forked from qt-creator/qt-creator
Core: Introduce ICore::{add,remove}AdditionalContext
Simplify single operation Change-Id: I172b9dfe8f97324d931d4f332ac1609d230e3400 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
e6020b7067
commit
aee3c2f531
@@ -247,13 +247,10 @@ void DesignMode::updateActions()
|
|||||||
|
|
||||||
void DesignMode::updateContext(Core::IMode *newMode, Core::IMode *oldMode)
|
void DesignMode::updateContext(Core::IMode *newMode, Core::IMode *oldMode)
|
||||||
{
|
{
|
||||||
if (newMode == this) {
|
if (newMode == this)
|
||||||
// Apply active context
|
ICore::addAdditionalContext(d->m_activeContext);
|
||||||
Core::ICore::updateAdditionalContexts(Context(), d->m_activeContext);
|
else if (oldMode == this)
|
||||||
} else if (oldMode == this) {
|
ICore::removeAdditionalContext(d->m_activeContext);
|
||||||
// Remove active context
|
|
||||||
Core::ICore::updateAdditionalContexts(d->m_activeContext, Context());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesignMode::setActiveContext(const Context &context)
|
void DesignMode::setActiveContext(const Context &context)
|
||||||
|
|||||||
@@ -514,6 +514,16 @@ void ICore::updateAdditionalContexts(const Context &remove, const Context &add)
|
|||||||
m_mainwindow->updateAdditionalContexts(remove, add);
|
m_mainwindow->updateAdditionalContexts(remove, add);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ICore::addAdditionalContext(const Context &context)
|
||||||
|
{
|
||||||
|
m_mainwindow->updateAdditionalContexts(Context(), context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ICore::removeAdditionalContext(const Context &context)
|
||||||
|
{
|
||||||
|
m_mainwindow->updateAdditionalContexts(context, Context());
|
||||||
|
}
|
||||||
|
|
||||||
void ICore::addContextObject(IContext *context)
|
void ICore::addContextObject(IContext *context)
|
||||||
{
|
{
|
||||||
m_mainwindow->addContextObject(context);
|
m_mainwindow->addContextObject(context);
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ public:
|
|||||||
// Adds and removes additional active contexts, these contexts are appended
|
// Adds and removes additional active contexts, these contexts are appended
|
||||||
// to the currently active contexts.
|
// to the currently active contexts.
|
||||||
static void updateAdditionalContexts(const Context &remove, const Context &add);
|
static void updateAdditionalContexts(const Context &remove, const Context &add);
|
||||||
|
static void addAdditionalContext(const Context &context);
|
||||||
|
static void removeAdditionalContext(const Context &context);
|
||||||
static void addContextObject(IContext *context);
|
static void addContextObject(IContext *context);
|
||||||
static void removeContextObject(IContext *context);
|
static void removeContextObject(IContext *context);
|
||||||
|
|
||||||
|
|||||||
@@ -346,15 +346,14 @@ void DebuggerMainWindowPrivate::activateQmlCppLayout()
|
|||||||
|
|
||||||
if (m_previousDebugLanguages & QmlLanguage) {
|
if (m_previousDebugLanguages & QmlLanguage) {
|
||||||
m_dockWidgetActiveStateQmlCpp = q->saveSettings();
|
m_dockWidgetActiveStateQmlCpp = q->saveSettings();
|
||||||
ICore::updateAdditionalContexts(qmlCppContext, Context());
|
ICore::removeAdditionalContext(qmlCppContext);
|
||||||
} else if (m_previousDebugLanguages & CppLanguage) {
|
} else if (m_previousDebugLanguages & CppLanguage) {
|
||||||
m_dockWidgetActiveStateCpp = q->saveSettings();
|
m_dockWidgetActiveStateCpp = q->saveSettings();
|
||||||
ICore::updateAdditionalContexts(m_contextsForLanguage.value(CppLanguage),
|
ICore::removeAdditionalContext(m_contextsForLanguage.value(CppLanguage));
|
||||||
Context());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
q->restoreSettings(m_dockWidgetActiveStateQmlCpp);
|
q->restoreSettings(m_dockWidgetActiveStateQmlCpp);
|
||||||
ICore::updateAdditionalContexts(Context(), qmlCppContext);
|
ICore::addAdditionalContext(qmlCppContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerMainWindowPrivate::activateCppLayout()
|
void DebuggerMainWindowPrivate::activateCppLayout()
|
||||||
@@ -368,17 +367,16 @@ void DebuggerMainWindowPrivate::activateCppLayout()
|
|||||||
|
|
||||||
if (m_previousDebugLanguages & QmlLanguage) {
|
if (m_previousDebugLanguages & QmlLanguage) {
|
||||||
m_dockWidgetActiveStateQmlCpp = q->saveSettings();
|
m_dockWidgetActiveStateQmlCpp = q->saveSettings();
|
||||||
ICore::updateAdditionalContexts(qmlCppContext, Context());
|
ICore::removeAdditionalContext(qmlCppContext);
|
||||||
} else if (m_previousDebugLanguages & CppLanguage) {
|
} else if (m_previousDebugLanguages & CppLanguage) {
|
||||||
m_dockWidgetActiveStateCpp = q->saveSettings();
|
m_dockWidgetActiveStateCpp = q->saveSettings();
|
||||||
ICore::updateAdditionalContexts(m_contextsForLanguage.value(CppLanguage),
|
ICore::removeAdditionalContext(m_contextsForLanguage.value(CppLanguage));
|
||||||
Context());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
q->restoreSettings(m_dockWidgetActiveStateCpp);
|
q->restoreSettings(m_dockWidgetActiveStateCpp);
|
||||||
|
|
||||||
const Context &cppContext = m_contextsForLanguage.value(CppLanguage);
|
const Context &cppContext = m_contextsForLanguage.value(CppLanguage);
|
||||||
ICore::updateAdditionalContexts(Context(), cppContext);
|
ICore::addAdditionalContext(cppContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerMainWindow::setToolBar(DebuggerLanguage language, QWidget *widget)
|
void DebuggerMainWindow::setToolBar(DebuggerLanguage language, QWidget *widget)
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ void QmlInspectorAdapter::toolsClientStateChanged(QmlDebugClient::State state)
|
|||||||
Core::Id(Constants::QML_UPDATE_ON_SAVE),
|
Core::Id(Constants::QML_UPDATE_ON_SAVE),
|
||||||
m_inspectorToolsContext);
|
m_inspectorToolsContext);
|
||||||
|
|
||||||
Core::ICore::updateAdditionalContexts(Core::Context(), m_inspectorToolsContext);
|
Core::ICore::addAdditionalContext(m_inspectorToolsContext);
|
||||||
|
|
||||||
m_toolsClientConnected = true;
|
m_toolsClientConnected = true;
|
||||||
onEngineStateChanged(m_engine->state());
|
onEngineStateChanged(m_engine->state());
|
||||||
@@ -246,7 +246,7 @@ void QmlInspectorAdapter::toolsClientStateChanged(QmlDebugClient::State state)
|
|||||||
Core::ActionManager::unregisterAction(m_updateOnSaveAction,
|
Core::ActionManager::unregisterAction(m_updateOnSaveAction,
|
||||||
Core::Id(Constants::QML_UPDATE_ON_SAVE));
|
Core::Id(Constants::QML_UPDATE_ON_SAVE));
|
||||||
|
|
||||||
Core::ICore::updateAdditionalContexts(m_inspectorToolsContext, Core::Context());
|
Core::ICore::removeAdditionalContext(m_inspectorToolsContext);
|
||||||
|
|
||||||
enableTools(false);
|
enableTools(false);
|
||||||
m_toolsClientConnected = false;
|
m_toolsClientConnected = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user