use enum and add default case

This commit is contained in:
BreadFish64 2018-01-18 21:02:55 -06:00
parent d462eacefb
commit 169b076913
2 changed files with 6 additions and 2 deletions

View file

@ -33,12 +33,12 @@ void CompatDB::Submit() {
compatibility->addButton(ui->radioButton_IntroMenu, 4); compatibility->addButton(ui->radioButton_IntroMenu, 4);
compatibility->addButton(ui->radioButton_WontBoot, 5); compatibility->addButton(ui->radioButton_WontBoot, 5);
switch (currentId()) { switch (currentId()) {
case 1: case CompatDBPage::SelectionPage:
if (compatibility->checkedId() == -1) { if (compatibility->checkedId() == -1) {
button(NextButton)->setEnabled(false); button(NextButton)->setEnabled(false);
} }
break; break;
case 2: case CompatDBPage::FinalPage:
LOG_DEBUG(Frontend, "Compatibility Rating: %d", compatibility->checkedId()); LOG_DEBUG(Frontend, "Compatibility Rating: %d", compatibility->checkedId());
Core::Telemetry().AddField(Telemetry::FieldType::UserFeedback, "Compatibility", Core::Telemetry().AddField(Telemetry::FieldType::UserFeedback, "Compatibility",
compatibility->checkedId()); compatibility->checkedId());
@ -46,6 +46,8 @@ void CompatDB::Submit() {
// workaround // workaround
button(QWizard::CancelButton)->setVisible(false); button(QWizard::CancelButton)->setVisible(false);
break; break;
default:
LOG_ERROR(Frontend, "Unexpected page: %d", currentId());
} }
} }

View file

@ -25,3 +25,5 @@ private slots:
void Submit(); void Submit();
void EnableNext(); void EnableNext();
}; };
enum CompatDBPage { IntroPage = 0, SelectionPage = 1, FinalPage = 2 };