ui: Add status dialog for Maven project setup

This commit is contained in:
malte_langkabel
2017-03-17 13:18:48 +01:00
parent 139c49805d
commit 5fea315cc9
3 changed files with 21 additions and 4 deletions
@@ -1,5 +1,7 @@
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
#include <thread>
#include <QMessageBox>
#include "qt/window/QtTextEditDialog.h"
@@ -40,6 +42,7 @@ QtProjectWizzardContent::QtProjectWizzardContent(std::shared_ptr<ProjectSettings
, m_settings(settings)
, m_window(window)
, m_isInForm(false)
, m_showFilesFunctor(std::bind(&QtProjectWizzardContent::showFilesDialog, this, std::placeholders::_1))
{
}
@@ -147,10 +150,17 @@ void QtProjectWizzardContent::filesButtonClicked()
{
m_window->saveContent();
std::thread([&](){
std::vector<std::string> fileNames = getFileNames();
m_showFilesFunctor(fileNames);
}).detach();
}
void QtProjectWizzardContent::showFilesDialog(const std::vector<std::string>& fileNames)
{
if (!m_filesDialog)
{
std::vector<std::string> fileNames = getFileNames();
m_filesDialog = std::make_shared<QtTextEditDialog>(
getFileNamesTitle(), QString::number(fileNames.size()) + " " + getFileNamesDescription());
m_filesDialog->setup();
@@ -7,6 +7,7 @@
#include <QWidget>
#include "qt/element/QtIconButton.h"
#include "qt/utility/QtThreadedFunctor.h"
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
#include "settings/ProjectSettings.h"
@@ -70,7 +71,10 @@ protected slots:
void closedFilesDialog();
private:
void showFilesDialog(const std::vector<std::string>& fileNames);
bool m_isInForm;
QtThreadedFunctor<std::vector<std::string>> m_showFilesFunctor;
};
#endif // QT_PROJECT_WIZZARD_CONTENT_H
@@ -72,9 +72,9 @@ QtProjectWizzardContentPathSourceMaven::QtProjectWizzardContentPathSourceMaven(
)
: QtProjectWizzardContentPath(settings, window)
{
setTitleString("Maven Project Root");
setTitleString("Maven Project File");
setHelpString(
"Enter the root folder of your Maven project (where the main .pom file resides).<br />"
"Enter the path to the main .pom file of your Maven project.<br />"
"<br />"
"You can make use of environment variables with ${ENV_VAR}."
);
@@ -128,6 +128,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
std::vector<std::string> list;
Application::getInstance()->getDialogView()->showStatusDialog("Preparing Project", "Maven\nGenerating Source Files");
const bool success = utility::mavenGenerateSources(mavenPath, mavenProjectRoot);
if (!success)
{
@@ -141,6 +142,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
}
else
{
Application::getInstance()->getDialogView()->showStatusDialog("Preparing Project", "Maven\nFetching Source Directories");
const std::vector<FilePath> sourceDirectories = utility::mavenGetAllDirectoriesFromEffectivePom(
mavenPath,
mavenProjectRoot,
@@ -167,6 +169,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
list.push_back(path.str());
}
}
Application::getInstance()->getDialogView()->hideStatusDialog();
return list;
}