ui: add menu entry to close the current project (issue #722)

This commit is contained in:
mlangkabel
2019-10-18 13:05:27 +02:00
committed by Eberhard Graether
parent dc24bae943
commit 6b692ff0e9
13 changed files with 70 additions and 14 deletions
@@ -125,7 +125,7 @@ void QtCodeFileTitleBar::setIsComplete(bool isComplete)
m_titleButton->setIsComplete(isComplete);
m_showErrorsButton->setVisible(!isComplete);
Project* project = Application::getInstance()->getCurrentProject().get();
std::shared_ptr<const Project> project = Application::getInstance()->getCurrentProject();
if (project && project->isIndexing())
{
m_showErrorsButton->setVisible(false);
@@ -1186,10 +1186,10 @@ void QtProjectWizard::createProject()
bool settingsChanged = false;
if (m_editing)
{
Application* application = Application::getInstance().get();
if (application->getCurrentProject() != nullptr)
std::shared_ptr<const Project> currentProject = Application::getInstance()->getCurrentProject();
if (currentProject)
{
settingsChanged = !(application->getCurrentProject()->settingsEqualExceptNameAndLocation(*(m_projectSettings.get())));
settingsChanged = !(currentProject->settingsEqualExceptNameAndLocation(*(m_projectSettings.get())));
}
settingsChanged |= !(m_appSettings == *ApplicationSettings::getInstance().get());
+12 -1
View File
@@ -39,6 +39,7 @@
#include "MessageBookmarkActivate.h"
#include "MessageBookmarkBrowse.h"
#include "MessageBookmarkCreate.h"
#include "MessageCloseProject.h"
#include "MessageCodeReference.h"
#include "MessageCustomTrailShow.h"
#include "MessageFind.h"
@@ -712,7 +713,7 @@ void QtMainWindow::openProject()
void QtMainWindow::editProject()
{
Project* currentProject = Application::getInstance()->getCurrentProject().get();
std::shared_ptr<const Project> currentProject = Application::getInstance()->getCurrentProject();
if (currentProject)
{
QtProjectWizard* wizard = createWindow<QtProjectWizard>();
@@ -721,6 +722,15 @@ void QtMainWindow::editProject()
}
}
void QtMainWindow::closeProject()
{
if (Application::getInstance()->getCurrentProject())
{
MessageCloseProject().dispatch();
showStartScreen();
}
}
void QtMainWindow::find()
{
MessageFind().dispatch();
@@ -932,6 +942,7 @@ void QtMainWindow::setupProjectMenu()
menu->addAction(tr("&Edit Project..."), this, &QtMainWindow::editProject);
menu->addSeparator();
menu->addAction(tr("Close Project"), this, &QtMainWindow::closeProject);
menu->addAction(tr("E&xit"), QCoreApplication::instance(), &QCoreApplication::quit, QKeySequence::Quit);
}
+1
View File
@@ -129,6 +129,7 @@ public slots:
void newProjectFromCDB(const FilePath& filePath);
void openProject();
void editProject();
void closeProject();
void find();
void findFulltext();
@@ -101,7 +101,7 @@ void QtPreferencesWindow::handleNext()
if (appSettingsChanged)
{
Project* currentProject = app->getCurrentProject().get();
std::shared_ptr<const Project> currentProject = Application::getInstance()->getCurrentProject();
if (currentProject)
{
MessageLoadProject(currentProject->getProjectSettingsFilePath(), true).dispatch();