QTfrontend/gameuiconfig.cpp
changeset 8354 c25bee85d6f8
parent 8350 14b938faec69
child 8358 274afc318dca
--- a/QTfrontend/gameuiconfig.cpp	Thu Jan 03 15:58:23 2013 +0200
+++ b/QTfrontend/gameuiconfig.cpp	Thu Jan 03 15:59:30 2013 +0200
@@ -24,6 +24,7 @@
 #include <QStandardItemModel>
 #include <QNetworkProxy>
 #include <QNetworkProxyFactory>
+#include <utility>
 
 #include "gameuiconfig.h"
 #include "hwform.h"
@@ -352,22 +353,28 @@
     return Form->ui.pageOptions->CBLanguage->itemData(Form->ui.pageOptions->CBLanguage->currentIndex()).toString();
 }
 
+std::pair<QRect, QRect> GameUIConfig::vid_ResolutionPair() {
+    // returns a pair of both the fullscreen and the windowed resolution
+    QRect full(0, 0, 640, 480);
+    QRect windowed(0, 0, 640, 480);
+    QStringList wh = Form->ui.pageOptions->CBResolution->currentText().split('x');
+    if (wh.size() == 2)
+    {
+        full.setWidth(wh[0].toInt());
+        full.setHeight(wh[1].toInt());
+    }
+    windowed.setWidth(Form->ui.pageOptions->windowWidthEdit->text().toInt());
+    windowed.setHeight(Form->ui.pageOptions->windowHeightEdit->text().toInt());
+    return std::make_pair(full, windowed);
+}
+
 QRect GameUIConfig::vid_Resolution()
 {
-    QRect result(0, 0, 640, 480);
-    if(Form->ui.pageOptions->CBFullscreen->isChecked()) {
-        QStringList wh = Form->ui.pageOptions->CBResolution->currentText().split('x');
-        if (wh.size() == 2)
-        {
-            result.setWidth(wh[0].toInt());
-            result.setHeight(wh[1].toInt());
-        }
-    }
-    else {
-        result.setWidth(Form->ui.pageOptions->windowWidthEdit->text().toInt());
-        result.setHeight(Form->ui.pageOptions->windowHeightEdit->text().toInt());
-    }
-    return result;
+    std::pair<QRect, QRect> result = vid_ResolutionPair();
+    if(Form->ui.pageOptions->CBFullscreen->isChecked())
+        return result.first;
+    else 
+        return result.second;
 }
 
 bool GameUIConfig::vid_Fullscreen()