Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/dialogs/kis_dlg_layer_style.cpp
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 65 | { | |||
---|---|---|---|---|---|
96 | m_outerGlow = new InnerGlow(InnerGlow::OuterGlowMode, resourceProvider, this); | 96 | m_outerGlow = new InnerGlow(InnerGlow::OuterGlowMode, resourceProvider, this); | ||
97 | wdgLayerStyles.stylesStack->addWidget(m_outerGlow); | 97 | wdgLayerStyles.stylesStack->addWidget(m_outerGlow); | ||
98 | connect(m_outerGlow, SIGNAL(configChanged()), SLOT(notifyGuiConfigChanged())); | 98 | connect(m_outerGlow, SIGNAL(configChanged()), SLOT(notifyGuiConfigChanged())); | ||
99 | 99 | | |||
100 | m_innerGlow = new InnerGlow(InnerGlow::InnerGlowMode, resourceProvider, this); | 100 | m_innerGlow = new InnerGlow(InnerGlow::InnerGlowMode, resourceProvider, this); | ||
101 | wdgLayerStyles.stylesStack->addWidget(m_innerGlow); | 101 | wdgLayerStyles.stylesStack->addWidget(m_innerGlow); | ||
102 | connect(m_innerGlow, SIGNAL(configChanged()), SLOT(notifyGuiConfigChanged())); | 102 | connect(m_innerGlow, SIGNAL(configChanged()), SLOT(notifyGuiConfigChanged())); | ||
103 | 103 | | |||
104 | // Contour and Texture are sub-styles of Bevel and Emboss | ||||
105 | // They are only applied to canvas when Bevel and Emboss is active. | ||||
104 | m_contour = new Contour(this); | 106 | m_contour = new Contour(this); | ||
105 | m_texture = new Texture(this); | 107 | m_texture = new Texture(this); | ||
106 | m_bevelAndEmboss = new BevelAndEmboss(m_contour, m_texture, this); | 108 | m_bevelAndEmboss = new BevelAndEmboss(m_contour, m_texture, this); | ||
107 | 109 | | |||
108 | wdgLayerStyles.stylesStack->addWidget(m_bevelAndEmboss); | 110 | wdgLayerStyles.stylesStack->addWidget(m_bevelAndEmboss); | ||
109 | wdgLayerStyles.stylesStack->addWidget(m_contour); | 111 | wdgLayerStyles.stylesStack->addWidget(m_contour); | ||
110 | wdgLayerStyles.stylesStack->addWidget(m_texture); | 112 | wdgLayerStyles.stylesStack->addWidget(m_texture); | ||
111 | 113 | | |||
114 | // notifyBevelAndEmbossToggle() enables/disables Contour and Texture on Bevel and Emboss toggle. | ||||
115 | connect(m_bevelAndEmboss, SIGNAL(configChanged()), SLOT(notifyBevelAndEmbossToggle())); | ||||
rempt: connect connect(wdgLayerStyles.lstStyleSelector, SIGNAL(itemClicked(QListWidgetItem*)), SLOT… | |||||
112 | connect(m_bevelAndEmboss, SIGNAL(configChanged()), SLOT(notifyGuiConfigChanged())); | 116 | connect(m_bevelAndEmboss, SIGNAL(configChanged()), SLOT(notifyGuiConfigChanged())); | ||
113 | 117 | | |||
114 | m_satin = new Satin(this); | 118 | m_satin = new Satin(this); | ||
115 | wdgLayerStyles.stylesStack->addWidget(m_satin); | 119 | wdgLayerStyles.stylesStack->addWidget(m_satin); | ||
116 | connect(m_satin, SIGNAL(configChanged()), SLOT(notifyGuiConfigChanged())); | 120 | connect(m_satin, SIGNAL(configChanged()), SLOT(notifyGuiConfigChanged())); | ||
117 | 121 | | |||
118 | m_colorOverlay = new ColorOverlay(this); | 122 | m_colorOverlay = new ColorOverlay(this); | ||
119 | wdgLayerStyles.stylesStack->addWidget(m_colorOverlay); | 123 | wdgLayerStyles.stylesStack->addWidget(m_colorOverlay); | ||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | |||||
191 | void KisDlgLayerStyle::notifyPredefinedStyleSelected(KisPSDLayerStyleSP style) | 195 | void KisDlgLayerStyle::notifyPredefinedStyleSelected(KisPSDLayerStyleSP style) | ||
192 | { | 196 | { | ||
193 | m_isSwitchingPredefinedStyle = true; | 197 | m_isSwitchingPredefinedStyle = true; | ||
194 | setStyle(style); | 198 | setStyle(style); | ||
195 | m_isSwitchingPredefinedStyle = false; | 199 | m_isSwitchingPredefinedStyle = false; | ||
196 | m_configChangedCompressor->start(); | 200 | m_configChangedCompressor->start(); | ||
197 | } | 201 | } | ||
198 | 202 | | |||
203 | void KisDlgLayerStyle::notifyBevelAndEmbossToggle() { | ||||
204 | QListWidgetItem *item; | ||||
205 | | ||||
206 | if (m_layerStyle->bevelAndEmboss()->effectEnabled()) { | ||||
Better use if (wdgLayerStyles.lstStyleSelector->item(6)->checkState() == Qt::Checked) { rempt: Better use if (wdgLayerStyles.lstStyleSelector->item(6)->checkState() == Qt::Checked) {
| |||||
207 | // Enable "Contour" (list item 7) | ||||
208 | item = wdgLayerStyles.lstStyleSelector->item(7); | ||||
Using indices may make the code hard to maintain. Can you set names of items in QtDesigner? If it is possible, it would be better to use names instead of indices. tusooaw: Using indices may make the code hard to maintain. Can you set names of items in QtDesigner? If… | |||||
209 | auto currentFlags7 = item->flags(); | ||||
210 | item->setFlags(currentFlags7 | Qt::ItemIsEnabled); | ||||
211 | | ||||
212 | // Enable "Texture" (list item 8) | ||||
213 | item = wdgLayerStyles.lstStyleSelector->item(8); | ||||
214 | auto currentFlags8 = item->flags(); | ||||
215 | item->setFlags(currentFlags8 | Qt::ItemIsEnabled); | ||||
216 | } | ||||
217 | else { | ||||
218 | // Disable "Contour" | ||||
219 | item = wdgLayerStyles.lstStyleSelector->item(7); | ||||
220 | auto currentFlags7 = item->flags(); | ||||
221 | item->setFlags(currentFlags7 & (~Qt::ItemIsEnabled)); | ||||
222 | | ||||
223 | // Disable "Texture" | ||||
224 | item = wdgLayerStyles.lstStyleSelector->item(8); | ||||
225 | auto currentFlags8 = item->flags(); | ||||
226 | item->setFlags(currentFlags8 & (~Qt::ItemIsEnabled)); | ||||
227 | } | ||||
228 | } | ||||
199 | 229 | | |||
200 | void KisDlgLayerStyle::slotNotifyOnAccept() | 230 | void KisDlgLayerStyle::slotNotifyOnAccept() | ||
201 | { | 231 | { | ||
202 | if (m_configChangedCompressor->isActive()) { | 232 | if (m_configChangedCompressor->isActive()) { | ||
203 | m_configChangedCompressor->stop(); | 233 | m_configChangedCompressor->stop(); | ||
204 | emit configChanged(); | 234 | emit configChanged(); | ||
205 | } | 235 | } | ||
206 | } | 236 | } | ||
▲ Show 20 Lines • Show All 1149 Lines • Show Last 20 Lines |
connect connect(wdgLayerStyles.lstStyleSelector, SIGNAL(itemClicked(QListWidgetItem*)), SLOT(notifyBevelAndEmbossToggle(QListWidgetItem*)));
instead.