Krita Source Code Documentation
Loading...
Searching...
No Matches
KisLayerPropertiesIcons Class Reference

#include <kis_layer_properties_icons.h>

Classes

struct  Private
 

Public Member Functions

 KisLayerPropertiesIcons ()
 
void updateIcons ()
 
 ~KisLayerPropertiesIcons ()
 

Static Public Member Functions

static KisBaseNode::Property getColorSpaceMismatchProperty (const KoColorSpace *cs)
 
static KisBaseNode::Property getErrorProperty (const QString &message)
 
static KisBaseNode::Property getProperty (const KoID &id, bool state)
 
static KisBaseNode::Property getProperty (const KoID &id, bool state, bool isInStasis, bool stateInStasis)
 
static KisLayerPropertiesIconsinstance ()
 
static QVariant nodeProperty (KisNodeSP node, const KoID &id, const QVariant &defaultValue)
 
static void setNodeProperty (KisBaseNode::PropertyList *props, const KoID &id, const QVariant &value)
 
static void setNodePropertyAutoUndo (KisNodeSP node, const KoID &id, const QVariant &value, KisImageSP image)
 

Static Public Attributes

static const KoID alphaLocked
 
static const KoID antialiased
 
static const KoID colorizeEditKeyStrokes
 
static const KoID colorizeNeedsUpdate
 
static const KoID colorizeShowColoring
 
static const KoID colorLabelIndex
 
static const KoID colorOverlay
 
static const KoID inheritAlpha
 
static const KoID layerColorSpaceMismatch
 
static const KoID layerError
 
static const KoID layerStyle
 
static const KoID locked
 
static const KoID onionSkins
 
static const KoID openFileLayerFile
 
static const KoID passThrough
 
static const KoID selectionActive
 
static const KoID visible
 

Private Attributes

const QScopedPointer< Privatem_d
 

Detailed Description

Definition at line 16 of file kis_layer_properties_icons.h.

Constructor & Destructor Documentation

◆ KisLayerPropertiesIcons()

KisLayerPropertiesIcons::KisLayerPropertiesIcons ( )

Definition at line 58 of file kis_layer_properties_icons.cpp.

References updateIcons().

◆ ~KisLayerPropertiesIcons()

KisLayerPropertiesIcons::~KisLayerPropertiesIcons ( )

Definition at line 64 of file kis_layer_properties_icons.cpp.

65{
66}

Member Function Documentation

◆ getColorSpaceMismatchProperty()

KisBaseNode::Property KisLayerPropertiesIcons::getColorSpaceMismatchProperty ( const KoColorSpace * cs)
static

Definition at line 124 of file kis_layer_properties_icons.cpp.

125{
126 const QString message =
127 i18nc("a tooltip shown in when hovering layer's property",
128 "Layer color space is different from the image color space:\n%1 [%2],\noperations may be slow",
129 cs->name(),
130 cs->profile() ? cs->profile()->name() : "");
131
132 const IconsPair &pair = instance()->m_d->icons[layerColorSpaceMismatch.id()];
133
137 prop.state = message;
138 prop.onIcon = pair.on;
139 prop.offIcon = pair.off;
140
141 return prop;
142}
static KisLayerPropertiesIcons * instance()
virtual const KoColorProfile * profile() const =0
QString name() const
Definition KoID.cpp:68
QString id() const
Definition KoID.cpp:63

References KoID::id(), KisBaseNode::Property::id, instance(), layerColorSpaceMismatch, m_d, KoID::name(), KisBaseNode::Property::name, KoColorProfile::name, KoColorSpace::name, KisBaseNode::Property::offIcon, KisBaseNode::Property::onIcon, KoColorSpace::profile(), and KisBaseNode::Property::state.

◆ getErrorProperty()

KisBaseNode::Property KisLayerPropertiesIcons::getErrorProperty ( const QString & message)
static

Definition at line 110 of file kis_layer_properties_icons.cpp.

111{
112 const IconsPair &pair = instance()->m_d->icons[layerError.id()];
113
115 prop.id = layerError.id();
116 prop.name = layerError.name();
117 prop.state = message;
118 prop.onIcon = pair.on;
119 prop.offIcon = pair.off;
120
121 return prop;
122}

References KoID::id(), KisBaseNode::Property::id, instance(), layerError, m_d, KoID::name(), KisBaseNode::Property::name, IconsPair::off, KisBaseNode::Property::offIcon, IconsPair::on, KisBaseNode::Property::onIcon, and KisBaseNode::Property::state.

◆ getProperty() [1/2]

KisBaseNode::Property KisLayerPropertiesIcons::getProperty ( const KoID & id,
bool state )
static

Definition at line 94 of file kis_layer_properties_icons.cpp.

95{
96 const IconsPair &pair = instance()->m_d->icons[id.id()];
97 return KisBaseNode::Property(id,
98 pair.on, pair.off, state);
99}

References instance(), m_d, IconsPair::off, and IconsPair::on.

◆ getProperty() [2/2]

KisBaseNode::Property KisLayerPropertiesIcons::getProperty ( const KoID & id,
bool state,
bool isInStasis,
bool stateInStasis )
static

Definition at line 101 of file kis_layer_properties_icons.cpp.

103{
104 const IconsPair &pair = instance()->m_d->icons[id.id()];
105 return KisBaseNode::Property(id,
106 pair.on, pair.off, state,
107 isInStasis, stateInStasis);
108}

References instance(), m_d, IconsPair::off, and IconsPair::on.

◆ instance()

KisLayerPropertiesIcons * KisLayerPropertiesIcons::instance ( )
static

Definition at line 68 of file kis_layer_properties_icons.cpp.

69{
70 return s_instance;
71}

◆ nodeProperty()

QVariant KisLayerPropertiesIcons::nodeProperty ( KisNodeSP node,
const KoID & id,
const QVariant & defaultValue )
static

Gets the specified property of the node

Definition at line 163 of file kis_layer_properties_icons.cpp.

164{
166
167 KisBaseNode::PropertyList::const_iterator it = props.constBegin();
168 KisBaseNode::PropertyList::const_iterator end = props.constEnd();
169 for (; it != end; ++it) {
170 if (it->id == id.id()) {
171 return it->state;
172 }
173 }
174
175 return defaultValue;
176}
virtual PropertyList sectionModelProperties() const

References KisBaseNode::sectionModelProperties().

◆ setNodeProperty()

void KisLayerPropertiesIcons::setNodeProperty ( KisBaseNode::PropertyList * props,
const KoID & id,
const QVariant & value )
static

Definition at line 151 of file kis_layer_properties_icons.cpp.

152{
153 KisBaseNode::PropertyList::iterator it = props->begin();
154 KisBaseNode::PropertyList::iterator end = props->end();
155 for (; it != end; ++it) {
156 if (it->id == id.id()) {
157 it->state = value;
158 break;
159 }
160 }
161}
float value(const T *src, size_t ch)

References value().

◆ setNodePropertyAutoUndo()

void KisLayerPropertiesIcons::setNodePropertyAutoUndo ( KisNodeSP node,
const KoID & id,
const QVariant & value,
KisImageSP image )
static

Sets the specified property of the node and updates it

Definition at line 144 of file kis_layer_properties_icons.cpp.

145{
147 setNodeProperty(&props, id, value);
149}
static void setNodeProperty(KisBaseNode::PropertyList *props, const KoID &id, const QVariant &value)
static void setNodePropertiesAutoUndo(KisNodeSP node, KisImageSP image, PropertyList proplist)

References KisBaseNode::sectionModelProperties(), KisNodePropertyListCommand::setNodePropertiesAutoUndo(), setNodeProperty(), and value().

◆ updateIcons()

void KisLayerPropertiesIcons::updateIcons ( )

Definition at line 73 of file kis_layer_properties_icons.cpp.

74{
75 m_d->icons.clear();
76 m_d->icons.insert(locked.id(), IconsPair(KisIconUtils::loadIcon("layer-locked"), KisIconUtils::loadIcon("layer-unlocked")));
77 m_d->icons.insert(visible.id(), IconsPair(KisIconUtils::loadIcon("visible"), KisIconUtils::loadIcon("novisible")));
78 m_d->icons.insert(layerStyle.id(), IconsPair(KisIconUtils::loadIcon("layer-style-enabled"), KisIconUtils::loadIcon("layer-style-disabled")));
79 m_d->icons.insert(inheritAlpha.id(), IconsPair(KisIconUtils::loadIcon("transparency-disabled"), KisIconUtils::loadIcon("transparency-enabled")));
80 m_d->icons.insert(alphaLocked.id(), IconsPair(KisIconUtils::loadIcon("transparency-locked"), KisIconUtils::loadIcon("transparency-unlocked")));
81 m_d->icons.insert(onionSkins.id(), IconsPair(KisIconUtils::loadIcon("onionOn"), KisIconUtils::loadIcon("onionOff")));
82 m_d->icons.insert(passThrough.id(), IconsPair(KisIconUtils::loadIcon("passthrough-enabled"), KisIconUtils::loadIcon("passthrough-disabled")));
83 m_d->icons.insert(selectionActive.id(), IconsPair(KisIconUtils::loadIcon("local-selection-active"), KisIconUtils::loadIcon("local-selection-inactive")));
84 m_d->icons.insert(colorizeNeedsUpdate.id(), IconsPair(KisIconUtils::loadIcon("updateColorize"), KisIconUtils::loadIcon("updateColorize")));
85 m_d->icons.insert(colorizeEditKeyStrokes.id(), IconsPair(KisIconUtils::loadIcon("showMarks"), KisIconUtils::loadIcon("showMarksOff")));
86 m_d->icons.insert(colorizeShowColoring.id(), IconsPair(KisIconUtils::loadIcon("showColoring"), KisIconUtils::loadIcon("showColoringOff")));
87 m_d->icons.insert(openFileLayerFile.id(), IconsPair(KisIconUtils::loadIcon("document-open"), KisIconUtils::loadIcon("document-open")));
88 m_d->icons.insert(layerError.id(), IconsPair(KisIconUtils::loadIcon("warning"), KisIconUtils::loadIcon("warning")));
89 m_d->icons.insert(layerColorSpaceMismatch.id(), IconsPair(KisIconUtils::loadIcon("different-colorspace"), KisIconUtils::loadIcon("different-colorspace")));
90 m_d->icons.insert(antialiased.id(), IconsPair(KisIconUtils::loadIcon("select-shape"), KisIconUtils::loadIcon("select-pixel")));
91 // No static icons for colorOverlay.
92}
QIcon loadIcon(const QString &name)

References alphaLocked, antialiased, colorizeEditKeyStrokes, colorizeNeedsUpdate, colorizeShowColoring, KoID::id(), inheritAlpha, layerColorSpaceMismatch, layerError, layerStyle, KisIconUtils::loadIcon(), locked, m_d, onionSkins, openFileLayerFile, passThrough, selectionActive, and visible.

Member Data Documentation

◆ alphaLocked

const KoID KisLayerPropertiesIcons::alphaLocked
static

Definition at line 26 of file kis_layer_properties_icons.h.

◆ antialiased

const KoID KisLayerPropertiesIcons::antialiased
static

Definition at line 38 of file kis_layer_properties_icons.h.

◆ colorizeEditKeyStrokes

const KoID KisLayerPropertiesIcons::colorizeEditKeyStrokes
static

Definition at line 33 of file kis_layer_properties_icons.h.

◆ colorizeNeedsUpdate

const KoID KisLayerPropertiesIcons::colorizeNeedsUpdate
static

Definition at line 32 of file kis_layer_properties_icons.h.

◆ colorizeShowColoring

const KoID KisLayerPropertiesIcons::colorizeShowColoring
static

Definition at line 34 of file kis_layer_properties_icons.h.

◆ colorLabelIndex

const KoID KisLayerPropertiesIcons::colorLabelIndex
static

Definition at line 30 of file kis_layer_properties_icons.h.

◆ colorOverlay

const KoID KisLayerPropertiesIcons::colorOverlay
static

Definition at line 31 of file kis_layer_properties_icons.h.

◆ inheritAlpha

const KoID KisLayerPropertiesIcons::inheritAlpha
static

Definition at line 25 of file kis_layer_properties_icons.h.

◆ layerColorSpaceMismatch

const KoID KisLayerPropertiesIcons::layerColorSpaceMismatch
static

Definition at line 37 of file kis_layer_properties_icons.h.

◆ layerError

const KoID KisLayerPropertiesIcons::layerError
static

Definition at line 36 of file kis_layer_properties_icons.h.

◆ layerStyle

const KoID KisLayerPropertiesIcons::layerStyle
static

Definition at line 24 of file kis_layer_properties_icons.h.

◆ locked

const KoID KisLayerPropertiesIcons::locked
static

Definition at line 22 of file kis_layer_properties_icons.h.

◆ m_d

const QScopedPointer<Private> KisLayerPropertiesIcons::m_d
private

Definition at line 64 of file kis_layer_properties_icons.h.

◆ onionSkins

const KoID KisLayerPropertiesIcons::onionSkins
static

Definition at line 27 of file kis_layer_properties_icons.h.

◆ openFileLayerFile

const KoID KisLayerPropertiesIcons::openFileLayerFile
static

Definition at line 35 of file kis_layer_properties_icons.h.

◆ passThrough

const KoID KisLayerPropertiesIcons::passThrough
static

Definition at line 28 of file kis_layer_properties_icons.h.

◆ selectionActive

const KoID KisLayerPropertiesIcons::selectionActive
static

Definition at line 29 of file kis_layer_properties_icons.h.

◆ visible

const KoID KisLayerPropertiesIcons::visible
static

Definition at line 23 of file kis_layer_properties_icons.h.


The documentation for this class was generated from the following files: