Qt: Re-add IOS version to the game info tab

This was accidentally removed during the Qt migration:
https://github.com/dolphin-emu/dolphin/pull/4734
This commit is contained in:
Léo Lam 2021-02-14 15:33:25 +01:00
parent f9deb68aee
commit 7097a7b3af
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
2 changed files with 24 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "DiscIO/Blob.h" #include "DiscIO/Blob.h"
#include "DiscIO/Enums.h" #include "DiscIO/Enums.h"
#include "DiscIO/Volume.h"
#include "DolphinQt/Config/InfoWidget.h" #include "DolphinQt/Config/InfoWidget.h"
#include "DolphinQt/QtUtils/ImageConverter.h" #include "DolphinQt/QtUtils/ImageConverter.h"
@ -25,6 +26,8 @@
InfoWidget::InfoWidget(const UICommon::GameFile& game) : m_game(game) InfoWidget::InfoWidget(const UICommon::GameFile& game) : m_game(game)
{ {
m_volume = DiscIO::CreateVolume(m_game.GetFilePath());
QVBoxLayout* layout = new QVBoxLayout(); QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget(CreateFileDetails()); layout->addWidget(CreateFileDetails());
@ -36,6 +39,8 @@ InfoWidget::InfoWidget(const UICommon::GameFile& game) : m_game(game)
setLayout(layout); setLayout(layout);
} }
InfoWidget::~InfoWidget() = default;
QGroupBox* InfoWidget::CreateFileDetails() QGroupBox* InfoWidget::CreateFileDetails()
{ {
QGroupBox* group = new QGroupBox(tr("File Details")); QGroupBox* group = new QGroupBox(tr("File Details"));
@ -121,6 +126,17 @@ QGroupBox* InfoWidget::CreateGameDetails()
if (!m_game.GetApploaderDate().empty()) if (!m_game.GetApploaderDate().empty())
layout->addRow(tr("Apploader Date:"), CreateValueDisplay(m_game.GetApploaderDate())); layout->addRow(tr("Apploader Date:"), CreateValueDisplay(m_game.GetApploaderDate()));
if (m_volume)
{
const DiscIO::Partition partition = m_volume->GetGamePartition();
const IOS::ES::TMDReader& tmd = m_volume->GetTMD(partition);
if (tmd.IsValid())
{
const auto ios = fmt::format("IOS{}", static_cast<u32>(tmd.GetIOSId()));
layout->addRow(tr("IOS Version:"), CreateValueDisplay(ios));
}
}
group->setLayout(layout); group->setLayout(layout);
return group; return group;
} }

View File

@ -4,12 +4,18 @@
#pragma once #pragma once
#include <memory>
#include <string> #include <string>
#include <QWidget> #include <QWidget>
#include "UICommon/GameFile.h" #include "UICommon/GameFile.h"
namespace DiscIO
{
class Volume;
}
class QComboBox; class QComboBox;
class QGroupBox; class QGroupBox;
class QLineEdit; class QLineEdit;
@ -21,6 +27,7 @@ class InfoWidget final : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit InfoWidget(const UICommon::GameFile& game); explicit InfoWidget(const UICommon::GameFile& game);
~InfoWidget() override;
private: private:
void ChangeLanguage(); void ChangeLanguage();
@ -34,6 +41,7 @@ private:
void CreateLanguageSelector(); void CreateLanguageSelector();
QWidget* CreateBannerGraphic(const QPixmap& image); QWidget* CreateBannerGraphic(const QPixmap& image);
std::unique_ptr<DiscIO::Volume> m_volume;
UICommon::GameFile m_game; UICommon::GameFile m_game;
QComboBox* m_language_selector; QComboBox* m_language_selector;
QLineEdit* m_name = {}; QLineEdit* m_name = {};