2009-08-06 16:01:51 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2009-08-06 16:01:51 +02:00
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
2009-08-14 09:30:56 +02:00
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
2009-08-06 16:01:51 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef FANCYMAINWINDOW_H
|
|
|
|
|
#define FANCYMAINWINDOW_H
|
|
|
|
|
|
|
|
|
|
#include "utils_global.h"
|
|
|
|
|
|
|
|
|
|
#include <QtGui/QMainWindow>
|
2009-10-01 16:38:08 +02:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QSettings;
|
|
|
|
|
QT_END_NAMESPACE
|
2009-08-06 16:01:51 +02:00
|
|
|
|
|
|
|
|
namespace Utils {
|
|
|
|
|
|
2010-03-17 17:44:46 +01:00
|
|
|
struct FancyMainWindowPrivate;
|
|
|
|
|
|
2010-04-20 16:46:35 +02:00
|
|
|
// MainWindow with dock widgets and additional "lock" functionality
|
|
|
|
|
// (locking the dock widgets in place) and "reset layout" functionality.
|
|
|
|
|
// The dock actions and the additional actions should be accessible
|
|
|
|
|
// in a Window-menu.
|
2009-08-06 16:01:51 +02:00
|
|
|
class QTCREATOR_UTILS_EXPORT FancyMainWindow : public QMainWindow
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2010-03-17 17:44:46 +01:00
|
|
|
explicit FancyMainWindow(QWidget *parent = 0);
|
|
|
|
|
virtual ~FancyMainWindow();
|
2009-08-06 16:01:51 +02:00
|
|
|
|
2010-04-06 11:23:11 +02:00
|
|
|
/* The widget passed in should have an objectname set
|
|
|
|
|
* which will then be used as key for QSettings. */
|
2009-08-06 16:01:51 +02:00
|
|
|
QDockWidget *addDockForWidget(QWidget *widget);
|
2010-03-17 17:44:46 +01:00
|
|
|
QList<QDockWidget *> dockWidgets() const;
|
2009-08-06 16:01:51 +02:00
|
|
|
|
|
|
|
|
void setTrackingEnabled(bool enabled);
|
2010-03-17 17:44:46 +01:00
|
|
|
bool isLocked() const;
|
2009-08-06 16:01:51 +02:00
|
|
|
|
|
|
|
|
void saveSettings(QSettings *settings) const;
|
2010-04-06 11:23:11 +02:00
|
|
|
void restoreSettings(const QSettings *settings);
|
2009-08-10 13:01:10 +02:00
|
|
|
QHash<QString, QVariant> saveSettings() const;
|
|
|
|
|
void restoreSettings(const QHash<QString, QVariant> &settings);
|
2009-08-06 16:01:51 +02:00
|
|
|
|
2010-04-20 16:46:35 +02:00
|
|
|
// Additional context menu actions
|
|
|
|
|
QAction *menuSeparator1() const;
|
|
|
|
|
QAction *toggleLockedAction() const;
|
|
|
|
|
QAction *menuSeparator2() const;
|
|
|
|
|
QAction *resetLayoutAction() const;
|
|
|
|
|
|
|
|
|
|
// Overwritten to add locked/reset.
|
|
|
|
|
virtual QMenu *createPopupMenu();
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
// Emitted by resetLayoutAction(). Connect to a slot
|
|
|
|
|
// restoring the default layout.
|
|
|
|
|
void resetLayout();
|
|
|
|
|
|
2009-08-06 16:01:51 +02:00
|
|
|
public slots:
|
|
|
|
|
void setLocked(bool locked);
|
2010-04-20 16:46:35 +02:00
|
|
|
void setDockActionsVisible(bool v);
|
2009-08-06 16:01:51 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void hideEvent(QHideEvent *event);
|
|
|
|
|
void showEvent(QShowEvent *event);
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void onDockActionTriggered();
|
|
|
|
|
void onDockVisibilityChange(bool);
|
|
|
|
|
void onTopLevelChanged();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void updateDockWidget(QDockWidget *dockWidget);
|
|
|
|
|
void handleVisibilityChanged(bool visible);
|
|
|
|
|
|
2010-03-17 17:44:46 +01:00
|
|
|
FancyMainWindowPrivate *d;
|
2009-08-06 16:01:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Utils
|
|
|
|
|
|
|
|
|
|
#endif // FANCYMAINWINDOW_H
|