mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2025-12-12 16:08:52 +01:00
...
This commit is contained in:
parent
0e62938403
commit
529f1d1b83
@ -221,9 +221,13 @@ func (self *MusicLibListPage) Click() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if cur_li.MyType == UI.ICON_TYPES["FILE"] {
|
if cur_li.MyType == UI.ICON_TYPES["FILE"] {
|
||||||
//addfile(cur_li.Path)
|
conn := self.Parent.MpdClient
|
||||||
//PlayListPage.SyncList()
|
conn.Add(cur_li.Path)
|
||||||
//print("add" , cur_li._Path)
|
self.Parent.SyncList()
|
||||||
|
//addfile(cur_li.Path)
|
||||||
|
//PlayListPage.SyncList()
|
||||||
|
//print("add" , cur_li._Path)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.Screen.Draw()
|
self.Screen.Draw()
|
||||||
|
|||||||
@ -93,6 +93,59 @@ func (self *MusicPlayerPage) SetLabels() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *MusicPlayerPage) SyncList() {
|
||||||
|
conn := self.MpdClient
|
||||||
|
start_x := 0
|
||||||
|
start_y := 0
|
||||||
|
|
||||||
|
if conn == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
self.MyList = nil
|
||||||
|
|
||||||
|
play_list,_ := conn.PlaylistInfo(-1,-1)
|
||||||
|
|
||||||
|
for i,v := range play_list {
|
||||||
|
li := NewMusicPlayPageListItem()
|
||||||
|
li.Parent = self
|
||||||
|
li.PosX = start_x
|
||||||
|
li.PosY = start_y + UI.DefaultInfoPageListItemHeight * i
|
||||||
|
li.Width = UI.Width
|
||||||
|
li.Fonts["normal"] = self.ListFontObj
|
||||||
|
|
||||||
|
if val,ok:=v["Title"]; ok {
|
||||||
|
li.Init(val)
|
||||||
|
|
||||||
|
if val2,ok2 := v["file"]; ok2 {
|
||||||
|
li.Path = val2
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if val2,ok2 := v["file"]; ok2 {
|
||||||
|
li.Init(filepath.Base(val2))
|
||||||
|
li.Path = val2
|
||||||
|
}else{
|
||||||
|
li.Init("NoName")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
li.Labels["Text"].PosX = 7
|
||||||
|
self.MyList = append(self.MyList, li)
|
||||||
|
}
|
||||||
|
|
||||||
|
self.SyncPlaying()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *MusicPlayerPage) SyncPlaying() {
|
||||||
|
conn := self.MpdClient
|
||||||
|
|
||||||
|
for i,_ := range self.MyList {
|
||||||
|
self.MyList[i].(*MusicPlayPageListItem).Active = false
|
||||||
|
self.MyList[i].(*MusicPlayPageListItem).PlayingProcess = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (self *MusicPlayerPage) Init() {
|
func (self *MusicPlayerPage) Init() {
|
||||||
if self.Screen == nil {
|
if self.Screen == nil {
|
||||||
panic("No Screen")
|
panic("No Screen")
|
||||||
|
|||||||
@ -27,6 +27,8 @@ type MusicPlayPageListItem struct {
|
|||||||
Value string
|
Value string
|
||||||
MyType int
|
MyType int
|
||||||
Path string
|
Path string
|
||||||
|
|
||||||
|
PlayingProcess int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMusicPlayPageListItem() *MusicPlayPageListItem {
|
func NewMusicPlayPageListItem() *MusicPlayPageListItem {
|
||||||
@ -47,15 +49,30 @@ func (self *MusicPlayPageListItem) Draw() {
|
|||||||
w, h := self.Labels["Text"].Size()
|
w, h := self.Labels["Text"].Size()
|
||||||
|
|
||||||
self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2)
|
self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2)
|
||||||
|
|
||||||
|
|
||||||
if self.Active == true {
|
if self.MyType == UI.ICON_TYPES["DIR"] && self.Path != "[..]" {
|
||||||
self.Parent.(*MusicPlayerPage).Icons["sys"].NewCoord(self.Parent.(*MusicPlayerPage).Width-30, self.PosY+5)
|
sys_icon := self.Parent.(*MusicPlayerPage).Icons["sys"]
|
||||||
self.Parent.(*MusicPlayerPage).Icons["sys"].Draw()
|
sys_icon.IconIndex = 0.
|
||||||
}
|
sys_icon.NewCoord(self.PosX+12,self.PosY + ( self.Height - sys_icon.Height)/2 + sys_icon.Height /2)
|
||||||
|
sys_icon.Draw()
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.MyType == UI.ICON_TYPES["FILE"] {
|
||||||
|
sys_icon := self.Parent.(*MusicPlayerPage).Icons["sys"]
|
||||||
|
sys_icon.IconIndex = 1
|
||||||
|
sys_icon.NewCoord(self.PosX+12,self.PosY + ( self.Height - sys_icon.Height)/2 + sys_icon.Height /2)
|
||||||
|
sys_icon.Draw()
|
||||||
|
}
|
||||||
|
|
||||||
|
self.Labels["Text"].Active = self.Active
|
||||||
|
|
||||||
|
self.Labels["Text"].NewCoord(x, self.PosY+(self.Height-h)/2)
|
||||||
|
|
||||||
self.Labels["Text"].SetBold(self.Active)
|
self.Labels["Text"].SetBold(self.Active)
|
||||||
self.Labels["Text"].Draw()
|
self.Labels["Text"].Draw()
|
||||||
|
|
||||||
|
/*
|
||||||
if _, ok := self.Labels["Small"]; ok {
|
if _, ok := self.Labels["Small"]; ok {
|
||||||
x, _ = self.Labels["Small"].Coord()
|
x, _ = self.Labels["Small"].Coord()
|
||||||
w, h = self.Labels["Small"].Size()
|
w, h = self.Labels["Small"].Size()
|
||||||
@ -64,10 +81,16 @@ func (self *MusicPlayPageListItem) Draw() {
|
|||||||
self.Labels["Small"].Draw()
|
self.Labels["Small"].Draw()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
canvas_ := self.Parent.GetCanvasHWND()
|
canvas_ := self.Parent.GetCanvasHWND()
|
||||||
draw.Line(canvas_, &color.Color{169, 169, 169, 255},
|
draw.Line(canvas_, UI.MySkinManager.GiveColor("Line"),
|
||||||
self.PosX, self.PosY+self.Height-1,
|
self.PosX, self.PosY+self.Height-1,
|
||||||
self.PosX+self.Width, self.PosY+self.Height-1, 1)
|
self.PosX+self.Width, self.PosY+self.Height-1, 1)
|
||||||
|
|
||||||
|
if self.PlayingProcess > 0 {
|
||||||
|
seek_posx := int(self.Width * self.PlayingProcess/100.0)
|
||||||
|
draw.Line(canvas_, UI.MySkinManager.GiveColor("Active"),
|
||||||
|
self.PosX, self.PosY+self.Height-2,
|
||||||
|
self.PosX+seek_posx, self.PosY+self.Height-2, 2)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user