add interface HasColumns and its appropriate implementations
This commit is contained in:
@@ -668,46 +668,24 @@ void PressSpace::Run()
|
||||
|
||||
bool PreviousColumn::canBeRun() const
|
||||
{
|
||||
return (myScreen == myLibrary && myLibrary->isPrevColumnAvailable())
|
||||
|| (myScreen == myPlaylistEditor && myPlaylistEditor->isPrevColumnAvailable())
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
|| (myScreen == myTagEditor && myTagEditor->isPrevColumnAvailable())
|
||||
# endif // HAVE_TAGLIB_H
|
||||
;
|
||||
auto hc = hasColumns(myScreen);
|
||||
return hc && hc->previousColumnAvailable();
|
||||
}
|
||||
|
||||
void PreviousColumn::Run()
|
||||
{
|
||||
if (myScreen == myLibrary)
|
||||
myLibrary->PrevColumn();
|
||||
else if (myScreen == myPlaylistEditor)
|
||||
myPlaylistEditor->PrevColumn();
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
else if (myScreen == myTagEditor)
|
||||
myTagEditor->PrevColumn();
|
||||
# endif // HAVE_TAGLIB_H
|
||||
hasColumns(myScreen)->previousColumn();
|
||||
}
|
||||
|
||||
bool NextColumn::canBeRun() const
|
||||
{
|
||||
return (myScreen == myLibrary && myLibrary->isNextColumnAvailable())
|
||||
|| (myScreen == myPlaylistEditor && myPlaylistEditor->isNextColumnAvailable())
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
|| (myScreen == myTagEditor && myTagEditor->isNextColumnAvailable())
|
||||
# endif // HAVE_TAGLIB_H
|
||||
;
|
||||
auto hc = hasColumns(myScreen);
|
||||
return hc && hc->nextColumnAvailable();
|
||||
}
|
||||
|
||||
void NextColumn::Run()
|
||||
{
|
||||
if (myScreen == myLibrary)
|
||||
myLibrary->NextColumn();
|
||||
else if (myScreen == myPlaylistEditor)
|
||||
myPlaylistEditor->NextColumn();
|
||||
# ifdef HAVE_TAGLIB_H
|
||||
else if (myScreen == myTagEditor)
|
||||
myTagEditor->NextColumn();
|
||||
# endif // HAVE_TAGLIB_H
|
||||
hasColumns(myScreen)->nextColumn();
|
||||
}
|
||||
|
||||
bool MasterScreen::canBeRun() const
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
#include "status.h"
|
||||
#include "utility/wide_string.h"
|
||||
|
||||
inline HasColumns *hasColumns(BasicScreen *screen)
|
||||
{
|
||||
return dynamic_cast<HasColumns *>(screen);
|
||||
}
|
||||
|
||||
inline HasSongs *hasSongs(BasicScreen *screen)
|
||||
{
|
||||
return dynamic_cast<HasSongs *>(screen);
|
||||
|
||||
@@ -50,4 +50,13 @@ struct HasSongs
|
||||
virtual MPD::SongList getSelectedSongs() = 0;
|
||||
};
|
||||
|
||||
struct HasColumns
|
||||
{
|
||||
virtual bool previousColumnAvailable() = 0;
|
||||
virtual void previousColumn() = 0;
|
||||
|
||||
virtual bool nextColumnAvailable() = 0;
|
||||
virtual void nextColumn() = 0;
|
||||
};
|
||||
|
||||
#endif // _INTERFACES_H
|
||||
|
||||
@@ -414,8 +414,8 @@ void MediaLibrary::MouseButtonPressed(MEVENT me)
|
||||
bool result = true;
|
||||
if (w != Songs)
|
||||
{
|
||||
if (isNextColumnAvailable())
|
||||
NextColumn();
|
||||
if (nextColumnAvailable())
|
||||
nextColumn();
|
||||
else
|
||||
result = false;
|
||||
}
|
||||
@@ -425,8 +425,8 @@ void MediaLibrary::MouseButtonPressed(MEVENT me)
|
||||
bool result = true;
|
||||
if (w != Tags)
|
||||
{
|
||||
if (isPrevColumnAvailable())
|
||||
PrevColumn();
|
||||
if (previousColumnAvailable())
|
||||
previousColumn();
|
||||
else
|
||||
result = false;
|
||||
}
|
||||
@@ -683,15 +683,41 @@ MPD::SongList MediaLibrary::getSelectedSongs()
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
int MediaLibrary::Columns()
|
||||
bool MediaLibrary::previousColumnAvailable()
|
||||
{
|
||||
if (hasTwoColumns)
|
||||
return 2;
|
||||
else
|
||||
return 3;
|
||||
assert(!hasTwoColumns || w != Tags);
|
||||
if (w == Songs)
|
||||
{
|
||||
if (!Albums->reallyEmpty() && (hasTwoColumns || !Tags->reallyEmpty()))
|
||||
return true;
|
||||
}
|
||||
else if (w == Albums)
|
||||
{
|
||||
if (!hasTwoColumns && !Tags->reallyEmpty())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MediaLibrary::isNextColumnAvailable()
|
||||
void MediaLibrary::previousColumn()
|
||||
{
|
||||
if (w == Songs)
|
||||
{
|
||||
Songs->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = Albums;
|
||||
Albums->setHighlightColor(Config.active_column_color);
|
||||
}
|
||||
else if (w == Albums && !hasTwoColumns)
|
||||
{
|
||||
Albums->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = Tags;
|
||||
Tags->setHighlightColor(Config.active_column_color);
|
||||
}
|
||||
}
|
||||
|
||||
bool MediaLibrary::nextColumnAvailable()
|
||||
{
|
||||
assert(!hasTwoColumns || w != Tags);
|
||||
if (w == Tags)
|
||||
@@ -707,7 +733,7 @@ bool MediaLibrary::isNextColumnAvailable()
|
||||
return false;
|
||||
}
|
||||
|
||||
void MediaLibrary::NextColumn()
|
||||
void MediaLibrary::nextColumn()
|
||||
{
|
||||
if (w == Tags)
|
||||
{
|
||||
@@ -725,38 +751,14 @@ void MediaLibrary::NextColumn()
|
||||
}
|
||||
}
|
||||
|
||||
bool MediaLibrary::isPrevColumnAvailable()
|
||||
{
|
||||
assert(!hasTwoColumns || w != Tags);
|
||||
if (w == Songs)
|
||||
{
|
||||
if (!Albums->reallyEmpty() && (hasTwoColumns || !Tags->reallyEmpty()))
|
||||
return true;
|
||||
}
|
||||
else if (w == Albums)
|
||||
{
|
||||
if (!hasTwoColumns && !Tags->reallyEmpty())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/***********************************************************************/
|
||||
|
||||
void MediaLibrary::PrevColumn()
|
||||
int MediaLibrary::Columns()
|
||||
{
|
||||
if (w == Songs)
|
||||
{
|
||||
Songs->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = Albums;
|
||||
Albums->setHighlightColor(Config.active_column_color);
|
||||
}
|
||||
else if (w == Albums && !hasTwoColumns)
|
||||
{
|
||||
Albums->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = Tags;
|
||||
Tags->setHighlightColor(Config.active_column_color);
|
||||
}
|
||||
if (hasTwoColumns)
|
||||
return 2;
|
||||
else
|
||||
return 3;
|
||||
}
|
||||
|
||||
std::shared_ptr<ProxySongList> MediaLibrary::songsProxyList()
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "interfaces.h"
|
||||
#include "screen.h"
|
||||
|
||||
class MediaLibrary : public Screen<NC::Window>, public Filterable, public HasSongs, public Searchable
|
||||
class MediaLibrary : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable
|
||||
{
|
||||
public:
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
@@ -42,33 +42,34 @@ class MediaLibrary : public Screen<NC::Window>, public Filterable, public HasSon
|
||||
virtual bool isTabbable() OVERRIDE { return true; }
|
||||
virtual bool isMergable() OVERRIDE { return true; }
|
||||
|
||||
/// Filterable implementation
|
||||
// Filterable implementation
|
||||
virtual bool allowsFiltering() OVERRIDE;
|
||||
virtual std::string currentFilter() OVERRIDE;
|
||||
virtual void applyFilter(const std::string &filter) OVERRIDE;
|
||||
|
||||
/// Searchable implementation
|
||||
// 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;
|
||||
|
||||
/// HasSongs implementation
|
||||
// HasSongs implementation
|
||||
virtual std::shared_ptr<ProxySongList> getProxySongList() OVERRIDE;
|
||||
|
||||
virtual bool allowsSelection() OVERRIDE;
|
||||
virtual void reverseSelection() OVERRIDE;
|
||||
virtual MPD::SongList getSelectedSongs() OVERRIDE;
|
||||
|
||||
// HasColumns implementation
|
||||
virtual bool previousColumnAvailable() OVERRIDE;
|
||||
virtual void previousColumn() OVERRIDE;
|
||||
|
||||
virtual bool nextColumnAvailable() OVERRIDE;
|
||||
virtual void nextColumn() OVERRIDE;
|
||||
|
||||
// private members
|
||||
int Columns();
|
||||
bool isNextColumnAvailable();
|
||||
void NextColumn();
|
||||
bool isPrevColumnAvailable();
|
||||
void PrevColumn();
|
||||
|
||||
void LocateSong(const MPD::Song &);
|
||||
|
||||
std::shared_ptr<ProxySongList> songsProxyList();
|
||||
|
||||
struct SearchConstraints
|
||||
|
||||
@@ -219,52 +219,6 @@ bool PlaylistEditor::isContentFiltered()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PlaylistEditor::isNextColumnAvailable()
|
||||
{
|
||||
if (w == Playlists)
|
||||
{
|
||||
if (!Content->reallyEmpty())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PlaylistEditor::NextColumn()
|
||||
{
|
||||
if (w == Playlists)
|
||||
{
|
||||
Playlists->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = Content;
|
||||
Content->setHighlightColor(Config.active_column_color);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PlaylistEditor::isPrevColumnAvailable()
|
||||
{
|
||||
if (w == Content)
|
||||
{
|
||||
if (!Playlists->reallyEmpty())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PlaylistEditor::PrevColumn()
|
||||
{
|
||||
if (w == Content)
|
||||
{
|
||||
Content->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = Playlists;
|
||||
Playlists->setHighlightColor(Config.active_column_color);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<ProxySongList> PlaylistEditor::contentProxyList()
|
||||
{
|
||||
return mkProxySongList(*Content, [](NC::Menu<MPD::Song>::Item &item) {
|
||||
@@ -328,8 +282,8 @@ void PlaylistEditor::MouseButtonPressed(MEVENT me)
|
||||
{
|
||||
if (w != Playlists)
|
||||
{
|
||||
if (isPrevColumnAvailable())
|
||||
PrevColumn();
|
||||
if (previousColumnAvailable())
|
||||
previousColumn();
|
||||
else
|
||||
return;
|
||||
}
|
||||
@@ -352,8 +306,8 @@ void PlaylistEditor::MouseButtonPressed(MEVENT me)
|
||||
{
|
||||
if (w != Content)
|
||||
{
|
||||
if (isNextColumnAvailable())
|
||||
NextColumn();
|
||||
if (nextColumnAvailable())
|
||||
nextColumn();
|
||||
else
|
||||
return;
|
||||
}
|
||||
@@ -508,6 +462,51 @@ MPD::SongList PlaylistEditor::getSelectedSongs()
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
bool PlaylistEditor::previousColumnAvailable()
|
||||
{
|
||||
if (w == Content)
|
||||
{
|
||||
if (!Playlists->reallyEmpty())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PlaylistEditor::previousColumn()
|
||||
{
|
||||
if (w == Content)
|
||||
{
|
||||
Content->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = Playlists;
|
||||
Playlists->setHighlightColor(Config.active_column_color);
|
||||
}
|
||||
}
|
||||
|
||||
bool PlaylistEditor::nextColumnAvailable()
|
||||
{
|
||||
if (w == Playlists)
|
||||
{
|
||||
if (!Content->reallyEmpty())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void PlaylistEditor::nextColumn()
|
||||
{
|
||||
if (w == Playlists)
|
||||
{
|
||||
Playlists->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = Content;
|
||||
Content->setHighlightColor(Config.active_column_color);
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
void PlaylistEditor::Locate(const std::string &name)
|
||||
{
|
||||
if (!isInitialized)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "interfaces.h"
|
||||
#include "screen.h"
|
||||
|
||||
class PlaylistEditor : public Screen<NC::Window>, public Filterable, public HasSongs, public Searchable
|
||||
class PlaylistEditor : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable
|
||||
{
|
||||
public:
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
@@ -42,36 +42,37 @@ class PlaylistEditor : public Screen<NC::Window>, public Filterable, public HasS
|
||||
virtual bool isTabbable() OVERRIDE { return true; }
|
||||
virtual bool isMergable() OVERRIDE { return true; }
|
||||
|
||||
/// Filterable implementation
|
||||
// Filterable implementation
|
||||
virtual bool allowsFiltering() OVERRIDE;
|
||||
virtual std::string currentFilter() OVERRIDE;
|
||||
virtual void applyFilter(const std::string &filter) OVERRIDE;
|
||||
|
||||
/// Searchable implementation
|
||||
// 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;
|
||||
|
||||
/// HasSongs implementation
|
||||
// HasSongs implementation
|
||||
virtual std::shared_ptr<ProxySongList> getProxySongList() OVERRIDE;
|
||||
|
||||
virtual bool allowsSelection() OVERRIDE;
|
||||
virtual void reverseSelection() OVERRIDE;
|
||||
virtual MPD::SongList getSelectedSongs() OVERRIDE;
|
||||
|
||||
// private members
|
||||
virtual void Locate(const std::string &);
|
||||
// HasColumns implementation
|
||||
virtual bool previousColumnAvailable() OVERRIDE;
|
||||
virtual void previousColumn() OVERRIDE;
|
||||
|
||||
virtual bool nextColumnAvailable() OVERRIDE;
|
||||
virtual void nextColumn() OVERRIDE;
|
||||
|
||||
// private members
|
||||
void requestPlaylistsUpdate() { playlistsUpdateRequested = true; }
|
||||
void requestContentsUpdate() { contentUpdateRequested = true; }
|
||||
|
||||
virtual void Locate(const std::string &);
|
||||
bool isContentFiltered();
|
||||
bool isNextColumnAvailable();
|
||||
bool NextColumn();
|
||||
bool isPrevColumnAvailable();
|
||||
bool PrevColumn();
|
||||
|
||||
std::shared_ptr<ProxySongList> contentProxyList();
|
||||
|
||||
NC::Menu<std::string> *Playlists;
|
||||
|
||||
@@ -646,8 +646,8 @@ void TagEditor::MouseButtonPressed(MEVENT me)
|
||||
bool result = true;
|
||||
if (w != Dirs)
|
||||
{
|
||||
if (isPrevColumnAvailable())
|
||||
PrevColumn();
|
||||
if (previousColumnAvailable())
|
||||
previousColumn();
|
||||
else
|
||||
result = false;
|
||||
}
|
||||
@@ -657,8 +657,8 @@ void TagEditor::MouseButtonPressed(MEVENT me)
|
||||
bool result = true;
|
||||
if (w != Tags)
|
||||
{
|
||||
if (isNextColumnAvailable())
|
||||
NextColumn();
|
||||
if (nextColumnAvailable())
|
||||
nextColumn();
|
||||
else
|
||||
result = false;
|
||||
}
|
||||
@@ -684,8 +684,8 @@ void TagEditor::MouseButtonPressed(MEVENT me)
|
||||
{
|
||||
if (w != FParser)
|
||||
{
|
||||
if (isPrevColumnAvailable())
|
||||
PrevColumn();
|
||||
if (previousColumnAvailable())
|
||||
previousColumn();
|
||||
else
|
||||
return;
|
||||
}
|
||||
@@ -702,8 +702,8 @@ void TagEditor::MouseButtonPressed(MEVENT me)
|
||||
{
|
||||
if (w != FParserHelper)
|
||||
{
|
||||
if (isNextColumnAvailable())
|
||||
NextColumn();
|
||||
if (nextColumnAvailable())
|
||||
nextColumn();
|
||||
else
|
||||
return;
|
||||
}
|
||||
@@ -880,63 +880,7 @@ MPD::SongList TagEditor::getSelectedSongs()
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
bool TagEditor::ifAnyModifiedAskForDiscarding()
|
||||
{
|
||||
bool result = true;
|
||||
if (isAnyModified(*Tags))
|
||||
result = Action::AskYesNoQuestion("There are pending changes, are you sure?", Status::trace);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool TagEditor::isNextColumnAvailable()
|
||||
{
|
||||
bool result = false;
|
||||
if (w == Dirs)
|
||||
{
|
||||
if (!TagTypes->reallyEmpty() && !Tags->reallyEmpty())
|
||||
result = true;
|
||||
}
|
||||
else if (w == TagTypes)
|
||||
{
|
||||
if (!Tags->reallyEmpty())
|
||||
result = true;
|
||||
}
|
||||
else if (w == FParser)
|
||||
result = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool TagEditor::NextColumn()
|
||||
{
|
||||
if (w == Dirs)
|
||||
{
|
||||
Dirs->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = TagTypes;
|
||||
TagTypes->setHighlightColor(Config.active_column_color);
|
||||
return true;
|
||||
}
|
||||
else if (w == TagTypes && TagTypes->choice() < 13 && !Tags->reallyEmpty())
|
||||
{
|
||||
TagTypes->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = Tags;
|
||||
Tags->setHighlightColor(Config.active_column_color);
|
||||
return true;
|
||||
}
|
||||
else if (w == FParser)
|
||||
{
|
||||
FParser->setBorder(Config.window_border);
|
||||
FParser->display();
|
||||
w = FParserHelper;
|
||||
FParserHelper->setBorder(Config.active_window_border);
|
||||
FParserHelper->display();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TagEditor::isPrevColumnAvailable()
|
||||
bool TagEditor::previousColumnAvailable()
|
||||
{
|
||||
bool result = false;
|
||||
if (w == Tags)
|
||||
@@ -954,7 +898,7 @@ bool TagEditor::isPrevColumnAvailable()
|
||||
return result;
|
||||
}
|
||||
|
||||
bool TagEditor::PrevColumn()
|
||||
void TagEditor::previousColumn()
|
||||
{
|
||||
if (w == Tags)
|
||||
{
|
||||
@@ -962,7 +906,6 @@ bool TagEditor::PrevColumn()
|
||||
w->refresh();
|
||||
w = TagTypes;
|
||||
TagTypes->setHighlightColor(Config.active_column_color);
|
||||
return true;
|
||||
}
|
||||
else if (w == TagTypes)
|
||||
{
|
||||
@@ -970,7 +913,6 @@ bool TagEditor::PrevColumn()
|
||||
w->refresh();
|
||||
w = Dirs;
|
||||
Dirs->setHighlightColor(Config.active_column_color);
|
||||
return true;
|
||||
}
|
||||
else if (w == FParserHelper)
|
||||
{
|
||||
@@ -979,9 +921,61 @@ bool TagEditor::PrevColumn()
|
||||
w = FParser;
|
||||
FParser->setBorder(Config.active_window_border);
|
||||
FParser->display();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TagEditor::nextColumnAvailable()
|
||||
{
|
||||
bool result = false;
|
||||
if (w == Dirs)
|
||||
{
|
||||
if (!TagTypes->reallyEmpty() && !Tags->reallyEmpty())
|
||||
result = true;
|
||||
}
|
||||
else if (w == TagTypes)
|
||||
{
|
||||
if (!Tags->reallyEmpty())
|
||||
result = true;
|
||||
}
|
||||
else if (w == FParser)
|
||||
result = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
void TagEditor::nextColumn()
|
||||
{
|
||||
if (w == Dirs)
|
||||
{
|
||||
Dirs->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = TagTypes;
|
||||
TagTypes->setHighlightColor(Config.active_column_color);
|
||||
}
|
||||
else if (w == TagTypes && TagTypes->choice() < 13 && !Tags->reallyEmpty())
|
||||
{
|
||||
TagTypes->setHighlightColor(Config.main_highlight_color);
|
||||
w->refresh();
|
||||
w = Tags;
|
||||
Tags->setHighlightColor(Config.active_column_color);
|
||||
}
|
||||
else if (w == FParser)
|
||||
{
|
||||
FParser->setBorder(Config.window_border);
|
||||
FParser->display();
|
||||
w = FParserHelper;
|
||||
FParserHelper->setBorder(Config.active_window_border);
|
||||
FParserHelper->display();
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
bool TagEditor::ifAnyModifiedAskForDiscarding()
|
||||
{
|
||||
bool result = true;
|
||||
if (isAnyModified(*Tags))
|
||||
result = Action::AskYesNoQuestion("There are pending changes, are you sure?", Status::trace);
|
||||
return result;
|
||||
}
|
||||
|
||||
void TagEditor::LocateSong(const MPD::Song &s)
|
||||
|
||||
@@ -33,61 +33,60 @@
|
||||
#include "regex_filter.h"
|
||||
#include "screen.h"
|
||||
|
||||
class TagEditor : public Screen<NC::Window>, public Filterable, public HasSongs, public Searchable
|
||||
class TagEditor : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable
|
||||
{
|
||||
public:
|
||||
TagEditor() : FParser(0), FParserHelper(0), FParserLegend(0), FParserPreview(0), itsBrowsedDir("/") { }
|
||||
|
||||
virtual void Resize();
|
||||
virtual void SwitchTo();
|
||||
virtual void Resize() OVERRIDE;
|
||||
virtual void SwitchTo() OVERRIDE;
|
||||
|
||||
virtual std::wstring Title();
|
||||
virtual std::wstring Title() OVERRIDE;
|
||||
|
||||
virtual void Refresh();
|
||||
virtual void Update();
|
||||
virtual void Refresh() OVERRIDE;
|
||||
virtual void Update() OVERRIDE;
|
||||
|
||||
virtual void EnterPressed();
|
||||
virtual void SpacePressed();
|
||||
virtual void MouseButtonPressed(MEVENT);
|
||||
virtual bool isTabbable() { return true; }
|
||||
virtual void EnterPressed() OVERRIDE;
|
||||
virtual void SpacePressed() OVERRIDE;
|
||||
virtual void MouseButtonPressed(MEVENT) 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;
|
||||
|
||||
virtual bool isMergable() { return true; }
|
||||
// HasColumns implementation
|
||||
virtual bool previousColumnAvailable() OVERRIDE;
|
||||
virtual void previousColumn() OVERRIDE;
|
||||
|
||||
virtual bool nextColumnAvailable() OVERRIDE;
|
||||
virtual void nextColumn() OVERRIDE;
|
||||
|
||||
// private members
|
||||
bool ifAnyModifiedAskForDiscarding();
|
||||
|
||||
bool isNextColumnAvailable();
|
||||
bool NextColumn();
|
||||
bool isPrevColumnAvailable();
|
||||
bool PrevColumn();
|
||||
|
||||
void LocateSong(const MPD::Song &s);
|
||||
const std::string &CurrentDir() { return itsBrowsedDir; }
|
||||
|
||||
NC::Menu< std::pair<std::string, std::string> > *Dirs;
|
||||
NC::Menu<std::string> *TagTypes;
|
||||
NC::Menu<MPD::MutableSong> *Tags;
|
||||
|
||||
/// NOTICE: this string is always in utf8, no need to convert it
|
||||
const std::string &CurrentDir() { return itsBrowsedDir; }
|
||||
|
||||
static void ReadTags(MPD::MutableSong &);
|
||||
static bool WriteTags(MPD::MutableSong &);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user