-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.cpp
54 lines (38 loc) · 1.36 KB
/
settings.cpp
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
#include "settings.h"
#include "instrument_panel.h"
#include <iostream>
Settings::Settings(QJsonObject settings, QWidget *parent, bool overlay)
: QWidget(parent)
{
QHBoxLayout* l = new QHBoxLayout;
this->setLayout(l);
url = new QLineEdit(settings.find("url").value().toString());
dt = new QSpinBox();
dt->setMaximum(99999);
dt->setValue(settings.find("dt").value().toDouble());
dt->setSuffix("ms");
QPushButton* run = new QPushButton("Start");
QPushButton* editor = new QPushButton("Editor");
QCheckBox* asOverlay = new QCheckBox("As overlay");
asOverlay->setChecked(overlay);
l->addWidget(new QLabel("Adress:", this));
l->addWidget(url);
l->addWidget(new QLabel("Update every:", this));
l->addWidget(dt);
l->addWidget(run);
l->addWidget(editor);
l->addWidget(asOverlay);
connect(url, SIGNAL(textChanged(QString)), parent, SLOT(set_url(QString)));
connect(dt, SIGNAL(valueChanged(int)), parent, SLOT(set_dt(int)));
connect(run, SIGNAL(clicked()), parent, SLOT(run_cockpit()));
// connect(editor, SIGNAL(clicked()), this, SLOT(show_editor()));
connect(editor, SIGNAL(clicked()), parent, SLOT(run_edit()));
connect(asOverlay,SIGNAL(stateChanged(int)), parent, SLOT(set_overlay(int)));
}
void Settings::show_editor()
{
this->parentWidget()->hide();
}
Settings::~Settings()
{
}