Skip to content

Commit 4dda617

Browse files
committed
feat(AppearanceView): Added padding factor slider and modified default scaling factors for short screens
- Adds a new padding factor slider to the `AppearanceView` to experiment with UI scaling behavior. This allows adjusting paddings dynamically for testing different density levels and layout responsiveness. - Adds a new 100% screen scaling factor for mobile to provide a more natural and consistent visual baseline across devices. Also updates the default UI configuration: - Font size: set to S - Padding: set to XXS These defaults help achieve a cleaner, more compact layout while improving readability and overall UI density on mobile.
1 parent 6f29d5e commit 4dda617

File tree

10 files changed

+157
-71
lines changed

10 files changed

+157
-71
lines changed

mobile/wrapperApp/sources/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ int main(int argc, char* argv[])
1111
{
1212
Q_INIT_RESOURCE(resources);
1313
qputenv("QT_FILE_SELECTORS", "noWebEngine");
14-
qputenv("QT_SCALE_FACTOR", "0.8");
1514

1615
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
1716
qmlRegisterModule("Qt.labs.settings", 1, 1);

ui/StatusQ/src/StatusQ/Core/Theme/Theme.qml

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ SQUtils.QObject {
2020
System
2121
}
2222

23+
enum PaddingFactor {
24+
PaddingXXS,
25+
PaddingXS,
26+
PaddingS,
27+
PaddingM,
28+
PaddingL
29+
}
30+
2331
property ThemePalette palette: Application.styleHints.colorScheme === Qt.ColorScheme.Dark ? statusQDarkTheme : statusQLightTheme
2432

2533
readonly property ThemePalette statusQLightTheme: StatusLightTheme {}
@@ -49,6 +57,10 @@ SQUtils.QObject {
4957
updateFontSize(fontSize)
5058
}
5159

60+
function changePaddingFactor(paddingFactor:int) {
61+
updatePaddingFactor(paddingFactor)
62+
}
63+
5264
readonly property var baseFont: FontLoader {
5365
source: assetPath + "fonts/Inter/Inter-Regular.otf"
5466
}
@@ -179,11 +191,11 @@ SQUtils.QObject {
179191

180192

181193
// Responsive properties used for responsive components (e.g. containers)
182-
property int xlPadding: defaultXlPadding
183-
property int bigPadding: defaultBigPadding
184-
property int padding: defaultPadding
185-
property int halfPadding: defaultHalfPadding
186-
property int smallPadding: defaultSmallPadding
194+
property int xlPadding: defaultXlPadding * dynamicPaddingFactorUnit
195+
property int bigPadding: defaultBigPadding * dynamicPaddingFactorUnit
196+
property int padding: defaultPadding * dynamicPaddingFactorUnit
197+
property int halfPadding: defaultHalfPadding * dynamicPaddingFactorUnit
198+
property int smallPadding: defaultSmallPadding * dynamicPaddingFactorUnit
187199
property int radius: defaultRadius
188200

189201
// Constant properties used for non-responsive components (e.g. buttons)
@@ -200,8 +212,10 @@ SQUtils.QObject {
200212
readonly property real pressedOpacity: 0.7
201213

202214
property int dynamicFontUnits: 0
215+
property real dynamicPaddingFactorUnit: 1.0
203216

204217
readonly property int currentFontSize: d.fontSize
218+
readonly property real currentPaddingFactor: d.paddingFactor
205219

206220
function updateFontSize(fontSize:int) {
207221
d.fontSize = fontSize
@@ -232,12 +246,28 @@ SQUtils.QObject {
232246
}
233247
}
234248

235-
function updatePaddings(basePadding:int) {
236-
xlPadding = basePadding * 2
237-
bigPadding = basePadding * 1.5
238-
padding = basePadding
239-
halfPadding = basePadding / 2
240-
smallPadding = basePadding * 0.625
249+
function updatePaddingFactor(paddingFactor:int) {
250+
d.paddingFactor = paddingFactor
251+
switch (paddingFactor) {
252+
case Theme.PaddingXXS:
253+
dynamicPaddingFactorUnit = 0.4
254+
break;
255+
case Theme.PaddingXS:
256+
dynamicPaddingFactorUnit = 0.6
257+
break;
258+
259+
case Theme.PaddingS:
260+
dynamicPaddingFactorUnit = 0.8
261+
break;
262+
263+
case Theme.PaddingM:
264+
dynamicPaddingFactorUnit = 1
265+
break;
266+
267+
case Theme.PaddingL:
268+
dynamicPaddingFactorUnit = 1.2
269+
break;
270+
}
241271
}
242272

243273
enum AnimationDuration {
@@ -262,5 +292,6 @@ SQUtils.QObject {
262292
id: d
263293

264294
property int fontSize: Theme.FontSizeM
295+
property int paddingFactor: Theme.PaddingM
265296
}
266297
}

ui/app/AppLayouts/Profile/ProfileLayout.qml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,18 @@ StatusSectionLayout {
8787

8888
required property int theme // Theme.Style.xxx
8989
required property int fontSize // Theme.FontSize.xxx
90+
required property int paddingFactor // Theme.PaddingFactor.xxx
9091

9192
required property var whitelistedDomainsModel
92-
93+
9394
signal addressWasShownRequested(string address)
9495
signal connectUsernameRequested(string ensName, string ownerAddress)
9596
signal registerUsernameRequested(string ensName)
9697
signal releaseUsernameRequested(string ensName, string senderAddress, int chainId)
9798

9899
signal themeChangeRequested(int theme)
99100
signal fontSizeChangeRequested(int fontSize)
101+
signal paddingFactorChangeRequested(int paddingFactor)
100102
signal leaveCommunityRequest(string communityId)
101103
signal setCommunityMutedRequest(string communityId, int mutedType)
102104
signal inviteFriends(var communityData)
@@ -374,8 +376,10 @@ StatusSectionLayout {
374376
contentWidth: d.contentWidth
375377
theme: root.theme
376378
fontSize: root.fontSize
379+
paddingFactor: root.paddingFactor
377380
onThemeChangeRequested: (theme) => root.themeChangeRequested(theme)
378381
onFontSizeChangeRequested: (fontSize) => root.fontSizeChangeRequested(fontSize)
382+
onPaddingFactorChangeRequested: (paddingFactor) => root.paddingFactorChangeRequested(paddingFactor)
379383
}
380384
}
381385

ui/app/AppLayouts/Profile/views/AppearanceView.qml

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,26 @@ SettingsContentBase {
1717

1818
required property int theme // Theme.Style.xxx
1919
required property int fontSize // Theme.FontSize.xxx
20+
required property int paddingFactor // Theme.PaddingFactor.xxx
2021

2122
signal themeChangeRequested(int theme)
2223
signal fontSizeChangeRequested(int fontSize)
24+
signal paddingFactorChangeRequested(int paddingFactor)
2325

24-
Item {
26+
content: ColumnLayout {
2527
id: appearanceContainer
26-
anchors.left: !!parent ? parent.left : undefined
27-
anchors.leftMargin: Theme.padding
28+
2829
width: root.contentWidth - 2 * Theme.padding
29-
height: childrenRect.height
30+
spacing: Theme.padding
3031

3132
Rectangle {
3233
id: preview
33-
anchors.top: parent.top
34-
anchors.left: parent.left
35-
anchors.right: parent.right
36-
height: placeholderMessage.implicitHeight +
37-
placeholderMessage.anchors.leftMargin +
38-
placeholderMessage.anchors.rightMargin
34+
35+
Layout.preferredHeight: placeholderMessage.implicitHeight +
36+
placeholderMessage.anchors.leftMargin +
37+
placeholderMessage.anchors.rightMargin
38+
Layout.fillWidth: true
39+
3940
radius: Theme.radius
4041
border.color: Theme.palette.border
4142
color: Theme.palette.transparent
@@ -45,7 +46,8 @@ SettingsContentBase {
4546
anchors.top: parent.top
4647
anchors.left: parent.left
4748
anchors.right: parent.right
48-
anchors.margins: Theme.smallPadding
49+
anchors.margins: Theme.padding
50+
4951
isMessage: true
5052
shouldRepeatHeader: true
5153
messageTimestamp: Date.now()
@@ -60,17 +62,14 @@ SettingsContentBase {
6062
StatusSectionHeadline {
6163
id: sectionHeadlineFontSize
6264
text: qsTr("Text size")
63-
anchors.top: preview.bottom
64-
anchors.topMargin: Theme.bigPadding*2
65-
anchors.left: parent.left
66-
anchors.right: parent.right
65+
Layout.topMargin: 2 * Theme.padding
6766
}
6867

6968
StatusQ.StatusLabeledSlider {
7069
id: fontSizeSlider
71-
anchors.top: sectionHeadlineFontSize.bottom
72-
anchors.topMargin: Theme.padding
73-
width: parent.width
70+
Layout.fillWidth: true
71+
Layout.leftMargin: Theme.smallPadding
72+
Layout.rightMargin: Layout.leftMargin
7473

7574
textRole: "name"
7675
valueRole: "value"
@@ -88,36 +87,51 @@ SettingsContentBase {
8887
onMoved: root.fontSizeChangeRequested(value)
8988
}
9089

90+
StatusSectionHeadline {
91+
text: qsTr("Padding factor")
92+
Layout.topMargin: 2 * Theme.padding
93+
}
94+
95+
StatusQ.StatusLabeledSlider {
96+
Layout.fillWidth: true
97+
Layout.leftMargin: Theme.smallPadding
98+
Layout.rightMargin: Layout.leftMargin
99+
100+
textRole: "name"
101+
valueRole: "value"
102+
model: ListModel {
103+
ListElement { name: qsTr("XXS"); value: Theme.PaddingFactor.PaddingXXS }
104+
ListElement { name: qsTr("XS"); value: Theme.PaddingFactor.PaddingXS }
105+
ListElement { name: qsTr("S"); value: Theme.PaddingFactor.PaddingS }
106+
ListElement { name: qsTr("M"); value: Theme.PaddingFactor.PaddingM }
107+
ListElement { name: qsTr("L"); value: Theme.PaddingFactor.PaddingL }
108+
}
109+
110+
value: root.paddingFactor
111+
112+
onMoved: root.paddingFactorChangeRequested(value)
113+
}
114+
91115
Rectangle {
92-
id: modeSeparator
93-
anchors.top: fontSizeSlider.bottom
94-
anchors.topMargin: Theme.padding*3
95-
anchors.left: parent.left
96-
anchors.right: parent.right
97-
height: 1
116+
Layout.topMargin: Theme.xlPadding
117+
Layout.preferredHeight: 1
118+
Layout.fillWidth: true
98119
color: Theme.palette.separator
99120
}
100121

101122
StatusSectionHeadline {
102-
id: sectionHeadlineAppearance
103123
text: qsTr("Mode")
104-
anchors.top: modeSeparator.bottom
105-
anchors.topMargin: Theme.padding*3
106-
anchors.left: parent.left
107-
anchors.right: parent.right
124+
Layout.topMargin: Theme.xlPadding
108125
}
109126

110127
RowLayout {
111-
id: appearanceSection
112-
anchors.top: sectionHeadlineAppearance.bottom
113-
anchors.topMargin: Theme.padding
114-
anchors.left: parent.left
115-
anchors.right: parent.right
128+
id: modeRow
129+
130+
Layout.fillWidth: true
116131
spacing: Theme.halfPadding
117132

118133
StatusImageRadioButton {
119-
Layout.preferredWidth: parent.width/3 - parent.spacing
120-
Layout.preferredHeight: implicitHeight
134+
Layout.fillWidth: true
121135
image.source: Theme.png("appearance-light")
122136
control.text: qsTr("Light")
123137
control.checked: root.theme === Theme.Style.Light
@@ -129,7 +143,7 @@ SettingsContentBase {
129143
}
130144

131145
StatusImageRadioButton {
132-
Layout.preferredWidth: parent.width/3 - parent.spacing
146+
Layout.fillWidth: true
133147
image.source: Theme.png("appearance-dark")
134148
control.text: qsTr("Dark")
135149
control.checked: root.theme === Theme.Style.Dark
@@ -141,7 +155,7 @@ SettingsContentBase {
141155
}
142156

143157
StatusImageRadioButton {
144-
Layout.preferredWidth: parent.width/3 - parent.spacing
158+
Layout.fillWidth: true
145159
image.source: Theme.png("appearance-system")
146160
control.text: qsTr("System")
147161
control.checked: root.theme === Theme.Style.System

ui/app/mainui/AppMain.qml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,11 +869,23 @@ Item {
869869
property var recentEmojis
870870
property string skinColor // NB: must be a string for the twemoji lib to work; we don't want the `#` in the name
871871
property int theme: Theme.Style.System
872-
property int fontSize: Theme.FontSize.FontSizeM
872+
property int fontSize: {
873+
if (appMain.width < Theme.portraitBreakpoint.width) {
874+
return Theme.FontSize.FontSizeS
875+
}
876+
return Theme.FontSize.FontSizeM
877+
}
878+
property int paddingFactor: {
879+
if (appMain.width < Theme.portraitBreakpoint.width) {
880+
return Theme.PaddingFactor.PaddingXXS
881+
}
882+
return Theme.PaddingFactor.PaddingM
883+
}
873884

874885
Component.onCompleted: {
875886
Theme.changeTheme(appMainLocalSettings.theme)
876887
Theme.changeFontSize(appMainLocalSettings.fontSize)
888+
Theme.changePaddingFactor(appMainLocalSettings.paddingFactor)
877889
}
878890
}
879891

@@ -2118,6 +2130,7 @@ Item {
21182130

21192131
theme: appMainLocalSettings.theme
21202132
fontSize: appMainLocalSettings.fontSize
2133+
paddingFactor: appMainLocalSettings.paddingFactor
21212134

21222135
whitelistedDomainsModel: appMainLocalSettings.whitelistedUnfurledDomains
21232136

@@ -2135,6 +2148,10 @@ Item {
21352148
appMainLocalSettings.fontSize = fontSize
21362149
Theme.changeFontSize(fontSize)
21372150
}
2151+
onPaddingFactorChangeRequested: function(paddingFactor) {
2152+
appMainLocalSettings.paddingFactor = paddingFactor
2153+
Theme.changePaddingFactor(paddingFactor)
2154+
}
21382155
// Communities related settings view:
21392156
onLeaveCommunityRequest: appMain.communitiesStore.leaveCommunity(communityId)
21402157
onSetCommunityMutedRequest: appMain.communitiesStore.setCommunityMuted(communityId, mutedType)

ui/i18n/qml_base_en.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,14 @@ from &quot;%1&quot; to &quot;%2&quot;</source>
21402140
<source>Mode</source>
21412141
<translation type="unfinished"></translation>
21422142
</message>
2143+
<message>
2144+
<source>Padding factor</source>
2145+
<translation type="unfinished"></translation>
2146+
</message>
2147+
<message>
2148+
<source>XXS</source>
2149+
<translation type="unfinished"></translation>
2150+
</message>
21432151
<message>
21442152
<source>Light</source>
21452153
<translation type="unfinished"></translation>

ui/i18n/qml_base_lokalise_en.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2627,6 +2627,16 @@
26272627
<comment>AppearanceView</comment>
26282628
<translation>Mode</translation>
26292629
</message>
2630+
<message>
2631+
<source>Padding factor</source>
2632+
<comment>AppearanceView</comment>
2633+
<translation>Padding factor</translation>
2634+
</message>
2635+
<message>
2636+
<source>XXS</source>
2637+
<comment>AppearanceView</comment>
2638+
<translation>XXS</translation>
2639+
</message>
26302640
<message>
26312641
<source>Light</source>
26322642
<comment>AppearanceView</comment>

ui/i18n/qml_cs.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,17 +2147,25 @@ from &quot;%1&quot; to &quot;%2&quot;</source>
21472147
<source>Mode</source>
21482148
<translation>Režim</translation>
21492149
</message>
2150+
<message>
2151+
<source>Padding factor</source>
2152+
<translation type="unfinished"></translation>
2153+
</message>
2154+
<message>
2155+
<source>XXS</source>
2156+
<translation type="unfinished"></translation>
2157+
</message>
21502158
<message>
21512159
<source>Light</source>
2152-
<translation>Světlý</translation>
2160+
<translation type="unfinished"></translation>
21532161
</message>
21542162
<message>
21552163
<source>Dark</source>
2156-
<translation>Tmavý</translation>
2164+
<translation type="unfinished"></translation>
21572165
</message>
21582166
<message>
21592167
<source>System</source>
2160-
<translation>Systémový</translation>
2168+
<translation type="unfinished">Systémový</translation>
21612169
</message>
21622170
</context>
21632171
<context>

0 commit comments

Comments
 (0)