mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-27 12:41:40 +00:00
DolphinQt/Config/GeckoCodeWidget: Make exec() outcomes explicit
Makes it a little more explicit which dialog outcomes we're expecting. While we're at it, we can invert them into guard clauses to unindent code a little bit.
This commit is contained in:
parent
255d2ff2d2
commit
6002529ece
1 changed files with 9 additions and 13 deletions
|
@ -185,33 +185,29 @@ void GeckoCodeWidget::AddCode()
|
||||||
|
|
||||||
CheatCodeEditor ed(this);
|
CheatCodeEditor ed(this);
|
||||||
ed.SetGeckoCode(&code);
|
ed.SetGeckoCode(&code);
|
||||||
|
if (ed.exec() == QDialog::Rejected)
|
||||||
|
return;
|
||||||
|
|
||||||
if (ed.exec())
|
m_gecko_codes.push_back(std::move(code));
|
||||||
{
|
SaveCodes();
|
||||||
m_gecko_codes.push_back(std::move(code));
|
UpdateList();
|
||||||
SaveCodes();
|
|
||||||
UpdateList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeckoCodeWidget::EditCode()
|
void GeckoCodeWidget::EditCode()
|
||||||
{
|
{
|
||||||
const auto* item = m_code_list->currentItem();
|
const auto* item = m_code_list->currentItem();
|
||||||
|
|
||||||
if (item == nullptr)
|
if (item == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int index = item->data(Qt::UserRole).toInt();
|
const int index = item->data(Qt::UserRole).toInt();
|
||||||
|
|
||||||
CheatCodeEditor ed(this);
|
CheatCodeEditor ed(this);
|
||||||
|
|
||||||
ed.SetGeckoCode(&m_gecko_codes[index]);
|
ed.SetGeckoCode(&m_gecko_codes[index]);
|
||||||
|
if (ed.exec() == QDialog::Rejected)
|
||||||
|
return;
|
||||||
|
|
||||||
if (ed.exec())
|
SaveCodes();
|
||||||
{
|
UpdateList();
|
||||||
SaveCodes();
|
|
||||||
UpdateList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeckoCodeWidget::RemoveCode()
|
void GeckoCodeWidget::RemoveCode()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue