diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index ada661bc40..8cffd84e58 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -78,6 +78,7 @@ DMainWindow::DMainWindow(QWidget* parent_widget) connect(m_ui->actionGitHub, SIGNAL(triggered()), this, SLOT(OnOpenGitHub())); connect(m_ui->actionSystemInfo, SIGNAL(triggered()), this, SLOT(OnOpenSystemInfo())); connect(m_ui->actionAbout, SIGNAL(triggered()), this, SLOT(OnOpenAbout())); + connect(m_ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(OnOpenAboutQt())); // Update GUI items emit CoreStateChanged(Core::CORE_UNINITIALIZED); @@ -92,6 +93,11 @@ DMainWindow::~DMainWindow() { } +void DMainWindow::closeEvent(QCloseEvent* ce) +{ + Stop(); +} + // Emulation void DMainWindow::StartGame(const QString filename) @@ -111,9 +117,15 @@ void DMainWindow::StartGame(const QString filename) m_ui->centralWidget->addWidget(m_render_widget.get()); m_ui->centralWidget->setCurrentWidget(m_render_widget.get()); - // TODO: When rendering to main, this won't resize the parent window... - m_render_widget->resize(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth, - SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight); + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderWindowAutoSize) + { + // Resize main window to fit render + m_render_widget->setMinimumSize(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth, + SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight); + qApp->processEvents(); // Force a redraw so the window has time to resize + m_render_widget->setMinimumSize(0, 0); // Allow the widget to scale down + } + m_render_widget->adjustSize(); } if (!BootManager::BootCore(filename.toStdString())) @@ -351,3 +363,8 @@ void DMainWindow::OnOpenAbout() DAboutDialog* dlg = new DAboutDialog(this); dlg->open(); } + +void DMainWindow::OnOpenAboutQt() +{ + QApplication::aboutQt(); +} diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h index f016bd3575..164e4528c5 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -58,11 +58,13 @@ private slots: void OnOpenGitHub(); void OnOpenSystemInfo(); void OnOpenAbout(); + void OnOpenAboutQt(); // Misc. void UpdateIcons(); private: + void closeEvent(QCloseEvent* ce); std::unique_ptr m_ui; DGameTracker* m_game_tracker; diff --git a/Source/Core/DolphinQt/MainWindow.ui b/Source/Core/DolphinQt/MainWindow.ui index 38f5a038e4..966486f29f 100644 --- a/Source/Core/DolphinQt/MainWindow.ui +++ b/Source/Core/DolphinQt/MainWindow.ui @@ -32,7 +32,7 @@ 0 0 990 - 24 + 19 @@ -218,17 +218,23 @@ - Play + &Play + + + F10 - Stop + &Stop + + + Esc - Reset + &Reset