Rename Application Fields
This commit is contained in:
parent
e2fd4c117e
commit
dbfc617037
12
App.go
12
App.go
@ -9,10 +9,10 @@ var IMG_X, IMG_Y, IMG_W, IMG_H int
|
|||||||
|
|
||||||
type Application struct {
|
type Application struct {
|
||||||
App *tview.Application
|
App *tview.Application
|
||||||
expandedView *tview.Table
|
ExpandedView *tview.Table
|
||||||
Navbar *tview.Table
|
Navbar *tview.Table
|
||||||
searchBar *tview.Table
|
SearchBar *tview.Table
|
||||||
pBar *progressBar
|
ProgressBar *progressBar
|
||||||
Pages *tview.Pages
|
Pages *tview.Pages
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,10 +60,10 @@ func newApplication(r *Renderer) *Application {
|
|||||||
|
|
||||||
return &Application{
|
return &Application{
|
||||||
App: App,
|
App: App,
|
||||||
expandedView: expandedView,
|
ExpandedView: expandedView,
|
||||||
Navbar: Navbar,
|
Navbar: Navbar,
|
||||||
searchBar: searchBar,
|
SearchBar: searchBar,
|
||||||
pBar: pBar,
|
ProgressBar: pBar,
|
||||||
Pages: rootPages,
|
Pages: rootPages,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
28
main.go
28
main.go
@ -39,31 +39,31 @@ func main() {
|
|||||||
fileMap, err := CONN.GetFiles()
|
fileMap, err := CONN.GetFiles()
|
||||||
dirTree := generateDirectoryTree(fileMap)
|
dirTree := generateDirectoryTree(fileMap)
|
||||||
|
|
||||||
UpdatePlaylist(UI.expandedView)
|
UpdatePlaylist(UI.ExpandedView)
|
||||||
|
|
||||||
_v, _ := CONN.Status()
|
_v, _ := CONN.Status()
|
||||||
Volume, _ = strconv.ParseInt(_v["volume"], 10, 64)
|
Volume, _ = strconv.ParseInt(_v["volume"], 10, 64)
|
||||||
Random, _ = strconv.ParseBool(_v["random"])
|
Random, _ = strconv.ParseBool(_v["random"])
|
||||||
Repeat, _ = strconv.ParseBool(_v["repeat"])
|
Repeat, _ = strconv.ParseBool(_v["repeat"])
|
||||||
|
|
||||||
UI.expandedView.SetDrawFunc(func(s tcell.Screen, x, y, width, height int) (int, int, int, int) {
|
UI.ExpandedView.SetDrawFunc(func(s tcell.Screen, x, y, width, height int) (int, int, int, int) {
|
||||||
if InsidePlaylist {
|
if InsidePlaylist {
|
||||||
UpdatePlaylist(UI.expandedView)
|
UpdatePlaylist(UI.ExpandedView)
|
||||||
} else {
|
} else {
|
||||||
Update(dirTree.children, UI.expandedView)
|
Update(dirTree.children, UI.ExpandedView)
|
||||||
}
|
}
|
||||||
return UI.expandedView.GetInnerRect()
|
return UI.ExpandedView.GetInnerRect()
|
||||||
})
|
})
|
||||||
|
|
||||||
var FUNC_MAP = map[string]func(){
|
var FUNC_MAP = map[string]func(){
|
||||||
"showChildrenContent": func() {
|
"showChildrenContent": func() {
|
||||||
r, _ := UI.expandedView.GetSelection()
|
r, _ := UI.ExpandedView.GetSelection()
|
||||||
if !InsidePlaylist {
|
if !InsidePlaylist {
|
||||||
if len(dirTree.children[r].children) == 0 {
|
if len(dirTree.children[r].children) == 0 {
|
||||||
id, _ := CONN.AddId(dirTree.children[r].absolutePath, -1)
|
id, _ := CONN.AddId(dirTree.children[r].absolutePath, -1)
|
||||||
CONN.PlayId(id)
|
CONN.PlayId(id)
|
||||||
} else {
|
} else {
|
||||||
Update(dirTree.children[r].children, UI.expandedView)
|
Update(dirTree.children[r].children, UI.ExpandedView)
|
||||||
dirTree = &dirTree.children[r]
|
dirTree = &dirTree.children[r]
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -76,7 +76,7 @@ func main() {
|
|||||||
"showParentContent": func() {
|
"showParentContent": func() {
|
||||||
if !InsidePlaylist {
|
if !InsidePlaylist {
|
||||||
if dirTree.parent != nil {
|
if dirTree.parent != nil {
|
||||||
Update(dirTree.parent.children, UI.expandedView)
|
Update(dirTree.parent.children, UI.ExpandedView)
|
||||||
dirTree = dirTree.parent
|
dirTree = dirTree.parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ func main() {
|
|||||||
"clearPlaylist": func() {
|
"clearPlaylist": func() {
|
||||||
CONN.Clear()
|
CONN.Clear()
|
||||||
if InsidePlaylist {
|
if InsidePlaylist {
|
||||||
UpdatePlaylist(UI.expandedView)
|
UpdatePlaylist(UI.ExpandedView)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"previousSong": func() {
|
"previousSong": func() {
|
||||||
@ -95,7 +95,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
"addToPlaylist": func() {
|
"addToPlaylist": func() {
|
||||||
if !InsidePlaylist {
|
if !InsidePlaylist {
|
||||||
r, _ := UI.expandedView.GetSelection()
|
r, _ := UI.ExpandedView.GetSelection()
|
||||||
CONN.Add(dirTree.children[r].absolutePath)
|
CONN.Add(dirTree.children[r].absolutePath)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -130,12 +130,12 @@ func main() {
|
|||||||
"navigateToFiles": func() {
|
"navigateToFiles": func() {
|
||||||
InsidePlaylist = false
|
InsidePlaylist = false
|
||||||
UI.Navbar.Select(1, 0)
|
UI.Navbar.Select(1, 0)
|
||||||
Update(dirTree.children, UI.expandedView)
|
Update(dirTree.children, UI.ExpandedView)
|
||||||
},
|
},
|
||||||
"navigateToPlaylist": func() {
|
"navigateToPlaylist": func() {
|
||||||
InsidePlaylist = true
|
InsidePlaylist = true
|
||||||
UI.Navbar.Select(0, 0)
|
UI.Navbar.Select(0, 0)
|
||||||
UpdatePlaylist(UI.expandedView)
|
UpdatePlaylist(UI.ExpandedView)
|
||||||
},
|
},
|
||||||
"navigateToMostPlayed": func() {
|
"navigateToMostPlayed": func() {
|
||||||
InsidePlaylist = false
|
InsidePlaylist = false
|
||||||
@ -155,7 +155,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
"deleteSongFromPlaylist": func() {
|
"deleteSongFromPlaylist": func() {
|
||||||
if InsidePlaylist {
|
if InsidePlaylist {
|
||||||
r, _ := UI.expandedView.GetSelection()
|
r, _ := UI.ExpandedView.GetSelection()
|
||||||
CONN.Delete(r, -1)
|
CONN.Delete(r, -1)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -163,7 +163,7 @@ func main() {
|
|||||||
|
|
||||||
config.GenerateKeyMap(FUNC_MAP)
|
config.GenerateKeyMap(FUNC_MAP)
|
||||||
|
|
||||||
UI.expandedView.SetInputCapture(func(e *tcell.EventKey) *tcell.EventKey {
|
UI.ExpandedView.SetInputCapture(func(e *tcell.EventKey) *tcell.EventKey {
|
||||||
if val, ok := config.KEY_MAP[int(e.Rune())]; ok {
|
if val, ok := config.KEY_MAP[int(e.Rune())]; ok {
|
||||||
FUNC_MAP[val]()
|
FUNC_MAP[val]()
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user