summaryrefslogtreecommitdiff
path: root/internal/gui/app.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-13 12:44:07 +0300
committerPaul Buetow <paul@buetow.org>2026-04-13 12:44:07 +0300
commit3c2e5839e40db29951ee6db37e55cb2e094e4ce4 (patch)
tree8780c7055f28a58fccdac73af514bad32d464e2d /internal/gui/app.go
parent65430e9876a32988839deb7a70dc1e42da21cf64 (diff)
Release v0.29.0: display card counter (Card X / N) in the GUI status barv0.29.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/gui/app.go')
-rw-r--r--internal/gui/app.go33
1 files changed, 29 insertions, 4 deletions
diff --git a/internal/gui/app.go b/internal/gui/app.go
index ff23acf..40c7dd7 100644
--- a/internal/gui/app.go
+++ b/internal/gui/app.go
@@ -54,8 +54,9 @@ type Application struct {
logViewer *LogViewer
// Navigation buttons
- prevWordBtn *ttwidget.Button
- nextWordBtn *ttwidget.Button
+ prevWordBtn *ttwidget.Button
+ nextWordBtn *ttwidget.Button
+ cardCounterLabel *widget.Label // displays "Card X / N"
// Action buttons
keepButton *ttwidget.Button
@@ -616,22 +617,46 @@ func (a *Application) buildToolbar() (exportButton, archiveButton, helpButton *t
}
// buildStatusSection constructs and returns the status bar at the bottom of
-// the window.
+// the window. It contains the status label, queue status, a card counter
+// ("Card X / N") and the version string.
func (a *Application) buildStatusSection() fyne.CanvasObject {
a.statusLabel = widget.NewLabel("Ready")
a.queueStatusLabel = widget.NewLabel("Queue: Empty")
a.queueStatusLabel.TextStyle = fyne.TextStyle{Italic: true}
+ // Card counter — updated by updateCardCounter whenever navigation changes.
+ a.cardCounterLabel = widget.NewLabel("")
+ a.cardCounterLabel.TextStyle = fyne.TextStyle{Italic: true}
+ a.cardCounterLabel.Alignment = fyne.TextAlignTrailing
+
versionLabel := widget.NewLabel(fmt.Sprintf("v%s", internal.Version))
versionLabel.TextStyle = fyne.TextStyle{Italic: true}
versionLabel.Alignment = fyne.TextAlignTrailing
+ // Right-side column: card counter above version string.
+ rightCol := container.NewVBox(a.cardCounterLabel, versionLabel)
+
return container.NewBorder(
- nil, nil, nil, versionLabel,
+ nil, nil, nil, rightCol,
container.NewVBox(a.statusLabel, widget.NewSeparator(), a.queueStatusLabel),
)
}
+// updateCardCounter refreshes the card-counter label to "Card X / N" where X
+// is the 1-based position of the current word in the combined word list and N
+// is the total number of available words. When no words are present the label
+// is cleared.
+func (a *Application) updateCardCounter(currentIndex, total int) {
+ if a.cardCounterLabel == nil {
+ return
+ }
+ if total == 0 {
+ a.cardCounterLabel.SetText("")
+ return
+ }
+ a.cardCounterLabel.SetText(fmt.Sprintf("Card %d / %d", currentIndex+1, total))
+}
+
// onWindowClosed is called when the window is closed. It stops background
// goroutines, cancels ongoing operations, and shuts down the application.
func (a *Application) onWindowClosed() {