From 3b18faa16330461dc5a19981f9297114497a900b Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Sat, 19 May 2018 17:21:26 +0800 Subject: [PATCH 1/3] citra_qt: Improve Game List Item display --- src/citra_qt/game_list_p.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/citra_qt/game_list_p.h b/src/citra_qt/game_list_p.h index d39281f59..914834131 100644 --- a/src/citra_qt/game_list_p.h +++ b/src/citra_qt/game_list_p.h @@ -15,6 +15,7 @@ #include #include #include "citra_qt/util/util.h" +#include "common/file_util.h" #include "common/logging/log.h" #include "common/string_util.h" #include "core/loader/smdh.h" @@ -167,11 +168,24 @@ public: QVariant data(int role) const override { if (role == Qt::DisplayRole) { - std::string filename; - Common::SplitPath(data(FullPathRole).toString().toStdString(), nullptr, &filename, - nullptr); + std::string path, filename, extension; + Common::SplitPath(data(FullPathRole).toString().toStdString(), &path, &filename, + &extension); QString title = data(TitleRole).toString(); - return QString::fromStdString(filename) + (title.isEmpty() ? "" : "\n " + title); + QString second_name = QString::fromStdString(filename + extension); + QRegExp installed_system_pattern( + QString::fromStdString( + FileUtil::GetUserPath(D_SDMC_IDX) + + "Nintendo " + "3DS/00000000000000000000000000000000/00000000000000000000000000000000/" + "title/000400(0|1)0/[0-9a-f]{8}/content/") + .replace("\\", "\\\\")); + if (installed_system_pattern.exactMatch(QString::fromStdString(path))) { + // Use a different mechanism for system / installed titles showing program ID + second_name = + "000" + QString::number(data(ProgramIdRole).toULongLong(), 16).toUpper(); + } + return title + (title.isEmpty() ? "" : "\n ") + second_name; } else { return GameListItem::data(role); } From e5c8b9f0a2c50202a8a6dd5dee373e7d85ec398b Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Wed, 23 May 2018 21:36:10 +0800 Subject: [PATCH 2/3] game_list: append filename after program ID --- src/citra_qt/game_list_p.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/citra_qt/game_list_p.h b/src/citra_qt/game_list_p.h index 914834131..c0a71df09 100644 --- a/src/citra_qt/game_list_p.h +++ b/src/citra_qt/game_list_p.h @@ -182,8 +182,9 @@ public: .replace("\\", "\\\\")); if (installed_system_pattern.exactMatch(QString::fromStdString(path))) { // Use a different mechanism for system / installed titles showing program ID - second_name = - "000" + QString::number(data(ProgramIdRole).toULongLong(), 16).toUpper(); + second_name = "000" + + QString::number(data(ProgramIdRole).toULongLong(), 16).toUpper() + + "-" + QString::fromStdString(filename); } return title + (title.isEmpty() ? "" : "\n ") + second_name; } else { From 9504aa19d53d1e4ebec23ef07031832938cd365f Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Sat, 26 May 2018 22:27:59 +0800 Subject: [PATCH 3/3] game_list: rewrite format --- src/citra_qt/game_list_p.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/citra_qt/game_list_p.h b/src/citra_qt/game_list_p.h index c0a71df09..1546709aa 100644 --- a/src/citra_qt/game_list_p.h +++ b/src/citra_qt/game_list_p.h @@ -173,7 +173,7 @@ public: &extension); QString title = data(TitleRole).toString(); QString second_name = QString::fromStdString(filename + extension); - QRegExp installed_system_pattern( + static QRegExp installed_system_pattern( QString::fromStdString( FileUtil::GetUserPath(D_SDMC_IDX) + "Nintendo " @@ -182,9 +182,10 @@ public: .replace("\\", "\\\\")); if (installed_system_pattern.exactMatch(QString::fromStdString(path))) { // Use a different mechanism for system / installed titles showing program ID - second_name = "000" + - QString::number(data(ProgramIdRole).toULongLong(), 16).toUpper() + - "-" + QString::fromStdString(filename); + second_name = QString("%1-%2") + .arg(data(ProgramIdRole).toULongLong(), 16, 16, QChar('0')) + .toUpper() + .arg(QString::fromStdString(filename)); } return title + (title.isEmpty() ? "" : "\n ") + second_name; } else {