mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 07:21:14 +01:00
Qt/ARCodeWidget: Disable functionality if no game id is given.
This commit is contained in:
parent
aa2d089d1b
commit
a4b1ea3d70
@ -31,14 +31,17 @@ ARCodeWidget::ARCodeWidget(std::string game_id, u16 game_revision, bool restart_
|
||||
CreateWidgets();
|
||||
ConnectWidgets();
|
||||
|
||||
IniFile game_ini_local;
|
||||
if (!m_game_id.empty())
|
||||
{
|
||||
IniFile game_ini_local;
|
||||
|
||||
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||
// will always be stored in GS/${GAMEID}.ini
|
||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
||||
// We don't use LoadLocalGameIni() here because user cheat codes that are installed via the UI
|
||||
// will always be stored in GS/${GAMEID}.ini
|
||||
game_ini_local.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + m_game_id + ".ini");
|
||||
|
||||
const IniFile game_ini_default = SConfig::LoadDefaultGameIni(m_game_id, m_game_revision);
|
||||
m_ar_codes = ActionReplay::LoadCodes(game_ini_default, game_ini_local);
|
||||
const IniFile game_ini_default = SConfig::LoadDefaultGameIni(m_game_id, m_game_revision);
|
||||
m_ar_codes = ActionReplay::LoadCodes(game_ini_default, game_ini_local);
|
||||
}
|
||||
|
||||
UpdateList();
|
||||
OnSelectionChanged();
|
||||
@ -54,6 +57,11 @@ void ARCodeWidget::CreateWidgets()
|
||||
m_code_edit = new QPushButton(tr("&Edit Code..."));
|
||||
m_code_remove = new QPushButton(tr("&Remove Code"));
|
||||
|
||||
m_code_list->setEnabled(!m_game_id.empty());
|
||||
m_code_add->setEnabled(!m_game_id.empty());
|
||||
m_code_edit->setEnabled(!m_game_id.empty());
|
||||
m_code_remove->setEnabled(!m_game_id.empty());
|
||||
|
||||
m_code_list->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
auto* button_layout = new QHBoxLayout;
|
||||
@ -171,6 +179,9 @@ void ARCodeWidget::UpdateList()
|
||||
|
||||
void ARCodeWidget::SaveCodes()
|
||||
{
|
||||
if (m_game_id.empty())
|
||||
return;
|
||||
|
||||
const auto ini_path =
|
||||
std::string(File::GetUserPath(D_GAMESETTINGS_IDX)).append(m_game_id).append(".ini");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user