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.
8 * @see The GNU Public License (GPL) Version 3
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
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>
41 struct FancyMainWindowPrivate
;
43 class QTCREATOR_UTILS_EXPORT FancyMainWindow
: public QMainWindow
{
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
);
77 // Emitted by resetLayoutAction(). Connect to a slot
78 // restoring the default layout.
82 void setLocked(bool locked
);
83 void setDockActionsVisible(bool v
);
86 void hideEvent(QHideEvent
*event
);
87 void showEvent(QShowEvent
*event
);
88 void contextMenuEvent(QContextMenuEvent
*event
);
90 void onDockActionTriggered();
91 void onDockVisibilityChange(bool);
92 void onTopLevelChanged();
95 void updateDockWidget(QDockWidget
*dockWidget
);
96 void handleVisibilityChanged(bool visible
);
98 FancyMainWindowPrivate
*d
;
102 #endif // FANCYMAINWINDOW_H