From 04de0647326d9521b350c451508491cf6f190c13 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Mon, 11 May 2015 10:51:11 +0200 Subject: [PATCH] DolphinQt: Use short GC game titles in grid view Short titles fit better than long titles. --- Source/Core/DolphinQt/GameList/GameFile.cpp | 25 ++++++++++++--------- Source/Core/DolphinQt/GameList/GameFile.h | 7 +++--- Source/Core/DolphinQt/GameList/GameGrid.cpp | 2 +- Source/Core/DolphinQt/GameList/GameTree.cpp | 2 +- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/Source/Core/DolphinQt/GameList/GameFile.cpp b/Source/Core/DolphinQt/GameList/GameFile.cpp index 67faf56d0e..85efd8f4e9 100644 --- a/Source/Core/DolphinQt/GameList/GameFile.cpp +++ b/Source/Core/DolphinQt/GameList/GameFile.cpp @@ -25,7 +25,7 @@ #include "DolphinQt/Utils/Resources.h" #include "DolphinQt/Utils/Utils.h" -static const u32 CACHE_REVISION = 0x009; +static const u32 CACHE_REVISION = 0x00A; static const u32 DATASTREAM_REVISION = 15; // Introduced in Qt 5.2 static QMap ConvertLocalizedStrings(std::map strings) @@ -87,7 +87,8 @@ GameFile::GameFile(const QString& fileName) { m_platform = volume->GetVolumeType(); - m_names = ConvertLocalizedStrings(volume->GetNames(true)); + m_short_names = ConvertLocalizedStrings(volume->GetNames(false)); + m_long_names = ConvertLocalizedStrings(volume->GetNames(true)); m_descriptions = ConvertLocalizedStrings(volume->GetDescriptions()); m_company = QString::fromStdString(volume->GetCompany()); @@ -165,10 +166,12 @@ bool GameFile::LoadFromCache() u32 country; u32 platform; - QMap names; + QMap short_names; + QMap long_names; QMap descriptions; stream >> m_folder_name - >> names + >> short_names + >> long_names >> descriptions >> m_company >> m_unique_id @@ -182,7 +185,8 @@ bool GameFile::LoadFromCache() >> m_revision; m_country = (DiscIO::IVolume::ECountry)country; m_platform = (DiscIO::IVolume::EPlatform)platform; - m_names = CastLocalizedStrings(names); + m_short_names = CastLocalizedStrings(short_names); + m_long_names = CastLocalizedStrings(long_names); m_descriptions = CastLocalizedStrings(descriptions); file.close(); return true; @@ -209,7 +213,8 @@ void GameFile::SaveToCache() stream << CACHE_REVISION; stream << m_folder_name - << CastLocalizedStrings(m_names) + << CastLocalizedStrings(m_short_names) + << CastLocalizedStrings(m_long_names) << CastLocalizedStrings(m_descriptions) << m_company << m_unique_id @@ -258,15 +263,15 @@ QString GameFile::GetDescription() const return GetDescription(SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(wii)); } -QString GameFile::GetName(DiscIO::IVolume::ELanguage language) const +QString GameFile::GetName(bool prefer_long, DiscIO::IVolume::ELanguage language) const { - return GetLanguageString(language, m_names); + return GetLanguageString(language, prefer_long ? m_long_names : m_short_names); } -QString GameFile::GetName() const +QString GameFile::GetName(bool prefer_long) const { bool wii = m_platform != DiscIO::IVolume::GAMECUBE_DISC; - QString name = GetName(SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(wii)); + QString name = GetName(prefer_long, SConfig::GetInstance().m_LocalCoreStartupParameter.GetCurrentLanguage(wii)); if (name.isEmpty()) { // No usable name, return filename (better than nothing) diff --git a/Source/Core/DolphinQt/GameList/GameFile.h b/Source/Core/DolphinQt/GameList/GameFile.h index 4f906fb611..30ea33d50d 100644 --- a/Source/Core/DolphinQt/GameList/GameFile.h +++ b/Source/Core/DolphinQt/GameList/GameFile.h @@ -22,8 +22,8 @@ public: bool IsValid() const { return m_valid; } QString GetFileName() { return m_file_name; } QString GetFolderName() { return m_folder_name; } - QString GetName(DiscIO::IVolume::ELanguage language) const; - QString GetName() const; + QString GetName(bool prefer_long, DiscIO::IVolume::ELanguage language) const; + QString GetName(bool prefer_long) const; QString GetDescription(DiscIO::IVolume::ELanguage language) const; QString GetDescription() const; QString GetCompany() const; @@ -45,7 +45,8 @@ private: QString m_file_name; QString m_folder_name; - QMap m_names; + QMap m_short_names; + QMap m_long_names; QMap m_descriptions; QString m_company; diff --git a/Source/Core/DolphinQt/GameList/GameGrid.cpp b/Source/Core/DolphinQt/GameList/GameGrid.cpp index 2e6d76f3d5..ebce076ccb 100644 --- a/Source/Core/DolphinQt/GameList/GameGrid.cpp +++ b/Source/Core/DolphinQt/GameList/GameGrid.cpp @@ -76,7 +76,7 @@ void DGameGrid::AddGame(GameFile* gameItem) QListWidgetItem* i = new QListWidgetItem; i->setIcon(QIcon(gameItem->GetBitmap() .scaled(GRID_BANNER_WIDTH, GRID_BANNER_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation))); - i->setText(gameItem->GetName()); + i->setText(gameItem->GetName(false)); if (gameItem->IsCompressed()) i->setTextColor(QColor("#00F")); diff --git a/Source/Core/DolphinQt/GameList/GameTree.cpp b/Source/Core/DolphinQt/GameList/GameTree.cpp index 0d84a3152d..b218d6072f 100644 --- a/Source/Core/DolphinQt/GameList/GameTree.cpp +++ b/Source/Core/DolphinQt/GameList/GameTree.cpp @@ -110,7 +110,7 @@ void DGameTree::AddGame(GameFile* item) QTreeWidgetItem* i = new QTreeWidgetItem; i->setIcon(COL_TYPE, QIcon(Resources::GetPlatformPixmap(item->GetPlatform()))); i->setIcon(COL_BANNER, QIcon(item->GetBitmap())); - i->setText(COL_TITLE, item->GetName()); + i->setText(COL_TITLE, item->GetName(true)); i->setText(COL_DESCRIPTION, item->GetDescription()); i->setIcon(COL_REGION, QIcon(Resources::GetRegionPixmap(item->GetCountry()))); i->setText(COL_SIZE, NiceSizeFormat(item->GetFileSize()));