KUserFeedback::Provider

KUserFeedback::Provider Class Reference

#include <provider.h>

Inheritance diagram for KUserFeedback::Provider:

Public Types

enum  TelemetryMode {
  NoTelemetry, BasicSystemInformation = 0x10, BasicUsageStatistics = 0x20, DetailedSystemInformation = 0x30,
  DetailedUsageStatistics = 0x40
}
 

Properties

int applicationStartsUntilEncouragement
 
int applicationUsageTimeUntilEncouragement
 
QString describeDataSources
 
bool enabled
 
int encouragementDelay
 
int encouragementInterval
 
QUrl feedbackServer
 
QString productIdentifier
 
int submissionInterval
 
int surveyInterval
 
TelemetryMode telemetryMode
 
- Properties inherited from QObject
 objectName
 

Signals

void dataSourcesChanged ()
 
void enabledChanged ()
 
void providerSettingsChanged ()
 
void showEncouragementMessage ()
 
void surveyAvailable (const KUserFeedback::SurveyInfo &survey)
 
void surveyIntervalChanged ()
 
void telemetryModeChanged ()
 

Public Slots

void load ()
 
void store ()
 
void submit ()
 
void surveyCompleted (const KUserFeedback::SurveyInfo &info)
 

Public Member Functions

 Provider (QObject *parent=nullptr)
 
void addDataSource (AbstractDataSource *source)
 
int applicationStartsUntilEncouragement () const
 
int applicationUsageTimeUntilEncouragement () const
 
AbstractDataSourcedataSource (const QString &id) const
 
QVector< AbstractDataSource * > dataSources () const
 
QString describeDataSources () const
 
int encouragementDelay () const
 
int encouragementInterval () const
 
QUrl feedbackServer () const
 
bool isEnabled () const
 
QString productIdentifier () const
 
void setApplicationStartsUntilEncouragement (int starts)
 
void setApplicationUsageTimeUntilEncouragement (int secs)
 
void setEnabled (bool enabled)
 
void setEncouragementDelay (int secs)
 
void setEncouragementInterval (int days)
 
void setFeedbackServer (const QUrl &url)
 
void setProductIdentifier (const QString &productId)
 
void setSubmissionInterval (int days)
 
void setSurveyInterval (int days)
 
void setTelemetryMode (TelemetryMode mode)
 
int submissionInterval () const
 
int surveyInterval () const
 
TelemetryMode telemetryMode () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

The central object managing data sources and transmitting feedback to the server.

The defaults for this class are very defensive, so in order to make it actually operational and submit data, there is a number of settings you need to set in code, namely submission intervals, encouragement settings and adding data sources. The settings about what data to submit (telemetryMode) and how often to bother the user with surveys (surveyInterval) should not be set to hardcoded values in code, but left as choices to the user.

Definition at line 31 of file provider.h.

Member Enumeration Documentation

Telemetry collection modes.

Colleciton modes are inclusive, ie. higher modes always imply data from lower modes too.

Enumerator
NoTelemetry 

Transmit no data at all.

BasicSystemInformation 

Transmit basic information about the system.

BasicUsageStatistics 

Transmit basic usage statistics.

DetailedSystemInformation 

Transmit detailed system information.

DetailedUsageStatistics 

Transmit detailed usage statistics.

Definition at line 102 of file provider.h.

Property Documentation

int Provider::applicationStartsUntilEncouragement
readwrite

Times the application has to be started before an encouragement message is shown.

See also
setApplicationStartsUntilEncouragement

Definition at line 73 of file provider.h.

int Provider::applicationUsageTimeUntilEncouragement
readwrite

Application usage time in seconds before an encouragement message is shown.

See also
setApplicationUsageTimeUntilEncouragement

Definition at line 81 of file provider.h.

bool KUserFeedback::Provider::enabled
readwrite

The global enabled state of the feedback functionality.

If this is false, all feedback functionality has to be disabled completely.

Definition at line 37 of file provider.h.

int Provider::encouragementDelay
readwrite

Encouragement delay after application start in seconds.

See also
setEncouragementDelay

Definition at line 86 of file provider.h.

int Provider::encouragementInterval
readwrite

Encouragement interval.

See also
setEncouragementInterval

Definition at line 91 of file provider.h.

QUrl Provider::feedbackServer
readwrite

URL of the feedback server.

See also
setFeedbackServer

Definition at line 60 of file provider.h.

QString Provider::productIdentifier
readwrite

Unique product id as set on the feedback server.

See also
setProductIdentifier

Definition at line 55 of file provider.h.

int Provider::submissionInterval
readwrite

Submission interval in days.

See also
setSubmissionInterval

Definition at line 65 of file provider.h.

int Provider::surveyInterval
readwrite

The interval in which the user accepts surveys.

This should be configurable for the user. -1 indicates surveys are disabled.

See also
surveyInterval(), setSurveyInterval()

Definition at line 44 of file provider.h.

Provider::TelemetryMode Provider::telemetryMode
readwrite

The telemetry mode the user has configured.

This should be configurable for the user.

See also
telemetryMode(), setTelemetryMode()

Definition at line 50 of file provider.h.

Constructor & Destructor Documentation

Provider::Provider ( QObject parent = nullptr)
explicit

Create a new feedback provider.

Parameters
parentThe parent object.

Definition at line 392 of file provider.cpp.

Member Function Documentation

void Provider::addDataSource ( AbstractDataSource source)

Adds a data source for telemetry data collection.

Parameters
sourceThe data source to add. The Provider takes ownership of source.

Definition at line 495 of file provider.cpp.

int KUserFeedback::Provider::applicationStartsUntilEncouragement ( ) const

Returns the amount of application starts before an encouragement message is shown.

int KUserFeedback::Provider::applicationUsageTimeUntilEncouragement ( ) const

Returns the amount of application usage time before an encouragement message is shown.

AbstractDataSource * Provider::dataSource ( const QString id) const

Returns a data source with matched id.

Parameters
iddata source unique identifier
Returns
pointer to found data source or nullptr if data source is not found

Definition at line 518 of file provider.cpp.

QVector< AbstractDataSource * > Provider::dataSources ( ) const

Returns all data sources that have been added to this provider.

See also
addDataSource

Definition at line 513 of file provider.cpp.

void KUserFeedback::Provider::dataSourcesChanged ( )
signal

Emitted when a data source is added or removed.

QString KUserFeedback::Provider::describeDataSources ( ) const

Returns a string with each source and its enable mode.

void KUserFeedback::Provider::enabledChanged ( )
signal

Emitted when the global enabled state changed.

int KUserFeedback::Provider::encouragementDelay ( ) const

Returns the current encouragement delay in seconds.

int KUserFeedback::Provider::encouragementInterval ( ) const

Returns the current encouragement interval.

QUrl KUserFeedback::Provider::feedbackServer ( ) const

Returns the current feedback server URL.

bool Provider::isEnabled ( ) const

Returns whether feedback functionality is enabled on this system.

This should be checked everywhere showing feedback UI to the user to respect the global "kill switch" for this. Provider does check this internally for encouragements, surveys and telemetry submission.

Definition at line 414 of file provider.cpp.

void Provider::load ( )
slot

Manually load settings of the provider and all added data sources.

Automatically invoked after object construction and changing product ID.

Note
Potentially long operation.

Definition at line 611 of file provider.cpp.

QString KUserFeedback::Provider::productIdentifier ( ) const

Returns the current product identifier.

void KUserFeedback::Provider::providerSettingsChanged ( )
signal

Emitted when any provider setting changed.

void Provider::setApplicationStartsUntilEncouragement ( int  starts)

Set the amount of application starts until the encouragement message should be shown.

The default is -1, ie. no encouragement based on application starts.

Parameters
startsThe amount of application starts after which an encouragement message should be displayed.

Definition at line 547 of file provider.cpp.

void Provider::setApplicationUsageTimeUntilEncouragement ( int  secs)

Set the amount of usage time until the encouragement message should be shown.

The default is -1, ie. no encouragement based on application usage time.

Parameters
secsAmount of seconds until the encouragement should be shown.

Definition at line 561 of file provider.cpp.

void Provider::setEnabled ( bool  enabled)

Set the global (user-wide) activation state for feedback functionality.

See also
isEnabled

Definition at line 421 of file provider.cpp.

void Provider::setEncouragementDelay ( int  secs)

Set the delay after application start for the earliest display of the encouragement message.

The default is 300, ie. 5 minutes after the application start.

Note
This only adds an additional contraint on usage time and startup count based encouragement messages, it does not actually trigger encouragement messages itself.
Parameters
secsAmount of seconds after the application start for the earliest display of an encouragement message.
See also
setApplicationStartsUntilEncouragement, setApplicationUsageTimeUntilEncouragement

Definition at line 575 of file provider.cpp.

void Provider::setEncouragementInterval ( int  days)

Sets the interval after the encouragement should be repeated.

Encouragement messages are only repeated if no feedback options have been enabled. The default is -1, that is no repeated encouragement at all.

Parameters
daysDays between encouragement messages, 0 disables repeated encouragements.

Definition at line 589 of file provider.cpp.

void Provider::setFeedbackServer ( const QUrl url)

Set the feedback server URL.

This must be called with an appropriate URL for this class to be operational.

Parameters
urlThe URL of the feedback server.

Definition at line 456 of file provider.cpp.

void Provider::setProductIdentifier ( const QString productId)

Set the product identifier.

This is used to distinguish independent products on the same server. If this is not specified, the product identifier is dervied from the application name organisation domain specified in QCoreApplication.

Parameters
productIdUnique product identifier, as configured on the feedback server.

Definition at line 434 of file provider.cpp.

void Provider::setSubmissionInterval ( int  days)

Set the automatic submission interval in days.

This must be called with a positive number for this class to be operational, as the default is -1 (no submission ever).

Definition at line 469 of file provider.cpp.

void Provider::setSurveyInterval ( int  days)

Sets the minimum time in days between two surveys.

-1 indicates no surveys should be requested. 0 indicates no minimum time between surveys at all (i.e. bother the user as often as you want).

Definition at line 529 of file provider.cpp.

void Provider::setTelemetryMode ( TelemetryMode  mode)

Set which telemetry data should be submitted.

Definition at line 483 of file provider.cpp.

void KUserFeedback::Provider::showEncouragementMessage ( )
signal

Indicate that the encouragement notice should be shown.

void Provider::store ( )
slot

Manually store settings of the provider and all added data sources.

Will be autromatically invoked upon QCoreApplication::aboutToQuit signal.

Note
Potentially long operation.

Definition at line 616 of file provider.cpp.

int KUserFeedback::Provider::submissionInterval ( ) const

Returns the current submission interval.

Returns
Days between telemetry submissions, or -1 if submission is off.
void Provider::submit ( )
slot

Manually submit currently recorded data.

Definition at line 621 of file provider.cpp.

void KUserFeedback::Provider::surveyAvailable ( const KUserFeedback::SurveyInfo survey)
signal

Emitted whenever there is a new survey available that can be presented to the user.

void Provider::surveyCompleted ( const KUserFeedback::SurveyInfo info)
slot

Marks the given survey as completed.

This avoids getting further notification about the same survey.

Definition at line 598 of file provider.cpp.

int KUserFeedback::Provider::surveyInterval ( ) const

Returns the minimum time between two surveys in days.

The default is -1 (no surveys enabled).

void KUserFeedback::Provider::surveyIntervalChanged ( )
signal

Emitted when the survey interval changed.

TelemetryMode KUserFeedback::Provider::telemetryMode ( ) const

Returns the current telemetry collection mode.

The default is NoTelemetry.

void KUserFeedback::Provider::telemetryModeChanged ( )
signal

Emitted when the telemetry collection mode has changed.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 23:08:15 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.