diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,8 @@ set(CMAKE_AUTORCC ON) +find_package(KUserFeedback) + pkg_check_modules(FLATPAK flatpak>=0.6.12) if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") diff --git a/discover/discover.schema b/discover/discover.schema new file mode 100644 --- /dev/null +++ b/discover/discover.schema @@ -0,0 +1,329 @@ +{ + "aggregation": [ + { + "elements": [ + { + "schemaEntry": "", + "schemaEntryElement": "", + "type": "value" + } + ], + "name": "CPU Architecture Distribution", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "", + "schemaEntryElement": "", + "type": "value" + } + ], + "name": "CPU Count Distribution", + "type": "numeric" + }, + { + "elements": [ + { + "schemaEntry": "", + "schemaEntryElement": "", + "type": "value" + } + ], + "name": "OS Distribution", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "", + "schemaEntryElement": "", + "type": "value" + }, + { + "schemaEntry": "", + "schemaEntryElement": "", + "type": "value" + } + ], + "name": "Platform Details", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "style", + "schemaEntryElement": "style", + "type": "value" + } + ], + "name": "Widget Style Distribution", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "style", + "schemaEntryElement": "dark", + "type": "value" + } + ], + "name": "Palette Color Scheme", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "usageTime", + "schemaEntryElement": "value", + "type": "value" + } + ], + "name": "Usage Time Distribution", + "type": "numeric" + }, + { + "elements": [ + { + "schemaEntry": "screens", + "type": "size" + } + ], + "name": "Amount of Screens", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "screens", + "schemaEntryElement": "dpi", + "type": "value" + } + ], + "name": "DPI Distribution", + "type": "numeric" + }, + { + "elements": [ + { + "schemaEntry": "opengl", + "schemaEntryElement": "type", + "type": "value" + } + ], + "name": "OpenGL Stack Type", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "opengl", + "schemaEntryElement": "vendor", + "type": "value" + } + ], + "name": "OpenGL Vendor Distribution", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "opengl", + "schemaEntryElement": "renderer", + "type": "value" + } + ], + "name": "OpenGL Renderer Distribution", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "opengl", + "schemaEntryElement": "type", + "type": "value" + }, + { + "schemaEntry": "opengl", + "schemaEntryElement": "version", + "type": "value" + } + ], + "name": "OpenGL Version Distribution", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "opengl", + "schemaEntryElement": "type", + "type": "value" + }, + { + "schemaEntry": "opengl", + "schemaEntryElement": "glslVersion", + "type": "value" + } + ], + "name": "OpenGL GLSL Version Distribution", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "opengl", + "schemaEntryElement": "profile", + "type": "value" + } + ], + "name": "OpenGL Profile Distribution", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "locale", + "schemaEntryElement": "language", + "type": "value" + } + ], + "name": "Language Distribution", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "locale", + "schemaEntryElement": "region", + "type": "value" + } + ], + "name": "Region Distribution", + "type": "category" + }, + { + "elements": [ + { + "schemaEntry": "qtVersion", + "schemaEntryElement": "value", + "type": "value" + } + ], + "name": "Qt Version Distribution", + "type": "category" + } + ], + "name": "org.kde.discover", + "schema": [ + { + "elements": [ + { + "name": "style", + "type": "string" + }, + { + "name": "dark", + "type": "bool" + } + ], + "name": "style", + "type": "scalar" + }, + { + "elements": [ + { + "name": "value", + "type": "int" + } + ], + "name": "usageTime", + "type": "scalar" + }, + { + "elements": [ + { + "name": "width", + "type": "int" + }, + { + "name": "height", + "type": "int" + }, + { + "name": "dpi", + "type": "int" + } + ], + "name": "screens", + "type": "list" + }, + { + "elements": [ + { + "name": "type", + "type": "string" + }, + { + "name": "vendor", + "type": "string" + }, + { + "name": "renderer", + "type": "string" + }, + { + "name": "version", + "type": "string" + }, + { + "name": "vendorVersion", + "type": "string" + }, + { + "name": "glslVersion", + "type": "string" + }, + { + "name": "profile", + "type": "string" + } + ], + "name": "opengl", + "type": "scalar" + }, + { + "elements": [ + { + "name": "language", + "type": "string" + }, + { + "name": "region", + "type": "string" + } + ], + "name": "locale", + "type": "scalar" + }, + { + "elements": [ + { + "name": "value", + "type": "string" + } + ], + "name": "qtVersion", + "type": "scalar" + }, + { + "elements": [ + { + "name": "value", + "type": "string" + } + ], + "name": "applicationSourceName", + "type": "scalar" + } + ] +} diff --git a/discover/qml/DiscoverWindow.qml b/discover/qml/DiscoverWindow.qml --- a/discover/qml/DiscoverWindow.qml +++ b/discover/qml/DiscoverWindow.qml @@ -5,6 +5,7 @@ import org.kde.discover 2.0 import org.kde.discover.app 1.0 import org.kde.kirigami 2.2 as Kirigami +import org.kde.userfeedback 1.0 as UserFeedback import "navigation.js" as Navigation Kirigami.ApplicationWindow @@ -51,6 +52,121 @@ showPassiveNotification(i18n("Running as root is discouraged and unnecessary.")); } + Component { + id: feedbackPage + Kirigami.OverlaySheet { + id: sheet + property QtObject provider + contentItem: ColumnLayout { + Kirigami.Heading { + Layout.fillWidth: true + text: i18n("Contribute Statistics") + } + Kirigami.Label { + Layout.fillWidth: true + wrapMode: Text.WordWrap + text: i18n("We make this application for you. You can help us improve it by contributing information on how you use it. This allows us to make sure we focus on things that matter to you.\nContributing statistics is of course entirely anonymous, will not use any kind of unique identifier and will not cover any data you process with this application.") + } + ComboBox { + id: statisticsModeCombo + Layout.fillWidth: true + currentIndex: 2 + textRole: "text" + model: ListModel { id: modeOptions } + Component.onCompleted: { + modeOptions.append({text: i18n("No Statistics"), value: UserFeedback.Provider.NoStatistics}) + modeOptions.append({text: i18n("Basic System Information"), value: UserFeedback.Provider.BasicSystemInformation}) + modeOptions.append({text: i18n("Basic Usage Information"), value: UserFeedback.Provider.BasicUsageStatistics}) + modeOptions.append({text: i18n("Detailed System Information"), value: UserFeedback.Provider.DetailedSystemInformation}) + modeOptions.append({text: i18n("Detailed Usage Information"), value: UserFeedback.Provider.DetailedUsageStatistics}) + + for(var i = 0, c=modeOptions.count; i applicationBackends() const; void setCurrentApplicationBackend(AbstractResourcesBackend* backend, bool writeConfig = true); diff --git a/libdiscover/resources/ResourcesModel.cpp b/libdiscover/resources/ResourcesModel.cpp --- a/libdiscover/resources/ResourcesModel.cpp +++ b/libdiscover/resources/ResourcesModel.cpp @@ -380,8 +380,7 @@ void ResourcesModel::initApplicationsBackend() { - KConfigGroup settings(KSharedConfig::openConfig(), "ResourcesModel"); - const QString name = settings.readEntry("currentApplicationBackend", QStringLiteral("packagekit-backend")); + const auto name = applicationSourceName(); const auto backends = applicationBackends(); auto idx = kIndexOf(backends, [name](AbstractResourcesBackend* b) { return b->name() == name; }); @@ -391,3 +390,9 @@ } setCurrentApplicationBackend(backends.value(idx, nullptr), false); } + +QString ResourcesModel::applicationSourceName() const +{ + KConfigGroup settings(KSharedConfig::openConfig(), "ResourcesModel"); + return settings.readEntry("currentApplicationBackend", QStringLiteral("packagekit-backend")); +}