FreeCAD

Форк
0
/
DlgPrefsTechDrawScaleImp.cpp 
100 строк · 3.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 "DlgPrefsTechDrawScaleImp.h"
28
#include "ui_DlgPrefsTechDrawScale.h"
29

30

31
using namespace TechDrawGui;
32

33
DlgPrefsTechDrawScaleImp::DlgPrefsTechDrawScaleImp( QWidget* parent )
34
  : PreferencePage( parent )
35
  , ui(new Ui_DlgPrefsTechDrawScaleImp)
36
{
37
    ui->setupUi(this);
38

39
    ui->pdsbTemplateMark->setUnit(Base::Unit::Length);
40
    ui->pdsbTemplateMark->setMinimum(0);
41

42
    connect(ui->cbViewScaleType, qOverload<int>(&QComboBox::currentIndexChanged),
43
            this, &DlgPrefsTechDrawScaleImp::onScaleTypeChanged);
44
}
45

46
DlgPrefsTechDrawScaleImp::~DlgPrefsTechDrawScaleImp()
47
{
48
    // no need to delete child widgets, Qt does it all for us
49
}
50

51
void DlgPrefsTechDrawScaleImp::onScaleTypeChanged(int index)
52
{
53
    // disable custom scale if the scale type is not custom
54

55
    if (index == 2) // if custom
56
        ui->pdsbViewScale->setEnabled(true);
57
    else
58
        ui->pdsbViewScale->setEnabled(false);
59
}
60

61
void DlgPrefsTechDrawScaleImp::saveSettings()
62
{
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();
70
}
71

72
void DlgPrefsTechDrawScaleImp::loadSettings()
73
{
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();
83
}
84

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

100
#include <Mod/TechDraw/Gui/moc_DlgPrefsTechDrawScaleImp.cpp>
101

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

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

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

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