From eaf8ccf11840275515deff4a916cd0af9e016cea Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 15 Aug 2019 08:49:50 +0300 Subject: Git: Fix branch expansion on show before the diff display is done MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The description is shown first (with the placeholder), and the diff parsing can be long. If is clicked during parsing, it fails because the base directory is not set yet. Change-Id: Ib5e839b292c32091c726f24eb643d0fa5a142cb7 Reviewed-by: André Hartmann Reviewed-by: Tobias Hunger --- src/plugins/diffeditor/diffeditorcontroller.cpp | 5 +++++ src/plugins/diffeditor/diffeditorcontroller.h | 1 + src/plugins/diffeditor/diffeditordocument.cpp | 8 +++++++- src/plugins/diffeditor/diffeditordocument.h | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/plugins/diffeditor') diff --git a/src/plugins/diffeditor/diffeditorcontroller.cpp b/src/plugins/diffeditor/diffeditorcontroller.cpp index e8cf1730f3..0a82110bbe 100644 --- a/src/plugins/diffeditor/diffeditorcontroller.cpp +++ b/src/plugins/diffeditor/diffeditorcontroller.cpp @@ -55,6 +55,11 @@ QString DiffEditorController::baseDirectory() const return m_document->baseDirectory(); } +void DiffEditorController::setBaseDirectory(const QString &directory) +{ + m_document->setBaseDirectory(directory); +} + int DiffEditorController::contextLineCount() const { return m_document->contextLineCount(); diff --git a/src/plugins/diffeditor/diffeditorcontroller.h b/src/plugins/diffeditor/diffeditorcontroller.h index 4578a7f82a..b32537c0e4 100644 --- a/src/plugins/diffeditor/diffeditorcontroller.h +++ b/src/plugins/diffeditor/diffeditorcontroller.h @@ -48,6 +48,7 @@ public: bool isReloading() const; QString baseDirectory() const; + void setBaseDirectory(const QString &directory); int contextLineCount() const; bool ignoreWhitespace() const; diff --git a/src/plugins/diffeditor/diffeditordocument.cpp b/src/plugins/diffeditor/diffeditordocument.cpp index 8c24d09424..34378d9108 100644 --- a/src/plugins/diffeditor/diffeditordocument.cpp +++ b/src/plugins/diffeditor/diffeditordocument.cpp @@ -113,7 +113,8 @@ void DiffEditorDocument::setDiffFiles(const QList &data, const QString const QString &startupFile) { m_diffFiles = data; - m_baseDirectory = directory; + if (!directory.isEmpty()) + m_baseDirectory = directory; m_startupFile = startupFile; emit documentChanged(); } @@ -128,6 +129,11 @@ QString DiffEditorDocument::baseDirectory() const return m_baseDirectory; } +void DiffEditorDocument::setBaseDirectory(const QString &directory) +{ + m_baseDirectory = directory; +} + QString DiffEditorDocument::startupFile() const { return m_startupFile; diff --git a/src/plugins/diffeditor/diffeditordocument.h b/src/plugins/diffeditor/diffeditordocument.h index a9dff53faa..42657e43f3 100644 --- a/src/plugins/diffeditor/diffeditordocument.h +++ b/src/plugins/diffeditor/diffeditordocument.h @@ -60,6 +60,7 @@ public: const QString &startupFile = QString()); QList diffFiles() const; QString baseDirectory() const; + void setBaseDirectory(const QString &directory); QString startupFile() const; void setDescription(const QString &description); -- cgit v1.2.1