forked from xibeilang524/Graphics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
79 lines (62 loc) · 2.03 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
78
79
#include "mainwindow.h"
#include "myapplication.h"
#include <QTextCodec>
#include <QDesktopWidget>
#include <QDir>
#include "./manager/actionmanager.h"
#include "SelfWidget/hidesplit.h"
#include "SelfWidget/mysplashscreen.h"
#include "global.h"
#include "sql/sqlproecss.h"
#include "mysettings.h"
#include "util.h"
const char APP_NAME[] = "Graphics";
const char CONFIG_PATH[] = "Graphics.ini";
MySettings * createSettings()
{
return new MySettings(QString("%1/%2").arg(APP_NAME).arg(CONFIG_PATH),QSettings::IniFormat);
}
int main(int argc, char *argv[])
{
MyApplication a(argc, argv);
a.setApplicationVersion(QString::number(M_VERTION));
a.setOrganizationName(M_AUTHOR);
a.setApplicationName(APP_NAME);
ScreenWidth = qApp->desktop()->screenGeometry().width();
ScreenHeight = qApp->desktop()->screenGeometry().height();
MyApplication::addLibraryPath("./plugins");
QTextCodec * codec = QTextCodec::codecForName("GB2312");
QTextCodec::setCodecForCStrings(codec);
MySettings * settings = createSettings();
settings->setIniCodec(codec);
QFileInfo fileInfo(settings->fileName());
IsConfigIniExisted = fileInfo.exists();
QPixmap pixmap(":/images/startup.png");
MySplashScreen screen(pixmap);
screen.setSettings(settings);
screen.setGeometry((ScreenWidth - pixmap.width())/2,(ScreenHeight - pixmap.height())/2,pixmap.width(),pixmap.height());
screen.show();
a.processEvents();
QDateTime n = QDateTime::currentDateTime();
QDateTime now;
do{
now = QDateTime::currentDateTime();
}
while(n.secsTo(now)<=3);
screen.hide();
#ifndef REMOVE_SQL_MODEL
if(!SQLProecss::instance()->initDatabase("./config/DataBaseInfo.properties"))
{
Util::showWarn(SQLProecss::instance()->getLastError());
}
#endif
SaveFileSuffix = ".bin";
SaveFileHeadFlag = "RGVISIO";
GlobalRotateStep = 5;
GlobalMinMumSize = 15;
ActionManager actionManager;
SplitManager splitManager;
MainWindow w(settings);
w.show();
return a.exec();
}