aboutsummaryrefslogtreecommitdiff
path: root/confui/ui_automation.h
blob: 69f2bddd1facbc91a1a3f4fac09c8053ecfeadf1 (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 <QWidget>
#include <QHBoxLayout>
#include <QPushButton>
#include <QString>
#include <QComboBox>

#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();
};