-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.cpp
72 lines (62 loc) · 1.83 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
#include "mainwindow.h"
#include "com/config.h"
#include "com/app_instance_file_guard.h"
#include "com/app_instance_local_connect.h"
#include "com/common.h"
int main(int argc, char *argv[])
{
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--single-process");
qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "7777");
/* Application Setup */
QApplication a(argc, argv);
qvs::printInfo();
qvs::loadFonts(); // Load fonts from resource.
a.setFont(FONT_DEFAULT);
/* Application Current Path */
QDir::setCurrent(QCoreApplication::applicationDirPath());
/* Global Configure First */
g_pConfig = new Config();
g_pConfig->init(a.arguments());
/* Splash Screen Show */
#ifdef QT_PLASH
QSplashScreen screen(QPixmap(":/images/splashscreen.png"));
if(g_pConfig->isStartSplashScreen())
{
screen.show();
}
#endif
/* Application Instance File Guard */
#if false
AppInstanceFileGuard guard(APPINSTANCE);
#else
AppInstanceLocalConnect guard(APPINSTANCE);
#endif
if(g_pConfig->isCheckGuardLocker())
{
if(!guard.isLocked())
{
qCritical("Couldn't start the qvs.\nAnother instance is probably already running.");
return eINDEX_NONE;
}
}
/* MainWindow Setup */
MainWindow w;
w.connect(&guard, SIGNAL(commandRecived(const QString &)), &w, SLOT(commandRecived(const QString &)));
g_pConfig->setMainWindow(&w);
g_pConfig->initEncodeConfig(); // Init encode config after create classes.
g_pConfig->initEncodeAudioConfig();
/* Splash Screen Finish */
#ifdef QT_PLASH
screen.finish(&w);
#endif
/* MainWindow Show */
if(g_pConfig->isShowMainWindow())
{
w.show();
}
else
{
w.modeLaunch();
}
return a.exec();
}