forked from qt-creator/qt-creator
Git: Fix crash on diff
Task-number: QTCREATORBUG-10138 Change-Id: I7c7f054e6253c677b52a3ea24d7ace562f1ad4af Reviewed-by: Jarek Kobus <jaroslaw.kobus@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
f69b994896
commit
9df379e0dc
@@ -1013,15 +1013,14 @@ DiffEditor::DiffEditor *GitClient::createDiffEditor(const char *registerDynamicP
|
||||
* (using the file's codec). Makes use of a dynamic property to find an
|
||||
* existing instance and to reuse it (in case, say, 'git diff foo' is
|
||||
* already open). */
|
||||
VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(const Core::Id &id,
|
||||
QString title,
|
||||
// Source file or directory
|
||||
const QString &source,
|
||||
CodecType codecType,
|
||||
// Dynamic property and value to identify that editor
|
||||
const char *registerDynamicProperty,
|
||||
const QString &dynamicPropertyValue,
|
||||
QWidget *configWidget) const
|
||||
VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(
|
||||
const Core::Id &id,
|
||||
QString title,
|
||||
const QString &source, // Source file or directory
|
||||
CodecType codecType,
|
||||
const char *registerDynamicProperty, // Dynamic property and value to identify that editor
|
||||
const QString &dynamicPropertyValue,
|
||||
VcsBase::VcsBaseEditorParameterWidget *configWidget) const
|
||||
{
|
||||
VcsBase::VcsBaseEditorWidget *rc = 0;
|
||||
QTC_CHECK(!findExistingVCSEditor(registerDynamicProperty, dynamicPropertyValue));
|
||||
@@ -1219,14 +1218,10 @@ void GitClient::diff(const QString &workingDirectory,
|
||||
}
|
||||
vcsEditor->setDiffBaseDirectory(workingDirectory);
|
||||
|
||||
GitFileDiffArgumentsWidget *argWidget = qobject_cast<GitFileDiffArgumentsWidget *>(
|
||||
vcsEditor->configurationWidget());
|
||||
QStringList userDiffArgs = argWidget->arguments();
|
||||
|
||||
QStringList cmdArgs;
|
||||
cmdArgs << QLatin1String("diff")
|
||||
<< QLatin1String(noColorOption)
|
||||
<< userDiffArgs;
|
||||
<< vcsEditor->configurationWidget()->arguments();
|
||||
|
||||
if (!fileName.isEmpty())
|
||||
cmdArgs << QLatin1String("--") << fileName;
|
||||
@@ -1287,14 +1282,10 @@ void GitClient::diffBranch(const QString &workingDirectory,
|
||||
}
|
||||
vcsEditor->setDiffBaseDirectory(workingDirectory);
|
||||
|
||||
GitBranchDiffArgumentsWidget *argWidget = qobject_cast<GitBranchDiffArgumentsWidget *>(
|
||||
vcsEditor->configurationWidget());
|
||||
QStringList userDiffArgs = argWidget->arguments();
|
||||
|
||||
QStringList cmdArgs;
|
||||
cmdArgs << QLatin1String("diff")
|
||||
<< QLatin1String(noColorOption)
|
||||
<< userDiffArgs
|
||||
<< vcsEditor->configurationWidget()->arguments()
|
||||
<< branchName;
|
||||
|
||||
executeGit(workingDirectory, cmdArgs, vcsEditor);
|
||||
@@ -1450,15 +1441,11 @@ void GitClient::show(const QString &source, const QString &id,
|
||||
newEditor = vcsEditor->editor();
|
||||
}
|
||||
|
||||
GitShowArgumentsWidget *argWidget = qobject_cast<GitShowArgumentsWidget *>(
|
||||
vcsEditor->configurationWidget());
|
||||
QStringList userArgs = argWidget->arguments();
|
||||
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("show")
|
||||
<< QLatin1String(noColorOption)
|
||||
<< QLatin1String(decorateOption)
|
||||
<< userArgs
|
||||
<< vcsEditor->configurationWidget()->arguments()
|
||||
<< id;
|
||||
|
||||
vcsEditor->setDiffBaseDirectory(workingDirectory);
|
||||
@@ -1520,12 +1507,9 @@ void GitClient::blame(const QString &workingDirectory,
|
||||
argWidget->setEditor(editor);
|
||||
}
|
||||
|
||||
GitBlameArgumentsWidget *argWidget = qobject_cast<GitBlameArgumentsWidget *>(editor->configurationWidget());
|
||||
QStringList userBlameArgs = argWidget->arguments();
|
||||
|
||||
QStringList arguments(QLatin1String("blame"));
|
||||
arguments << QLatin1String("--root");
|
||||
arguments.append(userBlameArgs);
|
||||
arguments.append(editor->configurationWidget()->arguments());
|
||||
arguments << QLatin1String("--") << fileName;
|
||||
if (!revision.isEmpty())
|
||||
arguments << revision;
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace VcsBase {
|
||||
class Command;
|
||||
class SubmitFileModel;
|
||||
class VcsBaseEditorWidget;
|
||||
class VcsBaseEditorParameterWidget;
|
||||
}
|
||||
|
||||
namespace Utils {
|
||||
@@ -363,7 +364,7 @@ private:
|
||||
CodecType codecType,
|
||||
const char *registerDynamicProperty,
|
||||
const QString &dynamicPropertyValue,
|
||||
QWidget *configWidget) const;
|
||||
VcsBase::VcsBaseEditorParameterWidget *configWidget) const;
|
||||
DiffEditor::DiffEditor *createDiffEditor(const char *registerDynamicProperty,
|
||||
const QString &dynamicPropertyValue,
|
||||
const QString &titlePattern,
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "diffhighlighter.h"
|
||||
#include "baseannotationhighlighter.h"
|
||||
#include "vcsbaseplugin.h"
|
||||
#include "vcsbaseeditorparameterwidget.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
@@ -566,7 +567,7 @@ public:
|
||||
QString m_copyRevisionTextFormat;
|
||||
bool m_fileLogAnnotateEnabled;
|
||||
TextEditor::BaseTextEditor *m_editor;
|
||||
QWidget *m_configurationWidget;
|
||||
VcsBaseEditorParameterWidget *m_configurationWidget;
|
||||
bool m_mouseDragging;
|
||||
QList<AbstractTextCursorHandler *> m_textCursorHandlers;
|
||||
|
||||
@@ -1324,7 +1325,7 @@ QString VcsBaseEditorWidget::getTitleId(const QString &workingDirectory,
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool VcsBaseEditorWidget::setConfigurationWidget(QWidget *w)
|
||||
bool VcsBaseEditorWidget::setConfigurationWidget(VcsBaseEditorParameterWidget *w)
|
||||
{
|
||||
if (!d->m_editor || d->m_configurationWidget)
|
||||
return false;
|
||||
@@ -1335,7 +1336,7 @@ bool VcsBaseEditorWidget::setConfigurationWidget(QWidget *w)
|
||||
return true;
|
||||
}
|
||||
|
||||
QWidget *VcsBaseEditorWidget::configurationWidget() const
|
||||
VcsBaseEditorParameterWidget *VcsBaseEditorWidget::configurationWidget() const
|
||||
{
|
||||
return d->m_configurationWidget;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ class VcsBaseEditorWidgetPrivate;
|
||||
|
||||
class DiffHighlighter;
|
||||
class BaseAnnotationHighlighter;
|
||||
class VcsBaseEditorParameterWidget;
|
||||
|
||||
// Documentation inside
|
||||
enum EditorContentType
|
||||
@@ -183,8 +184,8 @@ public:
|
||||
const QStringList &fileNames,
|
||||
const QString &revision = QString());
|
||||
|
||||
bool setConfigurationWidget(QWidget *w);
|
||||
QWidget *configurationWidget() const;
|
||||
bool setConfigurationWidget(VcsBaseEditorParameterWidget *w);
|
||||
VcsBaseEditorParameterWidget *configurationWidget() const;
|
||||
|
||||
/* Tagging editors: Sometimes, an editor should be re-used, for example, when showing
|
||||
* a diff of the same file with different diff-options. In order to be able to find
|
||||
|
||||
Reference in New Issue
Block a user