make use of override keyword if available
This commit is contained in:
12
configure.in
12
configure.in
@@ -84,6 +84,18 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <functional>], [[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 ==============================
|
||||
|
||||
@@ -320,22 +320,6 @@ std::shared_ptr<ProxySongList> 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;
|
||||
|
||||
@@ -30,38 +30,40 @@ class Browser : public Screen< NC::Menu<MPD::Item> >, public Filterable, public
|
||||
public:
|
||||
Browser() : itsBrowseLocally(0), itsScrollBeginning(0), itsBrowsedDir("/") { }
|
||||
|
||||
virtual void Resize();
|
||||
virtual void SwitchTo();
|
||||
// Screen< NC::Menu<MPD::Item> > implementation
|
||||
virtual void Resize() OVERRIDE;
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
|
||||
virtual std::basic_string<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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<ProxySongList> 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<ProxySongList> 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<MPD::Item> >, 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;
|
||||
|
||||
20
src/help.h
20
src/help.h
@@ -27,20 +27,22 @@
|
||||
class Help : public Screen<NC::Scrollpad>
|
||||
{
|
||||
public:
|
||||
virtual void Resize();
|
||||
virtual void SwitchTo();
|
||||
virtual void Resize() OVERRIDE;
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
|
||||
virtual std::basic_string<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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); }
|
||||
|
||||
21
src/lastfm.h
21
src/lastfm.h
@@ -36,26 +36,29 @@ class Lastfm : public Screen<NC::Scrollpad>
|
||||
public:
|
||||
Lastfm() : isReadyToTake(0), isDownloadInProgress(0) { }
|
||||
|
||||
virtual void SwitchTo();
|
||||
virtual void Resize();
|
||||
// Screen<NC::Scrollpad>
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
virtual void Resize() OVERRIDE;
|
||||
|
||||
virtual std::basic_string<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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<my_char_t> itsTitle;
|
||||
|
||||
21
src/lyrics.h
21
src/lyrics.h
@@ -37,18 +37,21 @@ class Lyrics : public Screen<NC::Scrollpad>
|
||||
# endif // HAVE_CURL_CURL_H
|
||||
itsScrollBegin(0) { }
|
||||
|
||||
virtual void Resize();
|
||||
virtual void SwitchTo();
|
||||
// Screen<NC::Scrollpad> implementation
|
||||
virtual void Resize() OVERRIDE;
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
|
||||
virtual std::basic_string<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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<NC::Scrollpad>
|
||||
bool ReloadNP;
|
||||
|
||||
protected:
|
||||
virtual void Init();
|
||||
virtual bool isLockable() { return false; }
|
||||
virtual void Init() OVERRIDE;
|
||||
virtual bool isLockable() OVERRIDE { return false; }
|
||||
|
||||
private:
|
||||
void Load();
|
||||
|
||||
@@ -336,6 +336,11 @@ void MediaLibrary::Update()
|
||||
}
|
||||
}
|
||||
|
||||
void MediaLibrary::EnterPressed()
|
||||
{
|
||||
AddToPlaylist(true);
|
||||
}
|
||||
|
||||
void MediaLibrary::SpacePressed()
|
||||
{
|
||||
if (Config.space_selects)
|
||||
|
||||
@@ -27,39 +27,40 @@
|
||||
class MediaLibrary : public Screen<NC::Window>, 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<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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<ProxySongList> getProxySongList();
|
||||
virtual std::shared_ptr<ProxySongList> 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();
|
||||
|
||||
@@ -283,16 +283,16 @@ template <typename T> 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();
|
||||
|
||||
@@ -32,23 +32,28 @@
|
||||
class Outputs : public Screen< NC::Menu<MPD::Output> >
|
||||
{
|
||||
public:
|
||||
virtual void SwitchTo();
|
||||
virtual void Resize();
|
||||
|
||||
virtual std::basic_string<my_char_t> Title();
|
||||
// Screen< NC::Menu<MPD::Output> > 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<my_char_t> 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;
|
||||
|
||||
@@ -338,22 +338,6 @@ std::shared_ptr<ProxySongList> 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;
|
||||
|
||||
@@ -35,38 +35,40 @@ class Playlist : public Screen<NC::Window>, public Filterable, public HasSongs,
|
||||
Playlist() : NowPlaying(-1), itsTotalLength(0), itsRemainingTime(0), itsScrollBegin(0) { }
|
||||
~Playlist() { }
|
||||
|
||||
virtual void SwitchTo();
|
||||
virtual void Resize();
|
||||
// Screen<NC::Window> implementation
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
virtual void Resize() OVERRIDE;
|
||||
|
||||
virtual std::basic_string<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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<ProxySongList> getProxySongList();
|
||||
// HasSongs implementation
|
||||
virtual std::shared_ptr<ProxySongList> 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<NC::Window>, 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<NC::Window>, 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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -26,41 +26,42 @@
|
||||
class PlaylistEditor : public Screen<NC::Window>, 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<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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<ProxySongList> getProxySongList();
|
||||
virtual std::shared_ptr<ProxySongList> 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<NC::Window>, public Filterable, public HasS
|
||||
NC::Menu<MPD::Song> *Content;
|
||||
|
||||
protected:
|
||||
virtual void Init();
|
||||
virtual bool isLockable() { return true; }
|
||||
virtual void Init() OVERRIDE;
|
||||
virtual bool isLockable() OVERRIDE { return true; }
|
||||
|
||||
private:
|
||||
void AddToPlaylist(bool);
|
||||
|
||||
86
src/screen.h
86
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 <typename WindowType> 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 <typename WindowType> class Screen : public BasicScreen
|
||||
WindowType *w;
|
||||
};
|
||||
|
||||
template <typename WindowType> NC::Window *Screen<WindowType>::ActiveWindow()
|
||||
{
|
||||
return w;
|
||||
}
|
||||
|
||||
template <typename WindowType> WindowType *Screen<WindowType>::Main()
|
||||
{
|
||||
return w;
|
||||
}
|
||||
|
||||
template <typename WindowType> void Screen<WindowType>::Refresh()
|
||||
{
|
||||
w->display();
|
||||
}
|
||||
|
||||
template <typename WindowType> void Screen<WindowType>::RefreshWindow()
|
||||
{
|
||||
w->display();
|
||||
}
|
||||
|
||||
template <typename WindowType> void Screen<WindowType>::Scroll(NC::Where where)
|
||||
{
|
||||
w->scroll(where);
|
||||
}
|
||||
|
||||
template <typename WindowType> void Screen<WindowType>::MouseButtonPressed(MEVENT me)
|
||||
{
|
||||
GenericMouseButtonPressed(w, me);
|
||||
}
|
||||
|
||||
/// Specialization for Screen<Scrollpad>::MouseButtonPressed, that should
|
||||
/// not scroll whole page, but rather a few lines (the number of them is
|
||||
/// defined in the config)
|
||||
|
||||
@@ -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
|
||||
///
|
||||
|
||||
@@ -76,43 +76,48 @@ struct SEItem
|
||||
class SearchEngine : public Screen< NC::Menu<SEItem> >, public Filterable, public HasSongs, public Searchable
|
||||
{
|
||||
public:
|
||||
virtual void Resize();
|
||||
virtual void SwitchTo();
|
||||
// Screen< NC::Menu<SEItem> > implementation
|
||||
virtual void Resize() OVERRIDE;
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
|
||||
virtual std::basic_string<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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<ProxySongList> 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<ProxySongList> 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();
|
||||
|
||||
@@ -28,21 +28,25 @@ class SelectedItemsAdder : public Screen< NC::Menu<std::string> >
|
||||
public:
|
||||
SelectedItemsAdder() : itsPSWidth(35), itsPSHeight(11) { }
|
||||
|
||||
virtual void SwitchTo();
|
||||
virtual void Resize();
|
||||
virtual void Refresh();
|
||||
// Screen< NC::Menu<std::string> > implementation
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
virtual void Resize() OVERRIDE;
|
||||
virtual void Refresh() OVERRIDE;
|
||||
|
||||
virtual std::basic_string<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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();
|
||||
|
||||
@@ -26,21 +26,23 @@
|
||||
class ServerInfo : public Screen<NC::Scrollpad>
|
||||
{
|
||||
public:
|
||||
virtual void SwitchTo();
|
||||
virtual void Resize();
|
||||
// Screen<NC::Scrollpad> implementation
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
virtual void Resize() OVERRIDE;
|
||||
|
||||
virtual std::basic_string<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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();
|
||||
|
||||
@@ -34,21 +34,27 @@ class SongInfo : public Screen<NC::Scrollpad>
|
||||
MPD::MutableSong::SetFunction Set;
|
||||
};
|
||||
|
||||
virtual void SwitchTo();
|
||||
virtual void Resize();
|
||||
// Screen<NC::Scrollpad> implementation
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
virtual void Resize() OVERRIDE;
|
||||
|
||||
virtual std::basic_string<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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 &);
|
||||
|
||||
@@ -34,22 +34,27 @@
|
||||
class TinyTagEditor : public Screen< NC::Menu<NC::Buffer> >
|
||||
{
|
||||
public:
|
||||
virtual void Resize();
|
||||
virtual void SwitchTo();
|
||||
// Screen< NC::Menu<NC::Buffer> > implementation
|
||||
virtual void Resize() OVERRIDE;
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
|
||||
virtual std::basic_string<my_char_t> Title();
|
||||
virtual std::basic_string<my_char_t> 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();
|
||||
|
||||
Reference in New Issue
Block a user