diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 23af0205..d1249364 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -290,6 +290,7 @@ add_files( utility/messaging/type/MessageStatus.h utility/messaging/type/MessageSwitchColorScheme.h utility/messaging/type/MessageUndo.h + utility/messaging/type/MessageWindowClosed.h utility/messaging/type/MessageWindowFocus.h utility/messaging/type/MessageZoom.h @@ -334,7 +335,7 @@ add_files( utility/solution/SolutionParserUtility.h utility/solution/SolutionParserVisualStudio.cpp utility/solution/SolutionParserVisualStudio.h - + utility/synchronization/ReaderWriterLock.cpp utility/synchronization/ReaderWriterLock.h utility/synchronization/ScopedReaderLock.cpp diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index 97b518c6..08436751 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -742,7 +742,7 @@ void GraphController::bundleNodesAndEdgesMatching( node->visible = false; bundleNode->bundledNodes.push_back(node); - bundleNode->bundledNodeCount += node->getConnectedSubNodeCount(); + bundleNode->bundledNodeCount += node->getBundledNodeCount(); m_dummyNodes.erase(m_dummyNodes.begin() + matchedNodeIndices[i]); } diff --git a/src/lib/component/controller/helper/DummyNode.h b/src/lib/component/controller/helper/DummyNode.h index 9f6da63c..e6c6312b 100644 --- a/src/lib/component/controller/helper/DummyNode.h +++ b/src/lib/component/controller/helper/DummyNode.h @@ -140,23 +140,6 @@ public: return false; } - size_t getConnectedSubNodeCount() const - { - size_t count = 0; - - if (connected) - { - count += 1; - } - - for (std::shared_ptr node : subNodes) - { - count += node->getConnectedSubNodeCount(); - } - - return count; - } - std::vector getConnectedSubNodes() const { std::vector nodes; diff --git a/src/lib/component/view/GraphViewStyle.cpp b/src/lib/component/view/GraphViewStyle.cpp index d6bcfd14..6d30ab84 100644 --- a/src/lib/component/view/GraphViewStyle.cpp +++ b/src/lib/component/view/GraphViewStyle.cpp @@ -455,7 +455,7 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ style.originOffset.y = 0; style.targetOffset.y = 0; style.verticalOffset = 0; - style.zValue = isActive ? -2 : -5; + style.zValue = isActive ? 1 : -5; break; case Edge::EDGE_CALL: style.originOffset.y = 1; @@ -472,7 +472,7 @@ GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType typ style.arrowWidth = 14; style.arrowClosed = true; style.targetOffset.x = 34; - style.zValue = isActive ? -1 : -3; + style.zValue = isActive ? 2 : -3; break; default: break; diff --git a/src/lib/data/search/SearchIndex.cpp b/src/lib/data/search/SearchIndex.cpp index 753e8939..a13e94c1 100644 --- a/src/lib/data/search/SearchIndex.cpp +++ b/src/lib/data/search/SearchIndex.cpp @@ -402,7 +402,7 @@ int SearchIndex::score(const std::string& text, const std::vector& indic } // after no letter - bool prevIsNoLetter = (index > 0 && noLetters.find(text[index - 1]) != noLetters.end()); + bool prevIsNoLetter = (index == 0 || noLetters.find(text[index - 1]) != noLetters.end()); if (prevIsNoLetter) { noLetterScore += noLetterBonus; diff --git a/src/lib/settings/ApplicationSettings.cpp b/src/lib/settings/ApplicationSettings.cpp index 1faf2061..3631c82d 100644 --- a/src/lib/settings/ApplicationSettings.cpp +++ b/src/lib/settings/ApplicationSettings.cpp @@ -261,7 +261,7 @@ void ApplicationSettings::setCodeSnippetSnapRange(int range) int ApplicationSettings::getCodeSnippetExpandRange() const { - return getValue("code/snippet/expand_range", 2); + return getValue("code/snippet/expand_range", 3); } void ApplicationSettings::setCodeSnippetExpandRange(int range) diff --git a/src/lib/utility/messaging/type/MessageWindowClosed.h b/src/lib/utility/messaging/type/MessageWindowClosed.h new file mode 100644 index 00000000..f5c283f2 --- /dev/null +++ b/src/lib/utility/messaging/type/MessageWindowClosed.h @@ -0,0 +1,21 @@ +#ifndef MESSAGE_WINDOW_CLOSED_H +#define MESSAGE_WINDOW_CLOSED_H + +#include "utility/messaging/Message.h" + +class MessageWindowClosed + : public Message +{ +public: + MessageWindowClosed() + { + setSendAsTask(false); + } + + static const std::string getStaticType() + { + return "MessageWindowClosed"; + } +}; + +#endif // MESSAGE_WINDOW_CLOSED_H diff --git a/src/lib/utility/scheduling/TaskGroupParallel.cpp b/src/lib/utility/scheduling/TaskGroupParallel.cpp index 70f1632c..599b8c2f 100644 --- a/src/lib/utility/scheduling/TaskGroupParallel.cpp +++ b/src/lib/utility/scheduling/TaskGroupParallel.cpp @@ -38,6 +38,9 @@ void TaskGroupParallel::doEnter(std::shared_ptr blackboard) Task::TaskState TaskGroupParallel::doUpdate(std::shared_ptr blackboard) { + const int SLEEP_TIME_MS = 25; + std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS)); + if (m_tasks.size() != 0 && getActveTaskCount() > 0) { return STATE_RUNNING; @@ -72,8 +75,6 @@ void TaskGroupParallel::doReset(std::shared_ptr blackboard) void TaskGroupParallel::processTaskThreaded(std::shared_ptr taskInfo, std::shared_ptr blackboard) { - const int SLEEP_TIME_MS = 25; - ScopedFunctor functor([&](){ std::lock_guard lock(m_activeTaskCountMutex); m_activeTaskCount--; @@ -92,8 +93,6 @@ void TaskGroupParallel::processTaskThreaded(std::shared_ptr taskInfo, taskInfo->active = false; break; } - - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS)); } } diff --git a/src/lib/utility/scheduling/TaskScheduler.cpp b/src/lib/utility/scheduling/TaskScheduler.cpp index 470132e8..b296d382 100644 --- a/src/lib/utility/scheduling/TaskScheduler.cpp +++ b/src/lib/utility/scheduling/TaskScheduler.cpp @@ -48,8 +48,6 @@ void TaskScheduler::startSchedulerLoopThreaded() void TaskScheduler::startSchedulerLoop() { - const int SLEEP_TIME_MS = 25; - { std::lock_guard lock(m_loopMutex); @@ -75,6 +73,7 @@ void TaskScheduler::startSchedulerLoop() } } + const int SLEEP_TIME_MS = 25; std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS)); } @@ -156,6 +155,15 @@ void TaskScheduler::processTasks() { break; } + + { + std::lock_guard lock(m_loopMutex); + + if (!m_loopIsRunning) + { + break; + } + } } } diff --git a/src/lib_gui/qt/view/QtDialogView.cpp b/src/lib_gui/qt/view/QtDialogView.cpp index 0f7bc397..56d44d10 100644 --- a/src/lib_gui/qt/view/QtDialogView.cpp +++ b/src/lib_gui/qt/view/QtDialogView.cpp @@ -14,11 +14,13 @@ QtDialogView::QtDialogView(QtMainWindow* mainWindow) : m_mainWindow(mainWindow) , m_windowStack(this) + , m_resultReady(false) { } QtDialogView::~QtDialogView() { + m_resultReady = true; } void QtDialogView::showProgressDialog(const std::string& title, const std::string& message) @@ -66,17 +68,17 @@ void QtDialogView::hideProgressDialog() bool QtDialogView::startIndexingDialog(size_t cleanFileCount, size_t indexFileCount) { bool result = false; - bool done = false; + m_resultReady = false; m_onQtThread( - [=, &result, &done]() + [=, &result]() { QtIndexingDialog* window = createWindow(); window->setupStart(cleanFileCount, indexFileCount, [&](bool start) { result = start; - done = true; + m_resultReady = true; setUIBlocked(false); } @@ -86,7 +88,7 @@ bool QtDialogView::startIndexingDialog(size_t cleanFileCount, size_t indexFileCo } ); - while (!done) + while (!m_resultReady) { const int SLEEP_TIME_MS = 25; std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS)); @@ -155,10 +157,10 @@ void QtDialogView::finishedIndexingDialog(size_t fileCount, size_t totalFileCoun int QtDialogView::confirm(const std::string& message, const std::vector& options) { int result = -1; - bool done = false; + m_resultReady = false; m_onQtThread( - [=, &result, &done]() + [=, &result]() { QMessageBox msgBox; msgBox.setText(message.c_str()); @@ -179,11 +181,11 @@ int QtDialogView::confirm(const std::string& message, const std::vector(m_windowStack.getTopWindow()); diff --git a/src/lib_gui/qt/view/QtDialogView.h b/src/lib_gui/qt/view/QtDialogView.h index 6b5e530e..49963829 100644 --- a/src/lib_gui/qt/view/QtDialogView.h +++ b/src/lib_gui/qt/view/QtDialogView.h @@ -9,6 +9,7 @@ #include "utility/messaging/MessageListener.h" #include "utility/messaging/type/MessageInterruptTasks.h" #include "utility/messaging/type/MessageShowErrors.h" +#include "utility/messaging/type/MessageWindowClosed.h" class QtMainWindow; @@ -17,6 +18,7 @@ class QtDialogView , public DialogView , public MessageListener , public MessageListener + , public MessageListener { Q_OBJECT @@ -36,6 +38,7 @@ public: private: void handleMessage(MessageInterruptTasks* message) override; void handleMessage(MessageShowErrors* message) override; + void handleMessage(MessageWindowClosed* message) override; void updateErrorCount(size_t errorCount, size_t fatalCount); @@ -50,6 +53,8 @@ private: QtThreadedLambdaFunctor m_onQtThread; QtThreadedLambdaFunctor m_onQtThread2; + + bool m_resultReady; }; #endif // QT_DIALOG_VIEW_H diff --git a/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp b/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp index 2900fb8f..1ebdf2eb 100644 --- a/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp +++ b/src/lib_gui/qt/view/graphElements/QtGraphNode.cpp @@ -258,6 +258,25 @@ Id QtGraphNode::getTokenId() const void QtGraphNode::addSubNode(const std::shared_ptr& node) { m_subNodes.push_back(node); + + // push parent nodes to back so all edges going to the active subnode are visible + if (node->getIsActive()) + { + QtGraphNode* parent = this; + while (parent) + { + parent->setZValue(-10.0f); + parent->m_rect->setZValue(-10.0f); + parent->m_text->setZValue(-9.0f); + + if (parent->m_undefinedRect) + { + parent->m_undefinedRect->setZValue(-10.0f); + } + + parent = parent->getParent(); + } + } } void QtGraphNode::moved(const Vec2i& oldPosition) diff --git a/src/lib_gui/qt/window/QtIndexingDialog.cpp b/src/lib_gui/qt/window/QtIndexingDialog.cpp index 14c2ae87..02a9038c 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.cpp +++ b/src/lib_gui/qt/window/QtIndexingDialog.cpp @@ -74,13 +74,13 @@ void QtIndexingDialog::setupProgress() QBoxLayout* layout = createLayout(); - addTopAndProgressBar(0.62); + addTopAndProgressBar(0.5); addTitle("Clearing", layout); addMessageLabel(layout); layout->addStretch(); - m_sizeHint = QSize(350, 350); + m_sizeHint = QSize(350, 280); m_progressBar->showUnknownProgressAnimated(); @@ -268,12 +268,12 @@ void QtIndexingDialog::addTopAndProgressBar(float topRatio) m_top = new QWidget(m_window); m_top->setObjectName("topHalf"); - m_top->setGeometry(0, 0, m_window->size().width(), m_window->size().height() * topRatio); + m_top->setGeometry(0, 0, 0, 0); m_top->show(); m_top->lower(); m_progressBar = new QtProgressBar(m_window); - m_progressBar->setGeometry(0, m_window->size().height() * topRatio - 5, m_window->size().width(), 10); + m_progressBar->setGeometry(0, 0, 0, 0); } void QtIndexingDialog::addTitle(QString title, QBoxLayout* layout) @@ -393,7 +393,7 @@ void QtIndexingDialog::setGeometries() void QtIndexingDialog::finishSetup() { - setGeometries(); - setupDone(); + + setGeometries(); } diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index c3923dcc..07d20683 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -36,6 +36,7 @@ #include "utility/messaging/type/MessageResetZoom.h" #include "utility/messaging/type/MessageSearch.h" #include "utility/messaging/type/MessageUndo.h" +#include "utility/messaging/type/MessageWindowClosed.h" #include "utility/messaging/type/MessageWindowFocus.h" #include "utility/messaging/type/MessageZoom.h" #include "utility/ResourcePaths.h" @@ -314,6 +315,11 @@ void QtMainWindow::contextMenuEvent(QContextMenuEvent* event) QtContextMenu::getInstance()->showDefault(event, this); } +void QtMainWindow::closeEvent(QCloseEvent* event) +{ + MessageWindowClosed().dispatch(); +} + void QtMainWindow::about() { QtAbout* aboutWindow = createWindow(); diff --git a/src/lib_gui/qt/window/QtMainWindow.h b/src/lib_gui/qt/window/QtMainWindow.h index 9bb3afdc..ace75244 100644 --- a/src/lib_gui/qt/window/QtMainWindow.h +++ b/src/lib_gui/qt/window/QtMainWindow.h @@ -91,6 +91,7 @@ protected: bool event(QEvent* event); void keyPressEvent(QKeyEvent* event); void contextMenuEvent(QContextMenuEvent* event); + void closeEvent(QCloseEvent* event); public slots: void about(); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp index 87f56a3d..c4e6abd8 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentData.cpp @@ -138,7 +138,6 @@ void QtProjectWizzardContentData::addNameAndLocation(QGridLayout* layout, int& r layout->addWidget(locationLabel, row, QtProjectWizzardWindow::FRONT_COL, Qt::AlignRight); layout->addWidget(m_projectFileLocation, row, QtProjectWizzardWindow::BACK_COL); - layout->setRowMinimumHeight(row, 50); row++; }