Add import dxf feature

Use dxf2elmt to import dxf.
See https://github.com/antonioaja/dxf2elmt
This commit is contained in:
joshua
2022-07-23 21:54:23 +02:00
parent 2a7848e1ca
commit 6e81451b46
9 changed files with 373 additions and 2 deletions

View File

@@ -0,0 +1,51 @@
/*
Copyright 2006-2022 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "thirdpartybinaryinstalldialog.h"
#include "ui_thirdpartybinaryinstalldialog.h"
#include <QDialogButtonBox>
#include <QPushButton>
#include <QDesktopServices>
#include <QDir>
#include <QUrl>
ThirdPartyBinaryInstallDialog::ThirdPartyBinaryInstallDialog(const QString &text,
const QString &downloadLink,
const QString &binaryFolderPath,
QWidget *parent) :
QDialog{parent},
ui{new Ui::ThirdPartyBinaryInstallDialog}
{
ui->setupUi(this);
ui->m_label->setText(text);
connect(ui->m_download_pb, &QPushButton::clicked, [downloadLink](){
QDesktopServices::openUrl(QUrl(downloadLink));
});
connect(ui->m_install_dir_pb, &QPushButton::clicked, [binaryFolderPath]() {
//Make sure the path exist
QDir dir_;
dir_.mkpath(binaryFolderPath);
QDesktopServices::openUrl(QUrl("file:///" + binaryFolderPath));
});
}
ThirdPartyBinaryInstallDialog::~ThirdPartyBinaryInstallDialog()
{
delete ui;
}

View File

@@ -0,0 +1,42 @@
/*
Copyright 2006-2022 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef THIRDPARTYBINARYINSTALLDIALOG_H
#define THIRDPARTYBINARYINSTALLDIALOG_H
#include <QDialog>
namespace Ui {
class ThirdPartyBinaryInstallDialog;
}
class ThirdPartyBinaryInstallDialog : public QDialog
{
Q_OBJECT
public:
explicit ThirdPartyBinaryInstallDialog(const QString &text,
const QString &downloadLink,
const QString &binaryFolderPath,
QWidget *parent = nullptr);
~ThirdPartyBinaryInstallDialog();
private:
Ui::ThirdPartyBinaryInstallDialog *ui;
};
#endif // THIRDPARTYBINARYINSTALLDIALOG_H

View File

@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ThirdPartyBinaryInstallDialog</class>
<widget class="QDialog" name="ThirdPartyBinaryInstallDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>373</width>
<height>64</height>
</rect>
</property>
<property name="windowTitle">
<string>Logiciel tiers requis</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="QDialogButtonBox" name="m_button_box">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="m_download_pb">
<property name="text">
<string>Télechargement</string>
</property>
<property name="icon">
<iconset resource="../../qelectrotech.qrc">
<normaloff>:/ico/16x16/edit-download.png</normaloff>:/ico/16x16/edit-download.png</iconset>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="m_install_dir_pb">
<property name="text">
<string>Dossier installation</string>
</property>
<property name="icon">
<iconset resource="../../qelectrotech.qrc">
<normaloff>:/ico/16x16/folder-open.png</normaloff>:/ico/16x16/folder-open.png</iconset>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="m_label">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="margin">
<number>5</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../qelectrotech.qrc"/>
</resources>
<connections>
<connection>
<sender>m_button_box</sender>
<signal>accepted()</signal>
<receiver>ThirdPartyBinaryInstallDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_button_box</sender>
<signal>rejected()</signal>
<receiver>ThirdPartyBinaryInstallDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>