// SPDX-FileCopyrightText: 2021 Jonah BrĂ¼chert // // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL #include #include #include #include #include #include #include #include #include #include "searchmodel.h" #include "albummodel.h" #include "videoinfoextractor.h" #include "artistmodel.h" #include "userplaylistmodel.h" #include "errorhandler.h" #include "playlistmodel.h" #include "playerutils.h" #include "library.h" #include "asyncdatabase.h" constexpr auto URI = "org.kde.ytmusic"; Q_DECL_EXPORT int main(int argc, char *argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); QCoreApplication::setOrganizationName(QStringLiteral("KDE")); QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org")); QCoreApplication::setApplicationName(QStringLiteral("audiotube")); KLocalizedString::setApplicationDomain("audiotube"); KAboutData::setApplicationData(KAboutData(QStringLiteral("audiotube"), QStringLiteral("AudioTube"))); KCrash::initialize(); QQmlApplicationEngine engine; qmlRegisterType(URI, 1, 0, "SearchModel"); qmlRegisterType(URI, 1, 0, "AlbumModel"); qmlRegisterType(URI, 1, 0, "VideoInfoExtractor"); qmlRegisterType(URI, 1, 0, "ArtistModel"); qmlRegisterType(URI, 1, 0, "PlaylistModel"); qmlRegisterUncreatableType(URI, 1, 0, "PlaybackHistoryModel",""); qmlRegisterType(URI, 1, 0, "SortFilterModel"); qmlRegisterSingletonType(URI, 1, 0, "UserPlaylistModel", [](QQmlEngine *, QJSEngine *) { return new UserPlaylistModel(); }); qmlRegisterSingletonType(URI, 1, 0, "ErrorHandler", [](QQmlEngine *, QJSEngine *) { return new ErrorHandler(); }); qmlRegisterSingletonType(URI, 1, 0, "PlayerUtils", [](QQmlEngine *, QJSEngine *) { return new PlayerUtils(); }); qmlRegisterSingletonInstance(URI, 1, 0, "Library", &Library::instance()); qmlRegisterType(URI, 1, 0, "ThumbnailSource"); qmlRegisterAnonymousType(URI, 1); engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); if (engine.rootObjects().isEmpty()) { return -1; } return app.exec(); }