diff --git a/src/Gui/DlgSettingsViewColor.cpp b/src/Gui/DlgSettingsViewColor.cpp index ba017d9c0b..19d781ae33 100644 --- a/src/Gui/DlgSettingsViewColor.cpp +++ b/src/Gui/DlgSettingsViewColor.cpp @@ -46,6 +46,18 @@ DlgSettingsViewColor::DlgSettingsViewColor(QWidget* parent) ui->SelectionColor->setEnabled(ui->checkBoxSelection->isChecked()); connect(ui->SwitchGradientColors, &QPushButton::pressed, this, &DlgSettingsViewColor::onSwitchGradientColorsPressed); + + connect(ui->radioButtonSimple, &QRadioButton::toggled, this, + &DlgSettingsViewColor::onRadioButtonSimpleToggled); + + connect(ui->radioButtonGradient, &QRadioButton::toggled, this, + &DlgSettingsViewColor::onRadioButtonGradientToggled); + + connect(ui->rbRadialGradient, &QRadioButton::toggled, this, + &DlgSettingsViewColor::onRadioButtonRadialGradientToggled); + + connect(ui->checkMidColor, &QCheckBox::toggled, this, + &DlgSettingsViewColor::onCheckMidColorToggled); } /** @@ -90,6 +102,13 @@ void DlgSettingsViewColor::loadSettings() ui->SelectionColor->onRestore(); ui->TreeEditColor->onRestore(); ui->TreeActiveColor->onRestore(); + + if (ui->radioButtonSimple->isChecked()) + onRadioButtonSimpleToggled(true); + else if(ui->radioButtonGradient->isChecked()) + onRadioButtonGradientToggled(true); + else + onRadioButtonRadialGradientToggled(true); } /** @@ -112,5 +131,48 @@ void DlgSettingsViewColor::onSwitchGradientColorsPressed() ui->backgroundColorTo->setColor(tempColor); } +void DlgSettingsViewColor::onCheckMidColorToggled(bool val) +{ + ui->color2Label->setEnabled(val); + ui->backgroundColorMid->setEnabled(val); +} + +void DlgSettingsViewColor::onRadioButtonSimpleToggled(bool val) +{ + setGradientColorVisibility(!val); +} + +void DlgSettingsViewColor::onRadioButtonGradientToggled(bool val) +{ + setGradientColorVisibility(val); + ui->color1Label->setText(tr("Top:")); + ui->color2Label->setText(tr("Middle:")); + ui->color3Label->setText(tr("Bottom:")); +} + +void DlgSettingsViewColor::onRadioButtonRadialGradientToggled(bool val) +{ + setGradientColorVisibility(val); + ui->color1Label->setText(tr("Central:")); + ui->color2Label->setText(tr("Midway:")); + ui->color3Label->setText(tr("End:")); +} + +void DlgSettingsViewColor::setGradientColorVisibility(bool val) +{ + ui->SelectionColor_Background->setVisible(!val); + ui->color1Label->setVisible(val); + ui->backgroundColorFrom->setVisible(val); + ui->color2Label->setVisible(val); + ui->backgroundColorMid->setVisible(val); + ui->color3Label->setVisible(val); + ui->backgroundColorTo->setVisible(val); + ui->checkMidColor->setVisible(val); + ui->SwitchGradientColors->setVisible(val); + + if (val) + onCheckMidColorToggled(ui->checkMidColor->isChecked()); +} + #include "moc_DlgSettingsViewColor.cpp" diff --git a/src/Gui/DlgSettingsViewColor.h b/src/Gui/DlgSettingsViewColor.h index 394c13892e..bed4835a2c 100644 --- a/src/Gui/DlgSettingsViewColor.h +++ b/src/Gui/DlgSettingsViewColor.h @@ -52,6 +52,13 @@ protected: protected Q_SLOTS: void onSwitchGradientColorsPressed(); + void onRadioButtonSimpleToggled(bool val); + void onRadioButtonGradientToggled(bool val); + void onRadioButtonRadialGradientToggled(bool val); + void onCheckMidColorToggled(bool val); + +private: + void setGradientColorVisibility(bool val); private: std::unique_ptr ui; diff --git a/src/Gui/DlgSettingsViewColor.ui b/src/Gui/DlgSettingsViewColor.ui index 398205dcbe..5e493a6a65 100644 --- a/src/Gui/DlgSettingsViewColor.ui +++ b/src/Gui/DlgSettingsViewColor.ui @@ -190,52 +190,83 @@ 6 + + + + Qt::Horizontal + + + + 40 + 20 + + + + - - - 0 - - - 0 - - - 0 - - - 0 - - - 6 - - - - - - 240 - 0 - - - - Background will have selected color - - - Simple color - - - Simple - - - View - - + + + + + + + Background will have selected color + + + Simple color + + + Simple + + + View + + + + + + + Background will have selected color gradient + + + Linear gradient + + + true + + + Gradient + + + View + + + + + + + Background will have selected color gradient + + + Radial gradient + + + false + + + RadialGradient + + + View + + + + - + - - false - - + 0 0 @@ -246,7 +277,7 @@ - + 20 20 @@ -261,157 +292,138 @@ - - - - Background will have selected color gradient + + + + 0 - - Linear gradient + + 0 - - true + + 0 - - Gradient + + 0 - - View + + 6 - - - - - - Top color - - - - - - - 51 - 51 - 101 - - - - BackgroundColor2 - - - View - - - - - - - Switches the colors of the gradient - - - Switch - - - - - - - Background will have selected color gradient - - - Radial gradient - - - false - - - RadialGradient - - - View - - - - - - - Bottom color - - - - - - - 151 - 151 - 170 - - - - BackgroundColor3 - - - View - - - - - - - Color gradient will get selected color as middle color - - - Middle color - - - UseBackgroundColorMid - - - View - - - - - - - false - - - Middle color - - - - - - - 111 - 111 - 147 - - - - BackgroundColor4 - - - View - - + + + + Switches the colors of the gradient + + + Switch + + + + :/icons/button_sort.svg:/icons/button_sort.svg + + + + + + + Top: + + + + + + + + + + + 51 + 51 + 101 + + + + BackgroundColor2 + + + View + + + + + + + Middle: + + + + + + + + + + + 111 + 111 + 147 + + + + BackgroundColor4 + + + View + + + + + + + Color gradient will get selected color as middle color + + + Middle color + + + UseBackgroundColorMid + + + View + + + + + + + Bottom: + + + + + + + + + + + 151 + 151 + 170 + + + + BackgroundColor3 + + + View + + + + - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -480,7 +492,7 @@ Background color for objects in tree view that are currently edited - + 255 255 @@ -513,7 +525,7 @@ Background color for active containers in tree view - + 230 230 @@ -588,11 +600,8 @@ HighlightColor checkBoxSelection SelectionColor - radioButtonSimple SelectionColor_Background - radioButtonGradient backgroundColorFrom - rbRadialGradient backgroundColorTo checkMidColor backgroundColorMid @@ -631,117 +640,5 @@ - - checkMidColor - toggled(bool) - backgroundColorMid - setEnabled(bool) - - - 114 - 363 - - - 310 - 365 - - - - - radioButtonSimple - toggled(bool) - SelectionColor_Background - setEnabled(bool) - - - 103 - 282 - - - 310 - 284 - - - - - radioButtonGradient - toggled(bool) - backgroundColorFrom - setEnabled(bool) - - - 110 - 309 - - - 310 - 311 - - - - - radioButtonGradient - toggled(bool) - backgroundColorTo - setEnabled(bool) - - - 77 - 309 - - - 310 - 338 - - - - - rbRadialGradient - toggled(bool) - backgroundColorFrom - setEnabled(bool) - - - 110 - 309 - - - 310 - 311 - - - - - rbRadialGradient - toggled(bool) - backgroundColorTo - setEnabled(bool) - - - 77 - 309 - - - 310 - 338 - - - - - radioButtonSimple - toggled(bool) - checkMidColor - setDisabled(bool) - - - 99 - 282 - - - 93 - 363 - - -