KUserFeedback

selectionratiosource.h
1/*
2 SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: MIT
5*/
6
7#ifndef KUSERFEEDBACK_SELECTIONRATIOSOURCE_H
8#define KUSERFEEDBACK_SELECTIONRATIOSOURCE_H
9
10#include "kuserfeedbackcore_export.h"
11#include "abstractdatasource.h"
12
13QT_BEGIN_NAMESPACE
15QT_END_NAMESPACE
16
17namespace KUserFeedback {
18
19class SelectionRatioSourcePrivate;
20
21/*! Records the time ratio a given entry is selected via a QItemSelectionModel.
22 *
23 * An example use-case would be the usage ratio of a applications
24 * views/modes selected using a model-based view sidebar (such as
25 * used in e.g. Kontact).
26 *
27 * The default telemetry mode for this source is Provider::DetailedUsageStatistics.
28 */
29class KUSERFEEDBACKCORE_EXPORT SelectionRatioSource : public AbstractDataSource
30{
31public:
32 /*! Create a new selection ratio data source.
33 * @param selectionModel The selection to monitor.
34 * @param sampleName This is the name of the database field this data source is
35 * associated with.
36 */
37 explicit SelectionRatioSource(QItemSelectionModel *selectionModel, const QString &sampleName);
38
39 /*! Determine which role to consider for the reported value.
40 * By default this is Qt::DisplayRole.
41 */
42 void setRole(int role);
43
44 QString description() const override;
45 /*! Set human-readable and translated description of the data provided by this source.
46 * @note This must be set before adding this source, sources without description are
47 * discarded.
48 * @param desc The description.
49 */
50 void setDescription(const QString &desc);
51
52 QVariant data() override;
53 void loadImpl(QSettings *settings) override;
54 void storeImpl(QSettings *settings) override;
55 void resetImpl(QSettings *settings) override;
56
57private:
58 Q_DECLARE_PRIVATE(SelectionRatioSource)
59};
60
61}
62
63#endif // KUSERFEEDBACK_SELECTIONRATIOSOURCE_H
AbstractDataSource(const QString &id, Provider::TelemetryMode mode=Provider::DetailedUsageStatistics)
Create a new data source named name.
SelectionRatioSource(QItemSelectionModel *selectionModel, const QString &sampleName)
Create a new selection ratio data source.
void setRole(int role)
Determine which role to consider for the reported value.
QString description() const override
Returns a human-readable, translated description of what this source provides.
QVariant data() override
Returns the data gathered by this source.
void resetImpl(QSettings *settings) override
Invoked by reset() in order to reset individual settings of this data source.
void loadImpl(QSettings *settings) override
Invoked by load() in order to load individual settings of this data source.
void setDescription(const QString &desc)
Set human-readable and translated description of the data provided by this source.
void storeImpl(QSettings *settings) override
Invoked by store() in order to store individual settings of this data source.
Classes for integrating telemetry collection, survey targeting, and contribution encouragenemt and co...
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.