Move licenses from window menu to settings screen (#477)

Co-authored-by: Florent CHAMPIGNY <champigny.florent@gmail.com>
This commit is contained in:
Timo Loewe 2026-01-25 10:29:30 +01:00 committed by GitHub
parent 4d981589e5
commit b8b17dc439
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 43 deletions

View file

@ -69,6 +69,8 @@
<string name="settings_adb_valid">ADB configuraton is valid</string>
<string name="settings_font_size_multiplier">Font Size Multiplier : %1$sx</string>
<string name="settings_test">Test</string>
<string name="settings_about_title">About</string>
<string name="settings_licenses">Licenses</string>
<string name="size">Size</string>
<string name="tables_empty">No Tables</string>
<string name="time">Time</string>

View file

@ -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() {

View file

@ -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()