Fix warnings when compiling with GCC 7
[ncmpcpp.git] / src / screens / tag_editor.h
blob591dcdb80ed59c38eec92cdc1bc67e663bf41785
1 /***************************************************************************
2 * Copyright (C) 2008-2017 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_TAG_EDITOR_H
22 #define NCMPCPP_TAG_EDITOR_H
24 #include "config.h"
26 #ifdef HAVE_TAGLIB_H
28 #include <list>
30 #include "interfaces.h"
31 #include "mutable_song.h"
32 #include "regex_filter.h"
33 #include "screens/screen.h"
34 #include "song_list.h"
36 struct TagsWindow: NC::Menu<MPD::MutableSong>, SongList
38 TagsWindow() { }
39 TagsWindow(NC::Menu<MPD::MutableSong> &&base)
40 : NC::Menu<MPD::MutableSong>(std::move(base)) { }
42 virtual SongIterator currentS() override;
43 virtual ConstSongIterator currentS() const override;
44 virtual SongIterator beginS() override;
45 virtual ConstSongIterator beginS() const override;
46 virtual SongIterator endS() override;
47 virtual ConstSongIterator endS() const override;
49 virtual std::vector<MPD::Song> getSelectedSongs() override;
52 struct TagEditor: Screen<NC::Window *>, HasActions, HasColumns, HasSongs, Searchable, Tabbable
54 TagEditor();
56 virtual void resize() override;
57 virtual void switchTo() override;
59 virtual std::wstring title() override;
60 virtual ScreenType type() override { return ScreenType::TagEditor; }
62 virtual void refresh() override;
63 virtual void update() override;
65 virtual void mouseButtonPressed(MEVENT) override;
67 virtual bool isLockable() override { return true; }
68 virtual bool isMergable() override { return true; }
70 // Searchable implementation
71 virtual bool allowsSearching() override;
72 virtual const std::string &searchConstraint() override;
73 virtual void setSearchConstraint(const std::string &constraint) override;
74 virtual void clearSearchConstraint() override;
75 virtual bool search(SearchDirection direction, bool wrap, bool skip_current) override;
77 // HasActions implementation
78 virtual bool actionRunnable() override;
79 virtual void runAction() override;
81 // HasSongs implementation
82 virtual bool itemAvailable() override;
83 virtual bool addItemToPlaylist(bool play) override;
84 virtual std::vector<MPD::Song> getSelectedSongs() override;
86 // HasColumns implementation
87 virtual bool previousColumnAvailable() override;
88 virtual void previousColumn() override;
90 virtual bool nextColumnAvailable() override;
91 virtual void nextColumn() override;
93 // private members
94 bool enterDirectory();
95 void LocateSong(const MPD::Song &s);
96 const std::string &CurrentDir() { return itsBrowsedDir; }
98 NC::Menu< std::pair<std::string, std::string> > *Dirs;
99 NC::Menu<std::string> *TagTypes;
100 TagsWindow *Tags;
102 private:
103 void SetDimensions(size_t, size_t);
105 std::vector<MPD::MutableSong *> EditedSongs;
106 NC::Menu<std::string> *FParserDialog;
107 NC::Menu<std::string> *FParser;
108 NC::Scrollpad *FParserHelper;
109 NC::Scrollpad *FParserLegend;
110 NC::Scrollpad *FParserPreview;
111 bool FParserUsePreview;
113 std::string itsBrowsedDir;
114 std::string itsHighlightedDir;
116 Regex::Filter<std::pair<std::string, std::string>> m_directories_search_predicate;
117 Regex::Filter<MPD::MutableSong> m_songs_search_predicate;
120 extern TagEditor *myTagEditor;
122 #endif // HAVE_TAGLIB_H
124 #endif // NCMPCPP_TAG_EDITOR_H