DesignMode: Apply 'static pattern'

Also:
 - and replace some occurrences of DesignMode::instance()->id() by
   Core::Constants::MODE_DESIGN for less dependence on the lifetime
   of the DesignMode object (and less indirection)
 - remove storage if DesignMode::instance() values when direct
   use of the static functions suffice
 - remove some unused items from the interface
 - use member-initialization in DesignMode::Private.

Change-Id: Ie66c06da0fc0a3ccc588b8079e51db6b39284152
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2018-01-23 09:09:46 +01:00
parent fba61c5b55
commit 2b76504bd2
9 changed files with 28 additions and 50 deletions

View File

@@ -118,7 +118,7 @@ ScxmlEditorData::~ScxmlEditorData()
ICore::removeContextObject(m_context);
if (m_modeWidget) {
m_designMode->unregisterDesignWidget(m_modeWidget);
DesignMode::unregisterDesignWidget(m_modeWidget);
delete m_modeWidget;
m_modeWidget = nullptr;
}
@@ -132,7 +132,6 @@ void ScxmlEditorData::fullInit()
m_widgetStack = new ScxmlEditorStack;
m_widgetToolBar = new QToolBar;
m_mainToolBar = createMainToolBar();
m_designMode = DesignMode::instance();
m_modeWidget = createModeWidget();
// Create undo/redo group/actions
@@ -153,7 +152,7 @@ void ScxmlEditorData::fullInit()
m_context = new ScxmlContext(scxmlContexts, m_modeWidget, this);
ICore::addContextObject(m_context);
m_designMode->registerDesignWidget(m_modeWidget, QStringList(QLatin1String(ProjectExplorer::Constants::SCXML_MIMETYPE)), m_contexts);
DesignMode::registerDesignWidget(m_modeWidget, QStringList(QLatin1String(ProjectExplorer::Constants::SCXML_MIMETYPE)), m_contexts);
}
IEditor *ScxmlEditorData::createEditor()
@@ -232,7 +231,7 @@ QWidget *ScxmlEditorData::createModeWidget()
// 'Run' in 'Design' mode emits output.
auto splitter = new MiniSplitter(Qt::Vertical);
splitter->addWidget(m_widgetStack);
auto outputPane = new OutputPanePlaceHolder(m_designMode->id(), splitter);
auto outputPane = new OutputPanePlaceHolder(Core::Constants::MODE_DESIGN, splitter);
outputPane->setObjectName("DesignerOutputPanePlaceHolder");
splitter->addWidget(outputPane);
layout->addWidget(splitter);