# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2016-08-28 16:08:47 # Node ID 2f04c80c72e384266f12c2fbc1c829a59f12365b # Parent 9bdc741a9793690abb8aeba4960d303649fd4ed3 implemented PlotManager::flashSnapshotOverlay diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -133,7 +133,7 @@ MainWindow::MainWindow(QWidget *parent) this, SLOT(clearPlot())); QObject::connect(snapshotMan.takeSnapshotAction(), &QAction::triggered, - ui->plot, &Plot::flashSnapshotOverlay); + plotMan, &PlotManager::flashSnapshotOverlay); // init port signals QObject::connect(&(this->serialPort), SIGNAL(error(QSerialPort::SerialPortError)), diff --git a/src/plot.cpp b/src/plot.cpp --- a/src/plot.cpp +++ b/src/plot.cpp @@ -181,14 +181,12 @@ QColor Plot::makeColor(unsigned int chan } } -void Plot::flashSnapshotOverlay() +void Plot::flashSnapshotOverlay(bool light) { if (snapshotOverlay != NULL) delete snapshotOverlay; QColor color; - // TODO: fix snapshot overlay - // if (darkBackgroundAction.isChecked()) - if(1) + if(light) { color = QColor(Qt::white); } diff --git a/src/plot.h b/src/plot.h --- a/src/plot.h +++ b/src/plot.h @@ -64,7 +64,12 @@ public slots: void darkBackground(bool enabled = true); void setAxis(bool autoScaled, double yMin = 0, double yMax = 1); - void flashSnapshotOverlay(); + /** + * Displays an animation for snapshot. + * + * @param light show a light colored (white) animation or the opposite + */ + void flashSnapshotOverlay(bool light); private slots: void unzoomed(); diff --git a/src/plotmanager.cpp b/src/plotmanager.cpp --- a/src/plotmanager.cpp +++ b/src/plotmanager.cpp @@ -328,3 +328,11 @@ void PlotManager::setAxis(bool autoScale plot->setAxis(autoScaled, yAxisMin, yAxisMax); } } + +void PlotManager::flashSnapshotOverlay() +{ + for (auto plot : plotWidgets) + { + plot->flashSnapshotOverlay(darkBackgroundAction.isChecked()); + } +} diff --git a/src/plotmanager.h b/src/plotmanager.h --- a/src/plotmanager.h +++ b/src/plotmanager.h @@ -63,6 +63,8 @@ public slots: void showDemoIndicator(bool show = true); /// Set the Y axis void setAxis(bool autoScaled, double yMin = 0, double yMax = 1); + /// Display an animation for snapshot + void flashSnapshotOverlay(); private: bool isMulti;