Rename Application Fields

This commit is contained in:
aditya-K2 2021-11-13 16:57:54 +05:30
parent e2fd4c117e
commit dbfc617037
2 changed files with 20 additions and 20 deletions

12
App.go
View File

@ -9,10 +9,10 @@ var IMG_X, IMG_Y, IMG_W, IMG_H int
type Application struct {
App *tview.Application
expandedView *tview.Table
ExpandedView *tview.Table
Navbar *tview.Table
searchBar *tview.Table
pBar *progressBar
SearchBar *tview.Table
ProgressBar *progressBar
Pages *tview.Pages
}
@ -60,10 +60,10 @@ func newApplication(r *Renderer) *Application {
return &Application{
App: App,
expandedView: expandedView,
ExpandedView: expandedView,
Navbar: Navbar,
searchBar: searchBar,
pBar: pBar,
SearchBar: searchBar,
ProgressBar: pBar,
Pages: rootPages,
}

28
main.go
View File

@ -39,31 +39,31 @@ func main() {
fileMap, err := CONN.GetFiles()
dirTree := generateDirectoryTree(fileMap)
UpdatePlaylist(UI.expandedView)
UpdatePlaylist(UI.ExpandedView)
_v, _ := CONN.Status()
Volume, _ = strconv.ParseInt(_v["volume"], 10, 64)
Random, _ = strconv.ParseBool(_v["random"])
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 {
UpdatePlaylist(UI.expandedView)
UpdatePlaylist(UI.ExpandedView)
} 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(){
"showChildrenContent": func() {
r, _ := UI.expandedView.GetSelection()
r, _ := UI.ExpandedView.GetSelection()
if !InsidePlaylist {
if len(dirTree.children[r].children) == 0 {
id, _ := CONN.AddId(dirTree.children[r].absolutePath, -1)
CONN.PlayId(id)
} else {
Update(dirTree.children[r].children, UI.expandedView)
Update(dirTree.children[r].children, UI.ExpandedView)
dirTree = &dirTree.children[r]
}
} else {
@ -76,7 +76,7 @@ func main() {
"showParentContent": func() {
if !InsidePlaylist {
if dirTree.parent != nil {
Update(dirTree.parent.children, UI.expandedView)
Update(dirTree.parent.children, UI.ExpandedView)
dirTree = dirTree.parent
}
}
@ -87,7 +87,7 @@ func main() {
"clearPlaylist": func() {
CONN.Clear()
if InsidePlaylist {
UpdatePlaylist(UI.expandedView)
UpdatePlaylist(UI.ExpandedView)
}
},
"previousSong": func() {
@ -95,7 +95,7 @@ func main() {
},
"addToPlaylist": func() {
if !InsidePlaylist {
r, _ := UI.expandedView.GetSelection()
r, _ := UI.ExpandedView.GetSelection()
CONN.Add(dirTree.children[r].absolutePath)
}
},
@ -130,12 +130,12 @@ func main() {
"navigateToFiles": func() {
InsidePlaylist = false
UI.Navbar.Select(1, 0)
Update(dirTree.children, UI.expandedView)
Update(dirTree.children, UI.ExpandedView)
},
"navigateToPlaylist": func() {
InsidePlaylist = true
UI.Navbar.Select(0, 0)
UpdatePlaylist(UI.expandedView)
UpdatePlaylist(UI.ExpandedView)
},
"navigateToMostPlayed": func() {
InsidePlaylist = false
@ -155,7 +155,7 @@ func main() {
},
"deleteSongFromPlaylist": func() {
if InsidePlaylist {
r, _ := UI.expandedView.GetSelection()
r, _ := UI.ExpandedView.GetSelection()
CONN.Delete(r, -1)
}
},
@ -163,7 +163,7 @@ func main() {
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 {
FUNC_MAP[val]()
return nil