-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
77 lines (72 loc) · 1.7 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
66
67
68
69
70
71
72
73
74
75
76
77
/******************** (C) COPYRIGHT 2018 merafour ********************
* Author : 冷月追风@merafour.blog.163.com
* Version : V2.0.0
* Date : 29/8/2018
* Description : main.
********************************************************************************
* merafour.blog.163.com
* github.com/Merafour
*******************************************************************************/
#include "mainwindow.h"
#include <QApplication>
//int main(int argc, char *argv[])
//{
// QApplication a(argc, argv);
// MainWindow w;
// w.show();
// return a.exec();
//}
#include <QApplication>
#include <QProcess>
#include "core/download.h"
#if 0
#define DEBUG_INFO_FILE 1
#else
#define DEBUG_INFO_FILE 0
#endif
#if DEBUG_INFO_FILE
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
void customMessageHandler(QtMsgType type, const QMessageLogContext &, const QString & str)
{
QString txt=str;
#else
void customMessageHandler(QtMsgType type, const char *msg)
{
QString txt(msg);
#endif
QFile outFile("debug.log");
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream ts(&outFile);
ts << txt << endl;
}
#endif
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
#if DEBUG_INFO_FILE
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
qInstallMessageHandler(customMessageHandler);
#else
qInstallMsgHandler(customMessageHandler);
#endif
#endif
#if 1
MainWindow w;
w.show();
#else
DownLoad w;
w.show();
#endif
#if 0
return a.exec();
#else
int ret = a.exec();
if(7714==ret)
{
QProcess::startDetached(qApp->applicationFilePath(), QStringList());
return 0;
}
return ret;
#endif
}