forked from qt-creator/qt-creator
VCS: Set user choices on editor reload
Broke by 2c6adc1e74.
Change-Id: Iba435899c7b0da4b270f4ef8ece84c1839bf6b72
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
771d9f222c
commit
a36536813f
@@ -839,14 +839,13 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
|||||||
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
const QString sourceFile = VcsBaseEditor::getSource(workingDir, fileName);
|
||||||
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile,
|
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile,
|
||||||
codecFor(CodecLogOutput), "logTitle", msgArg);
|
codecFor(CodecLogOutput), "logTitle", msgArg);
|
||||||
QStringList effectiveArgs = args;
|
VcsBaseEditorConfig *argWidget = editor->editorConfig();
|
||||||
if (!editor->configurationAdded()) {
|
if (!argWidget) {
|
||||||
auto *argWidget = new GitLogArgumentsWidget(settings(), editor->toolBar());
|
argWidget = new GitLogArgumentsWidget(settings(), editor->toolBar());
|
||||||
argWidget->setBaseArguments(args);
|
argWidget->setBaseArguments(args);
|
||||||
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||||
[=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, argWidget->arguments()); });
|
[=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, args); });
|
||||||
effectiveArgs = argWidget->arguments();
|
editor->setEditorConfig(argWidget);
|
||||||
editor->setConfigurationAdded();
|
|
||||||
}
|
}
|
||||||
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
||||||
editor->setWorkingDirectory(workingDir);
|
editor->setWorkingDirectory(workingDir);
|
||||||
@@ -856,7 +855,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
|||||||
if (logCount > 0)
|
if (logCount > 0)
|
||||||
arguments << "-n" << QString::number(logCount);
|
arguments << "-n" << QString::number(logCount);
|
||||||
|
|
||||||
arguments.append(effectiveArgs);
|
arguments << argWidget->arguments();
|
||||||
|
|
||||||
if (!fileName.isEmpty())
|
if (!fileName.isEmpty())
|
||||||
arguments << "--follow" << "--" << fileName;
|
arguments << "--follow" << "--" << fileName;
|
||||||
@@ -926,22 +925,21 @@ VcsBaseEditorWidget *GitClient::annotate(
|
|||||||
VcsBaseEditorWidget *editor
|
VcsBaseEditorWidget *editor
|
||||||
= createVcsEditor(editorId, title, sourceFile, codecFor(CodecSource, sourceFile),
|
= createVcsEditor(editorId, title, sourceFile, codecFor(CodecSource, sourceFile),
|
||||||
"blameFileName", id);
|
"blameFileName", id);
|
||||||
QStringList effectiveArgs = extraOptions;
|
VcsBaseEditorConfig *argWidget = editor->editorConfig();
|
||||||
if (!editor->configurationAdded()) {
|
if (!argWidget) {
|
||||||
auto *argWidget = new GitBlameArgumentsWidget(settings(), editor->toolBar());
|
argWidget = new GitBlameArgumentsWidget(settings(), editor->toolBar());
|
||||||
argWidget->setBaseArguments(extraOptions);
|
argWidget->setBaseArguments(extraOptions);
|
||||||
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||||
[=] {
|
[=] {
|
||||||
const int line = VcsBaseEditor::lineNumberOfCurrentEditor();
|
const int line = VcsBaseEditor::lineNumberOfCurrentEditor();
|
||||||
annotate(workingDir, file, revision, line, argWidget->arguments());
|
annotate(workingDir, file, revision, line, extraOptions);
|
||||||
} );
|
} );
|
||||||
effectiveArgs = argWidget->arguments();
|
editor->setEditorConfig(argWidget);
|
||||||
editor->setConfigurationAdded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
editor->setWorkingDirectory(workingDir);
|
editor->setWorkingDirectory(workingDir);
|
||||||
QStringList arguments = {"blame", "--root"};
|
QStringList arguments = {"blame", "--root"};
|
||||||
arguments << effectiveArgs << "--" << file;
|
arguments << argWidget->arguments() << "--" << file;
|
||||||
if (!revision.isEmpty())
|
if (!revision.isEmpty())
|
||||||
arguments << revision;
|
arguments << revision;
|
||||||
vcsExec(workingDir, arguments, editor, false, 0, lineNumber);
|
vcsExec(workingDir, arguments, editor, false, 0, lineNumber);
|
||||||
|
|||||||
@@ -1275,7 +1275,7 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
|
|||||||
this, [this](const PerforceDiffParameters &p) { p4Diff(p); });
|
this, [this](const PerforceDiffParameters &p) { p4Diff(p); });
|
||||||
connect(diffEditorWidget, &VcsBaseEditorWidget::diffChunkReverted,
|
connect(diffEditorWidget, &VcsBaseEditorWidget::diffChunkReverted,
|
||||||
pw, &PerforceDiffConfig::triggerReRun);
|
pw, &PerforceDiffConfig::triggerReRun);
|
||||||
diffEditorWidget->setConfigurationAdded();
|
diffEditorWidget->setEditorConfig(pw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforcePlugin::describe(const QString & source, const QString &n)
|
void PerforcePlugin::describe(const QString & source, const QString &n)
|
||||||
|
|||||||
@@ -433,21 +433,26 @@ void VcsBaseClient::diff(const QString &workingDir, const QStringList &files,
|
|||||||
vcsCmdString.toLatin1().constData(), id);
|
vcsCmdString.toLatin1().constData(), id);
|
||||||
editor->setWorkingDirectory(workingDir);
|
editor->setWorkingDirectory(workingDir);
|
||||||
|
|
||||||
QStringList effectiveArgs = extraOptions;
|
VcsBaseEditorConfig *paramWidget = editor->editorConfig();
|
||||||
if (!editor->configurationAdded()) {
|
if (!paramWidget) {
|
||||||
if (VcsBaseEditorConfig *paramWidget = d->createDiffEditor(editor)) {
|
paramWidget = d->createDiffEditor(editor);
|
||||||
|
if (paramWidget) {
|
||||||
|
paramWidget->setBaseArguments(extraOptions);
|
||||||
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
||||||
connect(editor, &VcsBaseEditorWidget::diffChunkReverted,
|
connect(editor, &VcsBaseEditorWidget::diffChunkReverted,
|
||||||
paramWidget, &VcsBaseEditorConfig::executeCommand);
|
paramWidget, &VcsBaseEditorConfig::executeCommand);
|
||||||
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||||
[=] { diff(workingDir, files, extraOptions + paramWidget->arguments()); } );
|
[=] { diff(workingDir, files, extraOptions); } );
|
||||||
effectiveArgs = paramWidget->arguments();
|
editor->setEditorConfig(paramWidget);
|
||||||
editor->setConfigurationAdded();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList args;
|
QStringList args = {vcsCmdString};
|
||||||
args << vcsCmdString << effectiveArgs << files;
|
if (paramWidget)
|
||||||
|
args << paramWidget->arguments();
|
||||||
|
else
|
||||||
|
args << extraOptions;
|
||||||
|
args << files;
|
||||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBaseEditor::getCodec(source);
|
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBaseEditor::getCodec(source);
|
||||||
VcsCommand *command = createCommand(workingDir, editor);
|
VcsCommand *command = createCommand(workingDir, editor);
|
||||||
command->setCodec(codec);
|
command->setCodec(codec);
|
||||||
@@ -468,20 +473,24 @@ void VcsBaseClient::log(const QString &workingDir, const QStringList &files,
|
|||||||
vcsCmdString.toLatin1().constData(), id);
|
vcsCmdString.toLatin1().constData(), id);
|
||||||
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
||||||
|
|
||||||
QStringList effectiveArgs = extraOptions;
|
VcsBaseEditorConfig *paramWidget = editor->editorConfig();
|
||||||
if (!editor->configurationAdded()) {
|
if (!paramWidget) {
|
||||||
if (VcsBaseEditorConfig *paramWidget = d->createLogEditor(editor)) {
|
paramWidget = d->createLogEditor(editor);
|
||||||
|
if (paramWidget) {
|
||||||
|
paramWidget->setBaseArguments(extraOptions);
|
||||||
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
||||||
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||||
[=]() { this->log(workingDir, files, extraOptions + paramWidget->arguments(),
|
[=] { this->log(workingDir, files, extraOptions, enableAnnotationContextMenu); } );
|
||||||
enableAnnotationContextMenu); } );
|
editor->setEditorConfig(paramWidget);
|
||||||
effectiveArgs = paramWidget->arguments();
|
|
||||||
editor->setConfigurationAdded();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList args;
|
QStringList args = {vcsCmdString};
|
||||||
args << vcsCmdString << effectiveArgs << files;
|
if (paramWidget)
|
||||||
|
args << paramWidget->arguments();
|
||||||
|
else
|
||||||
|
args << extraOptions;
|
||||||
|
args << files;
|
||||||
enqueueJob(createCommand(workingDir, editor), args);
|
enqueueJob(createCommand(workingDir, editor), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ public:
|
|||||||
QString m_annotateRevisionTextFormat;
|
QString m_annotateRevisionTextFormat;
|
||||||
QString m_annotatePreviousRevisionTextFormat;
|
QString m_annotatePreviousRevisionTextFormat;
|
||||||
QString m_copyRevisionTextFormat;
|
QString m_copyRevisionTextFormat;
|
||||||
bool m_configurationAdded = false;
|
VcsBaseEditorConfig *m_config = nullptr;
|
||||||
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
||||||
QPointer<VcsCommand> m_command;
|
QPointer<VcsCommand> m_command;
|
||||||
VcsBaseEditorWidget::DescribeFunc m_describeFunc = nullptr;
|
VcsBaseEditorWidget::DescribeFunc m_describeFunc = nullptr;
|
||||||
@@ -1380,14 +1380,14 @@ QString VcsBaseEditor::getTitleId(const QString &workingDirectory,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsBaseEditorWidget::setConfigurationAdded()
|
void VcsBaseEditorWidget::setEditorConfig(VcsBaseEditorConfig *config)
|
||||||
{
|
{
|
||||||
d->m_configurationAdded = true;
|
d->m_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VcsBaseEditorWidget::configurationAdded() const
|
VcsBaseEditorConfig *VcsBaseEditorWidget::editorConfig() const
|
||||||
{
|
{
|
||||||
return d->m_configurationAdded;
|
return d->m_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsBaseEditorWidget::setCommand(VcsCommand *command)
|
void VcsBaseEditorWidget::setCommand(VcsCommand *command)
|
||||||
|
|||||||
@@ -207,8 +207,8 @@ public:
|
|||||||
|
|
||||||
EditorContentType contentType() const;
|
EditorContentType contentType() const;
|
||||||
|
|
||||||
void setConfigurationAdded();
|
void setEditorConfig(VcsBaseEditorConfig *config);
|
||||||
bool configurationAdded() const;
|
VcsBaseEditorConfig *editorConfig() const;
|
||||||
|
|
||||||
void setCommand(VcsCommand *command);
|
void setCommand(VcsCommand *command);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user