diff --git a/FloconDesktop/composeApp/src/commonMain/composeResources/values/strings.xml b/FloconDesktop/composeApp/src/commonMain/composeResources/values/strings.xml index e44a64288..ca9753685 100644 --- a/FloconDesktop/composeApp/src/commonMain/composeResources/values/strings.xml +++ b/FloconDesktop/composeApp/src/commonMain/composeResources/values/strings.xml @@ -69,6 +69,8 @@ ADB configuraton is valid Font Size Multiplier : %1$sx Test + About + Licenses Size No Tables Time diff --git a/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/ui/settings/SettingsScreen.kt b/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/ui/settings/SettingsScreen.kt index 20cf83dca..115d0c254 100644 --- a/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/ui/settings/SettingsScreen.kt +++ b/FloconDesktop/composeApp/src/commonMain/kotlin/io/github/openflocon/flocondesktop/app/ui/settings/SettingsScreen.kt @@ -25,10 +25,14 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import co.touchlab.kermit.Logger import flocondesktop.composeapp.generated.resources.Res import flocondesktop.composeapp.generated.resources.general_save +import flocondesktop.composeapp.generated.resources.settings_about_title import flocondesktop.composeapp.generated.resources.settings_adb_setup_title import flocondesktop.composeapp.generated.resources.settings_adb_valid import flocondesktop.composeapp.generated.resources.settings_font_size_multiplier +import flocondesktop.composeapp.generated.resources.settings_licenses import flocondesktop.composeapp.generated.resources.settings_test +import io.github.openflocon.flocondesktop.common.ui.window.FloconWindow +import io.github.openflocon.flocondesktop.common.ui.window.createFloconWindowState import io.github.openflocon.library.designsystem.FloconTheme import io.github.openflocon.library.designsystem.components.FloconButton import io.github.openflocon.library.designsystem.components.FloconFeature @@ -73,6 +77,8 @@ private fun SettingsScreen( onAction: (SettingsAction) -> Unit, modifier: Modifier = Modifier, ) { + var showLicenses by remember { mutableStateOf(false) } + FloconFeature( modifier = modifier.fillMaxSize() ) { @@ -151,6 +157,22 @@ private fun SettingsScreen( ) } } + FloconSection( + title = stringResource(Res.string.settings_about_title), + initialValue = true + ) { + SettingsButton( + onClick = { showLicenses = true }, + text = stringResource(Res.string.settings_licenses), + modifier = Modifier.padding(8.dp) + ) + } + } + + if (showLicenses) { + LicensesWindow( + onCloseRequest = { showLicenses = false } + ) } } @@ -172,6 +194,25 @@ private fun SettingsButton( } } +@Composable +private fun LicensesWindow( + onCloseRequest: () -> Unit +) { + FloconWindow( + title = "Licenses", + state = createFloconWindowState(), + alwaysOnTop = true, + onCloseRequest = onCloseRequest, + ) { + AboutScreen( + modifier = Modifier + .fillMaxSize() + .background(FloconTheme.colorPalette.primary), + ) + } + +} + @Preview @Composable private fun SettingsScreenPreview() { diff --git a/FloconDesktop/composeApp/src/desktopMain/kotlin/io/github/openflocon/flocondesktop/Main.kt b/FloconDesktop/composeApp/src/desktopMain/kotlin/io/github/openflocon/flocondesktop/Main.kt index b6649e0e3..e4c0a2da2 100644 --- a/FloconDesktop/composeApp/src/desktopMain/kotlin/io/github/openflocon/flocondesktop/Main.kt +++ b/FloconDesktop/composeApp/src/desktopMain/kotlin/io/github/openflocon/flocondesktop/Main.kt @@ -1,7 +1,5 @@ package io.github.openflocon.flocondesktop -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect @@ -10,14 +8,11 @@ import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue -import androidx.compose.ui.Modifier import androidx.compose.ui.input.key.Key import androidx.compose.ui.input.key.KeyEventType import androidx.compose.ui.input.key.key import androidx.compose.ui.input.key.type import androidx.compose.ui.window.ApplicationScope -import androidx.compose.ui.window.FrameWindowScope -import androidx.compose.ui.window.MenuBar import androidx.compose.ui.window.Notification import androidx.compose.ui.window.Tray import androidx.compose.ui.window.Window @@ -32,21 +27,17 @@ import flocondesktop.composeapp.generated.resources.app_icon_small import io.github.openflocon.domain.feedback.FeedbackDisplayer import io.github.openflocon.domain.feedback.FeedbackDisplayerHandler import io.github.openflocon.flocondesktop.about.AboutScreen -import io.github.openflocon.flocondesktop.common.ui.window.FloconWindow -import io.github.openflocon.flocondesktop.common.ui.window.createFloconWindowState import io.github.openflocon.flocondesktop.window.MIN_WINDOW_HEIGHT import io.github.openflocon.flocondesktop.window.MIN_WINDOW_WIDTH import io.github.openflocon.flocondesktop.window.WindowStateData import io.github.openflocon.flocondesktop.window.WindowStateSaver import io.github.openflocon.flocondesktop.window.size import io.github.openflocon.flocondesktop.window.windowPosition -import io.github.openflocon.library.designsystem.FloconTheme import io.github.openflocon.library.designsystem.components.escape.LocalEscapeHandlerStack import org.jetbrains.compose.resources.painterResource import org.koin.compose.koinInject import java.awt.Desktop import java.awt.Dimension -import java.util.Locale private const val ACTIVATE_TRAY_NOTIFICATION = false @@ -115,7 +106,6 @@ fun main() { if (ACTIVATE_TRAY_NOTIFICATION) { FloconTray() } - FloconMenu() if (openAbout) { AboutScreen( @@ -127,39 +117,6 @@ fun main() { } } -@Composable -private fun FrameWindowScope.FloconMenu() { - var openLicenses by remember { mutableStateOf(false) } - - MenuBar { - Menu( - text = "Settings" - ) { - Item( - text = "Licences", - onClick = { - openLicenses = true - } - ) - } - } - - if (openLicenses) { - FloconWindow( - title = "Licenses", - state = createFloconWindowState(), - alwaysOnTop = true, - onCloseRequest = { openLicenses = false }, - ) { - io.github.openflocon.flocondesktop.app.ui.settings.AboutScreen( - modifier = Modifier - .fillMaxSize() - .background(FloconTheme.colorPalette.primary), - ) - } - } -} - @Composable private fun ApplicationScope.FloconTray() { val trayState = rememberTrayState()