aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlawl <github@dumbinter.net>2020-07-16 17:53:19 +0200
committerlawl <github@dumbinter.net>2020-07-16 17:53:19 +0200
commit806a0464cfd8c4face2c0f7d7ec9d05022d6e664 (patch)
tree5baf7f0fb8e7d16a3b64261bffa8659ff7fc6b47
parent0ca9621aa2a59ed322c521615f12915eaf02bb33 (diff)
downloadnoisetorch-806a0464cfd8c4face2c0f7d7ec9d05022d6e664.tar.gz
noisetorch-806a0464cfd8c4face2c0f7d7ec9d05022d6e664.zip
Add UI hint to reload on setting change, fixes #8
-rw-r--r--ui.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/ui.go b/ui.go
index 3e363fb..334d83f 100644
--- a/ui.go
+++ b/ui.go
@@ -26,6 +26,7 @@ type uistate struct {
licenseTextArea nucular.TextEditor
masterWindow *nucular.MasterWindow
update updateui
+ reloadRequired bool
}
var green = color.RGBA{34, 187, 69, 255}
@@ -108,9 +109,15 @@ func updatefn(w *nucular.Window, ui *uistate) {
}
if w.SliderInt(0, &ui.config.Threshold, 95, 1) {
go writeConfig(ui.config)
+ ui.reloadRequired = true
}
w.Label(fmt.Sprintf("%d%%", ui.config.Threshold), "RC")
+ if ui.reloadRequired {
+ w.Row(20).Dynamic(1)
+ w.LabelColored("Reloading NoiseTorch is required to apply these changes.", "LC", orange)
+ }
+
w.TreePop()
}
if w.TreePush(nucular.TreeTab, "Select Device", true) {
@@ -140,6 +147,7 @@ func updatefn(w *nucular.Window, ui *uistate) {
if ui.noiseSupressorState != unloaded {
if w.ButtonText("Unload NoiseTorch") {
ui.loadingScreen = true
+ ui.reloadRequired = false
go func() { // don't block the UI thread, just display a working screen so user can't run multiple loads/unloads
if err := unloadSupressor(ui.paClient); err != nil {
log.Println(err)
@@ -164,6 +172,7 @@ func updatefn(w *nucular.Window, ui *uistate) {
if inp, ok := inputSelection(ui); ok && ui.noiseSupressorState != inconsistent {
if w.ButtonText(txt) {
ui.loadingScreen = true
+ ui.reloadRequired = false
go func() { // don't block the UI thread, just display a working screen so user can't run multiple loads/unloads
if ui.noiseSupressorState == loaded {
if err := unloadSupressor(ui.paClient); err != nil {