-
Notifications
You must be signed in to change notification settings - Fork 5
/
specificationSelectDialog.cpp
155 lines (127 loc) · 4.69 KB
/
specificationSelectDialog.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include "specificationSelectDialog.h"
#include "ui_specificationSelectDialog.h"
#include <map>
#include "global.h"
#include "uap.h"
struct HeaderEntry
{
QString title;
QString url;
};
std::map<int, HeaderEntry> categoryHeader
{
{ 1, {"Monoradar Target Reports (Part 2a)", ""} },
{ 2, {"Monoradar Service Messages (Part2b)", ""} },
{ 3, {"Distribution of Synthetic Air Traffic Data", ""} },
{ 4, {"Safety Net Messages (Part 17)", ""} },
{ 7, {"Directed Interrogation Messages", ""} },
{ 8, {"Monoradar Derived Weather Information", ""} },
{ 9, {"Multisensor Derived Weather Information", ""} },
{ 10, {"Monosensor Surface Movement Data", ""} },
{ 11, {"Advanced-SMGCS Data", ""} },
{ 12, {"Monoradar Target Reports", ""} },
{ 13, {"Monoradar Service Messages", ""} },
{ 14, {"Monoradar Weather Reports", ""} },
{ 17, {"Mode S Surveillance Co-ordination Function messages", ""} },
{ 18, {"Mode S Data-Link Function messages", ""} },
{ 19, {"MLT System Status Messages", ""} },
{ 20, {"MLT Messages", ""} },
{ 21, {"ADS-B Messages", ""} },
{ 22, {"TIS-B Management Messages", ""} },
{ 23, {"CNS/ATM Ground Station Service Messages", ""} },
{ 24, {"ADS-C Messages", ""} },
{ 25, {"CNS/ATM Ground System Status Reports", ""} },
{ 30, {"Exchange of Air Situation Pictures", ""} },
{ 31, {"Sensors Information messages (transmission of surveillance biases to users)", ""} },
{ 32, {"Information provided by users to ARTAS", ""} },
{ 33, {"ADS-B Messages (Assigned for use by FAA)", ""} },
{ 34, {"Monoradar Service Messages (Part 2b - next version of Cat 002)", ""} },
{ 48, {"Monoradar Target Reports (Part 4 - next version of Cat 001)", ""} },
{ 61, {"SDPS Session and Service Control Messages", ""} },
{ 62, {"System Track Data (Part 9)", ""} },
{ 63, {"Sensor Status Messages", ""} },
{ 65, {"SDPS Service Status Messages", ""} },
{128, {"Exchange of C3I messages", ""} },
{150, {"Flight Data Messages", ""} },
{151, {"Association Messages", ""} },
{152, {"Time Stamp Messages", ""} },
{153, {"Special Purpose Messages", ""} },
{204, {"Recognised Air Picture", ""} },
{221, {"Replaced by CAT024", ""} },
{239, {"Foreign Object Debris (FOD)", ""} },
{240, {"Radar Video Transmission", ""} },
{247, {"Version Number Exchange", ""} },
};
SpecificationSelectDialog::SpecificationSelectDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SpecificationSelectDialog)
{
m_scrollWidget = 0;
ui->setupUi(this);
populateTable();
}
SpecificationSelectDialog::~SpecificationSelectDialog()
{
delete ui;
}
void SpecificationSelectDialog::populateTable()
{
if (!g_uap)
return;
ui->scrollArea->takeWidget();
delete m_scrollWidget;
m_radioButtonGroups.clear();
m_radioButtonCategories.clear();
m_scrollWidget = new QWidget;
ui->scrollArea->setWidget(m_scrollWidget);
m_scrollWidget->setLayout(new QVBoxLayout);
foreach (int cat, g_uap->m_categories.uniqueKeys())
{
QFrame* frame = new QFrame;
m_scrollWidget->layout()->addWidget(frame);
frame->setFrameStyle(QFrame::Box | QFrame::Plain);
QVBoxLayout* vbox1 = new QVBoxLayout;
frame->setLayout(vbox1);
QLabel* label = new QLabel(QString::number(cat));
vbox1->addWidget(label);
QFont font(label->font());
font.setBold(true);
label->setFont(font);
if (categoryHeader.count(cat))
{
label->setText(QString("Cat %1: ").arg(cat) + categoryHeader[cat].title);
}
QVBoxLayout* vbox2 = new QVBoxLayout;
vbox1->addLayout(vbox2);
vbox2->setContentsMargins(8, 4, 0, 4);
vbox2->setSpacing(8);
m_radioButtonGroups.insert(cat, new QButtonGroup(m_scrollWidget));
// iterate over defined UapCategory for current cat
foreach (const UapCategory* uapCat, g_uap->m_categories.values(cat))
{
QRadioButton* button = new QRadioButton(uapCat->m_version + "\n" + uapCat->m_sourceFile);
vbox2->addWidget(button);
m_radioButtonCategories.insert(button, uapCat);
m_radioButtonGroups[cat]->addButton(button);
// if current UapCategory is selected for usage check button
if (uapCat == g_uap->selectedUapCategory(cat))
{
button->setChecked(true);
}
}
if (m_radioButtonGroups[cat]->checkedButton() == nullptr)
{
m_radioButtonGroups[cat]->buttons().first()->setChecked(true);
}
}
m_scrollWidget->setStyleSheet("* {background:" + palette().color(QPalette::Base).name() + "}"); // set base color (usualy white) as background color
}
void SpecificationSelectDialog::accept()
{
foreach (const QButtonGroup* group, m_radioButtonGroups)
{
Q_ASSERT(group->checkedButton());
g_uap->selectUapCategory(m_radioButtonCategories[group->checkedButton()]);
}
QDialog::accept();
}