Permalink
Browse files

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
  • Loading branch information...
leoetlino committed May 20, 2018
2 parents eae45e0 + c7f0c74 commit 0706add5840edcc7faeca538dafcd4f56cee7940
@@ -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();
@@ -46,6 +46,7 @@ class GeckoCodeWidget : public QWidget
void RemoveCode();
void DownloadCodes();
void SaveCodes();
void SortCodesLexicographically();
const UICommon::GameFile& m_game;
std::string m_game_id;
@@ -61,6 +62,7 @@ class GeckoCodeWidget : public QWidget
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;
};

0 comments on commit 0706add

Please sign in to comment.