From 7ff58ef0a86b3504c1ddaa7f7db01decb508b7ca Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 6 Mar 2017 14:37:40 +0100 Subject: [PATCH] split sketcher settings page and move to its own group --- src/Mod/Sketcher/Gui/AppSketcherGui.cpp | 3 +- src/Mod/Sketcher/Gui/CMakeLists.txt | 1 + src/Mod/Sketcher/Gui/Resources/Sketcher.qrc | 1 + src/Mod/Sketcher/Gui/SketcherSettings.cpp | 133 ++-- src/Mod/Sketcher/Gui/SketcherSettings.h | 23 + src/Mod/Sketcher/Gui/SketcherSettings.ui | 570 ++---------------- .../Sketcher/Gui/SketcherSettingsColors.ui | 523 ++++++++++++++++ 7 files changed, 673 insertions(+), 581 deletions(-) create mode 100644 src/Mod/Sketcher/Gui/SketcherSettingsColors.ui diff --git a/src/Mod/Sketcher/Gui/AppSketcherGui.cpp b/src/Mod/Sketcher/Gui/AppSketcherGui.cpp index 488f62e9f..d3efd648c 100644 --- a/src/Mod/Sketcher/Gui/AppSketcherGui.cpp +++ b/src/Mod/Sketcher/Gui/AppSketcherGui.cpp @@ -118,7 +118,8 @@ PyMOD_INIT_FUNC(SketcherGui) SketcherGui::SoZoomTranslation ::initClass(); SketcherGui::PropertyConstraintListItem ::init(); - (void)new Gui::PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","Display") ); + (void)new Gui::PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","Sketcher") ); + (void)new Gui::PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","Sketcher") ); // add resources and reloads the translators loadSketcherResource(); diff --git a/src/Mod/Sketcher/Gui/CMakeLists.txt b/src/Mod/Sketcher/Gui/CMakeLists.txt index 6f6c78817..2b10cdc9a 100644 --- a/src/Mod/Sketcher/Gui/CMakeLists.txt +++ b/src/Mod/Sketcher/Gui/CMakeLists.txt @@ -60,6 +60,7 @@ set(SketcherGui_UIC_SRCS SketchOrientationDialog.ui SketchMirrorDialog.ui SketcherSettings.ui + SketcherSettingsColors.ui SketchRectangularArrayDialog.ui ) diff --git a/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc b/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc index 416fefb3f..b5f9c3a49 100644 --- a/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc +++ b/src/Mod/Sketcher/Gui/Resources/Sketcher.qrc @@ -147,6 +147,7 @@ icons/Sketcher_MergeSketch.svg icons/Sketcher_MirrorSketch.svg icons/Sketcher_NewSketch.svg + icons/Sketcher_NewSketch.svg icons/Sketcher_Parabolic_Arc.svg icons/Sketcher_Parabolic_Arc_Constr.svg icons/Sketcher_ProfilesHexagon1.svg diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.cpp b/src/Mod/Sketcher/Gui/SketcherSettings.cpp index 9f7993e10..228487967 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.cpp +++ b/src/Mod/Sketcher/Gui/SketcherSettings.cpp @@ -31,6 +31,7 @@ #include "SketcherSettings.h" #include "ui_SketcherSettings.h" +#include "ui_SketcherSettingsColors.h" #include "TaskSketcherGeneral.h" #include #include @@ -53,15 +54,7 @@ SketcherSettings::SketcherSettings(QWidget* parent) gridLayout->setMargin(0); form = new SketcherGeneralWidget(groupBox); gridLayout->addWidget(form, 0, 0, 1, 1); - ui->gridLayout_3->addWidget(groupBox, 2, 0, 1, 1); - - // Don't need them at the moment - ui->label_16->hide(); - ui->SketcherDatumWidth->hide(); - ui->label_12->hide(); - ui->DefaultSketcherVertexWidth->hide(); - ui->label_13->hide(); - ui->DefaultSketcherLineWidth->hide(); + ui->gridLayout_3->addWidget(groupBox, 1, 0, 1, 1); QList < QPair > styles; styles << qMakePair(Qt::SolidLine, 0xffff) @@ -101,25 +94,6 @@ SketcherSettings::~SketcherSettings() void SketcherSettings::saveSettings() { - // Sketcher - ui->SketchEdgeColor->onSave(); - ui->SketchVertexColor->onSave(); - ui->EditedEdgeColor->onSave(); - ui->EditedVertexColor->onSave(); - ui->ConstructionColor->onSave(); - ui->ExternalColor->onSave(); - ui->FullyConstrainedColor->onSave(); - - ui->ConstrainedColor->onSave(); - ui->NonDrivingConstraintColor->onSave(); - ui->DatumColor->onSave(); - - ui->SketcherDatumWidth->onSave(); - ui->DefaultSketcherVertexWidth->onSave(); - ui->DefaultSketcherLineWidth->onSave(); - - ui->CursorTextColor->onSave(); - // Sketch editing ui->EditSketcherFontSize->onSave(); ui->SegmentsPerGeometry->onSave(); @@ -145,25 +119,6 @@ void SketcherSettings::saveSettings() void SketcherSettings::loadSettings() { - // Sketcher - ui->SketchEdgeColor->onRestore(); - ui->SketchVertexColor->onRestore(); - ui->EditedEdgeColor->onRestore(); - ui->EditedVertexColor->onRestore(); - ui->ConstructionColor->onRestore(); - ui->ExternalColor->onRestore(); - ui->FullyConstrainedColor->onRestore(); - - ui->ConstrainedColor->onRestore(); - ui->NonDrivingConstraintColor->onRestore(); - ui->DatumColor->onRestore(); - - ui->SketcherDatumWidth->onRestore(); - ui->DefaultSketcherVertexWidth->onRestore(); - ui->DefaultSketcherLineWidth->onRestore(); - - ui->CursorTextColor->onRestore(); - // Sketch editing ui->EditSketcherFontSize->onRestore(); ui->SegmentsPerGeometry->onRestore(); @@ -234,5 +189,89 @@ void SketcherSettings::onBtnTVApplyClicked(bool) } } + + +/* TRANSLATOR SketcherGui::SketcherSettingsColors */ + +SketcherSettingsColors::SketcherSettingsColors(QWidget* parent) + : PreferencePage(parent), ui(new Ui_SketcherSettingsColors) +{ + ui->setupUi(this); + + // Don't need them at the moment + ui->label_16->hide(); + ui->SketcherDatumWidth->hide(); + ui->label_12->hide(); + ui->DefaultSketcherVertexWidth->hide(); + ui->label_13->hide(); + ui->DefaultSketcherLineWidth->hide(); +} + +/** + * Destroys the object and frees any allocated resources + */ +SketcherSettingsColors::~SketcherSettingsColors() +{ + // no need to delete child widgets, Qt does it all for us + delete ui; +} + +void SketcherSettingsColors::saveSettings() +{ + // Sketcher + ui->SketchEdgeColor->onSave(); + ui->SketchVertexColor->onSave(); + ui->EditedEdgeColor->onSave(); + ui->EditedVertexColor->onSave(); + ui->ConstructionColor->onSave(); + ui->ExternalColor->onSave(); + ui->FullyConstrainedColor->onSave(); + + ui->ConstrainedColor->onSave(); + ui->NonDrivingConstraintColor->onSave(); + ui->DatumColor->onSave(); + + ui->SketcherDatumWidth->onSave(); + ui->DefaultSketcherVertexWidth->onSave(); + ui->DefaultSketcherLineWidth->onSave(); + + ui->CursorTextColor->onSave(); +} + +void SketcherSettingsColors::loadSettings() +{ + // Sketcher + ui->SketchEdgeColor->onRestore(); + ui->SketchVertexColor->onRestore(); + ui->EditedEdgeColor->onRestore(); + ui->EditedVertexColor->onRestore(); + ui->ConstructionColor->onRestore(); + ui->ExternalColor->onRestore(); + ui->FullyConstrainedColor->onRestore(); + + ui->ConstrainedColor->onRestore(); + ui->NonDrivingConstraintColor->onRestore(); + ui->DatumColor->onRestore(); + + ui->SketcherDatumWidth->onRestore(); + ui->DefaultSketcherVertexWidth->onRestore(); + ui->DefaultSketcherLineWidth->onRestore(); + + ui->CursorTextColor->onRestore(); +} + +/** + * Sets the strings of the subwidgets using the current language. + */ +void SketcherSettingsColors::changeEvent(QEvent *e) +{ + if (e->type() == QEvent::LanguageChange) { + ui->retranslateUi(this); + } + else { + QWidget::changeEvent(e); + } +} + #include "moc_SketcherSettings.cpp" diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.h b/src/Mod/Sketcher/Gui/SketcherSettings.h index 07c2d3b7c..0b3ba698a 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.h +++ b/src/Mod/Sketcher/Gui/SketcherSettings.h @@ -28,6 +28,7 @@ namespace SketcherGui { class Ui_SketcherSettings; +class Ui_SketcherSettingsColors; class SketcherGeneralWidget; /** * The SketcherSettings class implements a preference page to change sketcher settings. @@ -55,6 +56,28 @@ private: SketcherGeneralWidget* form; }; +/** + * The SketcherSettings class implements a preference page to change sketcher settings. + * @author Werner Mayer + */ +class SketcherSettingsColors : public Gui::Dialog::PreferencePage +{ + Q_OBJECT + +public: + SketcherSettingsColors(QWidget* parent = 0); + ~SketcherSettingsColors(); + + void saveSettings(); + void loadSettings(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui_SketcherSettingsColors* ui; +}; + } // namespace SketcherGui #endif // SKETCHERGUI_SKETCHERSETTINGS_H diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.ui b/src/Mod/Sketcher/Gui/SketcherSettings.ui index ef71c7de1..405f083f4 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.ui +++ b/src/Mod/Sketcher/Gui/SketcherSettings.ui @@ -7,521 +7,14 @@ 0 0 427 - 1253 + 492 - Sketcher + General - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Sketch Solver - - - - - - Show Advanced Solver Control in the Task bar - - - ShowSolverAdvancedWidget - - - Mod/Sketcher - - - - - - - - - Sketcher colors - - - - - - - - - 182 - 0 - - - - Default edge color - - - - - - - The color of edges being edited - - - - 255 - 255 - 255 - - - - SketchEdgeColor - - - View - - - - - - - - 182 - 0 - - - - Default vertex color - - - - - - - The color of vertices being edited - - - - 255 - 255 - 255 - - - - SketchVertexColor - - - View - - - - - - - - 182 - 0 - - - - Edit edge color - - - - - - - The color of edges being edited - - - - 255 - 255 - 255 - - - - EditedEdgeColor - - - View - - - - - - - - 182 - 0 - - - - Edit vertex color - - - - - - - The color of vertices being edited - - - - 255 - 38 - 0 - - - - EditedVertexColor - - - View - - - - - - - - 182 - 0 - - - - Construction geometry - - - - - - - The color of fully constrained geometry in edit mode - - - - 255 - 38 - 0 - - - - ConstrainedDimColor - - - View - - - - - - - The color of construction geometry in edit mode - - - - 0 - 0 - 220 - - - - ConstructionColor - - - View - - - - - - - - 182 - 0 - - - - External geometry - - - - - - - The color of external geometry in edit mode - - - - 204 - 51 - 115 - - - - ExternalColor - - - View - - - - - - - - 182 - 0 - - - - Fully constrained geometry - - - - - - - - 182 - 0 - - - - Constraint color - - - - - - - The color of fully constrained geometry in edit mode - - - - 0 - 255 - 0 - - - - FullyConstrainedColor - - - View - - - - - - - - 182 - 0 - - - - Datum color - - - - - - - - 182 - 0 - - - - Datum text size - - - - - - - - 182 - 0 - - - - Default vertex size - - - - - - - The default line thickness for new shapes - - - px - - - 9 - - - 2 - - - DefaultSketcherVertexWidth - - - View - - - - - - - - 182 - 0 - - - - Default line width - - - - - - - The default line thickness for new shapes - - - px - - - 9 - - - 2 - - - DefaultSketcherVertexWidth - - - View - - - - - - - - 182 - 0 - - - - Cursor text color - - - - - - - - 0 - 0 - 255 - - - - CursorTextColor - - - View - - - - - - - The default line thickness for new shapes - - - px - - - 9 - - - 2 - - - DefaultShapeLineWidth - - - View - - - - - - - Non-driving Datum color - - - - - - - The color of driving constraints in edit mode - - - - 255 - 38 - 0 - - - - ConstrainedIcoColor - - - View - - - - - - - The color of non-driving constrains or dimensions in edit mode - - - - 0 - 38 - 255 - - - - NonDrivingConstrDimColor - - - View - - - - - - - - - Sketch editing @@ -813,24 +306,49 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Sketch Solver + + + + + + Show Advanced Solver Control in the Task bar + + + ShowSolverAdvancedWidget + + + Mod/Sketcher + + + + + + - - Gui::ColorButton - QPushButton -
Gui/Widgets.h
-
Gui::PrefSpinBox QSpinBox
Gui/PrefWidgets.h
- - Gui::PrefColorButton - Gui::ColorButton -
Gui/PrefWidgets.h
-
Gui::PrefCheckBox QCheckBox @@ -838,20 +356,6 @@
- SketchEdgeColor - SketchVertexColor - EditedEdgeColor - EditedVertexColor - ConstructionColor - ExternalColor - FullyConstrainedColor - ConstrainedColor - NonDrivingConstraintColor - DatumColor - SketcherDatumWidth - DefaultSketcherVertexWidth - DefaultSketcherLineWidth - CursorTextColor EditSketcherFontSize EditSketcherMarkerSize comboBox diff --git a/src/Mod/Sketcher/Gui/SketcherSettingsColors.ui b/src/Mod/Sketcher/Gui/SketcherSettingsColors.ui new file mode 100644 index 000000000..344208d7d --- /dev/null +++ b/src/Mod/Sketcher/Gui/SketcherSettingsColors.ui @@ -0,0 +1,523 @@ + + + SketcherGui::SketcherSettingsColors + + + + 0 + 0 + 438 + 474 + + + + Colors + + + + + + Sketcher colors + + + + + + + + + 182 + 0 + + + + Default edge color + + + + + + + The color of edges being edited + + + + 255 + 255 + 255 + + + + SketchEdgeColor + + + View + + + + + + + + 182 + 0 + + + + Default vertex color + + + + + + + The color of vertices being edited + + + + 255 + 255 + 255 + + + + SketchVertexColor + + + View + + + + + + + + 182 + 0 + + + + Edit edge color + + + + + + + The color of edges being edited + + + + 255 + 255 + 255 + + + + EditedEdgeColor + + + View + + + + + + + + 182 + 0 + + + + Edit vertex color + + + + + + + The color of vertices being edited + + + + 255 + 38 + 0 + + + + EditedVertexColor + + + View + + + + + + + + 182 + 0 + + + + Construction geometry + + + + + + + The color of fully constrained geometry in edit mode + + + + 255 + 38 + 0 + + + + ConstrainedDimColor + + + View + + + + + + + The color of construction geometry in edit mode + + + + 0 + 0 + 220 + + + + ConstructionColor + + + View + + + + + + + + 182 + 0 + + + + External geometry + + + + + + + The color of external geometry in edit mode + + + + 204 + 51 + 115 + + + + ExternalColor + + + View + + + + + + + + 182 + 0 + + + + Fully constrained geometry + + + + + + + + 182 + 0 + + + + Constraint color + + + + + + + The color of fully constrained geometry in edit mode + + + + 0 + 255 + 0 + + + + FullyConstrainedColor + + + View + + + + + + + + 182 + 0 + + + + Datum color + + + + + + + + 182 + 0 + + + + Datum text size + + + + + + + + 182 + 0 + + + + Default vertex size + + + + + + + The default line thickness for new shapes + + + px + + + 9 + + + 2 + + + DefaultSketcherVertexWidth + + + View + + + + + + + + 182 + 0 + + + + Default line width + + + + + + + The default line thickness for new shapes + + + px + + + 9 + + + 2 + + + DefaultSketcherVertexWidth + + + View + + + + + + + + 182 + 0 + + + + Cursor text color + + + + + + + + 0 + 0 + 255 + + + + CursorTextColor + + + View + + + + + + + The default line thickness for new shapes + + + px + + + 9 + + + 2 + + + DefaultShapeLineWidth + + + View + + + + + + + Non-driving Datum color + + + + + + + The color of driving constraints in edit mode + + + + 255 + 38 + 0 + + + + ConstrainedIcoColor + + + View + + + + + + + The color of non-driving constrains or dimensions in edit mode + + + + 0 + 38 + 255 + + + + NonDrivingConstrDimColor + + + View + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
+ + Gui::PrefSpinBox + QSpinBox +
Gui/PrefWidgets.h
+
+ + Gui::PrefColorButton + Gui::ColorButton +
Gui/PrefWidgets.h
+
+
+ + +