- audioplayer: small design reworks ...

* use OFFSET defines
* use CComponentsScrollbar
* rename some variables
* many, many position calculation fixes
* re-format code

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2017-06-18 00:04:40 +02:00
committed by Thilo Graf
parent 224521bc40
commit 4c21971b4a
3 changed files with 643 additions and 658 deletions

View File

@@ -160,8 +160,8 @@ audioplayer.add_loc Lokale Radioliste
audioplayer.add_sc SHOUTcast audioplayer.add_sc SHOUTcast
audioplayer.artist_title Interpret, Titel audioplayer.artist_title Interpret, Titel
audioplayer.building_search_index Erstelle Suchindex audioplayer.building_search_index Erstelle Suchindex
audioplayer.button_select_title_by_id Suche n. ID audioplayer.button_select_title_by_id Suche nach ID
audioplayer.button_select_title_by_name Suche n. Name audioplayer.button_select_title_by_name Suche nach Name
audioplayer.defdir Start-Verzeichnis audioplayer.defdir Start-Verzeichnis
audioplayer.delete Entfernen audioplayer.delete Entfernen
audioplayer.deleteall Alle entfernen audioplayer.deleteall Alle entfernen

File diff suppressed because it is too large Load Diff

View File

@@ -1,17 +1,9 @@
/* /*
$Id: audioplayer.h,v 1.24 2009/10/03 10:36:29 seife Exp $
Neutrino-GUI - DBoxII-Project Neutrino-GUI - DBoxII-Project
Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/ Copyright (C) 2009 Stefan Seyfried
Copyright (C) 2017 Sven Hoefer
Kommentar:
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
License: GPL License: GPL
@@ -26,8 +18,7 @@
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program. If not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef __audioplayergui__ #ifndef __audioplayergui__
@@ -55,8 +46,7 @@ typedef std::pair<unsigned char, CPosList> CTitle2PosItem;
class CFrameBuffer; class CFrameBuffer;
class CAudiofileExt : public CAudiofile class CAudiofileExt : public CAudiofile
{ {
public: public:
CAudiofileExt(); CAudiofileExt();
CAudiofileExt(std::string name, CFile::FileType type); CAudiofileExt(std::string name, CFile::FileType type);
@@ -65,7 +55,6 @@ public:
void operator=(const CAudiofileExt& src); void operator=(const CAudiofileExt& src);
char firstChar; char firstChar;
}; };
@@ -74,14 +63,9 @@ typedef std::vector<CAudiofileExt> CAudioPlayList;
class RandomNumber class RandomNumber
{ {
public: public:
RandomNumber() RandomNumber() { std::srand(time(0)); }
{
std::srand(time(0));
}
int operator()(int n){ int operator()(int n) { return std::rand() / (1.0 + RAND_MAX) * n; }
return std::rand() / (1.0 + RAND_MAX) * n;
}
}; };
class CAudioPlayerGui : public CMenuTarget class CAudioPlayerGui : public CMenuTarget
@@ -96,7 +80,11 @@ class CAudioPlayerGui : public CMenuTarget
REV REV
}; };
enum DisplayOrder {ARTIST_TITLE = 0, TITLE_ARTIST=1}; enum DisplayOrder
{
ARTIST_TITLE = 0,
TITLE_ARTIST=1
};
private: private:
void Init(void); void Init(void);
@@ -105,10 +93,10 @@ class CAudioPlayerGui : public CMenuTarget
int m_current; int m_current;
unsigned int m_liststart; unsigned int m_liststart;
unsigned int m_listmaxshow; unsigned int m_listmaxshow;
int m_fheight; // Fonthoehe Playlist-Inhalt int m_item_height;
int m_theight; // Fonthoehe Playlist-Titel int m_header_height;
int m_sheight; // Fonthoehe MP Info int m_meta_height;
int m_buttonHeight; int m_button_height;
int m_title_height; int m_title_height;
int m_info_height; int m_info_height;
int m_key_level; int m_key_level;
@@ -119,7 +107,6 @@ class CAudioPlayerGui : public CMenuTarget
std::string m_metainfo; std::string m_metainfo;
bool m_select_title_by_name; bool m_select_title_by_name;
bool m_show_playlist; bool m_show_playlist;
bool m_playlistHasChanged; bool m_playlistHasChanged;
CAudioPlayList m_playlist; CAudioPlayList m_playlist;
@@ -139,8 +126,8 @@ class CAudioPlayerGui : public CMenuTarget
int m_idletime; int m_idletime;
bool m_screensaver; bool m_screensaver;
bool m_inetmode; bool m_inetmode;
CComponentsDetailsLine *dline; CComponentsDetailsLine *m_detailsline;
CComponentsInfoBox *ibox; CComponentsInfoBox *m_infobox;
SMSKeyInput m_SMSKeyInput; SMSKeyInput m_SMSKeyInput;
@@ -148,16 +135,16 @@ class CAudioPlayerGui : public CMenuTarget
void paint(); void paint();
void paintHead(); void paintHead();
void paintFoot(); void paintFoot();
void paintInfo(); void paintTitleBox();
void paintCover(); void paintCover();
void paintLCD(); void paintLCD();
void paintDetailsLine(int pos);
void clearDetailsLine();
void hide(); void hide();
void get_id3(CAudiofileExt * audiofile); void get_id3(CAudiofileExt * audiofile);
void get_mp3info(CAudiofileExt * audiofile); void get_mp3info(CAudiofileExt * audiofile);
CFileFilter audiofilefilter; CFileFilter audiofilefilter;
void paintItemID3DetailsLine (int pos);
void clearItemID3DetailsLine ();
void ff(unsigned int seconds=0); void ff(unsigned int seconds=0);
void rev(unsigned int seconds=0); void rev(unsigned int seconds=0);
int getNext(); int getNext();
@@ -166,7 +153,7 @@ class CAudioPlayerGui : public CMenuTarget
void updateTimes(const bool force = false); void updateTimes(const bool force = false);
void showMetaData(); void showMetaData();
void screensaver(bool on); void screensaver(bool on);
bool getNumericInput(neutrino_msg_t& msg,int& val); bool getNumericInput(neutrino_msg_t& msg, int& val);
void addToPlaylist(CAudiofileExt &file); void addToPlaylist(CAudiofileExt &file);
void removeFromPlaylist(long pos); void removeFromPlaylist(long pos);
@@ -197,6 +184,7 @@ class CAudioPlayerGui : public CMenuTarget
void readDir_ic(void); void readDir_ic(void);
void selectTitle(unsigned char selectionChar); void selectTitle(unsigned char selectionChar);
/** /**
* Appends the file information to the given string. * Appends the file information to the given string.
* @param fileInfo a string where the file information will be appended * @param fileInfo a string where the file information will be appended
@@ -231,8 +219,7 @@ class CAudioPlayerGui : public CMenuTarget
* @return the location of absFilename as seen from fromDir * @return the location of absFilename as seen from fromDir
* (relative path) * (relative path)
*/ */
std::string absPath2Rel(const std::string& fromDir, std::string absPath2Rel(const std::string& fromDir, const std::string& absFilename);
const std::string& absFilename);
/** /**
* Asks the user if the file filename should be overwritten or not * Asks the user if the file filename should be overwritten or not
@@ -240,6 +227,7 @@ class CAudioPlayerGui : public CMenuTarget
* @return true if file should be overwritten, false otherwise * @return true if file should be overwritten, false otherwise
*/ */
bool askToOverwriteFile(const std::string& filename); bool askToOverwriteFile(const std::string& filename);
bool openFilebrowser(void); bool openFilebrowser(void);
bool openSCbrowser(void); bool openSCbrowser(void);
bool clearPlaylist(void); bool clearPlaylist(void);
@@ -259,8 +247,7 @@ class CAudioPlayerGui : public CMenuTarget
void stop(); void stop();
bool playNext(bool allow_rotate = false); bool playNext(bool allow_rotate = false);
bool playPrev(bool allow_rotate = false); bool playPrev(bool allow_rotate = false);
int getAudioPlayerM_current() {return m_current;} int getAudioPlayerM_current() { return m_current; }
}; };
#endif #endif