1 |
|
---|
2 | /* -------------------------------------------------------------------------
|
---|
3 | * RTNet DlgConf
|
---|
4 | * -------------------------------------------------------------------------
|
---|
5 | *
|
---|
6 | * Class: t_dlgConf
|
---|
7 | *
|
---|
8 | * Purpose: Set configuration
|
---|
9 | *
|
---|
10 | * Author: L. Mervart
|
---|
11 | *
|
---|
12 | * Created: 15-Sep-2013
|
---|
13 | *
|
---|
14 | * Changes:
|
---|
15 | *
|
---|
16 | * -----------------------------------------------------------------------*/
|
---|
17 |
|
---|
18 | #include "dlgconf.h"
|
---|
19 | #include "settings.h"
|
---|
20 | #include "const.h"
|
---|
21 |
|
---|
22 | using namespace std;
|
---|
23 | using namespace GnssCenter;
|
---|
24 |
|
---|
25 | // Constructor
|
---|
26 | /////////////////////////////////////////////////////////////////////////////
|
---|
27 | t_dlgConf::t_dlgConf(QWidget* parent) : QDialog(parent) {
|
---|
28 |
|
---|
29 | t_settings settings(pluginName);
|
---|
30 |
|
---|
31 | _hostLineEdit = new QLineEdit(settings.value("host").toString(), this);
|
---|
32 | _portLineEdit = new QLineEdit(settings.value("port").toString(), this);
|
---|
33 |
|
---|
34 |
|
---|
35 | QFormLayout* formLayout = new QFormLayout;
|
---|
36 | formLayout->addRow("Host:", _hostLineEdit);
|
---|
37 | formLayout->addRow("Port:", _portLineEdit);
|
---|
38 |
|
---|
39 | QPushButton* cancelButton = new QPushButton("Cancel", this);
|
---|
40 | connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
|
---|
41 |
|
---|
42 | QPushButton* okButton = new QPushButton("OK", this);
|
---|
43 | connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
|
---|
44 |
|
---|
45 | QHBoxLayout* buttonLayout = new QHBoxLayout;
|
---|
46 | buttonLayout->addWidget(cancelButton);
|
---|
47 | buttonLayout->addWidget(okButton);
|
---|
48 |
|
---|
49 | QVBoxLayout* mainLayout = new QVBoxLayout;
|
---|
50 | mainLayout->addLayout(formLayout);
|
---|
51 | mainLayout->addLayout(buttonLayout);
|
---|
52 | setLayout(mainLayout);
|
---|
53 | }
|
---|
54 |
|
---|
55 | // Destructor
|
---|
56 | /////////////////////////////////////////////////////////////////////////////
|
---|
57 | t_dlgConf::~t_dlgConf() {
|
---|
58 | }
|
---|
59 |
|
---|
60 | // Accept (virtual slot)
|
---|
61 | /////////////////////////////////////////////////////////////////////////////
|
---|
62 | void t_dlgConf::accept() {
|
---|
63 | t_settings settings(pluginName);
|
---|
64 | settings.setValue("host", _hostLineEdit->text());
|
---|
65 | settings.setValue("port", _portLineEdit->text());
|
---|
66 | }
|
---|
67 |
|
---|