Skip to content

armgit / krita

Public Imported from GitHub
0

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++

Move option for per-document color history into a proper location

Dmitry Kazakov97aafa356cdb
diff --git a/libs/global/kis_config_notifier.cpp b/libs/global/kis_config_notifier.cpp
index c9f0a8d481..7d69d8767e 100644
--- a/libs/global/kis_config_notifier.cpp
+++ b/libs/global/kis_config_notifier.cpp
@@ -49,3 +49,8 @@ void KisConfigNotifier::notifyPixelGridModeChanged()
{
emit pixelGridModeChanged();
}
+
+void KisConfigNotifier::notifyColorHistoryModeChanged()
+{
+ emit colorHistoryModeChanged();
+}
diff --git a/libs/global/kis_config_notifier.h b/libs/global/kis_config_notifier.h
index 48291287b9..1fe5db2b46 100644
--- a/libs/global/kis_config_notifier.h
+++ b/libs/global/kis_config_notifier.h
@@ -35,6 +35,7 @@ public:
void notifyDropFramesModeChanged();
void notifyPixelGridModeChanged();
+ void notifyColorHistoryModeChanged();
Q_SIGNALS:
/**
@@ -43,6 +44,7 @@ Q_SIGNALS:
void configChanged(void);
void dropFramesModeChanged();
void pixelGridModeChanged();
+ void colorHistoryModeChanged();
private:
KisConfigNotifier(const KisConfigNotifier&);
KisConfigNotifier operator=(const KisConfigNotifier&);
diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.cc
index ef55ea9c58..c801791208 100644
--- a/libs/ui/dialogs/kis_dlg_preferences.cc
+++ b/libs/ui/dialogs/kis_dlg_preferences.cc
@@ -1103,7 +1103,6 @@ ColorSettingsTab::ColorSettingsTab(QWidget *parent, const char *name)
m_page->chkBlackpoint->setChecked(cfg.useBlackPointCompensation());
m_page->chkAllowLCMSOptimization->setChecked(cfg.allowLCMSOptimization());
m_page->chkForcePaletteColor->setChecked(cfg.forcePaletteColors());
- m_page->chkColorHistoryPerDocument->setChecked(cfg.colorHistoryPerDocument());
KisImageConfig cfgImage(true);
KisProofingConfigurationSP proofingConfig = cfgImage.defaultProofingconfiguration();
@@ -2453,7 +2452,6 @@ bool KisDlgPreferences::editPreferences()
cfg.setUseBlackPointCompensation(m_colorSettings->m_page->chkBlackpoint->isChecked());
cfg.setAllowLCMSOptimization(m_colorSettings->m_page->chkAllowLCMSOptimization->isChecked());
cfg.setForcePaletteColors(m_colorSettings->m_page->chkForcePaletteColor->isChecked());
- cfg.setColorHistoryPerDocument(m_colorSettings->m_page->chkColorHistoryPerDocument->isChecked());
cfg.setPasteBehaviour(m_colorSettings->m_pasteBehaviourGroup.checkedId());
cfg.setRenderIntent(m_colorSettings->m_page->cmbMonitorIntent->currentIndex());
diff --git a/libs/ui/forms/wdgcolorsettings.ui b/libs/ui/forms/wdgcolorsettings.ui
index 20692bf708..9fc9c25fe8 100644
--- a/libs/ui/forms/wdgcolorsettings.ui
+++ b/libs/ui/forms/wdgcolorsettings.ui
@@ -6,6 +6,14 @@
</author>
<class>WdgColorSettings</class>
<widget class="QWidget" name="WdgColorSettings">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>460</width>
+ <height>424</height>
+ </rect>
+ </property>
<property name="windowTitle">
<string>Color Settings</string>
</property>
@@ -127,14 +135,7 @@
</property>
</widget>
</item>
- <item row="5" column="1">
- <widget class="QCheckBox" name="chkColorHistoryPerDocument">
- <property name="text">
- <string>Separate color history for each document.</string>
- </property>
- </widget>
- </item>
- <item row="6" column="0" colspan="2">
+ <item row="5" column="0" colspan="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -356,7 +357,13 @@
<customwidget>
<class>KisColorButton</class>
<extends>QPushButton</extends>
- <header>kis_color_button.h</header>
+ <header location="global">kis_color_button.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KisColorSpaceSelector</class>
+ <extends>QWidget</extends>
+ <header>widgets/kis_color_space_selector.h</header>
+ <container>1</container>
</customwidget>
<customwidget>
<class>KComboBox</class>
@@ -368,12 +375,6 @@
<extends>QComboBox</extends>
<header>widgets/kis_cmb_idlist.h</header>
</customwidget>
- <customwidget>
- <class>KisColorSpaceSelector</class>
- <extends>QWidget</extends>
- <header>widgets/kis_color_space_selector.h</header>
- <container>1</container>
- </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/libs/ui/kis_config.cc b/libs/ui/kis_config.cc
index dbeacb9605..d0b9558f84 100644
--- a/libs/ui/kis_config.cc
+++ b/libs/ui/kis_config.cc
@@ -751,12 +751,8 @@ void KisConfig::setForcePaletteColors(bool forcePaletteColors)
bool KisConfig::colorHistoryPerDocument(bool defaultValue) const
{
- return (defaultValue ? false : m_cfg.readEntry("colorsettings/colorhistoryperdocument", false));
-}
-
-void KisConfig::setColorHistoryPerDocument(bool perDocument)
-{
- m_cfg.writeEntry("colorsettings/colorhistoryperdocument", perDocument);
+ KConfigGroup cfg = KSharedConfig::openConfig()->group("advancedColorSelector");
+ return (defaultValue ? false : cfg.readEntry("lastUsedColorsPerDocument", false));
}
bool KisConfig::showRulers(bool defaultValue) const
diff --git a/libs/ui/kis_config.h b/libs/ui/kis_config.h
index 03702c8293..6def72ae01 100644
--- a/libs/ui/kis_config.h
+++ b/libs/ui/kis_config.h
@@ -166,7 +166,6 @@ public:
void setForcePaletteColors(bool forcePaletteColors);
bool colorHistoryPerDocument(bool defaultValue = false) const;
- void setColorHistoryPerDocument(bool perDocument);
void writeKoColor(const QString& name, const KoColor& color) const;
KoColor readKoColor(const QString& name, const KoColor& color = KoColor()) const;
diff --git a/plugins/dockers/advancedcolorselector/kis_color_history.cpp b/plugins/dockers/advancedcolorselector/kis_color_history.cpp
index a17ab8efc3..3828d8ac37 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_history.cpp
+++ b/plugins/dockers/advancedcolorselector/kis_color_history.cpp
@@ -29,10 +29,10 @@ KisColorHistory::KisColorHistory(QWidget *parent)
m_clearButton->setIcon(KisIconUtils::loadIcon("dialog-cancel-16"));
m_clearButton->setToolTip(i18n("Clear all color history"));
m_clearButton->setAutoRaise(true);
- updateSettings();
+ updateUserSettings();
connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clearColorHistory()));
- connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), this, SLOT(updateUserSettings()));
+ connect(KisConfigNotifier::instance(), SIGNAL(colorHistoryModeChanged()), this, SLOT(updateUserSettings()));
connect(s_color_history_change_notifier, SIGNAL(colorHistoryChanged(const QList<KoColor>&)),
this, SLOT(colorHistoryChanged(const QList<KoColor>&)));
@@ -122,9 +122,10 @@ void KisColorHistory::updateColorHistory(const QList<KoColor> &history)
void KisColorHistory::updateUserSettings()
{
- KisConfig config(true);
- m_history_per_document = config.colorHistoryPerDocument();
- updateColorHistory(colorHistory()); // Show with respect to the current strategy
+
+ KisConfig config(true);
+ m_history_per_document = config.colorHistoryPerDocument();
+ updateColorHistory(colorHistory()); // Show with respect to the current strategy
}
void KisColorHistory::colorHistoryChanged(const QList<KoColor> &history)
diff --git a/plugins/dockers/advancedcolorselector/kis_color_selector_settings.cpp b/plugins/dockers/advancedcolorselector/kis_color_selector_settings.cpp
index 5824c53df8..2797a63677 100644
--- a/plugins/dockers/advancedcolorselector/kis_color_selector_settings.cpp
+++ b/plugins/dockers/advancedcolorselector/kis_color_selector_settings.cpp
@@ -24,6 +24,7 @@
#include "kis_color_selector_combo_box.h"
#include "kis_color_selector.h"
#include "kis_config.h"
+#include "kis_config_notifier.h"
KisColorSelectorSettings::KisColorSelectorSettings(QWidget *parent) :
@@ -169,6 +170,7 @@ void KisColorSelectorSettings::savePreferences() const
kisconfig.setCustomColorSelectorColorSpace(colorSpace);
//color patches
+ cfg.writeEntry("lastUsedColorsPerDocument", ui->lastUsedColorsPerDocument->isChecked());
cfg.writeEntry("lastUsedColorsShow", ui->lastUsedColorsShow->isChecked());
cfg.writeEntry("lastUsedColorsAlignment", ui->lastUsedColorsAlignVertical->isChecked());
cfg.writeEntry("lastUsedColorsScrolling", ui->lastUsedColorsAllowScrolling->isChecked());
@@ -253,6 +255,7 @@ void KisColorSelectorSettings::savePreferences() const
hotkeycfg.writeEntry("steps_blueyellow", ui->sb_by->value());
emit settingsChanged();
+ KisConfigNotifier::instance()->notifyColorHistoryModeChanged();
}
void KisColorSelectorSettings::changedColorDocker(int index)
@@ -370,6 +373,7 @@ void KisColorSelectorSettings::loadPreferences()
//color patches
+ ui->lastUsedColorsPerDocument->setChecked(cfg.readEntry("lastUsedColorsPerDocument", false));
ui->lastUsedColorsShow->setChecked(cfg.readEntry("lastUsedColorsShow", true));
bool a = cfg.readEntry("lastUsedColorsAlignment", true);
ui->lastUsedColorsAlignVertical->setChecked(a);
diff --git a/plugins/dockers/advancedcolorselector/wdg_color_selector_settings.ui b/plugins/dockers/advancedcolorselector/wdg_color_selector_settings.ui
index 3134bdf448..2d41b7d09c 100644
--- a/plugins/dockers/advancedcolorselector/wdg_color_selector_settings.ui
+++ b/plugins/dockers/advancedcolorselector/wdg_color_selector_settings.ui
@@ -11,7 +11,7 @@
<x>0</x>
<y>0</y>
<width>480</width>
- <height>428</height>
+ <height>446</height>
</rect>
</property>
<property name="sizePolicy">
@@ -603,7 +603,7 @@
<string>Color History</string>
</attribute>
<layout class="QFormLayout" name="formLayout_8">
- <item row="0" column="0" colspan="2">
+ <item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="lastUsedColorsShow">
<property name="title">
<string>Show Color Histor&amp;y</string>
@@ -802,7 +802,7 @@
</layout>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -815,6 +815,13 @@
</property>
</spacer>
</item>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="lastUsedColorsPerDocument">
+ <property name="text">
+ <string>Separate color history for each document</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<widget class="QWidget" name="tab_colorsFromImage">
@@ -1150,7 +1157,7 @@
<customwidget>
<class>KisIntParseSpinBox</class>
<extends>QSpinBox</extends>
- <header location="global">kis_int_parse_spin_box.h</header>
+ <header>kis_int_parse_spin_box.h</header>
</customwidget>
<customwidget>
<class>KisColorButton</class>