Skip to content
Permalink
Browse files

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.
  • Loading branch information...
lioncash committed Jul 31, 2019
1 parent 255d2ff commit 6002529ece9aa9629169c56d30c3ba39ff98924a
Showing with 9 additions and 13 deletions.
  1. +9 −13 Source/Core/DolphinQt/Config/GeckoCodeWidget.cpp
@@ -185,33 +185,29 @@ 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();
}
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();
}
SaveCodes();
UpdateList();
}

void GeckoCodeWidget::RemoveCode()

0 comments on commit 6002529

Please sign in to comment.
You can’t perform that action at this time.