QTfrontend/gameuiconfig.cpp
changeset 674 a15c8e3c69b3
parent 657 b34fc518a48a
child 883 07a568ba44e0
equal deleted inserted replaced
673:bd82104a28af 674:a15c8e3c69b3
    18 
    18 
    19 #include <QMessageBox>
    19 #include <QMessageBox>
    20 #include <QCheckBox>
    20 #include <QCheckBox>
    21 #include <QLineEdit>
    21 #include <QLineEdit>
    22 #include <QDesktopWidget>
    22 #include <QDesktopWidget>
       
    23 #include <QApplication>
    23 
    24 
    24 #include "gameuiconfig.h"
    25 #include "gameuiconfig.h"
    25 #include "hwform.h"
    26 #include "hwform.h"
    26 #include "pages.h"
    27 #include "pages.h"
    27 #include "hwconsts.h"
    28 #include "hwconsts.h"
    29 
    30 
    30 GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
    31 GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
    31 	: QSettings(fileName, QSettings::IniFormat)
    32 	: QSettings(fileName, QSettings::IniFormat)
    32 {
    33 {
    33 	Form = FormWidgets;
    34 	Form = FormWidgets;
       
    35 
       
    36 	Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
    34 
    37 
    35 	int t = Form->ui.pageOptions->CBResolution->findText(value("video/resolution").toString());
    38 	int t = Form->ui.pageOptions->CBResolution->findText(value("video/resolution").toString());
    36 	Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 0 : t);
    39 	Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 0 : t);
    37 	Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool());
    40 	Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool());
    38 
    41 
    50 	Form->ui.pageOptions->CBShowFPS->setChecked(value("fps/show", false).toBool());
    53 	Form->ui.pageOptions->CBShowFPS->setChecked(value("fps/show", false).toBool());
    51 	Form->ui.pageOptions->fpsedit->setValue(value("fps/interval", 27).toUInt());
    54 	Form->ui.pageOptions->fpsedit->setValue(value("fps/interval", 27).toUInt());
    52 
    55 
    53 	Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", false).toBool());
    56 	Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", false).toBool());
    54 
    57 
    55 	QDesktopWidget desktop;
    58 	depth = QApplication::desktop()->depth();
    56 	depth = desktop.depth();
       
    57 	if (depth < 16) depth = 16;
    59 	if (depth < 16) depth = 16;
    58 	else if (depth > 16) depth = 32;
    60 	else if (depth > 16) depth = 32;
    59 }
    61 }
    60 
    62 
    61 QStringList GameUIConfig::GetTeamsList()
    63 QStringList GameUIConfig::GetTeamsList()
    84 
    86 
    85 	setValue("fps/show", isShowFPSEnabled());
    87 	setValue("fps/show", isShowFPSEnabled());
    86 	setValue("fps/interval", Form->ui.pageOptions->fpsedit->value());
    88 	setValue("fps/interval", Form->ui.pageOptions->fpsedit->value());
    87 
    89 
    88 	setValue("misc/altdamage", isAltDamageEnabled());
    90 	setValue("misc/altdamage", isAltDamageEnabled());
       
    91 
       
    92 	setValue("window/width", Form->width());
       
    93 	setValue("window/height", Form->height());
    89 }
    94 }
    90 
    95 
    91 QRect GameUIConfig::vid_Resolution()
    96 QRect GameUIConfig::vid_Resolution()
    92 {
    97 {
    93 	QRect result(0, 0, 640, 480);
    98 	QRect result(0, 0, 640, 480);