From d5bf13c568838b065da0cd5f404009e650f22cf9 Mon Sep 17 00:00:00 2001 From: Pier Luigi Fiorini Date: Wed, 11 Sep 2024 23:44:28 +0200 Subject: [PATCH] Port to Qt 6 --- CMakeLists.txt | 72 +++--- cmake/FindFlatpak.cmake | 4 +- features.cmake | 53 +++++ src/app/CMakeLists.txt | 81 +++++-- src/app/appcenter.qrc | 27 --- src/app/main.cpp | 24 +- src/app/qml/AddSourceDialog.qml | 9 +- src/app/qml/AllAppsTab.qml | 22 +- src/app/qml/AppPage.qml | 26 +- src/app/qml/InstalledAppsTab.qml | 26 +- src/app/qml/{main.qml => Main.qml} | 30 +-- src/app/qml/SourcesTab.qml | 18 +- src/app/qml/UpdatesTab.qml | 24 +- src/app/qml/app/Buttons.qml | 53 ++--- src/app/qml/app/Details.qml | 80 +++---- src/app/qml/app/Header.qml | 26 +- src/app/qml/app/HeaderRatings.qml | 14 +- src/app/qml/app/Icon.qml | 6 +- src/app/qml/app/Info.qml | 26 +- src/app/qml/app/RatingsReviews.qml | 52 ++-- src/app/qml/app/Review.qml | 80 +++---- src/app/qml/app/Screenshots.qml | 18 +- src/app/qml/app/Transaction.qml | 18 +- src/app/qml/pages/AddReviewPage.qml | 44 ++-- src/app/qml/pages/ReviewsPage.qml | 20 +- src/app/qml/ratings/RatingNumber.qml | 16 +- src/app/qml/ratings/RatingStar.qml | 10 +- src/app/qml/ratings/StarIcon.qml | 12 +- src/app/qml/ratings/StarRatings.qml | 20 +- src/framework/CMakeLists.txt | 74 ++---- src/framework/rating.h | 3 + src/framework/resourceproxy.cpp | 4 +- src/framework/resourceproxy.h | 4 + src/framework/resourcesmodel.cpp | 2 +- src/framework/resourcesmodel.h | 2 + src/framework/review.h | 4 + src/framework/reviewsbackend.cpp | 2 + src/framework/reviewsbackend.h | 1 + src/framework/reviewsmodel.h | 1 + src/framework/screenshotsmodel.cpp | 2 +- src/framework/screenshotsmodel.h | 1 + src/framework/softwaremanager.cpp | 16 +- src/framework/softwaremanager.h | 2 + src/framework/softwareresource.cpp | 6 +- src/framework/softwareresource.h | 4 + src/framework/softwaresource.h | 3 + src/framework/sourcesmodel.cpp | 2 +- src/framework/sourcesmodel.h | 2 + src/framework/transaction.cpp | 2 + src/framework/transaction.h | 3 + src/imports/appcenter/CMakeLists.txt | 51 ++-- .../appcenter/filteredresourcesmodel.h | 1 + src/imports/appcenter/filteredreviewsmodel.h | 1 + src/imports/appcenter/filteredsourcesmodel.h | 1 + src/imports/appcenter/paginatemodel.cpp | 10 +- src/imports/appcenter/paginatemodel.h | 3 + src/imports/appcenter/plugin.cpp | 2 - src/imports/appcenter/plugins.qmltypes | 225 ------------------ src/imports/appcenter/qmldir | 3 - src/notifier/CMakeLists.txt | 55 ++--- src/notifier/main.cpp | 8 +- src/plugins/flatpak/CMakeLists.txt | 82 ++++--- src/plugins/flatpak/flatpakbackend.cpp | 27 ++- src/plugins/flatpak/flatpakbackend.h | 6 +- src/plugins/flatpak/flatpakpluginbase.h | 6 +- src/plugins/flatpak/flatpakresource.cpp | 12 +- src/plugins/odrs/CMakeLists.txt | 40 ++-- src/plugins/odrs/odrsbackend.cpp | 21 +- src/plugins/odrs/odrsutils.cpp | 2 +- 69 files changed, 739 insertions(+), 868 deletions(-) create mode 100644 features.cmake delete mode 100644 src/app/appcenter.qrc rename src/app/qml/{main.qml => Main.qml} (68%) delete mode 100644 src/imports/appcenter/plugins.qmltypes delete mode 100644 src/imports/appcenter/qmldir diff --git a/CMakeLists.txt b/CMakeLists.txt index 829aae9..4fc1a12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.0) +cmake_minimum_required(VERSION 3.19) project("AppCenter" VERSION "0.1.0" @@ -6,53 +6,65 @@ project("AppCenter" LANGUAGES CXX C ) -## Shared macros and functions: -if(NOT LIRI_LOCAL_ECM) - find_package(LiriCMakeShared "2.0.0" REQUIRED NO_MODULE) - list(APPEND CMAKE_MODULE_PATH "${LCS_MODULE_PATH}") +## Only build on the appropriate platforms. +if(NOT UNIX OR ANDROID) + message(NOTICE "\"${CMAKE_PROJECT_NAME}\" can be build only on UNIX-like systems, Android excluded") + return() endif() ## Add some paths to check for CMake modules: list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -## Set C++ standard: -set(CMAKE_CXX_STANDARD 17) +## ECM: +find_package(ECM 5.245.0 REQUIRED NO_MODULE) +list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) -## Set minimum versions required. -set(QT_MIN_VERSION "5.10.0") +## Installation directories: +include(KDEInstallDirs) -## Liri specific setup common for all modules: -include(LiriSetup) +## Compiler settings: +set(KDE_SKIP_NULLPTR_WARNINGS_SETTINGS TRUE) +include(KDECompilerSettings NO_POLICY_SCOPE) -## Only build on the appropriate platforms. -if(NOT UNIX OR ANDROID) - message(NOTICE "Skipping the build as the condition \"UNIX OR ANDROID\" is not met.") - return() -endif() +## CMake settings: +include(KDECMakeSettings) -## Find Qt 5. -find_package(Qt5 "${QT_MIN_VERSION}" - CONFIG REQUIRED - COMPONENTS - Core - DBus - Concurrent - Gui - Qml - Quick - QuickControls2 - LinguistTools -) +## QML module: +include(ECMQmlModule) + +## Disable use of C++ API deprecated in Qt 5.15 +add_compile_definitions(QT_DISABLE_DEPRECATED_UP_TO=0x050F00) + +## Enable C++17: +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) ## Treat warnings as errors: add_compile_options(-Wall -Wextra -Werror) +## Shared macros and functions: +if(NOT LIRI_LOCAL_ECM) + find_package(LiriCMakeShared "2.0.99" REQUIRED NO_MODULE) + list(APPEND CMAKE_MODULE_PATH "${LCS_MODULE_PATH}") +endif() + +## Liri specific setup common for all modules: +include(LiriSetup) + +## Features: +include(features.cmake) + +## QML import path: +if(NOT QML_IMPORT_PATH) + set(QML_IMPORT_PATH ${CMAKE_SOURCE_DIR}/bin CACHE STRING "" FORCE) +endif() + ## Add subdirectories: add_subdirectory(src/framework) add_subdirectory(src/app) add_subdirectory(src/notifier) add_subdirectory(src/imports/appcenter) -if(LINUX AND NOT ANDROID) +if(LINUX AND NOT ANDROID AND TARGET PkgConfig::Flatpak) add_subdirectory(src/plugins/flatpak) endif() add_subdirectory(src/plugins/odrs) diff --git a/cmake/FindFlatpak.cmake b/cmake/FindFlatpak.cmake index 2334ca0..2547c3a 100644 --- a/cmake/FindFlatpak.cmake +++ b/cmake/FindFlatpak.cmake @@ -2,6 +2,6 @@ # # SPDX-License-Identifier: BSD-3-Clause -find_package(PkgConfig) +find_package(PkgConfig REQUIRED) -pkg_check_modules(Flatpak flatpak REQUIRED IMPORTED_TARGET) +pkg_check_modules(Flatpak flatpak>=0.11.8 REQUIRED IMPORTED_TARGET) diff --git a/features.cmake b/features.cmake new file mode 100644 index 0000000..779df7a --- /dev/null +++ b/features.cmake @@ -0,0 +1,53 @@ +# SPDX-FileCopyrightText: 2024 Pier Luigi Fiorini +# SPDX-License-Identifier: BSD-3-Clause + +## Enable feature summary at the end of the configure run: +include(FeatureSummary) + +## Set minimum versions required: +set(QT_MIN_VERSION "6.7.0") + +## Find Qt: +find_package(Qt6 "${QT_MIN_VERSION}" + REQUIRED + COMPONENTS + Core + Core5Compat + DBus + Concurrent + Gui + Qml + QmlIntegration + Quick + QuickControls2 + LinguistTools +) + +## Silence old policy warnings: +qt6_policy(SET QTP0004 OLD) + +## Find AppStreamQt: +find_package(AppStreamQt REQUIRED) + +## Find Flatpak: +option(FEATURE_appcenter_flatpak "Flatpak support" ON) +if(FEATURE_appcenter_flatpak) + find_package(Flatpak QUIET) + set_package_properties(Flatpak PROPERTIES + TYPE RECOMMENDED + PURPOSE "Flatpak support" + ) + if(NOT TARGET PkgConfig::Flatpak) + message(WARNING "You need Flatpak for AppCenter::Flatpak") + set(FEATURE_appcenter_flatpak OFF) + endif() +endif() +add_feature_info("AppCenter::Flatpak" FEATURE_appcenter_flatpak "Build support for Flatpak") +set(FEATURE_appcenter_flatpak "$") + +#### Features + +## Features summary: +if(NOT LIRI_SUPERBUILD) + feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES) +endif() diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 0a43586..95f0270 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -1,32 +1,61 @@ # Translations -file(GLOB LiriAppCenter_TRANSLATIONS "${CMAKE_SOURCE_DIR}/translations/app/*_*.ts") -qt5_add_translation(LiriAppCenter_QM_FILES ${LiriAppCenter_TRANSLATIONS}) -install(FILES ${LiriAppCenter_QM_FILES} - DESTINATION "${INSTALL_DATADIR}/liri-appcenter/translations") +#file(GLOB LiriAppCenter_TRANSLATIONS "${CMAKE_SOURCE_DIR}/translations/app/*_*.ts") +#qt5_add_translation(LiriAppCenter_QM_FILES ${LiriAppCenter_TRANSLATIONS}) +#install(FILES ${LiriAppCenter_QM_FILES} +# DESTINATION "${INSTALL_DATADIR}/liri-appcenter/translations") -liri_add_executable(LiriAppCenter - OUTPUT_NAME - "liri-appcenter" - SOURCES - main.cpp - ${LiriAppCenter_QM_FILES} - RESOURCES - appcenter.qrc - DEFINES +qt6_add_executable(LiriAppCenter MANUAL_FINALIZATION main.cpp) +set_target_properties(LiriAppCenter PROPERTIES OUTPUT_NAME "liri-appcenter") +qt6_finalize_target(LiriAppCenter) + +target_compile_definitions(LiriAppCenter + PRIVATE + APPCENTER_VERSION="${PROJECT_VERSION}" QT_NO_CAST_FROM_ASCII QT_NO_FOREACH - APPCENTER_VERSION="${PROJECT_VERSION}" - APPDATA - "${CMAKE_CURRENT_SOURCE_DIR}/io.liri.AppCenter.appdata.xml" - DESKTOP - "${CMAKE_CURRENT_SOURCE_DIR}/io.liri.AppCenter.desktop" - LIBRARIES - Qt5::Core - Qt5::Gui - Qt5::Qml - Qt5::Quick - Qt5::QuickControls2 - GUI ) -liri_finalize_executable(LiriAppCenter) +target_link_libraries(LiriAppCenter + PRIVATE + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Quick + Qt6::QuickControls2 +) + +qt6_add_qml_module(LiriAppCenter + URI io.liri.AppCenter + VERSION 1.0 + QML_FILES + qml/AddSourceDialog.qml + qml/AllAppsTab.qml + qml/AppPage.qml + qml/InstalledAppsTab.qml + qml/Main.qml + qml/SourcesTab.qml + qml/UpdatesTab.qml + qml/app/Buttons.qml + qml/app/Details.qml + qml/app/Header.qml + qml/app/HeaderRatings.qml + qml/app/Icon.qml + qml/app/Info.qml + qml/app/RatingsReviews.qml + qml/app/Review.qml + qml/app/Screenshots.qml + qml/app/Transaction.qml + qml/pages/AddReviewPage.qml + qml/pages/ReviewsPage.qml + qml/ratings/RatingNumber.qml + qml/ratings/RatingStar.qml + qml/ratings/StarIcon.qml + qml/ratings/StarRatings.qml +) + +install(TARGETS LiriAppCenter DESTINATION ${KDE_INSTALL_BINDIR}) + +install(FILES "io.liri.AppCenter.appdata.xml" + DESTINATION ${KDE_INSTALL_METAINFODIR}) +install(FILES "io.liri.AppCenter.desktop" + DESTINATION ${KDE_INSTALL_APPDIR}) \ No newline at end of file diff --git a/src/app/appcenter.qrc b/src/app/appcenter.qrc deleted file mode 100644 index ccc8d7c..0000000 --- a/src/app/appcenter.qrc +++ /dev/null @@ -1,27 +0,0 @@ - - - qml/AddSourceDialog.qml - qml/AllAppsTab.qml - qml/AppPage.qml - qml/InstalledAppsTab.qml - qml/main.qml - qml/SourcesTab.qml - qml/UpdatesTab.qml - qml/app/Buttons.qml - qml/app/Details.qml - qml/app/Header.qml - qml/app/HeaderRatings.qml - qml/app/Icon.qml - qml/app/Info.qml - qml/app/RatingsReviews.qml - qml/app/Review.qml - qml/app/Screenshots.qml - qml/app/Transaction.qml - qml/pages/AddReviewPage.qml - qml/pages/ReviewsPage.qml - qml/ratings/RatingNumber.qml - qml/ratings/RatingStar.qml - qml/ratings/StarIcon.qml - qml/ratings/StarRatings.qml - - diff --git a/src/app/main.cpp b/src/app/main.cpp index 0c85179..528a477 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -12,6 +12,9 @@ #include #include +using namespace Qt::StringLiterals; + +#if 0 static void loadQtTranslations() { #ifndef QT_NO_TRANSLATION @@ -50,27 +53,32 @@ static void loadAppTranslations() } #endif } +#endif int main(int argc, char *argv[]) { // Set the X11 WML_CLASS so X11 desktops can find the desktop file qputenv("RESOURCE_NAME", QByteArrayLiteral("io.liri.AppCenter")); - QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - app.setApplicationName(QLatin1String("App Center")); - app.setOrganizationDomain(QLatin1String("liri.io")); - app.setOrganizationName(QLatin1String("Liri")); - app.setDesktopFileName(QLatin1String("io.liri.AppCenter.desktop")); + app.setApplicationName("App Center"_L1); + app.setOrganizationDomain("liri.io"_L1); + app.setOrganizationName("Liri"_L1); + app.setDesktopFileName("io.liri.AppCenter"_L1); - QQuickStyle::setStyle(QLatin1String("Material")); + QQuickStyle::setStyle("Material"_L1); +#if 0 // Load translations loadQtTranslations(); loadAppTranslations(); +#endif - QQmlApplicationEngine engine(QUrl(QStringLiteral("qrc:/qml/main.qml"))); + QQmlApplicationEngine engine; + QObject::connect( + &engine, &QQmlApplicationEngine::objectCreationFailed, &app, + []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); + engine.loadFromModule("io.liri.AppCenter", "Main"); return app.exec(); } diff --git a/src/app/qml/AddSourceDialog.qml b/src/app/qml/AddSourceDialog.qml index 13e2bd0..55b1549 100644 --- a/src/app/qml/AddSourceDialog.qml +++ b/src/app/qml/AddSourceDialog.qml @@ -2,10 +2,11 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.0 -import QtQuick.Controls 2.1 +import QtQuick +import QtQuick.Controls +import Fluid as Fluid -Dialog { +Fluid.Dialog { id: addSourceDialog signal failed(string errorMessage) @@ -28,7 +29,7 @@ Dialog { addSourceDialog.failed(qsTr("Failed to retrieve source")); } - TextField { + Fluid.TextField { id: urlField anchors.left: parent.left anchors.top: parent.top diff --git a/src/app/qml/AllAppsTab.qml b/src/app/qml/AllAppsTab.qml index 466ff14..72b2ad3 100644 --- a/src/app/qml/AllAppsTab.qml +++ b/src/app/qml/AllAppsTab.qml @@ -2,13 +2,13 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.0 -import QtQuick.Controls 2.2 -import Fluid.Controls 1.0 as FluidControls -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Controls +import Fluid as Fluid +import Liri.AppCenter as AppCenter import "app" as App -FluidControls.Tab { +Fluid.Tab { title: qsTr("All Apps") AppCenter.FilteredResourcesModel { @@ -18,19 +18,19 @@ FluidControls.Tab { filter: AppCenter.FilteredResourcesModel.AllApps } - ScrollView { + Fluid.ScrollView { anchors.fill: parent clip: true - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + Fluid.ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ListView { - header: FluidControls.HeadlineLabel { + header: Fluid.HeadlineLabel { text: qsTr("Available (%1)").arg(allAppsModel.count) - padding: FluidControls.Units.smallSpacing * 2 + padding: Fluid.Units.smallSpacing * 2 } model: allAppsModel - delegate: FluidControls.ListItem { + delegate: Fluid.ListItem { text: model.name subText: model.summary valueText: model.rating @@ -42,7 +42,7 @@ FluidControls.Tab { iconUrl: model.iconUrl iconSize: 48 } - rightItem: Button { + rightItem: Fluid.Button { anchors.verticalCenter: parent.verticalCenter flat: true text: qsTr("Get") diff --git a/src/app/qml/AppPage.qml b/src/app/qml/AppPage.qml index ae9283d..46bedb8 100644 --- a/src/app/qml/AppPage.qml +++ b/src/app/qml/AppPage.qml @@ -3,15 +3,15 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Controls 1.0 as FluidControls -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts +import Fluid as FluidC +import Liri.AppCenter as AppCenter import "app" as App -FluidControls.Page { +Fluid.Page { id: appPage property AppCenter.ResourceProxy app: null @@ -50,7 +50,7 @@ FluidControls.Page { } } - FluidControls.OverlayView { + Fluid.OverlayView { id: screenshotOverlay property alias source: screenshot.source @@ -74,7 +74,7 @@ FluidControls.Page { } } - BusyIndicator { + Fluid.BusyIndicator { anchors.centerIn: parent visible: screenshot.status != Image.Ready } @@ -85,7 +85,7 @@ FluidControls.Page { } } - ScrollView { + Fluid.ScrollView { id: scrollView anchors.fill: parent @@ -93,18 +93,18 @@ FluidControls.Page { contentHeight: pane.height clip: true - Pane { + Fluid.Pane { id: pane width: scrollView.width height: column.implicitHeight + topPadding + bottomPadding - padding: FluidControls.Units.smallSpacing * 2 + padding: Fluid.Units.smallSpacing * 2 ColumnLayout { id: column - spacing: FluidControls.Units.smallSpacing + spacing: Fluid.Units.smallSpacing width: parent.width App.Header {} diff --git a/src/app/qml/InstalledAppsTab.qml b/src/app/qml/InstalledAppsTab.qml index 8de123f..72ce770 100644 --- a/src/app/qml/InstalledAppsTab.qml +++ b/src/app/qml/InstalledAppsTab.qml @@ -2,16 +2,16 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.3 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Controls 1.0 as FluidControls -import Liri.Core 1.0 as LiriCore -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts +import Fluid as Fluid +import Liri.Core as LiriCore +import Liri.AppCenter as AppCenter import "app" as App -FluidControls.Tab { +Fluid.Tab { title: qsTr("Installed Apps") AppCenter.FilteredResourcesModel { @@ -21,19 +21,19 @@ FluidControls.Tab { filter: AppCenter.FilteredResourcesModel.InstalledApps } - ScrollView { + Fluid.ScrollView { anchors.fill: parent clip: true - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + Fluid.ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ListView { - header: FluidControls.HeadlineLabel { + header: Fluid.HeadlineLabel { text: qsTr("On this device (%1)").arg(installedAppsModel.count) - padding: FluidControls.Units.smallSpacing * 2 + padding: Fluid.Units.smallSpacing * 2 } model: installedAppsModel - delegate: FluidControls.ListItem { + delegate: Fluid.ListItem { text: model.name subText: model.summary valueText: LiriCore.Formatter.formatByteSize(model.installedSize) diff --git a/src/app/qml/main.qml b/src/app/qml/Main.qml similarity index 68% rename from src/app/qml/main.qml rename to src/app/qml/Main.qml index 85bb01d..4d61113 100644 --- a/src/app/qml/main.qml +++ b/src/app/qml/Main.qml @@ -2,14 +2,14 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Material 2.0 -import Fluid.Controls 1.0 as FluidControls -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import QtQuick.Controls.Material +import Fluid as Fluid +import Liri.AppCenter as AppCenter -FluidControls.ApplicationWindow { +Fluid.ApplicationWindow { title: qsTr("App Center") width: 1024 @@ -34,30 +34,30 @@ FluidControls.ApplicationWindow { onFailed: snackBar.open(errorMessage) } - FluidControls.SnackBar { + Fluid.SnackBar { id: snackBar duration: 5000 } - initialPage: FluidControls.TabbedPage { + initialPage: Fluid.TabbedPage { title: qsTr("App Center") actions: [ - FluidControls.Action { - icon.source: FluidControls.Utils.iconUrl("content/add") + Fluid.Action { + icon.source: Fluid.Utils.iconUrl("content/add") text: qsTr("Add source") toolTip: qsTr("Add a new source") onTriggered: addSourceDialog.open() }, - FluidControls.Action { - icon.source: FluidControls.Utils.iconUrl("navigation/refresh") + Fluid.Action { + icon.source: Fluid.Utils.iconUrl("navigation/refresh") text: qsTr("Check for updates") toolTip: qsTr("Check for updates") onTriggered: softwareManager.checkForUpdates() }, - FluidControls.Action { - icon.source: FluidControls.Utils.iconUrl("action/search") + Fluid.Action { + icon.source: Fluid.Utils.iconUrl("action/search") text: qsTr("Search") toolTip: qsTr("Search apps") } diff --git a/src/app/qml/SourcesTab.qml b/src/app/qml/SourcesTab.qml index cf6f98b..ee21596 100644 --- a/src/app/qml/SourcesTab.qml +++ b/src/app/qml/SourcesTab.qml @@ -2,23 +2,23 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.0 -import QtQuick.Controls 2.2 -import Fluid.Controls 1.0 as FluidControls +import QtQuick +import QtQuick.Controls +import Fluid as Fluid -FluidControls.Tab { +Fluid.Tab { title: qsTr("Sources") - ScrollView { + Fluid.ScrollView { anchors.fill: parent ListView { model: softwareManager.sourcesModel - section.delegate: FluidControls.Subheader { + section.delegate: Fluid.Subheader { text: section } section.property: "section" - delegate: FluidControls.ListItem { + delegate: Fluid.ListItem { leftItem: CheckBox { anchors.verticalCenter: parent.verticalCenter checked: model.enabled @@ -27,8 +27,8 @@ FluidControls.Tab { rightItem: Row { anchors.verticalCenter: parent.verticalCenter - ToolButton { - icon.source: FluidControls.Utils.iconUrl("content/remove") + Fluid.ToolButton { + icon.source: Fluid.Utils.iconUrl("content/remove") onClicked: { softwareManager.removeSource(model.source); } diff --git a/src/app/qml/UpdatesTab.qml b/src/app/qml/UpdatesTab.qml index 9007c89..43f8884 100644 --- a/src/app/qml/UpdatesTab.qml +++ b/src/app/qml/UpdatesTab.qml @@ -2,14 +2,14 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.0 -import QtQuick.Controls 2.2 -import Fluid.Controls 1.0 as FluidControls -import Liri.Core 1.0 as LiriCore -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Controls +import Fluid as Fluid +import Liri.Core as LiriCore +import Liri.AppCenter as AppCenter import "app" as App -FluidControls.Tab { +Fluid.Tab { title: qsTr("Updates") AppCenter.FilteredResourcesModel { @@ -19,19 +19,19 @@ FluidControls.Tab { filter: AppCenter.FilteredResourcesModel.Updates } - ScrollView { + Fluid.ScrollView { anchors.fill: parent clip: true - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + Fluid.ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ListView { - header: FluidControls.HeadlineLabel { + header: Fluid.HeadlineLabel { text: qsTr("To update (%1)").arg(updatesModel.count) - padding: FluidControls.Units.smallSpacing * 2 + padding: Fluid.Units.smallSpacing * 2 } model: updatesModel - delegate: FluidControls.ListItem { + delegate: Fluid.ListItem { text: model.name subText: model.summary valueText: LiriCore.Formatter.formatByteSize(model.downloadSize) @@ -41,7 +41,7 @@ FluidControls.Tab { iconUrl: model.iconUrl iconSize: 48 } - rightItem: Button { + rightItem: Fluid.Button { anchors.verticalCenter: parent.verticalCenter flat: true text: qsTr("Update") diff --git a/src/app/qml/app/Buttons.qml b/src/app/qml/app/Buttons.qml index e486a9f..afb80b5 100644 --- a/src/app/qml/app/Buttons.qml +++ b/src/app/qml/app/Buttons.qml @@ -2,30 +2,29 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Core 1.0 as FluidCore -import Fluid.Controls 1.0 as FluidControls -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts +import Fluid as Fluid +import Liri.AppCenter as AppCenter RowLayout { Layout.fillWidth: true - spacing: FluidControls.Units.smallSpacing + spacing: Fluid.Units.smallSpacing - Button { + Fluid.Button { Layout.alignment: Qt.AlignVCenter ToolTip.text: qsTr("Get this resource on your device") - ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 - ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered + ToolTip.delay: Fluid.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 + ToolTip.visible: Fluid.Device.isMobile ? pressed : hovered text: qsTr("Get") flat: true enabled: !transactionIndicator.visible - hoverEnabled: FluidCore.Device.hoverEnabled + hoverEnabled: Fluid.Device.hoverEnabled visible: app.state === AppCenter.SoftwareResource.NotInstalledState onClicked: { var transaction = app.install(); @@ -41,17 +40,17 @@ RowLayout { Material.background: Material.color(Material.Green, Material.Shade500) } - Button { + Fluid.Button { Layout.alignment: Qt.AlignVCenter - ToolTip.text: qsTr("Remove this resource from your device") - ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 - ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered + Fluid.ToolTip.text: qsTr("Remove this resource from your device") + Fluid.ToolTip.delay: Fluid.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 + Fluid.ToolTip.visible: Fluid.Device.isMobile ? pressed : hovered text: qsTr("Remove") flat: true enabled: !transactionIndicator.visible - hoverEnabled: FluidCore.Device.hoverEnabled + hoverEnabled: Fluid.Device.hoverEnabled visible: app.state === AppCenter.SoftwareResource.InstalledState || app.state === AppCenter.SoftwareResource.UpgradableState onClicked: { @@ -67,17 +66,17 @@ RowLayout { Material.foreground: Material.color(Material.Green, Material.Shade500) } - Button { + Fluid.Button { Layout.alignment: Qt.AlignVCenter - ToolTip.text: qsTr("Update this resource") - ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 - ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered + Fluid.ToolTip.text: qsTr("Update this resource") + Fluid.ToolTip.delay: Fluid.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 + Fluid.ToolTip.visible: Fluid.Device.isMobile ? pressed : hovered text: qsTr("Update") flat: true enabled: !transactionIndicator.visible - hoverEnabled: FluidCore.Device.hoverEnabled + hoverEnabled: Fluid.Device.hoverEnabled visible: app.state === AppCenter.SoftwareResource.UpgradableState onClicked: { var transaction = app.update(); @@ -93,17 +92,17 @@ RowLayout { Material.background: Material.color(Material.Green, Material.Shade500) } - Button { + Fluid.Button { Layout.alignment: Qt.AlignVCenter - ToolTip.text: qsTr("Open this resource up") - ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 - ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered + Fluid.ToolTip.text: qsTr("Open this resource up") + Fluid.ToolTip.delay: Fluid.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 + Fluid.ToolTip.visible: Fluid.Device.isMobile ? pressed : hovered text: qsTr("Open") flat: true enabled: !transactionIndicator.visible - hoverEnabled: FluidCore.Device.hoverEnabled + hoverEnabled: Fluid.Device.hoverEnabled visible: app.state === AppCenter.SoftwareResource.InstalledState onClicked: { if (!app.launch()) { diff --git a/src/app/qml/app/Details.qml b/src/app/qml/app/Details.qml index 74c0098..7609c33 100644 --- a/src/app/qml/app/Details.qml +++ b/src/app/qml/app/Details.qml @@ -2,18 +2,18 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.2 -import QtQuick.Layouts 1.2 -import Liri.Core 1.0 as LiriCore -import Fluid.Controls 1.0 as FluidControls -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts +import Liri.Core as LiriCore +import Fluid as Fluid +import Liri.AppCenter as AppCenter ColumnLayout { Layout.fillWidth: true - FluidControls.HeadlineLabel { + Fluid.HeadlineLabel { Layout.fillWidth: true text: qsTr("Details") @@ -22,75 +22,75 @@ ColumnLayout { RowLayout { Layout.alignment: Qt.AlignHCenter - spacing: FluidControls.Units.smallSpacing * 2 + spacing: Fluid.Units.smallSpacing * 2 GridLayout { id: kudosGrid rows: 5 columns: 2 - rowSpacing: FluidControls.Units.smallSpacing - columnSpacing: FluidControls.Units.smallSpacing + rowSpacing: Fluid.Units.smallSpacing + columnSpacing: Fluid.Units.smallSpacing // Localization - FluidControls.Icon { - source: FluidControls.Utils.iconUrl("action/check_circle") + Fluid.Icon { + source: Fluid.Utils.iconUrl("action/check_circle") color: app.hasKudo(AppCenter.SoftwareResource.MyLanguageKudo) ? Material.color(Material.Green) : Material.secondaryTextColor } - Label { + Fluid.Label { text: qsTr("Localized in your language") } // Documentation - FluidControls.Icon { - source: FluidControls.Utils.iconUrl("action/check_circle") + Fluid.Icon { + source: Fluid.Utils.iconUrl("action/check_circle") color: app.hasKudo(AppCenter.SoftwareResource.InstallsUserDocsKudo) ? Material.color(Material.Green) : Material.secondaryTextColor } - Label { + Fluid.Label { text: qsTr("Documentation") } // Releases - FluidControls.Icon { - source: FluidControls.Utils.iconUrl("action/check_circle") + Fluid.Icon { + source: Fluid.Utils.iconUrl("action/check_circle") color: app.hasKudo(AppCenter.SoftwareResource.RecentReleaseKudo) ? Material.color(Material.Green) : Material.secondaryTextColor } - Label { + Fluid.Label { text: qsTr("Release activity") } // System integration - FluidControls.Icon { - source: FluidControls.Utils.iconUrl("action/check_circle") + Fluid.Icon { + source: Fluid.Utils.iconUrl("action/check_circle") color: (app.hasKudo(AppCenter.SoftwareResource.SearchProviderKudo) || app.hasKudo(AppCenter.SoftwareResource.UsesNotificationsKudo) || app.hasKudo(AppCenter.SoftwareResource.HighContrastKudo)) ? Material.color(Material.Green) : Material.secondaryTextColor } - Label { + Fluid.Label { text: qsTr("System integration") } // Sandboxed - FluidControls.Icon { - source: FluidControls.Utils.iconUrl("action/check_circle") + Fluid.Icon { + source: Fluid.Utils.iconUrl("action/check_circle") color: app.hasKudo(AppCenter.SoftwareResource.SandboxedKudo) ? Material.color(Material.Green) : Material.secondaryTextColor } - Label { + Fluid.Label { text: qsTr("Sandboxed") } } @@ -100,61 +100,61 @@ ColumnLayout { rows: 6 columns: 2 - rowSpacing: FluidControls.Units.smallSpacing - columnSpacing: FluidControls.Units.smallSpacing + rowSpacing: Fluid.Units.smallSpacing + columnSpacing: Fluid.Units.smallSpacing // Version - Label { + Fluid.Label { Layout.alignment: Qt.AlignRight text: qsTr("Version:") font.bold: true } - Label { + Fluid.Label { text: app.installedVersion color: Material.secondaryTextColor } // Updated - Label { + Fluid.Label { Layout.alignment: Qt.AlignRight text: qsTr("Updated:") font.bold: true } - Label { + Fluid.Label { text: qsTr("Unknown") color: Material.secondaryTextColor } // Category - Label { + Fluid.Label { Layout.alignment: Qt.AlignRight text: qsTr("Category:") font.bold: true } - Label { + Fluid.Label { text: app.category ? app.category : qsTr("Unknown") color: Material.secondaryTextColor } // License - Label { + Fluid.Label { Layout.alignment: Qt.AlignRight text: qsTr("License:") font.bold: true } - Label { + Fluid.Label { text: app.license ? app.license : qsTr("Unknown") color: Material.secondaryTextColor onLinkActivated: Qt.openUrlExternally(link) @@ -162,28 +162,28 @@ ColumnLayout { // Source - Label { + Fluid.Label { Layout.alignment: Qt.AlignRight text: qsTr("Source:") font.bold: true } - Label { + Fluid.Label { text: app.defaultSource ? app.defaultSource.name : qsTr("Unknown") color: Material.secondaryTextColor } // Size - Label { + Fluid.Label { Layout.alignment: Qt.AlignRight text: qsTr("Size:") font.bold: true } - Label { + Fluid.Label { text: LiriCore.Formatter.formatByteSize(app.size) color: Material.secondaryTextColor } diff --git a/src/app/qml/app/Header.qml b/src/app/qml/app/Header.qml index 73e864c..c1217aa 100644 --- a/src/app/qml/app/Header.qml +++ b/src/app/qml/app/Header.qml @@ -2,12 +2,12 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Controls 1.0 as FluidControls -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts +import Fluid as Fluid +import Liri.AppCenter as AppCenter ColumnLayout { property alias iconSize: icon.iconSize @@ -16,7 +16,7 @@ ColumnLayout { Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter - spacing: FluidControls.Units.smallSpacing + spacing: Fluid.Units.smallSpacing Icon { id: icon @@ -35,16 +35,16 @@ ColumnLayout { ColumnLayout { Layout.fillWidth: true - spacing: FluidControls.Units.smallSpacing + spacing: Fluid.Units.smallSpacing - FluidControls.HeadlineLabel { + Fluid.HeadlineLabel { Layout.fillWidth: true text: app.name elide: Text.ElideRight } - FluidControls.SubheadingLabel { + Fluid.SubheadingLabel { Layout.fillWidth: true Layout.fillHeight: true @@ -54,7 +54,7 @@ ColumnLayout { elide: Text.ElideRight } - ComboBox { + Fluid.ComboBox { model: AppCenter.FilteredSourcesModel { sourcesModel: app ? app.sourcesModel : null showDisabled: false @@ -70,7 +70,7 @@ ColumnLayout { // FIXME: Finish this once we have the information to show /* - FluidControls.BodyLabel { + Fluid.BodyLabel { text: "Developer" level: 2 } @@ -81,7 +81,7 @@ ColumnLayout { } } - FluidControls.ThinDivider { + Fluid.ThinDivider { Layout.fillWidth: true } diff --git a/src/app/qml/app/HeaderRatings.qml b/src/app/qml/app/HeaderRatings.qml index 340346e..1397739 100644 --- a/src/app/qml/app/HeaderRatings.qml +++ b/src/app/qml/app/HeaderRatings.qml @@ -2,18 +2,18 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Controls 1.0 as FluidControls +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts +import Fluid as Fluid import "../ratings" as Ratings ColumnLayout { visible: app.rating RowLayout { - FluidControls.DisplayLabel { + Fluid.DisplayLabel { level: 1 text: (app.rating ? app.rating.rating.toFixed(1) : 0.0.toFixed(1)).toLocaleString(Qt.locale()) color: Material.secondaryTextColor @@ -35,7 +35,7 @@ ColumnLayout { } } - FluidControls.BodyLabel { + Fluid.BodyLabel { level: 2 text: qsTr("%1 Ratings").arg(Number(app.rating ? app.rating.numVotes : 0).toFixed(0).toLocaleString(Qt.locale())) color: Material.secondaryTextColor diff --git a/src/app/qml/app/Icon.qml b/src/app/qml/app/Icon.qml index 3a7dffb..6ed5de6 100644 --- a/src/app/qml/app/Icon.qml +++ b/src/app/qml/app/Icon.qml @@ -2,8 +2,8 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.0 -import Fluid.Controls 1.0 as FluidControls +import QtQuick +import Fluid as Fluid Item { id: iconItem @@ -15,7 +15,7 @@ Item { width: iconSize height: iconSize - FluidControls.Icon { + Fluid.Icon { id: icon size: iconItem.iconSize diff --git a/src/app/qml/app/Info.qml b/src/app/qml/app/Info.qml index 772c854..aeb451f 100644 --- a/src/app/qml/app/Info.qml +++ b/src/app/qml/app/Info.qml @@ -2,18 +2,18 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Controls 1.0 as FluidControls +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Fluid as Fluid ColumnLayout { Layout.fillWidth: true - spacing: FluidControls.Units.smallSpacing + spacing: Fluid.Units.smallSpacing visible: descrLabel.visible && linksRow.visible - FluidControls.BodyLabel { + Fluid.BodyLabel { Layout.fillWidth: true id: descrLabel @@ -27,41 +27,41 @@ ColumnLayout { RowLayout { id: linksRow - spacing: FluidControls.Units.smallSpacing * 2 + spacing: Fluid.Units.smallSpacing * 2 visible: visibleChildren.length > 0 - FluidControls.BodyLabel { + Fluid.BodyLabel { text: qsTr("Website").arg(app.homepageUrl) visible: app.homepageUrl.toString() !== "" onLinkActivated: Qt.openUrlExternally(link) } - FluidControls.BodyLabel { + Fluid.BodyLabel { text: qsTr("Support").arg(app.bugtrackerUrl) visible: app.bugtrackerUrl.toString() !== "" onLinkActivated: Qt.openUrlExternally(link) } - FluidControls.BodyLabel { + Fluid.BodyLabel { text: qsTr("Help").arg(app.helpUrl) visible: app.helpUrl.toString() !== "" onLinkActivated: Qt.openUrlExternally(link) } - FluidControls.BodyLabel { + Fluid.BodyLabel { text: qsTr("FAQ").arg(app.faqUrl) visible: app.faqUrl.toString() !== "" onLinkActivated: Qt.openUrlExternally(link) } - FluidControls.BodyLabel { + Fluid.BodyLabel { text: qsTr("Donate").arg(app.donationUrl) visible: app.donationUrl.toString() !== "" onLinkActivated: Qt.openUrlExternally(link) } } - FluidControls.ThinDivider { + Fluid.ThinDivider { Layout.fillWidth: true } } diff --git a/src/app/qml/app/RatingsReviews.qml b/src/app/qml/app/RatingsReviews.qml index 741f7e0..3032097 100644 --- a/src/app/qml/app/RatingsReviews.qml +++ b/src/app/qml/app/RatingsReviews.qml @@ -2,13 +2,13 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Core 1.0 as FluidCore -import Fluid.Controls 1.0 as FluidControls -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts +import Fluid.Core as FluidCore +import Fluid as Fluid +import Liri.AppCenter as AppCenter import "../ratings" as Ratings ColumnLayout { @@ -19,18 +19,18 @@ ColumnLayout { RowLayout { Layout.fillWidth: true - FluidControls.HeadlineLabel { + Fluid.HeadlineLabel { Layout.fillWidth: true text: qsTr("Ratings and reviews") } - ToolButton { - ToolTip.text: qsTr("Show all reviews") - ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 - ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered + Fluid.ToolButton { + Fluid.ToolTip.text: qsTr("Show all reviews") + Fluid.ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 + Fluid.ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered - icon.source: FluidControls.Utils.iconUrl("navigation/arrow_forward") + icon.source: Fluid.Utils.iconUrl("navigation/arrow_forward") flat: true hoverEnabled: FluidCore.Device.hoverEnabled @@ -43,7 +43,7 @@ ColumnLayout { RowLayout { Layout.alignment: Qt.AlignHCenter - spacing: FluidControls.Units.smallSpacing * 2 + spacing: Fluid.Units.smallSpacing * 2 visible: app.rating Ratings.RatingNumber { @@ -55,7 +55,7 @@ ColumnLayout { } } - BusyIndicator { + Fluid.BusyIndicator { Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter visible: !reviewsModel.fetched @@ -65,8 +65,8 @@ ColumnLayout { Layout.fillWidth: true Layout.fillHeight: true - rowSpacing: FluidControls.Units.smallSpacing - columnSpacing: FluidControls.Units.smallSpacing + rowSpacing: Fluid.Units.smallSpacing + columnSpacing: Fluid.Units.smallSpacing flow: appPage.width > appPage.height ? GridLayout.LeftToRight : GridLayout.TopToBottom visible: reviewsModel.fetched && reviewsModel.count > 0 @@ -88,7 +88,7 @@ ColumnLayout { } Review { - Layout.minimumWidth: (appPage.width / paginateModel.pageSize) - (FluidControls.Units.smallSpacing * 3) + Layout.minimumWidth: (appPage.width / paginateModel.pageSize) - (Fluid.Units.smallSpacing * 3) Layout.fillWidth: true Layout.fillHeight: true } @@ -96,10 +96,10 @@ ColumnLayout { } RowLayout { - Button { - ToolTip.text: qsTr("Show all reviews") - ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 - ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered + Fluid.Button { + Fluid.ToolTip.text: qsTr("Show all reviews") + Fluid.ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 + Fluid.ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered text: qsTr("More reviews...") flat: true @@ -111,10 +111,10 @@ ColumnLayout { } } - Button { - ToolTip.text: qsTr("Post a review of this resource") - ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 - ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered + Fluid.Button { + Fluid.ToolTip.text: qsTr("Post a review of this resource") + Fluid.ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 + Fluid.ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered text: qsTr("Write a review...") flat: true diff --git a/src/app/qml/app/Review.qml b/src/app/qml/app/Review.qml index 865f556..a069651 100644 --- a/src/app/qml/app/Review.qml +++ b/src/app/qml/app/Review.qml @@ -2,15 +2,15 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Core 1.0 as FluidCore -import Fluid.Controls 1.0 as FluidControls +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts +import Fluid.Core as FluidCore +import Fluid as Fluid import "../ratings" as Ratings -Page { +Fluid.Page { readonly property real reviewRating: model.rating property bool drawBorder: true property bool isLastItem: ListView.view && index + 1 === ListView.view.count @@ -21,12 +21,12 @@ Page { border.color: drawBorder ? Material.dividerColor : "transparent" } - leftPadding: FluidControls.Units.smallSpacing * 2 - rightPadding: FluidControls.Units.smallSpacing * 2 - topPadding: FluidControls.Units.smallSpacing * 2 - bottomPadding: FluidControls.Units.smallSpacing + leftPadding: Fluid.Units.smallSpacing * 2 + rightPadding: Fluid.Units.smallSpacing * 2 + topPadding: Fluid.Units.smallSpacing * 2 + bottomPadding: Fluid.Units.smallSpacing - FluidControls.AlertDialog { + Fluid.AlertDialog { id: reportDialog parent: appPage @@ -45,7 +45,7 @@ Page { } } - FluidControls.AlertDialog { + Fluid.AlertDialog { id: removeDialog parent: appPage @@ -67,7 +67,7 @@ Page { ColumnLayout { anchors.fill: parent - FluidControls.TitleLabel { + Fluid.TitleLabel { Layout.fillWidth: true text: model.summary @@ -75,9 +75,9 @@ Page { } RowLayout { - Layout.preferredHeight: FluidControls.Units.smallSpacing * 4 + Layout.preferredHeight: Fluid.Units.smallSpacing * 4 - spacing: FluidControls.Units.smallSpacing + spacing: Fluid.Units.smallSpacing Row { Layout.alignment: Qt.AlignVCenter @@ -94,7 +94,7 @@ Page { } } - FluidControls.BodyLabel { + Fluid.BodyLabel { Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter @@ -106,7 +106,7 @@ Page { } } - FluidControls.BodyLabel { + Fluid.BodyLabel { Layout.fillWidth: true Layout.fillHeight: true @@ -115,29 +115,29 @@ Page { elide: Text.ElideRight } - Label { + Fluid.Label { text: qsTr("%n people found this review helpful", "", model.karmaUp) color: Material.secondaryTextColor visible: model.karmaUp > 0 } RowLayout { - Layout.maximumHeight: FluidControls.Units.smallSpacing * 6 + Layout.maximumHeight: Fluid.Units.smallSpacing * 6 - Label { + Fluid.Label { Layout.alignment: Qt.AlignVCenter text: qsTr("Was this review helpful?") } - ToolButton { + Fluid.ToolButton { Layout.alignment: Qt.AlignVCenter - ToolTip.text: qsTr("Up vote") - ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 - ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered + Fluid.ToolTip.text: qsTr("Up vote") + Fluid.ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 + Fluid.ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered - icon.source: FluidControls.Utils.iconUrl("action/thumb_up") + icon.source: Fluid.Utils.iconUrl("action/thumb_up") icon.width: 18 icon.height: 18 @@ -149,14 +149,14 @@ Page { } } - ToolButton { + Fluid.ToolButton { Layout.alignment: Qt.AlignVCenter - ToolTip.text: qsTr("Down vote") - ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 - ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered + Fluid.ToolTip.text: qsTr("Down vote") + Fluid.ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 + Fluid.ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered - icon.source: FluidControls.Utils.iconUrl("action/thumb_down") + icon.source: Fluid.Utils.iconUrl("action/thumb_down") icon.width: 18 icon.height: 18 @@ -172,12 +172,12 @@ Page { Layout.fillWidth: true } - Button { + Fluid.Button { Layout.alignment: Qt.AlignVCenter - ToolTip.text: qsTr("Report this review") - ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 - ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered + Fluid.ToolTip.text: qsTr("Report this review") + Fluid.ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 + Fluid.ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered flat: true text: qsTr("Report...") @@ -188,12 +188,12 @@ Page { } } - Button { + Fluid.Button { Layout.alignment: Qt.AlignVCenter - ToolTip.text: qsTr("Remove this review") - ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 - ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered + Fluid.ToolTip.text: qsTr("Remove this review") + Fluid.ToolTip.delay: FluidCore.Device.isMobile ? Qt.styleHints.mousePressAndHoldInterval : 0 + Fluid.ToolTip.visible: FluidCore.Device.isMobile ? pressed : hovered flat: true text: qsTr("Remove...") @@ -205,7 +205,7 @@ Page { } } - FluidControls.ThinDivider { + Fluid.ThinDivider { Layout.fillWidth: true visible: !drawBorder && !isLastItem diff --git a/src/app/qml/app/Screenshots.qml b/src/app/qml/app/Screenshots.qml index c10bf17..ae6a5d6 100644 --- a/src/app/qml/app/Screenshots.qml +++ b/src/app/qml/app/Screenshots.qml @@ -2,13 +2,13 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Controls 1.0 as FluidControls -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Fluid as Fluid +import Liri.AppCenter as AppCenter -ScrollView { +Fluid.ScrollView { Layout.fillWidth: true Layout.preferredHeight: screenshotsModel.maximumThumbnailSize.height / 2 @@ -16,7 +16,7 @@ ScrollView { ListView { orientation: ListView.Horizontal - spacing: FluidControls.Units.smallSpacing + spacing: Fluid.Units.smallSpacing visible: count > 0 model: AppCenter.ScreenshotsModel { id: screenshotsModel @@ -33,12 +33,12 @@ ScrollView { height: model.thumbnailSize.height / 2 visible: status !== Image.Error - BusyIndicator { + Fluid.BusyIndicator { anchors.centerIn: parent visible: thumbnail.status == Image.Loading } - FluidControls.Ripple { + Fluid.Ripple { anchors.fill: parent onClicked: screenshotOverlay.show(model.screenshotUrl) } diff --git a/src/app/qml/app/Transaction.qml b/src/app/qml/app/Transaction.qml index f4dc5c3..22ffa8b 100644 --- a/src/app/qml/app/Transaction.qml +++ b/src/app/qml/app/Transaction.qml @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Controls 1.0 as FluidControls -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Fluid as Fluid +import Liri.AppCenter as AppCenter RowLayout { id: transactionIndicator @@ -16,7 +16,7 @@ RowLayout { Layout.leftMargin: spacing Layout.rightMargin: spacing - spacing: FluidControls.Units.smallSpacing * 2 + spacing: Fluid.Units.smallSpacing * 2 visible: transaction && transaction.visible @@ -40,7 +40,7 @@ RowLayout { } ColumnLayout { - ProgressBar { + Fluid.ProgressBar { from: 0.0 to: 100.0 value: transaction ? transaction.progress : 0.0 @@ -60,7 +60,7 @@ RowLayout { Layout.fillWidth: true } - Label { + Fluid.Label { text: { if (!transaction) return ""; @@ -77,7 +77,7 @@ RowLayout { Layout.fillWidth: true } - Button { + Fluid.Button { text: qsTr("Cancel") flat: true enabled: { diff --git a/src/app/qml/pages/AddReviewPage.qml b/src/app/qml/pages/AddReviewPage.qml index 0f6c6dc..3fb8e72 100644 --- a/src/app/qml/pages/AddReviewPage.qml +++ b/src/app/qml/pages/AddReviewPage.qml @@ -2,14 +2,14 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Controls 1.0 as FluidControls -import Liri.AppCenter 1.0 as AppCenter - -FluidControls.Page { +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts +import Fluid as Fluid +import Liri.AppCenter as AppCenter + +Fluid.Page { property var resource property int rating: 0 property int hoverRating: 0 @@ -18,11 +18,11 @@ FluidControls.Page { title: qsTr("Write a review for %1").arg(resource.name) - padding: FluidControls.Units.smallSpacing * 2 + padding: Fluid.Units.smallSpacing * 2 actions: [ - FluidControls.Action { - icon.source: FluidControls.Utils.iconUrl("content/save") + Fluid.Action { + icon.source: Fluid.Utils.iconUrl("content/save") toolTip: qsTr("Submit this review") text: qsTr("Submit") @@ -47,9 +47,9 @@ FluidControls.Page { ColumnLayout { anchors.fill: parent - spacing: FluidControls.Units.smallSpacing + spacing: Fluid.Units.smallSpacing - Label { + Fluid.Label { text: qsTr("Find out what data in the privacy policy") onLinkActivated: { Qt.openUrlExternally("https://odrs.gnome.org/privacy"); @@ -58,7 +58,7 @@ FluidControls.Page { /// - FluidControls.HeadlineLabel { + Fluid.HeadlineLabel { text: qsTr("Rating") } @@ -68,10 +68,10 @@ FluidControls.Page { Repeater { model: 5 - ToolButton { + Fluid.ToolButton { property bool full: (hovering && hoverRating >= index + 1) || (!hovering && rating >= index + 1) - icon.source: FluidControls.Utils.iconUrl("toggle/star" + (full ? "" : "_border")) + icon.source: Fluid.Utils.iconUrl("toggle/star" + (full ? "" : "_border")) flat: true hoverEnabled: true enabled: !submitted @@ -94,14 +94,14 @@ FluidControls.Page { /// - FluidControls.HeadlineLabel { + Fluid.HeadlineLabel { text: qsTr("Summary") } ColumnLayout { Layout.fillWidth: true - TextField { + Fluid.TextField { Layout.fillWidth: true id: summaryField @@ -111,7 +111,7 @@ FluidControls.Page { enabled: !submitted } - Label { + Fluid.Label { text: qsTr("Give a short summary of your review") color: Material.secondaryTextColor } @@ -119,7 +119,7 @@ FluidControls.Page { /// - FluidControls.HeadlineLabel { + Fluid.HeadlineLabel { text: qsTr("Review") } @@ -127,7 +127,7 @@ FluidControls.Page { Layout.fillWidth: true Layout.fillHeight: true - TextArea { + Fluid.TextArea { Layout.fillWidth: true Layout.fillHeight: true @@ -135,7 +135,7 @@ FluidControls.Page { enabled: !submitted } - Label { + Fluid.Label { text: qsTr("What do you think of the app?") color: Material.secondaryTextColor } diff --git a/src/app/qml/pages/ReviewsPage.qml b/src/app/qml/pages/ReviewsPage.qml index 1001b24..13faad5 100644 --- a/src/app/qml/pages/ReviewsPage.qml +++ b/src/app/qml/pages/ReviewsPage.qml @@ -2,25 +2,25 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.2 -import QtQuick.Layouts 1.2 -import Fluid.Controls 1.0 as FluidControls -import Liri.AppCenter 1.0 as AppCenter +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import QtQuick.Layouts +import Fluid as Fluid +import Liri.AppCenter as AppCenter import "../app" as App -FluidControls.Page { +Fluid.Page { property alias resource: reviewsModel.resource title: qsTr("All reviews") - BusyIndicator { + Fluid.BusyIndicator { anchors.centerIn: parent visible: reviewsModel.count == 0 } - ScrollView { + Fluid.ScrollView { anchors.fill: parent clip: true @@ -28,7 +28,7 @@ FluidControls.Page { model: AppCenter.FilteredReviewsModel { id: reviewsModel } - spacing: FluidControls.Units.smallSpacing + spacing: Fluid.Units.smallSpacing delegate: App.Review { width: ListView.view.width height: Math.max(150, implicitHeight) diff --git a/src/app/qml/ratings/RatingNumber.qml b/src/app/qml/ratings/RatingNumber.qml index 01cbb74..f1f3831 100644 --- a/src/app/qml/ratings/RatingNumber.qml +++ b/src/app/qml/ratings/RatingNumber.qml @@ -2,16 +2,16 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQml 2.0 -import QtQuick 2.0 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Material 2.0 -import Fluid.Controls 1.0 as FluidControls +import QtQml +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import Fluid as Fluid Column { - spacing: FluidControls.Units.smallSpacing / 2 + spacing: Fluid.Units.smallSpacing / 2 - FluidControls.DisplayLabel { + Fluid.DisplayLabel { level: 3 text: (app.rating ? app.rating.rating.toFixed(1) : 0.0.toFixed(1)).toLocaleString(Qt.locale()) } @@ -27,7 +27,7 @@ Column { } } - FluidControls.BodyLabel { + Fluid.BodyLabel { text: qsTr("%1 Ratings").arg(Number(app.rating ? app.rating.numVotes : 0).toFixed(0).toLocaleString(Qt.locale())) } } diff --git a/src/app/qml/ratings/RatingStar.qml b/src/app/qml/ratings/RatingStar.qml index 220ae06..5d627cc 100644 --- a/src/app/qml/ratings/RatingStar.qml +++ b/src/app/qml/ratings/RatingStar.qml @@ -2,10 +2,10 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.0 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Material 2.0 -import Fluid.Controls 1.0 as FluidControls +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import Fluid as Fluid StarIcon { property int star: 1 @@ -19,6 +19,6 @@ StarIcon { return false; } - source: FluidControls.Utils.iconUrl("toggle/star" + (half ? "_half" : full ? "" : "_border")) + source: Fluid.Utils.iconUrl("toggle/star" + (half ? "_half" : full ? "" : "_border")) color: full || half ? Material.accentColor : Material.secondaryTextColor } diff --git a/src/app/qml/ratings/StarIcon.qml b/src/app/qml/ratings/StarIcon.qml index f232b1f..cf2422d 100644 --- a/src/app/qml/ratings/StarIcon.qml +++ b/src/app/qml/ratings/StarIcon.qml @@ -2,13 +2,13 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.0 -import QtQuick.Controls 2.0 -import QtQuick.Controls.Material 2.0 -import Fluid.Controls 1.0 as FluidControls +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import Fluid as Fluid -FluidControls.Icon { - source: FluidControls.Utils.iconUrl("toggle/star") +Fluid.Icon { + source: Fluid.Utils.iconUrl("toggle/star") size: 18 color: Material.secondaryTextColor } diff --git a/src/app/qml/ratings/StarRatings.qml b/src/app/qml/ratings/StarRatings.qml index fdf4206..f13af0b 100644 --- a/src/app/qml/ratings/StarRatings.qml +++ b/src/app/qml/ratings/StarRatings.qml @@ -2,15 +2,15 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import QtQuick 2.4 -import QtQuick.Controls 2.2 -import QtQuick.Controls.Material 2.2 -import Fluid.Controls 1.0 as FluidControls +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Material +import Fluid as Fluid Grid { rows: 5 columns: 2 - spacing: FluidControls.Units.smallSpacing / 2 + spacing: Fluid.Units.smallSpacing / 2 horizontalItemAlignment: Grid.AlignRight verticalItemAlignment: Grid.AlignVCenter @@ -22,7 +22,7 @@ Grid { } } - ProgressBar { + Fluid.ProgressBar { from: 0 to: app.rating ? app.rating.numVotes : 0 value: app.rating ? app.rating.star5 : 0 @@ -38,7 +38,7 @@ Grid { } } - ProgressBar { + Fluid.ProgressBar { from: 0 to: app.rating ? app.rating.numVotes : 0 value: app.rating ? app.rating.star4 : 0 @@ -54,7 +54,7 @@ Grid { } } - ProgressBar { + Fluid.ProgressBar { from: 0 to: app.rating ? app.rating.numVotes : 0 value: app.rating ? app.rating.star3 : 0 @@ -70,7 +70,7 @@ Grid { } } - ProgressBar { + Fluid.ProgressBar { from: 0 to: app.rating ? app.rating.numVotes : 0 value: app.rating ? app.rating.star2 : 0 @@ -80,7 +80,7 @@ Grid { StarIcon {} - ProgressBar { + Fluid.ProgressBar { from: 0 to: app.rating ? app.rating.numVotes : 0 value: app.rating ? app.rating.star1 : 0 diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 0bc1eda..9b16e9e 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -1,64 +1,32 @@ -find_package(AppStreamQt REQUIRED) - liri_add_module(AppCenter DESCRIPTION "AppCenter library" SOURCES - backend.cpp - backend.h - backendplugin.cpp - backendplugin.h - cachednetworkaccessmanager.cpp - cachednetworkaccessmanager_p.h - image.cpp - image.h - image_p.h - rating.cpp - rating.h - rating_p.h - resourcesmodel.cpp - resourcesmodel.h - resourcesmodel_p.h - resourceproxy.cpp - resourceproxy.h - resourceproxy_p.h - review.cpp - review.h - review_p.h - reviewsbackend.cpp - reviewsbackend.h - reviewsbackendplugin.cpp - reviewsbackendplugin.h - reviewsmodel.cpp - reviewsmodel.h - reviewsmodel_p.h - screenshotsmodel.cpp - screenshotsmodel.h - screenshotsmodel_p.h - softwaremanager.cpp - softwaremanager.h - softwaremanager_p.h - softwareresource.cpp - softwareresource.h - softwareresource_p.h - softwaresource.cpp - softwaresource.h - softwaresource_p.h - sourcesmodel.cpp - sourcesmodel.h - sourcesmodel_p.h - transaction.cpp - transaction.h - transaction_p.h - transactionsmanager.cpp - transactionsmanager.h - transactionsmanager_p.h + backend.cpp backend.h + backendplugin.cpp backendplugin.h + cachednetworkaccessmanager.cpp cachednetworkaccessmanager_p.h + image.cpp image.h image_p.h + rating.cpp rating.h rating_p.h + resourcesmodel.cpp resourcesmodel.h resourcesmodel_p.h + resourceproxy.cpp resourceproxy.h resourceproxy_p.h + review.cpp review.h review_p.h + reviewsbackend.cpp reviewsbackend.h + reviewsbackendplugin.cpp reviewsbackendplugin.h + reviewsmodel.cpp reviewsmodel.h reviewsmodel_p.h + screenshotsmodel.cpp screenshotsmodel.h screenshotsmodel_p.h + softwaremanager.cpp softwaremanager.h softwaremanager_p.h + softwareresource.cpp softwareresource.h softwareresource_p.h + softwaresource.cpp softwaresource.h softwaresource_p.h + sourcesmodel.cpp sourcesmodel.h sourcesmodel_p.h + transaction.cpp transaction.h transaction_p.h + transactionsmanager.cpp transactionsmanager.h transactionsmanager_p.h DEFINES QT_NO_CAST_FROM_ASCII QT_NO_FOREACH PUBLIC_LIBRARIES - Qt5::Core - Qt5::Network + Qt6::Core + Qt6::Network + Qt6::QmlIntegration AppStreamQt NO_PKGCONFIG ) diff --git a/src/framework/rating.h b/src/framework/rating.h index 6b99d0d..b878e4e 100644 --- a/src/framework/rating.h +++ b/src/framework/rating.h @@ -6,6 +6,7 @@ #define LIRI_APPCENTER_RATING_H #include +#include #include @@ -28,6 +29,8 @@ class LIRIAPPCENTER_EXPORT Rating : public QObject Q_PROPERTY(quint64 star3 READ star3 CONSTANT) Q_PROPERTY(quint64 star4 READ star4 CONSTANT) Q_PROPERTY(quint64 star5 READ star5 CONSTANT) + QML_ELEMENT + QML_UNCREATABLE("Unable to instantiate Rating") public: explicit Rating(const QString &appId, quint64 numVotes, qreal rating, diff --git a/src/framework/resourceproxy.cpp b/src/framework/resourceproxy.cpp index 312b455..ebeeb7f 100644 --- a/src/framework/resourceproxy.cpp +++ b/src/framework/resourceproxy.cpp @@ -67,7 +67,7 @@ void ResourceProxy::setDefaultSource(SoftwareSource *source) auto *oldRes = d->selectedResource; SoftwareResource *newRes = nullptr; - for (auto *resource : qAsConst(d->resources)) { + for (auto *resource : std::as_const(d->resources)) { if (resource->source() == source) { newRes = resource; break; @@ -499,3 +499,5 @@ bool ResourceProxy::operator==(const ResourceProxy &other) } // namespace AppCenter } // namespace Liri + +#include "moc_resourceproxy.cpp" diff --git a/src/framework/resourceproxy.h b/src/framework/resourceproxy.h index a651879..5935b0b 100644 --- a/src/framework/resourceproxy.h +++ b/src/framework/resourceproxy.h @@ -56,6 +56,10 @@ class LIRIAPPCENTER_EXPORT ResourceProxy : public QObject Q_PROPERTY(SoftwareResource::Kudos kudos READ kudos NOTIFY dataChanged) Q_PROPERTY(uint kudosPercentage READ kudosPercentage NOTIFY dataChanged) Q_PROPERTY(Rating *rating READ rating NOTIFY dataChanged) + QML_ELEMENT + QML_UNCREATABLE("Unable to instantiate ResourceProxy") + Q_MOC_INCLUDE("softwareresource.h") + Q_MOC_INCLUDE("transaction.h") public: explicit ResourceProxy(QObject *parent = nullptr); ~ResourceProxy(); diff --git a/src/framework/resourcesmodel.cpp b/src/framework/resourcesmodel.cpp index d07b937..3d9da2a 100644 --- a/src/framework/resourcesmodel.cpp +++ b/src/framework/resourcesmodel.cpp @@ -25,7 +25,7 @@ void ResourcesModelPrivate::addProxies(QList list) { Q_Q(ResourcesModel); - for (auto *proxy : qAsConst(list)) { + for (auto *proxy : std::as_const(list)) { auto connection = q->connect(proxy, &ResourceProxy::dataChanged, q, [this, proxy] { handleProxyChanged(proxy); }); diff --git a/src/framework/resourcesmodel.h b/src/framework/resourcesmodel.h index ae3fa3d..a296e1b 100644 --- a/src/framework/resourcesmodel.h +++ b/src/framework/resourcesmodel.h @@ -6,6 +6,7 @@ #define LIRIAPPCENTERRESOURCESMODEL_H #include +#include #include @@ -23,6 +24,7 @@ class LIRIAPPCENTER_EXPORT ResourcesModel : public QAbstractListModel Q_DECLARE_PRIVATE(ResourcesModel) Q_DISABLE_COPY(ResourcesModel) Q_PROPERTY(SoftwareManager *manager READ manager WRITE setManager NOTIFY managerChanged) + QML_ELEMENT public: enum Roles { ProxyRole = Qt::UserRole + 1, diff --git a/src/framework/review.h b/src/framework/review.h index a5fe59d..abde3de 100644 --- a/src/framework/review.h +++ b/src/framework/review.h @@ -37,6 +37,10 @@ class LIRIAPPCENTER_EXPORT Review : public QObject Q_PROPERTY(bool selfMade READ isSelfMade NOTIFY selfMadeChanged) Q_PROPERTY(bool hasAlreadyVoted READ hasAlreadyVoted NOTIFY hasAlreadyVotedChanged) Q_PROPERTY(QVariantMap metadata READ metadata NOTIFY metadataChanged) + QML_ELEMENT + QML_UNCREATABLE("Unable to instantiate Review") + Q_MOC_INCLUDE("reviewsbackend.h") + Q_MOC_INCLUDE("softwareresource.h") public: explicit Review(QObject *parent = nullptr); ~Review(); diff --git a/src/framework/reviewsbackend.cpp b/src/framework/reviewsbackend.cpp index 6e6be1a..cf919fb 100644 --- a/src/framework/reviewsbackend.cpp +++ b/src/framework/reviewsbackend.cpp @@ -25,3 +25,5 @@ void ReviewsBackend::initialize() } // namespace AppCenter } // namespace Liri + +#include "moc_reviewsbackend.cpp" diff --git a/src/framework/reviewsbackend.h b/src/framework/reviewsbackend.h index 00bffe7..296c13c 100644 --- a/src/framework/reviewsbackend.h +++ b/src/framework/reviewsbackend.h @@ -18,6 +18,7 @@ class SoftwareManager; class LIRIAPPCENTER_EXPORT ReviewsBackend : public QObject { Q_OBJECT + Q_MOC_INCLUDE("review.h") public: explicit ReviewsBackend(SoftwareManager *manager, QObject *parent = nullptr); diff --git a/src/framework/reviewsmodel.h b/src/framework/reviewsmodel.h index c24abb3..6b9df4f 100644 --- a/src/framework/reviewsmodel.h +++ b/src/framework/reviewsmodel.h @@ -22,6 +22,7 @@ class LIRIAPPCENTER_EXPORT ReviewsModel : public QAbstractListModel Q_DISABLE_COPY(ReviewsModel) Q_PROPERTY(SoftwareResource *resource READ resource WRITE setResource NOTIFY resourceChanged) Q_PROPERTY(int count READ rowCount NOTIFY countChanged) + QML_ELEMENT public: enum Roles { ReviewRole = Qt::UserRole + 1, diff --git a/src/framework/screenshotsmodel.cpp b/src/framework/screenshotsmodel.cpp index 3709375..0ff4b55 100644 --- a/src/framework/screenshotsmodel.cpp +++ b/src/framework/screenshotsmodel.cpp @@ -98,7 +98,7 @@ QSize ScreenshotsModel::maximumThumbnailSize() const QSize lastSize, maxSize; - for (const auto &thumbnail : qAsConst(d->thumbnails)) { + for (const auto &thumbnail : std::as_const(d->thumbnails)) { if (!lastSize.isValid() && thumbnail.size().width() > lastSize.width() && thumbnail.size().height() > lastSize.height()) { maxSize = thumbnail.size(); break; diff --git a/src/framework/screenshotsmodel.h b/src/framework/screenshotsmodel.h index 428c3dc..c8f298f 100644 --- a/src/framework/screenshotsmodel.h +++ b/src/framework/screenshotsmodel.h @@ -24,6 +24,7 @@ class LIRIAPPCENTER_EXPORT ScreenshotsModel : public QAbstractListModel Q_PROPERTY(int count READ rowCount NOTIFY countChanged) Q_DECLARE_PRIVATE(ScreenshotsModel) Q_DISABLE_COPY(ScreenshotsModel) + QML_ELEMENT public: enum Roles { ThumbnailUrlRole = Qt::UserRole + 1, diff --git a/src/framework/softwaremanager.cpp b/src/framework/softwaremanager.cpp index bfef418..296724b 100644 --- a/src/framework/softwaremanager.cpp +++ b/src/framework/softwaremanager.cpp @@ -117,7 +117,7 @@ bool SoftwareManager::addSource(const QString &name) { Q_D(SoftwareManager); - for (auto backend : qAsConst(d->resourcesBackends)) { + for (auto backend : std::as_const(d->resourcesBackends)) { if (backend->addSource(name)) return true; } @@ -129,7 +129,7 @@ bool SoftwareManager::removeSource(SoftwareSource *source) { Q_D(SoftwareManager); - for (auto backend : qAsConst(d->resourcesBackends)) { + for (auto backend : std::as_const(d->resourcesBackends)) { if (backend->removeSource(source)) return true; } @@ -143,7 +143,7 @@ SoftwareResources SoftwareManager::updates() const SoftwareResources list; - for (auto backend : qAsConst(d->resourcesBackends)) + for (auto backend : std::as_const(d->resourcesBackends)) list += backend->updates(); return list; @@ -209,7 +209,7 @@ void SoftwareManager::initialize() // Add ratings to software resources connect(backend, &ReviewsBackend::ratingsReady, this, [d, backend] { - for (auto *resource : qAsConst(d->resources)) { + for (auto *resource : std::as_const(d->resources)) { auto *rating = backend->ratingForSofwareResource(resource); if (rating) SoftwareResourcePrivate::get(resource)->setRating(rating); @@ -227,14 +227,14 @@ void SoftwareManager::initialize() } // Initialize them all - for (auto *backend : qAsConst(d->resourcesBackends)) { + for (auto *backend : std::as_const(d->resourcesBackends)) { backend->initialize(); backend->listSources(); backend->listAvailableApps(); backend->listInstalledApps(); backend->checkForUpdates(); } - for (auto *backend : qAsConst(d->reviewsBackends)) { + for (auto *backend : std::as_const(d->reviewsBackends)) { backend->initialize(); backend->fetchRatings(); } @@ -247,10 +247,12 @@ void SoftwareManager::checkForUpdates() { Q_D(SoftwareManager); - for (auto backend : qAsConst(d->resourcesBackends)) + for (auto backend : std::as_const(d->resourcesBackends)) backend->checkForUpdates(); } } // namespace AppCenter } // namespace Liri + +#include "moc_softwaremanager.cpp" diff --git a/src/framework/softwaremanager.h b/src/framework/softwaremanager.h index ae3184f..5e289a7 100644 --- a/src/framework/softwaremanager.h +++ b/src/framework/softwaremanager.h @@ -27,6 +27,8 @@ class LIRIAPPCENTER_EXPORT SoftwareManager : public QObject Q_PROPERTY(uint updatesCount READ updatesCount NOTIFY updatesAvailable) Q_DECLARE_PRIVATE(SoftwareManager) Q_DISABLE_COPY(SoftwareManager) + QML_ELEMENT + Q_MOC_INCLUDE("softwareresource.h") public: explicit SoftwareManager(QObject *parent = nullptr); ~SoftwareManager(); diff --git a/src/framework/softwareresource.cpp b/src/framework/softwareresource.cpp index 55f2aba..518da5c 100644 --- a/src/framework/softwareresource.cpp +++ b/src/framework/softwareresource.cpp @@ -260,7 +260,7 @@ void SoftwareResource::fetchReviews() Q_D(SoftwareResource); const auto list = SoftwareManagerPrivate::get(d->manager)->reviewsBackends; - for (auto *backend : qAsConst(list)) + for (auto *backend : std::as_const(list)) backend->fetchReviews(this); } @@ -271,7 +271,7 @@ void SoftwareResource::submitReview(const QString &summary, Q_D(SoftwareResource); const auto list = SoftwareManagerPrivate::get(d->manager)->reviewsBackends; - for (auto *backend : qAsConst(list)) { + for (auto *backend : std::as_const(list)) { if (backend->submitReview(this, summary, description, rating)) break; } @@ -287,3 +287,5 @@ bool SoftwareResource::operator==(const SoftwareResource &other) const } // namespace AppCenter } // namespace Liri + +#include "moc_softwareresource.cpp" diff --git a/src/framework/softwareresource.h b/src/framework/softwareresource.h index 83e5219..6b99680 100644 --- a/src/framework/softwareresource.h +++ b/src/framework/softwareresource.h @@ -8,6 +8,7 @@ #include #include #include +#include #include @@ -60,6 +61,9 @@ class LIRIAPPCENTER_EXPORT SoftwareResource : public QObject Q_PROPERTY(Rating *rating READ rating NOTIFY ratingChanged) Q_DECLARE_PRIVATE(SoftwareResource) Q_DISABLE_COPY(SoftwareResource) + QML_ELEMENT + QML_UNCREATABLE("Unable to instantiate SoftwareResource") + Q_MOC_INCLUDE("softwaremanager.h") public: enum Type { Addon, diff --git a/src/framework/softwaresource.h b/src/framework/softwaresource.h index d8b8be7..b8a9513 100644 --- a/src/framework/softwaresource.h +++ b/src/framework/softwaresource.h @@ -7,6 +7,7 @@ #include #include +#include #include @@ -35,6 +36,8 @@ class LIRIAPPCENTER_EXPORT SoftwareSource : public QObject Q_PROPERTY(int priority READ priority WRITE setPriority NOTIFY priorityChanged) Q_DECLARE_PRIVATE(SoftwareSource) Q_DISABLE_COPY(SoftwareSource) + QML_ELEMENT + QML_UNCREATABLE("Unable to instantiate SoftwareSource") public: explicit SoftwareSource(Backend *backend, QObject *parent = nullptr); ~SoftwareSource(); diff --git a/src/framework/sourcesmodel.cpp b/src/framework/sourcesmodel.cpp index c8b2202..94f8a9d 100644 --- a/src/framework/sourcesmodel.cpp +++ b/src/framework/sourcesmodel.cpp @@ -137,7 +137,7 @@ SoftwareSource *SourcesModel::findSource(const QString &name) const { Q_D(const SourcesModel); - for (auto source : qAsConst(d->sources)) { + for (auto source : std::as_const(d->sources)) { if (source->name() == name) return source; } diff --git a/src/framework/sourcesmodel.h b/src/framework/sourcesmodel.h index 18aa488..480507f 100644 --- a/src/framework/sourcesmodel.h +++ b/src/framework/sourcesmodel.h @@ -6,6 +6,7 @@ #define LIRIAPPCENTERSOURCESMODEL_H #include +#include #include @@ -21,6 +22,7 @@ class LIRIAPPCENTER_EXPORT SourcesModel : public QAbstractListModel Q_OBJECT Q_DECLARE_PRIVATE(SourcesModel) Q_DISABLE_COPY(SourcesModel) + QML_ELEMENT public: enum Roles { SourceRole = Qt::UserRole + 1, diff --git a/src/framework/transaction.cpp b/src/framework/transaction.cpp index 2fea5cc..12df1c4 100644 --- a/src/framework/transaction.cpp +++ b/src/framework/transaction.cpp @@ -140,3 +140,5 @@ bool Transaction::isVisible() const } // namespace AppCenter } // namespace Liri + +#include "moc_transaction.cpp" diff --git a/src/framework/transaction.h b/src/framework/transaction.h index f3a0db6..6b92f95 100644 --- a/src/framework/transaction.h +++ b/src/framework/transaction.h @@ -6,6 +6,7 @@ #define LIRIAPPCENTERTRANSACTION_H #include +#include #include @@ -29,6 +30,8 @@ class LIRIAPPCENTER_EXPORT Transaction : public QObject Q_PROPERTY(bool visible READ isVisible CONSTANT) Q_DECLARE_PRIVATE(Transaction) Q_DISABLE_COPY(Transaction) + QML_ELEMENT + QML_UNCREATABLE("Unable to instantiate Transaction") public: enum Type { Sources, diff --git a/src/imports/appcenter/CMakeLists.txt b/src/imports/appcenter/CMakeLists.txt index 336c45e..48b5927 100644 --- a/src/imports/appcenter/CMakeLists.txt +++ b/src/imports/appcenter/CMakeLists.txt @@ -2,33 +2,38 @@ if(NOT TARGET Liri::Models) find_package(Liri1Models REQUIRED) endif() -liri_add_qml_plugin(AppCenterQmlPlugin - MODULE_PATH - "Liri/AppCenter" - OUTPUT_NAME - "liriappcenterplugin" +ecm_add_qml_module(AppCenterQmlPlugin + URI + "Liri.AppCenter" VERSION "1.0" - SOURCES - filteredresourcesmodel.cpp - filteredresourcesmodel.h - filteredsourcesmodel.cpp - filteredsourcesmodel.h - filteredreviewsmodel.cpp - filteredreviewsmodel.h - logging.cpp - logging.h - paginatemodel.cpp - paginatemodel.h + NO_GENERATE_PLUGIN_SOURCE + DEPENDENCIES + "QtQuick" + "QtQuick.Controls" + "QtQuick.Layouts" + "QtQuick.Templates" + "QtQuick.Controls.Material" + "Liri.Models" +) + +target_sources(AppCenterQmlPlugin + PRIVATE + filteredresourcesmodel.cpp filteredresourcesmodel.h + filteredsourcesmodel.cpp filteredsourcesmodel.h + filteredreviewsmodel.cpp filteredreviewsmodel.h + logging.cpp logging.h + paginatemodel.cpp paginatemodel.h plugin.cpp - QML_FILES - qmldir - DEFINES - QT_NO_CAST_FROM_ASCII - QT_NO_FOREACH - PUBLIC_LIBRARIES +) + +target_link_libraries(AppCenterQmlPlugin + PUBLIC + Qt6::Core + Qt6::DBus + Qt6::Qml Liri::Models Liri::AppCenter ) -liri_finalize_qml_plugin(AppCenterQmlPlugin) +ecm_finalize_qml_module(AppCenterQmlPlugin) diff --git a/src/imports/appcenter/filteredresourcesmodel.h b/src/imports/appcenter/filteredresourcesmodel.h index 6d5a2a0..bf7fa86 100644 --- a/src/imports/appcenter/filteredresourcesmodel.h +++ b/src/imports/appcenter/filteredresourcesmodel.h @@ -15,6 +15,7 @@ class FilteredResourcesModel : public QSortFilterProxyModel Q_PROPERTY(Liri::AppCenter::SoftwareManager *manager READ manager WRITE setManager NOTIFY managerChanged) Q_PROPERTY(Filter filter READ filter WRITE setFilter NOTIFY modelFilterChanged) Q_PROPERTY(int count READ rowCount NOTIFY countChanged) + QML_ELEMENT public: enum Filter { AllApps, diff --git a/src/imports/appcenter/filteredreviewsmodel.h b/src/imports/appcenter/filteredreviewsmodel.h index 4528cf3..2cb17b8 100644 --- a/src/imports/appcenter/filteredreviewsmodel.h +++ b/src/imports/appcenter/filteredreviewsmodel.h @@ -17,6 +17,7 @@ class FilteredReviewsModel : public QSortFilterProxyModel Q_OBJECT Q_PROPERTY(SoftwareResource *resource READ resource WRITE setResource NOTIFY resourceChanged) Q_PROPERTY(int count READ rowCount NOTIFY countChanged) + QML_ELEMENT public: explicit FilteredReviewsModel(QObject *parent = nullptr); diff --git a/src/imports/appcenter/filteredsourcesmodel.h b/src/imports/appcenter/filteredsourcesmodel.h index 1cec7c5..ace0dc7 100644 --- a/src/imports/appcenter/filteredsourcesmodel.h +++ b/src/imports/appcenter/filteredsourcesmodel.h @@ -14,6 +14,7 @@ class FilteredSourcesModel : public QSortFilterProxyModel Q_OBJECT Q_PROPERTY(Liri::AppCenter::SourcesModel *sourcesModel READ sourcesModel WRITE setSourcesModel NOTIFY sourcesModelChanged) Q_PROPERTY(bool showDisabled READ showDisabled WRITE setShowDisabled NOTIFY showDisabledChanged) + QML_ELEMENT public: explicit FilteredSourcesModel(QObject *parent = nullptr); diff --git a/src/imports/appcenter/paginatemodel.cpp b/src/imports/appcenter/paginatemodel.cpp index e0c14d1..e9a47f7 100644 --- a/src/imports/appcenter/paginatemodel.cpp +++ b/src/imports/appcenter/paginatemodel.cpp @@ -35,7 +35,7 @@ void PaginateModel::setFirstItem(int row) beginResetModel(); d->m_firstItem = row; endResetModel(); - emit firstItemChanged(); + Q_EMIT firstItemChanged(); } } @@ -61,7 +61,7 @@ void PaginateModel::setPageSize(int count) d->m_pageSize = count; endRemoveRows(); } - emit pageSizeChanged(); + Q_EMIT pageSizeChanged(); } } @@ -105,7 +105,7 @@ void PaginateModel::setSourceModel(QAbstractItemModel* model) connect(d->m_sourceModel, &QAbstractItemModel::modelReset, this, &PaginateModel::pageCountChanged); } endResetModel(); - emit sourceModelChanged(); + Q_EMIT sourceModelChanged(); } } @@ -272,14 +272,14 @@ void PaginateModel::_k_sourceDataChanged(const QModelIndex& topLeft, const QMode if (!idxBottom.isValid()) idxBottom = index(rowCount()-1); - emit dataChanged(idxTop, idxBottom, roles); + Q_EMIT dataChanged(idxTop, idxBottom, roles); } void PaginateModel::_k_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last) { Q_UNUSED(last) if (first == 0) - emit headerDataChanged(orientation, 0, 0); + Q_EMIT headerDataChanged(orientation, 0, 0); } void PaginateModel::_k_sourceModelAboutToBeReset() diff --git a/src/imports/appcenter/paginatemodel.h b/src/imports/appcenter/paginatemodel.h index b086cb8..94bc566 100644 --- a/src/imports/appcenter/paginatemodel.h +++ b/src/imports/appcenter/paginatemodel.h @@ -6,6 +6,7 @@ #define PAGINATEMODEL_H #include +#include /** * @class PaginateModel @@ -36,6 +37,8 @@ class PaginateModel : public QAbstractListModel /** If enabled, ensures that pageCount and pageSize are the same. */ Q_PROPERTY(bool staticRowCount READ hasStaticRowCount WRITE setStaticRowCount NOTIFY staticRowCountChanged) + QML_ELEMENT + public: explicit PaginateModel(QObject* object = nullptr); ~PaginateModel() override; diff --git a/src/imports/appcenter/plugin.cpp b/src/imports/appcenter/plugin.cpp index 8c80675..45b3898 100644 --- a/src/imports/appcenter/plugin.cpp +++ b/src/imports/appcenter/plugin.cpp @@ -53,8 +53,6 @@ class LiriAppCenterPlugin : public QQmlExtensionPlugin qmlRegisterUncreatableType(uri, 1, 0, "SoftwareSource", QLatin1String("Unable to instantiate SoftwareSource")); qmlRegisterUncreatableType(uri, 1, 0, "Transaction", QLatin1String("Unable to instantiate Transaction")); - - qmlProtectModule(uri, 1); } }; diff --git a/src/imports/appcenter/plugins.qmltypes b/src/imports/appcenter/plugins.qmltypes deleted file mode 100644 index 42eb9e3..0000000 --- a/src/imports/appcenter/plugins.qmltypes +++ /dev/null @@ -1,225 +0,0 @@ -import QtQuick.tooling 1.2 - -// This file describes the plugin-supplied types contained in the library. -// It is used for QML tooling purposes only. -// -// This file was auto-generated by: -// 'qmlplugindump-qt5 -noinstantiate -nonrelocatable Liri.AppCenter 1.0 /home/plfiorini/git/liri/lirios/.build/install-root/lib/qml' - -Module { - dependencies: ["QtQuick 2.8"] - Component { - name: "FilteredResourcesModel" - prototype: "QSortFilterProxyModel" - exports: ["Liri.AppCenter/FilteredResourcesModel 1.0"] - exportMetaObjectRevisions: [0] - Enum { - name: "Filter" - values: { - "AllApps": 0, - "NotInstalledApps": 1, - "InstalledApps": 2, - "Updates": 3 - } - } - Property { name: "filter"; type: "Filter" } - } - Component { - name: "Liri::AppCenter::ResourcesModel" - prototype: "QAbstractListModel" - exports: ["Liri.AppCenter/ResourcesModel 1.0"] - isCreatable: false - exportMetaObjectRevisions: [0] - } - Component { - name: "Liri::AppCenter::ScreenshotsModel" - prototype: "QAbstractListModel" - exports: ["Liri.AppCenter/ScreenshotsModel 1.0"] - exportMetaObjectRevisions: [0] - Property { name: "app"; type: "SoftwareResource"; isPointer: true } - Property { name: "count"; type: "int"; isReadonly: true } - Method { - name: "thumbnailUrlAt" - type: "QUrl" - Parameter { name: "index"; type: "int" } - } - Method { - name: "screenshotUrlAt" - type: "QUrl" - Parameter { name: "index"; type: "int" } - } - } - Component { - name: "Liri::AppCenter::SoftwareManager" - prototype: "QObject" - exports: ["Liri.AppCenter/SoftwareManager 1.0"] - exportMetaObjectRevisions: [0] - Property { name: "sourcesModel"; type: "SourcesModel"; isReadonly: true; isPointer: true } - Property { name: "resourcesModel"; type: "ResourcesModel"; isReadonly: true; isPointer: true } - Property { name: "hasUpdates"; type: "bool"; isReadonly: true } - Property { name: "updatesCount"; type: "uint"; isReadonly: true } - Signal { name: "initializationCompleted" } - Signal { - name: "sourceAdded" - Parameter { name: "source"; type: "SoftwareSource"; isPointer: true } - } - Signal { - name: "sourceAddFailed" - Parameter { name: "name"; type: "string" } - Parameter { name: "errorMessage"; type: "string" } - } - Signal { - name: "updatesAvailable" - Parameter { name: "count"; type: "uint" } - } - Method { name: "initialize" } - Method { name: "checkForUpdates" } - Method { - name: "addSource" - type: "bool" - Parameter { name: "name"; type: "string" } - } - Method { - name: "removeSource" - type: "bool" - Parameter { name: "source"; type: "SoftwareSource"; isPointer: true } - } - } - Component { - name: "Liri::AppCenter::SoftwareResource" - prototype: "QObject" - exports: ["Liri.AppCenter/SoftwareResource 1.0"] - isCreatable: false - exportMetaObjectRevisions: [0] - Enum { - name: "Type" - values: { - "Addon": 0, - "App": 1, - "Codec": 2, - "Driver": 3, - "Firmware": 4, - "Font": 5, - "Generic": 6, - "InputMethod": 7, - "Localization": 8, - "Runtime": 9, - "Theme": 10 - } - } - Enum { - name: "State" - values: { - "InstalledState": 0, - "NotInstalledState": 1, - "UpgradableState": 2, - "BrokenState": 3 - } - } - Property { name: "type"; type: "Type"; isReadonly: true } - Property { name: "state"; type: "State"; isReadonly: true } - Property { name: "name"; type: "string"; isReadonly: true } - Property { name: "summary"; type: "string"; isReadonly: true } - Property { name: "description"; type: "string"; isReadonly: true } - Property { name: "iconName"; type: "string"; isReadonly: true } - Property { name: "iconUrl"; type: "QUrl"; isReadonly: true } - Property { name: "packageName"; type: "string"; isReadonly: true } - Property { name: "architecture"; type: "string"; isReadonly: true } - Property { name: "license"; type: "string"; isReadonly: true } - Property { name: "origin"; type: "string"; isReadonly: true } - Property { name: "category"; type: "string"; isReadonly: true } - Property { name: "homepageUrl"; type: "QUrl"; isReadonly: true } - Property { name: "bugtrackerUrl"; type: "QUrl"; isReadonly: true } - Property { name: "faqUrl"; type: "QUrl"; isReadonly: true } - Property { name: "helpUrl"; type: "QUrl"; isReadonly: true } - Property { name: "donationUrl"; type: "QUrl"; isReadonly: true } - Property { name: "translateUrl"; type: "QUrl"; isReadonly: true } - Property { name: "version"; type: "string"; isReadonly: true } - Property { name: "installedVersion"; type: "string"; isReadonly: true } - Property { name: "availableVersion"; type: "string"; isReadonly: true } - Property { name: "updatesAvailable"; type: "bool"; isReadonly: true } - Property { name: "downloadSize"; type: "qulonglong"; isReadonly: true } - Property { name: "installedSize"; type: "qulonglong"; isReadonly: true } - Property { name: "changeLog"; type: "string"; isReadonly: true } - Property { name: "localized"; type: "bool"; isReadonly: true } - Signal { name: "installed" } - Signal { name: "updated" } - Signal { name: "uninstalled" } - Method { name: "launch"; type: "bool" } - Method { name: "install"; type: "bool" } - Method { name: "uninstall"; type: "bool" } - Method { name: "update"; type: "bool" } - } - Component { - name: "Liri::AppCenter::SoftwareSource" - prototype: "QObject" - exports: ["Liri.AppCenter/SoftwareSource 1.0"] - isCreatable: false - exportMetaObjectRevisions: [0] - Property { name: "backend"; type: "QObject"; isPointer: true } - Property { name: "name"; type: "string" } - Property { name: "title"; type: "string" } - Property { name: "section"; type: "string" } - Property { name: "enabled"; type: "bool" } - Property { name: "url"; type: "QUrl" } - Property { name: "priority"; type: "int" } - } - Component { - name: "Liri::AppCenter::SourcesModel" - prototype: "QAbstractListModel" - exports: ["Liri.AppCenter/SourcesModel 1.0"] - exportMetaObjectRevisions: [0] - } - Component { - name: "QAbstractProxyModel" - prototype: "QAbstractItemModel" - Property { name: "sourceModel"; type: "QAbstractItemModel"; isPointer: true } - Method { - name: "mapToSource" - type: "QModelIndex" - Parameter { name: "proxyIndex"; type: "QModelIndex" } - } - Method { - name: "mapFromSource" - type: "QModelIndex" - Parameter { name: "sourceIndex"; type: "QModelIndex" } - } - Method { - name: "mapSelectionToSource" - type: "QItemSelection" - Parameter { name: "selection"; type: "QItemSelection" } - } - Method { - name: "mapSelectionFromSource" - type: "QItemSelection" - Parameter { name: "selection"; type: "QItemSelection" } - } - } - Component { - name: "QSortFilterProxyModel" - prototype: "QAbstractProxyModel" - Property { name: "filterRegExp"; type: "QRegExp" } - Property { name: "filterKeyColumn"; type: "int" } - Property { name: "dynamicSortFilter"; type: "bool" } - Property { name: "filterCaseSensitivity"; type: "Qt::CaseSensitivity" } - Property { name: "sortCaseSensitivity"; type: "Qt::CaseSensitivity" } - Property { name: "isSortLocaleAware"; type: "bool" } - Property { name: "sortRole"; type: "int" } - Property { name: "filterRole"; type: "int" } - Property { name: "recursiveFilteringEnabled"; type: "bool" } - Method { - name: "setFilterRegExp" - Parameter { name: "pattern"; type: "string" } - } - Method { - name: "setFilterWildcard" - Parameter { name: "pattern"; type: "string" } - } - Method { - name: "setFilterFixedString" - Parameter { name: "pattern"; type: "string" } - } - Method { name: "clear" } - Method { name: "invalidate" } - } -} diff --git a/src/imports/appcenter/qmldir b/src/imports/appcenter/qmldir deleted file mode 100644 index 4fdc2bd..0000000 --- a/src/imports/appcenter/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module Liri.AppCenter -plugin liriappcenterplugin -classname LiriAppCenterPlugin diff --git a/src/notifier/CMakeLists.txt b/src/notifier/CMakeLists.txt index a6c76e3..f3cda76 100644 --- a/src/notifier/CMakeLists.txt +++ b/src/notifier/CMakeLists.txt @@ -4,48 +4,41 @@ endif() # Translations file(GLOB LiriAppCenter_TRANSLATIONS "${CMAKE_SOURCE_DIR}/translations/notifier/*_*.ts") -qt5_add_translation(LiriAppCenter_QM_FILES ${LiriAppCenter_TRANSLATIONS}) +qt6_create_translation(LiriAppCenter_QM_FILES ${CMAKE_SOURCE_DIR} ${LiriAppCenter_TRANSLATIONS}) install(FILES ${LiriAppCenter_QM_FILES} - DESTINATION "${INSTALL_DATADIR}/liri-appcenter/translations") + DESTINATION "${KDE_INSTALL_DATADIR}/liri-appcenter/translations") -if(IS_ABSOLUTE "${INSTALL_LIBEXECDIR}") - set(LIBEXECDIR "${INSTALL_LIBEXECDIR}") -else() - set(LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBEXECDIR}") -endif() +set(LIBEXECDIR "${KDE_INSTALL_FULL_LIBEXECDIR}") configure_file( "io.liri.AppCenter.Notifier.desktop" "${CMAKE_CURRENT_BINARY_DIR}/io.liri.AppCenter.Notifier.desktop" @ONLY ) -install( - FILES - "${CMAKE_CURRENT_BINARY_DIR}/io.liri.AppCenter.Notifier.desktop" - DESTINATION - "${INSTALL_SYSCONFDIR}/xdg/autostart" +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/io.liri.AppCenter.Notifier.desktop" + DESTINATION "${KDE_INSTALL_AUTOSTARTDIR}") + +qt6_add_executable(LiriAppCenterNotifier + main.cpp + updatenotifier.cpp updatenotifier.h + ${LiriAppCenter_QM_FILES} ) -liri_add_executable(LiriAppCenterNotifier - OUTPUT_NAME - "liri-appcenter-notifier" - INSTALL_DIRECTORY - "${INSTALL_LIBEXECDIR}" - SOURCES - main.cpp - updatenotifier.cpp - updatenotifier.h - ${LiriAppCenter_QM_FILES} - DEFINES +set_target_properties(LiriAppCenterNotifier PROPERTIES + OUTPUT_NAME liri-appcenter-notifier +) + +qt6_finalize_target(LiriAppCenterNotifier) + +target_compile_definitions(LiriAppCenterNotifier + PRIVATE QT_NO_CAST_FROM_ASCII QT_NO_FOREACH VERSION="${PROJECT_VERSION}" - DESKTOP - "${CMAKE_CURRENT_BINARY_DIR}/io.liri.AppCenter.Notifier.desktop" - LIBRARIES - Qt5::Core - Liri::AppCenter - Liri::Notifications - GUI ) -liri_finalize_executable(LiriAppCenterNotifier) +target_link_libraries(LiriAppCenterNotifier + PRIVATE + Qt6::Core + Liri::AppCenter + Liri::Notifications +) \ No newline at end of file diff --git a/src/notifier/main.cpp b/src/notifier/main.cpp index e77703c..4d55c1f 100644 --- a/src/notifier/main.cpp +++ b/src/notifier/main.cpp @@ -16,8 +16,8 @@ static void loadQtTranslations() QString locale = QLocale::system().name(); // Load Qt translations - QTranslator *qtTranslator = new QTranslator(QCoreApplication::instance()); - if (qtTranslator->load(QStringLiteral("qt_%1").arg(locale), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) { + QTranslator *qtTranslator = new QTranslator(); + if (qtTranslator->load(QStringLiteral("qt_%1").arg(locale), QLibraryInfo::path(QLibraryInfo::TranslationsPath))) { qApp->installTranslator(qtTranslator); } else { delete qtTranslator; @@ -38,11 +38,11 @@ static void loadAppTranslations() QStandardPaths::LocateDirectory); // Load shell translations - QTranslator *appTranslator = new QTranslator(QCoreApplication::instance()); + QTranslator *appTranslator = new QTranslator(); if (appTranslator->load(QStringLiteral("%1/notifier_%3").arg(translationsDir, locale))) { QCoreApplication::installTranslator(appTranslator); } else if (locale == QLatin1String("C") || - locale.startsWith(QLatin1String("en"))) { + locale.startsWith(QLatin1String("en"))) { // English is the default, it's translated anyway delete appTranslator; } diff --git a/src/plugins/flatpak/CMakeLists.txt b/src/plugins/flatpak/CMakeLists.txt index abacb43..8ad0d39 100644 --- a/src/plugins/flatpak/CMakeLists.txt +++ b/src/plugins/flatpak/CMakeLists.txt @@ -1,42 +1,58 @@ -find_package(AppStreamQt REQUIRED) -find_package(Flatpak REQUIRED) +qt6_add_plugin(AppCenterFlatpakPlugin + CLASS_NAME FlatpakPlugin + MANUAL_FINALIZATION + flatpakappstreamjob.cpp flatpakappstreamjob.h + flatpakbackend.cpp flatpakbackend.h + flatpakpluginbase.h flatpakplugin.cpp flatpakplugin.h + flatpakresource.cpp flatpakresource.h + flatpaksource.cpp flatpaksource.h + flatpaktransaction.cpp flatpaktransaction.h + flatpaktransactionjob.cpp flatpaktransactionjob.h + flatpakutils.cpp flatpakutils.h + internetcheck.cpp internetcheck.h +) + +set_target_properties(AppCenterFlatpakPlugin PROPERTIES + OUTPUT_NAME flatpak +) + +qt6_finalize_target(AppCenterFlatpakPlugin) + +target_compile_definitions(AppCenterFlatpakPlugin + PRIVATE + QT_NO_CAST_FROM_ASCII + QT_NO_URL_CAST_FROM_STRING + QT_NO_FOREACH + QT_NO_KEYWORDS + QT_NO_SIGNALS_SLOTS_KEYWORDS +) + +if(Flatpak_VERSION VERSION_LESS 1.1.2) + target_compile_definitions(AppCenterFlatpakPlugin + PRIVATE + FLATPAK_EXTERNC_REQUIRED + ) +else() + target_compile_definitions(AppCenterFlatpakPlugin + PRIVATE + FLATPAK_VERBOSE_PROGRESS + FLATPAK_LIST_UNUSED_REFS + ) +endif() -liri_add_plugin(flatpak - TYPE - "liri/appcenter/resources" - SOURCES - flatpakappstreamjob.cpp - flatpakappstreamjob.h - flatpakbackend.cpp - flatpakbackend.h - flatpakpluginbase.h - flatpakplugin.cpp - flatpakplugin.h - flatpakresource.cpp - flatpakresource.h - flatpaksource.cpp - flatpaksource.h - flatpaktransaction.cpp - flatpaktransaction.h - flatpaktransactionjob.cpp - flatpaktransactionjob.h - flatpakutils.cpp - flatpakutils.h - internetcheck.cpp - internetcheck.h - DEFINES - QT_NO_KEYWORD - PUBLIC_LIBRARIES - Qt5::Core - Qt5::Concurrent - Qt5::Network +target_link_libraries(AppCenterFlatpakPlugin + PRIVATE + Qt6::Core + Qt6::Concurrent + Qt6::Network AppStreamQt PkgConfig::Flatpak Liri::AppCenter Liri::AppCenterPrivate ) -liri_finalize_plugin(flatpak) +install(TARGETS AppCenterFlatpakPlugin + DESTINATION "${KDE_INSTALL_QTPLUGINDIR}/liri/appcenter/resources") install(FILES "io.liri.AppCenter.Flatpak.desktop" - DESTINATION "${INSTALL_APPLICATIONSDIR}") + DESTINATION "${KDE_INSTALL_APPDIR}") diff --git a/src/plugins/flatpak/flatpakbackend.cpp b/src/plugins/flatpak/flatpakbackend.cpp index 713d935..00d7a67 100644 --- a/src/plugins/flatpak/flatpakbackend.cpp +++ b/src/plugins/flatpak/flatpakbackend.cpp @@ -123,25 +123,25 @@ void FlatpakBackend::initialize() void FlatpakBackend::listSources() { - for (auto *installation : qAsConst(m_installations)) + for (auto *installation : std::as_const(m_installations)) extractRepositories(installation); } void FlatpakBackend::listAvailableApps() { - for (auto *installation : qAsConst(m_installations)) + for (auto *installation : std::as_const(m_installations)) listAvailableApps(installation); } void FlatpakBackend::listInstalledApps() { - for (auto *installation : qAsConst(m_installations)) + for (auto *installation : std::as_const(m_installations)) listInstalledApps(installation); } void FlatpakBackend::checkForUpdates() { - for (auto installation : qAsConst(m_installations)) { + for (auto installation : std::as_const(m_installations)) { checkLocalUpdatesForInstallation(installation); checkUpdatesForInstallation(installation); } @@ -253,22 +253,23 @@ GPtrArray *FlatpakBackend::listUpdates(FlatpakInstallation *installation) return refs; } -QList FlatpakBackend::componentsFromInstalledRef(FlatpakInstallation *installation, - FlatpakInstalledRef *ref) +AppStream::ComponentBox +FlatpakBackend::componentsFromInstalledRef(FlatpakInstallation *installation, + FlatpakInstalledRef *ref) { const QString name = QString::fromUtf8(flatpak_ref_get_name(FLATPAK_REF(ref))); // Ignore special apps if (name.endsWith(QLatin1String(".Debug")) || name.endsWith(QLatin1String(".Locale")) || name.endsWith(QLatin1String(".BaseApp")) || name.endsWith(QLatin1String(".Docs"))) - return QList(); + return AppStream::ComponentBox(AppStream::ComponentBox::FlagNone); // Desktop entry const QDir exportsDir = FlatpakResource::installationDir(installation).absoluteFilePath(QLatin1String("exports/")); const QString desktopFilePath = exportsDir.absoluteFilePath(QLatin1String("share/applications/") + name + QLatin1String(".desktop")); if (!QFileInfo::exists(desktopFilePath)) - return QList(); + return AppStream::ComponentBox(AppStream::ComponentBox::FlagNone); // AppStream metadata AppStream::Metadata metadata; @@ -277,7 +278,7 @@ QList FlatpakBackend::componentsFromInstalledRef(FlatpakIn if (error != AppStream::Metadata::MetadataErrorNoError) { qCWarning(lcFlatpakBackend, "Failed to parse AppStream metadata from %s", desktopFilePath.toUtf8().constData()); - return QList(); + return AppStream::ComponentBox(AppStream::ComponentBox::FlagNone); } return metadata.components(); @@ -285,7 +286,7 @@ QList FlatpakBackend::componentsFromInstalledRef(FlatpakIn FlatpakResource *FlatpakBackend::findRuntimeResource(const QString &runtime) { - const auto runtimeInfo = runtime.splitRef(QLatin1Char('/')); + const auto runtimeInfo = runtime.split(QLatin1Char('/')); if (runtimeInfo.count() != 3) return nullptr; @@ -457,7 +458,7 @@ FlatpakResource *FlatpakBackend::installFromFlatpakRef(const QString &filePath) if (!iconUrl.isEmpty()) { AppStream::Icon icon; icon.setKind(AppStream::Icon::KindRemote); - icon.setUrl(iconUrl); + icon.setUrl(QUrl::fromUserInput(iconUrl)); component.addIcon(icon); } @@ -479,7 +480,7 @@ bool FlatpakBackend::addLocalSource(const QString &name, const QUrl &url) // Read .flatpakrepo file QSettings settings(url.toLocalFile(), QSettings::NativeFormat); const QString title = settings.value(QLatin1String("Flatpak Repo/Title")).toString(); - const QUrl repoUrl = settings.value(QLatin1String("Flatpak Repo/Url")).toString(); + const QUrl repoUrl = QUrl::fromUserInput(settings.value(QLatin1String("Flatpak Repo/Url")).toString()); const QByteArray gpgKeyBase64 = settings.value(QLatin1String("Flatpak Repo/GPGKey")).toString().toLocal8Bit(); if (name.isEmpty() || title.isEmpty() || repoUrl.isEmpty() || gpgKeyBase64.isEmpty()) { @@ -672,7 +673,7 @@ void FlatpakBackend::addAppsFromRemote(FlatpakInstallation *installation, Flatpa if (!resource) { // Find source FlatpakSource *source = nullptr; - for (auto *curSource : qAsConst(m_sources)) { + for (auto *curSource : std::as_const(m_sources)) { if (curSource->installation() == installation && curSource->name() == name) { source = curSource; break; diff --git a/src/plugins/flatpak/flatpakbackend.h b/src/plugins/flatpak/flatpakbackend.h index ec90d0b..b31aa1a 100644 --- a/src/plugins/flatpak/flatpakbackend.h +++ b/src/plugins/flatpak/flatpakbackend.h @@ -7,6 +7,8 @@ #include +#include + #include #include #include @@ -50,8 +52,8 @@ class FlatpakBackend : public Liri::AppCenter::Backend QList m_sources; QMultiHash m_resources; - QList componentsFromInstalledRef(FlatpakInstallation *installation, - FlatpakInstalledRef *ref); + AppStream::ComponentBox componentsFromInstalledRef(FlatpakInstallation *installation, + FlatpakInstalledRef *ref); FlatpakResource *findRuntimeResource(const QString &runtime); diff --git a/src/plugins/flatpak/flatpakpluginbase.h b/src/plugins/flatpak/flatpakpluginbase.h index 4524e3b..57fcdaf 100644 --- a/src/plugins/flatpak/flatpakpluginbase.h +++ b/src/plugins/flatpak/flatpakpluginbase.h @@ -7,9 +7,13 @@ #undef signals +#ifdef FLATPAK_EXTERNC_REQUIRED extern "C" { -#include +#endif +#include +#ifdef FLATPAK_EXTERNC_REQUIRED } +#endif #include diff --git a/src/plugins/flatpak/flatpakresource.cpp b/src/plugins/flatpak/flatpakresource.cpp index 67b3f18..13ca281 100644 --- a/src/plugins/flatpak/flatpakresource.cpp +++ b/src/plugins/flatpak/flatpakresource.cpp @@ -22,6 +22,8 @@ #include "flatpaktransaction.h" #include "flatpakutils.h" +#include + static quint64 fetchRemoteSize(FlatpakResource *app, FlatpakRef *ref) { g_autoptr(GCancellable) cancellable = g_cancellable_new(); @@ -226,7 +228,7 @@ QVector FlatpakResource::screenshots() const bool FlatpakResource::isLocalized() const { - return m_appdata.language(m_appdata.activeLocale()) > 0; + return m_appdata.languages().size() > 0; } bool FlatpakResource::launch() const @@ -439,7 +441,7 @@ void FlatpakResource::setFlatpakType(FlatpakRefKind kind) case AppStream::Component::KindGeneric: m_type = Liri::AppCenter::SoftwareResource::Generic; break; - case AppStream::Component::KindInputmethod: + case AppStream::Component::KindInputMethod: m_type = Liri::AppCenter::SoftwareResource::InputMethod; break; case AppStream::Component::KindLocalization: @@ -521,7 +523,7 @@ void FlatpakResource::updateComponent() } // Screenshots and thumbnails - const auto screenshots = m_appdata.screenshots(); + const auto screenshots = m_appdata.screenshotsAll(); for (const auto &screenshot : screenshots) { bool thumbnailDone = false; bool screenshotDone = false; @@ -539,7 +541,7 @@ void FlatpakResource::updateComponent() } } } - if (m_appdata.screenshots().size() > 0) + if (m_appdata.screenshotsAll().size() > 0) addKudo(SoftwareResource::HasScreenshotsKudo); // Package information @@ -559,7 +561,7 @@ void FlatpakResource::updateComponent() } // Is last build less than a year ago? - const auto releases = m_appdata.releases(); + const auto releases = m_appdata.releasesPlain().entries(); for (const auto &release : releases) { if (release.timestamp().daysTo(QDateTime::currentDateTime()) < 365) { addKudo(SoftwareResource::RecentReleaseKudo); diff --git a/src/plugins/odrs/CMakeLists.txt b/src/plugins/odrs/CMakeLists.txt index ca6bb3b..bdfbef7 100644 --- a/src/plugins/odrs/CMakeLists.txt +++ b/src/plugins/odrs/CMakeLists.txt @@ -1,27 +1,33 @@ -if(NOT TARGET Liri::Qt5AccountsService) - find_package(Qt5AccountsService REQUIRED) +if(NOT TARGET Liri::Qt6AccountsService) + find_package(Qt6AccountsService REQUIRED) endif() if(NOT TARGET Liri::LocalDevice) find_package(Liri1LocalDevice REQUIRED) endif() -liri_add_plugin(odrs - TYPE - "liri/appcenter/reviews" - SOURCES - odrsbackend.cpp - odrsbackend.h - odrsplugin.cpp - odrsplugin.h - odrsutils.cpp - odrsutils.h - PUBLIC_LIBRARIES - Qt5::Core - Qt5::Network - Liri::Qt5AccountsService +qt6_add_plugin(AppCenterOdrsPlugin + CLASS_NAME OdrsPlugin + MANUAL_FINALIZATION + odrsbackend.cpp odrsbackend.h + odrsplugin.cpp odrsplugin.h + odrsutils.cpp odrsutils.h +) + +set_target_properties(AppCenterOdrsPlugin PROPERTIES + OUTPUT_NAME odrs +) + +qt6_finalize_target(AppCenterOdrsPlugin) + +target_link_libraries(AppCenterOdrsPlugin + PRIVATE + Qt6::Core + Qt6::Network + Liri::Qt6AccountsService Liri::LocalDevice Liri::AppCenter Liri::AppCenterPrivate ) -liri_finalize_plugin(odrs) +install(TARGETS AppCenterOdrsPlugin + DESTINATION "${KDE_INSTALL_QTPLUGINDIR}/liri/appcenter/reviews") diff --git a/src/plugins/odrs/odrsbackend.cpp b/src/plugins/odrs/odrsbackend.cpp index 4841e79..a42a1bd 100644 --- a/src/plugins/odrs/odrsbackend.cpp +++ b/src/plugins/odrs/odrsbackend.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include @@ -40,9 +40,7 @@ OdrsBackend::OdrsBackend(SoftwareManager *manager, QObject *parent) : ReviewsBackend(manager, parent) , m_manager(new CachedNetworkAccessManager(QStringLiteral("odrs"), this)) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) m_manager->setAutoDeleteReplies(true); -#endif } void OdrsBackend::fetchRatings() @@ -88,12 +86,7 @@ void OdrsBackend::fetchRatings() qCWarning(lcOdrsBackend, "Failed to fetch ratings: %s", qPrintable(reply->errorString())); }; -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect(reply, &QNetworkReply::errorOccurred, errorHandler); -#else - connect(reply, static_cast(&QNetworkReply::error), - errorHandler); -#endif connect(reply, &QNetworkReply::finished, this, [this, cacheFileName, reply] { QFile file(cacheFileName); if (file.open(QFile::WriteOnly)) { @@ -153,12 +146,7 @@ void OdrsBackend::fetchReviews(SoftwareResource *resource) qPrintable(resource->appId()), qPrintable(reply->errorString())); }; -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect(reply, &QNetworkReply::errorOccurred, errorHandler); -#else - connect(reply, static_cast(&QNetworkReply::error), - errorHandler); -#endif connect(reply, &QNetworkReply::finished, this, [this, reply] { // We deal with errors in the appropriate slot if (reply->error() != QNetworkReply::NoError) @@ -378,12 +366,7 @@ void OdrsBackend::postReview(ReviewAction action, Review *review) } } }; -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect(reply, &QNetworkReply::errorOccurred, errorHandler); -#else - connect(reply, static_cast(&QNetworkReply::error), - errorHandler); -#endif connect(reply, &QNetworkReply::finished, this, [this, reply, action] { // We deal with errors in the appropriate slot if (reply->error() != QNetworkReply::NoError) @@ -466,7 +449,7 @@ void OdrsBackend::parseReviews(const QJsonDocument &json, SoftwareResource *reso Review *review = nullptr; if (reviewId > 0) { - for (auto *curReview : qAsConst(m_reviews)) { + for (auto *curReview : std::as_const(m_reviews)) { if (curReview->backend() == this && curReview->id() == reviewId) { alreadyExisting = true; review = curReview; diff --git a/src/plugins/odrs/odrsutils.cpp b/src/plugins/odrs/odrsutils.cpp index 58247f9..551ed87 100644 --- a/src/plugins/odrs/odrsutils.cpp +++ b/src/plugins/odrs/odrsutils.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include "odrsutils.h"