Merge branch 'dvbsi++' of coolstreamtech.de:cst-public-gui-neutrino into dvbsi++

This commit is contained in:
[CST] Focus
2012-11-08 19:14:35 +04:00
15 changed files with 165 additions and 71 deletions

View File

@@ -65,6 +65,8 @@
#include <gui/widget/stringinput.h>
#include <gui/widget/stringinput_ext.h>
#include "gui/pictureviewer.h"
#include <system/settings.h>
#include <system/helpers.h>
#include <driver/screen_max.h>
@@ -198,6 +200,8 @@ void CAudioPlayerGui::Init(void)
m_selected = 0;
m_metainfo.clear();
pictureviewer = false;
m_select_title_by_name = g_settings.audioplayer_select_title_by_name==1;
if (strlen(g_settings.network_nfs_audioplayerdir)!=0)
@@ -753,6 +757,22 @@ int CAudioPlayerGui::show()
}
}
}
else if ( (msg == CRCInput::RC_info) && (!m_playlist.empty()) )
{
pictureviewer = true;
m_frameBuffer->Clear();
videoDecoder->StopPicture();
CPictureViewerGui * picture = new CPictureViewerGui();
picture->m_audioPlayer = this;
picture->exec(this, "audio");
delete picture;
pictureviewer = false;
videoDecoder->setBlank(true);
videoDecoder->ShowPicture(DATADIR "/neutrino/icons/mp3.jpg");
CVFD::getInstance()->setMode(CVFD::MODE_AUDIO);
paintLCD();
screensaver(false);
}
else if (msg == CRCInput::RC_help)
{
if (m_key_level == 2)
@@ -904,6 +924,17 @@ bool CAudioPlayerGui::playNext(bool allow_rotate)
return(result);
}
void CAudioPlayerGui::wantNextPlay()
{
if ((m_state != CAudioPlayerGui::STOP) &&
(CAudioPlayer::getInstance()->getState() == CBaseDec::STOP) &&
(!m_playlist.empty()))
{
if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO)
playNext();
}
}
bool CAudioPlayerGui::playPrev(bool allow_rotate)
{
bool result = false;
@@ -1698,10 +1729,11 @@ const struct button_label AudioPlayerButtons[][4] =
void CAudioPlayerGui::paintFoot()
{
// printf("paintFoot{\n");
const struct button_label ScondLineButtons[2] =
const struct button_label ScondLineButtons[3] =
{
{ NEUTRINO_ICON_BUTTON_OKAY , LOCALE_AUDIOPLAYER_PLAY },
{ NEUTRINO_ICON_BUTTON_HELP , LOCALE_AUDIOPLAYER_KEYLEVEL },
{ NEUTRINO_ICON_BUTTON_INFO , LOCALE_PICTUREVIEWER_HEAD},
};
int top;
@@ -1717,8 +1749,7 @@ const struct button_label ScondLineButtons[2] =
m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_1);
if (!m_playlist.empty())
::paintButtons(m_x, top+m_buttonHeight, m_width, 2, ScondLineButtons, m_buttonHeight, ButtonWidth);
::paintButtons(m_x, top+m_buttonHeight, m_width, 3, ScondLineButtons, m_buttonHeight, ButtonWidth);
if (m_key_level == 0)
{
@@ -1943,12 +1974,16 @@ void CAudioPlayerGui::stop()
{
m_state = CAudioPlayerGui::STOP;
m_current = 0;
//LCD
paintLCD();
//Display
paintInfo();
m_key_level = 0;
paintFoot();
if (!pictureviewer)
{
//LCD
paintLCD();
//Display
paintInfo();
m_key_level = 0;
paintFoot();
}
if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
CAudioPlayer::getInstance()->stop();
@@ -2022,31 +2057,31 @@ void CAudioPlayerGui::play(unsigned int pos)
if (m_selected - m_liststart >= m_listmaxshow && g_settings.audioplayer_follow)
{
m_liststart = m_selected;
if (!m_screensaver)
if (!m_screensaver && !pictureviewer)
paint();
}
else if (m_liststart < m_selected && g_settings.audioplayer_follow)
{
m_liststart = m_selected - m_listmaxshow + 1;
if (!m_screensaver)
if (!m_screensaver && !pictureviewer)
paint();
}
else
{
if (old_current >= m_liststart && old_current - m_liststart < m_listmaxshow)
{
if (!m_screensaver)
if (!m_screensaver && !pictureviewer)
paintItem(old_current - m_liststart);
}
if (pos >= m_liststart && pos - m_liststart < m_listmaxshow)
{
if (!m_screensaver)
if (!m_screensaver && !pictureviewer)
paintItem(pos - m_liststart);
}
if (g_settings.audioplayer_follow)
{
if (old_selected >= m_liststart && old_selected - m_liststart < m_listmaxshow)
if (!m_screensaver)
if (!m_screensaver && !pictureviewer)
paintItem(old_selected - m_liststart);
}
}
@@ -2065,14 +2100,18 @@ void CAudioPlayerGui::play(unsigned int pos)
m_curr_audiofile = m_playlist[m_current];
// Play
CAudioPlayer::getInstance()->play(&m_curr_audiofile, g_settings.audioplayer_highprio == 1);
//LCD
paintLCD();
// Display
if (!m_screensaver)
paintInfo();
m_key_level = 1;
if (!m_screensaver)
paintFoot();
if (!pictureviewer)
{
//LCD
paintLCD();
// Display
if (!m_screensaver)
paintInfo();
m_key_level = 1;
if (!m_screensaver)
paintFoot();
}
}
//------------------------------------------------------------------------

View File

@@ -251,11 +251,15 @@ class CAudioPlayerGui : public CMenuTarget
bool playNext(bool allow_rotate = false);
bool playPrev(bool allow_rotate = false);
bool pictureviewer;
public:
CAudioPlayerGui(bool inetmode = false);
~CAudioPlayerGui();
int show();
int exec(CMenuTarget* parent, const std::string & actionKey);
void wantNextPlay();
};

View File

@@ -121,30 +121,38 @@ bool CExtUpdate::ErrorReset(bool modus, const std::string & msg1, const std::str
return false;
}
bool CExtUpdate::writemtdExt(const std::string & filename)
bool CExtUpdate::applySettings(const std::string & filename, int mode)
{
if(!FileHelpers)
FileHelpers = new CFileHelpers();
imgFilename = (std::string)g_settings.update_dir + "/" + FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
if (mode == MODE_EXPERT)
imgFilename = (std::string)g_settings.update_dir + "/" + FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
else
imgFilename = FILESYSTEM_ENCODING_TO_UTF8_STRING(filename);
DBG_TIMER_START()
bool ret = writemtdExt();
bool ret = applySettings();
DBG_TIMER_STOP("Image editing")
if (!ret) {
if (mtdRamError != "")
DisplayErrorMessage(mtdRamError.c_str());
}
else {
if ((mtdNumber < 3) || (mtdNumber > 4)) {
const char *err = "invalid mtdNumber\n";
printf(err);
DisplayErrorMessage(err);
WRITE_UPDATE_LOG("ERROR: %s", err);
return false;
if (mode == MODE_EXPERT) {
if ((mtdNumber < 3) || (mtdNumber > 4)) {
const char *err = "invalid mtdNumber\n";
printf(err);
DisplayErrorMessage(err);
WRITE_UPDATE_LOG("ERROR: %s", err);
return false;
}
}
ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SUCCESSFULLY), CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_INFO);
WRITE_UPDATE_LOG("\n");
WRITE_UPDATE_LOG("##### Settings taken. #####\n");
CFlashExpert::getInstance()->writemtd(filename, mtdNumber);
if (mode == MODE_EXPERT)
CFlashExpert::getInstance()->writemtd(filename, mtdNumber);
}
return ret;
}
@@ -166,7 +174,7 @@ bool CExtUpdate::isMtdramLoad()
return ret;
}
bool CExtUpdate::writemtdExt()
bool CExtUpdate::applySettings()
{
if(!hintBox)
hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_PROCESSED));

View File

@@ -55,7 +55,7 @@ class CExtUpdate
std::string mountPkt;
CFileHelpers* FileHelpers;
bool writemtdExt(void);
bool applySettings(void);
bool readBackupList(const std::string & dstPath);
bool copyFileList(const std::string & fileList, const std::string & dstPath);
bool readConfig(const std::string & Config);
@@ -69,11 +69,16 @@ class CExtUpdate
void updateLog(const char *buf);
public:
enum
{
MODE_EXPERT = 0,
MODE_SOFTUPDATE = 1
};
CExtUpdate();
~CExtUpdate();
static CExtUpdate* getInstance();
bool writemtdExt(const std::string & filename);
bool applySettings(const std::string & filename, int mode);
bool ErrorReset(bool modus, const std::string & msg1="", const std::string & msg2="");
};

View File

@@ -87,6 +87,7 @@ CInfoViewerBB::CInfoViewerBB()
pthread_detach(scrambledT);
}
#endif
hddpercent = 0;
hddperT = 0;
hddperTflag = false;
bbIconInfo[0].x = 0;
@@ -612,20 +613,17 @@ void CInfoViewerBB::showSysfsHdd()
percent = (u * 100ULL) / t;
showBarSys(percent);
#if 0
//HDD info in a seperate thread
if(!hddperTflag) {
hddperTflag=true;
pthread_create(&hddperT, NULL, hddperThread, (void*) this);
pthread_detach(hddperT);
}
#else
if (!check_dir(g_settings.network_nfs_recordingdir)) {
if (get_fs_usage(g_settings.network_nfs_recordingdir, t, u))
percent = (u * 100ULL) / t;
showBarHdd(percent);
}
#endif
if (check_dir(g_settings.network_nfs_recordingdir) == 0)
showBarHdd(hddpercent);
else
showBarHdd(-1);
}
}
@@ -633,11 +631,10 @@ void* CInfoViewerBB::hddperThread(void *arg)
{
CInfoViewerBB *infoViewerBB = (CInfoViewerBB*) arg;
int percent = 0;
infoViewerBB->hddpercent = 0;
long t, u;
if (get_fs_usage(g_settings.network_nfs_recordingdir, t, u))
percent = (u * 100ULL) / t;
infoViewerBB->showBarHdd(percent);
infoViewerBB->hddpercent = (u * 100ULL) / t;
infoViewerBB->hddperTflag=false;
pthread_exit(NULL);
@@ -651,8 +648,14 @@ void CInfoViewerBB::showBarSys(int percent)
void CInfoViewerBB::showBarHdd(int percent)
{
if (is_visible)
hddscale->paintProgressBar(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2 + 0, hddwidth, 6, percent, 100);
if (is_visible) {
if (percent >= 0)
hddscale->paintProgressBar(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2 + 0, hddwidth, 6, percent, 100);
else {
frameBuffer->paintBoxRel(bbIconMinX, BBarY + InfoHeightY_Info / 2 + 2 + 0, hddwidth, 6, COL_INFOBAR_BUTTONS_BACKGROUND);
hddscale->reset();
}
}
}
void CInfoViewerBB::paint_ca_icons(int caid, char * icon, int &icon_space_offset)

View File

@@ -124,6 +124,7 @@ class CInfoViewerBB
void showBarSys(int percent = 0);
void showBarHdd(int percent = 0);
int hddpercent;
pthread_t hddperT;
static void* hddperThread(void *arg);
bool hddperTflag;

View File

@@ -238,7 +238,7 @@ int CNetworkSetup::showNetworkSetup()
CIPInput networkSettings_NameServer(LOCALE_NETWORKMENU_NAMESERVER, network_nameserver, LOCALE_IPSETUP_HINT_1, LOCALE_IPSETUP_HINT_2);
//hostname
CStringInputSMS networkSettings_Hostname(LOCALE_NETWORKMENU_HOSTNAME, &network_hostname, 30, LOCALE_NETWORKMENU_NTPSERVER_HINT1, LOCALE_NETWORKMENU_NTPSERVER_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-. ");
CStringInputSMS networkSettings_Hostname(LOCALE_NETWORKMENU_HOSTNAME, &network_hostname, 30, LOCALE_NETWORKMENU_HOSTNAME_HINT1, LOCALE_NETWORKMENU_HOSTNAME_HINT2, "abcdefghijklmnopqrstuvwxyz0123456789-. ");
//auto start
CMenuOptionChooser* o1 = new CMenuOptionChooser(LOCALE_NETWORKMENU_SETUPONSTARTUP, &network_automatic_start, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true);

View File

@@ -112,8 +112,12 @@ CPictureViewerGui::~CPictureViewerGui()
}
//------------------------------------------------------------------------
int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey)
{
audioplayer = false;
if (actionKey == "audio")
audioplayer = true;
selected = 0;
width = w_max (710, 0);
height = h_max (570, 0);
@@ -159,14 +163,16 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey
// remember last mode
m_LastMode=(CNeutrinoApp::getInstance()->getLastMode() | NeutrinoMessages::norezap);
//g_Zapit->setStandby(true);
g_Zapit->lockPlayBack();
if (!audioplayer) { // !!! why? !!!
//g_Zapit->setStandby(true);
g_Zapit->lockPlayBack();
// blank background screen
videoDecoder->setBlank(true);
// blank background screen
videoDecoder->setBlank(true);
// Stop Sectionsd
g_Sectionsd->setPauseScanning(true);
// Stop Sectionsd
g_Sectionsd->setPauseScanning(true);
}
// Save and Clear background
bool usedBackground = frameBuffer->getuseBackground();
@@ -180,11 +186,13 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey
// free picviewer mem
m_viewer->Cleanup();
//g_Zapit->setStandby(false);
g_Zapit->unlockPlayBack();
if (!audioplayer) { // !!! why? !!!
//g_Zapit->setStandby(false);
g_Zapit->unlockPlayBack();
// Start Sectionsd
g_Sectionsd->setPauseScanning(false);
// Start Sectionsd
g_Sectionsd->setPauseScanning(false);
}
// Restore previous background
if (usedBackground) {
@@ -226,6 +234,9 @@ int CPictureViewerGui::show()
paint();
}
if (audioplayer)
m_audioPlayer->wantNextPlay();
if (m_state!=SLIDESHOW)
timeout=50; // egal
else

View File

@@ -37,6 +37,7 @@
#include <driver/pictureviewer/pictureviewer.h>
#include <gui/widget/menue.h>
#include <gui/filebrowser.h>
#include <gui/audioplayer.h>
#include <string>
@@ -109,10 +110,14 @@ class CPictureViewerGui : public CMenuTarget
void showHelp();
void deletePicFile(unsigned int index, bool mode);
bool audioplayer;
public:
CPictureViewerGui();
~CPictureViewerGui();
int exec(CMenuTarget* parent, const std::string & actionKey);
CAudioPlayerGui *m_audioPlayer;
};

View File

@@ -451,16 +451,20 @@ int CFlashUpdate::exec(CMenuTarget* parent, const std::string &)
CNeutrinoApp::getInstance()->exec(NULL, "savesettings");
sleep(2);
//flash it...
#ifdef DEBUG1
if(1)
#else
if(!ft.program(filename, 80, 100))
#endif
{
hide();
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); // UTF-8
if (ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_APPLY_SETTINGS), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NEUTRINO_ICON_UPDATE) == CMessageBox::mbrYes)
if (!CExtUpdate::getInstance()->applySettings(filename, CExtUpdate::MODE_SOFTUPDATE))
return menu_return::RETURN_REPAINT;
}
#ifdef DEBUG1
if(1) {
#else
if(!ft.program(filename, 80, 100)) {
#endif
hide();
ShowHintUTF(LOCALE_MESSAGEBOX_ERROR, ft.getErrorMessage().c_str()); // UTF-8
return menu_return::RETURN_REPAINT;
}
//status anzeigen
showGlobalStatus(100);
@@ -690,7 +694,7 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey)
showFileSelector("");
} else {
if(selectedMTD == 10) {
CExtUpdate::getInstance()->writemtdExt(actionKey);
CExtUpdate::getInstance()->applySettings(actionKey, CExtUpdate::MODE_EXPERT);
}
else if(selectedMTD==-1) {
writemtd(actionKey, MTD_OF_WHOLE_IMAGE);

View File

@@ -755,7 +755,9 @@ void CStringInputSMS::paint(bool /*unused*/)
{
CStringInput::paint(true);
frameBuffer->paintIcon(NEUTRINO_ICON_NUMERIC_PAD, x+20+140, y+ hheight+ mheight+ iheight* 3+ 30, 0, COL_MENUCONTENT);
int w = 0, h = 0;
frameBuffer->getIconSize(NEUTRINO_ICON_NUMERIC_PAD, &w, &h);
frameBuffer->paintIcon(NEUTRINO_ICON_NUMERIC_PAD, x + (width/2) - (w/2), y+ hheight+ mheight+ iheight* 3+ 30, 0, COL_MENUCONTENT);
//buttonbar
::paintButtons(x, y + height, width, 2, CStringInputSMSButtons);