Cleanup aboutdata registration

This commit is contained in:
Tobias Fella 2022-11-27 00:44:08 +01:00
parent cbd203272e
commit 5ec65d1b72
5 changed files with 5 additions and 39 deletions

View File

@ -5,7 +5,6 @@ add_subdirectory(solidextras)
set(SRCS_base set(SRCS_base
main.cpp main.cpp
about.cpp
fetcher.cpp fetcher.cpp
database.cpp database.cpp
entry.cpp entry.cpp

View File

@ -1,7 +0,0 @@
/**
* SPDX-FileCopyrightText: 2021 Felipe Kinoshita <kinofhek@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "about.h"

View File

@ -1,27 +0,0 @@
/**
* SPDX-FileCopyrightText: 2021 Felipe Kinoshita <kinofhek@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#pragma once
#include <QObject>
#include <KAboutData>
class AboutType : public QObject
{
Q_OBJECT
Q_PROPERTY(KAboutData aboutData READ aboutData CONSTANT)
public:
static AboutType &instance()
{
static AboutType _instance;
return _instance;
}
[[nodiscard]] KAboutData aboutData() const
{
return KAboutData::applicationData();
}
};

View File

@ -31,7 +31,6 @@
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
#include "androidlogging.h" #include "androidlogging.h"
#endif #endif
#include "about.h"
#include "audiomanager.h" #include "audiomanager.h"
#include "author.h" #include "author.h"
#include "database.h" #include "database.h"
@ -114,7 +113,7 @@ int main(int argc, char *argv[])
i18n("Podcast Player"), i18n("Podcast Player"),
KAboutLicense::GPL, KAboutLicense::GPL,
i18n("© 2020-2022 KDE Community")); i18n("© 2020-2022 KDE Community"));
about.addAuthor(i18n("Tobias Fella"), QString(), QStringLiteral("fella@posteo.de")); about.addAuthor(i18n("Tobias Fella"), QString(), QStringLiteral("fella@posteo.de"), QStringLiteral("https://tobiasfella.de"));
about.addAuthor(i18n("Bart De Vries"), QString(), QStringLiteral("bart@mogwai.be")); about.addAuthor(i18n("Bart De Vries"), QString(), QStringLiteral("bart@mogwai.be"));
about.setProgramLogo(QVariant(QIcon(QStringLiteral(":/logo.svg")))); about.setProgramLogo(QVariant(QIcon(QStringLiteral(":/logo.svg"))));
KAboutData::setApplicationData(about); KAboutData::setApplicationData(about);
@ -140,7 +139,9 @@ int main(int argc, char *argv[])
qmlRegisterUncreatableType<EpisodeModel>("org.kde.kasts", 1, 0, "EpisodeModel", QStringLiteral("Only for enums")); qmlRegisterUncreatableType<EpisodeModel>("org.kde.kasts", 1, 0, "EpisodeModel", QStringLiteral("Only for enums"));
qmlRegisterUncreatableType<FeedsModel>("org.kde.kasts", 1, 0, "FeedsModel", QStringLiteral("Only for enums")); qmlRegisterUncreatableType<FeedsModel>("org.kde.kasts", 1, 0, "FeedsModel", QStringLiteral("Only for enums"));
qmlRegisterSingletonInstance("org.kde.kasts", 1, 0, "AboutType", &AboutType::instance()); qmlRegisterSingletonType("org.kde.kasts", 1, 0, "About", [](QQmlEngine *engine, QJSEngine *) -> QJSValue {
return engine->toScriptValue(KAboutData::applicationData());
});
qmlRegisterSingletonInstance("org.kde.kasts", 1, 0, "Database", &Database::instance()); qmlRegisterSingletonInstance("org.kde.kasts", 1, 0, "Database", &Database::instance());
qmlRegisterSingletonInstance("org.kde.kasts", 1, 0, "Fetcher", &Fetcher::instance()); qmlRegisterSingletonInstance("org.kde.kasts", 1, 0, "Fetcher", &Fetcher::instance());
qmlRegisterSingletonInstance("org.kde.kasts", 1, 0, "DataManager", &DataManager::instance()); qmlRegisterSingletonInstance("org.kde.kasts", 1, 0, "DataManager", &DataManager::instance());

View File

@ -14,5 +14,5 @@ import org.kde.kasts 1.0
Kirigami.AboutPage { Kirigami.AboutPage {
title: i18n("About") title: i18n("About")
aboutData: AboutType.aboutData aboutData: About
} }