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:
Lioncash 2019-07-31 09:16:01 -04:00
parent 255d2ff2d2
commit 6002529ece

View file

@ -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()