diff --git a/apps/apps_window.cpp b/apps/apps_window.cpp index 4b6148973..c857ce385 100644 --- a/apps/apps_window.cpp +++ b/apps/apps_window.cpp @@ -13,12 +13,12 @@ void AppsWindow::setTitle(I18n::Message title) { m_titleBarView.setTitle(title); } -void AppsWindow::updateBatteryLevel() { - m_titleBarView.setChargeState(Ion::Battery::level()); +bool AppsWindow::updateBatteryLevel() { + return m_titleBarView.setChargeState(Ion::Battery::level()); } -void AppsWindow::updateIsChargingState() { - m_titleBarView.setIsCharging(Ion::Battery::isCharging()); +bool AppsWindow::updateIsChargingState() { + return m_titleBarView.setIsCharging(Ion::Battery::isCharging()); } void AppsWindow::refreshPreferences() { diff --git a/apps/apps_window.h b/apps/apps_window.h index 9b37ca231..f174cd261 100644 --- a/apps/apps_window.h +++ b/apps/apps_window.h @@ -8,8 +8,8 @@ class AppsWindow : public Window { public: AppsWindow(); void setTitle(I18n::Message title); - void updateBatteryLevel(); - void updateIsChargingState(); + bool updateBatteryLevel(); + bool updateIsChargingState(); void refreshPreferences(); private: constexpr static KDCoordinate k_titleBarHeight = 18; diff --git a/apps/battery_view.cpp b/apps/battery_view.cpp index 5c91df8e5..503685ccb 100644 --- a/apps/battery_view.cpp +++ b/apps/battery_view.cpp @@ -18,18 +18,22 @@ BatteryView::BatteryView() : { } -void BatteryView::setChargeState(Ion::Battery::Charge chargeState) { +bool BatteryView::setChargeState(Ion::Battery::Charge chargeState) { if (chargeState != m_chargeState) { m_chargeState = chargeState; markRectAsDirty(bounds()); + return true; } + return false; } -void BatteryView::setIsCharging(bool isCharging) { +bool BatteryView::setIsCharging(bool isCharging) { if (m_isCharging != isCharging) { m_isCharging = isCharging; markRectAsDirty(bounds()); + return true; } + return false; } KDColor s_flashWorkingBuffer[BatteryView::k_flashHeight*BatteryView::k_flashWidth]; diff --git a/apps/battery_view.h b/apps/battery_view.h index 2b500c607..e422541b0 100644 --- a/apps/battery_view.h +++ b/apps/battery_view.h @@ -6,8 +6,8 @@ class BatteryView : public View { public: BatteryView(); - void setChargeState(Ion::Battery::Charge chargeState); - void setIsCharging(bool isCharging); + bool setChargeState(Ion::Battery::Charge chargeState); + bool setIsCharging(bool isCharging); void drawRect(KDContext * ctx, KDRect rect) const override; KDSize minimalSizeForOptimalDisplay() const override; constexpr static int k_flashHeight = 8; diff --git a/apps/title_bar_view.cpp b/apps/title_bar_view.cpp index 5ef83e5d8..7aec661d5 100644 --- a/apps/title_bar_view.cpp +++ b/apps/title_bar_view.cpp @@ -13,21 +13,16 @@ TitleBarView::TitleBarView() : { } -void TitleBarView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(bounds(), Palette::YellowDark); - -} - void TitleBarView::setTitle(I18n::Message title) { m_titleView.setMessage(title); } -void TitleBarView::setChargeState(Ion::Battery::Charge chargeState) { - m_batteryView.setChargeState(chargeState); +bool TitleBarView::setChargeState(Ion::Battery::Charge chargeState) { + return m_batteryView.setChargeState(chargeState); } -void TitleBarView::setIsCharging(bool isCharging) { - m_batteryView.setIsCharging(isCharging); +bool TitleBarView::setIsCharging(bool isCharging) { + return m_batteryView.setIsCharging(isCharging); } int TitleBarView::numberOfSubviews() const { diff --git a/apps/title_bar_view.h b/apps/title_bar_view.h index 98ca955f1..b56cca6f3 100644 --- a/apps/title_bar_view.h +++ b/apps/title_bar_view.h @@ -8,10 +8,9 @@ class TitleBarView : public View { public: TitleBarView(); - void drawRect(KDContext * ctx, KDRect rect) const override; void setTitle(I18n::Message title); - void setChargeState(Ion::Battery::Charge chargeState); - void setIsCharging(bool isCharging); + bool setChargeState(Ion::Battery::Charge chargeState); + bool setIsCharging(bool isCharging); void refreshPreferences(); private: constexpr static KDCoordinate k_batteryLeftMargin = 5;