From 9f8287206b2f017a0847cdbac8fbf5789ac364b1 Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Tue, 28 Jan 2025 18:44:19 +0100 Subject: [PATCH 1/3] fix: "dxf2elmt" and "QET_ElementScaler" also read imported files from QETApp::documentDir() by default --- sources/editor/ui/qetelementeditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/editor/ui/qetelementeditor.cpp b/sources/editor/ui/qetelementeditor.cpp index cc03e354e..f67d12f15 100644 --- a/sources/editor/ui/qetelementeditor.cpp +++ b/sources/editor/ui/qetelementeditor.cpp @@ -1472,7 +1472,7 @@ void QETElementEditor::on_m_import_dxf_triggered() { QString file_path{QFileDialog::getOpenFileName(this, QObject::tr("Importer un fichier dxf"), - QDir::homePath(), + QETApp::documentDir(), "DXF (*.dxf)")}; if (file_path.isEmpty()) { return; @@ -1498,7 +1498,7 @@ void QETElementEditor::on_m_import_scaled_element_triggered() { QString file_path{QFileDialog::getOpenFileName(this, tr("Importer un élément à redimensionner"), - QDir::homePath(), + QETApp::documentDir(), tr("Éléments QElectroTech (*.elmt)"))}; if (file_path.isEmpty()) { return; From 30a6221e45ded653c1fc9e2d9044952620eb9cfa Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Tue, 28 Jan 2025 18:56:16 +0100 Subject: [PATCH 2/3] remove unused function --- sources/editor/ui/qetelementeditor.cpp | 18 ------------------ sources/editor/ui/qetelementeditor.h | 1 - 2 files changed, 19 deletions(-) diff --git a/sources/editor/ui/qetelementeditor.cpp b/sources/editor/ui/qetelementeditor.cpp index f67d12f15..bc1d0bb33 100644 --- a/sources/editor/ui/qetelementeditor.cpp +++ b/sources/editor/ui/qetelementeditor.cpp @@ -1282,24 +1282,6 @@ void QETElementEditor::on_m_open_from_file_action_triggered() openElement(user_filename); } -void QETElementEditor::on_m_open_scaled_element_action_triggered() -{ -#ifdef TODO_LIST -# pragma message("@TODO Merge 'Element-Scaling' code into QET") -# pragma message("https://github.com/plc-user/QET_ElementScaler") -#endif -#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) - QString program = (QDir::homePath() + "/Application Data/qet/QET_ElementScaler.exe"); -#elif defined(Q_OS_MAC) - QString program = (QDir::homePath() + "/.qet/QET_ElementScaler.app"); -#else - QString program = (QDir::homePath() + "/.qet/QET_ElementScaler"); -#endif - QStringList arguments; - QProcess *ES = new QProcess(qApp); - ES -> start(program,arguments); -} - bool QETElementEditor::on_m_save_as_file_action_triggered() { // Check element before writing diff --git a/sources/editor/ui/qetelementeditor.h b/sources/editor/ui/qetelementeditor.h index c263fcd2f..f35e366f4 100644 --- a/sources/editor/ui/qetelementeditor.h +++ b/sources/editor/ui/qetelementeditor.h @@ -86,7 +86,6 @@ class QETElementEditor : public QMainWindow void on_m_new_action_triggered(); void on_m_open_action_triggered(); void on_m_open_from_file_action_triggered(); - void on_m_open_scaled_element_action_triggered(); bool on_m_save_as_file_action_triggered(); void on_m_reload_action_triggered(); void on_m_quit_action_triggered(); From bdee8e3e36068a608b2ceacd0ae4a1f30ffa2381 Mon Sep 17 00:00:00 2001 From: plc-user <74435298+plc-user@users.noreply.github.com> Date: Tue, 28 Jan 2025 19:01:32 +0100 Subject: [PATCH 3/3] set default search-path of non-standard locations of collections and titleblocks (common, company and user) also to QETApp::documentsDir() --- sources/ui/configpage/generalconfigurationpage.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sources/ui/configpage/generalconfigurationpage.cpp b/sources/ui/configpage/generalconfigurationpage.cpp index f71e427c1..ae43016bb 100644 --- a/sources/ui/configpage/generalconfigurationpage.cpp +++ b/sources/ui/configpage/generalconfigurationpage.cpp @@ -436,7 +436,7 @@ void GeneralConfigurationPage::on_m_common_elmt_path_cb_currentIndexChanged(int { if (index == 1) { - QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection commune"), QDir::homePath()); + QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection commune"), QETApp::documentDir()); if (!path.isEmpty()) { ui->m_common_elmt_path_cb->setItemData(1, path, Qt::DisplayRole); } @@ -450,7 +450,7 @@ void GeneralConfigurationPage::on_m_company_elmt_path_cb_currentIndexChanged(int { if (index == 1) { - QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection company"), QDir::homePath()); + QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection company"), QETApp::documentDir()); if (!path.isEmpty()) { ui->m_company_elmt_path_cb->setItemData(1, path, Qt::DisplayRole); } @@ -464,7 +464,7 @@ void GeneralConfigurationPage::on_m_custom_elmt_path_cb_currentIndexChanged(int { if (index == 1) { - QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection utilisateur"), QDir::homePath()); + QString path = QFileDialog::getExistingDirectory(this, tr("Chemin de la collection utilisateur"), QETApp::documentDir()); if (!path.isEmpty()) { ui->m_custom_elmt_path_cb->setItemData(1, path, Qt::DisplayRole); } @@ -478,7 +478,7 @@ void GeneralConfigurationPage::on_m_company_tbt_path_cb_currentIndexChanged(int { if (index == 1) { - QString path = QFileDialog::getExistingDirectory(this, tr("Chemin des cartouches company"), QDir::homePath()); + QString path = QFileDialog::getExistingDirectory(this, tr("Chemin des cartouches company"), QETApp::documentDir()); if (!path.isEmpty()) { ui->m_company_tbt_path_cb->setItemData(1, path, Qt::DisplayRole); } @@ -492,7 +492,7 @@ void GeneralConfigurationPage::on_m_custom_tbt_path_cb_currentIndexChanged(int i { if (index == 1) { - QString path = QFileDialog::getExistingDirectory(this, tr("Chemin des cartouches utilisateur"), QDir::homePath()); + QString path = QFileDialog::getExistingDirectory(this, tr("Chemin des cartouches utilisateur"), QETApp::documentDir()); if (!path.isEmpty()) { ui->m_custom_tbt_path_cb->setItemData(1, path, Qt::DisplayRole); }