Commit 6ce96052 authored by Volker Krause's avatar Volker Krause
Browse files

Unify API naming related to telemetry modes

This removes all occurrences of "statistics collection mode" or
"collection mode" in favor of "telemetry mode".
parent 2cfe1f23
......@@ -48,7 +48,7 @@ private slots:
p.setProductIdentifier(QStringLiteral("org.kde.UserFeedback.UnitTestProduct"));
p.addDataSource(new ScreenInfoSource, Provider::BasicSystemInformation);
p.addDataSource(new PlatformInfoSource, Provider::DetailedSystemInformation);
p.setStatisticsCollectionMode(Provider::NoStatistics);
p.setTelemetryMode(Provider::NoTelemetry);
FeedbackConfigWidget w;
w.setFeedbackProvider(&p);
......@@ -62,9 +62,9 @@ private slots:
QCOMPARE(telemetrySlider->value(), 0);
telemetrySlider->setValue(1);
QCOMPARE(w.statisticsCollectionMode(), Provider::BasicSystemInformation);
QCOMPARE(w.telemetryMode(), Provider::BasicSystemInformation);
QTest::qWait(1);
QCOMPARE(p.statisticsCollectionMode(), Provider::NoStatistics);
QCOMPARE(p.telemetryMode(), Provider::NoTelemetry);
}
void testSurveySettings()
......
......@@ -57,9 +57,9 @@ private slots:
provider.setProductIdentifier(QStringLiteral("org.kde.UserFeedback.UnitTestProduct"));
provider.addDataSource(new ScreenInfoSource, Provider::BasicSystemInformation);
provider.addDataSource(new PlatformInfoSource, Provider::BasicSystemInformation);
provider.setStatisticsCollectionMode(Provider::NoStatistics);
provider.setTelemetryMode(Provider::NoTelemetry);
QByteArray b;
QMetaObject::invokeMethod(&provider, "jsonData", Q_RETURN_ARG(QByteArray, b), Q_ARG(KUserFeedback::Provider::StatisticsCollectionMode, provider.statisticsCollectionMode()));
QMetaObject::invokeMethod(&provider, "jsonData", Q_RETURN_ARG(QByteArray, b), Q_ARG(KUserFeedback::Provider::TelemetryMode, provider.telemetryMode()));
b.replace('\n', "");
QCOMPARE(b.constData(), "{}");
}
......@@ -68,21 +68,21 @@ private slots:
{
{
Provider p;
p.setStatisticsCollectionMode(Provider::NoStatistics);
p.setTelemetryMode(Provider::NoTelemetry);
p.setSurveyInterval(-1);
}
{
Provider p;
QCOMPARE(p.statisticsCollectionMode(), Provider::NoStatistics);
QCOMPARE(p.telemetryMode(), Provider::NoTelemetry);
QCOMPARE(p.surveyInterval(), -1);
p.setStatisticsCollectionMode(Provider::DetailedSystemInformation);
p.setTelemetryMode(Provider::DetailedSystemInformation);
p.setSurveyInterval(90);
}
{
Provider p;
QCOMPARE(p.statisticsCollectionMode(), Provider::DetailedSystemInformation);
QCOMPARE(p.telemetryMode(), Provider::DetailedSystemInformation);
QCOMPARE(p.surveyInterval(), 90);
}
}
......@@ -156,7 +156,7 @@ private slots:
Provider p;
p.addDataSource(new PlatformInfoSource, Provider::BasicSystemInformation);
p.setSurveyInterval(0);
p.setStatisticsCollectionMode(Provider::BasicSystemInformation);
p.setTelemetryMode(Provider::BasicSystemInformation);
QSignalSpy spy(&p, SIGNAL(showEncouragementMessage()));
QVERIFY(spy.isValid());
p.setEncouragementDelay(0);
......@@ -180,7 +180,7 @@ private slots:
{
Provider p;
p.setSurveyInterval(-1);
p.setStatisticsCollectionMode(Provider::NoStatistics);
p.setTelemetryMode(Provider::NoTelemetry);
QSignalSpy spy(&p, SIGNAL(showEncouragementMessage()));
QVERIFY(spy.isValid());
p.setEncouragementDelay(0);
......@@ -199,7 +199,7 @@ private slots:
{
Provider p;
p.setSurveyInterval(90);
p.setStatisticsCollectionMode(Provider::BasicSystemInformation);
p.setTelemetryMode(Provider::BasicSystemInformation);
QSignalSpy spy(&p, SIGNAL(showEncouragementMessage()));
QVERIFY(spy.isValid());
p.setEncouragementDelay(0);
......@@ -214,7 +214,7 @@ private slots:
{
{
Provider p0;
p0.setStatisticsCollectionMode(Provider::BasicUsageStatistics); // triggers store, so we want to avoid that below
p0.setTelemetryMode(Provider::BasicUsageStatistics); // triggers store, so we want to avoid that below
}
int c1 = -1;
......
......@@ -101,7 +101,7 @@ private slots:
// submit data
Provider provider;
provider.setProductIdentifier(QStringLiteral("org.kde.UserFeedback.UnitTestProduct"));
provider.setStatisticsCollectionMode(Provider::DetailedUsageStatistics);
provider.setTelemetryMode(Provider::DetailedUsageStatistics);
provider.setFeedbackServer(serverUrl);
provider.addDataSource(new ScreenInfoSource, Provider::DetailedUsageStatistics);
provider.addDataSource(new PlatformInfoSource, Provider::DetailedUsageStatistics);
......@@ -143,7 +143,7 @@ private slots:
// this must pass without ending in an infinite loop
Provider provider;
provider.setProductIdentifier(QStringLiteral("org.kde.UserFeedback.UnitTestProduct"));
provider.setStatisticsCollectionMode(Provider::DetailedUsageStatistics);
provider.setTelemetryMode(Provider::DetailedUsageStatistics);
provider.setFeedbackServer(serverUrl);
provider.addDataSource(new ScreenInfoSource, Provider::DetailedUsageStatistics);
provider.addDataSource(new PlatformInfoSource, Provider::DetailedUsageStatistics);
......
......@@ -65,19 +65,19 @@ void AbstractDataSource::reset(QSettings *settings)
Q_UNUSED(settings);
}
Provider::StatisticsCollectionMode AbstractDataSource::collectionMode() const
Provider::TelemetryMode AbstractDataSource::telemetryMode() const
{
Q_D(const AbstractDataSource);
Q_ASSERT(d->mode != Provider::NoStatistics);
if (d->mode == Provider::NoStatistics)
Q_ASSERT(d->mode != Provider::NoTelemetry);
if (d->mode == Provider::NoTelemetry)
return Provider::DetailedUsageStatistics;
return d->mode;
}
void AbstractDataSource::setCollectionMode(Provider::StatisticsCollectionMode mode)
void AbstractDataSource::setTelemetryMode(Provider::TelemetryMode mode)
{
Q_D(AbstractDataSource);
Q_ASSERT(mode != Provider::NoStatistics);
Q_ASSERT(mode != Provider::NoTelemetry);
d->mode = mode;
}
......@@ -31,7 +31,7 @@ namespace KUserFeedback {
class AbstractDataSourcePrivate;
/*! Base class for data sources for statistical data. */
/*! Base class for data sources for telemetry data. */
class KUSERFEEDBACKCORE_EXPORT AbstractDataSource
{
public:
......@@ -94,15 +94,15 @@ public:
*/
virtual void reset(QSettings *settings);
/*! Returns which colleciton mode this data source belongs to.
* @return The statistics collection category this source belongs to.
/*! Returns which telemetry colleciton mode this data source belongs to.
* @return The telemetry collection category this source belongs to.
*/
Provider::StatisticsCollectionMode collectionMode() const;
Provider::TelemetryMode telemetryMode() const;
/*! Sets which colleciton mode this data source belongs to.
/*! Sets which telemetry colleciton mode this data source belongs to.
* @param mode The data collection mode of this source.
*/
void setCollectionMode(Provider::StatisticsCollectionMode mode);
void setTelemetryMode(Provider::TelemetryMode mode);
protected:
/*! Create a new data source named @p name.
......
......@@ -29,7 +29,7 @@ public:
virtual ~AbstractDataSourcePrivate();
QString name;
Provider::StatisticsCollectionMode mode;
Provider::TelemetryMode mode;
private:
Q_DISABLE_COPY(AbstractDataSourcePrivate)
......
......@@ -32,7 +32,7 @@ public:
FeedbackConfigUiControllerPrivate();
Provider *provider;
std::vector<Provider::StatisticsCollectionMode> telemetryModeMap;
std::vector<Provider::TelemetryMode> telemetryModeMap;
};
}
......@@ -65,17 +65,17 @@ void FeedbackConfigUiController::setFeedbackProvider(Provider* provider)
d->telemetryModeMap.clear();
d->telemetryModeMap.reserve(5);
d->telemetryModeMap.push_back(Provider::NoStatistics);
d->telemetryModeMap.push_back(Provider::NoTelemetry);
d->telemetryModeMap.push_back(Provider::BasicSystemInformation);
d->telemetryModeMap.push_back(Provider::BasicUsageStatistics);
d->telemetryModeMap.push_back(Provider::DetailedSystemInformation);
d->telemetryModeMap.push_back(Provider::DetailedUsageStatistics);
QSet<Provider::StatisticsCollectionMode> supportedModes;
QSet<Provider::TelemetryMode> supportedModes;
supportedModes.reserve(d->telemetryModeMap.size());
supportedModes.insert(Provider::NoStatistics);
supportedModes.insert(Provider::NoTelemetry);
foreach (const auto &src, provider->dataSources())
supportedModes.insert(src->collectionMode());
supportedModes.insert(src->telemetryMode());
for (auto it = d->telemetryModeMap.begin(); it != d->telemetryModeMap.end();) {
if (!supportedModes.contains(*it))
it = d->telemetryModeMap.erase(it);
......@@ -96,14 +96,14 @@ int FeedbackConfigUiController::surveyModeCount() const
return 3;
}
Provider::StatisticsCollectionMode FeedbackConfigUiController::telemetryIndexToMode(int index) const
Provider::TelemetryMode FeedbackConfigUiController::telemetryIndexToMode(int index) const
{
if (index < 0 || index >= telemetryModeCount())
return Provider::NoStatistics;
return Provider::NoTelemetry;
return d->telemetryModeMap[index];
}
int FeedbackConfigUiController::telemetryModeToIndex(Provider::StatisticsCollectionMode mode) const
int FeedbackConfigUiController::telemetryModeToIndex(Provider::TelemetryMode mode) const
{
const auto it = std::lower_bound(d->telemetryModeMap.begin(), d->telemetryModeMap.end(), mode);
if (it == d->telemetryModeMap.end())
......@@ -114,7 +114,7 @@ int FeedbackConfigUiController::telemetryModeToIndex(Provider::StatisticsCollect
QString FeedbackConfigUiController::telemetryModeDescription(int telemetryIndex) const
{
switch (telemetryIndexToMode(telemetryIndex)) {
case Provider::NoStatistics:
case Provider::NoTelemetry:
return tr(
"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.\n"
......@@ -153,7 +153,7 @@ QString FeedbackConfigUiController::telemetryModeDetails(int telemetryIndex) con
auto detailsStr = QStringLiteral("<ul>");
foreach (const auto *src, d->provider->dataSources()) {
if (telemetryIndex >= telemetryModeToIndex(src->collectionMode()) && !src->description().isEmpty())
if (telemetryIndex >= telemetryModeToIndex(src->telemetryMode()) && !src->description().isEmpty())
detailsStr += QStringLiteral("<li>") + src->description() + QStringLiteral("</li>");
}
return detailsStr + QStringLiteral("</ul>");
......
......@@ -60,9 +60,9 @@ public:
int surveyModeCount() const;
/*! Convert slider index to telemetry mode. */
Q_INVOKABLE KUserFeedback::Provider::StatisticsCollectionMode telemetryIndexToMode(int index) const;
Q_INVOKABLE KUserFeedback::Provider::TelemetryMode telemetryIndexToMode(int index) const;
/*! Convert telemetry mode to slider index. */
Q_INVOKABLE int telemetryModeToIndex(KUserFeedback::Provider::StatisticsCollectionMode mode) const;
Q_INVOKABLE int telemetryModeToIndex(KUserFeedback::Provider::TelemetryMode mode) const;
/*! Telemetry mode explanation text. */
Q_INVOKABLE QString telemetryModeDescription(int telemetryIndex) const;
......
......@@ -61,7 +61,7 @@ ProviderPrivate::ProviderPrivate(Provider *qq)
, networkAccessManager(nullptr)
, redirectCount(0)
, submissionInterval(-1)
, statisticsMode(Provider::NoStatistics)
, telemetryMode(Provider::NoTelemetry)
, surveyInterval(-1)
, startCount(0)
, usageTime(0)
......@@ -89,9 +89,9 @@ int ProviderPrivate::currentApplicationTime() const
return usageTime + (startTime.elapsed() / 1000);
}
static QMetaEnum statisticsCollectionModeEnum()
static QMetaEnum telemetryModeEnum()
{
const auto idx = Provider::staticMetaObject.indexOfEnumerator("StatisticsCollectionMode");
const auto idx = Provider::staticMetaObject.indexOfEnumerator("TelemetryMode");
Q_ASSERT(idx >= 0);
return Provider::staticMetaObject.enumerator(idx);
}
......@@ -120,7 +120,7 @@ void ProviderPrivate::load()
lastSubmitTime = s->value(QStringLiteral("LastSubmission")).toDateTime();
const auto modeStr = s->value(QStringLiteral("StatisticsCollectionMode")).toByteArray();
statisticsMode = static_cast<Provider::StatisticsCollectionMode>(std::max(statisticsCollectionModeEnum().keyToValue(modeStr.constData()), 0));
telemetryMode = static_cast<Provider::TelemetryMode>(std::max(telemetryModeEnum().keyToValue(modeStr.constData()), 0));
surveyInterval = s->value(QStringLiteral("SurveyInterval"), -1).toInt();
lastSurveyTime = s->value(QStringLiteral("LastSurvey")).toDateTime();
......@@ -178,7 +178,7 @@ bool ProviderPrivate::isValidSource(AbstractDataSource *source) const
qCWarning(Log) << "Skipping data source with empty name!";
return false;
}
if (source->collectionMode() == Provider::NoStatistics) {
if (source->telemetryMode() == Provider::NoTelemetry) {
qCWarning(Log) << "Source" << source->name() << "attempts to report data unconditionally, ignoring!";
return false;
}
......@@ -188,7 +188,7 @@ bool ProviderPrivate::isValidSource(AbstractDataSource *source) const
}
Q_ASSERT(!source->name().isEmpty());
Q_ASSERT(source->collectionMode() != Provider::NoStatistics);
Q_ASSERT(source->telemetryMode() != Provider::NoTelemetry);
Q_ASSERT(!source->description().isEmpty());
return true;
}
......@@ -223,15 +223,15 @@ QByteArray variantMapToJson(const QVariantMap &m)
}
#endif
QByteArray ProviderPrivate::jsonData(Provider::StatisticsCollectionMode mode) const
QByteArray ProviderPrivate::jsonData(Provider::TelemetryMode mode) const
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QJsonObject obj;
if (mode != Provider::NoStatistics) {
if (mode != Provider::NoTelemetry) {
foreach (auto source, dataSources) {
if (!isValidSource(source))
continue;
if (mode < source->collectionMode())
if (mode < source->telemetryMode())
continue;
const auto data = source->data();
if (data.canConvert<QVariantMap>())
......@@ -245,11 +245,11 @@ QByteArray ProviderPrivate::jsonData(Provider::StatisticsCollectionMode mode) co
return doc.toJson();
#else
QByteArray b = "{";
if (mode != Provider::NoStatistics) {
if (mode != Provider::NoTelemetry) {
for (auto it = dataSources.begin(); it != dataSources.end(); ++it) {
if (!isValidSource(*it))
continue;
if (mode < (*it)->collectionMode())
if (mode < (*it)->telemetryMode())
continue;
const auto data = (*it)->data();
if (data.canConvert<QVariantList>()) {
......@@ -276,7 +276,7 @@ QByteArray ProviderPrivate::jsonData(Provider::StatisticsCollectionMode mode) co
void ProviderPrivate::scheduleNextSubmission()
{
submissionTimer.stop();
if (submissionInterval <= 0 || (statisticsMode == Provider::NoStatistics && surveyInterval < 0))
if (submissionInterval <= 0 || (telemetryMode == Provider::NoTelemetry && surveyInterval < 0))
return;
Q_ASSERT(submissionInterval > 0);
......@@ -373,11 +373,11 @@ bool ProviderPrivate::selectSurvey(const SurveyInfo &survey) const
return true;
}
Provider::StatisticsCollectionMode ProviderPrivate::highestStatisticsCollectionMode() const
Provider::TelemetryMode ProviderPrivate::highestTelemetryMode() const
{
auto mode = Provider::NoStatistics;
auto mode = Provider::NoTelemetry;
foreach (auto src, dataSources)
mode = std::max(mode, src->collectionMode());
mode = std::max(mode, src->telemetryMode());
return mode;
}
......@@ -395,10 +395,10 @@ void ProviderPrivate::scheduleEncouragement()
if (encouragementStarts > startCount) // we need more starts
return;
if (statisticsMode >= highestStatisticsCollectionMode() && surveyInterval == 0) // already everything enabled
if (telemetryMode >= highestTelemetryMode() && surveyInterval == 0) // already everything enabled
return;
// no repetition if some feedback is enabled
if (lastEncouragementTime.isValid() && (statisticsMode > Provider::NoStatistics || surveyInterval >= 0))
if (lastEncouragementTime.isValid() && (telemetryMode > Provider::NoTelemetry || surveyInterval >= 0))
return;
Q_ASSERT(encouragementDelay >= 0);
......@@ -492,26 +492,26 @@ void Provider::setSubmissionInterval(int days)
d->scheduleNextSubmission();
}
Provider::StatisticsCollectionMode Provider::statisticsCollectionMode() const
Provider::TelemetryMode Provider::telemetryMode() const
{
return d->statisticsMode;
return d->telemetryMode;
}
void Provider::setStatisticsCollectionMode(StatisticsCollectionMode mode)
void Provider::setTelemetryMode(TelemetryMode mode)
{
if (d->statisticsMode == mode)
if (d->telemetryMode == mode)
return;
d->statisticsMode = mode;
d->storeOne(QStringLiteral("StatisticsCollectionMode"), QString::fromLatin1(statisticsCollectionModeEnum().valueToKey(d->statisticsMode)));
d->telemetryMode = mode;
d->storeOne(QStringLiteral("StatisticsCollectionMode"), QString::fromLatin1(telemetryModeEnum().valueToKey(d->telemetryMode)));
d->scheduleNextSubmission();
d->scheduleEncouragement();
emit statisticsCollectionModeChanged();
emit telemetryModeChanged();
}
void Provider::addDataSource(AbstractDataSource *source, StatisticsCollectionMode mode)
void Provider::addDataSource(AbstractDataSource *source, TelemetryMode mode)
{
source->setCollectionMode(mode);
source->setTelemetryMode(mode);
// special cases for sources where we track the data here, as it's needed even if we don't report it
if (auto countSrc = dynamic_cast<StartCountSource*>(source))
......@@ -646,7 +646,7 @@ void ProviderPrivate::submit(const QUrl &url)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
request.setHeader(QNetworkRequest::UserAgentHeader, QString(QStringLiteral("KUserFeedback/") + QStringLiteral(KUSERFEEDBACK_VERSION_STRING)));
#endif
auto reply = networkAccessManager->post(request, jsonData(statisticsMode));
auto reply = networkAccessManager->post(request, jsonData(telemetryMode));
QObject::connect(reply, SIGNAL(finished()), q, SLOT(submitFinished()));
}
......
......@@ -35,7 +35,7 @@ class SurveyInfo;
* 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 (statisticsCollectionMode) and how often
* 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.
*/
......@@ -51,9 +51,9 @@ class KUSERFEEDBACKCORE_EXPORT Provider : public QObject
/*! The telemetry mode the user has configured.
* This should be configurable for the user.
* @see statisticsCollectionMode(), setStatisticsCollectionMode()
* @see telemetryMode(), setTelemetryMode()
*/
Q_PROPERTY(StatisticsCollectionMode statisticsCollectionMode READ statisticsCollectionMode WRITE setStatisticsCollectionMode NOTIFY statisticsCollectionModeChanged)
Q_PROPERTY(TelemetryMode telemetryMode READ telemetryMode WRITE setTelemetryMode NOTIFY telemetryModeChanged)
/*! Unique product id as set on the feedback server.
* @see setProductIdentifier
......@@ -101,8 +101,8 @@ public:
* Colleciton modes are inclusive, ie. higher modes always imply data from
* lower modes too.
*/
enum StatisticsCollectionMode {
NoStatistics, ///< Transmit no data at all.
enum TelemetryMode {
NoTelemetry, ///< Transmit no data at all.
BasicSystemInformation = 0x10, ///< Transmit basic information about the system.
BasicUsageStatistics = 0x20, ///< Transmit basic usage statistics.
DetailedSystemInformation = 0x30, ///< Transmit detailed system information.
......@@ -110,12 +110,12 @@ public:
};
#ifndef QT4_MOC_WORKAROUND
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
Q_ENUM(StatisticsCollectionMode)
Q_ENUM(TelemetryMode)
#else
Q_ENUMS(StatisticsCollectionMode)
Q_ENUMS(TelemetryMode)
#endif
#else
Q_ENUMS(StatisticsCollectionMode)
Q_ENUMS(TelemetryMode)
#endif
/*! Create a new feedback provider.
......@@ -152,21 +152,21 @@ public:
*/
void setSubmissionInterval(int days);
/*! Returns the current statistics collection mode.
* The default is NoStatistics.
/*! Returns the current telemetry collection mode.
* The default is NoTelemetry.
*/
StatisticsCollectionMode statisticsCollectionMode() const;
TelemetryMode telemetryMode() const;
/*! Set which statistics should be submitted. */
void setStatisticsCollectionMode(StatisticsCollectionMode mode);
/*! Set which telemetry data should be submitted. */
void setTelemetryMode(TelemetryMode mode);
/*! Adds a data source for statistical data collection.
/*! Adds a data source for telemetry data collection.
* @param source The data source to add. The Provider takes ownership of @p source.
* @param mode The statistics collection mode this source belongs to. Data is only
* @param mode The telemetry collection mode this source belongs to. Data is only
* send to the server for this source is a sufficiently high collection mode is configured
* by the user. @c NoStatistics is not allowed.
* by the user. @c NoTelemetry is not allowed.
*/
void addDataSource(AbstractDataSource *source, StatisticsCollectionMode mode);
void addDataSource(AbstractDataSource *source, TelemetryMode mode);
/*! Returns all data sources that have been added to this provider.
* @see addDataSource
......@@ -244,8 +244,8 @@ Q_SIGNALS:
/*! Emitted when the survey interval changed. */
void surveyIntervalChanged();
/*! Emitted when the statistics collection mode has changed. */
void statisticsCollectionModeChanged();
/*! Emitted when the telemetry collection mode has changed. */
void telemetryModeChanged();
/*! Emitted when any provider setting changed. */
void providerSettingsChanged();
......@@ -257,7 +257,7 @@ private:
Q_PRIVATE_SLOT(d, void submitFinished())
Q_PRIVATE_SLOT(d, void emitShowEncouragementMessage())
// for UI
Q_PRIVATE_SLOT(d, QByteArray jsonData(KUserFeedback::Provider::StatisticsCollectionMode))
Q_PRIVATE_SLOT(d, QByteArray jsonData(KUserFeedback::Provider::TelemetryMode))
// for testing
Q_PRIVATE_SLOT(d, void load())
Q_PRIVATE_SLOT(d, void store())
......@@ -265,6 +265,6 @@ private:
}
Q_DECLARE_METATYPE(KUserFeedback::Provider::StatisticsCollectionMode)
Q_DECLARE_METATYPE(KUserFeedback::Provider::TelemetryMode)
#endif // KUSERFEEDBACK_PROVIDER_H
......@@ -52,14 +52,14 @@ public:
void aboutToQuit();
bool isValidSource(AbstractDataSource *source) const;
QByteArray jsonData(Provider::StatisticsCollectionMode mode) const;
QByteArray jsonData(Provider::TelemetryMode mode) const;
void scheduleNextSubmission();
void submit(const QUrl &url);
void submitFinished();
bool selectSurvey(const SurveyInfo &survey) const;
Provider::StatisticsCollectionMode highestStatisticsCollectionMode() const;
Provider::TelemetryMode highestTelemetryMode() const;
void scheduleEncouragement();
void emitShowEncouragementMessage();
......@@ -75,7 +75,7 @@ public:
QDateTime lastSubmitTime;
int redirectCount;
int submissionInterval;
Provider::StatisticsCollectionMode statisticsMode;
Provider::TelemetryMode telemetryMode;
int surveyInterval;
QDateTime lastSurveyTime;
......
......@@ -31,17 +31,17 @@ QmlAbstractDataSource::~QmlAbstractDataSource()
{
}
Provider::StatisticsCollectionMode QmlAbstractDataSource::collectionMode() const
Provider::TelemetryMode QmlAbstractDataSource::telemetryMode() const
{
return m_source->collectionMode();
return m_source->telemetryMode();
}
void QmlAbstractDataSource::setCollectionMode(Provider::StatisticsCollectionMode mode)
void QmlAbstractDataSource::setTelemetryMode(Provider::TelemetryMode mode)
{
if (m_source->collectionMode() == mode)
if (m_source->telemetryMode() == mode)
return;
m_source->setCollectionMode(mode);
emit collectionModeChanged();
m_source->setTelemetryMode(mode);
emit telemetryModeChanged();
}
AbstractDataSource* QmlAbstractDataSource::source() const
......
......@@ -27,19 +27,19 @@ class AbstractDataSource;
class QmlAbstractDataSource : public QObject
{
Q_OBJECT
Q_PROPERTY(KUserFeedback::Provider::StatisticsCollectionMode mode READ collectionMode
WRITE setCollectionMode NOTIFY collectionModeChanged)
Q_PROPERTY(KUserFeedback::Provider::TelemetryMode mode READ telemetryMode
WRITE setTelemetryMode NOTIFY telemetryModeChanged)
public:
explicit QmlAbstractDataSource(AbstractDataSource *source, QObject *parent);
~QmlAbstractDataSource();
Provider::StatisticsCollectionMode collectionMode() const;
void setCollectionMode(Provider::StatisticsCollectionMode mode);
Provider::TelemetryMode telemetryMode() const;
void setTelemetryMode(Provider::TelemetryMode mode);
AbstractDataSource* source() const;
Q_SIGNALS:
void collectionModeChanged();
void telemetryModeChanged();
private:
AbstractDataSource *m_source;
......
......@@ -31,7 +31,7 @@ QmlProviderExtension::~QmlProviderExtension()
void QmlProviderExtension::sourceAppend(QQmlListProperty<QmlAbstractDataSource> *prop, QmlAbstractDataSource *value)