dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
serialpluginconfiguration.cpp
Go to the documentation of this file.
1 
14 /*
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful, but
21  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  * for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, see <http://www.gnu.org/licenses/>
27  *
28  * Additional note on redistribution: The copyright and license notices above
29  * must be maintained in each individual source file that is a derivative work
30  * of this source file; otherwise redistribution is prohibited.
31  */
32 
34 #include "utils/pathutils.h"
35 #include <coreplugin/icore.h>
36 
41 SerialPluginConfiguration::SerialPluginConfiguration(QString classId, QSettings *qSettings,
42  QObject *parent)
43  : IUAVGadgetConfiguration(classId, parent)
44  , m_speed("115200")
45  , m_reconnect(true)
46 {
47  Q_UNUSED(qSettings);
48 
49  settings = Core::ICore::instance()->settings();
50 }
51 
56 IUAVGadgetConfiguration *SerialPluginConfiguration::clone()
57 {
59  m->m_speed = m_speed;
60  m->m_reconnect = m_reconnect;
61  return m;
62 }
63 
68 void SerialPluginConfiguration::saveConfig(QSettings *settings) const
69 {
70  settings->setValue("speed", m_speed);
71 }
73 {
74  settings->beginGroup(QLatin1String("SerialConn"));
75  QString str = (settings->value(QLatin1String("speed"), tr("")).toString());
76  if (str.isEmpty())
77  m_speed = "115200";
78  else
79  m_speed = str;
80  m_reconnect = settings->value(QLatin1String("reconnect"), tr("")).toBool();
81  settings->endGroup();
82 }
84 {
85  settings->beginGroup(QLatin1String("SerialConn"));
86  settings->setValue(QLatin1String("speed"), m_speed);
87  settings->setValue(QLatin1String("reconnect"), m_reconnect);
88  settings->endGroup();
89 }
91 {
92 }
static ICore * instance()
Definition: coreimpl.cpp:46
virtual QSettings * settings(QSettings::Scope scope=QSettings::UserScope) const =0
Returns the application's main settings object.
IUAVGadgetConfiguration * clone()
SerialPluginConfiguration(QString classId, QSettings *qSettings=nullptr, QObject *parent=nullptr)