--- a/QTfrontend/gameuiconfig.cpp Sun Dec 16 15:58:29 2007 +0000
+++ b/QTfrontend/gameuiconfig.cpp Sun Dec 16 16:21:42 2007 +0000
@@ -20,6 +20,7 @@
#include <QCheckBox>
#include <QLineEdit>
#include <QDesktopWidget>
+#include <QApplication>
#include "gameuiconfig.h"
#include "hwform.h"
@@ -32,6 +33,8 @@
{
Form = FormWidgets;
+ Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
+
int t = Form->ui.pageOptions->CBResolution->findText(value("video/resolution").toString());
Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 0 : t);
Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool());
@@ -52,8 +55,7 @@
Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", false).toBool());
- QDesktopWidget desktop;
- depth = desktop.depth();
+ depth = QApplication::desktop()->depth();
if (depth < 16) depth = 16;
else if (depth > 16) depth = 32;
}
@@ -86,6 +88,9 @@
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/hwform.cpp Sun Dec 16 15:58:29 2007 +0000
+++ b/QTfrontend/hwform.cpp Sun Dec 16 16:21:42 2007 +0000
@@ -32,6 +32,7 @@
#include <QLabel>
#include <QRadioButton>
#include <QSpinBox>
+#include <QCloseEvent>
#include "hwform.h"
#include "game.h"
@@ -605,3 +606,9 @@
game->StartNet();
}
+
+void HWForm::closeEvent(QCloseEvent *event)
+{
+ config->SaveOptions();
+ event->accept();
+}
--- a/QTfrontend/hwform.h Sun Dec 16 15:58:29 2007 +0000
+++ b/QTfrontend/hwform.h Sun Dec 16 16:21:42 2007 +0000
@@ -32,6 +32,7 @@
class HWNewNet;
class GameUIConfig;
class HWNetRegisterServer;
+class QCloseEvent;
class HWForm : public QMainWindow
{
@@ -85,6 +86,7 @@
void _NetConnect(const QString & hostName, quint16 port, const QString & nick);
void UpdateTeamsLists(const QStringList* editable_teams=0);
void CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget);
+ void closeEvent(QCloseEvent *event);
enum PageIDs {
ID_PAGE_SIMPLEGAME = 0,
ID_PAGE_SETUP_TEAM = 1,