Skip to content

Commit ec143d6

Browse files
committed
dbus/properties: remove non bindable based dbus property impl
1 parent 324fe92 commit ec143d6

File tree

2 files changed

+0
-115
lines changed

2 files changed

+0
-115
lines changed

src/dbus/properties.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -110,24 +110,6 @@ void asyncReadPropertyInternal(
110110
QObject::connect(call, &QDBusPendingCallWatcher::finished, &interface, responseCallback);
111111
}
112112

113-
void AbstractDBusProperty::update() {
114-
if (this->group == nullptr) {
115-
qFatal(logDbusProperties) << "Tried to update dbus property" << this->nameRef()
116-
<< "which is not attached to a group";
117-
} else {
118-
this->group->requestPropertyUpdate(this);
119-
}
120-
}
121-
122-
void AbstractDBusProperty::write() {
123-
if (this->group == nullptr) {
124-
qFatal(logDbusProperties) << "Tried to write dbus property" << this->nameRef()
125-
<< "which is not attached to a group";
126-
} else {
127-
this->group->pushPropertyUpdate(this);
128-
}
129-
}
130-
131113
DBusPropertyGroup::DBusPropertyGroup(QVector<DBusPropertyCore*> properties, QObject* parent)
132114
: QObject(parent)
133115
, properties(std::move(properties)) {}
@@ -157,11 +139,6 @@ void DBusPropertyGroup::setInterface(QDBusAbstractInterface* interface) {
157139
}
158140
}
159141

160-
void DBusPropertyGroup::attachProperty(AbstractDBusProperty* property) {
161-
this->properties.append(property);
162-
property->group = this;
163-
}
164-
165142
void DBusPropertyGroup::attachProperty(DBusPropertyCore* property) {
166143
this->properties.append(property);
167144
}
@@ -325,8 +302,6 @@ QString DBusPropertyGroup::propertyString(const DBusPropertyCore* property) cons
325302
return this->toString() % ':' % property->nameRef();
326303
}
327304

328-
QString AbstractDBusProperty::toString() const { return this->group->propertyString(this); }
329-
330305
void DBusPropertyGroup::onPropertiesChanged(
331306
const QString& interfaceName,
332307
const QVariantMap& changedProperties,

src/dbus/properties.hpp

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -104,40 +104,6 @@ class DBusPropertyCore {
104104
friend class DBusPropertyGroup;
105105
};
106106

107-
class AbstractDBusProperty
108-
: public QObject
109-
, public DBusPropertyCore {
110-
Q_OBJECT;
111-
112-
public:
113-
explicit AbstractDBusProperty(QString name, bool required, QObject* parent = nullptr)
114-
: QObject(parent)
115-
, required(required)
116-
, mName(std::move(name)) {}
117-
118-
[[nodiscard]] QString name() const override { return this->mName; };
119-
[[nodiscard]] QStringView nameRef() const override { return this->mName; };
120-
[[nodiscard]] bool isRequired() const override { return this->required; };
121-
122-
[[nodiscard]] QString toString() const;
123-
124-
public slots:
125-
void update();
126-
void write();
127-
128-
signals:
129-
void changed();
130-
131-
private:
132-
bool required : 1;
133-
bool mExists : 1 = false;
134-
135-
DBusPropertyGroup* group = nullptr;
136-
QString mName;
137-
138-
friend class DBusPropertyGroup;
139-
};
140-
141107
// Default implementation with no transformation
142108
template <typename T>
143109
struct DBusDataTransform {
@@ -265,7 +231,6 @@ class DBusPropertyGroup: public QObject {
265231
explicit DBusPropertyGroup(QObject* parent): DBusPropertyGroup({}, parent) {}
266232

267233
void setInterface(QDBusAbstractInterface* interface);
268-
void attachProperty(AbstractDBusProperty* property);
269234
void attachProperty(DBusPropertyCore* property);
270235
void updateAllDirect();
271236
void updateAllViaGetAll();
@@ -297,61 +262,6 @@ private slots:
297262
friend class AbstractDBusProperty;
298263
};
299264

300-
template <typename T>
301-
class DBusProperty: public AbstractDBusProperty {
302-
public:
303-
explicit DBusProperty(
304-
QString name,
305-
T value = T(),
306-
bool required = true,
307-
QObject* parent = nullptr
308-
)
309-
: AbstractDBusProperty(std::move(name), required, parent)
310-
, value(std::move(value)) {}
311-
312-
explicit DBusProperty(
313-
DBusPropertyGroup& group,
314-
QString name,
315-
T value = T(),
316-
bool required = true,
317-
QObject* parent = nullptr
318-
)
319-
: DBusProperty(std::move(name), std::move(value), required, parent) {
320-
group.attachProperty(this);
321-
}
322-
323-
[[nodiscard]] QString valueString() override {
324-
QString str;
325-
QDebug(&str) << this->value;
326-
return str;
327-
}
328-
329-
[[nodiscard]] const T& get() const { return this->value; }
330-
331-
void set(T value) {
332-
this->value = std::move(value);
333-
emit this->changed();
334-
}
335-
336-
protected:
337-
QDBusError store(const QVariant& variant) override {
338-
auto result = demarshallVariant<T>(variant);
339-
340-
if (result.isValid()) {
341-
this->set(std::move(result.value));
342-
}
343-
344-
return result.error;
345-
}
346-
347-
QVariant serialize() override { return QVariant::fromValue(this->value); }
348-
349-
private:
350-
T value;
351-
352-
friend class DBusPropertyCore;
353-
};
354-
355265
} // namespace qs::dbus
356266

357267
// NOLINTBEGIN

0 commit comments

Comments
 (0)