forked from qt-creator/qt-creator
Vcs: Move responsibility to set editor parameters to editor factory
So it doesn't need to be named twice in the editor factory setup. This intentially includes a de-optimiztion: storing the parameters by value, not by pointer. That's more natural, does not need to keep the parameters alive on the caller side, and it's uncritical in this context. Change-Id: I92867d3f2f75c38911ae82d3eeb4759cba71b723 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -41,22 +41,23 @@ const char SUBMIT[] = "Vcs.Submit";
|
||||
const char DIFF_SELECTED[] = "Vcs.DiffSelectedFiles";
|
||||
|
||||
VcsSubmitEditorFactory::VcsSubmitEditorFactory
|
||||
(const VcsBaseSubmitEditorParameters *parameters,
|
||||
(const VcsBaseSubmitEditorParameters ¶meters,
|
||||
const EditorCreator &editorCreator,
|
||||
VcsBasePluginPrivate *plugin)
|
||||
: IEditorFactory(plugin)
|
||||
{
|
||||
setId(parameters->id);
|
||||
setDisplayName(QLatin1String(parameters->displayName));
|
||||
addMimeType(parameters->mimeType);
|
||||
setId(parameters.id);
|
||||
setDisplayName(QLatin1String(parameters.displayName));
|
||||
addMimeType(parameters.mimeType);
|
||||
|
||||
setEditorCreator([this, editorCreator] {
|
||||
setEditorCreator([this, editorCreator, parameters] {
|
||||
VcsBaseSubmitEditor *editor = editorCreator();
|
||||
editor->setParameters(parameters);
|
||||
editor->registerActions(m_undoAction, m_redoAction, m_submitAction, m_diffAction);
|
||||
return editor;
|
||||
});
|
||||
|
||||
Context context(parameters->id);
|
||||
Context context(parameters.id);
|
||||
m_undoAction = new QAction(tr("&Undo"), this);
|
||||
ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, context);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user