From 760a0be28ade95c461f7ba1cb1e9cb0cc0a628d4 Mon Sep 17 00:00:00 2001 From: spycrab Date: Sun, 13 May 2018 00:59:09 +0200 Subject: [PATCH] Qt/RenderWidget: Save position and size using QSettings --- Source/Core/DolphinQt2/MainWindow.cpp | 22 +++++----------------- Source/Core/DolphinQt2/MainWindow.h | 3 +-- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index b4cb6136ba..bf4ae88505 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -115,11 +115,8 @@ MainWindow::MainWindow(std::unique_ptr boot_parameters) : QMainW restoreState(settings.value(QStringLiteral("mainwindow/state")).toByteArray()); restoreGeometry(settings.value(QStringLiteral("mainwindow/geometry")).toByteArray()); - m_render_widget_size = - QSize(SConfig::GetInstance().iRenderWindowWidth, SConfig::GetInstance().iRenderWindowHeight); - m_render_widget_position = - QPoint(SConfig::GetInstance().iRenderWindowXPos, SConfig::GetInstance().iRenderWindowYPos); + m_render_widget_geometry = settings.value(QStringLiteral("renderwidget/geometry")).toByteArray(); } MainWindow::~MainWindow() @@ -132,11 +129,7 @@ MainWindow::~MainWindow() settings.setValue(QStringLiteral("mainwindow/state"), saveState()); settings.setValue(QStringLiteral("mainwindow/geometry"), saveGeometry()); - SConfig::GetInstance().iRenderWindowWidth = m_render_widget_size.width(); - SConfig::GetInstance().iRenderWindowHeight = m_render_widget_size.height(); - - SConfig::GetInstance().iRenderWindowXPos = m_render_widget_position.x(); - SConfig::GetInstance().iRenderWindowYPos = m_render_widget_position.y(); + settings.setValue(QStringLiteral("renderwidget/geometry"), m_render_widget_geometry); Config::Save(); } @@ -570,8 +563,7 @@ bool MainWindow::RequestStop() if (!m_render_widget->isFullScreen()) { - m_render_widget_size = m_render_widget->size(); - m_render_widget_position = m_render_widget->pos(); + m_render_widget_geometry = m_render_widget->saveGeometry(); } if (SConfig::GetInstance().bConfirmStop) @@ -655,8 +647,7 @@ void MainWindow::FullScreen() } else { - m_render_widget_size = m_render_widget->size(); - m_render_widget_position = m_render_widget->pos(); + m_render_widget_geometry = m_render_widget->saveGeometry(); m_render_widget->showFullScreen(); } } @@ -756,10 +747,7 @@ void MainWindow::ShowRenderWidget() m_rendering_to_main = false; m_render_widget->showNormal(); - m_render_widget->resize(m_render_widget_size); - - if (m_render_widget_position.x() != -1) - m_render_widget->move(m_render_widget_position); + m_render_widget->restoreGeometry(m_render_widget_geometry); } SetFullScreenResolution(false); diff --git a/Source/Core/DolphinQt2/MainWindow.h b/Source/Core/DolphinQt2/MainWindow.h index 43b3a98256..3b76e27146 100644 --- a/Source/Core/DolphinQt2/MainWindow.h +++ b/Source/Core/DolphinQt2/MainWindow.h @@ -195,6 +195,5 @@ private: RegisterWidget* m_register_widget; WatchWidget* m_watch_widget; CheatsManager* m_cheats_manager; - QSize m_render_widget_size; - QPoint m_render_widget_position; + QByteArray m_render_widget_geometry; };