From 32d5a5abdfe67a0d71a2e2ed80ff9a82902e8d87 Mon Sep 17 00:00:00 2001 From: Stef Tervelde Date: Thu, 18 Dec 2025 07:45:14 +0100 Subject: [PATCH] Welcome Screen + Prefs QA 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. --- app/src/main/resources/defaults.txt | 3 +++ app/src/processing/app/Preferences.kt | 2 ++ app/src/processing/app/ui/WelcomeSurvey.kt | 2 ++ app/src/processing/app/ui/preferences/Interface.kt | 12 +++++------- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/src/main/resources/defaults.txt b/app/src/main/resources/defaults.txt index 6e3e00f0d6..c979747bd7 100644 --- a/app/src/main/resources/defaults.txt +++ b/app/src/main/resources/defaults.txt @@ -307,3 +307,6 @@ pdex.completion.trigger = false pdex.suggest.imports = true # Set to false to disable ctrl/cmd-click jump to definition pdex.inspectMode.hotkey = true + +# Set default theme to automatic based on the users system +preferences.editor.theme= \ No newline at end of file diff --git a/app/src/processing/app/Preferences.kt b/app/src/processing/app/Preferences.kt index 48416a8d39..bd75896afa 100644 --- a/app/src/processing/app/Preferences.kt +++ b/app/src/processing/app/Preferences.kt @@ -3,6 +3,7 @@ package processing.app import androidx.compose.runtime.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.delay import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.dropWhile import kotlinx.coroutines.launch @@ -190,6 +191,7 @@ fun watchFile(file: File): Any? { if (modified.context() != path.fileName) continue event = modified } + delay(10) } } } diff --git a/app/src/processing/app/ui/WelcomeSurvey.kt b/app/src/processing/app/ui/WelcomeSurvey.kt index c7a110a87c..c0ebb23acf 100644 --- a/app/src/processing/app/ui/WelcomeSurvey.kt +++ b/app/src/processing/app/ui/WelcomeSurvey.kt @@ -2,6 +2,7 @@ package processing.app.ui import androidx.compose.foundation.Image import androidx.compose.foundation.background +import androidx.compose.foundation.border import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.RoundedCornerShape @@ -47,6 +48,7 @@ fun SurveyInvitation() { .pointerHoverIcon( PointerIcon.Hand ) + .border(1.dp, MaterialTheme.colorScheme.outlineVariant, RoundedCornerShape(12.dp)) ) { Image( painter = painterResource("bird.svg"), diff --git a/app/src/processing/app/ui/preferences/Interface.kt b/app/src/processing/app/ui/preferences/Interface.kt index be0ee833c0..6a07b83f11 100644 --- a/app/src/processing/app/ui/preferences/Interface.kt +++ b/app/src/processing/app/ui/preferences/Interface.kt @@ -126,8 +126,8 @@ class Interface { ?: range.start ) } - val automatic = currentZoom == range.start - val zoomPerc = "${currentZoom.toInt()}%" + val automatic = { currentZoom == range.start } + val zoomPerc = { "${currentZoom.toInt()}%" } Row( horizontalArrangement = Arrangement.spacedBy(16.dp) ) { @@ -136,16 +136,14 @@ class Interface { .widthIn(max = 200.dp) ) { Text( - text = if (automatic) "Auto" else zoomPerc, + text = if (automatic()) "Auto" else zoomPerc(), ) Slider( value = currentZoom, onValueChange = { currentZoom = it - }, - onValueChangeFinished = { - prefs["editor.zoom.auto"] = automatic - updatePreference(zoomPerc) + prefs["editor.zoom.auto"] = automatic() + updatePreference(zoomPerc()) }, valueRange = range, steps = 3