correct restoring window size after fullscreen mode
authordisplacer
Thu, 07 Aug 2008 14:08:43 +0000
changeset 1165 40eeae82e70b
parent 1164 a241f6eb48be
child 1166 3d65497a391b
correct restoring window size after fullscreen mode
QTfrontend/gameuiconfig.cpp
QTfrontend/gameuiconfig.h
QTfrontend/hwform.cpp
--- a/QTfrontend/gameuiconfig.cpp	Thu Aug 07 13:39:04 2008 +0000
+++ b/QTfrontend/gameuiconfig.cpp	Thu Aug 07 14:08:43 2008 +0000
@@ -33,7 +33,8 @@
 {
 	Form = FormWidgets;
 
-	Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
+	//Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
+	resizeToConfigValues();
 
 	int t = Form->ui.pageOptions->CBResolution->findText(value("video/resolution").toString());
 	Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 0 : t);
@@ -74,6 +75,11 @@
 	return cleanedList;
 }
 
+void GameUIConfig::resizeToConfigValues()
+{
+  Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
+}
+
 void GameUIConfig::SaveOptions()
 {
 	setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText());
@@ -81,6 +87,12 @@
 	bool ffscr=isFrontendFullscreen();
 	setValue("video/frontendfullscreen", ffscr);
 	emit frontendFullscreen(ffscr);
+	if (!ffscr) {
+	  setValue("window/width", Form->width());
+	  setValue("window/height", Form->height());
+	} else {
+	  resizeToConfigValues();
+	}
 
 	setValue("audio/sound", isSoundEnabled());
 	setValue("audio/music", isMusicEnabled());
@@ -95,9 +107,6 @@
 	setValue("fps/interval", Form->ui.pageOptions->fpsedit->value());
 
 	setValue("misc/altdamage", isAltDamageEnabled());
-
-	setValue("window/width", Form->width());
-	setValue("window/height", Form->height());
 }
 
 QRect GameUIConfig::vid_Resolution()
--- a/QTfrontend/gameuiconfig.h	Thu Aug 07 13:39:04 2008 +0000
+++ b/QTfrontend/gameuiconfig.h	Thu Aug 07 14:08:43 2008 +0000
@@ -43,6 +43,7 @@
 	quint8 bitDepth();
 	QString netNick();
 	bool isFrontendFullscreen() const;
+	void resizeToConfigValues();
 
  signals:
 	void frontendFullscreen(bool value);
--- a/QTfrontend/hwform.cpp	Thu Aug 07 13:39:04 2008 +0000
+++ b/QTfrontend/hwform.cpp	Thu Aug 07 14:08:43 2008 +0000
@@ -132,7 +132,6 @@
 
 void HWForm::onFrontendFullscreen(bool value)
 {
-  qDebug() << "fullscreen = " << value;
   if (value)
     setWindowState(windowState() | Qt::WindowFullScreen);
   else {