Make 'update_environment' action also update local mpd status
[ncmpcpp.git] / src / screens / playlist_editor.h
blob3d6efb75e49f6e216b2b6340af900af18f5edd00
1 /***************************************************************************
2 * Copyright (C) 2008-2016 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 "screens/screen.h"
29 #include "song_list.h"
31 struct PlaylistEditor: Screen<NC::Window *>, Filterable, 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 const std::string &searchConstraint() override;
54 virtual void setSearchConstraint(const std::string &constraint) override;
55 virtual void clearSearchConstraint() override;
56 virtual bool search(SearchDirection direction, bool wrap, bool skip_current) override;
58 // Filterable implementation
59 virtual bool allowsFiltering() override;
60 virtual std::string currentFilter() override;
61 virtual void applyFilter(const std::string &filter) override;
63 // HasSongs implementation
64 virtual bool itemAvailable() override;
65 virtual bool addItemToPlaylist(bool play) override;
66 virtual std::vector<MPD::Song> getSelectedSongs() override;
68 // HasColumns implementation
69 virtual bool previousColumnAvailable() override;
70 virtual void previousColumn() override;
72 virtual bool nextColumnAvailable() override;
73 virtual void nextColumn() override;
75 // private members
76 void updateTimer();
78 void requestPlaylistsUpdate() { m_playlists_update_requested = true; }
79 void requestContentsUpdate() { m_content_update_requested = true; }
81 void locatePlaylist(const MPD::Playlist &playlist);
83 NC::Menu<MPD::Playlist> Playlists;
84 SongMenu Content;
86 private:
87 bool m_playlists_update_requested;
88 bool m_content_update_requested;
90 boost::posix_time::ptime m_timer;
92 const int m_window_timeout;
93 const boost::posix_time::time_duration m_fetching_delay;
95 Regex::Filter<MPD::Playlist> m_playlists_search_predicate;
96 Regex::Filter<MPD::Song> m_content_search_predicate;
99 extern PlaylistEditor *myPlaylistEditor;
101 #endif // NCMPCPP_PLAYLIST_EDITOR_H