1
/***************************************************************************
2
* Copyright (c) 2015 FreeCAD Developers *
3
* Author: WandererFan <wandererfan@gmail.com> *
4
* Based on src/Mod/FEM/Gui/DlgSettingsFEMImp.cpp *
6
* This file is part of the FreeCAD CAx development system. *
8
* This library is free software; you can redistribute it and/or *
9
* modify it under the terms of the GNU Library General Public *
10
* License as published by the Free Software Foundation; either *
11
* version 2 of the License, or (at your option) any later version. *
13
* This library is distributed in the hope that it will be useful, *
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16
* GNU Library General Public License for more details. *
18
* You should have received a copy of the GNU Library General Public *
19
* License along with this library; see the file COPYING.LIB. If not, *
20
* write to the Free Software Foundation, Inc., 59 Temple Place, *
21
* Suite 330, Boston, MA 02111-1307, USA *
23
***************************************************************************/
25
#include "PreCompiled.h"
27
#include <Base/Tools.h>
29
#include "DlgPrefsTechDrawDimensionsImp.h"
30
#include "ui_DlgPrefsTechDrawDimensions.h"
31
#include "DrawGuiUtil.h"
32
#include "PreferencesGui.h"
35
using namespace TechDrawGui;
36
using namespace TechDraw;
39
DlgPrefsTechDrawDimensionsImp::DlgPrefsTechDrawDimensionsImp( QWidget* parent )
40
: PreferencePage( parent )
41
, ui(new Ui_DlgPrefsTechDrawDimensionsImp)
44
ui->plsb_FontSize->setUnit(Base::Unit::Length);
45
ui->plsb_FontSize->setMinimum(0);
46
ui->plsb_ArrowSize->setUnit(Base::Unit::Length);
47
ui->plsb_ArrowSize->setMinimum(0);
50
DlgPrefsTechDrawDimensionsImp::~DlgPrefsTechDrawDimensionsImp()
52
// no need to delete child widgets, Qt does it all for us
55
void DlgPrefsTechDrawDimensionsImp::saveSettings()
57
ui->pcbStandardAndStyle->onSave();
58
ui->cbGlobalDecimals->onSave();
59
ui->cbShowUnits->onSave();
60
ui->sbAltDecimals->onSave();
61
ui->plsb_FontSize->onSave();
62
ui->pdsbToleranceScale->onSave();
63
ui->leDiameter->onSave();
64
ui->pcbArrow->onSave();
65
ui->plsb_ArrowSize->onSave();
66
ui->leFormatSpec->onSave();
67
ui->pdsbGapISO->onSave();
68
ui->pdsbGapASME->onSave();
69
ui->pdsbLineSpacingFactorISO->onSave();
72
void DlgPrefsTechDrawDimensionsImp::loadSettings()
74
//set defaults for Quantity widgets if property not found
75
//Quantity widgets do not use preset value since they are based on
77
double fontDefault = Preferences::dimFontSizeMM();
78
double arrowDefault = Preferences::dimArrowSize();
79
ui->plsb_FontSize->setValue(fontDefault);
80
// double arrowDefault = 5.0;
81
// plsb_ArrowSize->setValue(arrowDefault);
82
ui->plsb_ArrowSize->setValue(arrowDefault);
84
ui->pcbStandardAndStyle->onRestore();
85
ui->cbGlobalDecimals->onRestore();
86
ui->cbShowUnits->onRestore();
87
ui->sbAltDecimals->onRestore();
88
ui->plsb_FontSize->onRestore();
89
ui->pdsbToleranceScale->onRestore();
90
ui->leDiameter->onRestore();
91
ui->pcbArrow->onRestore();
92
ui->plsb_ArrowSize->onRestore();
94
DrawGuiUtil::loadArrowBox(ui->pcbArrow);
95
ui->pcbArrow->setCurrentIndex(prefArrowStyle());
97
ui->leFormatSpec->setText(Base::Tools::fromStdString(Preferences::formatSpec()));
98
ui->leFormatSpec->onRestore();
100
ui->pdsbGapISO->onRestore();
101
ui->pdsbGapASME->onRestore();
102
ui->pdsbLineSpacingFactorISO->onRestore();
107
* Sets the strings of the subwidgets using the current language.
109
void DlgPrefsTechDrawDimensionsImp::changeEvent(QEvent *e)
111
if (e->type() == QEvent::LanguageChange) {
113
ui->retranslateUi(this);
117
QWidget::changeEvent(e);
121
int DlgPrefsTechDrawDimensionsImp::prefArrowStyle() const
123
return PreferencesGui::dimArrowStyle();
126
#include <Mod/TechDraw/Gui/moc_DlgPrefsTechDrawDimensionsImp.cpp>