2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-12-02 17:43:14 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-12-02 17:43:14 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-12-02 17:43:14 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-12-02 17:43:14 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-12-02 17:43:14 +01:00
|
|
|
|
2013-03-12 11:48:25 +01:00
|
|
|
#ifndef DEBUGGERMAINWINDOW_H
|
|
|
|
|
#define DEBUGGERMAINWINDOW_H
|
2010-12-02 17:43:14 +01:00
|
|
|
|
|
|
|
|
#include "debugger_global.h"
|
2016-02-29 18:15:36 +01:00
|
|
|
|
|
|
|
|
#include <utils/fancymainwindow.h>
|
|
|
|
|
#include <utils/statuslabel.h>
|
|
|
|
|
|
|
|
|
|
#include <QPointer>
|
|
|
|
|
#include <QSet>
|
|
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QComboBox;
|
|
|
|
|
class QStackedWidget;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
namespace Utils {
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
class DEBUGGER_EXPORT Perspective
|
2016-02-29 18:15:36 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2016-03-02 14:39:20 +01:00
|
|
|
enum OperationType { SplitVertical, SplitHorizontal, AddToTab, Raise };
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
class DEBUGGER_EXPORT Operation
|
2016-03-01 07:51:06 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2016-03-02 14:39:20 +01:00
|
|
|
Operation() = default;
|
2016-03-02 13:57:37 +01:00
|
|
|
Operation(const QByteArray &dockId, QWidget *widget,
|
|
|
|
|
const QByteArray &anchorDockId,
|
|
|
|
|
OperationType operationType,
|
|
|
|
|
bool visibleByDefault = true,
|
|
|
|
|
Qt::DockWidgetArea area = Qt::BottomDockWidgetArea);
|
|
|
|
|
|
|
|
|
|
QByteArray dockId;
|
|
|
|
|
QWidget *widget = 0;
|
|
|
|
|
QByteArray anchorDockId;
|
2016-03-02 14:39:20 +01:00
|
|
|
OperationType operationType;
|
2016-02-29 18:15:36 +01:00
|
|
|
bool visibleByDefault;
|
|
|
|
|
Qt::DockWidgetArea area;
|
|
|
|
|
};
|
|
|
|
|
|
2016-03-01 07:51:06 +01:00
|
|
|
Perspective() = default;
|
2016-03-02 13:57:37 +01:00
|
|
|
Perspective(const QString &name, const QVector<Operation> &operations);
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-02 14:39:20 +01:00
|
|
|
void addOperation(const Operation &operation);
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-02 14:39:20 +01:00
|
|
|
QVector<Operation> operations() const { return m_operations; }
|
2016-03-02 13:57:37 +01:00
|
|
|
QVector<QByteArray> docks() const { return m_docks; }
|
|
|
|
|
|
|
|
|
|
QString name() const;
|
|
|
|
|
void setName(const QString &name);
|
2016-02-29 18:15:36 +01:00
|
|
|
|
|
|
|
|
private:
|
2016-03-02 13:57:37 +01:00
|
|
|
QString m_name;
|
|
|
|
|
QVector<QByteArray> m_docks;
|
2016-03-02 14:39:20 +01:00
|
|
|
QVector<Operation> m_operations;
|
2016-02-29 18:15:36 +01:00
|
|
|
};
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
class DEBUGGER_EXPORT ToolbarDescription
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ToolbarDescription() = default;
|
|
|
|
|
ToolbarDescription(const QList<QWidget *> &widgets) : m_widgets(widgets) {}
|
2010-12-02 17:43:14 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
QList<QWidget *> widgets() const;
|
2014-12-12 15:33:16 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
void addAction(QAction *action);
|
|
|
|
|
void addWidget(QWidget *widget);
|
2016-03-01 07:51:06 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
private:
|
|
|
|
|
QList<QWidget *> m_widgets;
|
|
|
|
|
};
|
2010-12-02 17:43:14 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
class DebuggerMainWindow : public FancyMainWindow
|
2016-02-29 18:15:36 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2016-03-02 13:57:37 +01:00
|
|
|
DebuggerMainWindow();
|
|
|
|
|
~DebuggerMainWindow() override;
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
void registerPerspective(const QByteArray &perspectiveId, const Perspective &perspective);
|
|
|
|
|
void registerToolbar(const QByteArray &perspectiveId, QWidget *widget);
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-01 07:51:06 +01:00
|
|
|
void saveCurrentPerspective();
|
|
|
|
|
void resetCurrentPerspective();
|
2016-03-02 13:57:37 +01:00
|
|
|
void restorePerspective(const QByteArray &perspectiveId);
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
void finalizeSetup();
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
void showStatusMessage(const QString &message, int timeoutMS);
|
|
|
|
|
QDockWidget *dockWidget(const QByteArray &dockId) const;
|
|
|
|
|
QByteArray currentPerspective() const { return m_currentPerspectiveId; }
|
2016-02-29 18:15:36 +01:00
|
|
|
|
|
|
|
|
private:
|
2016-03-02 13:57:37 +01:00
|
|
|
QDockWidget *registerDockWidget(const QByteArray &dockId, QWidget *widget);
|
|
|
|
|
void loadPerspectiveHelper(const QByteArray &perspectiveId, bool fromStoredSettings = true);
|
2016-03-01 07:51:06 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
QByteArray m_currentPerspectiveId;
|
|
|
|
|
QComboBox *m_perspectiveChooser;
|
2016-02-29 18:15:36 +01:00
|
|
|
QStackedWidget *m_controlsStackWidget;
|
2016-03-02 13:23:30 +01:00
|
|
|
Utils::StatusLabel *m_statusLabel;
|
2016-03-09 13:26:02 +01:00
|
|
|
QDockWidget *m_toolbarDock;
|
2016-03-02 13:57:37 +01:00
|
|
|
|
|
|
|
|
QHash<QByteArray, QDockWidget *> m_dockForDockId;
|
|
|
|
|
QHash<QByteArray, QWidget *> m_toolbarForPerspectiveId;
|
|
|
|
|
QHash<QByteArray, Perspective> m_perspectiveForPerspectiveId;
|
2016-02-29 18:15:36 +01:00
|
|
|
|
|
|
|
|
// list of dock widgets to prevent memory leak
|
|
|
|
|
typedef QPointer<QDockWidget> DockPtr;
|
|
|
|
|
QList<DockPtr> m_dockWidgets;
|
|
|
|
|
};
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
} // Utils
|
2010-12-02 17:43:14 +01:00
|
|
|
|
2013-03-12 11:48:25 +01:00
|
|
|
#endif // DEBUGGERMAINWINDOW_H
|