This commit is contained in:
DavidXanatos 2023-05-25 18:33:24 +02:00
parent 22c6feb72f
commit 9546d97d0f
7 changed files with 17 additions and 8 deletions

View File

@ -623,7 +623,3 @@ void SafeShow(QWidget* pWidget) {
pWidget->setProperty("windowOpacity", 1.0);
}
int SafeExec(QDialog* pDialog){
SafeShow(pDialog);
return pDialog->exec();
}

View File

@ -115,7 +115,6 @@ MISCHELPERS_EXPORT bool InitConsole(bool bCreateIfNeeded = true);
#endif
MISCHELPERS_EXPORT void SafeShow(QWidget* pWidget);
MISCHELPERS_EXPORT int SafeExec(QDialog* pDialog);
template <typename T>
QSet<T> ListToSet(const QList<T>& qList) { return QSet<QString>(qList.begin(), qList.end()); }

View File

@ -1284,6 +1284,18 @@ bool CSandMan::IsSilentMode()
return IsFullScreenMode();
}
QWidget* g_GUIParent = NULL;
int CSandMan::SafeExec(QDialog* pDialog)
{
QWidget* pPrevParent = g_GUIParent;
g_GUIParent = pDialog;
SafeShow(pDialog);
int ret = pDialog->exec();
g_GUIParent = pPrevParent;
return ret;
}
void CSandMan::OnMessage(const QString& MsgData)
{
QStringList Messages = MsgData.split("\n");

View File

@ -65,6 +65,8 @@ public:
CSbieView* GetBoxView() { return m_pBoxView; }
CFileView* GetFileView() { return m_pFileView; }
int SafeExec(QDialog* pDialog);
bool RunSandboxed(const QStringList& Commands, QString BoxName = QString(), const QString& WrkDir = QString());
QIcon GetBoxIcon(int boxType, bool inUse = false);// , bool inBusy = false);

View File

@ -38,7 +38,7 @@ void CNewBoxWizard::showHelp()
QString CNewBoxWizard::CreateNewBox(bool bAlowTemp, QWidget* pParent)
{
CNewBoxWizard wizard(bAlowTemp, pParent);
if (!wizard.exec())
if (!theGUI->SafeExec(&wizard))
return QString();
QString BoxName = wizard.field("boxName").toString();

View File

@ -54,7 +54,7 @@ void CSetupWizard::showHelp()
bool CSetupWizard::ShowWizard()
{
CSetupWizard wizard;
if (!wizard.exec())
if (!theGUI->SafeExec(&wizard))
return false;
//bool useBusiness = wizard.field("useBusiness").toBool();

View File

@ -54,7 +54,7 @@ QString CTemplateWizard::GetTemplateLabel(ETemplateType Type)
bool CTemplateWizard::CreateNewTemplate(CSandBox* pBox, ETemplateType Type, QWidget* pParent)
{
CTemplateWizard wizard(Type, pParent);
if (!wizard.exec())
if (!theGUI->SafeExec(&wizard))
return false;
if (Type == TmplCustom)