playlist editor: change data fetch delay to 250ms
[ncmpcpp.git] / src / playlist_editor.h
blob83818b2b3c9228db4d269ead98083a7fb0a28596
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 int windowTimeout() OVERRIDE;
42 virtual void enterPressed() OVERRIDE;
43 virtual void spacePressed() OVERRIDE;
44 virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
46 virtual bool isMergable() OVERRIDE { return true; }
48 // Filterable implementation
49 virtual bool allowsFiltering() OVERRIDE;
50 virtual std::string currentFilter() OVERRIDE;
51 virtual void applyFilter(const std::string &filter) OVERRIDE;
53 // Searchable implementation
54 virtual bool allowsSearching() OVERRIDE;
55 virtual bool search(const std::string &constraint) OVERRIDE;
56 virtual void nextFound(bool wrap) OVERRIDE;
57 virtual void prevFound(bool wrap) OVERRIDE;
59 // HasSongs implementation
60 virtual ProxySongList proxySongList() OVERRIDE;
62 virtual bool allowsSelection() OVERRIDE;
63 virtual void reverseSelection() OVERRIDE;
64 virtual MPD::SongList getSelectedSongs() OVERRIDE;
66 // HasColumns implementation
67 virtual bool previousColumnAvailable() OVERRIDE;
68 virtual void previousColumn() OVERRIDE;
70 virtual bool nextColumnAvailable() OVERRIDE;
71 virtual void nextColumn() OVERRIDE;
73 // private members
74 void updateTimer();
76 void requestPlaylistsUpdate() { m_playlists_update_requested = true; }
77 void requestContentsUpdate() { m_content_update_requested = true; }
79 virtual void Locate(const std::string &);
80 bool isContentFiltered();
81 ProxySongList contentProxyList();
83 NC::Menu<std::string> Playlists;
84 NC::Menu<MPD::Song> Content;
86 protected:
87 virtual bool isLockable() OVERRIDE { return true; }
89 private:
90 void AddToPlaylist(bool);
92 bool m_playlists_update_requested;
93 bool m_content_update_requested;
95 boost::posix_time::ptime m_timer;
98 extern PlaylistEditor *myPlaylistEditor;
100 #endif // NCMPCPP_PLAYLIST_EDITOR_H