MainController::MainController() :
edit_page_(main_view_), delete_page_(main_view_),
- delete_presenter_(nullptr), edit_presenter_(nullptr)
+ delete_presenter_(nullptr), edit_presenter_(nullptr),
+ initialized_(false)
{
}
int MainController::Init()
{
+ if (initialized_) return 0;
+
world_clock_model_ = new model::WorldClock();
stop_watch_model_ = new model::StopWatch();
timer_model_ = new model::Timer();
listeners_.push_back(utils::EventBus::AddListener<AlarmEditRequestEvent>(
std::bind(&MainController::CreateEditAlarmPage, this, _1)));
+ initialized_ = true;
return 0;
}
void MainController::Deinit()
{
+ if (!initialized_) return;
+
delete alarm_presenter_;
delete world_clock_presenter_;
delete timer_model_;
listeners_.clear();
+ initialized_ = false;
}
void MainController::CreateNewAlarmPage(Event &e)