Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
[new strings] Implement a GUI option to configure sorting in Color History Wheel
Dmitry Kazakov3138bbd1ccbb
diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.ccindex c265aef957..f344d7beb1 100644--- a/libs/ui/dialogs/kis_dlg_preferences.cc+++ b/libs/ui/dialogs/kis_dlg_preferences.cc@@ -2083,14 +2083,26 @@ void FullscreenSettingsTab::setDefault()//---------------------------------------------------------------------------------------------------+namespace PopupPaletteTabPrivate {+static const QStringList allowedColorHistorySortingValues({"none", "hsv"});+}+PopupPaletteTab::PopupPaletteTab(QWidget *parent, const char *name): WdgPopupPaletteSettingsBase(parent, name){+ using namespace PopupPaletteTabPrivate;+load();++ connect(chkShowColorHistory, SIGNAL(toggled(bool)), cmbColorHistorySorting, SLOT(setEnabled(bool)));+ connect(chkShowColorHistory, SIGNAL(toggled(bool)), lblColorHistorySorting, SLOT(setEnabled(bool)));+ KIS_SAFE_ASSERT_RECOVER_NOOP(cmbColorHistorySorting->count() == allowedColorHistorySortingValues.size());}void PopupPaletteTab::load(){+ using namespace PopupPaletteTabPrivate;+KisConfig config(true);sbNumPresets->setValue(config.favoritePresets());sbPaletteSize->setValue(config.readEntry("popuppalette/size", 385));@@ -2099,10 +2111,20 @@ void PopupPaletteTab::load()chkShowColorHistory->setChecked(config.readEntry("popuppalette/showColorHistory", true));chkShowRotationTrack->setChecked(config.readEntry("popuppalette/showRotationTrack", true));chkUseDynamicSlotCount->setChecked(config.readEntry("popuppalette/useDynamicSlotCount", true));++ QString currentSorting = config.readEntry("popuppalette/colorHistorySorting", QString("hsv"));+ if (!allowedColorHistorySortingValues.contains(currentSorting)) {+ currentSorting = "hsv";+ }+ cmbColorHistorySorting->setCurrentIndex(allowedColorHistorySortingValues.indexOf(currentSorting));+ cmbColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());+ lblColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());}void PopupPaletteTab::save(){+ using namespace PopupPaletteTabPrivate;+KisConfig config(true);config.setFavoritePresets(sbNumPresets->value());config.writeEntry("popuppalette/size", sbPaletteSize->value());@@ -2111,6 +2133,8 @@ void PopupPaletteTab::save()config.writeEntry<bool>("popuppalette/showColorHistory", chkShowColorHistory->isChecked());config.writeEntry<bool>("popuppalette/showRotationTrack", chkShowRotationTrack->isChecked());config.writeEntry<bool>("popuppalette/useDynamicSlotCount", chkUseDynamicSlotCount->isChecked());+ config.writeEntry("popuppalette/colorHistorySorting",+ allowedColorHistorySortingValues[cmbColorHistorySorting->currentIndex()]);}void PopupPaletteTab::setDefault()@@ -2123,6 +2147,8 @@ void PopupPaletteTab::setDefault()chkShowColorHistory->setChecked(true);chkShowRotationTrack->setChecked(true);chkUseDynamicSlotCount->setChecked(true);+ cmbColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());+ lblColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());}//---------------------------------------------------------------------------------------------------diff --git a/libs/ui/forms/WdgPopupPaletteSettings.ui b/libs/ui/forms/WdgPopupPaletteSettings.uiindex 4a428c628c..9f1941752e 100644--- a/libs/ui/forms/WdgPopupPaletteSettings.ui+++ b/libs/ui/forms/WdgPopupPaletteSettings.ui@@ -6,8 +6,8 @@<rect><x>0</x><y>0</y>- <width>342</width>- <height>173</height>+ <width>430</width>+ <height>221</height></rect></property><property name="windowTitle">@@ -130,7 +130,7 @@</property></widget></item>- <item row="6" column="1">+ <item row="7" column="1"><widget class="QCheckBox" name="chkShowRotationTrack"><property name="text"><string>Show Rotation Ring</string>@@ -140,7 +140,7 @@</property></widget></item>- <item row="7" column="0" colspan="2">+ <item row="8" column="0" colspan="2"><spacer name="verticalSpacer"><property name="orientation"><enum>Qt::Vertical</enum>@@ -153,6 +153,27 @@</property></spacer></item>+ <item row="6" column="1">+ <widget class="QComboBox" name="cmbColorHistorySorting">+ <item>+ <property name="text">+ <string>Last Used</string>+ </property>+ </item>+ <item>+ <property name="text">+ <string>Hue/Saturation/Value</string>+ </property>+ </item>+ </widget>+ </item>+ <item row="6" column="0">+ <widget class="QLabel" name="lblColorHistorySorting">+ <property name="text">+ <string>Sort Color History Ring By:</string>+ </property>+ </widget>+ </item></layout></widget><customwidgets>