Part: split DlgImportExportStep into sub-widgets in order to be used independently
This commit is contained in:
@@ -49,7 +49,9 @@ set(PartGui_UIC_SRCS
|
||||
Mirroring.ui
|
||||
DlgBooleanOperation.ui
|
||||
DlgExportStep.ui
|
||||
DlgExportHeaderStep.ui
|
||||
DlgExtrusion.ui
|
||||
DlgImportStep.ui
|
||||
DlgFilletEdges.ui
|
||||
DlgImportExportIges.ui
|
||||
DlgImportExportStep.ui
|
||||
@@ -104,12 +106,16 @@ SET(PartGui_SRCS
|
||||
DlgExportStep.cpp
|
||||
DlgExportStep.h
|
||||
DlgExportStep.ui
|
||||
DlgExportHeaderStep.ui
|
||||
DlgExtrusion.cpp
|
||||
DlgExtrusion.h
|
||||
DlgExtrusion.ui
|
||||
DlgFilletEdges.cpp
|
||||
DlgFilletEdges.h
|
||||
DlgFilletEdges.ui
|
||||
DlgImportStep.cpp
|
||||
DlgImportStep.h
|
||||
DlgImportStep.ui
|
||||
DlgImportExportIges.ui
|
||||
DlgImportExportStep.ui
|
||||
DlgPartBox.ui
|
||||
|
||||
68
src/Mod/Part/Gui/DlgExportHeaderStep.ui
Normal file
68
src/Mod/Part/Gui/DlgExportHeaderStep.ui
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PartGui::DlgExportHeaderStep</class>
|
||||
<widget class="QWidget" name="PartGui::DlgExportHeaderStep">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>445</width>
|
||||
<height>149</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>STEP</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBoxHeader">
|
||||
<property name="toolTip">
|
||||
<string>If not empty, field contents will be used in the STEP file header.</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Company</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEditCompany"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Author</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEditAuthor"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Product</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEditProduct"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>lineEditCompany</tabstop>
|
||||
<tabstop>lineEditAuthor</tabstop>
|
||||
<tabstop>lineEditProduct</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include "DlgExportStep.h"
|
||||
#include "ui_DlgExportStep.h"
|
||||
#include "ui_DlgExportHeaderStep.h"
|
||||
|
||||
|
||||
using namespace PartGui;
|
||||
@@ -54,22 +55,11 @@ DlgExportStep::DlgExportStep(QWidget* parent)
|
||||
ui->comboBoxSchema->setItemData(3, QByteArray("AP214IS"));
|
||||
ui->comboBoxSchema->setItemData(4, QByteArray("AP242DIS"));
|
||||
|
||||
ui->lineEditProduct->setReadOnly(true);
|
||||
|
||||
// https://tracker.dev.opencascade.org/view.php?id=25654
|
||||
ui->checkBoxPcurves->setToolTip(tr("This parameter indicates whether parametric curves (curves in parametric space of surface)\n"
|
||||
"should be written into the STEP file. This parameter can be set to off in order to minimize\n"
|
||||
"the size of the resulting STEP file."));
|
||||
|
||||
QRegExp rx;
|
||||
rx.setPattern(QString::fromLatin1("[\\x00-\\x7F]+"));
|
||||
QRegExpValidator* companyValidator = new QRegExpValidator(ui->lineEditCompany);
|
||||
companyValidator->setRegExp(rx);
|
||||
ui->lineEditCompany->setValidator(companyValidator);
|
||||
QRegExpValidator* authorValidator = new QRegExpValidator(ui->lineEditAuthor);
|
||||
authorValidator->setRegExp(rx);
|
||||
ui->lineEditAuthor->setValidator(authorValidator);
|
||||
|
||||
Part::OCAF::ImportExportSettings settings;
|
||||
ui->checkBoxExportHiddenObj->setChecked(settings.getExportHiddenObject());
|
||||
ui->checkBoxExportLegacy->setChecked(settings.getExportLegacy());
|
||||
@@ -99,10 +89,6 @@ void DlgExportStep::saveSettings()
|
||||
QByteArray schema = ui->comboBoxSchema->itemData(ui->comboBoxSchema->currentIndex()).toByteArray();
|
||||
settings.setScheme(schema);
|
||||
|
||||
// header info
|
||||
settings.setCompany(ui->lineEditCompany->text().toLatin1());
|
||||
settings.setAuthor(ui->lineEditAuthor->text().toLatin1());
|
||||
|
||||
// (h)STEP of Import module
|
||||
ui->checkBoxExportHiddenObj->onSave();
|
||||
ui->checkBoxExportLegacy->onSave();
|
||||
@@ -124,11 +110,6 @@ void DlgExportStep::loadSettings()
|
||||
if (index >= 0)
|
||||
ui->comboBoxSchema->setCurrentIndex(index);
|
||||
|
||||
// header info
|
||||
ui->lineEditCompany->setText(QString::fromStdString(settings.getCompany()));
|
||||
ui->lineEditAuthor->setText(QString::fromStdString(settings.getAuthor()));
|
||||
ui->lineEditProduct->setText(QString::fromStdString(settings.getProductName()));
|
||||
|
||||
// (h)STEP of Import module
|
||||
ui->checkBoxExportHiddenObj->onRestore();
|
||||
ui->checkBoxExportLegacy->onRestore();
|
||||
@@ -159,6 +140,62 @@ void DlgExportStep::changeEvent(QEvent *e)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
DlgExportHeaderStep::DlgExportHeaderStep(QWidget* parent)
|
||||
: PreferencePage(parent)
|
||||
, ui(new Ui_DlgExportHeaderStep)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->lineEditProduct->setReadOnly(true);
|
||||
|
||||
QRegExp rx;
|
||||
rx.setPattern(QString::fromLatin1("[\\x00-\\x7F]+"));
|
||||
QRegExpValidator* companyValidator = new QRegExpValidator(ui->lineEditCompany);
|
||||
companyValidator->setRegExp(rx);
|
||||
ui->lineEditCompany->setValidator(companyValidator);
|
||||
QRegExpValidator* authorValidator = new QRegExpValidator(ui->lineEditAuthor);
|
||||
authorValidator->setRegExp(rx);
|
||||
ui->lineEditAuthor->setValidator(authorValidator);
|
||||
}
|
||||
|
||||
DlgExportHeaderStep::~DlgExportHeaderStep()
|
||||
{
|
||||
}
|
||||
|
||||
void DlgExportHeaderStep::saveSettings()
|
||||
{
|
||||
Part::STEP::ImportExportSettings settings;
|
||||
|
||||
// header info
|
||||
settings.setCompany(ui->lineEditCompany->text().toLatin1());
|
||||
settings.setAuthor(ui->lineEditAuthor->text().toLatin1());
|
||||
}
|
||||
|
||||
void DlgExportHeaderStep::loadSettings()
|
||||
{
|
||||
Part::STEP::ImportExportSettings settings;
|
||||
|
||||
// header info
|
||||
ui->lineEditCompany->setText(QString::fromStdString(settings.getCompany()));
|
||||
ui->lineEditAuthor->setText(QString::fromStdString(settings.getAuthor()));
|
||||
ui->lineEditProduct->setText(QString::fromStdString(settings.getProductName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the strings of the subwidgets using the current language.
|
||||
*/
|
||||
void DlgExportHeaderStep::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
TaskExportStep::TaskExportStep(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, ui(new DlgExportStep(this))
|
||||
|
||||
@@ -40,6 +40,8 @@ struct StepSettings
|
||||
bool keepPlacement = false;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class Ui_DlgExportStep;
|
||||
class DlgExportStep : public Gui::Dialog::PreferencePage
|
||||
{
|
||||
@@ -61,6 +63,29 @@ private:
|
||||
std::unique_ptr<Ui_DlgExportStep> ui;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class Ui_DlgExportHeaderStep;
|
||||
class DlgExportHeaderStep : public Gui::Dialog::PreferencePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DlgExportHeaderStep(QWidget* parent = nullptr);
|
||||
~DlgExportHeaderStep() override;
|
||||
|
||||
void saveSettings() override;
|
||||
void loadSettings() override;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgExportHeaderStep> ui;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class PartGuiExport TaskExportStep : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>445</width>
|
||||
<height>426</height>
|
||||
<height>278</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -155,61 +155,6 @@ it inside the Placement property.</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBoxHeader">
|
||||
<property name="toolTip">
|
||||
<string>If not empty, field contents will be used in the STEP file header.</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Header</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Company</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEditCompany"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Author</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEditAuthor"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Product</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEditProduct"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>82</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -223,9 +168,6 @@ it inside the Placement property.</string>
|
||||
<tabstop>comboBoxUnits</tabstop>
|
||||
<tabstop>checkBoxPcurves</tabstop>
|
||||
<tabstop>checkBoxExportHiddenObj</tabstop>
|
||||
<tabstop>lineEditCompany</tabstop>
|
||||
<tabstop>lineEditAuthor</tabstop>
|
||||
<tabstop>lineEditProduct</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
109
src/Mod/Part/Gui/DlgImportStep.cpp
Normal file
109
src/Mod/Part/Gui/DlgImportStep.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library 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 Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QButtonGroup>
|
||||
# include <QCheckBox>
|
||||
# include <QDialogButtonBox>
|
||||
# include <QVBoxLayout>
|
||||
# include <QRegExp>
|
||||
# include <QRegExpValidator>
|
||||
# include <Interface_Static.hxx>
|
||||
#endif
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Base/Parameter.h>
|
||||
#include <Mod/Part/App/OCAF/ImportExportSettings.h>
|
||||
#include <Mod/Part/App/STEP/ImportExportSettings.h>
|
||||
|
||||
#include "DlgImportStep.h"
|
||||
#include "ui_DlgImportStep.h"
|
||||
|
||||
|
||||
using namespace PartGui;
|
||||
|
||||
DlgImportStep::DlgImportStep(QWidget* parent)
|
||||
: PreferencePage(parent)
|
||||
, ui(new Ui_DlgImportStep)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
Part::OCAF::ImportExportSettings settings;
|
||||
ui->checkBoxMergeCompound->setChecked(settings.getReadShapeCompoundMode());
|
||||
ui->checkBoxImportHiddenObj->setChecked(settings.getImportHiddenObject());
|
||||
ui->checkBoxUseLinkGroup->setChecked(settings.getUseLinkGroup());
|
||||
ui->checkBoxUseBaseName->setChecked(settings.getUseBaseName());
|
||||
ui->checkBoxReduceObjects->setChecked(settings.getReduceObjects());
|
||||
ui->checkBoxExpandCompound->setChecked(settings.getExpandCompound());
|
||||
ui->checkBoxShowProgress->setChecked(settings.getShowProgress());
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys the object and frees any allocated resources
|
||||
*/
|
||||
DlgImportStep::~DlgImportStep()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
void DlgImportStep::saveSettings()
|
||||
{
|
||||
// (h)STEP of Import module
|
||||
ui->checkBoxMergeCompound->onSave();
|
||||
ui->checkBoxImportHiddenObj->onSave();
|
||||
ui->checkBoxUseLinkGroup->onSave();
|
||||
ui->checkBoxUseBaseName->onSave();
|
||||
ui->checkBoxReduceObjects->onSave();
|
||||
ui->checkBoxExpandCompound->onSave();
|
||||
ui->checkBoxShowProgress->onSave();
|
||||
ui->comboBoxImportMode->onSave();
|
||||
}
|
||||
|
||||
void DlgImportStep::loadSettings()
|
||||
{
|
||||
// (h)STEP of Import module
|
||||
ui->checkBoxMergeCompound->onRestore();
|
||||
ui->checkBoxImportHiddenObj->onRestore();
|
||||
ui->checkBoxUseLinkGroup->onRestore();
|
||||
ui->checkBoxUseBaseName->onRestore();
|
||||
ui->checkBoxReduceObjects->onRestore();
|
||||
ui->checkBoxExpandCompound->onRestore();
|
||||
ui->checkBoxShowProgress->onRestore();
|
||||
ui->comboBoxImportMode->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the strings of the subwidgets using the current language.
|
||||
*/
|
||||
void DlgImportStep::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include "moc_DlgImportStep.cpp"
|
||||
55
src/Mod/Part/Gui/DlgImportStep.h
Normal file
55
src/Mod/Part/Gui/DlgImportStep.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library 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 Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef PARTGUI_DLGIMPORTSTEP_H
|
||||
#define PARTGUI_DLGIMPORTSTEP_H
|
||||
|
||||
#include <Gui/PropertyPage.h>
|
||||
|
||||
class QButtonGroup;
|
||||
class QCheckBox;
|
||||
|
||||
namespace PartGui {
|
||||
|
||||
class Ui_DlgImportStep;
|
||||
class DlgImportStep : public Gui::Dialog::PreferencePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DlgImportStep(QWidget* parent = nullptr);
|
||||
~DlgImportStep() override;
|
||||
|
||||
void saveSettings() override;
|
||||
void loadSettings() override;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgImportStep> ui;
|
||||
};
|
||||
|
||||
} // namespace PartGui
|
||||
|
||||
#endif // PARTGUI_DLGIMPORTSTEP_H
|
||||
217
src/Mod/Part/Gui/DlgImportStep.ui
Normal file
217
src/Mod/Part/Gui/DlgImportStep.ui
Normal file
@@ -0,0 +1,217 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PartGui::DlgImportStep</class>
|
||||
<widget class="QWidget" name="PartGui::DlgImportStep">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>445</width>
|
||||
<height>292</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>STEP</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="GroupBox2">
|
||||
<property name="title">
|
||||
<string>Import</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxMergeCompound">
|
||||
<property name="toolTip">
|
||||
<string>If checked, no Compound merge will be done
|
||||
during file reading (slower but higher details).</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable STEP Compound merge</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ReadShapeCompoundMode</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Import/hSTEP</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxUseLinkGroup">
|
||||
<property name="toolTip">
|
||||
<string>Select this to use App::LinkGroup as group container, or else use App::Part.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use LinkGroup</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>UseLinkGroup</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Import</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxImportHiddenObj">
|
||||
<property name="toolTip">
|
||||
<string>Select this to not import any invisible objects.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Import invisible objects</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ImportHiddenObject</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Import</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxReduceObjects">
|
||||
<property name="toolTip">
|
||||
<string>Reduce number of objects using Link array</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reduce number of objects</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ReduceObjects</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Import</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxExpandCompound">
|
||||
<property name="toolTip">
|
||||
<string>Expand compound shape with multiple solids</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Expand compound shape</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ExpandCompound</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Import</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxShowProgress">
|
||||
<property name="toolTip">
|
||||
<string>Show progress bar when importing</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show progress bar when importing</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ShowProgress</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Import</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxUseBaseName">
|
||||
<property name="toolTip">
|
||||
<string>Do not use instance name. Useful for some legacy STEP file with non-meaningful auto generated instance names.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ignore instance names</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>UseBaseName</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Import</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefComboBox" name="comboBoxImportMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ImportMode</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Import</cstring>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Single document</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Assembly per document</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Assembly per document in sub-directory</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Object per document</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Object per document in sub-directory</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::PrefCheckBox</class>
|
||||
<extends>QCheckBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gui::PrefComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>checkBoxMergeCompound</tabstop>
|
||||
<tabstop>checkBoxUseLinkGroup</tabstop>
|
||||
<tabstop>checkBoxImportHiddenObj</tabstop>
|
||||
<tabstop>checkBoxReduceObjects</tabstop>
|
||||
<tabstop>checkBoxExpandCompound</tabstop>
|
||||
<tabstop>checkBoxShowProgress</tabstop>
|
||||
<tabstop>checkBoxUseBaseName</tabstop>
|
||||
<tabstop>comboBoxImportMode</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QButtonGroup>
|
||||
# include <QVBoxLayout>
|
||||
# include <QRegExp>
|
||||
# include <QRegExpValidator>
|
||||
# include <Interface_Static.hxx>
|
||||
@@ -39,6 +40,8 @@
|
||||
#include "ui_DlgSettingsGeneral.h"
|
||||
#include "ui_DlgImportExportIges.h"
|
||||
#include "ui_DlgImportExportStep.h"
|
||||
#include "DlgExportStep.h"
|
||||
#include "DlgImportStep.h"
|
||||
|
||||
|
||||
using namespace PartGui;
|
||||
@@ -169,45 +172,23 @@ void DlgImportExportIges::changeEvent(QEvent *e)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
DlgImportExportStep::DlgImportExportStep(QWidget* parent)
|
||||
: PreferencePage(parent), ui(new Ui_DlgImportExportStep)
|
||||
: PreferencePage(parent)
|
||||
, exportStep(new DlgExportStep(this))
|
||||
, importStep(new DlgImportStep(this))
|
||||
, headerStep(new DlgExportHeaderStep(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowTitle(tr("STEP"));
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
setLayout(layout);
|
||||
|
||||
ui->comboBoxSchema->setItemData(0, QByteArray("AP203"));
|
||||
ui->comboBoxSchema->setItemData(1, QByteArray("AP214CD"));
|
||||
ui->comboBoxSchema->setItemData(2, QByteArray("AP214DIS"));
|
||||
ui->comboBoxSchema->setItemData(3, QByteArray("AP214IS"));
|
||||
ui->comboBoxSchema->setItemData(4, QByteArray("AP242DIS"));
|
||||
layout->addWidget(exportStep);
|
||||
layout->addWidget(importStep);
|
||||
layout->addWidget(headerStep);
|
||||
|
||||
ui->lineEditProduct->setReadOnly(true);
|
||||
//ui->radioButtonAP203->setToolTip(tr("Configuration controlled 3D designs of mechanical parts and assemblies"));
|
||||
//ui->radioButtonAP214->setToolTip(tr("Core data for automotive mechanical design processes"));
|
||||
|
||||
// https://tracker.dev.opencascade.org/view.php?id=25654
|
||||
ui->checkBoxPcurves->setToolTip(tr("This parameter indicates whether parametric curves (curves in parametric space of surface)\n"
|
||||
"should be written into the STEP file. This parameter can be set to off in order to minimize\n"
|
||||
"the size of the resulting STEP file."));
|
||||
|
||||
QRegExp rx;
|
||||
rx.setPattern(QString::fromLatin1("[\\x00-\\x7F]+"));
|
||||
QRegExpValidator* companyValidator = new QRegExpValidator(ui->lineEditCompany);
|
||||
companyValidator->setRegExp(rx);
|
||||
ui->lineEditCompany->setValidator(companyValidator);
|
||||
QRegExpValidator* authorValidator = new QRegExpValidator(ui->lineEditAuthor);
|
||||
authorValidator->setRegExp(rx);
|
||||
ui->lineEditAuthor->setValidator(authorValidator);
|
||||
|
||||
Part::OCAF::ImportExportSettings settings;
|
||||
ui->checkBoxMergeCompound->setChecked(settings.getReadShapeCompoundMode());
|
||||
ui->checkBoxExportHiddenObj->setChecked(settings.getExportHiddenObject());
|
||||
ui->checkBoxImportHiddenObj->setChecked(settings.getImportHiddenObject());
|
||||
ui->checkBoxExportLegacy->setChecked(settings.getExportLegacy());
|
||||
ui->checkBoxKeepPlacement->setChecked(settings.getExportKeepPlacement());
|
||||
ui->checkBoxUseLinkGroup->setChecked(settings.getUseLinkGroup());
|
||||
ui->checkBoxUseBaseName->setChecked(settings.getUseBaseName());
|
||||
ui->checkBoxReduceObjects->setChecked(settings.getReduceObjects());
|
||||
ui->checkBoxExpandCompound->setChecked(settings.getExpandCompound());
|
||||
ui->checkBoxShowProgress->setChecked(settings.getShowProgress());
|
||||
QSpacerItem* verticalSpacer = new QSpacerItem(20, 82, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
layout->addItem(verticalSpacer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,82 +201,22 @@ DlgImportExportStep::~DlgImportExportStep()
|
||||
|
||||
void DlgImportExportStep::saveSettings()
|
||||
{
|
||||
// General
|
||||
Part::STEP::ImportExportSettings settings;
|
||||
settings.setWriteSurfaceCurveMode(ui->checkBoxPcurves->isChecked());
|
||||
|
||||
// STEP
|
||||
int unit = ui->comboBoxUnits->currentIndex();
|
||||
settings.setUnit(static_cast<Part::Interface::Unit>(unit));
|
||||
|
||||
// scheme
|
||||
// possible values: AP203, AP214CD (1996), AP214DIS (1998), AP214IS (2002), AP242DIS
|
||||
QByteArray schema = ui->comboBoxSchema->itemData(ui->comboBoxSchema->currentIndex()).toByteArray();
|
||||
settings.setScheme(schema);
|
||||
|
||||
// header info
|
||||
settings.setCompany(ui->lineEditCompany->text().toLatin1());
|
||||
settings.setAuthor(ui->lineEditAuthor->text().toLatin1());
|
||||
|
||||
// (h)STEP of Import module
|
||||
ui->checkBoxMergeCompound->onSave();
|
||||
ui->checkBoxExportHiddenObj->onSave();
|
||||
ui->checkBoxExportLegacy->onSave();
|
||||
ui->checkBoxKeepPlacement->onSave();
|
||||
ui->checkBoxImportHiddenObj->onSave();
|
||||
ui->checkBoxUseLinkGroup->onSave();
|
||||
ui->checkBoxUseBaseName->onSave();
|
||||
ui->checkBoxReduceObjects->onSave();
|
||||
ui->checkBoxExpandCompound->onSave();
|
||||
ui->checkBoxShowProgress->onSave();
|
||||
ui->comboBoxImportMode->onSave();
|
||||
exportStep->saveSettings();
|
||||
importStep->saveSettings();
|
||||
headerStep->saveSettings();
|
||||
}
|
||||
|
||||
void DlgImportExportStep::loadSettings()
|
||||
{
|
||||
// General
|
||||
Part::STEP::ImportExportSettings settings;
|
||||
ui->checkBoxPcurves->setChecked(settings.getWriteSurfaceCurveMode());
|
||||
|
||||
// STEP
|
||||
ui->comboBoxUnits->setCurrentIndex(static_cast<int>(settings.getUnit()));
|
||||
|
||||
// scheme
|
||||
QByteArray ap(settings.getScheme().c_str());
|
||||
int index = ui->comboBoxSchema->findData(QVariant(ap));
|
||||
if (index >= 0)
|
||||
ui->comboBoxSchema->setCurrentIndex(index);
|
||||
|
||||
// header info
|
||||
ui->lineEditCompany->setText(QString::fromStdString(settings.getCompany()));
|
||||
ui->lineEditAuthor->setText(QString::fromStdString(settings.getAuthor()));
|
||||
ui->lineEditProduct->setText(QString::fromStdString(settings.getProductName()));
|
||||
|
||||
// (h)STEP of Import module
|
||||
ui->checkBoxMergeCompound->onRestore();
|
||||
ui->checkBoxExportHiddenObj->onRestore();
|
||||
ui->checkBoxExportLegacy->onRestore();
|
||||
ui->checkBoxKeepPlacement->onRestore();
|
||||
ui->checkBoxImportHiddenObj->onRestore();
|
||||
ui->checkBoxUseLinkGroup->onRestore();
|
||||
ui->checkBoxUseBaseName->onRestore();
|
||||
ui->checkBoxReduceObjects->onRestore();
|
||||
ui->checkBoxExpandCompound->onRestore();
|
||||
ui->checkBoxShowProgress->onRestore();
|
||||
ui->comboBoxImportMode->onRestore();
|
||||
exportStep->loadSettings();
|
||||
importStep->loadSettings();
|
||||
headerStep->loadSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the strings of the subwidgets using the current language.
|
||||
*/
|
||||
void DlgImportExportStep::changeEvent(QEvent *e)
|
||||
void DlgImportExportStep::changeEvent(QEvent *)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
#include "moc_DlgSettingsGeneral.cpp"
|
||||
|
||||
@@ -67,7 +67,9 @@ private:
|
||||
QButtonGroup* bg;
|
||||
};
|
||||
|
||||
class Ui_DlgImportExportStep;
|
||||
class DlgExportStep;
|
||||
class DlgImportStep;
|
||||
class DlgExportHeaderStep;
|
||||
class DlgImportExportStep : public Gui::Dialog::PreferencePage
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -82,7 +84,9 @@ protected:
|
||||
void changeEvent(QEvent *e) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgImportExportStep> ui;
|
||||
DlgExportStep* exportStep;
|
||||
DlgImportStep* importStep;
|
||||
DlgExportHeaderStep* headerStep;
|
||||
};
|
||||
|
||||
} // namespace Gui
|
||||
|
||||
Reference in New Issue
Block a user