FreeCAD

Форк
0
/
DlgSettingsImportExportImp.cpp 
96 строк · 3.9 Кб
1
/***************************************************************************
2
 *   Copyright (c) 2016 Ian Rees <ian.rees@gmail.com>                      *
3
 *                                                                         *
4
 *   This file is part of the FreeCAD CAx development system.              *
5
 *                                                                         *
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.      *
10
 *                                                                         *
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.                  *
15
 *                                                                         *
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                                *
20
 *                                                                         *
21
 ***************************************************************************/
22

23
#include "PreCompiled.h"
24

25
#include <App/Application.h>
26
#include <Mod/Mesh/App/Core/MeshIO.h>
27

28
#include "DlgSettingsImportExportImp.h"
29
#include "ui_DlgSettingsImportExport.h"
30

31

32
using namespace MeshGui;
33

34
DlgSettingsImportExport::DlgSettingsImportExport(QWidget* parent)
35
    : PreferencePage(parent)
36
    , ui(new Ui_DlgSettingsImportExport)
37
{
38
    ui->setupUi(this);
39
    ui->exportAmfCompressed->setToolTip(tr("This parameter indicates whether ZIP compression\n"
40
                                           "is used when writing a file in AMF format"));
41
}
42

43
DlgSettingsImportExport::~DlgSettingsImportExport()
44
{
45
    // no need to delete child widgets, Qt does it all for us
46
    delete ui;
47
}
48

49
void DlgSettingsImportExport::saveSettings()
50
{
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);
55

56
    ui->exportAmfCompressed->onSave();
57
    ui->export3mfModel->onSave();
58

59
    ParameterGrp::handle asy = handle->GetGroup("Asymptote");
60
    asy->SetASCII("Width", ui->asymptoteWidth->text().toLatin1());
61
    asy->SetASCII("Height", ui->asymptoteHeight->text().toLatin1());
62

63
    MeshCore::MeshOutput::SetAsymptoteSize(ui->asymptoteWidth->text().toStdString(),
64
                                           ui->asymptoteHeight->text().toStdString());
65
}
66

67
void DlgSettingsImportExport::loadSettings()
68
{
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);
74

75
    ui->exportAmfCompressed->onRestore();
76
    ui->export3mfModel->onRestore();
77

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")));
81
}
82

83
/**
84
 * Sets the strings of the subwidgets using the current language.
85
 */
86
void DlgSettingsImportExport::changeEvent(QEvent* e)
87
{
88
    if (e->type() == QEvent::LanguageChange) {
89
        ui->retranslateUi(this);
90
    }
91
    else {
92
        QWidget::changeEvent(e);
93
    }
94
}
95

96
#include "moc_DlgSettingsImportExportImp.cpp"
97

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.