change version to 0.7.3
[ncmpcpp.git] / src / playlist_editor.h
blobb5ff33ca58443e0068bc229a788c78d16c0df990
1 /***************************************************************************
2 * Copyright (C) 2008-2014 by Andrzej Rybczak *
3 * electricityispower@gmail.com *
4 * *
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. *
9 * *
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. *
14 * *
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 ***************************************************************************/
21 #ifndef NCMPCPP_PLAYLIST_EDITOR_H
22 #define NCMPCPP_PLAYLIST_EDITOR_H
24 #include <boost/date_time/posix_time/posix_time_types.hpp>
26 #include "interfaces.h"
27 #include "regex_filter.h"
28 #include "screen.h"
29 #include "song_list.h"
31 struct PlaylistEditor: Screen<NC::Window *>, HasColumns, HasSongs, Searchable, Tabbable
33 PlaylistEditor();
35 virtual void switchTo() OVERRIDE;
36 virtual void resize() OVERRIDE;
38 virtual std::wstring title() OVERRIDE;
39 virtual ScreenType type() OVERRIDE { return ScreenType::PlaylistEditor; }
41 virtual void refresh() OVERRIDE;
42 virtual void update() OVERRIDE;
44 virtual int windowTimeout() OVERRIDE;
46 virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
48 virtual bool isLockable() OVERRIDE { return true; }
49 virtual bool isMergable() OVERRIDE { return true; }
51 // Searchable implementation
52 virtual bool allowsSearching() OVERRIDE;
53 virtual void setSearchConstraint(const std::string &constraint) OVERRIDE;
54 virtual void clearConstraint() OVERRIDE;
55 virtual bool find(SearchDirection direction, bool wrap, bool skip_current) OVERRIDE;
57 // HasSongs implementation
58 virtual bool itemAvailable() OVERRIDE;
59 virtual bool addItemToPlaylist(bool play) OVERRIDE;
60 virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
62 // HasColumns implementation
63 virtual bool previousColumnAvailable() OVERRIDE;
64 virtual void previousColumn() OVERRIDE;
66 virtual bool nextColumnAvailable() OVERRIDE;
67 virtual void nextColumn() OVERRIDE;
69 // private members
70 void updateTimer();
72 void requestPlaylistsUpdate() { m_playlists_update_requested = true; }
73 void requestContentsUpdate() { m_content_update_requested = true; }
75 virtual void Locate(const MPD::Playlist &playlist);
77 NC::Menu<MPD::Playlist> Playlists;
78 SongMenu Content;
80 private:
81 bool m_playlists_update_requested;
82 bool m_content_update_requested;
84 boost::posix_time::ptime m_timer;
86 const int m_window_timeout;
87 const boost::posix_time::time_duration m_fetching_delay;
89 Regex::Filter<MPD::Playlist> m_playlists_search_predicate;
90 Regex::Filter<MPD::Song> m_content_search_predicate;
93 extern PlaylistEditor *myPlaylistEditor;
95 #endif // NCMPCPP_PLAYLIST_EDITOR_H