aboutsummaryrefslogtreecommitdiff
path: root/confui/mainwindow.h
blob: 53a30c21c1af1b13fc2e88300317004a54bddeb9 (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
41
42
43
44
45
#pragma once

#include <QMainWindow>
#include <QtSerialPort/QSerialPort>

#include <QDebug>

#include "mesh_connector.h"
#include "serial.h"

class CDAutomationsTabWidget;
class CDNodeOverviewTabWidget;
class CDMainWindow;

extern CDMainWindow *g_cd_main_window;

/**
 * @brief main window
 *
 * creates menu bar and tabs
 * cascading refresh (automatic and manual)
 */
class CDMainWindow : public QMainWindow {
	Q_OBJECT

private:
	QMenuBar *menu_bar						   = nullptr;
	CDAutomationsTabWidget *automations_tab	   = nullptr;
	CDNodeOverviewTabWidget *node_overview_tab = nullptr;

public:
	CDMeshConnector *mesh_connector		= nullptr;
	CDSerialConnector *serial_connector = nullptr;

	CDMainWindow(QWidget *parent = nullptr);
	~CDMainWindow();
	/** @brief update user interface */
	virtual void update();
	/** @brief menu bar refresh action handler */
	virtual void menu_refresh();
	/** @brief menu bar add automation action handler */
	virtual void menu_add_automation();
	/** @brief menu bar set serial port action handler */
	void menu_set_serial_port(string new_port);
};