logic: allow the user to discard an aborted indexer run
* keep old database on filesystem while indexing * migrate old ".coatiproject" settings to new ".srctrlprj" extension when loading project * send new errors in MessageErrorCountUpdate after injecting * recheck filepath exist() in FileSystem's remove, rename, copy and create functions * updated tasks to new "override" policy
This commit is contained in:
@@ -221,24 +221,50 @@ void QtDialogView::updateIndexingDialog(
|
||||
);
|
||||
}
|
||||
|
||||
void QtDialogView::finishedIndexingDialog(
|
||||
DatabasePolicy QtDialogView::finishedIndexingDialog(
|
||||
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
|
||||
float time, ErrorCountInfo errorInfo, bool interrupted)
|
||||
{
|
||||
DatabasePolicy policy = DATABASE_POLICY_UNKNOWN;
|
||||
m_resultReady = false;
|
||||
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
[=, &policy]()
|
||||
{
|
||||
m_windowStack.clearWindows();
|
||||
|
||||
QtIndexingDialog* window = createWindow<QtIndexingDialog>();
|
||||
window->setupReport(indexedFileCount, totalIndexedFileCount, completedFileCount, totalFileCount, time, interrupted);
|
||||
window->updateErrorCount(errorInfo.total, errorInfo.fatal);
|
||||
connect(window, &QtWindow::finished,
|
||||
[this, &policy]()
|
||||
{
|
||||
setUIBlocked(false);
|
||||
policy = DATABASE_POLICY_KEEP;
|
||||
m_resultReady = true;
|
||||
}
|
||||
);
|
||||
connect(window, &QtWindow::canceled,
|
||||
[this, &policy]()
|
||||
{
|
||||
setUIBlocked(false);
|
||||
policy = DATABASE_POLICY_DISCARD;
|
||||
m_resultReady = true;
|
||||
}
|
||||
);
|
||||
|
||||
setUIBlocked(false);
|
||||
m_mainWindow->hideWindowsTaskbarProgress();
|
||||
setUIBlocked(true);
|
||||
}
|
||||
);
|
||||
|
||||
while (!m_resultReady)
|
||||
{
|
||||
const int SLEEP_TIME_MS = 25;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
|
||||
}
|
||||
|
||||
return policy;
|
||||
}
|
||||
|
||||
void QtDialogView::hideDialogs(bool unblockUI)
|
||||
|
||||
@@ -25,26 +25,26 @@ class QtDialogView
|
||||
|
||||
public:
|
||||
QtDialogView(QtMainWindow* mainWindow, StorageAccess* storageAccess);
|
||||
virtual ~QtDialogView();
|
||||
~QtDialogView() override;
|
||||
|
||||
virtual void showUnknownProgressDialog(const std::wstring& title, const std::wstring& message) override;
|
||||
virtual void hideUnknownProgressDialog() override;
|
||||
void showUnknownProgressDialog(const std::wstring& title, const std::wstring& message) override;
|
||||
void hideUnknownProgressDialog() override;
|
||||
|
||||
virtual void showProgressDialog(const std::wstring& title, const std::wstring& message, size_t progress) override;
|
||||
virtual void hideProgressDialog() override;
|
||||
void showProgressDialog(const std::wstring& title, const std::wstring& message, size_t progress) override;
|
||||
void hideProgressDialog() override;
|
||||
|
||||
virtual void startIndexingDialog(
|
||||
void startIndexingDialog(
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info) override;
|
||||
virtual void updateIndexingDialog(
|
||||
void updateIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const FilePath& sourcePath) override;
|
||||
virtual void finishedIndexingDialog(
|
||||
DatabasePolicy finishedIndexingDialog(
|
||||
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
|
||||
float time, ErrorCountInfo errorInfo, bool interrupted) override;
|
||||
|
||||
virtual void hideDialogs(bool unblockUI = true) override;
|
||||
void hideDialogs(bool unblockUI = true) override;
|
||||
|
||||
virtual int confirm(const std::string& message, const std::vector<std::string>& options) override;
|
||||
virtual int confirm(const std::wstring& message, const std::vector<std::wstring>& options) override;
|
||||
int confirm(const std::string& message, const std::vector<std::string>& options) override;
|
||||
int confirm(const std::wstring& message, const std::vector<std::wstring>& options) override;
|
||||
|
||||
void setParentWindow(QtWindow* window);
|
||||
|
||||
|
||||
@@ -207,8 +207,16 @@ void QtIndexingDialog::setupReport(
|
||||
layout->addStretch();
|
||||
|
||||
addButtons(layout);
|
||||
updateNextButton("OK");
|
||||
setCloseVisible(false);
|
||||
if (interrupted)
|
||||
{
|
||||
updateNextButton("Keep");
|
||||
updateCloseButton("Discard");
|
||||
}
|
||||
else
|
||||
{
|
||||
updateNextButton("OK");
|
||||
setCloseVisible(false);
|
||||
}
|
||||
|
||||
m_sizeHint = QSize(interrupted ? 400 : 430, 280);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user