ui: add menu entry to close the current project (issue #722)
This commit is contained in:
committed by
Eberhard Graether
parent
dc24bae943
commit
6b692ff0e9
@@ -146,7 +146,7 @@ Application::~Application()
|
||||
}
|
||||
}
|
||||
|
||||
const std::shared_ptr<Project> Application::getCurrentProject() const
|
||||
std::shared_ptr<const Project> Application::getCurrentProject() const
|
||||
{
|
||||
return m_project;
|
||||
}
|
||||
@@ -213,6 +213,19 @@ void Application::handleMessage(MessageActivateWindow* message)
|
||||
}
|
||||
}
|
||||
|
||||
void Application::handleMessage(MessageCloseProject* message)
|
||||
{
|
||||
if (m_project && m_project->isIndexing())
|
||||
{
|
||||
MessageStatus(L"Cannot close the project while indexing.", true, false).dispatch();
|
||||
return;
|
||||
}
|
||||
|
||||
m_project.reset();
|
||||
updateTitle();
|
||||
m_mainView->clear();
|
||||
}
|
||||
|
||||
void Application::handleMessage(MessageIndexingFinished* message)
|
||||
{
|
||||
logStorageStats();
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "MessageListener.h"
|
||||
#include "MessageIndexingFinished.h"
|
||||
#include "MessageActivateWindow.h"
|
||||
#include "MessageCloseProject.h"
|
||||
#include "MessageLoadProject.h"
|
||||
#include "MessageRefresh.h"
|
||||
#include "MessageRefreshUI.h"
|
||||
@@ -26,6 +27,7 @@ class ViewFactory;
|
||||
|
||||
class Application
|
||||
: public MessageListener<MessageActivateWindow>
|
||||
, public MessageListener<MessageCloseProject>
|
||||
, public MessageListener<MessageIndexingFinished>
|
||||
, public MessageListener<MessageLoadProject>
|
||||
, public MessageListener<MessageRefresh>
|
||||
@@ -48,7 +50,7 @@ public:
|
||||
|
||||
~Application();
|
||||
|
||||
const std::shared_ptr<Project> getCurrentProject() const;
|
||||
std::shared_ptr<const Project> getCurrentProject() const;
|
||||
FilePath getCurrentProjectPath() const;
|
||||
bool isProjectLoaded() const;
|
||||
|
||||
@@ -68,6 +70,7 @@ private:
|
||||
Application(bool withGUI = true);
|
||||
|
||||
void handleMessage(MessageActivateWindow* message) override;
|
||||
void handleMessage(MessageCloseProject* message) override;
|
||||
void handleMessage(MessageIndexingFinished* message) override;
|
||||
void handleMessage(MessageLoadProject* message) override;
|
||||
void handleMessage(MessageRefresh* message) override;
|
||||
|
||||
Reference in New Issue
Block a user