| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| |
|
| | #include <QCheckBox> |
| | #include <QDialogButtonBox> |
| | #include <QRegularExpression> |
| | #include <QRegularExpressionValidator> |
| | #include <QVBoxLayout> |
| | #include <Interface_Static.hxx> |
| |
|
| |
|
| | #include <App/Application.h> |
| | #include <Base/Parameter.h> |
| | #include <Mod/Part/App/OCAF/ImportExportSettings.h> |
| | #include <Mod/Part/App/STEP/ImportExportSettings.h> |
| |
|
| | #include "DlgExportStep.h" |
| | #include "ui_DlgExportStep.h" |
| | #include "ui_DlgExportHeaderStep.h" |
| |
|
| |
|
| | using namespace PartGui; |
| |
|
| | DlgExportStep::DlgExportStep(QWidget* parent) |
| | : PreferencePage(parent) |
| | , ui(new Ui_DlgExportStep) |
| | { |
| | ui->setupUi(this); |
| |
|
| | 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")); |
| |
|
| | |
| | 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.") |
| | ); |
| |
|
| | Part::OCAF::ImportExportSettings settings; |
| | ui->checkBoxExportHiddenObj->setChecked(settings.getExportHiddenObject()); |
| | ui->checkBoxExportLegacy->setChecked(settings.getExportLegacy()); |
| | ui->checkBoxKeepPlacement->setChecked(settings.getExportKeepPlacement()); |
| | } |
| |
|
| | |
| | |
| | |
| | DlgExportStep::~DlgExportStep() = default; |
| |
|
| | void DlgExportStep::saveSettings() |
| | { |
| | |
| | Part::STEP::ImportExportSettings settings; |
| | settings.setWriteSurfaceCurveMode(ui->checkBoxPcurves->isChecked()); |
| |
|
| | |
| | int unit = ui->comboBoxUnits->currentIndex(); |
| | settings.setUnit(static_cast<Part::Interface::Unit>(unit)); |
| |
|
| | |
| | |
| | QByteArray schema = ui->comboBoxSchema->itemData(ui->comboBoxSchema->currentIndex()).toByteArray(); |
| | settings.setScheme(schema); |
| |
|
| | |
| | ui->checkBoxExportHiddenObj->onSave(); |
| | ui->checkBoxExportLegacy->onSave(); |
| | ui->checkBoxKeepPlacement->onSave(); |
| | } |
| |
|
| | void DlgExportStep::loadSettings() |
| | { |
| | |
| | Part::STEP::ImportExportSettings settings; |
| | ui->checkBoxPcurves->setChecked(settings.getWriteSurfaceCurveMode()); |
| |
|
| | |
| | ui->comboBoxUnits->setCurrentIndex(static_cast<int>(settings.getUnit())); |
| |
|
| | |
| | QByteArray ap(settings.getScheme().c_str()); |
| | int index = ui->comboBoxSchema->findData(QVariant(ap)); |
| | if (index >= 0) { |
| | ui->comboBoxSchema->setCurrentIndex(index); |
| | } |
| |
|
| | |
| | ui->checkBoxExportHiddenObj->onRestore(); |
| | ui->checkBoxExportLegacy->onRestore(); |
| | ui->checkBoxKeepPlacement->onRestore(); |
| | } |
| |
|
| | StepSettings DlgExportStep::getSettings() const |
| | { |
| | StepSettings set; |
| | set.exportLegacy = ui->checkBoxExportLegacy->isChecked(); |
| | set.exportHidden = ui->checkBoxExportHiddenObj->isChecked(); |
| | set.keepPlacement = ui->checkBoxKeepPlacement->isChecked(); |
| | return set; |
| | } |
| |
|
| | |
| | |
| | |
| | void DlgExportStep::changeEvent(QEvent* e) |
| | { |
| | if (e->type() == QEvent::LanguageChange) { |
| | ui->retranslateUi(this); |
| | } |
| | else { |
| | QWidget::changeEvent(e); |
| | } |
| | } |
| |
|
| | |
| |
|
| | DlgExportHeaderStep::DlgExportHeaderStep(QWidget* parent) |
| | : PreferencePage(parent) |
| | , ui(new Ui_DlgExportHeaderStep) |
| | { |
| | ui->setupUi(this); |
| |
|
| | ui->lineEditProduct->setReadOnly(true); |
| |
|
| | QRegularExpression rx; |
| | rx.setPattern(QStringLiteral("[\\x00-\\x7F]+")); |
| | QRegularExpressionValidator* companyValidator = new QRegularExpressionValidator( |
| | ui->lineEditCompany |
| | ); |
| | companyValidator->setRegularExpression(rx); |
| | ui->lineEditCompany->setValidator(companyValidator); |
| | QRegularExpressionValidator* authorValidator = new QRegularExpressionValidator(ui->lineEditAuthor); |
| | authorValidator->setRegularExpression(rx); |
| | ui->lineEditAuthor->setValidator(authorValidator); |
| | } |
| |
|
| | DlgExportHeaderStep::~DlgExportHeaderStep() = default; |
| |
|
| | void DlgExportHeaderStep::saveSettings() |
| | { |
| | Part::STEP::ImportExportSettings settings; |
| |
|
| | |
| | settings.setCompany(ui->lineEditCompany->text().toLatin1()); |
| | settings.setAuthor(ui->lineEditAuthor->text().toLatin1()); |
| | } |
| |
|
| | void DlgExportHeaderStep::loadSettings() |
| | { |
| | Part::STEP::ImportExportSettings settings; |
| |
|
| | |
| | ui->lineEditCompany->setText(QString::fromStdString(settings.getCompany())); |
| | ui->lineEditAuthor->setText(QString::fromStdString(settings.getAuthor())); |
| | ui->lineEditProduct->setText(QString::fromStdString(settings.getProductName())); |
| | } |
| |
|
| | |
| | |
| | |
| | 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)) |
| | { |
| | QApplication::setOverrideCursor(Qt::ArrowCursor); |
| |
|
| | ui->loadSettings(); |
| | setWindowTitle(ui->windowTitle()); |
| |
|
| | QVBoxLayout* layout = new QVBoxLayout(this); |
| | layout->addWidget(ui.get()); |
| | setLayout(layout); |
| |
|
| | showThis = new QCheckBox(this); |
| | showThis->setText(tr("Do not show this dialog again")); |
| | layout->addWidget(showThis); |
| |
|
| | QDialogButtonBox* buttonBox = new QDialogButtonBox(this); |
| | buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
| | layout->addWidget(buttonBox); |
| |
|
| | connect(buttonBox, &QDialogButtonBox::accepted, this, &TaskExportStep::accept); |
| | connect(buttonBox, &QDialogButtonBox::rejected, this, &TaskExportStep::reject); |
| | } |
| |
|
| | TaskExportStep::~TaskExportStep() |
| | { |
| | QApplication::restoreOverrideCursor(); |
| | } |
| |
|
| | void TaskExportStep::accept() |
| | { |
| | QDialog::accept(); |
| | ui->saveSettings(); |
| |
|
| | Part::STEP::ImportExportSettings settings; |
| | settings.setVisibleExportDialog(!showThis->isChecked()); |
| | } |
| |
|
| | bool TaskExportStep::showDialog() const |
| | { |
| | Part::STEP::ImportExportSettings settings; |
| | return settings.isVisibleExportDialog(); |
| | } |
| |
|
| | StepSettings TaskExportStep::getSettings() const |
| | { |
| | return ui->getSettings(); |
| | } |
| |
|
| |
|
| | #include "moc_DlgExportStep.cpp" |
| |
|