-
Notifications
You must be signed in to change notification settings - Fork 10
/
flightindicators.cpp
115 lines (96 loc) · 2.79 KB
/
flightindicators.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
#include "flightindicators.h"
#include "ui_flightindicators.h"
flightIndicators::flightIndicators(QWidget *parent) :
QWidget(parent),
ui(new Ui::flightIndicators)
{
ui->setupUi(this);
ssm("Setting up.");
clock = new QTimer();
clock->setInterval(1000);
connect(clock, SIGNAL(timeout()), this, SLOT(updateTimeDate()));
clock->start();
alertLabelFont = ui->lastRecLabel->font();
alertLabelFont.setBold(true);
alertLabelFont.setPointSize(alertLabelFont.pointSize()*1.20);
defLabelFont = ui->lastRecLabel->font();
int ledSize = 18;
ui->diskLED->setSizeCustom(ledSize);
ui->imageLED->setSizeCustom(ledSize);
ui->gpsLinkLED->setSizeCustom(ledSize);
ui->gpsTroubleLED->setSizeCustom(ledSize);
ssm("Setup complete.");
}
flightIndicators::~flightIndicators()
{
ssm("Running deconstructor");
delete ui;
}
void flightIndicators::ssm(QString stat)
{
// Send Status Message
// Constructor and deconstructor messages
// will not make it through the signals and slots,
// so, uncomment the next line to see them:
// qDebug() << "[Flight Indicators]: " << stat;
emit statusText("[Flight Indicators]: " + stat);
}
void flightIndicators::updateTimeDate()
{
QDateTime now = QDateTime::currentDateTimeUtc();
QString timeString;
QString dateString;
timeString.append(now.toString("hh:mm:ss"));
ui->utcTimeLabel->setText(timeString);
dateString = now.toString("yyyy-MM-dd");
ui->utcDateLabel->setText(dateString);
}
void flightIndicators::updateLastRec()
{
QDateTime now = QDateTime::currentDateTimeUtc();
QString timeString;
timeString.append(now.toString("hh:mm"));
updateLastRec(timeString);
}
void flightIndicators::updateLastRec(QString hhmm)
{
ui->lastRecLabel->setText(hhmm);
nowRecording = true;
ui->lastRecLabel->setFont(alertLabelFont);
}
void flightIndicators::updateLastIssue(QString message)
{
ui->lastIssueLabel->setText(message);
}
void flightIndicators::doneRecording()
{
nowRecording = false;
ui->lastRecLabel->setFont(defLabelFont);
}
fiUI_t flightIndicators::getElements()
{
fiUI_t e;
e.diskLED = ui->diskLED;
e.imageLED = ui->imageLED;
e.imageLabel = ui->imageLabel;
e.gpsLinkLED = ui->gpsLinkLED;
e.gpsTroubleLED = ui->gpsTroubleLED;
e.clearErrorsBtn = ui->clearErrorsBtn;
e.latLabel = ui->latLabel;
e.longLabel = ui->longLabel;
e.headingLabel = ui->headingLabel;
e.alignmentLabel = ui->alignmentLabel;
e.lastIssueLabel = ui->lastIssueLabel;
e.groundSpeedLabel = ui->groundSpeedLabel;
e.altitudeLabel = ui->altitudeLabel;
e.lastRecLabel = ui->lastRecLabel;
return e;
}
void flightIndicators::debugThis()
{
//ui->latLabel
}
void flightIndicators::on_clearErrorsBtn_clicked()
{
emit clearErrors();
}