mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	Merge pull request #3757 from zhaowenlan1779/game-list-fix
citra_qt: Improve Game List Item display
This commit is contained in:
		
						commit
						87d2866127
					
				
					 1 changed files with 20 additions and 4 deletions
				
			
		|  | @ -15,6 +15,7 @@ | ||||||
| #include <QStandardItem> | #include <QStandardItem> | ||||||
| #include <QString> | #include <QString> | ||||||
| #include "citra_qt/util/util.h" | #include "citra_qt/util/util.h" | ||||||
|  | #include "common/file_util.h" | ||||||
| #include "common/logging/log.h" | #include "common/logging/log.h" | ||||||
| #include "common/string_util.h" | #include "common/string_util.h" | ||||||
| #include "core/loader/smdh.h" | #include "core/loader/smdh.h" | ||||||
|  | @ -167,11 +168,26 @@ public: | ||||||
| 
 | 
 | ||||||
|     QVariant data(int role) const override { |     QVariant data(int role) const override { | ||||||
|         if (role == Qt::DisplayRole) { |         if (role == Qt::DisplayRole) { | ||||||
|             std::string filename; |             std::string path, filename, extension; | ||||||
|             Common::SplitPath(data(FullPathRole).toString().toStdString(), nullptr, &filename, |             Common::SplitPath(data(FullPathRole).toString().toStdString(), &path, &filename, | ||||||
|                               nullptr); |                               &extension); | ||||||
|             QString title = data(TitleRole).toString(); |             QString title = data(TitleRole).toString(); | ||||||
|             return QString::fromStdString(filename) + (title.isEmpty() ? "" : "\n    " + title); |             QString second_name = QString::fromStdString(filename + extension); | ||||||
|  |             static 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 = QString("%1-%2") | ||||||
|  |                                   .arg(data(ProgramIdRole).toULongLong(), 16, 16, QChar('0')) | ||||||
|  |                                   .toUpper() | ||||||
|  |                                   .arg(QString::fromStdString(filename)); | ||||||
|  |             } | ||||||
|  |             return title + (title.isEmpty() ? "" : "\n     ") + second_name; | ||||||
|         } else { |         } else { | ||||||
|             return GameListItem::data(role); |             return GameListItem::data(role); | ||||||
|         } |         } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue