Qt: Fix initial window size (fixes #766)

This commit is contained in:
Vicki Pfau 2017-06-30 11:24:50 -07:00
parent 4d3d579cae
commit b909575a6c
2 changed files with 11 additions and 6 deletions

View File

@ -150,6 +150,7 @@ Misc:
Bugfixes: Bugfixes:
- Qt: Fix memory search close button (fixes mgba.io/i/769) - Qt: Fix memory search close button (fixes mgba.io/i/769)
- Qt: Fix window icon being stretched - Qt: Fix window icon being stretched
- Qt: Fix initial window size (fixes mgba.io/i/766)
Misc: Misc:
- Qt: Add language selector - Qt: Add language selector

View File

@ -85,7 +85,11 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent)
m_screenWidget->setMinimumSize(m_display->minimumSize()); m_screenWidget->setMinimumSize(m_display->minimumSize());
m_screenWidget->setSizePolicy(m_display->sizePolicy()); m_screenWidget->setSizePolicy(m_display->sizePolicy());
int i = 2; #if defined(M_CORE_GBA)
float i = 2;
#elif defined(M_CORE_GB)
float i = 3;
#endif
QVariant multiplier = m_config->getOption("scaleMultiplier"); QVariant multiplier = m_config->getOption("scaleMultiplier");
if (!multiplier.isNull()) { if (!multiplier.isNull()) {
m_savedScale = multiplier.toInt(); m_savedScale = multiplier.toInt();
@ -119,8 +123,11 @@ Window::Window(ConfigController* config, int playerId, QWidget* parent)
m_controller->loadGame(output, path.second, path.first); m_controller->loadGame(output, path.second, path.first);
} }
}); });
#elif defined(M_CORE_GBA) #endif
m_screenWidget->setSizeHint(QSize(VIDEO_HORIZONTAL_PIXELS * i, VIDEO_VERTICAL_PIXELS * i)); #if defined(M_CORE_GBA)
resizeFrame(QSize(VIDEO_HORIZONTAL_PIXELS * i, VIDEO_VERTICAL_PIXELS * i));
#elif defined(M_CORE_GB)
resizeFrame(QSize(GB_VIDEO_HORIZONTAL_PIXELS * i, GB_VIDEO_VERTICAL_PIXELS * i));
#endif #endif
m_screenWidget->setPixmap(m_logo); m_screenWidget->setPixmap(m_logo);
m_screenWidget->setLockAspectRatio(m_logo.width(), m_logo.height()); m_screenWidget->setLockAspectRatio(m_logo.width(), m_logo.height());
@ -233,9 +240,6 @@ void Window::argumentsPassed(mArguments* args) {
void Window::resizeFrame(const QSize& size) { void Window::resizeFrame(const QSize& size) {
QSize newSize(size); QSize newSize(size);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
newSize /= m_screenWidget->devicePixelRatioF();
#endif
m_screenWidget->setSizeHint(newSize); m_screenWidget->setSizeHint(newSize);
newSize -= m_screenWidget->size(); newSize -= m_screenWidget->size();
newSize += this->size(); newSize += this->size();