Read/Write sort order to settings

Not written to disk atm.
This commit is contained in:
Bim 2013-07-02 23:14:33 +02:00
parent ded54a6884
commit ac51656527
2 changed files with 5 additions and 1 deletions

View file

@ -33,6 +33,8 @@ void Settings::setDefaults()
mBoolMap["WINDOWED"] = false;
mIntMap["DIMTIME"] = 30*1000;
mIntMap["GameListSortIndex"] = 0;
}
template <typename K, typename V>

View file

@ -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()