Changeset View
Changeset View
Standalone View
Standalone View
widgets/toolbars/kpColorToolBar.cpp
Show First 20 Lines • Show All 169 Lines • ▼ Show 20 Line(s) | 169 | { | |||
---|---|---|---|---|---|
170 | return m_dualColorButton->foregroundColor (); | 170 | return m_dualColorButton->foregroundColor (); | ||
171 | } | 171 | } | ||
172 | 172 | | |||
173 | //--------------------------------------------------------------------- | 173 | //--------------------------------------------------------------------- | ||
174 | 174 | | |||
175 | void kpColorToolBar::setForegroundColor (const kpColor &color) | 175 | void kpColorToolBar::setForegroundColor (const kpColor &color) | ||
176 | { | 176 | { | ||
177 | qCDebug(kpLogWidgets) << "kpColorToolBar::setForegroundColor(" | 177 | qCDebug(kpLogWidgets) << "kpColorToolBar::setForegroundColor(" | ||
178 | << (int *) color.toQRgb () << ")" << endl; | 178 | << (int *) color.toQRgb () << ")"; | ||
179 | m_dualColorButton->setForegroundColor (color); | 179 | m_dualColorButton->setForegroundColor (color); | ||
180 | } | 180 | } | ||
181 | 181 | | |||
182 | //--------------------------------------------------------------------- | 182 | //--------------------------------------------------------------------- | ||
183 | 183 | | |||
184 | kpColor kpColorToolBar::backgroundColor () const | 184 | kpColor kpColorToolBar::backgroundColor () const | ||
185 | { | 185 | { | ||
186 | return m_dualColorButton->backgroundColor (); | 186 | return m_dualColorButton->backgroundColor (); | ||
187 | } | 187 | } | ||
188 | 188 | | |||
189 | //--------------------------------------------------------------------- | 189 | //--------------------------------------------------------------------- | ||
190 | 190 | | |||
191 | void kpColorToolBar::setBackgroundColor (const kpColor &color) | 191 | void kpColorToolBar::setBackgroundColor (const kpColor &color) | ||
192 | { | 192 | { | ||
193 | qCDebug(kpLogWidgets) << "kpColorToolBar::setBackgroundColor(" | 193 | qCDebug(kpLogWidgets) << "kpColorToolBar::setBackgroundColor(" | ||
194 | << (int *) color.toQRgb () << ")" << endl; | 194 | << (int *) color.toQRgb () << ")"; | ||
195 | m_dualColorButton->setBackgroundColor (color); | 195 | m_dualColorButton->setBackgroundColor (color); | ||
196 | } | 196 | } | ||
197 | 197 | | |||
198 | //--------------------------------------------------------------------- | 198 | //--------------------------------------------------------------------- | ||
199 | 199 | | |||
200 | 200 | | |||
201 | kpColor kpColorToolBar::oldForegroundColor () const | 201 | kpColor kpColorToolBar::oldForegroundColor () const | ||
202 | { | 202 | { | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | |||||
255 | //--------------------------------------------------------------------- | 255 | //--------------------------------------------------------------------- | ||
256 | 256 | | |||
257 | // private slot | 257 | // private slot | ||
258 | void kpColorToolBar::updateNameOrUrlLabel () | 258 | void kpColorToolBar::updateNameOrUrlLabel () | ||
259 | { | 259 | { | ||
260 | QString name; | 260 | QString name; | ||
261 | 261 | | |||
262 | kpColorCells *colorCells = m_colorPalette->colorCells (); | 262 | kpColorCells *colorCells = m_colorPalette->colorCells (); | ||
263 | if (!colorCells->url ().isEmpty ()) | 263 | if (!colorCells->url ().isEmpty ()) { | ||
264 | name = kpUrlFormatter::PrettyFilename (colorCells->url ()); | 264 | name = kpUrlFormatter::PrettyFilename (colorCells->url ()); | ||
265 | } | ||||
265 | else | 266 | else | ||
266 | { | 267 | { | ||
267 | if (!colorCells->name ().isEmpty ()) | 268 | if (!colorCells->name ().isEmpty ()) { | ||
268 | name = colorCells->name (); | 269 | name = colorCells->name (); | ||
269 | else | 270 | } | ||
271 | else { | ||||
270 | name = i18n ("KolourPaint Defaults"); | 272 | name = i18n ("KolourPaint Defaults"); | ||
271 | } | 273 | } | ||
274 | } | ||||
272 | 275 | | |||
273 | if (name.isEmpty ()) | 276 | if (name.isEmpty ()) { | ||
274 | name = i18n ("Untitled"); | 277 | name = i18n ("Untitled"); | ||
278 | } | ||||
275 | 279 | | |||
276 | 280 | | |||
277 | KLocalizedString labelStr; | 281 | KLocalizedString labelStr; | ||
278 | 282 | | |||
279 | if (!m_colorPalette->colorCells ()->isModified ()) | 283 | if (!m_colorPalette->colorCells ()->isModified ()) | ||
280 | { | 284 | { | ||
281 | labelStr = | 285 | labelStr = | ||
282 | ki18nc ("Colors: name_or_url_of_color_palette", | 286 | ki18nc ("Colors: name_or_url_of_color_palette", | ||
Show All 21 Lines | |||||
304 | 308 | | |||
305 | //--------------------------------------------------------------------- | 309 | //--------------------------------------------------------------------- | ||
306 | 310 | | |||
307 | // protected virtual [base QWidget] | 311 | // protected virtual [base QWidget] | ||
308 | void kpColorToolBar::dragEnterEvent (QDragEnterEvent *e) | 312 | void kpColorToolBar::dragEnterEvent (QDragEnterEvent *e) | ||
309 | { | 313 | { | ||
310 | // Grab the color drag for this widget, preventing it from being | 314 | // Grab the color drag for this widget, preventing it from being | ||
311 | // handled by our parent, the main window. | 315 | // handled by our parent, the main window. | ||
312 | e->setAccepted (KColorMimeData::canDecode (e->mimeData ()) == true); | 316 | e->setAccepted (KColorMimeData::canDecode (e->mimeData ())); | ||
313 | qCDebug(kpLogWidgets) << "isAccepted=" << e->isAccepted (); | 317 | qCDebug(kpLogWidgets) << "isAccepted=" << e->isAccepted (); | ||
314 | } | 318 | } | ||
315 | 319 | | |||
316 | //--------------------------------------------------------------------- | 320 | //--------------------------------------------------------------------- | ||
317 | 321 | | |||
318 | // protected virtual [base QWidget] | 322 | // protected virtual [base QWidget] | ||
319 | void kpColorToolBar::dragMoveEvent (QDragMoveEvent *e) | 323 | void kpColorToolBar::dragMoveEvent (QDragMoveEvent *e) | ||
320 | { | 324 | { | ||
321 | // Stop the grabbed drag from being dropped. | 325 | // Stop the grabbed drag from being dropped. | ||
322 | e->setAccepted (KColorMimeData::canDecode (e->mimeData ()) == false); | 326 | e->setAccepted (!KColorMimeData::canDecode (e->mimeData ())); | ||
323 | qCDebug(kpLogWidgets) << "isAccepted=" << e->isAccepted (); | 327 | qCDebug(kpLogWidgets) << "isAccepted=" << e->isAccepted (); | ||
324 | } | 328 | } |