Changed to full system name sorting for the system view and scraper selector.

This commit is contained in:
Leon Styhre 2020-08-24 18:51:55 +02:00
parent 77076c22f4
commit feb6577dbc
4 changed files with 16 additions and 1 deletions

View file

@ -63,6 +63,8 @@ GuiScraperMenu::GuiScraperMenu(Window* window) : GuiComponent(window),
mSystems->selectEntry(i) : mSystems->unselectEntry(i); mSystems->selectEntry(i) : mSystems->unselectEntry(i);
} }
} }
// Sort the systems by their full names.
mSystems->sortEntriesByName();
mMenu.addWithLabel("Systems", mSystems); mMenu.addWithLabel("Systems", mSystems);
addEntry("CONTENT SETTINGS", 0x777777FF, true, [this] { addEntry("CONTENT SETTINGS", 0x777777FF, true, [this] {

View file

@ -146,6 +146,10 @@ void SystemView::populate()
"OK", nullptr)); "OK", nullptr));
} }
} }
// Sort the systems by their full names.
std::sort(std::begin(mEntries), std::end(mEntries),
[](Entry a, Entry b) { return a.object->getFullName() < b.object->getFullName(); });
} }
void SystemView::goToSystem(SystemData* system, bool animate) void SystemView::goToSystem(SystemData* system, bool animate)

View file

@ -100,7 +100,8 @@ void ViewController::goToStart()
// Requested system doesn't exist. // Requested system doesn't exist.
Settings::getInstance()->setString("StartupSystem", ""); Settings::getInstance()->setString("StartupSystem", "");
} }
goToSystemView(SystemData::sSystemVector.at(0)); // Get the first system entry as sorted by full system names in SystemView.
goToSystemView(getSystemListView()->getFirst());
} }
void ViewController::ReloadAndGoToStart() void ViewController::ReloadAndGoToStart()

View file

@ -16,6 +16,8 @@
#include "Log.h" #include "Log.h"
#include "Window.h" #include "Window.h"
#include <algorithm>
// Used to display a list of options. // Used to display a list of options.
// Can select one or multiple options. // Can select one or multiple options.
@ -199,6 +201,12 @@ public:
onSelectedChanged(); onSelectedChanged();
} }
void sortEntriesByName()
{
std::sort(std::begin(mEntries), std::end(mEntries),
[](OptionListData a, OptionListData b) { return a.name < b.name; });
}
HelpStyle getHelpStyle() override { return mHelpStyle; }; HelpStyle getHelpStyle() override { return mHelpStyle; };
private: private: