diff options
| author | spxtr <spextear@gmail.com> | 2015-12-20 15:36:39 -0800 |
|---|---|---|
| committer | spxtr <spextear@gmail.com> | 2015-12-20 15:36:39 -0800 |
| commit | 3a4a60f937373f48324328f3f5580b8ffcf2aeed (patch) | |
| tree | 3abc2e5cecf5a456e6fe6fe8bc05051fed8e162d /Source/Core/DolphinQt2/MainWindow.cpp | |
| parent | 2842897d55d4d6dbf75fd7f6827d440377d00fb7 (diff) | |
Use a separate INI file for UI settings.
Diffstat (limited to 'Source/Core/DolphinQt2/MainWindow.cpp')
| -rw-r--r-- | Source/Core/DolphinQt2/MainWindow.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index 865253c131..9431d02218 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -11,13 +11,12 @@ #include <QMenu> #include <QMessageBox> -#include "Common/FileUtil.h" #include "Core/BootManager.h" -#include "Core/ConfigManager.h" #include "Core/Core.h" #include "DolphinQt2/Host.h" #include "DolphinQt2/MainWindow.h" #include "DolphinQt2/Resources.h" +#include "DolphinQt2/Settings.h" #include "DolphinQt2/GameList/GameListModel.h" MainWindow::MainWindow() : QMainWindow(nullptr) @@ -107,12 +106,12 @@ void MainWindow::Browse() QDir::currentPath()); if (!dir.isEmpty()) { - std::vector<std::string>& iso_folders = SConfig::GetInstance().m_ISOFolder; - auto found = std::find(iso_folders.begin(), iso_folders.end(), dir.toStdString()); - if (found == iso_folders.end()) + Settings settings; + QStringList iso_folders = settings.GetPaths(); + if (!iso_folders.contains(dir)) { - iso_folders.push_back(dir.toStdString()); - SConfig::GetInstance().SaveSettings(); + iso_folders << dir; + settings.SetPaths(iso_folders); emit m_game_list->DirectoryAdded(dir); } } @@ -138,8 +137,8 @@ void MainWindow::Play() } else { - QString path = QString::fromStdString(SConfig::GetInstance().m_LastFilename); - if (QFile::exists(path)) + QString path = Settings().GetLastGame(); + if (!path.isEmpty() && QFile::exists(path)) StartGame(path); else Open(); @@ -156,7 +155,7 @@ void MainWindow::Pause() bool MainWindow::Stop() { bool stop = true; - if (SConfig::GetInstance().bConfirmStop) + if (Settings().GetConfirmStop()) { // We could pause the game here and resume it if they say no. QMessageBox::StandardButton confirm; @@ -180,7 +179,7 @@ void MainWindow::ForceStop() void MainWindow::FullScreen() { // If the render widget is fullscreen we want to reset it to whatever is in - // SConfig. If it's set to be fullscreen then it just remakes the window, + // settings. If it's set to be fullscreen then it just remakes the window, // which probably isn't ideal. bool was_fullscreen = m_render_widget->isFullScreen(); HideRenderWidget(); @@ -209,13 +208,15 @@ void MainWindow::StartGame(QString path) QMessageBox::critical(this, tr("Error"), tr("Failed to init core"), QMessageBox::Ok); return; } + Settings().SetLastGame(path); ShowRenderWidget(); emit EmulationStarted(); } void MainWindow::ShowRenderWidget() { - if (SConfig::GetInstance().bRenderToMain) + Settings settings; + if (settings.GetRenderToMain()) { // If we're rendering to main, add it to the stack and update our title when necessary. m_rendering_to_main = true; @@ -226,15 +227,13 @@ void MainWindow::ShowRenderWidget() { // Otherwise, just show it. m_rendering_to_main = false; - if (SConfig::GetInstance().bFullscreen) + if (settings.GetFullScreen()) { m_render_widget->showFullScreen(); } else { - m_render_widget->setFixedSize( - SConfig::GetInstance().iRenderWindowWidth, - SConfig::GetInstance().iRenderWindowHeight); + m_render_widget->setFixedSize(settings.GetRenderWindowSize()); m_render_widget->showNormal(); } } |
