From ac516565279b3b862ac8af325983b97c0ade01c9 Mon Sep 17 00:00:00 2001 From: Bim Date: Tue, 2 Jul 2013 23:14:33 +0200 Subject: [PATCH] Read/Write sort order to settings Not written to disk atm. --- src/Settings.cpp | 2 ++ src/components/GuiGameList.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Settings.cpp b/src/Settings.cpp index 52111668d..8319a3b8c 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -33,6 +33,8 @@ void Settings::setDefaults() mBoolMap["WINDOWED"] = false; mIntMap["DIMTIME"] = 30*1000; + + mIntMap["GameListSortIndex"] = 0; } template diff --git a/src/components/GuiGameList.cpp b/src/components/GuiGameList.cpp index 5aeda1106..a19fb2688 100644 --- a/src/components/GuiGameList.cpp +++ b/src/components/GuiGameList.cpp @@ -30,7 +30,7 @@ GuiGameList::GuiGameList(Window* window) : GuiComponent(window), mScreenshot(window), mDescription(window), mTransitionImage(window, 0, 0, "", Renderer::getScreenWidth(), Renderer::getScreenHeight(), true), - sortStateIndex(0) + sortStateIndex(Settings::getInstance()->getInt("GameListSortIndex")) { //first object initializes the vector if (sortStates.empty()) { @@ -247,6 +247,8 @@ void GuiGameList::setSortIndex(size_t index) sortStateIndex = index; sort(sortStates.at(sortStateIndex).comparisonFunction, sortStates.at(sortStateIndex).ascending); } + //save new index to settings + Settings::getInstance()->setInt("GameListSortIndex", sortStateIndex); } void GuiGameList::setNextSortIndex()