Commit ee2023ef authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Git: Deduplicate diff editor creation sequence

Change-Id: I9d0751726f0acb340f9b19be62c6bbe23ec460f7
Reviewed-by: default avatarJarek Kobus <jaroslaw.kobus@digia.com>
parent 127d3b96
......@@ -46,6 +46,7 @@ public:
~DiffEditorReloader();
bool isReloading() const;
DiffEditorController *controller() const;
public slots:
void requestReload();
......@@ -55,7 +56,6 @@ protected:
// inside reload() (for synchronous reload)
// or later (for asynchronous reload)
virtual void reload() = 0;
DiffEditorController *controller() const;
void setController(DiffEditorController *controller);
protected slots:
......
This diff is collapsed.
......@@ -71,6 +71,7 @@ namespace Git {
namespace Internal {
class CommitData;
class GitDiffEditorReloader;
struct GitSubmitEditorPanelData;
class Stash;
......@@ -143,10 +144,13 @@ public:
QString findGitDirForRepository(const QString &repositoryDir) const;
bool managesFile(const QString &workingDirectory, const QString &fileName) const;
void diff(const QString &workingDirectory, const QString &fileName) const;
void diff(const QString &workingDirectory,
const QStringList &unstagedFileNames,
const QStringList &stagedFileNames = QStringList()) const;
void diffFile(const QString &workingDirectory, const QString &fileName) const;
void diffFiles(const QString &workingDirectory,
const QStringList &unstagedFileNames,
const QStringList &stagedFileNames) const;
void diffProject(const QString &workingDirectory,
const QString &projectDirectory) const;
void diffRepository(const QString &workingDirectory) const;
void diffBranch(const QString &workingDirectory,
const QString &branchName) const;
void merge(const QString &workingDirectory, const QStringList &unmergedFileNames = QStringList());
......@@ -363,6 +367,7 @@ private:
const QString &dynamicPropertyValue) const;
enum CodecType { CodecSource, CodecLogOutput, CodecNone };
VcsBase::VcsBaseEditorWidget *createVcsEditor(Core::Id kind,
QString title,
const QString &source,
......@@ -370,9 +375,11 @@ private:
const char *registerDynamicProperty,
const QString &dynamicPropertyValue,
VcsBase::VcsBaseEditorParameterWidget *configWidget) const;
DiffEditor::DiffEditorDocument *createDiffEditor(const QString &documentId,
const QString &source,
const QString &title) const;
GitDiffEditorReloader *findOrCreateDiffEditor(const QString &documentId,
const QString &source,
const QString &title,
const QString &workingDirectory) const;
VcsBase::VcsCommand *createCommand(const QString &workingDirectory,
VcsBase::VcsBaseEditorWidget* editor = 0,
......
......@@ -677,7 +677,7 @@ GitVersionControl *GitPlugin::gitVersionControl() const
void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList &staged)
{
m_gitClient->diff(m_submitRepository, unstaged, staged);
m_gitClient->diffFiles(m_submitRepository, unstaged, staged);
}
void GitPlugin::submitEditorMerge(const QStringList &unmerged)
......@@ -689,7 +689,7 @@ void GitPlugin::diffCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return);
m_gitClient->diff(state.currentFileTopLevel(), state.relativeCurrentFile());
m_gitClient->diffFile(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void GitPlugin::diffCurrentProject()
......@@ -697,15 +697,17 @@ void GitPlugin::diffCurrentProject()
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return);
const QString relativeProject = state.relativeCurrentProject();
m_gitClient->diff(state.currentProjectTopLevel(),
relativeProject.isEmpty() ? QStringList() : QStringList(relativeProject));
if (relativeProject.isEmpty())
m_gitClient->diffRepository(state.currentProjectTopLevel());
else
m_gitClient->diffProject(state.currentProjectTopLevel(), relativeProject);
}
void GitPlugin::diffRepository()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->diff(state.topLevel(), QStringList());
m_gitClient->diffRepository(state.topLevel());
}
void GitPlugin::logFile()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment