src: avoid indexing slowdown on macOS by not using unknown progress for progressbar in status bar
This commit is contained in:
@@ -84,8 +84,8 @@ QtStatusBar::QtStatusBar()
|
||||
|
||||
m_indexingProgress = new QProgressBar();
|
||||
m_indexingProgress->setMinimum(0);
|
||||
m_indexingProgress->setMaximum(0);
|
||||
m_indexingProgress->setValue(0);
|
||||
m_indexingProgress->setMaximum(100);
|
||||
m_indexingProgress->setValue(100);
|
||||
layout->addWidget(m_indexingProgress);
|
||||
|
||||
m_indexingStatus->setLayout(layout);
|
||||
@@ -155,23 +155,14 @@ void QtStatusBar::setIdeStatus(const std::wstring& text)
|
||||
m_ideStatusText.setText(QString::fromStdWString(text));
|
||||
}
|
||||
|
||||
void QtStatusBar::showIndexingProgress(bool unknownProgress, size_t progressPercent)
|
||||
void QtStatusBar::showIndexingProgress(size_t progressPercent)
|
||||
{
|
||||
m_indexingStatus->show();
|
||||
m_vlineIndexing->show();
|
||||
|
||||
m_errorButton.setEnabled(false);
|
||||
|
||||
if (unknownProgress)
|
||||
{
|
||||
m_indexingProgress->setValue(0);
|
||||
m_indexingProgress->setMaximum(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_indexingProgress->setValue(progressPercent);
|
||||
m_indexingProgress->setMaximum(100);
|
||||
}
|
||||
m_indexingProgress->setValue(progressPercent);
|
||||
}
|
||||
|
||||
void QtStatusBar::hideIndexingProgress()
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
|
||||
void setIdeStatus(const std::wstring& text);
|
||||
|
||||
void showIndexingProgress(bool unknownProgress, size_t progressPercent);
|
||||
void showIndexingProgress(size_t progressPercent);
|
||||
void hideIndexingProgress();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -33,13 +33,7 @@ QtDialogView::~QtDialogView()
|
||||
|
||||
bool QtDialogView::dialogsHidden() const
|
||||
{
|
||||
QtIndexingDialog* window = dynamic_cast<QtIndexingDialog*>(m_windowStack.getTopWindow());
|
||||
if (window)
|
||||
{
|
||||
return window->isHidden();
|
||||
}
|
||||
|
||||
return false;
|
||||
return !m_dialogsVisible;
|
||||
}
|
||||
|
||||
void QtDialogView::clearDialogs()
|
||||
@@ -114,11 +108,6 @@ void QtDialogView::showProgressDialog(const std::wstring& title, const std::wstr
|
||||
window->updateMessage(QString::fromStdWString(message));
|
||||
window->updateProgress(progress);
|
||||
|
||||
if (m_updateIndexingStatus)
|
||||
{
|
||||
MessageIndexingStatus(true, false, progress).dispatch();
|
||||
}
|
||||
|
||||
setUIBlocked(m_dialogsVisible);
|
||||
}
|
||||
);
|
||||
@@ -239,9 +228,11 @@ void QtDialogView::updateIndexingDialog(
|
||||
std::vector<std::wstring> stati;
|
||||
for (const FilePath& path : sourcePaths)
|
||||
{
|
||||
stati.push_back(L"[" + std::to_wstring(startedFileCount) + L"/" + std::to_wstring(totalFileCount) + L"] Indexing file: " + path.wstr());
|
||||
stati.push_back(
|
||||
L"[" + std::to_wstring(startedFileCount) + L"/" + std::to_wstring(totalFileCount) +
|
||||
L"] Indexing file: " + path.wstr());
|
||||
}
|
||||
MessageStatus(stati, false, true, m_dialogsVisible).dispatch();
|
||||
MessageStatus(stati, false, false, m_dialogsVisible).dispatch();
|
||||
}
|
||||
|
||||
QtIndexingDialog* window = dynamic_cast<QtIndexingDialog*>(m_windowStack.getTopWindow());
|
||||
@@ -255,21 +246,11 @@ void QtDialogView::updateIndexingDialog(
|
||||
|
||||
if (window && window->getType() == QtIndexingDialog::DIALOG_INDEXING)
|
||||
{
|
||||
window->updateIndexingProgress(finishedFileCount, totalFileCount, sourcePaths.empty() ? FilePath() : sourcePaths.back());
|
||||
window->updateIndexingProgress(
|
||||
finishedFileCount, totalFileCount, sourcePaths.empty() ? FilePath() : sourcePaths.back());
|
||||
}
|
||||
m_mainWindow->setWindowsTaskbarProgress(float(finishedFileCount) / totalFileCount);
|
||||
|
||||
if (m_updateIndexingStatus)
|
||||
{
|
||||
int progress = 0;
|
||||
if (totalFileCount)
|
||||
{
|
||||
progress = finishedFileCount * 100 / totalFileCount;
|
||||
}
|
||||
|
||||
MessageIndexingStatus(true, false, progress).dispatch();
|
||||
}
|
||||
|
||||
setUIBlocked(m_dialogsVisible);
|
||||
}
|
||||
);
|
||||
@@ -279,11 +260,6 @@ DatabasePolicy QtDialogView::finishedIndexingDialog(
|
||||
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
|
||||
float time, ErrorCountInfo errorInfo, bool interrupted)
|
||||
{
|
||||
if (m_updateIndexingStatus)
|
||||
{
|
||||
MessageIndexingStatus(false, false, 0).dispatch();
|
||||
}
|
||||
|
||||
DatabasePolicy policy = DATABASE_POLICY_UNKNOWN;
|
||||
m_resultReady = false;
|
||||
|
||||
@@ -441,11 +417,6 @@ void QtDialogView::showUnknownProgress(const std::wstring& title, const std::wst
|
||||
window->updateTitle(QString::fromStdWString(title));
|
||||
window->updateMessage(QString::fromStdWString(message));
|
||||
|
||||
if (m_updateIndexingStatus)
|
||||
{
|
||||
MessageIndexingStatus(true, true, 0).dispatch();
|
||||
}
|
||||
|
||||
setUIBlocked(m_dialogsVisible);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,12 +57,12 @@ void QtStatusBarView::showIdeStatus(const std::wstring& message)
|
||||
);
|
||||
}
|
||||
|
||||
void QtStatusBarView::showIndexingProgress(bool unknownProgress, size_t progressPercent)
|
||||
void QtStatusBarView::showIndexingProgress(size_t progressPercent)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_widget->showIndexingProgress(unknownProgress, progressPercent);
|
||||
m_widget->showIndexingProgress(progressPercent);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
virtual void showIdeStatus(const std::wstring& message);
|
||||
|
||||
virtual void showIndexingProgress(bool unknownProgress, size_t progressPercent);
|
||||
virtual void showIndexingProgress(size_t progressPercent);
|
||||
virtual void hideIndexingProgress();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user