Merge pull request #9172 from Ondsel-Development/color_pref_ui

Pref: Colors: Reorganize the ui.
This commit is contained in:
Chris Hennes
2023-04-03 13:39:53 -05:00
committed by GitHub
3 changed files with 269 additions and 303 deletions

View File

@@ -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"

View File

@@ -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_DlgSettingsViewColor> ui;

View File

@@ -190,52 +190,83 @@
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="1">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<layout class="QGridLayout" name="_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="Gui::PrefRadioButton" name="radioButtonSimple">
<property name="minimumSize">
<size>
<width>240</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Background will have selected color</string>
</property>
<property name="text">
<string>Simple color</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>Simple</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="Gui::PrefRadioButton" name="radioButtonSimple">
<property name="toolTip">
<string>Background will have selected color</string>
</property>
<property name="text">
<string>Simple color</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>Simple</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefRadioButton" name="radioButtonGradient">
<property name="toolTip">
<string>Background will have selected color gradient</string>
</property>
<property name="text">
<string>Linear gradient</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>Gradient</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefRadioButton" name="rbRadialGradient">
<property name="toolTip">
<string>Background will have selected color gradient</string>
</property>
<property name="text">
<string>Radial gradient</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>RadialGradient</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="3">
<item>
<widget class="Gui::PrefColorButton" name="SelectionColor_Background">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -246,7 +277,7 @@
<property name="text">
<string/>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>20</red>
<green>20</green>
@@ -261,157 +292,138 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Gui::PrefRadioButton" name="radioButtonGradient">
<property name="toolTip">
<string>Background will have selected color gradient</string>
<item>
<layout class="QGridLayout" name="_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="text">
<string>Linear gradient</string>
<property name="topMargin">
<number>0</number>
</property>
<property name="checked">
<bool>true</bool>
<property name="rightMargin">
<number>0</number>
</property>
<property name="prefEntry" stdset="0">
<cstring>Gradient</cstring>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
<property name="spacing">
<number>6</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="Gui::PrefColorButton" name="backgroundColorFrom">
<property name="toolTip">
<string>Top color</string>
</property>
<property name="text">
<string/>
</property>
<property name="color">
<color>
<red>51</red>
<green>51</green>
<blue>101</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor2</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="SwitchGradientColors">
<property name="toolTip">
<string>Switches the colors of the gradient</string>
</property>
<property name="text">
<string>Switch</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="Gui::PrefRadioButton" name="rbRadialGradient">
<property name="toolTip">
<string>Background will have selected color gradient</string>
</property>
<property name="text">
<string>Radial gradient</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>RadialGradient</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="Gui::PrefColorButton" name="backgroundColorTo">
<property name="toolTip">
<string>Bottom color</string>
</property>
<property name="text">
<string/>
</property>
<property name="color">
<color>
<red>151</red>
<green>151</green>
<blue>170</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor3</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="Gui::PrefCheckBox" name="checkMidColor">
<property name="toolTip">
<string>Color gradient will get selected color as middle color</string>
</property>
<property name="text">
<string>Middle color</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>UseBackgroundColorMid</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="Gui::PrefColorButton" name="backgroundColorMid">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Middle color</string>
</property>
<property name="text">
<string/>
</property>
<property name="color">
<color>
<red>111</red>
<green>111</green>
<blue>147</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor4</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
<item row="1" column="0">
<widget class="QToolButton" name="SwitchGradientColors">
<property name="toolTip">
<string>Switches the colors of the gradient</string>
</property>
<property name="text">
<string>Switch</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/icons/button_sort.svg</normaloff>:/icons/button_sort.svg</iconset>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="color1Label">
<property name="text">
<string>Top:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="Gui::PrefColorButton" name="backgroundColorFrom">
<property name="text">
<string/>
</property>
<property name="color" stdset="0">
<color>
<red>51</red>
<green>51</green>
<blue>101</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor2</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="color2Label">
<property name="text">
<string>Middle:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="Gui::PrefColorButton" name="backgroundColorMid">
<property name="text">
<string/>
</property>
<property name="color" stdset="0">
<color>
<red>111</red>
<green>111</green>
<blue>147</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor4</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="Gui::PrefCheckBox" name="checkMidColor">
<property name="toolTip">
<string>Color gradient will get selected color as middle color</string>
</property>
<property name="text">
<string>Middle color</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>UseBackgroundColorMid</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="color3Label">
<property name="text">
<string>Bottom:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::PrefColorButton" name="backgroundColorTo">
<property name="text">
<string/>
</property>
<property name="color" stdset="0">
<color>
<red>151</red>
<green>151</green>
<blue>170</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>BackgroundColor3</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
@@ -480,7 +492,7 @@
<property name="toolTip">
<string>Background color for objects in tree view that are currently edited</string>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>255</red>
<green>255</green>
@@ -513,7 +525,7 @@
<property name="toolTip">
<string>Background color for active containers in tree view</string>
</property>
<property name="color">
<property name="color" stdset="0">
<color>
<red>230</red>
<green>230</green>
@@ -588,11 +600,8 @@
<tabstop>HighlightColor</tabstop>
<tabstop>checkBoxSelection</tabstop>
<tabstop>SelectionColor</tabstop>
<tabstop>radioButtonSimple</tabstop>
<tabstop>SelectionColor_Background</tabstop>
<tabstop>radioButtonGradient</tabstop>
<tabstop>backgroundColorFrom</tabstop>
<tabstop>rbRadialGradient</tabstop>
<tabstop>backgroundColorTo</tabstop>
<tabstop>checkMidColor</tabstop>
<tabstop>backgroundColorMid</tabstop>
@@ -631,117 +640,5 @@
</hint>
</hints>
</connection>
<connection>
<sender>checkMidColor</sender>
<signal>toggled(bool)</signal>
<receiver>backgroundColorMid</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>114</x>
<y>363</y>
</hint>
<hint type="destinationlabel">
<x>310</x>
<y>365</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioButtonSimple</sender>
<signal>toggled(bool)</signal>
<receiver>SelectionColor_Background</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>103</x>
<y>282</y>
</hint>
<hint type="destinationlabel">
<x>310</x>
<y>284</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioButtonGradient</sender>
<signal>toggled(bool)</signal>
<receiver>backgroundColorFrom</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>110</x>
<y>309</y>
</hint>
<hint type="destinationlabel">
<x>310</x>
<y>311</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioButtonGradient</sender>
<signal>toggled(bool)</signal>
<receiver>backgroundColorTo</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>77</x>
<y>309</y>
</hint>
<hint type="destinationlabel">
<x>310</x>
<y>338</y>
</hint>
</hints>
</connection>
<connection>
<sender>rbRadialGradient</sender>
<signal>toggled(bool)</signal>
<receiver>backgroundColorFrom</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>110</x>
<y>309</y>
</hint>
<hint type="destinationlabel">
<x>310</x>
<y>311</y>
</hint>
</hints>
</connection>
<connection>
<sender>rbRadialGradient</sender>
<signal>toggled(bool)</signal>
<receiver>backgroundColorTo</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>77</x>
<y>309</y>
</hint>
<hint type="destinationlabel">
<x>310</x>
<y>338</y>
</hint>
</hints>
</connection>
<connection>
<sender>radioButtonSimple</sender>
<signal>toggled(bool)</signal>
<receiver>checkMidColor</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>99</x>
<y>282</y>
</hint>
<hint type="destinationlabel">
<x>93</x>
<y>363</y>
</hint>
</hints>
</connection>
</connections>
</ui>