This commit is contained in:
55
cmd/gui/window/credential/credential.go
Normal file
55
cmd/gui/window/credential/credential.go
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
package credential
|
||||||
|
|
||||||
|
import (
|
||||||
|
"image/color"
|
||||||
|
|
||||||
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/canvas"
|
||||||
|
"fyne.io/fyne/v2/dialog"
|
||||||
|
"fyne.io/fyne/v2/widget"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
CredentialDialog struct {
|
||||||
|
*dialog.FormDialog
|
||||||
|
inputUsername *widget.Entry
|
||||||
|
inputPassword *widget.Entry
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func Make(remoteHostname string, callback func(v bool), w fyne.Window) *CredentialDialog {
|
||||||
|
label := canvas.NewText("Connexion to "+remoteHostname, color.Black)
|
||||||
|
|
||||||
|
inputUsername := widget.NewEntry()
|
||||||
|
inputUsername.SetPlaceHolder("Username")
|
||||||
|
|
||||||
|
inputPassword := widget.NewEntry()
|
||||||
|
inputPassword.Password = true
|
||||||
|
inputPassword.SetPlaceHolder("Password")
|
||||||
|
|
||||||
|
formItems := []*widget.FormItem{
|
||||||
|
{
|
||||||
|
Text: "",
|
||||||
|
Widget: label,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Text: "Username",
|
||||||
|
Widget: inputUsername,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Text: "Password",
|
||||||
|
Widget: inputPassword,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
d := &CredentialDialog{
|
||||||
|
FormDialog: dialog.NewForm("Syncing", "Connexion", "Cancel", formItems, callback, w),
|
||||||
|
inputUsername: inputUsername,
|
||||||
|
inputPassword: inputPassword,
|
||||||
|
}
|
||||||
|
return d
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CredentialDialog) Credentials() (string, string) {
|
||||||
|
return c.inputUsername.Text, c.inputPassword.Text
|
||||||
|
}
|
||||||
@@ -102,6 +102,11 @@ func Make(a fyne.App, d *data.Service) fyne.Window {
|
|||||||
folderSelection.Show()
|
folderSelection.Show()
|
||||||
}),
|
}),
|
||||||
widget.NewToolbarSeparator(),
|
widget.NewToolbarSeparator(),
|
||||||
|
widget.NewToolbarAction(theme.UploadIcon(), func() {
|
||||||
|
go func() {
|
||||||
|
fmt.Println("todo")
|
||||||
|
}()
|
||||||
|
}),
|
||||||
widget.NewToolbarSpacer(),
|
widget.NewToolbarSpacer(),
|
||||||
widget.NewToolbarAction(theme.HelpIcon(), func() {
|
widget.NewToolbarAction(theme.HelpIcon(), func() {
|
||||||
aboutWindow := about.Make(a)
|
aboutWindow := about.Make(a)
|
||||||
|
|||||||
47
cmd/gui/window/sync/sync.go
Normal file
47
cmd/gui/window/sync/sync.go
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package sync
|
||||||
|
|
||||||
|
import (
|
||||||
|
"image/color"
|
||||||
|
|
||||||
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/canvas"
|
||||||
|
"fyne.io/fyne/v2/container"
|
||||||
|
"fyne.io/fyne/v2/dialog"
|
||||||
|
"fyne.io/fyne/v2/layout"
|
||||||
|
"fyne.io/fyne/v2/widget"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
SyncDialog struct {
|
||||||
|
*dialog.CustomDialog
|
||||||
|
label *canvas.Text
|
||||||
|
pg *widget.ProgressBar
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func Make(total int, w fyne.Window) *SyncDialog {
|
||||||
|
|
||||||
|
title := canvas.NewText("Warming up...", color.Black)
|
||||||
|
title.Alignment = fyne.TextAlignCenter
|
||||||
|
|
||||||
|
pg := widget.NewProgressBar()
|
||||||
|
pg.Max = float64(total)
|
||||||
|
|
||||||
|
c := container.New(layout.NewVBoxLayout(), title, pg)
|
||||||
|
d := &SyncDialog{
|
||||||
|
CustomDialog: dialog.NewCustomWithoutButtons("Syncing", c, w),
|
||||||
|
label: title,
|
||||||
|
pg: pg,
|
||||||
|
}
|
||||||
|
return d
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SyncDialog) UpdateLabel(msg string) {
|
||||||
|
s.label.Text = msg
|
||||||
|
s.Refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SyncDialog) UpdateProgressBar(percentage int) {
|
||||||
|
s.pg.Value = float64(percentage)
|
||||||
|
s.Refresh()
|
||||||
|
}
|
||||||
2
pkg/sync/sync.go
Normal file
2
pkg/sync/sync.go
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
package sync
|
||||||
|
|
||||||
Reference in New Issue
Block a user