LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / libs / utils / fancymainwindow.h
blob23c4b00c684ca8a5c24e5c7d8ddc99286bf2917a
1 /**
2 ******************************************************************************
4 * @file fancymainwindow.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 * @brief
8 * @see The GNU Public License (GPL) Version 3
9 * @defgroup
10 * @{
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 FANCYMAINWINDOW_H
30 #define FANCYMAINWINDOW_H
32 #include "utils_global.h"
34 #include <QMainWindow>
36 QT_BEGIN_NAMESPACE
37 class QSettings;
38 QT_END_NAMESPACE
40 namespace Utils {
41 struct FancyMainWindowPrivate;
43 class QTCREATOR_UTILS_EXPORT FancyMainWindow : public QMainWindow {
44 Q_OBJECT
46 public:
47 explicit FancyMainWindow(QWidget *parent = 0);
48 virtual ~FancyMainWindow();
50 /* The widget passed in should have an objectname set
51 * which will then be used as key for QSettings. */
52 QDockWidget *addDockForWidget(QWidget *widget);
53 QList<QDockWidget *> dockWidgets() const;
55 void setTrackingEnabled(bool enabled);
56 bool isLocked() const;
58 void saveSettings(QSettings *settings) const;
59 void restoreSettings(const QSettings *settings);
60 QHash<QString, QVariant> saveSettings() const;
61 void restoreSettings(const QHash<QString, QVariant> &settings);
63 // Additional context menu actions
64 QAction *menuSeparator1() const;
65 QAction *toggleLockedAction() const;
66 QAction *menuSeparator2() const;
67 QAction *resetLayoutAction() const;
69 // Overwritten to add locked/reset.
70 virtual QMenu *createPopupMenu();
73 QDockWidget *toolBarDockWidget() const;
74 void setToolBarDockWidget(QDockWidget *dock);
76 signals:
77 // Emitted by resetLayoutAction(). Connect to a slot
78 // restoring the default layout.
79 void resetLayout();
81 public slots:
82 void setLocked(bool locked);
83 void setDockActionsVisible(bool v);
85 protected:
86 void hideEvent(QHideEvent *event);
87 void showEvent(QShowEvent *event);
88 void contextMenuEvent(QContextMenuEvent *event);
89 private slots:
90 void onDockActionTriggered();
91 void onDockVisibilityChange(bool);
92 void onTopLevelChanged();
94 private:
95 void updateDockWidget(QDockWidget *dockWidget);
96 void handleVisibilityChanged(bool visible);
98 FancyMainWindowPrivate *d;
100 } // namespace Utils
102 #endif // FANCYMAINWINDOW_H