Merge branch 'mart/headerGroup'
This commit is contained in:
commit
50a699f9e3
@ -204,6 +204,46 @@ QColor QuickTheme::complementaryNegativeTextColor() const
|
||||
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ComplementaryColorGroup);
|
||||
}
|
||||
|
||||
|
||||
QColor QuickTheme::headerTextColor() const
|
||||
{
|
||||
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::HeaderColorGroup);
|
||||
}
|
||||
|
||||
QColor QuickTheme::headerBackgroundColor() const
|
||||
{
|
||||
return Plasma::Theme::color(Plasma::Theme::BackgroundColor, Plasma::Theme::HeaderColorGroup);
|
||||
}
|
||||
|
||||
QColor QuickTheme::headerHoverColor() const
|
||||
{
|
||||
return Plasma::Theme::color(Plasma::Theme::HoverColor, Plasma::Theme::HeaderColorGroup);
|
||||
}
|
||||
|
||||
QColor QuickTheme::headerFocusColor() const
|
||||
{
|
||||
return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::HeaderColorGroup);
|
||||
}
|
||||
|
||||
QColor QuickTheme::headerHighlightedTextColor() const
|
||||
{
|
||||
return Plasma::Theme::color(Plasma::Theme::HighlightedTextColor, Plasma::Theme::HeaderColorGroup);
|
||||
}
|
||||
|
||||
QColor QuickTheme::headerPositiveTextColor() const
|
||||
{
|
||||
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::HeaderColorGroup);
|
||||
}
|
||||
|
||||
QColor QuickTheme::headerNeutralTextColor() const
|
||||
{
|
||||
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::HeaderColorGroup);
|
||||
}
|
||||
|
||||
QColor QuickTheme::headerNegativeTextColor() const
|
||||
{
|
||||
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::HeaderColorGroup);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_quicktheme.cpp"
|
||||
|
@ -81,9 +81,18 @@ class QuickTheme : public Plasma::Theme
|
||||
Q_PROPERTY(QColor complementaryHoverColor READ complementaryHoverColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor complementaryFocusColor READ complementaryFocusColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor complementaryHighlightedTextColor READ complementaryHighlightedTextColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor complementaryPositiveTextColor READ buttonPositiveTextColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor complementaryNeutralTextColor READ buttonNeutralTextColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor complementaryNegativeTextColor READ buttonNegativeTextColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor complementaryPositiveTextColor READ complementaryPositiveTextColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor complementaryNeutralTextColor READ complementaryNeutralTextColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor complementaryNegativeTextColor READ complementaryNegativeTextColor NOTIFY themeChangedProxy)
|
||||
|
||||
Q_PROPERTY(QColor headerTextColor READ headerTextColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor headerBackgroundColor READ headerBackgroundColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor headerHoverColor READ headerHoverColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor headerFocusColor READ headerFocusColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor headerHighlightedTextColor READ headerHighlightedTextColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor headerPositiveTextColor READ headerPositiveTextColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor headerNeutralTextColor READ headerNeutralTextColor NOTIFY themeChangedProxy)
|
||||
Q_PROPERTY(QColor headerNegativeTextColor READ headerNegativeTextColor NOTIFY themeChangedProxy)
|
||||
|
||||
public:
|
||||
explicit QuickTheme(QObject *parent = nullptr);
|
||||
@ -295,6 +304,55 @@ public:
|
||||
*/
|
||||
QColor complementaryNegativeTextColor() const;
|
||||
|
||||
|
||||
/**
|
||||
* @return The theme's colorscheme's text color of "header" areas
|
||||
* @since 5.0
|
||||
*/
|
||||
QColor headerTextColor() const;
|
||||
|
||||
/**
|
||||
* @return The theme's colorscheme's background color of "header" areas
|
||||
* @since 5.0
|
||||
*/
|
||||
QColor headerBackgroundColor() const;
|
||||
|
||||
/**
|
||||
* @return The theme's colorscheme's color of hovered "header" areas
|
||||
* @since 5.0
|
||||
*/
|
||||
QColor headerHoverColor() const;
|
||||
|
||||
/**
|
||||
* @return The theme's colorscheme's color of focused "header" areas
|
||||
* @since 5.0
|
||||
*/
|
||||
QColor headerFocusColor() const;
|
||||
|
||||
/**
|
||||
* @return The theme's colorscheme's highlighted text color for "header" areas
|
||||
* @since 5.22
|
||||
*/
|
||||
QColor headerHighlightedTextColor() const;
|
||||
|
||||
/**
|
||||
* @return The theme's colorscheme's positive text color of header
|
||||
* @since 5.22
|
||||
*/
|
||||
QColor headerPositiveTextColor() const;
|
||||
|
||||
/**
|
||||
* @return The theme's colorscheme's neutral text color of header
|
||||
* @since 5.22
|
||||
*/
|
||||
QColor headerNeutralTextColor() const;
|
||||
|
||||
/**
|
||||
* @return The theme's colorscheme's negative text color of header
|
||||
* @since 5.22
|
||||
*/
|
||||
QColor headerNegativeTextColor() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void themeChangedProxy();
|
||||
};
|
||||
|
@ -14,7 +14,8 @@ import "../../private" as KirigamiPrivate
|
||||
T.AbstractApplicationHeader {
|
||||
id: root
|
||||
|
||||
Kirigami.Theme.inherit: true
|
||||
Kirigami.Theme.inherit: false
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Header
|
||||
|
||||
background: Rectangle {
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
|
@ -69,6 +69,12 @@ QtObject {
|
||||
property color complementaryHoverColor: theme.complementaryHoverColor
|
||||
property color complementaryFocusColor: theme.complementaryFocusColor
|
||||
|
||||
property color headerTextColor: theme.headerTextColor
|
||||
property color headerBackgroundColor: theme.headerBackgroundColor
|
||||
property color headerAlternateBackgroundColor: Qt.darker(theme.headerBackgroundColor, 1.05)
|
||||
property color headerHoverColor: theme.headerHoverColor
|
||||
property color headerFocusColor: theme.headerFocusColor
|
||||
|
||||
property variant defaultFont: theme.defaultFont
|
||||
property variant smallFont: theme.smallestFont
|
||||
|
||||
@ -93,6 +99,9 @@ QtObject {
|
||||
case Kirigami.Theme.Complementary:
|
||||
object.PlasmaCore.ColorScope.colorGroup = PlasmaCore.Theme.ComplementaryColorGroup;
|
||||
break;
|
||||
case Kirigami.Theme.Header:
|
||||
object.PlasmaCore.ColorScope.colorGroup = PlasmaCore.Theme.HeaderColorGroup;
|
||||
break;
|
||||
}
|
||||
}
|
||||
function __propagateTextColor(object, color) {}
|
||||
|
@ -208,7 +208,6 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
|
||||
return applet;
|
||||
}
|
||||
|
||||
|
||||
if (!applet) {
|
||||
//qCDebug(LOG_PLASMA) << name << "not a C++ applet: Falling back to an empty one";
|
||||
|
||||
|
@ -56,6 +56,7 @@ ThemePrivate::ThemePrivate(QObject *parent)
|
||||
buttonColorScheme(QPalette::Active, KColorScheme::Button, KSharedConfigPtr(nullptr)),
|
||||
viewColorScheme(QPalette::Active, KColorScheme::View, KSharedConfigPtr(nullptr)),
|
||||
complementaryColorScheme(QPalette::Active, KColorScheme::Complementary, KSharedConfigPtr(nullptr)),
|
||||
headerColorScheme(QPalette::Active, KColorScheme::Header, KSharedConfigPtr(nullptr)),
|
||||
defaultWallpaperTheme(QStringLiteral(DEFAULT_WALLPAPER_THEME)),
|
||||
defaultWallpaperSuffix(QStringLiteral(DEFAULT_WALLPAPER_SUFFIX)),
|
||||
defaultWallpaperWidth(DEFAULT_WALLPAPER_WIDTH),
|
||||
@ -486,6 +487,15 @@ const QString ThemePrivate::processStyleSheet(const QString &css, Plasma::Svg::S
|
||||
elements[QStringLiteral("%complementaryneutraltextcolor")] = color(Theme::NeutralTextColor, Theme::ComplementaryColorGroup).name();
|
||||
elements[QStringLiteral("%complementarynegativetextcolor")] = color(Theme::NegativeTextColor, Theme::ComplementaryColorGroup).name();
|
||||
|
||||
elements[QStringLiteral("%headertextcolor")] = color(status == Svg::Status::Selected ? Theme::HighlightedTextColor : Theme::TextColor, Theme::HeaderColorGroup).name();
|
||||
elements[QStringLiteral("%headerbackgroundcolor")] = color(status == Svg::Status::Selected ? Theme::HighlightColor : Theme::BackgroundColor, Theme::HeaderColorGroup).name();
|
||||
elements[QStringLiteral("%headerhovercolor")] = color(Theme::HoverColor, Theme::HeaderColorGroup).name();
|
||||
elements[QStringLiteral("%headerfocuscolor")] = color(Theme::FocusColor, Theme::HeaderColorGroup).name();
|
||||
elements[QStringLiteral("%headerhighlightedtextcolor")] = color(Theme::HighlightedTextColor, Theme::HeaderColorGroup).name();
|
||||
elements[QStringLiteral("%headerpositivetextcolor")] = color(Theme::PositiveTextColor, Theme::HeaderColorGroup).name();
|
||||
elements[QStringLiteral("%headerneutraltextcolor")] = color(Theme::NeutralTextColor, Theme::HeaderColorGroup).name();
|
||||
elements[QStringLiteral("%headernegativetextcolor")] = color(Theme::NegativeTextColor, Theme::HeaderColorGroup).name();
|
||||
|
||||
QFont font = QGuiApplication::font();
|
||||
elements[QStringLiteral("%fontsize")] = QStringLiteral("%1pt").arg(font.pointSize());
|
||||
elements[QStringLiteral("%fontfamily")] = font.family().splitRef(QLatin1Char('[')).first().toString();
|
||||
@ -536,6 +546,16 @@ const QString ThemePrivate::svgStyleSheet(Plasma::Theme::ColorGroup group, Plasm
|
||||
stylesheet += skel.arg(QStringLiteral("NeutralText"), QStringLiteral("%complementaryneutraltextcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("NegativeText"), QStringLiteral("%complementarynegativetextcolor"));
|
||||
break;
|
||||
case Theme::HeaderColorGroup:
|
||||
stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%headertextcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("Background"), QStringLiteral("%headerbackgroundcolor"));
|
||||
|
||||
stylesheet += skel.arg(QStringLiteral("Highlight"), QStringLiteral("%headerhovercolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("HighlightedText"), QStringLiteral("%headerhighlightedtextcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("PositiveText"), QStringLiteral("%headerpositivetextcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("NeutralText"), QStringLiteral("%headerneutraltextcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("NegativeText"), QStringLiteral("%headernegativetextcolor"));
|
||||
break;
|
||||
default:
|
||||
stylesheet += skel.arg(QStringLiteral("Text"), QStringLiteral("%textcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("Background"), QStringLiteral("%backgroundcolor"));
|
||||
@ -574,6 +594,15 @@ const QString ThemePrivate::svgStyleSheet(Plasma::Theme::ColorGroup group, Plasm
|
||||
stylesheet += skel.arg(QStringLiteral("ComplementaryNeutralText"), QStringLiteral("%complementaryneutraltextcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("ComplementaryNegativeText"), QStringLiteral("%complementarynegativetextcolor"));
|
||||
|
||||
stylesheet += skel.arg(QStringLiteral("HeaderText"), QStringLiteral("%headertextcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("HeaderBackground"), QStringLiteral("%headerbackgroundcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("HeaderHover"), QStringLiteral("%headerhovercolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("HeaderFocus"), QStringLiteral("%headerfocuscolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("HeaderHighlightedText"), QStringLiteral("%headerhighlightedtextcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("HeaderPositiveText"), QStringLiteral("%headerpositivetextcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("HeaderNeutralText"), QStringLiteral("%headerneutraltextcolor"));
|
||||
stylesheet += skel.arg(QStringLiteral("HeaderNegativeText"), QStringLiteral("%headernegativetextcolor"));
|
||||
|
||||
stylesheet = processStyleSheet(stylesheet, status);
|
||||
if (status == Svg::Status::Selected) {
|
||||
cachedSelectedSvgStyleSheets.insert(group, stylesheet);
|
||||
@ -652,6 +681,11 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const
|
||||
break;
|
||||
}
|
||||
|
||||
case Theme::HeaderColorGroup: {
|
||||
scheme = &headerColorScheme;
|
||||
break;
|
||||
}
|
||||
|
||||
case Theme::NormalColorGroup:
|
||||
default: {
|
||||
scheme = &colorScheme;
|
||||
@ -803,6 +837,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
|
||||
buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors);
|
||||
viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors);
|
||||
complementaryColorScheme = KColorScheme(QPalette::Active, KColorScheme::Complementary, colors);
|
||||
headerColorScheme = KColorScheme(QPalette::Active, KColorScheme::Header, colors);
|
||||
palette = KColorScheme::createApplicationPalette(colors);
|
||||
const QString wallpaperPath = QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1String("/wallpapers/");
|
||||
hasWallpapers = !QStandardPaths::locate(QStandardPaths::GenericDataLocation, wallpaperPath, QStandardPaths::LocateDirectory).isEmpty();
|
||||
|
@ -119,6 +119,7 @@ public:
|
||||
KColorScheme buttonColorScheme;
|
||||
KColorScheme viewColorScheme;
|
||||
KColorScheme complementaryColorScheme;
|
||||
KColorScheme headerColorScheme;
|
||||
QPalette palette;
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
KConfigGroup cfg;
|
||||
|
@ -90,7 +90,8 @@ public:
|
||||
NormalColorGroup = 0,
|
||||
ButtonColorGroup = 1,
|
||||
ViewColorGroup = 2,
|
||||
ComplementaryColorGroup = 3
|
||||
ComplementaryColorGroup = 3,
|
||||
HeaderColorGroup
|
||||
};
|
||||
Q_ENUM(ColorGroup)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user