dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
pfdqmlgadgetconfiguration.cpp
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful, but
8  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
10  * for more details.
11  *
12  * You should have received a copy of the GNU General Public License along
13  * with this program; if not, see <http://www.gnu.org/licenses/>
14  */
15 
17 #include "utils/pathutils.h"
18 
23 PfdQmlGadgetConfiguration::PfdQmlGadgetConfiguration(QString classId, QSettings *qSettings,
24  QObject *parent)
25  : IUAVGadgetConfiguration(classId, parent)
26  , m_qmlFile("Unknown")
27 {
28  // if a saved configuration exists load it
29  if (qSettings != nullptr) {
30  m_qmlFile = qSettings->value("qmlFile").toString();
31  m_qmlFile = Utils::PathUtils().InsertDataPath(m_qmlFile);
32 
33  foreach (const QString &key, qSettings->childKeys()) {
34  m_settings.insert(key, qSettings->value(key));
35  }
36  }
37 }
38 
43 IUAVGadgetConfiguration *PfdQmlGadgetConfiguration::clone()
44 {
46  m->m_qmlFile = m_qmlFile;
47  m->m_settings = m_settings;
48 
49  return m;
50 }
51 
56 void PfdQmlGadgetConfiguration::saveConfig(QSettings *qSettings) const
57 {
58  QString qmlFile = Utils::PathUtils().RemoveDataPath(m_qmlFile);
59  qSettings->setValue("qmlFile", qmlFile);
60 }
PfdQmlGadgetConfiguration(QString classId, QSettings *qSettings=nullptr, QObject *parent=nullptr)
IUAVGadgetConfiguration * clone()
static QString RemoveDataPath(QString path)
Definition: pathutils.cpp:67
static QString InsertDataPath(QString path)
Definition: pathutils.cpp:84