From 5ec65d1b72b4e0c5c43e908c904c7f0a32670748 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sun, 27 Nov 2022 00:44:08 +0100 Subject: [PATCH] Cleanup aboutdata registration --- src/CMakeLists.txt | 1 - src/about.cpp | 7 ------- src/about.h | 27 --------------------------- src/main.cpp | 7 ++++--- src/qml/Settings/AboutPage.qml | 2 +- 5 files changed, 5 insertions(+), 39 deletions(-) delete mode 100644 src/about.cpp delete mode 100644 src/about.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 35088835..6bba45e2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,7 +5,6 @@ add_subdirectory(solidextras) set(SRCS_base main.cpp - about.cpp fetcher.cpp database.cpp entry.cpp diff --git a/src/about.cpp b/src/about.cpp deleted file mode 100644 index 826ed383..00000000 --- a/src/about.cpp +++ /dev/null @@ -1,7 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2021 Felipe Kinoshita - * - * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL - */ - -#include "about.h" diff --git a/src/about.h b/src/about.h deleted file mode 100644 index 7fd6a131..00000000 --- a/src/about.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2021 Felipe Kinoshita - * - * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL - */ - -#pragma once - -#include -#include - -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(); - } -}; diff --git a/src/main.cpp b/src/main.cpp index 84fd5c20..feb9eeea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,7 +31,6 @@ #ifdef Q_OS_ANDROID #include "androidlogging.h" #endif -#include "about.h" #include "audiomanager.h" #include "author.h" #include "database.h" @@ -114,7 +113,7 @@ int main(int argc, char *argv[]) i18n("Podcast Player"), KAboutLicense::GPL, 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.setProgramLogo(QVariant(QIcon(QStringLiteral(":/logo.svg")))); KAboutData::setApplicationData(about); @@ -140,7 +139,9 @@ int main(int argc, char *argv[]) qmlRegisterUncreatableType("org.kde.kasts", 1, 0, "EpisodeModel", QStringLiteral("Only for enums")); qmlRegisterUncreatableType("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, "Fetcher", &Fetcher::instance()); qmlRegisterSingletonInstance("org.kde.kasts", 1, 0, "DataManager", &DataManager::instance()); diff --git a/src/qml/Settings/AboutPage.qml b/src/qml/Settings/AboutPage.qml index e3d145c6..8f527756 100644 --- a/src/qml/Settings/AboutPage.qml +++ b/src/qml/Settings/AboutPage.qml @@ -14,5 +14,5 @@ import org.kde.kasts 1.0 Kirigami.AboutPage { title: i18n("About") - aboutData: AboutType.aboutData + aboutData: About }