ui: fixes in project setup and indexing
* allow to ignore missing paths in project setup * button to remove missing paths in project setup * fixed progress dialog stays on empty project indexing * don't unblock ui between indexin steps
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ void DialogView::finishedIndexingDialog(
|
||||
{
|
||||
}
|
||||
|
||||
void DialogView::hideDialogs()
|
||||
void DialogView::hideDialogs(bool unblockUI)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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<std::string>& options);
|
||||
|
||||
@@ -21,7 +21,7 @@ void TaskParseWrapper::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
blackboard->get("source_file_count", sourceFileCount);
|
||||
if (std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView())
|
||||
{
|
||||
dialogView->hideUnknownProgressDialog();
|
||||
dialogView->hideDialogs(false);
|
||||
dialogView->updateIndexingDialog(0, 0, sourceFileCount, "");
|
||||
}
|
||||
|
||||
|
||||
@@ -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<TaskFinishParsing>(m_storage.get(), m_storageCache));
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -178,7 +178,7 @@ std::vector<FilePath> 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);
|
||||
|
||||
@@ -163,18 +163,18 @@ void QtDialogView::startIndexingDialog(
|
||||
Task::dispatch(std::make_shared<TaskLambda>(
|
||||
[=]()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -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<std::string>& options) override;
|
||||
|
||||
|
||||
@@ -69,30 +69,54 @@ void QtProjectWizzardContentPaths::populate(QGridLayout* layout, int& row)
|
||||
bool QtProjectWizzardContentPaths::check()
|
||||
{
|
||||
QString missingPaths;
|
||||
std::vector<FilePath> existingPaths;
|
||||
|
||||
std::vector<FilePath> 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<FilePath> 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;
|
||||
|
||||
@@ -91,6 +91,11 @@ std::shared_ptr<CombinedPathDetector> utility::getCxxVsHeaderPathDetector()
|
||||
{
|
||||
std::shared_ptr<CombinedPathDetector> combinedDetector = std::make_shared<CombinedPathDetector>();
|
||||
|
||||
if (utility::getOsType() != OS_WINDOWS)
|
||||
{
|
||||
return combinedDetector;
|
||||
}
|
||||
|
||||
combinedDetector->addDetector(std::make_shared<CxxVs15HeaderPathDetector>());
|
||||
|
||||
combinedDetector->addDetector(std::make_shared<CxxVs10To14HeaderPathDetector>(CxxVs10To14HeaderPathDetector::VISUAL_STUDIO_2015, false, APPLICATION_ARCHITECTURE_X86_32));
|
||||
|
||||
Reference in New Issue
Block a user