1
/***************************************************************************
2
* Copyright (c) 2016 Ian Rees <ian.rees@gmail.com> *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 59 Temple Place, *
19
* Suite 330, Boston, MA 02111-1307, USA *
21
***************************************************************************/
23
#include "PreCompiled.h"
25
#include <App/Application.h>
26
#include <Mod/Mesh/App/Core/MeshIO.h>
28
#include "DlgSettingsImportExportImp.h"
29
#include "ui_DlgSettingsImportExport.h"
32
using namespace MeshGui;
34
DlgSettingsImportExport::DlgSettingsImportExport(QWidget* parent)
35
: PreferencePage(parent)
36
, ui(new Ui_DlgSettingsImportExport)
39
ui->exportAmfCompressed->setToolTip(tr("This parameter indicates whether ZIP compression\n"
40
"is used when writing a file in AMF format"));
43
DlgSettingsImportExport::~DlgSettingsImportExport()
45
// no need to delete child widgets, Qt does it all for us
49
void DlgSettingsImportExport::saveSettings()
51
ParameterGrp::handle handle = App::GetApplication().GetParameterGroupByPath(
52
"User parameter:BaseApp/Preferences/Mod/Mesh");
53
double value = ui->maxDeviationExport->value().getValue();
54
handle->SetFloat("MaxDeviationExport", value);
56
ui->exportAmfCompressed->onSave();
57
ui->export3mfModel->onSave();
59
ParameterGrp::handle asy = handle->GetGroup("Asymptote");
60
asy->SetASCII("Width", ui->asymptoteWidth->text().toLatin1());
61
asy->SetASCII("Height", ui->asymptoteHeight->text().toLatin1());
63
MeshCore::MeshOutput::SetAsymptoteSize(ui->asymptoteWidth->text().toStdString(),
64
ui->asymptoteHeight->text().toStdString());
67
void DlgSettingsImportExport::loadSettings()
69
ParameterGrp::handle handle = App::GetApplication().GetParameterGroupByPath(
70
"User parameter:BaseApp/Preferences/Mod/Mesh");
71
double value = ui->maxDeviationExport->value().getValue();
72
value = handle->GetFloat("MaxDeviationExport", value);
73
ui->maxDeviationExport->setValue(value);
75
ui->exportAmfCompressed->onRestore();
76
ui->export3mfModel->onRestore();
78
ParameterGrp::handle asy = handle->GetGroup("Asymptote");
79
ui->asymptoteWidth->setText(QString::fromStdString(asy->GetASCII("Width")));
80
ui->asymptoteHeight->setText(QString::fromStdString(asy->GetASCII("Height")));
84
* Sets the strings of the subwidgets using the current language.
86
void DlgSettingsImportExport::changeEvent(QEvent* e)
88
if (e->type() == QEvent::LanguageChange) {
89
ui->retranslateUi(this);
92
QWidget::changeEvent(e);
96
#include "moc_DlgSettingsImportExportImp.cpp"