temporary disable 2.5.0 entry redo/undo

This commit is contained in:
aynakeya
2024-08-07 21:42:31 +08:00
parent 156901f14c
commit 46c2e2710e
13 changed files with 54 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
package component
import (
"AynaLivePlayer/gui/xfyne"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/widget"
)
@@ -14,6 +15,7 @@ type Entry struct {
func NewEntry() *Entry {
e := &Entry{}
e.ExtendBaseWidget(e)
xfyne.EntryDisableUndoRedo(&e.Entry)
return e
}

View File

@@ -4,6 +4,7 @@ import (
"AynaLivePlayer/core/events"
"AynaLivePlayer/core/model"
"AynaLivePlayer/global"
"AynaLivePlayer/gui/xfyne"
"AynaLivePlayer/pkg/event"
"AynaLivePlayer/pkg/i18n"
"fyne.io/fyne/v2"
@@ -57,8 +58,8 @@ func createRoomSelector() fyne.CanvasObject {
descriptionLabel.SetText("")
}
})
idEntry := widget.NewEntry()
nameEntry := widget.NewEntry()
idEntry := xfyne.EntryDisableUndoRedo(widget.NewEntry())
nameEntry := xfyne.EntryDisableUndoRedo(widget.NewEntry())
dia := dialog.NewCustomConfirm(
i18n.T("gui.room.add.title"),
i18n.T("gui.room.add.confirm"),

View File

@@ -4,6 +4,7 @@ import (
"AynaLivePlayer/core/events"
"AynaLivePlayer/core/model"
"AynaLivePlayer/global"
"AynaLivePlayer/gui/xfyne"
"AynaLivePlayer/pkg/event"
"AynaLivePlayer/pkg/i18n"
"fmt"
@@ -44,7 +45,7 @@ func createPlaylists() fyne.CanvasObject {
})
PlaylistManager.AddBtn = widget.NewButton(i18n.T("gui.playlist.button.add"), func() {
providerEntry := widget.NewSelect(PlaylistManager.providers, nil)
idEntry := widget.NewEntry()
idEntry := xfyne.EntryDisableUndoRedo(widget.NewEntry())
dia := dialog.NewCustomConfirm(
i18n.T("gui.playlist.add.title"),
i18n.T("gui.playlist.add.confirm"),

14
gui/xfyne/patch.go Normal file
View File

@@ -0,0 +1,14 @@
package xfyne
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/widget"
"reflect"
)
func EntryDisableUndoRedo(entry *widget.Entry) *widget.Entry {
val := reflect.ValueOf(entry).Elem().FieldByName("shortcut").Addr().UnsafePointer()
(*fyne.ShortcutHandler)(val).RemoveShortcut(&fyne.ShortcutRedo{})
(*fyne.ShortcutHandler)(val).RemoveShortcut(&fyne.ShortcutUndo{})
return entry
}

11
gui/xfyne/patch_test.go Normal file
View File

@@ -0,0 +1,11 @@
package xfyne
import (
"fyne.io/fyne/v2/widget"
"testing"
)
func TestEntryDisableUndoRedo(t *testing.T) {
entry := widget.NewEntry()
EntryDisableUndoRedo(entry)
}

View File

@@ -10,7 +10,7 @@ import (
const (
ProgramName = "卡西米尔唱片机"
Version uint32 = 0x010008
Version uint32 = 0x010009
)
const (

View File

@@ -1,6 +1,7 @@
package diange
import (
"AynaLivePlayer/gui/xfyne"
"AynaLivePlayer/pkg/i18n"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
@@ -30,7 +31,7 @@ func (b *blacklist) CreatePanel() fyne.CanvasObject {
return b.panel
}
// UI组件
input := widget.NewEntry()
input := xfyne.EntryDisableUndoRedo(widget.NewEntry())
input.SetPlaceHolder(i18n.T("plugin.diange.blacklist.input.placeholder"))
exactText := i18n.T("plugin.diange.blacklist.option.exact")

View File

@@ -6,6 +6,7 @@ import (
"AynaLivePlayer/global"
"AynaLivePlayer/gui"
"AynaLivePlayer/gui/component"
"AynaLivePlayer/gui/xfyne"
"AynaLivePlayer/pkg/config"
"AynaLivePlayer/pkg/event"
"AynaLivePlayer/pkg/i18n"
@@ -345,27 +346,27 @@ func (d *Diange) CreatePanel() fyne.CanvasObject {
container.NewGridWithColumns(2,
container.NewBorder(nil, nil,
widget.NewLabel(i18n.T("plugin.diange.medal.name")), nil,
widget.NewEntryWithData(binding.BindString(&d.MedalName))),
xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.BindString(&d.MedalName)))),
container.NewBorder(nil, nil,
widget.NewLabel(i18n.T("plugin.diange.medal.level")), nil,
widget.NewEntryWithData(binding.IntToString(binding.BindInt(&d.MedalPermission)))),
xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.IntToString(binding.BindInt(&d.MedalPermission))))),
),
)
dgQueue := container.NewBorder(nil, nil,
widget.NewLabel(i18n.T("plugin.diange.queue_max")), nil,
widget.NewEntryWithData(binding.IntToString(binding.BindInt(&d.QueueMax))),
xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.IntToString(binding.BindInt(&d.QueueMax)))),
)
dgUserMax := container.NewBorder(nil, nil,
widget.NewLabel(i18n.T("plugin.diange.user_max")), nil,
widget.NewEntryWithData(binding.IntToString(binding.BindInt(&d.UserMax))),
xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.IntToString(binding.BindInt(&d.UserMax)))),
)
dgCoolDown := container.NewBorder(nil, nil,
widget.NewLabel(i18n.T("plugin.diange.cooldown")), nil,
widget.NewEntryWithData(binding.IntToString(binding.BindInt(&d.UserCoolDown))),
xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.IntToString(binding.BindInt(&d.UserCoolDown)))),
)
dgShortCut := container.NewBorder(nil, nil,
widget.NewLabel(i18n.T("plugin.diange.custom_cmd")), nil,
widget.NewEntryWithData(binding.BindString(&d.CustomCMD)),
xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.BindString(&d.CustomCMD))),
)
skipPlaylistCheck := widget.NewCheckWithData(i18n.T("plugin.diange.skip_playlist.prompt"), binding.BindBool(&d.SkipSystemPlaylist))
skipPlaylist := container.NewHBox(
@@ -379,9 +380,9 @@ func (d *Diange) CreatePanel() fyne.CanvasObject {
widget.NewLabel(source),
widget.NewCheckWithData(i18n.T("plugin.diange.source.enable"), binding.BindBool(&cfg.Enable)),
widget.NewLabel(i18n.T("plugin.diange.source.priority")),
widget.NewEntryWithData(binding.IntToString(binding.BindInt(&cfg.Priority))),
xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.IntToString(binding.BindInt(&cfg.Priority)))),
widget.NewLabel(i18n.T("plugin.diange.source.command")),
widget.NewEntryWithData(binding.BindString(&cfg.Command)),
xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.BindString(&cfg.Command))),
),
)
}

View File

@@ -4,6 +4,7 @@ import (
"AynaLivePlayer/core/events"
"AynaLivePlayer/global"
"AynaLivePlayer/gui"
"AynaLivePlayer/gui/xfyne"
"AynaLivePlayer/pkg/config"
"AynaLivePlayer/pkg/event"
"AynaLivePlayer/pkg/i18n"
@@ -90,7 +91,7 @@ func (d *MaxDuration) CreatePanel() fyne.CanvasObject {
if d.panel != nil {
return d.panel
}
maxDurationInput := widget.NewEntryWithData(binding.IntToString(binding.BindInt(&d.MaxDuration)))
maxDurationInput := xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.IntToString(binding.BindInt(&d.MaxDuration))))
skipOnPlayCheckbox := widget.NewCheckWithData(i18n.T("plugin.maxduration.enable"), binding.BindBool(&d.SkipOnPlay))
skipOnReachCheckbox := widget.NewCheckWithData(i18n.T("plugin.maxduration.enable"), binding.BindBool(&d.SkipOnReach))
d.panel = container.New(

View File

@@ -5,6 +5,7 @@ import (
"AynaLivePlayer/global"
"AynaLivePlayer/gui"
"AynaLivePlayer/gui/component"
"AynaLivePlayer/gui/xfyne"
"AynaLivePlayer/pkg/config"
"AynaLivePlayer/pkg/event"
"AynaLivePlayer/pkg/i18n"
@@ -120,7 +121,7 @@ func (d *Qiege) CreatePanel() fyne.CanvasObject {
)
qgShortCut := container.NewBorder(nil, nil,
widget.NewLabel(i18n.T("plugin.qiege.custom_cmd")), nil,
widget.NewEntryWithData(binding.BindString(&d.CustomCMD)),
xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.BindString(&d.CustomCMD))),
)
d.panel = container.NewVBox(dgPerm, qgShortCut)
return d.panel

View File

@@ -7,6 +7,7 @@ import (
"AynaLivePlayer/core/model"
"AynaLivePlayer/gui"
"AynaLivePlayer/gui/component"
"AynaLivePlayer/gui/xfyne"
"AynaLivePlayer/pkg/config"
"AynaLivePlayer/pkg/event"
"AynaLivePlayer/pkg/i18n"
@@ -183,7 +184,7 @@ func (w *WebInfo) CreatePanel() fyne.CanvasObject {
statusText.SetText(w.getServerStatusText())
serverPort := container.NewBorder(nil, nil,
widget.NewLabel(i18n.T("plugin.webinfo.port")), nil,
widget.NewEntryWithData(binding.IntToString(binding.BindInt(&w.Port))),
xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.IntToString(binding.BindInt(&w.Port)))),
)
serverUrl := widget.NewHyperlink(w.getServerUrl(), util.UrlMustParse(w.getServerUrl()))
serverPreview := container.NewHBox(

View File

@@ -5,6 +5,7 @@ import (
"AynaLivePlayer/global"
"AynaLivePlayer/gui"
"AynaLivePlayer/gui/component"
"AynaLivePlayer/gui/xfyne"
"AynaLivePlayer/pkg/config"
"AynaLivePlayer/pkg/event"
"AynaLivePlayer/pkg/i18n"
@@ -97,9 +98,9 @@ func (w *WsHub) CreatePanel() fyne.CanvasObject {
freshStatusText()
serverPort := container.NewBorder(nil, nil,
widget.NewLabel(i18n.T("plugin.wshub.port")), nil,
widget.NewEntryWithData(binding.IntToString(binding.BindInt(&w.Port))),
xfyne.EntryDisableUndoRedo(widget.NewEntryWithData(binding.IntToString(binding.BindInt(&w.Port)))),
)
serverUrl := widget.NewEntry()
serverUrl := xfyne.EntryDisableUndoRedo(widget.NewEntry())
serverUrl.SetText(w.server.getWsUrl())
serverUrl.Disable()
serverPreview := container.NewBorder(nil, nil,

View File

@@ -13,6 +13,7 @@
- 网页输出重写,使用网页版本,不绑定在点歌机内(点歌机不需要启动网页服务)
- optimize local music
- 从搜索里添加的歌不能被切
- remove tmp fix for entry undo
----
Finished