ScalingService: 1st pass of the refactoring via signals instead of nested bindings for better efficienty and compatibility with old versions of Qt
This commit is contained in:
parent
934c8c61b3
commit
210bbac583
31 changed files with 186 additions and 56 deletions
|
|
@ -16,7 +16,16 @@ Variants {
|
|||
id: root
|
||||
|
||||
required property ShellScreen modelData
|
||||
readonly property real scaling: modelData ? ScalingService.scale(modelData) : 1.0
|
||||
property real scaling: ScalingService.getScreenScale(modelData)
|
||||
|
||||
Connections {
|
||||
target: ScalingService
|
||||
function onScaleChanged(screenName, scale) {
|
||||
if ((modelData !== null) && (screenName === modelData.name)) {
|
||||
scaling = scale
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
active: Settings.isLoaded && modelData && modelData.name ? (Settings.data.bar.monitors.includes(modelData.name)
|
||||
|| (Settings.data.bar.monitors.length === 0)) : false
|
||||
|
|
@ -67,6 +76,7 @@ Variants {
|
|||
widgetName: modelData
|
||||
widgetProps: {
|
||||
"screen": root.modelData || null,
|
||||
"scaling": ScalingService.getScreenScale(screen),
|
||||
"barSection": parent.objectName,
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.left.length
|
||||
|
|
@ -90,9 +100,11 @@ Variants {
|
|||
Repeater {
|
||||
model: Settings.data.bar.widgets.center
|
||||
delegate: NWidgetLoader {
|
||||
|
||||
widgetName: modelData
|
||||
widgetProps: {
|
||||
"screen": root.modelData || null,
|
||||
"scaling": ScalingService.getScreenScale(screen),
|
||||
"barSection": parent.objectName,
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.center.length
|
||||
|
|
@ -120,6 +132,7 @@ Variants {
|
|||
widgetName: modelData
|
||||
widgetProps: {
|
||||
"screen": root.modelData || null,
|
||||
"scaling": ScalingService.getScreenScale(screen),
|
||||
"barSection": parent.objectName,
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.bar.widgets.right.length
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ PopupWindow {
|
|||
property bool isSubMenu: false
|
||||
property bool isHovered: rootMouseArea.containsMouse
|
||||
property ShellScreen screen
|
||||
property real scaling: screen ? ScalingService.scale(screen) : 1.0
|
||||
property real scaling: ScalingService.getScreenScale(screen)
|
||||
|
||||
readonly property int menuWidth: 180
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Row {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
readonly property real minWidth: 160
|
||||
readonly property real maxWidth: 400
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ NIconButton {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
|
||||
sizeRatio: 0.8
|
||||
colorBg: Color.mSurfaceVariant
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Item {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ NIconButton {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
|
||||
visible: Settings.data.network.bluetoothEnabled
|
||||
sizeRatio: 0.8
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Item {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Rectangle {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
|
||||
implicitWidth: clock.width + Style.marginM * 2 * scaling
|
||||
implicitHeight: Math.round(Style.capsuleHeight * scaling)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Row {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Row {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
readonly property real minWidth: 160
|
||||
readonly property real maxWidth: 400
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Item {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ NIconButton {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
|
||||
sizeRatio: 0.8
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ NIconButton {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
|
||||
sizeRatio: 0.8
|
||||
icon: "notifications"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ NIconButton {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
property var powerProfiles: PowerProfiles
|
||||
readonly property bool hasPP: powerProfiles.hasPerformanceProfile
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ NIconButton {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
|
||||
visible: ScreenRecorderService.isRecording
|
||||
icon: "videocam"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ NIconButton {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
|
||||
icon: "widgets"
|
||||
tooltipText: "Open side panel"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Row {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Style.marginS * scaling
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import qs.Widgets
|
|||
Rectangle {
|
||||
id: root
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
|
||||
readonly property real itemSize: Style.baseWidgetSize * 0.8 * scaling
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Rectangle {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
readonly property real itemSize: 24 * scaling
|
||||
|
||||
visible: SystemTray.items.values.length > 0
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Item {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetsCount: 0
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ NIconButton {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
|
||||
visible: Settings.data.network.wifiEnabled
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Item {
|
|||
id: root
|
||||
|
||||
property ShellScreen screen: null
|
||||
property real scaling: ScalingService.scale(screen)
|
||||
property real scaling: 1.0
|
||||
|
||||
property bool isDestroying: false
|
||||
property bool hovered: false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue