Qt: Manage window sizes slightly better
Jeffrey Pfau jeffrey@endrift.com
Tue, 04 Oct 2016 10:36:31 -0700
4 files changed,
20 insertions(+),
1 deletions(-)
M
src/platform/qt/ConfigController.cpp
→
src/platform/qt/ConfigController.cpp
@@ -114,6 +114,7 @@ m_opts.rewindEnable = false;
m_opts.rewindBufferCapacity = 300; m_opts.useBios = true; m_opts.suspendScreensaver = true; + m_opts.lockAspectRatio = true; mCoreConfigLoad(&m_config); mCoreConfigLoadDefaults(&m_config, &m_opts); mCoreConfigMap(&m_config, &m_opts);
M
src/platform/qt/Display.cpp
→
src/platform/qt/Display.cpp
@@ -9,7 +9,11 @@ #include "DisplayGL.h"
#include "DisplayQt.h" extern "C" { +#ifdef M_CORE_GB #include "gb/video.h" +#elif defined(M_CORE_GBA) +#include "gba/video.h" +#endif } using namespace QGBA;@@ -55,7 +59,11 @@ , m_lockAspectRatio(false)
, m_filter(false) { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); +#ifdef M_CORE_GB setMinimumSize(GB_VIDEO_HORIZONTAL_PIXELS, GB_VIDEO_VERTICAL_PIXELS); +#elif defined(M_CORE_GBA) + setMinimumSize(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS); +#endif connect(&m_mouseTimer, SIGNAL(timeout()), this, SIGNAL(hideCursor())); m_mouseTimer.setSingleShot(true); m_mouseTimer.setInterval(MOUSE_DISAPPEAR_TIMER);
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -89,7 +89,9 @@ m_logo = m_logo; // Free memory left over in old pixmap
m_screenWidget->setMinimumSize(m_display->minimumSize()); m_screenWidget->setSizePolicy(m_display->sizePolicy()); - m_screenWidget->setSizeHint(m_display->minimumSize() * 2); +#ifdef M_CORE_GBA + m_screenWidget->setSizeHint(QSize(VIDEO_HORIZONTAL_PIXELS * 2, VIDEO_VERTICAL_PIXELS * 2)); +#endif m_screenWidget->setPixmap(m_logo); m_screenWidget->setLockAspectRatio(m_logo.width(), m_logo.height()); setCentralWidget(m_screenWidget);@@ -705,6 +707,7 @@ updateTitle();
unsigned width, height; context->core->desiredVideoDimensions(context->core, &width, &height); m_display->setMinimumSize(width, height); + m_screenWidget->setMinimumSize(m_display->minimumSize()); attachWidget(m_display); #ifndef Q_OS_MAC@@ -733,6 +736,12 @@ detachWidget(m_display);
m_screenWidget->setLockAspectRatio(m_logo.width(), m_logo.height()); m_screenWidget->setPixmap(m_logo); m_screenWidget->unsetCursor(); +#ifdef M_CORE_GB + m_display->setMinimumSize(GB_VIDEO_HORIZONTAL_PIXELS, GB_VIDEO_VERTICAL_PIXELS); +#elif defined(M_CORE_GBA) + m_display->setMinimumSize(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS); +#endif + m_screenWidget->setMinimumSize(m_display->minimumSize()); m_fpsTimer.stop(); m_focusCheck.stop();