Permalink
Browse files

Qt/RenderWidget: Save position and size using QSettings

  • Loading branch information...
spycrab committed May 12, 2018
1 parent be0f4f7 commit 760a0be28ade95c461f7ba1cb1e9cb0cc0a628d4
Showing with 6 additions and 19 deletions.
  1. +5 −17 Source/Core/DolphinQt2/MainWindow.cpp
  2. +1 −2 Source/Core/DolphinQt2/MainWindow.h
@@ -115,11 +115,8 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> 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);
@@ -195,6 +195,5 @@ class MainWindow final : public QMainWindow
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;
};

0 comments on commit 760a0be

Please sign in to comment.