DolphinQt: Use short GC game titles in grid view

Short titles fit better than long titles.
This commit is contained in:
JosJuice 2015-05-11 10:51:11 +02:00
parent ec0370d2d1
commit 04de064732
4 changed files with 21 additions and 15 deletions

View File

@ -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<DiscIO::IVolume::ELanguage, QString> ConvertLocalizedStrings(std::map<DiscIO::IVolume::ELanguage, std::string> 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<u8, QString> names;
QMap<u8, QString> short_names;
QMap<u8, QString> long_names;
QMap<u8, QString> 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<DiscIO::IVolume::ELanguage>(names);
m_short_names = CastLocalizedStrings<DiscIO::IVolume::ELanguage>(short_names);
m_long_names = CastLocalizedStrings<DiscIO::IVolume::ELanguage>(long_names);
m_descriptions = CastLocalizedStrings<DiscIO::IVolume::ELanguage>(descriptions);
file.close();
return true;
@ -209,7 +213,8 @@ void GameFile::SaveToCache()
stream << CACHE_REVISION;
stream << m_folder_name
<< CastLocalizedStrings<u8>(m_names)
<< CastLocalizedStrings<u8>(m_short_names)
<< CastLocalizedStrings<u8>(m_long_names)
<< CastLocalizedStrings<u8>(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)

View File

@ -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<DiscIO::IVolume::ELanguage, QString> m_names;
QMap<DiscIO::IVolume::ELanguage, QString> m_short_names;
QMap<DiscIO::IVolume::ELanguage, QString> m_long_names;
QMap<DiscIO::IVolume::ELanguage, QString> m_descriptions;
QString m_company;

View File

@ -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"));

View File

@ -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()));