-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
54 lines (39 loc) · 1.53 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
#include "WeightCurveViewer.h"
#include "WeightCurve.h"
#include <QQmlEngine>
#include <QQmlContext>
#include <QSettings>
/// This show the window maximized or not as saved last time
void loadWindowSettings(WeightCurveViewer& viewer)
{
QSettings settings;
viewer.setMaximized(settings.value("window/maximized", false).toBool());
viewer.setPosition(settings.value("window/position", QPoint(-1, -1)).toPoint());
viewer.setSize(settings.value("window/size", QSize(-1, -1)).toSize());
}
void saveWindowSettings(const WeightCurveViewer& viewer)
{
QSettings settings;
settings.setValue("window/maximized", viewer.isMaximized());
settings.setValue("window/position", viewer.position());
settings.setValue("window/size", viewer.size());
}
int main(int argc, char *argv[])
{
int result;
Application app(argc, argv);
QGuiApplication::setApplicationName("Weight Curve");
QGuiApplication::setApplicationVersion("1.0");
QGuiApplication::setOrganizationName("Flamaros");
QGuiApplication::setOrganizationDomain("Flamaros.fr");
QSettings::setDefaultFormat(QSettings::IniFormat);
WeightCurveViewer viewer;
viewer.qmlEngine().rootContext()->setContextProperty("application", WeightCurve::singleton());
WeightCurve::singleton()->initialize();
viewer.setMainQmlFile(QStringLiteral("qml/WeightCurve/main.qml"));
loadWindowSettings(viewer); // Will show the window in the right mode
result = app.exec();
saveWindowSettings(viewer);
WeightCurve::destroy();
return result;
}