GeckoCodeWidget: Take game ID and revision directly instead of through GameFile.

This commit is contained in:
Admiral H. Curtiss 2021-06-06 21:25:37 +02:00
parent 1fbe56210a
commit 414e0f4598
4 changed files with 14 additions and 12 deletions

View File

@ -195,7 +195,10 @@ void CheatsManager::OnStateChanged(Core::State state)
m_ar_code = new ARCodeWidget(m_game_file->GetGameID(), m_game_file->GetRevision(), false);
m_tab_widget->insertTab(0, m_ar_code, tr("AR Code"));
m_tab_widget->insertTab(1, new GeckoCodeWidget(*m_game_file, false), tr("Gecko Codes"));
auto* gecko_code =
new GeckoCodeWidget(m_game_file->GetGameID(), m_game_file->GetGameTDBID(),
m_game_file->GetRevision(), false);
m_tab_widget->insertTab(1, gecko_code, tr("Gecko Codes"));
}
}
}

View File

@ -4,6 +4,8 @@
#include "DolphinQt/Config/GeckoCodeWidget.h"
#include <utility>
#include <QCursor>
#include <QFontDatabase>
#include <QFormLayout>
@ -28,9 +30,10 @@
#include "UICommon/GameFile.h"
GeckoCodeWidget::GeckoCodeWidget(const UICommon::GameFile& game, bool restart_required)
: m_game(game), m_game_id(game.GetGameID()), m_gametdb_id(game.GetGameTDBID()),
m_game_revision(game.GetRevision()), m_restart_required(restart_required)
GeckoCodeWidget::GeckoCodeWidget(std::string game_id, std::string gametdb_id, u16 game_revision,
bool restart_required)
: m_game_id(std::move(game_id)), m_gametdb_id(std::move(gametdb_id)),
m_game_revision(game_revision), m_restart_required(restart_required)
{
CreateWidgets();
ConnectWidgets();

View File

@ -23,16 +23,12 @@ namespace Gecko
class GeckoCode;
}
namespace UICommon
{
class GameFile;
}
class GeckoCodeWidget : public QWidget
{
Q_OBJECT
public:
explicit GeckoCodeWidget(const UICommon::GameFile& game, bool restart_required = true);
explicit GeckoCodeWidget(std::string game_id, std::string gametdb_id, u16 game_revision,
bool restart_required = true);
~GeckoCodeWidget() override;
signals:
@ -54,7 +50,6 @@ private:
void SaveCodes();
void SortAlphabetically();
const UICommon::GameFile& m_game;
std::string m_game_id;
std::string m_gametdb_id;
u16 m_game_revision;

View File

@ -39,7 +39,8 @@ PropertiesDialog::PropertiesDialog(QWidget* parent, const UICommon::GameFile& ga
InfoWidget* info = new InfoWidget(game);
ARCodeWidget* ar = new ARCodeWidget(game.GetGameID(), game.GetRevision());
GeckoCodeWidget* gecko = new GeckoCodeWidget(game);
GeckoCodeWidget* gecko =
new GeckoCodeWidget(game.GetGameID(), game.GetGameTDBID(), game.GetRevision());
PatchesWidget* patches = new PatchesWidget(game);
GameConfigWidget* game_config = new GameConfigWidget(game);