aboutsummaryrefslogtreecommitdiff
path: root/confui/ui_tab_automations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'confui/ui_tab_automations.cpp')
-rw-r--r--confui/ui_tab_automations.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/confui/ui_tab_automations.cpp b/confui/ui_tab_automations.cpp
index 89ad5d4..7dd150e 100644
--- a/confui/ui_tab_automations.cpp
+++ b/confui/ui_tab_automations.cpp
@@ -1,7 +1,7 @@
-#include <QVBoxLayout>
-#include <QWidget>
#include <QLabel>
#include <QPushButton>
+#include <QVBoxLayout>
+#include <QWidget>
#include "ui_tab_automations.h"
@@ -9,7 +9,7 @@ using std::pair;
class CDAddAutomationWidget : public QWidget {
private:
- CDAutomationsTabWidget* _parent;
+ CDAutomationsTabWidget *_parent;
public:
void new_automation() {
@@ -17,11 +17,11 @@ public:
_parent->update();
}
- CDAddAutomationWidget(QWidget* parent) : QWidget(parent) {
- _parent = (CDAutomationsTabWidget*) parent;
+ CDAddAutomationWidget(QWidget *parent) : QWidget(parent) {
+ _parent = (CDAutomationsTabWidget *)parent;
- QHBoxLayout* main_layout = new QHBoxLayout;
- QPushButton* button_add = new QPushButton("Add automation");
+ QHBoxLayout *main_layout = new QHBoxLayout;
+ QPushButton *button_add = new QPushButton("Add automation");
main_layout->addStretch();
main_layout->addWidget(button_add);
@@ -35,15 +35,14 @@ public:
~CDAddAutomationWidget() {}
};
-
-CDAutomationsTabWidget::~CDAutomationsTabWidget() { }
-CDAutomationsTabWidget::CDAutomationsTabWidget(CDMainWindow* main_window) : QWidget(main_window) {
- this->mainwindow = main_window;
- main_layout = new CDScrollContainerLayout(this);
- automations = new QVBoxLayout;
+CDAutomationsTabWidget::~CDAutomationsTabWidget() {}
+CDAutomationsTabWidget::CDAutomationsTabWidget(CDMainWindow *main_window) : QWidget(main_window) {
+ this->mainwindow = main_window;
+ main_layout = new CDScrollContainerLayout(this);
+ automations = new QVBoxLayout;
new_automation_button = new CDAddAutomationWidget(this);
- QWidget* automations_widget = new QWidget(this);
+ QWidget *automations_widget = new QWidget(this);
automations_widget->setLayout(automations);
main_layout->addWidget(automations_widget);
@@ -54,9 +53,9 @@ CDAutomationsTabWidget::CDAutomationsTabWidget(CDMainWindow* main_window) : QWid
}
void CDAutomationsTabWidget::update() {
- map<cd_link_t, cd_s_automation*> links = this->mainwindow->mesh_connector->get_links(false);
+ map<cd_link_t, cd_s_automation *> links = this->mainwindow->mesh_connector->get_links(false);
- for (pair<cd_link_t, cd_s_automation*> link : links) {
+ for (pair<cd_link_t, cd_s_automation *> link : links) {
if (automation_widgets.count(link.first) == 0) {
automation_widgets[link.first] = new CDAutomationWidget(this); // create new automation
automation_widgets[link.first]->set_automation(link.first);
@@ -66,9 +65,8 @@ void CDAutomationsTabWidget::update() {
automation_widgets[link.first]->update(); // update existing widget
} else if (automation_widgets[link.first] != nullptr) {
automations->removeWidget(automation_widgets[link.first]); // remove removed automation
- delete automation_widgets[link.first]; // free automation widget
+ delete automation_widgets[link.first]; // free automation widget
automation_widgets[link.first] = nullptr;
}
}
}
-