Browse Source

Added checkbox to enable / disable all curves at once

QGC4.4
lm 14 years ago
parent
commit
e4dfd0ee3b
  1. 16
      src/ui/linechart/LinechartWidget.cc
  2. 3
      src/ui/linechart/LinechartWidget.h

16
src/ui/linechart/LinechartWidget.cc

@ -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()
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
// 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)
// 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)));

3
src/ui/linechart/LinechartWidget.h

@ -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:
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;

Loading…
Cancel
Save