Qt: Implement GetUniqueID()
This commit is contained in:
parent
ca1646d99b
commit
655778f7f1
|
@ -11,6 +11,7 @@
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
#include "Common/NandPaths.h"
|
#include "Common/NandPaths.h"
|
||||||
|
#include "Common/StringUtil.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/HW/WiiSaveCrypted.h"
|
#include "Core/HW/WiiSaveCrypted.h"
|
||||||
#include "Core/IOS/ES/ES.h"
|
#include "Core/IOS/ES/ES.h"
|
||||||
|
@ -305,6 +306,51 @@ QString GameFile::GetLanguage(DiscIO::Language lang) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString GameFile::GetUniqueID() const
|
||||||
|
{
|
||||||
|
std::vector<std::string> info;
|
||||||
|
if (!GetGameID().isEmpty())
|
||||||
|
info.push_back(GetGameID().toStdString());
|
||||||
|
|
||||||
|
if (GetRevision() != 0)
|
||||||
|
{
|
||||||
|
info.push_back("Revision " + std::to_string(GetRevision()));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string name = m_long_names[DiscIO::Language::LANGUAGE_ENGLISH].toStdString();
|
||||||
|
|
||||||
|
if (name.empty())
|
||||||
|
{
|
||||||
|
if (!m_long_names.isEmpty())
|
||||||
|
name = m_long_names.begin().value().toStdString();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string filename, extension;
|
||||||
|
name = SplitPath(m_path.toStdString(), nullptr, &filename, &extension);
|
||||||
|
name = filename + extension;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int disc_number = GetDiscNumber() + 1;
|
||||||
|
|
||||||
|
std::string lower_name = name;
|
||||||
|
std::transform(lower_name.begin(), lower_name.end(), lower_name.begin(), ::tolower);
|
||||||
|
if (disc_number > 1 &&
|
||||||
|
lower_name.find(std::string("disc ") + std::to_string(disc_number)) == std::string::npos &&
|
||||||
|
lower_name.find(std::string("disc") + std::to_string(disc_number)) == std::string::npos)
|
||||||
|
{
|
||||||
|
info.push_back("Disc " + std::to_string(disc_number));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.empty())
|
||||||
|
return QString::fromStdString(name);
|
||||||
|
|
||||||
|
std::ostringstream ss;
|
||||||
|
std::copy(info.begin(), info.end() - 1, std::ostream_iterator<std::string>(ss, ", "));
|
||||||
|
ss << info.back();
|
||||||
|
return QString::fromStdString(name + " (" + ss.str() + ")");
|
||||||
|
}
|
||||||
|
|
||||||
bool GameFile::IsInstalled() const
|
bool GameFile::IsInstalled() const
|
||||||
{
|
{
|
||||||
_assert_(m_platform == DiscIO::Platform::WII_WAD);
|
_assert_(m_platform == DiscIO::Platform::WII_WAD);
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
u64 GetTitleID() const { return m_title_id; }
|
u64 GetTitleID() const { return m_title_id; }
|
||||||
u16 GetRevision() const { return m_revision; }
|
u16 GetRevision() const { return m_revision; }
|
||||||
QString GetInternalName() const { return m_internal_name; }
|
QString GetInternalName() const { return m_internal_name; }
|
||||||
|
QString GetUniqueID() const;
|
||||||
u8 GetDiscNumber() const { return m_disc_number; }
|
u8 GetDiscNumber() const { return m_disc_number; }
|
||||||
u64 GetRawSize() const { return m_raw_size; }
|
u64 GetRawSize() const { return m_raw_size; }
|
||||||
QPixmap GetBanner() const { return m_banner; }
|
QPixmap GetBanner() const { return m_banner; }
|
||||||
|
|
Loading…
Reference in New Issue