/
main.cpp
65 lines (48 loc) · 1.58 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <QtGui/QApplication>
#include <QSqlDatabase>
#include "routetool.h"
#include "configuration.h"
#include "globalfunctions.h"
#include <QDebug>
#include <QJson/Parser>
#include <QVariantList>
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QDateTime>
#include <QSettings>
#include <QSqlError>
#include <QMessageBox>
#include <QTextCodec>
int main(int argc, char *argv[])
{
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
debuglogfile = NULL;
vvimDebug() << "<vvim> TODO: in databank table ophaalhistoriek kan Tourist Union het ophaalpuntid 0 hebben, terwijl in table ophaalpunten het id 131 heeft. Best ophaalhistoriek aanpassen!";
QApplication a(argc, argv);
QLocale curLocale(QLocale("nl_NL"));
QLocale::setDefault(curLocale);
checkSettings();
vvimDebug() << "databank:" << settings.value("db/host").toString();
if (!startLoggingToFile()) exit(0);
if (!connectToDatabase()) exit(0);
RouteTool r;
r.show();
a.exec();
vvimDebug() << "remove DB";
QSqlDatabase::removeDatabase(settings.value("db/databasename").toString());
/*
if(debuglogfile)
fclose(debuglogfile);
if(debuglogfile)
delete debuglogfile;
how to correctly close the logfile? This gives errors:
vvimDebug() << "close logfile";
fclose(debuglogfile);
vvimDebug() << "delete logfile";
delete debuglogfile;
*/
return 0;
}