Skip to content

Commit fca058e

Browse files
committed
service/upower: add device model property
1 parent eaf8549 commit fca058e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/services/upower/device.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ class UPowerDevice: public QObject {
154154
Q_PROPERTY(bool isLaptopBattery READ isLaptopBattery NOTIFY isLaptopBatteryChanged BINDABLE bindableIsLaptopBattery);
155155
/// Native path of the device specific to your OS.
156156
Q_PROPERTY(QString nativePath READ nativePath NOTIFY nativePathChanged BINDABLE bindableNativePath);
157+
/// Model name of the device. Unlikely to be useful for internal devices.
158+
Q_PROPERTY(QString model READ model NOTIFY modelChanged BINDABLE bindableModel);
157159
/// If device statistics have been queried for this device yet.
158160
/// This will be true for all devices returned from @@UPower.devices, but not the default
159161
/// device, which may be returned before it is ready to avoid returning null.
@@ -186,6 +188,7 @@ class UPowerDevice: public QObject {
186188
QS_BINDABLE_GETTER(QString, bIconName, iconName, bindableIconName);
187189
QS_BINDABLE_GETTER(bool, bIsLaptopBattery, isLaptopBattery, bindableIsLaptopBattery);
188190
QS_BINDABLE_GETTER(QString, bNativePath, nativePath, bindableNativePath);
191+
QS_BINDABLE_GETTER(QString, bModel, model, bindableModel);
189192
QS_BINDABLE_GETTER(bool, bReady, ready, bindableReady);
190193

191194
signals:
@@ -206,6 +209,7 @@ class UPowerDevice: public QObject {
206209
void iconNameChanged();
207210
void isLaptopBatteryChanged();
208211
void nativePathChanged();
212+
void modelChanged();
209213

210214
private slots:
211215
void onGetAllFinished();
@@ -227,6 +231,7 @@ private slots:
227231
Q_OBJECT_BINDABLE_PROPERTY(UPowerDevice, QString, bIconName, &UPowerDevice::iconNameChanged);
228232
Q_OBJECT_BINDABLE_PROPERTY(UPowerDevice, bool, bIsLaptopBattery, &UPowerDevice::isLaptopBatteryChanged);
229233
Q_OBJECT_BINDABLE_PROPERTY(UPowerDevice, QString, bNativePath, &UPowerDevice::nativePathChanged);
234+
Q_OBJECT_BINDABLE_PROPERTY(UPowerDevice, QString, bModel, &UPowerDevice::modelChanged);
230235
Q_OBJECT_BINDABLE_PROPERTY(UPowerDevice, bool, bReady, &UPowerDevice::readyChanged);
231236

232237
QS_DBUS_BINDABLE_PROPERTY_GROUP(UPowerDevice, deviceProperties);
@@ -243,6 +248,7 @@ private slots:
243248
QS_DBUS_PROPERTY_BINDING(UPowerDevice, pHealthPercentage, bHealthPercentage, deviceProperties, "Capacity");
244249
QS_DBUS_PROPERTY_BINDING(UPowerDevice, pIconName, bIconName, deviceProperties, "IconName");
245250
QS_DBUS_PROPERTY_BINDING(UPowerDevice, pNativePath, bNativePath, deviceProperties, "NativePath");
251+
QS_DBUS_PROPERTY_BINDING(UPowerDevice, pModel, bModel, deviceProperties, "Model");
246252
// clang-format on
247253

248254
DBusUPowerDevice* device = nullptr;

0 commit comments

Comments
 (0)