Skip to content

Commit 19b3512

Browse files
committed
plus ou moins responsive (bof mais ça va en vrai)
1 parent ca52afa commit 19b3512

File tree

2 files changed

+44
-25
lines changed

2 files changed

+44
-25
lines changed

hyprland.sh

100644100755
File mode changed.

views/main.qml

Lines changed: 44 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,42 @@ import QtQuick.Layouts
44

55
ApplicationWindow {
66
visibility: Window.FullScreen
7-
width: 720
8-
height: 500
7+
width: Screen.width
8+
height: Screen.height
99
title: "STIB Panel"
1010
color: "#111214"
1111

12+
// Reference dimensions for scaling calculations
13+
readonly property real refWidth: 720
14+
readonly property real refHeight: 500
15+
readonly property real scaleFactor: Math.min(width / refWidth, height / refHeight) * 0.6
16+
17+
// Font sizes scaled relative to screen size
18+
readonly property real titleFontSize: Math.max(22 * scaleFactor, 16)
19+
readonly property real normalFontSize: Math.max(16 * scaleFactor, 12)
20+
readonly property real smallFontSize: Math.max(12 * scaleFactor, 10)
21+
readonly property real busNumberFontSize: Math.max(18 * scaleFactor, 14)
22+
1223
ColumnLayout {
1324
anchors.fill: parent
25+
anchors.margins: 20 * scaleFactor
26+
spacing: 10 * scaleFactor
1427

1528
Text {
1629
id: text
1730
text: "Arrêt " + busStopName
1831
color: "#f0f0f0"
19-
font.pixelSize: 22
32+
font.pixelSize: titleFontSize
2033
font.bold: true
21-
padding: 12
22-
Layout.alignment: Qt.AlignVTop | Qt.AlignHCenter
34+
padding: 12 * scaleFactor
35+
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
36+
Layout.topMargin: 10 * scaleFactor
2337
}
2438

2539
Text {
2640
text: busError
2741
color: "#ff9898"
28-
font.pixelSize: 16
42+
font.pixelSize: normalFontSize
2943
Layout.alignment: Qt.AlignHCenter
3044
}
3145

@@ -34,46 +48,50 @@ ApplicationWindow {
3448
objectName: "busLinesModel"
3549
model: busProvider.busData
3650
Layout.alignment: Qt.AlignHCenter
37-
Layout.preferredHeight: 500
38-
Layout.preferredWidth: 500
39-
spacing: 8
51+
Layout.fillWidth: true
52+
Layout.fillHeight: true
53+
Layout.preferredWidth: parent.width * 0.8 // 80% of available width
54+
Layout.maximumWidth: 600 * scaleFactor
55+
spacing: 8 * scaleFactor
4056
clip: true
4157
boundsBehavior: Flickable.StopAtBounds
4258
highlightMoveDuration: 200
4359
highlightFollowsCurrentItem: true
4460

4561
header: ColumnLayout {
62+
width: busLinesView.width
4663
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
4764
Layout.fillWidth: true
65+
4866
Text {
4967
text: "Updated at " + busProvider.lastUpdate
5068
color: "#999999"
51-
font.pixelSize: 12
52-
padding: 4
53-
Layout.alignment: Qt.AlignVTop | Qt.AlignHCenter
69+
font.pixelSize: smallFontSize
70+
padding: 4 * scaleFactor
71+
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
5472
}
5573
}
5674

5775
delegate: RowLayout {
58-
width: parent.width
59-
height: 40
60-
spacing: 12
76+
width: busLinesView.width
77+
height: 40 * scaleFactor
78+
spacing: 12 * scaleFactor
6179

6280
ColumnLayout {
6381
Layout.alignment: Qt.AlignVCenter
6482
Image {
65-
Layout.preferredWidth: 32
66-
Layout.preferredHeight: 32
83+
Layout.preferredWidth: 32 * scaleFactor
84+
Layout.preferredHeight: 32 * scaleFactor
6785
source: lineTypeIcons[modelData.type]
6886
fillMode: Image.PreserveAspectFit
6987
Layout.alignment: Qt.AlignVCenter
7088
}
7189
}
7290

7391
Rectangle {
74-
width: 40
75-
height: 32
76-
radius: 6
92+
width: 40 * scaleFactor
93+
height: 32 * scaleFactor
94+
radius: 6 * scaleFactor
7795
color: modelData.color
7896
border.color: "#f0f0f0"
7997
border.width: 1
@@ -82,23 +100,24 @@ ApplicationWindow {
82100
Text {
83101
text: modelData.line
84102
color: "#f0f0f0"
85-
font.pixelSize: 18
103+
font.pixelSize: busNumberFontSize
86104
font.bold: true
87105
anchors.centerIn: parent
88106
}
89107
}
90108

91109
ColumnLayout {
92110
Layout.fillWidth: true
93-
spacing: 2
111+
spacing: 2 * scaleFactor
94112

95113
Text {
96114
text: modelData.destination
97115
color: "#f0f0f0"
98-
font.pixelSize: 16
116+
font.pixelSize: normalFontSize
99117
font.bold: true
100118
elide: Text.ElideRight
101119
Layout.fillWidth: true
120+
maximumLineCount: 1
102121
}
103122
}
104123

@@ -108,12 +127,12 @@ ApplicationWindow {
108127
Text {
109128
text: modelData.waiting
110129
color: "#f0f0f0"
111-
font.pixelSize: 16
130+
font.pixelSize: normalFontSize
112131
font.bold: true
113132
Layout.alignment: Qt.AlignRight
114133
}
115134
}
116135
}
117136
}
118137
}
119-
}
138+
}

0 commit comments

Comments
 (0)