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())
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->setText("Name");
......@@ -153,6 +155,15 @@ LinechartWidget::~LinechartWidget()
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()
{
QSettings settings;
......@@ -299,7 +310,7 @@ void LinechartWidget::appendData(int uasId, QString curve, double value, quint64
// Log data
if (logging)
{
if (activePlot->isVisible(curve))
if (activePlot->isVisible(curve+unit))
{
if (logStartTime == 0) logStartTime = usec;
qint64 time = usec - logStartTime;
......@@ -660,6 +671,7 @@ void LinechartWidget::addCurve(const QString& curve, const QString& unit)
// TODO
// Connect actions
connect(selectAllCheckBox, SIGNAL(clicked(bool)), checkBox, SLOT(setChecked(bool)));
QObject::connect(checkBox, SIGNAL(clicked(bool)), this, SLOT(takeButtonClick(bool)));
QObject::connect(this, SIGNAL(curveVisible(QString, bool)), plot, SLOT(setVisible(QString, bool)));
......
......@@ -99,6 +99,8 @@ public slots:
void writeSettings();
/** @brief Read the current configuration from disk */
void readSettings();
/** @brief Select all curves */
void selectAllCurves(bool all);
protected:
void addCurveToList(QString curve);
......@@ -145,6 +147,7 @@ protected:
quint64 logStartTime;
QTimer* updateTimer;
LogCompressor* compressor;
QCheckBox* selectAllCheckBox;
static const int updateInterval = 400; ///< Time between number updates, in milliseconds
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