diff --git a/kcms/colors/colorsmodel.h b/kcms/colors/colorsmodel.h --- a/kcms/colors/colorsmodel.h +++ b/kcms/colors/colorsmodel.h @@ -33,6 +33,8 @@ QString display; QString schemeName; QPalette palette; + QColor activeTitleBarBackground; + QColor activeTitleBarForeground; bool removable; bool pendingDeletion; }; @@ -52,6 +54,9 @@ enum Roles { SchemeNameRole = Qt::UserRole + 1, PaletteRole, + // Colors which aren't in QPalette + ActiveTitleBarBackgroundRole, + ActiveTitleBarForegroundRole, RemovableRole, PendingDeletionRole }; diff --git a/kcms/colors/colorsmodel.cpp b/kcms/colors/colorsmodel.cpp --- a/kcms/colors/colorsmodel.cpp +++ b/kcms/colors/colorsmodel.cpp @@ -61,6 +61,8 @@ case Qt::DisplayRole: return item.display; case SchemeNameRole: return item.schemeName; case PaletteRole: return item.palette; + case ActiveTitleBarBackgroundRole: return item.activeTitleBarBackground; + case ActiveTitleBarForegroundRole: return item.activeTitleBarForeground; case PendingDeletionRole: return item.pendingDeletion; case RemovableRole: return item.removable; } @@ -103,6 +105,8 @@ {Qt::DisplayRole, QByteArrayLiteral("display")}, {SchemeNameRole, QByteArrayLiteral("schemeName")}, {PaletteRole, QByteArrayLiteral("palette")}, + {ActiveTitleBarBackgroundRole, QByteArrayLiteral("activeTitleBarBackground")}, + {ActiveTitleBarForegroundRole, QByteArrayLiteral("activeTitleBarForeground")}, {RemovableRole, QByteArrayLiteral("removable")}, {PendingDeletionRole, QByteArrayLiteral("pendingDeletion")} }; @@ -180,10 +184,20 @@ KConfigGroup group(config, "General"); const QString name = group.readEntry("Name", baseName); + const QPalette palette = KColorScheme::createApplicationPalette(config); + + KConfigGroup wmConfig(config, QStringLiteral("WM")); + + // from kwin/decorations/decorationpalette.cpp + const QColor activeTitleBarBackground = wmConfig.readEntry("activeBackground", palette.color(QPalette::Active, QPalette::Highlight)); + const QColor activeTitleBarForeground = wmConfig.readEntry("activeForeground", palette.color(QPalette::Active, QPalette::HighlightedText)); + ColorsModelData item{ name, baseName, - KColorScheme::createApplicationPalette(config), + palette, + activeTitleBarBackground, + activeTitleBarForeground, fi.isWritable(), false, // pending deletion }; diff --git a/kcms/colors/package/contents/ui/main.qml b/kcms/colors/package/contents/ui/main.qml --- a/kcms/colors/package/contents/ui/main.qml +++ b/kcms/colors/package/contents/ui/main.qml @@ -52,6 +52,7 @@ Component.onCompleted: { // The thumbnails are a bit more elaborate and need more room, especially when translated view.implicitCellWidth = Kirigami.Units.gridUnit * 13; + view.implicitCellHeight = Kirigami.Units.gridUnit * 11; } DropArea { @@ -177,9 +178,39 @@ Kirigami.Theme.linkColor: model.palette.link Kirigami.Theme.textColor: model.palette.text + Rectangle { + id: windowTitleBar + width: parent.width + height: Math.round(Kirigami.Units.gridUnit * 1.5) + gradient: Gradient { + // from Breeze Decoration::paintTitleBar + GradientStop { position: 0.0; color: Qt.lighter(model.activeTitleBarBackground, 1.2) } + GradientStop { position: 0.8; color: model.activeTitleBarBackground } + } + + color: model.activeTitleBarBackground + + QtControls.Label { + anchors { + fill: parent + leftMargin: Kirigami.Units.smallSpacing + rightMargin: Kirigami.Units.smallSpacing + } + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: model.activeTitleBarForeground + text: i18n("Window Title") + textFormat: Text.PlainText + elide: Text.ElideRight + } + } + ColumnLayout { anchors { - fill: parent + left: parent.left + right: parent.right + top: windowTitleBar.bottom + bottom: parent.bottom margins: Kirigami.Units.smallSpacing }