Compare commits
2 Commits
088f6e77b0
...
e8e0060063
| Author | SHA1 | Date | |
|---|---|---|---|
| e8e0060063 | |||
| 7252d3683c |
+29
-14
@@ -27,6 +27,9 @@ const appID = "io.github.pysentry.desktop"
|
|||||||
const allFolders = "All"
|
const allFolders = "All"
|
||||||
const noFolder = "No folder"
|
const noFolder = "No folder"
|
||||||
const minJobsSidebarWidth float32 = 480
|
const minJobsSidebarWidth float32 = 480
|
||||||
|
const settingsLabelWidth float32 = 140
|
||||||
|
const settingsControlWidth float32 = 330
|
||||||
|
const settingsStatusWidth float32 = 280
|
||||||
const projectRepositoryURL = "https://gitea.mixdep.ru/mix/gosentry"
|
const projectRepositoryURL = "https://gitea.mixdep.ru/mix/gosentry"
|
||||||
|
|
||||||
// The GUI package aliases core types to keep widget callbacks short. The actual
|
// The GUI package aliases core types to keep widget callbacks short. The actual
|
||||||
@@ -512,6 +515,19 @@ func detailRow(label string, value fyne.CanvasObject) fyne.CanvasObject {
|
|||||||
return container.NewGridWithColumns(2, caption, value)
|
return container.NewGridWithColumns(2, caption, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func settingsRow(label string, value fyne.CanvasObject) fyne.CanvasObject {
|
||||||
|
caption := widget.NewLabelWithStyle(label, fyne.TextAlignLeading, fyne.TextStyle{Bold: true})
|
||||||
|
caption.Wrapping = fyne.TextTruncate
|
||||||
|
captionBox := container.New(minWidthLayout{width: settingsLabelWidth}, caption)
|
||||||
|
return container.NewBorder(nil, nil, captionBox, nil, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func settingsRowWithStatus(label string, value fyne.CanvasObject, status fyne.CanvasObject) fyne.CanvasObject {
|
||||||
|
valueBox := container.New(minWidthLayout{width: settingsControlWidth}, value)
|
||||||
|
statusBox := container.New(minWidthLayout{width: settingsStatusWidth}, status)
|
||||||
|
return settingsRow(label, container.NewBorder(nil, nil, valueBox, nil, statusBox))
|
||||||
|
}
|
||||||
|
|
||||||
func filteredJobIndexes(jobs []job, folder string) []int {
|
func filteredJobIndexes(jobs []job, folder string) []int {
|
||||||
indexes := make([]int, 0, len(jobs))
|
indexes := make([]int, 0, len(jobs))
|
||||||
for index, current := range jobs {
|
for index, current := range jobs {
|
||||||
@@ -733,7 +749,7 @@ func logFileName(path string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func settingsView(w fyne.Window, store *core.Store, jobs *[]job) fyne.CanvasObject {
|
func settingsView(w fyne.Window, store *core.Store, jobs *[]job) fyne.CanvasObject {
|
||||||
startOnLogin := widget.NewCheck("Start PySentry when I sign in", nil)
|
startOnLogin := widget.NewCheck("Start on login", nil)
|
||||||
startOnLogin.SetChecked(store.Config.StartOnLogin)
|
startOnLogin.SetChecked(store.Config.StartOnLogin)
|
||||||
autostartStatus := widget.NewLabel("")
|
autostartStatus := widget.NewLabel("")
|
||||||
refreshAutostartStatus := func() {
|
refreshAutostartStatus := func() {
|
||||||
@@ -826,25 +842,24 @@ func settingsView(w fyne.Window, store *core.Store, jobs *[]job) fyne.CanvasObje
|
|||||||
|
|
||||||
return container.NewPadded(container.NewVBox(
|
return container.NewPadded(container.NewVBox(
|
||||||
widget.NewLabelWithStyle("Application", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
widget.NewLabelWithStyle("Application", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||||
detailRow("Version", widget.NewLabel(core.Version)),
|
settingsRowWithStatus("Autostart", startOnLogin, autostartStatus),
|
||||||
detailRow("Start on login", container.NewBorder(nil, nil, nil, autostartStatus, startOnLogin)),
|
settingsRow("Tray", container.New(minWidthLayout{width: settingsControlWidth}, minimizeToTray)),
|
||||||
minimizeToTray,
|
settingsRow("Notifications", container.New(minWidthLayout{width: settingsControlWidth}, notifications)),
|
||||||
notifications,
|
|
||||||
widget.NewSeparator(),
|
widget.NewSeparator(),
|
||||||
widget.NewLabelWithStyle("Storage", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
widget.NewLabelWithStyle("Storage", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||||
detailRow("Config YAML", widget.NewLabel(store.Paths.ConfigPath)),
|
settingsRow("Config YAML", widget.NewLabel(store.Paths.ConfigPath)),
|
||||||
detailRow("Jobs directory", container.NewBorder(nil, nil, nil, jobsDirBrowse, jobsDir)),
|
settingsRow("Jobs directory", container.NewBorder(nil, nil, nil, jobsDirBrowse, jobsDir)),
|
||||||
detailRow("Logs directory", container.NewBorder(nil, nil, nil, logsDirBrowse, logsDir)),
|
settingsRow("Logs directory", container.NewBorder(nil, nil, nil, logsDirBrowse, logsDir)),
|
||||||
detailRow("Max log files", maxLogFiles),
|
settingsRow("Max log files", maxLogFiles),
|
||||||
detailRow("Max log age days", maxLogAgeDays),
|
settingsRow("Max log age days", maxLogAgeDays),
|
||||||
saveSettings,
|
saveSettings,
|
||||||
settingsStatus,
|
settingsStatus,
|
||||||
widget.NewSeparator(),
|
widget.NewSeparator(),
|
||||||
widget.NewLabelWithStyle("About", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
widget.NewLabelWithStyle("About", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||||
detailRow("GoSentry", widget.NewLabel(core.Version)),
|
settingsRow("GoSentry", widget.NewLabel(core.Version)),
|
||||||
detailRow("Go", widget.NewLabel(runtime.Version())),
|
settingsRow("Go", widget.NewLabel(runtime.Version())),
|
||||||
detailRow("Fyne", widget.NewLabel(fyneVersion())),
|
settingsRow("Fyne", widget.NewLabel(fyneVersion())),
|
||||||
detailRow("Repository", widget.NewHyperlink(projectRepositoryURL, mustParseURL(projectRepositoryURL))),
|
settingsRow("Repository", widget.NewHyperlink(projectRepositoryURL, mustParseURL(projectRepositoryURL))),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user