diff options
author | André Nusser <andre.nusser@googlemail.com> | 2017-04-23 18:58:42 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2017-04-23 18:58:42 +0200 |
commit | 78b97bbbbdad3339c43afda120ab218a41bc74b3 (patch) | |
tree | 79fdcc6f3e69c32b55db26c0875264bc2907c744 /plugingui/frame.cc | |
parent | 7e811d0a92ed8a89ef01531a7e7826692f4898e5 (diff) |
Fix broken PowerButton state of the frame.
Diffstat (limited to 'plugingui/frame.cc')
-rw-r--r-- | plugingui/frame.cc | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/plugingui/frame.cc b/plugingui/frame.cc index c56245a..efe0281 100644 --- a/plugingui/frame.cc +++ b/plugingui/frame.cc @@ -44,7 +44,7 @@ FrameWidget::FrameWidget(Widget* parent, bool has_switch) power_button.setChecked(is_switched_on); CONNECT(&power_button, stateChangedNotifier, this, - &FrameWidget::powerButtonClicked); + &FrameWidget::powerButtonStateChanged); } power_button.setVisible(has_switch); @@ -80,15 +80,10 @@ void FrameWidget::repaintEvent(RepaintEvent* repaintEvent) p.drawText(center_x - label_width, bar_height - 4, font, title_buf); } -void FrameWidget::powerButtonClicked(bool clicked) +void FrameWidget::powerButtonStateChanged(bool new_state) { - is_switched_on = !is_switched_on; + is_switched_on = new_state; onSwitchChangeNotifier(is_switched_on); - - if(content) - { - content->setVisible(true); - } } void FrameWidget::setTitle(std::string const& title) @@ -101,15 +96,12 @@ void FrameWidget::setContent(Widget* content) { this->content = content; content->reparent(this); - content->setVisible(true); } void FrameWidget::setOnSwitch(bool on) { is_switched_on = on; - onSwitchChangeNotifier(is_switched_on); - - redraw(); + power_button.setChecked(is_switched_on); } void FrameWidget::sizeChanged(int width, int height) |