1 /***************************************************************************
2 * Copyright (C) 2008-2009 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
30 class Playlist
: public Screen
<Window
>
33 Playlist() : NowPlaying(-1), itsTotalLength(0), itsRemainingTime(0), itsScrollBegin(0) { }
36 virtual void SwitchTo();
37 virtual void Resize();
39 virtual std::basic_string
<my_char_t
> Title();
41 virtual void EnterPressed();
42 virtual void SpacePressed();
43 virtual void MouseButtonPressed(MEVENT
);
45 virtual MPD::Song
*CurrentSong();
47 virtual bool allowsSelection() { return w
== Items
; }
48 virtual void ReverseSelection() { Items
->ReverseSelection(); }
49 virtual void GetSelectedSongs(MPD::SongList
&);
51 virtual void ApplyFilter(const std::string
&);
53 virtual List
*GetList() { return w
== Items
? Items
: 0; }
55 bool isPlaying() { return NowPlaying
>= 0 && !Items
->Empty(); }
56 const MPD::Song
*NowPlayingSong();
59 void AdjustSortOrder(int key
);
60 bool SortingInProgress() { return w
== SortDialog
; }
61 void FixPositions(size_t = 0);
63 void EnableHighlighting();
64 void UpdateTimer() { time(&itsTimer
); }
65 time_t Timer() const { return itsTimer
; }
67 bool Add(const MPD::Song
&s
, bool in_playlist
, bool play
);
68 bool Add(const MPD::SongList
&l
, bool play
);
70 static std::string
SongToString(const MPD::Song
&, void *);
71 static std::string
SongInColumnsToString(const MPD::Song
&, void *);
73 Menu
< MPD::Song
> *Items
;
77 static bool ReloadTotalLength
;
78 static bool ReloadRemaining
;
80 static bool BlockNowPlayingUpdate
;
81 static bool BlockUpdate
;
87 std::string
TotalLength();
89 std::string itsBufferedStats
;
91 size_t itsTotalLength
;
92 size_t itsRemainingTime
;
93 size_t itsScrollBegin
;
97 static bool Sorting(MPD::Song
*a
, MPD::Song
*b
);
99 static Menu
< std::pair
<std::string
, MPD::Song::GetFunction
> > *SortDialog
;
100 static const size_t SortOptions
;
101 static const size_t SortDialogWidth
;
102 static size_t SortDialogHeight
;
105 extern Playlist
*myPlaylist
;