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