-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnectdialog.cpp
46 lines (35 loc) · 1011 Bytes
/
connectdialog.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
#include "connectdialog.h"
#include "ui_connectdialog.h"
ConnectDialog::ConnectDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ConnectDialog)
{
ui->setupUi(this);
setModal(true);
QSettings settings;
QString host = settings.value("host").toString();
QString port = settings.value("port").toString();
QString index = settings.value("index").toString();
if (port.isEmpty()) {
port = "9200";
}
ui->leHost->setText(host);
ui->lePort->setText(port);
ui->leIndex->setText(index);
}
ConnectDialog::~ConnectDialog()
{
delete ui;
}
void ConnectDialog::on_buttonBox_accepted()
{
QString host = ui->leHost->text();
QString port = ui->lePort->text();
QString index = ui->leIndex->text();
QSettings settings;
settings.setValue("host", host);
settings.setValue("port", port);
settings.setValue("index", index);
QString newConnection = host + ":" + port + "/" + index;
emit connectionUpdated(newConnection);
}