diff --git a/configure.ac b/configure.ac index 05b1fde0b..3c0d763cd 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,21 @@ AC_PROG_CXX AC_DISABLE_STATIC AM_PROG_LIBTOOL +# Add build information to config.h +# --------------------------------- + +# Add host to config.h +AC_DEFINE_UNQUOTED(USED_BUILD, ["$build"], [Build system under which the program was compiled on.]) + +# Add used CXXFLAGS to config.h +AC_DEFINE_UNQUOTED(USED_CXXFLAGS, ["$CXXFLAGS"], [Define to the used CXXFLAGS to compile this package.]) + +# Get compiler (version) +AH_TEMPLATE(USED_COMPILER, [Define to name and version of used compiler]) +if COMPILER=`$CC --version | head -n 1`; then + AC_DEFINE_UNQUOTED(USED_COMPILER, ["$COMPILER"]) +fi + AC_ARG_WITH([tremor], [AS_HELP_STRING([--with-tremor], [use libvorbisidec instead of libogg/libvorbis])], [TREMOR="$withval"], diff --git a/data/license/deutsch.license b/data/license/deutsch.license index 3f183d2b5..01d9bfca1 100644 --- a/data/license/deutsch.license +++ b/data/license/deutsch.license @@ -1,3 +1,5 @@ +GPL v2 + Dieses Programm ist freie Software. Sie können es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation veröffentlicht, weitergeben und/oder modifizieren, gemäß Version 2 der Lizenz. Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, daß es Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License. diff --git a/data/license/english.license b/data/license/english.license index 2a52a4285..939d929a6 100644 --- a/data/license/english.license +++ b/data/license/english.license @@ -1,3 +1,5 @@ +GPL v2 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/data/license/slovak.license b/data/license/slovak.license index fb94fcc56..ec0d44a44 100644 --- a/data/license/slovak.license +++ b/data/license/slovak.license @@ -1,3 +1,5 @@ +GPL v2 + Tento program je slobodný softvér: môžete ho šíriť a upravovať podľa ustanovení Všeobecnej verejnej licencie GNU (GNU General Public License), vydávanej nadáciou Free Software Foundation, a to buď podľa 2.verzie tejto Licencie, alebo (podľa vášho uváženia) ktorejkoľvek neskoršej verzie. Tento program je šírený v nádeji, že bude užitočný, avšak BEZ AKEJKOĽVEK ZÁRUKY. Neposkytujú sa ani odvodené záruky OBCHODOVATEĽNOSTI alebo VHODNOSTI PRE URČITÝ ÚČEL. Ďalšie podrobnosti hľadajte vo Všeobecnej verejnej licencii GNU. diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index d210619d7..4a45755ef 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -200,6 +200,12 @@ bouquetname.hdtv HD Kanäle bouquetname.new Neue Kanäle bouquetname.other Unbekannter Provider bouquetname.removed Gelöschte Kanäle +buildinfo.compiled_on Build Host +buildinfo.compiled_with Compiler Version +buildinfo.compiler_flags Compiler Flags +buildinfo.creator Ersteller +buildinfo.kernel Kernel Version +buildinfo.menu Build Informationen cablesetup.provider Kabelanbieter channellist.additional Zusatzinformationen channellist.additional_off aus @@ -622,7 +628,7 @@ imageinfo.head Image-Informationen imageinfo.homepage Homepage: imageinfo.image Image: imageinfo.kernel Kernel: -imageinfo.license Lizenz: +imageinfo.license Lizenz imageinfo.vcs Git: imageinfo.version Version: inetradio.name Internetradio @@ -788,6 +794,7 @@ menu.hint_back Zurück zum vorherigen Menü.\nDie Taste 'Menü' schließt alle M menu.hint_backlight Konfigurieren Sie die Hintergrundbeleuchtung der Buttons menu.hint_backup Sichern von Konfigurationen und Kanallisten menu.hint_bedit Bearbeiten ihrer Favoriten und der Bouquets +menu.hint_buildinfo Informationen über Compiler, Compilerflags, Kernel menu.hint_cache_txt Startet das Zwischenspeichern des Teletextes nach einem Kanalwechsel menu.hint_cec_mode CEC-Modus menu.hint_cec_standby CEC-Standby @@ -1410,7 +1417,9 @@ moviebrowser.update_if_dest_empty_only Übernehmen nur wenn Ziel leer moviebrowser.use_dir Verzeichnis verwenden moviebrowser.use_movie_dir Wiedergabeverzeichnis verwenden moviebrowser.use_rec_dir Aufnahmeverzeichnis verwenden -moviebrowser.yt_concurrent_connections Gleichzeitige Verbindungen +moviebrowser.yt_concurrent_connections Gleichzeitige Verbindungen +moviebrowser.yt_history Frühere Suchen +moviebrowser.yt_max_history Max. Anzahl früherer Suchen moviebrowser.yt_error Fehler beim laden des Youtube Feed moviebrowser.yt_max_results Max. Anzahl der zu holenden Feeds moviebrowser.yt_most_discussed Am meisten diskutiert @@ -1707,7 +1716,7 @@ satsetup.fe_mode_link_loop Loop satsetup.fe_mode_link_twin TWIN satsetup.fe_mode_master Master satsetup.fe_mode_unused Nicht genutzt -satsetup.fe_setup Setup Tuner +satsetup.fe_setup Tuner Einstellungen satsetup.lofh LNB High Offset satsetup.lofl LNB Low Offset satsetup.lofs LNB Switch Offset diff --git a/data/locale/english.locale b/data/locale/english.locale index 3a30a967c..fceb13bab 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -187,7 +187,7 @@ bouqueteditor.discardingchanges Discarding changes. Please be patient. bouqueteditor.hide Hide bouqueteditor.lock Lock bouqueteditor.move Move -bouqueteditor.name bouquet editor +bouqueteditor.name Bouquet editor bouqueteditor.newbouquetname New name of bouquets bouqueteditor.rename Rename bouqueteditor.return ready @@ -200,6 +200,12 @@ bouquetname.hdtv HD channels bouquetname.new New channels bouquetname.other Unknown provider bouquetname.removed Removed channels +buildinfo.compiled_on Build Host +buildinfo.compiled_with Compiler version +buildinfo.compiler_flags Compiler flags +buildinfo.creator Creator +buildinfo.kernel Kernel version +buildinfo.menu Build information cablesetup.provider cable provider channellist.additional Additional informations channellist.additional_off off @@ -622,7 +628,7 @@ imageinfo.head Image info: imageinfo.homepage Home page: imageinfo.image Image: imageinfo.kernel Kernel: -imageinfo.license License: +imageinfo.license License imageinfo.vcs Git: imageinfo.version Version: inetradio.name Internetradio @@ -788,6 +794,7 @@ menu.hint_back Return to previous menu\nPress menu key to close all menus menu.hint_backlight Configure buttons backlight menu.hint_backup Backup configs and channels to selected dir menu.hint_bedit Edit favorites and bouquets +menu.hint_buildinfo Information about compilers, compiler flags, kernel menu.hint_cache_txt Start teletext caching after channel switch menu.hint_cec_mode CEC mode menu.hint_cec_standby CEC standby @@ -1412,6 +1419,8 @@ moviebrowser.use_movie_dir Use movie directory moviebrowser.use_rec_dir Use record directory moviebrowser.yt_concurrent_connections Concurrent connections moviebrowser.yt_error Failed to load youtube feed +moviebrowser.yt_history Search history +moviebrowser.yt_max_history Max search history size moviebrowser.yt_max_results Max results to fetch moviebrowser.yt_most_discussed Most discussed moviebrowser.yt_most_popular Most popular diff --git a/data/locale/nederlands.locale b/data/locale/nederlands.locale index d397e5019..5f4d0e229 100644 --- a/data/locale/nederlands.locale +++ b/data/locale/nederlands.locale @@ -203,6 +203,12 @@ bouquetname.hdtv HD zenders bouquetname.new Nieuwe Zenders bouquetname.other Onbekende provider bouquetname.removed Verwijderde zenders +buildinfo.compiled_on Build Host +buildinfo.compiled_with Compiler Version +buildinfo.compiler_flags Compiler Flags +buildinfo.creator Creator +buildinfo.kernel Kernel Version +buildinfo.menu Build Informationen cablesetup.provider kabel provider channellist.additional Extra informatie channellist.additional_off Uit @@ -600,7 +606,7 @@ imageinfo.forum Forum: imageinfo.head Image info: imageinfo.homepage Website: imageinfo.image Image: -imageinfo.license Licentie: +imageinfo.license Licentie imageinfo.version Versie: inetradio.name Internetradio infoviewer.epgnotload EPG is niet geladen.... diff --git a/lib/libcoolstream2/cnxtfb.h b/lib/libcoolstream2/cnxtfb.h index 1f5b34f70..4a51357a3 100644 --- a/lib/libcoolstream2/cnxtfb.h +++ b/lib/libcoolstream2/cnxtfb.h @@ -76,7 +76,10 @@ typedef enum CNXTFB_1080P_50, CNXTFB_1080P_24, CNXTFB_1080P_25, - CNXTFB_DISPLAY_MODE_LAST = CNXTFB_1080P_25, + CNXTFB_1080P_30, + CNXTFB_1080P_2397, + CNXTFB_1080P_2997, + CNXTFB_DISPLAY_MODE_LAST = CNXTFB_1080P_2997, } cnxtfb_displaymode; typedef enum @@ -110,18 +113,18 @@ typedef enum typedef struct { - u8 uRed; - u8 uGreen; - u8 uBlue; - u8 uAlpha; + unsigned char uRed; + unsigned char uGreen; + unsigned char uBlue; + unsigned char uAlpha; } CNXTFB_RGB_COLOR; typedef struct { - u8 uY; - u8 uCb; - u8 uCr; - u8 uAlpha; + unsigned char uY; + unsigned char uCb; + unsigned char uCr; + unsigned char uAlpha; } CNXTFB_YCC_COLOR; typedef enum @@ -212,6 +215,7 @@ extern void cnxtfb_register_evnt_clbk(cnxtfb_notify pfnotify); #ifdef FB_TEST_HW_ACCELERATION #define FBIO_JPEG_RENDER 0x4633 +#define FBIO_SYNC_DRAW_OP 0x4641 #endif #define FBIO_SCALE_SD_OSD 0x4634 diff --git a/src/driver/audiodec/mp3dec.cpp b/src/driver/audiodec/mp3dec.cpp index 3e56a072e..cd052fa92 100644 --- a/src/driver/audiodec/mp3dec.cpp +++ b/src/driver/audiodec/mp3dec.cpp @@ -946,6 +946,7 @@ bool CMP3Dec::GetMetaData(FILE* in, const bool nice, CAudioMetaData* const m) { res = GetMP3Info(in, nice, m); GetID3(in, m); + SaveCover(in, m); } else { @@ -1345,6 +1346,82 @@ void CMP3Dec::GetID3(FILE* in, CAudioMetaData* const m) } } +bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m) +{ + struct id3_frame const *frame; + const char * coverfile = "/tmp/cover.jpg"; + + /* text information */ + struct id3_file *id3file = id3_file_fdopen(fileno(in), ID3_FILE_MODE_READONLY); + + if(id3file == 0) + { + printf("CMP3Dec::SaveCover: error open id3 file\n"); + return false; + } + else + { + id3_tag * tag = id3_file_tag(id3file); + if(tag) + { + frame = id3_tag_findframe(tag, "APIC", 0); + + if (frame) + { + printf("CMP3Dec::SaveCover: Cover found\n"); + // Picture file data + unsigned int j; + union id3_field const *field; + + for (j = 0; (field = id3_frame_field(frame, j)); j++) + { + switch (id3_field_type(field)) + { + case ID3_FIELD_TYPE_BINARYDATA: + id3_length_t size; + id3_byte_t const *data; + + data = id3_field_getbinarydata(field, &size); + if ( data ) + { + m->cover = coverfile; + FILE * pFile; + pFile = fopen ( coverfile , "wb" ); + fwrite (data , 1 , size , pFile ); + fclose (pFile); + } + break; + + case ID3_FIELD_TYPE_INT8: + //pic->type = id3_field_getint(field); + break; + + default: + break; + } + } + } + + id3_tag_delete(tag); + } + else + { + printf("CMP3Dec::SaveCover: error open id3 tag\n"); + return false; + } + + id3_finish_file(id3file); + } + + if(0) + { + printf("CMP3Dec::SaveCover:id3: not enough memory to display tag\n"); + return false; + } + + return true; +} + // this is a copy of static libid3tag function "finish_file" // which cannot be called from outside void id3_finish_file(struct id3_file* file) diff --git a/src/driver/audiodec/mp3dec.h b/src/driver/audiodec/mp3dec.h index cafdc4f9c..5f9b97c66 100644 --- a/src/driver/audiodec/mp3dec.h +++ b/src/driver/audiodec/mp3dec.h @@ -73,6 +73,7 @@ public: State* const state, CAudioMetaData* m, time_t* const t, unsigned int* const secondsToSkip); bool GetMetaData(FILE *in, const bool nice, CAudioMetaData* const m); + bool SaveCover(FILE*, CAudioMetaData * const m); CMP3Dec(){}; }; diff --git a/src/driver/audiometadata.cpp b/src/driver/audiometadata.cpp index 600c4f32b..92c6a78fc 100644 --- a/src/driver/audiometadata.cpp +++ b/src/driver/audiometadata.cpp @@ -51,7 +51,7 @@ CAudioMetaData::CAudioMetaData( const CAudioMetaData& src ) audio_start_pos( src.audio_start_pos ), vbr( src.vbr ), hasInfoOrXingTag( src.hasInfoOrXingTag ), artist( src.artist ), title( src.title ), album( src.album ), sc_station( src.sc_station ), - date( src.date ), genre( src.genre ), track( src.track ), + date( src.date ), genre( src.genre ), track( src.track ),cover(src.cover), changed( src.changed ) { } @@ -81,6 +81,7 @@ void CAudioMetaData::operator=( const CAudioMetaData& src ) date = src.date; genre = src.genre; track = src.track; + cover = src.cover; sc_station = src.sc_station; changed = src.changed; } @@ -104,5 +105,6 @@ void CAudioMetaData::clear() date.clear(); genre.clear(); track.clear(); + cover.clear(); changed=false; } diff --git a/src/driver/audiometadata.h b/src/driver/audiometadata.h index 022d59460..ba2a58e0c 100644 --- a/src/driver/audiometadata.h +++ b/src/driver/audiometadata.h @@ -84,6 +84,7 @@ public: std::string date; std::string genre; std::string track; + std::string cover; bool changed; }; #endif /* __AUDIO_METADATA__ */ diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 964a5b52b..ddd901639 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -176,8 +176,11 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel) psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO_EAC3, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str()); }else psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str()); + + if (numpids >= REC_MAX_APIDS) + break; } - if ((StreamVTxtPid) && (allpids.PIDs.vtxtpid != 0)){ + if ((StreamVTxtPid) && (allpids.PIDs.vtxtpid != 0) && (numpids < REC_MAX_APIDS)){ apids[numpids++] = allpids.PIDs.vtxtpid; psi.addPid(allpids.PIDs.vtxtpid, EN_TYPE_TELTEX, 0, channel->getTeletextLang()); } @@ -187,6 +190,8 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel) if (s->thisSubType == CZapitAbsSub::DVB) { if(i>9)//max sub pids break; + if (numpids >= REC_MAX_APIDS) + break; CZapitDVBSub* sd = reinterpret_cast(s); apids[numpids++] = sd->pId; @@ -197,9 +202,10 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel) } psi.genpsi(fd); - - if ((StreamPmtPid) && (allpids.PIDs.pmtpid != 0)) +#if 0 + if ((StreamPmtPid) && (allpids.PIDs.pmtpid != 0) && (numpids < REC_MAX_APIDS)) apids[numpids++] = allpids.PIDs.pmtpid; +#endif if(record == NULL) record = new cRecord(channel->getRecordDemux() /*RECORD_DEMUX*/); @@ -318,6 +324,9 @@ bool CRecordInstance::Update() if(!found) { update = true; printf("%s: apid %x not found in recording pids\n", __FUNCTION__, it->apid); + if (numpids < REC_MAX_APIDS) + apids[numpids++] = it->apid; + record->AddPid(it->apid); for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { if(allpids.APIDs[i].pid == it->apid) { diff --git a/src/driver/scanepg.cpp b/src/driver/scanepg.cpp index ff8f06981..954645d64 100644 --- a/src/driver/scanepg.cpp +++ b/src/driver/scanepg.cpp @@ -208,6 +208,7 @@ void CEpgScan::EnterStandby() { if (standby) { CZapit::getInstance()->SetCurrentChannelID(live_channel_id); + CZapit::getInstance()->EnablePlayback(true); g_Zapit->setStandby(true); g_Sectionsd->setPauseScanning(true); } diff --git a/src/global.h b/src/global.h index 0d9eabc78..c05a44822 100644 --- a/src/global.h +++ b/src/global.h @@ -6,14 +6,6 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Homepage: http://dbox.cyberphoria.org/ - 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 This program is free software; you can redistribute it and/or modify diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index df0f362c4..37bb35190 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -42,6 +42,7 @@ libneutrino_gui_a_SOURCES = \ audioplayer_setup.cpp\ bookmarkmanager.cpp \ bouquetlist.cpp \ + buildinfo.cpp \ channellist.cpp \ cec_setup.cpp \ dboxinfo.cpp \ diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 3aa6e2a0e..ae1c706de 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -67,6 +67,7 @@ #include #include "gui/pictureviewer.h" +extern CPictureViewer * g_PicViewer; #include #include @@ -2170,6 +2171,25 @@ void CAudioPlayerGui::updateMetaData(bool screen_saver) m_curr_audiofile.MetaData.album = meta.sc_station; updateLcd = true; } + + std::string cover = m_curr_audiofile.Filename.substr(0, m_curr_audiofile.Filename.rfind('/')) + "/folder.jpg"; + + if (!meta.cover.empty()) + cover = "/tmp/cover.jpg"; + + 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) @@ -2184,8 +2204,7 @@ void CAudioPlayerGui::updateMetaData(bool screen_saver) if (updateMeta || updateScreen) { - m_frameBuffer->paintBoxRel(m_x + 10, m_y + 4 + 2*m_fheight, m_width - 20, - m_sheight, COL_MENUCONTENTSELECTED_PLUS_0); + m_frameBuffer->paintBoxRel(m_x + 10 + m_title_height, m_y + 4 + 2*m_fheight, m_width - 20 - m_title_height, m_sheight, COL_MENUCONTENTSELECTED_PLUS_0); int xstart = ((m_width - 20 - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(m_metainfo))/2)+10; g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL] ->RenderString(m_x + xstart, m_y + 4 + 2*m_fheight + m_sheight, diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp new file mode 100644 index 000000000..02523b66f --- /dev/null +++ b/src/gui/buildinfo.cpp @@ -0,0 +1,212 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Copyright (C) 2013, M. Liebmann 'micha-bbg' + Copyright (C) 2013, Thilo Graf 'dbt' + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + + +#include +#include + +#include +#include +#include +#include +#include + +using namespace std; + +CBuildInfo::CBuildInfo() : CComponentsWindow(1, 1, 700, 500, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) +{ + initVarBuildInfo(); +} + +//init all var members +void CBuildInfo::initVarBuildInfo() +{ + x = frameBuffer->getScreenWidth(true)/2 - width/2; + y = frameBuffer->getScreenHeight(true)/2 -height/2; + + append_v_offset = 1; + font = NULL; + setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); + InitInfoItems(); + + + shadow = true; +} + +CBuildInfo::~CBuildInfo() +{ + cleanCCForm(); +} + + +int CBuildInfo::exec(CMenuTarget* parent, const string & /*actionKey*/) +{ + int res = menu_return::RETURN_REPAINT; + + if (parent) + parent->hide(); + + //exit if no informations available + if (!HasData()){ + return res; + } + + //paint window + if (!is_painted) + paint(); + + + neutrino_msg_t msg; + while (1) + { + neutrino_msg_data_t data; + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd_MS(100); + g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); + + if(msg == CRCInput::RC_setup) { + res = menu_return::RETURN_EXIT_ALL; + break; + } + else if((msg == CRCInput::RC_sat) || (msg == CRCInput::RC_favorites)) { + g_RCInput->postMsg (msg, 0); + res = menu_return::RETURN_EXIT_ALL; + break; + } + else if (msg <= CRCInput::RC_MaxRC){ + break; + } + + if ( msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout){ + CNeutrinoApp::getInstance()->handleMsg( msg, data ); + } + + + } + + //hide window + hide(); + + return res; +} + +void CBuildInfo::setFontType(Font* font_text) +{ + if (font_text == NULL) + return; + font = font_text; + InitInfoItems(); +} + +bool CBuildInfo::HasData() +{ + v_info.clear(); + +#ifdef USED_COMPILER + build_info_t compiler = {BI_TYPE_ID_USED_COMPILER, LOCALE_BUILDINFO_COMPILED_WITH, USED_COMPILER}; + v_info.push_back(compiler); +#endif + +#ifdef USED_CXXFLAGS + string cxxflags = USED_CXXFLAGS; + cxxflags = trim(cxxflags); + // Remove double spaces + size_t pos = cxxflags.find(" "); + while (pos != string::npos) { + cxxflags.erase(pos, 1); + pos = cxxflags.find(" ", pos); + } + build_info_t flags = {BI_TYPE_ID_USED_CXXFLAGS, LOCALE_BUILDINFO_COMPILER_FLAGS, cxxflags}; + v_info.push_back(flags); +#endif + +#ifdef USED_BUILD + build_info_t build = {BI_TYPE_ID_USED_BUILD , LOCALE_BUILDINFO_COMPILED_ON, USED_BUILD}; + v_info.push_back(build); +#endif + + CComponentsText utext; + build_info_t kernel = {BI_TYPE_ID_USED_KERNEL, LOCALE_BUILDINFO_KERNEL, utext.getTextFromFile("/proc/version")}; + v_info.push_back(kernel); + +#if 0 + CConfigFile data ('\t'); + data.loadConfig("/.version"); + build_info_t creator = {BI_TYPE_ID_CREATOR, LOCALE_BUILDINFO_CREATOR, data.getString("creator", "n/a")}; + v_info.push_back(creator); +#endif + + if (v_info.empty()){ + DisplayInfoMessage("No Informations available. Please report!"); + return false; + } + + return true; +} + +void CBuildInfo::InitInfoItems() +{ + //get and checkup required informations + if (!HasData()) + return; + + //ensure a clean body + ccw_body->clearCCItems(); + + //define size and position + int x_info = 10; + int h_info = ccw_body->getHeight()/v_info.size(); //default height + int w_info = width-2*x_info; + + //init info texts + for(size_t i=0; igetText(v_info[i].caption), v_info[i].info_text); + info->setLabelAndTextFont(font); + info->setTextModes(CTextBox::TOP , CTextBox::AUTO_HIGH | CTextBox::TOP | CTextBox::AUTO_LINEBREAK_NO_BREAKCHARS); + info->doPaintBg(false); + ccw_body->addCCItem(info); + } +} + +// This allows to retrieve information about build infos. +// Use parameter 'type_info' to get specific information. +build_info_t CBuildInfo::getInfo(const info_type_id_t& type_id) +{ + for(size_t i=0; i +#endif + +#include +#include + +typedef int info_type_id_t; + +typedef struct build_info_t +{ + info_type_id_t type_id; + neutrino_locale_t caption; + std::string info_text; + +} build_info_struct_t; + +class CBuildInfo : public CMenuTarget, public CComponentsWindow +{ + private: + std::vector v_info; + Font* font; + void initVarBuildInfo(); + void InitInfoItems(); + + bool HasData(); + public: + + //type_id's for infos + enum + { + BI_TYPE_ID_USED_COMPILER, + BI_TYPE_ID_USED_CXXFLAGS, + BI_TYPE_ID_USED_BUILD, + BI_TYPE_ID_USED_KERNEL, +#if 0 + BI_TYPE_ID_CREATOR, +#endif + + BI_TYPE_IDS, + }; + + CBuildInfo(); + ~CBuildInfo(); + ///assigns text Font type + void setFontType(Font* font_text); + build_info_t getInfo(const info_type_id_t& type_id); + void hide(); + int exec(CMenuTarget* parent, const std::string & actionKey); +}; + +#endif // __buildinfo__ diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 3e16f1985..f31430bc3 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -48,7 +48,7 @@ #include #include #include - + #include #include #include diff --git a/src/gui/components/Makefile.am b/src/gui/components/Makefile.am index f54eae886..5a6ac6cf3 100644 --- a/src/gui/components/Makefile.am +++ b/src/gui/components/Makefile.am @@ -23,6 +23,7 @@ libneutrino_gui_components_a_SOURCES = \ cc_frm_clock.cpp \ cc_frm_footer.cpp \ cc_frm_header.cpp \ + cc_frm_ext_text.cpp \ cc_frm_icons.cpp \ cc_frm_signalbars.cpp \ cc_frm_window.cpp \ diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 9f13752e2..7842a0c10 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -31,8 +31,8 @@ Basic attributes and member functions for component sub classes #ifndef __N_COMPONENTS__ #define __N_COMPONENTS__ -#include "cc_base.h" #include "cc_types.h" +#include "cc_base.h" #include "cc_item_infobox.h" #include "cc_item_picture.h" diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 94693d13e..e6ebe16cb 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -56,8 +56,8 @@ void CComponents::clearSavedScreen() void CComponents::initVarBasic() { - x = saved_screen.x = 0; - y = saved_screen.y = 0; + x = saved_screen.x = 1; + y = saved_screen.y = 1; cc_xr = x; cc_yr = y; height = saved_screen.dy = CC_HEIGHT_MIN; @@ -77,6 +77,7 @@ void CComponents::initVarBasic() firstPaint = true; is_painted = false; paint_bg = true; + cc_allow_paint = true; frameBuffer = CFrameBuffer::getInstance(); v_fbdata.clear(); saved_screen.pixbuf = NULL; @@ -106,8 +107,15 @@ void CComponents::paintFbItems(bool do_save_bg) for(size_t i=0; i< v_fbdata.size() ;i++){ // Don't paint if dx or dy are 0 - if ((v_fbdata[i].dx == 0) || (v_fbdata[i].dy == 0)) + if ((v_fbdata[i].dx == 0) || (v_fbdata[i].dy == 0)){ +// printf(" [CComponents] WARNING:\n [%s - %d], dx = %d\n dy = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy); continue; + } +#if 0 + if ((v_fbdata[i].x == 0) || (v_fbdata[i].y == 0)){ + printf(" [CComponents] WARNING:\n [%s - %d], x = %d\n y = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].x, v_fbdata[i].y); + } +#endif int fbtype = v_fbdata[i].fbdata_type; #ifdef DEBUG_CC @@ -130,7 +138,7 @@ void CComponents::paintFbItems(bool do_save_bg) //paint all fb relevant basic parts (frame and body) with all specified properties, paint_bg must be true if (fbtype != CC_FBDATA_TYPE_BGSCREEN && paint_bg){ if (fbtype == CC_FBDATA_TYPE_FRAME) { - if (v_fbdata[i].frame_thickness > 0) + if (v_fbdata[i].frame_thickness > 0 && cc_allow_paint) frameBuffer->paintBoxFrame(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].frame_thickness, v_fbdata[i].color, v_fbdata[i].r, corner_type); } else if (fbtype == CC_FBDATA_TYPE_BACKGROUND) @@ -148,14 +156,17 @@ void CComponents::paintFbItems(bool do_save_bg) //calculate current shadow width depends of current corner_rad sw_cur = max(2*v_fbdata[i].r, sw); } - // shadow right - frameBuffer->paintBoxRel(x_sh, v_fbdata[i].y, sw_cur, v_fbdata[i].dy-sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_TOP_RIGHT); - // shadow bottom - frameBuffer->paintBoxRel(v_fbdata[i].x, y_sh, v_fbdata[i].dx, sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_BOTTOM); + if (cc_allow_paint){ + // shadow right + frameBuffer->paintBoxRel(x_sh, v_fbdata[i].y, sw_cur, v_fbdata[i].dy-sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_TOP_RIGHT); + // shadow bottom + frameBuffer->paintBoxRel(v_fbdata[i].x, y_sh, v_fbdata[i].dx, sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_BOTTOM); + } } } else - frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type); + if(cc_allow_paint) + frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type); } } diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 32605b04d..0f69bbe40 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -94,6 +94,8 @@ class CComponents bool is_painted; ///mode: true=activate rendering of basic elements (frame, shadow and body) bool paint_bg; + ///mode: true=allows painting of item, see also allowPaint() + bool cc_allow_paint; ///initialize of basic attributes, no parameters required void initVarBasic(); @@ -205,6 +207,11 @@ class CComponents ///allows paint of elementary item parts (shadow, frame and body), similar as background, set it usually to false, if item used in a form virtual void doPaintBg(bool do_paint){paint_bg = do_paint;}; + ///allow/disalows paint of item and its contents, but initialize of other properties are not touched + ///this can be understood as a counterpart to isPainted(), but before paint + virtual void allowPaint(bool allow){cc_allow_paint = allow;}; + ///returns visibility mode + virtual bool paintAllowed(){return cc_allow_paint;}; }; class CComponentsItem : public CComponents diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 1d2420a56..27c094170 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -361,8 +361,17 @@ void CComponentsForm::paintCCItems() cc_item->setHeight(new_h); } + //get current visibility mode from item, me must hold it and restore after paint + bool item_visible = cc_item->paintAllowed(); + //set visibility mode + if (!this->cc_allow_paint) + cc_item->allowPaint(false); + //finally paint current item cc_item->paint(CC_SAVE_SCREEN_NO); + + //restore defined old visibility mode of item after paint + cc_item->allowPaint(item_visible); } } diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index e00ae07d0..e3cb101d6 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -285,16 +285,13 @@ class CComponentsWindow : public CComponentsForm ~CComponentsWindow(); - ///paint window - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - ///add item to body object, also usable is addCCItem() to add items to the windo object void addWindowItem(CComponentsItem* cc_Item); ///allow/disallow paint a footer, default true, see also ccw_show_footer, showHeader() - void showFooter(bool show = true){ccw_show_footer = show;}; + void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();}; ///allow/disallow paint a header, default true, see also ccw_show_header, showFooter() - void showHeader(bool show = true){ccw_show_header = show;}; + void showHeader(bool show = true){ccw_show_header = show; initCCWItems();}; ///set caption in header with string, see also getHeaderObject() void setWindowCaption(const std::string& text, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK){ccw_caption = text; ccw_align_mode = align_mode;}; @@ -322,4 +319,100 @@ class CComponentsWindow : public CComponentsForm void Refresh(){initCCWItems();}; }; + +class CComponentsExtTextForm : public CComponentsForm +{ + private: + ///property: content of label, see also setLabelAndText() + std::string ccx_label_text; + ///property: content of text, see also setLabelAndText() + std::string ccx_text; + ///property: color of label text, see also setLabelAndTextColor() + fb_pixel_t ccx_label_color; + ///property: color of text, see also setLabelAndTextColor() + fb_pixel_t ccx_text_color; + ///property: mode of label text, see also setTextModes() + int ccx_label_align; + ///property: mode of text, see also setTextModes() + int ccx_text_align; + ///property: width of label, see also setLabelWidthPercent() + int ccx_label_width; + ///property: width of text, see also setLabelWidthPercent() + int ccx_text_width; + ///property: font type of both items (label and text), see also setLabelAndText() + Font* ccx_font; + ///property: percentage val of label width related to full width, causes fit of text automatically into the available remaining size of item, see also setLabelWidthPercent() + uint8_t ccx_percent_label_w; + + ///object: label object + CComponentsLabel *ccx_label_obj; + ///object: text object + CComponentsText *ccx_text_obj; + + ///initialize of properties for all objects + void initCCTextItems(); + ///initialize the label object + void initLabel(); + ///initialize the text object + void initText(); + + protected: + ///initialize basic variables + void initVarExtTextForm(const int x_pos = 1, const int y_pos = 1, const int w = 300, const int h = 27, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT, + fb_pixel_t text_color = COL_MENUCONTENT_TEXT, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + + public: + ///simple constructor for CComponentsExtTextForm + CComponentsExtTextForm(); + + ///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as string + CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h, + const std::string& label_text, const std::string& text, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT, + fb_pixel_t text_color = COL_MENUCONTENT_TEXT, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + + ///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as locales + CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h, + const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT, + fb_pixel_t text_color = COL_MENUCONTENT_TEXT, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); +// ~CComponentsExtTextForm(); //inherited from CComponentsForm + + ///assigns texts for label and text, parameter as string, parameter Font is optional for required font type, default font is dependently from defined item height + void setLabelAndText(const std::string& label_text, const std::string& text, Font* font_text = NULL); + ///assigns texts for label and text, parameter as neutrino_locale_t, parameter Font is optional for required font type, default font is dependently from defined item height + void setLabelAndText(const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text, Font* font_text = NULL); + ///assigns text Font type + void setLabelAndTextFont(Font* font); + + ///assigns texts for label and text, parameter as struct (locale_ext_txt_t), parameters provide the same properties like setLabelAndText() + void setLabelAndTexts(const locale_ext_txt_t& texts); + ///assigns texts for label and text, parameter as struct (string_ext_txt_t), parameters provide the same properties like setLabelAndText() + void setLabelAndTexts(const string_ext_txt_t& locale_texts); + + ///assigns colors for text for label text, parameter as fb_pixel_t + void setLabelAndTextColor(const fb_pixel_t label_color , const fb_pixel_t text_color); + + ///assigns width of label and text related to width, parameter as uint8_t in percent of width, fits text automatically into the available remaining size of item + void setLabelWidthPercent(const uint8_t& percent_val); + + ///returns a pointer to the internal label object, use this to get access to its most properties + CComponentsLabel*getLabelObject(){return ccx_label_obj;}; + ///returns a pointer to the internal text object, use this to get access to its most properties + CComponentsText*getTextObject(){return ccx_text_obj;}; + + ///sets the text modes (mainly text alignment) to the label and text object, see /gui/widget/textbox.h for possible modes + void setTextModes(const int& label_mode, const int& text_mode); + + ///paint this item/form + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); +}; + #endif diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index a126ab040..7846ef20d 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -68,7 +68,8 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i { initVarButton(); cc_btn_icon = icon_name; - cc_btn_capt = g_Locale->getText(caption_locale);; + cc_btn_capt_locale = caption_locale; + cc_btn_capt = g_Locale->getText(cc_btn_capt_locale); cc_btn_capt_col = COL_MENUCONTENT_TEXT; x = x_pos; @@ -95,6 +96,7 @@ void CComponentsButton::initVarButton() cc_btn_font = NULL; cc_btn_icon = ""; cc_btn_capt = ""; + cc_btn_capt_locale = NONEXISTANT_LOCALE; } void CComponentsButton::initIcon() @@ -194,7 +196,8 @@ void CComponentsButton::setCaption(const std::string& text) void CComponentsButton::setCaption(const neutrino_locale_t locale_text) { - cc_btn_capt = g_Locale->getText(locale_text); + cc_btn_capt_locale = locale_text; + cc_btn_capt = g_Locale->getText(cc_btn_capt_locale); } void CComponentsButton::initCCBtnItems() diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index f435c8e44..976433e81 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -47,8 +47,11 @@ class CComponentsButton : public CComponentsForm ///initialize all required attributes and objects void initVarButton(); - ///property: button text + ///property: button text as string, see also setCaption() and getCaptionString() std::string cc_btn_capt; + ///property: button text as locale, see also setCaption() and getCaptionLocale() + neutrino_locale_t cc_btn_capt_locale; + ///property: icon name, only icons supported, to find in gui/widget/icons.h std::string cc_btn_icon; @@ -86,6 +89,11 @@ class CComponentsButton : public CComponentsForm ///set caption: parameter as locale virtual void setCaption(const neutrino_locale_t locale_text); + ///get caption, type as std::string + virtual std::string getCaptionString(){return cc_btn_capt;}; + ///get loacalized caption id, type = neutrino_locale_t + virtual neutrino_locale_t getCaptionLocale(){return cc_btn_capt_locale;}; + ///reinitialize items virtual void Refresh(){initCCBtnItems();}; @@ -108,6 +116,14 @@ class CComponentsButtonRed : public CComponentsButton { cc_item_type = CC_ITEMTYPE_BUTTON_RED; }; + CComponentsButtonRed( const int x_pos, const int y_pos, const int w, const int h, + const neutrino_locale_t& caption_locale, + bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_RED, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + { + cc_item_type = CC_ITEMTYPE_BUTTON_RED; + }; }; //! Sub class of CComponentsButton. @@ -125,6 +141,14 @@ class CComponentsButtonGreen : public CComponentsButton { cc_item_type = CC_ITEMTYPE_BUTTON_GREEN; }; + CComponentsButtonGreen( const int x_pos, const int y_pos, const int w, const int h, + const neutrino_locale_t& caption_locale, + bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_GREEN, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + { + cc_item_type = CC_ITEMTYPE_BUTTON_GREEN; + }; }; //! Sub class of CComponentsButton. @@ -142,6 +166,14 @@ class CComponentsButtonYellow : public CComponentsButton { cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW; }; + CComponentsButtonYellow( const int x_pos, const int y_pos, const int w, const int h, + const neutrino_locale_t& caption_locale, + bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_YELLOW, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + { + cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW; + }; }; //! Sub class of CComponentsButton. @@ -159,6 +191,14 @@ class CComponentsButtonBlue : public CComponentsButton { cc_item_type = CC_ITEMTYPE_BUTTON_BLUE; }; + CComponentsButtonBlue( const int x_pos, const int y_pos, const int w, const int h, + const neutrino_locale_t& caption_locale, + bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_BLUE, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + { + cc_item_type = CC_ITEMTYPE_BUTTON_BLUE; + }; }; #endif /*__CC_BUTTONS_H__*/ diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp new file mode 100644 index 000000000..149786e28 --- /dev/null +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -0,0 +1,222 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2013, Thilo Graf 'dbt' + + License: GPL + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "cc_frm.h" + +#define DEF_HEIGHT 27 +#define DEF_LABEL_WIDTH_PERCENT 30 +#define DEF_WIDTH 300 + +using namespace std; + +CComponentsExtTextForm::CComponentsExtTextForm() +{ + initVarExtTextForm(); + initCCTextItems(); +} + +CComponentsExtTextForm::CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h, + const std::string& label_text, const std::string& text, + bool has_shadow, + fb_pixel_t label_color, + fb_pixel_t text_color, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + initVarExtTextForm(x_pos, y_pos, w, h, has_shadow, label_color, text_color, color_frame, color_body, color_shadow); + ccx_label_text = label_text; + ccx_text = text; + initCCTextItems(); +} + +CComponentsExtTextForm::CComponentsExtTextForm( const int x_pos, const int y_pos, const int w, const int h, + const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text, + bool has_shadow, + fb_pixel_t label_color, + fb_pixel_t text_color, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + initVarExtTextForm(x_pos, y_pos, w, h, has_shadow, label_color, text_color, color_frame, color_body, color_shadow); + ccx_label_text = g_Locale->getText(locale_label_text); + ccx_text = g_Locale->getText(locale_text); + + initCCTextItems(); +} + +void CComponentsExtTextForm::initVarExtTextForm(const int x_pos, const int y_pos, const int w, const int h, + bool has_shadow, + fb_pixel_t label_color, + fb_pixel_t text_color, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + initVarForm(); + cc_item_type = CC_ITEMTYPE_FRM_EXT_TEXT; + x = x_pos; + y = y_pos; + + width = w; + //init ccx_label_width and ccx_text_width + //default ccx_label_width = 30% of form width + ccx_percent_label_w = DEF_LABEL_WIDTH_PERCENT; + ccx_label_width = ccx_percent_label_w * width/100; + ccx_text_width = width-ccx_label_width; + + height = h; + + ccx_label_text = ""; + ccx_text = ""; + shadow = has_shadow; + ccx_label_color = label_color; + ccx_text_color = text_color; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + ccx_label_obj = NULL; + ccx_text_obj = NULL; + corner_type = 0; + int dx = 0, dy = DEF_HEIGHT; + ccx_font = *(CNeutrinoFonts::getInstance()->getDynFont(dx, dy)); + ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK; + + +} + +void CComponentsExtTextForm::initLabel() +{ + //initialize label object + if (ccx_label_obj == NULL){ + ccx_label_obj = new CComponentsLabel(); + ccx_label_obj->doPaintBg(false); + } + + //add label object + if (!ccx_label_obj->isAdded()) + addCCItem(ccx_label_obj); + + //set properties + if (ccx_label_obj){ + ccx_label_width = (ccx_percent_label_w * width/100); + ccx_label_obj->setText(ccx_label_text, ccx_label_align, ccx_font); + ccx_label_obj->setTextColor(ccx_label_color); + ccx_label_obj->setDimensionsAll(fr_thickness, 0, ccx_label_width-fr_thickness, height-2*fr_thickness); + ccx_label_obj->setCorner(this->corner_rad, CORNER_LEFT); + } +} + +void CComponentsExtTextForm::initText() +{ + //initialize text object + if (ccx_text_obj == NULL){ + ccx_text_obj = new CComponentsLabel(); + ccx_text_obj->doPaintBg(false); + } + + //add text object + if (!ccx_text_obj->isAdded()) + addCCItem(ccx_text_obj); + + //set properties + if (ccx_text_obj){ + ccx_text_width = width-ccx_label_obj->getWidth(); + ccx_text_obj->setText(ccx_text, ccx_text_align, ccx_font); + ccx_text_obj->setTextColor(ccx_text_color); + ccx_text_obj->setDimensionsAll(CC_APPEND, 0, ccx_text_width-2*fr_thickness, height-2*fr_thickness); + ccx_text_obj->setCorner(this->corner_rad, CORNER_RIGHT); + } +} + + +void CComponentsExtTextForm::setLabelAndText(const std::string& label_text, const std::string& text, Font* font_text) +{ + ccx_label_text = label_text; + ccx_text = text; + if (font_text) + ccx_font = font_text; + initCCTextItems(); +} + + +void CComponentsExtTextForm::setLabelAndText(const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text, Font* font_text) +{ + setLabelAndText(g_Locale->getText(locale_label_text), g_Locale->getText(locale_text), font_text); +} + +void CComponentsExtTextForm::setLabelAndTexts(const string_ext_txt_t& texts) +{ + setLabelAndText(texts.label_text, texts.text, texts.font); +} + +void CComponentsExtTextForm::setLabelAndTexts(const locale_ext_txt_t& locale_texts) +{ + setLabelAndText(g_Locale->getText(locale_texts.label_text), g_Locale->getText(locale_texts.text), locale_texts.font); +} + +void CComponentsExtTextForm::setLabelAndTextFont(Font* font) +{ + if (font == NULL) + return; + setLabelAndText(ccx_label_text, ccx_text, font); +} + +void CComponentsExtTextForm::setTextModes(const int& label_mode, const int& text_mode) +{ + ccx_label_align = label_mode; + ccx_text_align = text_mode; + initCCTextItems(); +} + +void CComponentsExtTextForm::setLabelAndTextColor(const fb_pixel_t label_color , const fb_pixel_t text_color) +{ + ccx_label_color = label_color; + ccx_text_color = text_color; + initCCTextItems(); +} + +void CComponentsExtTextForm::initCCTextItems() +{ + initLabel(); + initText(); +} + +void CComponentsExtTextForm::setLabelWidthPercent(const uint8_t& percent_val) +{ + ccx_percent_label_w = (int)percent_val; + initCCTextItems(); +} + +void CComponentsExtTextForm::paint(bool do_save_bg) +{ + //prepare items before paint + initCCTextItems(); + + //paint form contents + paintForm(do_save_bg); +} diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 6b66f5827..eef2f81ee 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -254,11 +254,3 @@ void CComponentsWindow::initCCWItems() addCCItem(ccw_footer); } -void CComponentsWindow::paint(bool do_save_bg) -{ - //prepare items before paint - initCCWItems(); - - //paint form contents - paintForm(do_save_bg); -} diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 07d621e96..0ab26c35d 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -107,21 +107,25 @@ void CComponentsItem::paintInit(bool do_save_bg) } //restore last saved screen behind form box, -//Do use parameter 'no restore' to override temporarly the restore funtionality. -//This could help to avoid ugly flicker efffects if it is necessary e.g. on often repaints, without changed contents. +//Do use parameter 'no restore' to override the restore funtionality. +//For embedded items is it mostly not required to restore saved screens, so no_resore=true also is default parameter +//for such items. +//This member ensures demage of already existing screen buffer too, if parameter no_restore was changed while runtime. void CComponentsItem::hideCCItem(bool no_restore) { - is_painted = false; - + //restore saved screen if available if (saved_screen.pixbuf) { frameBuffer->waitForIdle("CComponentsItem::hideCCItem()"); frameBuffer->RestoreScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy, saved_screen.pixbuf); - if (no_restore) { - delete[] saved_screen.pixbuf; - saved_screen.pixbuf = NULL; - firstPaint = true; - } + + if (no_restore) { //on parameter no restore=true delete saved screen if available + delete[] saved_screen.pixbuf; + saved_screen.pixbuf = NULL; + firstPaint = true; + } } + + is_painted = false; } void CComponentsItem::hide(bool no_restore) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 0ea76cd27..ff1b30bfb 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -97,16 +97,19 @@ void CComponentsInfoBox::paintPicture() //exit if no image definied if (pic_name == "") return; - + //init pic object and set icon paint position pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness, 0, 0, ""); //define icon pic->setPicture(pic_name); - + //fit icon into infobox pic->setHeight(height-2*fr_thickness); pic->setColorBody(col_body); + + //paint, but set visibility mode + pic->allowPaint(cc_allow_paint); pic->paint(CC_SAVE_SCREEN_NO); } @@ -119,7 +122,7 @@ void CComponentsInfoBox::paint(bool do_save_bg) //NOTE: real values are reqiured, if we paint this item within a form as embedded cc-item int x_text = (cc_parent ? cc_xr : x) + fr_thickness; int y_text = (cc_parent ? cc_yr : y) + fr_thickness; - + //set text to the left border if picture is not painted int pic_w = 0; if ((pic) && (pic->isPicPainted())) @@ -141,7 +144,9 @@ void CComponentsInfoBox::paint(bool do_save_bg) int tw = width - x_offset - pic_w - 2*fr_thickness; int th = height-2*fr_thickness; cctext->setDimensionsAll(tx, y_text, tw, th); - - cctext->paint(CC_SAVE_SCREEN_NO); + + //paint, but set visibility mode + cctext->allowPaint(cc_allow_paint); + cctext->paint(CC_SAVE_SCREEN_NO); } } diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 1b5f51a3a..ebd77bf6f 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -180,7 +180,7 @@ void CComponentsPicture::paintPicture() { pic_painted = false; - if (do_paint){ + if (do_paint && cc_allow_paint){ #ifdef DEBUG_CC printf(" [CComponentsPicture] %s: paint image: %s (do_paint=%d)\n", __FUNCTION__, pic_name.c_str(), do_paint); #endif diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 41bfa2d62..06debd8ae 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -141,6 +141,7 @@ void CProgressBar::paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_ { CComponentsShapeSquare shape(shx, shy, shw, shh, false); shape.setColorBody(col); + shape.allowPaint(cc_allow_paint); shape.paint(false); } diff --git a/src/gui/components/cc_item_progressbar.h b/src/gui/components/cc_item_progressbar.h index 90fb2a7a0..ecc074eee 100644 --- a/src/gui/components/cc_item_progressbar.h +++ b/src/gui/components/cc_item_progressbar.h @@ -92,7 +92,7 @@ class CProgressBar : public CComponentsItem ///paint version of progressbar with color and advanced display modifications void paintAdvanced(); ///painting of activ/passive bars via shape object - static void paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_t &col); + void paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_t &col); void initDimensions(); diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index dbd94b4c2..feb6b3f0e 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -109,7 +109,7 @@ void CComponentsText::initVarText() ct_text_Vborder = 0; ct_col_text = COL_MENUCONTENT_TEXT; - ct_old_col_text = ct_col_text; + ct_old_col_text = 0; ct_text_sent = false; ct_paint_textbg = false; ct_force_text_paint = false; @@ -153,11 +153,24 @@ void CComponentsText::initCCText() ct_textbox->setWindowMaxDimensions(width, height); ct_textbox->setWindowMinDimensions(width, height); - //send text to CTextBox object, but paint text only if text or text coloer has changed or force option is enabled - if ((ct_old_text != ct_text) || ct_old_col_text != ct_col_text || ct_force_text_paint) - ct_text_sent = ct_textbox->setText(&ct_text, this->iWidth); - ct_old_text = ct_text; - ct_old_col_text = ct_col_text; + //observe behavior of parent form if available + bool force_text_paint = ct_force_text_paint; + if (cc_parent){ + //if any embedded text item was hided because of hided parent form, + //we must ensure repaint of text, otherwise text item is not visible + if (cc_parent->isPainted()) + force_text_paint = true; + } + + //send text to CTextBox object, but force text paint text if force_text_paint option is enabled + //this is managed by CTextBox object itself + ct_text_sent = ct_textbox->setText(&ct_text, this->iWidth, force_text_paint); + + //set current text status, needed by textChanged() + if (ct_text_sent){ + ct_old_text = ct_text; + ct_old_col_text = ct_col_text; + } #ifdef DEBUG_CC printf(" [CComponentsText] [%s - %d] init text: %s [x %d, y %d, w %d, h %d]\n", __FUNCTION__, __LINE__, ct_text.c_str(), this->iX, this->iY, this->iWidth, this->iHeight); #endif @@ -170,7 +183,6 @@ void CComponentsText::clearCCText() ct_textbox = NULL; } - void CComponentsText::setText(const std::string& stext, const int mode, Font* font_text) { ct_old_text = ct_text; @@ -236,7 +248,7 @@ void CComponentsText::paintText(bool do_save_bg) { paintInit(do_save_bg); initCCText(); - if (ct_text_sent) + if (ct_text_sent && cc_allow_paint) ct_textbox->paint(); ct_text_sent = false; } diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 2661641eb..8d44d7f55 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -150,7 +150,7 @@ CComponentsLbel provides a interface to the embedded CTextBox object. class CComponentsLabel : public CComponentsText { public: - CComponentsLabel( const int x_pos, const int y_pos, const int w, const int h, + CComponentsLabel( const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50, std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENTINACTIVE_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) @@ -158,12 +158,6 @@ class CComponentsLabel : public CComponentsText { cc_item_type = CC_ITEMTYPE_LABEL; }; - CComponentsLabel():CComponentsText() - { - initVarText(); - cc_item_type = CC_ITEMTYPE_LABEL; - ct_col_text = COL_MENUCONTENTINACTIVE_TEXT; - }; }; #endif diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index 9dc397c48..c5aa38117 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -87,6 +87,9 @@ void CComponentsPIP::paint(bool do_save_bg) pig_w -= pig_w*25/100; pig_x += tmpw/2-pig_w/2; } + + if (!cc_allow_paint) + return; if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv){ videoDecoder->Pig(pig_x, pig_y, pig_w, pig_h, screen_w, screen_h); @@ -95,7 +98,6 @@ void CComponentsPIP::paint(bool do_save_bg) CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); pic.paint(CC_SAVE_SCREEN_NO); } - } diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 55011123c..59fc34243 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -28,6 +28,7 @@ #include #include +#include ///cc item types typedef enum @@ -45,6 +46,7 @@ typedef enum CC_ITEMTYPE_FOOTER, CC_ITEMTYPE_FRM_ICONFORM, CC_ITEMTYPE_FRM_WINDOW, + CC_ITEMTYPE_FRM_EXT_TEXT, CC_ITEMTYPE_LABEL, CC_ITEMTYPE_PROGRESSBAR, CC_ITEMTYPE_BUTTON, @@ -125,6 +127,20 @@ typedef struct comp_element_data_t void* handler2; }comp_element_data_struct_t; +//text lebel types +typedef struct locale_ext_txt_t +{ + neutrino_locale_t label_text; + neutrino_locale_t text; + Font* font; +} locale_ext_txt_struct_t; + +typedef struct string_ext_txt_t +{ + std::string label_text; + std::string text; + Font* font; +} string_ext_txt_struct_t; #define CC_WIDTH_MIN 16 #define CC_HEIGHT_MIN 16 diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 7254860ca..573bfc929 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -39,7 +39,7 @@ #include #include #include "version.h" - +#include #define LICENSEDIR DATADIR "/neutrino/license/" using namespace std; @@ -58,7 +58,13 @@ void CImageInfo::Init(void) cc_info = NULL; cc_tv = NULL; cc_lic = NULL; + cc_sub_caption = NULL; + b_info = NULL; + btn_red = NULL; item_offset = 10; + item_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; + item_height = item_font->getHeight(); + license_txt = ""; v_info.clear(); config.loadConfig("/.version"); @@ -81,6 +87,9 @@ void CImageInfo::Clean() cc_info = NULL; cc_tv = NULL; cc_lic = NULL; + cc_sub_caption = NULL; + b_info = NULL; + btn_red = NULL; } } @@ -107,6 +116,39 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &) res = menu_return::RETURN_EXIT_ALL; break; } + else if (msg == CRCInput::RC_red){ + // init temporarly vars + neutrino_locale_t info_cap , new_btn_cap; + info_cap = new_btn_cap = NONEXISTANT_LOCALE; + string info_txt = ""; + neutrino_locale_t btn_cap = btn_red->getCaptionLocale(); + + //toggle caption and info contents + if (btn_cap == LOCALE_BUILDINFO_MENU){ + info_cap = LOCALE_BUILDINFO_MENU; + for (uint i=0; igetText(b_info->getInfo(i).caption); + info_txt += "\n"; + info_txt += b_info->getInfo(i).info_text + "\n\n"; + } + new_btn_cap = LOCALE_IMAGEINFO_LICENSE; + } + if (btn_cap == LOCALE_IMAGEINFO_LICENSE){ + info_cap = LOCALE_IMAGEINFO_LICENSE; + info_txt = getLicenseText(); + new_btn_cap = LOCALE_BUILDINFO_MENU; + } + + //assign new caption and info contents + cc_sub_caption->setText(info_cap, CTextBox::AUTO_WIDTH, item_font); + InitInfoText(info_txt); + btn_red->setCaption(new_btn_cap); + + //paint items + cc_sub_caption->paint(false); + cc_lic->paint(false); + btn_red->paint(false); + } else if((msg == CRCInput::RC_sat) || (msg == CRCInput::RC_favorites)) { g_RCInput->postMsg (msg, 0); res = menu_return::RETURN_EXIT_ALL; @@ -125,6 +167,7 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &) if ( msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout){ CNeutrinoApp::getInstance()->handleMsg( msg, data ); } + } hide(); @@ -135,9 +178,14 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &) //contains all actions to init and add the window object and items void CImageInfo::ShowWindow() { + CComponentsFooter *footer = NULL; if (cc_win == NULL){ cc_win = new CComponentsWindow(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO); cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); + footer = cc_win->getFooterObject(); + footer->setColorBody(COL_INFOBAR_SHADOW_PLUS_1); + btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, footer->getHeight(), LOCALE_BUILDINFO_MENU, false , true, false, footer->getColorBody(), footer->getColorBody()); + footer->addCCItem(btn_red); } //prepare minitv @@ -146,7 +194,10 @@ void CImageInfo::ShowWindow() //prepare infos InitInfos(); - //prepare license text + //prepare build infos + InitBuildInfos(); + + //prepare info text InitInfoText(getLicenseText()); //paint window @@ -171,11 +222,19 @@ void CImageInfo::InitMinitv() cc_tv->setXPos(cc_tv_x); //add minitv to container - cc_win->addWindowItem(cc_tv); + if (!cc_tv->isAdded()) + cc_win->addWindowItem(cc_tv); } //prepare distribution infos -void CImageInfo::InitInfos() +void CImageInfo::InitBuildInfos() +{ + if (b_info == NULL) + b_info = new CBuildInfo(); +} + +//collect required data from environment +void CImageInfo::InitInfoData() { v_info.clear(); @@ -224,66 +283,52 @@ void CImageInfo::InitInfos() v_info.push_back(doc); image_info_t forum = {LOCALE_IMAGEINFO_FORUM, config.getString("forum", "http://forum.tuxbox.org")}; v_info.push_back(forum); - image_info_t license = {LOCALE_IMAGEINFO_LICENSE, "GPL v2"}; - v_info.push_back(license); +} - Font * item_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; + +//prepare distribution infos +void CImageInfo::InitInfos() +{ + InitInfoData(); //initialize container for infos if (cc_info == NULL) cc_info = new CComponentsForm(); - cc_win->addWindowItem(cc_info); + if (!cc_info->isAdded()) + cc_win->addWindowItem(cc_info); + cc_info->setPos(item_offset, item_offset); - cc_info->setWidth((cc_win->getWidth()/3*2)-2*item_offset); - - - //calculate max width of label and info_text - int w_label = 0, w_text = 0, w = 0; - for (size_t i = 0; i < v_info.size(); i++) { - w = item_font->getRenderWidth(g_Locale->getText(v_info[i].caption), true); - w_label = std::max(w_label, w); - - w = item_font->getRenderWidth(v_info[i].info_text.c_str(), true); - w_text = std::max(w_text, w); - } - - int x_label = 0, y_text = 0; - int x_text = x_label + w_label + item_offset; - int item_height = item_font->getHeight(); - - //recalc w_text to avoid an overlap with pip TODO: calculate within cc_info itself - w_text = std::min(w_text, cc_win->getWidth() - x_text - /*cc_tv->getWidth() - */2*item_offset); - + + //set width, use size between left border and minitv + cc_info->setWidth(cc_win->getWidth() - cc_tv->getWidth() - 2*item_offset); + + //calculate initial height for info form + cc_info->setHeight(v_info.size()*item_height); + //create label and text items - int h_tmp = 0; - size_t i = 0; - for (i = 0; i < v_info.size(); i++) { - CComponentsLabel *cc_label = new CComponentsLabel(); - cc_label->setDimensionsAll(x_label, y_text, w_label, item_height); - cc_label->setText(v_info[i].caption, CTextBox::NO_AUTO_LINEBREAK, item_font); + for (size_t i=0; igetWidth(), item_height, g_Locale->getText(v_info[i].caption), v_info[i].info_text); + item->setLabelAndTextFont(item_font); + item->setLabelWidthPercent(20); - //add label object to window body - cc_info->addCCItem(cc_label); + if ((i == 0) && (item->getYPos() == CC_APPEND)) + item->setYPos(1); - CComponentsText *cc_text = new CComponentsText(); - cc_text->setDimensionsAll(x_text, y_text, w_text, item_height); - cc_text->setText(v_info[i].info_text.c_str(), CTextBox::NO_AUTO_LINEBREAK, item_font); - y_text += item_height/*CC_APPEND*/; + //add ext-text object to window body + if (!item->isAdded()) + cc_info->addCCItem(item); - //add text object to window body - cc_info->addCCItem(cc_text); - - // add an offset before homepage and license - if (v_info[i].caption == LOCALE_IMAGEINFO_CREATOR|| v_info[i].caption == LOCALE_IMAGEINFO_FORUM){ - h_tmp += item_offset; - y_text += item_offset; + //add an offset before homepage and license and at the end + if (v_info[i].caption == LOCALE_IMAGEINFO_CREATOR || v_info[i].caption == LOCALE_IMAGEINFO_FORUM){ + CComponentsShapeSquare *spacer = new CComponentsShapeSquare(1, CC_APPEND, 1, item_offset); + //spacer ist not visible! + spacer->allowPaint(false); + cc_info->addCCItem(spacer); + //increase height of cc_info object with offset + int tmp_h = cc_info->getHeight(); + cc_info->setHeight(tmp_h + item_offset); } - - //set height for info form - h_tmp += item_height; } - //assign height of info form - cc_info->setHeight(h_tmp); } //get license @@ -307,25 +352,22 @@ void CImageInfo::InitInfoText(const std::string& text) int h_body = winbody->getHeight(); int w_body = winbody->getWidth(); - int y_lic = item_offset + cc_info->getHeight() + item_offset; - int h_lic = h_body - y_lic - item_offset; + //add a caption for info contents + Font * caption_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; + int caption_height = caption_font->getHeight(); + if (cc_sub_caption == NULL) + cc_sub_caption = new CComponentsLabel(cc_info->getXPos(), CC_APPEND, cc_info->getWidth(), caption_height, + g_Locale->getText(LOCALE_IMAGEINFO_LICENSE), CTextBox::AUTO_WIDTH, item_font); + if (!cc_sub_caption->isAdded()) + cc_win->addWindowItem(cc_sub_caption); + + //add info text box + int h_txt = h_body - item_offset - cc_info->getHeight() - cc_sub_caption->getHeight() - item_offset; if (cc_lic == NULL) - cc_lic = new CComponentsInfoBox(item_offset, cc_info->getYPos()+cc_info->getHeight()+item_offset, w_body-2*item_offset, h_lic); - cc_lic->setSpaceOffset(0); - cc_lic->setText(text, CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); - -#if 0 - //calc y pos of license box to avoid an overlap with pip - int h_info = cc_info->getHeight(); - int y_lic = std::max(h_info, cc_tv->getHeight() + 2*item_offset); - CComponentsForm *winbody = cc_win->getBodyObject(); - int h_lic = 0; - if (winbody) - h_lic = winbody->getHeight(); - cc_lic = new CComponentsInfoBox(item_offset, /*y_lic*/CC_APPEND, cc_win->getWidth()-2*item_offset, h_lic - h_info -item_offset); - cc_lic->setTextFromFile(file, CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); -#endif + cc_lic = new CComponentsInfoBox(CC_CENTERED, CC_APPEND, w_body-2*item_offset, h_txt); + cc_lic->setSpaceOffset(1); + cc_lic->setText(text, CTextBox::TOP | CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); //add text to container if (!cc_lic->isAdded()) @@ -349,8 +391,6 @@ void CImageInfo::ScrollLic(bool scrollDown) } } - - void CImageInfo::hide() { printf("[CImageInfo] [%s - %d] hide...\n", __FUNCTION__, __LINE__); diff --git a/src/gui/imageinfo.h b/src/gui/imageinfo.h index 2a5b671da..81c588bc2 100644 --- a/src/gui/imageinfo.h +++ b/src/gui/imageinfo.h @@ -33,6 +33,7 @@ #include #include +#include #include typedef struct image_info_t @@ -47,13 +48,17 @@ class CImageInfo : public CMenuTarget private: int item_offset; //distance between items and to boarder std::string license_txt; + Font* item_font; + int item_height; std::vector v_info; void Clean(); void Init(); + void InitInfoData(); void InitMinitv(); void InitInfos(); + void InitBuildInfos(); void InitInfoText(const std::string& text); std::string getLicenseText(); void ShowWindow(); @@ -63,7 +68,10 @@ class CImageInfo : public CMenuTarget CComponentsForm *cc_info; CComponentsPIP *cc_tv; CComponentsInfoBox *cc_lic; + CBuildInfo *b_info; CConfigFile config; + CComponentsButtonRed *btn_red; + CComponentsLabel *cc_sub_caption; public: diff --git a/src/gui/info_menue.cpp b/src/gui/info_menue.cpp index 6df35961f..e2add1b43 100644 --- a/src/gui/info_menue.cpp +++ b/src/gui/info_menue.cpp @@ -39,6 +39,10 @@ #include #include +#if 0 +#include +#endif + #include #include "gui/cam_menu.h" @@ -73,6 +77,7 @@ int CInfoMenu::showMenu() CDBoxInfoWidget boxinfo; CStreamInfo2 streaminfo; + info->addIntroItems(); CMenuForwarder * mf = new CMenuForwarder(LOCALE_SERVICEMENU_IMAGEINFO, true, NULL, &imageinfo, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED ); mf->setHint(NEUTRINO_ICON_HINT_IMAGEINFO, LOCALE_MENU_HINT_IMAGEINFO); @@ -85,13 +90,19 @@ int CInfoMenu::showMenu() mf = new CMenuForwarder(LOCALE_STREAMINFO_HEAD, !CNeutrinoApp::getInstance()->channelList->isEmpty(), NULL, &streaminfo, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); mf->setHint(NEUTRINO_ICON_HINT_STREAMINFO, LOCALE_MENU_HINT_STREAMINFO); info->addItem(mf); + +#if 0 + CBuildInfo buildinfo; + mf = new CMenuForwarder(LOCALE_BUILDINFO_MENU, true, NULL, &buildinfo, NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE ); + mf->setHint(NEUTRINO_ICON_HINT_IMAGEINFO, LOCALE_MENU_HINT_BUILDINFO); + info->addItem(mf); +#endif if (g_settings.easymenu) { mf = new CMenuForwarder(LOCALE_CI_SETTINGS, true, NULL, g_CamHandler, NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); mf->setHint(NEUTRINO_ICON_HINT_CI, LOCALE_MENU_HINT_CI); info->addItem(mf); } - int res = info->exec(NULL, ""); delete info; return res; diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index da738d1f0..f0aecadc6 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -779,6 +779,17 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings) settings->ytregion = configfile.getString("mb_ytregion", "default"); settings->ytsearch = configfile.getString("mb_ytsearch", ""); settings->ytvid = configfile.getString("mb_ytvid", ""); + settings->ytsearch_history_max = configfile.getInt32("mb_ytsearch_history_max", 10); + settings->ytsearch_history_size = configfile.getInt32("mb_ytsearch_history_size", 0); + if (settings->ytsearch_history_size > settings->ytsearch_history_max) + settings->ytsearch_history_size = settings->ytsearch_history_max; + settings->ytsearch_history.clear(); + for(int i = 0; i < settings->ytsearch_history_size; i++) { + std::string s = configfile.getString("mb_ytsearch_history_" + to_string(i)); + if (s != "") + settings->ytsearch_history.push_back(configfile.getString("mb_ytsearch_history_" + to_string(i), "")); + } + settings->ytsearch_history_size = settings->ytsearch_history.size(); return (result); } @@ -836,6 +847,15 @@ bool CMovieBrowser::saveSettings(MB_SETTINGS* settings) configfile.setString("mb_ytsearch", settings->ytsearch); configfile.setString("mb_ytvid", settings->ytvid); + settings->ytsearch_history_size = settings->ytsearch_history.size(); + if (settings->ytsearch_history_size > settings->ytsearch_history_max) + settings->ytsearch_history_size = settings->ytsearch_history_max; + configfile.setInt32("mb_ytsearch_history_max", settings->ytsearch_history_max); + configfile.setInt32("mb_ytsearch_history_size", settings->ytsearch_history_size); + std::list:: iterator it = settings->ytsearch_history.begin(); + for(int i = 0; i < settings->ytsearch_history_size; i++, ++it) + configfile.setString("mb_ytsearch_history_" + to_string(i), *it); + if (configfile.getModifiedFlag()) configfile.saveConfig(MOVIEBROWSER_SETTINGS_FILE); return (result); @@ -3640,6 +3660,55 @@ neutrino_locale_t CMovieBrowser::getFeedLocale(void) return ret; } +class CYTHistory : public CMenuTarget +{ + private: + int width; + int selected; + std::string *search; + MB_SETTINGS *settings; + public: + CYTHistory(MB_SETTINGS &_settings, std::string &_search); + int exec(CMenuTarget* parent, const std::string & actionKey); +}; + +CYTHistory::CYTHistory(MB_SETTINGS &_settings, std::string &_search) +{ + width = w_max (40, 10); + selected = -1; + settings = &_settings; + search = &_search; +} + +int CYTHistory::exec(CMenuTarget* parent, const std::string &actionKey) +{ + if (actionKey == "") { + if (parent) + parent->hide(); + CMenuWidget* m = new CMenuWidget(LOCALE_MOVIEBROWSER_YT_HISTORY, NEUTRINO_ICON_MOVIEPLAYER, width); + m->addKey(CRCInput::RC_spkr, this, "clear"); + m->setSelected(selected); + m->addItem(GenericMenuSeparator); + m->addItem(GenericMenuBack); + m->addItem(GenericMenuSeparatorLine); + std::list::iterator it = settings->ytsearch_history.begin(); + for (int i = 0; i < settings->ytsearch_history_size; i++, ++it) + m->addItem(new CMenuForwarderNonLocalized((*it).c_str(), true, NULL, this, (*it).c_str(), CRCInput::convertDigitToKey(i + 1))); + m->exec(NULL, ""); + m->hide(); + delete m; + return menu_return::RETURN_REPAINT; + } + if (actionKey == "clear") { + settings->ytsearch_history.clear(); + settings->ytsearch_history_size = 0; + return menu_return::RETURN_EXIT; + } + *search = actionKey; + g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_blue, 0); + return menu_return::RETURN_EXIT; +} + bool CMovieBrowser::showYTMenu() { m_pcWindow->paintBackground(); @@ -3664,18 +3733,23 @@ bool CMovieBrowser::showYTMenu() sprintf(cnt, "%d", cYTFeedParser::NEXT); mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_NEXT_RESULTS, ytparser.HaveNext(), NULL, selector, cnt, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); sprintf(cnt, "%d", cYTFeedParser::PREV); - mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_PREV_RESULTS, ytparser.HavePrev(), NULL, selector, cnt, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); + mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_PREV_RESULTS, ytparser.HavePrev(), NULL, selector, cnt, CRCInput::RC_nokey, "")); mainMenu.addItem(GenericMenuSeparatorLine); std::string search = m_settings.ytsearch; CStringInputSMS stringInput(LOCALE_MOVIEBROWSER_YT_SEARCH, &search, 20, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789 -_/()<>=+.,:!?\\'"); - mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_SEARCH, true, search, &stringInput, NULL, CRCInput::RC_nokey, "")); + mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_SEARCH, true, search, &stringInput, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); sprintf(cnt, "%d", cYTFeedParser::SEARCH); mainMenu.addItem(new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, selector, cnt, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE)); + CYTHistory ytHistory(m_settings, search); + if (m_settings.ytsearch_history_size > 0) + mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_HISTORY, true, NULL, &ytHistory, "", CRCInput::RC_0)); + mainMenu.addItem(GenericMenuSeparatorLine); mainMenu.addItem(new CMenuOptionNumberChooser(LOCALE_MOVIEBROWSER_YT_MAX_RESULTS, &m_settings.ytresults, true, 10, 50, NULL)); + mainMenu.addItem(new CMenuOptionNumberChooser(LOCALE_MOVIEBROWSER_YT_MAX_HISTORY, &m_settings.ytsearch_history_max, true, 10, 50, NULL)); char rstr[20]; sprintf(rstr, "%s", m_settings.ytregion.c_str()); @@ -3731,6 +3805,18 @@ bool CMovieBrowser::showYTMenu() reload = true; m_settings.ytsearch = search; m_settings.ytmode = newmode; + m_settings.ytsearch_history.push_front(search); + std::list::iterator it = m_settings.ytsearch_history.begin(); + it++; + while (it != m_settings.ytsearch_history.end()) { + if (*it == search) + it = m_settings.ytsearch_history.erase(it); + else + ++it; + } + m_settings.ytsearch_history_size = m_settings.ytsearch_history.size(); + if (m_settings.ytsearch_history_size > m_settings.ytsearch_history_max) + m_settings.ytsearch_history_size = m_settings.ytsearch_history_max; } } else if (m_settings.ytmode != newmode) { diff --git a/src/gui/moviebrowser.h b/src/gui/moviebrowser.h index 188eb95b5..2486bf0e5 100644 --- a/src/gui/moviebrowser.h +++ b/src/gui/moviebrowser.h @@ -73,6 +73,7 @@ #include #include +#include #include #include #include @@ -231,9 +232,12 @@ typedef struct int ytresults; int ytquality; int ytconcconn; + int ytsearch_history_size; + int ytsearch_history_max; std::string ytregion; std::string ytvid; std::string ytsearch; + std::list ytsearch_history; } MB_SETTINGS; // Priorities for Developmemt: P1: critical feature, P2: important feature, P3: for next release, P4: looks nice, lets see diff --git a/src/gui/network_setup.cpp b/src/gui/network_setup.cpp index 75fa1da60..b860de305 100644 --- a/src/gui/network_setup.cpp +++ b/src/gui/network_setup.cpp @@ -297,24 +297,8 @@ int CNetworkSetup::showNetworkSetup() networkSettings->addItem(o1); //set on start networkSettings->addItem(GenericMenuSeparatorLine); //------------------------------------------------ - networkSettings->addItem(mac); //eth id - networkSettings->addItem(GenericMenuSeparatorLine); - //------------------------------------------------- - networkSettings->addItem(o2); //dhcp on/off - networkSettings->addItem( m8); //hostname - networkSettings->addItem(GenericMenuSeparatorLine); - //------------------------------------------------- - networkSettings->addItem( m1); //adress - networkSettings->addItem( m2); //mask - networkSettings->addItem( m3); //broadcast - networkSettings->addItem(GenericMenuSeparatorLine); - //------------------------------------------------ - networkSettings->addItem( m4); //gateway - networkSettings->addItem( m5); //nameserver - //------------------------------------------------ if(ifcount > 1) // if there is only one, its probably wired { - networkSettings->addItem(GenericMenuSeparatorLine); //ssid CStringInputSMS * networkSettings_ssid = new CStringInputSMS(LOCALE_NETWORKMENU_SSID, &network_ssid, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789 -_/()<>=+.,:!?\\'"); //key @@ -334,10 +318,24 @@ int CNetworkSetup::showNetworkSetup() networkSettings->addItem( m11); //ssid scan networkSettings->addItem( m9); //ssid networkSettings->addItem( m10); //key - if (!g_settings.easymenu) - networkSettings->addItem(GenericMenuSeparatorLine); + networkSettings->addItem(GenericMenuSeparatorLine); } //------------------------------------------------ + networkSettings->addItem(mac); //eth id + networkSettings->addItem(GenericMenuSeparatorLine); + //------------------------------------------------- + networkSettings->addItem(o2); //dhcp on/off + networkSettings->addItem( m8); //hostname + networkSettings->addItem(GenericMenuSeparatorLine); + //------------------------------------------------- + networkSettings->addItem( m1); //adress + networkSettings->addItem( m2); //mask + networkSettings->addItem( m3); //broadcast + networkSettings->addItem(GenericMenuSeparatorLine); + //------------------------------------------------ + networkSettings->addItem( m4); //gateway + networkSettings->addItem( m5); //nameserver + //------------------------------------------------ sectionsdConfigNotifier = NULL; CMenuWidget ntp(LOCALE_MAINSETTINGS_NETWORK, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_NETWORKSETUP_NTP); #ifdef ENABLE_GUI_MOUNT diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index b32740862..119b47fc8 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -677,7 +677,12 @@ int CScanSetup::showFrontendSetup(int number) dmode = fe_config.diseqcType; char name[255]; - snprintf(name, sizeof(name), "%s %d: %s", g_Locale->getText(LOCALE_SATSETUP_FE_SETUP), number+1, fe->getInfo()->name); + if (g_settings.easymenu) + snprintf(name, sizeof(name), "%s %d: %s", g_Locale->getText(LOCALE_SATSETUP_FE_SETUP), number+1, + fe->getInfo()->type == FE_QPSK ? g_Locale->getText(LOCALE_SCANTS_ACTSATELLITE) + : g_Locale->getText(LOCALE_SCANTS_ACTCABLE)); + else + snprintf(name, sizeof(name), "%s %d: %s", g_Locale->getText(LOCALE_SATSETUP_FE_SETUP), number+1, fe->getInfo()->name); CMenuWidget * setupMenu = new CMenuWidget(name, NEUTRINO_ICON_SETTINGS, width); setupMenu->setSelected(feselected); diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 2d737fc89..c9894d958 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -782,7 +782,7 @@ long delta_time_ms (struct timeval *tv, struct timeval *last_tv) return timeval_to_ms (tv) - timeval_to_ms (last_tv); } -static cDemux * dmx; +static cDemux * dmx = NULL; int CStreamInfo2::ts_setup () { diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 295f2a357..43f39abd8 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -55,7 +55,7 @@ #include #include #include - +#include #if HAVE_COOL_HARDWARE extern int cs_test_card(int unit, char * str); @@ -76,6 +76,7 @@ CTestMenu::CTestMenu() window = NULL; button = NULL; clock = clock_r = NULL; + text_ext = NULL; } CTestMenu::~CTestMenu() @@ -93,6 +94,7 @@ CTestMenu::~CTestMenu() delete clock; delete clock_r; delete chnl_pic; + delete text_ext; } static int test_pos[4] = { 130, 192, 282, 360 }; @@ -470,8 +472,22 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) txt->paint(); return res; } + else if (actionKey == "text_ext"){ + if (text_ext == NULL) + text_ext = new CComponentsExtTextForm(); + text_ext->setDimensionsAll(10, 20, 300, 48); + text_ext->setLabelAndText("Label", "Text for demo", g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]); + text_ext->setFrameThickness(2); +// text_ext->setLabelWidthPercent(15/*%*/); + + if (text_ext->isPainted()) + text_ext->hide(); + else + text_ext->paint(); + return res; + } else if (actionKey == "header"){ - int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + int hh = 30;//g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); if (header == NULL){ header = new CComponentsHeader (100, 50, 500, hh, "Test-Header"/*, NEUTRINO_ICON_INFO, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU*/); // header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); @@ -664,6 +680,11 @@ int CTestMenu::showTestMenu() CMenuWidget * w_cc = new CMenuWidget("OSD-Components Demo", NEUTRINO_ICON_INFO, width, MN_WIDGET_ID_TESTMENU_COMPONENTS); w_test.addItem(new CMenuForwarderNonLocalized(w_cc->getName().c_str(), true, NULL, w_cc)); showCCTests(w_cc); + + //buildinfo + CMenuForwarder *f_bi = new CMenuForwarder(LOCALE_BUILDINFO_MENU, true, NULL, new CBuildInfo()); + f_bi->setHint(NEUTRINO_ICON_HINT_IMAGEINFO, LOCALE_MENU_HINT_BUILDINFO); + w_test.addItem(f_bi); //exit return w_test.exec(NULL, "");; @@ -685,6 +706,7 @@ void CTestMenu::showCCTests(CMenuWidget *widget) widget->addItem(new CMenuForwarderNonLocalized("Footer", true, NULL, this, "footer")); widget->addItem(new CMenuForwarderNonLocalized("Icon-Form", true, NULL, this, "iconform")); widget->addItem(new CMenuForwarderNonLocalized("Window", true, NULL, this, "window")); + widget->addItem(new CMenuForwarderNonLocalized("Text-Extended", true, NULL, this, "text_ext")); } void CTestMenu::showHWTests(CMenuWidget *widget) diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index b77bd9294..10869fe83 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -52,6 +52,7 @@ class CTestMenu : public CMenuTarget CComponentsButton *button; CComponentsFrmClock *clock ,*clock_r; CComponentsChannelLogo* chnl_pic; + CComponentsExtTextForm* text_ext; int width, selected; int showTestMenu(); diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 71a0ae94a..e60946120 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -178,6 +178,7 @@ void CTextBox::initVar(void) m_textBackgroundColor = m_old_textBackgroundColor = COL_MENUCONTENT_PLUS_0; m_textColor = COL_MENUCONTENT_TEXT; + m_old_textColor = 0; m_nPaintBackground = true; m_nBgRadius = m_old_nBgRadius = 0; m_nBgRadiusType = m_old_nBgRadiusType = CORNER_ALL; @@ -517,6 +518,7 @@ bool CTextBox::hasChanged(int* x, int* y, int* dx, int* dy) || m_old_dx != *dx || m_old_dy != *dy || m_old_textBackgroundColor != m_textBackgroundColor + || m_old_textColor != m_textColor || m_old_nBgRadius != m_nBgRadius || m_old_nBgRadiusType != m_nBgRadiusType || m_old_nMode != m_nMode){ @@ -531,9 +533,11 @@ void CTextBox::reInitToCompareVar(int* x, int* y, int* dx, int* dy) m_old_dx = *dx; m_old_dy = *dy; m_old_textBackgroundColor = m_textBackgroundColor; + m_old_textColor = m_textColor; m_old_nBgRadius = m_nBgRadius; m_old_nBgRadiusType = m_nBgRadiusType; m_old_nMode = m_nMode; + m_old_cText = m_cText; } void CTextBox::refreshText(void) @@ -699,12 +703,14 @@ void CTextBox::refresh(void) } -bool CTextBox::setText(const std::string* newText, int max_width) +bool CTextBox::setText(const std::string* newText, int max_width, bool force_repaint) { //TRACE("[CTextBox]->SetText \r\n"); bool result = false; m_nMaxTextWidth = max_width; - + //reset text to force repaint the text, managed in hasChanged() + if (force_repaint) + m_old_cText = ""; //printf("setText: _max_width %d max_width %d\n", _max_width, max_width); if (newText != NULL) { diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h index 044c82b55..b748e9f84 100644 --- a/src/gui/widget/textbox.h +++ b/src/gui/widget/textbox.h @@ -114,7 +114,7 @@ class CTextBox void refreshText(void); void reSizeMainFrameWidth(int maxTextWidth); void reSizeMainFrameHeight(int maxTextHeight); - int getFontTextHeight(); + bool hasChanged(int* x, int* y, int* dx, int* dy); void reInitToCompareVar(int* x, int* y, int* dx, int* dy); @@ -124,7 +124,7 @@ class CTextBox int m_old_x, m_old_y, m_old_dx, m_old_dy, m_old_nBgRadius, m_old_nBgRadiusType, m_old_nMode; bool m_has_scrolled; - fb_pixel_t m_old_textBackgroundColor; + fb_pixel_t m_old_textBackgroundColor, m_old_textColor; bool m_showTextFrame; @@ -183,7 +183,7 @@ class CTextBox void scrollPageDown(const int pages); void scrollPageUp(const int pages); void enableBackgroundPaint(bool mode = true){m_nPaintBackground = mode;}; - bool setText(const std::string* newText, int max_width = 0); + bool setText(const std::string* newText, int max_width = 0, bool force_repaint = true); void setTextColor(fb_pixel_t color_text){ m_textColor = color_text;}; void setBackGroundRadius(const int radius, const int type = CORNER_ALL){m_nBgRadius = radius; m_nBgRadiusType = type;}; void setTextBorderWidth(int Hborder, int Vborder); @@ -202,7 +202,8 @@ class CTextBox inline int getLinesPerPage(void) {return m_nLinesPerPage;}; inline int getPages(void) {return(m_nNrOfPages);}; inline void movePosition(int x, int y) {m_cFrame.iX = x; m_cFrame.iY = y;}; - + int getFontTextHeight(); + void paint (void); void hide (void); }; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 3d281da8b..0b4067a50 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3438,7 +3438,8 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) if(!g_settings.epg_scan && !fromDeepStandby && !CRecordManager::getInstance()->RecordingStatus() && !stream_status) { g_Zapit->setStandby(true); } else { - g_Zapit->stopPlayBack(); + //g_Zapit->stopPlayBack(); + g_Zapit->lockPlayBack(); } videoDecoder->Standby(true); @@ -3518,6 +3519,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->setBacklight(g_settings.backlight_tv); + CZapit::getInstance()->EnablePlayback(true); g_Zapit->setStandby(false); /* the old code did: if(was_record) g_Zapit->startPlayBack() diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index f24db04ee..92e490b11 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -149,9 +149,14 @@ void CNeutrinoApp::InitMenuMain() mb->setHint(NEUTRINO_ICON_HINT_MB, LOCALE_MENU_HINT_MB); personalize.addItem(MENU_MAIN, mb, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_MBROWSER]); } +#if 0 CMenuForwarder *cl = new CMenuForwarder(LOCALE_MAINMENU_CHANNELS, true, NULL, this, "channels", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); cl->setHint(NEUTRINO_ICON_HINT_TVMODE, LOCALE_MENU_HINT_CHANNELS); - personalize.addItem(MENU_MAIN, cl); //, &g_settings.personalize[SNeutrinoSettings::P_MAIN_TV_RADIO_MODE]); + personalize.addItem(MENU_MAIN, cl); +#endif + CMenuForwarder * mf = new CMenuForwarder(LOCALE_BOUQUETEDITOR_NAME , true, NULL, new CBEBouquetWidget(), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + mf->setHint(NEUTRINO_ICON_HINT_BEDIT, LOCALE_MENU_HINT_BEDIT); + personalize.addItem(MENU_MAIN, mf, &g_settings.personalize[SNeutrinoSettings::P_MSER_BOUQUET_EDIT], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION); } else { //tv <-> radio toggle CMenuForwarder *tvradio_switch = new CMenuForwarder(LOCALE_MAINMENU_TVRADIO_SWITCH, true, NULL, this, "tv_radio_switch", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); @@ -470,21 +475,20 @@ void CNeutrinoApp::InitMenuService() //bouquet edit // TODO: this needs a neutrino restart after changing parentallock_prompt to activate :-( - CLockedMenuForwarder *lf; - if (g_settings.easymenu) - lf = new CLockedMenuForwarder(LOCALE_BOUQUETEDITOR_NAME, g_settings.parentallock_pincode, g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED, true, NULL, new CBEBouquetWidget(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); - else + if (!g_settings.easymenu) { + CLockedMenuForwarder *lf; lf = new CLockedMenuForwarder(LOCALE_BOUQUETEDITOR_NAME, g_settings.parentallock_pincode, g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED, true, NULL, new CBEBouquetWidget(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); -/* does not work with CLockedMenuForwarder yet? - lf->setHint(NEUTRINO_ICON_HINT_BEDIT, LOCALE_MENU_HINT_BEDIT); - */ - personalize.addItem(MENU_SERVICE, lf, &g_settings.personalize[SNeutrinoSettings::P_MSER_BOUQUET_EDIT]); + /* does not work with CLockedMenuForwarder yet? + lf->setHint(NEUTRINO_ICON_HINT_BEDIT, LOCALE_MENU_HINT_BEDIT); + */ + personalize.addItem(MENU_SERVICE, lf, &g_settings.personalize[SNeutrinoSettings::P_MSER_BOUQUET_EDIT]); + } //channel reset CDataResetNotifier *resetNotifier = new CDataResetNotifier(); if (g_settings.easymenu) - mf = new CMenuForwarder(LOCALE_RESET_CHANNELS , true, NULL, resetNotifier, "channels", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); + mf = new CMenuForwarder(LOCALE_RESET_CHANNELS , true, NULL, resetNotifier, "channels", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); else mf = new CMenuForwarder(LOCALE_RESET_CHANNELS , true, NULL, resetNotifier, "channels"); @@ -526,7 +530,11 @@ void CNeutrinoApp::InitMenuService() } //firmware update - mf = new CMenuForwarder(LOCALE_SERVICEMENU_UPDATE, true, NULL, new CSoftwareUpdate()); + if (g_settings.easymenu) + mf = new CMenuForwarder(LOCALE_SERVICEMENU_UPDATE, true, NULL, new CSoftwareUpdate(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); + else + mf = new CMenuForwarder(LOCALE_SERVICEMENU_UPDATE, true, NULL, new CSoftwareUpdate()); + mf->setHint(NEUTRINO_ICON_HINT_SW_UPDATE, LOCALE_MENU_HINT_SW_UPDATE); personalize.addItem(MENU_SERVICE, mf, &g_settings.personalize[SNeutrinoSettings::P_MSER_SOFTUPDATE]); } diff --git a/src/system/helpers.h b/src/system/helpers.h index 8bf4babfb..d9d4b6108 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -24,7 +24,8 @@ #include #include - +#include + int my_system(const char * cmd); int my_system(int argc, const char *arg, ...); /* argc is number of arguments including command */ @@ -64,4 +65,11 @@ class CFileHelpers }; +template std::string to_string(C i) +{ + std::stringstream s; + s << i; + return s.str(); +} + #endif diff --git a/src/system/locals.h b/src/system/locals.h index c60336345..53293eafc 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -227,6 +227,12 @@ typedef enum LOCALE_BOUQUETNAME_NEW, LOCALE_BOUQUETNAME_OTHER, LOCALE_BOUQUETNAME_REMOVED, + LOCALE_BUILDINFO_COMPILED_ON, + LOCALE_BUILDINFO_COMPILED_WITH, + LOCALE_BUILDINFO_COMPILER_FLAGS, + LOCALE_BUILDINFO_CREATOR, + LOCALE_BUILDINFO_KERNEL, + LOCALE_BUILDINFO_MENU, LOCALE_CABLESETUP_PROVIDER, LOCALE_CHANNELLIST_ADDITIONAL, LOCALE_CHANNELLIST_ADDITIONAL_OFF, @@ -815,6 +821,7 @@ typedef enum LOCALE_MENU_HINT_BACKLIGHT, LOCALE_MENU_HINT_BACKUP, LOCALE_MENU_HINT_BEDIT, + LOCALE_MENU_HINT_BUILDINFO, LOCALE_MENU_HINT_CACHE_TXT, LOCALE_MENU_HINT_CEC_MODE, LOCALE_MENU_HINT_CEC_STANDBY, @@ -1439,6 +1446,8 @@ typedef enum LOCALE_MOVIEBROWSER_USE_REC_DIR, LOCALE_MOVIEBROWSER_YT_CONCURRENT_CONNECTIONS, LOCALE_MOVIEBROWSER_YT_ERROR, + LOCALE_MOVIEBROWSER_YT_HISTORY, + LOCALE_MOVIEBROWSER_YT_MAX_HISTORY, LOCALE_MOVIEBROWSER_YT_MAX_RESULTS, LOCALE_MOVIEBROWSER_YT_MOST_DISCUSSED, LOCALE_MOVIEBROWSER_YT_MOST_POPULAR, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 9c884333d..7e3fa0456 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -227,6 +227,12 @@ const char * locale_real_names[] = "bouquetname.new", "bouquetname.other", "bouquetname.removed", + "buildinfo.compiled_on", + "buildinfo.compiled_with", + "buildinfo.compiler_flags", + "buildinfo.creator", + "buildinfo.kernel", + "buildinfo.menu", "cablesetup.provider", "channellist.additional", "channellist.additional_off", @@ -815,6 +821,7 @@ const char * locale_real_names[] = "menu.hint_backlight", "menu.hint_backup", "menu.hint_bedit", + "menu.hint_buildinfo", "menu.hint_cache_txt", "menu.hint_cec_mode", "menu.hint_cec_standby", @@ -1439,6 +1446,8 @@ const char * locale_real_names[] = "moviebrowser.use_rec_dir", "moviebrowser.yt_concurrent_connections", "moviebrowser.yt_error", + "moviebrowser.yt_history", + "moviebrowser.yt_max_history", "moviebrowser.yt_max_results", "moviebrowser.yt_most_discussed", "moviebrowser.yt_most_popular",