Commit ce721e07 authored by David's avatar David

Got the boolean fixed.

parent 0fb09bef
package `is`.kow.deskscreen.camera
import javafx.beans.binding.Bindings
import javafx.beans.binding.BooleanBinding
import javafx.beans.property.SimpleObjectProperty
import javafx.geometry.Pos
import javafx.scene.control.ProgressBar
import javafx.scene.layout.Priority
import mu.KotlinLogging
import org.kordamp.ikonli.fontawesome5.FontAwesomeSolid
import org.kordamp.ikonli.javafx.FontIcon
import tornadofx.*
......@@ -23,17 +25,25 @@ class CameraState {
}
class CameraStateModel : ItemViewModel<CameraState>() {
private val logger = KotlinLogging.logger {}
val image: SimpleObjectProperty<BufferedImage> = bind(CameraState::imageProperty)
val state: SimpleObjectProperty<PictureTakingState> = bind(CameraState::stateProperty)
val previewing = Bindings.equal(PictureTakingState.PREVIEWING, state)
val readyToTake = Bindings.equal(PictureTakingState.READY, state) //Huh, why isn't that true to start with....
val previewing: BooleanBinding = Bindings.equal(PictureTakingState.PREVIEWING, state)
val readyToTake: BooleanBinding = Bindings.equal(PictureTakingState.READY, state) //Huh, why isn't that true to start with....
}
class CameraView : View() {
private val logger = KotlinLogging.logger {}
private val cameraLoadingView: CameraLoadingView by inject()
private val cameraStateModel: CameraStateModel by inject()
init {
//set up the state, it's weird that I even have to do this, the initial value doesn't work
cameraStateModel.state.set(PictureTakingState.READY)
}
override val root = borderpane {
//Left and right can be 160px max
......@@ -45,6 +55,7 @@ class CameraView : View() {
alignment = Pos.CENTER
button("", FontIcon.of(FontAwesomeSolid.CHECK_SQUARE, 60)) {
//WHYYYYY
enableWhen {
cameraStateModel.previewing
}
......@@ -56,13 +67,11 @@ class CameraView : View() {
//Kinda want a space in-between these two
button("Take Picture!") {
//Call the controller action that updates the model and starts the count down
enableWhen {
//this should start off enabled, but it's not... that's weird.
cameraStateModel.readyToTake
}
enableWhen(cameraStateModel.readyToTake)
}
label("Delay to take picture")
hbox {
label("Delay to take picture")
progressbar {
//countdown timer for photo taking
//Set max width to the same as something?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment