-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
addcallsign.cpp
78 lines (65 loc) · 2.11 KB
/
addcallsign.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
#include "addcallsign.h"
#include "ui_addcallsign.h"
#include <QMessageBox>
Addcallsign::Addcallsign(QWidget *parent)
: QDialog(parent)
, ui(new Ui::Addcallsign)
{
ui->setupUi(this);
ui->addCallsignEdit->setStyleSheet("color: black; font-weight: bold");
ui->addCallsignEdit->setValidator(new QRegularExpressionValidator(QRegularExpression("^[a-zA-Z0-9/]*$"), this));
}
Addcallsign::~Addcallsign()
{
delete ui;
}
void Addcallsign::on_addCallsignEdit_textEdited(const QString &arg1)
{
QString callsign = arg1.toUpper();
ui->addCallsignEdit->setText(callsign);
ui->addCallsignEdit->setStyleSheet("font-weight: bold");
}
void Addcallsign::on_addRDA_textEdited(const QString &arg1)
{
QString rda = arg1.toUpper();
ui->addRDA->setText(rda);
}
void Addcallsign::on_addLOC_textEdited(const QString &arg1)
{
QString location = arg1.toUpper();
ui->addLOC->setText(location);
}
void Addcallsign::on_addCallsignType_currentIndexChanged(int index)
{
if(index == 0) add_CallsignType = 0;
if(index == 1) add_CallsignType = 1;
if(index == 2) add_CallsignType = 2;
}
void Addcallsign::on_OkCallsignBtn_clicked()
{
QDateTime dt;
add_Callsign = ui->addCallsignEdit->text();
add_CallsignType = ui->addCallsignType->currentIndex();
dt = ui->validity_start->dateTime();
add_validity_start = dt.toSecsSinceEpoch();
dt = ui->validity_stop->dateTime();
add_validity_stop = dt.toSecsSinceEpoch();
add_location = ui->addLOC->text();
add_rda = ui->addRDA->text();
add_ituz = ui->addITU->text().toInt();
add_cqz = ui->addCQ->text().toInt();
if (add_Callsign.length() < 3) {
QMessageBox::critical(0, "Ошибка!", "Позывной сигнал не может быть меньше 3 символов.", QMessageBox::Ok);
return;
}
if (add_location.length() < 4) {
QMessageBox::critical(0, "Ошибка!", "QTH локатор не может быть меньше 4 символов.", QMessageBox::Ok);
return;
}
emit addCallsign();
close();
}
void Addcallsign::on_CnlCallsignBtn_clicked()
{
close();
}