diff --git a/src/lib/Application.cpp b/src/lib/Application.cpp index 68aeca26..bb589d8f 100644 --- a/src/lib/Application.cpp +++ b/src/lib/Application.cpp @@ -225,7 +225,7 @@ void Application::refreshProject(RefreshMode refreshMode) { if (m_project && checkSharedMemory()) { - m_project->refresh(getDialogView().get(), refreshMode); + m_project->refresh(refreshMode, getDialogView().get()); } } diff --git a/src/lib/component/view/DialogView.cpp b/src/lib/component/view/DialogView.cpp index 44a39038..aa524500 100644 --- a/src/lib/component/view/DialogView.cpp +++ b/src/lib/component/view/DialogView.cpp @@ -41,7 +41,7 @@ void DialogView::finishedIndexingDialog( { } -void DialogView::hideDialogs() +void DialogView::hideDialogs(bool unblockUI) { } diff --git a/src/lib/component/view/DialogView.h b/src/lib/component/view/DialogView.h index a00afe53..07d65c8f 100644 --- a/src/lib/component/view/DialogView.h +++ b/src/lib/component/view/DialogView.h @@ -30,7 +30,7 @@ public: size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo, bool interrupted); - virtual void hideDialogs(); + virtual void hideDialogs(bool unblockUI = true); int confirm(const std::string& message); virtual int confirm(const std::string& message, const std::vector& options); diff --git a/src/lib/data/parser/TaskParseWrapper.cpp b/src/lib/data/parser/TaskParseWrapper.cpp index 4eb0ae0d..7f891948 100644 --- a/src/lib/data/parser/TaskParseWrapper.cpp +++ b/src/lib/data/parser/TaskParseWrapper.cpp @@ -21,7 +21,7 @@ void TaskParseWrapper::doEnter(std::shared_ptr blackboard) blackboard->get("source_file_count", sourceFileCount); if (std::shared_ptr dialogView = Application::getInstance()->getDialogView()) { - dialogView->hideUnknownProgressDialog(); + dialogView->hideDialogs(false); dialogView->updateIndexingDialog(0, 0, sourceFileCount, ""); } diff --git a/src/lib/project/Project.cpp b/src/lib/project/Project.cpp index 7aaf1891..ecb3f53b 100644 --- a/src/lib/project/Project.cpp +++ b/src/lib/project/Project.cpp @@ -148,7 +148,7 @@ void Project::load() } } -void Project::refresh(DialogView* dialogView, RefreshMode refreshMode) +void Project::refresh(RefreshMode refreshMode, DialogView* dialogView) { if (m_state == PROJECT_STATE_NOT_LOADED) { @@ -274,7 +274,7 @@ void Project::refresh(DialogView* dialogView, RefreshMode refreshMode) } else { - buildIndex(info); + buildIndex(info, dialogView); } } @@ -296,11 +296,15 @@ RefreshInfo Project::getRefreshInfo(RefreshMode mode) const } } -void Project::buildIndex(const RefreshInfo& info) +void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView) { if (info.mode == REFRESH_NONE || (!info.filesToClear.size() && !info.filesToIndex.size())) { - if (!m_hasGUI) + if (m_hasGUI) + { + dialogView->hideDialogs(); + } + else { MessageFinishedParsing().dispatch(); } @@ -312,6 +316,8 @@ void Project::buildIndex(const RefreshInfo& info) MessageStatus("Preparing Indexing", false, true).dispatch(); MessageClearErrorCount().dispatch(); + dialogView->showUnknownProgressDialog("Preparing Indexing", "Setting up Indexers"); + if (info.mode == REFRESH_ALL_FILES) { m_storage->clear(); @@ -426,6 +432,10 @@ void Project::buildIndex(const RefreshInfo& info) ) ); } + else + { + dialogView->hideUnknownProgressDialog(); + } taskSequential->addTask(std::make_shared(m_storage.get(), m_storageCache)); diff --git a/src/lib/project/Project.h b/src/lib/project/Project.h index d4f8cda5..abd7326c 100644 --- a/src/lib/project/Project.h +++ b/src/lib/project/Project.h @@ -30,11 +30,11 @@ public: void load(); - void refresh(DialogView* dialogView, RefreshMode refreshMode); + void refresh(RefreshMode refreshMode, DialogView* dialogView); RefreshInfo getRefreshInfo(RefreshMode mode) const; - void buildIndex(const RefreshInfo& info); + void buildIndex(const RefreshInfo& info, DialogView* dialogView); private: enum ProjectStateType diff --git a/src/lib/utility/file/FilePath.cpp b/src/lib/utility/file/FilePath.cpp index 44412442..4bbf80d5 100644 --- a/src/lib/utility/file/FilePath.cpp +++ b/src/lib/utility/file/FilePath.cpp @@ -178,7 +178,7 @@ std::vector FilePath::expandEnvironmentVariables() const const char * s = match[1].matched ? getenv(match[1].str().c_str()) : getenv(match[2].str().c_str()); if (s == nullptr) { - LOG_ERROR(match[1].str() + " is not an environment variable"); + LOG_ERROR_STREAM(<< match[1].str() << " is not an environment variable in: " << text); return paths; } text.replace(match.position(0), match.length(0), s); diff --git a/src/lib_gui/qt/view/QtDialogView.cpp b/src/lib_gui/qt/view/QtDialogView.cpp index 1925bad7..37b92d45 100644 --- a/src/lib_gui/qt/view/QtDialogView.cpp +++ b/src/lib_gui/qt/view/QtDialogView.cpp @@ -163,18 +163,18 @@ void QtDialogView::startIndexingDialog( Task::dispatch(std::make_shared( [=]() { - project->buildIndex(info); + project->buildIndex(info, this); } )); m_windowStack.clearWindows(); - showUnknownProgress("Preparing Indexing", "Setting up Indexers", false); } ); connect(window, &QtWindow::canceled, [=]() { + std::cout << "cancelse" << std::endl; setUIBlocked(false); } ); @@ -228,13 +228,17 @@ void QtDialogView::finishedIndexingDialog( ); } -void QtDialogView::hideDialogs() +void QtDialogView::hideDialogs(bool unblockUI) { m_onQtThread2( [=]() { m_windowStack.clearWindows(); - setUIBlocked(false); + + if (unblockUI) + { + setUIBlocked(false); + } } ); diff --git a/src/lib_gui/qt/view/QtDialogView.h b/src/lib_gui/qt/view/QtDialogView.h index dd27341c..dcc29ce0 100644 --- a/src/lib_gui/qt/view/QtDialogView.h +++ b/src/lib_gui/qt/view/QtDialogView.h @@ -43,7 +43,7 @@ public: size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount, float time, ErrorCountInfo errorInfo, bool interrupted) override; - virtual void hideDialogs() override; + virtual void hideDialogs(bool unblockUI = true) override; int confirm(const std::string& message, const std::vector& options) override; diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp index f095f88b..75fda551 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPaths.cpp @@ -69,30 +69,54 @@ void QtProjectWizzardContentPaths::populate(QGridLayout* layout, int& row) bool QtProjectWizzardContentPaths::check() { QString missingPaths; + std::vector existingPaths; - std::vector paths = m_list->getList(); - if (m_settings) + for (const FilePath& path : m_list->getList()) { - paths = m_settings->makePathsExpandedAndAbsolute(paths); - } - - for (const FilePath& path : paths) - { - if (!path.exists()) + std::vector expandedPaths(1, path); + std::cout << path.str() << std::endl; + if (m_settings) { - missingPaths.append(path.str().c_str()); - missingPaths.append("\n"); - break; + expandedPaths = m_settings->makePathsExpandedAndAbsolute(expandedPaths); + } + + size_t existingCount = 0; + for (const FilePath& expandedPath : expandedPaths) + { + if (!expandedPath.exists()) + { + missingPaths.append((expandedPath.str() + "\n").c_str()); + } + else + { + existingCount++; + } + } + + if (expandedPaths.size() && expandedPaths.size() == existingCount) + { + existingPaths.push_back(path); } } if (!missingPaths.isEmpty()) { QMessageBox msgBox; - msgBox.setText("Some provided paths do not exist at \"" + m_titleString + "\"."); + msgBox.setText(QString("Some provided paths do not exist at \"%1\". Do you want to remove them " + "before continuing?").arg(m_titleString)); msgBox.setDetailedText(missingPaths); - msgBox.exec(); - return false; + msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); + int ret = msgBox.exec(); + + if (ret == QMessageBox::Yes) + { + m_list->setList(existingPaths); + save(); + } + else if (ret == QMessageBox::Cancel) + { + return false; + } } return true; diff --git a/src/lib_gui/utility/utilityPathDetection.cpp b/src/lib_gui/utility/utilityPathDetection.cpp index 51dbb97b..5c0bd9d0 100644 --- a/src/lib_gui/utility/utilityPathDetection.cpp +++ b/src/lib_gui/utility/utilityPathDetection.cpp @@ -91,6 +91,11 @@ std::shared_ptr utility::getCxxVsHeaderPathDetector() { std::shared_ptr combinedDetector = std::make_shared(); + if (utility::getOsType() != OS_WINDOWS) + { + return combinedDetector; + } + combinedDetector->addDetector(std::make_shared()); combinedDetector->addDetector(std::make_shared(CxxVs10To14HeaderPathDetector::VISUAL_STUDIO_2015, false, APPLICATION_ARCHITECTURE_X86_32));