diff --git a/bin/app/data/gui/setting_window/window.css b/bin/app/data/gui/setting_window/window.css index 09b1e20b..7ae5d71a 100644 --- a/bin/app/data/gui/setting_window/window.css +++ b/bin/app/data/gui/setting_window/window.css @@ -24,7 +24,7 @@ QLineEdit:disabled { } #form { - background-color: rgba(255, 255, 255, 220); + background-color: rgba(255, 255, 255, 150); } #form QLabel { diff --git a/bin/app/data/gui/startscreen/cpluspluss_icon.png b/bin/app/data/gui/startscreen/cpluspluss_icon.png deleted file mode 100755 index d2736e26..00000000 Binary files a/bin/app/data/gui/startscreen/cpluspluss_icon.png and /dev/null differ diff --git a/bin/app/data/gui/startscreen/file_icon.png b/bin/app/data/gui/startscreen/file_icon.png deleted file mode 100755 index 74c283d3..00000000 Binary files a/bin/app/data/gui/startscreen/file_icon.png and /dev/null differ diff --git a/bin/app/data/gui/startscreen/icon_file.png b/bin/app/data/gui/startscreen/icon_file.png deleted file mode 100644 index f41fe71c..00000000 Binary files a/bin/app/data/gui/startscreen/icon_file.png and /dev/null differ diff --git a/bin/app/data/gui/startscreen/logo.png b/bin/app/data/gui/startscreen/logo.png old mode 100755 new mode 100644 index 2c45335a..ce630305 Binary files a/bin/app/data/gui/startscreen/logo.png and b/bin/app/data/gui/startscreen/logo.png differ diff --git a/bin/app/data/gui/startscreen/logo_blurry.png b/bin/app/data/gui/startscreen/logo_blurry.png new file mode 100644 index 00000000..13eec631 Binary files /dev/null and b/bin/app/data/gui/startscreen/logo_blurry.png differ diff --git a/bin/app/data/gui/startscreen/logo_schriftzug.png b/bin/app/data/gui/startscreen/logo_schriftzug.png deleted file mode 100755 index ac955102..00000000 Binary files a/bin/app/data/gui/startscreen/logo_schriftzug.png and /dev/null differ diff --git a/bin/app/data/gui/startscreen/logo_white.png b/bin/app/data/gui/startscreen/logo_white.png deleted file mode 100644 index 00712bca..00000000 Binary files a/bin/app/data/gui/startscreen/logo_white.png and /dev/null differ diff --git a/src/app/qt/element/QtAutocompletionList.cpp b/src/app/qt/element/QtAutocompletionList.cpp index 19e42755..0b7375d8 100644 --- a/src/app/qt/element/QtAutocompletionList.cpp +++ b/src/app/qt/element/QtAutocompletionList.cpp @@ -44,7 +44,7 @@ QVariant QtAutocompletionModel::data(const QModelIndex &index, int role) const switch (index.column()) { case 0: - return QString::fromStdString(match.fullName); + return QString::fromStdString(match.getFullName()); case 1: return QString::fromStdString(match.typeName); case 2: diff --git a/src/app/qt/element/QtSmartSearchBox.cpp b/src/app/qt/element/QtSmartSearchBox.cpp index 5070cec1..08893d26 100644 --- a/src/app/qt/element/QtSmartSearchBox.cpp +++ b/src/app/qt/element/QtSmartSearchBox.cpp @@ -395,7 +395,7 @@ void QtSmartSearchBox::onTextEdited(const QString& text) } } - if (match.fullName.size() && !m_allowMultipleElements) + if (match.nameHierarchy.size() && !m_allowMultipleElements) { clearMatches(); matchesChanged = true; @@ -403,7 +403,7 @@ void QtSmartSearchBox::onTextEdited(const QString& text) if (matchesChanged) { - setEditText(QString::fromStdString(match.fullName)); + setEditText(QString::fromStdString(match.getFullName())); updateElements(); } else @@ -411,7 +411,7 @@ void QtSmartSearchBox::onTextEdited(const QString& text) layoutElements(); } - if (match.fullName.size() || m_elements.size()) + if (match.nameHierarchy.size() || m_elements.size()) { requestAutoCompletions(); } @@ -442,7 +442,7 @@ void QtSmartSearchBox::onAutocompletionActivated(const SearchMatch& match) { addMatchAndUpdate(match); - if (match.fullName.size()) + if (match.nameHierarchy.size()) { search(); } @@ -512,7 +512,7 @@ void QtSmartSearchBox::moveCursorTo(int target) void QtSmartSearchBox::addMatch(const SearchMatch& match) { - if (!match.fullName.size()) + if (!match.nameHierarchy.size()) { return; } @@ -522,7 +522,7 @@ void QtSmartSearchBox::addMatch(const SearchMatch& match) if (completer()->popup()->isVisible()) { const SearchMatch* mPtr = dynamic_cast(completer())->getSearchMatchAt(0); - if (mPtr && utility::equalsCaseInsensitive(match.fullName, mPtr->fullName)) + if (mPtr && utility::equalsCaseInsensitive(match.getFullName(), mPtr->getFullName())) { matchPtr = mPtr; } @@ -539,7 +539,7 @@ void QtSmartSearchBox::addMatch(const SearchMatch& match) void QtSmartSearchBox::addMatchAndUpdate(const SearchMatch& match) { - if (match.fullName.size()) + if (match.nameHierarchy.size()) { m_oldText.clear(); clearLineEdit(); @@ -586,7 +586,7 @@ void QtSmartSearchBox::editElement(QtSearchElement* element) } } - std::string name = m_matches[m_cursorIndex].fullName; + std::string name = m_matches[m_cursorIndex].getFullName(); m_matches.erase(m_matches.begin() + m_cursorIndex); setEditText(QString::fromStdString(name)); @@ -605,7 +605,7 @@ void QtSmartSearchBox::updateElements() for (const SearchMatch& match : m_matches) { - std::string name = match.fullName; + std::string name = match.getFullName(); name = utility::replace(name, "&", "&&"); std::shared_ptr element = std::make_shared(QString::fromStdString(name), this); @@ -739,7 +739,7 @@ std::string QtSmartSearchBox::getSelectedString() const { if (m_elements[i]->isChecked()) { - str += m_matches[i].fullName; + str += m_matches[i].getFullName(); } } return str; diff --git a/src/app/qt/view/graphElements/QtGraphNodeData.cpp b/src/app/qt/view/graphElements/QtGraphNodeData.cpp index 14070b71..30be1b8e 100644 --- a/src/app/qt/view/graphElements/QtGraphNodeData.cpp +++ b/src/app/qt/view/graphElements/QtGraphNodeData.cpp @@ -45,7 +45,7 @@ Id QtGraphNodeData::getTokenId() const void QtGraphNodeData::onClick() { MessageActivateNodes message; - message.addNode(m_data->getId(), m_data->getType(), m_data->getFullName()); + message.addNode(m_data->getId(), m_data->getType(), m_data->getNameHierarchy()); message.dispatch(); } diff --git a/src/app/qt/window/QtSettingsWindow.cpp b/src/app/qt/window/QtSettingsWindow.cpp index 08fe738e..939a0daf 100644 --- a/src/app/qt/window/QtSettingsWindow.cpp +++ b/src/app/qt/window/QtSettingsWindow.cpp @@ -36,7 +36,6 @@ QtSettingsWindow::QtSettingsWindow(QWidget *parent, int displacement) "border: 1px solid lightgray;" "border-radius: 15px; " "background: white; " - "background-image: url(:/data/gui/icon/logo_1024_1024.png); " "}"; m_window->setStyleSheet(frameStyle.c_str()); m_window->setObjectName("SettingWindow"); @@ -106,7 +105,7 @@ void QtSettingsWindow::mouseReleaseEvent(QMouseEvent *event) void QtSettingsWindow::setupForm() { - QtDeviceScaledPixmap coati_logo("data/gui/startscreen/logo.png"); + QtDeviceScaledPixmap coati_logo("data/gui/startscreen/logo_blurry.png"); coati_logo.scaleToWidth(400); QLabel* coatiLogoLabel = new QLabel(m_window); coatiLogoLabel->setPixmap(coati_logo.pixmap()); diff --git a/src/app/qt/window/QtStartScreen.cpp b/src/app/qt/window/QtStartScreen.cpp index d867dce2..dd18b8a8 100644 --- a/src/app/qt/window/QtStartScreen.cpp +++ b/src/app/qt/window/QtStartScreen.cpp @@ -34,7 +34,7 @@ void QtStartScreen::setup() { setStyleSheet(utility::getStyleSheet("data/gui/startscreen/startscreen.css").c_str()); - QtDeviceScaledPixmap coati_logo("data/gui/startscreen/logo_schriftzug.png"); + QtDeviceScaledPixmap coati_logo("data/gui/startscreen/logo.png"); coati_logo.scaleToWidth(200); QLabel* coatiLogoLabel = new QLabel(this); coatiLogoLabel->setPixmap(coati_logo.pixmap()); @@ -58,7 +58,7 @@ void QtStartScreen::setup() recentProjectsLabel->setObjectName("recentLabel"); int position = 290; - QIcon cpp_icon("data/gui/startscreen/Icon_CPP.png"); + QIcon cpp_icon("data/gui/startscreen/icon_cpp.png"); std::vector recentProjects = ApplicationSettings::getInstance()->getRecentProjects(); for (size_t i = 0; i < recentProjects.size() && i < 7; i++) { diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index a53ece25..255d7cf8 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -297,7 +297,6 @@ add_files( utility/utility.h utility/utilityString.cpp utility/utilityString.h - utility/Vector.h Application.cpp Application.h diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index b8800b4e..3e0a8d4a 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -218,6 +218,7 @@ DummyNode GraphController::createDummyNodeTopDown(Node* node) result.topLevelAncestorId = parent->getId(); } + // Expand nodes that were expanded before. DummyNode* oldNode = findDummyNodeRecursive(m_dummyNodes, node->getId()); if (oldNode) { @@ -300,7 +301,7 @@ void GraphController::autoExpandActiveNode(const std::vector& activeTokenIds node = findDummyNodeRecursive(m_dummyNodes, activeTokenIds[0]); } - if (node && node->data->isType(Node::NODE_CLASS | Node::NODE_STRUCT | Node::NODE_ENUM)) + if (node) { node->expanded = true; } @@ -414,7 +415,7 @@ void GraphController::bundleNodes() return isTypeNodeWithSingleAggregation(node, TokenComponentAggregation::DIRECTION_BACKWARD); }, 3, - "Used Types" + "Referenced Types" ); bundleNodesMatching( @@ -423,7 +424,7 @@ void GraphController::bundleNodes() return isTypeNodeWithSingleAggregation(node, TokenComponentAggregation::DIRECTION_FORWARD); }, 3, - "Using Types" + "Referencing Types" ); bundleNodesMatching( @@ -458,7 +459,7 @@ void GraphController::bundleNodes() return false; }, - 3, + 1, "Undefined Symbols" ); } diff --git a/src/lib/component/controller/helper/BucketGrid.cpp b/src/lib/component/controller/helper/BucketGrid.cpp index fd3f1329..3cd3f1d6 100644 --- a/src/lib/component/controller/helper/BucketGrid.cpp +++ b/src/lib/component/controller/helper/BucketGrid.cpp @@ -152,6 +152,11 @@ void BucketGrid::createBuckets(std::vector& nodes, const std::vector< DummyNode* owner = findTopMostDummyNodeRecursive(nodes, edge->ownerId); DummyNode* target = findTopMostDummyNodeRecursive(nodes, edge->targetId); + if (edge->getDirection() == TokenComponentAggregation::DIRECTION_BACKWARD) + { + std::swap(owner, target); + } + bool removeEdge = false; if (!owner || !target) { diff --git a/src/lib/data/SqliteStorage.cpp b/src/lib/data/SqliteStorage.cpp index 77f5c60c..1adb5694 100644 --- a/src/lib/data/SqliteStorage.cpp +++ b/src/lib/data/SqliteStorage.cpp @@ -497,7 +497,7 @@ Id SqliteStorage::getNameHierarchyElementIdByName(const std::string& name, Id pa else { return getFirstResult( - "SELECT id FROM name_hierarchy_element WHERE name == '" + name + "';" + "SELECT id FROM name_hierarchy_element WHERE name == '" + name + "' AND parent_id IS NULL;" ); } } @@ -540,14 +540,22 @@ NameHierarchy SqliteStorage::getNameHierarchyById(const Id id) const "SELECT name, parent_id FROM name_hierarchy_element WHERE id == " + std::to_string(id) + ";" ).c_str()); - const std::string elementName = q.getStringField(0, ""); - const Id parentId = q.getIntField(1, 0); + NameHierarchy nameHierarchy; - NameHierarchy nameHierarchy = (parentId > 0) ? getNameHierarchyById(parentId) : NameHierarchy(); - - if (elementName.size() > 0) + if (!q.eof()) { - nameHierarchy.push(std::make_shared(elementName)); + const std::string elementName = q.getStringField(0, ""); + const Id parentId = q.getIntField(1, 0); + + if (parentId > 0) + { + nameHierarchy = getNameHierarchyById(parentId); + } + + if (elementName.size() > 0) + { + nameHierarchy.push(std::make_shared(elementName)); + } } return nameHierarchy; diff --git a/src/lib/data/Storage.cpp b/src/lib/data/Storage.cpp index 372c3371..b86b4c07 100644 --- a/src/lib/data/Storage.cpp +++ b/src/lib/data/Storage.cpp @@ -719,14 +719,7 @@ Id Storage::getIdForNodeWithNameHierarchy(const NameHierarchy& nameHierarchy) co for (size_t i = 0; i < nameHierarchy.size(); i++) { - Id parentId = currentId; - currentId = m_sqliteStorage.getNameHierarchyElementIdByName(nameHierarchy[i]->getFullName(), parentId); - - if (currentId == 0) - { - currentId = parentId; - break; - } + currentId = m_sqliteStorage.getNameHierarchyElementIdByName(nameHierarchy[i]->getFullName(), currentId); } return m_sqliteStorage.getNodeByNameId(currentId).id; @@ -799,16 +792,11 @@ std::vector Storage::getSearchMatchesForTokenIds(const std::vector< if (m_sqliteStorage.isFile(tokenId)) { - StorageFile file = m_sqliteStorage.getFileById(tokenId); - - match.fullName = m_tokenIndex.getNameHierarchyForTokenId(tokenId).getFullName(); match.nodeType = Node::NODE_FILE; } else if (m_sqliteStorage.isNode(tokenId)) { StorageNode node = m_sqliteStorage.getNodeById(tokenId); - - match.fullName = m_tokenIndex.getNameHierarchyForTokenId(tokenId).getFullName(); match.nodeType = Node::intToType(node.type); } else @@ -817,6 +805,7 @@ std::vector Storage::getSearchMatchesForTokenIds(const std::vector< } match.tokenIds.insert(tokenId); + match.nameHierarchy = m_tokenIndex.getNameHierarchyForTokenId(tokenId); match.searchType = SearchMatch::SEARCH_TOKEN; matches.push_back(match); @@ -954,13 +943,8 @@ std::vector Storage::getTokenIdsForMatches(const std::vector& m std::set idSet; for (const SearchMatch& match : matches) { - std::vector ms = getAutocompletionMatches("", match.fullName); - - for (size_t i = 0; i < ms.size(); i++) - { - utility::append(idSet, ms[i].tokenIds); - break; - } + SearchNode* searchNode = m_tokenIndex.getNode(match.nameHierarchy); + utility::append(idSet, searchNode->getTokenIds()); } std::vector ids; @@ -1187,25 +1171,22 @@ std::shared_ptr Storage::getFileContent(const FilePath& filePath) co Id Storage::addNodeHierarchy(Node::NodeType nodeType, NameHierarchy nameHierarchy, bool distinct) { - addNameHierarchyElements(nameHierarchy); + std::vector nameIds = addNameHierarchyElements(nameHierarchy); - Id parentNameHierarchyElementId = 0; Id parentNodeId = 0; - for (size_t i = 0; i < nameHierarchy.size(); i++) + for (size_t i = 0; i < nameIds.size(); i++) { + Id nameId = nameIds[i]; bool lastName = (i == nameHierarchy.size() - 1); Node::NodeType type = (lastName ? nodeType : Node::NODE_UNDEFINED); - Id nameHierarchyElementId = - m_sqliteStorage.getNameHierarchyElementIdByName(nameHierarchy[i]->getFullName(), parentNameHierarchyElementId); - - const StorageNode node = m_sqliteStorage.getNodeByNameId(nameHierarchyElementId); + const StorageNode node = m_sqliteStorage.getNodeByNameId(nameId); Id nodeId = node.id; if (nodeId == 0 || (lastName && distinct)) { - nodeId = m_sqliteStorage.addNode(Node::typeToInt(type), nameHierarchyElementId); + nodeId = m_sqliteStorage.addNode(Node::typeToInt(type), nameId); if (parentNodeId != 0) { @@ -1221,7 +1202,6 @@ Id Storage::addNodeHierarchy(Node::NodeType nodeType, NameHierarchy nameHierarch } } - parentNameHierarchyElementId = nameHierarchyElementId; parentNodeId = nodeId; } @@ -1242,8 +1222,9 @@ Id Storage::addNodeHierarchyWithDistinctSignature(Node::NodeType type, const Par return nodeId; } -Id Storage::addNameHierarchyElements(NameHierarchy nameHierarchy) +std::vector Storage::addNameHierarchyElements(NameHierarchy nameHierarchy) { + std::vector nameIds; Id parentId = 0; bool nodeMayExist = true; @@ -1256,10 +1237,6 @@ Id Storage::addNameHierarchyElements(NameHierarchy nameHierarchy) { nodeId = m_sqliteStorage.getNameHierarchyElementIdByName(elementName, parentId); } - else - { - nodeId = 0; - } if (nodeId == 0) { @@ -1267,10 +1244,11 @@ Id Storage::addNameHierarchyElements(NameHierarchy nameHierarchy) nodeMayExist = false; } + nameIds.push_back(nodeId); parentId = nodeId; } - return parentId; + return nameIds; } int Storage::addSourceLocation(int elementNodeId, const ParseLocation& location, bool isScope) diff --git a/src/lib/data/Storage.h b/src/lib/data/Storage.h index c74cdc0f..0c6e319d 100644 --- a/src/lib/data/Storage.h +++ b/src/lib/data/Storage.h @@ -163,7 +163,7 @@ public: private: Id addNodeHierarchy(Node::NodeType nodeType, NameHierarchy nameHierarchy, bool distinct = false); Id addNodeHierarchyWithDistinctSignature(Node::NodeType type, const ParseFunction& function); - Id addNameHierarchyElements(NameHierarchy nameHierarchy); + std::vector addNameHierarchyElements(NameHierarchy nameHierarchy); int addSourceLocation(int elementNodeId, const ParseLocation& location, bool isScope = false); Id addEdge(Id sourceNodeId, Id targetNodeId, Edge::EdgeType type); diff --git a/src/lib/data/TaskCleanStorage.cpp b/src/lib/data/TaskCleanStorage.cpp index 47c06201..96f3154a 100644 --- a/src/lib/data/TaskCleanStorage.cpp +++ b/src/lib/data/TaskCleanStorage.cpp @@ -45,12 +45,11 @@ void TaskCleanStorage::exit() ss << "clearing files done, "; ss << std::setprecision(2) << std::fixed << utility::duration(m_start) << " seconds"; MessageStatus(ss.str()).dispatch(); - } void TaskCleanStorage::interrupt() { - MessageStatus("Clearing file interrupted", false, true).dispatch(); + MessageStatus("clearing files interrupted", false, true).dispatch(); } void TaskCleanStorage::revert() diff --git a/src/lib/data/parser/cxx/TaskParseCxx.cpp b/src/lib/data/parser/cxx/TaskParseCxx.cpp index 89f38349..a15bcd8f 100644 --- a/src/lib/data/parser/cxx/TaskParseCxx.cpp +++ b/src/lib/data/parser/cxx/TaskParseCxx.cpp @@ -63,7 +63,7 @@ Task::TaskState TaskParseCxx::update() } std::stringstream ss; - ss << "parsing (ESC to quit): ["; + ss << "analyzing files (ESC to quit): ["; ss << fileRegister->getParsedFilesCount() << "/" << fileRegister->getFilesCount() << "] "; ss << sourcePath; @@ -85,7 +85,7 @@ Task::TaskState TaskParseCxx::update() void TaskParseCxx::exit() { - MessageStatus("Building search index").dispatch(); + MessageStatus("building search index").dispatch(); m_client->finishParsing(); @@ -101,6 +101,7 @@ void TaskParseCxx::exit() void TaskParseCxx::interrupt() { + MessageStatus("analyzing files interrupted", false, true).dispatch(); } void TaskParseCxx::revert() diff --git a/src/lib/data/search/SearchIndex.cpp b/src/lib/data/search/SearchIndex.cpp index 1b76d1e8..94b6c46f 100644 --- a/src/lib/data/search/SearchIndex.cpp +++ b/src/lib/data/search/SearchIndex.cpp @@ -79,6 +79,18 @@ SearchNode* SearchIndex::addNode(NameHierarchy nameHierarchy) return nullptr; } +SearchNode* SearchIndex::getNode(const NameHierarchy& nameHierarchy) const +{ + std::deque nameIds = m_dictionary.getWordIdsConst(nameHierarchy); + + if (nameIds.size()) + { + return m_root.getNodeRecursive(&nameIds).get(); + } + + return nullptr; +} + SearchNode* SearchIndex::getNode(const std::string& fullName) const { std::deque nameIds = m_dictionary.getWordIdsConst(fullName, DELIMITER); diff --git a/src/lib/data/search/SearchIndex.h b/src/lib/data/search/SearchIndex.h index 5b51d629..c071211b 100644 --- a/src/lib/data/search/SearchIndex.h +++ b/src/lib/data/search/SearchIndex.h @@ -29,6 +29,7 @@ public: const std::string& getWord(Id wordId) const; SearchNode* addNode(NameHierarchy nameHierarchy); + SearchNode* getNode(const NameHierarchy& nameHierarchy) const; SearchNode* getNode(const std::string& fullName) const; SearchNode* getNode(const SearchNode* searchNode) const; diff --git a/src/lib/data/search/SearchMatch.cpp b/src/lib/data/search/SearchMatch.cpp index 61f2bb75..a8b06e00 100644 --- a/src/lib/data/search/SearchMatch.cpp +++ b/src/lib/data/search/SearchMatch.cpp @@ -38,21 +38,20 @@ std::string SearchMatch::searchMatchesToString(const std::vector& m for (size_t i = 0; i < matches.size(); i++) { - ss << '@' << matches[i].fullName; + ss << '@' << matches[i].getFullName(); } return ss.str(); } SearchMatch::SearchMatch() - : fullName("") - , typeName("") + : typeName("") , searchType(SEARCH_NONE) { } SearchMatch::SearchMatch(const std::string& query) - : fullName(query) + : nameHierarchy(query) , typeName("") , searchType(SEARCH_NONE) { @@ -65,7 +64,7 @@ bool SearchMatch::isValid() const void SearchMatch::print(std::ostream& ostream) const { - ostream << weight << '\t' << fullName << std::endl << '\t'; + ostream << weight << '\t' << nameHierarchy.getFullName() << std::endl << '\t'; size_t i = 0; for (size_t index : indices) { @@ -80,6 +79,11 @@ void SearchMatch::print(std::ostream& ostream) const ostream << std::endl; } +std::string SearchMatch::getFullName() const +{ + return nameHierarchy.getFullName(); +} + std::string SearchMatch::getNodeTypeAsString() const { return Node::getTypeString(nodeType); diff --git a/src/lib/data/search/SearchMatch.h b/src/lib/data/search/SearchMatch.h index 3a740e8e..76d39673 100644 --- a/src/lib/data/search/SearchMatch.h +++ b/src/lib/data/search/SearchMatch.h @@ -31,10 +31,11 @@ struct SearchMatch void print(std::ostream& ostream) const; + std::string getFullName() const; std::string getNodeTypeAsString() const; std::string getSearchTypeName() const; - std::string fullName; + NameHierarchy nameHierarchy; std::string typeName; Node::NodeType nodeType; diff --git a/src/lib/data/search/SearchNode.cpp b/src/lib/data/search/SearchNode.cpp index 7aed3a93..5938a3cf 100644 --- a/src/lib/data/search/SearchNode.cpp +++ b/src/lib/data/search/SearchNode.cpp @@ -255,7 +255,7 @@ void SearchNode::removeSearchNode(SearchNode* node) SearchMatch SearchNode::fuzzyMatchData(const std::string& query, const SearchNode* parent) const { SearchMatch data; - data.fullName = getFullName(); + data.nameHierarchy = getNameHierarchy(); data.tokenIds = m_tokenIds; data.weight = 0; @@ -364,7 +364,7 @@ std::pair SearchNode::fuzzyMatch( weight += 20; } - if (last == '_' || next == '_') + if (last == '_' || next == '_' || next == '\0') { weight += 20; } diff --git a/src/lib/utility/Vector.h b/src/lib/utility/Vector.h deleted file mode 100644 index a544db96..00000000 --- a/src/lib/utility/Vector.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef VECTOR_H -#define VECTOR_H - -struct Vec4i -{ - Vec4i(int x, int y, int z, int w) - : x(x) - , y(y) - , z(z) - , w(w) - {} - - int x, y, z, w; -}; - -#endif // VECTOR_H diff --git a/src/lib/utility/messaging/type/MessageFinishedParsing.h b/src/lib/utility/messaging/type/MessageFinishedParsing.h index 56abe641..b5217663 100644 --- a/src/lib/utility/messaging/type/MessageFinishedParsing.h +++ b/src/lib/utility/messaging/type/MessageFinishedParsing.h @@ -7,7 +7,8 @@ #include "utility/messaging/Message.h" #include "utility/messaging/type/MessageStatus.h" -class MessageFinishedParsing: public Message +class MessageFinishedParsing + : public Message { public: MessageFinishedParsing(size_t fileCount, size_t totalFileCount, float parseTime, size_t errorCount) @@ -33,7 +34,7 @@ public: std::string getStatusStr() const { std::stringstream ss; - ss << "Parsing Finished: "; + ss << "Finished analysis: "; ss << fileCount << "/" << totalFileCount << " files, "; ss << std::setprecision(2) << std::fixed << parseTime << " seconds, "; ss << errorCount << " error(s)"; diff --git a/src/lib/utility/scheduling/TaskScheduler.cpp b/src/lib/utility/scheduling/TaskScheduler.cpp index 21872a92..db5c06d8 100644 --- a/src/lib/utility/scheduling/TaskScheduler.cpp +++ b/src/lib/utility/scheduling/TaskScheduler.cpp @@ -166,6 +166,6 @@ void TaskScheduler::handleMessage(MessageInterruptTasks* message) std::lock_guard lock(m_tasksMutex); if (m_tasks.size()) { - MessageStatus("Stop running tasks...").dispatch(); + MessageStatus("Stop running tasks...", false, true).dispatch(); } } diff --git a/src/lib/utility/text/Dictionary.cpp b/src/lib/utility/text/Dictionary.cpp index 0c5d6bf2..6de3b7c0 100644 --- a/src/lib/utility/text/Dictionary.cpp +++ b/src/lib/utility/text/Dictionary.cpp @@ -1,5 +1,6 @@ #include "utility/text/Dictionary.h" +#include "data/name/NameHierarchy.h" #include "utility/utilityString.h" Dictionary::Dictionary() @@ -84,6 +85,18 @@ std::deque Dictionary::getWordIdsConst(const std::string& wordList, const st return ids; } +std::deque Dictionary::getWordIdsConst(const NameHierarchy& nameHierarchy) const +{ + std::deque ids; + + for (size_t i = 0; i < nameHierarchy.size(); i++) + { + ids.push_back(getWordIdConst(nameHierarchy[i]->getFullName())); + } + + return ids; +} + const std::string& Dictionary::getWord(Id id) const { std::unordered_map::const_iterator it = m_words.find(id); diff --git a/src/lib/utility/text/Dictionary.h b/src/lib/utility/text/Dictionary.h index f3b80c43..45be6e08 100644 --- a/src/lib/utility/text/Dictionary.h +++ b/src/lib/utility/text/Dictionary.h @@ -9,6 +9,8 @@ #include "utility/types.h" +class NameHierarchy; + class Dictionary { public: @@ -25,6 +27,7 @@ public: std::deque getWordIds(const std::string& wordList, const std::string& delimiter); std::deque getWordIdsConst(const std::string& wordList, const std::string& delimiter) const; + std::deque getWordIdsConst(const NameHierarchy& nameHierarchy) const; // Note: References to values in an unordered_map don't change on rehashing so they can be saved and used elsewhere. const std::string& getWord(Id id) const; diff --git a/src/test/SearchIndexTestSuite.h b/src/test/SearchIndexTestSuite.h index 6abefe9a..3f799d42 100644 --- a/src/test/SearchIndexTestSuite.h +++ b/src/test/SearchIndexTestSuite.h @@ -254,8 +254,8 @@ public: matches = index.runFuzzySearchAndGetMatches("uml"); TS_ASSERT_EQUALS(2, matches.size()); - TS_ASSERT_EQUALS("util::math::floor", matches[0].fullName); - TS_ASSERT_EQUALS("util::math::ceil", matches[1].fullName); + TS_ASSERT_EQUALS("util::math::ceil", matches[0].fullName); + TS_ASSERT_EQUALS("util::math::floor", matches[1].fullName); } void test_fuzzy_matching_in_hierarchy_respects_collin()