aboutsummaryrefslogtreecommitdiff
path: root/confui/ui_automation.h
blob: f0608bc209862e5c565392723b5a81807906f55d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include <QComboBox>
#include <QHBoxLayout>
#include <QPushButton>
#include <QString>
#include <QWidget>

#include "mesh_connector.h"

class CDAutomationsTabWidget;
/** @brief widget that displays single automation */
class CDAutomationWidget : public QWidget {
	Q_OBJECT

private:
	cd_s_automation *_automation = nullptr;
	cd_link_t _id;
	CDAutomationsTabWidget *_parent = nullptr;

	QHBoxLayout *main_layout;
	QComboBox *dropdown_button;
	QComboBox *dropdown_action;
	QComboBox *dropdown_light;
	QPushButton *button_remove;

public:
	CDAutomationWidget(QWidget *parent = nullptr);
	virtual ~CDAutomationWidget();
	/** @brief redraw ui with new values */
	virtual void update();
	/** @brief register automation that this widget controls */
	virtual void set_automation(cd_link_t link);
	/** @brief test if all fields are valid / entered */
	virtual bool conf_valid();
	/** @brief apply new automation rule */
	virtual void apply();
	/** @brief remove automation */
	virtual void remove();
};