diff options
author | André Nusser <andre.nusser@googlemail.com> | 2020-05-01 10:04:36 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2020-05-01 10:04:36 +0200 |
commit | 57a7ba540d6ede28aadec2e5181c6a16534de91e (patch) | |
tree | f28d07faabdfa0670c8c19631060fceee0750c01 | |
parent | 8ec4bbadfbd526ed21b3d3ac4a86d42781379fae (diff) |
Add input and output label in powerwidget.
As box.width() wasn't behaving as I expected, I just reused its size
calculation. Please fix if you know how to do that nice. :)
-rw-r--r-- | plugingui/powerwidget.cc | 13 | ||||
-rw-r--r-- | plugingui/powerwidget.h | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/plugingui/powerwidget.cc b/plugingui/powerwidget.cc index 7e8a904..3f169d6 100644 --- a/plugingui/powerwidget.cc +++ b/plugingui/powerwidget.cc @@ -43,7 +43,7 @@ PowerWidget::PowerWidget(GUI::Widget* parent, , canvas(this, settings, settings_notifier) , settings(settings) { - canvas.move(7, 7); + canvas.move(27, 7); CONNECT(&shelf_checkbox, stateChangedNotifier, this, &PowerWidget::chk_shelf); @@ -52,6 +52,13 @@ PowerWidget::PowerWidget(GUI::Widget* parent, shelf_label.resize(59, 16); shelf_checkbox.resize(59, 40); + input_label.setText("in"); + input_label.resize(20, 16); + input_label.setAlignment(GUI::TextAlignment::center); + output_label.setText("out"); + output_label.resize(20, 16); + output_label.setAlignment(GUI::TextAlignment::left); + CONNECT(&settings_notifier, powermap_shelf, &shelf_checkbox, &GUI::CheckBox::setChecked); } @@ -65,7 +72,7 @@ void PowerWidget::repaintEvent(GUI::RepaintEvent *repaintEvent) { GUI::Painter p(*this); box.setSize(width() - 59 - 64, height()); - p.drawImage(0, 0, box); + p.drawImage(20, 0, box); } void PowerWidget::resize(std::size_t width, std::size_t height) @@ -80,6 +87,8 @@ void PowerWidget::resize(std::size_t width, std::size_t height) shelf_label.move(width - 59 + 5 - 32 , 0); shelf_checkbox.move(width - 59 + 5 - 32, 16); + input_label.move(20+(width-64-59)/2, height-2); + output_label.move(0, height/2); } PowerWidget::Canvas::Canvas(GUI::Widget* parent, diff --git a/plugingui/powerwidget.h b/plugingui/powerwidget.h index b724e8c..562383b 100644 --- a/plugingui/powerwidget.h +++ b/plugingui/powerwidget.h @@ -90,6 +90,8 @@ private: Canvas canvas; GUI::Label shelf_label{this}; GUI::CheckBox shelf_checkbox{this}; + GUI::Label input_label{this}; + GUI::Label output_label{this}; Settings& settings; }; |