Using proper Style everywhere
This commit is contained in:
parent
d8debd2429
commit
33217e33ed
5 changed files with 66 additions and 61 deletions
|
|
@ -3,15 +3,17 @@ import Quickshell
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
import qs.Services
|
||||||
import qs.Theme
|
import qs.Theme
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
readonly property real scaling: Scaling.scale(screen)
|
||||||
property var modelData
|
property var modelData
|
||||||
|
|
||||||
screen: modelData
|
screen: modelData
|
||||||
implicitHeight: 36
|
implicitHeight: Style.barHeight * scaling
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
|
|
@ -31,12 +33,12 @@ PanelWindow {
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
// Just testing
|
// Just testing
|
||||||
NoctaliaToggle {
|
NToggle {
|
||||||
label: "Label"
|
label: "Label"
|
||||||
description: "Description"
|
description: "Description"
|
||||||
}
|
}
|
||||||
|
|
||||||
NoctaliaIconButton {
|
NIconButton {
|
||||||
icon: "refresh"
|
icon: "refresh"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,9 @@ Singleton {
|
||||||
readonly property int designScreenHeight: 1440
|
readonly property int designScreenHeight: 1440
|
||||||
|
|
||||||
// Automatic, orientation-agnostic scaling
|
// Automatic, orientation-agnostic scaling
|
||||||
function scale(currentScreen) {
|
function scale(aScreen) {
|
||||||
return 1.0
|
if (typeof aScreen !== 'undefined' & aScreen) {
|
||||||
|
|
||||||
// // 1) Per-monitor override wins
|
// // 1) Per-monitor override wins
|
||||||
// try {
|
// try {
|
||||||
// const overrides = Settings.settings.monitorScaleOverrides || {};
|
// const overrides = Settings.settings.monitorScaleOverrides || {};
|
||||||
|
|
@ -37,8 +38,9 @@ Singleton {
|
||||||
// } catch (e) {
|
// } catch (e) {
|
||||||
// // ignore and fall through
|
// // ignore and fall through
|
||||||
// }
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
// // 3) Safe default
|
// 3) Safe default
|
||||||
// return 1.0
|
return 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ Singleton {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Font
|
// Font
|
||||||
property real fontExtraLarge: 32
|
property real fontExtraLarge: 20
|
||||||
property real fontLarge: 16
|
property real fontLarge: 14
|
||||||
property real fontMedium: 14
|
property real fontMedium: 10
|
||||||
property real fontSmall: 12
|
property real fontSmall: 8
|
||||||
|
|
||||||
// Font weight
|
// Font weight
|
||||||
property int fontWeightRegular: 400
|
property int fontWeightRegular: 400
|
||||||
|
|
@ -43,4 +43,7 @@ Singleton {
|
||||||
property int animationFast: 150
|
property int animationFast: 150
|
||||||
property int animationNormal: 300
|
property int animationNormal: 300
|
||||||
property int animationSlow: 500
|
property int animationSlow: 500
|
||||||
|
|
||||||
|
property int barHeight: 36
|
||||||
|
property int baseWidgetHeight: 32
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,8 @@ import qs.Theme
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// Local scale convenience with safe fallback
|
readonly property real scaling: Scaling.scale(screen)
|
||||||
readonly property real scale: (typeof screen !== 'undefined'
|
property real size: Style.baseWidgetHeight * scaling
|
||||||
&& screen) ? Scaling.scale(screen) : 1.0
|
|
||||||
|
|
||||||
property real size: 32 * scale
|
|
||||||
property string icon
|
property string icon
|
||||||
property bool enabled: true
|
property bool enabled: true
|
||||||
property bool hovering: false
|
property bool hovering: false
|
||||||
|
|
@ -27,7 +24,7 @@ Rectangle {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: root.icon
|
text: root.icon
|
||||||
font.family: "Material Symbols Outlined"
|
font.family: "Material Symbols Outlined"
|
||||||
font.pixelSize: 24 * scale
|
font.pointSize: Style.fontExtraLarge * scaling
|
||||||
color: root.hovering ? Theme.onAccent : Theme.textPrimary
|
color: root.hovering ? Theme.onAccent : Theme.textPrimary
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
|
||||||
|
|
@ -8,31 +8,29 @@ import qs.Theme
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// Local scale convenience with safe fallback
|
readonly property real scaling: Scaling.scale(screen)
|
||||||
readonly property real scale: (typeof screen !== 'undefined'
|
|
||||||
&& screen) ? Scaling.scale(screen) : 1.0
|
|
||||||
|
|
||||||
property string label: ""
|
property string label: ""
|
||||||
property string description: ""
|
property string description: ""
|
||||||
property bool value: false
|
property bool value: false
|
||||||
|
property bool hovering: false
|
||||||
property var onToggled: function (value: bool) {}
|
property var onToggled: function (value: bool) {}
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: 4 * scale
|
spacing: 2 * scaling
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: label
|
text: label
|
||||||
font.pixelSize: 13 * scale
|
font.pointSize: Style.fontMedium * scaling
|
||||||
font.bold: true
|
font.bold: true
|
||||||
color: Theme.textPrimary
|
color: Theme.textPrimary
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: description
|
text: description
|
||||||
font.pixelSize: 12 * scale
|
font.pointSize: Style.fontSmall * scaling
|
||||||
color: Theme.textSecondary
|
color: Theme.textSecondary
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -42,22 +40,22 @@ RowLayout {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: switcher
|
id: switcher
|
||||||
|
|
||||||
width: 52 * scale
|
width: Style.baseWidgetHeight * 1.625 * scaling
|
||||||
height: 32 * scale
|
height: Style.baseWidgetHeight * scaling
|
||||||
radius: height / 2
|
radius: height * 0.5
|
||||||
color: value ? Theme.accentPrimary :Theme.surfaceVariant
|
color: value ? Theme.accentPrimary :Theme.surfaceVariant
|
||||||
border.color: value ? Theme.accentPrimary : Theme.outline
|
border.color: value ? Theme.accentPrimary : Theme.outline
|
||||||
border.width: 2 * scale
|
border.width: Math.max(1, 1.5 * scale)
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 28 * scale
|
width: (Style.baseWidgetHeight- 4) * scaling
|
||||||
height: 28 * scale
|
height: (Style.baseWidgetHeight - 4) * scaling
|
||||||
radius: height / 2
|
radius: height * 0.5
|
||||||
color: Theme.surface
|
color: Theme.surface
|
||||||
border.color: Theme.outline
|
border.color: hovering ? Theme.textDisabled : Theme.outline
|
||||||
border.width: 1 * scale
|
border.width: Math.max(1, 1.5 * scale)
|
||||||
y: 2 * scale
|
y: 2 * scaling
|
||||||
x: value ? switcher.width - width - 2 * scale : 2 * scale
|
x: value ? switcher.width - width - 2 * scale : 2 * scaling
|
||||||
|
|
||||||
Behavior on x {
|
Behavior on x {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
|
@ -70,6 +68,9 @@ RowLayout {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: hovering = true
|
||||||
|
onExited: hovering = false
|
||||||
onClicked: {
|
onClicked: {
|
||||||
value = !value;
|
value = !value;
|
||||||
root.onToggled(value);
|
root.onToggled(value);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue