blob: f5c29ed1d99b23c80603df5ee793a135d8f2c1fd (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#include <QMenuBar>
#include <QGridLayout>
#include <QTabWidget>
#include "mainwindow.h"
#include "ui_tab_automations.h"
#include "ui_tab_node_overview.h"
CDMeshConnector* g_cd_mesh_connector = nullptr;
CDMainWindow::~CDMainWindow() {
delete this->mesh_connector;
}
CDMainWindow::CDMainWindow(QWidget *parent) : QMainWindow(parent) {
g_cd_mesh_connector = new CDMeshConnector();
this->mesh_connector = g_cd_mesh_connector;
menu_bar = new QMenuBar(this);
QTabWidget* tab_bar_widget = new QTabWidget(this);
automations_tab = new CDAutomationsTabWidget(this);
node_overview_tab = new CDNodeOverviewTabWidget(this);
tab_bar_widget->addTab(this->node_overview_tab, "node overview");
tab_bar_widget->addTab(this->automations_tab, "automations");
setMenuBar(menu_bar);
setCentralWidget(tab_bar_widget);
update();
}
void CDMainWindow::update() {
// update tabs (children widgets)
automations_tab->update();
node_overview_tab->update();
setWindowTitle("confui");
menu_bar->clear();
QMenu* menu_options = menu_bar->addMenu("options");
QAction* menu_options_refresh = menu_options->addAction("refresh node list");
connect(menu_options_refresh, &QAction::triggered, this, &CDMainWindow::menu_refresh);
QAction* menu_options_add_automation = menu_options->addAction("add automation");
connect(menu_options_add_automation, &QAction::triggered, this, &CDMainWindow::menu_add_automation);
QMenu* menu_options_serialport = menu_options->addMenu("serial port (FIXME)");
menu_options_serialport->addAction("FIXME A");
menu_options_serialport->addAction("FIXME B");
}
void CDMainWindow::menu_refresh() {
update();
}
void CDMainWindow::menu_add_automation() {
g_cd_mesh_connector->create_link();
update();
}
|