Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.9 Rewrite #6

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package config

import (
"fyne.io/fyne/v2"
"sync"
)

const (
OSCOutPort = "OSCOutPort"
OSCPort = "OSCPort"
OSCAddr = "OSCAddr"
ClipPath = "clipPath"
ClipInvert = "clipInvert"
ClientMessage = "message"

EnableHttpClient = "enableHttpClient"
HTTPPort = "httpPort"

EnableOSCClient = "enableOSCClient"
OSCClientAddr = "OSCClientAddr"
OSCClientPort = "OSCClientPort"

AlertTime = "alertTime"
)

var (
StringConfig = make(map[string]string)
IntConfig = make(map[string]int)
BoolConfig = make(map[string]bool)

DefaultStringConfig = map[string]string{
OSCOutPort: "7001",
OSCPort: "7000",
OSCAddr: "127.0.0.1",
HTTPPort: "8080",
ClipPath: "",
ClientMessage: "",
OSCClientAddr: "",
OSCClientPort: "",
}
DefaultIntConfig = map[string]int{
AlertTime: 10,
}
DefaultBoolConfig = map[string]bool{
ClipInvert: false,
EnableOSCClient: false,
EnableHttpClient: true,
}

m = sync.RWMutex{}

a fyne.App
)

func SetString(key string, value string) {
m.Lock()
defer m.Unlock()
StringConfig[key] = value
}

func GetString(key string) string {
m.RLock()
defer m.RUnlock()
return StringConfig[key]
}

func SetInt(key string, value int) {
m.Lock()
defer m.Unlock()
IntConfig[key] = value
}

func GetInt(key string) int {
m.RLock()
defer m.RUnlock()
return IntConfig[key]
}

func SetBool(key string, value bool) {
m.Lock()
defer m.Unlock()
BoolConfig[key] = value
}

func GetBool(key string) bool {
m.RLock()
defer m.RUnlock()
return BoolConfig[key]
}

func StoreValues() {
m.RLock()
defer m.RUnlock()
for key, value := range StringConfig {
a.Preferences().SetString(key, value)
}
for key, value := range IntConfig {
a.Preferences().SetInt(key, value)
}
for key, value := range BoolConfig {
a.Preferences().SetBool(key, value)
}
}

func loadValues() {
m.Lock()
defer m.Unlock()
for key, value := range DefaultStringConfig {
StringConfig[key] = a.Preferences().StringWithFallback(key, value)
}
for key, value := range DefaultIntConfig {
IntConfig[key] = a.Preferences().IntWithFallback(key, value)
}
for key, value := range DefaultBoolConfig {
BoolConfig[key] = a.Preferences().BoolWithFallback(key, value)
}
}

func Init(app fyne.App) {
a = app
loadValues()
}
75 changes: 0 additions & 75 deletions distributor.go

This file was deleted.

16 changes: 7 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
module github.com/chabad360/resolume-timecode
module resolume-timecode

go 1.17

require (
fyne.io/fyne/v2 v2.1.4
github.com/chabad360/go-osc v0.0.0-20220217020417-1229c4fc60a5
github.com/chabad360/go-osc v0.0.0-20220505223708-c2e3ef7101f3
github.com/francoispqt/gojay v1.2.13
nhooyr.io/websocket v1.8.7
)

require (
fyne.io/systray v1.9.1-0.20220318224641-d5779bfb17d1 // indirect
github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect
github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 // indirect
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211213063430-748e38ca8aec // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff // indirect
github.com/gopherjs/gopherjs v0.0.0-20211219123610-ec9572f70e60 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/srwiley/oksvg v0.0.0-20211104221756-aeb4ca2c1505 // indirect
github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780 // indirect
github.com/stretchr/testify v1.7.0 // indirect
github.com/yuin/goldmark v1.4.4 // indirect
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee // indirect
golang.org/x/net v0.0.0-20211116231205-47ca1ff31462 // indirect
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect
)
Loading