dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
uavgadgetmanager.h
Go to the documentation of this file.
1 
13 /*
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.
18  *
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.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, see <http://www.gnu.org/licenses/>
26  */
27 
28 #ifndef UAVGADGETMANAGER_H
29 #define UAVGADGETMANAGER_H
30 
31 #include "../core_global.h"
32 
34 #include <coreplugin/imode.h>
35 
36 #include <QWidget>
37 #include <QtCore/QList>
38 #include <QtCore/QPointer>
39 #include <QtCore/QSettings>
40 #include <QIcon>
41 
42 QT_BEGIN_NAMESPACE
43 class QModelIndex;
44 QT_END_NAMESPACE
45 
46 namespace Core {
47 
48 class IContext;
49 class ICore;
50 class IUAVGadget;
51 
52 namespace Internal {
53 
54  class UAVGadgetView;
55  class SplitterOrView;
56 
57 } // namespace Internal
58 
59 class CORE_EXPORT UAVGadgetManager : public IMode
60 {
61  Q_OBJECT
62 
63 public:
64  explicit UAVGadgetManager(ICore *core, QString name, QIcon icon, int priority,
65  QString uniqueName, QWidget *parent);
66  virtual ~UAVGadgetManager();
67 
68  // IMode
69  QString name() const { return m_name; }
70  QIcon icon() const { return m_icon; }
71  int priority() const { return m_priority; }
72  void setPriority(int priority) { m_priority = priority; }
73  const char *uniqueModeName() const { return m_uniqueModeName; }
74  QList<int> context() const;
75 
76  void init();
77  QWidget *widget() { return m_widget; }
78 
79  void ensureUAVGadgetManagerVisible();
80 
81  IUAVGadget *currentGadget() const;
82 
83  void saveState(QSettings *) const;
84  bool restoreState(QSettings *qSettings);
85 
86  void saveSettings(QSettings *qs);
87  void readSettings(QSettings *qs);
88  bool toolbarsShown() { return m_showToolbars; }
89 
90 signals:
91  void currentGadgetChanged(IUAVGadget *gadget);
92  void showUavGadgetMenus(bool show, bool hasSplitter);
93  void updateSplitMenus(bool hasSplitter);
94 
95 private slots:
96  void handleContextChange(Core::IContext *context);
97  void updateUavGadgetMenus();
98  void modeChanged(Core::IMode *mode);
99 
100 public slots:
101  void split(Qt::Orientation orientation);
102  void split();
103  void splitSideBySide();
104  void removeCurrentSplit();
105  void removeAllSplits();
106  void gotoOtherSplit();
107  void showToolbars(bool show);
108 
109 private:
110  void setCurrentGadget(IUAVGadget *gadget);
111  void addGadgetToContext(IUAVGadget *gadget);
112  void removeGadget(IUAVGadget *gadget);
113  void closeView(Core::Internal::UAVGadgetView *view);
114  void emptyView(Core::Internal::UAVGadgetView *view);
115  Core::Internal::SplitterOrView *currentSplitterOrView() const;
116 
117  bool m_showToolbars;
118  Core::Internal::SplitterOrView *m_splitterOrView;
119  Core::IUAVGadget *m_currentGadget;
120  Core::ICore *m_core;
121 
122  QString m_name;
123  QIcon m_icon;
124  int m_priority;
125  QString m_uniqueName;
126  QByteArray m_uniqueNameBA;
127  const char *m_uniqueModeName;
128  QWidget *m_widget;
129 
132 };
133 
134 } // namespace Core
135 
136 #endif // UAVGADGETMANAGER_H
The ICore class allows access to the different part that make up the basic functionality of the GCS...
Definition: icore.h:58
const char * uniqueModeName() const
QString name() const
void setPriority(int priority)