source: ntrip/trunk/GnssCenter/monitor/dlgconf.cpp@ 10514

Last change on this file since 10514 was 5469, checked in by mervart, 11 years ago
File size: 2.0 KB
Line 
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
22using namespace std;
23using namespace GnssCenter;
24
25// Constructor
26/////////////////////////////////////////////////////////////////////////////
27t_dlgConf::t_dlgConf(QWidget* parent) : QDialog(parent) {
28
29 t_settings settings(pluginName);
30
31 QString host = settings.value("host").toString();
32 if (host.isEmpty()) {
33 host = "localhost";
34 }
35 _hostLineEdit = new QLineEdit(host, this);
36 _portLineEdit = new QLineEdit(settings.value("port").toString(), this);
37
38
39 QFormLayout* formLayout = new QFormLayout;
40 formLayout->addRow("Host:", _hostLineEdit);
41 formLayout->addRow("Port:", _portLineEdit);
42
43 QPushButton* cancelButton = new QPushButton("Cancel", this);
44 connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
45
46 QPushButton* okButton = new QPushButton("OK", this);
47 connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
48
49 QHBoxLayout* buttonLayout = new QHBoxLayout;
50 buttonLayout->addWidget(cancelButton);
51 buttonLayout->addWidget(okButton);
52
53 QVBoxLayout* mainLayout = new QVBoxLayout;
54 mainLayout->addLayout(formLayout);
55 mainLayout->addLayout(buttonLayout);
56 setLayout(mainLayout);
57}
58
59// Destructor
60/////////////////////////////////////////////////////////////////////////////
61t_dlgConf::~t_dlgConf() {
62}
63
64// Accept (virtual slot)
65/////////////////////////////////////////////////////////////////////////////
66void t_dlgConf::accept() {
67 t_settings settings(pluginName);
68 QString host = _hostLineEdit->text();
69 if (host.isEmpty()) {
70 host = "localhost";
71 }
72 settings.setValue("host", host);
73 settings.setValue("port", _portLineEdit->text());
74 QDialog::accept();
75}
76
Note: See TracBrowser for help on using the repository browser.