LP-56 - Better txpid option namings, fix tabs-spaces, tooltips. headers, variable...
[librepilot.git] / ground / openpilotgcs / src / plugins / coreplugin / outputpane.h
blobf02104fcb75a9f0bb8e7bda283ad23b46e7feb4f
1 /**
2 ******************************************************************************
4 * @file outputpane.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 OUTPUTPANE_H
30 #define OUTPUTPANE_H
32 #include "core_global.h"
34 #include <QtCore/QMap>
35 #include <QWidget>
37 QT_BEGIN_NAMESPACE
38 class QAction;
39 class QComboBox;
40 class QToolButton;
41 class QStackedWidget;
42 class QPushButton;
43 QT_END_NAMESPACE
45 namespace Core {
46 class IMode;
47 class IOutputPane;
49 namespace Internal {
50 class OutputPaneManager;
51 class MainWindow;
55 class CORE_EXPORT OutputPanePlaceHolder : public QWidget {
56 friend class Core::Internal::OutputPaneManager; // needs to set m_visible and thus access m_current
57 Q_OBJECT
58 public:
59 OutputPanePlaceHolder(Core::IMode *mode, QWidget *parent = 0);
60 ~OutputPanePlaceHolder();
61 void setCloseable(bool b);
62 bool closeable();
63 static OutputPanePlaceHolder *getCurrent()
65 return m_current;
68 private slots:
69 void currentModeChanged(Core::IMode *);
70 private:
71 Core::IMode *m_mode;
72 bool m_closeable;
73 static OutputPanePlaceHolder *m_current;
76 namespace Internal {
77 class OutputPaneManager : public QWidget {
78 Q_OBJECT
80 public:
81 void init();
82 static OutputPaneManager *instance();
83 void setCloseable(bool b);
84 bool closeable();
85 QWidget *buttonsWidget();
86 void updateStatusButtons(bool visible);
88 public slots:
89 void slotHide();
90 void slotNext();
91 void slotPrev();
92 void shortcutTriggered();
94 protected:
95 void focusInEvent(QFocusEvent *e);
97 private slots:
98 void changePage();
99 void showPage(bool focus);
100 void togglePage(bool focus);
101 void clearPage();
102 void updateToolTip();
103 void buttonTriggered();
104 void updateNavigateState();
106 private:
107 // the only class that is allowed to create and destroy
108 friend class MainWindow;
110 static void create();
111 static void destroy();
113 OutputPaneManager(QWidget *parent = 0);
114 ~OutputPaneManager();
116 void showPage(int idx, bool focus);
117 void ensurePageVisible(int idx);
118 int findIndexForPage(IOutputPane *out);
119 QComboBox *m_widgetComboBox;
120 QToolButton *m_clearButton;
121 QToolButton *m_closeButton;
123 QAction *m_nextAction;
124 QAction *m_prevAction;
125 QToolButton *m_prevToolButton;
126 QToolButton *m_nextToolButton;
127 QWidget *m_toolBar;
129 QMap<int, Core::IOutputPane *> m_pageMap;
130 int m_lastIndex;
132 QStackedWidget *m_outputWidgetPane;
133 QStackedWidget *m_opToolBarWidgets;
134 QWidget *m_buttonsWidget;
135 QMap<int, QPushButton *> m_buttons;
136 QMap<QAction *, int> m_actions;
138 } // namespace Internal
139 } // namespace Core
141 #endif // OUTPUTPANE_H