Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
54 lines (46 loc) · 1.35 KB
/
Copy pathmain.cpp
File metadata and controls
54 lines (46 loc) · 1.35 KB
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
#include "remote.h"
#include <QApplication>
#include <QStyleFactory>
#include <QFile>
void myMessageHandler(QtMsgType type, const QMessageLogContext &, const QString & str)
{
QString txt;
QString datestring = QTime::currentTime().toString("hh:mm:ss");
switch (type) {
case QtDebugMsg:
txt = QString("Debug %1: %2").arg(datestring).arg(str);
break;
case QtWarningMsg:
txt = QString("Warning %1: %2").arg(datestring).arg(str);
break;
case QtCriticalMsg:
txt = QString("Critical %1: %2").arg(datestring).arg(str);
break;
case QtFatalMsg:
txt = QString("Fatal %1: %2").arg(datestring).arg(str);
abort();
}
QFile outFile("debug.txt");
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream ts(&outFile);
ts << txt << endl;
outFile.close();
}
int main(int argc, char *argv[])
{
qInstallMessageHandler(myMessageHandler);
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
qsrand(QTime(0,0,0).msecsTo(QTime::currentTime()));
qApp->setStyle(QStyleFactory::create("fusion"));
QFont font = qApp->font();
font.setPixelSize(13);
qApp->setFont(font);
QPalette palette;
qApp->setPalette(palette);
Remote u;
if(u.Start(a.arguments()))
return a.exec();
else
return 0;
}