diff --git a/cmd/streampanel/FyneApp.toml b/cmd/streampanel/FyneApp.toml index 76db0b0..defba70 100755 --- a/cmd/streampanel/FyneApp.toml +++ b/cmd/streampanel/FyneApp.toml @@ -5,4 +5,4 @@ Website = "https://github.com/xaionaro/streamctl" Name = "streampanel" ID = "center.dx.streampanel" Version = "0.1.0" - Build = 361 + Build = 367 diff --git a/go.sum b/go.sum index c987e60..2af0f73 100755 --- a/go.sum +++ b/go.sum @@ -1161,8 +1161,6 @@ github.com/xaionaro-go/proxy v0.0.0-20250111150848-1f0e7b262638 h1:w7Dt6Mpj36S2c github.com/xaionaro-go/proxy v0.0.0-20250111150848-1f0e7b262638/go.mod h1:hOkJBFoMsnCDoZgpSPTHYbnevPgtpD16d9Xga91U+Eo= github.com/xaionaro-go/pulse v0.0.0-20241023202712-7151fa00d4bb h1:9iHPI27CYbmJDhzEuCABQthE/DGVNvT60ybWvv3BV8w= github.com/xaionaro-go/pulse v0.0.0-20241023202712-7151fa00d4bb/go.mod h1:cpYspI6YljhkUf1WLXLLDmeaaPFc3CnGLjDZf9dZ4no= -github.com/xaionaro-go/recoder v0.0.0-20250428012439-3fc4b32e59a9 h1:744Nrf5lfHG0lOpivgXHDDsENer25zJlr/f5puIWhGs= -github.com/xaionaro-go/recoder v0.0.0-20250428012439-3fc4b32e59a9/go.mod h1:Twc+NcQQ+afg4RHxwqqo9pRGIaY7+QwpuAiYa7ClSLw= github.com/xaionaro-go/recoder v0.0.0-20250503155018-6f353978d332 h1:jB5I8UE9UL6g7qQKaZ/g9wt3lIXxgkDDJX1cV37D5go= github.com/xaionaro-go/recoder v0.0.0-20250503155018-6f353978d332/go.mod h1:Twc+NcQQ+afg4RHxwqqo9pRGIaY7+QwpuAiYa7ClSLw= github.com/xaionaro-go/secret v0.0.0-20250111141743-ced12e1082c2 h1:QHpTWfyfmz65cE0MtFXe9fScdi+X0VIYR2wgolSYEUk= diff --git a/pkg/streampanel/is_mobile.go b/pkg/streampanel/is_mobile.go new file mode 100644 index 0000000..b232dc3 --- /dev/null +++ b/pkg/streampanel/is_mobile.go @@ -0,0 +1,9 @@ +package streampanel + +import ( + "fyne.io/fyne/v2" +) + +func isMobile() bool { + return fyne.CurrentDevice().IsMobile() +} diff --git a/pkg/streampanel/llm.go b/pkg/streampanel/llm.go index 07dc0a2..af16e5a 100644 --- a/pkg/streampanel/llm.go +++ b/pkg/streampanel/llm.go @@ -37,6 +37,7 @@ My keywords: %s`, tagsString)) return } p.streamTitleField.SetText(t) + p.streamTitleLabel.SetText(t) } func (p *Panel) generateNewDescription( @@ -54,6 +55,7 @@ func (p *Panel) generateNewDescription( return } p.streamDescriptionField.SetText(t) + p.streamDescriptionLabel.SetText(t) } func (p *Panel) generateAlternativeTextFor( diff --git a/pkg/streampanel/panel.go b/pkg/streampanel/panel.go index 376aa60..75553cb 100644 --- a/pkg/streampanel/panel.go +++ b/pkg/streampanel/panel.go @@ -84,7 +84,9 @@ type Panel struct { startStopButton *widget.Button profilesListWidget *widget.List streamTitleField *widget.Entry + streamTitleLabel *widget.Label streamDescriptionField *widget.Entry + streamDescriptionLabel *widget.Label dashboardLocker xsync.Mutex dashboardShowHideButton *widget.Button @@ -1127,19 +1129,17 @@ func resizeWindow(w fyne.Window, newSize fyne.Size) { } func setupStreamString() string { - switch runtime.GOOS { - case "android": + if isMobile() { return "Set!" - default: + } else { return "Setup stream" } } func startStreamString() string { - switch runtime.GOOS { - case "android": + if isMobile() { return "Go!" - default: + } else { return "Start stream" } } @@ -1387,6 +1387,7 @@ func (p *Panel) initMainWindow( } p.streamTitleField = widget.NewEntry() p.streamTitleField.SetPlaceHolder("stream title") + p.streamTitleField.Wrapping = fyne.TextWrapWord p.streamTitleField.OnChanged = func(s string) { if len(s) > youtubeTitleLength { p.streamTitleField.SetText(s[:youtubeTitleLength]) @@ -1400,6 +1401,35 @@ func (p *Panel) initMainWindow( p.startStopButton.OnTapped() p.startStopButton.OnTapped() } + p.streamTitleLabel = widget.NewLabel("") + p.streamTitleLabel.Wrapping = fyne.TextWrapWord + streamTitleButton := widget.NewButtonWithIcon("", theme.SettingsIcon(), func() { + f := widget.NewMultiLineEntry() + f.SetText(p.streamTitleField.Text) + f.Wrapping = fyne.TextWrapWord + w := p.app.NewWindow("title edit") + w.SetContent(container.NewBorder( + nil, + container.NewBorder( + nil, + nil, + widget.NewButtonWithIcon("Cancel", theme.DocumentSaveIcon(), func() { + w.Close() + }), + widget.NewButtonWithIcon("Save", theme.DocumentSaveIcon(), func() { + f.Text = strings.ReplaceAll(f.Text, "\n", " ") + f.Text = f.Text[:youtubeTitleLength] + p.streamTitleField.SetText(f.Text) + p.streamTitleLabel.SetText(f.Text) + w.Close() + }), + ), + nil, + nil, + f, + )) + w.Show() + }) p.streamDescriptionField = widget.NewMultiLineEntry() p.streamDescriptionField.SetPlaceHolder("stream description") @@ -1411,6 +1441,41 @@ func (p *Panel) initMainWindow( p.startStopButton.OnTapped() p.startStopButton.OnTapped() } + p.streamDescriptionLabel = widget.NewLabel("") + streamDescriptionButton := widget.NewButtonWithIcon("", theme.SettingsIcon(), func() { + f := widget.NewMultiLineEntry() + f.SetText(p.streamDescriptionField.Text) + f.Wrapping = fyne.TextWrapWord + w := p.app.NewWindow("title edit") + w.SetContent(container.NewBorder( + nil, + container.NewBorder( + nil, + nil, + widget.NewButtonWithIcon("Cancel", theme.DocumentSaveIcon(), func() { + w.Close() + }), + widget.NewButtonWithIcon("Save", theme.DocumentSaveIcon(), func() { + p.streamDescriptionField.SetText(f.Text) + p.streamDescriptionLabel.SetText(f.Text) + w.Close() + }), + ), + nil, + nil, + f, + )) + w.Show() + }) + + if isMobile() { + p.streamTitleField.Hide() + } else { + p.streamTitleLabel.Hide() + streamTitleButton.Hide() + p.streamDescriptionLabel.Hide() + streamDescriptionButton.Hide() + } p.twitchCheck = widget.NewCheck("Twitch", nil) p.twitchCheck.SetChecked(true) @@ -1433,8 +1498,27 @@ func (p *Panel) initMainWindow( }) bottomPanel := container.NewVBox( - container.NewBorder(nil, nil, regenerateTitleButton, nil, p.streamTitleField), - container.NewBorder(nil, nil, regenerateDescriptionButton, nil, p.streamDescriptionField), + container.NewBorder( + nil, nil, + regenerateTitleButton, nil, + container.NewStack( + p.streamTitleField, + container.NewBorder( + nil, nil, streamTitleButton, nil, + container.NewHScroll(p.streamTitleLabel), + )), + ), + container.NewBorder( + nil, nil, + regenerateDescriptionButton, nil, + container.NewStack( + p.streamDescriptionField, + container.NewBorder( + nil, nil, streamDescriptionButton, nil, + //container.NewHScroll(p.streamDescriptionLabel), + ), + ), + ), container.NewBorder( nil, nil, diff --git a/pkg/streampanel/profile.go b/pkg/streampanel/profile.go index dd0eba2..f04f642 100644 --- a/pkg/streampanel/profile.go +++ b/pkg/streampanel/profile.go @@ -638,8 +638,18 @@ func (p *Panel) profileWindow( }), ) - w.SetContent( - container.NewBorder( + var content fyne.CanvasObject + if isMobile() { + content = container.NewVScroll(container.NewVBox( + profileName, + defaultStreamTitle, + defaultStreamDescription, + container.NewVBox(bottomContentLeft...), + container.NewVBox(bottomContentRight...), + container.NewVBox(bottomContentCommon...), + )) + } else { + content = container.NewBorder( nil, container.NewVBox(bottomContentCommon...), nil, @@ -661,8 +671,10 @@ func (p *Panel) profileWindow( bottomContentRight..., ), ), - ), - ) + ) + } + + w.SetContent(content) w.Show() return w } @@ -916,7 +928,9 @@ func (p *Panel) onProfilesListSelect( }) p.selectedProfileName = ptrCopy(profileName) p.streamTitleField.SetText(profile.DefaultStreamTitle) + p.streamTitleLabel.SetText(profile.DefaultStreamTitle) p.streamDescriptionField.SetText(profile.DefaultStreamDescription) + p.streamDescriptionLabel.SetText(profile.DefaultStreamDescription) } func (p *Panel) onProfilesListUnselect(