Skip to content

Commit

Permalink
add icons to dialog buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed Aug 16, 2024
1 parent d635408 commit 1d64778
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ui/dialogs/addeditserverdialog.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func NewAddEditServerDialog(title string, cancelable bool, prefillServer *backen
nickField := widget.NewEntryWithData(binding.BindString(&a.Nickname))
nickField.SetPlaceHolder(lang.L("My Server"))
nickField.OnSubmitted = func(_ string) { focusHandler(hostField) }
a.submitBtn = widget.NewButton(lang.L("Enter"), a.doSubmit)
a.submitBtn = widget.NewButtonWithIcon(lang.L("Enter"), theme.ConfirmIcon(), a.doSubmit)
a.submitBtn.Importance = widget.HighImportance
a.promptText = widget.NewRichTextWithText("")
a.promptText.Hidden = true
Expand All @@ -88,7 +88,7 @@ func NewAddEditServerDialog(title string, cancelable bool, prefillServer *backen
bottomRow = container.NewHBox(
a.promptText,
layout.NewSpacer(),
widget.NewButton(lang.L("Cancel"), a.onCancel),
widget.NewButtonWithIcon(lang.L("Cancel"), theme.CancelIcon(), a.onCancel),
a.submitBtn)
} else {
bottomRow = container.NewHBox(
Expand Down
14 changes: 9 additions & 5 deletions ui/dialogs/editplaylistdialog.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fyne.io/fyne/v2/data/binding"
"fyne.io/fyne/v2/lang"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"github.com/dweymouth/supersonic/backend/mediaprovider"
)
Expand Down Expand Up @@ -36,25 +37,28 @@ func NewEditPlaylistDialog(playlist *mediaprovider.Playlist, showPublicCheck boo
isPublicCheck.Hidden = !showPublicCheck
nameEntry := widget.NewEntryWithData(binding.BindString(&e.Name))
descriptionEntry := widget.NewEntryWithData(binding.BindString(&e.Description))
deleteBtn := widget.NewButton(lang.L("Delete Playlist"), func() {
deleteBtn := widget.NewButtonWithIcon(lang.L("Delete Playlist"), theme.DeleteIcon(), func() {
if e.OnDeletePlaylist != nil {
e.OnDeletePlaylist()
}
})
submitBtn := widget.NewButton(lang.L("OK"), func() {
submitBtn := widget.NewButtonWithIcon(lang.L("OK"), theme.ConfirmIcon(), func() {
if e.OnUpdateMetadata != nil {
e.OnUpdateMetadata()
}
})
submitBtn.Importance = widget.HighImportance
cancelBtn := widget.NewButton(lang.L("Cancel"), func() {
cancelBtn := widget.NewButtonWithIcon(lang.L("Cancel"), theme.CancelIcon(), func() {
if e.OnCanceled != nil {
e.OnCanceled()
}
})

title := widget.NewLabel(lang.L("Edit Playlist"))
title.Alignment = fyne.TextAlignCenter
title.TextStyle.Bold = true
e.container = container.NewVBox(
container.NewHBox(layout.NewSpacer(), widget.NewLabel(lang.L("Edit Playlist")), layout.NewSpacer()),
title,
container.New(layout.NewFormLayout(),
widget.NewLabel(lang.L("Name")),
nameEntry,
Expand All @@ -72,7 +76,7 @@ func NewEditPlaylistDialog(playlist *mediaprovider.Playlist, showPublicCheck boo
}

func (e *EditPlaylistDialog) MinSize() fyne.Size {
return fyne.NewSize(300, e.BaseWidget.MinSize().Height)
return fyne.NewSize(400, e.BaseWidget.MinSize().Height)
}

func (e *EditPlaylistDialog) CreateRenderer() fyne.WidgetRenderer {
Expand Down
2 changes: 1 addition & 1 deletion ui/dialogs/logindialog.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func NewLoginDialog(servers []*backend.ServerConfig, pwFetch PasswordFetchFunc)
editBtn := widget.NewButtonWithIcon("", theme.DocumentCreateIcon(), l.onEditServer)
newBtn := widget.NewButtonWithIcon("", theme.ContentAddIcon(), l.onNewServer)
deleteBtn := widget.NewButtonWithIcon("", theme.DeleteIcon(), func() { l.onDeleteServer(l.serverSelect.SelectedIndex()) })
l.submitBtn = widget.NewButton(lang.L("OK"), l.onSubmit)
l.submitBtn = widget.NewButtonWithIcon(lang.L("OK"), theme.ConfirmIcon(), l.onSubmit)
l.submitBtn.Importance = widget.HighImportance
l.promptText = widget.NewRichTextWithText("")
l.promptText.Segments[0].(*widget.TextSegment).Style.ColorName = theme.ColorNameError
Expand Down

0 comments on commit 1d64778

Please sign in to comment.