diff options
author | ZyanKLee <ZyanKLee@users.noreply.github.com> | 2022-05-24 13:31:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-24 13:31:20 +0200 |
commit | 66eb02fce37a2d5cc82483b1b453abb2bb208ff5 (patch) | |
tree | 44843716da9a57d01d0d5c95c8a48199c8a6b3c5 | |
parent | 1231b3cfd71d33f0689e6f33e6abf14a92ef44e5 (diff) | |
parent | 32953ba47bcd40ed6ba4aeb26671889ac1279c20 (diff) |
Merge pull request #285 from TheDukeofErl/remove-patreon
feat: Remove Patreon and Guilt Messages
-rw-r--r-- | assets/patreon.png | bin | 3410 -> 0 bytes | |||
-rw-r--r-- | config.go | 2 | ||||
-rw-r--r-- | main.go | 3 | ||||
-rw-r--r-- | ui.go | 89 |
4 files changed, 17 insertions, 77 deletions
diff --git a/assets/patreon.png b/assets/patreon.png Binary files differdeleted file mode 100644 index 2a48aa8..0000000 --- a/assets/patreon.png +++ /dev/null @@ -14,7 +14,6 @@ type config struct { Threshold int DisplayMonitorSources bool EnableUpdates bool - GuiltTripped bool FilterInput bool FilterOutput bool LastUsedInput string @@ -33,7 +32,6 @@ func initializeConfigIfNot() { Threshold: 95, DisplayMonitorSources: false, EnableUpdates: true, - GuiltTripped: false, FilterInput: true, FilterOutput: false, LastUsedInput: "", @@ -29,9 +29,6 @@ import ( //go:embed c/ladspa/rnnoise_ladspa.so var libRNNoise []byte -//go:embed assets/patreon.png -var patreonPNG []byte - type device struct { ID string Name string @@ -1,12 +1,8 @@ package main import ( - "bytes" "fmt" - "image" "image/color" - "image/draw" - "image/png" "log" "os" "os/exec" @@ -57,8 +53,6 @@ var red = color.RGBA{255, 70, 70, 255} var orange = color.RGBA{255, 140, 0, 255} var lightBlue = color.RGBA{173, 216, 230, 255} -var patreonImg *image.RGBA - func updatefn(ctx *ntcontext, w *nucular.Window) { currView := ctx.views.Peek() currView(ctx, w) @@ -85,14 +79,7 @@ func mainView(ctx *ntcontext, w *nucular.Window) { w.MenubarEnd() - w.Row(25).Dynamic(2) - if patreonImg == nil { - patreonImg = loadPatreonImg() - } - - if imageButton(w, patreonImg) { - exec.Command("xdg-open", "https://patreon.com/lawl").Run() - } + w.Row(15).Dynamic(1) if ctx.noiseSupressorState == loaded { if (ctx.virtualDeviceInUse) { @@ -194,45 +181,26 @@ func mainView(ctx *ntcontext, w *nucular.Window) { } if ctx.config.FilterOutput && w.TreePush(nucular.TreeTab, "Select Headphones", true) { - if ctx.config.GuiltTripped { - w.Row(15).Dynamic(1) - w.Label("Select an output device below:", "LC") - - for i := range ctx.outputList { - el := &ctx.outputList[i] - - if el.isMonitor && !ctx.config.DisplayMonitorSources { - continue - } - w.Row(15).Static() - w.LayoutFitWidth(0, 0) - if w.CheckboxText("", &el.checked) { - ensureOnlyOneInputSelected(&ctx.outputList, el) - } - - w.LayoutFitWidth(ctx.sourceListColdWidthIndex, 0) - if el.dynamicLatency { - w.Label(el.Name, "LC") - } else { - w.LabelColored("(incompatible?) "+el.Name, "LC", orange) - } + w.Row(15).Dynamic(1) + w.Label("Select an output device below:", "LC") + for i := range ctx.outputList { + el := &ctx.outputList[i] + + if el.isMonitor && !ctx.config.DisplayMonitorSources { + continue } - } else { - w.Row(15).Dynamic(1) - w.Label("This feature is only for patrons.", "LC") - w.Row(15).Dynamic(1) - w.Label("You can still use it eitherway, but you are legally required to feel bad.", "LC") - w.Row(25).Dynamic(2) - if w.ButtonText("Become a patron") { - exec.Command("xdg-open", "https://patreon.com/lawl").Run() - ctx.config.GuiltTripped = true - go writeConfig(ctx.config) + w.Row(15).Static() + w.LayoutFitWidth(0, 0) + if w.CheckboxText("", &el.checked) { + ensureOnlyOneInputSelected(&ctx.outputList, el) } - if w.ButtonText("Feel bad") { - ctx.config.GuiltTripped = true - go writeConfig(ctx.config) + w.LayoutFitWidth(ctx.sourceListColdWidthIndex, 0) + if el.dynamicLatency { + w.Label(el.Name, "LC") + } else { + w.LabelColored("(incompatible?) "+el.Name, "LC", orange) } } @@ -272,7 +240,6 @@ func mainView(ctx *ntcontext, w *nucular.Window) { if (!ctx.config.FilterInput || (ctx.config.FilterInput && inpOk)) && (!ctx.config.FilterOutput || (ctx.config.FilterOutput && outOk)) && (ctx.config.FilterInput || ctx.config.FilterOutput) && - ((ctx.config.FilterOutput && ctx.config.GuiltTripped) || !ctx.config.FilterOutput) && ctx.noiseSupressorState != inconsistent { if w.ButtonText(txt) { ctx.reloadRequired = false @@ -511,25 +478,3 @@ func resetUI(ctx *ntcontext) { ctx.serverInfo.major, ctx.serverInfo.minor, ctx.serverInfo.patch))) } } - -func loadPatreonImg() *image.RGBA { - var pat *image.RGBA - img, _ := png.Decode(bytes.NewReader(patreonPNG)) - pat = image.NewRGBA(img.Bounds()) - draw.Draw(pat, img.Bounds(), img, image.Point{}, draw.Src) - return pat -} - -func imageButton(w *nucular.Window, img *image.RGBA) bool { - style := w.Master().Style() - origButtonStyle := style.Button - style.Button.Border = 0 - style.Button.Normal.Data.Color = style.NormalWindow.Background - style.Button.Hover.Data.Color = style.NormalWindow.Background - style.Button.Active.Data.Color = style.NormalWindow.Background - - defer (func() { style.Button = origButtonStyle })() - - return w.Button(label.I(patreonImg), false) - -} |