ui: Show progress dialog for maven source group within parent window
This commit is contained in:
@@ -9,12 +9,14 @@
|
||||
#include "data/access/StorageAccess.h"
|
||||
#include "qt/window/QtIndexingDialog.h"
|
||||
#include "qt/window/QtMainWindow.h"
|
||||
#include "qt/window/QtWindow.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
QtDialogView::QtDialogView(QtMainWindow* mainWindow, StorageAccess* storageAccess)
|
||||
: DialogView(storageAccess)
|
||||
, m_mainWindow(mainWindow)
|
||||
, m_parentWindow(nullptr)
|
||||
, m_windowStack(this)
|
||||
, m_resultReady(false)
|
||||
{
|
||||
@@ -258,6 +260,16 @@ int QtDialogView::confirm(const std::string& message, const std::vector<std::str
|
||||
return result;
|
||||
}
|
||||
|
||||
void QtDialogView::setParentWindow(QtWindow* window)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_parentWindow = window;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtDialogView::handleMessage(MessageInterruptTasks* message)
|
||||
{
|
||||
m_onQtThread2(
|
||||
@@ -318,7 +330,15 @@ void QtDialogView::updateErrorCount(size_t errorCount, size_t fatalCount)
|
||||
template<typename T>
|
||||
T* QtDialogView::createWindow()
|
||||
{
|
||||
T* window = new T(m_mainWindow);
|
||||
T* window = nullptr;
|
||||
if (m_parentWindow)
|
||||
{
|
||||
window = new T(m_parentWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
window = new T(m_mainWindow);
|
||||
}
|
||||
|
||||
connect(window, SIGNAL(canceled()), &m_windowStack, SLOT(popWindow()));
|
||||
connect(window, SIGNAL(finished()), &m_windowStack, SLOT(clearWindows()));
|
||||
@@ -330,7 +350,14 @@ template<typename T>
|
||||
|
||||
void QtDialogView::setUIBlocked(bool blocked)
|
||||
{
|
||||
m_mainWindow->setContentEnabled(!blocked);
|
||||
if (m_parentWindow)
|
||||
{
|
||||
m_parentWindow->setEnabled(!blocked);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mainWindow->setContentEnabled(!blocked);
|
||||
}
|
||||
|
||||
if (blocked)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "utility/messaging/type/MessageWindowClosed.h"
|
||||
|
||||
class QtMainWindow;
|
||||
class QtWindow;
|
||||
|
||||
class QtDialogView
|
||||
: public QObject
|
||||
@@ -46,6 +47,8 @@ public:
|
||||
|
||||
int confirm(const std::string& message, const std::vector<std::string>& options) override;
|
||||
|
||||
void setParentWindow(QtWindow* window);
|
||||
|
||||
private:
|
||||
void handleMessage(MessageInterruptTasks* message) override;
|
||||
void handleMessage(MessageNewErrors* message) override;
|
||||
@@ -60,6 +63,7 @@ private:
|
||||
void setUIBlocked(bool blocked);
|
||||
|
||||
QtMainWindow* m_mainWindow;
|
||||
QtWindow* m_parentWindow;
|
||||
|
||||
QtWindowStack m_windowStack;
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Application.h"
|
||||
#include "component/view/DialogView.h"
|
||||
#include "qt/element/QtLocationPicker.h"
|
||||
#include "qt/view/QtDialogView.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsJava.h"
|
||||
@@ -226,6 +226,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
|
||||
|
||||
std::vector<std::string> list;
|
||||
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
|
||||
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(m_window);
|
||||
|
||||
dialogView->showUnknownProgressDialog("Preparing Project", "Maven\nGenerating Source Files");
|
||||
const bool success = utility::mavenGenerateSources(mavenPath, mavenProjectRoot);
|
||||
@@ -268,6 +269,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
|
||||
}
|
||||
}
|
||||
dialogView->hideUnknownProgressDialog();
|
||||
std::dynamic_pointer_cast<QtDialogView>(dialogView)->setParentWindow(nullptr);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user