-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.cpp
80 lines (56 loc) · 2.17 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 "Display/CMainWindow.h"
#include <QApplication>
#include <QtXml>
#include "Display/CEventFilterObj.h"
#include "Model/CConfigManager.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
CMainWindow *window = new CMainWindow;
CConfigManager* confManager;
confManager = CConfigManager::getInstance();
CXmlStorageHandler xmlStorageHandler;
CProjectManager::getInstance()->setProjectFile(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/" + "record.xml");
CProjectManager::getInstance()->setStorageHandler(xmlStorageHandler);
CProjectManager::getInstance()->attachStorage();
// load profile list after storage ready
window->loadProjectList();
QByteArray savedGeometry;
savedGeometry = confManager->getValue("Window", "geometry").toByteArray();
window->restoreGeometry(savedGeometry);
QString splitterSizeStr;
QStringList splitterSizeStrList;
QList<int> splitterSizeList;
QString vsplitterSizeStr;
QStringList vsplitterSizeStrList;
QList<int> vsplitterSizeList;
// tab widget
window->restoreTabWidgetPos();
// splitter
splitterSizeStr = confManager->getValue("Window", "splitter").toString();
splitterSizeStr = splitterSizeStr.trimmed();
if (splitterSizeStr != "") {
splitterSizeStrList = splitterSizeStr.split(" ", Qt::SkipEmptyParts);
foreach (const QString& splitterSize, splitterSizeStrList) {
splitterSizeList.append(splitterSize.toInt());
}
window->setSplitterSizes(splitterSizeList);
}
// vertical splitter
vsplitterSizeStr = confManager->getValue("Window", "vsplitter").toString();
vsplitterSizeStr = vsplitterSizeStr.trimmed();
if (vsplitterSizeStr != "") {
vsplitterSizeStrList = vsplitterSizeStr.split(" ", Qt::SkipEmptyParts);
foreach (const QString& splitterSize, vsplitterSizeStrList) {
vsplitterSizeList.append(splitterSize.toInt());
}
window->setVerticalSplitterSizes(vsplitterSizeList);
}
qDebug() << window->geometry();
qDebug() << window->frameGeometry();
window->show();
// event filter for show/hide menuBar
CEventFilterObj *keyPressObj = new CEventFilterObj();
app.installEventFilter(keyPressObj);
return app.exec();
}