From ad3169c3c09056ad42c3698f1359ecab3379aa52 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Tue, 20 Jun 2017 15:18:30 +0200 Subject: [PATCH] src: Fixes for release * clear references count when clearing code view * fixed scrolling to character in overview lists * fixed aggregation activation shown in history menu * fixed same snippet being added twice * Sourcetrail [Trial] as window title * fixed undoing trail expand will always reactivate symbol --- src/lib/Application.cpp | 2 +- .../component/controller/GraphController.cpp | 9 ++++--- .../controller/UndoRedoController.cpp | 26 ++++++++++--------- src/lib_gui/qt/element/QtCodeFile.cpp | 10 +++++++ src/lib_gui/qt/element/QtCodeNavigator.cpp | 2 ++ src/lib_gui/qt/view/QtGraphView.cpp | 2 +- 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/lib/Application.cpp b/src/lib/Application.cpp index ba0d017c..1beb83e3 100644 --- a/src/lib/Application.cpp +++ b/src/lib/Application.cpp @@ -378,7 +378,7 @@ void Application::updateTitle() { if (m_hasGUI) { - std::string title = m_isInTrial ? "Sourcetrail Trial" : "Sourcetrail"; + std::string title = m_isInTrial ? "Sourcetrail [Trial]" : "Sourcetrail"; if (m_project) { diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index 4a641c12..bed96215 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -268,9 +268,12 @@ void GraphController::handleMessage(MessageGraphNodeExpand* message) if (m_graph && m_graph->getTrailMode() != Graph::TRAIL_NONE) { - MessageActivateNodes msg; - msg.addNode(message->tokenId, m_storageAccess->getNameHierarchyForNodeId(message->tokenId)); - msg.dispatch(); + if (!message->isReplayed()) + { + MessageActivateNodes msg; + msg.addNode(message->tokenId, m_storageAccess->getNameHierarchyForNodeId(message->tokenId)); + msg.dispatch(); + } return; } diff --git a/src/lib/component/controller/UndoRedoController.cpp b/src/lib/component/controller/UndoRedoController.cpp index d65ed75a..e6d00f15 100644 --- a/src/lib/component/controller/UndoRedoController.cpp +++ b/src/lib/component/controller/UndoRedoController.cpp @@ -548,6 +548,11 @@ void UndoRedoController::updateHistory() index++; SearchMatch match = getSearchMatchForMessage(it->message.get()); + if (!match.text.size()) + { + continue; + } + if (!firstActiveMessage) { firstActiveMessage = true; @@ -567,20 +572,17 @@ void UndoRedoController::updateHistory() } } - if (match.text.size()) + matches.push_back(match); + + if (matches.size() > historySize) { - matches.push_back(match); + matches.erase(matches.begin()); + m_historyOffset++; + } - if (matches.size() > historySize) - { - matches.erase(matches.begin()); - m_historyOffset++; - } - - if (matches.size() == historySize && currentIndex != -1 && currentIndex - m_historyOffset != historySize - 1) - { - break; - } + if (matches.size() == historySize && currentIndex != -1 && currentIndex - m_historyOffset != historySize - 1) + { + break; } } } diff --git a/src/lib_gui/qt/element/QtCodeFile.cpp b/src/lib_gui/qt/element/QtCodeFile.cpp index 29e65fa8..edcafca7 100644 --- a/src/lib_gui/qt/element/QtCodeFile.cpp +++ b/src/lib_gui/qt/element/QtCodeFile.cpp @@ -131,6 +131,16 @@ std::string QtCodeFile::getFileName() const QtCodeSnippet* QtCodeFile::addCodeSnippet(const CodeSnippetParams& params) { + for (std::shared_ptr snippet : m_snippets) + { + if (snippet->getStartLineNumber() == params.startLineNumber && + snippet->getEndLineNumber() == params.endLineNumber) + { + return snippet.get(); + } + } + + std::shared_ptr snippet(new QtCodeSnippet(params, m_navigator, this)); if (params.reduced) diff --git a/src/lib_gui/qt/element/QtCodeNavigator.cpp b/src/lib_gui/qt/element/QtCodeNavigator.cpp index ecd0a782..1ff90650 100644 --- a/src/lib_gui/qt/element/QtCodeNavigator.cpp +++ b/src/lib_gui/qt/element/QtCodeNavigator.cpp @@ -229,6 +229,8 @@ void QtCodeNavigator::clear() { clearCodeSnippets(); clearCaches(); + + updateRefLabel(); } void QtCodeNavigator::clearCodeSnippets() diff --git a/src/lib_gui/qt/view/QtGraphView.cpp b/src/lib_gui/qt/view/QtGraphView.cpp index 4dd8ab77..deca1787 100644 --- a/src/lib_gui/qt/view/QtGraphView.cpp +++ b/src/lib_gui/qt/view/QtGraphView.cpp @@ -327,7 +327,7 @@ void QtGraphView::pressedCharacterKey(QChar c) Vec2i pos = node->getPosition(); Vec2i size = node->getSize(); - view->ensureVisibleAnimated(QRectF(pos.x, pos.y, size.x, size.y + view->height() / 3 * 2), 100, 100); + view->ensureVisibleAnimated(QRectF(pos.x, pos.y, size.x, size.y + getViewSize().y / 3 * 2), 100, 100); } }