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

Hide gamut mask toolbar in wide gamut docker when the shape doesn't support it.

Wolthera van Hövell tot Westerflier94c2d5ddbed4
diff --git a/libs/widgets/KisVisualColorSelector.cpp b/libs/widgets/KisVisualColorSelector.cpp
index ae6c370905..1afa323c34 100644
--- a/libs/widgets/KisVisualColorSelector.cpp
+++ b/libs/widgets/KisVisualColorSelector.cpp
@@ -368,6 +368,8 @@ void KisVisualColorSelector::rebuildSelector()
m_d->colorChannelCount = m_d->selectorModel->colorChannelCount();
+ bool supportsGamutMask = false;
+
//recreate all the widgets.
if (m_d->colorChannelCount == 1) {
@@ -474,6 +476,8 @@ void KisVisualColorSelector::rebuildSelector()
channel2, channel3);
}
+ supportsGamutMask = block->supportsGamutMask();
+
connect(bar, SIGNAL(sigCursorMoved(QPointF)), SLOT(slotCursorMoved(QPointF)));
connect(block, SIGNAL(sigCursorMoved(QPointF)), SLOT(slotCursorMoved(QPointF)));
m_d->widgetlist.append(block);
@@ -499,6 +503,7 @@ void KisVisualColorSelector::rebuildSelector()
// finally update widgets with new channel values
slotChannelValuesChanged(m_d->selectorModel->channelValues(), (1u << m_d->colorChannelCount) - 1);
+ emit sigGamutMaskSupportChanged(supportsGamutMask);
}
void KisVisualColorSelector::resizeEvent(QResizeEvent *)
diff --git a/libs/widgets/KisVisualColorSelector.h b/libs/widgets/KisVisualColorSelector.h
index 69d4fe7d92..838692308d 100644
--- a/libs/widgets/KisVisualColorSelector.h
+++ b/libs/widgets/KisVisualColorSelector.h
@@ -116,6 +116,12 @@ Q_SIGNALS:
* interaction has just finished
*/
void sigInteraction(bool active);
+ /**
+ * @brief sigGamutMaskSupportChanged
+ * Signals whether gamut masks are supported by the current selector shape.
+ * @param supported -- whether the gamut mask is currently supported.
+ */
+ void sigGamutMaskSupportChanged(bool supported);
protected:
void resizeEvent(QResizeEvent *) override;
diff --git a/plugins/dockers/widegamutcolorselector/WGColorSelectorDock.cpp b/plugins/dockers/widegamutcolorselector/WGColorSelectorDock.cpp
index e9c12e06b0..6f9432229f 100644
--- a/plugins/dockers/widegamutcolorselector/WGColorSelectorDock.cpp
+++ b/plugins/dockers/widegamutcolorselector/WGColorSelectorDock.cpp
@@ -71,8 +71,11 @@ WGColorSelectorDock::WGColorSelectorDock()
m_gamutToolbar->setContentsMargins(0, 0, 0, 5);
m_gamutToolbar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
headerLayout->addWidget(m_gamutToolbar);
+ headerLayout->addStretch();
headerLayout->setContentsMargins(0, 0, 0, 0);
+ connect(m_selector, SIGNAL(sigGamutMaskSupportChanged(bool)), SLOT(slotShowGamutMaskToolbar(bool)));
+
m_configButton = new QToolButton(this);
m_configButton->setIcon(KisIconUtils::loadIcon("view-choose"));
m_configButton->setAutoRaise(true);
@@ -479,6 +482,11 @@ void WGColorSelectorDock::slotOpenSettings()
}
}
+void WGColorSelectorDock::slotShowGamutMaskToolbar(bool show)
+{
+ m_gamutToolbar->setVisible(show);
+}
+
namespace WGConfig {
const NumericSetting<WGColorSelectorDock::ColorSpaceSource> colorSpaceSource
{
diff --git a/plugins/dockers/widegamutcolorselector/WGColorSelectorDock.h b/plugins/dockers/widegamutcolorselector/WGColorSelectorDock.h
index 6ddd8e7b76..d820973e33 100644
--- a/plugins/dockers/widegamutcolorselector/WGColorSelectorDock.h
+++ b/plugins/dockers/widegamutcolorselector/WGColorSelectorDock.h
@@ -78,6 +78,7 @@ private Q_SLOTS:
void slotSetNewColors();
void slotCanvasResourceChanged(int key, const QVariant &value);
void slotOpenSettings();
+ void slotShowGamutMaskToolbar(bool show);
private:
QPointer<KisCanvas2> m_canvas;
WGSelectorDisplayConfigSP m_displayConfig;