mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-26 09:02:44 -06:00
Game list: save and load column sizes, sort order, to QSettings
This commit is contained in:
parent
797b91a449
commit
0fae76c741
3 changed files with 24 additions and 0 deletions
|
@ -100,6 +100,23 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan)
|
||||||
current_worker = std::move(worker);
|
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)
|
void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, bool deep_scan)
|
||||||
{
|
{
|
||||||
const auto callback = [&](const std::string& directory,
|
const auto callback = [&](const std::string& directory,
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
|
#include <QSettings>
|
||||||
#include <QStandardItem>
|
#include <QStandardItem>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
@ -30,6 +31,9 @@ public:
|
||||||
|
|
||||||
void PopulateAsync(const QString& dir_path, bool deep_scan);
|
void PopulateAsync(const QString& dir_path, bool deep_scan);
|
||||||
|
|
||||||
|
void SaveInterfaceLayout(QSettings& settings);
|
||||||
|
void LoadInterfaceLayout(QSettings& settings);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void AddEntry(QList<QStandardItem*> entry_items);
|
void AddEntry(QList<QStandardItem*> entry_items);
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,8 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
|
||||||
microProfileDialog->setVisible(settings.value("microProfileDialogVisible").toBool());
|
microProfileDialog->setVisible(settings.value("microProfileDialogVisible").toBool());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
game_list->LoadInterfaceLayout(settings);
|
||||||
|
|
||||||
ui.action_Use_Hardware_Renderer->setChecked(Settings::values.use_hw_renderer);
|
ui.action_Use_Hardware_Renderer->setChecked(Settings::values.use_hw_renderer);
|
||||||
SetHardwareRendererEnabled(ui.action_Use_Hardware_Renderer->isChecked());
|
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("singleWindowMode", ui.action_Single_Window_Mode->isChecked());
|
||||||
settings.setValue("displayTitleBars", ui.actionDisplay_widget_title_bars->isChecked());
|
settings.setValue("displayTitleBars", ui.actionDisplay_widget_title_bars->isChecked());
|
||||||
settings.setValue("firstStart", false);
|
settings.setValue("firstStart", false);
|
||||||
|
game_list->SaveInterfaceLayout(settings);
|
||||||
SaveHotkeys(settings);
|
SaveHotkeys(settings);
|
||||||
|
|
||||||
// Shutdown session if the emu thread is active...
|
// Shutdown session if the emu thread is active...
|
||||||
|
|
Loading…
Reference in a new issue