-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDlgLiveCapture.cpp
118 lines (65 loc) · 2.72 KB
/
DlgLiveCapture.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
// DlgLiveCapture.cpp
// Implements the DlgLiveCapture class representing the dialog that is shown while the liva capture is in progress
#include "Globals.h"
#include "DlgLiveCapture.h"
#include <QMessageBox>
#include "ui_DlgLiveCapture.h"
#include "LiveCapture.h"
DlgLiveCapture::DlgLiveCapture(QWidget * a_Parent):
Super(a_Parent),
m_UI(new Ui::DlgLiveCapture)
{
m_UI->setupUi(this);
}
void DlgLiveCapture::show(LiveCapture & a_LiveCapture, LiveCaptureSettings & a_Settings)
{
m_LiveCapture = &a_LiveCapture;
m_Settings = &a_Settings;
connect(m_LiveCapture, SIGNAL(logEvent(QString)), this, SLOT(captureLogEvent(QString)));
connect(m_LiveCapture, SIGNAL(error(QString)), this, SLOT(captureError(QString)));
connect(m_LiveCapture, SIGNAL(timerTick(int)), this, SLOT(captureTimerTick(int)));
connect(m_LiveCapture, SIGNAL(snapshotRecorded(QString)), this, SLOT(captureSnapshotRecorded(QString)));
connect(m_LiveCapture, SIGNAL(snapshotParsed(QString, SnapshotPtr)), this, SLOT(captureSnapshotParsed(QString, SnapshotPtr)));
connect(m_LiveCapture, SIGNAL(snapshotAdded(QString, SnapshotPtr)), this, SLOT(captureSnapshotAdded(QString, SnapshotPtr)));
m_UI->pbSecondsTillNext->setMaximum(a_Settings.m_CaptureIntervalSec);
Super::show();
a_LiveCapture.start();
Super::exec();
a_LiveCapture.stop();
}
void DlgLiveCapture::captureLogEvent(const QString & a_Message)
{
m_UI->txtLog->appendPlainText(a_Message + "\n");
}
void DlgLiveCapture::captureError(const QString & a_ErrorMessage)
{
m_UI->txtLog->appendPlainText(tr("ERROR: %1\n").arg(a_ErrorMessage));
m_UI->txtLog->appendPlainText(tr("Capture terminated."));
m_LiveCapture->stop();
// Display the error to the user:
QMessageBox::warning(
this,
tr("Live Capture error"),
tr("Error occured while capturing live data: %1. The capture terminated").arg(a_ErrorMessage)
);
// Change the "Stop capturing" button into a "Close" button:
m_UI->bClose->setText(tr("&Close"));
}
void DlgLiveCapture::captureTimerTick(int a_SecondsLeft)
{
m_UI->pbSecondsTillNext->setValue(a_SecondsLeft);
}
void DlgLiveCapture::captureSnapshotRecorded(const QString & a_FileName)
{
m_UI->txtLog->appendPlainText(tr("Captured a snapshot into file %1").arg(a_FileName));
}
void DlgLiveCapture::captureSnapshotParsed(const QString & a_FileName, SnapshotPtr a_Snapshot)
{
Q_UNUSED(a_Snapshot);
m_UI->txtLog->appendPlainText(tr("Parsed a snapshot from file %1").arg(a_FileName));
}
void DlgLiveCapture::captureSnapshotAdded(const QString & a_FileName, SnapshotPtr a_Snapshot)
{
Q_UNUSED(a_Snapshot);
m_UI->txtLog->appendPlainText(tr("Added a snapshot from file %1 into the project").arg(a_FileName));
}