diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2017-05-18 23:08:11 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2017-05-19 04:48:23 +0000 |
commit | a4a146b3cb2165f325adb60d3de417b26542bdf8 (patch) | |
tree | 3388970bba27917431799f27cb8319ffcbb1058c /src/plugins/diffeditor | |
parent | 744285c3fc1e28262efc0572e2135292f62eaa98 (diff) |
Move Git-specific logic from DiffEditor to Git
Change-Id: I29466c26a51844bb975ac3ecb68adf708021aa67
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Diffstat (limited to 'src/plugins/diffeditor')
-rw-r--r-- | src/plugins/diffeditor/diffeditorcontroller.cpp | 34 | ||||
-rw-r--r-- | src/plugins/diffeditor/diffeditorcontroller.h | 4 |
2 files changed, 2 insertions, 36 deletions
diff --git a/src/plugins/diffeditor/diffeditorcontroller.cpp b/src/plugins/diffeditor/diffeditorcontroller.cpp index 891241ced6..4cecb9fa0e 100644 --- a/src/plugins/diffeditor/diffeditorcontroller.cpp +++ b/src/plugins/diffeditor/diffeditorcontroller.cpp @@ -106,11 +106,8 @@ void DiffEditorController::setDescription(const QString &description) m_document->setDescription(description); } -void DiffEditorController::informationForCommitReceived(const QString &output) +void DiffEditorController::branchesReceived(const QString &branches) { - // TODO: Git specific code... - const QString branches = prepareBranchesForCommit(output); - QString tmp = m_document->description(); tmp.replace(QLatin1String(Constants::EXPAND_BRANCHES), branches); m_document->setDescription(tmp); @@ -123,35 +120,6 @@ void DiffEditorController::requestMoreInformation() emit requestInformationForCommit(rev); } -QString DiffEditorController::prepareBranchesForCommit(const QString &output) -{ - // TODO: More git-specific code... - QString moreBranches; - QString branches; - QStringList res; - foreach (const QString &branch, output.split(QLatin1Char('\n'))) { - const QString b = branch.mid(2).trimmed(); - if (!b.isEmpty()) - res << b; - } - const int branchCount = res.count(); - // If there are more than 20 branches, list first 10 followed by a hint - if (branchCount > 20) { - const int leave = 10; - //: Displayed after the untranslated message "Branches: branch1, branch2 'and %n more'" - // in git show. - moreBranches = QLatin1Char(' ') + tr("and %n more", 0, branchCount - leave); - res.erase(res.begin() + leave, res.end()); - } - branches = QLatin1String("Branches: "); - if (res.isEmpty()) - branches += tr("<None>"); - else - branches += res.join(QLatin1String(", ")) + moreBranches; - - return branches; -} - /** * @brief Force the lines of context to the given number. * diff --git a/src/plugins/diffeditor/diffeditorcontroller.h b/src/plugins/diffeditor/diffeditorcontroller.h index 3a88b914bd..49842bcf66 100644 --- a/src/plugins/diffeditor/diffeditorcontroller.h +++ b/src/plugins/diffeditor/diffeditorcontroller.h @@ -59,7 +59,7 @@ public: const QString &displayName); static DiffEditorController *controller(Core::IDocument *document); - void informationForCommitReceived(const QString &output); + void branchesReceived(const QString &branches); signals: void chunkActionsRequested(QMenu *menu, bool isValid); @@ -83,8 +83,6 @@ private: void requestMoreInformation(); void requestChunkActions(QMenu *menu, int diffFileIndex, int chunkIndex); - QString prepareBranchesForCommit(const QString &output); - Internal::DiffEditorDocument *const m_document; bool m_isReloading; |