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

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