From 0e29286856653bce1e73a1e409cfd422146d7808 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Sat, 22 Jun 2013 19:15:13 +0200 Subject: [PATCH] fix custom resolution maximum --- apps/launcher/graphicspage.cpp | 17 ++++++++++++++++- apps/launcher/graphicspage.hpp | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 700ba3db9c..d9e10e764a 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -35,7 +35,7 @@ GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, GraphicsSettings &g setupUi(this); // Set the maximum res we can set in windowed mode - QRect res = QApplication::desktop()->screenGeometry(); + QRect res = getMaximumResolution(); customWidthSpinBox->setMaximum(res.width()); customHeightSpinBox->setMaximum(res.height()); @@ -289,6 +289,21 @@ QStringList GraphicsPage::getAvailableResolutions(Ogre::RenderSystem *renderer) return result; } +QRect GraphicsPage::getMaximumResolution() +{ + QRect max, res; + int i, screens = QApplication::desktop()->screenCount(); + for (i = 0; i < screens; i++) + { + res = QApplication::desktop()->screenGeometry(i); + if (res.width() > max.width()) + max.setWidth(res.width()); + if (res.height() > max.height()) + max.setHeight(res.height()); + } + return max; +} + void GraphicsPage::rendererChanged(const QString &renderer) { mSelectedRenderSystem = mOgre->getRenderSystemByName(renderer.toStdString()); diff --git a/apps/launcher/graphicspage.hpp b/apps/launcher/graphicspage.hpp index 21039af430..37f56d2bb6 100644 --- a/apps/launcher/graphicspage.hpp +++ b/apps/launcher/graphicspage.hpp @@ -56,6 +56,7 @@ private: QStringList getAvailableOptions(const QString &key, Ogre::RenderSystem *renderer); QStringList getAvailableResolutions(Ogre::RenderSystem *renderer); + QRect getMaximumResolution(); void loadSettings();