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);
|
||||
VcsBaseEditorWidget *editor = createVcsEditor(editorId, title, sourceFile,
|
||||
codecFor(CodecLogOutput), "logTitle", msgArg);
|
||||
QStringList effectiveArgs = args;
|
||||
if (!editor->configurationAdded()) {
|
||||
auto *argWidget = new GitLogArgumentsWidget(settings(), editor->toolBar());
|
||||
VcsBaseEditorConfig *argWidget = editor->editorConfig();
|
||||
if (!argWidget) {
|
||||
argWidget = new GitLogArgumentsWidget(settings(), editor->toolBar());
|
||||
argWidget->setBaseArguments(args);
|
||||
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||
[=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, argWidget->arguments()); });
|
||||
effectiveArgs = argWidget->arguments();
|
||||
editor->setConfigurationAdded();
|
||||
[=]() { this->log(workingDir, fileName, enableAnnotationContextMenu, args); });
|
||||
editor->setEditorConfig(argWidget);
|
||||
}
|
||||
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
||||
editor->setWorkingDirectory(workingDir);
|
||||
@@ -856,7 +855,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName,
|
||||
if (logCount > 0)
|
||||
arguments << "-n" << QString::number(logCount);
|
||||
|
||||
arguments.append(effectiveArgs);
|
||||
arguments << argWidget->arguments();
|
||||
|
||||
if (!fileName.isEmpty())
|
||||
arguments << "--follow" << "--" << fileName;
|
||||
@@ -926,22 +925,21 @@ VcsBaseEditorWidget *GitClient::annotate(
|
||||
VcsBaseEditorWidget *editor
|
||||
= createVcsEditor(editorId, title, sourceFile, codecFor(CodecSource, sourceFile),
|
||||
"blameFileName", id);
|
||||
QStringList effectiveArgs = extraOptions;
|
||||
if (!editor->configurationAdded()) {
|
||||
auto *argWidget = new GitBlameArgumentsWidget(settings(), editor->toolBar());
|
||||
VcsBaseEditorConfig *argWidget = editor->editorConfig();
|
||||
if (!argWidget) {
|
||||
argWidget = new GitBlameArgumentsWidget(settings(), editor->toolBar());
|
||||
argWidget->setBaseArguments(extraOptions);
|
||||
connect(argWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||
[=] {
|
||||
const int line = VcsBaseEditor::lineNumberOfCurrentEditor();
|
||||
annotate(workingDir, file, revision, line, argWidget->arguments());
|
||||
annotate(workingDir, file, revision, line, extraOptions);
|
||||
} );
|
||||
effectiveArgs = argWidget->arguments();
|
||||
editor->setConfigurationAdded();
|
||||
editor->setEditorConfig(argWidget);
|
||||
}
|
||||
|
||||
editor->setWorkingDirectory(workingDir);
|
||||
QStringList arguments = {"blame", "--root"};
|
||||
arguments << effectiveArgs << "--" << file;
|
||||
arguments << argWidget->arguments() << "--" << file;
|
||||
if (!revision.isEmpty())
|
||||
arguments << revision;
|
||||
vcsExec(workingDir, arguments, editor, false, 0, lineNumber);
|
||||
|
||||
@@ -1275,7 +1275,7 @@ void PerforcePlugin::p4Diff(const PerforceDiffParameters &p)
|
||||
this, [this](const PerforceDiffParameters &p) { p4Diff(p); });
|
||||
connect(diffEditorWidget, &VcsBaseEditorWidget::diffChunkReverted,
|
||||
pw, &PerforceDiffConfig::triggerReRun);
|
||||
diffEditorWidget->setConfigurationAdded();
|
||||
diffEditorWidget->setEditorConfig(pw);
|
||||
}
|
||||
|
||||
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);
|
||||
editor->setWorkingDirectory(workingDir);
|
||||
|
||||
QStringList effectiveArgs = extraOptions;
|
||||
if (!editor->configurationAdded()) {
|
||||
if (VcsBaseEditorConfig *paramWidget = d->createDiffEditor(editor)) {
|
||||
VcsBaseEditorConfig *paramWidget = editor->editorConfig();
|
||||
if (!paramWidget) {
|
||||
paramWidget = d->createDiffEditor(editor);
|
||||
if (paramWidget) {
|
||||
paramWidget->setBaseArguments(extraOptions);
|
||||
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
||||
connect(editor, &VcsBaseEditorWidget::diffChunkReverted,
|
||||
paramWidget, &VcsBaseEditorConfig::executeCommand);
|
||||
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||
[=] { diff(workingDir, files, extraOptions + paramWidget->arguments()); } );
|
||||
effectiveArgs = paramWidget->arguments();
|
||||
editor->setConfigurationAdded();
|
||||
[=] { diff(workingDir, files, extraOptions); } );
|
||||
editor->setEditorConfig(paramWidget);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList args;
|
||||
args << vcsCmdString << effectiveArgs << files;
|
||||
QStringList args = {vcsCmdString};
|
||||
if (paramWidget)
|
||||
args << paramWidget->arguments();
|
||||
else
|
||||
args << extraOptions;
|
||||
args << files;
|
||||
QTextCodec *codec = source.isEmpty() ? static_cast<QTextCodec *>(0) : VcsBaseEditor::getCodec(source);
|
||||
VcsCommand *command = createCommand(workingDir, editor);
|
||||
command->setCodec(codec);
|
||||
@@ -468,20 +473,24 @@ void VcsBaseClient::log(const QString &workingDir, const QStringList &files,
|
||||
vcsCmdString.toLatin1().constData(), id);
|
||||
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
|
||||
|
||||
QStringList effectiveArgs = extraOptions;
|
||||
if (!editor->configurationAdded()) {
|
||||
if (VcsBaseEditorConfig *paramWidget = d->createLogEditor(editor)) {
|
||||
VcsBaseEditorConfig *paramWidget = editor->editorConfig();
|
||||
if (!paramWidget) {
|
||||
paramWidget = d->createLogEditor(editor);
|
||||
if (paramWidget) {
|
||||
paramWidget->setBaseArguments(extraOptions);
|
||||
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
||||
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||
[=]() { this->log(workingDir, files, extraOptions + paramWidget->arguments(),
|
||||
enableAnnotationContextMenu); } );
|
||||
effectiveArgs = paramWidget->arguments();
|
||||
editor->setConfigurationAdded();
|
||||
[=] { this->log(workingDir, files, extraOptions, enableAnnotationContextMenu); } );
|
||||
editor->setEditorConfig(paramWidget);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList args;
|
||||
args << vcsCmdString << effectiveArgs << files;
|
||||
QStringList args = {vcsCmdString};
|
||||
if (paramWidget)
|
||||
args << paramWidget->arguments();
|
||||
else
|
||||
args << extraOptions;
|
||||
args << files;
|
||||
enqueueJob(createCommand(workingDir, editor), args);
|
||||
}
|
||||
|
||||
|
||||
@@ -559,7 +559,7 @@ public:
|
||||
QString m_annotateRevisionTextFormat;
|
||||
QString m_annotatePreviousRevisionTextFormat;
|
||||
QString m_copyRevisionTextFormat;
|
||||
bool m_configurationAdded = false;
|
||||
VcsBaseEditorConfig *m_config = nullptr;
|
||||
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
||||
QPointer<VcsCommand> m_command;
|
||||
VcsBaseEditorWidget::DescribeFunc m_describeFunc = nullptr;
|
||||
@@ -1380,14 +1380,14 @@ QString VcsBaseEditor::getTitleId(const QString &workingDirectory,
|
||||
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)
|
||||
|
||||
@@ -207,8 +207,8 @@ public:
|
||||
|
||||
EditorContentType contentType() const;
|
||||
|
||||
void setConfigurationAdded();
|
||||
bool configurationAdded() const;
|
||||
void setEditorConfig(VcsBaseEditorConfig *config);
|
||||
VcsBaseEditorConfig *editorConfig() const;
|
||||
|
||||
void setCommand(VcsCommand *command);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user