From a7121cce50f19065dcfa07804d33aaadb2b4ba67 Mon Sep 17 00:00:00 2001 From: Laurent Trinques Date: Wed, 20 May 2020 02:27:47 +0200 Subject: [PATCH] Improve : Try to launch qet_tb_generator portable version of the plugin if user put binary on QDir::homePath() --- sources/qetdiagrameditor.cpp | 41 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index 142e7d615..ed8a9a532 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -2239,8 +2239,28 @@ void QETDiagramEditor::generateTerminalBlock() // If launched under control: //connect(process, SIGNAL(errorOcurred(int error)), this, SLOT(slot_generateTerminalBlock_error())); //process->start("qet_tb_generator"); - -#ifdef Q_OS_MACOS + +#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) + if (openedProjects().count()){ + success = process->startDetached("qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())}); + } + else { + success = process->startDetached("qet_tb_generator"); + } + if (openedProjects().count()){ + success = process->startDetached(QDir::homePath() + "/Application Data/qet/qet_tb_generator.exe", {(QETDiagramEditor::currentProjectView()->project()->filePath())}); + } + else { + success = process->startDetached(QDir::homePath() + "/Application Data/qet/qet_tb_generator.exe"); + } + if (openedProjects().count()){ + success = process->startDetached(QDir::homePath() + "/qet_tb_generator.exe", {(QETDiagramEditor::currentProjectView()->project()->filePath())}); + } + else { + success = process->startDetached(QDir::homePath() + "/qet_tb_generator.exe"); + } + +#elif Q_OS_MACOS if (openedProjects().count()){ success = process->startDetached("/Library/Frameworks/Python.framework/Versions/3.8/bin/qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())}); } @@ -2253,6 +2273,7 @@ void QETDiagramEditor::generateTerminalBlock() else { success = process->startDetached(QDir::homePath() + "/.qet/qet_tb_generator.app"); } + #else if (openedProjects().count()){ success = process->startDetached("qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())}); @@ -2269,22 +2290,6 @@ void QETDiagramEditor::generateTerminalBlock() #endif -#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) -if (openedProjects().count()){ - success = process->startDetached("qet_tb_generator", {(QETDiagramEditor::currentProjectView()->project()->filePath())}); - } - else { - success = process->startDetached("qet_tb_generator"); - } - if (openedProjects().count()){ - success = process->startDetached(QDir::homePath() + "/Application Data/qet/qet_tb_generator.exe", {(QETDiagramEditor::currentProjectView()->project()->filePath())}); - } - else { - success = process->startDetached(QDir::homePath() + "/Application Data/qet/qet_tb_generator.exe"); - } -#endif - - if ( !success ) { #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) QMessageBox::warning(nullptr,