diff options
author | Simon Garrelou <simon.garrelou@gmail.com> | 2022-12-09 15:21:04 +0100 |
---|---|---|
committer | Simon Garrelou <simon.garrelou@gmail.com> | 2022-12-09 15:21:04 +0100 |
commit | 9d1d1a02fde0a1561ad6a61e551a144bbeadc45b (patch) | |
tree | 7add9eb152c207e0e5cd3aaa6a3cd0b763f3ce4f /src/app.go | |
parent | 84665faeac2e721698dcfdb40d13a3db65e76f80 (diff) | |
download | termsonic-9d1d1a02fde0a1561ad6a61e551a144bbeadc45b.tar.gz termsonic-9d1d1a02fde0a1561ad6a61e551a144bbeadc45b.zip |
Add play queue page
Diffstat (limited to 'src/app.go')
-rw-r--r-- | src/app.go | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -19,10 +19,13 @@ type app struct { | |||
19 | footer *tview.TextView | 19 | footer *tview.TextView |
20 | cfg *Config | 20 | cfg *Config |
21 | 21 | ||
22 | // Artists panel | 22 | // Artists page |
23 | artistsTree *tview.TreeView | 23 | artistsTree *tview.TreeView |
24 | songsList *tview.List | 24 | songsList *tview.List |
25 | 25 | ||
26 | // Play queue page | ||
27 | playQueueList *tview.List | ||
28 | |||
26 | // Subsonic variables | 29 | // Subsonic variables |
27 | sub *subsonic.Client | 30 | sub *subsonic.Client |
28 | playQueue *music.Queue | 31 | playQueue *music.Queue |
@@ -42,6 +45,7 @@ func Run(cfg *Config) { | |||
42 | a.pages.SetBorder(true) | 45 | a.pages.SetBorder(true) |
43 | a.pages.AddPage("config", a.configPage(), true, false) | 46 | a.pages.AddPage("config", a.configPage(), true, false) |
44 | a.pages.AddPage("artists", a.artistsPage(), true, false) | 47 | a.pages.AddPage("artists", a.artistsPage(), true, false) |
48 | a.pages.AddPage("playqueue", a.queuePage(), true, false) | ||
45 | 49 | ||
46 | mainLayout := tview.NewFlex(). | 50 | mainLayout := tview.NewFlex(). |
47 | SetDirection(tview.FlexRow). | 51 | SetDirection(tview.FlexRow). |
@@ -69,9 +73,12 @@ func Run(cfg *Config) { | |||
69 | a.switchToPage("artists") | 73 | a.switchToPage("artists") |
70 | return nil | 74 | return nil |
71 | case tcell.KeyF2: | 75 | case tcell.KeyF2: |
72 | a.switchToPage("playlists") | 76 | a.switchToPage("playqueue") |
73 | return nil | 77 | return nil |
74 | case tcell.KeyF3: | 78 | case tcell.KeyF3: |
79 | a.switchToPage("playlists") | ||
80 | return nil | ||
81 | case tcell.KeyF4: | ||
75 | a.switchToPage("config") | 82 | a.switchToPage("config") |
76 | return nil | 83 | return nil |
77 | } | 84 | } |
@@ -97,6 +104,11 @@ func (a *app) switchToPage(name string) { | |||
97 | a.headerSections.Highlight("artists") | 104 | a.headerSections.Highlight("artists") |
98 | a.tv.SetFocus(a.artistsTree) | 105 | a.tv.SetFocus(a.artistsTree) |
99 | a.pages.SetBorder(false) | 106 | a.pages.SetBorder(false) |
107 | case "playqueue": | ||
108 | a.pages.SwitchToPage("playqueue") | ||
109 | a.headerSections.Highlight("playqueue") | ||
110 | a.tv.SetFocus(a.playQueueList) | ||
111 | a.pages.SetBorder(true) | ||
100 | case "playlists": | 112 | case "playlists": |
101 | a.pages.SwitchToPage("playlists") | 113 | a.pages.SwitchToPage("playlists") |
102 | a.headerSections.Highlight("playlists") | 114 | a.headerSections.Highlight("playlists") |