00001 #include "application.h" 00002 00003 #include <domain/taskmanagerdata.h> 00004 #include <domain/clock.h> 00005 00006 #include <control/controllerfactory.h> 00007 00008 #include <ui/gui/gui.h> 00009 00010 struct ApplicationPrivate 00011 { 00012 ui::UiInterface* ui; 00013 domain::TaskManagerData* data; 00014 00015 void createData(); 00016 void createUi(); 00017 void createControllers(); 00018 }; 00019 00020 void ApplicationPrivate::createData() 00021 { 00022 data = domain::TaskManagerData::instance(); 00023 } 00024 00025 void ApplicationPrivate::createUi() 00026 { 00027 ui = new ui::Gui(); 00028 ui->setTime(data->clock()->time()); 00029 00030 QObject::connect(data, SIGNAL(timeChanged(QDateTime)), 00031 ui, SLOT(setTime(QDateTime))); 00032 } 00033 00034 void ApplicationPrivate::createControllers() 00035 { 00036 control::ControllerFactory factory(data, ui); 00037 ui->loadControllers(factory.controllers()); 00038 } 00039 00040 Application::Application(int argc, char* argv[]) : QApplication(argc, argv), 00041 d(new ApplicationPrivate()) 00042 { 00043 d->createData(); 00044 d->createUi(); 00045 d->createControllers(); 00046 d->ui->start(); 00047 } 00048 00049 Application::~Application() 00050 { 00051 delete d->ui; 00052 delete d; 00053 }