forked from quickshell/quickshell
dbus/properties: allow removing to/from wire transforms
Useful when properties are only read/written in one direction.
This commit is contained in:
parent
ac50767873
commit
0e9e593078
3 changed files with 23 additions and 21 deletions
|
@ -105,8 +105,6 @@ DBusResult<qreal> DBusDataTransform<PowerPercentage>::fromWire(qreal wire) {
|
|||
return DBusResult(wire * 0.01);
|
||||
}
|
||||
|
||||
qreal DBusDataTransform<PowerPercentage>::toWire(const qreal& value) { return value * 100; }
|
||||
|
||||
DBusResult<UPowerDeviceState::Enum>
|
||||
DBusDataTransform<UPowerDeviceState::Enum>::fromWire(quint32 wire) {
|
||||
if (wire != UPowerDeviceType::Battery && wire >= UPowerDeviceState::Unknown
|
||||
|
@ -120,10 +118,6 @@ DBusDataTransform<UPowerDeviceState::Enum>::fromWire(quint32 wire) {
|
|||
);
|
||||
}
|
||||
|
||||
quint32 DBusDataTransform<UPowerDeviceState::Enum>::toWire(const UPowerDeviceState::Enum& value) {
|
||||
return static_cast<quint32>(value);
|
||||
}
|
||||
|
||||
DBusResult<UPowerDeviceType::Enum> DBusDataTransform<UPowerDeviceType::Enum>::fromWire(quint32 wire
|
||||
) {
|
||||
if (wire >= UPowerDeviceType::Unknown && wire <= UPowerDeviceType::BluetoothGeneric) {
|
||||
|
@ -135,8 +129,4 @@ DBusResult<UPowerDeviceType::Enum> DBusDataTransform<UPowerDeviceType::Enum>::fr
|
|||
);
|
||||
}
|
||||
|
||||
quint32 DBusDataTransform<UPowerDeviceType::Enum>::toWire(const UPowerDeviceType::Enum& value) {
|
||||
return static_cast<quint32>(value);
|
||||
}
|
||||
|
||||
} // namespace qs::dbus
|
||||
|
|
|
@ -91,7 +91,6 @@ struct DBusDataTransform<qs::service::upower::UPowerDeviceState::Enum> {
|
|||
using Wire = quint32;
|
||||
using Data = qs::service::upower::UPowerDeviceState::Enum;
|
||||
static DBusResult<Data> fromWire(Wire wire);
|
||||
static Wire toWire(const Data& value);
|
||||
};
|
||||
|
||||
template <>
|
||||
|
@ -99,7 +98,6 @@ struct DBusDataTransform<qs::service::upower::UPowerDeviceType::Enum> {
|
|||
using Wire = quint32;
|
||||
using Data = qs::service::upower::UPowerDeviceType::Enum;
|
||||
static DBusResult<Data> fromWire(Wire wire);
|
||||
static Wire toWire(const Data& value);
|
||||
};
|
||||
|
||||
template <>
|
||||
|
@ -107,7 +105,6 @@ struct DBusDataTransform<qs::service::upower::PowerPercentage> {
|
|||
using Wire = qreal;
|
||||
using Data = qreal;
|
||||
static DBusResult<Data> fromWire(Wire wire);
|
||||
static Wire toWire(const Data& value);
|
||||
};
|
||||
|
||||
} // namespace qs::dbus
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue