diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 4a45755ef..52fffd1d9 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -256,6 +256,8 @@ ci.reset_standby Reset nach Standby ci.settings Zugangskontrolle ci.timeout CAM antwortet nicht ci.waiting Warte auf CAM-Antwort +clock_size Info Uhr +clock_size_height Höhe der Anzeige clock_switch_off Uhr ausblenden clock_switch_on Uhr einblenden colorchooser.alpha alpha @@ -327,7 +329,9 @@ epgviewer.length Spieldauer (Min.) epgviewer.nodetailed Keine ausführlichen Informationen verfügbar epgviewer.notfound Keine Programminformationen (EPG) gefunden eventfinder.head EPG-Suche +eventfinder.history Frühere Suchen eventfinder.keyword Suche nach Textpassage +eventfinder.max_history Max. Anzahl früherer Suchen eventfinder.search Suche eventfinder.search_all_epg Ganze eventfinder.search_within_epg Suche innerhalb EPG-Daten @@ -808,6 +812,7 @@ menu.hint_channellist_foot Definiert, welche Informationen im unteren Sendungsfe menu.hint_channellist_setup Wählen Sie die Anzeigeoptionen für die Kanalliste menu.hint_channels Kanalliste öffnen menu.hint_ci Conditional-Access-Menü zum Einrichten Ihres CI-Moduls oder der eingebetteten Conax-Karte +menu.hint_clock_size Stellen Sie die Größe der Info Uhr ein. menu.hint_colors Konfigurieren Sie die Menü-Farben menu.hint_content_back Ändern Sie die Hintergrundfarbe für den Fensterinhalt menu.hint_content_textcolor Ändern Sie die Textfarbe für den Fensterinhalt @@ -873,6 +878,7 @@ menu.hint_infobar_sat Zeigt die aktuellen Satelliten- oder Kabel-Provider menu.hint_infobar_setup Wählen Sie die Anzeigeoptionen für die Infobar aus menu.hint_infobar_textcolor Ändern Sie die Textfarbe für die Infobar menu.hint_infobar_tuner Zeigt den aktiven Tuner als Nummernicon +menu.hint_infoclock_setup Wählen Sie die Anzeigeoptionen für die Info Uhr menu.hint_keep_numbers Mit der Aktivierung werden den Sendern feste/dauerhafte Kanalnummern zugewiesen menu.hint_key_addrecord Weisen Sie eine Taste für das Starten und Markieren von Aufnahmen im EPG zu menu.hint_key_addremind Weisen Sie eine Taste für das Umschalten im EPG über den Timer zu @@ -1236,6 +1242,7 @@ miscsettings.infobar_show_res Auflösung anzeigen miscsettings.infobar_show_res_simple einfach miscsettings.infobar_show_sysfs_hdd Füllstandanzeige (sysFS & hdd) miscsettings.infobar_show_tuner Aktiven Tuner anzeigen +miscsettings.infoclock Info Uhr miscsettings.progressbar Fortschrittsbalken miscsettings.progressbar_color Farbe miscsettings.progressbar_design Design @@ -1418,9 +1425,9 @@ 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_error Fehler beim laden des Youtube Feed 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 moviebrowser.yt_most_popular Beliebteste Videos @@ -1429,6 +1436,11 @@ moviebrowser.yt_most_responded Feeds mit den meisten Reaktionen moviebrowser.yt_most_shared Am häufigsten wiedergegebe Videos moviebrowser.yt_next_results Nächste Ergebnisse moviebrowser.yt_on_the_web Trendvideos +moviebrowser.yt_orderby Sortierung nach +moviebrowser.yt_orderby.published Veröffentlichungszeitpunkt +moviebrowser.yt_orderby.rating Bewertung +moviebrowser.yt_orderby.relevance Relevanz +moviebrowser.yt_orderby.viewcount Zahl der Views moviebrowser.yt_pref_quality Bevorzugte Qualität moviebrowser.yt_prev_results Vorherige Ergebnisse moviebrowser.yt_recently_featured Vor kurzem empfohlen diff --git a/data/locale/english.locale b/data/locale/english.locale index fceb13bab..72bef7ade 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -256,6 +256,8 @@ ci.reset_standby Reset after standby ci.settings Conditional access ci.timeout Timeout waiting CI menu ready ci.waiting Waiting for CI answer +clock_size Info clock +clock_size_height Display height clock_switch_off Clock off clock_switch_on Clock on colorchooser.alpha alpha @@ -327,7 +329,9 @@ epgviewer.length Length (min.) epgviewer.nodetailed No detailed informations available epgviewer.notfound No EPG found eventfinder.head Search in EPG +eventfinder.history Search history eventfinder.keyword Keyword +eventfinder.max_history Max results to fetch eventfinder.search Search eventfinder.search_all_epg whole eventfinder.search_within_epg Search within @@ -808,6 +812,7 @@ menu.hint_channellist_foot Show additional information\nin bottom box menu.hint_channellist_setup Configure channel list GUI options menu.hint_channels Open channel list menu.hint_ci Conditional access menu\nto setup your CI CAM or embeded Conax card +menu.hint_clock_size Set the size of the info clock. menu.hint_colors Configure GUI colors menu.hint_content_back Change GUI window background color menu.hint_content_textcolor Change GUI window text color @@ -873,6 +878,7 @@ menu.hint_infobar_sat Show current satellite or cable provider menu.hint_infobar_setup Configure infobar options menu.hint_infobar_textcolor Change infobar text color menu.hint_infobar_tuner Show active tuner number icon +menu.hint_infoclock_setup Configure info clock GUI options menu.hint_keep_numbers Keep channel numbers over next scans\nand bouquets editing menu.hint_key_addrecord Assign button to add record timer\nfrom event list menu.hint_key_addremind Assign button to add zap timer\nfrom event list @@ -1236,6 +1242,7 @@ miscsettings.infobar_show_res show resolution on infobar miscsettings.infobar_show_res_simple simple miscsettings.infobar_show_sysfs_hdd Fill level (sysFS & hdd) miscsettings.infobar_show_tuner Display active tuner +miscsettings.infoclock Info clock miscsettings.progressbar Progressbar miscsettings.progressbar_color Color miscsettings.progressbar_design Design @@ -1429,6 +1436,11 @@ moviebrowser.yt_most_responded Most responded moviebrowser.yt_most_shared Most shared moviebrowser.yt_next_results Next results moviebrowser.yt_on_the_web Trending videos +moviebrowser.yt_orderby Order by +moviebrowser.yt_orderby.published publishing date +moviebrowser.yt_orderby.rating rating +moviebrowser.yt_orderby.relevance relevance +moviebrowser.yt_orderby.viewcount view count moviebrowser.yt_pref_quality Prefered quality moviebrowser.yt_prev_results Previous results moviebrowser.yt_recently_featured Recently featured diff --git a/lib/libcoolstream2/audio_cs.h b/lib/libcoolstream2/audio_cs.h index a5aa5d866..0574eb588 100644 --- a/lib/libcoolstream2/audio_cs.h +++ b/lib/libcoolstream2/audio_cs.h @@ -44,20 +44,26 @@ typedef enum { HDMI_ENCODED_FORCED } HDMI_ENCODED_MODE; -typedef enum -{ +typedef enum { HDMI_AUDIO_FMT_LPCM = 0x1, - HDMI_AUDIO_FMT_AC3 , - HDMI_AUDIO_FMT_MPEG1 , - HDMI_AUDIO_FMT_MP3 , - HDMI_AUDIO_FMT_MPEG2 , - HDMI_AUDIO_FMT_AAC , - HDMI_AUDIO_FMT_DTS , - HDMI_AUDIO_FMT_ATRAC + HDMI_AUDIO_FMT_AC3, + HDMI_AUDIO_FMT_MPEG1, + HDMI_AUDIO_FMT_MP3, + HDMI_AUDIO_FMT_MPEG2, + HDMI_AUDIO_FMT_AAC, + HDMI_AUDIO_FMT_DTS, + HDMI_AUDIO_FMT_ATRAC, + HDMI_AUDIO_FMT_ONE_BIT, + HDMI_AUDIO_FMT_DD_PLUS, + HDMI_AUDIO_FMT_DTS_HD, + HDMI_AUDIO_FMT_MAT, + HDMI_AUDIO_FMT_DST, + HDMI_AUDIO_FMT_WMA_PRO, + HDMI_AUDIO_FMT_LAST = HDMI_AUDIO_FMT_WMA_PRO } HDMI_AUDIO_FORMAT; #define CS_MAX_AUDIO_DECODERS 1 -#define CS_MAX_AUDIO_FORMATS 10 +#define CS_MAX_AUDIO_FORMATS HDMI_AUDIO_FMT_LAST typedef struct cs_audio_format { HDMI_AUDIO_FORMAT format; @@ -73,6 +79,7 @@ class cDemux; class cVideo; class cAudio { +friend class cVideo; private: static cAudio *instance[CS_MAX_AUDIO_DECODERS]; unsigned int unit; diff --git a/lib/libcoolstream2/playback_cs.h b/lib/libcoolstream2/playback_cs.h index 5a5c61fb6..1f7ded7bd 100644 --- a/lib/libcoolstream2/playback_cs.h +++ b/lib/libcoolstream2/playback_cs.h @@ -12,6 +12,7 @@ #include #include +#include #include typedef enum { diff --git a/lib/libcoolstream2/video_cs.h b/lib/libcoolstream2/video_cs.h index e7aba1ba8..07310e313 100644 --- a/lib/libcoolstream2/video_cs.h +++ b/lib/libcoolstream2/video_cs.h @@ -223,10 +223,10 @@ public: /* get play state */ int getPlayState(void); - void SetVPPDelay(unsigned int delay) { uVPPDisplayDelay = delay;}; + void SetVPPDelay(unsigned int delay) { uVPPDisplayDelay = delay; } void SetVideoDelay(unsigned int delay) { uVideoPTSDelay = delay;}; /* Notification handlers */ - void HandleVPPMessage(int Event, void *pData); + void HandleVPPMessage(void *hHandle, int Event, void *pData); void HandleVideoMessage(void * hHandle, int Event, void *pData); void HandleEncoderMessage(void *hHandle, int Event, void *pData); VIDEO_DEFINITION GetVideoDef(void) { return VideoDefinition; } @@ -270,6 +270,7 @@ public: bool GetScreenImage(unsigned char * &data, int &xres, int &yres, bool get_video = true, bool get_osd = false, bool scale_to_video = false); void SetDemux(cDemux *Demux); static cVideo *GetDecoder(unsigned int Unit); + bool SyncSTC(void); }; #endif // __VIDEO_CS_H_ diff --git a/src/driver/audiodec/mp3dec.cpp b/src/driver/audiodec/mp3dec.cpp index cd052fa92..07a315fd9 100644 --- a/src/driver/audiodec/mp3dec.cpp +++ b/src/driver/audiodec/mp3dec.cpp @@ -42,6 +42,7 @@ #endif #include +#include #include #include #include @@ -1346,10 +1347,11 @@ void CMP3Dec::GetID3(FILE* in, CAudioMetaData* const m) } } +static int cover_count = 0; + 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); @@ -1384,11 +1386,17 @@ bool CMP3Dec::SaveCover(FILE * in, CAudioMetaData * const m) data = id3_field_getbinarydata(field, &size); if ( data ) { - m->cover = coverfile; + std::ostringstream cover; + cover.str(""); + cover << "/tmp/cover_" << cover_count++ << ".jpg"; FILE * pFile; - pFile = fopen ( coverfile , "wb" ); - fwrite (data , 1 , size , pFile ); - fclose (pFile); + pFile = fopen ( cover.str().c_str() , "wb" ); + if (pFile) + { + fwrite (data , 1 , size , pFile ); + fclose (pFile); + m->cover = cover.str().c_str(); + } } break; diff --git a/src/driver/fontrenderer.cpp b/src/driver/fontrenderer.cpp index af90ddcd8..53e8c7264 100644 --- a/src/driver/fontrenderer.cpp +++ b/src/driver/fontrenderer.cpp @@ -230,6 +230,8 @@ Font::Font(FBFontRenderClass *render, FTC_FaceID faceid, const int isize, const //font.image_type |= ftc_image_flag_autohinted; font.flags = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT; + maxdigitwidth = 0; + scaler.face_id = font.face_id; scaler.width = isize * 64; scaler.height = isize * 64; @@ -318,6 +320,21 @@ int Font::getDigitOffset(void) return DigitOffset; } +int Font::getMaxDigitWidth(void) +{ + if (maxdigitwidth < 1) { + char b[2]; + b[1] = 0; + for (char c = '0'; c <= '9'; c++) { + *b = c; + int w = getRenderWidth(b, true); + if (w > maxdigitwidth) + maxdigitwidth = w; + } + } + return maxdigitwidth; +} + int UTF8ToUnicode(const char * &text, const bool utf8_encoded) // returns -1 on error { int unicode_value; diff --git a/src/driver/fontrenderer.h b/src/driver/fontrenderer.h index 124de9632..fa1f97ae1 100644 --- a/src/driver/fontrenderer.h +++ b/src/driver/fontrenderer.h @@ -53,6 +53,7 @@ class Font // these are HACKED values, because the font metrics were unusable. int height,DigitHeight,DigitOffset,ascender,descender,upper,lower; int fontwidth; + int maxdigitwidth; inline void paintFontPixel(fb_pixel_t *td, uint8_t fg_trans, uint8_t fg_red, uint8_t fg_green, uint8_t fg_blue, fb_pixel_t bg_col, int faktor, uint8_t index); @@ -71,6 +72,7 @@ class Font int getRenderWidth(const std::string & text, const bool utf8_encoded = false); int getHeight(void); int getDigitHeight(void); + int getMaxDigitWidth(void); int getDigitOffset(void); int getWidth(void); int getSize(){return font.width;} diff --git a/src/driver/neutrinofonts.h b/src/driver/neutrinofonts.h index e5c99d55e..ce6e623c2 100644 --- a/src/driver/neutrinofonts.h +++ b/src/driver/neutrinofonts.h @@ -91,6 +91,7 @@ class CNeutrinoFonts }; enum { FONT_ID_VOLBAR, + FONT_ID_INFOCLOCK, FONT_ID_MAX }; diff --git a/src/driver/vfd.cpp b/src/driver/vfd.cpp index 464639b4a..cf7063b78 100644 --- a/src/driver/vfd.cpp +++ b/src/driver/vfd.cpp @@ -385,7 +385,7 @@ void CVFD::showPercentOver(const unsigned char perc, const bool /*perform_update { if(!has_lcd) return; - if ((mode == MODE_TVRADIO) && !(g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME])) { + if (((mode == MODE_TVRADIO) || (mode == MODE_MENU_UTF8)) && !(g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME])) { //if (g_settings.lcd_setting[SNeutrinoSettings::LCD_SHOW_VOLUME] == 0) { ShowIcon(FP_ICON_FRAME, true); diff --git a/src/gui/audiomute.cpp b/src/gui/audiomute.cpp index 88c0533e8..bd02bf968 100644 --- a/src/gui/audiomute.cpp +++ b/src/gui/audiomute.cpp @@ -64,6 +64,9 @@ void CAudioMute::AudioMute(int newValue, bool isEvent) if( isEvent && ( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_pic)) { + if (doInit) + CVolumeHelper::getInstance()->refresh(); + CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height); if ((y_old != y)) { if (do_paint_mute_icon) @@ -90,15 +93,13 @@ void CAudioMute::AudioMute(int newValue, bool isEvent) frameBuffer->setFbArea(CFrameBuffer::FB_PAINTAREA_MUTEICON1); } frameBuffer->fbNoCheck(false); - - if (doInit) - CVolumeHelper::getInstance()->refresh(); } } void CAudioMute::enableMuteIcon(bool enable) { CNeutrinoApp *neutrino = CNeutrinoApp::getInstance(); + CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height); frameBuffer->fbNoCheck(true); if (enable) { frameBuffer->doPaintMuteIcon(true); diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index ae1c706de..05836d205 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -966,6 +966,10 @@ bool CAudioPlayerGui::clearPlaylist(void) { bool result = false; + CAudioPlayList::const_iterator it; + for (it = m_playlist.begin(); it!=m_playlist.end(); ++it) + unlink(it->MetaData.cover.c_str()); + if (!(m_playlist.empty())) { m_playlist.clear(); @@ -1778,21 +1782,25 @@ void CAudioPlayerGui::paintInfo() return; int c_rad_mid = RADIUS_MID; + int title_height = m_title_height; + if (m_state == CAudioPlayerGui::STOP && m_show_playlist) m_frameBuffer->paintBackgroundBoxRel(m_x, m_y, m_width, m_title_height); else { - if (!m_show_playlist) - { - // no playlist -> smaller Info-Box - m_frameBuffer->paintBoxRel(m_x + 1, m_y + 1 , m_width - 2, m_title_height - 12 - m_fheight, COL_MENUCONTENTSELECTED_PLUS_0, c_rad_mid); - m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10 - m_fheight, 2, COL_MENUCONTENT_PLUS_6, c_rad_mid); - } - else - { - m_frameBuffer->paintBoxRel(m_x + 1, m_y + 1 , m_width - 2, m_title_height - 12, COL_MENUCONTENTSELECTED_PLUS_0, c_rad_mid); - m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10, 2, COL_MENUCONTENT_PLUS_6, c_rad_mid); - } + if (!m_show_playlist) // no playlist -> smaller Info-Box + title_height -= m_fheight; + + m_frameBuffer->paintBoxRel(m_x + 1, m_y + 1 , m_width - 2, title_height - 12, COL_MENUCONTENTSELECTED_PLUS_0, c_rad_mid); + m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, title_height - 10, 2, COL_MENUCONTENT_PLUS_6, c_rad_mid); + + std::string cover = m_curr_audiofile.Filename.substr(0, m_curr_audiofile.Filename.rfind('/')) + "/folder.jpg"; + + if (!m_curr_audiofile.MetaData.cover.empty()) + cover = m_curr_audiofile.MetaData.cover; + + if (access(cover.c_str(), F_OK) == 0) + g_PicViewer->DisplayImage(cover, m_x + 2 + c_rad_mid/2, m_y + 2 + c_rad_mid/2, title_height - 14 - c_rad_mid, title_height - 14 - c_rad_mid, m_frameBuffer->TM_NONE); // first line (Track number) std::string tmp; @@ -2171,25 +2179,6 @@ 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) @@ -2485,7 +2474,7 @@ void CAudioPlayerGui::removeFromPlaylist(long pos) // must be called before m_playlist.erase() firstChar = getFirstChar(m_playlist[pos]); } - + unlink(m_playlist[pos].MetaData.cover.c_str()); m_playlist.erase(m_playlist.begin() + pos); m_playlistHasChanged = true; diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index 45e42b6f0..271a1224f 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -135,7 +135,7 @@ int CCAMMenuHandler::doMainMenu() } else { snprintf(str1, sizeof(str1), "%s %d", g_Locale->getText(LOCALE_CI_EMPTY), i); tempMenu = new CMenuWidget(str1, NEUTRINO_ICON_SETTINGS); - cammenu->addItem(new CMenuForwarderNonLocalized(str1, false, NULL, tempMenu)); + cammenu->addItem(new CMenuDForwarderNonLocalized(str1, false, NULL, tempMenu)); memset(str1,0,sizeof(str1)); } if (i < (CiSlots - 1)) @@ -166,7 +166,7 @@ int CCAMMenuHandler::doMainMenu() } else { snprintf(str1, sizeof(str1), "%s %d", g_Locale->getText(LOCALE_SC_EMPTY), i); tempMenu = new CMenuWidget(str1, NEUTRINO_ICON_SETTINGS); - cammenu->addItem(new CMenuForwarderNonLocalized(str1, false, NULL, tempMenu)); + cammenu->addItem(new CMenuDForwarderNonLocalized(str1, false, NULL, tempMenu)); memset(str1,0,sizeof(str1)); } if (i < (ScNum - 1)) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index f31430bc3..36274304e 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1383,7 +1383,7 @@ int CChannelList::numericZap(int key) return res; } size_t maxchansize = MaxChanNr().size(); - int fw = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getRenderWidth(widest_number); + int fw = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getMaxDigitWidth(); int sx = maxchansize * fw + (fw/2); int sy = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNEL_NUM_ZAP]->getHeight() + 6; @@ -1760,7 +1760,7 @@ void CChannelList::paintItem2DetailsLine (int pos) if (pos >= 0) { if (dline == NULL) dline = new CComponentsDetailLine(xpos, ypos1, ypos2, fheight/2+1, info_height-RADIUS_LARGE*2); - dline->paint(); + dline->paint(false); } } @@ -1770,7 +1770,9 @@ void CChannelList::showChannelLogo() static int logo_w = 0; static int logo_h = 0; int logo_w_max = full_width / 4; - frameBuffer->paintBoxRel(x + full_width - logo_off - logo_w, y+(theight-logo_h)/2, logo_w, logo_h, COL_MENUHEAD_PLUS_0); + + if (logo_w && logo_h) + frameBuffer->paintBoxRel(x + full_width - logo_off - logo_w, y+(theight-logo_h)/2, logo_w, logo_h, COL_MENUHEAD_PLUS_0); std::string lname; if(g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->getName(), lname, &logo_w, &logo_h)) { @@ -2130,7 +2132,7 @@ void CChannelList::paintHead() headerClock->setClockIntervall(10); } - headerClock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]); + headerClock->setClockFont(SNeutrinoSettings::FONT_TYPE_MENU_TITLE); headerClock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); headerClock->setYPos(y); headerClock->setHeight(theight); diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index bc2e1fbee..0e01f5e34 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -108,14 +108,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)){ -// printf(" [CComponents] WARNING:\n [%s - %d], dx = %d\n dy = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy); +#ifdef DEBUG_CC + printf(" [CComponents] WARNING: [%s - %d], dx = %d dy = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy); +#endif 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); + printf(" [CComponents] WARNING: [%s - %d], x = %d y = %d\n", __FUNCTION__, __LINE__, v_fbdata[i].x, v_fbdata[i].y); } -#endif + int fbtype = v_fbdata[i].fbdata_type; #ifdef DEBUG_CC diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index 0f69bbe40..bf2eeb5cd 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -33,7 +33,7 @@ #include #include -//#define DEBUG_CC + /// Basic component class. /*! @@ -45,6 +45,8 @@ class CComponents private: ///pixel buffer handling, returns pixel buffer depends of given parameters fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); + ///initialize of basic attributes, no parameters required + void initVarBasic(); protected: ///object: framebuffer object, usable in all sub classes @@ -97,8 +99,6 @@ class CComponents ///mode: true=allows painting of item, see also allowPaint() bool cc_allow_paint; - ///initialize of basic attributes, no parameters required - void initVarBasic(); ///rendering of framebuffer elements at once, ///elements are contained in v_fbdata, presumes added frambuffer elements with paintInit(), ///parameter do_save_bg=true, saves background of element to pixel buffer, this can be restore with hide() @@ -216,6 +216,9 @@ class CComponents class CComponentsItem : public CComponents { + private: + ///initialize all required attributes + void initVarItem(); protected: ///property: define of item type, see cc_types.h for possible types int cc_item_type; @@ -242,8 +245,6 @@ class CComponentsItem : public CComponents ///an item will be hide or overpainted with other methods, or it's embedded (bound) in a parent form. void paintInit(bool do_save_bg); - ///initialize all required attributes - void initVarItem(); public: CComponentsItem(); diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp index 646b0292e..8b319ce21 100644 --- a/src/gui/components/cc_detailsline.cpp +++ b/src/gui/components/cc_detailsline.cpp @@ -69,9 +69,6 @@ CComponentsDetailLine::CComponentsDetailLine(const int x_pos, const int y_pos_to void CComponentsDetailLine::initVarDline() { - //CComponents - initVarBasic(); - shadow_w = 1; //CComponentsDetailLine @@ -80,8 +77,6 @@ void CComponentsDetailLine::initVarDline() CComponentsDetailLine::~CComponentsDetailLine() { - hide(); //restore background - clear(); } // y_top (=y) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 01cd1351d..b479986bd 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -76,8 +76,6 @@ void CComponentsForm::cleanCCForm() #endif clearCCItems(); - clearSavedScreen(); - clear(); } @@ -105,8 +103,6 @@ void CComponentsForm::clearCCItems() void CComponentsForm::initVarForm() { - //CComponentsItem - initVarItem(); //simple default dimensions diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index e3cb101d6..f97e15e23 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -37,9 +37,10 @@ class CComponentsForm : public CComponentsItem { + private: + void initVarForm(); protected: std::vector v_cc_items; - void initVarForm(); void paintForm(bool do_save_bg); ///generates next possible index for an item, see also cc_item_index, getIndex(), setIndex() int genIndex(); @@ -112,6 +113,8 @@ class CComponentsIconForm : public CComponentsForm class CComponentsHeader : public CComponentsForm { + private: + void initVarHeader(); protected: CComponentsPicture * cch_icon_obj; CComponentsText * cch_text_obj; @@ -131,8 +134,6 @@ class CComponentsHeader : public CComponentsForm void initDefaultButtons(); void initButtonFormSize(); - void initVarHeader(); - public: enum { @@ -317,6 +318,9 @@ class CComponentsWindow : public CComponentsForm ///refresh position and dimension and reinitialize elemenatary properties void Refresh(){initCCWItems();}; + + ///paint all window items, this overwriting paint() from CComponentsForm + virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 7846ef20d..639cfe683 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -88,7 +88,6 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i void CComponentsButton::initVarButton() { - initVarForm(); cc_item_type = CC_ITEMTYPE_BUTTON; cc_btn_icon_obj = NULL; cc_btn_capt_obj = NULL; diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index efc190194..5ffa37582 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "cc_frm_clock.h" #include @@ -60,32 +61,32 @@ CComponentsFrmClock::CComponentsFrmClock( const int x_pos, const int y_pos, cons col_body = color_body; col_shadow = color_shadow; + cl_format_str = format_str; paintClock = false; activeClock = activ; if (activeClock) startThread(); - - cl_format_str = format_str; } void CComponentsFrmClock::initVarClock() { - initVarForm(); - cc_item_type = CC_ITEMTYPE_FRM_CLOCK; - corner_rad = RADIUS_SMALL; + cc_item_type = CC_ITEMTYPE_FRM_CLOCK; + corner_rad = RADIUS_SMALL; - cl_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]; - cl_col_text = COL_MENUCONTENT_TEXT; - cl_format_str = "%H:%M"; - cl_align = CC_ALIGN_VER_CENTER | CC_ALIGN_HOR_CENTER; + cl_font_type = SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO; + cl_font = &g_Font[cl_font_type]; + dyn_font_size = 0; - cl_thread = 0; - cl_interval = 1; + cl_col_text = COL_MENUCONTENT_TEXT; + cl_format_str = "%H:%M"; + cl_align = CC_ALIGN_VER_CENTER | CC_ALIGN_HOR_CENTER; + + cl_thread = 0; + cl_interval = 1; } CComponentsFrmClock::~CComponentsFrmClock() { - cleanCCForm(); if (activeClock) stopThread(); } @@ -118,8 +119,8 @@ void CComponentsFrmClock::initCCLockItems() string s_time = cl_timestr; //get minimal required height, width from raw text - int min_text_w = cl_font->getRenderWidth(s_time, true);; - int min_text_h = cl_font->getHeight(); + int min_text_w = (*getClockFont())->getRenderWidth(s_time, true);; + int min_text_h = (*getClockFont())->getHeight(); height = max(height, min_text_h); width = max(width, min_text_w); @@ -150,7 +151,13 @@ void CComponentsFrmClock::initCCLockItems() } } - //modifie available lable items with current segment chars + int w_tmp; + int minSepWidth = (*getClockFont())->getRenderWidth(":", true); + w_tmp = (*getClockFont())->getRenderWidth(".", true); + if (w_tmp > minSepWidth) + minSepWidth = w_tmp; + + //modify available label items with current segment chars for (size_t i = 0; i < v_cc_items.size(); i++) { //v_cc_items are only available as CComponent-items here, so we must cast them before @@ -170,23 +177,35 @@ void CComponentsFrmClock::initCCLockItems() string stmp = s_time.substr(i, 1); //get width of current segment - int wtmp = cl_font->getRenderWidth(stmp, true); + int wtmp; + char c = stmp.at(0); + switch (c) { + case '0' ... '9': + wtmp = (*getClockFont())->getMaxDigitWidth(); + break; + case '.': + case ':': + wtmp = minSepWidth; + break; + default: + wtmp = (*getClockFont())->getRenderWidth(stmp, true); + } //set size, text, color of current item lbl->setDimensionsAll(cl_x, cl_y, wtmp, cl_h); lbl->setTextColor(cl_col_text); lbl->setColorAll(col_frame, col_body, col_shadow); - lbl->setText(stmp, CTextBox::CENTER, cl_font); + lbl->setText(stmp, CTextBox::CENTER, *getClockFont()); //use matching height for digits for better vertical centerring into form CTextBox* ctb = lbl->getCTextBoxObject(); if (ctb) ctb->setFontUseDigitHeight(); - +#if 0 //ensure paint of text and label bg on changed text or painted form background bool force_txt_and_bg = (lbl->textChanged() || this->paint_bg); lbl->forceTextPaint(force_txt_and_bg); - +#endif //set xpos of item cl_x += wtmp; @@ -252,12 +271,7 @@ void* CComponentsFrmClock::initClockThread(void *arg) time_t count = time(0); //start loop for paint while(1) { - sleep(clock->cl_interval); - if (clock->paintClock) { - //refresh item property values - clock->refresh(); - //paint segements, but wihtout saved backgrounds clock->paint(CC_SAVE_SCREEN_NO); count = time(0); @@ -266,6 +280,7 @@ void* CComponentsFrmClock::initClockThread(void *arg) clock->cl_thread = 0; break; } + sleep(clock->cl_interval); } return 0; } @@ -335,3 +350,24 @@ void CComponentsFrmClock::paint(bool do_save_bg) //paint form contents paintForm(do_save_bg); } + +void CComponentsFrmClock::setClockFontSize(int size) +{ + int tmp_w = 0; + dyn_font_size = size; + cl_font = CNeutrinoFonts::getInstance()->getDynFont(tmp_w, dyn_font_size, "", CNeutrinoFonts::FONT_STYLE_BOLD, CNeutrinoFonts::FONT_ID_INFOCLOCK); +} + +void CComponentsFrmClock::setClockFont(int font) +{ + cl_font_type = font; + cl_font = &g_Font[cl_font_type]; +} + +Font** CComponentsFrmClock::getClockFont() +{ + if (dyn_font_size == 0) + cl_font = &g_Font[cl_font_type]; + return cl_font; + +} diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index 1af9d2580..860126edc 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -62,7 +62,11 @@ class CComponentsFrmClock : public CComponentsForm bool activeClock; ///object: font render object - Font *cl_font; + Font **cl_font; + + int cl_font_type; + int dyn_font_size; + ///text color int cl_col_text; ///time format @@ -80,6 +84,9 @@ class CComponentsFrmClock : public CComponentsForm ///initialize of general alignment of timestring segments within form area void initSegmentAlign(int* segment_width, int* segment_height); + ///return pointer of font object + inline Font** getClockFont(); + public: CComponentsFrmClock(); CComponentsFrmClock( const int x_pos, const int y_pos, const int w, const int h, @@ -87,8 +94,9 @@ class CComponentsFrmClock : public CComponentsForm 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); virtual ~CComponentsFrmClock(); - ///set font type for segments - virtual void setClockFont(Font *font){cl_font = font;}; + ///set font type or font size for segments + virtual void setClockFont(int font); + virtual void setClockFontSize(int size); ///set text color virtual void setTextColor(fb_pixel_t color_text){ cl_col_text = color_text;}; diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 149786e28..d44c940d0 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -77,7 +77,6 @@ void CComponentsExtTextForm::initVarExtTextForm(const int x_pos, const int y_pos 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; @@ -135,7 +134,7 @@ void CComponentsExtTextForm::initText() { //initialize text object if (ccx_text_obj == NULL){ - ccx_text_obj = new CComponentsLabel(); + ccx_text_obj = new CComponentsText(); ccx_text_obj->doPaintBg(false); } diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 0a07cbf5e..8ad8ff113 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -65,9 +65,6 @@ CComponentsFooter::CComponentsFooter( const int x_pos, const int y_pos, const in void CComponentsFooter::initVarFooter() { - //CComponentsHeader - initVarHeader(); - cc_item_type = CC_ITEMTYPE_FOOTER; corner_rad = RADIUS_LARGE; corner_type = CORNER_BOTTOM; diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index ba2b689b6..421f9c2da 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -90,8 +90,6 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in void CComponentsHeader::initVarHeader() { - //CComponentsForm - initVarForm(); cc_item_type = CC_ITEMTYPE_FRM_HEADER; col_body = COL_MENUHEAD_PLUS_0; corner_rad = RADIUS_LARGE, @@ -128,7 +126,6 @@ CComponentsHeader::~CComponentsHeader() printf("[~CComponentsHeader] [%s - %d] delete...\n", __FUNCTION__, __LINE__); #endif v_cch_btn.clear(); - cleanCCForm(); } void CComponentsHeader::setCaption(const std::string& caption, const int& align_mode) diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp index 5bb8fe615..4bb19468a 100644 --- a/src/gui/components/cc_frm_icons.cpp +++ b/src/gui/components/cc_frm_icons.cpp @@ -60,8 +60,6 @@ CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const void CComponentsIconForm::initVarIconForm() { - //CComponentsForm - initVarForm(); cc_item_type = CC_ITEMTYPE_FRM_ICONFORM; //set default width and height to 0, this causes a dynamic adaptation of width and height of form diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index ea7949519..a7f94baec 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -39,10 +39,11 @@ using namespace std; CSignalBar::CSignalBar() { initVarSigBar(); + sb_name = "SIG"; initSBItems(); } -CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref) +CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname) { initVarSigBar(); sb_frontend = frontend_ref; @@ -50,6 +51,7 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int y = ypos; width = w; height = h; + sb_name = sbname; initSBItems(); } @@ -95,7 +97,6 @@ void CSignalBar::initSBItems() void CSignalBar::initVarSigBar() { - initVarForm(); corner_rad = 0; corner_type = 0; append_h_offset = 2; @@ -107,6 +108,7 @@ void CSignalBar::initVarSigBar() dy_font = CNeutrinoFonts::getInstance(); sb_caption_color= COL_INFOBAR_TEXT; + sb_val_mode = CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT; sb_lastsig = 0; sb_signal = 0; @@ -115,7 +117,6 @@ void CSignalBar::initVarSigBar() sb_scale = NULL; sb_vlbl = NULL; sb_lbl = NULL; - sb_name = "SIG"; } void CSignalBar::initSBarScale() @@ -144,7 +145,7 @@ void CSignalBar::initSBarValue() if (sb_vlbl == NULL){ sb_vlbl = new CComponentsLabel(); sb_vlbl->doPaintBg(false); - sb_vlbl->setText("0%", CTextBox::NO_AUTO_LINEBREAK, sb_font); + sb_vlbl->setText(" 0%", sb_val_mode, sb_font); } //move and set dimensions @@ -217,7 +218,7 @@ void CSignalBar::paintScale() i_str << sig; string percent(i_str.str()); percent += "%"; - sb_vlbl->setText(percent, CTextBox::NO_AUTO_LINEBREAK | CTextBox::CENTER, sb_font); + sb_vlbl->setText(percent, sb_val_mode, sb_font); //we must force paint backround, because of changing values sb_vlbl->doPaintBg(true); @@ -245,30 +246,6 @@ void CSignalBar::paint(bool do_save_bg) //******************************************************************************************************************************* -CSignalNoiseRatioBar::CSignalNoiseRatioBar() -{ - initVarSnrBar(); - initSBItems(); -} - -CSignalNoiseRatioBar::CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref) -{ - initVarSnrBar(); - sb_frontend = frontend_ref; - x = xpos; - y = ypos; - width = w; - height = h; - - initSBItems(); -} - -void CSignalNoiseRatioBar::initVarSnrBar() -{ - initVarSigBar(); - sb_name = "SNR"; -} - void CSignalNoiseRatioBar::Refresh() { //get current value from frontend @@ -306,7 +283,6 @@ CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int void CSignalBox::initVarSigBox() { - initVarForm(); corner_rad = 0; sbx_frontend = NULL; diff --git a/src/gui/components/cc_frm_signalbars.h b/src/gui/components/cc_frm_signalbars.h index 460270f12..3945cdbb8 100644 --- a/src/gui/components/cc_frm_signalbars.h +++ b/src/gui/components/cc_frm_signalbars.h @@ -31,8 +31,7 @@ #include #endif -// #include -// #include + #include #include #include @@ -82,6 +81,8 @@ class CSignalBar : public CComponentsForm int sb_vlbl_width; ///property: width of caption int sb_lbl_width; + ///property: text mode of value, predefined type = CTextBox::NO_AUTO_LINEBREAK | CTextBox::CENTER + int sb_val_mode; ///cache last assingned signal value int sb_lastsig; @@ -114,7 +115,7 @@ class CSignalBar : public CComponentsForm public: CSignalBar(); ///basic component class constructor for signal. - CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref); + CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG"); ///assigns the current used frontend, simplified a tuner object, see frontend_c.h virtual void setFrontEnd(CFrontend *frontend_ref){sb_frontend = frontend_ref;}; @@ -131,8 +132,10 @@ class CSignalBar : public CComponentsForm ///returns the scale object, type = CProgressBar* virtual CProgressBar* getScaleObject(){return sb_scale;}; - ///returns the caption object, type = CComponentsLabel* - virtual CComponentsLabel* getLabelObject(){return sb_lbl;}; + ///returns the value label object, type = CComponentsLabel* + virtual CComponentsLabel* getLabelValObject(){return sb_vlbl;}; + ///returns the name label object, type = CComponentsLabel* + virtual CComponentsLabel* getLabelNameObject(){return sb_lbl;}; ///paint this items virtual void paint(bool do_save_bg); @@ -151,14 +154,11 @@ class CSignalNoiseRatioBar : public CSignalBar ///refresh current item properties, use this before paintScale(). void Refresh(); - protected: - ///initialize all needed basic attributes and objects - void initVarSnrBar(); - public: - CSignalNoiseRatioBar(); + CSignalNoiseRatioBar(){}; ///basic component class constructor for signal noise ratio. - CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref); + CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref) + : CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR"){}; }; /// Class CSignalBox() provides CSignalBar(), CSignalNoiseRatioBar() scales at once. @@ -168,7 +168,7 @@ additional of CSignalBar()- and CSignalNoiseRatioBar()-objects. To add a signalbox object to your code add this to a header file: -#include +#include class CSampleClass { @@ -278,7 +278,7 @@ class CSignalBox : public CComponentsForm ///get caption color of signalbars, see also property 'sbx_caption_color' fb_pixel_t getTextColor(){return sbx_caption_color;}; - ///assigns the width of scale + ///assigns the width of scale in percent related of full width of signal box, the rest is reserved for text void setScaleWidth(const short & scale_width_percent){sbx_scale_w_percent = scale_width_percent;}; ///paint items diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index eef2f81ee..5fa98de8a 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -119,13 +119,11 @@ CComponentsWindow::~CComponentsWindow() #ifdef DEBUG_CC printf("[~CComponentsWindow] [%s - %d] delete...\n", __FUNCTION__, __LINE__); #endif - cleanCCForm(); } void CComponentsWindow::initVarWindow() { //CComponentsForm - initVarForm(); cc_item_type = CC_ITEMTYPE_FRM_WINDOW; //using current screen settings for default dimensions @@ -254,3 +252,11 @@ 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 0ab26c35d..30fccdfa4 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -52,7 +52,6 @@ CComponentsItem::CComponentsItem() void CComponentsItem::initVarItem() { //CComponents - initVarBasic(); cc_item_index = CC_NO_INDEX; cc_item_enabled = true; cc_item_selected = false; diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index ff1b30bfb..77ff00bd5 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -66,18 +66,12 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i CComponentsInfoBox::~CComponentsInfoBox() { - hide(); - clearSavedScreen(); - clearCCText(); delete pic; delete cctext; - clear(); } void CComponentsInfoBox::initVarInfobox() { - //CComponents, CComponentsItem, CComponentsText - initVarText(); cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; //CComponentsInfoBox diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index ebd77bf6f..8d66f43f8 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -57,7 +57,6 @@ void CComponentsPicture::init( int x_pos, int y_pos, const string& image_name, c fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) { //CComponents, CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_PICTURE; //CComponentsPicture diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 06debd8ae..8c5944a41 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -76,7 +76,6 @@ CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const void CProgressBar::initVarProgressbar() { //CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_PROGRESSBAR; //CProgressBar @@ -150,7 +149,8 @@ void CProgressBar::paintSimple() { // progress value if (pb_active_width != pb_last_width){ - paintShapes(pb_x, pb_y, pb_active_width, pb_height, pb_active_col); // active bar + if (pb_active_width) + paintShapes(pb_x, pb_y, pb_active_width, pb_height, pb_active_col); // active bar paintShapes(pb_start_x_passive, pb_y, pb_passive_width, pb_height, pb_passive_col); // passive bar } @@ -214,7 +214,8 @@ void CProgressBar::paintAdvanced() for (j = 0; j < hcnt; j++) { int sh_x = pb_x + i * itemw; int sh_y = py + j * itemh; - paintShapes(sh_x, sh_y, pointx, pointy, color); + //paintShapes(sh_x, sh_y, pointx, pointy, color); + frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, color); } } step = yw - rd - 1; @@ -230,7 +231,8 @@ void CProgressBar::paintAdvanced() for (j = 0; j < hcnt; j++) { int sh_x = pb_x + i * itemw; int sh_y = py + j * itemh; - paintShapes(sh_x, sh_y, pointx, pointy, color); + //paintShapes(sh_x, sh_y, pointx, pointy, color); + frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, color); } } off = diff; @@ -248,7 +250,8 @@ void CProgressBar::paintAdvanced() for (j = 0; j < hcnt; j++) { int sh_x = pb_x + i * itemw; int sh_y = py + j * itemh; - paintShapes(sh_x, sh_y, pointx, pointy, color); + //paintShapes(sh_x, sh_y, pointx, pointy, color); + frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, color); } } } @@ -256,7 +259,8 @@ void CProgressBar::paintAdvanced() for (j = 0; j < hcnt; j++) { int sh_x = pb_x + i * itemw; int sh_y = py + j * itemh; - paintShapes(sh_x, sh_y, pointx, pointy, pb_passive_col); //fill passive + //paintShapes(sh_x, sh_y, pointx, pointy, pb_passive_col); //fill passive + frameBuffer->paintBoxRel(sh_x, sh_y, pointx, pointy, pb_passive_col); } } } diff --git a/src/gui/components/cc_item_shapes.cpp b/src/gui/components/cc_item_shapes.cpp index 758622401..14393b610 100644 --- a/src/gui/components/cc_item_shapes.cpp +++ b/src/gui/components/cc_item_shapes.cpp @@ -38,7 +38,6 @@ using namespace std; CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_SHAPE_SQUARE; x = x_pos; @@ -64,7 +63,6 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponents, CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_SHAPE_CIRCLE; //CComponents diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index feb6b3f0e..4e6db142c 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -78,16 +78,13 @@ CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, CComponentsText::~CComponentsText() { hide(); - clearSavedScreen(); clearCCText(); - clear(); } void CComponentsText::initVarText() { //CComponents, CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_TEXT; //CComponentsText diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index c5aa38117..19dc1faa0 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -43,7 +43,6 @@ using namespace std; CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow) { //CComponents, CComponentsItem - initVarItem(); cc_item_type = CC_ITEMTYPE_PIP; //CComponentsPIP @@ -68,8 +67,6 @@ CComponentsPIP::~CComponentsPIP() { hide(); videoDecoder->Pig(-1, -1, -1, -1); - clearSavedScreen(); - clear(); } void CComponentsPIP::paint(bool do_save_bg) diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 59fc34243..5a5fb5fe9 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -30,6 +30,8 @@ #include #include +// #define DEBUG_CC + ///cc item types typedef enum { diff --git a/src/gui/components/unmaintained/cc_item_box.cpp b/src/gui/components/unmaintained/cc_item_box.cpp index 29140ebc2..4a2175dc7 100644 --- a/src/gui/components/unmaintained/cc_item_box.cpp +++ b/src/gui/components/unmaintained/cc_item_box.cpp @@ -356,7 +356,7 @@ void CComponentsItemBox::calSizeOfElements() digit_h = font_text->getDigitHeight(); digit_offset = font_text->getDigitOffset(); v_element_data[i].height = digit_h + (int)((float)digit_offset*1.5); -// v_element_data[i].width = font_text->getRenderWidth(widest_number)*4 + font->getRenderWidth(":"); +// v_element_data[i].width = font_text->getMaxDigitWidth() + font->getRenderWidth(":"); v_element_data[i].width = font_text->getRenderWidth(timestr); v_element_data[i].element = timestr; } diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 7e2f17031..957dc9204 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -73,6 +73,7 @@ inline static bool sortbyEventid (const CChannelEvent& a, const CChannelEvent& b return (a.channelID == b.channelID && a.eventID == b.eventID && a.startTime == b.startTime); } #endif + inline bool sortByDescription (const CChannelEvent& a, const CChannelEvent& b) { if(a.description == b.description) @@ -1127,6 +1128,22 @@ bool CNeutrinoEventList::findEvents(void) search_head_name += ": '"; search_head_name += m_search_keyword; search_head_name += "'"; + + if(!m_search_keyword.empty()){ + g_settings.epg_search_history.push_front(m_search_keyword); + std::list::iterator it = g_settings.epg_search_history.begin(); + it++; + while (it != g_settings.epg_search_history.end()) { + if (*it == m_search_keyword) + it = g_settings.epg_search_history.erase(it); + else + ++it; + } + g_settings.epg_search_history_size = g_settings.epg_search_history.size(); + if (g_settings.epg_search_history_size > g_settings.epg_search_history_max) + g_settings.epg_search_history_size = g_settings.epg_search_history_max; + } + } paintHead(0, search_head_name); paint(); @@ -1199,6 +1216,8 @@ CEventFinderMenu::CEventFinderMenu( int* event, m_search_list = search_list; m_search_channel_id = search_channel_id; m_search_bouquet_id = search_bouquet_id; + width = w_max (40, 10); + selected = -1; } @@ -1215,34 +1234,13 @@ int CEventFinderMenu::exec(CMenuTarget* parent, const std::string &actionkey) //printf("0\n"); showMenu(); } - else if(actionkey =="1") + else if(actionkey =="#1") { //printf("1\n"); *m_event = true; res = menu_return::RETURN_EXIT_ALL; } - else if(actionkey =="2") - { - //printf("2\n"); - /* - if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_CHANNEL) - { - mf[1]->setActive(true); - m_search_channelname = CServiceManager::getInstance()->GetServiceName(*m_search_channel_id);; - } - else if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_BOUQUET) - { - mf[1]->setActive(true); - m_search_channelname = bouquetList->Bouquets[*m_search_bouquet_id]->channelList->getName(); - } - else if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_ALL) - { - mf[1]->setActive(false); - m_search_channelname = ""; - } - */ - } - else if(actionkey =="3") + else if(actionkey =="#2") { //printf("3\n"); // get channel id / bouquet id @@ -1276,9 +1274,38 @@ int CEventFinderMenu::exec(CMenuTarget* parent, const std::string &actionkey) } } } - else if(actionkey =="4") + else if(actionkey =="#history") { - //printf("4\n"); + + if (parent) + parent->hide(); + CMenuWidget* m = new CMenuWidget(LOCALE_EVENTFINDER_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 = g_settings.epg_search_history.begin(); + for (int i = 0; i < g_settings.epg_search_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") { + g_settings.epg_search_history.clear(); + g_settings.epg_search_history_size = 0; + return menu_return::RETURN_EXIT; + } + + std::list::iterator it = g_settings.epg_search_history.begin(); + for (int i = 0; i < g_settings.epg_search_history_size; i++, ++it){ + if((*it)== actionkey){ + *m_search_keyword = actionkey; + g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_blue, 0); + return menu_return::RETURN_EXIT; + } } return res; @@ -1317,12 +1344,16 @@ int CEventFinderMenu::showMenu(void) CMenuForwarder* mf0 = new CMenuForwarder(LOCALE_EVENTFINDER_KEYWORD, true, *m_search_keyword, &stringInput, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); CMenuOptionChooser* mo0 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST, m_search_list, SEARCH_LIST_OPTIONS, SEARCH_LIST_OPTION_COUNT, true, this, CRCInput::convertDigitToKey(shortcut++)); - m_search_channelname_mf = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "3", CRCInput::convertDigitToKey(shortcut++)); + m_search_channelname_mf = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "#2", CRCInput::convertDigitToKey(shortcut++)); CMenuOptionChooser* mo1 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG, m_search_epg_item, SEARCH_EPG_OPTIONS, SEARCH_EPG_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++)); - CMenuForwarder* mf1 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "1", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + CMenuForwarder* mf1 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "#1", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); CMenuWidget searchMenu(LOCALE_EVENTFINDER_HEAD, NEUTRINO_ICON_FEATURES, 40); + CMenuForwarder* mf2 = new CMenuForwarder(LOCALE_EVENTFINDER_HISTORY, true, NULL, this, "#history", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + CMenuOptionNumberChooser* moc1 = new CMenuOptionNumberChooser(LOCALE_EVENTFINDER_MAX_HISTORY, &g_settings.epg_search_history_max, true, 0, 50, NULL); + searchMenu.addItem(GenericMenuSeparatorLine); + searchMenu.addItem(GenericMenuSeparator); searchMenu.addItem(mf0); searchMenu.addItem(GenericMenuSeparatorLine); @@ -1331,6 +1362,9 @@ int CEventFinderMenu::showMenu(void) searchMenu.addItem(mo1); searchMenu.addItem(GenericMenuSeparatorLine); searchMenu.addItem(mf1); + searchMenu.addItem(GenericMenuSeparatorLine); + searchMenu.addItem(mf2); + searchMenu.addItem(moc1); res = searchMenu.exec(NULL,""); return(res); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 8eff085db..7fba30b57 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -139,21 +139,23 @@ class CEventFinderMenu : public CMenuTarget, CChangeObserver { private: CMenuForwarderNonLocalized* m_search_channelname_mf; - int* m_event; - int* m_search_epg_item; - std::string* m_search_keyword; - int* m_search_list; - std::string m_search_channelname; - t_channel_id* m_search_channel_id; - t_bouquet_id* m_search_bouquet_id; - int showMenu(void); + int* m_event; + int* m_search_epg_item; + std::string* m_search_keyword; + int* m_search_list; + std::string m_search_channelname; + t_channel_id* m_search_channel_id; + t_bouquet_id* m_search_bouquet_id; + int width; + int selected; + int showMenu(void); public: - CEventFinderMenu( int* event, - int* search_epg_item, - std::string* search_keyword, - int* search_list, - t_channel_id* search_channel_id, - t_bouquet_id* search_bouquet_id); + CEventFinderMenu( int* event, + int* search_epg_item, + std::string* search_keyword, + int* search_list, + t_channel_id* search_channel_id, + t_bouquet_id* search_bouquet_id); int exec( CMenuTarget* parent, const std::string &actionkey); bool changeNotify(const neutrino_locale_t OptionName, void *); diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 83d01fe7d..f7767d326 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -670,17 +670,17 @@ _remount: if(!res) { snprintf(cmd, sizeof(cmd), "%s/movies", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); snprintf(cmd, sizeof(cmd), "%s/pictures", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); snprintf(cmd, sizeof(cmd), "%s/epg", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); snprintf(cmd, sizeof(cmd), "%s/music", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); snprintf(cmd, sizeof(cmd), "%s/logos", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); snprintf(cmd, sizeof(cmd), "%s/plugins", dst); - safe_mkdir((char *) cmd); + safe_mkdir(cmd); sync(); #if HAVE_TRIPLEDRAGON /* on the tripledragon, we mount via fstab, so we need to add an @@ -815,9 +815,11 @@ ret1: { switch(g_settings.hdd_fs) { case 0: + safe_mkdir(dst); res = mount(src, dst, "ext3", 0, NULL); break; case 1: + safe_mkdir(dst); res = mount(src, dst, "reiserfs", 0, NULL); break; default: diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 573bfc929..ff7c64da0 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -88,6 +88,7 @@ void CImageInfo::Clean() cc_tv = NULL; cc_lic = NULL; cc_sub_caption = NULL; + delete b_info; b_info = NULL; btn_red = NULL; } diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index 9ea868ce9..e7d690546 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -1,41 +1,44 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Info Clock Window + based up CComponentsFrmClock + Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013, Michael Liebmann 'micha-bbg' + + 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 -#include - -#include -#include -#include -#include -#include #include #include -#define YOFF 0 -CInfoClock::CInfoClock() -{ - frameBuffer = CFrameBuffer::getInstance(); - x = y = clock_x = 0; - time_height = time_width = thrTimer = 0; - Init(); -} -CInfoClock::~CInfoClock() +CInfoClock::CInfoClock():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, CC_SHADOW_OFF, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) { - if(thrTimer) - pthread_cancel(thrTimer); - thrTimer = 0; -} - -void CInfoClock::Init() -{ - CVolumeHelper::getInstance()->refresh(); - CVolumeHelper::getInstance()->getInfoClockDimensions(&clock_x, &y, &time_width, &time_height, &digit_h, &digit_offset); + initVarInfoClock(); } CInfoClock* CInfoClock::getInstance() @@ -46,64 +49,68 @@ CInfoClock* CInfoClock::getInstance() return InfoClock; } -void CInfoClock::paintTime( bool show_dot) +void CInfoClock::initVarInfoClock() { - char timestr[20]; - int dummy, mute_dx, h_spacer; - time_t tm = time(0); - strftime((char*) ×tr, sizeof(timestr), "%H:%M:%S", localtime(&tm)); - timestr[2] = show_dot ? ':':'.'; - - CVolumeHelper *cvh = CVolumeHelper::getInstance(); - cvh->getInfoClockDimensions(&clock_x, &y, &time_width, &time_height, &digit_h, &digit_offset); - cvh->getMuteIconDimensions(&dummy, &dummy, &mute_dx, &dummy); - cvh->getSpacer(&h_spacer, &dummy); - if (CNeutrinoApp::getInstance()->isMuted()) - clock_x -= (mute_dx + h_spacer); - - int x_diff = (time_width - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(timestr)) / 2; - frameBuffer->paintBoxRel(clock_x, y, time_width, time_height, COL_MENUCONTENT_PLUS_0, RADIUS_SMALL); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(clock_x + x_diff, y + digit_h + digit_offset + ((time_height - digit_h) / 2), time_width, timestr, COL_MENUCONTENT_TEXT); + Init(); } -void* CInfoClock::TimerProc(void *arg) +void CInfoClock::Init() { - - bool show_dot = false; - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,0); - pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS,0); - - CInfoClock *InfoClock = static_cast(arg); - InfoClock->paintTime(show_dot); - while(1) { - sleep(1); - show_dot = !show_dot; - InfoClock->paintTime(show_dot); + static int oldSize = 0; + if (oldSize != g_settings.infoClockFontSize) { + oldSize = g_settings.infoClockFontSize; + setClockFontSize(g_settings.infoClockFontSize); } - return 0; + + //use current theme colors + syncSysColors(); + + int x_old = x, y_old = y, width_old = width, height_old = height; + CVolumeHelper::getInstance()->refresh(cl_font); + CVolumeHelper::getInstance()->getInfoClockDimensions(&x, &y, &width, &height); + if ((x_old != x) || (y_old != y) || (width_old != width) || (height_old != height)) { + cleanCCForm(); + clearCCItems(); + } + + // set corner radius depending on clock height + corner_rad = (g_settings.rounded_corners) ? std::max(height/10, CORNER_RADIUS_SMALL) : 0; + + initCCLockItems(); } void CInfoClock::ClearDisplay() { - frameBuffer->paintBackgroundBoxRel(clock_x, y, time_width, time_height); + kill(); Init(); } -void CInfoClock::StartClock() +bool CInfoClock::StartClock() { Init(); - - if(!thrTimer) { - pthread_create (&thrTimer, NULL, TimerProc, (void*) this) ; - pthread_detach(thrTimer); - } + return Start(); } -void CInfoClock::StopClock() +bool CInfoClock::StopClock() { - if(thrTimer) { - pthread_cancel(thrTimer); - thrTimer = 0; - frameBuffer->paintBackgroundBoxRel(clock_x, y, time_width, time_height); - } + bool ret = Stop(); + kill(); + + return ret; +} + +bool CInfoClock::enableInfoClock(bool enable) +{ + bool ret = false; + if (g_settings.mode_clock) { + if (enable) { + if (!paintClock) + ret = StartClock(); + } + else { + if (paintClock) + ret = StopClock(); + } + } + return ret; } diff --git a/src/gui/infoclock.h b/src/gui/infoclock.h index 8d578181d..ebf1b912d 100644 --- a/src/gui/infoclock.h +++ b/src/gui/infoclock.h @@ -1,39 +1,52 @@ -#ifndef __infoclock__ -#define __infoclock__ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Info Clock Window + based up CComponentsFrmClock + Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013, Michael Liebmann 'micha-bbg' + + 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. +*/ + +#ifndef __INFOCLOCK__ +#define __INFOCLOCK__ -#include -#include -#include - -#include - -#include +#include -class CInfoClock +class CInfoClock : public CComponentsFrmClock { - private: - CFrameBuffer * frameBuffer; + protected: + void initVarInfoClock(); + private: + void Init(); + public: + CInfoClock(); + // ~CInfoClock(); // inherited from CComponentsFrmClock + static CInfoClock* getInstance(); - pthread_t thrTimer; - void paintTime( bool show_dot); - int time_offset, digit_offset, digit_h; - int x, y, clock_x; - void Init(); - static void CleanUpProc(void* arg); - static void* TimerProc(void *arg); - - public: - CInfoClock(); - ~CInfoClock(); - static CInfoClock* getInstance(); - - void StartClock(); - void StopClock(); - void ClearDisplay(); - - int time_width, time_height; + bool StartClock(); + bool StopClock(); + bool enableInfoClock(bool enable); + void ClearDisplay(); }; #endif diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index bbab9d187..a0bfe06f0 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include @@ -78,6 +78,7 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern CBouquetList * bouquetList; /* neutrino.cpp */ extern CPictureViewer * g_PicViewer; extern cVideo * videoDecoder; +extern CInfoClock *InfoClock; #define LEFT_OFFSET 5 @@ -97,6 +98,7 @@ CInfoViewer::CInfoViewer () sigscale = NULL; snrscale = NULL; timescale = NULL; + clock = NULL; info_CurrentNext.current_zeit.startzeit = 0; info_CurrentNext.current_zeit.dauer = 0; info_CurrentNext.flags = 0; @@ -135,6 +137,7 @@ CInfoViewer::~CInfoViewer() delete timescale; delete infoViewerBB; delete infobar_txt; + delete clock; } void CInfoViewer::Init() @@ -200,7 +203,7 @@ void CInfoViewer::start () if ( g_settings.infobar_show_channellogo != 3 && g_settings.infobar_show_channellogo != 5 && g_settings.infobar_show_channellogo != 6) /* 3 & 5 & 6 is "default" with sigscales etc. */ { - ChanWidth = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getRenderWidth(widest_number) + 10; + ChanWidth = 4 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getMaxDigitWidth() + 10; ChanHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]->getHeight() * 9 / 8; } else @@ -250,35 +253,27 @@ void CInfoViewer::changePB() timescale->setRgb(0, 100, 70); } -void CInfoViewer::paintTime (bool show_dot, bool firstPaint) +void CInfoViewer::paintTime (bool show_dot) { if (! gotTime) return; - char timestr[10]; - time_t rawtime = time(NULL); - strftime ((char *) ×tr, sizeof(timestr), "%H:%M", localtime(&rawtime)); + int clock_x = BoxEndX - time_width - LEFT_OFFSET; + int clock_y = ChanNameY; + int clock_w = time_width + LEFT_OFFSET; + int clock_h = time_height; - if ((!firstPaint) && (strcmp (timestr, old_timestr) == 0)) { - if (show_dot) - frameBuffer->paintBoxRel (BoxEndX - time_width + time_left_width - LEFT_OFFSET, ChanNameY, time_dot_width, time_height / 2 + 2, COL_INFOBAR_PLUS_0); - else - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_width + time_left_width - LEFT_OFFSET, ChanNameY + time_height, time_dot_width, ":", COL_INFOBAR_TEXT); - strcpy (old_timestr, timestr); - } else { - strcpy (old_timestr, timestr); - - if (!firstPaint) { - frameBuffer->paintBoxRel(BoxEndX - time_width - LEFT_OFFSET, ChanNameY, time_width + LEFT_OFFSET, time_height, COL_INFOBAR_PLUS_0, RADIUS_SMALL, CORNER_TOP); - } - - timestr[2] = 0; - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_width - LEFT_OFFSET, ChanNameY + time_height, time_left_width, timestr, COL_INFOBAR_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_left_width - LEFT_OFFSET, ChanNameY + time_height, time_left_width, ×tr[3], COL_INFOBAR_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString (BoxEndX - time_width + time_left_width - LEFT_OFFSET, ChanNameY + time_height, time_dot_width, ":", COL_INFOBAR_TEXT); - if (show_dot) - frameBuffer->paintBoxRel (BoxEndX - time_left_width - time_dot_width - LEFT_OFFSET, ChanNameY, time_dot_width, time_height / 2 + 2, COL_INFOBAR_PLUS_0); + if (clock == NULL){ + clock = new CComponentsFrmClock(); + clock->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); + clock->doPaintBg(false); } + clock->setColorBody(COL_INFOBAR_PLUS_0); + clock->setDimensionsAll(clock_x, clock_y, clock_w, clock_h); + clock->setClockFont(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME); + clock->setClockFormat(show_dot ? "%H:%M" : "%H.%M"); + + clock->paint(CC_SAVE_SCREEN_NO); } void CInfoViewer::showRecordIcon (const bool show) @@ -481,7 +476,7 @@ void CInfoViewer::show_current_next(bool new_chan, int epgpos) } } -void CInfoViewer::showMovieTitle(const int playState, const std::string &Channel, +void CInfoViewer::showMovieTitle(const int playState, const t_channel_id &Channel_Id, const std::string &Channel, const std::string &g_file_epg, const std::string &g_file_epg1, const int duration, const int curr_pos) { @@ -515,7 +510,7 @@ void CInfoViewer::showMovieTitle(const int playState, const std::string &Channel infoViewerBB->is_visible = true; ChannelName = Channel; - channel_id = 0; + channel_id = Channel_Id; /* showChannelLogo() changes this, so better reset it every time... */ ChanNameX = BoxStartX + ChanWidth + SHADOW_OFFSET; @@ -523,13 +518,17 @@ void CInfoViewer::showMovieTitle(const int playState, const std::string &Channel paintBackground(COL_INFOBAR_PLUS_0); bool show_dot = true; - paintTime (show_dot, true); + paintTime (show_dot); showRecordIcon (show_dot); show_dot = !show_dot; infoViewerBB->paintshowButtonBar(); - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(ChanNameX + 10 , ChanNameY + time_height,BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 5 ,ChannelName, COL_INFOBAR_TEXT, 0, true); // UTF-8 + int ChannelLogoMode = 0; + if (g_settings.infobar_show_channellogo > 1) + ChannelLogoMode = showChannelLogo(channel_id, 0); + if (ChannelLogoMode == 0 || ChannelLogoMode == 3 || ChannelLogoMode == 4) + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(ChanNameX + 10 , ChanNameY + time_height,BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 5 ,ChannelName, COL_INFOBAR_TEXT, 0, true); // UTF-8 // show_Data if (CMoviePlayerGui::getInstance().file_prozent > 100) @@ -689,7 +688,7 @@ void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, con paintBackground(col_NumBox); bool show_dot = true; - paintTime (show_dot, true); + paintTime (show_dot); showRecordIcon (show_dot); show_dot = !show_dot; @@ -881,7 +880,7 @@ void CInfoViewer::loop(bool show_dot) res = messages_return::cancel_info; } else if ((msg == NeutrinoMessages::EVT_TIMER) && (data == sec_timer_id)) { showSNR (); - paintTime (show_dot, false); + paintTime (show_dot); showRecordIcon (show_dot); show_dot = !show_dot; showInfoFile(); @@ -1102,6 +1101,7 @@ void CInfoViewer::killRadiotext() if (g_Radiotext->S_RtOsd) frameBuffer->paintBackgroundBox(rt_x, rt_y, rt_w, rt_h); rt_x = rt_y = rt_h = rt_w = 0; + InfoClock->enableInfoClock(true); } void CInfoViewer::showRadiotext() @@ -1113,6 +1113,7 @@ void CInfoViewer::showRadiotext() infoViewerBB->showIcon_RadioText(g_Radiotext->haveRadiotext()); if (g_Radiotext->S_RtOsd) { + InfoClock->enableInfoClock(false); // dimensions of radiotext window int /*yoff = 8,*/ ii = 0; rt_dx = BoxEndX - BoxStartX; diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index 10707d34f..c7e4237a1 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -44,6 +44,7 @@ #include #include #include +#include class CInfoViewer { @@ -51,6 +52,7 @@ class CInfoViewer CFrameBuffer * frameBuffer; CInfoViewerBB* infoViewerBB; + CComponentsFrmClock *clock; bool gotTime; bool recordModeActive; @@ -116,7 +118,7 @@ class CInfoViewer const char *runningStart = NULL, const char *runningRest = NULL, const char *nextStart = NULL, const char *nextDuration = NULL, bool update_current = true, bool update_next = true); - void paintTime( bool show_dot, bool firstPaint ); + void paintTime( bool show_dot ); void showRecordIcon(const bool show); void showIcon_Tuner() const; @@ -157,7 +159,7 @@ class CInfoViewer CInfoViewer(); ~CInfoViewer(); - void showMovieTitle(const int playState, const std::string &title, + void showMovieTitle(const int playState, const t_channel_id &channel_id, const std::string &title, const std::string &g_file_epg, const std::string &g_file_epg1, const int duration, const int curr_pos); diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 1e2311300..487cda1e8 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -62,7 +63,6 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern cVideo * videoDecoder; -//#define SHOW_RADIOTEXT_ICON #define COL_INFOBAR_BUTTONS_BACKGROUND (COL_INFOBAR_SHADOW_PLUS_1) CInfoViewerBB::CInfoViewerBB() @@ -90,6 +90,8 @@ CInfoViewerBB::CInfoViewerBB() bbIconInfo[0].h = 0; BBarY = 0; BBarFontY = 0; + hddscale = NULL; + sysscale = NULL; Init(); } @@ -162,7 +164,7 @@ void CInfoViewerBB::getBBIconInfo() bbIconMaxH = 0; BBarY = g_InfoViewer->BoxEndY + bottom_bar_offset; BBarFontY = BBarY + InfoHeightY_Info - (InfoHeightY_Info - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()) / 2; /* center in buttonbar */ - bbIconMinX = g_InfoViewer->BoxEndX; + bbIconMinX = g_InfoViewer->BoxEndX - 8; //should be 10px, but 2px will be reduced for each icon CNeutrinoApp* neutrino = CNeutrinoApp::getInstance(); for (int i = 0; i < CInfoViewerBB::ICON_MAX; i++) { @@ -177,12 +179,10 @@ void CInfoViewerBB::getBBIconInfo() if (neutrino->getMode() != NeutrinoMessages::mode_radio) iconView = checkBBIcon(NEUTRINO_ICON_VTXT, &w, &h); break; -#ifdef SHOW_RADIOTEXT_ICON case CInfoViewerBB::ICON_RT: - if (neutrino->getMode() == NeutrinoMessages::mode_radio) - iconView = checkBBIcon(NEUTRINO_ICON_RT, &w, &h); + if ((neutrino->getMode() == NeutrinoMessages::mode_radio) && g_settings.radiotext_enable) + iconView = checkBBIcon(NEUTRINO_ICON_RADIOTEXTGET, &w, &h); break; -#endif case CInfoViewerBB::ICON_DD: if( g_settings.infobar_show_dd_available ) iconView = checkBBIcon(NEUTRINO_ICON_DD, &w, &h); @@ -482,22 +482,19 @@ void CInfoViewerBB::showIcon_DD() showBBIcons(CInfoViewerBB::ICON_DD, dd_icon); } -#ifdef SHOW_RADIOTEXT_ICON void CInfoViewerBB::showIcon_RadioText(bool rt_available) { - // TODO: display radiotext icon - if ((showButtonBar) && (is_visible)) - { - int mode = CNeutrinoApp::getInstance()->getMode(); + if (!is_visible || !g_settings.radiotext_enable) + return; - showBBIcons(CInfoViewerBB::ICON_RT, rt_icon); - } + std::string rt_icon; + if (rt_available) + rt_icon = (g_Radiotext->S_RtOsd) ? NEUTRINO_ICON_RADIOTEXTGET : NEUTRINO_ICON_RADIOTEXTWAIT; + else + rt_icon = NEUTRINO_ICON_RADIOTEXTOFF; + + showBBIcons(CInfoViewerBB::ICON_RT, rt_icon); } -#else -void CInfoViewerBB::showIcon_RadioText(bool /*rt_available*/) -{ -} -#endif void CInfoViewerBB::showIcon_16_9() { @@ -690,7 +687,7 @@ void CInfoViewerBB::showBarHdd(int percent) void CInfoViewerBB::paint_ca_icons(int caid, char * icon, int &icon_space_offset) { char buf[20]; - int endx = g_InfoViewer->BoxEndX -3; + int endx = g_InfoViewer->BoxEndX - 10; int py = g_InfoViewer->BoxEndY + 2; /* hand-crafted, should be automatic */ int px = 0; static map > icon_map; diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index 950450617..522de1c0d 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -217,6 +217,9 @@ int CKeybindSetup::showKeySetup() CMenuWidget bindSettings(LOCALE_MAINSETTINGS_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING); //keybindings + for (int i = 0; i < KEYBINDS_COUNT; i++) + keychooser[i] = new CKeyChooser(key_settings[i].keyvalue_p, key_settings[i].keydescription/*as head caption*/, NEUTRINO_ICON_SETTINGS); + int shortcut = 1; showKeyBindSetup(&bindSettings); CMenuForwarder * mf; @@ -268,6 +271,8 @@ int CKeybindSetup::showKeySetup() } delete keySettings; + for (int i = 0; i < KEYBINDS_COUNT; i++) + delete keychooser[i]; return res; } @@ -280,9 +285,6 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) bindSettings->addIntroItems(LOCALE_KEYBINDINGMENU_HEAD); - for (int i = 0; i < KEYBINDS_COUNT; i++) - keychooser[i] = new CKeyChooser(key_settings[i].keyvalue_p, key_settings[i].keydescription/*as head caption*/, NEUTRINO_ICON_SETTINGS); - //modes CMenuWidget* bindSettings_modes = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_MODES); showKeyBindModeSetup(bindSettings_modes); @@ -313,7 +315,7 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) //misc bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_MISC)); - //bindSettings->addItem(new CMenuDForwarder(keydescription[KEY_PLUGIN], true, NULL, keychooser[KEY_PLUGIN])); + //bindSettings->addItem(new CMenuForwarder(keydescription[KEY_PLUGIN], true, NULL, keychooser[KEY_PLUGIN])); //Special keys CMenuWidget* bindSettings_special = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_SPECIAL); @@ -323,24 +325,24 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) bindSettings->addItem(mf); // unlock - mf = new CMenuDForwarder(key_settings[KEY_UNLOCK].keydescription, true, keychooser[KEY_UNLOCK]->getKeyName(), keychooser[KEY_UNLOCK]); + mf = new CMenuForwarder(key_settings[KEY_UNLOCK].keydescription, true, keychooser[KEY_UNLOCK]->getKeyName(), keychooser[KEY_UNLOCK]); mf->setHint("", key_settings[KEY_UNLOCK].hint); bindSettings->addItem(mf); // screenshot #ifdef SCREENSHOT - mf = new CMenuDForwarder(key_settings[KEY_SCREENSHOT].keydescription, true, keychooser[KEY_SCREENSHOT]->getKeyName(), keychooser[KEY_SCREENSHOT]); + mf = new CMenuForwarder(key_settings[KEY_SCREENSHOT].keydescription, true, keychooser[KEY_SCREENSHOT]->getKeyName(), keychooser[KEY_SCREENSHOT]); mf->setHint("", key_settings[KEY_SCREENSHOT].hint); bindSettings->addItem(mf); #endif #ifdef ENABLE_PIP // pip - mf = new CMenuDForwarder(key_settings[KEY_PIP_CLOSE].keydescription, true, keychooser[KEY_PIP_CLOSE]->getKeyName(), keychooser[KEY_PIP_CLOSE]); + mf = new CMenuForwarder(key_settings[KEY_PIP_CLOSE].keydescription, true, keychooser[KEY_PIP_CLOSE]->getKeyName(), keychooser[KEY_PIP_CLOSE]); mf->setHint("", key_settings[KEY_PIP_CLOSE].hint); bindSettings->addItem(mf); - mf = new CMenuDForwarder(key_settings[KEY_PIP_SETUP].keydescription, true, keychooser[KEY_PIP_SETUP]->getKeyName(), keychooser[KEY_PIP_SETUP]); + mf = new CMenuForwarder(key_settings[KEY_PIP_SETUP].keydescription, true, keychooser[KEY_PIP_SETUP]->getKeyName(), keychooser[KEY_PIP_SETUP]); mf->setHint("", key_settings[KEY_PIP_SETUP].hint); bindSettings->addItem(mf); - mf = new CMenuDForwarder(key_settings[KEY_PIP_SWAP].keydescription, true, keychooser[KEY_PIP_SWAP]->getKeyName(), keychooser[KEY_PIP_SWAP]); + mf = new CMenuForwarder(key_settings[KEY_PIP_SWAP].keydescription, true, keychooser[KEY_PIP_SWAP]->getKeyName(), keychooser[KEY_PIP_SWAP]); mf->setHint("", key_settings[KEY_PIP_SWAP].hint); bindSettings->addItem(mf); #endif @@ -368,11 +370,11 @@ void CKeybindSetup::showKeyBindModeSetup(CMenuWidget *bindSettings_modes) bindSettings_modes->addIntroItems(LOCALE_KEYBINDINGMENU_MODECHANGE); // tv/radio - mf = new CMenuDForwarder(key_settings[KEY_TV_RADIO_MODE].keydescription, true, keychooser[KEY_TV_RADIO_MODE]->getKeyName(), keychooser[KEY_TV_RADIO_MODE], NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + mf = new CMenuForwarder(key_settings[KEY_TV_RADIO_MODE].keydescription, true, keychooser[KEY_TV_RADIO_MODE]->getKeyName(), keychooser[KEY_TV_RADIO_MODE], NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); mf->setHint("", key_settings[KEY_TV_RADIO_MODE].hint); bindSettings_modes->addItem(mf); - mf = new CMenuDForwarder(key_settings[KEY_POWER_OFF].keydescription, true, keychooser[KEY_POWER_OFF]->getKeyName(), keychooser[KEY_POWER_OFF], NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + mf = new CMenuForwarder(key_settings[KEY_POWER_OFF].keydescription, true, keychooser[KEY_POWER_OFF]->getKeyName(), keychooser[KEY_POWER_OFF], NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); mf->setHint("", key_settings[KEY_POWER_OFF].hint); bindSettings_modes->addItem(mf); } @@ -385,7 +387,7 @@ void CKeybindSetup::showKeyBindChannellistSetup(CMenuWidget *bindSettings_chlist bindSettings_chlist->addItem(oj); #endif for (int i = KEY_PAGE_UP; i <= KEY_CURRENT_TRANSPONDER; i++) { - CMenuForwarder * mf = new CMenuDForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); + CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); mf->setHint("", key_settings[i].hint); bindSettings_chlist->addItem(mf); } @@ -400,7 +402,7 @@ void CKeybindSetup::showKeyBindQuickzapSetup(CMenuWidget *bindSettings_qzap) bindSettings_qzap->addIntroItems(LOCALE_KEYBINDINGMENU_QUICKZAP); for (int i = KEY_CHANNEL_UP; i <= KEY_LASTCHANNEL; i++) { - CMenuForwarder * mf = new CMenuDForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); + CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); mf->setHint("", key_settings[i].hint); bindSettings_qzap->addItem(mf); } @@ -411,7 +413,7 @@ void CKeybindSetup::showKeyBindMovieplayerSetup(CMenuWidget *bindSettings_mplaye bindSettings_mplayer->addIntroItems(LOCALE_MAINMENU_MOVIEPLAYER); for (int i = MPKEY_REWIND; i < MPKEY_PLUGIN; i++) { - CMenuForwarder * mf = new CMenuDForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); + CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); mf->setHint("", key_settings[i].hint); bindSettings_mplayer->addItem(mf); } diff --git a/src/gui/mediaplayer.cpp b/src/gui/mediaplayer.cpp index f3ce226ce..d1970c75e 100644 --- a/src/gui/mediaplayer.cpp +++ b/src/gui/mediaplayer.cpp @@ -39,6 +39,7 @@ #include #include +#include #include #include #if ENABLE_UPNP @@ -52,6 +53,7 @@ #include #include extern cVideo * videoDecoder; +extern CInfoClock *InfoClock; CMediaPlayerMenu::CMediaPlayerMenu() { @@ -106,6 +108,7 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "movieplayer") { audiomute->enableMuteIcon(false); + InfoClock->enableInfoClock(false); int mode = CNeutrinoApp::getInstance()->getMode(); if( mode == NeutrinoMessages::mode_radio ) videoDecoder->StopPicture(); @@ -113,6 +116,7 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) if( mode == NeutrinoMessages::mode_radio ) videoDecoder->ShowPicture(DATADIR "/neutrino/icons/radiomode.jpg"); audiomute->enableMuteIcon(true); + InfoClock->enableInfoClock(true); return res; } @@ -258,6 +262,7 @@ int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p) res = media->exec(NULL, ""); delete media; + delete moviePlayer; delete personalize; delete pictureviewergui; #if ENABLE_UPNP diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index f0aecadc6..3973f0b04 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -607,6 +607,7 @@ void CMovieBrowser::initGlobalSettings(void) m_settings.browserRowWidth[5] = m_defaultRowWidth[m_settings.browserRowItem[5]]; //30; m_settings.ytmode = cYTFeedParser::MOST_POPULAR; + m_settings.ytorderby = cYTFeedParser::ORDERBY_PUBLISHED; m_settings.ytresults = 10; m_settings.ytregion = "default"; m_settings.ytquality = 37; @@ -773,6 +774,7 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings) settings->browserRowWidth[i] = configfile.getInt32(cfg_key, 50); } settings->ytmode = configfile.getInt32("mb_ytmode", cYTFeedParser::MOST_POPULAR); + settings->ytorderby = configfile.getInt32("mb_ytorderby", cYTFeedParser::ORDERBY_PUBLISHED); settings->ytresults = configfile.getInt32("mb_ytresults", 10); settings->ytquality = configfile.getInt32("mb_ytquality", 37); // itag value (MP4, 1080p) settings->ytconcconn = configfile.getInt32("mb_ytconcconn", 4); // concurrent connections @@ -840,6 +842,7 @@ bool CMovieBrowser::saveSettings(MB_SETTINGS* settings) configfile.setInt32(cfg_key, settings->browserRowWidth[i]); } configfile.setInt32("mb_ytmode", settings->ytmode); + configfile.setInt32("mb_ytorderby", settings->ytorderby); configfile.setInt32("mb_ytresults", settings->ytresults); configfile.setInt32("mb_ytquality", settings->ytquality); configfile.setInt32("mb_ytconcconn", settings->ytconcconn); @@ -3594,7 +3597,7 @@ void CMovieBrowser::loadYTitles(int mode, std::string search, std::string id) ytparser.SetConcurrentDownloads(m_settings.ytconcconn); if (!ytparser.Parsed() || (ytparser.GetFeedMode() != mode)) { - if (ytparser.ParseFeed((cYTFeedParser::yt_feed_mode_t)mode, search, id)) { + if (ytparser.ParseFeed((cYTFeedParser::yt_feed_mode_t)mode, search, id, (cYTFeedParser::yt_feed_orderby_t)m_settings.ytorderby)) { ytparser.DownloadThumbnails(); } else { //FIXME show error @@ -3643,6 +3646,16 @@ const CMenuOptionChooser::keyval YT_FEED_OPTIONS[] = #define YT_FEED_OPTION_COUNT (sizeof(YT_FEED_OPTIONS)/sizeof(CMenuOptionChooser::keyval)) +const CMenuOptionChooser::keyval YT_ORDERBY_OPTIONS[] = +{ + { cYTFeedParser::ORDERBY_PUBLISHED, LOCALE_MOVIEBROWSER_YT_ORDERBY_PUBLISHED }, + { cYTFeedParser::ORDERBY_RELEVANCE, LOCALE_MOVIEBROWSER_YT_ORDERBY_RELEVANCE }, + { cYTFeedParser::ORDERBY_VIEWCOUNT, LOCALE_MOVIEBROWSER_YT_ORDERBY_VIEWCOUNT }, + { cYTFeedParser::ORDERBY_RATING, LOCALE_MOVIEBROWSER_YT_ORDERBY_RATING }, +}; + +#define YT_ORDERBY_OPTION_COUNT (sizeof(YT_ORDERBY_OPTIONS)/sizeof(CMenuOptionChooser::keyval)) + neutrino_locale_t CMovieBrowser::getFeedLocale(void) { neutrino_locale_t ret = LOCALE_MOVIEBROWSER_YT_MOST_POPULAR; @@ -3740,6 +3753,7 @@ bool CMovieBrowser::showYTMenu() 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_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); + mainMenu.addItem(new CMenuOptionChooser(LOCALE_MOVIEBROWSER_YT_ORDERBY, &m_settings.ytorderby, YT_ORDERBY_OPTIONS, YT_ORDERBY_OPTION_COUNT, true, NULL, CRCInput::RC_nokey, "", true)); sprintf(cnt, "%d", cYTFeedParser::SEARCH); mainMenu.addItem(new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, selector, cnt, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE)); diff --git a/src/gui/moviebrowser.h b/src/gui/moviebrowser.h index 2486bf0e5..e543ee303 100644 --- a/src/gui/moviebrowser.h +++ b/src/gui/moviebrowser.h @@ -229,6 +229,7 @@ typedef struct MB_INFO_ITEM lastRecordRow[MB_MAX_ROWS]; int lastRecordRowWidth[MB_MAX_ROWS]; int ytmode; + int ytorderby; int ytresults; int ytquality; int ytconcconn; diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index fa6e47f67..c073dde40 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -230,6 +230,7 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) } else if (actionKey == "ytplayback") { CAudioMute::getInstance()->enableMuteIcon(false); + InfoClock->enableInfoClock(false); isMovieBrowser = true; moviebrowser->setMode(MB_SHOW_YT); } @@ -272,8 +273,10 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); - if (moviebrowser->getMode() == MB_SHOW_YT) + if (moviebrowser->getMode() == MB_SHOW_YT) { CAudioMute::getInstance()->enableMuteIcon(true); + InfoClock->enableInfoClock(true); + } if (timeshift){ timeshift = 0; @@ -426,6 +429,7 @@ bool CMoviePlayerGui::SelectFile() } else { // filebrowser CAudioMute::getInstance()->enableMuteIcon(false); + InfoClock->enableInfoClock(false); if (filebrowser->exec(Path_local.c_str()) == true) { Path_local = filebrowser->getCurrentDir(); CFile *file; @@ -464,6 +468,7 @@ bool CMoviePlayerGui::SelectFile() } else menu_ret = filebrowser->getMenuRet(); CAudioMute::getInstance()->enableMuteIcon(true); + InfoClock->enableInfoClock(true); } if(ret && file_name.empty()) { std::string::size_type pos = full_name.find_last_of('/'); @@ -520,7 +525,7 @@ void CMoviePlayerGui::PlayFile(void) neutrino_msg_data_t data; menu_ret = menu_return::RETURN_REPAINT; - bool first_start_timeshift = false; + bool first_start = true; bool time_forced = false; bool update_lcd = true; int eof = 0; @@ -563,7 +568,6 @@ void CMoviePlayerGui::PlayFile(void) playstate = CMoviePlayerGui::PLAY; CVFD::getInstance()->ShowIcon(FP_ICON_PLAY, true); if(timeshift) { - first_start_timeshift = true; startposition = -1; int i; int towait = (timeshift == 1) ? TIMESHIFT_SECONDS+1 : TIMESHIFT_SECONDS; @@ -601,6 +605,7 @@ void CMoviePlayerGui::PlayFile(void) } CAudioMute::getInstance()->enableMuteIcon(true); + InfoClock->enableInfoClock(true); while (playstate >= CMoviePlayerGui::PLAY) { @@ -608,9 +613,9 @@ void CMoviePlayerGui::PlayFile(void) update_lcd = false; updateLcd(); } - if (first_start_timeshift) { + if (first_start) { callInfoViewer(/*duration, position*/); - first_start_timeshift = false; + first_start = false; } g_RCInput->getMsg(&msg, &data, 10); // 1 secs.. @@ -621,6 +626,8 @@ void CMoviePlayerGui::PlayFile(void) file_prozent = (unsigned char) (position / (duration / 100)); #if HAVE_TRIPLEDRAGON CVFD::getInstance()->showPercentOver(file_prozent, true, CVFD::MODE_MOVIE); +#else + CVFD::getInstance()->showPercentOver(file_prozent); #endif playback->GetSpeed(speed); @@ -821,7 +828,7 @@ void CMoviePlayerGui::PlayFile(void) } else if ( msg == NeutrinoMessages::ZAPTO || msg == NeutrinoMessages::STANDBY_ON || msg == NeutrinoMessages::SHUTDOWN || - msg == NeutrinoMessages::SLEEPTIMER) { // Exit for Record/Zapto Timers + ((msg == NeutrinoMessages::SLEEPTIMER) && !data) ) { // Exit for Record/Zapto Timers printf("CMoviePlayerGui::PlayFile: ZAPTO etc..\n"); if(msg != NeutrinoMessages::ZAPTO) menu_ret = menu_return::RETURN_EXIT_ALL; @@ -863,9 +870,7 @@ void CMoviePlayerGui::PlayFile(void) restoreNeutrino(); CAudioMute::getInstance()->enableMuteIcon(false); - - if (g_settings.mode_clock) - InfoClock->StartClock(); + InfoClock->enableInfoClock(false); } void CMoviePlayerGui::callInfoViewer(/*const int duration, const int curr_pos*/) @@ -881,13 +886,13 @@ void CMoviePlayerGui::callInfoViewer(/*const int duration, const int curr_pos*/) getCurrentAudioName( is_file_player, currentaudioname); if (isMovieBrowser && p_movie_info) { - g_InfoViewer->showMovieTitle(playstate, p_movie_info->epgChannel, p_movie_info->epgTitle, p_movie_info->epgInfo1, + g_InfoViewer->showMovieTitle(playstate, p_movie_info->epgEpgId >>16, p_movie_info->epgChannel, p_movie_info->epgTitle, p_movie_info->epgInfo1, duration, position); return; } /* not moviebrowser => use the filename as title */ - g_InfoViewer->showMovieTitle(playstate, file_name, "", "", duration, position); + g_InfoViewer->showMovieTitle(playstate, 0, file_name, "", "", duration, position); } bool CMoviePlayerGui::getAudioName(int apid, std::string &apidtitle) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 9776ffbb5..7915c23c8 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -45,6 +45,8 @@ #include "osdlang_setup.h" #include "filebrowser.h" +#include +#include #include #include #include @@ -558,6 +560,13 @@ int COsdSetup::showOsdSetup() mf->setHint("", LOCALE_MENU_HINT_VOLUME); osd_menu->addItem(mf); + //info clock + CMenuWidget osd_menu_infoclock(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_INFOCLOCK); + showOsdInfoclockSetup(&osd_menu_infoclock); + mf = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOCLOCK, true, NULL, &osd_menu_infoclock, NULL, CRCInput::convertDigitToKey(shortcut++)); + mf->setHint("", LOCALE_MENU_HINT_INFOCLOCK_SETUP); + osd_menu->addItem(mf); + #ifdef SCREENSHOT //screenshot CMenuWidget osd_menu_screenshot(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_SCREENSHOT); @@ -613,6 +622,7 @@ int COsdSetup::showOsdSetup() osd_menu->addItem(mc); int oldVolumeSize = g_settings.volume_size; + int oldInfoClockSize = g_settings.infoClockFontSize; int res = osd_menu->exec(NULL, ""); @@ -625,6 +635,15 @@ int COsdSetup::showOsdSetup() if (oldVolumeSize != g_settings.volume_size) CVolumeHelper::getInstance()->refresh(); + if (oldInfoClockSize != g_settings.infoClockFontSize) { + CInfoClock::getInstance()->setClockFontSize(g_settings.infoClockFontSize); + CVolumeHelper::getInstance()->refresh(); + if (CNeutrinoApp::getInstance()->isMuted()) { + CAudioMute::getInstance()->enableMuteIcon(false); + CAudioMute::getInstance()->enableMuteIcon(true); + } + } + delete osd_menu; return res; } @@ -814,6 +833,13 @@ void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts) fontSettings->addItem(mf); w_index++; } +#if 0 + // size of info clock + fontSettings->addItem(GenericMenuSeparatorLine); + CMenuOptionNumberChooser* mn = new CMenuOptionNumberChooser(LOCALE_CLOCK_SIZE, &g_settings.infoClockFontSize, true, 30, 120); + mn->setHint("", LOCALE_MENU_HINT_CLOCK_SIZE); + fontSettings->addItem(mn); +#endif } //osd timeouts @@ -1024,6 +1050,17 @@ void COsdSetup::showOsdVolumeSetup(CMenuWidget *menu_volume) menu_volume->addItem(mc); } +//info clock +void COsdSetup::showOsdInfoclockSetup(CMenuWidget *menu_infoclock) +{ + menu_infoclock->addIntroItems(LOCALE_MISCSETTINGS_INFOCLOCK); + + // size of info clock + CMenuOptionNumberChooser* mn = new CMenuOptionNumberChooser(LOCALE_CLOCK_SIZE_HEIGHT, &g_settings.infoClockFontSize, true, 30, 120); + mn->setHint("", LOCALE_MENU_HINT_CLOCK_SIZE); + menu_infoclock->addItem(mn); +} + bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) { if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLORMENU_CONTRAST_FONTS)) diff --git a/src/gui/osd_setup.h b/src/gui/osd_setup.h index 68ab6ad17..2d30c064e 100644 --- a/src/gui/osd_setup.h +++ b/src/gui/osd_setup.h @@ -68,6 +68,7 @@ class COsdSetup : public CMenuTarget, public CChangeObserver void showOsdChanlistSetup(CMenuWidget *menu_chanlist); void showOsdEventlistSetup(CMenuWidget *menu_eventlist); void showOsdVolumeSetup(CMenuWidget *menu_volume); + void showOsdInfoclockSetup(CMenuWidget *menu_infoclock); void showOsdScreenShotSetup(CMenuWidget *menu_screenshot); void paintWindowSize(int w, int h); diff --git a/src/gui/osdlang_setup.cpp b/src/gui/osdlang_setup.cpp index c57cbce3e..f4a82d14b 100644 --- a/src/gui/osdlang_setup.cpp +++ b/src/gui/osdlang_setup.cpp @@ -60,6 +60,7 @@ COsdLangSetup::COsdLangSetup(bool wizard_mode) is_wizard = wizard_mode; width = w_max (45, 10); + tzNotifier = NULL; } COsdLangSetup::~COsdLangSetup() @@ -97,6 +98,7 @@ int COsdLangSetup::showLocalSetup() localSettings->addItem(mf); //timezone setup + tzNotifier = new CTZChangeNotifier(); CMenuOptionStringChooser* tzSelect = getTzItems(); if (tzSelect != NULL) localSettings->addItem(tzSelect); @@ -115,6 +117,7 @@ int COsdLangSetup::showLocalSetup() int res = localSettings->exec(NULL, ""); delete localSettings; delete langNotifier; + delete tzNotifier; return res; } @@ -127,7 +130,7 @@ CMenuOptionStringChooser* COsdLangSetup::getTzItems() CMenuOptionStringChooser* tzSelect = NULL; if (parser != NULL) { - tzSelect = new CMenuOptionStringChooser(LOCALE_MAINSETTINGS_TIMEZONE, g_settings.timezone, true, new CTZChangeNotifier(), CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN, true); + tzSelect = new CMenuOptionStringChooser(LOCALE_MAINSETTINGS_TIMEZONE, g_settings.timezone, true, tzNotifier, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN, true); tzSelect->setHint("", LOCALE_MENU_HINT_TIMEZONE); xmlNodePtr search = xmlDocGetRootElement(parser)->xmlChildrenNode; bool found = false; diff --git a/src/gui/osdlang_setup.h b/src/gui/osdlang_setup.h index 1e181b46b..e99125d76 100644 --- a/src/gui/osdlang_setup.h +++ b/src/gui/osdlang_setup.h @@ -54,6 +54,7 @@ class COsdLangSetup : public CMenuTarget, CChangeObserver int width; bool is_wizard; + CTZChangeNotifier * tzNotifier; int showLocalSetup(); void showPrefMenu(CMenuWidget *prefMenu, CLangSelectNotifier *langNotifier); diff --git a/src/gui/parentallock_setup.cpp b/src/gui/parentallock_setup.cpp index fba9290d0..160d88701 100644 --- a/src/gui/parentallock_setup.cpp +++ b/src/gui/parentallock_setup.cpp @@ -108,10 +108,13 @@ int CParentalSetup::showParentalSetup() // intros plock->addIntroItems(); + CMenuForwarder * mf; CPersonalizeGui &p = CNeutrinoApp::getInstance()->getPersonalizeGui(); - CMenuForwarder * mf = new CMenuForwarder(LOCALE_PARENTALLOCK_MENU, true, NULL, &p, NULL, CRCInput::RC_red , NEUTRINO_ICON_BUTTON_RED); - mf->setHint("", LOCALE_MENU_HINT_PARENTALLOCK_MENU); - plock->addItem(mf); + if (g_settings.easymenu) { + mf = new CMenuForwarder(LOCALE_PARENTALLOCK_MENU, true, NULL, &p, NULL, CRCInput::RC_red , NEUTRINO_ICON_BUTTON_RED); + mf->setHint("", LOCALE_MENU_HINT_PARENTALLOCK_MENU); + plock->addItem(mf); + } CMenuOptionChooser * mc; if (g_settings.easymenu) diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index 1e691cc98..602b2d32d 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -73,6 +74,7 @@ #include extern cVideo * videoDecoder; +extern CInfoClock *InfoClock; //------------------------------------------------------------------------ bool comparePictureByDate (const CPicture& a, const CPicture& b) @@ -255,6 +257,7 @@ int CPictureViewerGui::show() m_currentTitle = m_audioPlayer->getAudioPlayerM_current(); CAudioMute::getInstance()->enableMuteIcon(false); + InfoClock->enableInfoClock(false); while (loop) { @@ -639,6 +642,7 @@ int CPictureViewerGui::show() hide(); CAudioMute::getInstance()->enableMuteIcon(true); + InfoClock->enableInfoClock(true); return(res); } diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 119b47fc8..b3030af96 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -199,9 +199,6 @@ CScanSetup::CScanSetup(bool wizard_mode) width = w_max (40, 10); is_wizard = wizard_mode; - satSelect = NULL; - cableSelect = NULL; - terrSelect = NULL; satOnOff = NULL; fautoScanAll = NULL; frontendSetup = NULL; @@ -217,8 +214,6 @@ CScanSetup::CScanSetup(bool wizard_mode) allow_start = true; if (CFEManager::getInstance()->haveCable()) nid = new CIntInput(LOCALE_SATSETUP_CABLE_NID, (int&) scansettings.cable_nid, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE); - if (CFEManager::getInstance()->haveSat()) - satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); } CScanSetup* CScanSetup::getInstance() @@ -235,7 +230,6 @@ CScanSetup* CScanSetup::getInstance() CScanSetup::~CScanSetup() { - delete satSelect; delete nid; } @@ -411,14 +405,8 @@ printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager: //settings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SCANTS_PREVERENCES_RECEIVING_SYSTEM )); - //satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); - satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE); - satOnOff = new CMenuWidget(LOCALE_SATSETUP_SATELLITE, NEUTRINO_ICON_SETTINGS, width); - /* add configured satellites to satSelect */ - fillSatSelect(satSelect); - //auto scan char autoscan[64]; std::string s_capt_part = g_Locale->getText(LOCALE_SATSETUP_SATELLITE); @@ -426,14 +414,14 @@ printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager: CMenuWidget * autoScan = new CMenuWidget(LOCALE_SERVICEMENU_SCANTS, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_AUTO_SCAN); addScanMenuAutoScan(autoScan); - mf = new CMenuForwarderNonLocalized(autoscan, true, NULL, autoScan, "", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + mf = new CMenuDForwarderNonLocalized(autoscan, true, NULL, autoScan, "", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); mf->setHint("", LOCALE_MENU_HINT_SCAN_AUTO); settings->addItem(mf); //manual scan CMenuWidget * manualScan = new CMenuWidget(LOCALE_SATSETUP_MANUAL_SCAN, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_MANUAL_SCAN); addScanMenuManualScan(manualScan); - mf = new CMenuForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + mf = new CMenuDForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); mf->setHint("", LOCALE_MENU_HINT_SCAN_MANUAL); settings->addItem(mf); //auto scan all @@ -454,12 +442,9 @@ printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager: if (CFEManager::getInstance()->haveCable()) { r_system = DVB_C; - cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); - cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); //-------------------------------------------------------------- settings->addItem(GenericMenuSeparatorLine); //-------------------------------------------------------------- - fillCableSelect(cableSelect); //tune timeout if(CFEManager::getInstance()->getFrontendCount() <= 1) { CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_EXTRA_ZAPIT_FE_TIMEOUT, (int *)&zapitCfg.feTimeout, true, 6, 100); @@ -476,14 +461,14 @@ printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager: CMenuWidget * autoScan = new CMenuWidget(LOCALE_SERVICEMENU_SCANTS, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_AUTO_SCAN); addScanMenuAutoScan(autoScan); - mf = new CMenuForwarderNonLocalized(autoscan, true, NULL, autoScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_red, have_sat ? NULL : NEUTRINO_ICON_BUTTON_RED); + mf = new CMenuDForwarderNonLocalized(autoscan, true, NULL, autoScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_red, have_sat ? NULL : NEUTRINO_ICON_BUTTON_RED); mf->setHint("", LOCALE_MENU_HINT_SCAN_AUTO); settings->addItem(mf); //manual scan CMenuWidget * manualScan = new CMenuWidget(LOCALE_SATSETUP_MANUAL_SCAN, NEUTRINO_ICON_SETTINGS, w/*width*/, MN_WIDGET_ID_SCAN_MANUAL_SCAN); addScanMenuManualScan(manualScan); - mf = new CMenuForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_green, have_sat ? NULL : NEUTRINO_ICON_BUTTON_GREEN); + mf = new CMenuDForwarder(LOCALE_SATSETUP_MANUAL_SCAN, true, NULL, manualScan, "", have_sat ? CRCInput::convertDigitToKey(shortcut++) : CRCInput::RC_green, have_sat ? NULL : NEUTRINO_ICON_BUTTON_GREEN); mf->setHint("", LOCALE_MENU_HINT_SCAN_MANUAL); settings->addItem(mf); //simple cable scan @@ -495,13 +480,6 @@ printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager: } if (CFEManager::getInstance()->haveTerr()) { r_system = DVB_T; - - terrSelect = new CMenuOptionStringChooser(LOCALE_TERRESTRIALSETUP_PROVIDER, scansettings.terrName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); - //terrSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); - //-------------------------------------------------------------- - settings->addItem(GenericMenuSeparatorLine); - //-------------------------------------------------------------- - fillCableSelect(terrSelect); // tune timeout, "Setup tuner" is not shown for only one non-sat tuner if (CFEManager::getInstance()->getFrontendCount() <= 1) { CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_EXTRA_ZAPIT_FE_TIMEOUT, (int *)&zapitCfg.feTimeout, true, 6, 100); @@ -781,7 +759,7 @@ int CScanSetup::showFrontendSetup(int number) mc->setHint("", LOCALE_MENU_HINT_SCAN_SATENABLE); satToSelect->addItem(mc); } - fsatSelect = new CMenuForwarder(LOCALE_SATSETUP_SELECT_SAT, allow_moptions, NULL, satToSelect, "", CRCInput::convertDigitToKey(shortcut++)); + fsatSelect = new CMenuDForwarder(LOCALE_SATSETUP_SELECT_SAT, allow_moptions, NULL, satToSelect, "", CRCInput::convertDigitToKey(shortcut++)); fsatSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATADD); setupMenu->addItem(fsatSelect); @@ -1121,15 +1099,25 @@ void CScanSetup::addScanMenuManualScan(CMenuWidget *manual_Scan) manual_Scan->addIntroItems(); //---------------------------------------------------------------------- if (r_system == DVB_C) { + CMenuOptionStringChooser * cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); + fillCableSelect(cableSelect); manual_Scan->addItem(cableSelect); mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid); mf->setHint("", LOCALE_MENU_HINT_SCAN_NID); manual_Scan->addItem(mf); mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "cable", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); } else if (r_system == DVB_T) { + CMenuOptionStringChooser * terrSelect = new CMenuOptionStringChooser(LOCALE_TERRESTRIALSETUP_PROVIDER, scansettings.terrName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + //terrSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); + fillCableSelect(terrSelect); manual_Scan->addItem(terrSelect); mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "terrestrial", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); } else { + CMenuOptionStringChooser * satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE); + /* add configured satellites to satSelect */ + fillSatSelect(satSelect); manual_Scan->addItem(satSelect); mf = new CMenuDForwarder(LOCALE_SCANTS_SELECT_TP, true, NULL, new CTPSelectHandler(), "sat", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); } @@ -1221,15 +1209,25 @@ void CScanSetup::addScanMenuAutoScan(CMenuWidget *auto_Scan) const char *action; if (r_system == DVB_C) { //cable + CMenuOptionStringChooser * cableSelect = new CMenuOptionStringChooser(LOCALE_CABLESETUP_PROVIDER, scansettings.cableName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + cableSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); + fillCableSelect(cableSelect); auto_Scan->addItem(cableSelect); mf = new CMenuForwarder(LOCALE_SATSETUP_CABLE_NID, true, nid->getValue(), nid); mf->setHint("", LOCALE_MENU_HINT_SCAN_NID); auto_Scan->addItem(mf); action = "cauto"; } else if (r_system == DVB_T) { + CMenuOptionStringChooser * terrSelect = new CMenuOptionStringChooser(LOCALE_TERRESTRIALSETUP_PROVIDER, scansettings.terrName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + //terrSelect->setHint("", LOCALE_MENU_HINT_SCAN_CABLE); + fillCableSelect(terrSelect); auto_Scan->addItem(terrSelect); action = "tauto"; } else { + CMenuOptionStringChooser * satSelect = new CMenuOptionStringChooser(LOCALE_SATSETUP_SATELLITE, scansettings.satName, true, this, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + satSelect->setHint("", LOCALE_MENU_HINT_SCAN_SATELLITE); + /* add configured satellites to satSelect */ + fillSatSelect(satSelect); auto_Scan->addItem(satSelect); action = "sauto"; } diff --git a/src/gui/scan_setup.h b/src/gui/scan_setup.h index e1408a637..5e416f97b 100644 --- a/src/gui/scan_setup.h +++ b/src/gui/scan_setup.h @@ -50,9 +50,6 @@ class CScanSetup : public CMenuTarget, public CChangeObserver int width; private: - CMenuOptionStringChooser *satSelect; - CMenuOptionStringChooser *cableSelect; - CMenuOptionStringChooser *terrSelect; CMenuWidget *satOnOff; /* global items to be enabled/disabled in notify */ diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index c9894d958..9a8ef4dc0 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -886,8 +886,8 @@ int CStreamInfo2::ts_close () void CStreamInfo2::showSNR () { if (signalbox == NULL){ - signalbox = new CSignalBox(x + 10, yypos, 240/*statusbox->getWidth()-2*/, 50, frontend); - signalbox->setScaleWidth(66); + signalbox = new CSignalBox(x + 10, yypos, 240, 50, frontend); + signalbox->setScaleWidth(60); /*%*/ signalbox->setColorBody(COL_MENUHEAD_PLUS_0); signalbox->setTextColor(COL_INFOBAR_TEXT); signalbox->doPaintBg(true); diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 43f39abd8..fe80bf0ce 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -619,7 +619,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "running_clock"){ if (clock_r == NULL){ clock_r = new CComponentsFrmClock(100, 50, 0, 50, "%H.%M:%S"); - clock_r->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]); + clock_r->setClockFont(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME); clock_r->setClockIntervall(1); // clock_r->doPaintBg(false); } @@ -640,7 +640,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "clock"){ if (clock == NULL){ clock = new CComponentsFrmClock(100, 50, 0, 50, "%H:%M", false); - clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]); + clock->setClockFont(SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME); } if (!clock->isPainted()) diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index 0978e927d..c7ea16720 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -54,8 +54,7 @@ CTimeOSD::~CTimeOSD() void CTimeOSD::show(time_t time_show) { - if (g_settings.mode_clock) - InfoClock->StartClock(); + InfoClock->enableInfoClock(false); GetDimensions(); visible = true; @@ -75,10 +74,8 @@ void CTimeOSD::GetDimensions() m_height = 10; m_y = frameBuffer->getScreenY(); m_width = g_Font[TIMEOSD_FONT]->getRenderWidth("00:00:00"); - t1 = g_Font[TIMEOSD_FONT]->getRenderWidth(widest_number); + t1 = g_Font[TIMEOSD_FONT]->getMaxDigitWidth(); m_width += t1; - if(g_settings.mode_clock) - m_xend = m_xend - m_width - (m_width/4); } void CTimeOSD::update(time_t time_show) @@ -142,8 +139,7 @@ void CTimeOSD::hide() if(!visible) return; - if (g_settings.mode_clock) - InfoClock->StopClock(); + InfoClock->enableInfoClock(true); //GetDimensions(); frameBuffer->paintBackgroundBoxRel(m_xend - m_width - t1, m_y, m_width, m_height); diff --git a/src/gui/update.cpp b/src/gui/update.cpp index 220b00f7f..4ce1bac7b 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -818,7 +818,7 @@ int CFlashExpert::showMTDSelector(const std::string & actionkey) enabled = false; // build jffs2 image from root0 if ((actionkey == "readmtd") && (lx == mtdInfo->findMTDNumberFromName("root0"))) { - CMenuForwarder *mf = new CMenuForwarderNonLocalized("root0", true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(shortcut++)); + CMenuForwarder *mf = new CMenuDForwarderNonLocalized("root0", true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(shortcut++)); mtdselector->addItem(mf); continue; } diff --git a/src/gui/update_menue.cpp b/src/gui/update_menue.cpp index 73162ae4e..5cfd1830c 100644 --- a/src/gui/update_menue.cpp +++ b/src/gui/update_menue.cpp @@ -118,9 +118,9 @@ int CSoftwareUpdate::showSoftwareUpdate() softUpdate.addItem(GenericMenuSeparatorLine); if (g_settings.easymenu) - mf = new CMenuForwarder(LOCALE_FLASHUPDATE_CREATEIMAGE_MENU, true, NULL, new CFlashExpertSetup(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + mf = new CMenuDForwarder(LOCALE_FLASHUPDATE_CREATEIMAGE_MENU, true, NULL, new CFlashExpertSetup(), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); else - mf = new CMenuForwarder(LOCALE_FLASHUPDATE_CREATEIMAGE_MENU, true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(1)); + mf = new CMenuDForwarder(LOCALE_FLASHUPDATE_CREATEIMAGE_MENU, true, NULL, new CFlashExpertSetup(), NULL, CRCInput::convertDigitToKey(1)); mf->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_CREATEIMAGE_MENU); softUpdate.addItem(mf); #endif diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 626e661df..a871a2270 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -52,6 +52,7 @@ #include #include +#include #include #include @@ -67,6 +68,7 @@ extern cVideo * videoDecoder; extern CPictureViewer * g_PicViewer; +extern CInfoClock *InfoClock; const struct button_label RescanButton = {NEUTRINO_ICON_BUTTON_BLUE , LOCALE_UPNPBROWSER_RESCAN}; const struct button_label BrowseButtons[4] = @@ -454,6 +456,7 @@ void CUpnpBrowserGui::selectDevice() return; CAudioMute::getInstance()->enableMuteIcon(false); + InfoClock->enableInfoClock(false); while (loop) { @@ -543,6 +546,7 @@ printf("msg: %x\n", (int) msg); } } CAudioMute::getInstance()->enableMuteIcon(true); + InfoClock->enableInfoClock(true); } void CUpnpBrowserGui::playnext(void) diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index f2c1ade75..1a264f139 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -44,8 +44,6 @@ CVolumeBar::CVolumeBar() void CVolumeBar::initVarVolumeBar() { - //init inherited variables - initVarForm(); col_body = COL_MENUCONTENT_PLUS_0; vb_item_offset = 4; @@ -79,6 +77,7 @@ void CVolumeBar::initVarVolumeBar() void CVolumeBar::initVolumeBarSize() { CVolumeHelper *cvh = CVolumeHelper::getInstance(); + cvh->refresh(); cvh->getSpacer(&h_spacer, &v_spacer); cvh->getDimensions(&x, &y, &sw, &sh, &vb_icon_w, &vb_digit_w); cvh->getVolBarDimensions(&y, &height); @@ -101,16 +100,14 @@ void CVolumeBar::initVolumeBarSize() cvh->getMuteIconDimensions(&mute_ax, &mute_ay, &mute_dx, &mute_dy); // info clock int dummy; - cvh->getInfoClockDimensions(&dummy, &clock_y, &clock_width, &clock_height, &dummy, &dummy); + cvh->getInfoClockDimensions(&dummy, &clock_y, &clock_width, &clock_height); int mute_corrY = 0; if (mute_dy < height) mute_corrY = (height - mute_dy) / 2; cvh->setMuteIconCorrY(mute_corrY); - if ((g_settings.mode_clock) && (!CNeutrinoApp::getInstance()->isMuted())) - CInfoClock::getInstance()->ClearDisplay(); - vb_pbh = height-8; + vb_pby = height/2-vb_pbh/2; } @@ -127,7 +124,7 @@ void CVolumeBar::initVolumeBarPosition() if ((neutrino->isMuted()) && (!g_settings.mode_clock)) x_corr = mute_dx + h_spacer; if (g_settings.mode_clock) - y += max(clock_y + clock_height, mute_ay + mute_dy); + y = clock_y + clock_height + v_spacer; } x = sw - width - x_corr; break; @@ -262,34 +259,46 @@ CVolumeHelper::CVolumeHelper() { h_spacer = 11; v_spacer = 6; + vb_font = NULL; + clock_font = NULL; frameBuffer = CFrameBuffer::getInstance(); Init(); } -void CVolumeHelper::Init() +void CVolumeHelper::Init(Font** font) { x = frameBuffer->getScreenX() + h_spacer; y = frameBuffer->getScreenY() + v_spacer; sw = g_settings.screen_EndX - h_spacer; sh = frameBuffer->getScreenHeight(); - vb_font = NULL; initVolBarSize(); initMuteIcon(); - initInfoClock(); + initInfoClock(font); } -void CVolumeHelper::initInfoClock() +void CVolumeHelper::initInfoClock(Font** font) { - digit_offset = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getDigitOffset(); - digit_h = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getDigitHeight(); - int t1 = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(widest_number); - int t2 = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(":"); - clock_dy = digit_h + (int)((float)digit_offset * 1.5); - clock_dx = t1*6 + t2*2; + if (clock_font == NULL){ + if (font == NULL) { + clock_font = &g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + } + else + clock_font = font; + } + else { + if (font != NULL) + clock_font = font; + } + digit_offset = (*clock_font)->getDigitOffset(); + digit_h = (*clock_font)->getDigitHeight(); + int t1 = (*clock_font)->getMaxDigitWidth(); + int t2 = (*clock_font)->getRenderWidth(":"); + clock_dy = digit_h + (int)((float)digit_offset * 1.3); + clock_dx = t1*7 + t2*2; clock_ax = sw - clock_dx; clock_ay = y; vol_ay = y; @@ -339,9 +348,17 @@ void CVolumeHelper::initVolBarSize() } } -void CVolumeHelper::refresh() +int CVolumeHelper::getInfoClockX() { - Init(); + if (CNeutrinoApp::getInstance()->isMuted()) + return clock_ax - mute_dx - h_spacer; + else + return clock_ax; +} + +void CVolumeHelper::refresh(Font** font) +{ + Init(font); } CVolumeHelper* CVolumeHelper::getInstance() diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index c19b04424..b028da0a5 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -105,12 +105,13 @@ class CVolumeHelper int icon_width, icon_height, digit_width; int h_spacer, v_spacer; int vol_ay, vol_height; + Font** clock_font; CFrameBuffer *frameBuffer; - void Init(); + void Init(Font** font=NULL); void initVolBarSize(); void initMuteIcon(); - void initInfoClock(); + void initInfoClock(Font** font); public: @@ -123,10 +124,11 @@ class CVolumeHelper int getVolIconHeight() {return icon_height;} void getDimensions(int *_x, int *_y, int *_sw, int *_sh, int *_iw, int *_dw) { *_x = x; *_y = y; *_sw = sw; *_sh = sh; *_iw = icon_width; *_dw = digit_width; } void getMuteIconDimensions(int *_x, int *_y, int *w, int *h) { *_x = mute_ax; *_y = mute_ay+mute_corrY; *w = mute_dx; *h = mute_dy; } - void getInfoClockDimensions(int *_x, int *_y, int *w, int *h, int *d_h, int *d_o) { *_x = clock_ax; *_y = clock_ay; *w = clock_dx; *h = clock_dy, *d_h = digit_h, *d_o = digit_offset; } + int getInfoClockX(); + void getInfoClockDimensions(int *_x, int *_y, int *w, int *h) { *_x = getInfoClockX(); *_y = clock_ay; *w = clock_dx; *h = clock_dy; } void getVolBarDimensions(int *_y, int *_dy) { *_y = vol_ay; *_dy = vol_height; } void setMuteIconCorrY(int corr) { mute_corrY = corr; } - void refresh(); + void refresh(Font** font=NULL); }; #endif diff --git a/src/gui/widget/icons.h b/src/gui/widget/icons.h index c74164a90..772528232 100644 --- a/src/gui/widget/icons.h +++ b/src/gui/widget/icons.h @@ -110,6 +110,9 @@ #define NEUTRINO_ICON_FF "mp_f-skip" #define NEUTRINO_ICON_PROTECTING "protecting" #define NEUTRINO_ICON_QUESTION "question" +#define NEUTRINO_ICON_RADIOTEXTGET "radiotextget" +#define NEUTRINO_ICON_RADIOTEXTWAIT "radiotextwait" +#define NEUTRINO_ICON_RADIOTEXTOFF "radiotextoff" #define NEUTRINO_ICON_RADIOMODE "radiomode" #define NEUTRINO_ICON_RECORDING "recording" #define NEUTRINO_ICON_REC "rec" diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 77d4c6b46..bdc4c4123 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -507,14 +507,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) break; pos++; } -#if 0 - GenericMenuBack->setHint("", NONEXISTANT_LOCALE); -#endif checkHints(); -#if 0 - if (has_hints) - GenericMenuBack->setHint(NEUTRINO_ICON_HINT_BACK, LOCALE_MENU_HINT_BACK); -#endif if(savescreen) { calcSize(); @@ -816,11 +809,6 @@ void CMenuWidget::calcSize() int tmpw = items[i]->getWidth() + 10 + 10 + wi; /* 10 pixels to the left and right of the text */ if (tmpw > width) width = tmpw; -#if 0 - if(!items[i]->hintIcon.empty() || items[i]->hint != NONEXISTANT_LOCALE) { - has_hints = true; - } -#endif } hint_height = 0; if(g_settings.show_menu_hints && has_hints) { @@ -1092,34 +1080,13 @@ void CMenuWidget::paintHint(int pos) if (pos < 0 && !hint_painted) return; -#if 0 - if (hint_painted) { - /* clear detailsline line */ - // TODO CComponents::hide with param restore ? or auto (if it have saved screens) ? - if (details_line != NULL) { - if (savescreen) - details_line->restore(); - else - details_line->hide(); - } - /* clear info box */ - if (info_box != NULL) { - if (pos == -1) { - if (savescreen) - info_box->restore(); - else - info_box->hide(); - } - } - hint_painted = false; -#endif if (hint_painted) { /* clear detailsline line */ if (details_line) - details_line->hide(); + savescreen ? details_line->hide() : details_line->kill(); /* clear info box */ if ((info_box) && (pos == -1)) - info_box->hide(true); + savescreen ? info_box->hide(true) : info_box->kill(); hint_painted = false; } if (pos < 0) @@ -1128,18 +1095,8 @@ void CMenuWidget::paintHint(int pos) CMenuItem* item = items[pos]; if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE) { -#if 0 - if (info_box != NULL) { - if (savescreen) -#endif if (info_box) info_box->hide(false); -#if 0 - info_box->restore(); - else - info_box->hide(); - } -#endif return; } @@ -1168,9 +1125,6 @@ void CMenuWidget::paintHint(int pos) details_line->setHMarkDown(markh); details_line->syncSysColors(); } -#if 0 - details_line->paint(savescreen); -#endif //init infobox std::string str = g_Locale->getText(item->hint); @@ -1185,18 +1139,12 @@ void CMenuWidget::paintHint(int pos) info_box->setShadowOnOff(CC_SHADOW_ON); info_box->setPicture(item->hintIcon); } -#if 0 - /* force full paint - menu-over i.e. option chooser with pulldown can overwrite */ - info_box->paint(savescreen, true); -#endif - //paint result - details_line->paint(); - info_box->paint(); + details_line->paint(savescreen); + info_box->paint(savescreen); hint_painted = true; - } void CMenuWidget::addKey(neutrino_msg_t key, CMenuTarget *menue, const std::string & action) @@ -1280,15 +1228,29 @@ int CMenuOptionNumberChooser::getWidth(void) const char * l_optionName = (optionString != NULL) ? optionString : g_Locale->getText(optionName); int width = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_optionName, true); - char tmp[20], *t; + int _lower_bound = lower_bound; + int _upper_bound = upper_bound; + int m = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getMaxDigitWidth(); - snprintf(tmp, sizeof(tmp), "%d", lower_bound); - for(t = tmp; *t; t++) if (isdigit((int)*t)) *t = *widest_number; - int w1 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); + int w1 = 0; + if (_lower_bound < 0) { + w1 += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("-", true); + lower_bound *= -1; + } + while (_lower_bound > 0) { + w1 += m; + _lower_bound /= 10; + } - snprintf(tmp, sizeof(tmp), "%d", upper_bound); - for(t = tmp; *t; t++) if (isdigit((int)*t)) *t = *widest_number; - int w2 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true); + int w2 = 0; + if (_upper_bound < 0) { + w2 += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("-", true); + _upper_bound *= -1; + } + while (_upper_bound > 0) { + w1 += m; + _upper_bound /= 10; + } width += (w1 > w2) ? w1 : w2; @@ -1868,6 +1830,20 @@ int CMenuForwarderNonLocalized::getWidth(void) return tw; } + +CMenuDForwarderNonLocalized::CMenuDForwarderNonLocalized(const char * const Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) : CMenuForwarderNonLocalized(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) +{ +} + +CMenuDForwarderNonLocalized::CMenuDForwarderNonLocalized(const char * const Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right) : CMenuForwarderNonLocalized(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) +{ +} + +CMenuDForwarderNonLocalized::~CMenuDForwarderNonLocalized() +{ + delete jumpTarget; +} + //------------------------------------------------------------------------------------------------------------------------------- CMenuSeparator::CMenuSeparator(const int Type, const neutrino_locale_t Text, bool IsStatic) { diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 7ae164a20..4134bf051 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -255,6 +255,14 @@ class CMenuForwarderNonLocalized : public CMenuForwarder void setText(const char * const Text); }; +class CMenuDForwarderNonLocalized : public CMenuForwarderNonLocalized +{ + public: + CMenuDForwarderNonLocalized(const char * const Text, const bool Active=true, const char * const Option=NULL, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL); + CMenuDForwarderNonLocalized(const char * const Text, const bool Active, const std::string &Option, CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const char * const IconName = NULL, const char * const IconName_Info_right = NULL); + ~CMenuDForwarderNonLocalized(); +}; + class CAbstractMenuOptionChooser : public CMenuItem { protected: diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 0b4067a50..a8cb63159 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -793,6 +793,18 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.startchanneltv_id = configfile.getInt64("startchanneltv_id", 0); g_settings.startchannelradio_id = configfile.getInt64("startchannelradio_id", 0); g_settings.uselastchannel = configfile.getInt32("uselastchannel" , 1); + //epg searsch + g_settings.epg_search_history_max = configfile.getInt32("epg_search_history_max", 10); + g_settings.epg_search_history_size = configfile.getInt32("epg_search_history_size", 0); + if (g_settings.epg_search_history_size > g_settings.epg_search_history_max) + g_settings.epg_search_history_size = g_settings.epg_search_history_max; + g_settings.epg_search_history.clear(); + for(int i = 0; i < g_settings.epg_search_history_size; i++) { + std::string s = configfile.getString("epg_search_history_" + to_string(i)); + if (s != "") + g_settings.epg_search_history.push_back(configfile.getString("epg_search_history_" + to_string(i), "")); + } + g_settings.epg_search_history_size = g_settings.epg_search_history.size(); // USERMENU -> in system/settings.h @@ -864,6 +876,9 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.pip_width = configfile.getInt32("pip_width", 365); g_settings.pip_height = configfile.getInt32("pip_height", 200); #endif + + g_settings.infoClockFontSize = configfile.getInt32("infoClockFontSize", 34); + if(erg) configfile.setModifiedFlag(true); return erg; @@ -1234,6 +1249,15 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt64("startchanneltv_id", g_settings.startchanneltv_id); configfile.setInt64("startchannelradio_id", g_settings.startchannelradio_id); configfile.setInt32("uselastchannel", g_settings.uselastchannel); + //epg search + g_settings.epg_search_history_size = g_settings.epg_search_history.size(); + if (g_settings.epg_search_history_size > g_settings.epg_search_history_max) + g_settings.epg_search_history_size = g_settings.epg_search_history_max; + configfile.setInt32("epg_search_history_max", g_settings.epg_search_history_max); + configfile.setInt32("epg_search_history_size", g_settings.epg_search_history_size); + std::list:: iterator it = g_settings.epg_search_history.begin(); + for(int i = 0; i < g_settings.epg_search_history_size; i++, ++it) + configfile.setString("epg_search_history_" + to_string(i), *it); // USERMENU //--------------------------------------- @@ -1271,6 +1295,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("pip_width", g_settings.pip_width); configfile.setInt32("pip_height", g_settings.pip_height); #endif + configfile.setInt32("infoClockFontSize", g_settings.infoClockFontSize); configfile.setInt32("easymenu", g_settings.easymenu); if(strcmp(fname, NEUTRINO_SETTINGS_FILE)) configfile.saveConfig(fname); @@ -2019,9 +2044,7 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms dprintf( DEBUG_NORMAL, "registering as event client\n"); -#ifndef DISABLE_SECTIONSD InitSectiondClient(); -#endif /* wait until timerd is ready... */ time_t timerd_wait = time_monotonic_ms(); @@ -2136,7 +2159,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) InfoClock = CInfoClock::getInstance(); if(g_settings.mode_clock) - InfoClock->StartClock(); + g_settings.mode_clock = InfoClock->StartClock(); //cCA::GetInstance()->Ready(true); @@ -2145,15 +2168,19 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) if( ( mode == mode_tv ) || ( ( mode == mode_radio ) ) ) { if( (msg == NeutrinoMessages::SHOW_EPG) /* || (msg == CRCInput::RC_info) */ ) { + InfoClock->enableInfoClock(false); StopSubtitles(); t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); g_EpgData->show(live_channel_id); + InfoClock->enableInfoClock(true); StartSubtitles(); } else if( msg == CRCInput::RC_epg ) { + InfoClock->enableInfoClock(false); StopSubtitles(); t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); g_EventList->exec(live_channel_id, channelList->getActiveChannelName()); + InfoClock->enableInfoClock(true); StartSubtitles(); } else if( ( msg == (neutrino_msg_t) g_settings.key_quickzap_up ) || ( msg == (neutrino_msg_t) g_settings.key_quickzap_down ) ) @@ -2161,11 +2188,9 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) //quickzap quickZap(msg); } - else if( msg == CRCInput::RC_text) { g_RCInput->clearRCMsg(); - if(g_settings.mode_clock) - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); StopSubtitles(); tuxtx_stop_subtitle(); @@ -2175,19 +2200,16 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) //if(!g_settings.cacheTXT) // tuxtxt_stop(); g_RCInput->clearRCMsg(); - if(g_settings.mode_clock) - InfoClock->StartClock(); + InfoClock->enableInfoClock(true); StartSubtitles(); } else if( msg == CRCInput::RC_setup ) { if(!g_settings.minimode) { StopSubtitles(); - if(g_settings.mode_clock) - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); int old_ttx = g_settings.cacheTXT; mainMenu.exec(NULL, ""); - if(g_settings.mode_clock) - InfoClock->StartClock(); + InfoClock->enableInfoClock(true); StartSubtitles(); saveSetup(NEUTRINO_SETTINGS_FILE); if (!g_settings.epg_scan) @@ -2254,8 +2276,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else if( msg == (neutrino_msg_t) g_settings.key_zaphistory ) { // Zap-History "Bouquet" if(g_settings.mode_clock && g_settings.key_zaphistory == CRCInput::RC_home) { - g_settings.mode_clock=false; - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); + g_settings.mode_clock = false; } else { numericZap( msg ); } @@ -2418,8 +2440,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else { if (msg == CRCInput::RC_home) { if(g_settings.mode_clock && g_settings.key_zaphistory == CRCInput::RC_home) { - g_settings.mode_clock=false; - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); + g_settings.mode_clock = false; } CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); } @@ -2444,8 +2466,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) int CNeutrinoApp::showChannelList(const neutrino_msg_t _msg, bool from_menu) { neutrino_msg_t msg = _msg; - if(g_settings.mode_clock) - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); StopSubtitles(); @@ -2529,8 +2550,8 @@ _repeat: goto _show; } - if(!from_menu && g_settings.mode_clock) - InfoClock->StartClock(); + if (!from_menu) + InfoClock->enableInfoClock(true); return ((nNewChannel >= 0) ? menu_return::RETURN_EXIT_ALL : menu_return::RETURN_REPAINT); } @@ -2957,9 +2978,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) } } if (g_settings.shutdown_real && can_deepstandby) - ExitRun(true, can_deepstandby); - else if(mode != mode_standby) - standbyMode( true ); + g_RCInput->postMsg(NeutrinoMessages::SHUTDOWN, 0); + else + g_RCInput->postMsg(NeutrinoMessages::STANDBY_ON, 0); return messages_return::handled; } else if( msg == NeutrinoMessages::RELOAD_SETUP ) { @@ -3463,9 +3484,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) } CVFD::getInstance()->setBacklight(g_settings.backlight_standby); - if(g_settings.mode_clock) { - InfoClock->StopClock(); - } + InfoClock->enableInfoClock(false); //remember tuned channel-id standby_channel_id = CZapit::getInstance()->GetCurrentChannelID(); @@ -3554,8 +3573,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) g_Sectionsd->setPauseScanning(false); //g_Sectionsd->setServiceChanged(live_channel_id, true ); - if(g_settings.mode_clock) - InfoClock->StartClock(); + InfoClock->enableInfoClock(true); g_audioMute->AudioMute(current_muted, true); StartSubtitles(); @@ -3619,11 +3637,11 @@ void CNeutrinoApp::switchTvRadioMode(const int prev_mode) void CNeutrinoApp::switchClockOnOff() { if(g_settings.mode_clock) { - g_settings.mode_clock=false; - InfoClock->StopClock(); + InfoClock->enableInfoClock(false); + g_settings.mode_clock = false; } else { - g_settings.mode_clock=true; - InfoClock->StartClock(); + g_settings.mode_clock = true; + InfoClock->enableInfoClock(true); } } diff --git a/src/neutrino.h b/src/neutrino.h index 734405e9b..9bbe88c7f 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -49,8 +49,6 @@ #include -#define widest_number "2" - #define ANNOUNCETIME (1 * 60) /************************************************************************************** diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index 6435ab333..0bb8bfb1f 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -64,6 +64,7 @@ enum MN_WIDGET_ID MN_WIDGET_ID_OSDSETUP_TIMEOUT, MN_WIDGET_ID_OSDSETUP_SCREENSHOT, MN_WIDGET_ID_OSDSETUP_VOLUME, + MN_WIDGET_ID_OSDSETUP_INFOCLOCK, //actually it does not matter, but these 6 entries must be the same order as in menu MN_WIDGET_ID_OSDSETUP_FONTSIZE_MENU, MN_WIDGET_ID_OSDSETUP_FONTSIZE_CHANNELLIST, diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index d983dca45..921a7bfca 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -191,19 +191,28 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type) return(fp); } -int safe_mkdir(char * path) +int safe_mkdir(const char * path) { struct statfs s; - int ret = 0; - if(!strncmp(path, "/hdd", 4)) { - ret = statfs("/hdd", &s); - if((ret != 0) || (s.f_type == 0x72b6)) - ret = -1; - else - mkdir(path, 0755); - } else - mkdir(path, 0755); - return ret; + size_t l = strlen(path); + char d[l + 3]; + strncpy(d, path, l); + + // skip trailing slashes + while (l > 0 && d[l - 1] == '/') + l--; + // find last slash + while (l > 0 && d[l - 1] != '/') + l--; + if (!l) + return -1; + // append a single dot + d[l++] = '.'; + d[l] = 0; + + if(statfs(d, &s) || (s.f_type == 0x72b6 /* jffs2 */)) + return -1; + return mkdir(path, 0755); } /* function used to check is this dir writable, i.e. not flash, for record etc */ @@ -213,30 +222,15 @@ int check_dir(const char * dir, bool allow_tmp) int ret = -1; struct statfs s; if (::statfs(dir, &s) == 0) { - switch (s.f_type) /* f_type is long */ - { - case 0xEF53L: /*EXT2 & EXT3*/ - case 0x6969L: /*NFS*/ - case 0xFF534D42L: /*CIFS*/ - case 0x517BL: /*SMB*/ - case 0x52654973L: /*REISERFS*/ - case 0x65735546L: /*fuse for ntfs*/ - case 0x58465342L: /*xfs*/ - case 0x4d44L: /*msdos*/ - case 0x0187: /* AUTOFS_SUPER_MAGIC */ -#if 0 - case 0x72b6L: /*jffs2*/ -#endif - ret = 0;//ok - break; - case 0x858458f6L: /*ramfs*/ - case 0x1021994: /*TMPFS_MAGIC*/ + switch (s.f_type) { + case 0x858458f6L: // ramfs + case 0x1021994L: // tmpfs if(allow_tmp) ret = 0;//ok + case 0x72b6L: // jffs2 break; default: - fprintf(stderr, "%s Unknown filesystem type: 0x%x\n", dir, (int)s.f_type); - break; // error + ret = 0; // ok } } return ret; diff --git a/src/system/helpers.h b/src/system/helpers.h index d9d4b6108..9639c39bf 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -30,7 +30,9 @@ int my_system(const char * cmd); int my_system(int argc, const char *arg, ...); /* argc is number of arguments including command */ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type); -int safe_mkdir(char * path); + +int safe_mkdir(const char * path); +inline int safe_mkdir(std::string path) { return safe_mkdir(path.c_str()); } off_t file_size(const char *filename); bool file_exists(const char *filename); void wakeup_hdd(const char *hdd_dir); diff --git a/src/system/localize.cpp b/src/system/localize.cpp index 220f0b3d4..6a3f2cb1d 100644 --- a/src/system/localize.cpp +++ b/src/system/localize.cpp @@ -43,6 +43,9 @@ #include #include #include +#include +#include +#include //static const char * iso639filename = "/usr/share/iso-codes/iso-639.tab"; static const char * iso639filename = "/share/iso-codes/iso-639.tab"; @@ -86,80 +89,80 @@ const char * getISO639Description(const char * const iso) CLocaleManager::CLocaleManager() { localeData = new char * [sizeof(locale_real_names)/sizeof(const char *)]; - for (unsigned int i = 0; i < (sizeof(locale_real_names)/sizeof(const char *)); i++) - localeData[i] = (char *)locale_real_names[i]; - defaultData = new char * [sizeof(locale_real_names)/sizeof(const char *)]; - for (unsigned int i = 0; i < (sizeof(locale_real_names)/sizeof(const char *)); i++) - defaultData[i] = (char *)locale_real_names[i]; + memcpy(localeData, locale_real_names, sizeof(locale_real_names)); + memcpy(defaultData, locale_real_names, sizeof(locale_real_names)); + defaultDataMem = localeDataMem = NULL; loadLocale(DEFAULT_LOCALE, true); } CLocaleManager::~CLocaleManager() { - for (unsigned j = 0; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) - if (localeData[j] != locale_real_names[j] && localeData[j] != defaultData[j]) - ::free(localeData[j]); - delete[] localeData; - - for (unsigned j = 0; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) - if (defaultData[j] != locale_real_names[j]) - ::free(defaultData[j]); - delete[] defaultData; + + if (localeDataMem) + ::free(localeDataMem); + if (defaultDataMem) + ::free(defaultDataMem); } const char * path[2] = { CONFIGDIR "/locale/", DATADIR "/neutrino/locale/"}; CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const locale, bool asdefault) { - unsigned int i; - FILE * fd; + FILE * fd = NULL; char ** loadData = asdefault ? defaultData : localeData; + char **mem = asdefault ? &defaultDataMem : &localeDataMem; + if(!asdefault && !strcmp(locale, DEFAULT_LOCALE)) { - for (unsigned j = 0; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) { - if (loadData[j] != locale_real_names[j] && loadData[j] != defaultData[j]) - free(loadData[j]); - loadData[j] = defaultData[j]; + if (*mem) { + free(*mem); + *mem = NULL; } + memcpy(loadData, defaultData, sizeof(locale_real_names)); return UNICODE_FONT; } - for (i = 0; i < 2; i++) + struct stat st; + for (unsigned int i = 0; i < 2; i++) { std::string filename = path[i]; filename += locale; filename += ".locale"; + ::stat(filename.c_str(), &st); fd = fopen(filename.c_str(), "r"); if (fd) break; } - if (i == 2) + if (!fd) { perror("cannot read locale"); return NO_SUCH_LOCALE; } - if(!asdefault) { - for (unsigned j = 0; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) { - if (loadData[j] != locale_real_names[j] && loadData[j] != defaultData[j]) - { - free(loadData[j]); - } - loadData[j] = (char *)locale_real_names[j]; - } + if (*mem) { + free (*mem); + *mem = NULL; } + memcpy(loadData, locale_real_names, sizeof(locale_real_names)); + + *mem = (char *) malloc(st.st_size); + if (!*mem) + { + perror("loadLocale"); + return NO_SUCH_LOCALE; + } + char *memp = *mem; + char *buf=NULL; size_t len = 0; - i = 1; - while(!feof(fd)) { if(getline(&buf, &len, fd)!=-1) @@ -192,13 +195,19 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l } } while ( ( pos != -1 ) ); + unsigned int i; for(i = 1; i < sizeof(locale_real_names)/sizeof(const char *); i++) { //printf("[%s] [%s]\n", buf,locale_real_names[i]); if(!strcmp(buf,locale_real_names[i])) { if(loadData[i] == locale_real_names[i]) - loadData[i] = strdup(text.c_str()); + { + loadData[i] = memp; + size_t l = text.length() + 1; + memcpy(memp, text.c_str(), l); + memp += l; + } else printf("[%s.locale] dup entry: %s\n", locale, locale_real_names[i]); break; @@ -212,6 +221,16 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l fclose(fd); if(buf) free(buf); + char *_mem = (char *) realloc(*mem, memp - *mem); + if (_mem) { + if (_mem != *mem) { + // most likely doesn't happen + for(unsigned int i = 1; i < sizeof(locale_real_names)/sizeof(const char *); i++) + if (loadData[i] != locale_real_names[i]) + loadData[i] -= *mem - _mem; + *mem = _mem; + } + } for (unsigned j = 1; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) if (loadData[j] == locale_real_names[j]) @@ -221,13 +240,7 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l loadData[j] = defaultData[j]; } - return ( - (strcmp(locale, "bosanski") == 0) || - (strcmp(locale, "ellinika") == 0) || - (strcmp(locale, "russkij") == 0) || - (strcmp(locale, "utf8") == 0) - /* utf8.locale is a generic name that can be used for new locales which need characters outside the ISO-8859-1 character set */ - ) ? UNICODE_FONT : ISO_8859_1_FONT; + return UNICODE_FONT; } const char * CLocaleManager::getText(const neutrino_locale_t keyName) const diff --git a/src/system/localize.h b/src/system/localize.h index ad8bedb81..b12b430fd 100644 --- a/src/system/localize.h +++ b/src/system/localize.h @@ -51,6 +51,9 @@ class CLocaleManager private: char * * localeData; char * * defaultData; + + char * localeDataMem; + char * defaultDataMem; public: enum loadLocale_ret_t diff --git a/src/system/locals.h b/src/system/locals.h index 53293eafc..85e9442dc 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -283,6 +283,8 @@ typedef enum LOCALE_CI_SETTINGS, LOCALE_CI_TIMEOUT, LOCALE_CI_WAITING, + LOCALE_CLOCK_SIZE, + LOCALE_CLOCK_SIZE_HEIGHT, LOCALE_CLOCK_SWITCH_OFF, LOCALE_CLOCK_SWITCH_ON, LOCALE_COLORCHOOSER_ALPHA, @@ -354,7 +356,9 @@ typedef enum LOCALE_EPGVIEWER_NODETAILED, LOCALE_EPGVIEWER_NOTFOUND, LOCALE_EVENTFINDER_HEAD, + LOCALE_EVENTFINDER_HISTORY, LOCALE_EVENTFINDER_KEYWORD, + LOCALE_EVENTFINDER_MAX_HISTORY, LOCALE_EVENTFINDER_SEARCH, LOCALE_EVENTFINDER_SEARCH_ALL_EPG, LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG, @@ -835,6 +839,7 @@ typedef enum LOCALE_MENU_HINT_CHANNELLIST_SETUP, LOCALE_MENU_HINT_CHANNELS, LOCALE_MENU_HINT_CI, + LOCALE_MENU_HINT_CLOCK_SIZE, LOCALE_MENU_HINT_COLORS, LOCALE_MENU_HINT_CONTENT_BACK, LOCALE_MENU_HINT_CONTENT_TEXTCOLOR, @@ -900,6 +905,7 @@ typedef enum LOCALE_MENU_HINT_INFOBAR_SETUP, LOCALE_MENU_HINT_INFOBAR_TEXTCOLOR, LOCALE_MENU_HINT_INFOBAR_TUNER, + LOCALE_MENU_HINT_INFOCLOCK_SETUP, LOCALE_MENU_HINT_KEEP_NUMBERS, LOCALE_MENU_HINT_KEY_ADDRECORD, LOCALE_MENU_HINT_KEY_ADDREMIND, @@ -1263,6 +1269,7 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_SHOW_RES_SIMPLE, LOCALE_MISCSETTINGS_INFOBAR_SHOW_SYSFS_HDD, LOCALE_MISCSETTINGS_INFOBAR_SHOW_TUNER, + LOCALE_MISCSETTINGS_INFOCLOCK, LOCALE_MISCSETTINGS_PROGRESSBAR, LOCALE_MISCSETTINGS_PROGRESSBAR_COLOR, LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN, @@ -1456,6 +1463,11 @@ typedef enum LOCALE_MOVIEBROWSER_YT_MOST_SHARED, LOCALE_MOVIEBROWSER_YT_NEXT_RESULTS, LOCALE_MOVIEBROWSER_YT_ON_THE_WEB, + LOCALE_MOVIEBROWSER_YT_ORDERBY, + LOCALE_MOVIEBROWSER_YT_ORDERBY_PUBLISHED, + LOCALE_MOVIEBROWSER_YT_ORDERBY_RATING, + LOCALE_MOVIEBROWSER_YT_ORDERBY_RELEVANCE, + LOCALE_MOVIEBROWSER_YT_ORDERBY_VIEWCOUNT, LOCALE_MOVIEBROWSER_YT_PREF_QUALITY, LOCALE_MOVIEBROWSER_YT_PREV_RESULTS, LOCALE_MOVIEBROWSER_YT_RECENTLY_FEATURED, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 7e3fa0456..e4ac4f635 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -283,6 +283,8 @@ const char * locale_real_names[] = "ci.settings", "ci.timeout", "ci.waiting", + "clock_size", + "clock_size_height", "clock_switch_off", "clock_switch_on", "colorchooser.alpha", @@ -354,7 +356,9 @@ const char * locale_real_names[] = "epgviewer.nodetailed", "epgviewer.notfound", "eventfinder.head", + "eventfinder.history", "eventfinder.keyword", + "eventfinder.max_history", "eventfinder.search", "eventfinder.search_all_epg", "eventfinder.search_within_epg", @@ -835,6 +839,7 @@ const char * locale_real_names[] = "menu.hint_channellist_setup", "menu.hint_channels", "menu.hint_ci", + "menu.hint_clock_size", "menu.hint_colors", "menu.hint_content_back", "menu.hint_content_textcolor", @@ -900,6 +905,7 @@ const char * locale_real_names[] = "menu.hint_infobar_setup", "menu.hint_infobar_textcolor", "menu.hint_infobar_tuner", + "menu.hint_infoclock_setup", "menu.hint_keep_numbers", "menu.hint_key_addrecord", "menu.hint_key_addremind", @@ -1263,6 +1269,7 @@ const char * locale_real_names[] = "miscsettings.infobar_show_res_simple", "miscsettings.infobar_show_sysfs_hdd", "miscsettings.infobar_show_tuner", + "miscsettings.infoclock", "miscsettings.progressbar", "miscsettings.progressbar_color", "miscsettings.progressbar_design", @@ -1456,6 +1463,11 @@ const char * locale_real_names[] = "moviebrowser.yt_most_shared", "moviebrowser.yt_next_results", "moviebrowser.yt_on_the_web", + "moviebrowser.yt_orderby", + "moviebrowser.yt_orderby.published", + "moviebrowser.yt_orderby.rating", + "moviebrowser.yt_orderby.relevance", + "moviebrowser.yt_orderby.viewcount", "moviebrowser.yt_pref_quality", "moviebrowser.yt_prev_results", "moviebrowser.yt_recently_featured", diff --git a/src/system/settings.h b/src/system/settings.h index 4624ebfab..3472df627 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -43,6 +43,7 @@ #include #include +#include #ifdef BOXMODEL_APOLLO #define VIDEOMENU_VIDEOMODE_OPTION_COUNT 14 @@ -152,6 +153,10 @@ struct SNeutrinoSettings std::string epg_dir; int epg_scan; + int epg_search_history_size; + int epg_search_history_max; + std::list epg_search_history; + //network std::string network_ntpserver; std::string network_ntprefresh; @@ -538,6 +543,8 @@ struct SNeutrinoSettings FONT_TYPE_COUNT }; + int infoClockFontSize; + // lcdd enum LCD_SETTINGS { LCD_BRIGHTNESS = 0, diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index 7bdfc8535..5837f51fb 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -472,7 +472,7 @@ bool cYTFeedParser::ParseFeed(std::string &url) return parseFeedXml(answer); } -bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::string vid) +bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::string vid, yt_feed_orderby_t orderby) { std::string url = "http://gdata.youtube.com/feeds/api/standardfeeds/"; bool append_res = true; @@ -540,6 +540,8 @@ bool cYTFeedParser::ParseFeed(yt_feed_mode_t mode, std::string search, std::stri url = "http://gdata.youtube.com/feeds/api/videos?q="; url += search; url += "&"; + const char *orderby_values[] = { "published", "relevance", "viewCount", "rating" }; + url += "orderby=" + std::string(orderby_values[orderby & 3]) + "&"; } feedmode = mode; diff --git a/src/system/ytparser.h b/src/system/ytparser.h index fb97d65d1..5e4d6f12d 100644 --- a/src/system/ytparser.h +++ b/src/system/ytparser.h @@ -129,10 +129,17 @@ class cYTFeedParser SEARCH, MODE_LAST }; + enum yt_feed_orderby_t + { + ORDERBY_PUBLISHED = 0, + ORDERBY_RELEVANCE, + ORDERBY_VIEWCOUNT, + ORDERBY_RATING + }; cYTFeedParser(); ~cYTFeedParser(); - bool ParseFeed(yt_feed_mode_t mode = MOST_POPULAR, std::string search = "", std::string vid = ""); + bool ParseFeed(yt_feed_mode_t mode = MOST_POPULAR, std::string search = "", std::string vid = "", yt_feed_orderby_t orderby = ORDERBY_PUBLISHED); bool ParseVideoInfo(cYTVideoInfo &vinfo, CURL *_curl_handle = NULL); bool DownloadThumbnail(cYTVideoInfo &vinfo, CURL *_curl_handle = NULL); bool GetVideoUrls();