Merge pull request #4734 from leoetlino/info-ios-version

DolphinWX: Show the required IOS version in info panel
This commit is contained in:
Matthew Parlane 2017-01-24 18:47:14 +13:00 committed by GitHub
commit 221be63cb4
2 changed files with 46 additions and 67 deletions

View File

@ -7,6 +7,7 @@
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <string> #include <string>
#include <utility>
#include <vector> #include <vector>
#include <wx/arrstr.h> #include <wx/arrstr.h>
@ -26,6 +27,7 @@
#include "Common/MD5.h" #include "Common/MD5.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/IOS/ES/Formats.h"
#include "DiscIO/Enums.h" #include "DiscIO/Enums.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DolphinWX/ISOFile.h" #include "DolphinWX/ISOFile.h"
@ -178,6 +180,12 @@ void InfoPanel::LoadISODetails()
m_revision->SetValue(StrToWxStr(std::to_string(m_opened_iso->GetRevision()))); m_revision->SetValue(StrToWxStr(std::to_string(m_opened_iso->GetRevision())));
m_date->SetValue(StrToWxStr(m_opened_iso->GetApploaderDate())); m_date->SetValue(StrToWxStr(m_opened_iso->GetApploaderDate()));
m_fst->SetValue(StrToWxStr(std::to_string(m_opened_iso->GetFSTSize()))); m_fst->SetValue(StrToWxStr(std::to_string(m_opened_iso->GetFSTSize())));
if (m_ios_version)
{
IOS::HLE::TMDReader tmd{m_opened_iso->GetTMD()};
if (tmd.IsValid())
m_ios_version->SetValue(StringFromFormat("IOS%u", static_cast<u32>(tmd.GetIOSId())));
}
} }
void InfoPanel::LoadBannerDetails() void InfoPanel::LoadBannerDetails()
@ -206,55 +214,41 @@ void InfoPanel::LoadBannerImage()
wxStaticBoxSizer* InfoPanel::CreateISODetailsSizer() wxStaticBoxSizer* InfoPanel::CreateISODetailsSizer()
{ {
auto* const internal_name_text = new wxStaticText(this, wxID_ANY, _("Internal Name:")); std::vector<std::pair<wxString, wxTextCtrl*&>> controls = {{
m_internal_name = {_("Internal Name:"), m_internal_name},
new wxTextCtrl(this, ID_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); {_("Game ID:"), m_game_id},
{_("Country:"), m_country},
auto* const game_id_text = new wxStaticText(this, wxID_ANY, _("Game ID:")); {_("Maker ID:"), m_maker_id},
m_game_id = new wxTextCtrl(this, ID_GAME_ID, wxEmptyString, wxDefaultPosition, wxDefaultSize, {_("Revision:"), m_revision},
wxTE_READONLY); {_("Apploader Date:"), m_date},
auto* const country_text = new wxStaticText(this, wxID_ANY, _("Country:")); {_("FST Size:"), m_fst},
m_country = new wxTextCtrl(this, ID_COUNTRY, wxEmptyString, wxDefaultPosition, wxDefaultSize, }};
wxTE_READONLY); if (!m_opened_iso->GetTMD().empty())
auto* const maker_id_text = new wxStaticText(this, wxID_ANY, _("Maker ID:")); controls.emplace_back(_("IOS Version:"), m_ios_version);
m_maker_id = new wxTextCtrl(this, ID_MAKER_ID, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_READONLY);
auto* const revision_text = new wxStaticText(this, wxID_ANY, _("Revision:"));
m_revision = new wxTextCtrl(this, ID_REVISION, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_READONLY);
auto* const date_text = new wxStaticText(this, wxID_ANY, _("Apploader Date:"));
m_date =
new wxTextCtrl(this, ID_DATE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
auto* const fst_text = new wxStaticText(this, wxID_ANY, _("FST Size:"));
m_fst =
new wxTextCtrl(this, ID_FST, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
auto* const md5_sum_text = new wxStaticText(this, wxID_ANY, _("MD5 Checksum:"));
m_md5_sum = new wxTextCtrl(this, ID_MD5_SUM, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_READONLY);
m_md5_sum_compute = new wxButton(this, ID_MD5_SUM_COMPUTE, _("Compute"));
const int space_10 = FromDIP(10); const int space_10 = FromDIP(10);
auto* const iso_details = new wxGridBagSizer(space_10, space_10); auto* const iso_details = new wxGridBagSizer(space_10, space_10);
iso_details->Add(internal_name_text, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL); size_t row = 0;
iso_details->Add(m_internal_name, wxGBPosition(0, 1), wxGBSpan(1, 2), wxEXPAND); for (auto& control : controls)
iso_details->Add(game_id_text, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL); {
iso_details->Add(m_game_id, wxGBPosition(1, 1), wxGBSpan(1, 2), wxEXPAND); auto* const text = new wxStaticText(this, wxID_ANY, control.first);
iso_details->Add(country_text, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL); iso_details->Add(text, wxGBPosition(row, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
iso_details->Add(m_country, wxGBPosition(2, 1), wxGBSpan(1, 2), wxEXPAND); control.second = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
iso_details->Add(maker_id_text, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL); wxTE_READONLY);
iso_details->Add(m_maker_id, wxGBPosition(3, 1), wxGBSpan(1, 2), wxEXPAND); iso_details->Add(control.second, wxGBPosition(row, 1), wxGBSpan(1, 2), wxEXPAND);
iso_details->Add(revision_text, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL); ++row;
iso_details->Add(m_revision, wxGBPosition(4, 1), wxGBSpan(1, 2), wxEXPAND); }
iso_details->Add(date_text, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
iso_details->Add(m_date, wxGBPosition(5, 1), wxGBSpan(1, 2), wxEXPAND); auto* const md5_sum_text = new wxStaticText(this, wxID_ANY, _("MD5 Checksum:"));
iso_details->Add(fst_text, wxGBPosition(6, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL); m_md5_sum = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
iso_details->Add(m_fst, wxGBPosition(6, 1), wxGBSpan(1, 2), wxEXPAND); wxTE_READONLY);
iso_details->Add(md5_sum_text, wxGBPosition(7, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL); m_md5_sum_compute = new wxButton(this, wxID_ANY, _("Compute"));
iso_details->Add(m_md5_sum, wxGBPosition(7, 1), wxGBSpan(1, 1), wxEXPAND);
iso_details->Add(m_md5_sum_compute, wxGBPosition(7, 2), wxGBSpan(1, 1), wxEXPAND); iso_details->Add(md5_sum_text, wxGBPosition(row, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL);
iso_details->Add(m_md5_sum, wxGBPosition(row, 1), wxGBSpan(1, 1), wxEXPAND);
iso_details->Add(m_md5_sum_compute, wxGBPosition(row, 2), wxGBSpan(1, 1), wxEXPAND);
++row;
iso_details->AddGrowableCol(1); iso_details->AddGrowableCol(1);
const int space_5 = FromDIP(5); const int space_5 = FromDIP(5);
@ -269,17 +263,17 @@ wxStaticBoxSizer* InfoPanel::CreateISODetailsSizer()
wxStaticBoxSizer* InfoPanel::CreateBannerDetailsSizer() wxStaticBoxSizer* InfoPanel::CreateBannerDetailsSizer()
{ {
auto* const name_text = new wxStaticText(this, wxID_ANY, _("Name:")); auto* const name_text = new wxStaticText(this, wxID_ANY, _("Name:"));
m_name = new wxTextCtrl(this, ID_SHORT_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_name = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_READONLY); wxTE_READONLY);
auto* const maker_text = new wxStaticText(this, wxID_ANY, _("Maker:")); auto* const maker_text = new wxStaticText(this, wxID_ANY, _("Maker:"));
m_maker = new wxTextCtrl(this, ID_MAKER, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_maker = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_READONLY); wxTE_READONLY);
auto* const comment_text = new wxStaticText(this, wxID_ANY, _("Description:")); auto* const comment_text = new wxStaticText(this, wxID_ANY, _("Description:"));
m_comment = new wxTextCtrl(this, ID_COMMENT, wxEmptyString, wxDefaultPosition, wxDefaultSize, m_comment = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY); wxTE_MULTILINE | wxTE_READONLY);
auto* const banner_text = new wxStaticText(this, wxID_ANY, _("Banner:")); auto* const banner_text = new wxStaticText(this, wxID_ANY, _("Banner:"));
m_banner = m_banner =
new wxStaticBitmap(this, ID_BANNER, wxNullBitmap, wxDefaultPosition, FromDIP(wxSize(96, 32))); new wxStaticBitmap(this, wxID_ANY, wxNullBitmap, wxDefaultPosition, FromDIP(wxSize(96, 32)));
auto* const languages_text = new wxStaticText(this, wxID_ANY, _("Show Language:")); auto* const languages_text = new wxStaticText(this, wxID_ANY, _("Show Language:"));
m_languages = CreateCommentLanguageChoice(); m_languages = CreateCommentLanguageChoice();
@ -317,7 +311,7 @@ wxChoice* InfoPanel::CreateCommentLanguageChoice()
const int preferred_language_index = FindPreferredLanguageIndex(preferred_language, languages); const int preferred_language_index = FindPreferredLanguageIndex(preferred_language, languages);
const auto choices = GetLanguageChoiceStrings(languages); const auto choices = GetLanguageChoiceStrings(languages);
auto* const choice = new wxChoice(this, ID_LANGUAGE, wxDefaultPosition, wxDefaultSize, choices); auto* const choice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices);
choice->SetSelection(preferred_language_index); choice->SetSelection(preferred_language_index);
if (choice->GetCount() <= 1) if (choice->GetCount() <= 1)

View File

@ -29,22 +29,6 @@ public:
private: private:
enum enum
{ {
ID_NAME = 10000,
ID_GAME_ID,
ID_COUNTRY,
ID_MAKER_ID,
ID_REVISION,
ID_DATE,
ID_FST,
ID_MD5_SUM,
ID_MD5_SUM_COMPUTE,
ID_VERSION,
ID_LANGUAGE,
ID_SHORT_NAME,
ID_MAKER,
ID_COMMENT,
ID_BANNER,
IDM_SAVE_BANNER IDM_SAVE_BANNER
}; };
@ -78,6 +62,7 @@ private:
wxTextCtrl* m_revision; wxTextCtrl* m_revision;
wxTextCtrl* m_date; wxTextCtrl* m_date;
wxTextCtrl* m_fst; wxTextCtrl* m_fst;
wxTextCtrl* m_ios_version = nullptr;
wxTextCtrl* m_md5_sum; wxTextCtrl* m_md5_sum;
wxButton* m_md5_sum_compute; wxButton* m_md5_sum_compute;
wxChoice* m_languages; wxChoice* m_languages;