Reach the setup wizard from the Options menu

Written-by: Codex (GPT-6.2 Sol)
Written-by: Claude Fable 5.2
This commit is contained in:
Rsclub2_2 committed 2026-11-18 21:32:11 +01:00
1 parent f1e80c6ed3
commit 8352af911e
9 files changed
+85

No files matched your search

@@ -537,3 +537,9 @@ wizard.summary.turnedOff=Wird abgeschaltet: Zweitchat.
wizard.summary.integrationsUnchanged=Logprogramm, Rotor, AirScout und DX-Cluster-Server behalten ihre gespeicherten Werte. Im Einstellungsfenster prüfen.
wizard.summary.none=keine
wizard.summary.passwordSet=gesetzt
menu.setupWizard=Einrichtungsassistent...
alert.setupWizardTitle=Einrichtungsassistent
alert.setupWizardQuestion=Sitzung beenden und den Einrichtungsassistenten starten?
alert.setupWizardBody=Die ON4KST-Verbindung wird geschlossen, und alle Fenster werden nach dem Assistenten neu aufgebaut. Für einzelne Änderungen im laufenden Betrieb ist das Einstellungsfenster da.
dialog.startSetupWizard=Assistent starten
@@ -546,3 +546,9 @@ wizard.summary.turnedOff=Will be switched off: second chat.
wizard.summary.integrationsUnchanged=Log program, rotator, AirScout and DX cluster server keep their stored settings. Check them in the settings window.
wizard.summary.none=none
wizard.summary.passwordSet=set
menu.setupWizard=Setup assistant...
alert.setupWizardTitle=Setup assistant
alert.setupWizardQuestion=End the session and start the setup assistant?
alert.setupWizardBody=The ON4KST connection is closed and all windows are rebuilt after the assistant. For single changes during operation use the settings window.
dialog.startSetupWizard=Start assistant
@@ -4,6 +4,7 @@ import kst4contest.controller.ActiveOperatorProfile;
import kst4contest.controller.OperatorProfilePaths;
import kst4contest.controller.OperatorProfileStore;
import kst4contest.model.OperatorProfile;
import kst4contest.model.OperatorProfileSelection;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -82,6 +83,26 @@ public final class ApplicationRuntimeLauncher {
return SETUP_WIZARD_REQUESTED.getAndSet(false);
}
/**
* Rebuilds the runtime of the active profile with the setup wizard in front of it.
*
* <p>The running runtime is torn down first and the wizard shown afterwards, not the
* other way round: a runtime shutting down flushes its pending layout write, and that
* must not land on the file the wizard has just written.</p>
*
* @return true if the new runtime was built
*/
public static boolean rerunSetupWizard() {
OperatorProfileSelection active = ActiveOperatorProfile.get();
if (active == null) {
return false;
}
requestSetupWizard();
return switchProfile(active.getProfile());
}
/**
* Replaces the running runtime with one bound to another operator profile.
*
@@ -54,6 +54,11 @@ public final class ComposeMenuActions implements MainMenuActions {
application.runOnUi(application::menuActionToggleSettingsWindow);
}
@Override
public void openSetupWizard() {
application.runOnUi(application::menuActionOpenSetupWizard);
}
@Override
public void toggleMonitorWindow() {
application.runOnUi(application::menuActionToggleMonitorWindow);
@@ -4046,6 +4046,27 @@ public class Kst4ContestApplication implements StatusUpdateListener, SettingsHos
}
}
/**
* Options -> setup assistant. Rebuilds the runtime of the active profile with the wizard
* in front of it, which costs the running session; hence the question, and hence the
* settings edits are settled first, as before a profile switch.
*/
void menuActionOpenSetupWizard() {
SettingsWindow.settleThen(() -> {
boolean confirmed = ComposeAlert.confirm(
kst4contest.view.i18n.CurrentStrings.get().getAlertSetupWizardTitle(),
kst4contest.view.i18n.CurrentStrings.get().getAlertSetupWizardQuestion(),
kst4contest.view.i18n.CurrentStrings.get().getAlertSetupWizardBody(),
kst4contest.view.i18n.CurrentStrings.get().getDialogStartSetupWizard(),
kst4contest.view.i18n.CurrentStrings.get().getDialogCancel(),
chatcontroller.getChatPreferences().isGUI_darkModeActive());
if (confirmed) {
ApplicationRuntimeLauncher.rerunSetupWizard();
}
});
}
/** Windows -> open or close the cluster / stranger-QSO monitor window. */
void menuActionToggleMonitorWindow() {
if (MonitorWindow.isOpen()) {
@@ -55,6 +55,9 @@ interface MainMenuActions {
fun setQrgAsNameInChat()
fun toggleAwayState()
fun toggleSettingsWindow()
/** Ends the session after asking and runs the setup wizard for the active profile. */
fun openSetupWizard()
fun toggleMonitorWindow()
fun toggleStationMap()
fun useDarkDesign()
@@ -87,6 +87,11 @@ fun mainMenuModel(
enabled = true,
actions::toggleSettingsWindow,
),
/*
* Always usable, like the profile switch: it rebuilds the runtime and asks before
* it gives the session up.
*/
MenuEntry.Item(strings.menuSetupWizard, state.canSwitchProfile, actions::openSetupWizard),
),
),
MenuSpec(
@@ -28,6 +28,7 @@ class MainMenuModelTest {
override fun setQrgAsNameInChat() { calls += "setQrgAsNameInChat" }
override fun toggleAwayState() { calls += "toggleAwayState" }
override fun toggleSettingsWindow() { calls += "toggleSettingsWindow" }
override fun openSetupWizard() { calls += "openSetupWizard" }
override fun toggleMonitorWindow() { calls += "toggleMonitorWindow" }
override fun toggleStationMap() { calls += "toggleStationMap" }
override fun useDarkDesign() { calls += "useDarkDesign" }
@@ -181,4 +182,19 @@ class MainMenuModelTest {
"every item must reach an action; one of them did nothing",
)
}
@Test
fun theSetupAssistantIsReachableFromOptionsWhateverTheConnection() {
for (connectionState in On4KstConnectionState.values()) {
val actions = RecordingActions()
val model = model(connectionState = connectionState, actions = actions)
val entry = items(model.single { it.title == "Options" }).single { it.label == "Setup assistant..." }
// Like the profile switch: it gives the session up itself, after asking.
assertTrue(entry.enabled, "the assistant must be reachable while $connectionState")
entry.onClick()
assertEquals("openSetupWizard", actions.calls.last())
}
}
}
@@ -55,6 +55,7 @@ class MainMenuRowScreenTest {
override fun setQrgAsNameInChat() { calls += "setQrgAsNameInChat" }
override fun toggleAwayState() { calls += "toggleAwayState" }
override fun toggleSettingsWindow() { calls += "toggleSettingsWindow" }
override fun openSetupWizard() { calls += "openSetupWizard" }
override fun toggleMonitorWindow() { calls += "toggleMonitorWindow" }
override fun toggleStationMap() { calls += "toggleStationMap" }
override fun useDarkDesign() { calls += "useDarkDesign" }
@@ -116,6 +117,7 @@ class MainMenuRowScreenTest {
Triple("Options", "Set QRG as name in Chat (main category)", "setQrgAsNameInChat"),
Triple("Options", "Show me as AWAY FROM chat!", "toggleAwayState"),
Triple("Options", "Show options", "toggleSettingsWindow"),
Triple("Options", "Setup assistant...", "openSetupWizard"),
Triple("Windows", "Show cluster / stranger QSOs", "toggleMonitorWindow"),
Triple("Windows", "Show / hide station map", "toggleStationMap"),
Triple("Windows", "Use dark mode design", "useDarkDesign"),