dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
uavobjectbrowserconfiguration.cpp
Go to the documentation of this file.
1 
13 /*
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  * for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, see <http://www.gnu.org/licenses/>
26  */
27 
29 
31  QObject *parent)
32  : IUAVGadgetConfiguration(classId, parent)
33  , m_recentlyUpdatedColor(QColor(255, 230, 230))
34  , m_manuallyChangedColor(QColor(230, 230, 255))
35  , m_notPresentOnHwColor(QColor(170, 170, 170))
36  , m_recentlyUpdatedTimeout(500)
37  , m_onlyHighlightChangedValues(false)
38  , m_useScientificView(false)
39  , m_showMetaData(false)
40  , m_hideNotPresentOnHw(false)
41 {
42  // if a saved configuration exists load it
43  if (qSettings != nullptr) {
44  QColor recent = qSettings->value("recentlyUpdatedColor").value<QColor>();
45  QColor manual = qSettings->value("manuallyChangedColor").value<QColor>();
46  QColor present =
47  qSettings->value("notPresentOnHwColor", QColor(170, 170, 170)).value<QColor>();
48  int timeout = qSettings->value("recentlyUpdatedTimeout").toInt();
49  bool highlight = qSettings->value("onlyHighlightChangedValues").toBool();
50 
51  m_useScientificView = qSettings->value("ScientificView").toBool();
52  m_showMetaData = qSettings->value("showMetaData").toBool();
53  m_hideNotPresentOnHw = qSettings->value("hideNotPresentOnHw", false).toBool();
54  m_recentlyUpdatedColor = recent;
55  m_manuallyChangedColor = manual;
56  m_notPresentOnHwColor = present;
57  m_recentlyUpdatedTimeout = timeout;
58  m_onlyHighlightChangedValues = highlight;
59  }
60 }
61 
62 IUAVGadgetConfiguration *UAVObjectBrowserConfiguration::clone()
63 {
68  m->m_recentlyUpdatedTimeout = m_recentlyUpdatedTimeout;
73  return m;
74 }
75 
80 void UAVObjectBrowserConfiguration::saveConfig(QSettings *qSettings) const
81 {
82  qSettings->setValue("recentlyUpdatedColor", m_recentlyUpdatedColor);
83  qSettings->setValue("manuallyChangedColor", m_manuallyChangedColor);
84  qSettings->setValue("notPresentOnHwColor", m_notPresentOnHwColor);
85  qSettings->setValue("recentlyUpdatedTimeout", m_recentlyUpdatedTimeout);
86  qSettings->setValue("onlyHighlightChangedValues", m_onlyHighlightChangedValues);
87  qSettings->setValue("ScientificView", m_useScientificView);
88  qSettings->setValue("showMetaData", m_showMetaData);
89  qSettings->setValue("hideNotPresentOnHw", m_hideNotPresentOnHw);
90 }
UAVObjectBrowserConfiguration(QString classId, QSettings *qSettings=nullptr, QObject *parent=nullptr)