summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..41f7fef
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,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();
+}