From cac6ace1ff704f0ca7267ecb2268b84ecf688643 Mon Sep 17 00:00:00 2001 From: Xuefer Date: Mon, 1 Feb 2016 02:28:55 +0800 Subject: sort languages by display value Change-Id: I79d58fd680dd04161b89d42fed04a86a931defd3 Signed-off-by: Xuefer --- gui/pages.cpp | 3 +++ gui/pages.hpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/gui/pages.cpp b/gui/pages.cpp index 4a4c52361..cfe306773 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -36,6 +36,7 @@ #include "../partitions.hpp" #include +#include extern "C" { #include "../twcommon.h" @@ -1333,6 +1334,8 @@ void PageManager::LoadLanguageList(ZipArchive* package) { } else { LoadLanguageListDir(TWRES "languages/"); } + + std::sort(Language_List.begin(), Language_List.end()); } void PageManager::LoadLanguage(string filename) { diff --git a/gui/pages.hpp b/gui/pages.hpp index cf1afa1e9..927f3fc01 100644 --- a/gui/pages.hpp +++ b/gui/pages.hpp @@ -34,6 +34,11 @@ struct language_struct { std::string displayvalue; }; +inline bool operator < (const language_struct& language1, const language_struct& language2) +{ + return language1.displayvalue < language2.displayvalue; +} + extern std::vector Language_List; // Utility Functions -- cgit v1.2.3