2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +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.
|
2008-12-02 14:17:16 +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
|
|
|
****************************************************************************/
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2016-03-25 20:00:19 +01:00
|
|
|
#include <coreplugin/id.h>
|
2012-05-07 18:28:03 +02:00
|
|
|
#include <QObject>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
2010-01-21 21:12:40 +01:00
|
|
|
class QAction;
|
2008-12-02 12:01:29 +01:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
2018-01-19 15:51:23 +01:00
|
|
|
class IMode;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
namespace Internal {
|
2010-03-18 10:59:06 +01:00
|
|
|
class MainWindow;
|
|
|
|
|
class FancyTabWidget;
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
class CORE_EXPORT ModeManager : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2018-04-26 16:09:16 +02:00
|
|
|
enum class Style {
|
|
|
|
|
IconsAndText,
|
|
|
|
|
IconsOnly,
|
|
|
|
|
Hidden
|
|
|
|
|
};
|
|
|
|
|
|
2014-10-15 22:36:38 +02:00
|
|
|
static ModeManager *instance();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2018-07-10 15:49:50 +02:00
|
|
|
static IMode *currentMode();
|
|
|
|
|
static Id currentModeId();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-01-26 01:18:02 +01:00
|
|
|
static void addAction(QAction *action, int priority);
|
|
|
|
|
static void addProjectSelector(QAction *action);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-05-07 18:28:03 +02:00
|
|
|
static void activateMode(Id id);
|
2012-01-26 01:18:02 +01:00
|
|
|
static void setFocusToCurrentMode();
|
2018-05-09 13:53:26 +02:00
|
|
|
static Style modeStyle();
|
2013-04-11 12:22:10 +02:00
|
|
|
|
|
|
|
|
public slots:
|
2018-05-09 13:53:26 +02:00
|
|
|
static void setModeStyle(Style layout);
|
2018-04-26 16:09:16 +02:00
|
|
|
static void cycleModeStyle();
|
2010-09-14 15:15:57 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
signals:
|
2016-03-25 20:00:19 +01:00
|
|
|
void currentModeAboutToChange(Core::Id mode);
|
2010-02-25 14:52:04 +01:00
|
|
|
|
|
|
|
|
// the default argument '=0' is important for connects without the oldMode argument.
|
2016-03-25 20:00:19 +01:00
|
|
|
void currentModeChanged(Core::Id mode, Core::Id oldMode = Core::Id());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2016-02-02 09:10:54 +02:00
|
|
|
private:
|
|
|
|
|
explicit ModeManager(Internal::MainWindow *mainWindow, Internal::FancyTabWidget *modeStack);
|
2018-05-07 15:00:03 +02:00
|
|
|
~ModeManager() override;
|
2016-02-02 09:10:54 +02:00
|
|
|
|
2018-01-26 08:56:40 +01:00
|
|
|
static void extensionsInitialized();
|
|
|
|
|
|
2018-01-19 15:51:23 +01:00
|
|
|
static void addMode(IMode *mode);
|
|
|
|
|
static void removeMode(IMode *mode);
|
2008-12-02 12:01:29 +01:00
|
|
|
void currentTabAboutToChange(int index);
|
|
|
|
|
void currentTabChanged(int index);
|
2013-06-25 13:37:21 +02:00
|
|
|
|
2018-01-19 15:51:23 +01:00
|
|
|
friend class IMode;
|
2013-06-25 13:37:21 +02:00
|
|
|
friend class Core::Internal::MainWindow;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Core
|