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 "DlgPrefsTechDrawScaleImp.h"
28
#include "ui_DlgPrefsTechDrawScale.h"
31
using namespace TechDrawGui;
33
DlgPrefsTechDrawScaleImp::DlgPrefsTechDrawScaleImp( QWidget* parent )
34
: PreferencePage( parent )
35
, ui(new Ui_DlgPrefsTechDrawScaleImp)
39
ui->pdsbTemplateMark->setUnit(Base::Unit::Length);
40
ui->pdsbTemplateMark->setMinimum(0);
42
connect(ui->cbViewScaleType, qOverload<int>(&QComboBox::currentIndexChanged),
43
this, &DlgPrefsTechDrawScaleImp::onScaleTypeChanged);
46
DlgPrefsTechDrawScaleImp::~DlgPrefsTechDrawScaleImp()
48
// no need to delete child widgets, Qt does it all for us
51
void DlgPrefsTechDrawScaleImp::onScaleTypeChanged(int index)
53
// disable custom scale if the scale type is not custom
55
if (index == 2) // if custom
56
ui->pdsbViewScale->setEnabled(true);
58
ui->pdsbViewScale->setEnabled(false);
61
void DlgPrefsTechDrawScaleImp::saveSettings()
63
ui->pdsbPageScale->onSave();
64
ui->cbViewScaleType->onSave();
65
ui->pdsbViewScale->onSave();
66
ui->pdsbVertexScale->onSave();
67
ui->pdsbCenterScale->onSave();
68
ui->pdsbTemplateMark->onSave();
69
ui->pdsbSymbolScale->onSave();
72
void DlgPrefsTechDrawScaleImp::loadSettings()
74
ui->pdsbPageScale->onRestore();
75
ui->cbViewScaleType->onRestore();
76
ui->pdsbViewScale->onRestore();
77
ui->pdsbVertexScale->onRestore();
78
ui->pdsbCenterScale->onRestore();
79
double markDefault = 3.0;
80
ui->pdsbTemplateMark->setValue(markDefault);
81
ui->pdsbTemplateMark->onRestore();
82
ui->pdsbSymbolScale->onRestore();
86
* Sets the strings of the subwidgets using the current language.
88
void DlgPrefsTechDrawScaleImp::changeEvent(QEvent *e)
90
if (e->type() == QEvent::LanguageChange) {
92
ui->retranslateUi(this);
96
QWidget::changeEvent(e);
100
#include <Mod/TechDraw/Gui/moc_DlgPrefsTechDrawScaleImp.cpp>