Skip to content

Commit

Permalink
Rename tools to more and enable about dialog for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikKalkoken committed Jan 26, 2025
1 parent bdd018c commit 62fde14
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 27 deletions.
1 change: 1 addition & 0 deletions internal/app/ui/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ func (a *AssetsArea) makeLocationsTree() *widget.Tree {
return
}
if n.Type == nodeLocation {
t.OpenBranch(uid)
t.UnselectAll()
return
}
Expand Down
11 changes: 1 addition & 10 deletions internal/app/ui/desktop/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,7 @@ func (u *DesktopUI) disableMenuShortcuts() {
}

func (u *DesktopUI) showAboutDialog() {
c := container.NewVBox()
info := u.FyneApp.Metadata()
appData := widget.NewRichTextFromMarkdown(
"## " + u.AppName() + "\n**Version:** " + info.Version)
c.Add(appData)
uri, _ := url.Parse("https://github.com/ErikKalkoken/evebuddy")
c.Add(widget.NewHyperlink("Website", uri))
c.Add(widget.NewLabel("\"EVE\", \"EVE Online\", \"CCP\", \nand all related logos and images \nare trademarks or registered trademarks of CCP hf."))
c.Add(widget.NewLabel("(c) 2024 Erik Kalkoken"))
d := dialog.NewCustom("About", "Close", c, u.Window)
d := dialog.NewCustom("About", "Close", u.MakeAboutPage(), u.Window)
kxdialog.AddDialogKeyHandler(d, u.Window)
u.disableMenuShortcuts()
d.SetOnClosed(func() {
Expand Down
10 changes: 10 additions & 0 deletions internal/app/ui/icon.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 21 additions & 15 deletions internal/app/ui/mobile/mobile.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func NewMobileUI(fyneApp fyne.App) *MobileUI {
)

navListCommunications := NewNavListItemWithIcon(
theme.InfoIcon(),
theme.NewThemedResource(ui.IconMessageSvg),
"Communications",
func() {
u.NotificationsArea.OnSelected = func() {
Expand Down Expand Up @@ -280,7 +280,7 @@ func NewMobileUI(fyneApp fyne.App) *MobileUI {
}

// tools
var toolsNav *Navigator
var moreNav *Navigator
makePage := func(c fyne.CanvasObject) fyne.CanvasObject {
return container.NewScroll(c)
}
Expand All @@ -292,15 +292,15 @@ func NewMobileUI(fyneApp fyne.App) *MobileUI {
theme.NewThemedResource(ui.IconCogSvg),
"Settings",
func() {
toolsNav.Push(
moreNav.Push(
NewAppBar(
"Settings",
NewNavList(
NewNavListItem(
"General",
func() {
c, f := u.MakeGeneralSettingsPage(nil)
toolsNav.Push(
moreNav.Push(
NewAppBar("General", makePage(c), NewToolbarActionMenu(
makeMenu(fyne.NewMenuItem(
"Reset", f,
Expand All @@ -312,7 +312,7 @@ func NewMobileUI(fyneApp fyne.App) *MobileUI {
"Eve Online",
func() {
c, f := u.MakeEVEOnlinePage()
toolsNav.Push(
moreNav.Push(
NewAppBar("Eve Online", makePage(c), NewToolbarActionMenu(
makeMenu(fyne.NewMenuItem(
"Reset", f,
Expand All @@ -321,10 +321,10 @@ func NewMobileUI(fyneApp fyne.App) *MobileUI {
},
),
NewNavListItem(
"Notification - General",
"Notifications",
func() {
c, f := u.MakeNotificationGeneralPage(nil)
toolsNav.Push(
moreNav.Push(
NewAppBar("Notification - General", makePage(c), NewToolbarActionMenu(
makeMenu(fyne.NewMenuItem(
"Reset", f,
Expand All @@ -336,7 +336,7 @@ func NewMobileUI(fyneApp fyne.App) *MobileUI {
"Notification - Types",
func() {
c, f := u.MakeNotificationTypesPage()
toolsNav.Push(
moreNav.Push(
NewAppBar("Notification - Types", makePage(c), NewToolbarActionMenu(
makeMenu(fyne.NewMenuItem(
"Reset", f,
Expand All @@ -352,12 +352,18 @@ func NewMobileUI(fyneApp fyne.App) *MobileUI {
theme.NewThemedResource(ui.IconManageaccountsSvg),
"Manage characters",
func() {
toolsNav.Push(
NewAppBar("Manage characters", u.AccountArea.Content))
moreNav.Push(NewAppBar("Manage characters", u.AccountArea.Content))
},
),
NewNavListItemWithIcon(
theme.InfoIcon(),
"About",
func() {
moreNav.Push(NewAppBar("About", u.MakeAboutPage()))
},
),
)
toolsNav = NewNavigator(NewAppBar("Tools", toolsList))
moreNav = NewNavigator(NewAppBar("More", toolsList))

// navigation bar
characterDest := NewNavBarItem("Character", theme.NewThemedResource(ui.IconAccountSvg), characterNav)
Expand All @@ -368,11 +374,11 @@ func NewMobileUI(fyneApp fyne.App) *MobileUI {
crossDest.OnSelectedAgain = func() {
crossNav.PopAll()
}
toolsDest := NewNavBarItem("Tools", theme.NewThemedResource(ui.IconToolsSvg), toolsNav)
toolsDest.OnSelectedAgain = func() {
toolsNav.PopAll()
moreDest := NewNavBarItem("More", theme.MenuIcon(), moreNav)
moreDest.OnSelectedAgain = func() {
moreNav.PopAll()
}
navBar := NewNavBar(characterDest, crossDest, toolsDest)
navBar := NewNavBar(characterDest, crossDest, moreDest)

u.OnSetCharacter = func(id int32) {
// update character selector
Expand Down
16 changes: 16 additions & 0 deletions internal/app/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import (
"context"
"errors"
"log/slog"
"net/url"
"sync"
"sync/atomic"
"time"

"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/data/binding"
"fyne.io/fyne/v2/driver/desktop"
"fyne.io/fyne/v2/widget"
kxmodal "github.com/ErikKalkoken/fyne-kx/modal"

"github.com/ErikKalkoken/evebuddy/internal/app"
Expand Down Expand Up @@ -336,3 +339,16 @@ const (
func (ui BaseUI) ShowTypeInfoWindow(typeID, characterID int32, selectTab TypeWindowTab) {

}

func (u *BaseUI) MakeAboutPage() fyne.CanvasObject {
c := container.NewVBox()
info := u.FyneApp.Metadata()
appData := widget.NewRichTextFromMarkdown(
"## " + u.AppName() + "\n**Version:** " + info.Version)
c.Add(appData)
uri, _ := url.Parse("https://github.com/ErikKalkoken/evebuddy")
c.Add(widget.NewHyperlink("Website", uri))
c.Add(widget.NewLabel("\"EVE\", \"EVE Online\", \"CCP\", \nand all related logos and images \nare trademarks or registered trademarks of CCP hf."))
c.Add(widget.NewLabel("(c) 2024 Erik Kalkoken"))
return c
}
3 changes: 1 addition & 2 deletions internal/app/widgets/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import (
)

const (
typeIconSize = 55
labelMaxCharacters = 11
typeIconSize = 55
)

type Asset struct {
Expand Down
4 changes: 4 additions & 0 deletions internal/app/widgets/assetlabel.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import (
"fyne.io/fyne/v2/widget"
)

const (
labelMaxCharacters = 10
)

type assetLabel struct {
widget.BaseWidget

Expand Down
1 change: 1 addition & 0 deletions resources/ui/message-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/ui/message.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 62fde14

Please sign in to comment.