diff --git a/configure.in b/configure.in index 834ffe86..e4218fea 100644 --- a/configure.in +++ b/configure.in @@ -84,6 +84,18 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ], [[int a = 5; std::fu AC_MSG_ERROR([[Your compiler doesn't seem to support lambda functions, please upgrade (GCC >= 4.5)]]) ) +dnl ========================================= +dnl = checking for override keyword support = +dnl ========================================= +AH_TEMPLATE([OVERRIDE], [override keyword used in C++11]) +AC_MSG_CHECKING([whether compiler supports override keyword]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[struct A { virtual void foo() { } }; struct B : public A { virtual void foo() override { } };]], [])], + AC_MSG_RESULT([yes]) + AC_DEFINE([OVERRIDE], [override]), + AC_MSG_RESULT([no]) + AC_DEFINE([OVERRIDE], []), +) + dnl ============================== dnl = checking for regex (win32) = dnl ============================== diff --git a/src/browser.cpp b/src/browser.cpp index a95bb9c6..f84b8186 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -320,22 +320,6 @@ std::shared_ptr Browser::getProxySongList() }); } -MPD::Song *Browser::getSong(size_t pos) -{ - MPD::Song *ptr = 0; - if ((*w)[pos].value().type == itSong) - ptr = (*w)[pos].value().song.get(); - return ptr; -} - -MPD::Song *Browser::currentSong() -{ - if (w->empty()) - return 0; - else - return getSong(w->choice()); -} - bool Browser::allowsSelection() { return true; diff --git a/src/browser.h b/src/browser.h index 46e56a25..42fd9de7 100644 --- a/src/browser.h +++ b/src/browser.h @@ -30,38 +30,40 @@ class Browser : public Screen< NC::Menu >, public Filterable, public public: Browser() : itsBrowseLocally(0), itsScrollBeginning(0), itsBrowsedDir("/") { } - virtual void Resize(); - virtual void SwitchTo(); + // Screen< NC::Menu > implementation + virtual void Resize() OVERRIDE; + virtual void SwitchTo() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void EnterPressed(); - virtual void SpacePressed(); - virtual void MouseButtonPressed(MEVENT); - virtual bool isTabbable() { return true; } + virtual void Update() OVERRIDE { } - /// Filterable implementation - virtual bool allowsFiltering(); - virtual std::string currentFilter(); - virtual void applyFilter(const std::string &filter); + virtual void EnterPressed() OVERRIDE; + virtual void SpacePressed() OVERRIDE; + virtual void MouseButtonPressed(MEVENT me) OVERRIDE; - /// Searchable implementation - virtual bool allowsSearching(); - virtual bool search(const std::string &constraint); - virtual void nextFound(bool wrap); - virtual void prevFound(bool wrap); + virtual bool isTabbable() OVERRIDE { return true; } + virtual bool isMergable() OVERRIDE { return true; } - /// HasSongs implementation - virtual MPD::Song *getSong(size_t pos); - virtual MPD::Song *currentSong(); - virtual std::shared_ptr getProxySongList(); + // Filterable implementation + virtual bool allowsFiltering() OVERRIDE; + virtual std::string currentFilter() OVERRIDE; + virtual void applyFilter(const std::string &filter) OVERRIDE; - virtual bool allowsSelection(); - virtual void reverseSelection(); - virtual MPD::SongList getSelectedSongs(); + // Searchable implementation + virtual bool allowsSearching() OVERRIDE; + virtual bool search(const std::string &constraint) OVERRIDE; + virtual void nextFound(bool wrap) OVERRIDE; + virtual void prevFound(bool wrap) OVERRIDE; - virtual bool isMergable() { return true; } + // HasSongs implementation + virtual std::shared_ptr getProxySongList() OVERRIDE; + virtual bool allowsSelection() OVERRIDE; + virtual void reverseSelection() OVERRIDE; + virtual MPD::SongList getSelectedSongs() OVERRIDE; + + // private members const std::string &CurrentDir() { return itsBrowsedDir; } bool isLocal() { return itsBrowseLocally; } @@ -79,8 +81,8 @@ class Browser : public Screen< NC::Menu >, public Filterable, public } protected: - virtual void Init(); - virtual bool isLockable() { return true; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return true; } private: bool itsBrowseLocally; diff --git a/src/help.h b/src/help.h index b5b89a9c..b15a192a 100644 --- a/src/help.h +++ b/src/help.h @@ -27,20 +27,22 @@ class Help : public Screen { public: - virtual void Resize(); - virtual void SwitchTo(); + virtual void Resize() OVERRIDE; + virtual void SwitchTo() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void EnterPressed() { } - virtual void SpacePressed() { } - virtual bool isTabbable() { return true; } + virtual void Update() OVERRIDE { } - virtual bool isMergable() { return true; } + virtual void EnterPressed() OVERRIDE { } + virtual void SpacePressed() OVERRIDE { } + + virtual bool isTabbable() OVERRIDE { return true; } + virtual bool isMergable() OVERRIDE { return true; } protected: - virtual void Init(); - virtual bool isLockable() { return true; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return true; } private: void KeysSection(const char *title) { Section("Keys", title); } diff --git a/src/lastfm.h b/src/lastfm.h index 05e041a0..9d58f49a 100644 --- a/src/lastfm.h +++ b/src/lastfm.h @@ -36,26 +36,29 @@ class Lastfm : public Screen public: Lastfm() : isReadyToTake(0), isDownloadInProgress(0) { } - virtual void SwitchTo(); - virtual void Resize(); + // Screen + virtual void SwitchTo() OVERRIDE; + virtual void Resize() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void Update(); + virtual void Update() OVERRIDE; - virtual void EnterPressed() { } - virtual void SpacePressed() { } + virtual void EnterPressed() OVERRIDE { } + virtual void SpacePressed() OVERRIDE { } - virtual bool isMergable() { return true; } + virtual bool isMergable() OVERRIDE { return true; } + virtual bool isTabbable() OVERRIDE { return false; } + // private members void Refetch(); bool isDownloading() { return isDownloadInProgress && !isReadyToTake; } bool SetArtistInfoArgs(const std::string &artist, const std::string &lang = ""); protected: - virtual void Init(); - virtual bool isLockable() { return false; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return false; } private: std::basic_string itsTitle; diff --git a/src/lyrics.h b/src/lyrics.h index f71efc07..8d6ca6c8 100644 --- a/src/lyrics.h +++ b/src/lyrics.h @@ -37,18 +37,21 @@ class Lyrics : public Screen # endif // HAVE_CURL_CURL_H itsScrollBegin(0) { } - virtual void Resize(); - virtual void SwitchTo(); + // Screen implementation + virtual void Resize() OVERRIDE; + virtual void SwitchTo() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void Update(); + virtual void Update() OVERRIDE; - virtual void EnterPressed() { } - virtual void SpacePressed(); + virtual void EnterPressed() OVERRIDE { } + virtual void SpacePressed() OVERRIDE; - virtual bool isMergable() { return true; } + virtual bool isMergable() OVERRIDE { return true; } + virtual bool isTabbable() OVERRIDE { return false; } + // private members void Edit(); # ifdef HAVE_CURL_CURL_H @@ -61,8 +64,8 @@ class Lyrics : public Screen bool ReloadNP; protected: - virtual void Init(); - virtual bool isLockable() { return false; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return false; } private: void Load(); diff --git a/src/media_library.cpp b/src/media_library.cpp index 4ca07958..4761e1c0 100644 --- a/src/media_library.cpp +++ b/src/media_library.cpp @@ -336,6 +336,11 @@ void MediaLibrary::Update() } } +void MediaLibrary::EnterPressed() +{ + AddToPlaylist(true); +} + void MediaLibrary::SpacePressed() { if (Config.space_selects) diff --git a/src/media_library.h b/src/media_library.h index 98c25fdf..2b285d70 100644 --- a/src/media_library.h +++ b/src/media_library.h @@ -27,39 +27,40 @@ class MediaLibrary : public Screen, public Filterable, public HasSongs, public Searchable { public: - virtual void SwitchTo(); - virtual void Resize(); + virtual void SwitchTo() OVERRIDE; + virtual void Resize() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void Refresh(); - virtual void Update(); + virtual void Refresh() OVERRIDE; + virtual void Update() OVERRIDE; - virtual void EnterPressed() { AddToPlaylist(1); } - virtual void SpacePressed(); - virtual void MouseButtonPressed(MEVENT); - virtual bool isTabbable() { return true; } + virtual void EnterPressed() OVERRIDE; + virtual void SpacePressed() OVERRIDE; + virtual void MouseButtonPressed(MEVENT me) OVERRIDE; + + virtual bool isTabbable() OVERRIDE { return true; } + virtual bool isMergable() OVERRIDE { return true; } /// Filterable implementation - virtual bool allowsFiltering(); - virtual std::string currentFilter(); - virtual void applyFilter(const std::string &filter); + virtual bool allowsFiltering() OVERRIDE; + virtual std::string currentFilter() OVERRIDE; + virtual void applyFilter(const std::string &filter) OVERRIDE; /// Searchable implementation - virtual bool allowsSearching(); - virtual bool search(const std::string &constraint); - virtual void nextFound(bool wrap); - virtual void prevFound(bool wrap); + virtual bool allowsSearching() OVERRIDE; + virtual bool search(const std::string &constraint) OVERRIDE; + virtual void nextFound(bool wrap) OVERRIDE; + virtual void prevFound(bool wrap) OVERRIDE; /// HasSongs implementation - virtual std::shared_ptr getProxySongList(); + virtual std::shared_ptr getProxySongList() OVERRIDE; - virtual bool allowsSelection(); - virtual void reverseSelection(); - virtual MPD::SongList getSelectedSongs(); - - virtual bool isMergable() { return true; } + virtual bool allowsSelection() OVERRIDE; + virtual void reverseSelection() OVERRIDE; + virtual MPD::SongList getSelectedSongs() OVERRIDE; + // private members int Columns(); bool isNextColumnAvailable(); void NextColumn(); diff --git a/src/menu.h b/src/menu.h index 884b0313..c5e9f669 100644 --- a/src/menu.h +++ b/src/menu.h @@ -283,16 +283,16 @@ template struct Menu : public Window /// Refreshes the menu window /// @see Window::Refresh() - virtual void refresh(); + virtual void refresh() OVERRIDE; /// Scrolls by given amount of lines /// @param where indicated where exactly one wants to go /// @see Window::Scroll() - virtual void scroll(Where where); + virtual void scroll(Where where) OVERRIDE; /// Cleares all options, used filters etc. It doesn't reset highlighted position though. /// @see reset() - virtual void clear(); + virtual void clear() OVERRIDE; /// Sets highlighted position to 0 void reset(); diff --git a/src/outputs.h b/src/outputs.h index 92c2e9f6..499baf92 100644 --- a/src/outputs.h +++ b/src/outputs.h @@ -32,23 +32,28 @@ class Outputs : public Screen< NC::Menu > { public: - virtual void SwitchTo(); - virtual void Resize(); - virtual std::basic_string Title(); + // Screen< NC::Menu > implementation + virtual void SwitchTo() OVERRIDE; + virtual void Resize() OVERRIDE; - virtual void EnterPressed(); - virtual void SpacePressed() { } - virtual void MouseButtonPressed(MEVENT); - virtual bool isTabbable() { return true; } + virtual std::basic_string Title() OVERRIDE; - virtual bool isMergable() { return true; } + virtual void Update() OVERRIDE { } + virtual void EnterPressed() OVERRIDE; + virtual void SpacePressed() OVERRIDE { } + virtual void MouseButtonPressed(MEVENT me) OVERRIDE; + + virtual bool isTabbable() OVERRIDE { return true; } + virtual bool isMergable() OVERRIDE { return true; } + + // private members void FetchList(); protected: - virtual void Init(); - virtual bool isLockable() { return true; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return true; } }; extern Outputs *myOutputs; diff --git a/src/playlist.cpp b/src/playlist.cpp index db9b1e50..bddbb3ce 100644 --- a/src/playlist.cpp +++ b/src/playlist.cpp @@ -338,22 +338,6 @@ std::shared_ptr Playlist::getProxySongList() return ptr; } -MPD::Song *Playlist::getSong(size_t pos) -{ - MPD::Song *ptr = 0; - if (w == Items) - ptr = &(*Items)[pos].value(); - return ptr; -} - -MPD::Song *Playlist::currentSong() -{ - if (Items->empty()) - return 0; - else - return getSong(Items->choice()); -} - bool Playlist::allowsSelection() { return w == Items; diff --git a/src/playlist.h b/src/playlist.h index 809e4d7a..40fc9fbe 100644 --- a/src/playlist.h +++ b/src/playlist.h @@ -35,38 +35,40 @@ class Playlist : public Screen, public Filterable, public HasSongs, Playlist() : NowPlaying(-1), itsTotalLength(0), itsRemainingTime(0), itsScrollBegin(0) { } ~Playlist() { } - virtual void SwitchTo(); - virtual void Resize(); + // Screen implementation + virtual void SwitchTo() OVERRIDE; + virtual void Resize() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void EnterPressed(); - virtual void SpacePressed(); - virtual void MouseButtonPressed(MEVENT); - virtual bool isTabbable() { return true; } + virtual void Update() OVERRIDE { } - /// Filterable implementation - virtual bool allowsFiltering(); - virtual std::string currentFilter(); - virtual void applyFilter(const std::string &filter); + virtual void EnterPressed() OVERRIDE; + virtual void SpacePressed() OVERRIDE; + virtual void MouseButtonPressed(MEVENT me) OVERRIDE; - /// Searchable implementation + virtual bool isTabbable() OVERRIDE { return true; } + virtual bool isMergable() OVERRIDE { return true; } + + // Filterable implementation + virtual bool allowsFiltering() OVERRIDE; + virtual std::string currentFilter() OVERRIDE; + virtual void applyFilter(const std::string &filter) OVERRIDE; + + // Searchable implementation virtual bool allowsSearching(); - virtual bool search(const std::string &constraint); - virtual void nextFound(bool wrap); - virtual void prevFound(bool wrap); + virtual bool search(const std::string &constraint) OVERRIDE; + virtual void nextFound(bool wrap) OVERRIDE; + virtual void prevFound(bool wrap) OVERRIDE; - /// HasSongs implementation - virtual MPD::Song *getSong(size_t pos); - virtual MPD::Song *currentSong(); - virtual std::shared_ptr getProxySongList(); + // HasSongs implementation + virtual std::shared_ptr getProxySongList() OVERRIDE; - virtual bool allowsSelection(); - virtual void reverseSelection(); - virtual MPD::SongList getSelectedSongs(); - - virtual bool isMergable() { return true; } + virtual bool allowsSelection() OVERRIDE; + virtual void reverseSelection() OVERRIDE; + virtual MPD::SongList getSelectedSongs() OVERRIDE; + // private members bool isFiltered(); bool isPlaying() { return NowPlaying >= 0 && !Items->empty(); } const MPD::Song *NowPlayingSong(); @@ -93,9 +95,6 @@ class Playlist : public Screen, public Filterable, public HasSongs, void registerHash(size_t hash); void unregisterHash(size_t hash); - //static std::string SongToString(const MPD::Song &s); - //static std::string SongInColumnsToString(const MPD::Song &s); - NC::Menu< MPD::Song > *Items; int NowPlaying; @@ -104,8 +103,8 @@ class Playlist : public Screen, public Filterable, public HasSongs, static bool ReloadRemaining; protected: - virtual void Init(); - virtual bool isLockable() { return true; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return true; } private: std::string TotalLength(); diff --git a/src/playlist_editor.cpp b/src/playlist_editor.cpp index 6b981bda..e58d40d3 100644 --- a/src/playlist_editor.cpp +++ b/src/playlist_editor.cpp @@ -312,6 +312,11 @@ void PlaylistEditor::AddToPlaylist(bool add_n_play) w->scroll(NC::wDown); } +void PlaylistEditor::EnterPressed() +{ + AddToPlaylist(true); +} + void PlaylistEditor::SpacePressed() { if (Config.space_selects) diff --git a/src/playlist_editor.h b/src/playlist_editor.h index 36f38138..f966243b 100644 --- a/src/playlist_editor.h +++ b/src/playlist_editor.h @@ -26,41 +26,42 @@ class PlaylistEditor : public Screen, public Filterable, public HasSongs, public Searchable { public: - virtual void SwitchTo(); - virtual void Resize(); + virtual void SwitchTo() OVERRIDE; + virtual void Resize() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void Refresh(); - virtual void Update(); + virtual void Refresh() OVERRIDE; + virtual void Update() OVERRIDE; - virtual void EnterPressed() { AddToPlaylist(1); } - virtual void SpacePressed(); - virtual void MouseButtonPressed(MEVENT); - virtual bool isTabbable() { return true; } + virtual void EnterPressed() OVERRIDE; + virtual void SpacePressed() OVERRIDE; + virtual void MouseButtonPressed(MEVENT me) OVERRIDE; + + virtual bool isTabbable() OVERRIDE { return true; } + virtual bool isMergable() OVERRIDE { return true; } /// Filterable implementation - virtual bool allowsFiltering(); - virtual std::string currentFilter(); - virtual void applyFilter(const std::string &filter); + virtual bool allowsFiltering() OVERRIDE; + virtual std::string currentFilter() OVERRIDE; + virtual void applyFilter(const std::string &filter) OVERRIDE; /// Searchable implementation - virtual bool allowsSearching(); - virtual bool search(const std::string &constraint); - virtual void nextFound(bool wrap); - virtual void prevFound(bool wrap); + virtual bool allowsSearching() OVERRIDE; + virtual bool search(const std::string &constraint) OVERRIDE; + virtual void nextFound(bool wrap) OVERRIDE; + virtual void prevFound(bool wrap) OVERRIDE; /// HasSongs implementation - virtual std::shared_ptr getProxySongList(); + virtual std::shared_ptr getProxySongList() OVERRIDE; - virtual bool allowsSelection(); - virtual void reverseSelection(); - virtual MPD::SongList getSelectedSongs(); + virtual bool allowsSelection() OVERRIDE; + virtual void reverseSelection() OVERRIDE; + virtual MPD::SongList getSelectedSongs() OVERRIDE; + // private members virtual void Locate(const std::string &); - virtual bool isMergable() { return true; } - void MoveSelectedItems(Playlist::Movement where); void requestPlaylistsUpdate() { playlistsUpdateRequested = true; } @@ -78,8 +79,8 @@ class PlaylistEditor : public Screen, public Filterable, public HasS NC::Menu *Content; protected: - virtual void Init(); - virtual bool isLockable() { return true; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return true; } private: void AddToPlaylist(bool); diff --git a/src/screen.h b/src/screen.h index 12d62b63..3e8a2dbc 100644 --- a/src/screen.h +++ b/src/screen.h @@ -30,12 +30,10 @@ void ScrollpadMouseButtonPressed(NC::Scrollpad *w, MEVENT me); /// An interface for various instantiations of Screen template class. Since C++ doesn't like /// comparison of two different instantiations of the same template class we need the most /// basic class to be non-template to allow it. -/// class BasicScreen { public: /// Initializes all variables to zero - /// BasicScreen() : hasToBeResized(0), isInitialized(0) { } virtual ~BasicScreen() { } @@ -43,6 +41,15 @@ class BasicScreen /// @see Screen::ActiveWindow() virtual NC::Window *ActiveWindow() = 0; + /// @see Screen::Refresh() + virtual void Refresh() = 0; + + /// @see Screen::RefreshWindow() + virtual void RefreshWindow() = 0; + + /// @see Screen::Scroll() + virtual void Scroll(NC::Where where) = 0; + /// Method used for switching to screen virtual void SwitchTo() = 0; @@ -55,16 +62,7 @@ class BasicScreen /// If the screen contantly has to update itself /// somehow, it should be called by this function. - virtual void Update() { } - - /// @see Screen::Refresh() - virtual void Refresh() = 0; - - /// @see Screen::RefreshWindow() - virtual void RefreshWindow() = 0; - - /// @see Screen::Scroll() - virtual void Scroll(NC::Where where) = 0; + virtual void Update() = 0; /// Invoked after Enter was pressed virtual void EnterPressed() = 0; @@ -73,11 +71,11 @@ class BasicScreen virtual void SpacePressed() = 0; /// @see Screen::MouseButtonPressed() - virtual void MouseButtonPressed(MEVENT) { } - + virtual void MouseButtonPressed(MEVENT me) = 0; + /// When this is overwritten with a function returning true, the /// screen will be used in tab switching. - virtual bool isTabbable() { return false; } + virtual bool isTabbable() = 0; /// @return true if screen is mergable, ie. can be "proper" subwindow /// if one of the screens is locked. Screens that somehow resemble popups @@ -100,7 +98,6 @@ class BasicScreen /// this in the constructor. This function should be invoked /// only once and after that isInitialized flag has to be set /// to true to somehow avoid next attempt of initialization. - /// virtual void Init() = 0; /// @return true if screen can be locked. Note that returning @@ -116,7 +113,6 @@ class BasicScreen void GetWindowResizeParams(size_t &x_offset, size_t &width, bool adjust_locked_screen = true); /// Flag that inditates whether the screen is initialized or not - /// bool isInitialized; }; @@ -138,27 +134,39 @@ template class Screen : public BasicScreen /// it's useful to determine the one that is being /// active /// @return address to window object cast to void * - virtual NC::Window *ActiveWindow(); - - /// @return pointer to currently active window - WindowType *Main(); + virtual NC::Window *ActiveWindow() OVERRIDE { + return w; + } /// Refreshes whole screen - virtual void Refresh(); + virtual void Refresh() OVERRIDE { + w->display(); + } /// Refreshes active window of the screen - virtual void RefreshWindow(); + virtual void RefreshWindow() OVERRIDE { + w->display(); + } /// Scrolls the screen by given amount of lines and /// if fancy scrolling feature is disabled, enters the /// loop that holds main loop until user releases the key /// @param where indicates where one wants to scroll - virtual void Scroll(NC::Where where); + virtual void Scroll(NC::Where where) OVERRIDE { + w->scroll(where); + } /// Invoked after there was one of mouse buttons pressed /// @param me struct that contains coords of where the click /// had its place and button actions - virtual void MouseButtonPressed(MEVENT me); + virtual void MouseButtonPressed(MEVENT me) OVERRIDE { + GenericMouseButtonPressed(w, me); + } + + /// @return pointer to currently active window + WindowType *Main() { + return w; + } protected: /// Template parameter that should indicate the main type @@ -168,36 +176,6 @@ template class Screen : public BasicScreen WindowType *w; }; -template NC::Window *Screen::ActiveWindow() -{ - return w; -} - -template WindowType *Screen::Main() -{ - return w; -} - -template void Screen::Refresh() -{ - w->display(); -} - -template void Screen::RefreshWindow() -{ - w->display(); -} - -template void Screen::Scroll(NC::Where where) -{ - w->scroll(where); -} - -template void Screen::MouseButtonPressed(MEVENT me) -{ - GenericMouseButtonPressed(w, me); -} - /// Specialization for Screen::MouseButtonPressed, that should /// not scroll whole page, but rather a few lines (the number of them is /// defined in the config) diff --git a/src/scrollpad.h b/src/scrollpad.h index 44b3523b..7f99bc1f 100644 --- a/src/scrollpad.h +++ b/src/scrollpad.h @@ -79,25 +79,25 @@ struct Scrollpad: public Window /// Refreshes the window /// @see Window::Refresh() /// - virtual void refresh(); + virtual void refresh() OVERRIDE; /// Scrolls by given amount of lines /// @param where indicates where exactly one wants to go /// @see Window::Scroll() /// - virtual void scroll(Where where); + virtual void scroll(Where where) OVERRIDE; /// Resizes the window /// @param new_width new window's width /// @param new_height new window's height /// @see Window::Resize() /// - virtual void resize(size_t new_width, size_t new_height); + virtual void resize(size_t new_width, size_t new_height) OVERRIDE; /// Cleares the content of scrollpad /// @see Window::clear() /// - virtual void clear(); + virtual void clear() OVERRIDE; /// Sets starting position to the beginning /// diff --git a/src/search_engine.h b/src/search_engine.h index 2d4a65eb..f11e0190 100644 --- a/src/search_engine.h +++ b/src/search_engine.h @@ -76,43 +76,48 @@ struct SEItem class SearchEngine : public Screen< NC::Menu >, public Filterable, public HasSongs, public Searchable { public: - virtual void Resize(); - virtual void SwitchTo(); + // Screen< NC::Menu > implementation + virtual void Resize() OVERRIDE; + virtual void SwitchTo() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void EnterPressed(); - virtual void SpacePressed(); - virtual void MouseButtonPressed(MEVENT); - virtual bool isTabbable() { return true; } + virtual void Update() OVERRIDE { } - /// Filterable implementation - virtual bool allowsFiltering(); - virtual std::string currentFilter(); - virtual void applyFilter(const std::string &filter); + virtual void EnterPressed() OVERRIDE; + virtual void SpacePressed() OVERRIDE; + virtual void MouseButtonPressed(MEVENT me) OVERRIDE; - /// Searchable implementation - virtual bool allowsSearching(); - virtual bool search(const std::string &constraint); - virtual void nextFound(bool wrap); - virtual void prevFound(bool wrap); + virtual bool isTabbable() OVERRIDE { return true; } + virtual bool isMergable() OVERRIDE { return true; } - /// HasSongs implementation - virtual std::shared_ptr getProxySongList(); + // Filterable implementation + virtual bool allowsFiltering() OVERRIDE; + virtual std::string currentFilter() OVERRIDE; + virtual void applyFilter(const std::string &filter) OVERRIDE; - virtual bool allowsSelection(); - virtual void reverseSelection(); - virtual MPD::SongList getSelectedSongs(); + // Searchable implementation + virtual bool allowsSearching() OVERRIDE; + virtual bool search(const std::string &constraint) OVERRIDE; + virtual void nextFound(bool wrap) OVERRIDE; + virtual void prevFound(bool wrap) OVERRIDE; - virtual bool isMergable() { return true; } + // HasSongs implementation + virtual std::shared_ptr getProxySongList() OVERRIDE; + + virtual bool allowsSelection() OVERRIDE; + virtual void reverseSelection() OVERRIDE; + virtual MPD::SongList getSelectedSongs() OVERRIDE; + + // private members static size_t StaticOptions; static size_t SearchButton; static size_t ResetButton; protected: - virtual void Init(); - virtual bool isLockable() { return true; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return true; } private: void Prepare(); diff --git a/src/sel_items_adder.h b/src/sel_items_adder.h index 03758032..83d90a37 100644 --- a/src/sel_items_adder.h +++ b/src/sel_items_adder.h @@ -28,21 +28,25 @@ class SelectedItemsAdder : public Screen< NC::Menu > public: SelectedItemsAdder() : itsPSWidth(35), itsPSHeight(11) { } - virtual void SwitchTo(); - virtual void Resize(); - virtual void Refresh(); + // Screen< NC::Menu > implementation + virtual void SwitchTo() OVERRIDE; + virtual void Resize() OVERRIDE; + virtual void Refresh() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void EnterPressed(); - virtual void SpacePressed() { } - virtual void MouseButtonPressed(MEVENT); + virtual void Update() OVERRIDE { } - virtual bool isMergable() { return false; } + virtual void EnterPressed() OVERRIDE; + virtual void SpacePressed() OVERRIDE { } + virtual void MouseButtonPressed(MEVENT me) OVERRIDE; + + virtual bool isMergable() OVERRIDE { return false; } + virtual bool isTabbable() OVERRIDE { return false; } protected: - virtual void Init(); - virtual bool isLockable() { return false; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return false; } private: void SetDimensions(); diff --git a/src/server_info.h b/src/server_info.h index b58f706f..d66ac9b7 100644 --- a/src/server_info.h +++ b/src/server_info.h @@ -26,21 +26,23 @@ class ServerInfo : public Screen { public: - virtual void SwitchTo(); - virtual void Resize(); + // Screen implementation + virtual void SwitchTo() OVERRIDE; + virtual void Resize() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void Update(); + virtual void Update() OVERRIDE; - virtual void EnterPressed() { } - virtual void SpacePressed() { } + virtual void EnterPressed() OVERRIDE { } + virtual void SpacePressed() OVERRIDE { } - virtual bool isMergable() { return false; } + virtual bool isMergable() OVERRIDE { return false; } + virtual bool isTabbable() OVERRIDE { return false; } protected: - virtual void Init(); - virtual bool isLockable() { return false; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return false; } private: void SetDimensions(); diff --git a/src/song_info.h b/src/song_info.h index 65220168..3f58c2f9 100644 --- a/src/song_info.h +++ b/src/song_info.h @@ -34,21 +34,27 @@ class SongInfo : public Screen MPD::MutableSong::SetFunction Set; }; - virtual void SwitchTo(); - virtual void Resize(); + // Screen implementation + virtual void SwitchTo() OVERRIDE; + virtual void Resize() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void EnterPressed() { } - virtual void SpacePressed() { } + virtual void Update() OVERRIDE { } - virtual bool isMergable() { return true; } + virtual void EnterPressed() OVERRIDE { } + virtual void SpacePressed() OVERRIDE { } + + virtual bool isMergable() OVERRIDE { return true; } + virtual bool isTabbable() OVERRIDE { return false; } + + // private members static const Metadata Tags[]; protected: - virtual void Init(); - virtual bool isLockable() { return false; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return false; } private: void PrepareSong(MPD::Song &); diff --git a/src/tiny_tag_editor.h b/src/tiny_tag_editor.h index 75349fb5..5e482c25 100644 --- a/src/tiny_tag_editor.h +++ b/src/tiny_tag_editor.h @@ -34,22 +34,27 @@ class TinyTagEditor : public Screen< NC::Menu > { public: - virtual void Resize(); - virtual void SwitchTo(); + // Screen< NC::Menu > implementation + virtual void Resize() OVERRIDE; + virtual void SwitchTo() OVERRIDE; - virtual std::basic_string Title(); + virtual std::basic_string Title() OVERRIDE; - virtual void EnterPressed(); - virtual void SpacePressed() { } - virtual void MouseButtonPressed(MEVENT); + virtual void Update() OVERRIDE { } - virtual bool isMergable() { return true; } + virtual void EnterPressed() OVERRIDE; + virtual void SpacePressed() OVERRIDE { } + virtual void MouseButtonPressed(MEVENT me) OVERRIDE; + virtual bool isMergable() OVERRIDE { return true; } + virtual bool isTabbable() OVERRIDE { return false; } + + // private members void SetEdited(const MPD::Song &); protected: - virtual void Init(); - virtual bool isLockable() { return true; } + virtual void Init() OVERRIDE; + virtual bool isLockable() OVERRIDE { return true; } private: bool getTags();