aboutsummaryrefslogtreecommitdiff
path: root/confui/ui_node.h
blob: 4c049b3ece95c8b4dc9e70e5e2a4f6fe696fdb90 (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
#pragma once

#include <QCheckBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QString>
#include <QWidget>

#include "mesh_connector.h"

/** @brief widget that displays single node */
class CDNodeWidget : public QWidget {
	Q_OBJECT

private:
	cd_s_node *_node = nullptr;
	cd_uid_t _id;

	QHBoxLayout *main_layout;
	QLabel *label_node_name;
	QLabel *label_node_address;
	QCheckBox *switch_on_off;
	QPushButton *button_add_remove;

public:
	CDNodeWidget(QWidget *parent = nullptr);
	virtual ~CDNodeWidget();
	/** @brief update node info in GUI */
	virtual void update();
	/** @brief register which node this widget controls */
	virtual void set_node(cd_uid_t id);
	/** @brief join/remove from network */
	virtual void toggle_provision();
	/** @brief turn led on/off */
	virtual void update_led(bool on);
	/** @brief send get_node command to update self */
	virtual void update_net();
};