dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
modelviewgadgetconfiguration.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 
30 ModelViewGadgetConfiguration::ModelViewGadgetConfiguration(QString classId, QSettings *qSettings,
31  QObject *parent)
32  : IUAVGadgetConfiguration(classId, parent)
33  , m_acFilename("../share/models/multi/test_quad/test_quad_X.3ds")
34  , m_bgFilename("")
35  , m_enableVbo(false)
36 {
37  // if a saved configuration exists load it
38  if (qSettings != nullptr) {
39  QString modelFile = qSettings->value("acFilename").toString();
40  QString bgFile = qSettings->value("bgFilename").toString();
41  m_enableVbo = qSettings->value("enableVbo").toBool();
42  m_acFilename = Utils::PathUtils().InsertDataPath(modelFile);
43  m_bgFilename = Utils::PathUtils().InsertDataPath(bgFile);
44  }
45 }
46 
47 IUAVGadgetConfiguration *ModelViewGadgetConfiguration::clone()
48 {
50 
51  mv->m_acFilename = m_acFilename;
52  mv->m_bgFilename = m_bgFilename;
53  mv->m_enableVbo = m_enableVbo;
54  return mv;
55 }
56 
61 void ModelViewGadgetConfiguration::saveConfig(QSettings *qSettings) const
62 {
63  qSettings->setValue("acFilename", Utils::PathUtils().RemoveDataPath(m_acFilename));
64  qSettings->setValue("bgFilename", Utils::PathUtils().RemoveDataPath(m_bgFilename));
65  qSettings->setValue("enableVbo", m_enableVbo);
66 }
ModelViewGadgetConfiguration(QString classId, QSettings *qSettings=nullptr, QObject *parent=nullptr)
static QString InsertDataPath(QString path)
Definition: pathutils.cpp:84