summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2016-01-05 23:38:08 +0200
committerOrgad Shaneh <orgads@gmail.com>2016-01-06 10:08:34 +0000
commit70958c4c07042af4b8d36c7ebbc7623ecfb60c14 (patch)
tree84facbbcd4f972c2447d0d2f51299e5ea35eda34
parenteb375d734d5303404c6977be188dbf42fcd65356 (diff)
downloadqt-creator-70958c4c07042af4b8d36c7ebbc7623ecfb60c14.tar.gz
Git: Reduce indirection in submit editor
Change-Id: Ic4e897d5c8ec82dbbffd5bd9fe9af84491c4402f Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
-rw-r--r--src/plugins/git/gitplugin.cpp14
-rw-r--r--src/plugins/git/gitplugin.h2
-rw-r--r--src/plugins/git/gitsubmiteditor.cpp11
-rw-r--r--src/plugins/git/gitsubmiteditor.h7
4 files changed, 8 insertions, 26 deletions
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 07394e79c1..b38fe687e0 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -639,16 +639,6 @@ GitVersionControl *GitPlugin::gitVersionControl() const
return static_cast<GitVersionControl *>(versionControl());
}
-void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList &staged)
-{
- m_gitClient->diffFiles(m_submitRepository, unstaged, staged);
-}
-
-void GitPlugin::submitEditorMerge(const QStringList &unmerged)
-{
- m_gitClient->merge(m_submitRepository, unmerged);
-}
-
void GitPlugin::diffCurrentFile()
{
const VcsBasePluginState state = currentState();
@@ -960,10 +950,6 @@ IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &
IDocument *document = submitEditor->document();
document->setPreferredDisplayName(title);
VcsBasePlugin::setSource(document, m_submitRepository);
- connect(submitEditor, &GitSubmitEditor::diff, this, &GitPlugin::submitEditorDiff);
- connect(submitEditor, &GitSubmitEditor::merge, this, &GitPlugin::submitEditorMerge);
- connect(submitEditor, &GitSubmitEditor::show,
- m_gitClient, [this](const QString &wd, const QString &c) { m_gitClient->show(wd, c); });
return editor;
}
diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h
index b7443cd73f..96fe7119e6 100644
--- a/src/plugins/git/gitplugin.h
+++ b/src/plugins/git/gitplugin.h
@@ -113,8 +113,6 @@ private slots:
private:
void diffCurrentFile();
void diffCurrentProject();
- void submitEditorDiff(const QStringList &unstaged, const QStringList &staged);
- void submitEditorMerge(const QStringList &unmerged);
void submitCurrentLog();
void logFile();
void blameFile();
diff --git a/src/plugins/git/gitsubmiteditor.cpp b/src/plugins/git/gitsubmiteditor.cpp
index faf16c783f..047e1c45e5 100644
--- a/src/plugins/git/gitsubmiteditor.cpp
+++ b/src/plugins/git/gitsubmiteditor.cpp
@@ -132,7 +132,8 @@ GitSubmitEditor::GitSubmitEditor(const VcsBaseSubmitEditorParameters *parameters
m_commitEncoding(0),
m_commitType(SimpleCommit),
m_firstUpdate(true),
- m_commitDataFetcher(0)
+ m_commitDataFetcher(0),
+ m_gitClient(GitPlugin::instance()->client())
{
connect(this, &VcsBaseSubmitEditor::diffSelectedRows, this, &GitSubmitEditor::slotDiffSelected);
connect(submitEditorWidget(), &GitSubmitEditorWidget::show, this, &GitSubmitEditor::showCommit);
@@ -242,15 +243,15 @@ void GitSubmitEditor::slotDiffSelected(const QList<int> &rows)
}
}
if (!unstagedFiles.empty() || !stagedFiles.empty())
- emit diff(unstagedFiles, stagedFiles);
+ m_gitClient->diffFiles(m_workingDirectory, unstagedFiles, stagedFiles);
if (!unmergedFiles.empty())
- emit merge(unmergedFiles);
+ m_gitClient->merge(m_workingDirectory, unmergedFiles);
}
void GitSubmitEditor::showCommit(const QString &commit)
{
if (!m_workingDirectory.isEmpty())
- emit show(m_workingDirectory, commit);
+ m_gitClient->show(m_workingDirectory, commit);
}
void GitSubmitEditor::updateFileModel()
@@ -271,7 +272,7 @@ void GitSubmitEditor::updateFileModel()
QFuture<void> future = QtConcurrent::run(m_commitDataFetcher, &CommitDataFetcher::start);
Core::ProgressManager::addTask(future, tr("Refreshing Commit Data"), TASK_UPDATE_COMMIT);
- GitPlugin::instance()->client()->addFuture(future);
+ m_gitClient->addFuture(future);
}
void GitSubmitEditor::forceUpdateFileModel()
diff --git a/src/plugins/git/gitsubmiteditor.h b/src/plugins/git/gitsubmiteditor.h
index 24d85035d5..5224f29ae7 100644
--- a/src/plugins/git/gitsubmiteditor.h
+++ b/src/plugins/git/gitsubmiteditor.h
@@ -42,6 +42,7 @@ namespace VcsBase { class SubmitFileModel; }
namespace Git {
namespace Internal {
+class GitClient;
class GitSubmitEditorWidget;
class CommitData;
class CommitDataFetcher;
@@ -59,11 +60,6 @@ public:
CommitType commitType() const { return m_commitType; }
QString amendSHA1() const;
-signals:
- void diff(const QStringList &unstagedFiles, const QStringList &stagedFiles);
- void merge(const QStringList &unmergedFiles);
- void show(const QString &workingDirectory, const QString &commit);
-
protected:
QByteArray fileContents() const override;
void updateFileModel() override;
@@ -85,6 +81,7 @@ private:
QString m_workingDirectory;
bool m_firstUpdate;
CommitDataFetcher *m_commitDataFetcher;
+ GitClient *m_gitClient;
};
} // namespace Internal