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)
|
||||
{
|
||||
if (newMode == this) {
|
||||
// Apply active context
|
||||
Core::ICore::updateAdditionalContexts(Context(), d->m_activeContext);
|
||||
} else if (oldMode == this) {
|
||||
// Remove active context
|
||||
Core::ICore::updateAdditionalContexts(d->m_activeContext, Context());
|
||||
}
|
||||
if (newMode == this)
|
||||
ICore::addAdditionalContext(d->m_activeContext);
|
||||
else if (oldMode == this)
|
||||
ICore::removeAdditionalContext(d->m_activeContext);
|
||||
}
|
||||
|
||||
void DesignMode::setActiveContext(const Context &context)
|
||||
|
||||
@@ -514,6 +514,16 @@ void ICore::updateAdditionalContexts(const Context &remove, const Context &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)
|
||||
{
|
||||
m_mainwindow->addContextObject(context);
|
||||
|
||||
@@ -107,6 +107,8 @@ public:
|
||||
// Adds and removes additional active contexts, these contexts are appended
|
||||
// to the currently active contexts.
|
||||
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 removeContextObject(IContext *context);
|
||||
|
||||
|
||||
@@ -346,15 +346,14 @@ void DebuggerMainWindowPrivate::activateQmlCppLayout()
|
||||
|
||||
if (m_previousDebugLanguages & QmlLanguage) {
|
||||
m_dockWidgetActiveStateQmlCpp = q->saveSettings();
|
||||
ICore::updateAdditionalContexts(qmlCppContext, Context());
|
||||
ICore::removeAdditionalContext(qmlCppContext);
|
||||
} else if (m_previousDebugLanguages & CppLanguage) {
|
||||
m_dockWidgetActiveStateCpp = q->saveSettings();
|
||||
ICore::updateAdditionalContexts(m_contextsForLanguage.value(CppLanguage),
|
||||
Context());
|
||||
ICore::removeAdditionalContext(m_contextsForLanguage.value(CppLanguage));
|
||||
}
|
||||
|
||||
q->restoreSettings(m_dockWidgetActiveStateQmlCpp);
|
||||
ICore::updateAdditionalContexts(Context(), qmlCppContext);
|
||||
ICore::addAdditionalContext(qmlCppContext);
|
||||
}
|
||||
|
||||
void DebuggerMainWindowPrivate::activateCppLayout()
|
||||
@@ -368,17 +367,16 @@ void DebuggerMainWindowPrivate::activateCppLayout()
|
||||
|
||||
if (m_previousDebugLanguages & QmlLanguage) {
|
||||
m_dockWidgetActiveStateQmlCpp = q->saveSettings();
|
||||
ICore::updateAdditionalContexts(qmlCppContext, Context());
|
||||
ICore::removeAdditionalContext(qmlCppContext);
|
||||
} else if (m_previousDebugLanguages & CppLanguage) {
|
||||
m_dockWidgetActiveStateCpp = q->saveSettings();
|
||||
ICore::updateAdditionalContexts(m_contextsForLanguage.value(CppLanguage),
|
||||
Context());
|
||||
ICore::removeAdditionalContext(m_contextsForLanguage.value(CppLanguage));
|
||||
}
|
||||
|
||||
q->restoreSettings(m_dockWidgetActiveStateCpp);
|
||||
|
||||
const Context &cppContext = m_contextsForLanguage.value(CppLanguage);
|
||||
ICore::updateAdditionalContexts(Context(), cppContext);
|
||||
ICore::addAdditionalContext(cppContext);
|
||||
}
|
||||
|
||||
void DebuggerMainWindow::setToolBar(DebuggerLanguage language, QWidget *widget)
|
||||
|
||||
@@ -226,7 +226,7 @@ void QmlInspectorAdapter::toolsClientStateChanged(QmlDebugClient::State state)
|
||||
Core::Id(Constants::QML_UPDATE_ON_SAVE),
|
||||
m_inspectorToolsContext);
|
||||
|
||||
Core::ICore::updateAdditionalContexts(Core::Context(), m_inspectorToolsContext);
|
||||
Core::ICore::addAdditionalContext(m_inspectorToolsContext);
|
||||
|
||||
m_toolsClientConnected = true;
|
||||
onEngineStateChanged(m_engine->state());
|
||||
@@ -246,7 +246,7 @@ void QmlInspectorAdapter::toolsClientStateChanged(QmlDebugClient::State state)
|
||||
Core::ActionManager::unregisterAction(m_updateOnSaveAction,
|
||||
Core::Id(Constants::QML_UPDATE_ON_SAVE));
|
||||
|
||||
Core::ICore::updateAdditionalContexts(m_inspectorToolsContext, Core::Context());
|
||||
Core::ICore::removeAdditionalContext(m_inspectorToolsContext);
|
||||
|
||||
enableTools(false);
|
||||
m_toolsClientConnected = false;
|
||||
|
||||
Reference in New Issue
Block a user