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
|
/*
SPDX-License-Identifier: GPL-2.0-or-later
SPDX-FileCopyrightText: 2024 Alexander Kavon <me+kue@alexkavon.com>
*/
#include <QtGlobal>
#include <QApplication>
#include <QIcon>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>
#include <QUrl>
#include <QDebug>
#include <KDescendantsProxyModel>
#include "version-kue.h"
#include <KAboutData>
#include <KLocalizedContext>
#include <KLocalizedString>
#include "kueconfig.h"
using namespace Qt::Literals::StringLiterals;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
// Default to org.kde.desktop style unless the user forces another style
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
QQuickStyle::setStyle(u"org.kde.desktop"_s);
}
KLocalizedString::setApplicationDomain("kue");
QCoreApplication::setOrganizationName(u"KDE"_s);
KAboutData aboutData(
// The program name used internally.
u"kue"_s,
// A displayable program name string.
i18nc("@title", "Kue"),
// The program version string.
QStringLiteral(KUE_VERSION_STRING),
// Short description of what the app does.
i18n("Application Description"),
// The license this code is released under.
KAboutLicense::GPL,
// Copyright Statement.
i18n("(c) 2024"));
aboutData.addAuthor(i18nc("@info:credit", "Alexander Kavon"),
i18nc("@info:credit", "Maintainer"),
u"me+kue@alexkavon.com"_s,
u"https://yourwebsite.com"_s);
aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"), i18nc("EMAIL OF TRANSLATORS", "Your emails"));
KAboutData::setApplicationData(aboutData);
QGuiApplication::setWindowIcon(QIcon::fromTheme(u"org.kde.kue"_s));
QQmlApplicationEngine engine;
auto config = KueConfig::self();
qRegisterMetaType<KDescendantsProxyModel*>("KDescendantsProxyModel*");
qmlRegisterSingletonInstance("org.kde.kue.private", 1, 0, "Kue", config);
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
engine.loadFromModule("org.kde.kue", u"Main"_s);
if (engine.rootObjects().isEmpty()) {
return -1;
}
return app.exec();
}
|