QTfrontend/gameuiconfig.cpp
changeset 1165 40eeae82e70b
parent 1162 91bf5e3e558d
child 1223 41d7283934c1
equal deleted inserted replaced
1164:a241f6eb48be 1165:40eeae82e70b
    31 GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
    31 GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
    32 	: QSettings(fileName, QSettings::IniFormat)
    32 	: QSettings(fileName, QSettings::IniFormat)
    33 {
    33 {
    34 	Form = FormWidgets;
    34 	Form = FormWidgets;
    35 
    35 
    36 	Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
    36 	//Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
       
    37 	resizeToConfigValues();
    37 
    38 
    38 	int t = Form->ui.pageOptions->CBResolution->findText(value("video/resolution").toString());
    39 	int t = Form->ui.pageOptions->CBResolution->findText(value("video/resolution").toString());
    39 	Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 0 : t);
    40 	Form->ui.pageOptions->CBResolution->setCurrentIndex((t < 0) ? 0 : t);
    40 	Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool());
    41 	Form->ui.pageOptions->CBFullscreen->setChecked(value("video/fullscreen", false).toBool());
    41 	bool ffscr=value("video/frontendfullscreen", false).toBool();
    42 	bool ffscr=value("video/frontendfullscreen", false).toBool();
    72 	  cleanedList.push_back(tmpTeamStr);
    73 	  cleanedList.push_back(tmpTeamStr);
    73 	}
    74 	}
    74 	return cleanedList;
    75 	return cleanedList;
    75 }
    76 }
    76 
    77 
       
    78 void GameUIConfig::resizeToConfigValues()
       
    79 {
       
    80   Form->resize(value("window/width", 640).toUInt(), value("window/height", 450).toUInt());
       
    81 }
       
    82 
    77 void GameUIConfig::SaveOptions()
    83 void GameUIConfig::SaveOptions()
    78 {
    84 {
    79 	setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText());
    85 	setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText());
    80 	setValue("video/fullscreen", vid_Fullscreen());
    86 	setValue("video/fullscreen", vid_Fullscreen());
    81 	bool ffscr=isFrontendFullscreen();
    87 	bool ffscr=isFrontendFullscreen();
    82 	setValue("video/frontendfullscreen", ffscr);
    88 	setValue("video/frontendfullscreen", ffscr);
    83 	emit frontendFullscreen(ffscr);
    89 	emit frontendFullscreen(ffscr);
       
    90 	if (!ffscr) {
       
    91 	  setValue("window/width", Form->width());
       
    92 	  setValue("window/height", Form->height());
       
    93 	} else {
       
    94 	  resizeToConfigValues();
       
    95 	}
    84 
    96 
    85 	setValue("audio/sound", isSoundEnabled());
    97 	setValue("audio/sound", isSoundEnabled());
    86 	setValue("audio/music", isMusicEnabled());
    98 	setValue("audio/music", isMusicEnabled());
    87 
    99 
    88 	setValue("net/nick", netNick());
   100 	setValue("net/nick", netNick());
    93 
   105 
    94 	setValue("fps/show", isShowFPSEnabled());
   106 	setValue("fps/show", isShowFPSEnabled());
    95 	setValue("fps/interval", Form->ui.pageOptions->fpsedit->value());
   107 	setValue("fps/interval", Form->ui.pageOptions->fpsedit->value());
    96 
   108 
    97 	setValue("misc/altdamage", isAltDamageEnabled());
   109 	setValue("misc/altdamage", isAltDamageEnabled());
    98 
       
    99 	setValue("window/width", Form->width());
       
   100 	setValue("window/height", Form->height());
       
   101 }
   110 }
   102 
   111 
   103 QRect GameUIConfig::vid_Resolution()
   112 QRect GameUIConfig::vid_Resolution()
   104 {
   113 {
   105 	QRect result(0, 0, 640, 480);
   114 	QRect result(0, 0, 640, 480);