Commit e4dfd0ee authored by lm's avatar lm

Added checkbox to enable / disable all curves at once

parent d4f5cb86
...@@ -107,7 +107,9 @@ updateTimer(new QTimer()) ...@@ -107,7 +107,9 @@ updateTimer(new QTimer())
int labelRow = curvesWidgetLayout->rowCount(); int labelRow = curvesWidgetLayout->rowCount();
curvesWidgetLayout->addWidget(new QLabel(tr("On")), labelRow, 0, 1, 2); selectAllCheckBox = new QCheckBox("", this);
connect(selectAllCheckBox, SIGNAL(clicked(bool)), this, SLOT(selectAllCurves(bool)));
curvesWidgetLayout->addWidget(selectAllCheckBox, labelRow, 0, 1, 2);
label = new QLabel(this); label = new QLabel(this);
label->setText("Name"); label->setText("Name");
...@@ -153,6 +155,15 @@ LinechartWidget::~LinechartWidget() ...@@ -153,6 +155,15 @@ LinechartWidget::~LinechartWidget()
listedCurves = NULL; listedCurves = NULL;
} }
void LinechartWidget::selectAllCurves(bool all)
{
QMap<QString, QLabel*>::iterator i;
for (i = curveLabels->begin(); i != curveLabels->end(); ++i)
{
activePlot->setVisible(i.key(), all);
}
}
void LinechartWidget::writeSettings() void LinechartWidget::writeSettings()
{ {
QSettings settings; QSettings settings;
...@@ -299,7 +310,7 @@ void LinechartWidget::appendData(int uasId, QString curve, double value, quint64 ...@@ -299,7 +310,7 @@ void LinechartWidget::appendData(int uasId, QString curve, double value, quint64
// Log data // Log data
if (logging) if (logging)
{ {
if (activePlot->isVisible(curve)) if (activePlot->isVisible(curve+unit))
{ {
if (logStartTime == 0) logStartTime = usec; if (logStartTime == 0) logStartTime = usec;
qint64 time = usec - logStartTime; qint64 time = usec - logStartTime;
...@@ -660,6 +671,7 @@ void LinechartWidget::addCurve(const QString& curve, const QString& unit) ...@@ -660,6 +671,7 @@ void LinechartWidget::addCurve(const QString& curve, const QString& unit)
// TODO // TODO
// Connect actions // Connect actions
connect(selectAllCheckBox, SIGNAL(clicked(bool)), checkBox, SLOT(setChecked(bool)));
QObject::connect(checkBox, SIGNAL(clicked(bool)), this, SLOT(takeButtonClick(bool))); QObject::connect(checkBox, SIGNAL(clicked(bool)), this, SLOT(takeButtonClick(bool)));
QObject::connect(this, SIGNAL(curveVisible(QString, bool)), plot, SLOT(setVisible(QString, bool))); QObject::connect(this, SIGNAL(curveVisible(QString, bool)), plot, SLOT(setVisible(QString, bool)));
......
...@@ -99,6 +99,8 @@ public slots: ...@@ -99,6 +99,8 @@ public slots:
void writeSettings(); void writeSettings();
/** @brief Read the current configuration from disk */ /** @brief Read the current configuration from disk */
void readSettings(); void readSettings();
/** @brief Select all curves */
void selectAllCurves(bool all);
protected: protected:
void addCurveToList(QString curve); void addCurveToList(QString curve);
...@@ -145,6 +147,7 @@ protected: ...@@ -145,6 +147,7 @@ protected:
quint64 logStartTime; quint64 logStartTime;
QTimer* updateTimer; QTimer* updateTimer;
LogCompressor* compressor; LogCompressor* compressor;
QCheckBox* selectAllCheckBox;
static const int updateInterval = 400; ///< Time between number updates, in milliseconds static const int updateInterval = 400; ///< Time between number updates, in milliseconds
static const int MAX_CURVE_MENUITEM_NUMBER = 8; static const int MAX_CURVE_MENUITEM_NUMBER = 8;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment