logic: Show hidden indexing dialog on refresh

* Fixed refresh restarted when refreshing while processing files
This commit is contained in:
Eberhard Graether
2018-10-17 01:30:33 +02:00
parent d78e80b548
commit 842bce8b32
12 changed files with 64 additions and 40 deletions
+1 -1
View File
@@ -190,7 +190,7 @@ void QtStatusBar::showErrors()
void QtStatusBar::clickedIndexingProgress()
{
MessageIndexingShowDialog(true).dispatch();
MessageIndexingShowDialog().dispatch();
}
QWidget* QtStatusBar::addPermanentVLine()
+13 -6
View File
@@ -134,8 +134,8 @@ void QtDialogView::hideProgressDialog()
}
void QtDialogView::startIndexingDialog(
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info,
std::function<void(const RefreshInfo& info)> onStartIndexing)
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode,
std::function<void(const RefreshInfo& info)> onStartIndexing, std::function<void()> onCancelIndexing)
{
m_refreshInfos.clear();
@@ -146,9 +146,6 @@ void QtDialogView::startIndexingDialog(
m_windowStack.clearWindows();
QtIndexingDialog* window = createWindow();
window->setupStart(enabledModes);
m_refreshInfos.emplace(info.mode, info);
connect(window, &QtIndexingDialog::setMode,
[=](RefreshMode refreshMode)
@@ -157,6 +154,7 @@ void QtDialogView::startIndexingDialog(
if (it != m_refreshInfos.end())
{
window->updateRefreshInfo(it->second);
window->show();
return;
}
@@ -184,6 +182,7 @@ void QtDialogView::startIndexingDialog(
timer->stop();
hideUnknownProgress();
window->show();
}
);
}
@@ -209,11 +208,19 @@ void QtDialogView::startIndexingDialog(
connect(window, &QtWindow::canceled,
[=]()
{
Task::dispatch(std::make_shared<TaskLambda>(
[=]()
{
onCancelIndexing();
}
));
setUIBlocked(false);
}
);
window->updateRefreshInfo(info);
window->setupStart(enabledModes, initialMode);
window->hide();
setUIBlocked(true);
}
);
+2 -2
View File
@@ -40,8 +40,8 @@ public:
void hideProgressDialog() override;
void startIndexingDialog(
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info,
std::function<void(const RefreshInfo& info)> onStartIndexing) override;
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode,
std::function<void(const RefreshInfo& info)> onStartIndexing, std::function<void()> onCancelIndexing) override;
void updateIndexingDialog(
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths) override;
DatabasePolicy finishedIndexingDialog(
+9 -2
View File
@@ -3,12 +3,13 @@
#include <QHBoxLayout>
#include <QFrame>
#include "MessageIndexingShowDialog.h"
#include "MessageRefresh.h"
#include "ResourcePaths.h"
#include "QtSearchBarButton.h"
#include "utilityQt.h"
#include "QtViewWidgetWrapper.h"
#include "utilityQt.h"
QtRefreshView::QtRefreshView(ViewLayout* viewLayout)
: RefreshView(viewLayout)
@@ -25,7 +26,13 @@ QtRefreshView::QtRefreshView(ViewLayout* viewLayout)
new QtSearchBarButton(ResourcePaths::getGuiPath().concatenate(L"refresh_view/images/refresh.png"));
refreshButton->setObjectName("refresh_button");
refreshButton->setToolTip("refresh");
m_widget->connect(refreshButton, &QPushButton::clicked, [](){ MessageRefresh().dispatch(); });
m_widget->connect(refreshButton, &QPushButton::clicked,
[]()
{
MessageIndexingShowDialog().dispatch();
MessageRefresh().dispatch();
}
);
layout->addWidget(refreshButton);
m_widget->setLayout(layout);
+7 -1
View File
@@ -38,7 +38,7 @@ QtIndexingDialog::DialogType QtIndexingDialog::getType() const
return m_type;
}
void QtIndexingDialog::setupStart(const std::vector<RefreshMode>& enabledModes)
void QtIndexingDialog::setupStart(const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode)
{
setType(DIALOG_START_INDEXING);
@@ -111,6 +111,10 @@ void QtIndexingDialog::setupStart(const std::vector<RefreshMode>& enabledModes)
QRadioButton* button = p.second;
button->setObjectName("option");
button->setEnabled(false);
if (p.first == initialMode)
{
button->setChecked(true);
}
modeLayout->addWidget(button);
connect(button, &QRadioButton::toggled, func);
}
@@ -132,6 +136,8 @@ void QtIndexingDialog::setupStart(const std::vector<RefreshMode>& enabledModes)
m_sizeHint = QSize(350, 310);
finishSetup();
emit setMode(initialMode);
}
void QtIndexingDialog::updateRefreshInfo(const RefreshInfo& info)
+1 -1
View File
@@ -37,7 +37,7 @@ public:
DialogType getType() const;
void setupStart(const std::vector<RefreshMode>& enabledModes);
void setupStart(const std::vector<RefreshMode>& enabledModes, const RefreshMode initialMode);
void updateRefreshInfo(const RefreshInfo& info);
void setupIndexing(bool hideable);
+3
View File
@@ -39,6 +39,7 @@
#include "MessageDisplayBookmarks.h"
#include "MessageEnteredLicense.h"
#include "MessageFind.h"
#include "MessageIndexingShowDialog.h"
#include "MessageInterruptTasks.h"
#include "MessageLoadProject.h"
#include "MessageRefresh.h"
@@ -660,11 +661,13 @@ void QtMainWindow::closeWindow()
void QtMainWindow::refresh()
{
MessageIndexingShowDialog().dispatch();
MessageRefresh().dispatch();
}
void QtMainWindow::forceRefresh()
{
MessageIndexingShowDialog().dispatch();
MessageRefresh().refreshAll().dispatch();
}