summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-05-15 22:36:49 +0300
committerPaul Buetow <paul@buetow.org>2025-05-15 23:35:37 +0300
commit0844f52b45138f14a182f10453d8938978c95505 (patch)
tree24443f73625c6c3da2831f8e4daafa00f32b67b6
parentaf6d1013db54295e1f45c76a5e5c04429a853912 (diff)
improvements
-rw-r--r--.gitignore3
-rw-r--r--FyneApp.toml2
-rw-r--r--README.md14
-rw-r--r--main.go102
4 files changed, 107 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2c12244
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+fyne-cross
+quicklogger
+tmp-pkg
diff --git a/FyneApp.toml b/FyneApp.toml
index 960038a..226fec5 100644
--- a/FyneApp.toml
+++ b/FyneApp.toml
@@ -5,4 +5,4 @@ Website = "https://codeberg.org/snonux/quicklogger"
Name = "quicklogger"
ID = "org.buetow.quicklogger"
Version = "0.0.1"
- Build = 14
+ Build = 26
diff --git a/README.md b/README.md
index 5cc3571..bedeaaa 100644
--- a/README.md
+++ b/README.md
@@ -17,3 +17,17 @@ This are screenshots of the App running on Android and Fedora Linux.
2. Clone Quicklogger: `git clone https://codeberg.org/snonux/quicklogger; cd quicklogger`
3. Build it `./build.sh` - Note, you may need to set the `ANDROID_NDK_HOME` environment variable accordingly.
4. Copy `quicklogger.apk` to your Android phone and install it (You may need to allow installing APKs from this source - just follow the instructions Android is prompting you with).
+
+## Not sure
+
+... not sure that the above is still required, but I now have to do this to complile this on Fedora Linux for Android:
+
+```sh
+sudo systemctl start podman
+DOCKER_HOST=unix:///run/user/1001/podman/podman.sock
+go install github.com/fyne-io/fyne-cross@latest
+fyne-cross android --pull
+fyne-cross android
+```
+
+And then install the `.apk` file.
diff --git a/main.go b/main.go
index 42a3318..0cf6aec 100644
--- a/main.go
+++ b/main.go
@@ -3,6 +3,7 @@ package main
import (
"fmt"
"os"
+ "strings"
"time"
"fyne.io/fyne/v2"
@@ -13,53 +14,128 @@ import (
)
const (
- appId = "org.buetow.quicklogger"
+ appId = "org.buetow.quicklogger"
+ placeholderText = "Enter text here..."
+)
+
+var (
defaultDirectory = "."
+ defaultTagItems = []string{
+ "log",
+ "share",
+ "share:li",
+ "share:ma",
+ "track",
+ "track 10",
+ "track 15",
+ "track 20",
+ "track 25",
+ "track 30",
+ "track 5",
+ "work",
+ }
+ defaultWhatItems = []string{
+ "Breathing",
+ "Bulgarian",
+ "Ema",
+ "Exercise",
+ "Meditation",
+ "Music",
+ "Reading Articles",
+ "Reading Books",
+ "Stretching",
+ "Tech",
+ }
)
-var windowSize = fyne.NewSize(200, 100)
+var windowSize = fyne.NewSize(400, 100)
func createPreferenceWindow(a fyne.App) fyne.Window {
window := a.NewWindow("Preferences")
directoryPreference := widget.NewEntry()
directoryPreference.SetText(a.Preferences().StringWithFallback("Directory", defaultDirectory))
+ tagDropdownPreference := widget.NewEntry()
+ tagDropdownPreference.SetText(a.Preferences().StringWithFallback("Tags", strings.Join(defaultTagItems, ",")))
+
+ whatDropdownPreference := widget.NewEntry()
+ whatDropdownPreference.SetText(a.Preferences().StringWithFallback("Whats", strings.Join(defaultWhatItems, ",")))
+
window.SetContent(container.NewVBox(
- widget.NewLabel("Directory:"),
- directoryPreference,
- widget.NewButton("Save", func() {
- a.Preferences().SetString("Directory", directoryPreference.Text)
- window.Hide()
- }),
- ))
+ container.NewVBox(
+ widget.NewLabel("Directory:"),
+ directoryPreference,
+ widget.NewLabel("Tags:"),
+ tagDropdownPreference,
+ widget.NewLabel("Whats:"),
+ whatDropdownPreference,
+ ),
+ container.NewHBox(
+ widget.NewButton("Save", func() {
+ a.Preferences().SetString("Directory", directoryPreference.Text)
+ a.Preferences().SetString("Tags", tagDropdownPreference.Text)
+ a.Preferences().SetString("Whats", whatDropdownPreference.Text)
+ window.Hide()
+ }),
+ widget.NewButton("Reset dropdowns", func() {
+ // directoryPreference.SetText(defaultDirectory)
+ tagDropdownPreference.SetText(strings.Join(defaultTagItems, ","))
+ whatDropdownPreference.SetText(strings.Join(defaultWhatItems, ","))
+ },
+ ),
+ )))
window.Resize(windowSize)
return window
}
func createMainWindow(a fyne.App) fyne.Window {
+ // Create main window
window := a.NewWindow("Quick logger")
input := widget.NewMultiLineEntry()
input.Wrapping = fyne.TextWrapWord
- input.SetPlaceHolder("Enter text here...")
+ input.SetPlaceHolder(placeholderText)
+ input.SetMinRowsVisible(30)
- button := widget.NewButton("Log text", func() {
+ // Dropdown with pre-selectable items
+ daysDropdown := widget.NewSelect([]string{"0", "1", "3", "7", "14", "30", "60", "99"}, func(selected string) {
+ input.SetText(selected + " ")
+ window.Canvas().Focus(input)
+ })
+ daysDropdown.PlaceHolder = "Days"
+
+ tagDropdownItems := strings.Split(a.Preferences().StringWithFallback("Tags", strings.Join(defaultTagItems, ",")), ",")
+ tagDropdown := widget.NewSelect(tagDropdownItems, func(selected string) {
+ input.Append(selected + " ")
+ window.Canvas().Focus(input)
+ })
+ tagDropdown.PlaceHolder = "Tag"
+
+ whatDropdownItems := strings.Split(a.Preferences().StringWithFallback("Whats", strings.Join(defaultWhatItems, ",")), ",")
+ whatDropdown := widget.NewSelect(whatDropdownItems, func(selected string) {
+ input.Append(selected + " ")
+ window.Canvas().Focus(input)
+ input.Cursor()
+ })
+ whatDropdown.PlaceHolder = "What"
+
+ logTextButton := widget.NewButton("Log text", func() {
filename := fmt.Sprintf("%s/ql-%s.md",
a.Preferences().StringWithFallback("Directory", defaultDirectory),
time.Now().Format("060102-150405"),
)
-
if err := os.WriteFile(filename, []byte(input.Text), 0644); err != nil {
dialog.ShowError(err, window)
return
}
input.SetText("")
+ input.SetPlaceHolder(placeholderText)
})
window.SetContent(container.NewVBox(
+ container.NewHBox(daysDropdown, tagDropdown, whatDropdown, logTextButton),
input,
- button,
widget.NewButton("Preferences", func() {
createPreferenceWindow(a).Show()
}),