first commit

This commit is contained in:
aro 2022-11-13 14:55:44 +01:00
commit a41c2c50c8
131 changed files with 703 additions and 0 deletions

View file

@ -0,0 +1,25 @@
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.runtime.remember
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import xyz.atnrch.wrench.display.WrenchDisplay
import xyz.atnrch.wrench.scheduler.FileMover
@Composable
@Preview
fun App() {
MaterialTheme {
val fileMover = remember { FileMover() }
WrenchDisplay(onStartButtonClick = fileMover::start)
}
}
fun main() = application {
Window(onCloseRequest = ::exitApplication, title = "Wrench") {
App()
}
}

View file

@ -0,0 +1,26 @@
package xyz.atnrch.wrench.display
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.Button
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@Composable
fun WrenchDisplay(
onStartButtonClick: () -> Unit
) {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxSize()
) {
Row {
Button(onStartButtonClick) {
Text("Watch")
}
}
}
}

View file

@ -0,0 +1,15 @@
package xyz.atnrch.wrench.io
import java.io.File
class IOManager {
private val paths: List<IOPath>
init {
paths = arrayListOf()
}
fun addFile(file: File) {
val path = IOPath(file, arrayListOf())
}
}

View file

@ -0,0 +1,6 @@
package xyz.atnrch.wrench.io
import java.io.File
import java.nio.file.Path
data class IOPath(val file: File, val map: ArrayList<Path>)

View file

@ -0,0 +1,32 @@
package xyz.atnrch.wrench.scheduler
import kotlinx.coroutines.*
import kotlinx.coroutines.swing.Swing
import java.util.concurrent.TimeUnit
class FileMover {
private var coroutineScope = CoroutineScope(Dispatchers.Swing)
private var isActive = false
fun start() {
if(isActive) return
coroutineScope.launch {
this@FileMover.isActive = true
while (isActive) {
delay(TimeUnit.SECONDS.toMillis(5))
println("Hello world!")
}
}
}
fun pause() {
isActive = false
}
fun stop() {
coroutineScope.cancel()
coroutineScope = CoroutineScope(Dispatchers.Main)
isActive = false
}
}