adjust indentation of remaining classes in headers

This commit is contained in:
Andrzej Rybczak
2012-09-13 22:09:39 +02:00
parent bb5d72d558
commit 58a26b1e18
23 changed files with 951 additions and 967 deletions

View File

@@ -25,69 +25,68 @@
#include "mpdpp.h"
#include "screen.h"
class Browser : public Screen< NC::Menu<MPD::Item> >, public Filterable, public HasSongs, public Searchable
struct Browser : public Screen< NC::Menu<MPD::Item> >, public Filterable, public HasSongs, public Searchable
{
public:
Browser() : itsBrowseLocally(0), itsScrollBeginning(0), itsBrowsedDir("/") { }
// Screen< NC::Menu<MPD::Item> > implementation
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
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; }
// Filterable implementation
virtual bool allowsFiltering() OVERRIDE;
virtual std::string currentFilter() OVERRIDE;
virtual void applyFilter(const std::string &filter) OVERRIDE;
// 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
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; }
void LocateSong(const MPD::Song &);
void GetDirectory(std::string, std::string = "/");
# ifndef WIN32
void GetLocalDirectory(MPD::ItemList &, const std::string & = "", bool = 0) const;
void ClearDirectory(const std::string &) const;
void ChangeBrowseMode();
bool deleteItem(const MPD::Item &);
# endif // !WIN32
static bool isParentDirectory(const MPD::Item &item) {
return item.type == MPD::itDirectory && item.name == "..";
}
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
bool itsBrowseLocally;
size_t itsScrollBeginning;
std::string itsBrowsedDir;
Browser() : itsBrowseLocally(0), itsScrollBeginning(0), itsBrowsedDir("/") { }
// Screen< NC::Menu<MPD::Item> > implementation
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
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; }
// Filterable implementation
virtual bool allowsFiltering() OVERRIDE;
virtual std::string currentFilter() OVERRIDE;
virtual void applyFilter(const std::string &filter) OVERRIDE;
// 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
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; }
void LocateSong(const MPD::Song &);
void GetDirectory(std::string, std::string = "/");
# ifndef WIN32
void GetLocalDirectory(MPD::ItemList &, const std::string & = "", bool = 0) const;
void ClearDirectory(const std::string &) const;
void ChangeBrowseMode();
bool deleteItem(const MPD::Item &);
# endif // !WIN32
static bool isParentDirectory(const MPD::Item &item) {
return item.type == MPD::itDirectory && item.name == "..";
}
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
bool itsBrowseLocally;
size_t itsScrollBeginning;
std::string itsBrowsedDir;
};
extern Browser *myBrowser;

View File

@@ -28,39 +28,38 @@
#include "window.h"
#include "screen.h"
class Clock : public Screen<NC::Window>
struct Clock : public Screen<NC::Window>
{
public:
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE;
virtual void scroll(NC::Where) OVERRIDE { }
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; }
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
NC::Window *itsPane;
static void Prepare();
static void Set(int, int);
static short disp[11];
static long older[6], next[6], newer[6], mask;
static size_t Width;
static const size_t Height;
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE;
virtual void scroll(NC::Where) OVERRIDE { }
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; }
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
NC::Window *itsPane;
static void Prepare();
static void Set(int, int);
static short disp[11];
static long older[6], next[6], newer[6], mask;
static size_t Width;
static const size_t Height;
};
extern Clock *myClock;

View File

@@ -26,31 +26,28 @@
#include "mutable_song.h"
#include "search_engine.h"
namespace Display
{
std::string Columns(size_t);
template <typename T> void Default(NC::Menu<T> &menu)
{
menu << menu.drawn()->value();
}
template <typename A, typename B> void Pair(NC::Menu< std::pair<A, B> > &menu)
{
menu << menu.drawn()->value().first;
}
void SongsInColumns(NC::Menu<MPD::Song> &menu, HasSongs *screen);
void Songs(NC::Menu<MPD::Song> &menu, HasSongs *screen, const std::string &format);
void Tags(NC::Menu<MPD::MutableSong> &menu);
void Outputs(NC::Menu<MPD::Output> &menu);
void SearchEngine(NC::Menu<SEItem> &menu);
void Items(NC::Menu<MPD::Item> &menu);
namespace Display {//
std::string Columns(size_t);
template <typename ItemT>
void Default(NC::Menu<ItemT> &menu) { menu << menu.drawn()->value(); }
template <typename A, typename B>
void Pair(NC::Menu< std::pair<A, B> > &menu) { menu << menu.drawn()->value().first; }
void SongsInColumns(NC::Menu<MPD::Song> &menu, HasSongs *screen);
void Songs(NC::Menu<MPD::Song> &menu, HasSongs *screen, const std::string &format);
void Tags(NC::Menu<MPD::MutableSong> &menu);
void Outputs(NC::Menu<MPD::Output> &menu);
void SearchEngine(NC::Menu<SEItem> &menu);
void Items(NC::Menu<MPD::Item> &menu);
}
#endif

View File

@@ -20,20 +20,24 @@
#include "global.h"
BasicScreen *Global::myScreen;
BasicScreen *Global::myOldScreen;
BasicScreen *Global::myPrevScreen;
BasicScreen *Global::myLockedScreen;
BasicScreen *Global::myInactiveScreen;
namespace Global {//
NC::Window *Global::wHeader;
NC::Window *Global::wFooter;
BasicScreen *myScreen;
BasicScreen *myOldScreen;
BasicScreen *myPrevScreen;
BasicScreen *myLockedScreen;
BasicScreen *myInactiveScreen;
size_t Global::MainStartY;
size_t Global::MainHeight;
NC::Window *wHeader;
NC::Window *wFooter;
bool Global::ShowMessages = false;
bool Global::SeekingInProgress = false;
size_t MainStartY;
size_t MainHeight;
std::string Global::VolumeState;
timeval Global::Timer;
bool ShowMessages = false;
bool SeekingInProgress = false;
std::string VolumeState;
timeval Timer;
}

View File

@@ -26,47 +26,48 @@
#include "mpdpp.h"
#include "screen.h"
namespace Global
{
// currently active screen (displayed in main window)
extern BasicScreen *myScreen;
// for info, lyrics, popups to remember which screen return to
extern BasicScreen *myOldScreen;
// "real" screen switching (browser, search, etc.)
extern BasicScreen *myPrevScreen;
// points at the screen that was locked (or is null if no screen is locked)
extern BasicScreen *myLockedScreen;
// points at inactive screen, if locking was enabled and two screens are displayed
extern BasicScreen *myInactiveScreen;
// header window (above main window)
extern NC::Window *wHeader;
// footer window (below main window)
extern NC::Window *wFooter;
// Y coordinate of top of main window
extern size_t MainStartY;
// height of main window
extern size_t MainHeight;
// indicates whether messages from Statusbar::msg function should be shown
extern bool ShowMessages;
// indicates whether seeking action in currently in progress
extern bool SeekingInProgress;
// string that represents volume in right top corner. being global
// to be used for calculating width offsets in various files.
extern std::string VolumeState;
// global timer
extern timeval Timer;
namespace Global {//
// currently active screen (displayed in main window)
extern BasicScreen *myScreen;
// for info, lyrics, popups to remember which screen return to
extern BasicScreen *myOldScreen;
// "real" screen switching (browser, search, etc.)
extern BasicScreen *myPrevScreen;
// points at the screen that was locked (or is null if no screen is locked)
extern BasicScreen *myLockedScreen;
// points at inactive screen, if locking was enabled and two screens are displayed
extern BasicScreen *myInactiveScreen;
// header window (above main window)
extern NC::Window *wHeader;
// footer window (below main window)
extern NC::Window *wFooter;
// Y coordinate of top of main window
extern size_t MainStartY;
// height of main window
extern size_t MainHeight;
// indicates whether messages from Statusbar::msg function should be shown
extern bool ShowMessages;
// indicates whether seeking action in currently in progress
extern bool SeekingInProgress;
// string that represents volume in right top corner. being global
// to be used for calculating width offsets in various files.
extern std::string VolumeState;
// global timer
extern timeval Timer;
}
#endif

View File

@@ -24,36 +24,35 @@
#include "actions.h"
#include "screen.h"
class Help : public Screen<NC::Scrollpad>
struct Help : public Screen<NC::Scrollpad>
{
public:
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE { }
virtual void enterPressed() OVERRIDE { }
virtual void spacePressed() OVERRIDE { }
virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; }
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
void KeysSection(const char *title) { Section("Keys", title); }
void MouseSection(const char *title) { Section("Mouse", title); }
void Section(const char *type, const char *title);
void KeyDesc(const ActionType at, const char *desc);
void MouseDesc(std::string action, const char *desc, bool indent = false);
void MouseColumn(const char *column);
std::string DisplayKeys(const ActionType at);
void GetKeybindings();
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE { }
virtual void enterPressed() OVERRIDE { }
virtual void spacePressed() OVERRIDE { }
virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; }
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
void KeysSection(const char *title) { Section("Keys", title); }
void MouseSection(const char *title) { Section("Mouse", title); }
void Section(const char *type, const char *title);
void KeyDesc(const ActionType at, const char *desc);
void MouseDesc(std::string action, const char *desc, bool indent = false);
void MouseColumn(const char *column);
std::string DisplayKeys(const ActionType at);
void GetKeybindings();
};
extern Help *myHelp;

View File

@@ -31,57 +31,56 @@
#include "lastfm_service.h"
#include "screen.h"
class Lastfm : public Screen<NC::Scrollpad>
struct Lastfm : public Screen<NC::Scrollpad>
{
public:
Lastfm() : isReadyToTake(0), isDownloadInProgress(0) { }
// Screen<NC::Scrollpad>
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE;
virtual void enterPressed() OVERRIDE { }
virtual void spacePressed() OVERRIDE { }
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
std::wstring itsTitle;
std::string itsArtist;
std::string itsFilename;
std::string itsFolder;
std::auto_ptr<LastfmService> itsService;
LastfmService::Args itsArgs;
void Load();
void Save(const std::string &data);
void SetTitleAndFolder();
void Download();
static void *DownloadWrapper(void *);
void Take();
bool isReadyToTake;
bool isDownloadInProgress;
pthread_t itsDownloader;
Lastfm() : isReadyToTake(0), isDownloadInProgress(0) { }
// Screen<NC::Scrollpad>
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE;
virtual void enterPressed() OVERRIDE { }
virtual void spacePressed() OVERRIDE { }
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
std::wstring itsTitle;
std::string itsArtist;
std::string itsFilename;
std::string itsFolder;
std::auto_ptr<LastfmService> itsService;
LastfmService::Args itsArgs;
void Load();
void Save(const std::string &data);
void SetTitleAndFolder();
void Download();
static void *DownloadWrapper(void *);
void Take();
bool isReadyToTake;
bool isDownloadInProgress;
pthread_t itsDownloader;
};
extern Lastfm *myLastfm;

View File

@@ -41,16 +41,16 @@ struct LastfmService
virtual bool checkArgs(const Args &args) = 0;
virtual void colorizeOutput(NC::Scrollpad &w) = 0;
protected:
virtual bool actionFailed(const std::string &data);
virtual bool parse(std::string &data) = 0;
virtual void postProcess(std::string &data);
virtual const char *methodName() = 0;
static const char *baseURL;
static const char *msgParseFailed;
protected:
virtual bool actionFailed(const std::string &data);
virtual bool parse(std::string &data) = 0;
virtual void postProcess(std::string &data);
virtual const char *methodName() = 0;
static const char *baseURL;
static const char *msgParseFailed;
};
struct ArtistInfo : public LastfmService
@@ -60,10 +60,10 @@ struct ArtistInfo : public LastfmService
virtual bool checkArgs(const Args &args);
virtual void colorizeOutput(NC::Scrollpad &w);
protected:
virtual bool parse(std::string &data);
virtual const char *methodName() { return "artist.getinfo"; }
protected:
virtual bool parse(std::string &data);
virtual const char *methodName() { return "artist.getinfo"; }
};
#endif // HAVE_CURL_CURL_H

View File

@@ -28,78 +28,77 @@
#include "screen.h"
#include "lyrics_fetcher.h"
class Lyrics : public Screen<NC::Scrollpad>
struct Lyrics : public Screen<NC::Scrollpad>
{
public:
Lyrics() : ReloadNP(0),
# ifdef HAVE_CURL_CURL_H
isReadyToTake(0), isDownloadInProgress(0),
# endif // HAVE_CURL_CURL_H
itsScrollBegin(0) { }
// Screen<NC::Scrollpad> implementation
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE;
virtual void enterPressed() OVERRIDE { }
virtual void spacePressed() OVERRIDE;
virtual bool isMergable() OVERRIDE { return true; }
virtual bool isTabbable() OVERRIDE { return false; }
// private members
void Edit();
# ifdef HAVE_CURL_CURL_H
void Refetch();
static void ToggleFetcher();
static void DownloadInBackground(const MPD::Song &s);
# endif // HAVE_CURL_CURL_H
bool ReloadNP;
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
void Load();
# ifdef HAVE_CURL_CURL_H
static void *DownloadInBackgroundImpl(void *song_ptr);
static void DownloadInBackgroundImplHelper(const MPD::Song &s);
// lock for allowing exclusive access to itsToDownload and itsWorkersNumber
static pthread_mutex_t itsDIBLock;
// storage for songs for which lyrics are scheduled to be downloaded
static std::queue<MPD::Song *> itsToDownload;
// current worker threads (ie. downloading lyrics)
static size_t itsWorkersNumber;
// maximum number of worker threads. if it's reached, next lyrics requests
// are put into itsToDownload queue.
static const size_t itsMaxWorkersNumber = 4;
void *Download();
static void *DownloadWrapper(void *);
static void Save(const std::string &filename, const std::string &lyrics);
void Take();
bool isReadyToTake;
bool isDownloadInProgress;
pthread_t itsDownloader;
static LyricsFetcher **itsFetcher;
# endif // HAVE_CURL_CURL_H
size_t itsScrollBegin;
MPD::Song itsSong;
std::string itsFilename;
static std::string GenerateFilename(const MPD::Song &s);
Lyrics() : ReloadNP(0),
# ifdef HAVE_CURL_CURL_H
isReadyToTake(0), isDownloadInProgress(0),
# endif // HAVE_CURL_CURL_H
itsScrollBegin(0) { }
// Screen<NC::Scrollpad> implementation
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE;
virtual void enterPressed() OVERRIDE { }
virtual void spacePressed() OVERRIDE;
virtual bool isMergable() OVERRIDE { return true; }
virtual bool isTabbable() OVERRIDE { return false; }
// private members
void Edit();
# ifdef HAVE_CURL_CURL_H
void Refetch();
static void ToggleFetcher();
static void DownloadInBackground(const MPD::Song &s);
# endif // HAVE_CURL_CURL_H
bool ReloadNP;
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
void Load();
# ifdef HAVE_CURL_CURL_H
static void *DownloadInBackgroundImpl(void *song_ptr);
static void DownloadInBackgroundImplHelper(const MPD::Song &s);
// lock for allowing exclusive access to itsToDownload and itsWorkersNumber
static pthread_mutex_t itsDIBLock;
// storage for songs for which lyrics are scheduled to be downloaded
static std::queue<MPD::Song *> itsToDownload;
// current worker threads (ie. downloading lyrics)
static size_t itsWorkersNumber;
// maximum number of worker threads. if it's reached, next lyrics requests
// are put into itsToDownload queue.
static const size_t itsMaxWorkersNumber = 4;
void *Download();
static void *DownloadWrapper(void *);
static void Save(const std::string &filename, const std::string &lyrics);
void Take();
bool isReadyToTake;
bool isDownloadInProgress;
pthread_t itsDownloader;
static LyricsFetcher **itsFetcher;
# endif // HAVE_CURL_CURL_H
size_t itsScrollBegin;
MPD::Song itsSong;
std::string itsFilename;
static std::string GenerateFilename(const MPD::Song &s);
};
extern Lyrics *myLyrics;

View File

@@ -34,27 +34,27 @@ struct LyricsFetcher
virtual const char *name() = 0;
virtual Result fetch(const std::string &artist, const std::string &title);
protected:
virtual const char *getURL() = 0;
virtual const char *getOpenTag() = 0;
virtual const char *getCloseTag() = 0;
virtual bool notLyrics(const std::string &) { return false; }
virtual void postProcess(std::string &data);
bool getContent(const char *open_tag, const char *close_tag, std::string &data);
static const char msgNotFound[];
protected:
virtual const char *getURL() = 0;
virtual const char *getOpenTag() = 0;
virtual const char *getCloseTag() = 0;
virtual bool notLyrics(const std::string &) { return false; }
virtual void postProcess(std::string &data);
bool getContent(const char *open_tag, const char *close_tag, std::string &data);
static const char msgNotFound[];
};
struct LyrcComArFetcher : public LyricsFetcher
{
virtual const char *name() { return "lyrc.com.ar"; }
protected:
virtual const char *getURL() { return "http://lyrc.com.ar/tema1es.php?artist=%artist%&songname=%title%"; }
virtual const char *getOpenTag() { return "</table>"; }
virtual const char *getCloseTag() { return "<p>"; }
protected:
virtual const char *getURL() { return "http://lyrc.com.ar/tema1es.php?artist=%artist%&songname=%title%"; }
virtual const char *getOpenTag() { return "</table>"; }
virtual const char *getCloseTag() { return "<p>"; }
};
struct LyricwikiFetcher : public LyricsFetcher
@@ -62,12 +62,12 @@ struct LyricwikiFetcher : public LyricsFetcher
virtual const char *name() { return "lyricwiki.com"; }
virtual Result fetch(const std::string &artist, const std::string &title);
protected:
virtual const char *getURL() { return "http://lyrics.wikia.com/api.php?action=lyrics&fmt=xml&func=getSong&artist=%artist%&song=%title%"; }
virtual const char *getOpenTag() { return "<url>"; }
virtual const char *getCloseTag() { return "</url>"; }
virtual bool notLyrics(const std::string &data);
protected:
virtual const char *getURL() { return "http://lyrics.wikia.com/api.php?action=lyrics&fmt=xml&func=getSong&artist=%artist%&song=%title%"; }
virtual const char *getOpenTag() { return "<url>"; }
virtual const char *getCloseTag() { return "</url>"; }
virtual bool notLyrics(const std::string &data);
};
/**********************************************************************/
@@ -76,118 +76,118 @@ struct GoogleLyricsFetcher : public LyricsFetcher
{
virtual Result fetch(const std::string &artist, const std::string &title);
protected:
virtual const char *getSiteKeyword() = 0;
virtual const char *getURL() { return URL; }
virtual bool isURLOk(const std::string &url);
private:
const char *URL;
protected:
virtual const char *getSiteKeyword() = 0;
virtual const char *getURL() { return URL; }
virtual bool isURLOk(const std::string &url);
private:
const char *URL;
};
struct LyricstimeFetcher : public GoogleLyricsFetcher
{
virtual const char *name() { return "lyricstime.com"; }
protected:
virtual const char *getSiteKeyword() { return "lyricstime"; }
virtual const char *getOpenTag() { return "<div id=\"songlyrics\" >"; }
virtual const char *getCloseTag() { return "</div>"; }
virtual bool isURLOk(const std::string &url);
virtual void postProcess(std::string &data);
protected:
virtual const char *getSiteKeyword() { return "lyricstime"; }
virtual const char *getOpenTag() { return "<div id=\"songlyrics\" >"; }
virtual const char *getCloseTag() { return "</div>"; }
virtual bool isURLOk(const std::string &url);
virtual void postProcess(std::string &data);
};
struct MetrolyricsFetcher : public GoogleLyricsFetcher
{
virtual const char *name() { return "metrolyrics.com"; }
protected:
virtual const char *getSiteKeyword() { return "metrolyrics"; }
virtual const char *getOpenTag() { return "<div id=\"lyrics\">"; }
virtual const char *getCloseTag() { return "</div>"; }
virtual bool isURLOk(const std::string &url);
virtual void postProcess(std::string &data);
protected:
virtual const char *getSiteKeyword() { return "metrolyrics"; }
virtual const char *getOpenTag() { return "<div id=\"lyrics\">"; }
virtual const char *getCloseTag() { return "</div>"; }
virtual bool isURLOk(const std::string &url);
virtual void postProcess(std::string &data);
};
struct LyricsmaniaFetcher : public GoogleLyricsFetcher
{
virtual const char *name() { return "lyricsmania.com"; }
protected:
virtual const char *getSiteKeyword() { return "lyricsmania"; }
virtual const char *getOpenTag() { return "</strong> :<br />"; }
virtual const char *getCloseTag() { return "&#91; <a"; }
virtual void postProcess(std::string &data);
protected:
virtual const char *getSiteKeyword() { return "lyricsmania"; }
virtual const char *getOpenTag() { return "</strong> :<br />"; }
virtual const char *getCloseTag() { return "&#91; <a"; }
virtual void postProcess(std::string &data);
};
struct SonglyricsFetcher : public GoogleLyricsFetcher
{
virtual const char *name() { return "songlyrics.com"; }
protected:
virtual const char *getSiteKeyword() { return "songlyrics"; }
virtual const char *getOpenTag() { return "-6000px;\">"; }
virtual const char *getCloseTag() { return "</p>"; }
virtual void postProcess(std::string &data);
protected:
virtual const char *getSiteKeyword() { return "songlyrics"; }
virtual const char *getOpenTag() { return "-6000px;\">"; }
virtual const char *getCloseTag() { return "</p>"; }
virtual void postProcess(std::string &data);
};
struct LyriczzFetcher : public GoogleLyricsFetcher
{
virtual const char *name() { return "lyriczz.com"; }
protected:
virtual const char *getSiteKeyword() { return "lyriczz"; }
virtual const char *getOpenTag() { return "border=0 /></a>"; }
virtual const char *getCloseTag() { return "<a href"; }
protected:
virtual const char *getSiteKeyword() { return "lyriczz"; }
virtual const char *getOpenTag() { return "border=0 /></a>"; }
virtual const char *getCloseTag() { return "<a href"; }
};
struct Sing365Fetcher : public GoogleLyricsFetcher
{
virtual const char *name() { return "sing365.com"; }
protected:
virtual const char *getSiteKeyword() { return "sing365"; }
virtual const char *getOpenTag() { return "<br><br></div>"; }
virtual const char *getCloseTag() { return "<div align"; }
protected:
virtual const char *getSiteKeyword() { return "sing365"; }
virtual const char *getOpenTag() { return "<br><br></div>"; }
virtual const char *getCloseTag() { return "<div align"; }
};
struct LyricsvipFetcher : public GoogleLyricsFetcher
{
virtual const char *name() { return "lyricsvip.com"; }
protected:
virtual const char *getSiteKeyword() { return "lyricsvip"; }
virtual const char *getOpenTag() { return "</h2>"; }
virtual const char *getCloseTag() { return "</td>"; }
virtual void postProcess(std::string &data);
protected:
virtual const char *getSiteKeyword() { return "lyricsvip"; }
virtual const char *getOpenTag() { return "</h2>"; }
virtual const char *getCloseTag() { return "</td>"; }
virtual void postProcess(std::string &data);
};
struct JustSomeLyricsFetcher : public GoogleLyricsFetcher
{
virtual const char *name() { return "justsomelyrics.com"; }
protected:
virtual const char *getSiteKeyword() { return "justsomelyrics"; }
virtual const char *getOpenTag() { return "alt=\"phone\" />\n</div>"; }
virtual const char *getCloseTag() { return "<div class=\"adsdiv\">"; }
protected:
virtual const char *getSiteKeyword() { return "justsomelyrics"; }
virtual const char *getOpenTag() { return "alt=\"phone\" />\n</div>"; }
virtual const char *getCloseTag() { return "<div class=\"adsdiv\">"; }
};
struct LoloLyricsFetcher : public GoogleLyricsFetcher
{
virtual const char *name() { return "lololyrics.com"; }
protected:
virtual const char *getSiteKeyword() { return "lololyrics"; }
virtual const char *getOpenTag() { return "<div class=\"lyrics_txt\" id=\"lyrics_txt\" style=\"font-size:12px; letter-spacing:0.2px; line-height:20px;\">"; }
virtual const char *getCloseTag() { return "</div>"; }
protected:
virtual const char *getSiteKeyword() { return "lololyrics"; }
virtual const char *getOpenTag() { return "<div class=\"lyrics_txt\" id=\"lyrics_txt\" style=\"font-size:12px; letter-spacing:0.2px; line-height:20px;\">"; }
virtual const char *getCloseTag() { return "</div>"; }
};
struct InternetLyricsFetcher : public GoogleLyricsFetcher
@@ -195,15 +195,15 @@ struct InternetLyricsFetcher : public GoogleLyricsFetcher
virtual const char *name() { return "the Internet"; }
virtual Result fetch(const std::string &artist, const std::string &title);
protected:
virtual const char *getSiteKeyword() { return "lyrics"; }
virtual const char *getOpenTag() { return ""; }
virtual const char *getCloseTag() { return ""; }
virtual bool isURLOk(const std::string &url);
private:
std::string URL;
protected:
virtual const char *getSiteKeyword() { return "lyrics"; }
virtual const char *getOpenTag() { return ""; }
virtual const char *getCloseTag() { return ""; }
virtual bool isURLOk(const std::string &url);
private:
std::string URL;
};
extern LyricsFetcher *lyricsPlugins[];

View File

@@ -24,77 +24,76 @@
#include "interfaces.h"
#include "screen.h"
class MediaLibrary : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable
struct MediaLibrary : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable
{
public:
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void refresh() OVERRIDE;
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; }
// Filterable implementation
virtual bool allowsFiltering() OVERRIDE;
virtual std::string currentFilter() OVERRIDE;
virtual void applyFilter(const std::string &filter) OVERRIDE;
// 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
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();
void LocateSong(const MPD::Song &);
std::shared_ptr<ProxySongList> songsProxyList();
struct SearchConstraints
{
SearchConstraints() { }
SearchConstraints(const std::string &tag, const std::string &album, const std::string &date)
: PrimaryTag(tag), Album(album), Date(date) { }
SearchConstraints(const std::string &album, const std::string &date)
: Album(album), Date(date) { }
virtual std::wstring title() OVERRIDE;
virtual void refresh() OVERRIDE;
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; }
// Filterable implementation
virtual bool allowsFiltering() OVERRIDE;
virtual std::string currentFilter() OVERRIDE;
virtual void applyFilter(const std::string &filter) OVERRIDE;
// 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
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();
void LocateSong(const MPD::Song &);
std::shared_ptr<ProxySongList> songsProxyList();
struct SearchConstraints
{
SearchConstraints() { }
SearchConstraints(const std::string &tag, const std::string &album, const std::string &date)
: PrimaryTag(tag), Album(album), Date(date) { }
SearchConstraints(const std::string &album, const std::string &date)
: Album(album), Date(date) { }
std::string PrimaryTag;
std::string Album;
std::string Date;
};
NC::Menu<std::string> *Tags;
NC::Menu<SearchConstraints> *Albums;
NC::Menu<MPD::Song> *Songs;
protected:
virtual void init();
virtual bool isLockable() { return true; }
private:
void AddToPlaylist(bool);
std::string PrimaryTag;
std::string Album;
std::string Date;
};
NC::Menu<std::string> *Tags;
NC::Menu<SearchConstraints> *Albums;
NC::Menu<MPD::Song> *Songs;
protected:
virtual void init();
virtual bool isLockable() { return true; }
private:
void AddToPlaylist(bool);
};
extern MediaLibrary *myLibrary;

View File

@@ -29,31 +29,29 @@
#include "mpdpp.h"
#include "screen.h"
class Outputs : public Screen< NC::Menu<MPD::Output> >
struct Outputs : public Screen< NC::Menu<MPD::Output> >
{
public:
// Screen< NC::Menu<MPD::Output> > implementation
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
// Screen< NC::Menu<MPD::Output> > implementation
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
};
extern Outputs *myOutputs;

View File

@@ -27,84 +27,83 @@
#include "screen.h"
#include "song.h"
class Playlist : public Screen<NC::Menu<MPD::Song>>, public Filterable, public HasSongs, public Searchable
struct Playlist : public Screen<NC::Menu<MPD::Song>>, public Filterable, public HasSongs, public Searchable
{
public:
Playlist() : itsTotalLength(0), itsRemainingTime(0), itsScrollBegin(0) { }
~Playlist() { }
// Screen<NC::Menu<MPD::Song>> implementation
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
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; }
// 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) OVERRIDE;
virtual void nextFound(bool wrap) OVERRIDE;
virtual void prevFound(bool wrap) OVERRIDE;
// HasSongs implementation
virtual std::shared_ptr<ProxySongList> getProxySongList() OVERRIDE;
virtual bool allowsSelection() OVERRIDE;
virtual void reverseSelection() OVERRIDE;
virtual MPD::SongList getSelectedSongs() OVERRIDE;
// private members
MPD::Song nowPlayingSong();
bool isFiltered();
void Reverse();
void EnableHighlighting();
void UpdateTimer();
timeval Timer() const { return itsTimer; }
bool Add(const MPD::Song &s, bool play, int position = -1);
bool Add(const MPD::SongList &l, bool play, int position = -1);
void PlayNewlyAddedSongs();
void SetSelectedItemsPriority(int prio);
bool checkForSong(const MPD::Song &s);
void registerHash(size_t hash);
void unregisterHash(size_t hash);
static bool ReloadTotalLength;
static bool ReloadRemaining;
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
std::string TotalLength();
std::string itsBufferedStats;
std::map<size_t, int> itsSongHashes;
size_t itsTotalLength;
size_t itsRemainingTime;
size_t itsScrollBegin;
timeval itsTimer;
Playlist() : itsTotalLength(0), itsRemainingTime(0), itsScrollBegin(0) { }
~Playlist() { }
// Screen<NC::Menu<MPD::Song>> implementation
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
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; }
// 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) OVERRIDE;
virtual void nextFound(bool wrap) OVERRIDE;
virtual void prevFound(bool wrap) OVERRIDE;
// HasSongs implementation
virtual std::shared_ptr<ProxySongList> getProxySongList() OVERRIDE;
virtual bool allowsSelection() OVERRIDE;
virtual void reverseSelection() OVERRIDE;
virtual MPD::SongList getSelectedSongs() OVERRIDE;
// private members
MPD::Song nowPlayingSong();
bool isFiltered();
void Reverse();
void EnableHighlighting();
void UpdateTimer();
timeval Timer() const { return itsTimer; }
bool Add(const MPD::Song &s, bool play, int position = -1);
bool Add(const MPD::SongList &l, bool play, int position = -1);
void PlayNewlyAddedSongs();
void SetSelectedItemsPriority(int prio);
bool checkForSong(const MPD::Song &s);
void registerHash(size_t hash);
void unregisterHash(size_t hash);
static bool ReloadTotalLength;
static bool ReloadRemaining;
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
std::string TotalLength();
std::string itsBufferedStats;
std::map<size_t, int> itsSongHashes;
size_t itsTotalLength;
size_t itsRemainingTime;
size_t itsScrollBegin;
timeval itsTimer;
};
extern Playlist *myPlaylist;

View File

@@ -24,69 +24,68 @@
#include "interfaces.h"
#include "screen.h"
class PlaylistEditor : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable
struct PlaylistEditor : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable
{
public:
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void refresh() OVERRIDE;
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; }
// Filterable implementation
virtual bool allowsFiltering() OVERRIDE;
virtual std::string currentFilter() OVERRIDE;
virtual void applyFilter(const std::string &filter) OVERRIDE;
// 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
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
void requestPlaylistsUpdate() { playlistsUpdateRequested = true; }
void requestContentsUpdate() { contentUpdateRequested = true; }
virtual void Locate(const std::string &);
bool isContentFiltered();
std::shared_ptr<ProxySongList> contentProxyList();
NC::Menu<std::string> *Playlists;
NC::Menu<MPD::Song> *Content;
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
void AddToPlaylist(bool);
bool playlistsUpdateRequested;
bool contentUpdateRequested;
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void refresh() OVERRIDE;
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; }
// Filterable implementation
virtual bool allowsFiltering() OVERRIDE;
virtual std::string currentFilter() OVERRIDE;
virtual void applyFilter(const std::string &filter) OVERRIDE;
// 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
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
void requestPlaylistsUpdate() { playlistsUpdateRequested = true; }
void requestContentsUpdate() { contentUpdateRequested = true; }
virtual void Locate(const std::string &);
bool isContentFiltered();
std::shared_ptr<ProxySongList> contentProxyList();
NC::Menu<std::string> *Playlists;
NC::Menu<MPD::Song> *Content;
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
void AddToPlaylist(bool);
bool playlistsUpdateRequested;
bool contentUpdateRequested;
};
extern PlaylistEditor *myPlaylistEditor;

View File

@@ -73,66 +73,65 @@ struct SEItem
MPD::Song itsSong;
};
class SearchEngine : public Screen< NC::Menu<SEItem> >, public Filterable, public HasSongs, public Searchable
struct SearchEngine : public Screen< NC::Menu<SEItem> >, public Filterable, public HasSongs, public Searchable
{
public:
// Screen< NC::Menu<SEItem> > implementation
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
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; }
// Filterable implementation
virtual bool allowsFiltering() OVERRIDE;
virtual std::string currentFilter() OVERRIDE;
virtual void applyFilter(const std::string &filter) OVERRIDE;
// 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
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
void Prepare();
void Search();
void reset();
const char **SearchMode;
static const char *SearchModes[];
static const size_t ConstraintsNumber = 11;
static const char *ConstraintsNames[];
std::string itsConstraints[ConstraintsNumber];
static bool MatchToPattern;
// Screen< NC::Menu<SEItem> > implementation
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
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; }
// Filterable implementation
virtual bool allowsFiltering() OVERRIDE;
virtual std::string currentFilter() OVERRIDE;
virtual void applyFilter(const std::string &filter) OVERRIDE;
// 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
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
void Prepare();
void Search();
void reset();
const char **SearchMode;
static const char *SearchModes[];
static const size_t ConstraintsNumber = 11;
static const char *ConstraintsNames[];
std::string itsConstraints[ConstraintsNumber];
static bool MatchToPattern;
};
extern SearchEngine *mySearcher;

View File

@@ -23,42 +23,41 @@
#include "screen.h"
class SelectedItemsAdder : public Screen< NC::Menu<std::string> >
struct SelectedItemsAdder : public Screen< NC::Menu<std::string> >
{
public:
SelectedItemsAdder() : itsPSWidth(35), itsPSHeight(11) { }
// Screen< NC::Menu<std::string> > implementation
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual void refresh() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE { }
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
void SetDimensions();
NC::Menu<std::string> *itsPlaylistSelector;
NC::Menu<std::string> *itsPositionSelector;
size_t itsPSWidth;
size_t itsPSHeight;
size_t itsWidth;
size_t itsHeight;
SelectedItemsAdder() : itsPSWidth(35), itsPSHeight(11) { }
// Screen< NC::Menu<std::string> > implementation
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual void refresh() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE { }
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
void SetDimensions();
NC::Menu<std::string> *itsPlaylistSelector;
NC::Menu<std::string> *itsPositionSelector;
size_t itsPSWidth;
size_t itsPSHeight;
size_t itsWidth;
size_t itsHeight;
};
extern SelectedItemsAdder *mySelectedItemsAdder;

View File

@@ -23,35 +23,34 @@
#include "screen.h"
class ServerInfo : public Screen<NC::Scrollpad>
struct ServerInfo : public Screen<NC::Scrollpad>
{
public:
// Screen<NC::Scrollpad> implementation
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE;
virtual void enterPressed() OVERRIDE { }
virtual void spacePressed() OVERRIDE { }
virtual bool isMergable() OVERRIDE { return false; }
virtual bool isTabbable() OVERRIDE { return false; }
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
void SetDimensions();
MPD::StringList itsURLHandlers;
MPD::StringList itsTagTypes;
size_t itsWidth;
size_t itsHeight;
// Screen<NC::Scrollpad> implementation
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE;
virtual void enterPressed() OVERRIDE { }
virtual void spacePressed() OVERRIDE { }
virtual bool isMergable() OVERRIDE { return false; }
virtual bool isTabbable() OVERRIDE { return false; }
protected:
virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
void SetDimensions();
MPD::StringList itsURLHandlers;
MPD::StringList itsTagTypes;
size_t itsWidth;
size_t itsHeight;
};
extern ServerInfo *myServerInfo;

View File

@@ -192,11 +192,11 @@ struct Configuration
SortMode browser_sort_mode;
private:
void MakeProperPath(std::string &dir);
std::string home_directory;
std::string config_file_path;
private:
void MakeProperPath(std::string &dir);
std::string home_directory;
std::string config_file_path;
};
extern Configuration Config;

View File

@@ -79,13 +79,13 @@ struct Song
static const char FormatEscapeCharacter = 1;
private:
const char *getTag(mpd_tag_type type, unsigned idx) const;
std::string ParseFormat(std::string::const_iterator &it, const std::string &tags_separator,
const std::string &escape_chars) const;
std::shared_ptr<mpd_song> m_song;
size_t m_hash;
private:
const char *getTag(mpd_tag_type type, unsigned idx) const;
std::string ParseFormat(std::string::const_iterator &it, const std::string &tags_separator,
const std::string &escape_chars) const;
std::shared_ptr<mpd_song> m_song;
size_t m_hash;
};
typedef std::vector<Song> SongList;

View File

@@ -24,40 +24,38 @@
#include "screen.h"
#include "mutable_song.h"
class SongInfo : public Screen<NC::Scrollpad>
struct SongInfo : public Screen<NC::Scrollpad>
{
public:
struct Metadata
{
const char *Name;
MPD::Song::GetFunction Get;
MPD::MutableSong::SetFunction Set;
};
// Screen<NC::Scrollpad> implementation
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE { }
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
void PrepareSong(MPD::Song &);
struct Metadata
{
const char *Name;
MPD::Song::GetFunction Get;
MPD::MutableSong::SetFunction Set;
};
// Screen<NC::Scrollpad> implementation
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE { }
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; }
private:
void PrepareSong(MPD::Song &);
};
extern SongInfo *mySongInfo;

View File

@@ -33,77 +33,76 @@
#include "regex_filter.h"
#include "screen.h"
class TagEditor : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable
struct 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() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void refresh() OVERRIDE;
virtual void update() OVERRIDE;
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() OVERRIDE;
virtual std::string currentFilter() OVERRIDE;
virtual void applyFilter(const std::string &filter) OVERRIDE;
// 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
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
bool ifAnyModifiedAskForDiscarding();
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;
protected:
virtual void init();
virtual bool isLockable() { return true; }
private:
void SetDimensions(size_t, size_t);
std::vector<MPD::MutableSong *> EditedSongs;
NC::Menu<std::string> *FParserDialog;
NC::Menu<std::string> *FParser;
NC::Scrollpad *FParserHelper;
NC::Scrollpad *FParserLegend;
NC::Scrollpad *FParserPreview;
bool FParserUsePreview;
std::string itsBrowsedDir;
std::string itsHighlightedDir;
TagEditor() : FParser(0), FParserHelper(0), FParserLegend(0), FParserPreview(0), itsBrowsedDir("/") { }
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void refresh() OVERRIDE;
virtual void update() OVERRIDE;
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() OVERRIDE;
virtual std::string currentFilter() OVERRIDE;
virtual void applyFilter(const std::string &filter) OVERRIDE;
// 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
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
bool ifAnyModifiedAskForDiscarding();
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;
protected:
virtual void init();
virtual bool isLockable() { return true; }
private:
void SetDimensions(size_t, size_t);
std::vector<MPD::MutableSong *> EditedSongs;
NC::Menu<std::string> *FParserDialog;
NC::Menu<std::string> *FParser;
NC::Scrollpad *FParserHelper;
NC::Scrollpad *FParserLegend;
NC::Scrollpad *FParserPreview;
bool FParserUsePreview;
std::string itsBrowsedDir;
std::string itsHighlightedDir;
};
extern TagEditor *myTagEditor;

View File

@@ -28,34 +28,33 @@
#include "mutable_song.h"
#include "screen.h"
class TinyTagEditor : public Screen< NC::Menu<NC::Buffer> >
struct TinyTagEditor : public Screen< NC::Menu<NC::Buffer> >
{
public:
// Screen< NC::Menu<NC::Buffer> > implementation
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE { }
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
bool getTags();
MPD::MutableSong itsEdited;
// Screen< NC::Menu<NC::Buffer> > implementation
virtual void resize() OVERRIDE;
virtual void switchTo() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE { }
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() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; }
private:
bool getTags();
MPD::MutableSong itsEdited;
};
extern TinyTagEditor *myTinyTagEditor;

View File

@@ -32,53 +32,52 @@
# include <fftw3.h>
#endif
class Visualizer : public Screen<NC::Window>
struct Visualizer : public Screen<NC::Window>
{
public:
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE;
virtual void scroll(NC::Where) OVERRIDE { }
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; }
// private members
void SetFD();
void ResetFD();
void FindOutputID();
static const int WindowTimeout;
protected:
virtual void init();
virtual bool isLockable() { return true; }
private:
void DrawSoundWave(int16_t *, ssize_t, size_t, size_t);
# ifdef HAVE_FFTW3_H
void DrawFrequencySpectrum(int16_t *, ssize_t, size_t, size_t);
# endif // HAVE_FFTW3_H
int itsOutputID;
timeval itsTimer;
int itsFifo;
unsigned itsSamples;
# ifdef HAVE_FFTW3_H
unsigned itsFFTResults;
unsigned *itsFreqsMagnitude;
double *itsInput;
fftw_complex *itsOutput;
fftw_plan itsPlan;
# endif // HAVE_FFTW3_H
virtual void switchTo() OVERRIDE;
virtual void resize() OVERRIDE;
virtual std::wstring title() OVERRIDE;
virtual void update() OVERRIDE;
virtual void scroll(NC::Where) OVERRIDE { }
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; }
// private members
void SetFD();
void ResetFD();
void FindOutputID();
static const int WindowTimeout;
protected:
virtual void init();
virtual bool isLockable() { return true; }
private:
void DrawSoundWave(int16_t *, ssize_t, size_t, size_t);
# ifdef HAVE_FFTW3_H
void DrawFrequencySpectrum(int16_t *, ssize_t, size_t, size_t);
# endif // HAVE_FFTW3_H
int itsOutputID;
timeval itsTimer;
int itsFifo;
unsigned itsSamples;
# ifdef HAVE_FFTW3_H
unsigned itsFFTResults;
unsigned *itsFreqsMagnitude;
double *itsInput;
fftw_complex *itsOutput;
fftw_plan itsPlan;
# endif // HAVE_FFTW3_H
};
extern Visualizer *myVisualizer;