mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
GCVolume: supports reading all opening.bnr information
DQT2: Game properties dialog contains info tab giving information about the selected iso.
This commit is contained in:
@ -5,8 +5,6 @@
|
||||
#include <QCryptographicHash>
|
||||
#include <QDataStream>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QImage>
|
||||
#include <QSharedPointer>
|
||||
|
||||
@ -20,6 +18,11 @@
|
||||
static const int CACHE_VERSION = 13; // Last changed in PR #3261
|
||||
static const int DATASTREAM_VERSION = QDataStream::Qt_5_5;
|
||||
|
||||
QList<DiscIO::IVolume::ELanguage> GameFile::GetAvailableLanguages() const
|
||||
{
|
||||
return m_long_names.keys();
|
||||
}
|
||||
|
||||
static QMap<DiscIO::IVolume::ELanguage, QString>
|
||||
ConvertLanguageMap(const std::map<DiscIO::IVolume::ELanguage, std::string>& map)
|
||||
{
|
||||
@ -137,22 +140,22 @@ bool GameFile::TryLoadVolume()
|
||||
return false;
|
||||
|
||||
m_unique_id = QString::fromStdString(volume->GetUniqueID());
|
||||
m_maker_id = QString::fromStdString(volume->GetMakerID());
|
||||
std::string maker_id = volume->GetMakerID();
|
||||
m_maker = QString::fromStdString(DiscIO::GetCompanyFromID(maker_id));
|
||||
m_maker_id = QString::fromStdString(maker_id);
|
||||
m_revision = volume->GetRevision();
|
||||
m_internal_name = QString::fromStdString(volume->GetInternalName());
|
||||
m_short_names = ConvertLanguageMap(volume->GetNames(false));
|
||||
m_long_names = ConvertLanguageMap(volume->GetNames(true));
|
||||
m_short_names = ConvertLanguageMap(volume->GetShortNames());
|
||||
m_long_names = ConvertLanguageMap(volume->GetLongNames());
|
||||
m_short_makers = ConvertLanguageMap(volume->GetShortMakers());
|
||||
m_long_makers = ConvertLanguageMap(volume->GetLongMakers());
|
||||
m_descriptions = ConvertLanguageMap(volume->GetDescriptions());
|
||||
m_company = QString::fromStdString(volume->GetCompany());
|
||||
m_disc_number = volume->GetDiscNumber();
|
||||
m_platform = volume->GetVolumeType();
|
||||
m_country = volume->GetCountry();
|
||||
m_blob_type = volume->GetBlobType();
|
||||
m_raw_size = volume->GetRawSize();
|
||||
|
||||
if (m_company.isEmpty() && m_unique_id.size() >= 6)
|
||||
m_company =
|
||||
QString::fromStdString(DiscIO::GetCompanyFromID(m_unique_id.mid(4, 2).toStdString()));
|
||||
m_apploader_date = QString::fromStdString(volume->GetApploaderDate());
|
||||
|
||||
ReadBanner(*volume);
|
||||
|
||||
@ -176,12 +179,13 @@ bool GameFile::TryLoadElfDol()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GameFile::SaveCache()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
QString GameFile::GetLanguageString(const QMap<DiscIO::IVolume::ELanguage, QString>& m) const
|
||||
QString GameFile::GetBannerString(const QMap<DiscIO::IVolume::ELanguage, QString>& m) const
|
||||
{
|
||||
// Try the settings language, then English, then just pick one.
|
||||
if (m.isEmpty())
|
||||
@ -200,3 +204,100 @@ QString GameFile::GetLanguageString(const QMap<DiscIO::IVolume::ELanguage, QStri
|
||||
return m[DiscIO::IVolume::LANGUAGE_ENGLISH];
|
||||
return m.first();
|
||||
}
|
||||
|
||||
QString GameFile::GetPlatform() const
|
||||
{
|
||||
switch (m_platform)
|
||||
{
|
||||
case DiscIO::IVolume::GAMECUBE_DISC:
|
||||
return QObject::tr("GameCube");
|
||||
case DiscIO::IVolume::WII_DISC:
|
||||
return QObject::tr("Wii");
|
||||
case DiscIO::IVolume::WII_WAD:
|
||||
return QObject::tr("Wii Channel");
|
||||
case DiscIO::IVolume::ELF_DOL:
|
||||
return QObject::tr("ELF/DOL");
|
||||
default:
|
||||
return QObject::tr("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
QString GameFile::GetCountry() const
|
||||
{
|
||||
switch (m_country)
|
||||
{
|
||||
case DiscIO::IVolume::COUNTRY_EUROPE:
|
||||
return QObject::tr("Europe");
|
||||
case DiscIO::IVolume::COUNTRY_JAPAN:
|
||||
return QObject::tr("Japan");
|
||||
case DiscIO::IVolume::COUNTRY_USA:
|
||||
return QObject::tr("USA");
|
||||
case DiscIO::IVolume::COUNTRY_AUSTRALIA:
|
||||
return QObject::tr("Australia");
|
||||
case DiscIO::IVolume::COUNTRY_FRANCE:
|
||||
return QObject::tr("France");
|
||||
case DiscIO::IVolume::COUNTRY_GERMANY:
|
||||
return QObject::tr("Germany");
|
||||
case DiscIO::IVolume::COUNTRY_ITALY:
|
||||
return QObject::tr("Italy");
|
||||
case DiscIO::IVolume::COUNTRY_KOREA:
|
||||
return QObject::tr("Korea");
|
||||
case DiscIO::IVolume::COUNTRY_NETHERLANDS:
|
||||
return QObject::tr("Netherlands");
|
||||
case DiscIO::IVolume::COUNTRY_RUSSIA:
|
||||
return QObject::tr("Russia");
|
||||
case DiscIO::IVolume::COUNTRY_SPAIN:
|
||||
return QObject::tr("Spain");
|
||||
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
||||
return QObject::tr("Taiwan");
|
||||
case DiscIO::IVolume::COUNTRY_WORLD:
|
||||
return QObject::tr("World");
|
||||
default:
|
||||
return QObject::tr("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
QString GameFile::GetLanguage(DiscIO::IVolume::ELanguage lang) const
|
||||
{
|
||||
switch (lang)
|
||||
{
|
||||
case DiscIO::IVolume::LANGUAGE_JAPANESE:
|
||||
return QObject::tr("Japanese");
|
||||
case DiscIO::IVolume::LANGUAGE_ENGLISH:
|
||||
return QObject::tr("English");
|
||||
case DiscIO::IVolume::LANGUAGE_GERMAN:
|
||||
return QObject::tr("German");
|
||||
case DiscIO::IVolume::LANGUAGE_FRENCH:
|
||||
return QObject::tr("French");
|
||||
case DiscIO::IVolume::LANGUAGE_SPANISH:
|
||||
return QObject::tr("Spanish");
|
||||
case DiscIO::IVolume::LANGUAGE_ITALIAN:
|
||||
return QObject::tr("Italian");
|
||||
case DiscIO::IVolume::LANGUAGE_DUTCH:
|
||||
return QObject::tr("Dutch");
|
||||
case DiscIO::IVolume::LANGUAGE_SIMPLIFIED_CHINESE:
|
||||
return QObject::tr("Simplified Chinese");
|
||||
case DiscIO::IVolume::LANGUAGE_TRADITIONAL_CHINESE:
|
||||
return QObject::tr("Traditional Chinese");
|
||||
case DiscIO::IVolume::LANGUAGE_KOREAN:
|
||||
return QObject::tr("Korean");
|
||||
default:
|
||||
return QObject::tr("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
// Convert an integer size to a friendly string representation.
|
||||
QString FormatSize(qint64 size)
|
||||
{
|
||||
QStringList units{QStringLiteral("KB"), QStringLiteral("MB"), QStringLiteral("GB"),
|
||||
QStringLiteral("TB")};
|
||||
QStringListIterator i(units);
|
||||
QString unit = QStringLiteral("B");
|
||||
double num = (double)size;
|
||||
while (num > 1024.0 && i.hasNext())
|
||||
{
|
||||
unit = i.next();
|
||||
num /= 1024.0;
|
||||
}
|
||||
return QStringLiteral("%1 %2").arg(QString::number(num, 'f', 1)).arg(unit);
|
||||
}
|
||||
|
@ -19,34 +19,43 @@ public:
|
||||
|
||||
bool IsValid() const { return m_valid; }
|
||||
// These will be properly initialized before we try to load the file.
|
||||
QString GetPath() const { return m_path; }
|
||||
QString GetFilePath() const { return m_path; }
|
||||
QString GetFileName() const { return m_file_name; }
|
||||
QString GetExtension() const { return m_extension; }
|
||||
QString GetFolder() const { return m_folder; }
|
||||
QString GetFileExtension() const { return m_extension; }
|
||||
QString GetFileFolder() const { return m_folder; }
|
||||
qint64 GetFileSize() const { return m_size; }
|
||||
// The rest will not.
|
||||
QString GetUniqueID() const { return m_unique_id; }
|
||||
QString GetMakerID() const { return m_maker_id; }
|
||||
QString GetMaker() const { return m_maker; }
|
||||
u16 GetRevision() const { return m_revision; }
|
||||
QString GetInternalName() const { return m_internal_name; }
|
||||
QString GetCompany() const { return m_company; }
|
||||
u8 GetDiscNumber() const { return m_disc_number; }
|
||||
u64 GetRawSize() const { return m_raw_size; }
|
||||
QPixmap GetBanner() const { return m_banner; }
|
||||
QString GetIssues() const { return m_issues; }
|
||||
int GetRating() const { return m_rating; }
|
||||
DiscIO::IVolume::EPlatform GetPlatform() const { return m_platform; }
|
||||
DiscIO::IVolume::ECountry GetCountry() const { return m_country; }
|
||||
QString GetApploaderDate() const { return m_apploader_date; }
|
||||
DiscIO::IVolume::EPlatform GetPlatformID() const { return m_platform; }
|
||||
QString GetPlatform() const;
|
||||
DiscIO::IVolume::ECountry GetCountryID() const { return m_country; }
|
||||
QString GetCountry() const;
|
||||
DiscIO::BlobType GetBlobType() const { return m_blob_type; }
|
||||
QString GetShortName() const { return GetLanguageString(m_short_names); }
|
||||
// Banner details
|
||||
QString GetLanguage(DiscIO::IVolume::ELanguage lang) const;
|
||||
QList<DiscIO::IVolume::ELanguage> GetAvailableLanguages() const;
|
||||
QString GetShortName() const { return GetBannerString(m_short_names); }
|
||||
QString GetShortMaker() const { return GetBannerString(m_short_makers); }
|
||||
QString GetLongName() const { return GetBannerString(m_long_names); }
|
||||
QString GetLongMaker() const { return GetBannerString(m_long_makers); }
|
||||
QString GetDescription() const { return GetBannerString(m_descriptions); }
|
||||
QString GetShortName(DiscIO::IVolume::ELanguage lang) const { return m_short_names[lang]; }
|
||||
QString GetLongName() const { return GetLanguageString(m_long_names); }
|
||||
QString GetShortMaker(DiscIO::IVolume::ELanguage lang) const { return m_short_makers[lang]; }
|
||||
QString GetLongName(DiscIO::IVolume::ELanguage lang) const { return m_long_names[lang]; }
|
||||
QString GetDescription() const { return GetLanguageString(m_descriptions); }
|
||||
QString GetLongMaker(DiscIO::IVolume::ELanguage lang) const { return m_long_makers[lang]; }
|
||||
QString GetDescription(DiscIO::IVolume::ELanguage lang) const { return m_descriptions[lang]; }
|
||||
private:
|
||||
DiscIO::IVolume::ELanguage GetDefaultLanguage() const;
|
||||
QString GetLanguageString(const QMap<DiscIO::IVolume::ELanguage, QString>& m) const;
|
||||
QString GetBannerString(const QMap<DiscIO::IVolume::ELanguage, QString>& m) const;
|
||||
|
||||
QString GetCacheFileName() const;
|
||||
void ReadBanner(const DiscIO::IVolume& volume);
|
||||
@ -67,11 +76,14 @@ private:
|
||||
qint64 m_size = 0;
|
||||
|
||||
QString m_unique_id;
|
||||
QString m_maker;
|
||||
QString m_maker_id;
|
||||
u16 m_revision = 0;
|
||||
QString m_internal_name;
|
||||
QMap<DiscIO::IVolume::ELanguage, QString> m_short_names;
|
||||
QMap<DiscIO::IVolume::ELanguage, QString> m_long_names;
|
||||
QMap<DiscIO::IVolume::ELanguage, QString> m_short_makers;
|
||||
QMap<DiscIO::IVolume::ELanguage, QString> m_long_makers;
|
||||
QMap<DiscIO::IVolume::ELanguage, QString> m_descriptions;
|
||||
QString m_company;
|
||||
u8 m_disc_number = 0;
|
||||
@ -82,4 +94,7 @@ private:
|
||||
QPixmap m_banner;
|
||||
QString m_issues;
|
||||
int m_rating = 0;
|
||||
QString m_apploader_date;
|
||||
};
|
||||
|
||||
QString FormatSize(qint64 size);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <QMenu>
|
||||
#include <QUrl>
|
||||
|
||||
#include "DolphinQt2/Config/PropertiesDialog.h"
|
||||
#include "DolphinQt2/GameList/GameList.h"
|
||||
#include "DolphinQt2/GameList/ListProxyModel.h"
|
||||
#include "DolphinQt2/GameList/TableDelegate.h"
|
||||
@ -103,12 +104,26 @@ void GameList::MakeListView()
|
||||
void GameList::ShowContextMenu(const QPoint&)
|
||||
{
|
||||
QMenu* menu = new QMenu(this);
|
||||
menu->addAction(tr("Properties"));
|
||||
menu->addAction(tr("Open Wiki Page"), this, SLOT(OpenWiki()));
|
||||
menu->addAction(tr("Set as Default ISO"), this, SLOT(SetDefaultISO()));
|
||||
DiscIO::IVolume::EPlatform platform = GameFile(GetSelectedGame()).GetPlatformID();
|
||||
if (platform == DiscIO::IVolume::GAMECUBE_DISC || platform == DiscIO::IVolume::WII_DISC)
|
||||
{
|
||||
menu->addAction(tr("Properties"), this, SLOT(OpenProperties()));
|
||||
menu->addAction(tr("Open Wiki Page"), this, SLOT(OpenWiki()));
|
||||
menu->addAction(tr("Set as Default ISO"), this, SLOT(SetDefaultISO()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
menu->exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void GameList::OpenProperties()
|
||||
{
|
||||
PropertiesDialog* properties = new PropertiesDialog(this, GameFile(GetSelectedGame()));
|
||||
properties->show();
|
||||
}
|
||||
|
||||
void GameList::OpenWiki()
|
||||
{
|
||||
QString game_id = GameFile(GetSelectedGame()).GetUniqueID();
|
||||
|
@ -29,6 +29,7 @@ public slots:
|
||||
void SetViewColumn(int col, bool view) { m_table->setColumnHidden(col, !view); }
|
||||
private slots:
|
||||
void ShowContextMenu(const QPoint&);
|
||||
void OpenProperties();
|
||||
void OpenWiki();
|
||||
void SetDefaultISO();
|
||||
|
||||
|
@ -34,11 +34,11 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
|
||||
case COL_DESCRIPTION:
|
||||
return game->GetDescription();
|
||||
case COL_MAKER:
|
||||
return game->GetCompany();
|
||||
return game->GetMaker();
|
||||
case COL_SIZE:
|
||||
return game->GetFileSize();
|
||||
case COL_COUNTRY:
|
||||
return game->GetCountry();
|
||||
return game->GetCountryID();
|
||||
case COL_RATING:
|
||||
return game->GetRating();
|
||||
}
|
||||
@ -85,7 +85,7 @@ int GameListModel::columnCount(const QModelIndex& parent) const
|
||||
|
||||
void GameListModel::UpdateGame(QSharedPointer<GameFile> game)
|
||||
{
|
||||
QString path = game->GetPath();
|
||||
QString path = game->GetFilePath();
|
||||
|
||||
int entry = FindGame(path);
|
||||
if (entry < 0)
|
||||
@ -111,7 +111,7 @@ int GameListModel::FindGame(const QString& path) const
|
||||
{
|
||||
for (int i = 0; i < m_games.size(); i++)
|
||||
{
|
||||
if (m_games[i]->GetPath() == path)
|
||||
if (m_games[i]->GetFilePath() == path)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
int columnCount(const QModelIndex& parent) const override;
|
||||
|
||||
// Path of the Game at the specified index.
|
||||
QString GetPath(int index) const { return m_games[index]->GetPath(); }
|
||||
QString GetPath(int index) const { return m_games[index]->GetFilePath(); }
|
||||
enum
|
||||
{
|
||||
COL_PLATFORM = 0,
|
||||
|
@ -4,28 +4,13 @@
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
#include "DolphinQt2/GameList/GameFile.h"
|
||||
#include "DolphinQt2/GameList/GameListModel.h"
|
||||
#include "DolphinQt2/GameList/TableDelegate.h"
|
||||
#include "DolphinQt2/Resources.h"
|
||||
|
||||
static QSize NORMAL_BANNER_SIZE(96, 32);
|
||||
|
||||
// Convert an integer size to a friendly string representation.
|
||||
static QString FormatSize(qint64 size)
|
||||
{
|
||||
QStringList units{QStringLiteral("KB"), QStringLiteral("MB"), QStringLiteral("GB"),
|
||||
QStringLiteral("TB")};
|
||||
QStringListIterator i(units);
|
||||
QString unit = QStringLiteral("B");
|
||||
double num = (double)size;
|
||||
while (num > 1024.0 && i.hasNext())
|
||||
{
|
||||
unit = i.next();
|
||||
num /= 1024.0;
|
||||
}
|
||||
return QStringLiteral("%1 %2").arg(QString::number(num, 'f', 1)).arg(unit);
|
||||
}
|
||||
|
||||
TableDelegate::TableDelegate(QWidget* parent) : QStyledItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user