kasts/src/main.cpp

84 lines
2.7 KiB
C++
Raw Normal View History

2020-02-28 23:25:08 +01:00
/**
* Copyright 2020 Tobias Fella <fella@posteo.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2020-04-21 23:27:15 +02:00
#ifdef Q_OS_ANDROID
#include <QGuiApplication>
#else
2020-02-28 23:25:08 +01:00
#include <QApplication>
2020-04-21 23:27:15 +02:00
#endif
2020-02-28 23:25:08 +01:00
#include <QQmlApplicationEngine>
#include <QQuickView>
2020-03-26 14:16:19 +01:00
#include <QQmlContext>
#include <KAboutData>
2020-04-15 21:21:08 +02:00
#include <KLocalizedString>
2020-04-21 23:27:15 +02:00
#include <KLocalizedContext>
2020-02-28 23:25:08 +01:00
#include "entryListModel.h"
#include "feedListModel.h"
2020-03-16 22:37:04 +01:00
#include "database.h"
2020-03-26 14:16:19 +01:00
#include "alligatorsettings.h"
2020-03-29 18:07:28 +02:00
#include "feed.h"
2020-02-28 23:25:08 +01:00
2020-04-21 23:27:15 +02:00
#ifdef Q_OS_ANDROID
Q_DECL_EXPORT
#endif
int main(int argc, char *argv[])
2020-02-28 23:25:08 +01:00
{
2020-04-21 23:27:15 +02:00
#ifdef Q_OS_ANDROID
QGuiApplication app(argc, argv);
#else
2020-02-28 23:25:08 +01:00
QApplication app(argc, argv);
2020-04-21 23:27:15 +02:00
#endif
2020-02-28 23:25:08 +01:00
QCoreApplication::setOrganizationName(QStringLiteral("KDE"));
QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org"));
QCoreApplication::setApplicationName(QStringLiteral("Alligator"));
QCoreApplication::setApplicationVersion(QStringLiteral("0.1"));
qmlRegisterType<FeedListModel>("org.kde.alligator", 1, 0, "FeedListModel");
qmlRegisterType<EntryListModel>("org.kde.alligator", 1, 0, "EntryListModel");
QQmlApplicationEngine engine;
2020-04-21 23:27:15 +02:00
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
2020-02-28 23:25:08 +01:00
2020-04-15 21:21:08 +02:00
KAboutData about(QStringLiteral("alligator"), i18n("Alligator"), QStringLiteral("0.1"), i18n("Feed Reader"),
KAboutLicense::GPL, i18n("© 2020 KDE Community"));
about.addAuthor(i18n("Tobias Fella"), QString(), QStringLiteral("fella@posteo.de"));
2020-03-26 14:16:19 +01:00
KAboutData::setApplicationData(about);
engine.rootContext()->setContextProperty(QStringLiteral("_aboutData"), QVariant::fromValue(about));
AlligatorSettings settings;
engine.rootContext()->setContextProperty(QStringLiteral("_settings"), &settings);
2020-03-16 22:37:04 +01:00
Database::instance();
2020-02-28 23:25:08 +01:00
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
if (engine.rootObjects().isEmpty()) {
return -1;
}
return app.exec();
}