From 309f7197f4b12bd9837ac210b4e46b6cb2829f85 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 17 Jul 2020 13:57:08 +0200 Subject: [PATCH] PVS: V678 An object is used as an argument to its own method. Consider checking the first actual argument of the 'setupUi' function. Avoid to include ui generated header files within other header files but use forward declarations instead. This reduces dependencies between files and compile time considerably --- .../Gui/DlgPrefsTechDrawAdvancedImp.cpp | 50 ++++++------ .../Gui/DlgPrefsTechDrawAdvancedImp.h | 8 +- .../Gui/DlgPrefsTechDrawAnnotationImp.cpp | 72 +++++++++-------- .../Gui/DlgPrefsTechDrawAnnotationImp.h | 10 ++- .../Gui/DlgPrefsTechDrawColorsImp.cpp | 70 ++++++++-------- .../TechDraw/Gui/DlgPrefsTechDrawColorsImp.h | 8 +- .../Gui/DlgPrefsTechDrawDimensionsImp.cpp | 62 +++++++------- .../Gui/DlgPrefsTechDrawDimensionsImp.h | 7 +- .../Gui/DlgPrefsTechDrawGeneralImp.cpp | 81 ++++++++++--------- .../TechDraw/Gui/DlgPrefsTechDrawGeneralImp.h | 8 +- .../TechDraw/Gui/DlgPrefsTechDrawHLRImp.cpp | 46 ++++++----- src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.h | 8 +- .../TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp | 62 +++++++------- .../TechDraw/Gui/DlgPrefsTechDrawScaleImp.h | 8 +- 14 files changed, 271 insertions(+), 229 deletions(-) diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp index 9f2a2c5cf7..fffbf95c87 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.cpp @@ -26,14 +26,16 @@ #include "PreCompiled.h" #include "DlgPrefsTechDrawAdvancedImp.h" +#include #include using namespace TechDrawGui; DlgPrefsTechDrawAdvancedImp::DlgPrefsTechDrawAdvancedImp( QWidget* parent ) : PreferencePage( parent ) + , ui(new Ui_DlgPrefsTechDrawAdvancedImp) { - this->setupUi(this); + ui->setupUi(this); } DlgPrefsTechDrawAdvancedImp::~DlgPrefsTechDrawAdvancedImp() @@ -43,32 +45,32 @@ DlgPrefsTechDrawAdvancedImp::~DlgPrefsTechDrawAdvancedImp() void DlgPrefsTechDrawAdvancedImp::saveSettings() { - cbEndCap->onSave(); - cbCrazyEdges->onSave(); - cbDebugSection->onSave(); - cbDetectFaces->onSave(); - cbDebugDetail->onSave(); - cbShowSectionEdges->onSave(); - cbFuseBeforeSection->onSave(); - sbMaxTiles->onSave(); - sbMaxPat->onSave(); - cbShowLoose->onSave(); - leFormatSpec->onSave(); + ui->cbEndCap->onSave(); + ui->cbCrazyEdges->onSave(); + ui->cbDebugSection->onSave(); + ui->cbDetectFaces->onSave(); + ui->cbDebugDetail->onSave(); + ui->cbShowSectionEdges->onSave(); + ui->cbFuseBeforeSection->onSave(); + ui->sbMaxTiles->onSave(); + ui->sbMaxPat->onSave(); + ui->cbShowLoose->onSave(); + ui->leFormatSpec->onSave(); } void DlgPrefsTechDrawAdvancedImp::loadSettings() { - cbEndCap->onRestore(); - cbCrazyEdges->onRestore(); - cbDebugSection->onRestore(); - cbDetectFaces->onRestore(); - cbDebugDetail->onRestore(); - cbShowSectionEdges->onRestore(); - cbFuseBeforeSection->onRestore(); - sbMaxTiles->onRestore(); - sbMaxPat->onRestore(); - cbShowLoose->onRestore(); - leFormatSpec->onRestore(); + ui->cbEndCap->onRestore(); + ui->cbCrazyEdges->onRestore(); + ui->cbDebugSection->onRestore(); + ui->cbDetectFaces->onRestore(); + ui->cbDebugDetail->onRestore(); + ui->cbShowSectionEdges->onRestore(); + ui->cbFuseBeforeSection->onRestore(); + ui->sbMaxTiles->onRestore(); + ui->sbMaxPat->onRestore(); + ui->cbShowLoose->onRestore(); + ui->leFormatSpec->onRestore(); } /** @@ -78,7 +80,7 @@ void DlgPrefsTechDrawAdvancedImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { saveSettings(); - retranslateUi(this); + ui->retranslateUi(this); loadSettings(); } else { diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.h b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.h index 4404c1ba6f..797cca6287 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.h +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAdvancedImp.h @@ -25,12 +25,13 @@ #ifndef DRAWINGGUI_DLGPREFSTECHDRAWIMPADVANCED_H #define DRAWINGGUI_DLGPREFSTECHDRAWIMPADVANCED_H -#include #include +#include namespace TechDrawGui { +class Ui_DlgPrefsTechDrawAdvancedImp; -class DlgPrefsTechDrawAdvancedImp : public Gui::Dialog::PreferencePage, public Ui_DlgPrefsTechDrawAdvancedImp +class DlgPrefsTechDrawAdvancedImp : public Gui::Dialog::PreferencePage { Q_OBJECT @@ -42,6 +43,9 @@ protected: void saveSettings(); void loadSettings(); void changeEvent(QEvent *e); + +private: + std::unique_ptr ui; }; } // namespace TechDrawGui diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.cpp index 0551e39785..a0e14677b7 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.cpp @@ -33,6 +33,7 @@ #include "DrawGuiUtil.h" #include "PreferencesGui.h" #include "DlgPrefsTechDrawAnnotationImp.h" +#include "ui_DlgPrefsTechDrawAnnotation.h" using namespace TechDrawGui; @@ -41,10 +42,11 @@ using namespace TechDraw; DlgPrefsTechDrawAnnotationImp::DlgPrefsTechDrawAnnotationImp( QWidget* parent ) : PreferencePage( parent ) + , ui(new Ui_DlgPrefsTechDrawAnnotationImp) { - this->setupUi(this); - pdsbBalloonKink->setUnit(Base::Unit::Length); - pdsbBalloonKink->setMinimum(0); + ui->setupUi(this); + ui->pdsbBalloonKink->setUnit(Base::Unit::Length); + ui->pdsbBalloonKink->setMinimum(0); } DlgPrefsTechDrawAnnotationImp::~DlgPrefsTechDrawAnnotationImp() @@ -54,20 +56,20 @@ DlgPrefsTechDrawAnnotationImp::~DlgPrefsTechDrawAnnotationImp() void DlgPrefsTechDrawAnnotationImp::saveSettings() { - cbAutoHoriz->onSave(); - cbPrintCenterMarks->onSave(); - cbPyramidOrtho->onSave(); - cbSectionLineStd->onSave(); - cbShowCenterMarks->onSave(); - leLineGroup->onSave(); - pcbBalloonArrow->onSave(); - pcbBalloonShape->onSave(); - pcbCenterStyle->onSave(); - pcbMatting->onSave(); - pcbSectionStyle->onSave(); - pdsbBalloonKink->onSave(); - cbCutSurface->onSave(); - pcbHighlightStyle->onSave(); + ui->cbAutoHoriz->onSave(); + ui->cbPrintCenterMarks->onSave(); + ui->cbPyramidOrtho->onSave(); + ui->cbSectionLineStd->onSave(); + ui->cbShowCenterMarks->onSave(); + ui->leLineGroup->onSave(); + ui->pcbBalloonArrow->onSave(); + ui->pcbBalloonShape->onSave(); + ui->pcbCenterStyle->onSave(); + ui->pcbMatting->onSave(); + ui->pcbSectionStyle->onSave(); + ui->pdsbBalloonKink->onSave(); + ui->cbCutSurface->onSave(); + ui->pcbHighlightStyle->onSave(); } void DlgPrefsTechDrawAnnotationImp::loadSettings() @@ -76,25 +78,25 @@ void DlgPrefsTechDrawAnnotationImp::loadSettings() //Quantity widgets do not use preset value since they are based on //QAbstractSpinBox double kinkDefault = 5.0; - pdsbBalloonKink->setValue(kinkDefault); + ui->pdsbBalloonKink->setValue(kinkDefault); - cbAutoHoriz->onRestore(); - cbPrintCenterMarks->onRestore(); - cbPyramidOrtho->onRestore(); - cbSectionLineStd->onRestore(); - cbShowCenterMarks->onRestore(); - leLineGroup->onRestore(); - pcbBalloonArrow->onRestore(); - pcbBalloonShape->onRestore(); - pcbCenterStyle->onRestore(); - pcbMatting->onRestore(); - pcbSectionStyle->onRestore(); - pdsbBalloonKink->onRestore(); - cbCutSurface->onRestore(); - pcbHighlightStyle->onRestore(); + ui->cbAutoHoriz->onRestore(); + ui->cbPrintCenterMarks->onRestore(); + ui->cbPyramidOrtho->onRestore(); + ui->cbSectionLineStd->onRestore(); + ui->cbShowCenterMarks->onRestore(); + ui->leLineGroup->onRestore(); + ui->pcbBalloonArrow->onRestore(); + ui->pcbBalloonShape->onRestore(); + ui->pcbCenterStyle->onRestore(); + ui->pcbMatting->onRestore(); + ui->pcbSectionStyle->onRestore(); + ui->pdsbBalloonKink->onRestore(); + ui->cbCutSurface->onRestore(); + ui->pcbHighlightStyle->onRestore(); - DrawGuiUtil::loadArrowBox(pcbBalloonArrow); - pcbBalloonArrow->setCurrentIndex(prefBalloonArrow()); + DrawGuiUtil::loadArrowBox(ui->pcbBalloonArrow); + ui->pcbBalloonArrow->setCurrentIndex(prefBalloonArrow()); } /** @@ -104,7 +106,7 @@ void DlgPrefsTechDrawAnnotationImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { saveSettings(); - retranslateUi(this); + ui->retranslateUi(this); loadSettings(); } else { diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.h b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.h index 22b9ed283c..b0c2c71eba 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.h +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawAnnotationImp.h @@ -25,12 +25,13 @@ #ifndef DRAWINGGUI_DLGPREFSTECHDRAWIMPANNOTATION_H #define DRAWINGGUI_DLGPREFSTECHDRAWIMPANNOTATION_H -#include #include +#include namespace TechDrawGui { +class Ui_DlgPrefsTechDrawAnnotationImp; -class DlgPrefsTechDrawAnnotationImp : public Gui::Dialog::PreferencePage, public Ui_DlgPrefsTechDrawAnnotationImp +class DlgPrefsTechDrawAnnotationImp : public Gui::Dialog::PreferencePage { Q_OBJECT @@ -42,8 +43,11 @@ protected: void saveSettings(); void loadSettings(); void changeEvent(QEvent *e); - + int prefBalloonArrow(void) const; + +private: + std::unique_ptr ui; }; } // namespace TechDrawGui diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.cpp index b3fdea7de1..850ff0a8eb 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.cpp @@ -26,14 +26,16 @@ #include "PreCompiled.h" #include "DlgPrefsTechDrawColorsImp.h" +#include "ui_DlgPrefsTechDrawColors.h" #include using namespace TechDrawGui; DlgPrefsTechDrawColorsImp::DlgPrefsTechDrawColorsImp( QWidget* parent ) : PreferencePage( parent ) + , ui(new Ui_DlgPrefsTechDrawColorsImp) { - this->setupUi(this); + ui->setupUi(this); } DlgPrefsTechDrawColorsImp::~DlgPrefsTechDrawColorsImp() @@ -43,42 +45,42 @@ DlgPrefsTechDrawColorsImp::~DlgPrefsTechDrawColorsImp() void DlgPrefsTechDrawColorsImp::saveSettings() { - pcbDimColor->onSave(); - pcb_Hatch->onSave(); - pcb_Background->onSave(); - pcb_PreSelect->onSave(); - pcb_Hidden->onSave(); - pcb_Select->onSave(); - pcb_Normal->onSave(); - pcb_Surface->onSave(); - pcb_GeomHatch->onSave(); - pcb_Face->onSave(); - pcb_PaintFaces->onSave(); - pcbSectionLine->onSave(); - pcbCenterColor->onSave(); - pcbVertexColor->onSave(); - pcbMarkup->onSave(); - pcbHighlight->onSave(); + ui->pcbDimColor->onSave(); + ui->pcb_Hatch->onSave(); + ui->pcb_Background->onSave(); + ui->pcb_PreSelect->onSave(); + ui->pcb_Hidden->onSave(); + ui->pcb_Select->onSave(); + ui->pcb_Normal->onSave(); + ui->pcb_Surface->onSave(); + ui->pcb_GeomHatch->onSave(); + ui->pcb_Face->onSave(); + ui->pcb_PaintFaces->onSave(); + ui->pcbSectionLine->onSave(); + ui->pcbCenterColor->onSave(); + ui->pcbVertexColor->onSave(); + ui->pcbMarkup->onSave(); + ui->pcbHighlight->onSave(); } void DlgPrefsTechDrawColorsImp::loadSettings() { - pcbDimColor->onRestore(); - pcb_Hatch->onRestore(); - pcb_Background->onRestore(); - pcb_PreSelect->onRestore(); - pcb_Hidden->onRestore(); - pcb_Select->onRestore(); - pcb_Normal->onRestore(); - pcb_Surface->onRestore(); - pcb_GeomHatch->onRestore(); - pcb_Face->onRestore(); - pcb_PaintFaces->onRestore(); - pcbSectionLine->onRestore(); - pcbCenterColor->onRestore(); - pcbVertexColor->onRestore(); - pcbMarkup->onRestore(); - pcbHighlight->onRestore(); + ui->pcbDimColor->onRestore(); + ui->pcb_Hatch->onRestore(); + ui->pcb_Background->onRestore(); + ui->pcb_PreSelect->onRestore(); + ui->pcb_Hidden->onRestore(); + ui->pcb_Select->onRestore(); + ui->pcb_Normal->onRestore(); + ui->pcb_Surface->onRestore(); + ui->pcb_GeomHatch->onRestore(); + ui->pcb_Face->onRestore(); + ui->pcb_PaintFaces->onRestore(); + ui->pcbSectionLine->onRestore(); + ui->pcbCenterColor->onRestore(); + ui->pcbVertexColor->onRestore(); + ui->pcbMarkup->onRestore(); + ui->pcbHighlight->onRestore(); } /** @@ -88,7 +90,7 @@ void DlgPrefsTechDrawColorsImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { saveSettings(); - retranslateUi(this); + ui->retranslateUi(this); loadSettings(); } else { diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.h b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.h index df4422960f..96cb1b656b 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.h +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawColorsImp.h @@ -25,12 +25,13 @@ #ifndef DRAWINGGUI_DLGPREFSTECHDRAWIMPCOLORS_H #define DRAWINGGUI_DLGPREFSTECHDRAWIMPCOLORS_H -#include #include +#include namespace TechDrawGui { +class Ui_DlgPrefsTechDrawColorsImp; -class DlgPrefsTechDrawColorsImp : public Gui::Dialog::PreferencePage, public Ui_DlgPrefsTechDrawColorsImp +class DlgPrefsTechDrawColorsImp : public Gui::Dialog::PreferencePage { Q_OBJECT @@ -42,6 +43,9 @@ protected: void saveSettings(); void loadSettings(); void changeEvent(QEvent *e); + +private: + std::unique_ptr ui; }; } // namespace TechDrawGui diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp index d5ce4a6d93..cc017f5920 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.cpp @@ -33,6 +33,7 @@ #include "DrawGuiUtil.h" #include "PreferencesGui.h" #include "DlgPrefsTechDrawDimensionsImp.h" +#include "ui_DlgPrefsTechDrawDimensions.h" using namespace TechDrawGui; @@ -41,12 +42,13 @@ using namespace TechDraw; DlgPrefsTechDrawDimensionsImp::DlgPrefsTechDrawDimensionsImp( QWidget* parent ) : PreferencePage( parent ) + , ui(new Ui_DlgPrefsTechDrawDimensionsImp) { - this->setupUi(this); - plsb_FontSize->setUnit(Base::Unit::Length); - plsb_FontSize->setMinimum(0); - plsb_ArrowSize->setUnit(Base::Unit::Length); - plsb_ArrowSize->setMinimum(0); + ui->setupUi(this); + ui->plsb_FontSize->setUnit(Base::Unit::Length); + ui->plsb_FontSize->setMinimum(0); + ui->plsb_ArrowSize->setUnit(Base::Unit::Length); + ui->plsb_ArrowSize->setMinimum(0); } DlgPrefsTechDrawDimensionsImp::~DlgPrefsTechDrawDimensionsImp() @@ -56,16 +58,16 @@ DlgPrefsTechDrawDimensionsImp::~DlgPrefsTechDrawDimensionsImp() void DlgPrefsTechDrawDimensionsImp::saveSettings() { - cbGlobalDecimals->onSave(); - cbHiddenLineStyle->onSave(); - cbProjAngle->onSave(); - cbShowUnits->onSave(); - leDiameter->onSave(); - pcbArrow->onSave(); - pcbStandardAndStyle->onSave(); - plsb_ArrowSize->onSave(); - plsb_FontSize->onSave(); - sbAltDecimals->onSave(); + ui->cbGlobalDecimals->onSave(); + ui->cbHiddenLineStyle->onSave(); + ui->cbProjAngle->onSave(); + ui->cbShowUnits->onSave(); + ui->leDiameter->onSave(); + ui->pcbArrow->onSave(); + ui->pcbStandardAndStyle->onSave(); + ui->plsb_ArrowSize->onSave(); + ui->plsb_FontSize->onSave(); + ui->sbAltDecimals->onSave(); } void DlgPrefsTechDrawDimensionsImp::loadSettings() @@ -74,24 +76,24 @@ void DlgPrefsTechDrawDimensionsImp::loadSettings() //Quantity widgets do not use preset value since they are based on //QAbstractSpinBox double fontDefault = Preferences::dimFontSizeMM(); - plsb_FontSize->setValue(fontDefault); + ui->plsb_FontSize->setValue(fontDefault); // double arrowDefault = 5.0; // plsb_ArrowSize->setValue(arrowDefault); - plsb_ArrowSize->setValue(fontDefault); + ui->plsb_ArrowSize->setValue(fontDefault); - cbGlobalDecimals->onRestore(); - cbHiddenLineStyle->onRestore(); - cbProjAngle->onRestore(); - cbShowUnits->onRestore(); - leDiameter->onRestore(); - pcbArrow->onRestore(); - pcbStandardAndStyle->onRestore(); - plsb_ArrowSize->onRestore(); - plsb_FontSize->onRestore(); - sbAltDecimals->onRestore(); + ui->cbGlobalDecimals->onRestore(); + ui->cbHiddenLineStyle->onRestore(); + ui->cbProjAngle->onRestore(); + ui->cbShowUnits->onRestore(); + ui->leDiameter->onRestore(); + ui->pcbArrow->onRestore(); + ui->pcbStandardAndStyle->onRestore(); + ui->plsb_ArrowSize->onRestore(); + ui->plsb_FontSize->onRestore(); + ui->sbAltDecimals->onRestore(); - DrawGuiUtil::loadArrowBox(pcbArrow); - pcbArrow->setCurrentIndex(prefArrowStyle()); + DrawGuiUtil::loadArrowBox(ui->pcbArrow); + ui->pcbArrow->setCurrentIndex(prefArrowStyle()); } /** @@ -101,7 +103,7 @@ void DlgPrefsTechDrawDimensionsImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { saveSettings(); - retranslateUi(this); + ui->retranslateUi(this); loadSettings(); } else { diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.h b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.h index da6f747646..f030a2800b 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.h +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensionsImp.h @@ -25,12 +25,13 @@ #ifndef DRAWINGGUI_DLGPREFSTECHDRAWIMPDIMENSIONS_H #define DRAWINGGUI_DLGPREFSTECHDRAWIMPDIMENSIONS_H -#include #include +#include namespace TechDrawGui { +class Ui_DlgPrefsTechDrawDimensionsImp; -class DlgPrefsTechDrawDimensionsImp : public Gui::Dialog::PreferencePage, public Ui_DlgPrefsTechDrawDimensionsImp +class DlgPrefsTechDrawDimensionsImp : public Gui::Dialog::PreferencePage { Q_OBJECT @@ -45,6 +46,8 @@ protected: int prefArrowStyle(void) const; +private: + std::unique_ptr ui; }; } // namespace TechDrawGui diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp index acd3a0e52b..534b9ec4cb 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.cpp @@ -29,18 +29,21 @@ #include #include "DlgPrefsTechDrawGeneralImp.h" +#include "ui_DlgPrefsTechDrawGeneral.h" #include #include "PreferencesGui.h" + using namespace TechDrawGui; using namespace TechDraw; DlgPrefsTechDrawGeneralImp::DlgPrefsTechDrawGeneralImp( QWidget* parent ) : PreferencePage( parent ) + , ui(new Ui_DlgPrefsTechDrawGeneralImp) { - this->setupUi(this); - plsb_LabelSize->setUnit(Base::Unit::Length); - plsb_LabelSize->setMinimum(0); + ui->setupUi(this); + ui->plsb_LabelSize->setUnit(Base::Unit::Length); + ui->plsb_LabelSize->setMinimum(0); } DlgPrefsTechDrawGeneralImp::~DlgPrefsTechDrawGeneralImp() @@ -50,54 +53,54 @@ DlgPrefsTechDrawGeneralImp::~DlgPrefsTechDrawGeneralImp() void DlgPrefsTechDrawGeneralImp::saveSettings() { - pfc_DefTemp->onSave(); - pfc_DefDir->onSave(); - pfc_HatchFile->onSave(); - pfc_FilePattern->onSave(); - pfc_LineGroup->onSave(); - pfc_Welding->onSave(); - le_NamePattern->onSave(); + ui->pfc_DefTemp->onSave(); + ui->pfc_DefDir->onSave(); + ui->pfc_HatchFile->onSave(); + ui->pfc_FilePattern->onSave(); + ui->pfc_LineGroup->onSave(); + ui->pfc_Welding->onSave(); + ui->le_NamePattern->onSave(); - pfb_LabelFont->onSave(); - plsb_LabelSize->onSave(); + ui->pfb_LabelFont->onSave(); + ui->plsb_LabelSize->onSave(); - cb_Global->onSave(); - cb_Override->onSave(); - cb_PageUpdate->onSave(); - cb_AutoDist->onSave(); + ui->cb_Global->onSave(); + ui->cb_Override->onSave(); + ui->cb_PageUpdate->onSave(); + ui->cb_AutoDist->onSave(); } void DlgPrefsTechDrawGeneralImp::loadSettings() { // double labelDefault = 8.0; double labelDefault = Preferences::labelFontSizeMM(); - plsb_LabelSize->setValue(labelDefault); + ui->plsb_LabelSize->setValue(labelDefault); QFont prefFont(Preferences::labelFontQString()); - pfb_LabelFont->setCurrentFont(prefFont); -// pfb_LabelFont->setCurrentText(Preferences::labelFontQString()); //only works in Qt5 + ui->pfb_LabelFont->setCurrentFont(prefFont); +// ui->pfb_LabelFont->setCurrentText(Preferences::labelFontQString()); //only works in Qt5 - pfc_DefTemp->setFileName(Preferences::defaultTemplate()); - pfc_DefDir->setFileName(Preferences::defaultTemplateDir()); - pfc_HatchFile->setFileName(QString::fromStdString(DrawHatch::prefSvgHatch())); - pfc_FilePattern->setFileName(QString::fromStdString(DrawGeomHatch::prefGeomHatchFile())); - pfc_Welding->setFileName(PreferencesGui::weldingDirectory()); - pfc_LineGroup->setFileName(QString::fromUtf8(Preferences::lineGroupFile().c_str())); + ui->pfc_DefTemp->setFileName(Preferences::defaultTemplate()); + ui->pfc_DefDir->setFileName(Preferences::defaultTemplateDir()); + ui->pfc_HatchFile->setFileName(QString::fromStdString(DrawHatch::prefSvgHatch())); + ui->pfc_FilePattern->setFileName(QString::fromStdString(DrawGeomHatch::prefGeomHatchFile())); + ui->pfc_Welding->setFileName(PreferencesGui::weldingDirectory()); + ui->pfc_LineGroup->setFileName(QString::fromUtf8(Preferences::lineGroupFile().c_str())); - pfc_DefTemp->onRestore(); - pfc_DefDir->onRestore(); - pfc_HatchFile->onRestore(); - pfc_FilePattern->onRestore(); - pfc_LineGroup->onRestore(); - pfc_Welding->onRestore(); - le_NamePattern->onRestore(); + ui->pfc_DefTemp->onRestore(); + ui->pfc_DefDir->onRestore(); + ui->pfc_HatchFile->onRestore(); + ui->pfc_FilePattern->onRestore(); + ui->pfc_LineGroup->onRestore(); + ui->pfc_Welding->onRestore(); + ui->le_NamePattern->onRestore(); - pfb_LabelFont->onRestore(); - plsb_LabelSize->onRestore(); + ui->pfb_LabelFont->onRestore(); + ui->plsb_LabelSize->onRestore(); - cb_Global->onRestore(); - cb_Override->onRestore(); - cb_PageUpdate->onRestore(); - cb_AutoDist->onRestore(); + ui->cb_Global->onRestore(); + ui->cb_Override->onRestore(); + ui->cb_PageUpdate->onRestore(); + ui->cb_AutoDist->onRestore(); } /** @@ -107,7 +110,7 @@ void DlgPrefsTechDrawGeneralImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { saveSettings(); - retranslateUi(this); + ui->retranslateUi(this); loadSettings(); } else { diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.h b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.h index cde3671f92..d410c033bf 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.h +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawGeneralImp.h @@ -25,12 +25,13 @@ #ifndef DRAWINGGUI_DLGPREFSTECHDRAWIMPGENERAL_H #define DRAWINGGUI_DLGPREFSTECHDRAWIMPGENERAL_H -#include #include +#include namespace TechDrawGui { +class Ui_DlgPrefsTechDrawGeneralImp; -class DlgPrefsTechDrawGeneralImp : public Gui::Dialog::PreferencePage, public Ui_DlgPrefsTechDrawGeneralImp +class DlgPrefsTechDrawGeneralImp : public Gui::Dialog::PreferencePage { Q_OBJECT @@ -42,6 +43,9 @@ protected: void saveSettings(); void loadSettings(); void changeEvent(QEvent *e); + +private: + std::unique_ptr ui; }; } // namespace TechDrawGui diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.cpp index 96ec646b79..0c46260b06 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.cpp @@ -26,14 +26,16 @@ #include "PreCompiled.h" #include "DlgPrefsTechDrawHLRImp.h" +#include "ui_DlgPrefsTechDrawHLR.h" #include using namespace TechDrawGui; DlgPrefsTechDrawHLRImp::DlgPrefsTechDrawHLRImp( QWidget* parent ) : PreferencePage( parent ) + , ui(new Ui_DlgPrefsTechDrawHLRImp) { - this->setupUi(this); + ui->setupUi(this); } DlgPrefsTechDrawHLRImp::~DlgPrefsTechDrawHLRImp() @@ -43,30 +45,30 @@ DlgPrefsTechDrawHLRImp::~DlgPrefsTechDrawHLRImp() void DlgPrefsTechDrawHLRImp::saveSettings() { - pcbSeamViz->onSave(); - pcbSmoothViz->onSave(); - pcbHardViz->onSave(); - pcbPolygon->onSave(); - pcbIsoViz->onSave(); - pcbSmoothHid->onSave(); - pcbSeamHid->onSave(); - pcbIsoHid->onSave(); - psbIsoCount->onSave(); - pcbHardHid->onSave(); + ui->pcbSeamViz->onSave(); + ui->pcbSmoothViz->onSave(); + ui->pcbHardViz->onSave(); + ui->pcbPolygon->onSave(); + ui->pcbIsoViz->onSave(); + ui->pcbSmoothHid->onSave(); + ui->pcbSeamHid->onSave(); + ui->pcbIsoHid->onSave(); + ui->psbIsoCount->onSave(); + ui->pcbHardHid->onSave(); } void DlgPrefsTechDrawHLRImp::loadSettings() { - pcbSeamViz->onRestore(); - pcbSmoothViz->onRestore(); - pcbHardViz->onRestore(); - pcbPolygon->onRestore(); - pcbIsoViz->onRestore(); - pcbSmoothHid->onRestore(); - pcbSeamHid->onRestore(); - pcbIsoHid->onRestore(); - psbIsoCount->onRestore(); - pcbHardHid->onRestore(); + ui->pcbSeamViz->onRestore(); + ui->pcbSmoothViz->onRestore(); + ui->pcbHardViz->onRestore(); + ui->pcbPolygon->onRestore(); + ui->pcbIsoViz->onRestore(); + ui->pcbSmoothHid->onRestore(); + ui->pcbSeamHid->onRestore(); + ui->pcbIsoHid->onRestore(); + ui->psbIsoCount->onRestore(); + ui->pcbHardHid->onRestore(); } /** @@ -76,7 +78,7 @@ void DlgPrefsTechDrawHLRImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { saveSettings(); - retranslateUi(this); + ui->retranslateUi(this); loadSettings(); } else { diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.h b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.h index 1d0a86ede3..f34b29a1aa 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.h +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawHLRImp.h @@ -25,12 +25,13 @@ #ifndef DRAWINGGUI_DLGPREFSTECHDRAWIMPHLR_H #define DRAWINGGUI_DLGPREFSTECHDRAWIMPHLR_H -#include #include +#include namespace TechDrawGui { +class Ui_DlgPrefsTechDrawHLRImp; -class DlgPrefsTechDrawHLRImp : public Gui::Dialog::PreferencePage, public Ui_DlgPrefsTechDrawHLRImp +class DlgPrefsTechDrawHLRImp : public Gui::Dialog::PreferencePage { Q_OBJECT @@ -42,6 +43,9 @@ protected: void saveSettings(); void loadSettings(); void changeEvent(QEvent *e); + +private: + std::unique_ptr ui; }; } // namespace TechDrawGui diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp index 233bf6c7dc..242e6f9eb2 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.cpp @@ -26,19 +26,21 @@ #include "PreCompiled.h" #include "DlgPrefsTechDrawScaleImp.h" +#include "ui_DlgPrefsTechDrawScale.h" #include using namespace TechDrawGui; DlgPrefsTechDrawScaleImp::DlgPrefsTechDrawScaleImp( QWidget* parent ) : PreferencePage( parent ) + , ui(new Ui_DlgPrefsTechDrawScaleImp) { - this->setupUi(this); + ui->setupUi(this); - this->pdsbTemplateMark->setUnit(Base::Unit::Length); - this->pdsbTemplateMark->setMinimum(0); + ui->pdsbTemplateMark->setUnit(Base::Unit::Length); + ui->pdsbTemplateMark->setMinimum(0); - connect(this->cbViewScaleType, SIGNAL(currentIndexChanged(int)), + connect(ui->cbViewScaleType, SIGNAL(currentIndexChanged(int)), this, SLOT(onScaleTypeChanged(int))); } @@ -52,41 +54,41 @@ void DlgPrefsTechDrawScaleImp::onScaleTypeChanged(int index) // disable custom scale if the scale type is not custom if (index == 2) // if custom - this->pdsbViewScale->setEnabled(true); + ui->pdsbViewScale->setEnabled(true); else - this->pdsbViewScale->setEnabled(false); + ui->pdsbViewScale->setEnabled(false); } void DlgPrefsTechDrawScaleImp::saveSettings() { - pdsbToleranceScale->onSave(); - pdsbTemplateMark->onSave(); - pdsbVertexScale->onSave(); - pdsbCenterScale->onSave(); - pdsbPageScale->onSave(); - cbViewScaleType->onSave(); - pdsbViewScale->onSave(); - pdsbEdgeFuzz->onSave(); - pdsbMarkFuzz->onSave(); - pdsbTemplateMark->onSave(); - pdsbSymbolScale->onSave(); + ui->pdsbToleranceScale->onSave(); + ui->pdsbTemplateMark->onSave(); + ui->pdsbVertexScale->onSave(); + ui->pdsbCenterScale->onSave(); + ui->pdsbPageScale->onSave(); + ui->cbViewScaleType->onSave(); + ui->pdsbViewScale->onSave(); + ui->pdsbEdgeFuzz->onSave(); + ui->pdsbMarkFuzz->onSave(); + ui->pdsbTemplateMark->onSave(); + ui->pdsbSymbolScale->onSave(); } void DlgPrefsTechDrawScaleImp::loadSettings() { double markDefault = 3.0; - pdsbTemplateMark->setValue(markDefault); - pdsbToleranceScale->onRestore(); - pdsbTemplateMark->onRestore(); - pdsbVertexScale->onRestore(); - pdsbCenterScale->onRestore(); - pdsbPageScale->onRestore(); - cbViewScaleType->onRestore(); - pdsbViewScale->onRestore(); - pdsbEdgeFuzz->onRestore(); - pdsbMarkFuzz->onRestore(); - pdsbTemplateMark->onRestore(); - pdsbSymbolScale->onRestore(); + ui->pdsbTemplateMark->setValue(markDefault); + ui->pdsbToleranceScale->onRestore(); + ui->pdsbTemplateMark->onRestore(); + ui->pdsbVertexScale->onRestore(); + ui->pdsbCenterScale->onRestore(); + ui->pdsbPageScale->onRestore(); + ui->cbViewScaleType->onRestore(); + ui->pdsbViewScale->onRestore(); + ui->pdsbEdgeFuzz->onRestore(); + ui->pdsbMarkFuzz->onRestore(); + ui->pdsbTemplateMark->onRestore(); + ui->pdsbSymbolScale->onRestore(); } /** @@ -96,7 +98,7 @@ void DlgPrefsTechDrawScaleImp::changeEvent(QEvent *e) { if (e->type() == QEvent::LanguageChange) { saveSettings(); - retranslateUi(this); + ui->retranslateUi(this); loadSettings(); } else { diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.h b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.h index d68e184267..fb6a1c7729 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.h +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawScaleImp.h @@ -25,12 +25,13 @@ #ifndef DRAWINGGUI_DLGPREFSTECHDRAWIMPSCALE_H #define DRAWINGGUI_DLGPREFSTECHDRAWIMPSCALE_H -#include #include +#include namespace TechDrawGui { +class Ui_DlgPrefsTechDrawScaleImp; -class DlgPrefsTechDrawScaleImp : public Gui::Dialog::PreferencePage, public Ui_DlgPrefsTechDrawScaleImp +class DlgPrefsTechDrawScaleImp : public Gui::Dialog::PreferencePage { Q_OBJECT @@ -45,6 +46,9 @@ protected: void saveSettings(); void loadSettings(); void changeEvent(QEvent *e); + +private: + std::unique_ptr ui; }; } // namespace TechDrawGui