Merge pull request #9513 from leoetlino/info-ios-version-qt

Qt: Re-add IOS version to the game info tab
This commit is contained in:
Léo Lam 2021-03-01 11:44:26 +01:00 committed by GitHub
commit 010279f4e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h"
#include "DolphinQt/Config/InfoWidget.h"
#include "DolphinQt/QtUtils/ImageConverter.h"
@ -25,6 +26,8 @@
InfoWidget::InfoWidget(const UICommon::GameFile& game) : m_game(game)
{
m_volume = DiscIO::CreateVolume(m_game.GetFilePath());
QVBoxLayout* layout = new QVBoxLayout();
layout->addWidget(CreateFileDetails());
@ -36,6 +39,8 @@ InfoWidget::InfoWidget(const UICommon::GameFile& game) : m_game(game)
setLayout(layout);
}
InfoWidget::~InfoWidget() = default;
QGroupBox* InfoWidget::CreateFileDetails()
{
QGroupBox* group = new QGroupBox(tr("File Details"));
@ -121,6 +126,17 @@ QGroupBox* InfoWidget::CreateGameDetails()
if (!m_game.GetApploaderDate().empty())
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);
return group;
}

View File

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