-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadddevicedialog.cpp
More file actions
55 lines (48 loc) · 1.24 KB
/
Copy pathadddevicedialog.cpp
File metadata and controls
55 lines (48 loc) · 1.24 KB
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
53
54
55
#include "adddevicedialog.h"
#include "ui_adddevicedialog.h"
AddDeviceDialog::AddDeviceDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AddDeviceDialog)
{
LOG(__PRETTY_FUNCTION__);
ui->setupUi(this);
connect(ui->nameEdit, SIGNAL(textChanged(const QString&)),
this, SLOT(nameChanged(const QString&)));
ui->buttonBox->buttons().at(0)->setEnabled(false);
}
AddDeviceDialog::~AddDeviceDialog()
{
LOG(__PRETTY_FUNCTION__);
delete ui;
}
void AddDeviceDialog::nameChanged(const QString &_name)
{
LOG(__PRETTY_FUNCTION__);
emit checkName(_name);
}
void AddDeviceDialog::nameAvailable(bool available)
{
LOG(__PRETTY_FUNCTION__);
if(available){
ui->nameTakenLabel->setText("Valid");
ui->buttonBox->buttons().at(0)->setEnabled(true);
} else {
ui->nameTakenLabel->setText("Invalid");
ui->buttonBox->buttons().at(0)->setEnabled(false);
}
}
std::string AddDeviceDialog::name()
{
LOG(__PRETTY_FUNCTION__);
return ui->nameEdit->text().toStdString();
}
std::string AddDeviceDialog::host()
{
LOG(__PRETTY_FUNCTION__);
return ui->addressEdit->text().toStdString();
}
int AddDeviceDialog::port()
{
LOG(__PRETTY_FUNCTION__);
return ui->portEdit->value();
}