diff options
Diffstat (limited to 'pokemodr/MapWildListUI.cpp')
| -rw-r--r-- | pokemodr/MapWildListUI.cpp | 57 |
1 files changed, 10 insertions, 47 deletions
diff --git a/pokemodr/MapWildListUI.cpp b/pokemodr/MapWildListUI.cpp index 8b204440..3530495e 100644 --- a/pokemodr/MapWildListUI.cpp +++ b/pokemodr/MapWildListUI.cpp @@ -25,9 +25,6 @@ #include "../pokemod/MapWildList.h" #include "../pokemod/Time.h" -// General includes -#include "../general/BugCatcher.h" - MapWildListUI::MapWildListUI(MapWildList* wildList, QWidget* parent) : ObjectUI(parent) { @@ -35,6 +32,10 @@ MapWildListUI::MapWildListUI(MapWildList* wildList, QWidget* parent) : QMetaObject::connectSlotsByName(this); setObjects(wildList, new MapWildList(*wildList)); connect(this, SIGNAL(changed(bool)), boxButtons, SLOT(setEnabled(bool))); + connect(modified(), SIGNAL(error()), this, SLOT(setGui())); + connect(modified(), SIGNAL(error(QString&)), this, SLOT(errorMessage(QString&))); + connect(modified(), SIGNAL(warning(QString&)), this, SLOT(warningMessage(QString&))); + connect(modified(), SIGNAL(changed()), this, SIGNAL(changed(true))); init(); } @@ -107,47 +108,20 @@ void MapWildListUI::on_buttonDiscard_clicked() void MapWildListUI::on_varControl_currentIndexChanged(const int control) { - try - { - static_cast<MapWildList*>(modified())->setControl(control); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - } - setGui(); + static_cast<MapWildList*>(modified())->setControl(control); } void MapWildListUI::on_varValue_currentIndexChanged(const int value) { - try - { - static_cast<MapWildList*>(modified())->setValue(varValue->itemData(value).toInt()); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - } - setGui(); + static_cast<MapWildList*>(modified())->setValue(varValue->itemData(value).toInt()); } void MapWildListUI::on_varTimes_itemSelectionChanged() { - try - { - for (int i = 0; i < varTimes->count(); ++i) - { - const QListWidgetItem* widgetItem = varTimes->item(i); - static_cast<MapWildList*>(modified())->setTime(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected()); - } - emit(changed(true)); - } - catch (BoundsException& exception) + for (int i = 0; i < varTimes->count(); ++i) { - BugCatcher::report(exception); - setGui(); + const QListWidgetItem* widgetItem = varTimes->item(i); + static_cast<MapWildList*>(modified())->setTime(widgetItem->data(Qt::UserRole).toInt(), widgetItem->isSelected()); } } @@ -155,20 +129,9 @@ void MapWildListUI::on_boxScope_toggled(const bool scopeUsed) { if (!scopeUsed) static_cast<MapWildList*>(modified())->setScope(INT_MAX); - emit(changed(true)); - setGui(); } void MapWildListUI::on_varScope_currentIndexChanged(const int scope) { - try - { - static_cast<MapWildList*>(modified())->setScope(varScope->itemData(scope).toInt()); - emit(changed(true)); - } - catch (BoundsException& exception) - { - BugCatcher::report(exception); - setGui(); - } + static_cast<MapWildList*>(modified())->setScope(varScope->itemData(scope).toInt()); } |
