14 QWidget(parent), plottedPoints(0)
16 d_plots.append(
new Plot(
"Lead I",
this));
17 d_plots.append(
new Plot(
"Lead II",
this));
18 d_plots.append(
new Plot(
"Lead III",
this));
19 d_plots.append(
new Plot(
"Respiration",
this));
21 d_plots[0]->setCurveColor(Qt::red);
22 d_plots[1]->setCurveColor(Qt::blue);
23 d_plots[2]->setCurveColor(Qt::green);
24 d_plots[3]->setCurveColor(Qt::black);
52 QPixmap pixmap = this->grab();
53 pixmap.save(
"screen.png");
60 currentStatusLabel->setText(status);
76 device->
init(1, *stream);
77 connect(device, SIGNAL(sendSampleVector(QVector<QVector<QPointF> >)),
this, SLOT(
plotSampleVector(QVector<QVector<QPointF> >)),Qt::QueuedConnection);
79 stopButton->setEnabled(
true);
80 startButton->setDisabled(
true);
81 currentStatusLabel->setText(
"Recording...");
99 stopButton->setEnabled(
false);
100 currentStatusLabel->setText(
"Stopped!");
102 logger->
save(*stream);
103 startButton->setEnabled(
true);
110 const int sampleSize = sampleVector.length();
111 QPointF last = sampleVector.at(sampleSize-1).at(0);
112 const double elapsedTime = last.x();
114 if (elapsedTime > currentTime+timeInterval)
116 for (
int ii = 0; ii<4; ii++) {
117 d_plots[ii]->IncrementInterval();
118 d_plots[ii]->ClearPlot();
126 for (
int ii = 0; ii < sampleSize; ii++) {
127 for (
int jj = 0; jj<4; jj++) {
128 d_plots[jj]->AppendPoint(sampleVector.at(ii).at(jj));
133 for (
int ii = 0; ii<4; ii++) {
134 d_plots[ii]->DrawCurveSegment(sampleSize);
140 void PlotAndCaptureWidget::setupComponents()
143 currentStatusLabel =
new QLabel(
"Off");
147 channelControlGroup =
new QGroupBox(
"Channel control");
148 channelControlButtonGroup =
new QButtonGroup;
149 leadIButton =
new QRadioButton(
"Lead I");
150 leadIIButton =
new QRadioButton(
"Lead II");
151 leadIIIButton =
new QRadioButton(
"Lead III");
152 respButton =
new QRadioButton(
"Respiration");
153 channelControlButtonGroup->addButton(leadIButton, 1);
154 channelControlButtonGroup->addButton(leadIIButton, 2);
155 channelControlButtonGroup->addButton(leadIIIButton, 3);
156 channelControlButtonGroup->addButton(respButton, 4);
157 leadIButton->setChecked(
true);
161 startButton =
new QPushButton(tr(
"Start ECG capture"));
163 stopButton =
new QPushButton(tr(
"Stop ECG capture"));
164 stopButton->setDisabled(
true);
165 takeScreenshot =
new QPushButton(
"Take screenshot");
168 void PlotAndCaptureWidget::setupActions()
171 connect(takeScreenshot, SIGNAL(clicked()),
this, SLOT(
takeScreen()));
172 connect(startButton, SIGNAL(clicked()),
this, SLOT(
startCapture()));
173 connect(stopButton, SIGNAL(clicked()),
this, SLOT(
stopCapture()));
178 void PlotAndCaptureWidget::setupLayout()
180 QLabel *statusLabel =
new QLabel(
"Status: ");
181 QLabel *xAxisLabel =
new QLabel(
"Time [s]");
182 xAxisLabel->setAlignment(Qt::AlignCenter);
185 QHBoxLayout *channelControlLayout =
new QHBoxLayout;
186 channelControlLayout->addWidget(leadIButton);
187 channelControlLayout->addWidget(leadIIButton);
188 channelControlLayout->addWidget(leadIIIButton);
189 channelControlLayout->addWidget(respButton);
191 channelControlGroup->setLayout(channelControlLayout);
194 QHBoxLayout *statusBarLayout =
new QHBoxLayout;
195 statusBarLayout->addWidget(statusLabel);
196 statusBarLayout->addWidget(currentStatusLabel);
197 statusBarLayout->addStretch();
200 QHBoxLayout *buttonLayout =
new QHBoxLayout;
201 buttonLayout->addWidget(startButton);
202 buttonLayout->addWidget(stopButton);
203 buttonLayout->addWidget(takeScreenshot);
206 QVBoxLayout *mainLayout =
new QVBoxLayout;
207 mainLayout->addLayout(buttonLayout);
208 mainLayout->addLayout(statusBarLayout);
210 for (
int ii = 0; ii<4; ii++) {
211 mainLayout->addWidget(d_plots[ii]);
213 mainLayout->addWidget(xAxisLabel);
214 mainLayout->addWidget(channelControlGroup);
216 setLayout(mainLayout);
Extension of QwtPlot used for plotting data.
void stop()
Stops the running device.
void save(DataStream &input)
Saves the input to a txt-file, header-file and edf-file(if bool saveAsEdf in SettingsSingleton) ...
Abstract Interface that should be used for storing data in the memory.
void init(int, DataStream &)
Prepares a new data-collection,.
Handles which device to connect through the DeviceInterface.
void startCapture()
Starts the initiated device through a call to start()