LP-419 cleanup QSettings usage throughout GCS
[librepilot.git] / ground / gcs / src / plugins / coreplugin / iuavgadgetfactory.h
blob457fe95a68f817ecc64d436d0951ac13703cacef
1 /**
2 ******************************************************************************
4 * @file iuavgadgetfactory.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
7 * @addtogroup GCSPlugins GCS Plugins
8 * @{
9 * @addtogroup CorePlugin Core Plugin
10 * @{
11 * @brief The Core GCS plugin
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef IUAVGADGETFACTORY_H
30 #define IUAVGADGETFACTORY_H
32 #include "core_global.h"
34 #include "uavconfiginfo.h"
36 #include <QObject>
37 #include <QIcon>
39 QT_BEGIN_NAMESPACE
40 class QStringList;
41 class QSettings;
42 QT_END_NAMESPACE
44 namespace Core {
45 class IUAVGadget;
46 class IUAVGadgetConfiguration;
47 class IOptionsPage;
49 class CORE_EXPORT IUAVGadgetFactory : public QObject {
50 Q_OBJECT
51 public:
52 IUAVGadgetFactory(QString classId, QString name, QObject *parent = 0) :
53 QObject(parent),
54 m_classId(classId),
55 m_name(name),
56 m_icon(QIcon()),
57 m_singleConfigurationGadget(false) {}
58 virtual ~IUAVGadgetFactory() {}
60 virtual IUAVGadget *createGadget(QWidget *parent) = 0;
61 virtual IUAVGadgetConfiguration *createConfiguration(QSettings &)
63 return 0;
65 virtual IUAVGadgetConfiguration *createConfiguration(QSettings &settings, UAVConfigInfo *)
67 return createConfiguration(settings);
69 virtual IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *)
71 return 0;
73 QString classId() const
75 return m_classId;
77 QString name() const
79 return m_name;
81 QIcon icon() const
83 return m_icon;
85 bool isSingleConfigurationGadget()
87 return m_singleConfigurationGadget;
89 protected:
90 void setIcon(QIcon icon)
92 m_icon = icon;
94 void setSingleConfigurationGadgetTrue()
96 m_singleConfigurationGadget = true;
98 private:
99 QString m_classId; // unique class id
100 QString m_name; // display name, should also be unique
101 QIcon m_icon;
102 bool m_singleConfigurationGadget; // true if there is exactly one configuration for this gadget
104 } // namespace Core
106 #endif // IUAVGADGETFACTORY_H