From 9e16e8f6a9025099a6f7741f8d67301448f0ad3e Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Thu, 30 Jan 2014 21:54:05 +0100 Subject: [PATCH] OP-1194 minor cleanups to scope gadget state persistence handling --- .../plugins/coreplugin/uavgadgetdecorator.cpp | 2 +- .../openpilotgcs/src/plugins/scope/scope.pro | 36 +++++++++++-------- .../src/plugins/scope/scopegadgetwidget.cpp | 5 ++- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/coreplugin/uavgadgetdecorator.cpp b/ground/openpilotgcs/src/plugins/coreplugin/uavgadgetdecorator.cpp index 86536d988..e9111c1b4 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/uavgadgetdecorator.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/uavgadgetdecorator.cpp @@ -138,7 +138,7 @@ void UAVGadgetDecorator::restoreState(QSettings *qSettings) break; } } - // store gadget individual state + // restore gadget individual state qSettings->beginGroup("state"); m_gadget->restoreState(qSettings); qSettings->endGroup(); diff --git a/ground/openpilotgcs/src/plugins/scope/scope.pro b/ground/openpilotgcs/src/plugins/scope/scope.pro index 7fef56df4..b95e23e6c 100644 --- a/ground/openpilotgcs/src/plugins/scope/scope.pro +++ b/ground/openpilotgcs/src/plugins/scope/scope.pro @@ -1,22 +1,30 @@ TEMPLATE = lib TARGET = ScopeGadget + DEFINES += SCOPE_LIBRARY + include(../../openpilotgcsplugin.pri) include (scope_dependencies.pri) -HEADERS += scopeplugin.h \ + +HEADERS += \ + scopeplugin.h \ plotdata.h \ - scope_global.h -HEADERS += scopegadgetoptionspage.h -HEADERS += scopegadgetconfiguration.h -HEADERS += scopegadget.h -HEADERS += scopegadgetwidget.h -HEADERS += scopegadgetfactory.h -SOURCES += scopeplugin.cpp \ - plotdata.cpp -SOURCES += scopegadgetoptionspage.cpp -SOURCES += scopegadgetconfiguration.cpp -SOURCES += scopegadget.cpp -SOURCES += scopegadgetfactory.cpp -SOURCES += scopegadgetwidget.cpp + scope_global.h \ + scopegadgetoptionspage.h \ + scopegadgetconfiguration.h \ + scopegadget.h \ + scopegadgetwidget.h \ + scopegadgetfactory.h + +SOURCES += \ + scopeplugin.cpp \ + plotdata.cpp \ + scopegadgetoptionspage.cpp \ + scopegadgetconfiguration.cpp \ + scopegadget.cpp \ + scopegadgetfactory.cpp \ + scopegadgetwidget.cpp + OTHER_FILES += ScopeGadget.pluginspec + FORMS += scopegadgetoptionspage.ui diff --git a/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp b/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp index 1b4798dbf..733068f0f 100644 --- a/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/scope/scopegadgetwidget.cpp @@ -520,7 +520,10 @@ void ScopeGadgetWidget::saveState(QSettings *qSettings) int i = 1; foreach(PlotData * plotData, m_curvesData.values()) { - qSettings->setValue(QString("plot%1").arg(i), plotData->curve->isVisible()); + bool plotVisible = plotData->curve->isVisible(); + if (!plotVisible) { + qSettings->setValue(QString("plot%1").arg(i), plotVisible); + } i++; } // legend state