-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.cpp
76 lines (64 loc) · 1.69 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
#include "mainwidget.h"
#include "eb_common.h"
#include "eb_options.h"
#include <QApplication>
#include <QFile>
#include <QMessageBox>
#include <QTextCodec>
#include <QFontDatabase>
#include <QFont>
extern "C"
{
#include <stdlib.h>
}
int main(int argc, char *argv[])
{
#if SINGLETON
// Ensure only one process is running at the same time.
#if 1
QFile lockFile;
lockFile.setFileName(QString("~/.lock_easybench"));
if (lockFile.exists()) {
return 0;
}
else {
//system("touch /home/root/.lock_easybench");
}
#else
if(!is_singleton()) {
printf("(W) The program is already running.\n");
return -1;
}
#endif
#endif
QApplication a(argc, argv);
QFile qssFile(":/qss/easybench.qss");
qssFile.open(QFile::ReadOnly);
a.setStyleSheet(qssFile.readAll());
qssFile.close();
#if LANGUAGE_CHINESE
#if QT_VERSION_5
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
#else
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
#endif
int index = QFontDatabase::addApplicationFont("/usr/share/fonts/ttf/LiHeiPro.ttf");
if(index != -1) {
QStringList fontList(QFontDatabase::applicationFontFamilies(index));
// font : LiHei Pro
if(fontList.count() > 0) {
QFont font_zh(fontList.at(0));
//font_zh.setPointSize(26);
font_zh.setBold(false);
a.setFont(font_zh);
}
}
#endif
//calcCheckSum("1234567890", 10);
EbOptions g_opt;
MainWidget w(&g_opt);
w.show();
return a.exec();
}