# HG changeset patch # User unc0rr # Date 1197822102 0 # Node ID a15c8e3c69b39363522dc89da1c14fc5c924b918 # Parent bd82104a28afd88876e207ed3894a531c0fc7551 Save and restore window size diff -r bd82104a28af -r a15c8e3c69b3 QTfrontend/gameuiconfig.cpp --- 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 #include #include +#include #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() diff -r bd82104a28af -r a15c8e3c69b3 QTfrontend/hwform.cpp --- 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 #include #include +#include #include "hwform.h" #include "game.h" @@ -605,3 +606,9 @@ game->StartNet(); } + +void HWForm::closeEvent(QCloseEvent *event) +{ + config->SaveOptions(); + event->accept(); +} diff -r bd82104a28af -r a15c8e3c69b3 QTfrontend/hwform.h --- 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,