summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2018-05-20 11:13:38 +0200
committerGitHub <noreply@github.com>2018-05-20 11:13:38 +0200
commit0706add5840edcc7faeca538dafcd4f56cee7940 (patch)
tree9d347bbbfb35ddae577c51d5dcb44b510c96a401 /Source
parenteae45e0e2cd50fc0dac1e1af938f3a4c33e50733 (diff)
parentc7f0c7484dd5fe0ff959551e9b08acfe6b71eb75 (diff)
Merge pull request #6699 from 404-Name-Not-Found/alphabetize-gecko-qt
Adds a toggleable function for sorting the gecko codes alphabetically to the gecko code menu
Diffstat (limited to 'Source')
-rwxr-xr-xSource/Core/DolphinQt2/Config/GeckoCodeWidget.cpp9
-rw-r--r--Source/Core/DolphinQt2/Config/GeckoCodeWidget.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/Source/Core/DolphinQt2/Config/GeckoCodeWidget.cpp b/Source/Core/DolphinQt2/Config/GeckoCodeWidget.cpp
index 6842385573..19d7de737a 100755
--- a/Source/Core/DolphinQt2/Config/GeckoCodeWidget.cpp
+++ b/Source/Core/DolphinQt2/Config/GeckoCodeWidget.cpp
@@ -66,6 +66,7 @@ void GeckoCodeWidget::CreateWidgets()
m_edit_code = new QPushButton(tr("&Edit Code..."));
m_remove_code = new QPushButton(tr("&Remove Code"));
m_download_codes = new QPushButton(tr("Download Codes"));
+ m_sort_codes = new QPushButton(tr("Sort Codes"));
m_download_codes->setToolTip(tr("Download Codes from the WiiRD Database"));
@@ -102,6 +103,7 @@ void GeckoCodeWidget::CreateWidgets()
btn_layout->addWidget(m_edit_code);
btn_layout->addWidget(m_remove_code);
btn_layout->addWidget(m_download_codes);
+ btn_layout->addWidget(m_sort_codes);
layout->addLayout(btn_layout);
@@ -118,6 +120,7 @@ void GeckoCodeWidget::ConnectWidgets()
connect(m_remove_code, &QPushButton::pressed, this, &GeckoCodeWidget::RemoveCode);
connect(m_edit_code, &QPushButton::pressed, this, &GeckoCodeWidget::EditCode);
connect(m_download_codes, &QPushButton::pressed, this, &GeckoCodeWidget::DownloadCodes);
+ connect(m_sort_codes, &QPushButton::pressed, this, &GeckoCodeWidget::SortCodesLexicographically);
connect(m_warning, &CheatWarningWidget::OpenCheatEnableSettings, this,
&GeckoCodeWidget::OpenGeneralSettings);
@@ -221,6 +224,12 @@ void GeckoCodeWidget::SaveCodes()
game_ini_local.Save(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
}
+void GeckoCodeWidget::SortCodesLexicographically()
+{
+ m_code_list->setSortingEnabled(!m_code_list->isSortingEnabled());
+ GeckoCodeWidget::UpdateList();
+}
+
void GeckoCodeWidget::UpdateList()
{
m_code_list->clear();
diff --git a/Source/Core/DolphinQt2/Config/GeckoCodeWidget.h b/Source/Core/DolphinQt2/Config/GeckoCodeWidget.h
index 8e0efcd698..4c13d10ba5 100644
--- a/Source/Core/DolphinQt2/Config/GeckoCodeWidget.h
+++ b/Source/Core/DolphinQt2/Config/GeckoCodeWidget.h
@@ -46,6 +46,7 @@ private:
void RemoveCode();
void DownloadCodes();
void SaveCodes();
+ void SortCodesLexicographically();
const UICommon::GameFile& m_game;
std::string m_game_id;
@@ -61,6 +62,7 @@ private:
QPushButton* m_edit_code;
QPushButton* m_remove_code;
QPushButton* m_download_codes;
+ QPushButton* m_sort_codes;
std::vector<Gecko::GeckoCode> m_gecko_codes;
bool m_restart_required;
};