2 ******************************************************************************
4 * @file modelviewgadgetconfiguration.cpp
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * @addtogroup GCSPlugins GCS Plugins
8 * @addtogroup ModelViewPlugin ModelView Plugin
10 * @brief A gadget that displays a 3D representation of the UAV
11 *****************************************************************************/
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.
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
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "modelviewgadgetconfiguration.h"
29 #include "utils/pathutils.h"
31 ModelViewGadgetConfiguration::ModelViewGadgetConfiguration(QString classId
, QSettings
*qSettings
, QObject
*parent
) :
32 IUAVGadgetConfiguration(classId
, parent
),
33 m_acFilename("../share/openpilotgcs/models/planes/Easystar/EasyStar.3ds"),
37 // if a saved configuration exists load it
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
);
47 IUAVGadgetConfiguration
*ModelViewGadgetConfiguration::clone()
49 ModelViewGadgetConfiguration
*mv
= new ModelViewGadgetConfiguration(this->classId());
51 mv
->m_acFilename
= m_acFilename
;
52 mv
->m_bgFilename
= m_bgFilename
;
53 mv
->m_enableVbo
= m_enableVbo
;
58 * Saves a configuration.
61 void ModelViewGadgetConfiguration::saveConfig(QSettings
*qSettings
) const
63 qSettings
->setValue("acFilename", Utils::PathUtils().RemoveDataPath(m_acFilename
));
64 qSettings
->setValue("bgFilename", Utils::PathUtils().RemoveDataPath(m_bgFilename
));
65 qSettings
->setValue("enableVbo", m_enableVbo
);