@@ -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
142108template <typename T>
143109struct 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