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
|
@ -185,34 +185,30 @@ void GeckoCodeWidget::AddCode()
|
|||
|
||||
CheatCodeEditor ed(this);
|
||||
ed.SetGeckoCode(&code);
|
||||
if (ed.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
if (ed.exec())
|
||||
{
|
||||
m_gecko_codes.push_back(std::move(code));
|
||||
SaveCodes();
|
||||
UpdateList();
|
||||
}
|
||||
}
|
||||
|
||||
void GeckoCodeWidget::EditCode()
|
||||
{
|
||||
const auto* item = m_code_list->currentItem();
|
||||
|
||||
if (item == nullptr)
|
||||
return;
|
||||
|
||||
const int index = item->data(Qt::UserRole).toInt();
|
||||
|
||||
CheatCodeEditor ed(this);
|
||||
|
||||
ed.SetGeckoCode(&m_gecko_codes[index]);
|
||||
if (ed.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
if (ed.exec())
|
||||
{
|
||||
SaveCodes();
|
||||
UpdateList();
|
||||
}
|
||||
}
|
||||
|
||||
void GeckoCodeWidget::RemoveCode()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue