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{
28 Q_OBJECT
29 /*! The Provider instance we are configuring. */
30 Q_PROPERTY(KUserFeedback::Provider* feedbackProvider READ feedbackProvider WRITE setFeedbackProvider NOTIFY providerChanged)
31 /*! Amount of telemetry modes supported by the provider. */
32 Q_PROPERTY(int telemetryModeCount READ telemetryModeCount NOTIFY providerChanged)
33 /*! Amount of supported survey modes. */
34 Q_PROPERTY(int surveyModeCount READ surveyModeCount CONSTANT)
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);
40
41 /*! Returns the feedback provider to be configured. */
42 Provider* feedbackProvider() const;
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
53 QString applicationName() const;
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. */
71 Q_INVOKABLE QString telemetryDescription(KUserFeedback::Provider::TelemetryMode mode) const;
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
81Q_SIGNALS:
82 /*! A provider-related setting has changed. */
83 void providerChanged();
84 void applicationNameChanged(const QString &applicationName);
85
86private:
87 std::unique_ptr<FeedbackConfigUiControllerPrivate> d;
88};
89
90}
91
92#endif // KUSERFEEDBACK_FEEDBACKCONFIGUICONTROLLER_H
Logic/behavior of the feedback configuration UI.
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...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.