-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstanceedr.cpp
83 lines (68 loc) · 1.41 KB
/
instanceedr.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright 2020 VMware, Inc.
// SPDX-License-Identifier: MIT
#include "instanceedr.h"
#include "ui_instanceedr.h"
InstanceEdr::InstanceEdr(QWidget *parent) :
QWidget(parent),
ui(new Ui::InstanceEdr)
{
ui->setupUi(this);
}
InstanceEdr::~InstanceEdr()
{
delete ui;
}
void InstanceEdr::set_name(const QString & name)
{
ui->lineEdit_name->setText(name);
}
void InstanceEdr::set_api(const QString & api)
{
ui->lineEdit_api->setText(api);
}
void InstanceEdr::set_url(const QString & url)
{
ui->lineEdit_url->setText(url);
check_validity();
}
QString InstanceEdr::get_name()
{
return ui->lineEdit_name->text();
}
QString InstanceEdr::get_api()
{
return ui->lineEdit_api->text();
}
QString InstanceEdr::get_url()
{
return ui->lineEdit_url->text();
}
bool InstanceEdr::isValid()
{
if (get_name().isEmpty() || get_api().isEmpty() || get_url().isEmpty())
return false;
return true;
}
void InstanceEdr::check_validity()
{
if (!isValid()) {
ui->label_invalid->show();
} else {
ui->label_invalid->hide();
}
}
void InstanceEdr::on_lineEdit_name_textChanged(const QString & arg1)
{
Q_UNUSED(arg1);
check_validity();
}
void InstanceEdr::on_lineEdit_url_textChanged(const QString & arg1)
{
Q_UNUSED(arg1);
check_validity();
}
void InstanceEdr::on_lineEdit_api_textChanged(const QString &arg1)
{
Q_UNUSED(arg1);
check_validity();
}