logic: background indexing (issue #175)
* allow hiding of indexing dialogs to browse loaded project while indexing * show indexing status in status bar while indexing * use different dialog views for different use cases to avoid state collisions * fixed error label in status bar jittering while indexing * show hand cursors for clickable elements in status bar * indexing is not interrupted on pressing ESC while in hidden * disable error table and error label while indexing * refactored indexing messages * forbid indexing and changing project while indexing * don't show indexing status messages in status bar when indexing in the background * allow tasks to run in the background fortune cookie message = A journey is waiting for you.
This commit is contained in:
@@ -541,6 +541,7 @@
|
||||
<text>
|
||||
<normal>#D4D4D4</normal>
|
||||
<active>black</active>
|
||||
<disabled>#AAA</disabled>
|
||||
</text>
|
||||
<table_line_1>
|
||||
<normal>#494949</normal>
|
||||
|
||||
@@ -508,6 +508,7 @@
|
||||
<text>
|
||||
<normal>black</normal>
|
||||
<active>white</active>
|
||||
<disabled>#777</disabled>
|
||||
</text>
|
||||
<table_line_1>
|
||||
<normal>white</normal>
|
||||
|
||||
@@ -518,6 +518,7 @@
|
||||
<text>
|
||||
<normal>white</normal>
|
||||
<active>black</active>
|
||||
<disabled>#AAA</disabled>
|
||||
</text>
|
||||
<table_line_1>
|
||||
<normal>#272728</normal>
|
||||
|
||||
@@ -50,6 +50,10 @@ QTableView {
|
||||
font-size: <setting:font_size>px;
|
||||
}
|
||||
|
||||
QTableView:disabled {
|
||||
color: <color:table/text/disabled>;
|
||||
}
|
||||
|
||||
QTableView::item {
|
||||
border-left: 1px solid <color:table/table>;
|
||||
}
|
||||
@@ -92,6 +96,10 @@ QHeaderView::section:vertical {
|
||||
padding: 2px 5px 1px;
|
||||
}
|
||||
|
||||
QHeaderView::section:disabled {
|
||||
color: <color:table/text/disabled>;
|
||||
}
|
||||
|
||||
QTableView QTableCornerButton::section {
|
||||
background-color: <color:table/background>;
|
||||
border-bottom: 1px solid <color:table/table>;
|
||||
@@ -103,6 +111,14 @@ QCheckBox {
|
||||
font-size: <setting:font_size>px;
|
||||
}
|
||||
|
||||
QLabel {
|
||||
color: <color:table/text/normal>;
|
||||
}
|
||||
|
||||
QLabel:disabled {
|
||||
color: <color:table/text/disabled>;
|
||||
}
|
||||
|
||||
#help_button {
|
||||
background: transparent;
|
||||
border: none;
|
||||
|
||||
+63
-62
@@ -153,32 +153,32 @@ bool Application::hasGUI()
|
||||
|
||||
int Application::handleDialog(const std::string& message)
|
||||
{
|
||||
return getDialogView()->confirm(message);
|
||||
return getDialogView(DialogView::UseCase::GENERAL)->confirm(message);
|
||||
}
|
||||
|
||||
int Application::handleDialog(const std::string& message, const std::vector<std::string>& options)
|
||||
{
|
||||
return getDialogView()->confirm(message, options);
|
||||
return getDialogView(DialogView::UseCase::GENERAL)->confirm(message, options);
|
||||
}
|
||||
|
||||
int Application::handleDialog(const std::wstring& message)
|
||||
{
|
||||
return getDialogView()->confirm(message);
|
||||
return getDialogView(DialogView::UseCase::GENERAL)->confirm(message);
|
||||
}
|
||||
|
||||
int Application::handleDialog(const std::wstring& message, const std::vector<std::wstring>& options)
|
||||
{
|
||||
return getDialogView()->confirm(message, options);
|
||||
return getDialogView(DialogView::UseCase::GENERAL)->confirm(message, options);
|
||||
}
|
||||
|
||||
std::shared_ptr<DialogView> Application::getDialogView()
|
||||
std::shared_ptr<DialogView> Application::getDialogView(DialogView::UseCase useCase)
|
||||
{
|
||||
if (m_componentManager)
|
||||
{
|
||||
return m_componentManager->getDialogView();
|
||||
return m_componentManager->getDialogView(useCase);
|
||||
}
|
||||
|
||||
return std::make_shared<DialogView>(nullptr);
|
||||
return std::make_shared<DialogView>(useCase, nullptr);
|
||||
}
|
||||
|
||||
void Application::updateHistoryMenu(const std::vector<std::shared_ptr<MessageBase>>& historyMenuItems)
|
||||
@@ -191,59 +191,6 @@ void Application::updateBookmarks(const std::vector<std::shared_ptr<Bookmark>>&
|
||||
m_mainView->updateBookmarksMenu(bookmarks);
|
||||
}
|
||||
|
||||
void Application::createAndLoadProject(FilePath projectSettingsFilePath)
|
||||
{
|
||||
MessageStatus(L"Loading Project: " + projectSettingsFilePath.wstr(), false, true).dispatch();
|
||||
|
||||
projectSettingsFilePath = migrateProjectSettings(projectSettingsFilePath);
|
||||
|
||||
try
|
||||
{
|
||||
updateRecentProjects(projectSettingsFilePath);
|
||||
|
||||
m_storageCache->clear();
|
||||
m_storageCache->setSubject(nullptr);
|
||||
|
||||
m_project = std::make_shared<Project>(
|
||||
std::make_shared<ProjectSettings>(projectSettingsFilePath), m_storageCache.get(), hasGUI());
|
||||
|
||||
if (m_project)
|
||||
{
|
||||
m_project->load();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "Failed to load project.");
|
||||
MessageStatus(L"Failed to load project: " + projectSettingsFilePath.wstr(), true).dispatch();
|
||||
}
|
||||
|
||||
updateTitle();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "Failed to load project, exception thrown: " << e.what());
|
||||
MessageStatus(L"Failed to load project, exception was thrown: " + projectSettingsFilePath.wstr(), true).dispatch();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "Failed to load project, unknown exception thrown.");
|
||||
MessageStatus(L"Failed to load project, unknown exception was thrown: " + projectSettingsFilePath.wstr(), true).dispatch();
|
||||
}
|
||||
|
||||
if (m_hasGUI)
|
||||
{
|
||||
m_componentManager->clearComponents();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::refreshProject(RefreshMode refreshMode)
|
||||
{
|
||||
if (m_project && checkSharedMemory())
|
||||
{
|
||||
m_project->refresh(refreshMode, getDialogView().get());
|
||||
}
|
||||
}
|
||||
|
||||
void Application::handleMessage(MessageActivateWindow* message)
|
||||
{
|
||||
if (m_hasGUI)
|
||||
@@ -261,7 +208,7 @@ void Application::handleMessage(MessageEnteredLicense* message)
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
void Application::handleMessage(MessageFinishedParsing* message)
|
||||
void Application::handleMessage(MessageIndexingFinished* message)
|
||||
{
|
||||
logStorageStats();
|
||||
|
||||
@@ -285,6 +232,12 @@ void Application::handleMessage(MessageLoadProject* message)
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_project && m_project->isIndexing())
|
||||
{
|
||||
MessageStatus(L"Cannot load another project while indexing.", true, false).dispatch();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_project && projectSettingsFilePath == m_project->getProjectSettingsFilePath())
|
||||
{
|
||||
if (message->settingsChanged && m_hasGUI)
|
||||
@@ -295,7 +248,47 @@ void Application::handleMessage(MessageLoadProject* message)
|
||||
}
|
||||
else
|
||||
{
|
||||
createAndLoadProject(projectSettingsFilePath);
|
||||
MessageStatus(L"Loading Project: " + projectSettingsFilePath.wstr(), false, true).dispatch();
|
||||
|
||||
projectSettingsFilePath = migrateProjectSettings(projectSettingsFilePath);
|
||||
|
||||
try
|
||||
{
|
||||
updateRecentProjects(projectSettingsFilePath);
|
||||
|
||||
m_storageCache->clear();
|
||||
m_storageCache->setSubject(nullptr);
|
||||
|
||||
m_project = std::make_shared<Project>(
|
||||
std::make_shared<ProjectSettings>(projectSettingsFilePath), m_storageCache.get(), hasGUI());
|
||||
|
||||
if (m_project)
|
||||
{
|
||||
m_project->load();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "Failed to load project.");
|
||||
MessageStatus(L"Failed to load project: " + projectSettingsFilePath.wstr(), true).dispatch();
|
||||
}
|
||||
|
||||
updateTitle();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "Failed to load project, exception thrown: " << e.what());
|
||||
MessageStatus(L"Failed to load project, exception was thrown: " + projectSettingsFilePath.wstr(), true).dispatch();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "Failed to load project, unknown exception thrown.");
|
||||
MessageStatus(L"Failed to load project, unknown exception was thrown: " + projectSettingsFilePath.wstr(), true).dispatch();
|
||||
}
|
||||
|
||||
if (m_hasGUI)
|
||||
{
|
||||
m_componentManager->clearComponents();
|
||||
}
|
||||
|
||||
if (message->refreshMode != REFRESH_NONE)
|
||||
{
|
||||
@@ -400,6 +393,14 @@ void Application::startMessagingAndScheduling()
|
||||
queue->startMessageLoopThreaded();
|
||||
}
|
||||
|
||||
void Application::refreshProject(RefreshMode refreshMode)
|
||||
{
|
||||
if (m_project && checkSharedMemory())
|
||||
{
|
||||
m_project->refresh(refreshMode, getDialogView(DialogView::UseCase::INDEXING).get());
|
||||
}
|
||||
}
|
||||
|
||||
void Application::updateRecentProjects(const FilePath& projectSettingsFilePath)
|
||||
{
|
||||
if (m_hasGUI)
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "component/ComponentManager.h"
|
||||
#include "project/Project.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingFinished.h"
|
||||
#include "utility/messaging/type/MessageActivateWindow.h"
|
||||
#include "utility/messaging/type/MessageEnteredLicense.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
||||
@@ -27,7 +27,7 @@ class ViewFactory;
|
||||
class Application
|
||||
: public MessageListener<MessageActivateWindow>
|
||||
, public MessageListener<MessageEnteredLicense>
|
||||
, public MessageListener<MessageFinishedParsing>
|
||||
, public MessageListener<MessageIndexingFinished>
|
||||
, public MessageListener<MessageLoadProject>
|
||||
, public MessageListener<MessageRefresh>
|
||||
, public MessageListener<MessageSwitchColorScheme>
|
||||
@@ -47,15 +47,13 @@ public:
|
||||
|
||||
const std::shared_ptr<Project> getCurrentProject();
|
||||
|
||||
void createAndLoadProject(FilePath projectSettingsFilePath);
|
||||
void refreshProject(RefreshMode refreshMode);
|
||||
bool hasGUI();
|
||||
|
||||
int handleDialog(const std::string& message);
|
||||
int handleDialog(const std::string& message, const std::vector<std::string>& options);
|
||||
int handleDialog(const std::wstring& message);
|
||||
int handleDialog(const std::wstring& message, const std::vector<std::wstring>& options);
|
||||
std::shared_ptr<DialogView> getDialogView();
|
||||
std::shared_ptr<DialogView> getDialogView(DialogView::UseCase useCase);
|
||||
|
||||
void updateHistoryMenu(const std::vector<std::shared_ptr<MessageBase>>& historyMenuItems);
|
||||
void updateBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks);
|
||||
@@ -68,7 +66,7 @@ private:
|
||||
|
||||
virtual void handleMessage(MessageActivateWindow* message);
|
||||
virtual void handleMessage(MessageEnteredLicense* message);
|
||||
virtual void handleMessage(MessageFinishedParsing* message);
|
||||
virtual void handleMessage(MessageIndexingFinished* message);
|
||||
virtual void handleMessage(MessageLoadProject* message);
|
||||
virtual void handleMessage(MessageRefresh* message);
|
||||
virtual void handleMessage(MessageSwitchColorScheme* message);
|
||||
@@ -77,6 +75,7 @@ private:
|
||||
FilePath migrateProjectSettings(const FilePath& projectSettingsFilePath) const;
|
||||
void startMessagingAndScheduling();
|
||||
|
||||
void refreshProject(RefreshMode refreshMode);
|
||||
void updateRecentProjects(const FilePath& projectSettingsFilePath);
|
||||
|
||||
void logStorageStats() const;
|
||||
|
||||
@@ -277,8 +277,6 @@ add_files(
|
||||
data/TaskInjectStorage.h
|
||||
data/TaskMergeStorages.cpp
|
||||
data/TaskMergeStorages.h
|
||||
data/TaskShowUnknownProgressDialog.cpp
|
||||
data/TaskShowUnknownProgressDialog.h
|
||||
|
||||
project/Project.cpp
|
||||
project/Project.h
|
||||
@@ -432,6 +430,11 @@ add_files(
|
||||
utility/messaging/type/history/MessageHistoryRedo.h
|
||||
utility/messaging/type/history/MessageHistoryUndo.h
|
||||
|
||||
utility/messaging/type/indexing/MessageIndexingFinished.h
|
||||
utility/messaging/type/indexing/MessageIndexingShowDialog.h
|
||||
utility/messaging/type/indexing/MessageIndexingStarted.h
|
||||
utility/messaging/type/indexing/MessageIndexingStatus.h
|
||||
|
||||
utility/messaging/type/MessageActivateAll.h
|
||||
utility/messaging/type/MessageActivateBase.h
|
||||
utility/messaging/type/MessageActivateBookmark.h
|
||||
@@ -455,7 +458,6 @@ add_files(
|
||||
utility/messaging/type/MessageDisplayBookmarks.h
|
||||
utility/messaging/type/MessageEnteredLicense.h
|
||||
utility/messaging/type/MessageFind.h
|
||||
utility/messaging/type/MessageFinishedParsing.h
|
||||
utility/messaging/type/MessageFlushUpdates.h
|
||||
utility/messaging/type/MessageFocusIn.h
|
||||
utility/messaging/type/MessageFocusOut.h
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "component/ComponentManager.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
#include "component/controller/Controller.h"
|
||||
#include "component/controller/ScreenSearchController.h"
|
||||
#include "component/view/CompositeView.h"
|
||||
@@ -59,15 +61,19 @@ void ComponentManager::setup(ViewLayout* viewLayout)
|
||||
screenSearchController->addResponder(dynamic_cast<ScreenSearchResponder*>(codeComponent->getViewPtr()));
|
||||
m_components.push_back(screenSearchComponent);
|
||||
|
||||
m_dialogView = m_componentFactory->getViewFactory()->createDialogView(viewLayout, m_componentFactory->getStorageAccess());
|
||||
for (DialogView::UseCase useCase :
|
||||
{ DialogView::UseCase::GENERAL, DialogView::UseCase::INDEXING, DialogView::UseCase::PROJECT_SETUP })
|
||||
{
|
||||
m_dialogViews.emplace(
|
||||
useCase,
|
||||
m_componentFactory->getViewFactory()->createDialogView(viewLayout, useCase, m_componentFactory->getStorageAccess())
|
||||
);
|
||||
}
|
||||
|
||||
std::shared_ptr<TabbedView> tabbedView =
|
||||
m_componentFactory->getViewFactory()->createTabbedView(viewLayout, "Status");
|
||||
m_tabbedViews.push_back(tabbedView);
|
||||
|
||||
// std::shared_ptr<Component> logComponent = m_componentFactory->createLogComponent(tabbedView.get());
|
||||
// m_components.push_back(logComponent);
|
||||
|
||||
std::shared_ptr<Component> statusComponent = m_componentFactory->createStatusComponent(tabbedView.get());
|
||||
m_components.push_back(statusComponent);
|
||||
|
||||
@@ -112,9 +118,16 @@ void ComponentManager::refreshViews()
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<DialogView> ComponentManager::getDialogView() const
|
||||
std::shared_ptr<DialogView> ComponentManager::getDialogView(DialogView::UseCase useCase) const
|
||||
{
|
||||
return m_dialogView;
|
||||
auto it = m_dialogViews.find(useCase);
|
||||
if (it == m_dialogViews.end())
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "No DialogView available for useCase " << int(useCase));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
ComponentManager::ComponentManager()
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "component/Component.h"
|
||||
#include "component/ComponentFactory.h"
|
||||
#include "component/view/DialogView.h"
|
||||
|
||||
class CompositeView;
|
||||
class DialogView;
|
||||
@@ -27,7 +28,7 @@ public:
|
||||
void clearComponents();
|
||||
void refreshViews();
|
||||
|
||||
std::shared_ptr<DialogView> getDialogView() const;
|
||||
std::shared_ptr<DialogView> getDialogView(DialogView::UseCase useCase) const;
|
||||
|
||||
private:
|
||||
ComponentManager();
|
||||
@@ -39,7 +40,7 @@ private:
|
||||
std::vector<std::shared_ptr<TabbedView>> m_tabbedViews;
|
||||
std::vector<std::shared_ptr<Component>> m_components;
|
||||
|
||||
std::shared_ptr<DialogView> m_dialogView;
|
||||
std::map<DialogView::UseCase, std::shared_ptr<DialogView>> m_dialogViews;
|
||||
};
|
||||
|
||||
#endif // COMPONENT_MANAGER_H
|
||||
|
||||
@@ -349,7 +349,7 @@ void BookmarkController::handleMessage(MessageDisplayBookmarkCreator* message)
|
||||
showBookmarkCreator(message->nodeId);
|
||||
}
|
||||
|
||||
void BookmarkController::handleMessage(MessageFinishedParsing* message)
|
||||
void BookmarkController::handleMessage(MessageIndexingFinished* message)
|
||||
{
|
||||
m_bookmarkCache.clear();
|
||||
getView<BookmarkView>()->enableDisplayBookmarks(true);
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/error/MessageActivateErrors.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingFinished.h"
|
||||
#include "utility/messaging/type/MessageActivateAll.h"
|
||||
#include "utility/messaging/type/MessageActivateBookmark.h"
|
||||
#include "utility/messaging/type/MessageActivateTokens.h"
|
||||
#include "utility/messaging/type/MessageDisplayBookmarkCreator.h"
|
||||
#include "utility/messaging/type/MessageDisplayBookmarks.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
|
||||
#include "component/controller/Controller.h"
|
||||
|
||||
@@ -26,7 +26,7 @@ class BookmarkController
|
||||
, public MessageListener<MessageActivateTokens>
|
||||
, public MessageListener<MessageDisplayBookmarkCreator>
|
||||
, public MessageListener<MessageDisplayBookmarks>
|
||||
, public MessageListener<MessageFinishedParsing>
|
||||
, public MessageListener<MessageIndexingFinished>
|
||||
{
|
||||
public:
|
||||
BookmarkController(StorageAccess* storageAccess);
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
virtual void handleMessage(MessageActivateTokens* message);
|
||||
virtual void handleMessage(MessageDisplayBookmarkCreator* message);
|
||||
virtual void handleMessage(MessageDisplayBookmarks* message);
|
||||
virtual void handleMessage(MessageFinishedParsing* message);
|
||||
virtual void handleMessage(MessageIndexingFinished* message);
|
||||
|
||||
std::vector<std::wstring> getActiveTokenDisplayNames() const;
|
||||
std::vector<std::wstring> getDisplayNamesForNodeId(Id nodeId) const;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "component/controller/ErrorController.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "component/view/DialogView.h"
|
||||
#include "data/access/StorageAccess.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
@@ -100,7 +102,11 @@ void ErrorController::handleMessage(MessageErrorCountUpdate* message)
|
||||
}
|
||||
|
||||
getView()->addErrors(errors, message->errorCount, true);
|
||||
getView()->showDockWidget();
|
||||
|
||||
if (!Application::getInstance()->getDialogView(DialogView::UseCase::INDEXING)->dialogsHidden())
|
||||
{
|
||||
getView()->showDockWidget();
|
||||
}
|
||||
|
||||
m_errorCount += errors.size();
|
||||
}
|
||||
@@ -139,11 +145,18 @@ void ErrorController::handleMessage(MessageErrorsHelpMessage* message)
|
||||
getView()->showErrorHelpMessage();
|
||||
}
|
||||
|
||||
void ErrorController::handleMessage(MessageFinishedParsing* message)
|
||||
void ErrorController::handleMessage(MessageIndexingFinished* message)
|
||||
{
|
||||
clear();
|
||||
|
||||
showErrors(getView()->getErrorFilter(), false);
|
||||
|
||||
getView()->setEnabled(true);
|
||||
}
|
||||
|
||||
void ErrorController::handleMessage(MessageIndexingStarted* message)
|
||||
{
|
||||
getView()->setEnabled(false);
|
||||
}
|
||||
|
||||
void ErrorController::handleMessage(MessageShowError* message)
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
#include "utility/messaging/type/error/MessageErrorsForFile.h"
|
||||
#include "utility/messaging/type/error/MessageErrorsHelpMessage.h"
|
||||
#include "utility/messaging/type/error/MessageShowError.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingFinished.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingStarted.h"
|
||||
#include "utility/messaging/type/MessageActivateAll.h"
|
||||
#include "utility/messaging/type/MessageActivateFullTextSearch.h"
|
||||
#include "utility/messaging/type/MessageActivateTokens.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
|
||||
#include "component/controller/Controller.h"
|
||||
#include "component/view/ErrorView.h"
|
||||
@@ -30,7 +31,8 @@ class ErrorController
|
||||
, public MessageListener<MessageErrorsAll>
|
||||
, public MessageListener<MessageErrorsForFile>
|
||||
, public MessageListener<MessageErrorsHelpMessage>
|
||||
, public MessageListener<MessageFinishedParsing>
|
||||
, public MessageListener<MessageIndexingFinished>
|
||||
, public MessageListener<MessageIndexingStarted>
|
||||
, public MessageListener<MessageShowError>
|
||||
{
|
||||
public:
|
||||
@@ -50,7 +52,8 @@ private:
|
||||
virtual void handleMessage(MessageErrorsAll* message);
|
||||
virtual void handleMessage(MessageErrorsForFile* message);
|
||||
virtual void handleMessage(MessageErrorsHelpMessage* message);
|
||||
virtual void handleMessage(MessageFinishedParsing* message);
|
||||
virtual void handleMessage(MessageIndexingFinished* message);
|
||||
virtual void handleMessage(MessageIndexingStarted* message);
|
||||
virtual void handleMessage(MessageShowError* message);
|
||||
|
||||
ErrorView* getView() const;
|
||||
|
||||
@@ -33,9 +33,22 @@ void StatusBarController::handleMessage(MessageErrorCountUpdate* message)
|
||||
getView()->setErrorCount(message->errorCount);
|
||||
}
|
||||
|
||||
void StatusBarController::handleMessage(MessageFinishedParsing* message)
|
||||
void StatusBarController::handleMessage(MessageIndexingFinished* message)
|
||||
{
|
||||
getView()->setErrorCount(m_storageAccess->getErrorCount());
|
||||
getView()->hideIndexingProgress();
|
||||
}
|
||||
|
||||
void StatusBarController::handleMessage(MessageIndexingStatus* message)
|
||||
{
|
||||
if (message->showProgress)
|
||||
{
|
||||
getView()->showIndexingProgress(message->unknownProgress, message->progressPercent);
|
||||
}
|
||||
else
|
||||
{
|
||||
getView()->hideIndexingProgress();
|
||||
}
|
||||
}
|
||||
|
||||
void StatusBarController::handleMessage(MessagePingReceived* message)
|
||||
@@ -63,7 +76,10 @@ void StatusBarController::handleMessage(MessageRefresh* message)
|
||||
|
||||
void StatusBarController::handleMessage(MessageStatus* message)
|
||||
{
|
||||
setStatus(message->status(), message->isError, message->showLoader);
|
||||
if (message->showInStatusBar)
|
||||
{
|
||||
setStatus(message->status(), message->isError, message->showLoader);
|
||||
}
|
||||
}
|
||||
|
||||
void StatusBarController::setStatus(const std::wstring& status, bool isError, bool showLoader)
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/error/MessageErrorCountClear.h"
|
||||
#include "utility/messaging/type/error/MessageErrorCountUpdate.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingFinished.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingStatus.h"
|
||||
#include "utility/messaging/type/MessagePingReceived.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
@@ -20,7 +21,8 @@ class StatusBarController
|
||||
: public Controller
|
||||
, public MessageListener<MessageErrorCountClear>
|
||||
, public MessageListener<MessageErrorCountUpdate>
|
||||
, public MessageListener<MessageFinishedParsing>
|
||||
, public MessageListener<MessageIndexingFinished>
|
||||
, public MessageListener<MessageIndexingStatus>
|
||||
, public MessageListener<MessagePingReceived>
|
||||
, public MessageListener<MessageRefresh>
|
||||
, public MessageListener<MessageStatus>
|
||||
@@ -36,7 +38,8 @@ public:
|
||||
private:
|
||||
virtual void handleMessage(MessageErrorCountClear* message);
|
||||
virtual void handleMessage(MessageErrorCountUpdate* message);
|
||||
virtual void handleMessage(MessageFinishedParsing* message);
|
||||
virtual void handleMessage(MessageIndexingFinished* message);
|
||||
virtual void handleMessage(MessageIndexingStatus* message);
|
||||
virtual void handleMessage(MessagePingReceived* message);
|
||||
virtual void handleMessage(MessageRefresh* message);
|
||||
virtual void handleMessage(MessageStatus* message);
|
||||
|
||||
@@ -163,32 +163,6 @@ void UndoRedoController::handleMessage(MessageDeactivateEdge* message)
|
||||
m->setKeepContent(keepContent);
|
||||
}
|
||||
|
||||
void UndoRedoController::handleMessage(MessageFinishedParsing* message)
|
||||
{
|
||||
std::list<Command> newList;
|
||||
|
||||
for (const Command& command : m_list)
|
||||
{
|
||||
if (command.order == Command::ORDER_ACTIVATE)
|
||||
{
|
||||
MessageActivateTokens* msg = dynamic_cast<MessageActivateTokens*>(command.message.get());
|
||||
if (msg)
|
||||
{
|
||||
if (msg->isAggregation)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
msg->isFromSearch = false;
|
||||
}
|
||||
|
||||
newList.insert(newList.end(), command);
|
||||
}
|
||||
}
|
||||
|
||||
m_list = newList;
|
||||
m_iterator = m_list.end();
|
||||
}
|
||||
|
||||
void UndoRedoController::handleMessage(MessageGraphNodeBundleSplit* message)
|
||||
{
|
||||
Command command(std::make_shared<MessageGraphNodeBundleSplit>(*message), Command::ORDER_ADAPT);
|
||||
@@ -328,6 +302,32 @@ void UndoRedoController::handleMessage(MessageHistoryUndo* message)
|
||||
updateHistory();
|
||||
}
|
||||
|
||||
void UndoRedoController::handleMessage(MessageIndexingFinished* message)
|
||||
{
|
||||
std::list<Command> newList;
|
||||
|
||||
for (const Command& command : m_list)
|
||||
{
|
||||
if (command.order == Command::ORDER_ACTIVATE)
|
||||
{
|
||||
MessageActivateTokens* msg = dynamic_cast<MessageActivateTokens*>(command.message.get());
|
||||
if (msg)
|
||||
{
|
||||
if (msg->isAggregation)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
msg->isFromSearch = false;
|
||||
}
|
||||
|
||||
newList.insert(newList.end(), command);
|
||||
}
|
||||
}
|
||||
|
||||
m_list = newList;
|
||||
m_iterator = m_list.end();
|
||||
}
|
||||
|
||||
void UndoRedoController::handleMessage(MessageRefresh* message)
|
||||
{
|
||||
if (!message->uiOnly)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "utility/messaging/type/history/MessageHistoryRedo.h"
|
||||
#include "utility/messaging/type/history/MessageHistoryToPosition.h"
|
||||
#include "utility/messaging/type/history/MessageHistoryUndo.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingFinished.h"
|
||||
#include "utility/messaging/type/MessageActivateAll.h"
|
||||
#include "utility/messaging/type/MessageActivateFullTextSearch.h"
|
||||
#include "utility/messaging/type/MessageActivateLocalSymbols.h"
|
||||
@@ -18,7 +19,6 @@
|
||||
#include "utility/messaging/type/MessageActivateTrailEdge.h"
|
||||
#include "utility/messaging/type/MessageChangeFileView.h"
|
||||
#include "utility/messaging/type/MessageDeactivateEdge.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
|
||||
#include "utility/messaging/type/MessageGraphNodeExpand.h"
|
||||
#include "utility/messaging/type/MessageGraphNodeHide.h"
|
||||
@@ -45,7 +45,6 @@ class UndoRedoController
|
||||
, public MessageListener<MessageActivateTrailEdge>
|
||||
, public MessageListener<MessageChangeFileView>
|
||||
, public MessageListener<MessageDeactivateEdge>
|
||||
, public MessageListener<MessageFinishedParsing>
|
||||
, public MessageListener<MessageGraphNodeBundleSplit>
|
||||
, public MessageListener<MessageGraphNodeExpand>
|
||||
, public MessageListener<MessageGraphNodeHide>
|
||||
@@ -53,6 +52,7 @@ class UndoRedoController
|
||||
, public MessageListener<MessageHistoryRedo>
|
||||
, public MessageListener<MessageHistoryToPosition>
|
||||
, public MessageListener<MessageHistoryUndo>
|
||||
, public MessageListener<MessageIndexingFinished>
|
||||
, public MessageListener<MessageRefresh>
|
||||
, public MessageListener<MessageScrollCode>
|
||||
, public MessageListener<MessageScrollGraph>
|
||||
@@ -94,7 +94,6 @@ private:
|
||||
virtual void handleMessage(MessageActivateTrailEdge* message);
|
||||
virtual void handleMessage(MessageChangeFileView* message);
|
||||
virtual void handleMessage(MessageDeactivateEdge* message);
|
||||
virtual void handleMessage(MessageFinishedParsing* message);
|
||||
virtual void handleMessage(MessageGraphNodeBundleSplit* message);
|
||||
virtual void handleMessage(MessageGraphNodeExpand* message);
|
||||
virtual void handleMessage(MessageGraphNodeHide* message);
|
||||
@@ -102,6 +101,7 @@ private:
|
||||
virtual void handleMessage(MessageHistoryRedo* message);
|
||||
virtual void handleMessage(MessageHistoryToPosition* message);
|
||||
virtual void handleMessage(MessageHistoryUndo* message);
|
||||
virtual void handleMessage(MessageIndexingFinished* message);
|
||||
virtual void handleMessage(MessageRefresh* message);
|
||||
virtual void handleMessage(MessageScrollCode* message);
|
||||
virtual void handleMessage(MessageScrollGraph* message);
|
||||
|
||||
@@ -53,3 +53,8 @@ void CompositeView::showView(View* view)
|
||||
void CompositeView::hideView(View* view)
|
||||
{
|
||||
}
|
||||
|
||||
void CompositeView::setViewEnabled(View* view, bool enabled)
|
||||
{
|
||||
getViewLayout()->setViewEnabled(view, enabled);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ public:
|
||||
virtual void showView(View* view);
|
||||
virtual void hideView(View* view);
|
||||
|
||||
virtual void setViewEnabled(View* view, bool enabled);
|
||||
|
||||
private:
|
||||
std::vector<View*> m_views;
|
||||
CompositeDirection m_direction;
|
||||
|
||||
@@ -1,11 +1,32 @@
|
||||
#include "component/view/DialogView.h"
|
||||
|
||||
DialogView::DialogView(StorageAccess* storageAccess)
|
||||
: m_storageAccess(storageAccess)
|
||||
DialogView::DialogView(UseCase useCase, StorageAccess* storageAccess)
|
||||
: m_useCase(useCase)
|
||||
, m_storageAccess(storageAccess)
|
||||
{
|
||||
}
|
||||
|
||||
DialogView::~DialogView()
|
||||
DialogView::UseCase DialogView::getUseCase() const
|
||||
{
|
||||
return m_useCase;
|
||||
}
|
||||
|
||||
void DialogView::setDialogsHideable(bool hideable)
|
||||
{
|
||||
m_dialogsHideable = hideable;
|
||||
}
|
||||
|
||||
void DialogView::setUpdateIndexingStatus(bool updateStatus)
|
||||
{
|
||||
m_updateIndexingStatus = updateStatus;
|
||||
}
|
||||
|
||||
bool DialogView::dialogsHidden() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void DialogView::clearDialogs()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -31,7 +52,7 @@ void DialogView::startIndexingDialog(
|
||||
}
|
||||
|
||||
void DialogView::updateIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const FilePath& sourcePath)
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,10 +63,6 @@ DatabasePolicy DialogView::finishedIndexingDialog(
|
||||
return DATABASE_POLICY_KEEP; // used in non-gui mode
|
||||
}
|
||||
|
||||
void DialogView::hideDialogs(bool unblockUI)
|
||||
{
|
||||
}
|
||||
|
||||
int DialogView::confirm(const std::string& message)
|
||||
{
|
||||
return confirm(message, std::vector<std::string>());
|
||||
|
||||
@@ -20,8 +20,23 @@ enum DatabasePolicy
|
||||
class DialogView
|
||||
{
|
||||
public:
|
||||
DialogView(StorageAccess* storageAccess);
|
||||
virtual ~DialogView();
|
||||
enum class UseCase
|
||||
{
|
||||
GENERAL,
|
||||
INDEXING,
|
||||
PROJECT_SETUP
|
||||
};
|
||||
|
||||
DialogView(UseCase useCase, StorageAccess* storageAccess);
|
||||
virtual ~DialogView() = default;
|
||||
|
||||
UseCase getUseCase() const;
|
||||
|
||||
void setDialogsHideable(bool hideable);
|
||||
void setUpdateIndexingStatus(bool updateStatus);
|
||||
|
||||
virtual bool dialogsHidden() const;
|
||||
virtual void clearDialogs();
|
||||
|
||||
virtual void showUnknownProgressDialog(const std::wstring& title, const std::wstring& message);
|
||||
virtual void hideUnknownProgressDialog();
|
||||
@@ -32,20 +47,22 @@ public:
|
||||
virtual void startIndexingDialog(
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info);
|
||||
virtual void updateIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const FilePath& sourcePath);
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths);
|
||||
virtual DatabasePolicy finishedIndexingDialog(
|
||||
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
|
||||
float time, ErrorCountInfo errorInfo, bool interrupted);
|
||||
|
||||
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);
|
||||
int confirm(const std::wstring& message);
|
||||
virtual int confirm(const std::wstring& message, const std::vector<std::wstring>& options);
|
||||
|
||||
protected:
|
||||
const UseCase m_useCase;
|
||||
StorageAccess* m_storageAccess;
|
||||
|
||||
bool m_dialogsHideable = false;
|
||||
bool m_updateIndexingStatus = false;
|
||||
};
|
||||
|
||||
#endif // DIALOG_VIEW_H
|
||||
|
||||
@@ -7,10 +7,6 @@ StatusBarView::StatusBarView(ViewLayout* viewLayout)
|
||||
{
|
||||
}
|
||||
|
||||
StatusBarView::~StatusBarView()
|
||||
{
|
||||
}
|
||||
|
||||
std::string StatusBarView::getName() const
|
||||
{
|
||||
return "StatusBarView";
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
|
||||
class StatusBarController;
|
||||
|
||||
class StatusBarView : public View
|
||||
class StatusBarView
|
||||
: public View
|
||||
{
|
||||
public:
|
||||
StatusBarView(ViewLayout* viewLayout);
|
||||
~StatusBarView(void);
|
||||
virtual ~StatusBarView() = default;
|
||||
|
||||
virtual std::string getName() const;
|
||||
virtual void showMessage(const std::wstring& message, bool isError, bool showLoader) = 0;
|
||||
@@ -18,6 +19,9 @@ public:
|
||||
|
||||
virtual void showIdeStatus(const std::wstring& message) = 0;
|
||||
|
||||
virtual void showIndexingProgress(bool unknownProgress, size_t progressPercent) = 0;
|
||||
virtual void hideIndexingProgress() = 0;
|
||||
|
||||
protected:
|
||||
StatusBarController* getController();
|
||||
};
|
||||
|
||||
@@ -45,3 +45,8 @@ void TabbedView::hideView(View* view)
|
||||
{
|
||||
getViewLayout()->hideView(this);
|
||||
}
|
||||
|
||||
void TabbedView::setViewEnabled(View* view, bool enabled)
|
||||
{
|
||||
getViewLayout()->setViewEnabled(view, enabled);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ public:
|
||||
virtual void showView(View* view);
|
||||
virtual void hideView(View* view);
|
||||
|
||||
virtual void setViewEnabled(View* view, bool enabled);
|
||||
|
||||
private:
|
||||
std::vector<View*> m_views;
|
||||
std::string m_name;
|
||||
|
||||
@@ -45,6 +45,11 @@ ViewLayout* View::getViewLayout() const
|
||||
return m_viewLayout;
|
||||
}
|
||||
|
||||
void View::setEnabled(bool enabled)
|
||||
{
|
||||
return getViewLayout()->setViewEnabled(this, enabled);
|
||||
}
|
||||
|
||||
void View::setWidgetWrapper(std::shared_ptr<ViewWidgetWrapper> widgetWrapper)
|
||||
{
|
||||
m_widgetWrapper = widgetWrapper;
|
||||
|
||||
@@ -39,6 +39,8 @@ public:
|
||||
ViewWidgetWrapper* getWidgetWrapper() const;
|
||||
ViewLayout* getViewLayout() const;
|
||||
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
protected:
|
||||
template <typename ControllerType>
|
||||
ControllerType* getController();
|
||||
|
||||
@@ -3,7 +3,3 @@
|
||||
ViewFactory::ViewFactory()
|
||||
{
|
||||
}
|
||||
|
||||
ViewFactory::~ViewFactory()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#include <memory>
|
||||
|
||||
#include "component/view/CompositeView.h"
|
||||
#include "component/view/DialogView.h"
|
||||
|
||||
class BookmarkView;
|
||||
class CodeView;
|
||||
class DialogView;
|
||||
class ErrorView;
|
||||
class GraphView;
|
||||
class MainView;
|
||||
@@ -26,7 +26,7 @@ class ViewFactory
|
||||
{
|
||||
public:
|
||||
ViewFactory();
|
||||
virtual ~ViewFactory();
|
||||
virtual ~ViewFactory() = default;
|
||||
|
||||
virtual std::shared_ptr<MainView> createMainView() const = 0;
|
||||
virtual std::shared_ptr<CompositeView> createCompositeView(
|
||||
@@ -45,7 +45,8 @@ public:
|
||||
virtual std::shared_ptr<TooltipView> createTooltipView(ViewLayout* viewLayout) const = 0;
|
||||
virtual std::shared_ptr<UndoRedoView> createUndoRedoView(ViewLayout* viewLayout) const = 0;
|
||||
|
||||
virtual std::shared_ptr<DialogView> createDialogView(ViewLayout* viewLayout, StorageAccess* storageAccess) const = 0;
|
||||
virtual std::shared_ptr<DialogView> createDialogView(
|
||||
ViewLayout* viewLayout, DialogView::UseCase useCase, StorageAccess* storageAccess) const = 0;
|
||||
};
|
||||
|
||||
#endif // VIEW_FACTORY_H
|
||||
|
||||
@@ -17,6 +17,8 @@ public:
|
||||
virtual void showView(View* view) = 0;
|
||||
virtual void hideView(View* view) = 0;
|
||||
|
||||
virtual void setViewEnabled(View* view, bool enabled) = 0;
|
||||
|
||||
virtual View* findFloatingView(const std::string& name) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ TaskCleanStorage::TaskCleanStorage(
|
||||
|
||||
void TaskCleanStorage::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
Application::getInstance()->getDialogView()->showUnknownProgressDialog(
|
||||
Application::getInstance()->getDialogView(DialogView::UseCase::INDEXING)->showUnknownProgressDialog(
|
||||
L"Clearing Files", std::to_wstring(m_filePaths.size()) + L" Files");
|
||||
|
||||
m_start = utility::durationStart();
|
||||
@@ -38,7 +38,7 @@ Task::TaskState TaskCleanStorage::doUpdate(std::shared_ptr<Blackboard> blackboar
|
||||
|
||||
m_storage->clearFileElements(m_filePaths, [=](int progress)
|
||||
{
|
||||
Application::getInstance()->getDialogView()->showProgressDialog(
|
||||
Application::getInstance()->getDialogView(DialogView::UseCase::INDEXING)->showProgressDialog(
|
||||
L"Clearing", std::to_wstring(m_filePaths.size()) + L" Files", progress);
|
||||
}
|
||||
);
|
||||
@@ -52,7 +52,7 @@ void TaskCleanStorage::doExit(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
blackboard->set("clear_time", utility::duration(m_start));
|
||||
|
||||
Application::getInstance()->getDialogView()->hideProgressDialog();
|
||||
Application::getInstance()->getDialogView(DialogView::UseCase::INDEXING)->hideProgressDialog();
|
||||
}
|
||||
|
||||
void TaskCleanStorage::doReset(std::shared_ptr<Blackboard> blackboard)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "component/view/DialogView.h"
|
||||
#include "data/storage/PersistentStorage.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingFinished.h"
|
||||
#include "utility/messaging/type/MessageQuitApplication.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/scheduling/Blackboard.h"
|
||||
@@ -20,11 +20,11 @@ void TaskFinishParsing::terminate()
|
||||
Application* app = Application::getInstance().get();
|
||||
if (app)
|
||||
{
|
||||
app->getDialogView()->hideDialogs();
|
||||
app->getDialogView(DialogView::UseCase::INDEXING)->clearDialogs();
|
||||
}
|
||||
|
||||
MessageStatus(L"An unknown exception was thrown during indexing.", true, false).dispatch();
|
||||
MessageFinishedParsing().dispatch();
|
||||
MessageIndexingFinished().dispatch();
|
||||
}
|
||||
|
||||
void TaskFinishParsing::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
@@ -36,7 +36,7 @@ Task::TaskState TaskFinishParsing::doUpdate(std::shared_ptr<Blackboard> blackboa
|
||||
{
|
||||
TimeStamp start = utility::durationStart();
|
||||
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView(DialogView::UseCase::INDEXING);
|
||||
|
||||
dialogView->showUnknownProgressDialog(L"Finish Indexing", L"Optimizing database");
|
||||
m_storage->optimizeMemory();
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#include "data/TaskShowUnknownProgressDialog.h"
|
||||
|
||||
#include "component/view/DialogView.h"
|
||||
#include "Application.h"
|
||||
|
||||
TaskShowUnknownProgressDialog::TaskShowUnknownProgressDialog(
|
||||
const std::wstring& title,
|
||||
const std::wstring& message
|
||||
)
|
||||
: m_title(title)
|
||||
, m_message(message)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskShowUnknownProgressDialog::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
}
|
||||
|
||||
Task::TaskState TaskShowUnknownProgressDialog::doUpdate(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
if (std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView())
|
||||
{
|
||||
dialogView->showUnknownProgressDialog(m_title, m_message);
|
||||
}
|
||||
return STATE_SUCCESS;
|
||||
}
|
||||
|
||||
void TaskShowUnknownProgressDialog::doExit(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
}
|
||||
|
||||
void TaskShowUnknownProgressDialog::doReset(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef TASK_SHOW_UNKNOWN_PROGRESS_DIALOG_H
|
||||
#define TASK_SHOW_UNKNOWN_PROGRESS_DIALOG_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "utility/scheduling/Task.h"
|
||||
|
||||
class TaskShowUnknownProgressDialog
|
||||
: public Task
|
||||
{
|
||||
public:
|
||||
TaskShowUnknownProgressDialog(
|
||||
const std::wstring& title,
|
||||
const std::wstring& message
|
||||
);
|
||||
|
||||
private:
|
||||
void doEnter(std::shared_ptr<Blackboard> blackboard) override;
|
||||
TaskState doUpdate(std::shared_ptr<Blackboard> blackboard) override;
|
||||
void doExit(std::shared_ptr<Blackboard> blackboard) override;
|
||||
void doReset(std::shared_ptr<Blackboard> blackboard) override;
|
||||
|
||||
const std::wstring m_title;
|
||||
const std::wstring m_message;
|
||||
};
|
||||
|
||||
#endif // TASK_SHOW_UNKNOWN_PROGRESS_DIALOG_H
|
||||
@@ -167,7 +167,10 @@ void TaskBuildIndex::terminate()
|
||||
|
||||
void TaskBuildIndex::handleMessage(MessageInterruptTasks* message)
|
||||
{
|
||||
m_interrupted = true;
|
||||
if (!Application::getInstance()->getDialogView(DialogView::UseCase::INDEXING)->dialogsHidden())
|
||||
{
|
||||
m_interrupted = true;
|
||||
}
|
||||
}
|
||||
|
||||
void TaskBuildIndex::runIndexerProcess(int processId, const std::wstring& logFilePath)
|
||||
@@ -291,18 +294,8 @@ void TaskBuildIndex::updateIndexingDialog(
|
||||
blackboard->get("indexed_source_file_count", indexedSourceFileCount);
|
||||
}
|
||||
|
||||
if (!sourcePaths.empty())
|
||||
{
|
||||
std::vector<std::wstring> stati;
|
||||
for (const FilePath& path : sourcePaths)
|
||||
{
|
||||
m_indexingFileCount++;
|
||||
stati.push_back(L"[" + std::to_wstring(m_indexingFileCount) + L"/" + std::to_wstring(sourceFileCount) + L"] Indexing file: " + path.wstr());
|
||||
}
|
||||
MessageStatus(stati, false, true).dispatch();
|
||||
}
|
||||
m_indexingFileCount += sourcePaths.size();
|
||||
|
||||
Application::getInstance()->getDialogView()->updateIndexingDialog(
|
||||
m_indexingFileCount, indexedSourceFileCount, sourceFileCount, (sourcePaths.empty() ? FilePath() : sourcePaths.back())
|
||||
);
|
||||
Application::getInstance()->getDialogView(DialogView::UseCase::INDEXING)->updateIndexingDialog(
|
||||
m_indexingFileCount, indexedSourceFileCount, sourceFileCount, sourcePaths);
|
||||
}
|
||||
|
||||
@@ -19,10 +19,11 @@ void TaskParseWrapper::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
int sourceFileCount = 0;
|
||||
blackboard->get("source_file_count", sourceFileCount);
|
||||
if (std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView())
|
||||
|
||||
if (std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView(DialogView::UseCase::INDEXING))
|
||||
{
|
||||
dialogView->hideDialogs(false);
|
||||
dialogView->updateIndexingDialog(0, 0, sourceFileCount, FilePath());
|
||||
dialogView->clearDialogs();
|
||||
dialogView->updateIndexingDialog(0, 0, sourceFileCount, { });
|
||||
}
|
||||
|
||||
m_start = utility::durationStart();
|
||||
|
||||
@@ -351,7 +351,11 @@ void PersistentStorage::clearFileElements(const std::vector<FilePath>& filePaths
|
||||
{
|
||||
TRACE();
|
||||
|
||||
const std::vector<Id> fileNodeIds = getFileNodeIds(filePaths);
|
||||
std::vector<Id> fileNodeIds;
|
||||
for (const StorageFile& file : m_sqliteIndexStorage.getFilesByPaths(filePaths))
|
||||
{
|
||||
fileNodeIds.push_back(file.id);
|
||||
}
|
||||
|
||||
if (!fileNodeIds.empty())
|
||||
{
|
||||
|
||||
+65
-46
@@ -12,7 +12,6 @@
|
||||
#include "data/TaskFinishParsing.h"
|
||||
#include "data/TaskInjectStorage.h"
|
||||
#include "data/TaskMergeStorages.h"
|
||||
#include "data/TaskShowUnknownProgressDialog.h"
|
||||
#include "project/RefreshInfoGenerator.h"
|
||||
#include "project/SourceGroup.h"
|
||||
#include "project/SourceGroupFactory.h"
|
||||
@@ -23,7 +22,8 @@
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/messaging/type/error/MessageErrorCountClear.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingFinished.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingStarted.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/scheduling/TaskDecoratorRepeat.h"
|
||||
@@ -51,6 +51,7 @@ Project::Project(std::shared_ptr<ProjectSettings> settings, StorageCache* storag
|
||||
: m_settings(settings)
|
||||
, m_storageCache(storageCache)
|
||||
, m_state(PROJECT_STATE_NOT_LOADED)
|
||||
, m_isIndexing(false)
|
||||
, m_hasGUI(hasGUI)
|
||||
{
|
||||
}
|
||||
@@ -69,6 +70,11 @@ std::string Project::getDescription() const
|
||||
return m_settings->getDescription();
|
||||
}
|
||||
|
||||
bool Project::isIndexing() const
|
||||
{
|
||||
return m_isIndexing;
|
||||
}
|
||||
|
||||
bool Project::settingsEqualExceptNameAndLocation(const ProjectSettings& otherSettings) const
|
||||
{
|
||||
return m_settings->equalsExceptNameAndLocation(otherSettings);
|
||||
@@ -84,6 +90,12 @@ void Project::setStateOutdated()
|
||||
|
||||
void Project::load()
|
||||
{
|
||||
if (m_isIndexing)
|
||||
{
|
||||
MessageStatus(L"Cannot load another project while indexing.", true, false).dispatch();
|
||||
return;
|
||||
}
|
||||
|
||||
m_storageCache->clear();
|
||||
m_storageCache->setSubject(nullptr);
|
||||
|
||||
@@ -101,9 +113,10 @@ void Project::load()
|
||||
{
|
||||
if (dbPath.exists())
|
||||
{
|
||||
if (Application::getInstance()->getDialogView()->confirm(
|
||||
if (Application::getInstance()->getDialogView(DialogView::UseCase::GENERAL)->confirm(
|
||||
"Sourcetrail has been closed unexpectedly while indexing this project. You can either choose to keep the data that has "
|
||||
"already been indexed or discard that data and restore the state of your project before indexing?", { "Keep and Continue", "Discard and Restore" }) == 0)
|
||||
"already been indexed or discard that data and restore the state of your project before indexing?",
|
||||
{ "Keep and Continue", "Discard and Restore" }) == 0)
|
||||
{
|
||||
LOG_INFO("Switching to temporary indexing data on user's decision");
|
||||
FileSystem::remove(dbPath);
|
||||
@@ -124,7 +137,7 @@ void Project::load()
|
||||
}
|
||||
|
||||
m_storage = std::make_shared<PersistentStorage>(
|
||||
projectSettingsPath.replaceExtension(INDEX_DB_FILE_EXTENSION),
|
||||
projectSettingsPath.replaceExtension(INDEX_DB_FILE_EXTENSION),
|
||||
projectSettingsPath.replaceExtension(BOOKMARK_DB_FILE_EXTENSION)
|
||||
);
|
||||
|
||||
@@ -181,7 +194,7 @@ void Project::load()
|
||||
|
||||
if (m_hasGUI)
|
||||
{
|
||||
MessageFinishedParsing().dispatch();
|
||||
MessageIndexingFinished().dispatch();
|
||||
}
|
||||
MessageStatus(L"Finished Loading", false, false).dispatch();
|
||||
}
|
||||
@@ -214,6 +227,12 @@ void Project::load()
|
||||
|
||||
void Project::refresh(RefreshMode refreshMode, DialogView* dialogView)
|
||||
{
|
||||
if (m_isIndexing)
|
||||
{
|
||||
MessageStatus(L"Cannot refresh the project while indexing.", true, false).dispatch();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_state == PROJECT_STATE_NOT_LOADED)
|
||||
{
|
||||
return;
|
||||
@@ -354,15 +373,21 @@ RefreshInfo Project::getRefreshInfo(RefreshMode mode) const
|
||||
|
||||
void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView)
|
||||
{
|
||||
if (m_isIndexing)
|
||||
{
|
||||
MessageStatus(L"Cannot refresh project while indexing.", true, false).dispatch();
|
||||
return;
|
||||
}
|
||||
|
||||
if (info.mode != REFRESH_ALL_FILES && info.filesToClear.empty() && info.filesToIndex.empty())
|
||||
{
|
||||
if (m_hasGUI)
|
||||
{
|
||||
dialogView->hideDialogs();
|
||||
dialogView->clearDialogs();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageFinishedParsing().dispatch();
|
||||
MessageIndexingFinished().dispatch();
|
||||
}
|
||||
|
||||
MessageStatus(L"Nothing to refresh, all files are up-to-date.").dispatch();
|
||||
@@ -390,6 +415,10 @@ void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView)
|
||||
|
||||
std::shared_ptr<TaskGroupSequence> taskSequential = std::make_shared<TaskGroupSequence>();
|
||||
|
||||
bool hideable = m_state == PROJECT_STATE_LOADED || m_state == PROJECT_STATE_OUTDATED;
|
||||
dialogView->setDialogsHideable(hideable);
|
||||
dialogView->setUpdateIndexingStatus(true);
|
||||
|
||||
if (info.mode != REFRESH_ALL_FILES && (info.filesToClear.size() || info.nonIndexedFilesToClear.size()))
|
||||
{
|
||||
taskSequential->addTask(std::make_shared<TaskCleanStorage>(
|
||||
@@ -489,7 +518,9 @@ void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView)
|
||||
);
|
||||
// add task that notifies the user of what's going on
|
||||
taskSequential->addTask( // we don't need to hide this dialog again, because it's overridden by other dialogs later on.
|
||||
std::make_shared<TaskShowUnknownProgressDialog>(L"Finish Indexing", L"Saving\nRemaining Data")
|
||||
std::make_shared<TaskLambda>([dialogView]() {
|
||||
dialogView->showUnknownProgressDialog(L"Finish Indexing", L"Saving\nRemaining Data");
|
||||
})
|
||||
);
|
||||
|
||||
// add task that injects the remaining intermediate storages into the persistent storage
|
||||
@@ -509,7 +540,7 @@ void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView)
|
||||
|
||||
taskSequential->addTask(std::make_shared<TaskGroupSelector>()->addChildTasks(
|
||||
std::make_shared<TaskGroupSequence>()->addChildTasks(
|
||||
std::make_shared<TaskFindValue>("keep_database"),
|
||||
std::make_shared<TaskFindValue>("keep_database"),
|
||||
std::make_shared<TaskLambda>([this]() {
|
||||
Task::dispatch(std::make_shared<TaskLambda>([this]() {
|
||||
swapToTempStorage();
|
||||
@@ -521,37 +552,42 @@ void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView)
|
||||
std::make_shared<TaskFindValue>("discard_database"),
|
||||
std::make_shared<TaskLambda>([this]() {
|
||||
Task::dispatch(std::make_shared<TaskLambda>([this]() {
|
||||
const FilePath tempIndexDbPath = m_storage->getIndexDbFilePath().replaceExtension(TEMP_INDEX_DB_FILE_EXTENSION);
|
||||
if (tempIndexDbPath.exists())
|
||||
{
|
||||
LOG_INFO("Discarding temporary indexing data");
|
||||
FileSystem::remove(tempIndexDbPath);
|
||||
}
|
||||
discardTempStorage();
|
||||
}));
|
||||
})
|
||||
)
|
||||
));
|
||||
|
||||
taskSequential->addTask(std::make_shared<TaskLambda>([]() {
|
||||
MessageFinishedParsing().dispatch();
|
||||
taskSequential->addTask(std::make_shared<TaskLambda>([dialogView, this]() {
|
||||
m_isIndexing = false;
|
||||
dialogView->setDialogsHideable(false);
|
||||
dialogView->setUpdateIndexingStatus(false);
|
||||
|
||||
MessageIndexingFinished().dispatch();
|
||||
}));
|
||||
|
||||
taskSequential->setIsBackgroundTask(true);
|
||||
Task::dispatch(taskSequential);
|
||||
|
||||
m_isIndexing = true;
|
||||
MessageIndexingStarted().dispatch();
|
||||
}
|
||||
|
||||
void Project::swapToTempStorage()
|
||||
{
|
||||
LOG_INFO("Switching to temporary indexing data");
|
||||
|
||||
const FilePath indexDbFilePath = m_storage->getIndexDbFilePath();
|
||||
const FilePath tempIndexDbFilePath = indexDbFilePath.replaceExtension(TEMP_INDEX_DB_FILE_EXTENSION);
|
||||
const FilePath bookmarkDbFilePath = m_storage->getBookmarkDbFilePath();
|
||||
|
||||
m_storage.reset();
|
||||
FileSystem::remove(indexDbFilePath);
|
||||
FileSystem::rename(tempIndexDbFilePath, indexDbFilePath);
|
||||
m_storage = std::make_shared<PersistentStorage>(indexDbFilePath, bookmarkDbFilePath);
|
||||
m_storage->setup();
|
||||
|
||||
//std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
//std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView(DialogView::UseCase::INDEXING);
|
||||
//dialogView->showUnknownProgressDialog(L"Finish Indexing", L"Building caches");
|
||||
m_storage->buildCaches();
|
||||
//dialogView->hideUnknownProgressDialog();
|
||||
@@ -559,6 +595,16 @@ void Project::swapToTempStorage()
|
||||
m_storageCache->setSubject(m_storage.get());
|
||||
}
|
||||
|
||||
void Project::discardTempStorage()
|
||||
{
|
||||
const FilePath tempIndexDbPath = m_storage->getIndexDbFilePath().replaceExtension(TEMP_INDEX_DB_FILE_EXTENSION);
|
||||
if (tempIndexDbPath.exists())
|
||||
{
|
||||
LOG_INFO("Discarding temporary indexing data");
|
||||
FileSystem::remove(tempIndexDbPath);
|
||||
}
|
||||
}
|
||||
|
||||
bool Project::hasCxxSourceGroup() const
|
||||
{
|
||||
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
|
||||
@@ -573,30 +619,3 @@ bool Project::hasCxxSourceGroup() const
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Project::didFileChange(const FileInfo& info) const
|
||||
{
|
||||
FileInfo diskFileInfo = FileSystem::getFileInfoForPath(info.path);
|
||||
if (diskFileInfo.lastWriteTime > info.lastWriteTime)
|
||||
{
|
||||
std::shared_ptr<TextAccess> storedFileContent = m_storage->getFileContent(info.path);
|
||||
std::shared_ptr<TextAccess> diskFileContent = TextAccess::createFromFile(diskFileInfo.path);
|
||||
|
||||
const std::vector<std::string>& diskFileLines = diskFileContent->getAllLines();
|
||||
const std::vector<std::string>& storedFileLines = storedFileContent->getAllLines();
|
||||
|
||||
if (diskFileLines.size() == storedFileLines.size())
|
||||
{
|
||||
for (size_t i = 0; i < diskFileLines.size(); i++)
|
||||
{
|
||||
if (diskFileLines[i] != storedFileLines[i])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ public:
|
||||
FilePath getProjectSettingsFilePath() const;
|
||||
std::string getDescription() const;
|
||||
|
||||
bool isIndexing() const;
|
||||
|
||||
bool settingsEqualExceptNameAndLocation(const ProjectSettings& otherSettings) const;
|
||||
void setStateOutdated();
|
||||
|
||||
@@ -56,13 +58,16 @@ private:
|
||||
Project(const Project&);
|
||||
|
||||
void swapToTempStorage();
|
||||
void discardTempStorage();
|
||||
|
||||
bool hasCxxSourceGroup() const;
|
||||
bool didFileChange(const FileInfo& info) const;
|
||||
|
||||
std::shared_ptr<ProjectSettings> m_settings;
|
||||
StorageCache* const m_storageCache;
|
||||
|
||||
ProjectStateType m_state;
|
||||
bool m_isIndexing = false;
|
||||
|
||||
std::shared_ptr<PersistentStorage> m_storage;
|
||||
std::vector<std::shared_ptr<SourceGroup>> m_sourceGroups;
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef MESSAGE_FINISHED_PARSING_H
|
||||
#define MESSAGE_FINISHED_PARSING_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageFinishedParsing
|
||||
: public Message<MessageFinishedParsing>
|
||||
{
|
||||
public:
|
||||
MessageFinishedParsing()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageFinishedParsing";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_FINISHED_PARSING_H
|
||||
@@ -2,18 +2,20 @@
|
||||
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
MessageStatus::MessageStatus(const std::wstring& status, bool isError, bool showLoader)
|
||||
MessageStatus::MessageStatus(const std::wstring& status, bool isError, bool showLoader, bool showInStatusBar)
|
||||
: isError(isError)
|
||||
, showLoader(showLoader)
|
||||
, showInStatusBar(showInStatusBar)
|
||||
{
|
||||
m_stati.push_back(utility::replace(status, L"\n", L" "));
|
||||
|
||||
setSendAsTask(false);
|
||||
}
|
||||
|
||||
MessageStatus::MessageStatus(const std::vector<std::wstring>& stati, bool isError, bool showLoader)
|
||||
MessageStatus::MessageStatus(const std::vector<std::wstring>& stati, bool isError, bool showLoader, bool showInStatusBar)
|
||||
: isError(isError)
|
||||
, showLoader(showLoader)
|
||||
, showInStatusBar(showInStatusBar)
|
||||
, m_stati(stati)
|
||||
{
|
||||
setSendAsTask(false);
|
||||
|
||||
@@ -10,8 +10,8 @@ class MessageStatus
|
||||
: public Message<MessageStatus>
|
||||
{
|
||||
public:
|
||||
MessageStatus(const std::wstring& status, bool isError = false, bool showLoader = false);
|
||||
MessageStatus(const std::vector<std::wstring>& stati, bool isError = false, bool showLoader = false);
|
||||
MessageStatus(const std::wstring& status, bool isError = false, bool showLoader = false, bool showInStatusBar = true);
|
||||
MessageStatus(const std::vector<std::wstring>& stati, bool isError = false, bool showLoader = false, bool showInStatusBar = true);
|
||||
|
||||
static const std::string getStaticType();
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
|
||||
const bool isError;
|
||||
const bool showLoader;
|
||||
const bool showInStatusBar;
|
||||
|
||||
private:
|
||||
std::vector<std::wstring> m_stati;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef MESSAGE_INDEXING_FINISHED_H
|
||||
#define MESSAGE_INDEXING_FINISHED_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageIndexingFinished
|
||||
: public Message<MessageIndexingFinished>
|
||||
{
|
||||
public:
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageIndexingFinished";
|
||||
}
|
||||
|
||||
MessageIndexingFinished()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_INDEXING_FINISHED_H
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef MESSAGE_INDEXING_SHOW_DIALOG_H
|
||||
#define MESSAGE_INDEXING_SHOW_DIALOG_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageIndexingShowDialog
|
||||
: public Message<MessageIndexingShowDialog>
|
||||
{
|
||||
public:
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageIndexingShowDialog";
|
||||
}
|
||||
|
||||
MessageIndexingShowDialog(bool showDialog)
|
||||
: showDialog(showDialog)
|
||||
{
|
||||
}
|
||||
|
||||
const bool showDialog;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_INDEXING_SHOW_DIALOG_H
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef MESSAGE_INDEXING_STARTED_H
|
||||
#define MESSAGE_INDEXING_STARTED_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageIndexingStarted
|
||||
: public Message<MessageIndexingStarted>
|
||||
{
|
||||
public:
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageIndexingStarted";
|
||||
}
|
||||
|
||||
MessageIndexingStarted()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_INDEXING_STARTED_H
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef MESSAGE_INDEXING_STATUS_H
|
||||
#define MESSAGE_INDEXING_STATUS_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageIndexingStatus
|
||||
: public Message<MessageIndexingStatus>
|
||||
{
|
||||
public:
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageIndexingStatus";
|
||||
}
|
||||
|
||||
MessageIndexingStatus(bool showProgress, bool unknownProgress, size_t progressPercent)
|
||||
: showProgress(showProgress)
|
||||
, unknownProgress(unknownProgress)
|
||||
, progressPercent(progressPercent)
|
||||
{
|
||||
setSendAsTask(false);
|
||||
}
|
||||
|
||||
const bool showProgress;
|
||||
const bool unknownProgress;
|
||||
const size_t progressPercent;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_INDEXING_STATUS_H
|
||||
@@ -12,14 +12,9 @@ void Task::dispatchNext(std::shared_ptr<Task> task)
|
||||
TaskScheduler::getInstance()->pushNextTask(task);
|
||||
}
|
||||
|
||||
Task::Task()
|
||||
: m_enterCalled(false)
|
||||
, m_exitCalled(false)
|
||||
{
|
||||
}
|
||||
|
||||
Task::~Task()
|
||||
void Task::setIsBackgroundTask(bool background)
|
||||
{
|
||||
m_isBackgroundTask = background;
|
||||
}
|
||||
|
||||
Task::TaskState Task::update(std::shared_ptr<Blackboard> blackboard)
|
||||
@@ -32,7 +27,12 @@ Task::TaskState Task::update(std::shared_ptr<Blackboard> blackboard)
|
||||
|
||||
TaskState state = doUpdate(blackboard);
|
||||
|
||||
if (state != STATE_RUNNING && !m_exitCalled)
|
||||
if (m_isBackgroundTask && state == STATE_RUNNING)
|
||||
{
|
||||
state = STATE_HOLD;
|
||||
}
|
||||
|
||||
if ((state == STATE_SUCCESS || state == STATE_FAILURE) && !m_exitCalled)
|
||||
{
|
||||
doExit(blackboard);
|
||||
m_exitCalled = true;
|
||||
@@ -51,4 +51,3 @@ void Task::reset(std::shared_ptr<Blackboard> blackboard)
|
||||
void Task::terminate()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,9 @@ public:
|
||||
static void dispatch(std::shared_ptr<Task> task);
|
||||
static void dispatchNext(std::shared_ptr<Task> task);
|
||||
|
||||
Task();
|
||||
virtual ~Task();
|
||||
virtual ~Task() = default;
|
||||
|
||||
void setIsBackgroundTask(bool background);
|
||||
|
||||
TaskState update(std::shared_ptr<Blackboard> blackboard);
|
||||
void reset(std::shared_ptr<Blackboard> blackboard);
|
||||
@@ -32,8 +33,10 @@ private:
|
||||
virtual void doExit(std::shared_ptr<Blackboard> blackboard) = 0;
|
||||
virtual void doReset(std::shared_ptr<Blackboard> blackboard) = 0;
|
||||
|
||||
bool m_enterCalled;
|
||||
bool m_exitCalled;
|
||||
bool m_isBackgroundTask = false;
|
||||
|
||||
bool m_enterCalled = false;
|
||||
bool m_exitCalled = false;
|
||||
};
|
||||
|
||||
#endif // TASK_H
|
||||
|
||||
@@ -10,7 +10,7 @@ class TaskGroupSelector
|
||||
public:
|
||||
TaskGroupSelector();
|
||||
|
||||
virtual void addTask(std::shared_ptr<Task> task);
|
||||
void addTask(std::shared_ptr<Task> task) override;
|
||||
|
||||
private:
|
||||
void doEnter(std::shared_ptr<Blackboard> blackboard) override;
|
||||
|
||||
@@ -10,7 +10,7 @@ class TaskGroupSequence
|
||||
public:
|
||||
TaskGroupSequence();
|
||||
|
||||
virtual void addTask(std::shared_ptr<Task> task);
|
||||
void addTask(std::shared_ptr<Task> task) override;
|
||||
|
||||
private:
|
||||
void doEnter(std::shared_ptr<Blackboard> blackboard) override;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "utility/scheduling/TaskRunner.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/scheduling/Blackboard.h"
|
||||
#include "utility/scheduling/TaskScheduler.h"
|
||||
|
||||
TaskRunner::TaskRunner(std::shared_ptr<Task> task)
|
||||
@@ -9,12 +10,18 @@ TaskRunner::TaskRunner(std::shared_ptr<Task> task)
|
||||
{
|
||||
}
|
||||
|
||||
TaskRunner::~TaskRunner()
|
||||
{
|
||||
}
|
||||
|
||||
Task::TaskState TaskRunner::update(std::shared_ptr<Blackboard> blackboard)
|
||||
{
|
||||
if (!blackboard)
|
||||
{
|
||||
if (!m_blackboard)
|
||||
{
|
||||
m_blackboard = std::make_shared<Blackboard>();
|
||||
}
|
||||
|
||||
blackboard = m_blackboard;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (m_reset)
|
||||
@@ -50,6 +57,3 @@ void TaskRunner::terminate()
|
||||
m_task->terminate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ class TaskRunner
|
||||
{
|
||||
public:
|
||||
TaskRunner(std::shared_ptr<Task> task);
|
||||
~TaskRunner();
|
||||
|
||||
Task::TaskState update(std::shared_ptr<Blackboard> blackboard);
|
||||
void reset();
|
||||
@@ -18,6 +17,9 @@ public:
|
||||
private:
|
||||
std::shared_ptr<Task> m_task;
|
||||
bool m_reset;
|
||||
|
||||
// Only created by the first TaskRunner in the hierarchy, then passed down.
|
||||
std::shared_ptr<Blackboard> m_blackboard;
|
||||
};
|
||||
|
||||
#endif // TASK_RUNNER_H
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <thread>
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/scheduling/Blackboard.h"
|
||||
#include "utility/ScopedFunctor.h"
|
||||
|
||||
std::shared_ptr<TaskScheduler> TaskScheduler::getInstance()
|
||||
@@ -154,7 +153,6 @@ void TaskScheduler::processTasks()
|
||||
m_tasksMutex.lock();
|
||||
});
|
||||
|
||||
std::shared_ptr<Blackboard> blackboard = std::make_shared<Blackboard>();
|
||||
while (true)
|
||||
{
|
||||
{
|
||||
@@ -167,7 +165,7 @@ void TaskScheduler::processTasks()
|
||||
}
|
||||
}
|
||||
|
||||
state = runner->update(blackboard);
|
||||
state = runner->update(nullptr);
|
||||
if (state != Task::STATE_RUNNING)
|
||||
{
|
||||
break;
|
||||
|
||||
@@ -883,7 +883,7 @@ void QtCodeNavigator::handleMessage(MessageCodeReference* message)
|
||||
);
|
||||
}
|
||||
|
||||
void QtCodeNavigator::handleMessage(MessageFinishedParsing* message)
|
||||
void QtCodeNavigator::handleMessage(MessageIndexingFinished* message)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include "qt/element/QtCodeFileSingle.h"
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingFinished.h"
|
||||
#include "utility/messaging/type/MessageCodeReference.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/messaging/type/MessageShowReference.h"
|
||||
#include "utility/messaging/type/MessageSwitchColorScheme.h"
|
||||
#include "utility/messaging/type/MessageWindowFocus.h"
|
||||
@@ -24,7 +24,7 @@ class SourceLocationFile;
|
||||
class QtCodeNavigator
|
||||
: public QWidget
|
||||
, public MessageListener<MessageCodeReference>
|
||||
, public MessageListener<MessageFinishedParsing>
|
||||
, public MessageListener<MessageIndexingFinished>
|
||||
, public MessageListener<MessageShowReference>
|
||||
, public MessageListener<MessageSwitchColorScheme>
|
||||
, public MessageListener<MessageWindowFocus>
|
||||
@@ -163,7 +163,7 @@ private:
|
||||
};
|
||||
|
||||
void handleMessage(MessageCodeReference* message);
|
||||
void handleMessage(MessageFinishedParsing* message);
|
||||
void handleMessage(MessageIndexingFinished* message);
|
||||
void handleMessage(MessageShowReference* message);
|
||||
void handleMessage(MessageSwitchColorScheme* message);
|
||||
void handleMessage(MessageWindowFocus* message);
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#include "qt/element/QtStatusBar.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QMovie>
|
||||
#include <QProgressBar>
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "utility/messaging/type/error/MessageErrorsAll.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingShowDialog.h"
|
||||
#include "utility/messaging/type/MessageShowStatus.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
@@ -13,7 +16,8 @@ QtStatusBar::QtStatusBar()
|
||||
{
|
||||
addWidget(new QWidget()); // add some space
|
||||
|
||||
m_movie = std::make_shared<QMovie>(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"statusbar_view/loader.gif").wstr()));
|
||||
m_movie = std::make_shared<QMovie>(QString::fromStdWString(
|
||||
ResourcePaths::getGuiPath().concatenate(L"statusbar_view/loader.gif").wstr()));
|
||||
// if movie doesn't loop forever, force it to.
|
||||
if (m_movie->loopCount() != -1)
|
||||
{
|
||||
@@ -28,25 +32,68 @@ QtStatusBar::QtStatusBar()
|
||||
m_text.setFlat(true);
|
||||
m_text.setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_text.setSizePolicy(QSizePolicy::Ignored, m_text.sizePolicy().verticalPolicy());
|
||||
m_text.setCursor(Qt::PointingHandCursor);
|
||||
addWidget(&m_text, 1);
|
||||
setText(L"", false, false);
|
||||
|
||||
connect(&m_text, &QPushButton::clicked, this, &QtStatusBar::showStatus);
|
||||
|
||||
addPermanentWidget(&m_ideStatusText);
|
||||
// ide status
|
||||
{
|
||||
addPermanentVLine();
|
||||
addPermanentWidget(&m_ideStatusText);
|
||||
}
|
||||
|
||||
m_errorButton.hide();
|
||||
m_errorButton.setFlat(true);
|
||||
m_errorButton.setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_errorButton.setStyleSheet("QPushButton { color: #D00000; margin-right: 0; spacing: none; }");
|
||||
m_errorButton.setIcon(utility::colorizePixmap(
|
||||
QPixmap(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"statusbar_view/dot.png").wstr())),
|
||||
// "#D00000"
|
||||
QColor(0xD0, 0, 0)
|
||||
).scaledToHeight(12));
|
||||
addPermanentWidget(&m_errorButton);
|
||||
// errors
|
||||
{
|
||||
m_vlineError = addPermanentVLine();
|
||||
m_vlineError->hide();
|
||||
|
||||
m_errorButton.hide();
|
||||
m_errorButton.setFlat(true);
|
||||
m_errorButton.setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_errorButton.setStyleSheet("QPushButton { color: #D00000; margin-right: 0; spacing: none; }");
|
||||
m_errorButton.setIcon(utility::colorizePixmap(
|
||||
QPixmap(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"statusbar_view/dot.png").wstr())),
|
||||
QColor(0xD0, 0, 0)
|
||||
).scaledToHeight(12));
|
||||
m_errorButton.setCursor(Qt::PointingHandCursor);
|
||||
addPermanentWidget(&m_errorButton);
|
||||
|
||||
connect(&m_errorButton, &QPushButton::clicked, this, &QtStatusBar::showErrors);
|
||||
}
|
||||
|
||||
// indexing status
|
||||
{
|
||||
m_vlineIndexing = addPermanentVLine();
|
||||
m_vlineIndexing->hide();
|
||||
|
||||
m_indexingStatus = new QPushButton(this);
|
||||
m_indexingStatus->setFlat(true);
|
||||
m_indexingStatus->setMinimumWidth(150);
|
||||
m_indexingStatus->setStyleSheet("QPushButton { margin-right: 0; spacing: none; }");
|
||||
m_indexingStatus->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_indexingStatus->setCursor(Qt::PointingHandCursor);
|
||||
|
||||
connect(m_indexingStatus, &QPushButton::clicked, this, &QtStatusBar::clickedIndexingProgress);
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
layout->addWidget(new QLabel("Indexing:"));
|
||||
|
||||
m_indexingProgress = new QProgressBar();
|
||||
m_indexingProgress->setMinimum(0);
|
||||
m_indexingProgress->setMaximum(0);
|
||||
m_indexingProgress->setValue(0);
|
||||
layout->addWidget(m_indexingProgress);
|
||||
|
||||
m_indexingStatus->setLayout(layout);
|
||||
m_indexingStatus->hide();
|
||||
|
||||
addPermanentWidget(m_indexingStatus);
|
||||
}
|
||||
|
||||
connect(&m_errorButton, &QPushButton::clicked, this, &QtStatusBar::showErrors);
|
||||
}
|
||||
|
||||
void QtStatusBar::setText(const std::wstring& text, bool isError, bool showLoader)
|
||||
@@ -69,11 +116,8 @@ void QtStatusBar::setText(const std::wstring& text, bool isError, bool showLoade
|
||||
m_loader.hide();
|
||||
}
|
||||
|
||||
if (!text.empty())
|
||||
{
|
||||
m_textString = text;
|
||||
m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdWString(m_textString), Qt::ElideRight, m_text.width()));
|
||||
}
|
||||
m_textString = text;
|
||||
m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdWString(m_textString), Qt::ElideRight, m_text.width()));
|
||||
}
|
||||
|
||||
void QtStatusBar::setErrorCount(ErrorCountInfo errorCount)
|
||||
@@ -84,6 +128,9 @@ void QtStatusBar::setErrorCount(ErrorCountInfo errorCount)
|
||||
QString::number(errorCount.total) + " error" + (errorCount.total > 1 ? "s" : "") +
|
||||
(errorCount.fatal > 0 ? " (" + QString::number(errorCount.fatal) + " fatal)" : ""));
|
||||
|
||||
m_errorButton.setMinimumWidth(
|
||||
m_errorButton.fontMetrics().width(QString(m_errorButton.text().size(), 'a')));
|
||||
|
||||
if (errorCount.fatal > 0)
|
||||
{
|
||||
m_errorButton.setStyleSheet("QPushButton { color: #D00000; margin-right: 0; spacing: none; }");
|
||||
@@ -94,10 +141,12 @@ void QtStatusBar::setErrorCount(ErrorCountInfo errorCount)
|
||||
}
|
||||
|
||||
m_errorButton.show();
|
||||
m_vlineError->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_errorButton.hide();
|
||||
m_vlineError->hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +155,33 @@ void QtStatusBar::setIdeStatus(const std::wstring& text)
|
||||
m_ideStatusText.setText(QString::fromStdWString(text));
|
||||
}
|
||||
|
||||
void QtStatusBar::showIndexingProgress(bool unknownProgress, 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);
|
||||
}
|
||||
}
|
||||
|
||||
void QtStatusBar::hideIndexingProgress()
|
||||
{
|
||||
m_indexingStatus->hide();
|
||||
m_vlineIndexing->hide();
|
||||
|
||||
m_errorButton.setEnabled(true);
|
||||
}
|
||||
|
||||
void QtStatusBar::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
m_text.setText(m_text.fontMetrics().elidedText(QString::fromStdWString(m_textString), Qt::ElideRight, m_text.width()));
|
||||
@@ -120,3 +196,18 @@ void QtStatusBar::showErrors()
|
||||
{
|
||||
MessageErrorsAll().dispatch();
|
||||
}
|
||||
|
||||
void QtStatusBar::clickedIndexingProgress()
|
||||
{
|
||||
MessageIndexingShowDialog(true).dispatch();
|
||||
}
|
||||
|
||||
QWidget* QtStatusBar::addPermanentVLine()
|
||||
{
|
||||
QFrame* vline = new QFrame(this);
|
||||
vline->setFrameShape(QFrame::VLine);
|
||||
vline->setStyleSheet("color: #777");
|
||||
addPermanentWidget(vline);
|
||||
return vline;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include "data/ErrorCountInfo.h"
|
||||
|
||||
class QProgressBar;
|
||||
|
||||
class QtStatusBar
|
||||
: public QStatusBar
|
||||
{
|
||||
@@ -23,14 +25,20 @@ public:
|
||||
|
||||
void setIdeStatus(const std::wstring& text);
|
||||
|
||||
void showIndexingProgress(bool unknownProgress, size_t progressPercent);
|
||||
void hideIndexingProgress();
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
|
||||
private slots:
|
||||
void showStatus();
|
||||
void showErrors();
|
||||
void clickedIndexingProgress();
|
||||
|
||||
private:
|
||||
QWidget* addPermanentVLine();
|
||||
|
||||
std::shared_ptr<QMovie> m_movie;
|
||||
|
||||
std::wstring m_textString;
|
||||
@@ -40,6 +48,12 @@ private:
|
||||
QPushButton m_errorButton;
|
||||
|
||||
QLabel m_ideStatusText;
|
||||
|
||||
QPushButton* m_indexingStatus;
|
||||
QProgressBar* m_indexingProgress;
|
||||
|
||||
QWidget* m_vlineError;
|
||||
QWidget* m_vlineIndexing;
|
||||
};
|
||||
|
||||
#endif // QT_STATUS_BAR_H
|
||||
|
||||
@@ -11,13 +11,14 @@
|
||||
#include "qt/window/QtIndexingDialog.h"
|
||||
#include "qt/window/QtMainWindow.h"
|
||||
#include "qt/window/QtWindow.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingStatus.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/scheduling/TaskLambda.h"
|
||||
#include "utility/utility.h"
|
||||
#include "project/Project.h"
|
||||
|
||||
QtDialogView::QtDialogView(QtMainWindow* mainWindow, StorageAccess* storageAccess)
|
||||
: DialogView(storageAccess)
|
||||
QtDialogView::QtDialogView(QtMainWindow* mainWindow, UseCase useCase, StorageAccess* storageAccess)
|
||||
: DialogView(useCase, storageAccess)
|
||||
, m_mainWindow(mainWindow)
|
||||
, m_parentWindow(nullptr)
|
||||
, m_windowStack(this)
|
||||
@@ -30,6 +31,31 @@ QtDialogView::~QtDialogView()
|
||||
m_resultReady = true;
|
||||
}
|
||||
|
||||
bool QtDialogView::dialogsHidden() const
|
||||
{
|
||||
QtIndexingDialog* window = dynamic_cast<QtIndexingDialog*>(m_windowStack.getTopWindow());
|
||||
if (window)
|
||||
{
|
||||
return window->isHidden();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void QtDialogView::clearDialogs()
|
||||
{
|
||||
m_onQtThread2(
|
||||
[=]()
|
||||
{
|
||||
m_windowStack.clearWindows();
|
||||
|
||||
setUIBlocked(false);
|
||||
}
|
||||
);
|
||||
|
||||
setParentWindow(nullptr);
|
||||
}
|
||||
|
||||
void QtDialogView::showUnknownProgressDialog(const std::wstring& title, const std::wstring& message)
|
||||
{
|
||||
MessageStatus(title + L": " + message, false, true).dispatch();
|
||||
@@ -67,8 +93,8 @@ void QtDialogView::showProgressDialog(const std::wstring& title, const std::wstr
|
||||
{
|
||||
m_windowStack.clearWindows();
|
||||
|
||||
window = createWindow<QtIndexingDialog>();
|
||||
window->setupProgress();
|
||||
window = createWindow();
|
||||
window->setupProgress(m_dialogsHideable);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -88,7 +114,12 @@ void QtDialogView::showProgressDialog(const std::wstring& title, const std::wstr
|
||||
window->updateMessage(QString::fromStdWString(message));
|
||||
window->updateProgress(progress);
|
||||
|
||||
setUIBlocked(true);
|
||||
if (m_updateIndexingStatus)
|
||||
{
|
||||
MessageIndexingStatus(true, false, progress).dispatch();
|
||||
}
|
||||
|
||||
setUIBlocked(m_dialogsVisible);
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -123,7 +154,7 @@ void QtDialogView::startIndexingDialog(
|
||||
{
|
||||
m_windowStack.clearWindows();
|
||||
|
||||
QtIndexingDialog* window = createWindow<QtIndexingDialog>();
|
||||
QtIndexingDialog* window = createWindow();
|
||||
window->setupStart(enabledModes);
|
||||
|
||||
m_refreshInfos.emplace(info.mode, info);
|
||||
@@ -197,26 +228,48 @@ void QtDialogView::startIndexingDialog(
|
||||
}
|
||||
|
||||
void QtDialogView::updateIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const FilePath& sourcePath)
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
if (!sourcePaths.empty())
|
||||
{
|
||||
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());
|
||||
}
|
||||
MessageStatus(stati, false, true, m_dialogsVisible).dispatch();
|
||||
}
|
||||
|
||||
QtIndexingDialog* window = dynamic_cast<QtIndexingDialog*>(m_windowStack.getTopWindow());
|
||||
if (!window)
|
||||
{
|
||||
m_windowStack.clearWindows();
|
||||
|
||||
window = createWindow<QtIndexingDialog>();
|
||||
window->setupIndexing();
|
||||
window = createWindow();
|
||||
window->setupIndexing(m_dialogsHideable);
|
||||
}
|
||||
|
||||
if (window && window->getType() == QtIndexingDialog::DIALOG_INDEXING)
|
||||
{
|
||||
window->updateIndexingProgress(finishedFileCount, totalFileCount, sourcePath);
|
||||
setUIBlocked(true);
|
||||
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);
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -225,15 +278,21 @@ 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;
|
||||
|
||||
m_onQtThread(
|
||||
[=, &policy]()
|
||||
{
|
||||
m_dialogsVisible = true;
|
||||
m_windowStack.clearWindows();
|
||||
|
||||
QtIndexingDialog* window = createWindow<QtIndexingDialog>();
|
||||
QtIndexingDialog* window = createWindow();
|
||||
window->setupReport(indexedFileCount, totalIndexedFileCount, completedFileCount, totalFileCount, time, interrupted);
|
||||
window->updateErrorCount(errorInfo.total, errorInfo.fatal);
|
||||
connect(window, &QtWindow::finished,
|
||||
@@ -267,23 +326,6 @@ DatabasePolicy QtDialogView::finishedIndexingDialog(
|
||||
return policy;
|
||||
}
|
||||
|
||||
void QtDialogView::hideDialogs(bool unblockUI)
|
||||
{
|
||||
m_onQtThread2(
|
||||
[=]()
|
||||
{
|
||||
m_windowStack.clearWindows();
|
||||
|
||||
if (unblockUI)
|
||||
{
|
||||
setUIBlocked(false);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
setParentWindow(nullptr);
|
||||
}
|
||||
|
||||
int QtDialogView::confirm(const std::string& message, const std::vector<std::string>& options)
|
||||
{
|
||||
int result = -1;
|
||||
@@ -391,14 +433,19 @@ void QtDialogView::showUnknownProgress(const std::wstring& title, const std::wst
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = createWindow<QtIndexingDialog>();
|
||||
window->setupUnknownProgress();
|
||||
window = createWindow();
|
||||
window->setupUnknownProgress(m_dialogsHideable);
|
||||
}
|
||||
|
||||
window->updateTitle(QString::fromStdWString(title));
|
||||
window->updateMessage(QString::fromStdWString(message));
|
||||
|
||||
setUIBlocked(true);
|
||||
if (m_updateIndexingStatus)
|
||||
{
|
||||
MessageIndexingStatus(true, true, 0).dispatch();
|
||||
}
|
||||
|
||||
setUIBlocked(m_dialogsVisible);
|
||||
}
|
||||
|
||||
void QtDialogView::hideUnknownProgress()
|
||||
@@ -417,6 +464,13 @@ void QtDialogView::hideUnknownProgress()
|
||||
|
||||
void QtDialogView::setUIBlocked(bool blocked)
|
||||
{
|
||||
if (m_uiBlocked == blocked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_uiBlocked = blocked;
|
||||
|
||||
if (m_parentWindow)
|
||||
{
|
||||
m_parentWindow->setEnabled(!blocked);
|
||||
@@ -436,8 +490,41 @@ void QtDialogView::setUIBlocked(bool blocked)
|
||||
}
|
||||
}
|
||||
|
||||
void QtDialogView::dialogVisibilityChanged(bool visible)
|
||||
{
|
||||
QtIndexingDialog* window = dynamic_cast<QtIndexingDialog*>(m_windowStack.getTopWindow());
|
||||
if (!window)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
window->setVisible(visible);
|
||||
m_dialogsVisible = visible;
|
||||
setUIBlocked(visible);
|
||||
|
||||
if (!visible)
|
||||
{
|
||||
MessageStatus(L"", false, false).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void QtDialogView::handleMessage(MessageIndexingShowDialog* message)
|
||||
{
|
||||
m_onQtThread3(
|
||||
[=]()
|
||||
{
|
||||
dialogVisibilityChanged(true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtDialogView::handleMessage(MessageInterruptTasks* message)
|
||||
{
|
||||
if (!m_dialogsVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_onQtThread3(
|
||||
[=]()
|
||||
{
|
||||
@@ -475,26 +562,28 @@ void QtDialogView::updateErrorCount(size_t errorCount, size_t fatalCount)
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* QtDialogView::createWindow()
|
||||
QtIndexingDialog* QtDialogView::createWindow()
|
||||
{
|
||||
T* window = nullptr;
|
||||
QtIndexingDialog* window = nullptr;
|
||||
if (m_parentWindow)
|
||||
{
|
||||
window = new T(m_parentWindow);
|
||||
window = new QtIndexingDialog(m_parentWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
window = new T(m_mainWindow);
|
||||
window = new QtIndexingDialog(m_mainWindow);
|
||||
}
|
||||
|
||||
//make sure T is a QtWindow
|
||||
if (dynamic_cast<QtWindow*>(window))
|
||||
{
|
||||
connect(window, &QtWindow::canceled, &m_windowStack, &QtWindowStack::popWindow);
|
||||
connect(window, &QtWindow::finished, &m_windowStack, &QtWindowStack::clearWindows);
|
||||
connect(window, &QtWindow::canceled, &m_windowStack, &QtWindowStack::popWindow);
|
||||
connect(window, &QtWindow::finished, &m_windowStack, &QtWindowStack::clearWindows);
|
||||
|
||||
m_windowStack.pushWindow(window);
|
||||
connect(window, &QtIndexingDialog::visibleChanged, this, &QtDialogView::dialogVisibilityChanged);
|
||||
|
||||
m_windowStack.pushWindow(window);
|
||||
|
||||
if (!m_dialogsVisible)
|
||||
{
|
||||
window->hide();
|
||||
}
|
||||
|
||||
return window;
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/error/MessageErrorCountUpdate.h"
|
||||
#include "utility/messaging/type/indexing/MessageIndexingShowDialog.h"
|
||||
#include "utility/messaging/type/MessageInterruptTasks.h"
|
||||
#include "utility/messaging/type/MessageWindowClosed.h"
|
||||
|
||||
class QtIndexingDialog;
|
||||
class QtMainWindow;
|
||||
class QtWindow;
|
||||
|
||||
@@ -18,15 +20,19 @@ class QtDialogView
|
||||
: public QObject
|
||||
, public DialogView
|
||||
, public MessageListener<MessageErrorCountUpdate>
|
||||
, public MessageListener<MessageIndexingShowDialog>
|
||||
, public MessageListener<MessageInterruptTasks>
|
||||
, public MessageListener<MessageWindowClosed>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtDialogView(QtMainWindow* mainWindow, StorageAccess* storageAccess);
|
||||
QtDialogView(QtMainWindow* mainWindow, UseCase useCase, StorageAccess* storageAccess);
|
||||
~QtDialogView() override;
|
||||
|
||||
bool dialogsHidden() const override;
|
||||
void clearDialogs() override;
|
||||
|
||||
void showUnknownProgressDialog(const std::wstring& title, const std::wstring& message) override;
|
||||
void hideUnknownProgressDialog() override;
|
||||
|
||||
@@ -36,13 +42,11 @@ public:
|
||||
void startIndexingDialog(
|
||||
Project* project, const std::vector<RefreshMode>& enabledModes, const RefreshInfo& info) override;
|
||||
void updateIndexingDialog(
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const FilePath& sourcePath) override;
|
||||
size_t startedFileCount, size_t finishedFileCount, size_t totalFileCount, const std::vector<FilePath>& sourcePaths) override;
|
||||
DatabasePolicy finishedIndexingDialog(
|
||||
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
|
||||
float time, ErrorCountInfo errorInfo, bool interrupted) override;
|
||||
|
||||
void hideDialogs(bool unblockUI = true) 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;
|
||||
|
||||
@@ -53,16 +57,17 @@ private slots:
|
||||
void hideUnknownProgress();
|
||||
|
||||
void setUIBlocked(bool blocked);
|
||||
void dialogVisibilityChanged(bool visible);
|
||||
|
||||
private:
|
||||
void handleMessage(MessageErrorCountUpdate* message) override;
|
||||
void handleMessage(MessageIndexingShowDialog* message) override;
|
||||
void handleMessage(MessageInterruptTasks* message) override;
|
||||
void handleMessage(MessageWindowClosed* message) override;
|
||||
|
||||
void updateErrorCount(size_t errorCount, size_t fatalCount);
|
||||
|
||||
template<typename T>
|
||||
T* createWindow();
|
||||
QtIndexingDialog* createWindow();
|
||||
|
||||
QtMainWindow* m_mainWindow;
|
||||
QtWindow* m_parentWindow;
|
||||
@@ -76,6 +81,8 @@ private:
|
||||
std::map<RefreshMode, RefreshInfo> m_refreshInfos;
|
||||
|
||||
bool m_resultReady;
|
||||
bool m_uiBlocked = false;
|
||||
bool m_dialogsVisible = true;
|
||||
};
|
||||
|
||||
#endif // QT_DIALOG_VIEW_H
|
||||
|
||||
@@ -176,7 +176,6 @@ void QtErrorView::initView()
|
||||
|
||||
checkboxes->addSpacing(10);
|
||||
|
||||
|
||||
{
|
||||
m_editButton = new QtSelfRefreshIconButton(
|
||||
"Edit Project",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "qt/view/QtMainView.h"
|
||||
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "qt/window/QtMainWindow.h"
|
||||
|
||||
QtMainView::QtMainView()
|
||||
@@ -55,6 +56,17 @@ void QtMainView::hideView(View* view)
|
||||
);
|
||||
}
|
||||
|
||||
void QtMainView::setViewEnabled(View* view, bool enabled)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(view);
|
||||
widget->setEnabled(enabled);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
View* QtMainView::findFloatingView(const std::string& name) const
|
||||
{
|
||||
return m_window->findFloatingView(name);
|
||||
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
virtual void showView(View* view);
|
||||
virtual void hideView(View* view);
|
||||
|
||||
virtual void setViewEnabled(View* view, bool enabled);
|
||||
|
||||
virtual View* findFloatingView(const std::string& name) const;
|
||||
|
||||
virtual QStatusBar* getStatusBar();
|
||||
|
||||
@@ -15,10 +15,6 @@ QtStatusBarView::QtStatusBarView(ViewLayout* viewLayout)
|
||||
mw->setStatusBar(sb);
|
||||
}
|
||||
|
||||
QtStatusBarView::~QtStatusBarView()
|
||||
{
|
||||
}
|
||||
|
||||
void QtStatusBarView::createWidgetWrapper()
|
||||
{
|
||||
}
|
||||
@@ -60,3 +56,23 @@ void QtStatusBarView::showIdeStatus(const std::wstring& message)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtStatusBarView::showIndexingProgress(bool unknownProgress, size_t progressPercent)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_widget->showIndexingProgress(unknownProgress, progressPercent);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtStatusBarView::hideIndexingProgress()
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_widget->hideIndexingProgress();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class QtStatusBarView
|
||||
{
|
||||
public:
|
||||
QtStatusBarView(ViewLayout* viewLayout);
|
||||
~QtStatusBarView();
|
||||
virtual ~QtStatusBarView() = default;
|
||||
|
||||
// View implementation
|
||||
virtual void createWidgetWrapper();
|
||||
@@ -27,6 +27,9 @@ public:
|
||||
|
||||
virtual void showIdeStatus(const std::wstring& message);
|
||||
|
||||
virtual void showIndexingProgress(bool unknownProgress, size_t progressPercent);
|
||||
virtual void hideIndexingProgress();
|
||||
|
||||
private:
|
||||
QtThreadedLambdaFunctor m_onQtThread;
|
||||
|
||||
|
||||
@@ -22,10 +22,6 @@ QtViewFactory::QtViewFactory()
|
||||
{
|
||||
}
|
||||
|
||||
QtViewFactory::~QtViewFactory()
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<MainView> QtViewFactory::createMainView() const
|
||||
{
|
||||
return std::make_shared<QtMainView>();
|
||||
@@ -104,7 +100,8 @@ std::shared_ptr<UndoRedoView> QtViewFactory::createUndoRedoView(ViewLayout* view
|
||||
return View::createInitAndAddToLayout<QtUndoRedoView>(viewLayout);
|
||||
}
|
||||
|
||||
std::shared_ptr<DialogView> QtViewFactory::createDialogView(ViewLayout* viewLayout, StorageAccess* storageAccess) const
|
||||
std::shared_ptr<DialogView> QtViewFactory::createDialogView(
|
||||
ViewLayout* viewLayout, DialogView::UseCase useCase, StorageAccess* storageAccess) const
|
||||
{
|
||||
return std::make_shared<QtDialogView>(dynamic_cast<QtMainView*>(viewLayout)->getMainWindow(), storageAccess);
|
||||
return std::make_shared<QtDialogView>(dynamic_cast<QtMainView*>(viewLayout)->getMainWindow(), useCase, storageAccess);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
|
||||
#include "component/view/ViewFactory.h"
|
||||
|
||||
class QtViewFactory: public ViewFactory
|
||||
class QtViewFactory
|
||||
: public ViewFactory
|
||||
{
|
||||
public:
|
||||
QtViewFactory();
|
||||
virtual ~QtViewFactory();
|
||||
virtual ~QtViewFactory() = default;
|
||||
|
||||
virtual std::shared_ptr<MainView> createMainView() const;
|
||||
virtual std::shared_ptr<CompositeView> createCompositeView(
|
||||
@@ -26,7 +27,8 @@ public:
|
||||
virtual std::shared_ptr<TooltipView> createTooltipView(ViewLayout* viewLayout) const;
|
||||
virtual std::shared_ptr<UndoRedoView> createUndoRedoView(ViewLayout* viewLayout) const;
|
||||
|
||||
virtual std::shared_ptr<DialogView> createDialogView(ViewLayout* viewLayout, StorageAccess* storageAccess) const;
|
||||
virtual std::shared_ptr<DialogView> createDialogView(
|
||||
ViewLayout* viewLayout, DialogView::UseCase useCase, StorageAccess* storageAccess) const;
|
||||
};
|
||||
|
||||
#endif // QT_VIEW_FACTORY_H
|
||||
|
||||
@@ -152,7 +152,7 @@ void QtIndexingDialog::updateRefreshInfo(const RefreshInfo& info)
|
||||
m_indexLabel->setVisible(true);
|
||||
}
|
||||
|
||||
void QtIndexingDialog::setupIndexing()
|
||||
void QtIndexingDialog::setupIndexing(bool hideable)
|
||||
{
|
||||
setType(DIALOG_INDEXING);
|
||||
|
||||
@@ -171,7 +171,8 @@ void QtIndexingDialog::setupIndexing()
|
||||
layout->addStretch();
|
||||
|
||||
addButtons(layout);
|
||||
setNextVisible(false);
|
||||
updateNextButton("Hide");
|
||||
setNextVisible(hideable);
|
||||
updateCloseButton("Stop");
|
||||
|
||||
m_sizeHint = QSize(350, 350);
|
||||
@@ -232,7 +233,7 @@ void QtIndexingDialog::setupReport(
|
||||
finishSetup();
|
||||
}
|
||||
|
||||
void QtIndexingDialog::setupUnknownProgress()
|
||||
void QtIndexingDialog::setupUnknownProgress(bool hideable)
|
||||
{
|
||||
setType(DIALOG_UNKNOWN_PROGRESS);
|
||||
|
||||
@@ -244,6 +245,13 @@ void QtIndexingDialog::setupUnknownProgress()
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
if (hideable)
|
||||
{
|
||||
addButtons(layout);
|
||||
updateNextButton("Hide");
|
||||
setCloseVisible(false);
|
||||
}
|
||||
|
||||
m_sizeHint = QSize(350, 280);
|
||||
|
||||
m_progressBar->showUnknownProgressAnimated();
|
||||
@@ -253,7 +261,7 @@ void QtIndexingDialog::setupUnknownProgress()
|
||||
finishSetup();
|
||||
}
|
||||
|
||||
void QtIndexingDialog::setupProgress()
|
||||
void QtIndexingDialog::setupProgress(bool hideable)
|
||||
{
|
||||
setType(DIALOG_PROGRESS);
|
||||
|
||||
@@ -266,6 +274,13 @@ void QtIndexingDialog::setupProgress()
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
if (hideable)
|
||||
{
|
||||
addButtons(layout);
|
||||
updateNextButton("Hide");
|
||||
setCloseVisible(false);
|
||||
}
|
||||
|
||||
m_sizeHint = QSize(350, 280);
|
||||
|
||||
setCancelAble(false);
|
||||
@@ -365,6 +380,12 @@ void QtIndexingDialog::handleNext()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_type == DIALOG_INDEXING || m_type == DIALOG_PROGRESS || m_type == DIALOG_UNKNOWN_PROGRESS)
|
||||
{
|
||||
emit visibleChanged(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_type == DIALOG_REPORT)
|
||||
{
|
||||
MessageErrorsHelpMessage().dispatch();
|
||||
@@ -484,7 +505,8 @@ void QtIndexingDialog::addErrorWidget(QBoxLayout* layout)
|
||||
errorCount->setObjectName("errorCount");
|
||||
errorCount->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
|
||||
errorCount->setIcon(QPixmap(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"indexing_dialog/error.png").wstr())));
|
||||
errorCount->setIcon(QPixmap(QString::fromStdWString(
|
||||
ResourcePaths::getGuiPath().concatenate(L"indexing_dialog/error.png").wstr())));
|
||||
errorLayout->addWidget(errorCount);
|
||||
|
||||
QtHelpButton* helpButton = new QtHelpButton("aaa", "bbb");
|
||||
@@ -526,7 +548,8 @@ void QtIndexingDialog::addButtons(QBoxLayout* layout)
|
||||
|
||||
void QtIndexingDialog::addFlag()
|
||||
{
|
||||
QtDeviceScaledPixmap flag(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"indexing_dialog/flag.png").wstr()));
|
||||
QtDeviceScaledPixmap flag(QString::fromStdWString(
|
||||
ResourcePaths::getGuiPath().concatenate(L"indexing_dialog/flag.png").wstr()));
|
||||
flag.scaleToWidth(120);
|
||||
|
||||
QLabel* flagLabel = new QLabel(this);
|
||||
|
||||
@@ -19,6 +19,7 @@ class QtIndexingDialog
|
||||
signals:
|
||||
void setMode(RefreshMode mode);
|
||||
void startIndexing(RefreshMode mode);
|
||||
void visibleChanged(bool visible);
|
||||
|
||||
public:
|
||||
enum DialogType
|
||||
@@ -39,13 +40,13 @@ public:
|
||||
void setupStart(const std::vector<RefreshMode>& enabledModes);
|
||||
void updateRefreshInfo(const RefreshInfo& info);
|
||||
|
||||
void setupIndexing();
|
||||
void setupIndexing(bool hideable);
|
||||
void setupReport(
|
||||
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
|
||||
float time, bool interrupted);
|
||||
|
||||
void setupUnknownProgress();
|
||||
void setupProgress();
|
||||
void setupUnknownProgress(bool hideable);
|
||||
void setupProgress(bool hideable);
|
||||
|
||||
void updateMessage(const QString& message);
|
||||
std::wstring getMessage() const;
|
||||
|
||||
@@ -75,7 +75,7 @@ void QtPreferencesWindow::handleNext()
|
||||
|
||||
if (needsRestart)
|
||||
{
|
||||
app->getDialogView()->confirm(
|
||||
app->getDialogView(DialogView::UseCase::PROJECT_SETUP)->confirm(
|
||||
"<p>Please restart the application for all changes to take effect.</p><p>Note: These changes may harm "
|
||||
"the execution of the application. In case the application is not useable anymore, please run the "
|
||||
"'resetPreferences.sh' script located in your install directory.</p>"
|
||||
|
||||
@@ -13,7 +13,7 @@ QtWindowStack::QtWindowStack(QObject* parent)
|
||||
{
|
||||
}
|
||||
|
||||
QtWindowStackElement* QtWindowStack::getTopWindow()
|
||||
QtWindowStackElement* QtWindowStack::getTopWindow() const
|
||||
{
|
||||
if (m_stack.size())
|
||||
{
|
||||
@@ -23,7 +23,7 @@ QtWindowStackElement* QtWindowStack::getTopWindow()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QtWindowStackElement* QtWindowStack::getBottomWindow()
|
||||
QtWindowStackElement* QtWindowStack::getBottomWindow() const
|
||||
{
|
||||
if (m_stack.size())
|
||||
{
|
||||
@@ -33,7 +33,7 @@ QtWindowStackElement* QtWindowStack::getBottomWindow()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t QtWindowStack::getWindowCount()
|
||||
size_t QtWindowStack::getWindowCount() const
|
||||
{
|
||||
return m_stack.size();
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ signals:
|
||||
public:
|
||||
QtWindowStack(QObject* parent = nullptr);
|
||||
|
||||
QtWindowStackElement* getTopWindow();
|
||||
QtWindowStackElement* getBottomWindow();
|
||||
QtWindowStackElement* getTopWindow() const;
|
||||
QtWindowStackElement* getBottomWindow() const;
|
||||
|
||||
size_t getWindowCount();
|
||||
size_t getWindowCount() const;
|
||||
|
||||
void centerSubWindows();
|
||||
|
||||
|
||||
@@ -545,14 +545,16 @@ std::vector<FilePath> QtProjectWizzardContentPathSourceMaven::getFilePaths() con
|
||||
return std::vector<FilePath>();
|
||||
}
|
||||
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
QtDialogView* dialogView = dynamic_cast<QtDialogView*>(
|
||||
Application::getInstance()->getDialogView(DialogView::UseCase::PROJECT_SETUP).get());
|
||||
|
||||
ScopedFunctor scopedFunctor([&dialogView]() {
|
||||
dialogView->hideUnknownProgressDialog();
|
||||
});
|
||||
|
||||
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
|
||||
dialogView->setParentWindow(m_window);
|
||||
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Maven\nGenerating Source Files");
|
||||
|
||||
const bool success = utility::mavenGenerateSources(mavenPath, mavenProjectRoot);
|
||||
if (!success)
|
||||
{
|
||||
|
||||
@@ -730,14 +730,15 @@ void QtProjectWizzardContentPathsHeaderSearch::validateIncludesButtonClicked()
|
||||
{
|
||||
std::vector<IncludeDirective> unresolvedIncludes;
|
||||
{
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
QtDialogView* dialogView = dynamic_cast<QtDialogView*>(
|
||||
Application::getInstance()->getDialogView(DialogView::UseCase::PROJECT_SETUP).get());
|
||||
|
||||
std::set<FilePath> sourceFilePaths;
|
||||
std::vector<FilePath> indexedFilePaths;
|
||||
std::vector<FilePath> headerSearchPaths;
|
||||
|
||||
{
|
||||
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
|
||||
dialogView->setParentWindow(m_window);
|
||||
dialogView->showUnknownProgressDialog(L"Processing", L"Gathering Source Files");
|
||||
ScopedFunctor dialogHider([&dialogView](){
|
||||
dialogView->hideUnknownProgressDialog();
|
||||
@@ -761,7 +762,7 @@ void QtProjectWizzardContentPathsHeaderSearch::validateIncludesButtonClicked()
|
||||
}
|
||||
}
|
||||
{
|
||||
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
|
||||
dialogView->setParentWindow(m_window);
|
||||
ScopedFunctor dialogHider([&dialogView](){
|
||||
dialogView->hideProgressDialog();
|
||||
});
|
||||
@@ -773,8 +774,9 @@ void QtProjectWizzardContentPathsHeaderSearch::validateIncludesButtonClicked()
|
||||
log2(sourceFilePaths.size()),
|
||||
[&](const float progress)
|
||||
{
|
||||
Application::getInstance()->getDialogView()->showProgressDialog(
|
||||
L"Processing", std::to_wstring(int(progress * sourceFilePaths.size())) + L" Files", int(progress * 100.0f)
|
||||
dialogView->showProgressDialog(
|
||||
L"Processing", std::to_wstring(int(progress * sourceFilePaths.size())) + L" Files",
|
||||
int(progress * 100.0f)
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -802,7 +804,8 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
|
||||
{
|
||||
std::set<FilePath> detectedHeaderSearchPaths;
|
||||
{
|
||||
std::shared_ptr<QtDialogView> dialogView = std::dynamic_pointer_cast<QtDialogView>(Application::getInstance()->getDialogView());
|
||||
QtDialogView* dialogView = dynamic_cast<QtDialogView*>(
|
||||
Application::getInstance()->getDialogView(DialogView::UseCase::PROJECT_SETUP).get());
|
||||
|
||||
std::set<FilePath> sourceFilePaths;
|
||||
std::vector<FilePath> headerSearchPaths;
|
||||
@@ -841,8 +844,9 @@ void QtProjectWizzardContentPathsHeaderSearch::finishedSelectDetectIncludesRootP
|
||||
log2(sourceFilePaths.size()),
|
||||
[&](const float progress)
|
||||
{
|
||||
Application::getInstance()->getDialogView()->showProgressDialog(
|
||||
L"Processing", std::to_wstring(int(progress * sourceFilePaths.size())) + L" Files", int(progress * 100.0f)
|
||||
dialogView->showProgressDialog(
|
||||
L"Processing", std::to_wstring(int(progress * sourceFilePaths.size())) + L" Files",
|
||||
int(progress * 100.0f)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ std::vector<FilePath> SourceGroupJavaGradle::getAllSourcePaths() const
|
||||
std::vector<FilePath> sourcePaths;
|
||||
if (m_settings->getGradleProjectFilePathExpandedAndAbsolute().exists())
|
||||
{
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView(DialogView::UseCase::PROJECT_SETUP);
|
||||
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Gradle\nFetching Source Directories");
|
||||
|
||||
const FilePath projectRootPath = m_settings->getGradleProjectFilePathExpandedAndAbsolute().getParentDirectory();
|
||||
@@ -87,7 +87,7 @@ bool SourceGroupJavaGradle::prepareGradleData()
|
||||
{
|
||||
const FilePath projectRootPath = m_settings->getGradleProjectFilePathExpandedAndAbsolute().getParentDirectory();
|
||||
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView(DialogView::UseCase::PROJECT_SETUP);
|
||||
|
||||
ScopedFunctor dialogHider([&dialogView]() {
|
||||
dialogView->hideUnknownProgressDialog();
|
||||
|
||||
@@ -36,7 +36,7 @@ std::vector<FilePath> SourceGroupJavaMaven::getAllSourcePaths() const
|
||||
std::vector<FilePath> sourcePaths;
|
||||
if (m_settings && m_settings->getMavenProjectFilePathExpandedAndAbsolute().exists())
|
||||
{
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView(DialogView::UseCase::PROJECT_SETUP);
|
||||
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Maven\nFetching Source Directories");
|
||||
|
||||
const FilePath mavenPath(ApplicationSettings::getInstance()->getMavenPath());
|
||||
@@ -87,7 +87,7 @@ bool SourceGroupJavaMaven::prepareMavenData()
|
||||
const FilePath mavenPath = ApplicationSettings::getInstance()->getMavenPath();
|
||||
const FilePath projectRootPath = m_settings->getMavenProjectFilePathExpandedAndAbsolute().getParentDirectory();
|
||||
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView(DialogView::UseCase::PROJECT_SETUP);
|
||||
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Maven\nGenerating Source Files");
|
||||
|
||||
ScopedFunctor dialogHider([&dialogView](){
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace utility
|
||||
|
||||
std::set<FilePath> fetchRootDirectories(const std::set<FilePath>& sourceFilePaths)
|
||||
{
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView(DialogView::UseCase::PROJECT_SETUP);
|
||||
dialogView->showUnknownProgressDialog(L"Preparing Project", L"Gathering Root\nDirectories");
|
||||
|
||||
ScopedFunctor dialogHider([&dialogView]() {
|
||||
|
||||
Reference in New Issue
Block a user