Changeset View
Changeset View
Standalone View
Standalone View
kcms/colors/colors.cpp
Show All 29 Lines | |||||
30 | #include <QProcess> | 30 | #include <QProcess> | ||
31 | #include <QStandardItemModel> | 31 | #include <QStandardItemModel> | ||
32 | #include <QStandardPaths> | 32 | #include <QStandardPaths> | ||
33 | #include <QQuickItem> | 33 | #include <QQuickItem> | ||
34 | #include <QQuickRenderControl> | 34 | #include <QQuickRenderControl> | ||
35 | #include <QQuickWindow> | 35 | #include <QQuickWindow> | ||
36 | 36 | | |||
37 | #include <KAboutData> | 37 | #include <KAboutData> | ||
38 | #include <KColorUtils> | ||||
38 | #include <KColorScheme> | 39 | #include <KColorScheme> | ||
39 | #include <KConfigGroup> | 40 | #include <KConfigGroup> | ||
40 | #include <KLocalizedString> | 41 | #include <KLocalizedString> | ||
41 | #include <KPluginFactory> | 42 | #include <KPluginFactory> | ||
42 | #include <KWindowSystem> | 43 | #include <KWindowSystem> | ||
43 | 44 | | |||
44 | #include <KIO/FileCopyJob> | 45 | #include <KIO/FileCopyJob> | ||
45 | #include <KIO/DeleteJob> | 46 | #include <KIO/DeleteJob> | ||
▲ Show 20 Lines • Show All 268 Lines • ▼ Show 20 Line(s) | 295 | { | |||
314 | 315 | | |||
315 | { | 316 | { | ||
316 | KConfig cfg(QStringLiteral("kcmdisplayrc"), KConfig::NoGlobals); | 317 | KConfig cfg(QStringLiteral("kcmdisplayrc"), KConfig::NoGlobals); | ||
317 | group = KConfigGroup(&cfg, "X11"); | 318 | group = KConfigGroup(&cfg, "X11"); | ||
318 | m_applyToAlien = group.readEntry("exportKDEColors", true); | 319 | m_applyToAlien = group.readEntry("exportKDEColors", true); | ||
319 | } | 320 | } | ||
320 | } | 321 | } | ||
321 | 322 | | |||
322 | void KCMColors::save() | 323 | void KCMColors::save() | ||
broulik: Pass by const-ref `const QString &name, ..` | |||||
323 | { | 324 | { | ||
324 | if (m_selectedSchemeDirty) { | 325 | if (m_selectedSchemeDirty) { | ||
broulik: `return QStringLiteral("@define-color %1 %2").arg(name, color);\n"`; | |||||
325 | saveColors(); | 326 | saveColors(); | ||
326 | } | 327 | } | ||
327 | 328 | | |||
328 | processPendingDeletions(); | 329 | processPendingDeletions(); | ||
329 | 330 | | |||
330 | setNeedsSave(false); | 331 | setNeedsSave(false); | ||
331 | } | 332 | } | ||
332 | 333 | | |||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 422 | for (const QString &groupName : groupNameList) { | |||
424 | 425 | | |||
425 | for (const QString &effect : effectList) { | 426 | for (const QString &effect : effectList) { | ||
426 | groupEffectOut.writeEntry(effect, groupEffectTheme.readEntry(effect)); | 427 | groupEffectOut.writeEntry(effect, groupEffectTheme.readEntry(effect)); | ||
427 | } | 428 | } | ||
428 | } | 429 | } | ||
429 | 430 | | |||
430 | m_config->sync(); | 431 | m_config->sync(); | ||
431 | 432 | | |||
432 | runRdb(KRdbExportQtColors | KRdbExportGtkTheme | (m_applyToAlien ? KRdbExportColors : 0)); | 433 | runRdb(KRdbExportQtColors | KRdbExportGtkTheme | KRdbExportGtkColors | (m_applyToAlien ? KRdbExportColors : 0)); | ||
434 | | ||||
435 | KCMColors::saveGtkColors(config); | ||||
433 | 436 | | |||
434 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KGlobalSettings"), | 437 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KGlobalSettings"), | ||
435 | QStringLiteral("org.kde.KGlobalSettings"), | 438 | QStringLiteral("org.kde.KGlobalSettings"), | ||
436 | QStringLiteral("notifyChange")); | 439 | QStringLiteral("notifyChange")); | ||
437 | message.setArguments({ | 440 | message.setArguments({ | ||
438 | 0, //previous KGlobalSettings::PaletteChanged. This is now private API in khintsettings | 441 | 0, //previous KGlobalSettings::PaletteChanged. This is now private API in khintsettings | ||
439 | 0 //unused in palette changed but needed for the DBus signature | 442 | 0 //unused in palette changed but needed for the DBus signature | ||
440 | }); | 443 | }); | ||
441 | QDBusConnection::sessionBus().send(message); | 444 | QDBusConnection::sessionBus().send(message); | ||
442 | 445 | | |||
443 | if (KWindowSystem::isPlatformX11()) { | 446 | if (KWindowSystem::isPlatformX11()) { | ||
444 | // Send signal to all kwin instances | 447 | // Send signal to all kwin instances | ||
445 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig")); | 448 | QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KWin"), QStringLiteral("org.kde.KWin"), QStringLiteral("reloadConfig")); | ||
446 | QDBusConnection::sessionBus().send(message); | 449 | QDBusConnection::sessionBus().send(message); | ||
447 | } | 450 | } | ||
448 | 451 | | |||
449 | m_selectedSchemeDirty = false; | 452 | m_selectedSchemeDirty = false; | ||
You probably want to be using QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) or something along the lines instead of hardcoding ~/.config broulik: You probably want to be using `QStandardPaths::writableLocation(QStandardPaths… | |||||
450 | } | 453 | } | ||
451 | 454 | | |||
452 | void KCMColors::processPendingDeletions() | 455 | void KCMColors::processPendingDeletions() | ||
453 | { | 456 | { | ||
broulik: Coding style, brace on same line as `if` | |||||
454 | const QStringList pendingDeletions = m_model->pendingDeletions(); | 457 | const QStringList pendingDeletions = m_model->pendingDeletions(); | ||
455 | 458 | | |||
456 | for (const QString &schemeName : pendingDeletions) { | 459 | for (const QString &schemeName : pendingDeletions) { | ||
457 | Q_ASSERT(schemeName != m_model->selectedScheme()); | 460 | Q_ASSERT(schemeName != m_model->selectedScheme()); | ||
458 | 461 | | |||
459 | const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, | 462 | const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, | ||
460 | QStringLiteral("color-schemes/%1.colors").arg(schemeName)); | 463 | QStringLiteral("color-schemes/%1.colors").arg(schemeName)); | ||
461 | 464 | | |||
462 | auto *job = KIO::del(QUrl::fromLocalFile(path), KIO::HideProgressInfo); | 465 | auto *job = KIO::del(QUrl::fromLocalFile(path), KIO::HideProgressInfo); | ||
463 | // needs to block for it to work on "OK" where the dialog (kcmshell) closes | 466 | // needs to block for it to work on "OK" where the dialog (kcmshell) closes | ||
464 | job->exec(); | 467 | job->exec(); | ||
465 | } | 468 | } | ||
466 | 469 | | |||
broulik: Not just `WriteOnly`? | |||||
467 | m_model->removeItemsPendingDeletion(); | 470 | m_model->removeItemsPendingDeletion(); | ||
468 | } | 471 | } | ||
469 | 472 | | |||
470 | void KCMColors::defaults() | 473 | void KCMColors::defaults() | ||
471 | { | 474 | { | ||
472 | m_model->setSelectedScheme(s_defaultColorSchemeName); | 475 | m_model->setSelectedScheme(s_defaultColorSchemeName); | ||
473 | 476 | | |||
474 | setNeedsSave(true); | 477 | setNeedsSave(true); | ||
475 | } | 478 | } | ||
476 | 479 | | |||
480 | QString KCMColors::gtkColorsHelper(const QString &name, const QString &color) | ||||
481 | { | ||||
482 | return QStringLiteral("@define-color %1 %2;\n").arg(name, color); | ||||
483 | } | ||||
484 | | ||||
485 | void KCMColors::saveGtkColors(KSharedConfigPtr& config) | ||||
486 | { | ||||
487 | QFile gtkCss(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/gtk-3.0/gtk.css"); | ||||
488 | QFile colorsCss(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/gtk-3.0/colors.css"); | ||||
489 | | ||||
490 | if (gtkCss.open(QIODevice::ReadWrite)) { | ||||
491 | QTextStream gtkStream(>kCss); | ||||
492 | bool hasImport = false; | ||||
493 | while (!gtkStream.atEnd()) { | ||||
494 | QString line = gtkStream.readLine(); | ||||
495 | if (line.contains("@import 'colors.css';")) { | ||||
496 | hasImport = true; | ||||
497 | } | ||||
498 | } | ||||
499 | if (!hasImport) { | ||||
500 | gtkStream << "@import 'colors.css';"; | ||||
501 | } | ||||
502 | } | ||||
503 | if (colorsCss.open(QIODevice::WriteOnly | QIODevice::Truncate)) { | ||||
504 | QTextStream colorsStream(&colorsCss); | ||||
505 | /* | ||||
506 | 0 Active View | ||||
507 | 1 Active Window | ||||
508 | 2 Active Button | ||||
509 | 3 Active Selection | ||||
510 | 4 Active Tooltip | ||||
511 | 5 Active Complimentary | ||||
512 | */ | ||||
513 | | ||||
514 | QList<KColorScheme> activeColorSchemes{ | ||||
515 | KColorScheme(QPalette::Active, KColorScheme::View, config), | ||||
516 | KColorScheme(QPalette::Active, KColorScheme::Window, config), | ||||
517 | KColorScheme(QPalette::Active, KColorScheme::Button, config), | ||||
518 | KColorScheme(QPalette::Active, KColorScheme::Selection, config), | ||||
519 | KColorScheme(QPalette::Active, KColorScheme::Tooltip, config), | ||||
520 | KColorScheme(QPalette::Active, KColorScheme::Complementary, config) | ||||
521 | }; | ||||
522 | QList<KColorScheme> inactiveColorSchemes{ | ||||
523 | KColorScheme(QPalette::Inactive, KColorScheme::View, config), | ||||
524 | KColorScheme(QPalette::Inactive, KColorScheme::Window, config), | ||||
525 | KColorScheme(QPalette::Inactive, KColorScheme::Button, config), | ||||
526 | KColorScheme(QPalette::Inactive, KColorScheme::Selection, config), | ||||
527 | KColorScheme(QPalette::Inactive, KColorScheme::Tooltip, config), | ||||
528 | KColorScheme(QPalette::Inactive, KColorScheme::Complementary, config) | ||||
529 | }; | ||||
530 | QList<KColorScheme> disabledColorSchemes{ | ||||
531 | KColorScheme(QPalette::Disabled, KColorScheme::View, config), | ||||
532 | KColorScheme(QPalette::Disabled, KColorScheme::Window, config), | ||||
533 | KColorScheme(QPalette::Disabled, KColorScheme::Button, config), | ||||
534 | KColorScheme(QPalette::Disabled, KColorScheme::Selection, config), | ||||
535 | KColorScheme(QPalette::Disabled, KColorScheme::Tooltip, config), | ||||
536 | KColorScheme(QPalette::Disabled, KColorScheme::Complementary, config) | ||||
537 | }; | ||||
538 | | ||||
539 | /* | ||||
540 | Normal (Non Backdrop, Non Insensitive) | ||||
541 | */ | ||||
542 | | ||||
543 | // General Colors | ||||
544 | | ||||
545 | colorsStream << gtkColorsHelper("theme_fg_color", activeColorSchemes[1].foreground(KColorScheme::NormalText).color().name()); | ||||
546 | colorsStream << gtkColorsHelper("theme_bg_color", activeColorSchemes[1].background(KColorScheme::NormalBackground).color().name()); | ||||
547 | colorsStream << gtkColorsHelper("theme_text_color", activeColorSchemes[0].foreground(KColorScheme::NormalText).color().name()); | ||||
548 | colorsStream << gtkColorsHelper("theme_base_color", activeColorSchemes[0].background(KColorScheme::NormalBackground).color().name()); | ||||
549 | colorsStream << gtkColorsHelper("theme_view_hover_decoration_color", activeColorSchemes[0].decoration(KColorScheme::HoverColor).color().name()); | ||||
550 | colorsStream << gtkColorsHelper("theme_hovering_selected_bg_color", activeColorSchemes[3].decoration(KColorScheme::HoverColor).color().name()); | ||||
551 | colorsStream << gtkColorsHelper("theme_selected_bg_color", activeColorSchemes[3].background(KColorScheme::NormalBackground).color().name()); | ||||
552 | colorsStream << gtkColorsHelper("theme_selected_fg_color", activeColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
553 | colorsStream << gtkColorsHelper("theme_view_active_decoration_color", activeColorSchemes[0].decoration(KColorScheme::HoverColor).color().name()); | ||||
554 | | ||||
555 | // Button Colors | ||||
556 | colorsStream << gtkColorsHelper("theme_button_background_normal", activeColorSchemes[2].background(KColorScheme::NormalBackground).color().name()); | ||||
557 | colorsStream << gtkColorsHelper("theme_button_decoration_hover", activeColorSchemes[2].decoration(KColorScheme::HoverColor).color().name()); | ||||
558 | colorsStream << gtkColorsHelper("theme_button_decoration_focus", activeColorSchemes[2].decoration(KColorScheme::FocusColor).color().name()); | ||||
559 | colorsStream << gtkColorsHelper("theme_button_foreground_normal", activeColorSchemes[2].foreground(KColorScheme::NormalText).color().name()); | ||||
560 | colorsStream << gtkColorsHelper("theme_button_foreground_active", activeColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
561 | | ||||
562 | // Misc Colors | ||||
563 | QColor windowForegroundColor = activeColorSchemes[1].foreground(KColorScheme::NormalText).color(); | ||||
564 | QColor windowBackgroundColor = activeColorSchemes[1].background(KColorScheme::NormalBackground).color(); | ||||
565 | QColor bordersColor = KColorUtils::mix(windowBackgroundColor,windowForegroundColor, 0.25); | ||||
566 | | ||||
567 | colorsStream << gtkColorsHelper("borders", bordersColor.name()); | ||||
568 | colorsStream << gtkColorsHelper("warning_color", activeColorSchemes[0].foreground(KColorScheme::NeutralText).color().name()); | ||||
569 | colorsStream << gtkColorsHelper("success_color", activeColorSchemes[0].foreground(KColorScheme::PositiveText).color().name()); | ||||
570 | colorsStream << gtkColorsHelper("error_color", activeColorSchemes[0].foreground(KColorScheme::NegativeText).color().name()); | ||||
571 | | ||||
572 | /* | ||||
573 | Backdrop (Inactive) | ||||
574 | */ | ||||
575 | | ||||
576 | // General | ||||
577 | colorsStream << gtkColorsHelper("theme_unfocused_fg_color",inactiveColorSchemes[1].foreground(KColorScheme::NormalText).color().name()); | ||||
578 | colorsStream << gtkColorsHelper("theme_unfocused_text_color", inactiveColorSchemes[0].foreground(KColorScheme::NormalText).color().name()); | ||||
579 | colorsStream << gtkColorsHelper("theme_unfocused_bg_color", inactiveColorSchemes[1].background(KColorScheme::NormalBackground).color().name()); | ||||
580 | colorsStream << gtkColorsHelper("theme_unfocused_base_color", inactiveColorSchemes[0].background(KColorScheme::NormalBackground).color().name()); | ||||
581 | colorsStream << gtkColorsHelper("theme_unfocused_selected_bg_color_alt", inactiveColorSchemes[3].background(KColorScheme::NormalBackground).color().name()); | ||||
582 | colorsStream << gtkColorsHelper("theme_unfocused_selected_bg_color", inactiveColorSchemes[3].background(KColorScheme::NormalBackground).color().name()); | ||||
583 | colorsStream << gtkColorsHelper("theme_unfocused_selected_fg_color", inactiveColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
584 | | ||||
585 | // Button | ||||
586 | colorsStream << gtkColorsHelper("theme_button_background_normal_backdrop", inactiveColorSchemes[2].background(KColorScheme::NormalBackground).color().name()); | ||||
587 | colorsStream << gtkColorsHelper("theme_button_decoration_hover_backdrop", inactiveColorSchemes[2].decoration(KColorScheme::HoverColor).color().name()); | ||||
588 | colorsStream << gtkColorsHelper("theme_button_decoration_focus_backdrop", inactiveColorSchemes[2].decoration(KColorScheme::FocusColor).color().name()); | ||||
589 | colorsStream << gtkColorsHelper("theme_button_foreground_normal_backdrop", inactiveColorSchemes[2].foreground(KColorScheme::NormalText).color().name()); | ||||
590 | colorsStream << gtkColorsHelper("theme_button_foreground_active_backdrop", inactiveColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
591 | | ||||
592 | // Misc Colors | ||||
593 | QColor inactiveWindowForegroundColor = inactiveColorSchemes[1].foreground(KColorScheme::NormalText).color(); | ||||
594 | QColor inactiveWindowBackgroundColor = inactiveColorSchemes[1].background(KColorScheme::NormalBackground).color(); | ||||
595 | QColor inactiveBordersColor = KColorUtils::mix(inactiveWindowBackgroundColor,inactiveWindowForegroundColor, 0.25); | ||||
596 | | ||||
597 | colorsStream << gtkColorsHelper("unfocused_borders", inactiveBordersColor.name()); | ||||
598 | colorsStream << gtkColorsHelper("warning_color_backdrop", inactiveColorSchemes[0].foreground(KColorScheme::NeutralText).color().name()); | ||||
599 | colorsStream << gtkColorsHelper("success_color_backdrop", inactiveColorSchemes[0].foreground(KColorScheme::PositiveText).color().name()); | ||||
600 | colorsStream << gtkColorsHelper("error_color_backdrop", inactiveColorSchemes[0].foreground(KColorScheme::NegativeText).color().name()); | ||||
601 | | ||||
602 | /* | ||||
603 | Insensitive (Disabled) | ||||
604 | */ | ||||
605 | | ||||
606 | // General | ||||
607 | colorsStream << gtkColorsHelper("insensitive_fg_color",disabledColorSchemes[1].foreground(KColorScheme::NormalText).color().name()); | ||||
608 | colorsStream << gtkColorsHelper("insensitive_base_fg_color", disabledColorSchemes[0].foreground(KColorScheme::NormalText).color().name()); | ||||
609 | colorsStream << gtkColorsHelper("insensitive_bg_color", disabledColorSchemes[1].background(KColorScheme::NormalBackground).color().name()); | ||||
610 | colorsStream << gtkColorsHelper("insensitive_base_color", disabledColorSchemes[0].background(KColorScheme::NormalBackground).color().name()); | ||||
611 | colorsStream << gtkColorsHelper("insensitive_selected_bg_color", disabledColorSchemes[3].background(KColorScheme::NormalBackground).color().name()); | ||||
612 | colorsStream << gtkColorsHelper("insensitive_selected_fg_color", disabledColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
613 | | ||||
614 | // Button | ||||
615 | colorsStream << gtkColorsHelper("theme_button_background_normal_insensitive", disabledColorSchemes[2].background(KColorScheme::NormalBackground).color().name()); | ||||
616 | colorsStream << gtkColorsHelper("theme_button_decoration_hover_insensitive", disabledColorSchemes[2].decoration(KColorScheme::HoverColor).color().name()); | ||||
617 | colorsStream << gtkColorsHelper("theme_button_decoration_focus_insensitive", disabledColorSchemes[2].decoration(KColorScheme::FocusColor).color().name()); | ||||
618 | colorsStream << gtkColorsHelper("theme_button_foreground_normal_insensitive", disabledColorSchemes[2].foreground(KColorScheme::NormalText).color().name()); | ||||
619 | colorsStream << gtkColorsHelper("theme_button_foreground_active_insensitive", disabledColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
620 | | ||||
621 | // Misc Colors | ||||
622 | QColor disabledWindowForegroundColor = disabledColorSchemes[1].foreground(KColorScheme::NormalText).color(); | ||||
623 | QColor disabledWindowBackgroundColor = disabledColorSchemes[1].background(KColorScheme::NormalBackground).color(); | ||||
624 | QColor disabledBordersColor = KColorUtils::mix(disabledWindowBackgroundColor,disabledWindowForegroundColor, 0.25); | ||||
625 | | ||||
626 | colorsStream << gtkColorsHelper("insensitive_borders", disabledBordersColor.name()); | ||||
627 | colorsStream << gtkColorsHelper("warning_color_insensitive", disabledColorSchemes[0].foreground(KColorScheme::NeutralText).color().name()); | ||||
628 | colorsStream << gtkColorsHelper("success_color_insensitive", disabledColorSchemes[0].foreground(KColorScheme::PositiveText).color().name()); | ||||
629 | colorsStream << gtkColorsHelper("error_color_insensitive", disabledColorSchemes[0].foreground(KColorScheme::NegativeText).color().name()); | ||||
630 | | ||||
631 | /* | ||||
632 | Insensitive Backdrop (Inactive Disabled) These pretty much have the same appearance as regular inactive colors, but they're seperate in case we decide to make | ||||
633 | them different in the future. | ||||
634 | */ | ||||
635 | | ||||
636 | // General | ||||
637 | colorsStream << gtkColorsHelper("insensitive_unfocused_fg_color",disabledColorSchemes[1].foreground(KColorScheme::NormalText).color().name()); | ||||
638 | colorsStream << gtkColorsHelper("theme_unfocused_view_text_color", disabledColorSchemes[0].foreground(KColorScheme::NormalText).color().name()); | ||||
639 | colorsStream << gtkColorsHelper("insensitive_unfocused_bg_color", disabledColorSchemes[1].background(KColorScheme::NormalBackground).color().name()); | ||||
640 | colorsStream << gtkColorsHelper("theme_unfocused_view_bg_color", disabledColorSchemes[0].background(KColorScheme::NormalBackground).color().name()); | ||||
641 | colorsStream << gtkColorsHelper("insensitive_unfocused_selected_bg_color", disabledColorSchemes[3].background(KColorScheme::NormalBackground).color().name()); | ||||
642 | colorsStream << gtkColorsHelper("insensitive_unfocused_selected_fg_color", disabledColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
643 | | ||||
644 | // Button | ||||
645 | colorsStream << gtkColorsHelper("theme_button_background_normal_backdrop_insensitive", disabledColorSchemes[2].background(KColorScheme::NormalBackground).color().name()); | ||||
646 | colorsStream << gtkColorsHelper("theme_button_decoration_hover_backdrop_insensitive", disabledColorSchemes[2].decoration(KColorScheme::HoverColor).color().name()); | ||||
647 | colorsStream << gtkColorsHelper("theme_button_decoration_focus_backdrop_insensitive", disabledColorSchemes[2].decoration(KColorScheme::FocusColor).color().name()); | ||||
648 | colorsStream << gtkColorsHelper("theme_button_foreground_normal_backdrop_insensitive", disabledColorSchemes[2].foreground(KColorScheme::NormalText).color().name()); | ||||
649 | colorsStream << gtkColorsHelper("theme_button_foreground_active_backdrop_insensitive", disabledColorSchemes[3].foreground(KColorScheme::NormalText).color().name()); | ||||
650 | | ||||
651 | // Misc Colors | ||||
652 | QColor unfocusedDisabledWindowForegroundColor = disabledColorSchemes[1].foreground(KColorScheme::NormalText).color(); | ||||
653 | QColor unfocusedDisabledWindowBackgroundColor = disabledColorSchemes[1].background(KColorScheme::NormalBackground).color(); | ||||
654 | QColor unfocusedDisabledBordersColor = KColorUtils::mix(unfocusedDisabledWindowBackgroundColor,unfocusedDisabledWindowForegroundColor, 0.25); | ||||
655 | | ||||
656 | colorsStream << gtkColorsHelper("unfocused_insensitive_borders", unfocusedDisabledBordersColor.name()); | ||||
657 | colorsStream << gtkColorsHelper("warning_color_insensitive_backdrop", disabledColorSchemes[0].foreground(KColorScheme::NeutralText).color().name()); | ||||
658 | colorsStream << gtkColorsHelper("success_color_insensitive_backdrop", disabledColorSchemes[0].foreground(KColorScheme::PositiveText).color().name()); | ||||
659 | colorsStream << gtkColorsHelper("error_color_insensitive_backdrop", disabledColorSchemes[0].foreground(KColorScheme::NegativeText).color().name()); | ||||
660 | | ||||
661 | /* | ||||
662 | Ignorant Colors (These colors do not care about backdrop or insensitive states) | ||||
663 | */ | ||||
664 | | ||||
665 | colorsStream << gtkColorsHelper("link_color", activeColorSchemes[0].foreground(KColorScheme::LinkText).color().name()); | ||||
666 | colorsStream << gtkColorsHelper("link_visited_color", activeColorSchemes[0].foreground(KColorScheme::VisitedText).color().name()); | ||||
667 | | ||||
668 | QColor tooltipForegroundColor = activeColorSchemes[4].foreground(KColorScheme::NormalText).color(); | ||||
669 | QColor tooltipBackgroundColor = activeColorSchemes[4].background(KColorScheme::NormalBackground).color(); | ||||
670 | QColor tooltipBorderColor = KColorUtils::mix(tooltipBackgroundColor, tooltipForegroundColor, 0.25); | ||||
671 | | ||||
672 | colorsStream << gtkColorsHelper("tooltip_text", tooltipForegroundColor.name()); | ||||
673 | colorsStream << gtkColorsHelper("tooltip_background", tooltipBackgroundColor.name()); | ||||
674 | colorsStream << gtkColorsHelper("tooltip_border", tooltipBorderColor.name()); | ||||
675 | | ||||
676 | colorsStream << gtkColorsHelper("content_view_bg", activeColorSchemes[0].background(KColorScheme::NormalBackground).color().name()); | ||||
677 | | ||||
678 | /* | ||||
679 | Theme titlebar colors | ||||
680 | */ | ||||
681 | KConfigGroup groupWMTheme(config, "WM"); | ||||
682 | colorsStream << gtkColorsHelper("theme_titlebar_background", "rgb(" + groupWMTheme.readEntry("activeBackground", "") + ")"); | ||||
683 | colorsStream << gtkColorsHelper("theme_titlebar_foreground", "rgb(" + groupWMTheme.readEntry("activeForeground", "") + ")"); | ||||
684 | colorsStream << gtkColorsHelper("theme_titlebar_background_light", activeColorSchemes[1].background(KColorScheme::NormalBackground).color().name()); | ||||
685 | colorsStream << gtkColorsHelper("theme_titlebar_foreground_backdrop", "rgb(" + groupWMTheme.readEntry("inactiveForeground", "") + ")"); | ||||
686 | colorsStream << gtkColorsHelper("theme_titlebar_background_backdrop", "rgb(" + groupWMTheme.readEntry("inactiveBackground", "") + ")"); | ||||
687 | colorsStream << gtkColorsHelper("theme_titlebar_foreground_insensitive", "rgb(" + groupWMTheme.readEntry("inactiveForeground", "") + ")"); | ||||
688 | colorsStream << gtkColorsHelper("theme_titlebar_foreground_insensitive_backdrop", "rgb(" + groupWMTheme.readEntry("inactiveForeground", "") + ")"); | ||||
689 | } | ||||
690 | } | ||||
691 | | ||||
477 | #include "colors.moc" | 692 | #include "colors.moc" |
Pass by const-ref const QString &name, ..