KUserFeedback

feedbackconfiguicontroller.h
1/*
2 SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: MIT
5*/
6
7#ifndef KUSERFEEDBACK_FEEDBACKCONFIGUICONTROLLER_H
8#define KUSERFEEDBACK_FEEDBACKCONFIGUICONTROLLER_H
9
10#include "kuserfeedbackcore_export.h"
11#include "provider.h"
12
13#include <QObject>
14
15#include <memory>
16
17namespace KUserFeedback {
18
19class FeedbackConfigUiControllerPrivate;
20class Provider;
21
22/*! Logic/behavior of the feedback configuration UI.
23 * This is available for use in e.g. QtQuick-based UIs.
24 * @see FeedbackConfigWidget
25 */
26class KUSERFEEDBACKCORE_EXPORT FeedbackConfigUiController : public QObject
27{
29 /*! The Provider instance we are configuring. */
31 /*! Amount of telemetry modes supported by the provider. */
33 /*! Amount of supported survey modes. */
35 /*! Name of the application that will appear on descriptions. By default it will use QGuiApplication::applicationDisplayName() */
36 Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName NOTIFY applicationNameChanged)
37public:
38 explicit FeedbackConfigUiController(QObject *parent = nullptr);
39 ~FeedbackConfigUiController() override;
40
41 /*! Returns the feedback provider to be configured. */
43 /*! Set the feedback provider to configure. */
44 void setFeedbackProvider(Provider *provider);
45
46 /*! Amount of supported telemetry modes.
47 * This depends on what type of sources the provider actually has.
48 */
49 int telemetryModeCount() const;
50 /*! Amount of supported survey modes. */
51 int surveyModeCount() const;
52
54 void setApplicationName(const QString& appName);
55
56 /*! Convert slider index to telemetry mode. */
57 Q_INVOKABLE KUserFeedback::Provider::TelemetryMode telemetryIndexToMode(int index) const;
58 /*! Convert telemetry mode to slider index. */
59 Q_INVOKABLE int telemetryModeToIndex(KUserFeedback::Provider::TelemetryMode mode) const;
60
61 /*! Telemetry mode short name. */
62 Q_INVOKABLE QString telemetryModeName(int telemetryIndex) const;
63 /*! Telemetry mode explanation text. */
64 Q_INVOKABLE QString telemetryModeDescription(int telemetryIndex) const;
65 /*! Detailed information about the data sources of the given telemetry mode index. */
66 Q_INVOKABLE QString telemetryModeDetails(int telemetryIndex) const;
67
68 /*! Telemetry mode short name. */
69 Q_INVOKABLE QString telemetryName(KUserFeedback::Provider::TelemetryMode mode) const;
70 /*! Telemetry mode explanation text. */
72
73 /*! Convert slider index to survey interval. */
74 Q_INVOKABLE int surveyIndexToInterval(int index) const;
75 /*! Convert survey interval to slider index. */
76 Q_INVOKABLE int surveyIntervalToIndex(int interval) const;
77
78 /*! Survey mode explanation text. */
79 Q_INVOKABLE QString surveyModeDescription(int surveyIndex) const;
80
82 /*! A provider-related setting has changed. */
84 void applicationNameChanged(const QString &applicationName);
85
86private:
87 std::unique_ptr<FeedbackConfigUiControllerPrivate> d;
88};
89
90}
91
92#endif // KUSERFEEDBACK_FEEDBACKCONFIGUICONTROLLER_H
KUserFeedback::Provider * feedbackProvider
The Provider instance we are configuring.
Q_INVOKABLE QString telemetryDescription(KUserFeedback::Provider::TelemetryMode mode) const
Telemetry mode explanation text.
void providerChanged()
A provider-related setting has changed.
void setFeedbackProvider(Provider *provider)
Set the feedback provider to configure.
Q_INVOKABLE QString telemetryModeDescription(int telemetryIndex) const
Telemetry mode explanation text.
Q_INVOKABLE int surveyIntervalToIndex(int interval) const
Convert survey interval to slider index.
Q_INVOKABLE int surveyIndexToInterval(int index) const
Convert slider index to survey interval.
Q_INVOKABLE QString surveyModeDescription(int surveyIndex) const
Survey mode explanation text.
Q_INVOKABLE QString telemetryModeDetails(int telemetryIndex) const
Detailed information about the data sources of the given telemetry mode index.
int telemetryModeCount
Amount of telemetry modes supported by the provider.
QString applicationName
Name of the application that will appear on descriptions.
Q_INVOKABLE int telemetryModeToIndex(KUserFeedback::Provider::TelemetryMode mode) const
Convert telemetry mode to slider index.
Q_INVOKABLE KUserFeedback::Provider::TelemetryMode telemetryIndexToMode(int index) const
Convert slider index to telemetry mode.
Q_INVOKABLE QString telemetryModeName(int telemetryIndex) const
Telemetry mode short name.
int surveyModeCount
Amount of supported survey modes.
Q_INVOKABLE QString telemetryName(KUserFeedback::Provider::TelemetryMode mode) const
Telemetry mode short name.
The central object managing data sources and transmitting feedback to the server.
Definition provider.h:32
Classes for integrating telemetry collection, survey targeting, and contribution encouragenemt and co...
QObject(QObject *parent)
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:56:44 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.