-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
61 lines (51 loc) · 1.56 KB
/
main.cpp
File metadata and controls
61 lines (51 loc) · 1.56 KB
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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QWindow>
#include <QPoint>
#include <QDir>
#include <QFile>
#include <QString>
#include <QSettings>
#include <unistd.h>
#include "qquickimage.h"
#include "context.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
app.setAttribute(Qt::AA_EnableHighDpiScaling);
QDir dir;
QString path = dir.homePath() + "/.config/synth/desktop/";
QFile file(path + "settings.conf");
if(!dir.exists(path))
{
dir.mkpath(path);
}
if(!file.exists())
{
if (file.open(QIODevice::ReadWrite))
{
QSettings settings(path + "settings.conf", QSettings::NativeFormat);
settings.setValue("background", "file:///usr/share/backgrounds/elementaryos-default");
settings.beginGroup("wallpaper");
settings.setValue("x", 0);
settings.setValue("y", 0);
settings.setValue("w", 770);
settings.setValue("h", 600);
settings.endGroup();
}
file.close();
}
Context *context = new Context();
QQuickImage image;
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("Context", context);
engine.addImageProvider("pixmap", &image);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
QObject *main = engine.rootObjects().first();
QWindow *window = qobject_cast<QWindow *>(main);
context->window = window;
return app.exec();
}