FreeCAD

Форк
0
/
DlgPrefsTechDrawDimensionsImp.cpp 
126 строк · 4.6 Кб
1
/***************************************************************************
2
 *   Copyright (c) 2015 FreeCAD Developers                                 *
3
 *   Author: WandererFan <wandererfan@gmail.com>                           *
4
 *   Based on src/Mod/FEM/Gui/DlgSettingsFEMImp.cpp                        *
5
 *                                                                         *
6
 *   This file is part of the FreeCAD CAx development system.              *
7
 *                                                                         *
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.      *
12
 *                                                                         *
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.                  *
17
 *                                                                         *
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                                *
22
 *                                                                         *
23
 ***************************************************************************/
24

25
#include "PreCompiled.h"
26

27
#include <Base/Tools.h>
28

29
#include "DlgPrefsTechDrawDimensionsImp.h"
30
#include "ui_DlgPrefsTechDrawDimensions.h"
31
#include "DrawGuiUtil.h"
32
#include "PreferencesGui.h"
33

34

35
using namespace TechDrawGui;
36
using namespace TechDraw;
37

38

39
DlgPrefsTechDrawDimensionsImp::DlgPrefsTechDrawDimensionsImp( QWidget* parent )
40
  : PreferencePage( parent )
41
  , ui(new Ui_DlgPrefsTechDrawDimensionsImp)
42
{
43
    ui->setupUi(this);
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);
48
}
49

50
DlgPrefsTechDrawDimensionsImp::~DlgPrefsTechDrawDimensionsImp()
51
{
52
    // no need to delete child widgets, Qt does it all for us
53
}
54

55
void DlgPrefsTechDrawDimensionsImp::saveSettings()
56
{
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();
70
}
71

72
void DlgPrefsTechDrawDimensionsImp::loadSettings()
73
{
74
    //set defaults for Quantity widgets if property not found
75
    //Quantity widgets do not use preset value since they are based on
76
    //QAbstractSpinBox
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);
83

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();
93

94
    DrawGuiUtil::loadArrowBox(ui->pcbArrow);
95
    ui->pcbArrow->setCurrentIndex(prefArrowStyle());
96

97
    ui->leFormatSpec->setText(Base::Tools::fromStdString(Preferences::formatSpec()));
98
    ui->leFormatSpec->onRestore();
99

100
    ui->pdsbGapISO->onRestore();
101
    ui->pdsbGapASME->onRestore();
102
    ui->pdsbLineSpacingFactorISO->onRestore();
103

104
}
105

106
/**
107
 * Sets the strings of the subwidgets using the current language.
108
 */
109
void DlgPrefsTechDrawDimensionsImp::changeEvent(QEvent *e)
110
{
111
    if (e->type() == QEvent::LanguageChange) {
112
        saveSettings();
113
        ui->retranslateUi(this);
114
        loadSettings();
115
    }
116
    else {
117
        QWidget::changeEvent(e);
118
    }
119
}
120

121
int DlgPrefsTechDrawDimensionsImp::prefArrowStyle() const
122
{
123
    return PreferencesGui::dimArrowStyle();
124
}
125

126
#include <Mod/TechDraw/Gui/moc_DlgPrefsTechDrawDimensionsImp.cpp>
127

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

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

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

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