aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-11-10 17:38:39 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-11-10 17:38:39 +0100
commit813c5b09fe57021809a4f550d766e43b809e433e (patch)
tree8b301a0161617c71906288adcf893de38ddd2018
parent9781b036f49da10f24b1c81f934fb3bfbbf03878 (diff)
downloadxK-813c5b09fe57021809a4f550d766e43b809e433e.tar.gz
xK-813c5b09fe57021809a4f550d766e43b809e433e.tar.xz
xK-813c5b09fe57021809a4f550d766e43b809e433e.zip
WIP: xA: highlighted icon
-rw-r--r--xA/Makefile2
-rw-r--r--xA/xA.go29
2 files changed, 27 insertions, 4 deletions
diff --git a/xA/Makefile b/xA/Makefile
index cd33028..b597652 100644
--- a/xA/Makefile
+++ b/xA/Makefile
@@ -21,7 +21,7 @@ FyneApp.toml: ../xK-version
Categories = ['Network', 'Chat', 'IRCClient']\n" > $@
.svg.png:
rsvg-convert --output=$@ -- $<
-xA: xA.go proto.go ../xK-version
+xA: xA.go proto.go ../xK-version xA.png xA-highlighted.png
go build -ldflags "-X 'main.projectVersion=$$(cat ../xK-version)'" -o $@ \
-gcflags=all="-N -l"
proto.go: $(tools)/lxdrgen.awk $(tools)/lxdrgen-go.awk ../xC.lxdr
diff --git a/xA/xA.go b/xA/xA.go
index 8150026..c1038e5 100644
--- a/xA/xA.go
+++ b/xA/xA.go
@@ -6,6 +6,7 @@ package main
import (
"bufio"
"context"
+ _ "embed"
"encoding/binary"
"flag"
"fmt"
@@ -31,6 +32,16 @@ var (
debug = flag.Bool("debug", false, "enable debug output")
projectName = "xA"
projectVersion = "?"
+
+ //go:embed xA.png
+ iconNormal []byte
+ //go:embed xA-highlighted.png
+ iconHighlighted []byte
+
+ resourceIconNormal = fyne.NewStaticResource(
+ "xA.png", iconNormal)
+ resourceIconHighlighted = fyne.NewStaticResource(
+ "xA-highlighted.png", iconHighlighted)
)
// --- Theme -------------------------------------------------------------------
@@ -326,7 +337,19 @@ func bufferScrollToBottom() {
// --- UI state refresh --------------------------------------------------------
func refreshIcon() {
- // TODO(p): We can have an icon.
+ highlighted := false
+ for _, b := range buffers {
+ if b.highlighted {
+ highlighted = true
+ break
+ }
+ }
+
+ if highlighted {
+ wWindow.SetIcon(resourceIconHighlighted)
+ } else {
+ wWindow.SetIcon(resourceIconNormal)
+ }
}
func refreshTopic(topic []bufferLineItem) {
@@ -577,9 +600,8 @@ func bufferPrintLine(lines []bufferLine, index int) {
}
func bufferPrintSeparator() {
- // TODO(p): Formatting.
+ // TODO(p): Implement our own, so that it can use the primary colour.
wRichText.Segments = append(wRichText.Segments,
- &widget.TextSegment{Style: widget.RichTextStyleParagraph},
&widget.SeparatorSegment{})
}
@@ -656,6 +678,7 @@ func relayProcessBufferLine(b *buffer, m *RelayEventDataBufferLine) {
bufferScrollToBottom()
}
+ // TODO(p): On mobile, we should probably send notifications.
if line.isHighlight || (!visible && !line.isUnimportant &&
b.kind == RelayBufferKindPrivateMessage) {
beep()