split sketcher settings page and move to its own group

This commit is contained in:
wmayer
2017-03-06 14:37:40 +01:00
parent 7711d71410
commit 7ff58ef0a8
7 changed files with 673 additions and 581 deletions

View File

@@ -31,6 +31,7 @@
#include "SketcherSettings.h"
#include "ui_SketcherSettings.h"
#include "ui_SketcherSettingsColors.h"
#include "TaskSketcherGeneral.h"
#include <Base/Console.h>
#include <Base/Interpreter.h>
@@ -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<Qt::PenStyle, int> > 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"