Skip to content

Commit 26c53c9

Browse files
authored
Welcome Screen + Prefs QA (#1362)
Set the default editor theme to automatic in defaults.txt. Added a slight delay in file watching to reduce CPU usage. Enhanced the WelcomeSurvey UI with a border for better visual feedback. Refactored zoom preference handling in Interface.kt to use lambdas for up-to-date values.
1 parent f85e3bc commit 26c53c9

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

app/src/main/resources/defaults.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,6 @@ pdex.completion.trigger = false
307307
pdex.suggest.imports = true
308308
# Set to false to disable ctrl/cmd-click jump to definition
309309
pdex.inspectMode.hotkey = true
310+
311+
# Set default theme to automatic based on the users system
312+
preferences.editor.theme=

app/src/processing/app/Preferences.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package processing.app
33
import androidx.compose.runtime.*
44
import kotlinx.coroutines.Dispatchers
55
import kotlinx.coroutines.FlowPreview
6+
import kotlinx.coroutines.delay
67
import kotlinx.coroutines.flow.debounce
78
import kotlinx.coroutines.flow.dropWhile
89
import kotlinx.coroutines.launch
@@ -190,6 +191,7 @@ fun watchFile(file: File): Any? {
190191
if (modified.context() != path.fileName) continue
191192
event = modified
192193
}
194+
delay(10)
193195
}
194196
}
195197
}

app/src/processing/app/ui/WelcomeSurvey.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package processing.app.ui
22

33
import androidx.compose.foundation.Image
44
import androidx.compose.foundation.background
5+
import androidx.compose.foundation.border
56
import androidx.compose.foundation.clickable
67
import androidx.compose.foundation.layout.*
78
import androidx.compose.foundation.shape.RoundedCornerShape
@@ -47,6 +48,7 @@ fun SurveyInvitation() {
4748
.pointerHoverIcon(
4849
PointerIcon.Hand
4950
)
51+
.border(1.dp, MaterialTheme.colorScheme.outlineVariant, RoundedCornerShape(12.dp))
5052
) {
5153
Image(
5254
painter = painterResource("bird.svg"),

app/src/processing/app/ui/preferences/Interface.kt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ class Interface {
126126
?: range.start
127127
)
128128
}
129-
val automatic = currentZoom == range.start
130-
val zoomPerc = "${currentZoom.toInt()}%"
129+
val automatic = { currentZoom == range.start }
130+
val zoomPerc = { "${currentZoom.toInt()}%" }
131131
Row(
132132
horizontalArrangement = Arrangement.spacedBy(16.dp)
133133
) {
@@ -136,16 +136,14 @@ class Interface {
136136
.widthIn(max = 200.dp)
137137
) {
138138
Text(
139-
text = if (automatic) "Auto" else zoomPerc,
139+
text = if (automatic()) "Auto" else zoomPerc(),
140140
)
141141
Slider(
142142
value = currentZoom,
143143
onValueChange = {
144144
currentZoom = it
145-
},
146-
onValueChangeFinished = {
147-
prefs["editor.zoom.auto"] = automatic
148-
updatePreference(zoomPerc)
145+
prefs["editor.zoom.auto"] = automatic()
146+
updatePreference(zoomPerc())
149147
},
150148
valueRange = range,
151149
steps = 3

0 commit comments

Comments
 (0)