QTfrontend/gameuiconfig.cpp
changeset 297 279e10ec31b4
parent 184 f97a7a3dc8f6
child 301 29bf9c1a3ad3
--- a/QTfrontend/gameuiconfig.cpp	Sun Dec 10 18:13:10 2006 +0000
+++ b/QTfrontend/gameuiconfig.cpp	Sun Dec 10 18:57:05 2006 +0000
@@ -22,6 +22,7 @@
 #include "hwform.h"
 #include "pages.h"
 #include "hwconsts.h"
+#include "fpsedit.h"
 
 GameUIConfig::GameUIConfig(HWForm * FormWidgets)
 	: QObject()
@@ -58,6 +59,14 @@
 			if (str.startsWith("ip "))
 			{
 				Form->ui.pageNet->editIP->setText(str.mid(3));
+			} else
+			if (str.startsWith("showfps "))
+			{
+				Form->ui.pageOptions->CBShowFPS->setChecked(str.mid(8).toLong());
+			} else
+			if (str.startsWith("interval "))
+			{
+				Form->ui.pageOptions->fpsedit->setValue(str.mid(9).toUInt());
 			}
 		}
 		settings.close();
@@ -102,11 +111,13 @@
 	QTextStream stream(&settings);
 	stream.setCodec("UTF-8");
 	stream << "; Generated by Hedgewars, do not modify" << endl;
-	stream << "resolution " << Form->ui.pageOptions->CBResolution->currentIndex() << endl;
-	stream << "fullscreen " << Form->ui.pageOptions->CBFullscreen->isChecked() << endl;
-	stream << "sound " << Form->ui.pageOptions->CBEnableSound->isChecked() << endl;
+	stream << "resolution " << vid_Resolution() << endl;
+	stream << "fullscreen " << vid_Fullscreen() << endl;
+	stream << "sound " << isSoundEnabled() << endl;
 	stream << "nick " << Form->ui.pageNet->editNetNick->text() << endl;
 	stream << "ip " << Form->ui.pageNet->editIP->text() << endl;
+	stream << "showfps " << isShowFPSEnabled() << endl;
+	stream << "interval " << Form->ui.pageOptions->fpsedit->value() << endl;
 	settings.close();
 }
 
@@ -125,6 +136,16 @@
 	return Form->ui.pageOptions->CBEnableSound->isChecked();
 }
 
+bool GameUIConfig::isShowFPSEnabled()
+{
+	return Form->ui.pageOptions->CBShowFPS->isChecked();
+}
+
+quint8 GameUIConfig::timerInterval()
+{
+	return 35 - Form->ui.pageOptions->fpsedit->value();
+}
+
 QString GameUIConfig::GetRandomTheme()
 {
 	return (Themes.size() > 0) ? Themes[rand() % Themes.size()] : QString("steel");