blob: 5f013ffa5071f124b4c93767c6509adb1f644742 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <coreplugin/core_global.h>
#include <utils/id.h>
#include <QObject>
QT_BEGIN_NAMESPACE
class QAction;
QT_END_NAMESPACE
namespace Core {
class IMode;
namespace Internal {
class MainWindow;
class FancyTabWidget;
}
class CORE_EXPORT ModeManager : public QObject
{
Q_OBJECT
public:
enum class Style {
IconsAndText,
IconsOnly,
Hidden
};
static ModeManager *instance();
static IMode *currentMode();
static Utils::Id currentModeId();
static void addAction(QAction *action, int priority);
static void addProjectSelector(QAction *action);
static void activateMode(Utils::Id id);
static void setFocusToCurrentMode();
static Style modeStyle();
static void removeMode(IMode *mode);
public slots:
static void setModeStyle(Style layout);
static void cycleModeStyle();
signals:
void currentModeAboutToChange(Utils::Id mode);
// the default argument '=0' is important for connects without the oldMode argument.
void currentModeChanged(Utils::Id mode, Utils::Id oldMode = {});
private:
explicit ModeManager(Internal::MainWindow *mainWindow, Internal::FancyTabWidget *modeStack);
~ModeManager() override;
static void extensionsInitialized();
static void addMode(IMode *mode);
void currentTabAboutToChange(int index);
void currentTabChanged(int index);
friend class IMode;
friend class Core::Internal::MainWindow;
};
} // namespace Core
|