playlist editor: add data fetch delay after position changes
[ncmpcpp.git] / src / playlist_editor.h
blob0183a01e79b751dd8f5ad329f07fe63311216c87
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 "interfaces.h"
25 #include "screen.h"
27 struct PlaylistEditor: Screen<NC::Window *>, Filterable, HasColumns, HasSongs, Searchable, Tabbable
29 PlaylistEditor();
31 virtual void switchTo() OVERRIDE;
32 virtual void resize() OVERRIDE;
34 virtual std::wstring title() OVERRIDE;
35 virtual ScreenType type() OVERRIDE { return ScreenType::PlaylistEditor; }
37 virtual void refresh() OVERRIDE;
38 virtual void update() OVERRIDE;
40 virtual void enterPressed() OVERRIDE;
41 virtual void spacePressed() OVERRIDE;
42 virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
44 virtual bool isMergable() OVERRIDE { return true; }
46 // Filterable implementation
47 virtual bool allowsFiltering() OVERRIDE;
48 virtual std::string currentFilter() OVERRIDE;
49 virtual void applyFilter(const std::string &filter) OVERRIDE;
51 // Searchable implementation
52 virtual bool allowsSearching() OVERRIDE;
53 virtual bool search(const std::string &constraint) OVERRIDE;
54 virtual void nextFound(bool wrap) OVERRIDE;
55 virtual void prevFound(bool wrap) OVERRIDE;
57 // HasSongs implementation
58 virtual ProxySongList proxySongList() OVERRIDE;
60 virtual bool allowsSelection() OVERRIDE;
61 virtual void reverseSelection() OVERRIDE;
62 virtual MPD::SongList getSelectedSongs() OVERRIDE;
64 // HasColumns implementation
65 virtual bool previousColumnAvailable() OVERRIDE;
66 virtual void previousColumn() OVERRIDE;
68 virtual bool nextColumnAvailable() OVERRIDE;
69 virtual void nextColumn() OVERRIDE;
71 // private members
72 void updateTimer();
74 void requestPlaylistsUpdate() { m_playlists_update_requested = true; }
75 void requestContentsUpdate() { m_content_update_requested = true; }
77 virtual void Locate(const std::string &);
78 bool isContentFiltered();
79 ProxySongList contentProxyList();
81 NC::Menu<std::string> Playlists;
82 NC::Menu<MPD::Song> Content;
84 protected:
85 virtual bool isLockable() OVERRIDE { return true; }
87 private:
88 void AddToPlaylist(bool);
90 bool m_playlists_update_requested;
91 bool m_content_update_requested;
93 boost::posix_time::ptime m_timer;
96 extern PlaylistEditor *myPlaylistEditor;
98 #endif // NCMPCPP_PLAYLIST_EDITOR_H