Commit fc769576 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 3757f2b4
......@@ -36,7 +36,7 @@ Rectangle {
PlasmaComponents3.Label {
id: label
anchors.centerIn: parent
font.pixelSize: Math.max(icon.height/4, theme.smallestFont.pixelSize*0.8)
font.pixelSize: Math.max(icon.height/4, PlasmaCore.Theme.smallestFont.pixelSize*0.8)
}
layer.enabled: true
......
......@@ -51,7 +51,7 @@ Item {
width: parent ? parent.width : implicitWidth
wrapMode: Text.WordWrap
text: batteryItem.isBroken && typeof model.Capacity !== "undefined" ? i18n("This battery's health is at only %1% and should be replaced. Please contact your hardware vendor for more details.", model.Capacity) : ""
font: !!detailsLayout.parent.inListView ? theme.smallestFont : theme.defaultFont
font: !!detailsLayout.parent.inListView ? PlasmaCore.Theme.smallestFont : PlasmaCore.Theme.defaultFont
visible: batteryItem.isBroken
}
......@@ -77,7 +77,7 @@ Item {
PropertyChanges {
target: detailsLabel
horizontalAlignment: modelData.value ? Text.AlignRight : Text.AlignLeft
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
width: parent ? parent.width / 2 : 0
elide: Text.ElideNone // eliding and height: implicitHeight causes loops
}
......
......@@ -38,7 +38,7 @@ RowLayout {
PlasmaComponents3.Label {
id: label
Layout.fillWidth: true
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
wrapMode: Text.WordWrap
elide: Text.ElideRight
maximumLineCount: 4
......
......@@ -69,7 +69,7 @@ ColumnLayout {
// Don't need to show the inhibitions when power management
// isn't enabled anyway
visible: inhibitions.length > 0 && pmCheckBox.checked
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
wrapMode: Text.WordWrap
elide: Text.ElideRight
maximumLineCount: 3
......
......@@ -76,7 +76,7 @@ Item {
}
Rectangle {
id: overlay
color: theme.textColor
color: PlasmaCore.Theme.textColor
opacity: 0.6
height: PlasmaCore.Units.gridUnit
anchors {
......@@ -86,8 +86,8 @@ Item {
}
}
PlasmaComponents3.Label {
font: theme.smallestFont
color: theme.backgroundColor
font: PlasmaCore.Theme.smallestFont
color: PlasmaCore.Theme.backgroundColor
maximumLineCount: 1
anchors {
verticalCenter: overlay.verticalCenter
......@@ -119,6 +119,6 @@ Item {
}
verticalAlignment: Text.AlignBottom
horizontalAlignment: Text.AlignCenter
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
}
}
......@@ -257,7 +257,7 @@ PlasmaComponents3.Page {
readonly property string timeString: Qt.formatTime(new Date(2000, 12, 12, 12, 12, 12, 12))
readonly property string dateString: agenda.formatDateWithoutYear(new Date(2000, 12, 12, 12, 12, 12))
font: theme.defaultFont
font: PlasmaCore.Theme.defaultFont
text: timeString.length > dateString.length ? timeString : dateString
}
......
......@@ -59,7 +59,7 @@ Item {
// if the date/timezone cannot be fit with the smallest font to its designated space
property bool oneLineMode: plasmoid.configuration.dateDisplayFormat === 1 ||
plasmoid.formFactor === PlasmaCore.Types.Horizontal &&
main.height <= 2 * theme.smallestFont.pixelSize &&
main.height <= 2 * PlasmaCore.Theme.smallestFont.pixelSize &&
(main.showDate || timezoneLabel.visible)
onDateFormatChanged: {
......@@ -177,7 +177,7 @@ Item {
* and still fits well into the panel with all the applied margins.
*/
height: Math.min(main.showDate || timezoneLabel.visible ? main.height * 0.56 : main.height * 0.71,
3 * theme.defaultFont.pixelSize)
3 * PlasmaCore.Theme.defaultFont.pixelSize)
font.pixelSize: sizehelper.height
}
......@@ -252,10 +252,10 @@ Item {
PropertyChanges {
target: sizehelper
height: Math.min(main.height, 3 * theme.defaultFont.pixelSize)
height: Math.min(main.height, 3 * PlasmaCore.Theme.defaultFont.pixelSize)
fontSizeMode: Text.VerticalFit
font.pixelSize: 3 * theme.defaultFont.pixelSize
font.pixelSize: 3 * PlasmaCore.Theme.defaultFont.pixelSize
}
},
......@@ -290,7 +290,7 @@ Item {
height: sizehelper.contentHeight
width: main.width
font.pixelSize: Math.min(timeLabel.height, 3 * theme.defaultFont.pixelSize)
font.pixelSize: Math.min(timeLabel.height, 3 * PlasmaCore.Theme.defaultFont.pixelSize)
fontSizeMode: Text.HorizontalFit
}
......@@ -334,7 +334,7 @@ Item {
width: main.width
fontSizeMode: Text.HorizontalFit
font.pixelSize: 3 * theme.defaultFont.pixelSize
font.pixelSize: 3 * PlasmaCore.Theme.defaultFont.pixelSize
}
},
......@@ -487,8 +487,8 @@ Item {
id: timeLabel
font {
family: plasmoid.configuration.fontFamily || theme.defaultFont.family
weight: plasmoid.configuration.boldText ? Font.Bold : theme.defaultFont.weight
family: plasmoid.configuration.fontFamily || PlasmaCore.Theme.defaultFont.family
weight: plasmoid.configuration.boldText ? Font.Bold : PlasmaCore.Theme.defaultFont.weight
italic: plasmoid.configuration.italicText
pixelSize: 1024
}
......
......@@ -39,11 +39,11 @@ MouseArea {
readonly property bool constrained: plasmoid.formFactor === PlasmaCore.Types.Vertical || plasmoid.formFactor === PlasmaCore.Types.Horizontal
property bool containsAcceptableDrag: false
height: Math.round(PlasmaCore.Units.iconSizes.desktop + 2 * theme.mSize(theme.defaultFont).height)
height: Math.round(PlasmaCore.Units.iconSizes.desktop + 2 * PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height)
width: Math.round(PlasmaCore.Units.iconSizes.desktop * 1.5)
Layout.minimumWidth: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? height : PlasmaCore.Units.iconSizes.small
Layout.minimumHeight: plasmoid.formFactor === PlasmaCore.Types.Vertical ? width : (PlasmaCore.Units.iconSizes.small + 2 * theme.mSize(theme.defaultFont).height)
Layout.minimumHeight: plasmoid.formFactor === PlasmaCore.Types.Vertical ? width : (PlasmaCore.Units.iconSizes.small + 2 * PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height)
Layout.maximumWidth: inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1
Layout.maximumHeight: inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1
......
......@@ -334,7 +334,7 @@ PlasmaExtras.Representation {
id: timeMetrics
text: i18nc("Remaining time for song e.g -5:42", "-%1",
KCoreAddons.Format.formatDuration(seekSlider.to / 1000, expandedRepresentation.durationFormattingOptions))
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
}
PlasmaComponents3.Label { // Time Elapsed
......@@ -343,7 +343,7 @@ PlasmaExtras.Representation {
horizontalAlignment: Text.AlignRight
text: KCoreAddons.Format.formatDuration(seekSlider.value / 1000, expandedRepresentation.durationFormattingOptions)
opacity: 0.9
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
color: PlasmaCore.ColorScope.textColor
}
......@@ -406,7 +406,7 @@ PlasmaExtras.Representation {
text: i18nc("Remaining time for song e.g -5:42", "-%1",
KCoreAddons.Format.formatDuration((seekSlider.to - seekSlider.value) / 1000, expandedRepresentation.durationFormattingOptions))
opacity: 0.9
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
color: PlasmaCore.ColorScope.textColor
}
}
......@@ -415,7 +415,7 @@ PlasmaExtras.Representation {
id: playerControls
property bool enabled: root.canControl
property int controlsSize: theme.mSize(theme.defaultFont).height * 3
property int controlsSize: PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height * 3
Layout.alignment: Qt.AlignHCenter
Layout.bottomMargin: PlasmaCore.Units.smallSpacing
......
......@@ -37,7 +37,7 @@ MouseArea {
|| plasmoid.location === PlasmaCore.Types.LeftEdge)
Layout.minimumWidth: plasmoid.formFactor === PlasmaCore.Types.Horizontal ? height : PlasmaCore.Units.iconSizes.small
Layout.minimumHeight: plasmoid.formFactor === PlasmaCore.Types.Vertical ? width : (PlasmaCore.Units.iconSizes.small + 2 * theme.mSize(theme.defaultFont).height)
Layout.minimumHeight: plasmoid.formFactor === PlasmaCore.Types.Vertical ? width : (PlasmaCore.Units.iconSizes.small + 2 * PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height)
Layout.maximumWidth: inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1
Layout.maximumHeight: inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1
......@@ -88,7 +88,7 @@ MouseArea {
range { from: 0; to: 100; automatic: false }
valueSources: Charts.SingleValueSource { value: compactRoot.jobsPercentage }
colorSource: Charts.SingleValueSource { value: theme.highlightColor }
colorSource: Charts.SingleValueSource { value: PlasmaCore.Theme.highlightColor }
thickness: PlasmaCore.Units.devicePixelRatio * 5
}
......@@ -101,7 +101,7 @@ MouseArea {
fontSizeMode: Text.Fit
font.pointSize: 1024
font.pixelSize: -1
minimumPointSize: 5//theme.smallestFont.pointSize
minimumPointSize: 5//PlasmaCore.Theme.smallestFont.pointSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: compactRoot.unreadCount || ""
......
......@@ -47,7 +47,7 @@ GridLayout {
Layout.alignment: Qt.AlignTop | Qt.AlignRight
text: jobDetails["descriptionLabel" + modelData] && jobDetails["descriptionValue" + modelData]
? i18ndc("plasma_applet_org.kde.plasma.notifications", "Row description, e.g. Source", "%1:", jobDetails["descriptionLabel" + modelData]) : ""
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
textFormat: Text.PlainText
visible: text !== ""
}
......@@ -61,7 +61,7 @@ GridLayout {
Layout.column: 1
Layout.row: index
Layout.fillWidth: true
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
elide: Text.ElideMiddle
textFormat: Text.PlainText
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
......@@ -146,7 +146,7 @@ GridLayout {
return "";
}
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
textFormat: Text.PlainText
visible: text !== ""
}
......@@ -158,7 +158,7 @@ GridLayout {
Layout.fillWidth: true
text: jobDetails.speed > 0 ? i18ndc("plasma_applet_org.kde.plasma.notifications", "Bytes per second", "%1/s",
KCoreAddons.Format.formatByteSize(jobDetails.speed)) : ""
font: theme.smallestFont
font: PlasmaCore.Theme.smallestFont
textFormat: Text.PlainText
visible: text !== ""
}
......
......@@ -237,7 +237,7 @@ RowLayout {
range { from: 0; to: notificationHeading.timeout; automatic: false }
valueSources: Charts.SingleValueSource { value: notificationHeading.remainingTime }
colorSource: Charts.SingleValueSource { value: theme.highlightColor }
colorSource: Charts.SingleValueSource { value: PlasmaCore.Theme.highlightColor }
thickness: Math.max(Math.floor(PlasmaCore.Units.devicePixelRatio), 1) * 5
......
......@@ -66,17 +66,17 @@ Item {
enabled: !Kirigami.Settings.isMobile
color: PlasmaCore.ColorScope.textColor
selectedTextColor: theme.viewBackgroundColor
selectionColor: theme.viewFocusColor
font.capitalization: theme.defaultFont.capitalization
font.family: theme.defaultFont.family
font.italic: theme.defaultFont.italic
font.letterSpacing: theme.defaultFont.letterSpacing
font.pointSize: theme.defaultFont.pointSize
font.strikeout: theme.defaultFont.strikeout
font.underline: theme.defaultFont.underline
font.weight: theme.defaultFont.weight
font.wordSpacing: theme.defaultFont.wordSpacing
selectedTextColor: PlasmaCore.Theme.viewBackgroundColor
selectionColor: PlasmaCore.Theme.viewFocusColor
font.capitalization: PlasmaCore.Theme.defaultFont.capitalization
font.family: PlasmaCore.Theme.defaultFont.family
font.italic: PlasmaCore.Theme.defaultFont.italic
font.letterSpacing: PlasmaCore.Theme.defaultFont.letterSpacing
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize
font.strikeout: PlasmaCore.Theme.defaultFont.strikeout
font.underline: PlasmaCore.Theme.defaultFont.underline
font.weight: PlasmaCore.Theme.defaultFont.weight
font.wordSpacing: PlasmaCore.Theme.defaultFont.wordSpacing
// Work around Qt bug where NativeRendering breaks for non-integer scale factors
// https://bugreports.qt.io/browse/QTBUG-67007
renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering
......
......@@ -166,7 +166,7 @@ Item {
Rectangle {
anchors.fill: parent
color: theme.highlightColor
color: PlasmaCore.Theme.highlightColor
visible: plasmoid.nativeInterface.containment.editMode
}
}
......@@ -77,7 +77,7 @@ KWin.Switcher {
horizontalAlignment: Text.AlignHCenter
text: display
font.bold: true
color: theme.textColor
color: PlasmaCore.Theme.textColor
elide: Text.ElideMiddle
anchors {
left: iconElement.right
......
......@@ -457,7 +457,7 @@ PlasmaCore.ColorScope {
PlasmaComponents3.Button {
Layout.fillWidth: true
font.pointSize: theme.defaultFont.pointSize + 1
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Switch to This Session")
onClicked: initSwitchSession()
visible: sessionsModel.count > 0
......@@ -465,7 +465,7 @@ PlasmaCore.ColorScope {
PlasmaComponents3.Button {
Layout.fillWidth: true
font.pointSize: theme.defaultFont.pointSize + 1
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Start New Session")
onClicked: {
mainStack.pop({immediate:true})
......
......@@ -56,7 +56,7 @@ SessionManagementScreen {
PlasmaComponents3.TextField {
id: passwordBox
font.pointSize: theme.defaultFont.pointSize + 1
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
Layout.fillWidth: true
placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Password")
......
......@@ -117,7 +117,7 @@ Item {
elide: Text.ElideRight
text: mpris2Source.track || i18nd("plasma_lookandfeel_org.kde.lookandfeel", "No media playing")
textFormat: Text.PlainText
font.pointSize: theme.defaultFont.pointSize + 1
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
maximumLineCount: 1
}
......@@ -128,7 +128,7 @@ Item {
// if no artist is given, show player name instead
text: mpris2Source.artist || mpris2Source.identity || ""
textFormat: Text.PlainText
font.pointSize: theme.smallestFont.pointSize + 1
font.pointSize: PlasmaCore.Theme.smallestFont.pointSize + 1
maximumLineCount: 1
}
}
......
......@@ -141,7 +141,7 @@ PlasmaCore.ColorScope {
width: Math.max(implicitWidth, PlasmaCore.Units.gridUnit * 16)
PlasmaComponents.Label {
font.pointSize: theme.defaultFont.pointSize + 1
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
Layout.maximumWidth: PlasmaCore.Units.gridUnit * 16
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
......@@ -156,7 +156,7 @@ PlasmaCore.ColorScope {
}
PlasmaComponents.Label {
font.pointSize: theme.defaultFont.pointSize + 1
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
Layout.maximumWidth: PlasmaCore.Units.gridUnit * 16
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
......@@ -221,7 +221,7 @@ PlasmaCore.ColorScope {
}
PlasmaComponents.Label {
font.pointSize: theme.defaultFont.pointSize + 1
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
Layout.alignment: Qt.AlignHCenter
//opacity, as visible would re-layout
opacity: countDownTimer.running ? 1 : 0
......@@ -247,14 +247,14 @@ PlasmaCore.ColorScope {
Layout.alignment: Qt.AlignHCenter
PlasmaComponents.Button {
implicitWidth: PlasmaCore.Units.gridUnit * 6
font.pointSize: theme.defaultFont.pointSize + 1
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
enabled: root.currentAction !== null
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "OK")
onClicked: root.currentAction()
}
PlasmaComponents.Button {
implicitWidth: PlasmaCore.Units.gridUnit * 6
font.pointSize: theme.defaultFont.pointSize + 1
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Cancel")
onClicked: root.cancelRequested()
}
......
......@@ -35,7 +35,7 @@ ActionButton {
opacity: activeFocus || containsMouse ? 1 : 0.5
labelRendering: Text.QtRendering // Remove once we've solved Qt bug: https://bugreports.qt.io/browse/QTBUG-70138 (KDE bug: https://bugs.kde.org/show_bug.cgi?id=401644)
font.underline: false
font.pointSize: theme.defaultFont.pointSize + 1
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
Behavior on opacity {
OpacityAnimator {
duration: PlasmaCore.Units.longDuration
......
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