KUserFeedback

qmlpropertyratiosource.cpp
1/*
2 SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: MIT
5*/
6
7#include "qmlpropertyratiosource.h"
8
9#include <KUserFeedback/PropertyRatioSource>
10
11using namespace KUserFeedback;
12
13QmlPropertyRatioSource::QmlPropertyRatioSource(QObject* parent)
14 : QmlAbstractDataSource(new PropertyRatioSource(nullptr, nullptr, QString()), parent)
15{
16}
17
18QmlPropertyRatioSource::~QmlPropertyRatioSource()
19{
20}
21
22PropertyRatioSource* QmlPropertyRatioSource::prSrc() const
23{
24 return static_cast<PropertyRatioSource*>(source());
25}
26
27QString QmlPropertyRatioSource::sourceId() const
28{
29 return source()->id();
30}
31
32void QmlPropertyRatioSource::setSourceId(const QString& id)
33{
34 if (source()->id() == id)
35 return;
36 prSrc()->setId(id);
37 Q_EMIT changed();
38}
39
40QString QmlPropertyRatioSource::name() const
41{
42 return prSrc()->name();
43}
44
45void QmlPropertyRatioSource::setName(const QString& name)
46{
47 if (prSrc()->name() == name) {
48 return;
49 }
50 prSrc()->setName(name);
51 Q_EMIT changed();
52}
53
54QString QmlPropertyRatioSource::description() const
55{
56 return prSrc()->description();
57}
58
59void QmlPropertyRatioSource::setDescription(const QString& desc)
60{
61 if (description() == desc)
62 return;
63 prSrc()->setDescription(desc);
64 Q_EMIT changed();
65}
66
67QObject* QmlPropertyRatioSource::object() const
68{
69 return prSrc()->object();
70}
71
72void QmlPropertyRatioSource::setObject(QObject* object)
73{
74 if (prSrc()->object() == object)
75 return;
76 prSrc()->setObject(object);
77 Q_EMIT changed();
78}
79
80QString QmlPropertyRatioSource::propertyName() const
81{
82 return prSrc()->propertyName();
83}
84
85void QmlPropertyRatioSource::setPropertyName(const QString& name)
86{
87 if (propertyName() == name)
88 return;
89 prSrc()->setPropertyName(name);
90 Q_EMIT changed();
91}
92
93void QmlPropertyRatioSource::addValueMapping(const QVariant& value, const QString& name)
94{
95 prSrc()->addValueMapping(value, name);
96}
97
98#include "moc_qmlpropertyratiosource.cpp"
QString id() const
Returns the ID of this data source.
Records the time ratio a given QObject property has a specific value.
void setName(const QString &name)
Set human readable name.
QString description() const override
Returns a human-readable, translated description of what this source provides.
void addValueMapping(const QVariant &value, const QString &str)
Map property value value to str for sending to the server.
void setDescription(const QString &desc)
Set human-readable and translated description of the data provided by this source.
QString propertyName() const
Returns the property name.
QObject * object() const
Returns the monitored object.
QString name() const override
Returns a short name of this data source.
void setId(const QString &id)
Set the ID of this data source.
void setPropertyName(const QString &name)
Sets the property name that should be monitored.
void setObject(QObject *object)
Sets the monitoried object.
QString name(GameStandardAction id)
Classes for integrating telemetry collection, survey targeting, and contribution encouragenemt and co...
Q_EMITQ_EMIT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:48:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.