mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Qt: sort core association list case-insensitively
This commit is contained in:
parent
3d9e7f2c60
commit
325d30f062
@ -156,6 +156,11 @@ inline static bool comp_hash_ui_display_name_key_lower(const QHash<QString, QStr
|
|||||||
return lhs.value("ui_display_name").toLower() < rhs.value("ui_display_name").toLower();
|
return lhs.value("ui_display_name").toLower() < rhs.value("ui_display_name").toLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline static bool comp_hash_name_key_lower(const QHash<QString, QString> &lhs, const QHash<QString, QString> &rhs)
|
||||||
|
{
|
||||||
|
return lhs.value("name").toLower() < rhs.value("name").toLower();
|
||||||
|
}
|
||||||
|
|
||||||
inline static bool comp_hash_label_key_lower(const QHash<QString, QString> &lhs, const QHash<QString, QString> &rhs)
|
inline static bool comp_hash_label_key_lower(const QHash<QString, QString> &lhs, const QHash<QString, QString> &rhs)
|
||||||
{
|
{
|
||||||
return lhs.value("label").toLower() < rhs.value("label").toLower();
|
return lhs.value("label").toLower() < rhs.value("label").toLower();
|
||||||
@ -1979,13 +1984,14 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
|
|||||||
|
|
||||||
{
|
{
|
||||||
QMapIterator<QString, const core_info_t*> coreListIterator(coreList);
|
QMapIterator<QString, const core_info_t*> coreListIterator(coreList);
|
||||||
|
QVector<QHash<QString, QString> > cores;
|
||||||
|
|
||||||
while (coreListIterator.hasNext())
|
while (coreListIterator.hasNext())
|
||||||
{
|
{
|
||||||
QString key;
|
QString key;
|
||||||
const core_info_t *core = NULL;
|
const core_info_t *core = NULL;
|
||||||
QAction *action = NULL;
|
|
||||||
QString name;
|
QString name;
|
||||||
|
QHash<QString, QString> hash;
|
||||||
|
|
||||||
coreListIterator.next();
|
coreListIterator.next();
|
||||||
|
|
||||||
@ -2000,8 +2006,20 @@ void MainWindow::onPlaylistWidgetContextMenuRequested(const QPoint&)
|
|||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
action = associateMenu->addAction(name);
|
hash["name"] = name;
|
||||||
action->setProperty("core_path", core->path);
|
hash["core_path"] = core->path;
|
||||||
|
|
||||||
|
cores.append(hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::sort(cores.begin(), cores.end(), comp_hash_name_key_lower);
|
||||||
|
|
||||||
|
for (j = 0; j < cores.count(); j++)
|
||||||
|
{
|
||||||
|
const QHash<QString, QString> &hash = cores.at(j);
|
||||||
|
QAction *action = associateMenu->addAction(hash.value("name"));
|
||||||
|
|
||||||
|
action->setProperty("core_path", hash.value("core_path"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user