summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugingui/frame.cc16
-rw-r--r--plugingui/frame.h2
2 files changed, 5 insertions, 13 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)
diff --git a/plugingui/frame.h b/plugingui/frame.h
index 04cfeb2..8475690 100644
--- a/plugingui/frame.h
+++ b/plugingui/frame.h
@@ -77,7 +77,7 @@ private:
bool is_switched_on;
PowerButton power_button{this};
- void powerButtonClicked(bool clicked);
+ void powerButtonStateChanged(bool clicked);
// grey box
std::size_t bar_height;