From 6474616c8310a9f2bd42a49e84fbe15e0ae69e1d Mon Sep 17 00:00:00 2001 From: Simon McFarlane Date: Sat, 2 May 2015 23:18:10 -0700 Subject: [PATCH 1/4] Qt: Prevent crash when closed by the window manager --- Source/Core/DolphinQt/MainWindow.cpp | 5 +++++ Source/Core/DolphinQt/MainWindow.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index e00a35e5e1..ec619ef22b 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -92,6 +92,11 @@ DMainWindow::~DMainWindow() { } +void DMainWindow::closeEvent(QCloseEvent* ce) +{ + Stop(); +} + // Emulation void DMainWindow::StartGame(const QString filename) diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h index 3808f77e9c..e2ef64f93c 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -63,6 +63,7 @@ private slots: void UpdateIcons(); private: + void closeEvent(QCloseEvent* ce); std::unique_ptr m_ui; DGameTracker* m_game_tracker; From 406270bcf999085fc5aa67159e252ddf813f4c40 Mon Sep 17 00:00:00 2001 From: Simon McFarlane Date: Sat, 2 May 2015 23:59:40 -0700 Subject: [PATCH 2/4] Qt: resize main window to fit render --- Source/Core/DolphinQt/MainWindow.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index ec619ef22b..9a9e2d483f 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -116,9 +116,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())) From 64cf6d167f1f6dacdf33b213a16774b324b741de Mon Sep 17 00:00:00 2001 From: Simon McFarlane Date: Sun, 3 May 2015 15:05:25 -0700 Subject: [PATCH 3/4] Qt: Make 'About Qt' action actually open the about box --- Source/Core/DolphinQt/MainWindow.cpp | 6 ++++++ Source/Core/DolphinQt/MainWindow.h | 1 + 2 files changed, 7 insertions(+) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 9a9e2d483f..9bc9272a25 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); @@ -362,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 e2ef64f93c..6e44ce8d9b 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -58,6 +58,7 @@ private slots: void OnOpenGitHub(); void OnOpenSystemInfo(); void OnOpenAbout(); + void OnOpenAboutQt(); // Misc. void UpdateIcons(); From 66e337a19fad20561a004ecb326b65848fbb41ad Mon Sep 17 00:00:00 2001 From: Simon McFarlane Date: Mon, 4 May 2015 20:10:03 -0700 Subject: [PATCH 4/4] Qt: add proper keyboard shortcuts from wx --- Source/Core/DolphinQt/MainWindow.ui | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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