diff options
author | lonkaars <loek@pipeframe.xyz> | 2022-12-05 12:39:12 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2022-12-05 12:39:12 +0100 |
commit | 51bfa6adf76353a4ac0f7941bae138cc5cb665c5 (patch) | |
tree | 481234586c22f7e0927072b6c965ef240e9976a0 /confui/ui_tab_node_overview.cpp | |
parent | cd89c506cf45b6de221f89388fb146efca96599c (diff) |
automation widget + renaming
Diffstat (limited to 'confui/ui_tab_node_overview.cpp')
-rw-r--r-- | confui/ui_tab_node_overview.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/confui/ui_tab_node_overview.cpp b/confui/ui_tab_node_overview.cpp new file mode 100644 index 0000000..4dd2007 --- /dev/null +++ b/confui/ui_tab_node_overview.cpp @@ -0,0 +1,55 @@ +#include <QWidget> +#include <QLabel> +#include <QVBoxLayout> + +#include "ui_tab_node_overview.h" +#include "ui_node.h" +#include "ui_automation.h" + +class CDAddAutomationWidget : public QWidget { +public: + CDAddAutomationWidget(QWidget* parent) : QWidget(parent) { + QHBoxLayout* main_layout = new QHBoxLayout; + QPushButton* button_add = new QPushButton("Add automation"); + + main_layout->addStretch(); + main_layout->addWidget(button_add); + main_layout->addStretch(); + + setLayout(main_layout); + } + + ~CDAddAutomationWidget() {} +}; + +CDNodeOverviewTabWidget::~CDNodeOverviewTabWidget() { } +CDNodeOverviewTabWidget::CDNodeOverviewTabWidget(CDMainWindow* main_window) : QWidget(main_window) { + this->mainwindow = main_window; + + QVBoxLayout* main_layout = new QVBoxLayout; + + const char* n_name = "berta"; + cd_s_node n = { + .address = { 0x00, 0xff, 0x21, 0x69, 0xf2, 0x31 }, + .name_len = strlen(n_name), + .name = n_name, + .light_on = true, + .provisioned = true, + }; + + cd_s_automation a = { + .type = CD_AUTOMATION_TYPE_TOGGLE, + .button = &n, + .light = &n, + }; + + CDNodeWidget* nd_w = new CDNodeWidget(&n, this); + CDAutomationWidget* au_w = new CDAutomationWidget(&a, this); + CDAddAutomationWidget* ad_w = new CDAddAutomationWidget(this); + + main_layout->addWidget(nd_w); + main_layout->addWidget(au_w); + main_layout->addWidget(ad_w); + + setLayout(main_layout); +} |