From 379d1b2f2e5596e03d647e710766f84305495051 Mon Sep 17 00:00:00 2001 From: aro Date: Fri, 2 Dec 2022 17:19:45 +0100 Subject: [PATCH] refactor: simpler entrypoint --- .../kotlin/xyz/atnrch/wrench/WrenchApp.kt | 26 +++---------------- .../components/bottom/AddOutputButton.kt | 2 ++ .../components/bottom/RemoveOutputButton.kt | 5 ++++ 3 files changed, 11 insertions(+), 22 deletions(-) create mode 100644 src/main/kotlin/xyz/atnrch/wrench/components/bottom/AddOutputButton.kt create mode 100644 src/main/kotlin/xyz/atnrch/wrench/components/bottom/RemoveOutputButton.kt diff --git a/src/main/kotlin/xyz/atnrch/wrench/WrenchApp.kt b/src/main/kotlin/xyz/atnrch/wrench/WrenchApp.kt index 504a2ed..f844fdc 100644 --- a/src/main/kotlin/xyz/atnrch/wrench/WrenchApp.kt +++ b/src/main/kotlin/xyz/atnrch/wrench/WrenchApp.kt @@ -1,12 +1,9 @@ package xyz.atnrch.wrench -import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.material.MaterialTheme -import androidx.compose.runtime.Composable -import androidx.compose.ui.window.Window -import androidx.compose.ui.window.application -import xyz.atnrch.wrench.logger.Logger +import androidx.compose.ui.window.singleWindowApplication import xyz.atnrch.wrench.components.WrenchScaffold +import xyz.atnrch.wrench.logger.Logger import javax.swing.UIManager class WrenchApp { @@ -14,23 +11,8 @@ class WrenchApp { const val PREFIX: String = "(Wrench)" @JvmStatic - fun main(args: Array) { - application { - Window(onCloseRequest = { - Logger.info("Stopping Wrench...") - Logger.info("bye!") - ::exitApplication.invoke() - }, title = "Wrench") { - Logger.info("Starting Wrench...") - App() - } - } - } - - @Composable - @Preview - @JvmStatic - fun App() { + fun main(args: Array) = singleWindowApplication { + Logger.info("Starting Wrench...") UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) MaterialTheme { WrenchScaffold() } } diff --git a/src/main/kotlin/xyz/atnrch/wrench/components/bottom/AddOutputButton.kt b/src/main/kotlin/xyz/atnrch/wrench/components/bottom/AddOutputButton.kt new file mode 100644 index 0000000..2f68331 --- /dev/null +++ b/src/main/kotlin/xyz/atnrch/wrench/components/bottom/AddOutputButton.kt @@ -0,0 +1,2 @@ +package xyz.atnrch.wrench.components.bottom + diff --git a/src/main/kotlin/xyz/atnrch/wrench/components/bottom/RemoveOutputButton.kt b/src/main/kotlin/xyz/atnrch/wrench/components/bottom/RemoveOutputButton.kt new file mode 100644 index 0000000..aa35762 --- /dev/null +++ b/src/main/kotlin/xyz/atnrch/wrench/components/bottom/RemoveOutputButton.kt @@ -0,0 +1,5 @@ +package xyz.atnrch.wrench.components.bottom + +class RemoveOutputButton(watcherManager: WatcherManager, outputs: MutableList, currentClick: Int) { + +}