service/upower: adopt bindable properties

This commit is contained in:
outfoxxed 2024-11-21 03:40:53 -08:00
parent d4deb11216
commit ff55ac874b
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
4 changed files with 162 additions and 107 deletions

View file

@ -53,13 +53,6 @@ UPower::UPower() {
}
void UPower::init() {
QObject::connect(
&this->pOnBattery,
&dbus::AbstractDBusProperty::changed,
this,
&UPower::onBatteryChanged
);
this->serviceProperties.setInterface(this->service);
this->serviceProperties.updateAllViaGetAll();
@ -143,8 +136,6 @@ UPowerDevice* UPower::displayDevice() { return this->mDisplayDevice; }
ObjectModel<UPowerDevice>* UPower::devices() { return &this->readyDevices; }
bool UPower::onBattery() const { return this->pOnBattery.get(); }
UPower* UPower::instance() {
static UPower* instance = new UPower(); // NOLINT
return instance;
@ -173,6 +164,4 @@ ObjectModel<UPowerDevice>* UPowerQml::devices() { // NOLINT
return UPower::instance()->devices();
}
bool UPowerQml::onBattery() { return UPower::instance()->onBattery(); }
} // namespace qs::service::upower