This commit is contained in:
Nayla Hanegan 2023-05-26 15:52:58 -04:00
parent 7d8fe0f105
commit 871da4e307
No known key found for this signature in database
GPG key ID: BAFE9001DA16CFA2
275 changed files with 33002 additions and 27474 deletions

View file

@ -3,6 +3,7 @@
#include "DolphinQt/Config/GeckoCodeWidget.h"
#include <algorithm>
#include <utility>
#include <QCursor>
@ -257,6 +258,8 @@ void GeckoCodeWidget::OnContextMenuRequested()
QMenu menu;
menu.addAction(tr("Sort Alphabetically"), this, &GeckoCodeWidget::SortAlphabetically);
menu.addAction(tr("Show Enabled Codes First"), this, &GeckoCodeWidget::SortEnabledCodesFirst);
menu.addAction(tr("Show Disabled Codes First"), this, &GeckoCodeWidget::SortDisabledCodesFirst);
menu.exec(QCursor::pos());
}
@ -267,6 +270,26 @@ void GeckoCodeWidget::SortAlphabetically()
OnListReordered();
}
void GeckoCodeWidget::SortEnabledCodesFirst()
{
std::stable_sort(m_gecko_codes.begin(), m_gecko_codes.end(), [](const auto& a, const auto& b) {
return a.enabled && a.enabled != b.enabled;
});
UpdateList();
SaveCodes();
}
void GeckoCodeWidget::SortDisabledCodesFirst()
{
std::stable_sort(m_gecko_codes.begin(), m_gecko_codes.end(), [](const auto& a, const auto& b) {
return !a.enabled && a.enabled != b.enabled;
});
UpdateList();
SaveCodes();
}
void GeckoCodeWidget::OnListReordered()
{
// Reorder codes based on the indices of table item