mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-01 01:41:12 +02:00
gui/audioplayer.cpp: disable screen save for dline/ibox;
always load metadata when adding files to play list;
cleanup code
Origin commit data
------------------
Commit: 937c23bc20
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-12-12 (Thu, 12 Dec 2013)
This commit is contained in:
@@ -79,21 +79,10 @@ extern CPictureViewer * g_PicViewer;
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#if 0
|
#include <curl/curl.h>
|
||||||
#ifdef ENABLE_LIRC
|
#include <curl/easy.h>
|
||||||
#include <irsend/irsend.h>
|
#if LIBCURL_VERSION_NUM < 0x071507
|
||||||
#endif
|
#include <curl/types.h>
|
||||||
|
|
||||||
#if 1
|
|
||||||
#include <linux/dvb/audio.h>
|
|
||||||
#include <linux/dvb/dmx.h>
|
|
||||||
#include <linux/dvb/video.h>
|
|
||||||
#define ADAP "/dev/dvb/adapter0"
|
|
||||||
#define ADEC ADAP "/audio0"
|
|
||||||
#define VDEC ADAP "/video0"
|
|
||||||
#define DMX ADAP "/demux0"
|
|
||||||
#define DVR ADAP "/dvr0"
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <video.h>
|
#include <video.h>
|
||||||
@@ -102,7 +91,7 @@ extern cVideo * videoDecoder;
|
|||||||
#define AUDIOPLAYERGUI_SMSKEY_TIMEOUT 1000
|
#define AUDIOPLAYERGUI_SMSKEY_TIMEOUT 1000
|
||||||
#define SHOW_FILE_LOAD_LIMIT 50
|
#define SHOW_FILE_LOAD_LIMIT 50
|
||||||
|
|
||||||
//#define AUDIOPLAYER_TIME_DEBUG
|
#define AUDIOPLAYER_TIME_DEBUG
|
||||||
|
|
||||||
// check if files to be added are already in the playlist
|
// check if files to be added are already in the playlist
|
||||||
#define AUDIOPLAYER_CHECK_FOR_DUPLICATES
|
#define AUDIOPLAYER_CHECK_FOR_DUPLICATES
|
||||||
@@ -135,17 +124,6 @@ void CAudiofileExt::operator=(const CAudiofileExt& src)
|
|||||||
firstChar = src.firstChar;
|
firstChar = src.firstChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
#include <curl/curl.h>
|
|
||||||
#include <curl/easy.h>
|
|
||||||
|
|
||||||
#if LIBCURL_VERSION_NUM < 0x071507
|
|
||||||
#include <curl/types.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct MemoryStruct {
|
struct MemoryStruct {
|
||||||
char *memory;
|
char *memory;
|
||||||
size_t size;
|
size_t size;
|
||||||
@@ -227,21 +205,16 @@ void CAudioPlayerGui::Init(void)
|
|||||||
m_SMSKeyInput.setTimeout(AUDIOPLAYERGUI_SMSKEY_TIMEOUT);
|
m_SMSKeyInput.setTimeout(AUDIOPLAYERGUI_SMSKEY_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
CAudioPlayerGui::~CAudioPlayerGui()
|
CAudioPlayerGui::~CAudioPlayerGui()
|
||||||
{
|
{
|
||||||
m_playlist.clear();
|
m_playlist.clear();
|
||||||
m_radiolist.clear();
|
m_radiolist.clear();
|
||||||
m_filelist.clear();
|
m_filelist.clear();
|
||||||
m_title2Pos.clear();
|
m_title2Pos.clear();
|
||||||
// g_Zapit->setStandby (false);
|
|
||||||
// g_Sectionsd->setPauseScanning (false);
|
|
||||||
delete dline;
|
delete dline;
|
||||||
delete ibox;
|
delete ibox;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey)
|
int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -299,9 +272,7 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey)
|
|||||||
m_screensaver=false;
|
m_screensaver=false;
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
{
|
|
||||||
parent->hide();
|
parent->hide();
|
||||||
}
|
|
||||||
|
|
||||||
bool usedBackground = m_frameBuffer->getuseBackground();
|
bool usedBackground = m_frameBuffer->getuseBackground();
|
||||||
if (usedBackground)
|
if (usedBackground)
|
||||||
@@ -348,8 +319,6 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int CAudioPlayerGui::show()
|
int CAudioPlayerGui::show()
|
||||||
{
|
{
|
||||||
neutrino_msg_t msg;
|
neutrino_msg_t msg;
|
||||||
@@ -376,11 +345,10 @@ int CAudioPlayerGui::show()
|
|||||||
|
|
||||||
updateTimes();
|
updateTimes();
|
||||||
|
|
||||||
if (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_audio)
|
|
||||||
{
|
|
||||||
// stop if mode was changed in another thread
|
// stop if mode was changed in another thread
|
||||||
|
if (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_audio)
|
||||||
loop = false;
|
loop = false;
|
||||||
}
|
|
||||||
if ((m_state != CAudioPlayerGui::STOP) &&
|
if ((m_state != CAudioPlayerGui::STOP) &&
|
||||||
(CAudioPlayer::getInstance()->getState() == CBaseDec::STOP) &&
|
(CAudioPlayer::getInstance()->getState() == CBaseDec::STOP) &&
|
||||||
(!m_playlist.empty()))
|
(!m_playlist.empty()))
|
||||||
@@ -467,9 +435,7 @@ int CAudioPlayerGui::show()
|
|||||||
else if (!m_playlist.empty())
|
else if (!m_playlist.empty())
|
||||||
{
|
{
|
||||||
if (m_selected < m_listmaxshow)
|
if (m_selected < m_listmaxshow)
|
||||||
{
|
|
||||||
m_selected = m_playlist.size()-1;
|
m_selected = m_playlist.size()-1;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
m_selected -= m_listmaxshow;
|
m_selected -= m_listmaxshow;
|
||||||
m_liststart = (m_selected / m_listmaxshow) * m_listmaxshow;
|
m_liststart = (m_selected / m_listmaxshow) * m_listmaxshow;
|
||||||
@@ -517,17 +483,7 @@ int CAudioPlayerGui::show()
|
|||||||
m_selected -= step;
|
m_selected -= step;
|
||||||
if ((prevselected-step) < 0)
|
if ((prevselected-step) < 0)
|
||||||
m_selected = m_playlist.size()-1;
|
m_selected = m_playlist.size()-1;
|
||||||
#if 0
|
|
||||||
if (m_selected == 0)
|
|
||||||
{
|
|
||||||
m_selected = m_playlist.size()-1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_selected--;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
paintItem(prevselected - m_liststart);
|
|
||||||
unsigned int oldliststart = m_liststart;
|
unsigned int oldliststart = m_liststart;
|
||||||
m_liststart = (m_selected/m_listmaxshow)*m_listmaxshow;
|
m_liststart = (m_selected/m_listmaxshow)*m_listmaxshow;
|
||||||
if (oldliststart != m_liststart)
|
if (oldliststart != m_liststart)
|
||||||
@@ -536,6 +492,7 @@ int CAudioPlayerGui::show()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
paintItem(prevselected - m_liststart);
|
||||||
paintItem(m_selected - m_liststart);
|
paintItem(m_selected - m_liststart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -556,7 +513,6 @@ int CAudioPlayerGui::show()
|
|||||||
}
|
}
|
||||||
//m_selected = (m_selected + 1) % m_playlist.size();
|
//m_selected = (m_selected + 1) % m_playlist.size();
|
||||||
|
|
||||||
paintItem(prevselected - m_liststart);
|
|
||||||
unsigned int oldliststart = m_liststart;
|
unsigned int oldliststart = m_liststart;
|
||||||
m_liststart = (m_selected/m_listmaxshow)*m_listmaxshow;
|
m_liststart = (m_selected/m_listmaxshow)*m_listmaxshow;
|
||||||
if (oldliststart != m_liststart)
|
if (oldliststart != m_liststart)
|
||||||
@@ -565,6 +521,7 @@ int CAudioPlayerGui::show()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
paintItem(prevselected - m_liststart);
|
||||||
paintItem(m_selected - m_liststart);
|
paintItem(m_selected - m_liststart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -584,13 +541,10 @@ int CAudioPlayerGui::show()
|
|||||||
{
|
{
|
||||||
if (!m_playlist.empty())
|
if (!m_playlist.empty())
|
||||||
{
|
{
|
||||||
//xx CPlayList::iterator p = m_playlist.begin()+selected;
|
|
||||||
removeFromPlaylist(m_selected);
|
removeFromPlaylist(m_selected);
|
||||||
if ((int)m_selected == m_current)
|
if ((int)m_selected == m_current)
|
||||||
{
|
|
||||||
m_current--;
|
m_current--;
|
||||||
//stop(); // Stop if song is deleted, next song will be startet automat.
|
|
||||||
}
|
|
||||||
if (m_selected >= m_playlist.size())
|
if (m_selected >= m_playlist.size())
|
||||||
m_selected = m_playlist.empty() ? m_playlist.size() : m_playlist.size() - 1;
|
m_selected = m_playlist.empty() ? m_playlist.size() : m_playlist.size() - 1;
|
||||||
update = true;
|
update = true;
|
||||||
@@ -862,9 +816,6 @@ int CAudioPlayerGui::show()
|
|||||||
CVFD::getInstance()->setMode(CVFD::MODE_AUDIO);
|
CVFD::getInstance()->setMode(CVFD::MODE_AUDIO);
|
||||||
paintLCD();
|
paintLCD();
|
||||||
update = true;
|
update = true;
|
||||||
//pushback key if...
|
|
||||||
//g_RCInput->postMsg( msg, data );
|
|
||||||
//loop = false;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (msg == NeutrinoMessages::CHANGEMODE)
|
else if (msg == NeutrinoMessages::CHANGEMODE)
|
||||||
@@ -879,7 +830,7 @@ int CAudioPlayerGui::show()
|
|||||||
msg == NeutrinoMessages::ZAPTO ||
|
msg == NeutrinoMessages::ZAPTO ||
|
||||||
msg == NeutrinoMessages::STANDBY_ON ||
|
msg == NeutrinoMessages::STANDBY_ON ||
|
||||||
msg == NeutrinoMessages::SHUTDOWN ||
|
msg == NeutrinoMessages::SHUTDOWN ||
|
||||||
msg == NeutrinoMessages::SLEEPTIMER)
|
((msg == NeutrinoMessages::SLEEPTIMER) && !data))
|
||||||
{
|
{
|
||||||
if(msg != NeutrinoMessages::RECORD_START )
|
if(msg != NeutrinoMessages::RECORD_START )
|
||||||
ret = menu_return::RETURN_EXIT_ALL;
|
ret = menu_return::RETURN_EXIT_ALL;
|
||||||
@@ -965,8 +916,11 @@ bool CAudioPlayerGui::clearPlaylist(void)
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
CAudioPlayList::const_iterator it;
|
CAudioPlayList::const_iterator it;
|
||||||
for (it = m_playlist.begin(); it!=m_playlist.end(); ++it)
|
#if 0
|
||||||
|
for (it = m_playlist.begin(); it!=m_playlist.end(); ++it) {
|
||||||
unlink(it->MetaData.cover.c_str());
|
unlink(it->MetaData.cover.c_str());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!(m_playlist.empty()))
|
if (!(m_playlist.empty()))
|
||||||
{
|
{
|
||||||
@@ -993,9 +947,8 @@ bool CAudioPlayerGui::shufflePlaylist(void)
|
|||||||
|
|
||||||
std::random_shuffle((m_current != 0) ? m_playlist.begin() : m_playlist.begin() + 1, m_playlist.end(), rnd);
|
std::random_shuffle((m_current != 0) ? m_playlist.begin() : m_playlist.begin() + 1, m_playlist.end(), rnd);
|
||||||
if (m_select_title_by_name)
|
if (m_select_title_by_name)
|
||||||
{
|
|
||||||
buildSearchTree();
|
buildSearchTree();
|
||||||
}
|
|
||||||
m_playlistHasChanged = true;
|
m_playlistHasChanged = true;
|
||||||
m_selected = 0;
|
m_selected = 0;
|
||||||
|
|
||||||
@@ -1004,7 +957,8 @@ bool CAudioPlayerGui::shufflePlaylist(void)
|
|||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAudioPlayerGui::addUrl2Playlist(const char *url, const char *name, const time_t bitrate) {
|
void CAudioPlayerGui::addUrl2Playlist(const char *url, const char *name, const time_t bitrate)
|
||||||
|
{
|
||||||
CAudiofileExt mp3( url, CFile::STREAM_AUDIO );
|
CAudiofileExt mp3( url, CFile::STREAM_AUDIO );
|
||||||
// tmp = tmp.substr(0,tmp.length()-4); //remove .url
|
// tmp = tmp.substr(0,tmp.length()-4); //remove .url
|
||||||
//printf("[addUrl2Playlist], name = %s, url = %s\n", name, url);
|
//printf("[addUrl2Playlist], name = %s, url = %s\n", name, url);
|
||||||
@@ -1019,12 +973,12 @@ void CAudioPlayerGui::addUrl2Playlist(const char *url, const char *name, const t
|
|||||||
else
|
else
|
||||||
mp3.MetaData.total_time = 0;
|
mp3.MetaData.total_time = 0;
|
||||||
|
|
||||||
if (url[0] != '#') {
|
if (url[0] != '#')
|
||||||
addToPlaylist(mp3);
|
addToPlaylist(mp3);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void CAudioPlayerGui::processPlaylistUrl(const char *url, const char *name, const time_t tim) {
|
void CAudioPlayerGui::processPlaylistUrl(const char *url, const char *name, const time_t tim)
|
||||||
|
{
|
||||||
CURL *curl_handle;
|
CURL *curl_handle;
|
||||||
struct MemoryStruct chunk;
|
struct MemoryStruct chunk;
|
||||||
const long int GET_PLAYLIST_TIMEOUT = 2;
|
const long int GET_PLAYLIST_TIMEOUT = 2;
|
||||||
@@ -1110,7 +1064,6 @@ void CAudioPlayerGui::processPlaylistUrl(const char *url, const char *name, cons
|
|||||||
curl_global_cleanup();
|
curl_global_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CAudioPlayerGui::readDir_ic(void)
|
void CAudioPlayerGui::readDir_ic(void)
|
||||||
{
|
{
|
||||||
const std::string icecasturl = "http://dir.xiph.org/yp.xml";
|
const std::string icecasturl = "http://dir.xiph.org/yp.xml";
|
||||||
@@ -1418,15 +1371,12 @@ bool CAudioPlayerGui::openFilebrowser(void)
|
|||||||
else if (files->getType() == CFile::FILE_XML)
|
else if (files->getType() == CFile::FILE_XML)
|
||||||
{
|
{
|
||||||
if (!files->Name.empty())
|
if (!files->Name.empty())
|
||||||
{
|
|
||||||
scanXmlFile(files->Name);
|
scanXmlFile(files->Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (m_select_title_by_name)
|
if (m_select_title_by_name)
|
||||||
{
|
|
||||||
buildSearchTree();
|
buildSearchTree();
|
||||||
}
|
|
||||||
#ifdef AUDIOPLAYER_TIME_DEBUG
|
#ifdef AUDIOPLAYER_TIME_DEBUG
|
||||||
timeval end;
|
timeval end;
|
||||||
gettimeofday(&end,NULL);
|
gettimeofday(&end,NULL);
|
||||||
@@ -1434,9 +1384,8 @@ bool CAudioPlayerGui::openFilebrowser(void)
|
|||||||
printTimevalDiff(start,end);
|
printTimevalDiff(start,end);
|
||||||
#endif
|
#endif
|
||||||
//store last dir
|
//store last dir
|
||||||
if( (sizeof(g_settings.network_nfs_audioplayerdir)) > m_Path.size() && (strcmp(g_settings.network_nfs_audioplayerdir,m_Path.c_str()) != 0)){
|
if( (sizeof(g_settings.network_nfs_audioplayerdir)) > m_Path.size() && (strcmp(g_settings.network_nfs_audioplayerdir,m_Path.c_str()) != 0))
|
||||||
strcpy(g_settings.network_nfs_audioplayerdir,m_Path.c_str());
|
strcpy(g_settings.network_nfs_audioplayerdir,m_Path.c_str());
|
||||||
}
|
|
||||||
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
@@ -1449,8 +1398,6 @@ bool CAudioPlayerGui::openFilebrowser(void)
|
|||||||
return ( result);
|
return ( result);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool CAudioPlayerGui::openSCbrowser(void)
|
bool CAudioPlayerGui::openSCbrowser(void)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@@ -1504,9 +1451,7 @@ bool CAudioPlayerGui::openSCbrowser(void)
|
|||||||
g_RCInput->getMsg(&msg, &data, 0);
|
g_RCInput->getMsg(&msg, &data, 0);
|
||||||
}
|
}
|
||||||
if (m_select_title_by_name)
|
if (m_select_title_by_name)
|
||||||
{
|
|
||||||
buildSearchTree();
|
buildSearchTree();
|
||||||
}
|
|
||||||
#ifdef AUDIOPLAYER_TIME_DEBUG
|
#ifdef AUDIOPLAYER_TIME_DEBUG
|
||||||
timeval end;
|
timeval end;
|
||||||
gettimeofday(&end,NULL);
|
gettimeofday(&end,NULL);
|
||||||
@@ -1524,9 +1469,6 @@ bool CAudioPlayerGui::openSCbrowser(void)
|
|||||||
return ( result);
|
return ( result);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
void CAudioPlayerGui::hide()
|
void CAudioPlayerGui::hide()
|
||||||
{
|
{
|
||||||
// printf("hide(){\n");
|
// printf("hide(){\n");
|
||||||
@@ -1540,8 +1482,6 @@ void CAudioPlayerGui::hide()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::paintItem(int pos)
|
void CAudioPlayerGui::paintItem(int pos)
|
||||||
{
|
{
|
||||||
if (!m_show_playlist)
|
if (!m_show_playlist)
|
||||||
@@ -1603,14 +1543,6 @@ void CAudioPlayerGui::paintItem(int pos)
|
|||||||
|
|
||||||
if ((pos + m_liststart) < m_playlist.size())
|
if ((pos + m_liststart) < m_playlist.size())
|
||||||
{
|
{
|
||||||
if (m_playlist[pos + m_liststart].FileType != CFile::STREAM_AUDIO &&
|
|
||||||
!m_playlist[pos + m_liststart].MetaData.bitrate)
|
|
||||||
{
|
|
||||||
// id3tag noch nicht geholt
|
|
||||||
GetMetaData(m_playlist[pos + m_liststart]);
|
|
||||||
if (m_state != CAudioPlayerGui::STOP && !g_settings.audioplayer_highprio)
|
|
||||||
usleep(100*1000);
|
|
||||||
}
|
|
||||||
char sNr[20];
|
char sNr[20];
|
||||||
sprintf(sNr, "%2d : ", pos + m_liststart + 1);
|
sprintf(sNr, "%2d : ", pos + m_liststart + 1);
|
||||||
std::string tmp = sNr;
|
std::string tmp = sNr;
|
||||||
@@ -1630,16 +1562,12 @@ void CAudioPlayerGui::paintItem(int pos)
|
|||||||
if ((pos + m_liststart) == m_selected)
|
if ((pos + m_liststart) == m_selected)
|
||||||
{
|
{
|
||||||
if (m_state == CAudioPlayerGui::STOP)
|
if (m_state == CAudioPlayerGui::STOP)
|
||||||
{
|
|
||||||
CVFD::getInstance()->showAudioTrack(m_playlist[pos + m_liststart].MetaData.artist,
|
CVFD::getInstance()->showAudioTrack(m_playlist[pos + m_liststart].MetaData.artist,
|
||||||
m_playlist[pos + m_liststart].MetaData.title,
|
m_playlist[pos + m_liststart].MetaData.title,
|
||||||
m_playlist[pos + m_liststart].MetaData.album);
|
m_playlist[pos + m_liststart].MetaData.album);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//--------------playlist----------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::paintHead()
|
void CAudioPlayerGui::paintHead()
|
||||||
{
|
{
|
||||||
@@ -1660,7 +1588,6 @@ void CAudioPlayerGui::paintHead()
|
|||||||
header.paint(CC_SAVE_SCREEN_NO);
|
header.paint(CC_SAVE_SCREEN_NO);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
const struct button_label AudioPlayerButtons[][4] =
|
const struct button_label AudioPlayerButtons[][4] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -1706,7 +1633,6 @@ const struct button_label AudioPlayerButtons[][4] =
|
|||||||
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_INETRADIO_NAME },
|
{ NEUTRINO_ICON_BUTTON_BLUE , LOCALE_INETRADIO_NAME },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::paintFoot()
|
void CAudioPlayerGui::paintFoot()
|
||||||
{
|
{
|
||||||
@@ -1727,8 +1653,6 @@ const struct button_label ScondLineButtons[3] =
|
|||||||
else
|
else
|
||||||
top = m_y + (m_height - 2 * m_buttonHeight);
|
top = m_y + (m_height - 2 * m_buttonHeight);
|
||||||
|
|
||||||
//int ButtonWidth = (m_width - 20) / 5;
|
|
||||||
|
|
||||||
m_frameBuffer->paintBoxRel(m_x, top, m_width, 2 * m_buttonHeight, COL_INFOBAR_SHADOW_PLUS_1, c_rad_mid, (m_show_playlist ? CORNER_BOTTOM : CORNER_ALL));
|
m_frameBuffer->paintBoxRel(m_x, top, m_width, 2 * m_buttonHeight, COL_INFOBAR_SHADOW_PLUS_1, c_rad_mid, (m_show_playlist ? CORNER_BOTTOM : CORNER_ALL));
|
||||||
// why? m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_1);
|
// why? m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_1);
|
||||||
|
|
||||||
@@ -1775,7 +1699,24 @@ const struct button_label ScondLineButtons[3] =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
void CAudioPlayerGui::paintCover()
|
||||||
|
{
|
||||||
|
int c_rad_mid = RADIUS_MID;
|
||||||
|
int title_height = m_title_height;
|
||||||
|
const CAudioMetaData meta = CAudioPlayer::getInstance()->getMetaData();
|
||||||
|
|
||||||
|
if (!m_show_playlist) // no playlist -> smaller Info-Box
|
||||||
|
title_height -= m_fheight;
|
||||||
|
|
||||||
|
std::string cover = m_curr_audiofile.Filename.substr(0, m_curr_audiofile.Filename.rfind('/')) + "/folder.jpg";
|
||||||
|
if (!meta.cover.empty())
|
||||||
|
cover = meta.cover;
|
||||||
|
|
||||||
|
if (access(cover.c_str(), F_OK) == 0)
|
||||||
|
g_PicViewer->DisplayImage(cover, m_x + 2 + c_rad_mid/2, m_y + 2 + c_rad_mid/2, title_height - 14 - c_rad_mid, title_height - 14 - c_rad_mid, m_frameBuffer->TM_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
void CAudioPlayerGui::paintInfo()
|
void CAudioPlayerGui::paintInfo()
|
||||||
{
|
{
|
||||||
if (m_screensaver)
|
if (m_screensaver)
|
||||||
@@ -1794,13 +1735,7 @@ void CAudioPlayerGui::paintInfo()
|
|||||||
m_frameBuffer->paintBoxRel(m_x + 1, m_y + 1 , m_width - 2, title_height - 12, COL_MENUCONTENTSELECTED_PLUS_0, c_rad_mid);
|
m_frameBuffer->paintBoxRel(m_x + 1, m_y + 1 , m_width - 2, title_height - 12, COL_MENUCONTENTSELECTED_PLUS_0, c_rad_mid);
|
||||||
m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, title_height - 10, 2, COL_MENUCONTENT_PLUS_6, c_rad_mid);
|
m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, title_height - 10, 2, COL_MENUCONTENT_PLUS_6, c_rad_mid);
|
||||||
|
|
||||||
std::string cover = m_curr_audiofile.Filename.substr(0, m_curr_audiofile.Filename.rfind('/')) + "/folder.jpg";
|
paintCover();
|
||||||
|
|
||||||
if (!m_curr_audiofile.MetaData.cover.empty())
|
|
||||||
cover = m_curr_audiofile.MetaData.cover;
|
|
||||||
|
|
||||||
if (access(cover.c_str(), F_OK) == 0)
|
|
||||||
g_PicViewer->DisplayImage(cover, m_x + 2 + c_rad_mid/2, m_y + 2 + c_rad_mid/2, title_height - 14 - c_rad_mid, title_height - 14 - c_rad_mid, m_frameBuffer->TM_NONE);
|
|
||||||
|
|
||||||
// first line (Track number)
|
// first line (Track number)
|
||||||
std::string tmp;
|
std::string tmp;
|
||||||
@@ -1821,11 +1756,7 @@ void CAudioPlayerGui::paintInfo()
|
|||||||
tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8
|
tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8
|
||||||
|
|
||||||
// second line (Artist/Title...)
|
// second line (Artist/Title...)
|
||||||
if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO &&
|
|
||||||
!m_curr_audiofile.MetaData.bitrate)
|
|
||||||
{
|
|
||||||
GetMetaData(m_curr_audiofile);
|
GetMetaData(m_curr_audiofile);
|
||||||
}
|
|
||||||
|
|
||||||
if (m_curr_audiofile.MetaData.title.empty())
|
if (m_curr_audiofile.MetaData.title.empty())
|
||||||
tmp = m_curr_audiofile.MetaData.artist;
|
tmp = m_curr_audiofile.MetaData.artist;
|
||||||
@@ -1858,7 +1789,6 @@ void CAudioPlayerGui::paintInfo()
|
|||||||
updateTimes(true);
|
updateTimes(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::paint()
|
void CAudioPlayerGui::paint()
|
||||||
{
|
{
|
||||||
@@ -1867,9 +1797,7 @@ void CAudioPlayerGui::paint()
|
|||||||
m_liststart = (m_selected / m_listmaxshow) * m_listmaxshow;
|
m_liststart = (m_selected / m_listmaxshow) * m_listmaxshow;
|
||||||
paintHead();
|
paintHead();
|
||||||
for (unsigned int count=0; count<m_listmaxshow; count++)
|
for (unsigned int count=0; count<m_listmaxshow; count++)
|
||||||
{
|
|
||||||
paintItem(count);
|
paintItem(count);
|
||||||
}
|
|
||||||
|
|
||||||
int ypos = m_y + m_title_height + m_theight;
|
int ypos = m_y + m_title_height + m_theight;
|
||||||
int sb = m_fheight * m_listmaxshow;
|
int sb = m_fheight * m_listmaxshow;
|
||||||
@@ -1886,16 +1814,12 @@ void CAudioPlayerGui::paint()
|
|||||||
paintInfo();
|
paintInfo();
|
||||||
paintFoot();
|
paintFoot();
|
||||||
m_visible = true;
|
m_visible = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::clearItemID3DetailsLine ()
|
void CAudioPlayerGui::clearItemID3DetailsLine ()
|
||||||
{
|
{
|
||||||
paintItemID3DetailsLine(-1);
|
paintItemID3DetailsLine(-1);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::paintItemID3DetailsLine (int pos)
|
void CAudioPlayerGui::paintItemID3DetailsLine (int pos)
|
||||||
{
|
{
|
||||||
@@ -1907,11 +1831,11 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos)
|
|||||||
|
|
||||||
// clear details line
|
// clear details line
|
||||||
if (dline != NULL)
|
if (dline != NULL)
|
||||||
dline->hide();
|
dline->kill();
|
||||||
|
|
||||||
// clear infobox
|
// clear infobox
|
||||||
if (ibox != NULL)
|
if (ibox != NULL)
|
||||||
ibox->hide();
|
ibox->kill();
|
||||||
|
|
||||||
// paint Line if detail info (and not valid list pos) and info box
|
// paint Line if detail info (and not valid list pos) and info box
|
||||||
if (!m_playlist.empty() && (pos >= 0))
|
if (!m_playlist.empty() && (pos >= 0))
|
||||||
@@ -1920,7 +1844,7 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos)
|
|||||||
if (dline == NULL)
|
if (dline == NULL)
|
||||||
dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, m_fheight/2+1, m_fheight);
|
dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, m_fheight/2+1, m_fheight);
|
||||||
dline->setYPos(ypos1a);
|
dline->setYPos(ypos1a);
|
||||||
dline->paint();
|
dline->paint(false);
|
||||||
|
|
||||||
// paint id3 infobox
|
// paint id3 infobox
|
||||||
if (ibox == NULL)
|
if (ibox == NULL)
|
||||||
@@ -1959,12 +1883,11 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dline != NULL)
|
if (dline != NULL)
|
||||||
dline->hide();
|
dline->kill();
|
||||||
if (ibox != NULL)
|
if (ibox != NULL)
|
||||||
ibox->hide();
|
ibox->kill();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::stop()
|
void CAudioPlayerGui::stop()
|
||||||
{
|
{
|
||||||
@@ -1984,7 +1907,6 @@ void CAudioPlayerGui::stop()
|
|||||||
if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
|
if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
|
||||||
CAudioPlayer::getInstance()->stop();
|
CAudioPlayer::getInstance()->stop();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::pause()
|
void CAudioPlayerGui::pause()
|
||||||
{
|
{
|
||||||
@@ -2002,7 +1924,6 @@ void CAudioPlayerGui::pause()
|
|||||||
}
|
}
|
||||||
paintLCD();
|
paintLCD();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::ff(unsigned int seconds)
|
void CAudioPlayerGui::ff(unsigned int seconds)
|
||||||
{
|
{
|
||||||
@@ -2020,7 +1941,6 @@ void CAudioPlayerGui::ff(unsigned int seconds)
|
|||||||
}
|
}
|
||||||
paintLCD();
|
paintLCD();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::rev(unsigned int seconds)
|
void CAudioPlayerGui::rev(unsigned int seconds)
|
||||||
{
|
{
|
||||||
@@ -2038,7 +1958,6 @@ void CAudioPlayerGui::rev(unsigned int seconds)
|
|||||||
}
|
}
|
||||||
paintLCD();
|
paintLCD();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::play(unsigned int pos)
|
void CAudioPlayerGui::play(unsigned int pos)
|
||||||
{
|
{
|
||||||
@@ -2082,13 +2001,8 @@ void CAudioPlayerGui::play(unsigned int pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_playlist[pos].FileType != CFile::STREAM_AUDIO &&
|
|
||||||
!m_playlist[pos].MetaData.bitrate)
|
|
||||||
{
|
|
||||||
// id3tag noch nicht geholt
|
|
||||||
//printf("play: need getMetaData\n");
|
|
||||||
GetMetaData(m_playlist[pos]);
|
GetMetaData(m_playlist[pos]);
|
||||||
}
|
|
||||||
m_metainfo.clear();
|
m_metainfo.clear();
|
||||||
m_time_played = 0;
|
m_time_played = 0;
|
||||||
m_time_total = m_playlist[m_current].MetaData.total_time;
|
m_time_total = m_playlist[m_current].MetaData.total_time;
|
||||||
@@ -2107,7 +2021,6 @@ void CAudioPlayerGui::play(unsigned int pos)
|
|||||||
paintFoot();
|
paintFoot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int CAudioPlayerGui::getNext()
|
int CAudioPlayerGui::getNext()
|
||||||
{
|
{
|
||||||
@@ -2123,7 +2036,7 @@ int CAudioPlayerGui::getNext()
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
void CAudioPlayerGui::updateMetaData(bool screen_saver)
|
void CAudioPlayerGui::updateMetaData(bool screen_saver)
|
||||||
{
|
{
|
||||||
bool updateMeta = false;
|
bool updateMeta = false;
|
||||||
@@ -2180,26 +2093,8 @@ void CAudioPlayerGui::updateMetaData(bool screen_saver)
|
|||||||
updateLcd = true;
|
updateLcd = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cover = m_curr_audiofile.Filename.substr(0, m_curr_audiofile.Filename.rfind('/')) + "/folder.jpg";
|
paintCover();
|
||||||
|
|
||||||
if (!meta.cover.empty())
|
|
||||||
cover = meta.cover;
|
|
||||||
|
|
||||||
if ((access(cover.c_str(), F_OK) == 0) && !screen_saver)
|
|
||||||
{
|
|
||||||
g_PicViewer->DisplayImage(cover, m_x + 2, m_y + 2, m_title_height - 14, m_title_height - 14, m_frameBuffer->TM_NONE);
|
|
||||||
|
|
||||||
if(g_settings.rounded_corners)
|
|
||||||
{
|
|
||||||
//repaint frame to cover up the corners of the cover; FIXME
|
|
||||||
if (!m_show_playlist)
|
|
||||||
m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10 - m_fheight, 2, COL_MENUCONTENT_PLUS_6, RADIUS_MID);
|
|
||||||
else
|
|
||||||
m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10, 2, COL_MENUCONTENT_PLUS_6, RADIUS_MID);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
//if (CAudioPlayer::getInstance()->getScBuffered() != 0)
|
|
||||||
if (CAudioPlayer::getInstance()->hasMetaDataChanged() != 0)
|
if (CAudioPlayer::getInstance()->hasMetaDataChanged() != 0)
|
||||||
updateLcd = true;
|
updateLcd = true;
|
||||||
|
|
||||||
@@ -2219,7 +2114,6 @@ void CAudioPlayerGui::updateMetaData(bool screen_saver)
|
|||||||
m_width- 2*xstart, m_metainfo, COL_MENUCONTENTSELECTED_TEXT);
|
m_width- 2*xstart, m_metainfo, COL_MENUCONTENTSELECTED_TEXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::updateTimes(const bool force)
|
void CAudioPlayerGui::updateTimes(const bool force)
|
||||||
{
|
{
|
||||||
@@ -2285,8 +2179,6 @@ void CAudioPlayerGui::updateTimes(const bool force)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::paintLCD()
|
void CAudioPlayerGui::paintLCD()
|
||||||
{
|
{
|
||||||
switch (m_state)
|
switch (m_state)
|
||||||
@@ -2325,7 +2217,6 @@ void CAudioPlayerGui::paintLCD()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::screensaver(bool on)
|
void CAudioPlayerGui::screensaver(bool on)
|
||||||
{
|
{
|
||||||
@@ -2345,14 +2236,12 @@ void CAudioPlayerGui::screensaver(bool on)
|
|||||||
m_idletime = time(NULL);
|
m_idletime = time(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::GetMetaData(CAudiofileExt &File)
|
void CAudioPlayerGui::GetMetaData(CAudiofileExt &File)
|
||||||
{
|
{
|
||||||
// printf("GetMetaData\n");
|
|
||||||
bool ret = 1;
|
bool ret = 1;
|
||||||
|
|
||||||
if (CFile::STREAM_AUDIO != File.FileType)
|
if (File.FileType != CFile::STREAM_AUDIO && !File.MetaData.bitrate)
|
||||||
ret = CAudioPlayer::getInstance()->readMetaData( &File,
|
ret = CAudioPlayer::getInstance()->readMetaData( &File,
|
||||||
m_state != CAudioPlayerGui::STOP &&
|
m_state != CAudioPlayerGui::STOP &&
|
||||||
!g_settings.audioplayer_highprio);
|
!g_settings.audioplayer_highprio);
|
||||||
@@ -2383,7 +2272,6 @@ void CAudioPlayerGui::GetMetaData(CAudiofileExt &File)
|
|||||||
File.MetaData.title = FILESYSTEM_ENCODING_TO_UTF8_STRING(File.MetaData.title );
|
File.MetaData.title = FILESYSTEM_ENCODING_TO_UTF8_STRING(File.MetaData.title );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool CAudioPlayerGui::getNumericInput(neutrino_msg_t& msg, int& val) {
|
bool CAudioPlayerGui::getNumericInput(neutrino_msg_t& msg, int& val) {
|
||||||
|
|
||||||
@@ -2416,12 +2304,9 @@ bool CAudioPlayerGui::getNumericInput(neutrino_msg_t& msg, int& val) {
|
|||||||
return (msg == CRCInput::RC_ok);
|
return (msg == CRCInput::RC_ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
void CAudioPlayerGui::getFileInfoToDisplay(std::string &fileInfo, CAudiofileExt &file)
|
||||||
|
|
||||||
|
|
||||||
void CAudioPlayerGui::getFileInfoToDisplay(std::string &info, CAudiofileExt &file)
|
|
||||||
{
|
{
|
||||||
std::string fileInfo;
|
//std::string fileInfo;
|
||||||
std::string artist;
|
std::string artist;
|
||||||
std::string title;
|
std::string title;
|
||||||
|
|
||||||
@@ -2430,10 +2315,7 @@ void CAudioPlayerGui::getFileInfoToDisplay(std::string &info, CAudiofileExt &fil
|
|||||||
title = "Title?";
|
title = "Title?";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file.MetaData.bitrate)
|
|
||||||
{
|
|
||||||
GetMetaData(file);
|
GetMetaData(file);
|
||||||
}
|
|
||||||
|
|
||||||
if (!file.MetaData.artist.empty())
|
if (!file.MetaData.artist.empty())
|
||||||
artist = file.MetaData.artist;
|
artist = file.MetaData.artist;
|
||||||
@@ -2465,35 +2347,30 @@ void CAudioPlayerGui::getFileInfoToDisplay(std::string &info, CAudiofileExt &fil
|
|||||||
fileInfo += "Unknown";
|
fileInfo += "Unknown";
|
||||||
}
|
}
|
||||||
file.firstChar = tolower(fileInfo[0]);
|
file.firstChar = tolower(fileInfo[0]);
|
||||||
info += fileInfo;
|
//info += fileInfo;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::addToPlaylist(CAudiofileExt &file)
|
void CAudioPlayerGui::addToPlaylist(CAudiofileExt &file)
|
||||||
{
|
{
|
||||||
//printf("add2Playlist: %s\n", file.Filename.c_str());
|
//printf("add2Playlist: %s\n", file.Filename.c_str());
|
||||||
if (m_select_title_by_name)
|
if (m_select_title_by_name) {
|
||||||
{
|
|
||||||
if (!file.MetaData.bitrate)
|
|
||||||
{
|
|
||||||
std::string t = "";
|
std::string t = "";
|
||||||
getFileInfoToDisplay(t,file);
|
getFileInfoToDisplay(t,file);
|
||||||
}
|
} else
|
||||||
}
|
GetMetaData(file);
|
||||||
|
|
||||||
m_playlist.push_back(file);
|
m_playlist.push_back(file);
|
||||||
m_playlistHasChanged = true;
|
m_playlistHasChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
void CAudioPlayerGui::removeFromPlaylist(long pos)
|
void CAudioPlayerGui::removeFromPlaylist(long pos)
|
||||||
{
|
{
|
||||||
unsigned char firstChar = ' ';
|
unsigned char firstChar = ' ';
|
||||||
if (m_select_title_by_name)
|
|
||||||
{
|
|
||||||
// must be called before m_playlist.erase()
|
// must be called before m_playlist.erase()
|
||||||
|
if (m_select_title_by_name)
|
||||||
firstChar = getFirstChar(m_playlist[pos]);
|
firstChar = getFirstChar(m_playlist[pos]);
|
||||||
}
|
|
||||||
unlink(m_playlist[pos].MetaData.cover.c_str());
|
//unlink(m_playlist[pos].MetaData.cover.c_str());
|
||||||
m_playlist.erase(m_playlist.begin() + pos);
|
m_playlist.erase(m_playlist.begin() + pos);
|
||||||
m_playlistHasChanged = true;
|
m_playlistHasChanged = true;
|
||||||
|
|
||||||
@@ -2509,15 +2386,12 @@ void CAudioPlayerGui::removeFromPlaylist(long pos)
|
|||||||
CTitle2Pos::iterator item = m_title2Pos.find(firstChar);
|
CTitle2Pos::iterator item = m_title2Pos.find(firstChar);
|
||||||
if (item != m_title2Pos.end())
|
if (item != m_title2Pos.end())
|
||||||
{
|
{
|
||||||
//const CPosList::size_type del =
|
|
||||||
item->second.erase(pos);
|
item->second.erase(pos);
|
||||||
|
|
||||||
// delete empty entries
|
// delete empty entries
|
||||||
if (item->second.empty())
|
if (item->second.empty())
|
||||||
{
|
|
||||||
m_title2Pos.erase(item);
|
m_title2Pos.erase(item);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("could not find key: %c pos: %ld\n",firstChar,pos);
|
printf("could not find key: %c pos: %ld\n",firstChar,pos);
|
||||||
@@ -2538,7 +2412,6 @@ void CAudioPlayerGui::removeFromPlaylist(long pos)
|
|||||||
// old list is sorted so we can give a hint to insert at the end
|
// old list is sorted so we can give a hint to insert at the end
|
||||||
newList.insert(newList.end(), p);
|
newList.insert(newList.end(), p);
|
||||||
}
|
}
|
||||||
//title->second.clear();
|
|
||||||
title->second = newList;
|
title->second = newList;
|
||||||
}
|
}
|
||||||
#ifdef AUDIOPLAYER_TIME_DEBUG
|
#ifdef AUDIOPLAYER_TIME_DEBUG
|
||||||
@@ -2547,14 +2420,9 @@ void CAudioPlayerGui::removeFromPlaylist(long pos)
|
|||||||
printf("delete took: ");
|
printf("delete took: ");
|
||||||
printTimevalDiff(start,end);
|
printTimevalDiff(start,end);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::selectTitle(unsigned char selectionChar)
|
void CAudioPlayerGui::selectTitle(unsigned char selectionChar)
|
||||||
{
|
{
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
@@ -2594,7 +2462,6 @@ void CAudioPlayerGui::selectTitle(unsigned char selectionChar)
|
|||||||
int prevselected = m_selected;
|
int prevselected = m_selected;
|
||||||
m_selected = i;
|
m_selected = i;
|
||||||
|
|
||||||
paintItem(prevselected - m_liststart);
|
|
||||||
unsigned int oldliststart = m_liststart;
|
unsigned int oldliststart = m_liststart;
|
||||||
m_liststart = (m_selected / m_listmaxshow)*m_listmaxshow;
|
m_liststart = (m_selected / m_listmaxshow)*m_listmaxshow;
|
||||||
//printf("before paint\n");
|
//printf("before paint\n");
|
||||||
@@ -2604,10 +2471,10 @@ void CAudioPlayerGui::selectTitle(unsigned char selectionChar)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
paintItem(prevselected - m_liststart);
|
||||||
paintItem(m_selected - m_liststart);
|
paintItem(m_selected - m_liststart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::printSearchTree()
|
void CAudioPlayerGui::printSearchTree()
|
||||||
{
|
{
|
||||||
@@ -2628,8 +2495,6 @@ void CAudioPlayerGui::printSearchTree()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::buildSearchTree()
|
void CAudioPlayerGui::buildSearchTree()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2653,11 +2518,8 @@ void CAudioPlayerGui::buildSearchTree()
|
|||||||
for (CAudioPlayList::iterator it=m_playlist.begin();
|
for (CAudioPlayList::iterator it=m_playlist.begin();
|
||||||
it!=m_playlist.end(); ++it)
|
it!=m_playlist.end(); ++it)
|
||||||
{
|
{
|
||||||
// if (m_state == CAudioPlayerGui::PLAY)
|
|
||||||
// usleep(10*1000);
|
|
||||||
listPos++;
|
listPos++;
|
||||||
progress.showGlobalStatus(100*listPos / maxProgress);
|
progress.showGlobalStatus(100*listPos / maxProgress);
|
||||||
//std::string info;
|
|
||||||
progress.showStatusMessageUTF(it->Filename);
|
progress.showStatusMessageUTF(it->Filename);
|
||||||
unsigned char firstChar = getFirstChar(*it);
|
unsigned char firstChar = getFirstChar(*it);
|
||||||
const std::pair<CTitle2Pos::iterator,bool> item =
|
const std::pair<CTitle2Pos::iterator,bool> item =
|
||||||
@@ -2677,8 +2539,6 @@ void CAudioPlayerGui::buildSearchTree()
|
|||||||
//printSearchTree();
|
//printSearchTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
unsigned char CAudioPlayerGui::getFirstChar(CAudiofileExt &file)
|
unsigned char CAudioPlayerGui::getFirstChar(CAudiofileExt &file)
|
||||||
{
|
{
|
||||||
if (file.firstChar == '\0')
|
if (file.firstChar == '\0')
|
||||||
@@ -2690,8 +2550,6 @@ unsigned char CAudioPlayerGui::getFirstChar(CAudiofileExt &file)
|
|||||||
return file.firstChar;
|
return file.firstChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
#ifdef AUDIOPLAYER_TIME_DEBUG
|
#ifdef AUDIOPLAYER_TIME_DEBUG
|
||||||
void CAudioPlayerGui::printTimevalDiff(timeval &start, timeval &end)
|
void CAudioPlayerGui::printTimevalDiff(timeval &start, timeval &end)
|
||||||
{
|
{
|
||||||
@@ -2707,8 +2565,6 @@ void CAudioPlayerGui::printTimevalDiff(timeval &start, timeval &end)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void CAudioPlayerGui::savePlaylist()
|
void CAudioPlayerGui::savePlaylist()
|
||||||
{
|
{
|
||||||
const char *path;
|
const char *path;
|
||||||
@@ -2739,9 +2595,8 @@ void CAudioPlayerGui::savePlaylist()
|
|||||||
|
|
||||||
// add a trailing slash if necessary
|
// add a trailing slash if necessary
|
||||||
if ((absPlaylistDir.empty()) || ((*(absPlaylistDir.rbegin()) != '/')))
|
if ((absPlaylistDir.empty()) || ((*(absPlaylistDir.rbegin()) != '/')))
|
||||||
{
|
|
||||||
absPlaylistDir += '/';
|
absPlaylistDir += '/';
|
||||||
}
|
|
||||||
absPlaylistDir += file->getFileName();
|
absPlaylistDir += file->getFileName();
|
||||||
|
|
||||||
const int filenamesize = 30;
|
const int filenamesize = 30;
|
||||||
@@ -2755,9 +2610,8 @@ void CAudioPlayerGui::savePlaylist()
|
|||||||
name += file->getFileName();
|
name += file->getFileName();
|
||||||
bool overwrite = askToOverwriteFile(name);
|
bool overwrite = askToOverwriteFile(name);
|
||||||
if (!overwrite)
|
if (!overwrite)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
snprintf(filename, name.size(), "%s", name.c_str());
|
snprintf(filename, name.size(), "%s", name.c_str());
|
||||||
}
|
}
|
||||||
else if (file->getType() == CFile::FILE_DIR)
|
else if (file->getType() == CFile::FILE_DIR)
|
||||||
@@ -2784,10 +2638,8 @@ void CAudioPlayerGui::savePlaylist()
|
|||||||
{
|
{
|
||||||
bool overwrite = askToOverwriteFile(name);
|
bool overwrite = askToOverwriteFile(name);
|
||||||
if (!overwrite)
|
if (!overwrite)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
input.close();
|
input.close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2836,9 +2688,9 @@ void CAudioPlayerGui::savePlaylist()
|
|||||||
}
|
}
|
||||||
this->paint();
|
this->paint();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
bool CAudioPlayerGui::askToOverwriteFile(const std::string& filename) {
|
bool CAudioPlayerGui::askToOverwriteFile(const std::string& filename)
|
||||||
|
{
|
||||||
|
|
||||||
char msg[filename.length() + 127];
|
char msg[filename.length() + 127];
|
||||||
snprintf(msg,
|
snprintf(msg,
|
||||||
@@ -2852,10 +2704,10 @@ bool CAudioPlayerGui::askToOverwriteFile(const std::string& filename) {
|
|||||||
this->paint();
|
this->paint();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------
|
|
||||||
|
|
||||||
std::string CAudioPlayerGui::absPath2Rel(const std::string& fromDir,
|
std::string CAudioPlayerGui::absPath2Rel(const std::string& fromDir,
|
||||||
const std::string& absFilename) {
|
const std::string& absFilename)
|
||||||
|
{
|
||||||
std::string res = "";
|
std::string res = "";
|
||||||
|
|
||||||
int length = fromDir.length() < absFilename.length() ? fromDir.length() : absFilename.length();
|
int length = fromDir.length() < absFilename.length() ? fromDir.length() : absFilename.length();
|
||||||
@@ -2869,10 +2721,8 @@ std::string CAudioPlayerGui::absPath2Rel(const std::string& fromDir,
|
|||||||
if (fromDir[i] == absFilename[i])
|
if (fromDir[i] == absFilename[i])
|
||||||
{
|
{
|
||||||
if (fromDir[i] == '/')
|
if (fromDir[i] == '/')
|
||||||
{
|
|
||||||
lastSlash = i;
|
lastSlash = i;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
@@ -2891,10 +2741,8 @@ std::string CAudioPlayerGui::absPath2Rel(const std::string& fromDir,
|
|||||||
for (unsigned int i=0; i<relFromDir.size(); i++)
|
for (unsigned int i=0; i<relFromDir.size(); i++)
|
||||||
{
|
{
|
||||||
if (relFromDir[i] == '/')
|
if (relFromDir[i] == '/')
|
||||||
{
|
|
||||||
res = res + "../";
|
res = res + "../";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
res = res + relFilepath;
|
res = res + relFilepath;
|
||||||
return res;
|
return res;
|
||||||
|
@@ -151,6 +151,7 @@ class CAudioPlayerGui : public CMenuTarget
|
|||||||
void paintHead();
|
void paintHead();
|
||||||
void paintFoot();
|
void paintFoot();
|
||||||
void paintInfo();
|
void paintInfo();
|
||||||
|
void paintCover();
|
||||||
void paintLCD();
|
void paintLCD();
|
||||||
void hide();
|
void hide();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user