forked from qt-creator/qt-creator
Core: Make IEditorFactory::createEditor use a function object
Also, replace or remove unneeded Q_OBJECTs, and make base setters and adders protected. Change-Id: I212257ef53984d8852dc8c478537199fc9483486 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -44,12 +44,18 @@ VcsSubmitEditorFactory::VcsSubmitEditorFactory
|
||||
(const VcsBaseSubmitEditorParameters *parameters,
|
||||
const EditorCreator &editorCreator,
|
||||
VcsBasePluginPrivate *plugin)
|
||||
: IEditorFactory(plugin), m_editorCreator(editorCreator)
|
||||
: IEditorFactory(plugin)
|
||||
{
|
||||
setId(parameters->id);
|
||||
setDisplayName(QLatin1String(parameters->displayName));
|
||||
addMimeType(parameters->mimeType);
|
||||
|
||||
setEditorCreator([this, editorCreator] {
|
||||
VcsBaseSubmitEditor *editor = editorCreator();
|
||||
editor->registerActions(m_undoAction, m_redoAction, m_submitAction, m_diffAction);
|
||||
return editor;
|
||||
});
|
||||
|
||||
Context context(parameters->id);
|
||||
m_undoAction = new QAction(tr("&Undo"), this);
|
||||
ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, context);
|
||||
@@ -68,11 +74,4 @@ VcsSubmitEditorFactory::VcsSubmitEditorFactory
|
||||
ActionManager::registerAction(m_diffAction, DIFF_SELECTED, context);
|
||||
}
|
||||
|
||||
Core::IEditor *VcsSubmitEditorFactory::createEditor()
|
||||
{
|
||||
VcsBaseSubmitEditor *editor = m_editorCreator();
|
||||
editor->registerActions(m_undoAction, m_redoAction, m_submitAction, m_diffAction);
|
||||
return editor;
|
||||
}
|
||||
|
||||
} // namespace VcsBase
|
||||
|
||||
Reference in New Issue
Block a user