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: ...@@ -46,6 +46,7 @@ public:
~DiffEditorReloader(); ~DiffEditorReloader();
bool isReloading() const; bool isReloading() const;
DiffEditorController *controller() const;
public slots: public slots:
void requestReload(); void requestReload();
...@@ -55,7 +56,6 @@ protected: ...@@ -55,7 +56,6 @@ protected:
// inside reload() (for synchronous reload) // inside reload() (for synchronous reload)
// or later (for asynchronous reload) // or later (for asynchronous reload)
virtual void reload() = 0; virtual void reload() = 0;
DiffEditorController *controller() const;
void setController(DiffEditorController *controller); void setController(DiffEditorController *controller);
protected slots: protected slots:
......
This diff is collapsed.
...@@ -71,6 +71,7 @@ namespace Git { ...@@ -71,6 +71,7 @@ namespace Git {
namespace Internal { namespace Internal {
class CommitData; class CommitData;
class GitDiffEditorReloader;
struct GitSubmitEditorPanelData; struct GitSubmitEditorPanelData;
class Stash; class Stash;
...@@ -143,10 +144,13 @@ public: ...@@ -143,10 +144,13 @@ public:
QString findGitDirForRepository(const QString &repositoryDir) const; QString findGitDirForRepository(const QString &repositoryDir) const;
bool managesFile(const QString &workingDirectory, const QString &fileName) const; bool managesFile(const QString &workingDirectory, const QString &fileName) const;
void diff(const QString &workingDirectory, const QString &fileName) const; void diffFile(const QString &workingDirectory, const QString &fileName) const;
void diff(const QString &workingDirectory, void diffFiles(const QString &workingDirectory,
const QStringList &unstagedFileNames, const QStringList &unstagedFileNames,
const QStringList &stagedFileNames = QStringList()) const; const QStringList &stagedFileNames) const;
void diffProject(const QString &workingDirectory,
const QString &projectDirectory) const;
void diffRepository(const QString &workingDirectory) const;
void diffBranch(const QString &workingDirectory, void diffBranch(const QString &workingDirectory,
const QString &branchName) const; const QString &branchName) const;
void merge(const QString &workingDirectory, const QStringList &unmergedFileNames = QStringList()); void merge(const QString &workingDirectory, const QStringList &unmergedFileNames = QStringList());
...@@ -363,6 +367,7 @@ private: ...@@ -363,6 +367,7 @@ private:
const QString &dynamicPropertyValue) const; const QString &dynamicPropertyValue) const;
enum CodecType { CodecSource, CodecLogOutput, CodecNone }; enum CodecType { CodecSource, CodecLogOutput, CodecNone };
VcsBase::VcsBaseEditorWidget *createVcsEditor(Core::Id kind, VcsBase::VcsBaseEditorWidget *createVcsEditor(Core::Id kind,
QString title, QString title,
const QString &source, const QString &source,
...@@ -370,9 +375,11 @@ private: ...@@ -370,9 +375,11 @@ private:
const char *registerDynamicProperty, const char *registerDynamicProperty,
const QString &dynamicPropertyValue, const QString &dynamicPropertyValue,
VcsBase::VcsBaseEditorParameterWidget *configWidget) const; VcsBase::VcsBaseEditorParameterWidget *configWidget) const;
DiffEditor::DiffEditorDocument *createDiffEditor(const QString &documentId,
const QString &source, GitDiffEditorReloader *findOrCreateDiffEditor(const QString &documentId,
const QString &title) const; const QString &source,
const QString &title,
const QString &workingDirectory) const;
VcsBase::VcsCommand *createCommand(const QString &workingDirectory, VcsBase::VcsCommand *createCommand(const QString &workingDirectory,
VcsBase::VcsBaseEditorWidget* editor = 0, VcsBase::VcsBaseEditorWidget* editor = 0,
......
...@@ -677,7 +677,7 @@ GitVersionControl *GitPlugin::gitVersionControl() const ...@@ -677,7 +677,7 @@ GitVersionControl *GitPlugin::gitVersionControl() const
void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList &staged) 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) void GitPlugin::submitEditorMerge(const QStringList &unmerged)
...@@ -689,7 +689,7 @@ void GitPlugin::diffCurrentFile() ...@@ -689,7 +689,7 @@ void GitPlugin::diffCurrentFile()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return); QTC_ASSERT(state.hasFile(), return);
m_gitClient->diff(state.currentFileTopLevel(), state.relativeCurrentFile()); m_gitClient->diffFile(state.currentFileTopLevel(), state.relativeCurrentFile());
} }
void GitPlugin::diffCurrentProject() void GitPlugin::diffCurrentProject()
...@@ -697,15 +697,17 @@ void GitPlugin::diffCurrentProject() ...@@ -697,15 +697,17 @@ void GitPlugin::diffCurrentProject()
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return); QTC_ASSERT(state.hasProject(), return);
const QString relativeProject = state.relativeCurrentProject(); const QString relativeProject = state.relativeCurrentProject();
m_gitClient->diff(state.currentProjectTopLevel(), if (relativeProject.isEmpty())
relativeProject.isEmpty() ? QStringList() : QStringList(relativeProject)); m_gitClient->diffRepository(state.currentProjectTopLevel());
else
m_gitClient->diffProject(state.currentProjectTopLevel(), relativeProject);
} }
void GitPlugin::diffRepository() void GitPlugin::diffRepository()
{ {
const VcsBasePluginState state = currentState(); const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return); QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->diff(state.topLevel(), QStringList()); m_gitClient->diffRepository(state.topLevel());
} }
void GitPlugin::logFile() 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