From 0fae76c741b84cfe6d31a9079b818866778dfa31 Mon Sep 17 00:00:00 2001 From: archshift Date: Sun, 6 Sep 2015 23:51:57 -0700 Subject: Game list: save and load column sizes, sort order, to QSettings --- src/citra_qt/game_list.cpp | 17 +++++++++++++++++ src/citra_qt/game_list.h | 4 ++++ src/citra_qt/main.cpp | 3 +++ 3 files changed, 24 insertions(+) (limited to 'src') diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index f90e05374..dade3c212 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp @@ -100,6 +100,23 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) current_worker = std::move(worker); } +void GameList::SaveInterfaceLayout(QSettings& settings) +{ + settings.beginGroup("UILayout"); + settings.setValue("gameListHeaderState", tree_view->header()->saveState()); + settings.endGroup(); +} + +void GameList::LoadInterfaceLayout(QSettings& settings) +{ + auto header = tree_view->header(); + settings.beginGroup("UILayout"); + header->restoreState(settings.value("gameListHeaderState").toByteArray()); + settings.endGroup(); + + item_model->sort(header->sortIndicatorSection(), header->sortIndicatorOrder()); +} + void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, bool deep_scan) { const auto callback = [&](const std::string& directory, diff --git a/src/citra_qt/game_list.h b/src/citra_qt/game_list.h index ab09edce3..0950d9622 100644 --- a/src/citra_qt/game_list.h +++ b/src/citra_qt/game_list.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include #include #include @@ -30,6 +31,9 @@ public: void PopulateAsync(const QString& dir_path, bool deep_scan); + void SaveInterfaceLayout(QSettings& settings); + void LoadInterfaceLayout(QSettings& settings); + public slots: void AddEntry(QList entry_items); diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index c5e338c91..298649aaf 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -141,6 +141,8 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) microProfileDialog->setVisible(settings.value("microProfileDialogVisible").toBool()); settings.endGroup(); + game_list->LoadInterfaceLayout(settings); + ui.action_Use_Hardware_Renderer->setChecked(Settings::values.use_hw_renderer); SetHardwareRendererEnabled(ui.action_Use_Hardware_Renderer->isChecked()); @@ -490,6 +492,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) { settings.setValue("singleWindowMode", ui.action_Single_Window_Mode->isChecked()); settings.setValue("displayTitleBars", ui.actionDisplay_widget_title_bars->isChecked()); settings.setValue("firstStart", false); + game_list->SaveInterfaceLayout(settings); SaveHotkeys(settings); // Shutdown session if the emu thread is active... -- cgit v1.2.3