-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstance.cpp
111 lines (93 loc) · 2 KB
/
instance.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Copyright 2020 VMware, Inc.
// SPDX-License-Identifier: MIT
#include "instance.h"
#include "ui_instance.h"
Instance::Instance(QWidget *parent) :
QWidget(parent),
ui(new Ui::Instance)
{
ui->setupUi(this);
}
Instance::~Instance()
{
delete ui;
}
QString Instance::get_name()
{
return ui->customer_name_LineEdit->text();
}
QString Instance::get_api_id()
{
return ui->api_id_LineEdit->text();
}
QString Instance::get_api_secret()
{
return ui->api_secret_LineEdit->text();
}
QString Instance::get_org_key()
{
return ui->org_key_LineEdit->text();
}
QString Instance::get_server_display_name()
{
return ui->env_comboBox->currentText();
}
void Instance::set_name(const QString & s)
{
ui->customer_name_LineEdit->setText(s);
}
void Instance::set_api_id(const QString & s)
{
ui->api_id_LineEdit->setText(s);
}
void Instance::set_api_secret(const QString & s)
{
ui->api_secret_LineEdit->setText(s);
}
void Instance::set_server(const QString & s)
{
ui->env_comboBox->setCurrentText(s);
}
void Instance::set_org_key(const QString & s)
{
ui->org_key_LineEdit->setText(s);
}
bool Instance::isValid()
{
if ((get_name().isEmpty() || get_api_id().isEmpty() || get_api_secret().isEmpty() || get_org_key().isEmpty()))
return false;
return true;
}
void Instance::on_customer_name_LineEdit_textChanged(const QString & arg1)
{
Q_UNUSED(arg1);
check_validity();
}
void Instance::on_api_id_LineEdit_textChanged(const QString & arg1)
{
Q_UNUSED(arg1);
check_validity();
}
void Instance::on_api_secret_LineEdit_textChanged(const QString & arg1)
{
Q_UNUSED(arg1);
check_validity();
}
void Instance::on_org_key_LineEdit_textChanged(const QString & arg1)
{
Q_UNUSED(arg1);
check_validity();
}
void Instance::check_validity()
{
if (!isValid()) {
ui->label_invalid->show();
} else {
ui->label_invalid->hide();
}
}
void Instance::setInstanceType(Instances::InstanceType type)
{
instanceType = type;
check_validity();
}