FreeCAD

Форк
0
/
DlgPrefsTechDrawGeneralImp.cpp 
134 строки · 4.7 Кб
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 "DlgPrefsTechDrawGeneralImp.h"
28
#include "ui_DlgPrefsTechDrawGeneral.h"
29
#include "PreferencesGui.h"
30
#include "DrawGuiUtil.h"
31

32

33
using namespace TechDrawGui;
34
using namespace TechDraw;
35

36
DlgPrefsTechDrawGeneralImp::DlgPrefsTechDrawGeneralImp( QWidget* parent )
37
  : PreferencePage( parent )
38
  , ui(new Ui_DlgPrefsTechDrawGeneralImp)
39
{
40
    ui->setupUi(this);
41
    ui->plsb_LabelSize->setUnit(Base::Unit::Length);
42
    ui->plsb_LabelSize->setMinimum(0);
43

44
    ui->psb_GridSpacing->setUnit(Base::Unit::Length);
45
    ui->psb_GridSpacing->setMinimum(0);
46
}
47

48
DlgPrefsTechDrawGeneralImp::~DlgPrefsTechDrawGeneralImp()
49
{
50
    // no need to delete child widgets, Qt does it all for us
51
}
52

53
void DlgPrefsTechDrawGeneralImp::saveSettings()
54
{
55
    ui->cb_Global->onSave();
56
    ui->cb_Override->onSave();
57
    ui->cb_PageUpdate->onSave();
58
    ui->cb_AutoDist->onSave();
59

60
    ui->pfb_LabelFont->onSave();
61
    ui->plsb_LabelSize->onSave();
62

63
    ui->cbProjAngle->onSave();
64
    ui->cbSectionLineStd->onSave();
65

66
    ui->pfc_DefTemp->onSave();
67
    ui->pfc_DefDir->onSave();
68
    ui->pfc_HatchFile->onSave();
69
    ui->pfc_LineGroup->onSave();
70
    ui->pfc_Welding->onSave();
71
    ui->pfc_FilePattern->onSave();
72
    ui->le_NamePattern->onSave();
73
    ui->cb_ShowGrid->onSave();
74
    ui->psb_GridSpacing->onSave();
75

76
    ui->cbMultiSelection->onSave();
77
}
78

79
void DlgPrefsTechDrawGeneralImp::loadSettings()
80
{
81
    ui->cb_Global->onRestore();
82
    ui->cb_Override->onRestore();
83
    ui->cb_PageUpdate->onRestore();
84
    ui->cb_AutoDist->onRestore();
85

86
    double labelDefault = Preferences::labelFontSizeMM();
87
    ui->plsb_LabelSize->setValue(labelDefault);
88
    QFont prefFont(Preferences::labelFontQString());
89
    ui->pfb_LabelFont->setCurrentFont(prefFont);
90
    //    ui->pfb_LabelFont->setCurrentText(Preferences::labelFontQString());   //only works in Qt5
91

92
    ui->pfb_LabelFont->onRestore();
93
    ui->plsb_LabelSize->onRestore();
94

95
    ui->cbProjAngle->onRestore();
96
    ui->cbSectionLineStd->onRestore();
97

98
    ui->pfc_DefTemp->onRestore();
99
    ui->pfc_DefDir->onRestore();
100
    ui->pfc_HatchFile->onRestore();
101
    ui->pfc_LineGroup->onRestore();
102
    ui->pfc_Welding->onRestore();
103
    ui->pfc_FilePattern->onRestore();
104
    ui->le_NamePattern->onRestore();
105

106
    bool gridDefault = PreferencesGui::showGrid();
107
    ui->cb_ShowGrid->setChecked(gridDefault);
108
    ui->cb_ShowGrid->onRestore();
109

110
    double spacingDefault = PreferencesGui::gridSpacing();
111
    ui->psb_GridSpacing->setValue(spacingDefault);
112
    ui->psb_GridSpacing->onRestore();
113

114
    bool multiSelectionDefault = PreferencesGui::multiSelection();
115
    ui->cbMultiSelection->setChecked(multiSelectionDefault);
116
    ui->cbMultiSelection->onRestore();
117
}
118

119
/**
120
 * Sets the strings of the subwidgets using the current language.
121
 */
122
void DlgPrefsTechDrawGeneralImp::changeEvent(QEvent *e)
123
{
124
    if (e->type() == QEvent::LanguageChange) {
125
        saveSettings();
126
        ui->retranslateUi(this);
127
        loadSettings();
128
    }
129
    else {
130
        QWidget::changeEvent(e);
131
    }
132
}
133

134
#include <Mod/TechDraw/Gui/moc_DlgPrefsTechDrawGeneralImp.cpp>
135

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

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

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

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