|
|
@ -1,7 +1,10 @@ |
|
|
|
package debugwriter |
|
|
|
package debugwriter |
|
|
|
|
|
|
|
|
|
|
|
import androidx.compose.desktop.LocalAppWindow |
|
|
|
import androidx.compose.ui.window.application |
|
|
|
import androidx.compose.desktop.Window |
|
|
|
import androidx.compose.ui.window.rememberWindowState |
|
|
|
|
|
|
|
import androidx.compose.ui.window.Window |
|
|
|
|
|
|
|
import androidx.compose.ui.window.WindowState |
|
|
|
|
|
|
|
import androidx.compose.ui.window.WindowPosition |
|
|
|
import androidx.compose.foundation.layout.Column |
|
|
|
import androidx.compose.foundation.layout.Column |
|
|
|
import androidx.compose.foundation.layout.Row |
|
|
|
import androidx.compose.foundation.layout.Row |
|
|
|
import androidx.compose.foundation.layout.Box |
|
|
|
import androidx.compose.foundation.layout.Box |
|
|
@ -20,6 +23,7 @@ import androidx.compose.runtime.setValue |
|
|
|
import androidx.compose.ui.Alignment |
|
|
|
import androidx.compose.ui.Alignment |
|
|
|
import androidx.compose.ui.Modifier |
|
|
|
import androidx.compose.ui.Modifier |
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
import androidx.compose.ui.unit.dp |
|
|
|
|
|
|
|
import androidx.compose.ui.unit.DpSize |
|
|
|
import androidx.compose.ui.unit.IntSize |
|
|
|
import androidx.compose.ui.unit.IntSize |
|
|
|
import debugwriter.decoration.AppTheme |
|
|
|
import debugwriter.decoration.AppTheme |
|
|
|
import kotlinx.coroutines.delay |
|
|
|
import kotlinx.coroutines.delay |
|
|
@ -36,47 +40,54 @@ fun main() { |
|
|
|
output = "Failed to cteate file: $fileName" |
|
|
|
output = "Failed to cteate file: $fileName" |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
Window( |
|
|
|
application { |
|
|
|
title = "DebugWriter", |
|
|
|
val closed = remember { mutableStateOf(false) } |
|
|
|
size = IntSize(650, 450) |
|
|
|
if (!closed.value) { |
|
|
|
) { |
|
|
|
Window( |
|
|
|
val window = LocalAppWindow.current |
|
|
|
onCloseRequest = ::exitApplication, |
|
|
|
|
|
|
|
title = "DebugWriter", |
|
|
|
AppTheme { |
|
|
|
state = WindowState( |
|
|
|
Surface( |
|
|
|
position = WindowPosition.Aligned(Alignment.Center), |
|
|
|
modifier = Modifier.fillMaxSize() |
|
|
|
size = DpSize(650.dp, 450.dp) |
|
|
|
|
|
|
|
) |
|
|
|
) { |
|
|
|
) { |
|
|
|
Box( |
|
|
|
AppTheme { |
|
|
|
modifier = Modifier.fillMaxSize().padding(20.dp), |
|
|
|
Surface( |
|
|
|
contentAlignment = Alignment.Center |
|
|
|
modifier = Modifier.fillMaxSize() |
|
|
|
) { |
|
|
|
) { |
|
|
|
Column { |
|
|
|
Box( |
|
|
|
Header("Click [Refresh] to refresh info or [Open file] to see the output file.") |
|
|
|
modifier = Modifier.fillMaxSize().padding(20.dp), |
|
|
|
if (isReady) { |
|
|
|
contentAlignment = Alignment.Center |
|
|
|
TextBox(output, Modifier.weight(1f).padding(start = 30.dp, end = 30.dp)) |
|
|
|
) { |
|
|
|
} else { |
|
|
|
Column { |
|
|
|
Loader(Modifier.weight(1f).fillMaxWidth()) |
|
|
|
Header("Click [Refresh] to refresh info or [Open file] to see the output file.") |
|
|
|
} |
|
|
|
if (isReady) { |
|
|
|
Row(modifier = Modifier.fillMaxWidth()) { |
|
|
|
TextBox(output, Modifier.weight(1f).padding(start = 30.dp, end = 30.dp)) |
|
|
|
Button("Refresh", Modifier.weight(1f), { writeDebugInfo() }) |
|
|
|
} else { |
|
|
|
Button( |
|
|
|
Loader(Modifier.weight(1f).fillMaxWidth()) |
|
|
|
text = "Open file", |
|
|
|
|
|
|
|
modifier = Modifier.weight(1f), |
|
|
|
|
|
|
|
action = { |
|
|
|
|
|
|
|
if(!revealDebugOutput(fileName)) { |
|
|
|
|
|
|
|
output = "Failed to open file: $fileName" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
) |
|
|
|
Row(modifier = Modifier.fillMaxWidth()) { |
|
|
|
Button("Close", Modifier.weight(1f), { window.close() }) |
|
|
|
Button("Refresh", Modifier.weight(1f), { writeDebugInfo() }) |
|
|
|
|
|
|
|
Button( |
|
|
|
|
|
|
|
text = "Open file", |
|
|
|
|
|
|
|
modifier = Modifier.weight(1f), |
|
|
|
|
|
|
|
action = { |
|
|
|
|
|
|
|
if(!revealDebugOutput(fileName)) { |
|
|
|
|
|
|
|
output = "Failed to open file: $fileName" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
Button("Close", Modifier.weight(1f), { closed.value = true }) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (result) { |
|
|
|
if (result) { |
|
|
|
writeDebugInfo() |
|
|
|
writeDebugInfo() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|