From c7f0c7484dd5fe0ff959551e9b08acfe6b71eb75 Mon Sep 17 00:00:00 2001 From: Justin Futrell Date: Sun, 20 May 2018 11:04:30 +0200 Subject: [PATCH] GeckoCodeWidget: Add a Sort button --- Source/Core/DolphinQt2/Config/GeckoCodeWidget.cpp | 9 +++++++++ Source/Core/DolphinQt2/Config/GeckoCodeWidget.h | 2 ++ 2 files changed, 11 insertions(+) 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 m_gecko_codes; bool m_restart_required; };