Commit 1b8d5d70 authored by Nate Graham's avatar Nate Graham
Browse files

Port to singleton Theme

We ported units to use the PlasmaCore.Units singleton earlier; now it's
time to do the same thing for PlasmaCore.Theme.

There are no UI changes or regressions detected.
parent d677153e
......@@ -52,7 +52,7 @@ Item {
readonly property int dots: showSeconds ? 6 : 4
readonly property color onColor: plasmoid.configuration.useCustomColorForActive ? plasmoid.configuration.customColorForActive : theme.textColor
readonly property color onColor: plasmoid.configuration.useCustomColorForActive ? plasmoid.configuration.customColorForActive : PlasmaCore.Theme.textColor
readonly property color offColor: plasmoid.configuration.useCustomColorForInactive ? plasmoid.configuration.customColorForInactive : Qt.rgba(onColor.r, onColor.g, onColor.b, 0.4)
readonly property color gridColor: plasmoid.configuration.useCustomColorForGrid ? plasmoid.configuration.customColorForGrid : Qt.rgba(onColor.r, onColor.g, onColor.b, 0.6)
......
......@@ -263,9 +263,9 @@ QQC2.Control {
margins: parent.margins.right;
}
text: "0";
font.pointSize: theme.defaultFont.pointSize * 2;
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize * 2;
font.weight: Font.Bold;
color: theme.viewTextColor;
color: PlasmaCore.Theme.viewTextColor;
horizontalAlignment: TextEdit.AlignRight;
verticalAlignment: TextEdit.AlignVCenter;
readOnly: true;
......
......@@ -136,7 +136,7 @@ Item {
anchors.centerIn: parent
width: Math.min(parent.width, colorCircle.height)
height: Math.min(parent.height, colorCircle.height)
color: theme.textColor
color: PlasmaCore.Theme.textColor
opacity: 0.6
}
}
......@@ -207,9 +207,9 @@ Item {
}
border {
color: theme.textColor
color: PlasmaCore.Theme.textColor
width: {
var contrast = luminance(theme.viewBackgroundColor) / luminance(colorCircle.color) + 0.05;
var contrast = luminance(PlasmaCore.Theme.viewBackgroundColor) / luminance(colorCircle.color) + 0.05;
// show border only if there's too little contrast to the surrounding view or color is transparent
if (contrast > 3 && colorCircle.color.a > 0.5) {
......@@ -295,7 +295,7 @@ Item {
Rectangle {
id: dragImageDummy
border {
color: theme.textColor
color: PlasmaCore.Theme.textColor
width: Math.round(PlasmaCore.Units.devicePixelRatio)
}
radius: width
......@@ -361,7 +361,7 @@ Item {
color: delegateMouse.currentColor
border {
color: theme.textColor
color: PlasmaCore.Theme.textColor
width: Math.round(PlasmaCore.Units.devicePixelRatio)
}
......@@ -373,7 +373,7 @@ Item {
margins: rect.border.width
}
height: colorLabel.contentHeight + 2 * PlasmaCore.Units.smallSpacing
color: theme.backgroundColor
color: PlasmaCore.Theme.backgroundColor
opacity: 0.8
PlasmaComponents3.Label {
......@@ -383,7 +383,7 @@ Item {
verticalAlignment: Text.AlignVCenter
elide: Text.ElideLeft
fontSizeMode: Text.HorizontalFit
minimumPointSize: theme.smallestFont.pointSize
minimumPointSize: PlasmaCore.Theme.smallestFont.pointSize
text: Logic.formatColor(delegateMouse.currentColor, root.defaultFormat)
}
}
......
......@@ -32,7 +32,7 @@ Item {
leftMargin: 2
}
color: theme.textColor
color: PlasmaCore.Theme.textColor
visible: (showIdentifier && comicIdentifier.text.length > 0)
text: (showIdentifier && comicData.currentReadable != undefined) ? comicData.currentReadable : ""
......@@ -44,11 +44,11 @@ Item {
hoverEnabled: true
onEntered: {
parent.color = theme.highlightColor;
parent.color = PlasmaCore.Theme.highlightColor;
}
onExited: {
parent.color = theme.textColor;
parent.color = PlasmaCore.Theme.textColor;
}
onClicked: {
......@@ -72,7 +72,7 @@ Item {
rightMargin: 2
}
color: theme.textColor
color: PlasmaCore.Theme.textColor
visible: (showUrl && comicUrl.text.length > 0)
text: (showUrl && comicData.websiteHost.length > 0) ? comicData.websiteHost : ""
......@@ -84,11 +84,11 @@ Item {
hoverEnabled: true
onEntered: {
parent.color = theme.highlightColor;
parent.color = PlasmaCore.Theme.highlightColor;
}
onExited: {
parent.color = theme.textColor;
parent.color = PlasmaCore.Theme.textColor;
}
onClicked: {
......
......@@ -158,7 +158,7 @@ Item {
Rectangle {
id: mainGrid
color: theme.backgroundColor
color: PlasmaCore.Theme.backgroundColor
anchors {
top: parent.top
left: parent.left
......@@ -187,7 +187,7 @@ Item {
id: timeLabel
Layout.fillWidth: true
text: main.timerText()
color: theme.textColor
color: PlasmaCore.Theme.textColor
}
}
......@@ -195,7 +195,7 @@ Item {
id: solvedRect
visible: false
anchors.fill: mainGrid
color: theme.backgroundColor
color: PlasmaCore.Theme.backgroundColor
z: 0
Image {
......@@ -215,7 +215,7 @@ Item {
PlasmaComponents3.Label {
id: solvedLabel
anchors.centerIn: parent
color: theme.textColor
color: PlasmaCore.Theme.textColor
text: i18nc("@info", "Solved! Try again.")
z: 2
}
......
......@@ -22,7 +22,7 @@ Item {
Layout.minimumHeight: vertical ? sizehelper.paintedHeight + (PlasmaCore.Units.smallSpacing * 2) : 0
Layout.maximumHeight: vertical ? Layout.minimumHeight : Infinity
Layout.preferredHeight: vertical ? Layout.minimumHeight : theme.mSize(theme.defaultFont).height * 2
Layout.preferredHeight: vertical ? Layout.minimumHeight : PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height * 2
readonly property bool vertical: plasmoid.formFactor == PlasmaCore.Types.Vertical
......@@ -256,7 +256,7 @@ Item {
pixelSize: 1024
pointSize: 0 // we need to unset pointSize otherwise it breaks the Text.Fit size mode
}
minimumPixelSize: theme.mSize(theme.smallestFont).height
minimumPixelSize: PlasmaCore.Theme.mSize(PlasmaCore.Theme.smallestFont).height
fontSizeMode: Text.Fit
text: timeString()
......@@ -283,8 +283,8 @@ Item {
id: sizehelper
font.weight: timeLabel.font.weight
font.italic: timeLabel.font.italic
font.pixelSize: vertical ? theme.mSize(theme.defaultFont).height * 2 : 1024 // random "big enough" size - this is used as a max pixelSize by the fontSizeMode
minimumPixelSize: theme.mSize(theme.smallestFont).height
font.pixelSize: vertical ? PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height * 2 : 1024 // random "big enough" size - this is used as a max pixelSize by the fontSizeMode
minimumPixelSize: PlasmaCore.Theme.mSize(PlasmaCore.Theme.smallestFont).height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: timeLabel.text
......
......@@ -56,7 +56,7 @@ PlasmaCore.ToolTipArea {
})
} else {
popupWindow.mainItem.width = Qt.binding(function() {
return theme.mSize(theme.defaultFont).width * 35
return PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width * 35
})
}
......@@ -74,7 +74,7 @@ PlasmaCore.ToolTipArea {
})
} else {
popupWindow.mainItem.height = Qt.binding(function() {
return theme.mSize(theme.defaultFont).height * 25
return PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height * 25
})
}
......
......@@ -81,7 +81,7 @@ function minimumCellHeight()
{
var h = PlasmaCore.Units.iconSizes.small + 2 * itemPadding();
if (showLauncherNames) {
h += theme.mSize(theme.defaultFont).height * 2;
h += PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height * 2;
}
return h;
}
......@@ -98,8 +98,8 @@ function preferredCellHeight()
function popupItemWidth()
{
var fw = theme.mSize(theme.defaultFont).width;
return Math.max(root.width, PlasmaCore.Units.iconSizes.medium + 20 * fw);
var fw = PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).width;
return Math.max(root.width, PlasmaCore.Units.iconSizes.medium + 20 * fw);
}
function popupItemHeight()
......
......@@ -87,7 +87,7 @@ Item {
right: parent.right
}
height: theme.mSize(theme.defaultFont).height
height: PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignTop
elide: Text.ElideMiddle
......
......@@ -253,10 +253,10 @@ DropArea {
Rectangle {
border {
color: theme.textColor
color: PlasmaCore.Theme.textColor
width: root.containsDrag ? 5 : 1
}
color: theme.backgroundColor
color: PlasmaCore.Theme.backgroundColor
radius: Math.max(parent.width, parent.height)/10
anchors.fill: parent
opacity: root.containsDrag || tooltipArea.containsMouse ? .3 : 0
......
......@@ -93,7 +93,7 @@ Item {
wrapMode: Text.NoWrap
elide: Text.ElideRight
opacity: 0.6
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
visible: text !== ""
}
}
......
......@@ -56,15 +56,15 @@ Item {
id: compactRoot
// Taken from DigitalClock to ensure uniform sizing when next to each other
readonly property bool tooSmall: plasmoid.formFactor === PlasmaCore.Types.Horizontal && Math.round(2 * (compactRoot.height / 5)) <= theme.smallestFont.pixelSize
readonly property bool tooSmall: plasmoid.formFactor === PlasmaCore.Types.Horizontal && Math.round(2 * (compactRoot.height / 5)) <= PlasmaCore.Theme.smallestFont.pixelSize
Layout.minimumWidth: isVertical ? 0 : compactRow.implicitWidth
Layout.maximumWidth: isVertical ? Infinity : Layout.minimumWidth
Layout.preferredWidth: isVertical ? undefined : Layout.minimumWidth
Layout.minimumHeight: isVertical ? label.height : theme.smallestFont.pixelSize
Layout.minimumHeight: isVertical ? label.height : PlasmaCore.Theme.smallestFont.pixelSize
Layout.maximumHeight: isVertical ? Layout.minimumHeight : Infinity
Layout.preferredHeight: isVertical ? Layout.minimumHeight : theme.mSize(theme.defaultFont).height * 2
Layout.preferredHeight: isVertical ? Layout.minimumHeight : PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height * 2
onClicked: plasmoid.expanded = !plasmoid.expanded
......@@ -92,8 +92,8 @@ Item {
verticalAlignment: Text.AlignVCenter
wrapMode: Text.NoWrap
fontSizeMode: Text.VerticalFit
font.pixelSize: tooSmall ? theme.defaultFont.pixelSize : PlasmaCore.Units.roundToIconSize(PlasmaCore.Units.gridUnit * 2)
minimumPointSize: theme.smallestFont.pointSize
font.pixelSize: tooSmall ? PlasmaCore.Theme.defaultFont.pixelSize : PlasmaCore.Units.roundToIconSize(PlasmaCore.Units.gridUnit * 2)
minimumPointSize: PlasmaCore.Theme.smallestFont.pointSize
visible: root.showName
}
}
......
......@@ -43,7 +43,7 @@ ColumnLayout {
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignRight
font {
pointSize: theme.smallestFont.pointSize
pointSize: PlasmaCore.Theme.smallestFont.pointSize
underline: !!creditUrl
}
linkColor : color
......
......@@ -63,9 +63,9 @@ GridLayout {
family: label.font.family
weight: label.font.weight
italic: label.font.italic
pixelSize: iconAndTextRoot.vertical ? theme.mSize(theme.defaultFont).height * 2 : 1024 // random "big enough" size - this is used as a max pixelSize by the fontSizeMode
pixelSize: iconAndTextRoot.vertical ? PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height * 2 : 1024 // random "big enough" size - this is used as a max pixelSize by the fontSizeMode
}
minimumPixelSize: theme.mSize(theme.smallestFont).height / 2
minimumPixelSize: PlasmaCore.Theme.mSize(PlasmaCore.Theme.smallestFont).height / 2
fontSizeMode: iconAndTextRoot.vertical ? Text.HorizontalFit : Text.VerticalFit
wrapMode: Text.NoWrap
......@@ -82,7 +82,7 @@ GridLayout {
if (parent.height <= 26) {
textHeightScaleFactor = 0.9;
}
return Math.min (parent.height * textHeightScaleFactor, 3 * theme.defaultFont.pixelSize);
return Math.min (parent.height * textHeightScaleFactor, 3 * PlasmaCore.Theme.defaultFont.pixelSize);
}
visible: false
......@@ -98,7 +98,7 @@ GridLayout {
pixelSize: 1024
pointSize: 0 // we need to unset pointSize otherwise it breaks the Text.Fit size mode
}
minimumPixelSize: theme.mSize(theme.smallestFont).height / 2
minimumPixelSize: PlasmaCore.Theme.mSize(PlasmaCore.Theme.smallestFont).height / 2
fontSizeMode: Text.Fit
wrapMode: Text.NoWrap
......
......@@ -45,7 +45,7 @@ ColumnLayout {
delegate: PlasmaComponents.Label {
font.underline: true
color: theme.linkColor
color: PlasmaCore.Theme.linkColor
text: modelData.description
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment