File indexing completed on 2024-11-03 12:45:27

0001 /**
0002  * SPDX-FileCopyrightText: (C) 2020 Carl Schwan <carl@carlschwan.eu>
0003  * 
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #include <QApplication>
0008 #include <QQmlApplicationEngine>
0009 #include <QtQml>
0010 #include <QUrl>
0011 #include <QDebug>
0012 #include <KLocalizedContext>
0013 #include <KLocalizedString>
0014 #include <KPackage/PackageLoader>
0015 
0016 #include "arkade.h"
0017 #include "gamesmodel.h"
0018 
0019 Q_DECL_EXPORT int main(int argc, char *argv[])
0020 {
0021 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0022     QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
0023 #endif
0024     QApplication app(argc, argv);
0025     QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
0026     QCoreApplication::setApplicationName(QStringLiteral("Arkade"));
0027 
0028     KLocalizedString::setApplicationDomain("arkade");
0029 
0030     QQmlApplicationEngine engine;
0031     
0032     Arkade arkade(&engine);
0033     qRegisterMetaType<GamesModel *>("GamesModel *");
0034     qmlRegisterSingletonInstance("org.kde.arkade.private", 1, 0, "Arkade", &arkade);
0035     
0036     engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
0037     engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
0038 
0039     for (const KPluginMetaData& pluginMetaData : KPackage::PackageLoader::self()->listPackages(QStringLiteral("Arkade/Game"))) {
0040         /*KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Arkjade/Game"));
0041         package.setDefaultPackageRoot("kpackage/arkade");
0042         package.setPath(pluginMetaData.pluginId());*/
0043         qDebug() << pluginMetaData.name();
0044     }
0045     
0046     if (engine.rootObjects().isEmpty()) {
0047         return -1;
0048     }
0049 
0050     return app.exec();
0051 }