Timesheets-Server
Timesheets server
Načítám...
Vyhledávám...
Nebylo nic nalezeno
timesheetserver.cpp
Zobrazit dokumentaci tohoto souboru.
1
7#include "timesheetserver.h"
8#include "msettings.h"
9#include "pdebug.h"
10#include "logger.h"
11#include "mythread.h"
12#include "db.h"
13#include "httpd/httpd.h"
14#include "security/security.h"
15#include "security/guard.h"
16#include <QFile>
17#include <QTimer>
18#include <QCoreApplication>
19
22
38 m_timesheetServer = this;
40 QTimer::singleShot(1, this, SLOT(init()));
41 m_startTime = QDateTime::currentDateTime();
42}
43
44
51
52
53TimesheetServer::~TimesheetServer() {
54 PDEBUG;
55 QCoreApplication::quit();
56}
57
58
60 QTimer::singleShot(1000, this, SLOT(destroy()));
61 QTimer::singleShot(5000, this, SLOT(quit()));
62}
63
64
66 PDEBUG;
67 QCoreApplication::quit();
68}
69
70
72 PDEBUG;
73 deleteLater();
74}
75
76
78 PDEBUG;
79 Logger::instance(this);
80 PDEBUG << "Starting server";
81
82 // tady start jednotlivych komponent
83 Db::Database::instance(this);
84
85 /*
86 MyThread::takeObject(this, "threadDataGroups", Data::DataGroups::dataGroups(this));
87 MyThread::takeObject(this, "threadDataSystems", Data::DataSystems::dataSystems(this));
88 MyThread::takeObject(this, "threadDataInvertors", Data::DataInvertors::dataInvertors(this));
89 MyThread::takeObject(this, "threadDataSensors", Data::DataSensors::dataSensors(this));
90 MyThread::takeObject(this, "threadAggregatorToday", Data::AggregatorToday::aggregatorToday(this));
91 MyThread::takeObject(this, "threadAggregatorPast", Data::AggregatorPast::aggregatorPast(this));
92 Importers::ImportersList::importersList(this);
93 */
94
96 MyThread::takeObject(this, "threadHttpServer", Httpd::Httpd::httpd(this));
97
98 /*
99 QTimer::singleShot(0, Data::DataGroups::dataGroups(), SLOT(init()));
100 QTimer::singleShot(0, Data::DataSystems::dataSystems(), SLOT(init()));
101 QTimer::singleShot(0, Data::DataInvertors::dataInvertors(), SLOT(init()));
102 QTimer::singleShot(0, Data::DataSensors::dataSensors(), SLOT(init()));
103 QTimer::singleShot(10000, Data::AggregatorToday::aggregatorToday(), SLOT(aggregate()));
104 QTimer::singleShot(15000, Data::AggregatorPast::aggregatorPast(), SLOT(aggregate()));
105 */
106
107 PDEBUG << "Started";
108}
109
static Httpd * httpd(QObject *parent=NULL)
Vrací ukazatal na singleton instanci třídy.
Definition httpd.cpp:33
static MSettings * instance(QObject *parent=NULL)
Vytváří signleton instanci třídy, vyhledá konfigurační soubor.
Definition msettings.cpp:48
static Guard * guard(QObject *parent=NULL)
Vrací ukazatel na singleton instanci třídy.
Definition guard.cpp:13
Hlavní třída - startovaná z main, inicializuje aplikaci a startuje potřebné objekty.
void restart()
Restartuje (nebo ukončí) server.
void init()
Funkce volaná přes timer po startu aplikace.
static QDateTime m_startTime
Čas startu.
static TimesheetServer * instance()
Vrací ukazatel na singleton instanci třídy.
void quit()
Ukončí aplikaci natrvrdo, quit.
void destroy()
Ukončí aplikaci.
static TimesheetServer * m_timesheetServer
Singleton instance třídy.
TimesheetServer()
Konstruktor, přes timer volá funkci init()