forked from qt-creator/qt-creator
Use Core::Id in ModeManager interface
Makes it more uniform to use and allows placeholder widget creation to be independent of mode creations. Change-Id: I4021bc9db7f8c78f0374c0cc3b3331506959afe4 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -197,7 +197,7 @@ void DesignMode::currentEditorChanged(IEditor *editor)
|
||||
|
||||
if (!mimeEditorAvailable) {
|
||||
setActiveContext(Context());
|
||||
if (ModeManager::currentMode() == this)
|
||||
if (ModeManager::currentMode() == id())
|
||||
ModeManager::activateMode(Constants::MODE_EDIT);
|
||||
setEnabled(false);
|
||||
d->m_currentEditor = 0;
|
||||
@@ -217,11 +217,11 @@ void DesignMode::updateActions()
|
||||
emit actionsUpdated(d->m_currentEditor.data());
|
||||
}
|
||||
|
||||
void DesignMode::updateContext(IMode *newMode, IMode *oldMode)
|
||||
void DesignMode::updateContext(Id newMode, Id oldMode)
|
||||
{
|
||||
if (newMode == this)
|
||||
if (newMode == id())
|
||||
ICore::addAdditionalContext(d->m_activeContext);
|
||||
else if (oldMode == this)
|
||||
else if (oldMode == id())
|
||||
ICore::removeAdditionalContext(d->m_activeContext);
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ void DesignMode::setActiveContext(const Context &context)
|
||||
if (d->m_activeContext == context)
|
||||
return;
|
||||
|
||||
if (ModeManager::currentMode() == this)
|
||||
if (ModeManager::currentMode() == id())
|
||||
ICore::updateAdditionalContexts(d->m_activeContext, context);
|
||||
|
||||
d->m_activeContext = context;
|
||||
|
@@ -68,7 +68,7 @@ private:
|
||||
void updateActions();
|
||||
|
||||
void currentEditorChanged(IEditor *editor);
|
||||
void updateContext(IMode *newMode, IMode *oldMode);
|
||||
void updateContext(Id newMode, Id oldMode);
|
||||
void setActiveContext(const Context &context);
|
||||
|
||||
DesignModePrivate *d;
|
||||
|
@@ -58,25 +58,25 @@ EditMode::EditMode() :
|
||||
m_rightSplitWidgetLayout->setMargin(0);
|
||||
QWidget *rightSplitWidget = new QWidget;
|
||||
rightSplitWidget->setLayout(m_rightSplitWidgetLayout);
|
||||
auto editorPlaceHolder = new EditorManagerPlaceHolder(this);
|
||||
auto editorPlaceHolder = new EditorManagerPlaceHolder(Constants::MODE_EDIT);
|
||||
m_rightSplitWidgetLayout->insertWidget(0, editorPlaceHolder);
|
||||
|
||||
MiniSplitter *rightPaneSplitter = new MiniSplitter;
|
||||
rightPaneSplitter->insertWidget(0, rightSplitWidget);
|
||||
rightPaneSplitter->insertWidget(1, new RightPanePlaceHolder(this));
|
||||
rightPaneSplitter->insertWidget(1, new RightPanePlaceHolder(Constants::MODE_EDIT));
|
||||
rightPaneSplitter->setStretchFactor(0, 1);
|
||||
rightPaneSplitter->setStretchFactor(1, 0);
|
||||
|
||||
MiniSplitter *splitter = new MiniSplitter;
|
||||
splitter->setOrientation(Qt::Vertical);
|
||||
splitter->insertWidget(0, rightPaneSplitter);
|
||||
QWidget *outputPane = new OutputPanePlaceHolder(this, splitter);
|
||||
QWidget *outputPane = new OutputPanePlaceHolder(Constants::MODE_EDIT, splitter);
|
||||
outputPane->setObjectName(QLatin1String("EditModeOutputPanePlaceHolder"));
|
||||
splitter->insertWidget(1, outputPane);
|
||||
splitter->setStretchFactor(0, 3);
|
||||
splitter->setStretchFactor(1, 0);
|
||||
|
||||
m_splitter->insertWidget(0, new NavigationWidgetPlaceHolder(this));
|
||||
m_splitter->insertWidget(0, new NavigationWidgetPlaceHolder(Constants::MODE_EDIT));
|
||||
m_splitter->insertWidget(1, splitter);
|
||||
m_splitter->setStretchFactor(0, 0);
|
||||
m_splitter->setStretchFactor(1, 1);
|
||||
@@ -100,9 +100,9 @@ EditMode::~EditMode()
|
||||
delete m_splitter;
|
||||
}
|
||||
|
||||
void EditMode::grabEditorManager(IMode *mode)
|
||||
void EditMode::grabEditorManager(Id mode)
|
||||
{
|
||||
if (mode != this)
|
||||
if (mode != id())
|
||||
return;
|
||||
|
||||
if (EditorManager::currentEditor())
|
||||
|
@@ -47,7 +47,7 @@ public:
|
||||
~EditMode();
|
||||
|
||||
private:
|
||||
void grabEditorManager(IMode *mode);
|
||||
void grabEditorManager(Id mode);
|
||||
|
||||
QSplitter *m_splitter;
|
||||
QVBoxLayout *m_rightSplitWidgetLayout;
|
||||
|
@@ -121,7 +121,7 @@ using namespace Utils;
|
||||
|
||||
//===================EditorManager=====================
|
||||
|
||||
EditorManagerPlaceHolder::EditorManagerPlaceHolder(IMode *mode, QWidget *parent)
|
||||
EditorManagerPlaceHolder::EditorManagerPlaceHolder(Id mode, QWidget *parent)
|
||||
: QWidget(parent), m_mode(mode)
|
||||
{
|
||||
setLayout(new QVBoxLayout);
|
||||
@@ -143,7 +143,7 @@ EditorManagerPlaceHolder::~EditorManagerPlaceHolder()
|
||||
}
|
||||
}
|
||||
|
||||
void EditorManagerPlaceHolder::currentModeChanged(IMode *mode)
|
||||
void EditorManagerPlaceHolder::currentModeChanged(Id mode)
|
||||
{
|
||||
if (m_mode == mode) {
|
||||
QWidget *previousFocus = 0;
|
||||
|
@@ -72,13 +72,13 @@ class CORE_EXPORT EditorManagerPlaceHolder : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EditorManagerPlaceHolder(IMode *mode, QWidget *parent = 0);
|
||||
explicit EditorManagerPlaceHolder(Id mode, QWidget *parent = 0);
|
||||
~EditorManagerPlaceHolder();
|
||||
|
||||
private:
|
||||
void currentModeChanged(IMode *);
|
||||
void currentModeChanged(Id mode);
|
||||
|
||||
IMode *m_mode;
|
||||
Id m_mode;
|
||||
};
|
||||
|
||||
class CORE_EXPORT EditorManager : public QObject
|
||||
|
@@ -115,15 +115,15 @@ ModeManager::~ModeManager()
|
||||
m_instance = 0;
|
||||
}
|
||||
|
||||
IMode *ModeManager::currentMode()
|
||||
Id ModeManager::currentMode()
|
||||
{
|
||||
int currentIndex = d->m_modeStack->currentIndex();
|
||||
if (currentIndex < 0)
|
||||
return 0;
|
||||
return d->m_modes.at(currentIndex);
|
||||
return d->m_modes.at(currentIndex)->id();
|
||||
}
|
||||
|
||||
IMode *ModeManager::mode(Id id)
|
||||
static IMode *findMode(Id id)
|
||||
{
|
||||
const int index = indexOf(id);
|
||||
if (index >= 0)
|
||||
@@ -205,7 +205,7 @@ void ModeManager::enabledStateChanged()
|
||||
d->m_modeStack->setTabEnabled(index, mode->isEnabled());
|
||||
|
||||
// Make sure we leave any disabled mode to prevent possible crashes:
|
||||
if (mode == currentMode() && !mode->isEnabled()) {
|
||||
if (mode->id() == currentMode() && !mode->isEnabled()) {
|
||||
// This assumes that there is always at least one enabled mode.
|
||||
for (int i = 0; i < d->m_modes.count(); ++i) {
|
||||
if (d->m_modes.at(i) != mode &&
|
||||
@@ -256,7 +256,7 @@ void ModeManager::currentTabAboutToChange(int index)
|
||||
if (index >= 0) {
|
||||
IMode *mode = d->m_modes.at(index);
|
||||
if (mode)
|
||||
emit currentModeAboutToChange(mode);
|
||||
emit currentModeAboutToChange(mode->id());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,13 +276,13 @@ void ModeManager::currentTabChanged(int index)
|
||||
if (d->m_oldCurrent >= 0)
|
||||
oldMode = d->m_modes.at(d->m_oldCurrent);
|
||||
d->m_oldCurrent = index;
|
||||
emit currentModeChanged(mode, oldMode);
|
||||
emit currentModeChanged(mode ? mode->id() : Id(), oldMode ? oldMode->id() : Id());
|
||||
}
|
||||
}
|
||||
|
||||
void ModeManager::setFocusToCurrentMode()
|
||||
{
|
||||
IMode *mode = currentMode();
|
||||
IMode *mode = findMode(currentMode());
|
||||
QTC_ASSERT(mode, return);
|
||||
QWidget *widget = mode->widget();
|
||||
if (widget) {
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <coreplugin/core_global.h>
|
||||
#include <coreplugin/id.h>
|
||||
#include <QObject>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -34,9 +34,6 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
|
||||
class Id;
|
||||
class IMode;
|
||||
|
||||
namespace Internal {
|
||||
class MainWindow;
|
||||
class FancyTabWidget;
|
||||
@@ -49,8 +46,7 @@ class CORE_EXPORT ModeManager : public QObject
|
||||
public:
|
||||
static ModeManager *instance();
|
||||
|
||||
static IMode *currentMode();
|
||||
static IMode *mode(Id id);
|
||||
static Id currentMode();
|
||||
|
||||
static void addAction(QAction *action, int priority);
|
||||
static void addProjectSelector(QAction *action);
|
||||
@@ -63,10 +59,10 @@ public slots:
|
||||
static void setModeSelectorVisible(bool visible);
|
||||
|
||||
signals:
|
||||
void currentModeAboutToChange(Core::IMode *mode);
|
||||
void currentModeAboutToChange(Core::Id mode);
|
||||
|
||||
// the default argument '=0' is important for connects without the oldMode argument.
|
||||
void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode = 0);
|
||||
void currentModeChanged(Core::Id mode, Core::Id oldMode = Core::Id());
|
||||
|
||||
private:
|
||||
explicit ModeManager(Internal::MainWindow *mainWindow, Internal::FancyTabWidget *modeStack);
|
||||
|
@@ -55,7 +55,7 @@ NavigationWidgetPlaceHolder* NavigationWidgetPlaceHolder::current()
|
||||
return m_current;
|
||||
}
|
||||
|
||||
NavigationWidgetPlaceHolder::NavigationWidgetPlaceHolder(IMode *mode, QWidget *parent)
|
||||
NavigationWidgetPlaceHolder::NavigationWidgetPlaceHolder(Id mode, QWidget *parent)
|
||||
:QWidget(parent), m_mode(mode)
|
||||
{
|
||||
setLayout(new QVBoxLayout);
|
||||
@@ -104,7 +104,7 @@ void NavigationWidgetPlaceHolder::applyStoredSize(int width)
|
||||
// m_current points to the current PlaceHolder, or zero if there
|
||||
// is no PlaceHolder in this mode
|
||||
// And that the parent of the NavigationWidget gets the correct parent
|
||||
void NavigationWidgetPlaceHolder::currentModeAboutToChange(IMode *mode)
|
||||
void NavigationWidgetPlaceHolder::currentModeAboutToChange(Id mode)
|
||||
{
|
||||
NavigationWidget *navigationWidget = NavigationWidget::instance();
|
||||
|
||||
|
@@ -38,7 +38,6 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
class INavigationWidgetFactory;
|
||||
class IMode;
|
||||
class Command;
|
||||
class NavigationWidget;
|
||||
struct NavigationWidgetPrivate;
|
||||
@@ -50,15 +49,15 @@ class CORE_EXPORT NavigationWidgetPlaceHolder : public QWidget
|
||||
friend class Core::NavigationWidget;
|
||||
|
||||
public:
|
||||
explicit NavigationWidgetPlaceHolder(IMode *mode, QWidget *parent = 0);
|
||||
explicit NavigationWidgetPlaceHolder(Id mode, QWidget *parent = 0);
|
||||
virtual ~NavigationWidgetPlaceHolder();
|
||||
static NavigationWidgetPlaceHolder* current();
|
||||
void applyStoredSize(int width);
|
||||
|
||||
private:
|
||||
void currentModeAboutToChange(IMode *);
|
||||
void currentModeAboutToChange(Id mode);
|
||||
|
||||
IMode *m_mode;
|
||||
Id m_mode;
|
||||
static NavigationWidgetPlaceHolder* m_current;
|
||||
};
|
||||
|
||||
|
@@ -36,9 +36,9 @@ namespace Core {
|
||||
|
||||
class OutputPanePlaceHolderPrivate {
|
||||
public:
|
||||
explicit OutputPanePlaceHolderPrivate(IMode *mode, QSplitter *parent);
|
||||
explicit OutputPanePlaceHolderPrivate(Id mode, QSplitter *parent);
|
||||
|
||||
IMode *m_mode;
|
||||
Id m_mode;
|
||||
QSplitter *m_splitter;
|
||||
int m_nonMaximizedSize = 0;
|
||||
bool m_isMaximized = false;
|
||||
@@ -46,14 +46,14 @@ public:
|
||||
static OutputPanePlaceHolder* m_current;
|
||||
};
|
||||
|
||||
OutputPanePlaceHolderPrivate::OutputPanePlaceHolderPrivate(IMode *mode, QSplitter *parent) :
|
||||
OutputPanePlaceHolderPrivate::OutputPanePlaceHolderPrivate(Id mode, QSplitter *parent) :
|
||||
m_mode(mode), m_splitter(parent)
|
||||
{
|
||||
}
|
||||
|
||||
OutputPanePlaceHolder *OutputPanePlaceHolderPrivate::m_current = 0;
|
||||
|
||||
OutputPanePlaceHolder::OutputPanePlaceHolder(IMode *mode, QSplitter* parent)
|
||||
OutputPanePlaceHolder::OutputPanePlaceHolder(Id mode, QSplitter *parent)
|
||||
: QWidget(parent), d(new OutputPanePlaceHolderPrivate(mode, parent))
|
||||
{
|
||||
setVisible(false);
|
||||
@@ -83,7 +83,7 @@ OutputPanePlaceHolder::~OutputPanePlaceHolder()
|
||||
delete d;
|
||||
}
|
||||
|
||||
void OutputPanePlaceHolder::currentModeChanged(IMode *mode)
|
||||
void OutputPanePlaceHolder::currentModeChanged(Id mode)
|
||||
{
|
||||
if (d->m_current == this) {
|
||||
d->m_current = 0;
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core_global.h"
|
||||
#include "id.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
@@ -35,9 +35,6 @@ QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
|
||||
class IMode;
|
||||
|
||||
namespace Internal { class OutputPaneManager; }
|
||||
class OutputPanePlaceHolderPrivate;
|
||||
|
||||
class CORE_EXPORT OutputPanePlaceHolder : public QWidget
|
||||
@@ -45,7 +42,7 @@ class CORE_EXPORT OutputPanePlaceHolder : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OutputPanePlaceHolder(IMode *mode, QSplitter *parent = 0);
|
||||
explicit OutputPanePlaceHolder(Id mode, QSplitter *parent = 0);
|
||||
~OutputPanePlaceHolder();
|
||||
|
||||
static OutputPanePlaceHolder *getCurrent();
|
||||
@@ -62,7 +59,7 @@ protected:
|
||||
|
||||
private:
|
||||
void setHeight(int height);
|
||||
void currentModeChanged(IMode *);
|
||||
void currentModeChanged(Id mode);
|
||||
|
||||
OutputPanePlaceHolderPrivate *d;
|
||||
};
|
||||
|
@@ -45,7 +45,7 @@ RightPanePlaceHolder* RightPanePlaceHolder::current()
|
||||
return m_current;
|
||||
}
|
||||
|
||||
RightPanePlaceHolder::RightPanePlaceHolder(IMode *mode, QWidget *parent)
|
||||
RightPanePlaceHolder::RightPanePlaceHolder(Id mode, QWidget *parent)
|
||||
:QWidget(parent), m_mode(mode)
|
||||
{
|
||||
setLayout(new QVBoxLayout);
|
||||
@@ -92,7 +92,7 @@ void RightPanePlaceHolder::applyStoredSize(int width)
|
||||
// m_current points to the current PlaceHolder, or zero if there
|
||||
// is no PlaceHolder in this mode
|
||||
// And that the parent of the RightPaneWidget gets the correct parent
|
||||
void RightPanePlaceHolder::currentModeChanged(IMode *mode)
|
||||
void RightPanePlaceHolder::currentModeChanged(Id mode)
|
||||
{
|
||||
if (m_current == this) {
|
||||
m_current = 0;
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core_global.h"
|
||||
#include "id.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
@@ -45,14 +45,14 @@ class CORE_EXPORT RightPanePlaceHolder : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RightPanePlaceHolder(IMode *mode, QWidget *parent = 0);
|
||||
explicit RightPanePlaceHolder(Id mode, QWidget *parent = 0);
|
||||
~RightPanePlaceHolder();
|
||||
static RightPanePlaceHolder *current();
|
||||
|
||||
private:
|
||||
void currentModeChanged(IMode *);
|
||||
void currentModeChanged(Id mode);
|
||||
void applyStoredSize(int width);
|
||||
IMode *m_mode;
|
||||
Id m_mode;
|
||||
static RightPanePlaceHolder* m_current;
|
||||
};
|
||||
|
||||
|
@@ -205,7 +205,7 @@ void DebuggerMainWindow::finalizeSetup()
|
||||
addDockWidget(Qt::BottomDockWidgetArea, dock);
|
||||
}
|
||||
|
||||
QWidget *createModeWindow(Core::IMode *mode, DebuggerMainWindow *mainWindow, QWidget *central)
|
||||
QWidget *createModeWindow(const Core::Id &mode, DebuggerMainWindow *mainWindow, QWidget *central)
|
||||
{
|
||||
if (!central)
|
||||
central = new EditorManagerPlaceHolder(mode);
|
||||
|
@@ -40,7 +40,7 @@ class QComboBox;
|
||||
class QStackedWidget;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core { class IMode; }
|
||||
namespace Core { class Id; }
|
||||
|
||||
namespace Utils {
|
||||
|
||||
@@ -135,6 +135,6 @@ private:
|
||||
QHash<QByteArray, Perspective> m_perspectiveForPerspectiveId;
|
||||
};
|
||||
|
||||
QWidget *createModeWindow(Core::IMode *mode, DebuggerMainWindow *mainWindow, QWidget *central);
|
||||
QWidget *createModeWindow(const Core::Id &mode, DebuggerMainWindow *mainWindow, QWidget *central);
|
||||
|
||||
} // Utils
|
||||
|
@@ -680,7 +680,7 @@ public:
|
||||
void activateDebugMode();
|
||||
void toggleBreakpointHelper();
|
||||
void toggleBreakpoint(const ContextData &location, const QString &tracePointMessage = QString());
|
||||
void onModeChanged(IMode *mode);
|
||||
void onModeChanged(Id mode);
|
||||
void updateDebugWithoutDeployMenu();
|
||||
|
||||
void startAndDebugApplication();
|
||||
@@ -1735,7 +1735,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
|
||||
|
||||
// Debug mode setup
|
||||
m_mode = new DebugMode;
|
||||
m_modeWindow = createModeWindow(m_mode, m_mainWindow, 0);
|
||||
m_modeWindow = createModeWindow(Constants::MODE_DEBUG, m_mainWindow, 0);
|
||||
m_mode->setWidget(m_modeWindow);
|
||||
|
||||
m_plugin->addAutoReleasedObject(new DebugModeContext(m_mainWindow));
|
||||
@@ -2705,8 +2705,7 @@ void DebuggerPluginPrivate::dumpLog()
|
||||
/*! Activates the previous mode when the current mode is the debug mode. */
|
||||
void DebuggerPluginPrivate::activatePreviousMode()
|
||||
{
|
||||
if (ModeManager::currentMode() == ModeManager::mode(MODE_DEBUG)
|
||||
&& m_previousMode.isValid()) {
|
||||
if (ModeManager::currentMode() == MODE_DEBUG && m_previousMode.isValid()) {
|
||||
// If stopping the application also makes Qt Creator active (as the
|
||||
// "previously active application"), doing the switch synchronously
|
||||
// leads to funny effects with floating dock widgets
|
||||
@@ -3320,13 +3319,13 @@ void DebuggerPluginPrivate::updateActiveLanguages()
|
||||
// return QObject::eventFilter(obj, event);
|
||||
//}
|
||||
|
||||
void DebuggerPluginPrivate::onModeChanged(IMode *mode)
|
||||
void DebuggerPluginPrivate::onModeChanged(Id mode)
|
||||
{
|
||||
// FIXME: This one gets always called, even if switching between modes
|
||||
// different then the debugger mode. E.g. Welcome and Help mode and
|
||||
// also on shutdown.
|
||||
|
||||
if (mode && mode->id() == MODE_DEBUG) {
|
||||
if (mode == MODE_DEBUG) {
|
||||
if (IEditor *editor = EditorManager::currentEditor())
|
||||
editor->widget()->setFocus();
|
||||
|
||||
@@ -3362,7 +3361,7 @@ void DebuggerPluginPrivate::onModeChanged(IMode *mode)
|
||||
|
||||
void saveModeToRestore()
|
||||
{
|
||||
dd->m_previousMode = ModeManager::currentMode()->id();
|
||||
dd->m_previousMode = ModeManager::currentMode();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -177,13 +177,13 @@ SharedTools::WidgetHost *FormEditorStack::formWindowEditorForXmlEditor(const Cor
|
||||
return i != -1 ? m_formEditors.at(i).widgetHost : static_cast<SharedTools::WidgetHost *>(0);
|
||||
}
|
||||
|
||||
void FormEditorStack::modeAboutToChange(Core::IMode *m)
|
||||
void FormEditorStack::modeAboutToChange(Core::Id mode)
|
||||
{
|
||||
if (Designer::Constants::Internal::debug && m)
|
||||
qDebug() << "FormEditorStack::modeAboutToChange" << m->id().toString();
|
||||
if (Designer::Constants::Internal::debug)
|
||||
qDebug() << "FormEditorStack::modeAboutToChange" << mode.toString();
|
||||
|
||||
// Sync the editor when entering edit mode
|
||||
if (m && m->id() == Core::Constants::MODE_EDIT)
|
||||
if (mode == Core::Constants::MODE_EDIT)
|
||||
foreach (const EditorData &data, m_formEditors)
|
||||
data.formWindowEditor->formWindowFile()->syncXmlFromFormWindow();
|
||||
}
|
||||
|
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "editordata.h"
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <QStackedWidget>
|
||||
#include <QList>
|
||||
|
||||
@@ -35,10 +37,7 @@ class QDesignerFormWindowInterface;
|
||||
class QDesignerFormEditorInterface;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
class IEditor;
|
||||
class IMode;
|
||||
}
|
||||
namespace Core { class IEditor; }
|
||||
|
||||
namespace Designer {
|
||||
namespace Internal {
|
||||
@@ -68,7 +67,7 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void updateFormWindowSelectionHandles();
|
||||
void modeAboutToChange(Core::IMode *);
|
||||
void modeAboutToChange(Core::Id mode);
|
||||
void formSizeChanged(int w, int h);
|
||||
|
||||
private:
|
||||
|
@@ -434,7 +434,7 @@ void FormEditorData::fullInit()
|
||||
// 'Run' in 'Design' mode emits output.
|
||||
MiniSplitter *splitter = new MiniSplitter(Qt::Vertical);
|
||||
splitter->addWidget(m_editorWidget);
|
||||
QWidget *outputPane = new OutputPanePlaceHolder(m_designMode, splitter);
|
||||
QWidget *outputPane = new OutputPanePlaceHolder(m_designMode->id(), splitter);
|
||||
outputPane->setObjectName(QLatin1String("DesignerOutputPanePlaceHolder"));
|
||||
splitter->addWidget(outputPane);
|
||||
layout->addWidget(splitter);
|
||||
|
@@ -478,7 +478,7 @@ void HelpPlugin::updateSideBarSource(const QUrl &newUrl)
|
||||
void HelpPlugin::setupHelpEngineIfNeeded()
|
||||
{
|
||||
LocalHelpManager::setEngineNeedsUpdate();
|
||||
if (ModeManager::currentMode() == m_mode
|
||||
if (ModeManager::currentMode() == m_mode->id()
|
||||
|| LocalHelpManager::contextHelpOption() == HelpManager::ExternalHelpAlways)
|
||||
LocalHelpManager::setupGuiHelpEngine();
|
||||
}
|
||||
|
@@ -276,7 +276,7 @@ public:
|
||||
|
||||
void slotUpdateRunActions();
|
||||
|
||||
void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode);
|
||||
void currentModeChanged(Core::Id mode, Core::Id oldMode);
|
||||
|
||||
void updateWelcomePage();
|
||||
|
||||
@@ -1572,8 +1572,7 @@ void ProjectExplorerPluginPrivate::showSessionManager()
|
||||
|
||||
updateActions();
|
||||
|
||||
IMode *welcomeMode = ModeManager::mode(Core::Constants::MODE_WELCOME);
|
||||
if (ModeManager::currentMode() == welcomeMode)
|
||||
if (ModeManager::currentMode() == Core::Constants::MODE_WELCOME)
|
||||
updateWelcomePage();
|
||||
}
|
||||
|
||||
@@ -1781,11 +1780,11 @@ void ProjectExplorerPluginPrivate::updateWelcomePage()
|
||||
m_welcomePage->reloadWelcomeScreenData();
|
||||
}
|
||||
|
||||
void ProjectExplorerPluginPrivate::currentModeChanged(IMode *mode, IMode *oldMode)
|
||||
void ProjectExplorerPluginPrivate::currentModeChanged(Id mode, Id oldMode)
|
||||
{
|
||||
if (oldMode && oldMode->id() == Constants::MODE_SESSION)
|
||||
if (oldMode == Constants::MODE_SESSION)
|
||||
ICore::saveSettings();
|
||||
if (mode && mode->id() == Core::Constants::MODE_WELCOME)
|
||||
if (mode == Core::Constants::MODE_WELCOME)
|
||||
updateWelcomePage();
|
||||
}
|
||||
|
||||
|
@@ -172,11 +172,10 @@ bool SessionManager::isDefaultSession(const QString &session)
|
||||
return session == QLatin1String("default");
|
||||
}
|
||||
|
||||
|
||||
void SessionManager::saveActiveMode(IMode *mode)
|
||||
void SessionManager::saveActiveMode(Id mode)
|
||||
{
|
||||
if (mode->id() != Core::Constants::MODE_WELCOME)
|
||||
setValue(QLatin1String("ActiveMode"), mode->id().toString());
|
||||
if (mode != Core::Constants::MODE_WELCOME)
|
||||
setValue(QLatin1String("ActiveMode"), mode.toString());
|
||||
}
|
||||
|
||||
void SessionManager::clearProjectFileCache()
|
||||
|
@@ -27,23 +27,14 @@
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <utils/persistentsettings.h>
|
||||
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
#include <QFutureInterface>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAbstractItemModel;
|
||||
class QTimer;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
class IMode;
|
||||
class IEditor;
|
||||
} // namespace Core
|
||||
namespace Core { class IEditor; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -148,7 +139,7 @@ signals:
|
||||
void dependencyChanged(ProjectExplorer::Project *a, ProjectExplorer::Project *b);
|
||||
|
||||
private:
|
||||
static void saveActiveMode(Core::IMode *mode);
|
||||
static void saveActiveMode(Core::Id mode);
|
||||
void clearProjectFileCache();
|
||||
static void configureEditor(Core::IEditor *editor, const QString &fileName);
|
||||
static void markSessionFileDirty(bool makeDefaultVirginDirty = true);
|
||||
|
@@ -575,7 +575,7 @@ static Core::MiniSplitter *createCentralSplitter(const QList<WidgetInfo> &widget
|
||||
outputPlaceholderSplitter->setStretchFactor(1, 0);
|
||||
outputPlaceholderSplitter->setOrientation(Qt::Vertical);
|
||||
|
||||
StyledOutputpanePlaceHolder *outputPanePlaceholder = new StyledOutputpanePlaceHolder(Core::DesignMode::instance(), outputPlaceholderSplitter);
|
||||
auto outputPanePlaceholder = new StyledOutputpanePlaceHolder(Core::Constants::MODE_DESIGN, outputPlaceholderSplitter);
|
||||
|
||||
if (centralWidgetInfos.count() == 1)
|
||||
outputPlaceholderSplitter->addWidget(centralWidgetInfos.first().widget);
|
||||
|
@@ -81,7 +81,7 @@ QmlDesignerPlugin *QmlDesignerPlugin::m_instance = 0;
|
||||
|
||||
static bool isInDesignerMode()
|
||||
{
|
||||
return Core::ModeManager::currentMode() == Core::DesignMode::instance();
|
||||
return Core::ModeManager::currentMode() == Core::Constants::MODE_DESIGN;
|
||||
}
|
||||
|
||||
bool shouldAssertInException()
|
||||
@@ -492,11 +492,11 @@ const DesignerActionManager &QmlDesignerPlugin::designerActionManager() const
|
||||
|
||||
void QmlDesignerPlugin::switchTextDesign()
|
||||
{
|
||||
if (Core::ModeManager::currentMode()->id() == Core::Constants::MODE_EDIT) {
|
||||
if (Core::ModeManager::currentMode() == Core::Constants::MODE_EDIT) {
|
||||
Core::IEditor *editor = Core::EditorManager::currentEditor();
|
||||
if (checkIfEditorIsQtQuick(editor))
|
||||
Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN);
|
||||
} else if (Core::ModeManager::currentMode()->id() == Core::Constants::MODE_DESIGN) {
|
||||
} else if (Core::ModeManager::currentMode() == Core::Constants::MODE_DESIGN) {
|
||||
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@
|
||||
namespace QmlDesigner {
|
||||
namespace Internal {
|
||||
|
||||
StyledOutputpanePlaceHolder::StyledOutputpanePlaceHolder(Core::IMode *mode, QSplitter *parent)
|
||||
StyledOutputpanePlaceHolder::StyledOutputpanePlaceHolder(Core::Id mode, QSplitter *parent)
|
||||
: Core::OutputPanePlaceHolder(mode, parent)
|
||||
{
|
||||
QByteArray sheet = Utils::FileReader::fetchQrc(":/qmldesigner/outputpane-style.css");
|
||||
|
@@ -33,7 +33,7 @@ namespace Internal {
|
||||
class StyledOutputpanePlaceHolder : public Core::OutputPanePlaceHolder
|
||||
{
|
||||
public:
|
||||
explicit StyledOutputpanePlaceHolder(Core::IMode *mode, QSplitter *parent = 0);
|
||||
explicit StyledOutputpanePlaceHolder(Core::Id mode, QSplitter *parent = 0);
|
||||
|
||||
protected:
|
||||
void childEvent(QChildEvent *event) override;;
|
||||
|
@@ -1036,9 +1036,8 @@ bool QmlJSEditor::isDesignModePreferred() const
|
||||
alwaysPreferDesignMode = true;
|
||||
|
||||
// stay in design mode if we are there
|
||||
IMode *mode = ModeManager::currentMode();
|
||||
return alwaysPreferDesignMode
|
||||
|| (mode && mode->id() == Core::Constants::MODE_DESIGN);
|
||||
Id mode = ModeManager::currentMode();
|
||||
return alwaysPreferDesignMode || mode == Core::Constants::MODE_DESIGN;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user