dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
qmlviewgadgetconfiguration.cpp
Go to the documentation of this file.
1 
12 /*
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  * for more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with this program; if not, see <http://www.gnu.org/licenses/>
25  */
26 
28 #include "utils/pathutils.h"
29 
34 QmlViewGadgetConfiguration::QmlViewGadgetConfiguration(QString classId, QSettings *qSettings,
35  QObject *parent)
36  : IUAVGadgetConfiguration(classId, parent)
37  , m_defaultDial("Unknown")
38 {
39  // if a saved configuration exists load it
40  if (qSettings != nullptr) {
41  QString dialFile = qSettings->value("dialFile").toString();
42  m_defaultDial = Utils::PathUtils().InsertDataPath(dialFile);
43  }
44 }
45 
50 IUAVGadgetConfiguration *QmlViewGadgetConfiguration::clone()
51 {
53  m->m_defaultDial = m_defaultDial;
54  return m;
55 }
56 
61 void QmlViewGadgetConfiguration::saveConfig(QSettings *qSettings) const
62 {
63  QString dialFile = Utils::PathUtils().RemoveDataPath(m_defaultDial);
64  qSettings->setValue("dialFile", dialFile);
65 }
QmlViewGadgetConfiguration(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