mirror of https://github.com/qwc/backive.git
struct for saving and message level handling ...
This commit is contained in:
parent
cade8cc379
commit
728af0d9d3
|
@ -13,6 +13,11 @@ import (
|
||||||
"github.com/qwc/backive"
|
"github.com/qwc/backive"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type UISettings struct {
|
||||||
|
hideUntil time.Time
|
||||||
|
globalLevel int
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
app fyne.App
|
app fyne.App
|
||||||
window fyne.Window
|
window fyne.Window
|
||||||
|
@ -20,6 +25,8 @@ var (
|
||||||
db backive.Database
|
db backive.Database
|
||||||
doNotShowUntil time.Time = time.Unix(0, 0)
|
doNotShowUntil time.Time = time.Unix(0, 0)
|
||||||
c net.Conn
|
c net.Conn
|
||||||
|
uisettings UISettings
|
||||||
|
messageLevel int
|
||||||
)
|
)
|
||||||
|
|
||||||
func Init(a fyne.App, w fyne.Window, conf backive.Configuration, d backive.Database) {
|
func Init(a fyne.App, w fyne.Window, conf backive.Configuration, d backive.Database) {
|
||||||
|
@ -85,16 +92,34 @@ func ShallShow(data map[string]string) bool {
|
||||||
if level <= 10 {
|
if level <= 10 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if int(level) <= uisettings.globalLevel && messageLevel > 0 {
|
||||||
return true
|
return false
|
||||||
|
}
|
||||||
|
if int(level) <= uisettings.globalLevel {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetHideUntil(until time.Time) {
|
func SetHideUntil(until time.Time) {
|
||||||
|
uisettings.hideUntil = until
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetMessageLevel(level int) {
|
func SetMessageLevel(level int) {
|
||||||
|
if level <= 10 {
|
||||||
|
messageLevel = level
|
||||||
|
} else {
|
||||||
|
uisettings.globalLevel = level
|
||||||
|
messageLevel = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func SaveSettings() {
|
||||||
|
// save internal settings to file in homedir
|
||||||
|
}
|
||||||
|
|
||||||
|
func LoadSettings() {
|
||||||
|
// load settings
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeTray(app fyne.App) {
|
func makeTray(app fyne.App) {
|
||||||
|
|
Loading…
Reference in New Issue