-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
30 lines (30 loc) · 812 Bytes
/
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
#include <QCoreApplication>
#include <QSettings>
#include <QFile>
#include "handler.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
if(!(QFile("config.ini").exists()))
{
qDebug() << "Config file missing exiting";
return -1;
}
QSettings settings("config.ini", QSettings::IniFormat);
QStringList info;
int port = 0;
settings.beginGroup("info");
const QStringList childKeys = settings.childKeys();
foreach (const QString &childKey, childKeys)
{
if(childKey == "port")
{
port = settings.value(childKey).toInt();
}
info.append(settings.value(childKey).toString());
}
settings.endGroup();
handler han;
han.Prepear(info[1],info[0],info[2],info[3],port);
return a.exec();
}