dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
uavgadgetview.h
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  */
29 
30 #ifndef UAVGADGETVIEW_H
31 #define UAVGADGETVIEW_H
32 
33 #include <QtCore/QList>
34 #include <QtCore/QString>
35 #include <QtCore/QSettings>
36 #include <QWidget>
37 #include <QAction>
38 #include <QSplitter>
39 #include <QVBoxLayout>
40 #include <QStackedLayout>
41 #include <QtCore/QPointer>
42 
43 QT_BEGIN_NAMESPACE
44 class QComboBox;
45 class QToolButton;
46 class QLabel;
47 class QVBoxLayout;
48 QT_END_NAMESPACE
49 
50 namespace Utils {
51 class StyledBar;
52 }
53 
54 namespace Core {
55 
56 class IUAVGadget;
57 class UAVGadgetManager;
58 
59 namespace Internal {
60 
61  class UAVGadgetView : public QWidget
62  {
63  Q_OBJECT
64 
65  public:
66  UAVGadgetView(UAVGadgetManager *uavGadgetManager, IUAVGadget *uavGadget = nullptr,
67  QWidget *parent = nullptr, bool restoring = false);
68  virtual ~UAVGadgetView();
69  void selectionActivated(int index, bool forceLoadConfiguration);
70  void removeGadget();
71  IUAVGadget *gadget() const;
72  void setGadget(IUAVGadget *uavGadget);
73  bool hasGadget(IUAVGadget *uavGadget) const;
74  int indexOfClassId(QString classId);
75  void showToolbar(bool show);
76 
77  public slots:
78  void closeView();
79  void doReplaceGadget(int index);
80 
81  private slots:
82  void currentGadgetChanged(IUAVGadget *gadget);
83 
84  private:
85  void updateToolBar();
86  QPointer<UAVGadgetManager> m_uavGadgetManager;
87  QPointer<IUAVGadget> m_uavGadget;
88  QWidget *m_toolBar;
89  QComboBox *m_defaultToolBar;
90  QWidget *m_currentToolBar;
91  QWidget *m_activeToolBar;
92  QComboBox *m_uavGadgetList;
93  QToolButton *m_closeButton;
94  Utils::StyledBar *m_top;
95  QVBoxLayout *tl; // top layout
96  int m_defaultIndex;
97  QLabel *m_activeLabel;
98  };
99 }
100 }
101 #endif // UAVGADGETVIEW_H
void doReplaceGadget(int index)
Slot called when the user changes the selected gadget on the view's dropbox.
int indexOfClassId(QString classId)
IUAVGadget * gadget() const
bool hasGadget(IUAVGadget *uavGadget) const
void setGadget(IUAVGadget *uavGadget)
UAVGadgetView(UAVGadgetManager *uavGadgetManager, IUAVGadget *uavGadget=nullptr, QWidget *parent=nullptr, bool restoring=false)
void selectionActivated(int index, bool forceLoadConfiguration)
Function used to select the gadget to show on this view.