-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
46 lines (34 loc) · 1.07 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
#include "pythonhandler.h"
// #undef slots
// #define slots Q_SLOTS
#include "vpetinterface.h"
#include <QSharedMemory>
#include <QApplication>
#include "loghandler.h"
#include "qssloader.h"
// #define HIGH_PRIOIRTY_ENABLED
QMutex mutex;
int main(int argc, char *argv[])
{
PythonHandler::initPython();
PythonHandler::importNecessaryPyMoudle();
LogHandler::initLog();
qInstallMessageHandler(LogHandler::message);
QApplication a(argc, argv);
QApplication::setQuitOnLastWindowClosed(false); // 设置平行顶层窗口逻辑:文心一言我爱你xD
QSharedMemory singleMem(a.applicationName());
if(!singleMem.create(1))
{
qDebug() << QT_BACKGROUND_LOG << "App started more than once";
return -1;
}
// 用共享内存方法检测软件是否运行多次
QSSLoader::setFontFamily();
QSSLoader::setStyle(":/qss/material_dark_teal.qss");
#ifdef HIGH_PRIOIRTY_ENABLED
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); // 设置进程优先级
#endif
VPetInterface w;
w.show();
return a.exec();
}