diff --git a/.gitignore b/.gitignore index 7a616e898..bbd35a839 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ src/zapit/src/pzapit src/zapit/src/udpstreampes src/drivertool src/gui/svn_version.h +src/gui/git_version.h diff --git a/data/Makefile.am b/data/Makefile.am index c08900b20..1b5dc7b1e 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -5,6 +5,6 @@ SUBDIRS += lcd endif configdir = $(CONFIGDIR) -config_DATA = cables.xml satellites.xml encoding.conf tobackup.conf providermap.xml +config_DATA = cables.xml satellites.xml encoding.conf tobackup.conf providermap.xml settingsupdate.conf config_DATA += terrestrial.xml diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index 66dc9a37d..4dd2afa5f 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -1,6 +1,29 @@ installdir = $(DATADIR)/neutrino/icons -install_DATA = \ +locale = \ + locale/deutsch.png \ + locale/english.png + +locale_unmaintained = \ + locale/unmaintained/bayrisch.png \ + locale/unmaintained/bosanski.png \ + locale/unmaintained/ch-baslerdeutsch.png \ + locale/unmaintained/ch-berndeutsch.png \ + locale/unmaintained/czech.png \ + locale/unmaintained/francais.png \ + locale/unmaintained/italiano.png \ + locale/unmaintained/nederlands.png \ + locale/unmaintained/polski.png \ + locale/unmaintained/portugues.png \ + locale/unmaintained/russkij.png \ + locale/unmaintained/slovak.png \ + locale/unmaintained/suomi.png \ + locale/unmaintained/svenska.png + +install_DATA = $(locale) +install_DATA += $(locale_unmaintained) + +install_DATA += \ 0.png \ 1.png \ 16_9.png \ @@ -16,7 +39,6 @@ install_DATA = \ ats.png \ ats_gray.png \ audio.png \ - bayrisch.png \ biss_green.png \ biss_white.png \ biss_yellow.png \ @@ -24,15 +46,12 @@ install_DATA = \ bookmarkmanager.png \ border_lr.png \ border_ul.png \ - bosanski.png \ btn_record_active.png \ btn_record_inactive.png \ btn_stop.png \ ca.png \ ca2.png \ ca2_gray.png \ - ch-baslerdeutsch.png \ - ch-berndeutsch.png \ colors.png \ conax_green.png \ conax_white.png \ @@ -40,7 +59,6 @@ install_DATA = \ cw_green.png \ cw_white.png \ cw_yellow.png \ - czech.png \ d_green.png \ d_white.png \ d_yellow.png \ @@ -48,17 +66,11 @@ install_DATA = \ dd_avail.png \ dd_gray.png \ ddfill.png \ - deutsch.png \ down.png \ - dutch.png \ - ellinika.png \ - english.png \ error.png \ features.png \ file.png \ folder.png \ - francais.png \ - french.png \ games.png \ gelb.png \ gruen.png \ @@ -108,7 +120,6 @@ install_DATA = \ hint_vfd.png \ hint_video.png \ home.png \ - hungarian.png \ icon_green.png \ icon_movieplayer.png \ icon_red.png \ @@ -120,7 +131,6 @@ install_DATA = \ ird_green.png \ ird_white.png \ ird_yellow.png \ - italiano.png \ keybinding.png \ language.png \ lcd.png \ @@ -157,16 +167,12 @@ install_DATA = \ nds_green.png \ nds_white.png \ nds_yellow.png \ - nederlands.png \ network.png \ - norsk.png \ not_mounted.png \ notyet.png \ numericpad.png \ ok.png \ personalize.png \ - polski.png \ - portugues.png \ power.png \ powervu_green.png \ powervu_white.png \ @@ -208,9 +214,7 @@ install_DATA = \ res_hd.png \ res_sd.png \ right.png \ - romania.png \ rot.png \ - russkij.png \ scan.jpg \ seca_green.png \ seca_white.png \ @@ -218,14 +222,11 @@ install_DATA = \ settings.png \ shell.png \ shutdown.jpg \ - slovak.png \ softupdate.png \ start.jpg \ streaming.png \ subt.png \ subt_gray.png \ - suomi.png \ - svenska.png \ timer.png \ tuner_1.png \ tuner_2.png \ diff --git a/data/icons/deutsch.png b/data/icons/locale/deutsch.png similarity index 100% rename from data/icons/deutsch.png rename to data/icons/locale/deutsch.png diff --git a/data/icons/english.png b/data/icons/locale/english.png similarity index 100% rename from data/icons/english.png rename to data/icons/locale/english.png diff --git a/data/icons/ellinika.png b/data/icons/locale/orphaned/ellinika.png similarity index 100% rename from data/icons/ellinika.png rename to data/icons/locale/orphaned/ellinika.png diff --git a/data/icons/norsk.png b/data/icons/locale/orphaned/norsk.png similarity index 100% rename from data/icons/norsk.png rename to data/icons/locale/orphaned/norsk.png diff --git a/data/icons/romania.png b/data/icons/locale/orphaned/romania.png similarity index 100% rename from data/icons/romania.png rename to data/icons/locale/orphaned/romania.png diff --git a/data/icons/bayrisch.png b/data/icons/locale/unmaintained/bayrisch.png similarity index 100% rename from data/icons/bayrisch.png rename to data/icons/locale/unmaintained/bayrisch.png diff --git a/data/icons/bosanski.png b/data/icons/locale/unmaintained/bosanski.png similarity index 100% rename from data/icons/bosanski.png rename to data/icons/locale/unmaintained/bosanski.png diff --git a/data/icons/ch-baslerdeutsch.png b/data/icons/locale/unmaintained/ch-baslerdeutsch.png similarity index 100% rename from data/icons/ch-baslerdeutsch.png rename to data/icons/locale/unmaintained/ch-baslerdeutsch.png diff --git a/data/icons/ch-berndeutsch.png b/data/icons/locale/unmaintained/ch-berndeutsch.png similarity index 100% rename from data/icons/ch-berndeutsch.png rename to data/icons/locale/unmaintained/ch-berndeutsch.png diff --git a/data/icons/czech.png b/data/icons/locale/unmaintained/czech.png similarity index 100% rename from data/icons/czech.png rename to data/icons/locale/unmaintained/czech.png diff --git a/data/icons/dutch.png b/data/icons/locale/unmaintained/dutch.png similarity index 100% rename from data/icons/dutch.png rename to data/icons/locale/unmaintained/dutch.png diff --git a/data/icons/francais.png b/data/icons/locale/unmaintained/francais.png similarity index 100% rename from data/icons/francais.png rename to data/icons/locale/unmaintained/francais.png diff --git a/data/icons/french.png b/data/icons/locale/unmaintained/french.png similarity index 100% rename from data/icons/french.png rename to data/icons/locale/unmaintained/french.png diff --git a/data/icons/hungarian.png b/data/icons/locale/unmaintained/hungarian.png similarity index 100% rename from data/icons/hungarian.png rename to data/icons/locale/unmaintained/hungarian.png diff --git a/data/icons/italiano.png b/data/icons/locale/unmaintained/italiano.png similarity index 100% rename from data/icons/italiano.png rename to data/icons/locale/unmaintained/italiano.png diff --git a/data/icons/nederlands.png b/data/icons/locale/unmaintained/nederlands.png similarity index 100% rename from data/icons/nederlands.png rename to data/icons/locale/unmaintained/nederlands.png diff --git a/data/icons/polski.png b/data/icons/locale/unmaintained/polski.png similarity index 100% rename from data/icons/polski.png rename to data/icons/locale/unmaintained/polski.png diff --git a/data/icons/portugues.png b/data/icons/locale/unmaintained/portugues.png similarity index 100% rename from data/icons/portugues.png rename to data/icons/locale/unmaintained/portugues.png diff --git a/data/icons/russkij.png b/data/icons/locale/unmaintained/russkij.png similarity index 100% rename from data/icons/russkij.png rename to data/icons/locale/unmaintained/russkij.png diff --git a/data/icons/slovak.png b/data/icons/locale/unmaintained/slovak.png similarity index 100% rename from data/icons/slovak.png rename to data/icons/locale/unmaintained/slovak.png diff --git a/data/icons/suomi.png b/data/icons/locale/unmaintained/suomi.png similarity index 100% rename from data/icons/suomi.png rename to data/icons/locale/unmaintained/suomi.png diff --git a/data/icons/svenska.png b/data/icons/locale/unmaintained/svenska.png similarity index 100% rename from data/icons/svenska.png rename to data/icons/locale/unmaintained/svenska.png diff --git a/data/locale/Makefile.am b/data/locale/Makefile.am index 50d9e1356..feed9a7bc 100644 --- a/data/locale/Makefile.am +++ b/data/locale/Makefile.am @@ -1,55 +1,70 @@ installdir = $(DATADIR)/neutrino/locale -install_DATA = \ - bayrisch.locale \ - bosanski.locale \ - ch-baslerdeutsch.locale \ - ch-berndeutsch.locale \ - czech.locale \ +locale = \ deutsch.locale \ - english.locale \ - francais.locale \ - italiano.locale \ - nederlands.locale \ - polski.locale \ - portugues.locale \ - russkij.locale \ - slovak.locale \ - suomi.locale \ - svenska.locale + english.locale + +locale_unmaintained = \ + unmaintained/bayrisch.locale \ + unmaintained/bosanski.locale \ + unmaintained/ch-baslerdeutsch.locale \ + unmaintained/ch-berndeutsch.locale \ + unmaintained/czech.locale \ + unmaintained/francais.locale \ + unmaintained/italiano.locale \ + unmaintained/nederlands.locale \ + unmaintained/polski.locale \ + unmaintained/portugues.locale \ + unmaintained/russkij.locale \ + unmaintained/slovak.locale \ + unmaintained/suomi.locale \ + unmaintained/svenska.locale + +install_DATA = $(locale) +install_DATA += $(locale_unmaintained) if MAINTAINER_MODE -locals: sort-locals locals.h locals_intern.h install-locals +master.locale=english.locale -sort-locals: $(top_srcdir)/data/locale/deutsch.locale $(top_srcdir)/data/locale/english.locale - cat $(top_srcdir)/data/locale/deutsch.locale | LC_ALL=C sort | uniq > deutsch.locale - cat $(top_srcdir)/data/locale/english.locale | LC_ALL=C sort | uniq > english.locale - cp -f deutsch.locale english.locale $(top_srcdir)/data/locale +locals: sort-locals work-locals locals.h locals_intern.h -ordercheck: $(top_srcdir)/data/locale/deutsch.locale - cut -d' ' -f1 $(top_srcdir)/data/locale/deutsch.locale | LC_ALL=C sort | uniq > /tmp/log - cut -d' ' -f1 $(top_srcdir)/data/locale/deutsch.locale | uniq | diff - /tmp/log || \ - (echo "ERROR: deutsch.locale not ordered or contains empty lines" && false) +$(master.locale) \ +sort-locals: $(top_srcdir)/data/locale/$(master.locale) + for locale in $(locale); do \ + cat $(top_srcdir)/data/locale/$${locale} | LC_ALL=C sort | uniq > $${locale}; \ + done -locals.h: ordercheck $(top_srcdir)/data/locale/deutsch.locale - cut -d' ' -f1 $(top_srcdir)/data/locale/deutsch.locale | LC_ALL=C sort | uniq | tr [:lower:] [:upper:] | tr \. \_ | tr \- \_ | tr -d \? | $(top_srcdir)/data/locale/create.locals.h +work-locals: $(master.locale) + for locale in $(locale); do \ + $(top_srcdir)/data/locale/helpers/create-locals-work $${locale}; \ + done -locals_intern.h: ordercheck $(top_srcdir)/data/locale/deutsch.locale - cut -d' ' -f1 $(top_srcdir)/data/locale/deutsch.locale | LC_ALL=C sort | uniq | $(top_srcdir)/data/locale/create.locals_intern.h +ordercheck: $(master.locale) + cut -d' ' -f1 $(master.locale) | LC_ALL=C sort | uniq > /tmp/log + cut -d' ' -f1 $(master.locale) | uniq | diff - /tmp/log || \ + (echo "ERROR: $(master.locale) not ordered or contains empty lines" && false) + +locals.h: ordercheck + cut -d' ' -f1 $(top_srcdir)/data/locale/$(master.locale) | LC_ALL=C sort | uniq | tr [:lower:] [:upper:] | tr \. \_ | tr \- \_ | tr -d \? | \ + $(top_srcdir)/data/locale/helpers/create-locals.h + +locals_intern.h: ordercheck + cut -d' ' -f1 $(top_srcdir)/data/locale/$(master.locale) | LC_ALL=C sort | uniq | \ + $(top_srcdir)/data/locale/helpers/create-locals_intern.h check: locals.h locals_intern.h diff locals.h $(top_srcdir)/src/system diff locals_intern.h $(top_srcdir)/src/system -install-locals: locals.h locals_intern.h +install-locals: $(locale) locals.h locals_intern.h cp locals.h locals_intern.h $(top_srcdir)/src/system - @echo "Consider committing src/system/[locals.h,locals_intern.h]" - cp -f deutsch.locale english.locale $(top_srcdir)/data/locale - @echo "Consider committing data/locale/[deutsch.locale,english.locale]" + @echo "Consider committing src/system/[locals.h locals_intern.h]" + cp -f $(locale) $(top_srcdir)/data/locale + @echo "Consider committing data/locale/[$(locale)]" locals-clean: - rm -f locals.h locals_intern.h deutsch.locale english.locale + rm -f locals.h locals_intern.h $(locale) endif diff --git a/data/locale/_readme.txt b/data/locale/_readme.txt index cd4366866..8c47c902f 100644 --- a/data/locale/_readme.txt +++ b/data/locale/_readme.txt @@ -12,12 +12,12 @@ directory: /var/tuxbox/config/locale or /share/tuxbox/neutrino/locale Master file: ------------ -deutsch.locale is considered the master file. +english.locale is considered the master file. Verfication of .locale files: ----------------------------- -Use the check.locale.files shell script for detecting +Use ./helpers/check-locale for detecting in master file - violations of the sorting order, - missing translations and - legacy strings. @@ -27,32 +27,31 @@ Use the check.locale.files shell script for detecting How do I add a new locale string? --------------------------------- 1.) -First of all, add the new string to deutsch.locale while preserving +First of all, add the new string to english.locale while preserving the ordering. Do not add any empty lines. 2.) Enter the directory build_tmp/neutrino-hd/data/locale. 3.) -Use for sorting (deutsch.locale,english.locale) 'make sort-locals', use 'make ordercheck' to for -verification. +Use for sorting 'make sort-locals', use 'make ordercheck' to for verification. 4.) +To the extent possible, update other locale file. For this, 'make work-locals' +may be useful. if you find a file called *.locale-work, merge this into *.locale + +5.) Create new versions of the files src/system/locals.h and src/system/locals_intern.h using the command 'make locals.h locals_intern.h'. -5.) -Check the modifications with 'make check' - 6.) -Copy the replacement file to their destination with 'make install-locals' +Check the modifications with 'make check' 7.) Or use for item 3-6 'make locals' 8.) -To the extent possible, update other locale file. For this, the -Perl-script create-locals-update.pl may be useful. +Copy the replacement file to their destination with 'make install-locals' 9.) If committing the changes to Git, commit both the involved @@ -60,7 +59,7 @@ locale-files, src/system/locals.h, and src/system/locals_intern.h. Useful tools: ------------- -- emacs (add '(file-coding-system-alist (quote (("\\.locale\\'" . utf-8-unix) ("" undecided)))) to .emacs or use "C-x c utf-8 C-x C-f deutsch.locale") +- emacs (add '(file-coding-system-alist (quote (("\\.locale\\'" . utf-8-unix) ("" undecided)))) to .emacs or use "C-x c utf-8 C-x C-f english.locale") - iconv - sort - uxterm diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index d3ab0e772..a3a470790 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -437,7 +437,7 @@ filesystem.is.utf8.option.iso8859.1 ISO-8859-1 filesystem.is.utf8.option.utf8 UTF-8 flashupdate.actionreadflash lese Flash flashupdate.cantopenfile kann Datei nicht öffnen -flashupdate.cantopenmtd kann das MTD-Device nicht öffnen +flashupdate.cantopenmtd kann MTD nicht öffnen flashupdate.checkupdate_internet Online nach Updates suchen flashupdate.checkupdate_local Lokales Update flashupdate.currentversion_sep Installierte Version @@ -484,6 +484,9 @@ flashupdate.settings Update-Einstellungen flashupdate.squashfs.noversion Bei Updates werden Versionsüberprüfungen derzeit nur über Web-Updates unterstützt.\nWollen Sie das ausgewählte Image wirklich installieren? flashupdate.titlereadflash Flash auslesen flashupdate.titlewriteflash Flash schreiben +flashupdate.update_with_settings_processed Image wird bearbeitet... +flashupdate.update_with_settings_skipped Ordner [%s] kann nicht gesichert werden. Eintrag wird übersprungen. +flashupdate.update_with_settings_successfully Settingsübernahme erfolgreich.\nDas Image kann jetzt geflasht werden. flashupdate.updatemode Updatemodus flashupdate.updatemode_internet Internet flashupdate.updatemode_manual von lokalem Update-Verzeichnis @@ -538,7 +541,7 @@ hdd_60min 60 min. hdd_activate Übernehmen hdd_check Dateisystemprüfung hdd_check_failed Festplattenprüfung fehlgeschlagen -hdd_ext3 Ext3fs +hdd_ext3 ext3 hdd_extended_settings Erweiterte Festplatteneinstellungen hdd_fast Schnell hdd_format Formatiere Festplatte @@ -771,7 +774,7 @@ menu.hint_hdd_tools Hier können Sie die gefundenen Festplatten formatieren bzw. menu.hint_head_back Ändern Sie die Titel-Hintergrundfarbe menu.hint_head_textcolor Ändern Sie die Titel-Textfarbe menu.hint_imageinfo Informationen über die installierte Software -menu.hint_inact_timer Ausschalten der Box nach Inaktivität in Minuten,\ndie Box geht automatisch in den Deep-Standby +menu.hint_inact_timer Ausschalten der Box nach Inaktivität in Minuten,\ndie Box geht automatisch in den Standby-Modus menu.hint_inactive_back Ändern Sie die Hintergrundfarbe für deaktivierte Fensterinhalte menu.hint_inactive_textcolor Ändern Sie die Textfarbe für deaktivierte Fensterinhalte menu.hint_inet_radio Internetradio @@ -925,6 +928,7 @@ menu.hint_record_apply Hiermit werden die Aufnahmeoptionen übernommen menu.hint_record_chandir Diese Option speichert Aufnahmen mit dem Namen des Kanals\nin ein eigenes Verzeichnis menu.hint_record_dir Hier wählen Sie das Aufnahmeverzeichnis menu.hint_record_end Hier können Sie wählen zwischen max. Aufnahmezeit\noder anhand der EPG-Daten +menu.hint_record_slow_warn Zeige Warnung, wenn Aufnahmepuffer zu überlaufen droht menu.hint_record_tdir Wählen Sie eine Verzeichnis für Ihre Timeshift-Aufnahmen\nim temporären Timeshiftmodus menu.hint_record_time Hier wird die maximale Zeit in Stunden eingetragen außer\nSie stoppen die Aufnahme vorzeitig menu.hint_record_timeafter Hier kann die Endzeit für den Aufnahmetimer eingestellt werden,\nein Wert von 2, beendet die Aufnahme 2 Minuten nach dem Sendungsende @@ -1494,6 +1498,7 @@ recordingmenu.save_in_channeldir Speichere im Kanalverzeichnis recordingmenu.server Server recordingmenu.server_mac MAC-Adresse recordingmenu.setupnow Einstellungen jetzt übernehmen +recordingmenu.slow_warn Warnung bei langsamen Aufnahmemedien recordingmenu.timeshift Timeshift recordingmenu.tsdir Timeshift Aufnahmeverzeichnis recordingmenu.vcr Videorekorder @@ -1516,7 +1521,7 @@ satsetup.diseqc11 DiSEqC 1.1 satsetup.diseqc12 DiSEqC 1.2 satsetup.diseqc_advanced Erweiterte Auswahl satsetup.diseqc_com_uncom Committed/Uncommitted -satsetup.diseqc_input Diseqc Einspeisung +satsetup.diseqc_input DiSEqC Einspeisung satsetup.diseqc_uncom_com Uncommitted/Committed satsetup.diseqcrepeat DiSEqC-Wiederholungen satsetup.extended DiSEqC-Einstellungen @@ -1633,7 +1638,7 @@ settings.restore Image-Einstellungen: Wiederherstellen settings.restore_warn Alle Settings werden ersetzt.\nDie Box wird neu gestartet.\nWeiter? shutdown.recoding_query Aufnahme läuft. Trotzdem beenden? shutdowntimer.announce Die Box wird in 1 Min. heruntergefahren.\nShutdown abbrechen? -sleeptimerbox.announce Sleeptimer in 1 min +sleeptimerbox.announce Die Box wird in 1 Min. in Standby-Betrieb gehen.\nStandby-Betrieb abbrechen? sleeptimerbox.hint1 Ausschaltzeit in Min. (000=aus) sleeptimerbox.hint2 Die Box schaltet sich nach dieser Standby-Zeit aus. sleeptimerbox.hint3 Die Box schaltet sich bei Nichtbenutzen der FB aus. @@ -1669,6 +1674,7 @@ timerbar.recordevent Aufnehmen timerlist.alarmtime Alarmzeit timerlist.apids Audio PIDs timerlist.apids_dflt Voreingestellte Tonspuren aufn. +timerlist.ask_to_delete Das Löschen des Timers beendet auch die laufende Aufnahme!\n%sTrotzdem fortsetzen? timerlist.bouquetselect Bouquet wählen timerlist.channel Kanal timerlist.channelselect Kanal wählen diff --git a/data/locale/english.locale b/data/locale/english.locale index 901a98019..b10b81d96 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -254,23 +254,23 @@ colormenu.menucolors Colors colormenu.osd_preset TV preset colormenu.sd_preset CRT colormenu.textcolor Text color -colormenu.themeselect select theme +colormenu.themeselect Select theme colormenu.timing OSD Timeouts colormenusetup.menucontent Content colormenusetup.menucontent_inactive Content inactive colormenusetup.menucontent_selected Content selected colormenusetup.menuhead Header colorstatusbar.text Infobar -colorthememenu.head Theme auswählen -colorthememenu.head2 Themes laden -colorthememenu.name Themename +colorthememenu.head Select theme +colorthememenu.head2 Load themes +colorthememenu.name Theme name colorthememenu.neutrino_theme Neutrino Theme -colorthememenu.question Aktuelles Theme beibehalten? -colorthememenu.save aktuelles Theme speichern -colorthememenu.select1 Benutzer Theme +colorthememenu.question Use selected theme? +colorthememenu.save Save current theme +colorthememenu.select1 User Theme colorthememenu.select2 Standard Theme -cpu.freq Cpu frequency -cpu.freq_default default frequency +cpu.freq CPU frequency +cpu.freq_default Default frequency cpu.freq_normal Normal frequency cpu.freq_standby Standby frequency date.Apr Apr @@ -303,7 +303,7 @@ epglist.noevents EPG is not available... epgviewer.More_Screenings More Screenings on this Channel epgviewer.More_Screenings_short More Screenings epgviewer.nodetailed No detailed informations available -epgviewer.notfound no epg found +epgviewer.notfound No EPG found eventfinder.head Search in EPG eventfinder.keyword Keyword eventfinder.search Search @@ -437,7 +437,7 @@ filesystem.is.utf8.option.iso8859.1 ISO-8859-1 filesystem.is.utf8.option.utf8 UTF-8 flashupdate.actionreadflash reading flashupdate.cantopenfile can't open file -flashupdate.cantopenmtd can't open mtd-device +flashupdate.cantopenmtd can't open MTD flashupdate.checkupdate_internet Check for online updates flashupdate.checkupdate_local Local update flashupdate.currentversion_sep Current version @@ -484,6 +484,9 @@ flashupdate.settings Update settings flashupdate.squashfs.noversion SquashFS version checks are currently only supported when updating over the web.\nAre you sure that you wish to install this image? flashupdate.titlereadflash Reading Flash flashupdate.titlewriteflash Writing Flash +flashupdate.update_with_settings_processed Image is being processed... +flashupdate.update_with_settings_skipped Folder [%s] can not be saved. Entry is skipped. +flashupdate.update_with_settings_successfully Setting takeover successfully.\nThe image can now be flashed. flashupdate.updatemode Updatemode flashupdate.updatemode_internet internet flashupdate.updatemode_manual from local update directory @@ -538,7 +541,7 @@ hdd_60min 60 min. hdd_activate Apply settings hdd_check Check filesystem hdd_check_failed HDD-check failed! -hdd_ext3 Ext3fs +hdd_ext3 ext3 hdd_extended_settings Extended HDD-Settings hdd_fast Fast hdd_format Formating drive... @@ -925,6 +928,7 @@ menu.hint_record_apply Apply record options menu.hint_record_chandir Create directory with name of channel\nto store recording menu.hint_record_dir Select directory to store recordings menu.hint_record_end Stop direct record after max. time\nor after current event end time +menu.hint_record_slow_warn Show warning, when record buffer is close to overflow menu.hint_record_tdir Select directory to save timeshift recordings\nin temporary timeshift mode menu.hint_record_time Record time before stop when\nusing direct record with record button menu.hint_record_timeafter Stop record after event end\nin minutes @@ -1494,6 +1498,7 @@ recordingmenu.save_in_channeldir Save in channel dir recordingmenu.server server recordingmenu.server_mac MAC address recordingmenu.setupnow activate changes +recordingmenu.slow_warn Enable slow record warning recordingmenu.timeshift Timeshift recordingmenu.tsdir Timeshift directory recordingmenu.vcr vcr @@ -1516,7 +1521,7 @@ satsetup.diseqc11 DiSEqC 1.1 satsetup.diseqc12 DiSEqC 1.2 satsetup.diseqc_advanced Advanced satsetup.diseqc_com_uncom Commited/Uncommited -satsetup.diseqc_input Diseqc input +satsetup.diseqc_input DiSEqC input satsetup.diseqc_uncom_com Uncommited/Commited satsetup.diseqcrepeat DiSEqC-repeats satsetup.extended DiSEqC-Settings @@ -1633,7 +1638,7 @@ settings.restore Image-Settings: Restore settings.restore_warn This will replace all settings and reboot\nContinue ? shutdown.recoding_query You really want to to stop record ? shutdowntimer.announce Box will shutdown in 1 min.\nCancel Shutdown ? -sleeptimerbox.announce Sleeptimer in 1 min +sleeptimerbox.announce Box will standby in 1 min.\nCancel Standby ? sleeptimerbox.hint1 Shutdown time in min. (000=off) sleeptimerbox.hint2 The STB will shutdown after this time in standby. sleeptimerbox.hint3 The STB will shutdown, if remote not used. @@ -1669,6 +1674,7 @@ timerbar.recordevent Record timerlist.alarmtime Alarm time timerlist.apids Audio PIDs timerlist.apids_dflt record default audio streams +timerlist.ask_to_delete Deletion of timer stops current recording!\n%sContinue anyway? timerlist.bouquetselect choose bouquet timerlist.channel Channel timerlist.channelselect choose channel diff --git a/data/locale/check.locale.files b/data/locale/helpers/check-locale similarity index 81% rename from data/locale/check.locale.files rename to data/locale/helpers/check-locale index ef63e8cfd..5b3cf27d1 100755 --- a/data/locale/check.locale.files +++ b/data/locale/helpers/check-locale @@ -1,5 +1,5 @@ #!/bin/sh -cut -d' ' -f1 deutsch.locale | sort | uniq > /tmp/log +cut -d' ' -f1 english.locale | sort | uniq > /tmp/log for i in *.locale; do \ echo $i:; \ echo "----------------"; \ diff --git a/data/locale/create-locals-update.pl b/data/locale/helpers/create-locals-work similarity index 88% rename from data/locale/create-locals-update.pl rename to data/locale/helpers/create-locals-work index 7abc7aaad..4c9fba0f1 100755 --- a/data/locale/create-locals-update.pl +++ b/data/locale/helpers/create-locals-work @@ -7,9 +7,9 @@ # Written by Barf on 2005-12-10. -$masterfilename = "deutsch.locale"; +$masterfilename = "english.locale"; -$#ARGV == 0 || die("Usage: create-locals-update.pl file.locale."); +$#ARGV == 0 || die("Usage: create-locals-work file.locale."); $no_errors = 0; $last_was_ok = 1; @@ -43,7 +43,7 @@ while () { close(outfile); -print "There were ", $no_errors, " error(s).\n"; +print "There were ", $no_errors, " error(s) in ", $localefilename, ".\n"; if ($no_errors == 0) { unlink($outfilename); diff --git a/data/locale/create.locals.h b/data/locale/helpers/create-locals.h similarity index 76% rename from data/locale/create.locals.h rename to data/locale/helpers/create-locals.h index 6f0bbb788..946b43138 100755 --- a/data/locale/create.locals.h +++ b/data/locale/helpers/create-locals.h @@ -1,6 +1,6 @@ #!/bin/bash -# usage: cut -d' ' -f1 deutsch.locale | LC_ALL=C sort | uniq | tr [:lower:] [:upper:] | tr \. \_ | tr \- \_ | tr -d \? | ./create.locals.h -cat > locals.h < locals.h < locals.h <> locals.h; - fi + echo $'\t'"LOCALE_$id," >> locals.h; done + cat >> locals.h < locals_intern.h < locals_intern.h < locals_intern.h <> locals_intern.h; - fi + echo $'\t'"\"$id\"," >> locals_intern.h; done + cat >> locals_intern.h < - + diff --git a/data/settingsupdate.conf b/data/settingsupdate.conf new file mode 100644 index 000000000..bae28ab75 --- /dev/null +++ b/data/settingsupdate.conf @@ -0,0 +1,28 @@ +# settings for logfile +Log=1 +LogFile=/tmp/update.log + + +## Mögliche Einträge: +#==================== +# ganzes Verzeichnis +#------------------- +# /var/etc + +# einzelne Datei +#---------------- +# /etc/init.d/rcS + +# Wildcards +#---------- +# /bin/*.sh + +#------------------------------------------------------------------------------------------------ +## Die Verzeichnisse "/", "/dev", "/proc", "/sys", "/mnt", "/tmp" können nicht gesichert werden!! +#------------------------------------------------------------------------------------------------ + +## Sicherungen +/etc/network +/etc/wpa_supplicant.conf +/var/etc +/var/tuxbox/config diff --git a/src/driver/genpsi.c b/src/driver/genpsi.c index 381f0ac50..6724369ea 100644 --- a/src/driver/genpsi.c +++ b/src/driver/genpsi.c @@ -278,5 +278,6 @@ int genpsi(int fd2) //-- finish -- avPids.vpid=0; avPids.nba=0; + fdatasync(fd2); return 1; } diff --git a/src/driver/radiotext.cpp b/src/driver/radiotext.cpp index a32cc059e..1c0a8461a 100644 --- a/src/driver/radiotext.cpp +++ b/src/driver/radiotext.cpp @@ -2288,97 +2288,31 @@ eOSState cRTplusList::ProcessKey(eKeys Key) //--------------- End ----------------------------------------------------------------- #endif - -//static int pes_SyncBufferRead (cDemux *audioDemux, ringbuffer_t *buf, u_long *skipped_bytes); - -static bool rtThreadRunning; - -void *RadioTextThread(void *data) -{ - CRadioText *rt = ((CRadioText::s_rt_thread*)data)->rt_object; - int fd = ((CRadioText::s_rt_thread*)data)->fd; - // struct dmx_pes_filter_params flt; - cDemux *audioDemux = rt->audioDemux; - printf("in RadioTextThread fd = %d\n", fd); - - bool ret = false; - - printf("\nRadioTextThread: ###################### Setting PID 0x%x ######################\n", rt->getPid()); - - audioDemux->Stop(); - if (audioDemux->pesFilter(rt->getPid())) - { - /* start demux filter */ - if (audioDemux->Start()) - ret = true; - } - if (!ret) { - perror("RadiotextThread Audiodemuxer"); - perror("DMX_SET_PES_FILTER"); - audioDemux->Stop(); - pthread_exit(NULL); - } - /* - -- read PES packet for pid - */ -#if 0 - ringbuffer_t *buf_in = ringbuffer_create(0x1FFFF); - char *b; /* ptr to packet start */ - long count = 0; -#endif - rtThreadRunning = true; - while(rtThreadRunning) - { - int n; - unsigned char buf[0x1FFFF]; -#if 0 - int offset; - size_t rd; - u_long skipped_bytes = 0; -#endif - //printf("."); fflush(stdout); - // -- Read PES packet (sync Read) - //n = pes_SyncBufferRead (audioDemux, buf_in, &skipped_bytes); - n = audioDemux->Read(buf, sizeof(buf), 500 /*5000*/); - - // -- error or eof? - if (n <= 0) { - usleep(10000); /* save CPU if nothing read */ - continue; - } - rt->PES_Receive(buf, n); -#if 0 - rd = ringbuffer_get_readpointer(buf_in, &b, n); - /* this can not happen, because pes_SyncBufferRead() returns -1 if ringbuffer is empty - if (rd <= 0) { - continue; - } - */ - count ++; - // -- skipped Data to get sync byte? - offset = rt->PES_Receive(b, n); - - ringbuffer_read_advance(buf_in, offset); -#endif - } - - audioDemux->Stop(); - -#if 0 - ringbuffer_free(buf_in); - fprintf(stderr, "RT %s: exit\n", __FUNCTION__); -#endif - printf("\nRadioTextThread: ###################### exit ######################\n"); - pthread_exit(NULL); -} - CRadioText::CRadioText(void) { - pid = 0; - dmxfd = -1; + pid = 0; + audioDemux = NULL; + init(); + + running = true; + start(); +} + +CRadioText::~CRadioText(void) +{ + printf("CRadioText::~CRadioText\n"); + running = false; + radiotext_stop(); + cond.broadcast(); + OpenThreads::Thread::join(); + printf("CRadioText::~CRadioText done\n"); +} + +void CRadioText::init() +{ S_Verbose = 0; S_RtFunc = 1; - S_RtOsd = 1; + S_RtOsd = 0; S_RtOsdTitle = 1; S_RtOsdTags = 2; S_RtOsdPos = 2; @@ -2391,7 +2325,6 @@ CRadioText::CRadioText(void) S_RtFgCol = 1; S_RtDispl = 1; S_RtMsgItems = 0; -//int S_RtpMemNo = 25; RT_Index = 0; RT_PTY = 0; @@ -2401,265 +2334,87 @@ CRadioText::CRadioText(void) RT_PlusShow = false; RT_Replay = false; RT_ReOpen = false; - for (int i=0; i<5; i++) strcpy(RT_Text[i], ""); - strcpy(RDS_PTYN, ""); + for (int i = 0; i < 5; i++) + RT_Text[i][0] = 0; + RDS_PTYN[0] = 0; + +#if ENABLE_RASS + // Rass ... + Rass_Show = -1; // -1=No, 0=Yes, 1=display + Rass_Archiv = -1; // -1=Off, 0=Index, 1000-9990=Slidenr. +#endif + RT_MsgShow = false; // clear entries from old channel have_radiotext = false; - audioDemux = NULL; } void CRadioText::radiotext_stop(void) { - printf("\nCRadioText::radiotext_stop: ###################### pid 0x%x ######################\n", getPid()); + printf("CRadioText::radiotext_stop: ###################### pid 0x%x ######################\n", getPid()); if (getPid() != 0) { - // this stuff takes a while sometimes - look for a better syncronisation - printf("Stopping RT Thread\n"); - rtThreadRunning = false; - pthread_join(getThread(), NULL); + mutex.lock(); pid = 0; have_radiotext = false; - audioDemux->Stop(); S_RtOsd = 0; + mutex.unlock(); } - } -CRadioText::~CRadioText(void) -{ - radiotext_stop(); - pid = 0; -// printf("Deleting RT object\n"); - -// close(dmxfd); - delete audioDemux; - audioDemux = NULL; - dmxfd = -1; -} - - void CRadioText::setPid(uint inPid) { - uint oldPid = pid; - - printf("\nCRadioText::setPid: ###################### old pid 0x%x new pid 0x%x ######################\n", oldPid, inPid); - if (pid != inPid) - { - int rc; - - printf("CRadioText::setPid: setting pid 0x%x\n", inPid); + printf("CRadioText::setPid: ###################### old pid 0x%x new pid 0x%x ######################\n", pid, inPid); + if (pid != inPid) { + mutex.lock(); pid = inPid; - - // open the device if first pid - if (0 == oldPid) - { - if (audioDemux == NULL) { - audioDemux = new cDemux(1); - //audioDemux->Open(DMX_TP_CHANNEL /*DMX_AUDIO_CHANNEL*/,0,128*1024); - audioDemux->Open(DMX_PES_CHANNEL,0,128*1024); -#if 0 - bool ret = false; - if (audioDemux->pesFilter(pid)) - { - /* start demux filter */ - if (audioDemux->Start()) - ret = true; - } - if (!ret) { - perror("Radiotext Audiodemuxer"); - return; - } -#endif - // audioDemux->Stop() -#if 0 - dmxfd = open(DMXDEV, O_RDWR|O_NONBLOCK); - if (dmxfd < 0) { - perror(DMXDEV); - pthread_exit(NULL); - } -#endif - } - rt.rt_object = this; - rt.fd = dmxfd; - } - - // Setup-Params - // S_Activate = false; - // S_HMEntry = false; - S_RtFunc = 1; - S_RtOsd = 0; - S_RtOsdTitle = 1; - S_RtOsdTags = 2; - S_RtOsdPos = 2; - S_RtOsdRows = 3; - S_RtOsdLoop = 1; - S_RtOsdTO = 60; - S_RtSkinColor = false; - S_RtBgCol = 0; - S_RtBgTra = 0xA0; - S_RtFgCol = 1; - S_RtDispl = 1; - S_RtMsgItems = 0; - //int S_RtpMemNo = 25; - RT_Index = RT_PTY = 0; - - // Radiotext - RTP_ItemToggle = 1; - RTP_TToggle = 0; - RT_PlusShow = false; - RT_Replay = false; - RT_ReOpen = false; - for (int i=0; i<5; i++) strcpy(RT_Text[i], ""); - strcpy(RDS_PTYN, ""); - -#if ENABLE_RASS - // Rass ... - Rass_Show = -1; // -1=No, 0=Yes, 1=display - Rass_Archiv = -1; // -1=Off, 0=Index, 1000-9990=Slidenr. -#endif - RT_MsgShow = false; // clear entries from old channel - - rc = pthread_create(&threadRT, 0, RadioTextThread, (void *) &rt); - - if (rc) { - printf("failed to create RadioText Thread (rc=%d)\n", rc); - return; - } + init(); + mutex.unlock(); + cond.broadcast(); } } - -// ----------------------------------------------------------- -// following functions are ripped from dvbsnoop: http://dvbsnoop.sourceforge.net - -/* - -- read PES packet (Synced) - -- buffer pre-read bytes for next execution - -- return: len // read()-return code -*/ - -#if 0 -static int pes_SyncBufferRead(cDemux *audioDemux, ringbuffer_t *buf, /*u_long max_len,*/ u_long *skipped_bytes) +void CRadioText::run() { - ringbuffer_data_t vec; - int rd; - char *ppes; + uint current_pid = 0; - // -- simple PES sync... seek for 0x000001 (PES_SYNC_BYTE) - // ISO/IEC 13818-1: - // -- packet_start_code_prefix -- The packet_start_code_prefix is - // -- a 24-bit code. Together with the stream_id that follows it constitutes - // -- a packet start code that identifies the beginning of a packet. - // -- The packet_start_code_prefix is the bit stream - // -- '0000 0000 0000 0000 0000 0001' (0x000001). + printf("CRadioText::run: ###################### Starting thread ######################\n"); + audioDemux = new cDemux(1); + audioDemux->Open(DMX_PES_CHANNEL,0,128*1024); - *skipped_bytes = 0; - ringbuffer_get_write_vector(buf, &vec); - if (vec.len == 0) - { - fprintf(stderr, "RT %s: ringbuffer full\n", __FUNCTION__); - /* do not read anything from demux, but continue with sync */ - } - else - { - rd = audioDemux->Read((unsigned char*)vec.buf, vec.len, 5000); - if (rd < 0) - { - if (errno != EAGAIN) - { - fprintf(stderr, "RT %s: read %d errno %d (%m)\n", __FUNCTION__, rd, errno); - return rd; - } - /* if EAGAIN, still process contents of ringbuffer */ - rd = 0; + while(running) { + mutex.lock(); + if (pid == 0) { + mutex.unlock(); + audioDemux->Stop(); + pidmutex.lock(); + printf("CRadioText::run: ###################### waiting for pid.. ######################\n"); + cond.wait(&pidmutex); + pidmutex.unlock(); + mutex.lock(); } - - ringbuffer_write_advance(buf, rd); - } - - rd = ringbuffer_get_readpointer(buf, &ppes, 6); - if (rd < 6) - { -// fprintf(stderr, "RT %s: ringbuffer empty (%d < 6)\n", __FUNCTION__, rd); - return -1; - } - - if ((ppes[0] != 0x00) || (ppes[1] != 0x00) || (ppes[2] != 0x01)) - { - //INFO("async, not 000001: %02x%02x%02x ", ppes[0], ppes[1], ppes[2]); - int deleted = 0; - do { - ringbuffer_read_advance(buf, 1); // remove 1 Byte - rd = ringbuffer_get_readpointer(buf, &ppes, 6); - deleted++; - (*skipped_bytes)++; - //fprintf(stderr, "%d", rd); - if ((ppes[0] == 0x00) || (ppes[1] == 0x00) || (ppes[2] == 0x01)) - { - deleted = 0; - break; + if (pid && (current_pid != pid)) { + current_pid = pid; + printf("CRadioText::run: ###################### Setting PID 0x%x ######################\n", getPid()); + audioDemux->Stop(); + if (!audioDemux->pesFilter(getPid()) || !audioDemux->Start()) { + pid = 0; + printf("CRadioText::run: ###################### failed to start PES filter ######################\n"); } } - while (rd == 6); - //fprintf(stderr, "\n"); - if (deleted > 0) - { -// fprintf(stderr, "RT %s: No valid PES signature found. %d Bytes deleted.\n", __FUNCTION__, deleted); - return -1; + mutex.unlock(); + if (pid) { + int n; + unsigned char buf[0x1FFFF]; + + n = audioDemux->Read(buf, sizeof(buf), 500 /*5000*/); + + if (n > 0) { + //printf("."); fflush(stdout); + mutex.lock(); + PES_Receive(buf, n); + mutex.unlock(); + } } } - - // -- Sync found! - // -- evaluate packet_id and seek packet end (next sync) - if (ppes[3] >= 0xBC) { // PES system packet with length - unsigned int l; - l = (ppes[4] << 8) + ppes[5]; // PES packet size... - - if (l > 0) { - if (ringbuffer_read_space(buf) >= l + 6) - return (l + 6); - else - return 0; - } else - ringbuffer_read_advance(buf, 6); - } else { - // will resync automatically on next invocation. Enough? - ringbuffer_read_advance(buf, 4); - } - -#if 0 - // -- seek packet end (sync to next packet) - // -- ISO 13818-1 length=0 packets (unbound video streams) - // -- ISO 13818-2 packets - - sync = 0xFFFFFFFF; - while (max_len > 0) { - u_char c; - int n; - - // $$$ TODO: may be optimized - n = pes_rawBufferedRead (fd, buf,1); - if (n < 0) return n; - - c = *buf++; - max_len -= n; - - // -- EOF - if (n == 0) { - return (long) (buf - org_buf); - } - - - // -- next packet found? (sync detected) - sync = (sync << 8) | c; - if ( (sync & 0x00FFFFFF) == 0x000001 ) { - pes_rawBufferedPushByte (*(--buf)); // push back sync bytes - pes_rawBufferedPushByte (*(--buf)); - pes_rawBufferedPushByte (*(--buf)); - return (long) (buf - org_buf); - } - } -#endif - -// fprintf(stderr, "RT %s: unsynced, ret = -1! (this never happens) ppes[3] = 0x%02x\n", __FUNCTION__, ppes[3]); - return -1; // buffer overflow + delete audioDemux; + audioDemux = NULL; + printf("CRadioText::run: ###################### exit ######################\n"); } -#endif diff --git a/src/driver/radiotext.h b/src/driver/radiotext.h index 5b6af9726..0a2b64ae9 100644 --- a/src/driver/radiotext.h +++ b/src/driver/radiotext.h @@ -59,6 +59,8 @@ #endif #include +#include +#include //#define ENABLE_RASS @@ -88,13 +90,8 @@ public: #define RT_MEL 65 #define tr(a) a -class CRadioText { - -public: - typedef struct { - CRadioText *rt_object; - int fd; - } s_rt_thread; +class CRadioText : public OpenThreads::Thread +{ private: bool enabled; @@ -107,17 +104,26 @@ private: int first_packets; //Radiotext +#if 0 // cDevice *rdsdevice; void RadiotextCheckPES(const uchar *Data, int Length); - void RadioStatusMsg(void); void AudioRecorderService(void); +#endif + void RadioStatusMsg(void); void RassDecode(uchar *Data, int Length); bool DividePes(unsigned char *data, int length, int *substart, int *subend); uint pid; - pthread_t threadRT; - int dmxfd; + //pthread_t threadRT; + //int dmxfd; + OpenThreads::Mutex mutex; + OpenThreads::Mutex pidmutex; + OpenThreads::Condition cond; + bool running; + + void run(); + void init(); public: CRadioText(void); ~CRadioText(void); @@ -133,15 +139,11 @@ public: void setPid(uint inPid); uint getPid(){ return pid; } - int run(void); - int getDMXfd(void) { return dmxfd; } -// s_rt_thread& getThreadParams(void) { return rt; } - pthread_t getThread(void) { return threadRT; } + void radiotext_stop(void); bool haveRadiotext(void) {return have_radiotext; } cDemux *audioDemux; - s_rt_thread rt; //Setup-Params int S_RtFunc; diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 30afa27c1..1b5e32a60 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -1114,7 +1114,8 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n"); break; case CTimerdClient::EVT_ANNOUNCE_ZAPTO : *msg = NeutrinoMessages::ANNOUNCE_ZAPTO; - *data = 0; + *data = (neutrino_msg_data_t)p; + dont_delete_p = true; break; case CTimerdClient::EVT_ANNOUNCE_SHUTDOWN : *msg = NeutrinoMessages::ANNOUNCE_SHUTDOWN; diff --git a/src/driver/record.cpp b/src/driver/record.cpp index fa0836111..3c45dd4b1 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -1096,6 +1096,18 @@ bool CRecordManager::Stop(const t_channel_id channel_id) return (inst != NULL); } +bool CRecordManager::IsRecording(const CTimerd::RecordingStopInfo * recinfo) +{ + bool ret = false; + mutex.lock(); + CRecordInstance * inst = FindInstanceID(recinfo->eventID); + if(inst != NULL && recinfo->eventID == inst->GetRecordingId()) + ret = true; + mutex.unlock(); + printf("[%s] eventID: %d, channel_id: 0x%llx, ret: %d\n", __FUNCTION__, recinfo->eventID, recinfo->channel_id, ret); + return ret; +} + bool CRecordManager::Stop(const CTimerd::RecordingStopInfo * recinfo) { bool ret = false; @@ -1182,7 +1194,7 @@ int CRecordManager::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data error_display = false; warn_display = false; DisplayErrorMessage(g_Locale->getText(LOCALE_STREAMING_OVERFLOW)); - } else if (warn_display) { + } else if (g_settings.recording_slow_warning && warn_display) { warn_display = false; DisplayErrorMessage(g_Locale->getText(LOCALE_STREAMING_SLOW)); } @@ -1605,6 +1617,8 @@ bool CRecordManager::CutBackNeutrino(const t_channel_id channel_id, CFrontend * g_Zapit->setRecordMode( true ); if(last_mode == NeutrinoMessages::mode_standby) g_Zapit->stopPlayBack(); + if ((live_channel_id == channel_id) && g_Radiotext) + g_Radiotext->radiotext_stop(); } if(last_mode == NeutrinoMessages::mode_standby) { //CNeutrinoApp::getInstance()->handleMsg( NeutrinoMessages::CHANGEMODE , NeutrinoMessages::mode_standby); diff --git a/src/driver/record.h b/src/driver/record.h index f55f15bb8..f7c3d0c12 100644 --- a/src/driver/record.h +++ b/src/driver/record.h @@ -192,6 +192,7 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/ bool Record(const t_channel_id channel_id, const char * dir = NULL, bool timeshift = false); bool Stop(const t_channel_id channel_id); bool Stop(const CTimerd::RecordingStopInfo * recinfo); + bool IsRecording(const CTimerd::RecordingStopInfo * recinfo); bool Update(const t_channel_id channel_id); bool ShowMenu(void); bool AskToStop(const t_channel_id channel_id, const int recid = 0); diff --git a/src/driver/shutdown_count.cpp b/src/driver/shutdown_count.cpp index e681c4ef6..aced910e9 100644 --- a/src/driver/shutdown_count.cpp +++ b/src/driver/shutdown_count.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -119,6 +120,11 @@ void SHTDCNT::shutdown_counter() sleep_cnt--; } else if(sleeptimer_active && !CNeutrinoApp::getInstance ()->recordingstatus) { sleeptimer_active = false; + + puts("[SHTDCNT] executing " NEUTRINO_ENTER_INACTIVITY_SCRIPT "."); + if (my_system(NEUTRINO_ENTER_INACTIVITY_SCRIPT) != 0) + perror(NEUTRINO_ENTER_INACTIVITY_SCRIPT " failed"); + printf("[SHTDCNT] sleep-timer send NeutrinoMessages::SLEEPTIMER\n"); g_RCInput->postMsg(NeutrinoMessages::SLEEPTIMER, 1); } diff --git a/src/driver/vfd.cpp b/src/driver/vfd.cpp index 161a71320..51b6de1e1 100644 --- a/src/driver/vfd.cpp +++ b/src/driver/vfd.cpp @@ -73,8 +73,10 @@ CVFD::CVFD() CVFD::~CVFD() { - if(fd > 0) + if(fd > 0){ close(fd); + fd = -1; + } } CVFD* CVFD::getInstance() @@ -678,7 +680,7 @@ void CVFD::Clear() void CVFD::ShowIcon(vfd_icon icon, bool show) { - if(!has_lcd) return; + if(!has_lcd || fd < 0) return; //printf("CVFD::ShowIcon %s %x\n", show ? "show" : "hide", (int) icon); int ret = ioctl(fd, show ? IOC_VFD_SET_ICON : IOC_VFD_CLEAR_ICON, icon); if(ret < 0) diff --git a/src/global.h b/src/global.h index bea35a8cd..09c199489 100644 --- a/src/global.h +++ b/src/global.h @@ -66,6 +66,9 @@ #define NEUTRINO_RECORDING_ENDED_SCRIPT CONFIGDIR "/recording.end" #define NEUTRINO_ENTER_STANDBY_SCRIPT CONFIGDIR "/standby.on" #define NEUTRINO_LEAVE_STANDBY_SCRIPT CONFIGDIR "/standby.off" +#define NEUTRINO_ENTER_INACTIVITY_SCRIPT CONFIGDIR "/inactivity.on" +#define NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT CONFIGDIR "/deepstandby.on" +#define NEUTRINO_LEAVE_DEEPSTANDBY_SCRIPT CONFIGDIR "/deepstandby.off" #define MOVIEPLAYER_START_SCRIPT CONFIGDIR "/movieplayer.start" #define MOVIEPLAYER_END_SCRIPT CONFIGDIR "/movieplayer.end" diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 58534e620..1f871997b 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -1,16 +1,22 @@ AM_CPPFLAGS = -fno-rtti -fno-exceptions #AM_CPPFLAGS = -fno-rtti - -BUILT_SOURCES = svn_version.h - -svn_version.h: - @if test -d .svn ; then \ - sleep 180 && rm svn_version.h & echo "#define SVNVERSION \"$$(svnversion -n || echo svn_oops!)\" " > svn_version.h ; \ +BUILT_SOURCES = git_version.h +git_version.h: makeversion + @if test -d ../../.git; then \ + echo "#define GITVERSION \"$$(git describe --dirty || echo `date` )\" " > git_version.h.tmp ; \ + if diff -q git_version.h git_version.h.tmp >/dev/null 2>&1 ; then \ + rm -f git_version.h.tmp ; \ + else \ + rm -f git_version.h ; \ + mv git_version.h.tmp git_version.h ; \ + fi; \ else \ - rm svn_version.h; echo '#define BUILT_DATE "'`date`'"' > svn_version.h ; \ + rm git_version.h; echo '#define BUILT_DATE "'`date`'"' > git_version.h ; \ fi +noinst_HEADERS = git_version.h + +.PHONY: makeversion -noinst_HEADERS = svn_version.h SUBDIRS = widget bedit @@ -23,6 +29,7 @@ INCLUDES = \ -I$(top_srcdir)/lib/libeventserver \ -I$(top_srcdir)/lib/libnet \ -I$(top_srcdir)/lib/libconfigfile \ + -I$(top_srcdir)/lib/connection \ -I$(top_srcdir)/lib/xmltree \ -I$(top_srcdir)/lib/libupnpclient \ @CURL_CFLAGS@ \ @@ -55,6 +62,7 @@ libneutrino_gui_a_SOURCES = \ epgplus.cpp \ epgview.cpp \ eventlist.cpp \ + ext_update.cpp \ favorites.cpp \ filebrowser.cpp \ imageinfo.cpp \ diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 63d46c047..ec20bfeda 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -71,9 +71,9 @@ CBouquetList::CBouquetList(const char * const Name) CBouquetList::~CBouquetList() { - for (std::vector::iterator it = Bouquets.begin(); it != Bouquets.end(); ++it) { - delete (*it); - } + for (std::vector::iterator it = Bouquets.begin(); it != Bouquets.end(); ++it) + delete (*it); + Bouquets.clear(); } @@ -144,7 +144,6 @@ bool CBouquetList::hasChannelID(t_channel_id channel_id) return false; } -extern CBouquetList * TVfavList; bool CBouquetList::adjustToChannelID(t_channel_id channel_id) { //printf("CBouquetList::adjustToChannelID [%s] to %llx, selected %d size %d\n", name.c_str(), channel_id, selected, Bouquets.size()); @@ -172,7 +171,7 @@ bool CBouquetList::adjustToChannelID(t_channel_id channel_id) /* used in channellist to switch bouquets up/down */ int CBouquetList::showChannelList( int nBouquet) { - if (nBouquet == -1) + if ((nBouquet < 0)|| (nBouquet >= (int) Bouquets.size())) nBouquet = selected; int nNewChannel = Bouquets[nBouquet]->channelList->exec(); @@ -187,7 +186,7 @@ int CBouquetList::activateBouquet( int id, bool bShowChannelList) { int res = -1; - if(id < (int) Bouquets.size()) + if((id >= 0) && (id < (int) Bouquets.size())) selected = id; if (bShowChannelList) { @@ -292,24 +291,56 @@ int CBouquetList::doMenu() return 0; } +const struct button_label CBouquetListButtons[4] = +{ + { NEUTRINO_ICON_BUTTON_RED, LOCALE_CHANNELLIST_FAVS}, + { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_CHANNELLIST_PROVS}, + { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_CHANNELLIST_SATS}, + { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_CHANNELLIST_HEAD} +}; + +void CBouquetList::updateSelection(int newpos) +{ + if((int) selected != newpos) { + int prev_selected = selected; + unsigned int oldliststart = liststart; + + selected = newpos; + liststart = (selected/listmaxshow)*listmaxshow; + if (oldliststart != liststart) + paint(); + else { + paintItem(prev_selected - liststart); + paintItem(selected - liststart); + } + } +} + /* bShowChannelList default to true, returns new bouquet or -1/-2 */ int CBouquetList::show(bool bShowChannelList) { neutrino_msg_t msg; neutrino_msg_data_t data; int res = -1; + int icol_w, icol_h; + int w_max_text = 0; + int w_max_icon = 0; - //if(Bouquets.size()==0) - // return res; + for(unsigned int count = 0; count < sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]);count++){ + int w_text = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(g_Locale->getText (CBouquetListButtons[count].locale),true); + w_max_text = std::max(w_max_icon, w_text); + frameBuffer->getIconSize(CBouquetListButtons[count].button, &icol_w, &icol_h); + w_max_icon = std::max(w_max_icon, icol_w); + } + int need_width = sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0])*(w_max_icon + w_max_text + 20); CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, ""); fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); - width = w_max (g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth()*52, 20);//500 + width = w_max (need_width, 20);//500 height = h_max (16 * fheight, 40); /* assuming all color icons must have same size */ - int icol_w, icol_h; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); footerHeight = std::max(icol_h+8, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8); //TODO get footerHeight from buttons @@ -388,84 +419,54 @@ int CBouquetList::show(bool bShowChannelList) return -3; } } - else if(Bouquets.empty()) - continue; //FIXME msgs not forwarded to neutrino !! else if ( msg == CRCInput::RC_setup) { - int ret = doMenu(); - if(ret > 0) { - CNeutrinoApp::getInstance ()->g_channel_list_changed = true; - res = -4; - loop = false; - } else if(ret < 0) - paint(); + if (!Bouquets.empty()) { + int ret = doMenu(); + if(ret > 0) { + CNeutrinoApp::getInstance ()->g_channel_list_changed = true; + res = -4; + loop = false; + } else if(ret < 0) + paint(); + } } else if ( msg == (neutrino_msg_t) g_settings.key_list_start ) { - selected=0; - liststart = (selected/listmaxshow)*listmaxshow; - paint(); + if (!Bouquets.empty()) + updateSelection(0); } else if ( msg == (neutrino_msg_t) g_settings.key_list_end ) { - selected=Bouquets.size()-1; - liststart = (selected/listmaxshow)*listmaxshow; - paint(); + if (!Bouquets.empty()) + updateSelection(Bouquets.size()-1); } else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup) { - int step = 0; - int prev_selected = selected; - - step = ((int) msg == g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1 - selected -= step; -#if 0 - if((prev_selected-step) < 0) // because of uint - selected = Bouquets.size()-1; -#endif - if((prev_selected-step) < 0) { - if(prev_selected != 0 && step != 1) - selected = 0; - else - selected = Bouquets.size() - 1; + if (!Bouquets.empty()) { + int step = ((int) msg == g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1 + int new_selected = selected - step; + if (new_selected < 0) { + if (selected != 0 && step != 1) + new_selected = 0; + else + new_selected = Bouquets.size() - 1; + } + updateSelection(new_selected); } - - paintItem(prev_selected - liststart); - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if(oldliststart!=liststart) - paint(); - else - paintItem(selected - liststart); } else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown) { - unsigned int step = 0; - unsigned int prev_selected = selected; - - step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1 - selected += step; -#if 0 - if(selected >= Bouquets.size()) { - if (((Bouquets.size() / listmaxshow) + 1) * listmaxshow == Bouquets.size() + listmaxshow) // last page has full entries - selected = 0; - else - selected = ((step == listmaxshow) && (selected < (((Bouquets.size() / listmaxshow) + 1) * listmaxshow))) ? (Bouquets.size() - 1) : 0; + if (!Bouquets.empty()) { + int step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1 + int new_selected = selected + step; + if (new_selected >= (int) Bouquets.size()) { + if ((Bouquets.size() - listmaxshow -1 < selected) && (selected != (Bouquets.size() - 1)) && (step != 1)) + new_selected = Bouquets.size() - 1; + else if (((Bouquets.size() / listmaxshow) + 1) * listmaxshow == Bouquets.size() + listmaxshow) // last page has full entries + new_selected = 0; + else + new_selected = ((step == (int) listmaxshow) && (new_selected < (int) (((Bouquets.size() / listmaxshow)+1) * listmaxshow))) ? (Bouquets.size() - 1) : 0; + } + updateSelection(new_selected); } -#endif - if(selected >= Bouquets.size()) { - if((Bouquets.size() - listmaxshow -1 < prev_selected) && (prev_selected != (Bouquets.size() - 1)) && (step != 1)) - selected = Bouquets.size() - 1; - else if (((Bouquets.size() / listmaxshow) + 1) * listmaxshow == Bouquets.size() + listmaxshow) // last page has full entries - selected = 0; - else - selected = ((step == listmaxshow) && (selected < (((Bouquets.size() / listmaxshow)+1) * listmaxshow))) ? (Bouquets.size() - 1) : 0; - } - - paintItem(prev_selected - liststart); - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if(oldliststart!=liststart) - paint(); - else - paintItem(selected - liststart); } else if(msg == (neutrino_msg_t)g_settings.key_bouquet_up || msg == (neutrino_msg_t)g_settings.key_bouquet_down) { if(bShowChannelList) { @@ -479,45 +480,36 @@ int CBouquetList::show(bool bShowChannelList) hide(); return -3; } - } - else if ( msg == CRCInput::RC_ok ) { - if(!bShowChannelList || Bouquets[selected]->channelList->getSize() > 0) { + if(!Bouquets.empty() && (!bShowChannelList || !Bouquets[selected]->channelList->isEmpty())) { zapOnExit = true; loop=false; } } else if (CRCInput::isNumeric(msg)) { - if (pos == lmaxpos) { - if (msg == CRCInput::RC_0) { + if (!Bouquets.empty()) { + if (pos == lmaxpos) { + if (msg == CRCInput::RC_0) { + chn = firstselected; + pos = lmaxpos; + } else { + chn = CRCInput::getNumericValue(msg); + pos = 1; + } + } else { + chn = chn * 10 + CRCInput::getNumericValue(msg); + pos++; + } + + if (chn > Bouquets.size()) { chn = firstselected; pos = lmaxpos; - } else { - chn = CRCInput::getNumericValue(msg); - pos = 1; } - } else { - chn = chn * 10 + CRCInput::getNumericValue(msg); - pos++; - } - if (chn > Bouquets.size()) { - chn = firstselected; - pos = lmaxpos; + int new_selected = (chn - 1) % Bouquets.size(); // is % necessary (i.e. can firstselected be > Bouquets.size()) ? + updateSelection(new_selected); } - - int prevselected=selected; - selected = (chn - 1) % Bouquets.size(); // is % necessary (i.e. can firstselected be > Bouquets.size()) ? - paintItem(prevselected - liststart); - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if(oldliststart!=liststart) { - paint(); - } else { - paintItem(selected - liststart); - } - } else { if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) { loop = false; @@ -564,9 +556,9 @@ void CBouquetList::paintItem(int pos) CVFD::getInstance()->showMenuText(0, lname, -1, true); } else { if(npos < (int) Bouquets.size()) - iscurrent = Bouquets[npos]->channelList->getSize() > 0; - color = iscurrent ? COL_MENUCONTENT : COL_MENUCONTENTINACTIVE; - bgcolor = iscurrent ? COL_MENUCONTENT_PLUS_0 : COL_MENUCONTENTINACTIVE_PLUS_0; + iscurrent = !Bouquets[npos]->channelList->isEmpty(); + color = iscurrent ? COL_MENUCONTENT : COL_MENUCONTENTINACTIVE; + bgcolor = iscurrent ? COL_MENUCONTENT_PLUS_0 : COL_MENUCONTENTINACTIVE_PLUS_0; frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, bgcolor); } @@ -582,14 +574,6 @@ void CBouquetList::paintItem(int pos) } } -const struct button_label CBouquetListButtons[4] = -{ - { NEUTRINO_ICON_BUTTON_RED, LOCALE_CHANNELLIST_FAVS}, - { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_CHANNELLIST_PROVS}, - { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_CHANNELLIST_SATS}, - { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_CHANNELLIST_HEAD} -}; - void CBouquetList::paintHead() { frameBuffer->paintBoxRel(x,y, width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); diff --git a/src/gui/bouquetlist.h b/src/gui/bouquetlist.h index 35dcb136f..41e76a07b 100644 --- a/src/gui/bouquetlist.h +++ b/src/gui/bouquetlist.h @@ -99,6 +99,7 @@ class CBouquetList void paintHead(); void hide(); int doMenu(); + void updateSelection(int newpos); public: CBouquetList(const char * const Name = NULL); diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index 6da597a76..34071faec 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -49,6 +49,8 @@ #include #include +#include +#include void CCAMMenuHandler::init(void) { @@ -269,6 +271,7 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t snprintf(str, sizeof(str), "%s %d: %s", g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_OK : LOCALE_SC_INIT_OK), (int)curslot+1, name); printf("CCAMMenuHandler::handleCamMsg: %s\n", str); + CCamManager::getInstance()->Start(CZapit::getInstance()->GetCurrentChannelID(), CCamManager::PLAY, true); ShowHintUTF(LOCALE_MESSAGEBOX_INFO, str); #if 0 showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); @@ -471,7 +474,9 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) res = menu_return::RETURN_EXIT_ALL; } } else if (ret == 1) { - timeoutEnd = CRCInput::calcTimeoutEnd(10); + /* workaround: dont cycle here on timers */ + if (msg != NeutrinoMessages::EVT_TIMER) + timeoutEnd = CRCInput::calcTimeoutEnd(10); continue; } else if (ret == 2) { doexit = true; diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 07ce2c3b4..77ee5a991 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -631,13 +631,15 @@ int CChannelList::show() else if ((msg == CRCInput::RC_red) || (msg == CRCInput::RC_epg)) { hide(); + /* RETURN_EXIT_ALL on FAV/SAT buttons or messages_return::cancel_all from CNeutrinoApp::getInstance()->handleMsg() */ if ( g_EventList->exec(chanlist[selected]->channel_id, chanlist[selected]->getName()) == menu_return::RETURN_EXIT_ALL) { res = -2; loop = false; + } else { + paintHead(); + paint(); + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); } - paintHead(); - paint(); - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); } else if (msg == CRCInput::RC_yellow) { bShowBouquetList = true; @@ -698,11 +700,11 @@ int CChannelList::show() if (!bouquetList->Bouquets.empty()) { bool found = true; uint32_t nNext = (bouquetList->getActiveBouquetNumber()+1) % bouquetList->Bouquets.size(); - if(bouquetList->Bouquets[nNext]->channelList->getSize() <= 0) { + if(bouquetList->Bouquets[nNext]->channelList->isEmpty() ) { found = false; nNext = nNext < bouquetList->Bouquets.size()-1 ? nNext+1 : 0; for(uint32_t i = nNext; i < bouquetList->Bouquets.size(); i++) { - if(bouquetList->Bouquets[i]->channelList->getSize() > 0) { + if( !bouquetList->Bouquets[i]->channelList->isEmpty() ) { found = true; nNext = i; break; @@ -720,11 +722,11 @@ int CChannelList::show() if (!bouquetList->Bouquets.empty()) { bool found = true; int nNext = (bouquetList->getActiveBouquetNumber()+bouquetList->Bouquets.size()-1) % bouquetList->Bouquets.size(); - if(bouquetList->Bouquets[nNext]->channelList->getSize() <= 0) { + if(bouquetList->Bouquets[nNext]->channelList->isEmpty() ) { found = false; nNext = nNext > 0 ? nNext-1 : bouquetList->Bouquets.size()-1; for(int i = nNext; i > 0; i--) { - if(bouquetList->Bouquets[i]->channelList->getSize() > 0) { + if(!bouquetList->Bouquets[i]->channelList->isEmpty()) { found = true; nNext = i; break; @@ -745,9 +747,11 @@ int CChannelList::show() } } else if (( msg == CRCInput::RC_spkr ) && g_settings.channellist_new_zap_mode ) { - this->new_mode_active = (this->new_mode_active ? 0 : 1); - paintHead(); - showChannelLogo(); + if(CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_ts) { + this->new_mode_active = (this->new_mode_active ? 0 : 1); + paintHead(); + showChannelLogo(); + } } else if (CRCInput::isNumeric(msg) && (this->historyMode || g_settings.sms_channel)) { if (this->historyMode) { //numeric zap @@ -811,20 +815,19 @@ int CChannelList::show() else if ( msg == CRCInput::RC_blue ) { displayNext = !displayNext; - paint(); paintHead(); // update button bar - showChannelLogo(); + paint(); } else if ( msg == CRCInput::RC_green ) { int mode = CNeutrinoApp::getInstance()->GetChannelMode(); - if(mode){ + if(mode != LIST_MODE_FAV) { g_settings.channellist_sort_mode++; if(g_settings.channellist_sort_mode > 2) g_settings.channellist_sort_mode = 0; CNeutrinoApp::getInstance()->SetChannelMode(mode); - paint(); paintHead(); // update button bar + paint(); } } @@ -1197,7 +1200,7 @@ int CChannelList::numericZap(int key) channelList->addChannel(orgList->chanlist[i]); } } - if (channelList->getSize() != 0) { + if ( !channelList->isEmpty()) { channelList->adjustToChannelID(orgList->getActiveChannel_ChannelID(), false); this->frameBuffer->paintBackground(); res = channelList->exec(); @@ -1217,7 +1220,7 @@ int CChannelList::numericZap(int key) if(channel) channelList->addChannel(channel); } } - if (channelList->getSize() != 0) { + if ( !channelList->isEmpty() ) { this->frameBuffer->paintBackground(); res = channelList->exec(); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); @@ -1636,7 +1639,7 @@ void CChannelList::paintButtonBar(bool is_current) { //printf("[neutrino channellist] %s...%d, selected %d\n", __FUNCTION__, __LINE__, selected); unsigned int smode = CNeutrinoApp::getInstance()->GetChannelMode(); - int num_buttons = smode ? NUM_LIST_BUTTONS_SORT : NUM_LIST_BUTTONS; + int num_buttons = smode != LIST_MODE_FAV ? NUM_LIST_BUTTONS_SORT : NUM_LIST_BUTTONS; struct button_label Button[num_buttons]; const neutrino_locale_t button_ids[] = {LOCALE_INFOVIEWER_NOW,LOCALE_INFOVIEWER_NEXT,LOCALE_MAINMENU_RECORDING,LOCALE_MAINMENU_RECORDING_STOP,NONEXISTANT_LOCALE, @@ -1983,6 +1986,11 @@ void CChannelList::paint() showChannelLogo(); } +bool CChannelList::isEmpty() const +{ + return this->chanlist.empty(); +} + int CChannelList::getSize() const { return this->chanlist.size(); diff --git a/src/gui/channellist.h b/src/gui/channellist.h index e3b360156..bf1b78319 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -146,6 +146,7 @@ public: int handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data); int getSize() const; + bool isEmpty() const; int getSelectedChannelIndex() const; void setSize(int newsize); int doChannelMenu(void); diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 8f781eea0..4103b6fe6 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -884,11 +884,11 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu bool found = true; uint32_t nNext = (bouquetList->getActiveBouquetNumber()+1) % bouquetList->Bouquets.size(); //printf("**************************** EpgPlus::exec current bouquet %d new %d\n", bouquetList->getActiveBouquetNumber(), nNext); - if(bouquetList->Bouquets[nNext]->channelList->getSize() <= 0) { + if(bouquetList->Bouquets[nNext]->channelList->isEmpty() ) { found = false; nNext = nNext < bouquetList->Bouquets.size()-1 ? nNext+1 : 0; for(uint32_t i = nNext; i < bouquetList->Bouquets.size(); i++) { - if(bouquetList->Bouquets[i]->channelList->getSize() > 0) { + if(!bouquetList->Bouquets[i]->channelList->isEmpty() ) { found = true; nNext = i; break; @@ -910,11 +910,11 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu if (!bouquetList->Bouquets.empty()) { bool found = true; int nNext = (bouquetList->getActiveBouquetNumber()+bouquetList->Bouquets.size()-1) % bouquetList->Bouquets.size(); - if(bouquetList->Bouquets[nNext]->channelList->getSize() <= 0) { + if(bouquetList->Bouquets[nNext]->channelList->isEmpty()) { found = false; nNext = nNext > 0 ? nNext-1 : bouquetList->Bouquets.size()-1; for(int i = nNext; i > 0; i--) { - if(bouquetList->Bouquets[i]->channelList->getSize() > 0) { + if(!bouquetList->Bouquets[i]->channelList->isEmpty()) { found = true; nNext = i; break; @@ -1263,7 +1263,7 @@ int CEPGplusHandler::exec (CMenuTarget * parent, const std::string & /*actionKey //channelList = CNeutrinoApp::getInstance()->channelList; int bnum = bouquetList->getActiveBouquetNumber(); current_bouquet = bnum; - if(!bouquetList->Bouquets.empty() && bouquetList->Bouquets[bnum]->channelList->getSize() > 0) + if(!bouquetList->Bouquets.empty() && !bouquetList->Bouquets[bnum]->channelList->isEmpty() ) channelList = bouquetList->Bouquets[bnum]->channelList; else channelList = CNeutrinoApp::getInstance()->channelList; diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 2a30af005..249990de9 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -703,7 +703,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start switch ( msg ) { case NeutrinoMessages::EVT_TIMER: - if (data == g_InfoViewer->lcdUpdateTimer) { + if (data == g_InfoViewer->getUpdateTimer()) { GetEPGData(channel_id, id, &startzeit, false); if ( epg_done!= -1 ) { CProgressBar pb(true, -1, -1, 30, 100, 70, true); diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index aa268b932..ee468032d 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -1236,6 +1236,7 @@ int CEventFinderMenu::showMenu(void) /************************************************************************************************/ { int res = menu_return::RETURN_REPAINT; + m_search_channelname_mf = NULL; *m_event = false; if(*m_search_list == CNeutrinoEventList::SEARCH_LIST_CHANNEL) @@ -1259,24 +1260,51 @@ int CEventFinderMenu::showMenu(void) CStringInputSMS stringInput(LOCALE_EVENTFINDER_KEYWORD,m_search_keyword, 20, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789 -_/()<>=+.,:!?\\'"); - CMenuForwarder* mf2 = new CMenuForwarder(LOCALE_EVENTFINDER_KEYWORD ,true, *m_search_keyword, &stringInput, NULL, CRCInput::RC_1 ); - CMenuOptionChooser* mo0 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST , m_search_list, SEARCH_LIST_OPTIONS, SEARCH_LIST_OPTION_COUNT, true, NULL, CRCInput::RC_2); - CMenuForwarderNonLocalized* mf1 = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "3", CRCInput::RC_3 ); + CMenuForwarder* mf0 = new CMenuForwarder(LOCALE_EVENTFINDER_KEYWORD, true, *m_search_keyword, &stringInput, NULL, CRCInput::RC_1, NEUTRINO_ICON_BUTTON_1); + CMenuOptionChooser* mo0 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST, m_search_list, SEARCH_LIST_OPTIONS, SEARCH_LIST_OPTION_COUNT, true, this, CRCInput::RC_2, NEUTRINO_ICON_BUTTON_2); + m_search_channelname_mf = new CMenuForwarderNonLocalized("", *m_search_list != CNeutrinoEventList::SEARCH_LIST_ALL, m_search_channelname, this, "3", CRCInput::RC_3, NEUTRINO_ICON_BUTTON_3); CMenuOptionChooser* mo1 = new CMenuOptionChooser(LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG, m_search_epg_item, SEARCH_EPG_OPTIONS, SEARCH_EPG_OPTION_COUNT, true, NULL, CRCInput::RC_4); - CMenuForwarder* mf0 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "1", CRCInput::RC_5 ); + CMenuForwarder* mf1 = new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, this, "1", CRCInput::RC_5, NEUTRINO_ICON_BUTTON_5); CMenuWidget searchMenu(LOCALE_EVENTFINDER_HEAD, NEUTRINO_ICON_FEATURES); searchMenu.addItem(GenericMenuSeparator); - searchMenu.addItem(mf2, false); + searchMenu.addItem(mf0); searchMenu.addItem(GenericMenuSeparatorLine); - searchMenu.addItem(mo0, false); - searchMenu.addItem(mf1, false); - searchMenu.addItem(mo1, false); + searchMenu.addItem(mo0); + searchMenu.addItem(m_search_channelname_mf); + searchMenu.addItem(mo1); searchMenu.addItem(GenericMenuSeparatorLine); - searchMenu.addItem(mf0, false); + searchMenu.addItem(mf1); res = searchMenu.exec(NULL,""); return(res); } + + +/************************************************************************************************/ +bool CEventFinderMenu::changeNotify(const neutrino_locale_t OptionName, void *) +/************************************************************************************************/ +{ + if (ARE_LOCALES_EQUAL(OptionName, LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST)) + { + if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_CHANNEL) + { + m_search_channelname = g_Zapit->getChannelName(*m_search_channel_id); + m_search_channelname_mf->setActive(true); + } + else if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_BOUQUET) + { + m_search_channelname = bouquetList->Bouquets[*m_search_bouquet_id]->channelList->getName(); + m_search_channelname_mf->setActive(true); + } + else if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_ALL) + { + m_search_channelname = ""; + m_search_channelname_mf->setActive(false); + } + } + return false; +} + diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index c1ef8b81b..41a128cfa 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -134,9 +134,10 @@ class CEventListHandler : public CMenuTarget }; -class CEventFinderMenu : public CMenuTarget +class CEventFinderMenu : public CMenuTarget, CChangeObserver { private: + CMenuForwarderNonLocalized* m_search_channelname_mf; int* m_event; int* m_search_epg_item; std::string* m_search_keyword; @@ -153,6 +154,7 @@ class CEventFinderMenu : public CMenuTarget 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 *); }; #endif diff --git a/src/gui/ext_update.cpp b/src/gui/ext_update.cpp new file mode 100644 index 000000000..392819871 --- /dev/null +++ b/src/gui/ext_update.cpp @@ -0,0 +1,522 @@ +/* + update with settings - Neutrino-GUI + + Copyright (C) 2001 Steffen Hehn 'McClean' + and some other guys + Homepage: http://dbox.cyberphoria.org/ + + Copyright (C) 2012 M. Liebmann (micha-bbg) + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#define UPDATE_DEBUG_TIMER +#define UPDATE_DEBUG + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +CHintBox * hintBox = 0; + +CExtUpdate::CExtUpdate() +{ + imgFilename = ""; + mtdRamError = ""; + mtdNumber = -1; + MTDBufSize = 0xFFFF; + MTDBuf = (char*)malloc(MTDBufSize); + backupList = CONFIGDIR "/settingsupdate.conf"; + defaultBackup = CONFIGDIR; + + fUpdate = NULL; + updateLogBuf[0] = '\0'; + fLogEnabled = 1; + fLogfile = "/tmp/update.log"; + mountPkt = "/tmp/image_mount"; + FileHelpers = NULL; +} + +CExtUpdate::~CExtUpdate() +{ + if (MTDBuf != NULL) + free(MTDBuf); + if(FileHelpers) + delete[] FileHelpers; +} + +CExtUpdate* CExtUpdate::getInstance() +{ + static CExtUpdate* ExtUpdate = NULL; + if(!ExtUpdate) + ExtUpdate = new CExtUpdate(); + return ExtUpdate; +} + +bool CExtUpdate::ErrorReset(bool modus, const std::string & msg1, const std::string & msg2) +{ + char buf[1024]; + + if (modus & RESET_UNLOAD) { + umount(mountPkt.c_str()); + my_system("rmmod", mtdramDriver.c_str()); + } + if (modus & RESET_FD1) + close(fd1); + if (modus & RESET_FD2) + close(fd2); + if (modus & RESET_F1) + fclose(f1); + + if (msg2 == "") + snprintf(buf, sizeof(buf), "%s\n", msg1.c_str()); + else + snprintf(buf, sizeof(buf), "%s %s\n", msg1.c_str(), msg2.c_str()); + + if ((msg1 != "") || (msg2 != "")) { + mtdRamError = buf; + WRITE_UPDATE_LOG("ERROR: %s", buf); + printf(mtdRamError.c_str()); + } + if(hintBox) + hintBox->hide(); + return false; +} + +bool CExtUpdate::writemtdExt(const std::string & filename) +{ + if(!FileHelpers) + FileHelpers = new CFileHelpers(); + imgFilename = (std::string)g_settings.update_dir + "/" + FILESYSTEM_ENCODING_TO_UTF8_STRING(filename); + DBG_TIMER_START() + bool ret = writemtdExt(); + DBG_TIMER_STOP("Image editing") + if (!ret) { + if (mtdRamError != "") + DisplayErrorMessage(mtdRamError.c_str()); + } + else { + if ((mtdNumber < 3) || (mtdNumber > 4)) { + const char *err = "invalid mtdNumber\n"; + printf(err); + DisplayErrorMessage(err); + WRITE_UPDATE_LOG("ERROR: %s", err); + return false; + } + ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SUCCESSFULLY), CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_INFO); + WRITE_UPDATE_LOG("\n"); + WRITE_UPDATE_LOG("##### Settings taken. #####\n"); + CFlashExpert::getInstance()->writemtd(filename, mtdNumber); + } + return ret; +} + +bool CExtUpdate::isMtdramLoad() +{ + char buf[256] = ""; + bool ret = false; + FILE* f = fopen("/proc/modules", "r"); + if (f) { + while(fgets(buf, sizeof(buf), f) != NULL) { + if (strstr(buf, "mtdram") != NULL) { + ret = true; + break; + } + } + fclose(f); + } + return ret; +} + +bool CExtUpdate::writemtdExt() +{ + if(!hintBox) + hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_PROCESSED)); + hintBox->paint(); + mtdRamError = ""; + std::string osrelease = ""; + mtdramDriver = ""; // driver path + char buf1[256] = ""; + char buf2[256] = ""; + + CMTDInfo * mtdInfo = CMTDInfo::getInstance(); + std::string mtdFilename = mtdInfo->findMTDsystem(); // /dev/mtdX + int mtdSize = mtdInfo->getMTDSize(mtdFilename); + int mtdEraseSize = mtdInfo->getMTDEraseSize(mtdFilename); + mtdNumber = mtdInfo->findMTDNumber(mtdFilename); + + // get osrelease + struct utsname uts_info; + if( uname(&uts_info) == 0 ) + osrelease = uts_info.release; + else + return ErrorReset(0, "error no kernel info"); + + // check if mtdram driver is already loaded + if (!isMtdramLoad()) { + // check if exist mtdram driver + snprintf(buf1, sizeof(buf1), "/lib/modules/%s/mtdram.ko", osrelease.c_str()); + mtdramDriver = buf1; + if ( !file_exists(mtdramDriver.c_str()) ) + return ErrorReset(0, "no mtdram driver available"); + // load mtdram driver + snprintf(buf1, sizeof(buf1), "total_size=%d", mtdSize/1024); + snprintf(buf2, sizeof(buf2), "erase_size=%d", mtdEraseSize/1024); + my_system("insmod", mtdramDriver.c_str(), buf1, buf2); + // check if mtdram driver is now loaded + if (!isMtdramLoad()) + return ErrorReset(0, "error load mtdram driver"); + } + else { + DBG_MSG("mtdram driver is already loaded"); + } + + // find mtdram device + std::string mtdRamFilename = "", mtdBlockFileName = ""; + int mtdRamSize, mtdRamEraseSize, mtdRamNr = 0; + f1 = fopen("/proc/mtd", "r"); + if(!f1) + return ErrorReset(RESET_UNLOAD, "cannot read /proc/mtd"); + fgets(buf1, sizeof(buf1), f1); + while(!feof(f1)) { + if(fgets(buf1, sizeof(buf1), f1)!=NULL) { + char dummy[50] = ""; + sscanf(buf1, "mtd%1d: %8x %8x \"%48s\"\n", &mtdRamNr, &mtdRamSize, &mtdRamEraseSize, dummy); + if (strstr(buf1, "mtdram test device") != NULL) { + sprintf(buf1, "/dev/mtd%d", mtdRamNr); + mtdRamFilename = buf1; + sprintf(buf1, "/dev/mtdblock%d", mtdRamNr); + mtdBlockFileName = buf1; + break; + } + } + } + fclose(f1); + + if (mtdRamFilename == "") + return ErrorReset(RESET_UNLOAD, "no mtdram test device found"); + else { + // check mtdRamSize / mtdRamEraseSize + if ((mtdRamSize != mtdSize) || (mtdRamEraseSize != mtdEraseSize)) { + snprintf(buf2, sizeof(buf2), "error MTDSize(%08x/%08x) or MTDEraseSize(%08x/%08x)\n", mtdSize, mtdRamSize, mtdEraseSize, mtdRamEraseSize); + return ErrorReset(RESET_UNLOAD, buf2); + } + } + + // copy image to mtdblock + if (MTDBuf == NULL) + return ErrorReset(RESET_UNLOAD, "malloc error"); + fd1 = open(imgFilename.c_str(), O_RDONLY); + if (fd1 < 0) + return ErrorReset(RESET_UNLOAD, "cannot read image file: " + imgFilename); + long filesize = lseek(fd1, 0, SEEK_END); + lseek(fd1, 0, SEEK_SET); + if(filesize == 0) + return ErrorReset(RESET_UNLOAD | RESET_FD1, "image filesize is 0"); + if(filesize > mtdSize) + return ErrorReset(RESET_UNLOAD | RESET_FD1, "image filesize too large"); + fd2 = -1; + int tmpCount = 0; + while (fd2 < 0) { + fd2 = open(mtdBlockFileName.c_str(), O_WRONLY); + tmpCount++; + if (tmpCount > 3) + break; + sleep(1); + } + if (fd2 < 0) + return ErrorReset(RESET_UNLOAD | RESET_FD1, "cannot open mtdBlock"); + long fsize = filesize; + long block; + while(fsize > 0) { + block = fsize; + if(block > (long)MTDBufSize) + block = MTDBufSize; + read(fd1, MTDBuf, block); + write(fd2, MTDBuf, block); + fsize -= block; + } + close(fd1); + close(fd2); + + FileHelpers->createDir(mountPkt.c_str(), 0755); + int res = mount(mtdBlockFileName.c_str(), mountPkt.c_str(), "jffs2", 0, NULL); + if (res) + return ErrorReset(RESET_UNLOAD, "mount error"); + + readBackupList(mountPkt); + + res = umount(mountPkt.c_str()); + if (res) + return ErrorReset(RESET_UNLOAD, "unmount error"); + + unlink(imgFilename.c_str()); + + // copy mtdblock to image + if (MTDBuf == NULL) + return ErrorReset(RESET_UNLOAD, "malloc error"); + fd1 = open(mtdBlockFileName.c_str(), O_RDONLY); + if (fd1 < 0) + return ErrorReset(RESET_UNLOAD, "cannot read mtdBlock"); + fsize = mtdRamSize; + fd2 = open(imgFilename.c_str(), O_WRONLY | O_CREAT); + if (fd2 < 0) + return ErrorReset(RESET_UNLOAD | RESET_FD1, "cannot open image file: ", imgFilename); + while(fsize > 0) { + block = fsize; + if(block > (long)MTDBufSize) + block = MTDBufSize; + read(fd1, MTDBuf, block); + write(fd2, MTDBuf, block); + fsize -= block; + } + lseek(fd2, 0, SEEK_SET); + long fsizeDst = lseek(fd2, 0, SEEK_END); + close(fd1); + close(fd2); + // check image file size + if (mtdRamSize != fsizeDst) { + unlink(imgFilename.c_str()); + return ErrorReset(0, "error file size: ", imgFilename); + } + + // unload mtdramDriver only + ErrorReset(RESET_UNLOAD); + + if(hintBox) + hintBox->hide(); + + return true; +} + +std::string Wildcard = ""; + +int fileSelect(const struct dirent *entry) +{ + if ((strcmp(entry->d_name, ".") == 0) || (strcmp(entry->d_name, "..") == 0)) + return 0; + else + if ((Wildcard != "") && (fnmatch(Wildcard.c_str(), entry->d_name, FNM_FILE_NAME))) + return 0; + else + return 1; + +} + +bool CExtUpdate::copyFileList(const std::string & fileList, const std::string & dstPath) +{ + Wildcard = ""; + struct dirent **namelist; + std::string fList = fileList, dst; + static struct stat FileInfo; + char buf[PATH_MAX]; + + size_t pos = fileList.find_last_of("/"); + fList = fileList.substr(0, pos); + Wildcard = fileList.substr(pos+1); + + int n = scandir(fList.c_str(), &namelist, fileSelect, 0); + if (n > 0) { + dst = dstPath + fList; + FileHelpers->createDir(dst.c_str(), 0755); + while (n--) { + std::string dName = namelist[n]->d_name; + if (lstat((fList+"/"+dName).c_str(), &FileInfo) != -1) { + if (S_ISLNK(FileInfo.st_mode)) { + int len = readlink((fList+"/"+dName).c_str(), buf, sizeof(buf)-1); + if (len != -1) { + buf[len] = '\0'; + WRITE_UPDATE_LOG("symlink: %s => %s\n", (dst+"/"+dName).c_str(), buf); + symlink(buf, (dst+"/"+dName).c_str()); + } + } + else + if (S_ISREG(FileInfo.st_mode)) { + WRITE_UPDATE_LOG("copy %s => %s\n", (fList+"/"+dName).c_str(), (dst+"/"+dName).c_str()); + if (!FileHelpers->copyFile((fList+"/"+dName).c_str(), (dst+"/"+dName).c_str(), FileInfo.st_mode & 0x0FFF)) + return ErrorReset(0, "copyFile error"); + } + } + free(namelist[n]); + } + free(namelist); + } + + return true; +} + +bool CExtUpdate::findConfigEntry(std::string & line, std::string find) +{ + if (line.find(find + "=") == 0) { + size_t pos = line.find_first_of('='); + line = line.substr(pos+1); + line = trim(line); + return true; + } + return false; +} + +bool CExtUpdate::readConfig(const std::string & line) +{ + std::string tmp1 = line; + if (findConfigEntry(tmp1, "Log")) { + if (tmp1 != "") + fLogEnabled = atoi(tmp1.c_str()); + return true; + } + tmp1 = line; + if (findConfigEntry(tmp1, "LogFile")) { + if (tmp1 != "") + fLogfile = tmp1; + return true; + } + + return true; +} + +bool CExtUpdate::readBackupList(const std::string & dstPath) +{ + char buf[PATH_MAX]; + static struct stat FileInfo; + + f1 = fopen(backupList.c_str(), "r"); + if (f1 == NULL) { + f1 = fopen(backupList.c_str(), "w"); + if (f1 != NULL) { + char tmp1[1024]; + snprintf(tmp1, sizeof(tmp1), "Log=%d\nLogFile=%s\n\n%s\n\n", fLogEnabled, fLogfile.c_str(), defaultBackup.c_str()); + fwrite(tmp1, 1, strlen(tmp1), f1); + fclose(f1); + } + else + return ErrorReset(0, "cannot create missing backuplist file: " + backupList); + } + + f1 = fopen(backupList.c_str(), "r"); + if (f1 == NULL) + return ErrorReset(0, "cannot read backuplist file: " + backupList); + fpos_t fz; + fseek(f1, 0, SEEK_END); + fgetpos(f1, &fz); + fseek(f1, 0, SEEK_SET); + if (fz.__pos == 0) + return ErrorReset(RESET_F1, "backuplist filesize is 0"); + size_t pos; + while(fgets(buf, sizeof(buf), f1) != NULL) { + std::string line = buf; + // remove comments + line = trim(line); + if (line.find_first_of("#") == 0) + continue; + pos = line.find_first_of("#"); + if (pos != std::string::npos) { + line = line.substr(0, pos); + line = trim(line); + } + // config vars + if (line.find_first_of("/+-~") != 0) { + if (line.length() > 1) + readConfig(line); + continue; + } + // special folders + else if ((line == "/") || (line == "/*") || (line == "/*.*") || (line.find("/dev") == 0) || (line.find("/proc") == 0) || + (line.find("/sys") == 0) || (line.find("/mnt") == 0) || (line.find("/tmp") == 0)) { + snprintf(buf, sizeof(buf), g_Locale->getText(LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SKIPPED), line.c_str()); + WRITE_UPDATE_LOG("%s%s", buf, "\n"); + ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, buf, CMessageBox::mbrOk, CMessageBox::mbOk, NEUTRINO_ICON_INFO); + continue; + } + // remove '/' from line end + size_t len = line.length(); + pos = line.find_last_of("/"); + if (len == pos+1) + line = line.substr(0, pos); + std::string dst = dstPath + line; + if ((line.find("*") != std::string::npos) || (line.find("?") != std::string::npos)) { + // Wildcards + DBG_MSG("Wildcards: %s\n", dst.c_str()); + WRITE_UPDATE_LOG("\n"); + WRITE_UPDATE_LOG("--------------------\n"); + WRITE_UPDATE_LOG("Wildcards: %s\n", dst.c_str()); + copyFileList(line, dstPath); + } + else { + if (lstat(line.c_str(), &FileInfo) != -1) { + if (S_ISREG(FileInfo.st_mode)) { + // one file only + pos = dst.find_last_of("/"); + std::string dir = dst.substr(0, pos); + FileHelpers->createDir(dir.c_str(), 0755); + DBG_MSG("file: %s => %s\n", line.c_str(), dst.c_str()); + WRITE_UPDATE_LOG("\n"); + WRITE_UPDATE_LOG("file: %s => %s\n", line.c_str(), dst.c_str()); + WRITE_UPDATE_LOG("--------------------\n"); + if (!FileHelpers->copyFile(line.c_str(), dst.c_str(), FileInfo.st_mode & 0x0FFF)) + return ErrorReset(0, "copyFile error"); + } + else if (S_ISDIR(FileInfo.st_mode)) { + // directory + DBG_MSG("directory: %s => %s\n", line.c_str(), dst.c_str()); + WRITE_UPDATE_LOG("\n"); + WRITE_UPDATE_LOG("directory: %s => %s\n", line.c_str(), dst.c_str()); + WRITE_UPDATE_LOG("--------------------\n"); + FileHelpers->copyDir(line.c_str(), dst.c_str()); + } + } + + } + } + fclose(f1); + + return true; +} + +void CExtUpdate::updateLog(const char *buf) +{ + if ((!fUpdate) && (fLogEnabled)) + fUpdate = fopen(fLogfile.c_str(), "a"); + if (fUpdate) { + fwrite(buf, 1, strlen(buf), fUpdate); + fclose(fUpdate); + fUpdate = NULL; + } +} diff --git a/src/gui/ext_update.h b/src/gui/ext_update.h new file mode 100644 index 000000000..a588cb890 --- /dev/null +++ b/src/gui/ext_update.h @@ -0,0 +1,104 @@ +/* + update with settings - Neutrino-GUI + + Copyright (C) 2001 Steffen Hehn 'McClean' + and some other guys + Homepage: http://dbox.cyberphoria.org/ + + Copyright (C) 2012 M. Liebmann (micha-bbg) + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __CEXTUPDATE__ +#define __CEXTUPDATE__ + +#include +#include + +#include + +class CExtUpdate +{ + private: + enum + { + RESET_UNLOAD = 1, + RESET_FD1 = 2, + RESET_FD2 = 4, + RESET_F1 = 8 + }; + std::string imgFilename; + std::string mtdRamError; + int mtdNumber; + int MTDBufSize; + char *MTDBuf; + int fd1, fd2; + FILE *f1; + std::string mtdramDriver; + std::string backupList, defaultBackup; + std::string mountPkt; + CFileHelpers* FileHelpers; + + bool writemtdExt(void); + bool readBackupList(const std::string & dstPath); + bool copyFileList(const std::string & fileList, const std::string & dstPath); + bool readConfig(const std::string & Config); + bool findConfigEntry(std::string & line, std::string find); + bool isMtdramLoad(); + + FILE * fUpdate; + char updateLogBuf[1024]; + std::string fLogfile; + int fLogEnabled; + void updateLog(const char *buf); + + public: + CExtUpdate(); + ~CExtUpdate(); + static CExtUpdate* getInstance(); + + bool writemtdExt(const std::string & filename); + bool ErrorReset(bool modus, const std::string & msg1="", const std::string & msg2=""); + +}; + +#ifdef UPDATE_DEBUG_TIMER +static struct timeval timer_tv, timer_tv2; +static unsigned int timer_msec; +#define DBG_TIMER_START() gettimeofday(&timer_tv, NULL); +#define DBG_TIMER_STOP(label) \ + gettimeofday(&timer_tv2, NULL); \ + timer_msec = ((timer_tv2.tv_sec - timer_tv.tv_sec) * 1000) + ((timer_tv2.tv_usec - timer_tv.tv_usec) / 1000); \ + printf("##### [ext_update.cpp] %s: %u msec\n", label, timer_msec); +#else +#define DBG_TIMER_START() +#define DBG_TIMER_STOP(label) +#endif // UPDATE_DEBUG_TIMER + +#ifdef UPDATE_DEBUG +#define DBG_MSG(fmt, args...) printf("#### [ext_update.cpp:%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args); +#else +#define DBG_MSG(fmt, args...) +#endif // UPDATE_DEBUG + +#define WRITE_UPDATE_LOG(fmt, args...) \ + snprintf(updateLogBuf, sizeof(updateLogBuf), "[update:%d] " fmt, __LINE__ , ## args); \ + updateLog(updateLogBuf); + +#endif // __CEXTUPDATE__ diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index ed3f2fd1e..aa88e4da2 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -232,7 +232,7 @@ unsigned char SMSKeyInput::getOldKey() const { return m_oldKey; } - +#if 0 const timeval* SMSKeyInput::getOldKeyTime() const { return &m_oldKeyTime; @@ -248,7 +248,7 @@ int SMSKeyInput::getTimeout() const { return m_timeout; } - +#endif void SMSKeyInput::setTimeout(int timeout) { m_timeout = timeout; diff --git a/src/gui/filebrowser.h b/src/gui/filebrowser.h index 3a20ab783..b1e92dabf 100644 --- a/src/gui/filebrowser.h +++ b/src/gui/filebrowser.h @@ -92,7 +92,7 @@ public: * @return the last key calculated by #handleMsg(neutrino_msg_t) */ unsigned char getOldKey() const; - +#if 0 /** * Returns time of last key push. * resolution: usecs @@ -106,7 +106,7 @@ public: time_t getOldKeyTimeSec() const; int getTimeout() const; - +#endif /** * Sets the timeout. * @param timeout keypresses within this period are taken as a diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 9120a7d56..f1643ab12 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -39,8 +39,8 @@ #include #include -#include "svn_version.h" -#define SVN_REV "SVN Rev.:" +#include "git_version.h" +#define GIT_DESC "GIT Desc.:" #define GIT_REV "GIT Build:" extern cVideo * videoDecoder; @@ -92,8 +92,8 @@ void CImageInfo::Init(void) offset = tmpoffset; } } -#ifdef SVNVERSION - int off_tmp = g_Font[font_info]->getRenderWidth(SVN_REV); +#ifdef GITVERSION + int off_tmp = g_Font[font_info]->getRenderWidth(GIT_DESC); #else int off_tmp = g_Font[font_info]->getRenderWidth(GIT_REV); #endif @@ -208,8 +208,8 @@ void CImageInfo::paint() const char * version = config.getString("version", "no version").c_str(); const char * docs = config.getString("docs", "http://wiki.neutrino-hd.de").c_str(); const char * forum = config.getString("forum", "http://forum.tuxbox.org").c_str(); -#ifdef SVNVERSION - const char * builddate = config.getString("builddate", SVNVERSION).c_str(); +#ifdef GITVERSION + const char * builddate = GITVERSION; #else const char * builddate = config.getString("builddate", BUILT_DATE).c_str(); #endif @@ -246,8 +246,8 @@ void CImageInfo::paint() paintLine(xpos+offset, font_info, Version_Kernel.c_str()); ypos += iheight; -#ifdef SVNVERSION - paintLine(xpos , font_info, SVN_REV); +#ifdef GITVERSION + paintLine(xpos , font_info, GIT_DESC); #else paintLine(xpos , font_info, GIT_REV); #endif diff --git a/src/gui/info_menue.cpp b/src/gui/info_menue.cpp index bb8470a48..c90c17b7d 100644 --- a/src/gui/info_menue.cpp +++ b/src/gui/info_menue.cpp @@ -79,7 +79,7 @@ int CInfoMenu::showMenu() mf->setHint(NEUTRINO_ICON_HINT_DBOXINFO, LOCALE_MENU_HINT_DBOXINFO); info->addItem(mf); - mf = new CMenuForwarder(LOCALE_STREAMINFO_HEAD, true, NULL, &streaminfo, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + mf = new CMenuForwarder(LOCALE_STREAMINFO_HEAD, !CNeutrinoApp::getInstance()->channelList->isEmpty(), NULL, &streaminfo, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); mf->setHint(NEUTRINO_ICON_HINT_STREAMINFO, LOCALE_MENU_HINT_STREAMINFO); info->addItem(mf); diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 590856349..64e3cb9bf 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -136,6 +136,7 @@ void CInfoViewer::Init() channel_id = CZapit::getInstance()->GetCurrentChannelID();; lcdUpdateTimer = 0; + rt_x = rt_y = rt_h = rt_w = 0; } /* @@ -199,10 +200,6 @@ void CInfoViewer::start () time_left_width = 2 * g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getWidth(); /* still a kludge */ time_dot_width = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth(":"); time_width = time_left_width* 2+ time_dot_width; - - const int lcd_update_time_tv_mode = (60 * 1000 * 1000); - if (lcdUpdateTimer == 0) - lcdUpdateTimer = g_RCInput->addTimer (lcd_update_time_tv_mode, false, true); } void CInfoViewer::changePB() @@ -1008,7 +1005,9 @@ void CInfoViewer::showMotorMoving (int duration) void CInfoViewer::killRadiotext() { - frameBuffer->paintBackgroundBox(rt_x, rt_y, rt_w, rt_h); + if (g_Radiotext->S_RtOsd) + frameBuffer->paintBackgroundBox(rt_x, rt_y, rt_w, rt_h); + rt_x = rt_y = rt_h = rt_w = 0; frameBuffer->blit(); } @@ -1149,7 +1148,6 @@ void CInfoViewer::showRadiotext() } - int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) { if ((msg == NeutrinoMessages::EVT_CURRENTNEXT_EPG) || (msg == NeutrinoMessages::EVT_NEXTPROGRAM)) { @@ -1955,6 +1953,13 @@ void CInfoViewer::showEpgInfo() //message on event change } } +void CInfoViewer::setUpdateTimer(uint64_t interval) +{ + g_RCInput->killTimer(lcdUpdateTimer); + if (interval) + lcdUpdateTimer = g_RCInput->addTimer(interval, false); +} + #if 0 int CInfoViewerHandler::exec (CMenuTarget * parent, const std::string & /*actionkey*/) { diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index 25b13f018..dc503c3fa 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -107,6 +107,8 @@ class CInfoViewer CProgressBar *snrscale, *sigscale, *timescale; bool casysChange; bool channellogoChange; + uint32_t lcdUpdateTimer; + void paintBackground(int col_Numbox); void show_Data( bool calledFromEvent = false ); void display_Info(const char *current, const char *next, bool UTF8 = true, @@ -136,7 +138,6 @@ class CInfoViewer bool chanready; bool is_visible; bool virtual_zap_mode; - uint32_t lcdUpdateTimer; char aspectRatio; uint32_t sec_timer_id; @@ -171,6 +172,8 @@ class CInfoViewer void showSNR(); void Init(void); bool SDT_freq_update; + void setUpdateTimer(uint64_t interval); + uint32_t getUpdateTimer(void) { return lcdUpdateTimer; } }; #if 0 class CInfoViewerHandler : public CMenuTarget diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 572e2659a..caafa6652 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -237,10 +238,13 @@ void CInfoViewerBB::getBBButtonInfo() text = g_settings.usermenu_text[SNeutrinoSettings::BUTTON_GREEN]; if (text == g_Locale->getText(LOCALE_AUDIOSELECTMENUE_HEAD)) text = ""; - if (!g_RemoteControl->current_PIDs.APIDs.empty()) { + if(NeutrinoMessages::mode_ts == CNeutrinoApp::getInstance()->getMode() && !CMoviePlayerGui::getInstance().timeshift){ + text = CMoviePlayerGui::getInstance().CurrentAudioName(); + }else if (!g_RemoteControl->current_PIDs.APIDs.empty()) { int selected = g_RemoteControl->current_PIDs.PIDs.selected_apid; - if (text.empty()) + if (text.empty()){ text = g_RemoteControl->current_PIDs.APIDs[selected].desc; + } } break; case CInfoViewerBB::BUTTON_SUBS: @@ -715,14 +719,21 @@ void CInfoViewerBB::paint_ca_icons(int caid, char * icon, int &icon_space_offset void CInfoViewerBB::showIcon_CA_Status(int notfirst) { + if (g_settings.casystem_display == 3) + return; + if(NeutrinoMessages::mode_ts == CNeutrinoApp::getInstance()->getMode() && !CMoviePlayerGui::getInstance().timeshift){ + if (g_settings.casystem_display == 2) { + fta = true; + showOne_CAIcon(); + } + return; + } + int caids[] = { 0x900, 0xD00, 0xB00, 0x1800, 0x0500, 0x0100, 0x600, 0x2600, 0x4a00, 0x0E00 }; const char * white = (char *) "white"; const char * yellow = (char *) "yellow"; int icon_space_offset = 0; - if (g_settings.casystem_display == 3) - return; - if(!g_InfoViewer->chanready) { if (g_settings.casystem_display == 2) { fta = true; diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index 7bd0a86fa..9a33fea7e 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -258,7 +258,6 @@ void CMiscMenue::showMiscSettingsMenuGeneral(CMenuWidget *ms_general) CMenuOptionNumberChooser * mn = new CMenuOptionNumberChooser(LOCALE_FAN_SPEED, &g_settings.fan_speed, true, 1, 14, fanNotifier, 0, 0, LOCALE_OPTIONS_OFF); mn->setHint("", LOCALE_MENU_HINT_FAN_SPEED); ms_general->addItem(mn); - fanNotifier->changeNotify(NONEXISTANT_LOCALE, (void*) &g_settings.fan_speed); } //rotor diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index d1eebbf59..314cfe95c 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -309,7 +309,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) default: //printf("[motorcontrol] message received...\n"); if ((msg >= CRCInput::RC_WithData) && (msg < CRCInput::RC_WithData + 0x10000000)) - delete (unsigned char*) data; + delete[] (unsigned char*) data; break; } } @@ -425,7 +425,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) default: //printf("[motorcontrol] message received...\n"); if ((msg >= CRCInput::RC_WithData) && (msg < CRCInput::RC_WithData + 0x10000000)) - delete (unsigned char*) data; + delete[] (unsigned char*) data; break; } } diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 8658bc770..1b7c685c5 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -711,6 +711,9 @@ void CMoviePlayerGui::callInfoViewer(const int duration, const int curr_pos) CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID()); return; } + currentaudioname = "Unk"; + 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, duration, curr_pos); @@ -735,6 +738,78 @@ bool CMoviePlayerGui::getAudioName(int apid, std::string &apidtitle) return false; } +void CMoviePlayerGui::addAudioFormat(int count, std::string &apidtitle, bool file_player, bool& enabled) +{ + enabled = true; + switch(ac3flags[count]) + { + case 1: /*AC3,EAC3*/ + if (apidtitle.find("AC3") == std::string::npos || file_player) + apidtitle.append(" (AC3)"); + break; + case 2: /*teletext*/ + apidtitle.append(" (Teletext)"); + enabled = false; + break; + case 3: /*MP2*/ + apidtitle.append("( MP2)"); + break; + case 4: /*MP3*/ + apidtitle.append(" (MP3)"); + break; + case 5: /*AAC*/ + apidtitle.append(" (AAC)"); + break; + case 6: /*DTS*/ + apidtitle.append(" (DTS)"); +#ifndef HAVE_SPARK_HARDWARE + enabled = false; +#endif + break; + case 7: /*MLP*/ + apidtitle.append(" (MLP)"); + break; + default: + break; + } +} + +void CMoviePlayerGui::getCurrentAudioName( bool file_player, std::string &audioname) +{ + if(file_player && !numpida){ + playback->FindAllPids(apids, ac3flags, &numpida, language); + if(numpida) + currentapid = apids[0]; + } + bool dumm = true; + for (unsigned int count = 0; count < numpida; count++) { + + if(currentapid == apids[count]){ + if(!file_player){ + getAudioName(apids[count], audioname); + return ; + }else if (!language[count].empty()){ + audioname = language[count]; + addAudioFormat(count, audioname, file_player, dumm); + if(!dumm && (count < numpida)){ + currentapid = apids[count+1]; + continue; + } + return ; + } + char apidnumber[20]; + sprintf(apidnumber, "Stream %d %X", count + 1, apids[count]); + audioname = apidnumber; + addAudioFormat(count, audioname, file_player, dumm); + if(!dumm && (count < numpida)){ + currentapid = apids[count+1]; + continue; + } + return ; + } + } +} + void CMoviePlayerGui::selectAudioPid(bool file_player) { CMenuWidget APIDSelector(LOCALE_APIDSELECTOR_HEAD, NEUTRINO_ICON_AUDIO); @@ -745,7 +820,6 @@ void CMoviePlayerGui::selectAudioPid(bool file_player) if(file_player && !numpida){ playback->FindAllPids(apids, ac3flags, &numpida, language); - /* fix current pid in case of file play */ if(numpida) currentapid = apids[0]; } @@ -767,38 +841,12 @@ void CMoviePlayerGui::selectAudioPid(bool file_player) sprintf(apidnumber, "Stream %d %X", count + 1, apids[count]); apidtitle = apidnumber; } - - switch(ac3flags[count]) - { - case 1: /*AC3,EAC3*/ - if (apidtitle.find("AC3") == std::string::npos || file_player) - apidtitle.append(" (AC3)"); - break; - case 2: /*teletext*/ - apidtitle.append(" (Teletext)"); - enabled = false; - break; - case 3: /*MP2*/ - apidtitle.append("( MP2)"); - break; - case 4: /*MP3*/ - apidtitle.append(" (MP3)"); - break; - case 5: /*AAC*/ - apidtitle.append(" (AAC)"); - break; - case 6: /*DTS*/ - apidtitle.append(" (DTS)"); -#ifndef HAVE_SPARK_HARDWARE - enabled = false; -#endif - break; - case 7: /*MLP*/ - apidtitle.append(" (MLP)"); - break; - default: - break; + addAudioFormat(count, apidtitle, file_player, enabled); + if(defpid && !enabled && (count < numpida)){ + currentapid = apids[count+1]; + defpid = false; } + char cnt[5]; sprintf(cnt, "%d", count); CMenuForwarderNonLocalized * item = new CMenuForwarderNonLocalized(apidtitle.c_str(), enabled, NULL, selector, cnt, CRCInput::convertDigitToKey(count + 1)); @@ -816,7 +864,7 @@ void CMoviePlayerGui::selectAudioPid(bool file_player) APIDSelector.addItem(new CMenuOptionNumberChooser(NONEXISTANT_LOCALE, &percent[i], currentapid == apids[i], 0, 999, CVolume::getInstance(), 0, 0, NONEXISTANT_LOCALE, - g_RemoteControl->current_PIDs.APIDs[i].desc)); + p_movie_info->audioPids[i].epgAudioPidName.c_str())); } } diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 1ede8b215..31125f1a1 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -69,7 +69,7 @@ class CMoviePlayerGui : public CMenuTarget std::string full_name; std::string file_name; - + std::string currentaudioname; bool playing; CMoviePlayerGui::state playstate; int speed; @@ -112,6 +112,8 @@ class CMoviePlayerGui : public CMenuTarget void fillPids(); bool getAudioName(int pid, std::string &apidtitle); void selectAudioPid(bool file_player); + void getCurrentAudioName( bool file_player, std::string &audioname); + void addAudioFormat(int count, std::string &apidtitle, bool file_player, bool& enabled ); void handleMovieBrowser(neutrino_msg_t msg, int position = 0); bool SelectFile(); @@ -127,6 +129,7 @@ class CMoviePlayerGui : public CMenuTarget int exec(CMenuTarget* parent, const std::string & actionKey); bool Playing() { return playing; }; + std::string CurrentAudioName() { return currentaudioname; }; int timeshift; int file_prozent; }; diff --git a/src/gui/network_service.cpp b/src/gui/network_service.cpp index fafef83ac..d0bf2e81a 100644 --- a/src/gui/network_service.cpp +++ b/src/gui/network_service.cpp @@ -57,7 +57,7 @@ static struct network_service services[SERVICE_COUNT] = { "FTP", "vsftpd", "", LOCALE_MENU_HINT_NET_FTPD, "", 0 }, { "Telnet", "telnetd", "-l/bin/login", LOCALE_MENU_HINT_NET_TELNET, "", 0 }, { "DjMount", "djmount", "-o iocharset=utf8 /media/00upnp/", LOCALE_MENU_HINT_NET_DJMOUNT, "", 0 }, - { "uShare", "ushare", "-D", LOCALE_MENU_HINT_NET_USHARE, "", 0 } + { "uShare", "ushare", "-D -n `cat /etc/hostname`", LOCALE_MENU_HINT_NET_USHARE, "", 0 } }; CNetworkService::CNetworkService(std::string cmd, std::string opts) @@ -73,8 +73,9 @@ CNetworkService::CNetworkService(std::string cmd, std::string opts) void CNetworkService::Start() { + std::string cmd = command + " " + options; printf("CNetworkService::Start: %s %s\n", command.c_str(), options.c_str()); - my_system( command.c_str(), options.c_str()); + my_system("/bin/sh", "-c", cmd.c_str()); enabled = true; TouchFile(); } diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 86cf29252..139778a2e 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -68,8 +68,6 @@ extern std::string ttx_font_file; COsdSetup::COsdSetup(bool wizard_mode) { colorSetupNotifier = new CColorSetupNotifier(); - colorSetupNotifier->changeNotify(NONEXISTANT_LOCALE, NULL); - fontsizenotifier = new CFontSizeNotifier; osd_menu = NULL; @@ -897,19 +895,30 @@ int COsdSetup::showContextChanlistMenu() menu_chanlist->enableFade(false); menu_chanlist->setSelected(cselected); - menu_chanlist->addIntroItems(LOCALE_MISCSETTINGS_CHANNELLIST, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); + menu_chanlist->addIntroItems(LOCALE_MISCSETTINGS_CHANNELLIST);//, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); - menu_chanlist->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_CHANNELLIST_EPGTEXT_ALIGN, &g_settings.channellist_epgtext_align_right, CHANNELLIST_EPGTEXT_ALIGN_RIGHT_OPTIONS, CHANNELLIST_EPGTEXT_ALIGN_RIGHT_OPTIONS_COUNT, true)); - menu_chanlist->addItem(new CMenuOptionChooser(LOCALE_CHANNELLIST_EXTENDED, &g_settings.channellist_extended, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); - menu_chanlist->addItem(new CMenuOptionChooser(LOCALE_CHANNELLIST_FOOT, &g_settings.channellist_foot, CHANNELLIST_FOOT_OPTIONS, CHANNELLIST_FOOT_OPTIONS_COUNT, true)); - menu_chanlist->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_CHANNELLIST_COLORED_EVENTS, &g_settings.colored_events_channellist, OPTIONS_COLORED_EVENTS_OPTIONS, OPTIONS_COLORED_EVENTS_OPTION_COUNT, true)); + CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_CHANNELLIST_EPGTEXT_ALIGN, &g_settings.channellist_epgtext_align_right, CHANNELLIST_EPGTEXT_ALIGN_RIGHT_OPTIONS, CHANNELLIST_EPGTEXT_ALIGN_RIGHT_OPTIONS_COUNT, true); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_EPG_ALIGN); + menu_chanlist->addItem(mc); + + mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_EXTENDED, &g_settings.channellist_extended, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_EXTENDED); + menu_chanlist->addItem(mc); + + mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_FOOT, &g_settings.channellist_foot, CHANNELLIST_FOOT_OPTIONS, CHANNELLIST_FOOT_OPTIONS_COUNT, true); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_FOOT); + menu_chanlist->addItem(mc); + + mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_CHANNELLIST_COLORED_EVENTS, &g_settings.colored_events_channellist, OPTIONS_COLORED_EVENTS_OPTIONS, OPTIONS_COLORED_EVENTS_OPTION_COUNT, true); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_COLORED); + menu_chanlist->addItem(mc); CMenuWidget *fontSettingsSubMenu = new CMenuWidget(LOCALE_FONTMENU_HEAD, NEUTRINO_ICON_KEYBINDING); fontSettingsSubMenu->enableSaveScreen(true); fontSettingsSubMenu->enableFade(false); int i = 1; - fontSettingsSubMenu->addIntroItems(font_sizes_groups[i].groupname, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); + fontSettingsSubMenu->addIntroItems(font_sizes_groups[i].groupname);//, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); for (unsigned int j = 0; j < font_sizes_groups[i].count; j++) { @@ -917,7 +926,10 @@ int COsdSetup::showContextChanlistMenu() } fontSettingsSubMenu->addItem(GenericMenuSeparatorLine); fontSettingsSubMenu->addItem(new CMenuForwarder(LOCALE_OPTIONS_DEFAULT, true, NULL, this, font_sizes_groups[i].actionkey)); - menu_chanlist->addItem(new CMenuDForwarder(LOCALE_FONTMENU_HEAD, true, NULL, fontSettingsSubMenu, "", CRCInput::convertDigitToKey(0))); + + CMenuForwarder * mf = new CMenuDForwarder(LOCALE_FONTMENU_HEAD, true, NULL, fontSettingsSubMenu, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + mf->setHint("", LOCALE_MENU_HINT_FONTS); + menu_chanlist->addItem(mf); int res = menu_chanlist->exec(NULL, ""); cselected = menu_chanlist->getSelected(); diff --git a/src/gui/rc_lock.cpp b/src/gui/rc_lock.cpp index 51e12a12d..2b7177692 100644 --- a/src/gui/rc_lock.cpp +++ b/src/gui/rc_lock.cpp @@ -38,6 +38,7 @@ #include const std::string CRCLock::NO_USER_INPUT = "noUserInput"; +bool CRCLock::locked = false; // -- Menue Handler Interface // -- Infinite Loop to lock remote control (until release lock key pressed) @@ -45,6 +46,9 @@ const std::string CRCLock::NO_USER_INPUT = "noUserInput"; int CRCLock::exec(CMenuTarget* parent, const std::string &actionKey) { + if(locked) + return menu_return::RETURN_EXIT_ALL; + if (parent) parent->hide(); @@ -55,7 +59,9 @@ int CRCLock::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_EXIT_ALL; // -- Lockup Box + locked = true; lockBox(); + locked = false; ShowLocalizedMessage(LOCALE_RCLOCK_TITLE, LOCALE_RCLOCK_UNLOCKMSG, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO,450, no_input ? 5 : -1); return menu_return::RETURN_EXIT_ALL; diff --git a/src/gui/rc_lock.h b/src/gui/rc_lock.h index 4e6ea758c..bd32757d0 100644 --- a/src/gui/rc_lock.h +++ b/src/gui/rc_lock.h @@ -36,12 +36,13 @@ // class CRCLock: public CMenuTarget { +private: + void lockBox(); public: static const std::string NO_USER_INPUT; int exec(CMenuTarget* parent, const std::string & actionKey); - void lockBox(); + static bool locked; }; - #endif diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index aced80cda..599754ece 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -199,6 +199,10 @@ int CRecordSetup::showRecordSetup() end_of_recording->setHint("", LOCALE_MENU_HINT_RECORD_END); recordingSettings->addItem(end_of_recording); + CMenuOptionChooser* slow_warn = new CMenuOptionChooser(LOCALE_RECORDINGMENU_SLOW_WARN, &g_settings.recording_slow_warning, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + slow_warn->setHint("", LOCALE_MENU_HINT_RECORD_SLOW_WARN); + recordingSettings->addItem(slow_warn); + //template //CStringInput recordingSettings_filenameTemplate(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, &g_settings.recording_filename_template[0], 21, LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT, LOCALE_IPSETUP_HINT_2, "%/-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "); //CMenuForwarder* mf11 = new CMenuForwarder(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, true, g_settings.recording_filename_template[0], &recordingSettings_filenameTemplate); diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index be4ca034d..9afd773ae 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -2,13 +2,13 @@ Neutrino-GUI - DBoxII-Project Copyright (C) 2001 Steffen Hehn 'McClean' - Copyright (C) 2011 Stefan Seyfried + Copyright (C) 2011-2012 Stefan Seyfried 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 3 of the License, or + 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, diff --git a/src/gui/start_wizard.cpp b/src/gui/start_wizard.cpp index 1628734c6..b566c2450 100644 --- a/src/gui/start_wizard.cpp +++ b/src/gui/start_wizard.cpp @@ -107,7 +107,10 @@ int CStartUpWizard::exec(CMenuTarget* parent, const string & /*actionKey*/) res = CScanSetup::getInstance()->exec(NULL, ""); CScanSetup::getInstance()->setWizardMode(CScanSetup::SCAN_SETUP_MODE_WIZARD_NO); } - bool init_settings = file_exists("/var/tuxbox/config/initial/"); + bool init_settings = false; + if (g_info.delivery_system == DVB_S) + init_settings = file_exists("/var/tuxbox/config/initial/"); + if(init_settings && (res != menu_return::RETURN_EXIT_ALL)) { if (ShowMsgUTF(LOCALE_WIZARD_INITIAL_SETTINGS, g_Locale->getText(LOCALE_WIZARD_INSTALL_SETTINGS), diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 58955a310..fd845b11d 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -457,6 +457,8 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) int spaceoffset = 0,i = 0; int ypos1 = ypos; int box_width = width*2/3 - 10; + + yypos = ypos; if(box_h > 0) frameBuffer->paintBoxRel (0, ypos, box_width, box_h, COL_MENUHEAD_PLUS_0); diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index eb178398d..cf580aeb9 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -572,9 +573,32 @@ int CTimerList::show() } else if ((msg == CRCInput::RC_red) && !(timerlist.empty())) { - Timer->removeTimerEvent(timerlist[selected].eventID); - skipEventID=timerlist[selected].eventID; - update=true; + bool killTimer = true; + if (CRecordManager::getInstance()->RecordingStatus(timerlist[selected].channel_id)) { + CTimerd::RecordingStopInfo recinfo; + recinfo.channel_id = timerlist[selected].channel_id; + recinfo.eventID = timerlist[selected].eventID; + if (CRecordManager::getInstance()->IsRecording(&recinfo)) { + std::string title = ""; + char buf1[1024]; + CEPGData epgdata; + CEitManager::getInstance()->getEPGid(timerlist[selected].epgID, timerlist[selected].epg_starttime, &epgdata); + memset(buf1, '\0', sizeof(buf1)); + if (epgdata.title != "") + title = "(" + epgdata.title + ")\n"; + snprintf(buf1, sizeof(buf1)-1, g_Locale->getText(LOCALE_TIMERLIST_ASK_TO_DELETE), title.c_str()); + if(ShowMsgUTF(LOCALE_RECORDINGMENU_RECORD_IS_RUNNING, buf1, + CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, false) == CMessageBox::mbrNo) { + killTimer = false; + update = false; + } + } + } + if (killTimer) { + Timer->removeTimerEvent(timerlist[selected].eventID); + skipEventID=timerlist[selected].eventID; + update = true; + } } else if (msg==CRCInput::RC_green) { diff --git a/src/gui/update.cpp b/src/gui/update.cpp index d61b0f542..61c971baa 100644 --- a/src/gui/update.cpp +++ b/src/gui/update.cpp @@ -35,6 +35,7 @@ #endif #include +#include #include #include @@ -518,6 +519,14 @@ CFlashExpert::CFlashExpert() width = w_max (40, 10); } +CFlashExpert* CFlashExpert::getInstance() +{ + static CFlashExpert* FlashExpert = NULL; + if(!FlashExpert) + FlashExpert = new CFlashExpert(); + return FlashExpert; +} + void CFlashExpert::readmtd(int preadmtd) { char tmpStr[256]; @@ -525,11 +534,11 @@ void CFlashExpert::readmtd(int preadmtd) gettimeofday(&tv, NULL); strftime(tmpStr, sizeof(tmpStr), "_%Y%m%d_%H%M.img", localtime(&tv.tv_sec)); CMTDInfo* mtdInfo = CMTDInfo::getInstance(); - std::string filename = "/tmp/" + mtdInfo->getMTDName(preadmtd); + std::string filename = (std::string)g_settings.update_dir + "/" + mtdInfo->getMTDName(preadmtd); filename += tmpStr; if (preadmtd == -1) { - filename = "/tmp/flashimage.img"; // US-ASCII (subset of UTF-8 and ISO8859-1) + filename = (std::string)g_settings.update_dir + "/flashimage.img"; // US-ASCII (subset of UTF-8 and ISO8859-1) preadmtd = MTD_OF_WHOLE_IMAGE; } setTitle(LOCALE_FLASHUPDATE_TITLEREADFLASH); @@ -558,7 +567,7 @@ void CFlashExpert::writemtd(const std::string & filename, int mtdNumber) { char message[500]; - sprintf(message, + snprintf(message, sizeof(message), g_Locale->getText(LOCALE_FLASHUPDATE_REALLYFLASHMTD), FILESYSTEM_ENCODING_TO_UTF8_STRING(filename).c_str(), CMTDInfo::getInstance()->getMTDName(mtdNumber).c_str()); @@ -576,7 +585,7 @@ void CFlashExpert::writemtd(const std::string & filename, int mtdNumber) CFlashTool ft; ft.setStatusViewer( this ); ft.setMTDDevice( CMTDInfo::getInstance()->getMTDFileName(mtdNumber) ); - if(!ft.program( "/tmp/" + filename, 50, 100)) { + if(!ft.program( (std::string)g_settings.update_dir + "/" + filename, 50, 100)) { showStatusMessageUTF(ft.getErrorMessage()); // UTF-8 sleep(10); } else { @@ -613,6 +622,8 @@ void CFlashExpert::showMTDSelector(const std::string & actionkey) sprintf(sActionKey, "%s%d", actionkey.c_str(), lx); mtdselector->addItem(new CMenuForwarderNonLocalized(mtdInfo->getMTDName(lx).c_str(), enabled, NULL, this, sActionKey, CRCInput::convertDigitToKey(shortcut++))); } + if (actionkey == "writemtd") + mtdselector->addItem(new CMenuForwarderNonLocalized("systemFS with settings", true, NULL, this, "writemtd10", CRCInput::convertDigitToKey(shortcut++))); mtdselector->exec(NULL,""); delete mtdselector; } @@ -623,7 +634,7 @@ void CFlashExpert::showFileSelector(const std::string & actionkey) fileselector->addIntroItems(LOCALE_FLASHUPDATE_FILESELECTOR, NONEXISTANT_LOCALE, CMenuWidget::BTN_TYPE_CANCEL); struct dirent **namelist; - int n = scandir("/tmp", &namelist, 0, alphasort); + int n = scandir(g_settings.update_dir, &namelist, 0, alphasort); if (n < 0) { perror("no flashimages available"); @@ -678,7 +689,10 @@ int CFlashExpert::exec(CMenuTarget* parent, const std::string & actionKey) selectedMTD = iWritemtd; showFileSelector(""); } else { - if(selectedMTD==-1) { + if(selectedMTD == 10) { + CExtUpdate::getInstance()->writemtdExt(actionKey); + } + else if(selectedMTD==-1) { writemtd(actionKey, MTD_OF_WHOLE_IMAGE); } else { writemtd(actionKey, selectedMTD); diff --git a/src/gui/update.h b/src/gui/update.h index 6f85b9342..98122db86 100644 --- a/src/gui/update.h +++ b/src/gui/update.h @@ -74,11 +74,12 @@ class CFlashExpert : public CProgressWindow void showFileSelector(const std::string & actionkey); void readmtd(int readmtd); - void writemtd(const std::string & filename, int mtdNumber); public: CFlashExpert(); + static CFlashExpert* getInstance(); int exec(CMenuTarget* parent, const std::string & actionKey); + void writemtd(const std::string & filename, int mtdNumber); }; diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 2aa65eed7..1318fe662 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -288,7 +288,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_TECHINFO; streamInfo = new CStreamInfo2(); keyhelper.get(&key,&icon,CRCInput::RC_blue); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_STREAMINFO, true, NULL, streamInfo, "-1", key, icon ); + menu_item = new CMenuForwarder(LOCALE_EPGMENU_STREAMINFO, !CNeutrinoApp::getInstance()->channelList->isEmpty(), NULL, streamInfo, "-1", key, icon ); menu->addItem(menu_item, false); break; case SNeutrinoSettings::ITEM_GAMES: diff --git a/src/gui/widget/buttons.cpp b/src/gui/widget/buttons.cpp index 0ae7d2492..f4a48d13b 100644 --- a/src/gui/widget/buttons.cpp +++ b/src/gui/widget/buttons.cpp @@ -6,7 +6,7 @@ * * 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 3 of the License, or + * 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, diff --git a/src/gui/widget/components.cpp b/src/gui/widget/components.cpp index 52f64db69..be43e39b5 100644 --- a/src/gui/widget/components.cpp +++ b/src/gui/widget/components.cpp @@ -275,7 +275,7 @@ void CComponentsInfoBox::hide() col_body = col_frame = col_shadow = COL_BACKGROUND; //paint with background and restore, set last used colors - paint(false); + paint(false, true); col_body = c_tmp1; col_shadow = c_tmp2; col_frame = c_tmp3; diff --git a/src/gui/widget/components.h b/src/gui/widget/components.h index 78f2bed53..c7ec2586a 100644 --- a/src/gui/widget/components.h +++ b/src/gui/widget/components.h @@ -80,7 +80,7 @@ class CComponentsDetailLine : public CComponents fb_pixel_t color_line = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsDetailLine(); - void paint(bool do_save_bg = true); + void paint(bool do_save_bg = false); void hide(); void setColor(fb_pixel_t color_line, fb_pixel_t color_shadow){col_line = color_line; col_shadow = color_shadow;}; void setYPosDown(const int& y_pos_down){y_down = y_pos_down;}; @@ -101,7 +101,7 @@ class CComponentsInfoBox : public CComponents CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = true, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENTDARK_PLUS_0,fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - void paint(bool do_save_bg = true, bool fullPaint = false); + void paint(bool do_save_bg = false, bool fullPaint = false); void hide(); void restore(bool clear_ = true); void setColor(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;}; diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index f7427e5c8..30b95e5b2 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -491,10 +491,14 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) } } } +#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(); @@ -761,8 +765,9 @@ void CMenuWidget::hide() restoreScreen();//FIXME else { frameBuffer->paintBackgroundBoxRel(x, y, full_width, full_height); - paintHint(-1); + //paintHint(-1); } + paintHint(-1); frameBuffer->blit(); /* setActive() paints item for hidden parent menu, if called from child menu */ @@ -882,13 +887,12 @@ void CMenuWidget::calcSize() if(total_pages > 1) sb_width=15; + full_width = /*ConnectLineBox_Width+*/width+sb_width+SHADOW_OFFSET; + full_height = height+RADIUS_LARGE+SHADOW_OFFSET*2 /*+hint_height+INFO_BOX_Y_OFFSET*/; /* 2 times ConnectLineBox_Width for symmetry */ - full_width = ConnectLineBox_Width * 2 + width + sb_width + SHADOW_OFFSET; - full_height = height+RADIUS_LARGE+SHADOW_OFFSET*2+hint_height+INFO_BOX_Y_OFFSET; - if (full_width > (int)frameBuffer->getScreenWidth()) + if (full_width + 2 * ConnectLineBox_Width > (int)frameBuffer->getScreenWidth()) { - width -= (full_width - frameBuffer->getScreenWidth()); - /* subtract the additional connectlineboxwidth we added above */ + width = frameBuffer->getScreenWidth() - 2 * ConnectLineBox_Width - sb_width - SHADOW_OFFSET; full_width = frameBuffer->getScreenWidth() - ConnectLineBox_Width; } @@ -1051,14 +1055,14 @@ void CMenuWidget::saveScreen() background = new fb_pixel_t [full_width * full_height]; if(background) - frameBuffer->SaveScreen(x-ConnectLineBox_Width, y, full_width, full_height, background); + frameBuffer->SaveScreen(x /*-ConnectLineBox_Width*/, y, full_width, full_height, background); } void CMenuWidget::restoreScreen() { if(background) { if(savescreen) - frameBuffer->RestoreScreen(x-ConnectLineBox_Width, y, full_width, full_height, background); + frameBuffer->RestoreScreen(x /*-ConnectLineBox_Width*/, y, full_width, full_height, background); } } @@ -1087,12 +1091,22 @@ void CMenuWidget::paintHint(int pos) if (hint_painted) { /* clear detailsline line */ - if (details_line != NULL) - details_line->restore(); + // 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) - info_box->restore(); + if (info_box != NULL) { + if (pos == -1) { + if (savescreen) + info_box->restore(); + else + info_box->hide(); + } + } hint_painted = false; } if (pos < 0) @@ -1102,8 +1116,12 @@ void CMenuWidget::paintHint(int pos) //printf("paintHint: icon %s text %s\n", item->hintIcon.c_str(), g_Locale->getText(item->hint)); if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE) { - if (info_box != NULL) - info_box->restore(); + if (info_box != NULL) { + if (savescreen) + info_box->restore(); + else + info_box->hide(); + } return; } @@ -1126,7 +1144,7 @@ void CMenuWidget::paintHint(int pos) details_line->setYPosDown(ypos2a); details_line->setHMarkDown(markh); } - details_line->paint(); + details_line->paint(savescreen); if (info_box == NULL) info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height); @@ -1135,7 +1153,8 @@ void CMenuWidget::paintHint(int pos) info_box->setYPos(ypos2); info_box->setWidth(iwidth); } - info_box->paint(); + /* force full paint - menu-over i.e. option chooser with pulldown can overwrite */ + info_box->paint(savescreen, true); int offset = 10; if (!item->hintIcon.empty()) { diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index 4fcef5461..1c453579f 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -171,7 +171,7 @@ void CStringInput::init() } mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); iheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]->getHeight(); - footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; //initial height value for buttonbar + //footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8; //initial height value for buttonbar height = hheight+ mheight + 50; if (hint_1 != NONEXISTANT_LOCALE) { @@ -577,7 +577,7 @@ int CStringInput::handleOthers(const neutrino_msg_t /*msg*/, const neutrino_msg_ void CStringInput::hide() { - frameBuffer->paintBackgroundBoxRel(x, y, width, height + footerHeight); + frameBuffer->paintBackgroundBoxRel(x, y, width, height + hheight); frameBuffer->blit(); } diff --git a/src/gui/widget/stringinput.h b/src/gui/widget/stringinput.h index 0a5a5aea9..8834f3914 100644 --- a/src/gui/widget/stringinput.h +++ b/src/gui/widget/stringinput.h @@ -51,7 +51,6 @@ class CStringInput : public CMenuTarget int hheight; // head font height int mheight; // menu font height int iheight; - int footerHeight; int lower_bound; int upper_bound; diff --git a/src/gui/widget/stringinput_ext.cpp b/src/gui/widget/stringinput_ext.cpp index c21089569..a7cd842c3 100644 --- a/src/gui/widget/stringinput_ext.cpp +++ b/src/gui/widget/stringinput_ext.cpp @@ -519,7 +519,6 @@ void CDateInput::onBeforeExec() sprintf( value, "%02d.%02d.%04d %02d:%02d", tmTime->tm_mday, tmTime->tm_mon+1, tmTime->tm_year+1900, tmTime->tm_hour, tmTime->tm_min); - dst = tmTime->tm_isdst; } void CDateInput::onAfterExec() @@ -532,7 +531,6 @@ void CDateInput::onAfterExec() tmTime.tm_year -= 1900; tmTime.tm_sec = 0; - //tmTime.tm_isdst = dst; tmTime.tm_isdst = -1; if(tmTime.tm_year>129) diff --git a/src/gui/widget/stringinput_ext.h b/src/gui/widget/stringinput_ext.h index 42b632391..22ed53bb5 100644 --- a/src/gui/widget/stringinput_ext.h +++ b/src/gui/widget/stringinput_ext.h @@ -167,7 +167,6 @@ class CDateInput : public CExtendedInput { private: time_t* time; - int dst; protected: virtual void onBeforeExec(); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 34408f98a..da29f0a8c 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -194,32 +194,6 @@ extern const char * locale_real_names[]; /* #include */ // USERMENU const char* usermenu_button_def[SNeutrinoSettings::BUTTON_MAX]={"red","green","yellow","blue"}; -static void initGlobals(void) -{ - g_fontRenderer = NULL; - - g_RCInput = NULL; - g_Timerd = NULL; - g_RemoteControl = NULL; - - g_EpgData = NULL; - g_InfoViewer = NULL; - g_EventList = NULL; - g_videoSettings = NULL; - - g_Locale = new CLocaleManager; - g_PluginList = NULL; - InfoClock = NULL; - g_CamHandler = NULL; - g_Radiotext = NULL; - g_volume = NULL; - - g_info.hw_caps = get_hwcaps(); - - can_deepstandby = g_info.hw_caps->can_shutdown; - g_info.has_fan = g_info.hw_caps->has_fan; -} - /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + CNeutrinoApp - Constructor, initialize g_fontRenderer + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ @@ -242,6 +216,7 @@ CNeutrinoApp::CNeutrinoApp() TVchannelList = NULL; RADIOchannelList = NULL; skipShutdownTimer = false; + skipSleepTimer = false; current_muted = 0; recordingstatus = 0; g_channel_list_changed = 0; @@ -619,14 +594,15 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.recording_stopsectionsd = configfile.getBool("recording_stopsectionsd" , false ); g_settings.recording_audio_pids_default = configfile.getInt32("recording_audio_pids_default", TIMERD_APIDS_STD | TIMERD_APIDS_AC3); g_settings.recording_zap_on_announce = configfile.getBool("recording_zap_on_announce" , false); - g_settings.shutdown_timer_record_type = configfile.getBool("shutdown_timer_record_type" , false); + g_settings.shutdown_timer_record_type = configfile.getBool("shutdown_timer_record_type" , false); g_settings.recording_stream_vtxt_pid = configfile.getBool("recordingmenu.stream_vtxt_pid" , false); g_settings.recording_stream_pmt_pid = configfile.getBool("recordingmenu.stream_pmt_pid" , false); g_settings.recording_choose_direct_rec_dir = configfile.getInt32( "recording_choose_direct_rec_dir", 0 ); g_settings.recording_epg_for_filename = configfile.getBool("recording_epg_for_filename" , true); g_settings.recording_epg_for_end = configfile.getBool("recording_epg_for_end" , false); - g_settings.recording_save_in_channeldir = configfile.getBool("recording_save_in_channeldir" , false); + g_settings.recording_save_in_channeldir = configfile.getBool("recording_save_in_channeldir" , false); + g_settings.recording_slow_warning = configfile.getBool("recording_slow_warning" , true); // default plugin for movieplayer g_settings.movieplayer_plugin = configfile.getString( "movieplayer_plugin", "Teletext" ); @@ -1048,6 +1024,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool ("recording_epg_for_filename" , g_settings.recording_epg_for_filename ); configfile.setBool ("recording_epg_for_end" , g_settings.recording_epg_for_end ); configfile.setBool ("recording_save_in_channeldir" , g_settings.recording_save_in_channeldir ); + configfile.setBool ("recording_slow_warning" , g_settings.recording_slow_warning ); // default plugin for movieplayer configfile.setString ( "movieplayer_plugin", g_settings.movieplayer_plugin ); @@ -1306,16 +1283,6 @@ void CNeutrinoApp::channelsInit(bool bOnly) } } printf("[neutrino] created %s bouquet with %d TV and %d RADIO channels\n", sit->second.name.c_str(), tvi, ri); -#if 0 - if(tvi) - tmp1->channelList->SortAlpha(); - else - TVsatList->deleteBouquet(tmp1); - if(ri) - tmp2->channelList->SortAlpha(); - else - RADIOsatList->deleteBouquet(tmp2); -#endif if(!tvi) TVsatList->deleteBouquet(tmp1); if(!ri) @@ -1664,13 +1631,10 @@ void CNeutrinoApp::InitZapper() channelsInit(); if(tvmode) - { tvMode(true); - } else { - g_RCInput->killTimer(g_InfoViewer->lcdUpdateTimer); - g_InfoViewer->lcdUpdateTimer = g_RCInput->addTimer( LCD_UPDATE_TIME_RADIO_MODE, false ); + else radioMode(true); - } + if(g_settings.cacheTXT) tuxtxt_init(); @@ -1723,11 +1687,6 @@ void CNeutrinoApp::InitZapitClient() CZapitClient::EVT_ZAP_SUB_COMPLETE, CZapitClient::EVT_ZAP_SUB_FAILED, CZapitClient::EVT_ZAP_MOTOR, -#if 0 - CZapitClient::EVT_ZAP_CA_CLEAR, - CZapitClient::EVT_ZAP_CA_LOCK, - CZapitClient::EVT_ZAP_CA_FTA, -#endif CZapitClient::EVT_ZAP_CA_ID, CZapitClient::EVT_RECORDMODE_ACTIVATED, CZapitClient::EVT_RECORDMODE_DEACTIVATED, @@ -1743,9 +1702,6 @@ void CNeutrinoApp::InitZapitClient() CZapitClient::EVT_BOUQUETS_CHANGED, CZapitClient::EVT_SERVICES_CHANGED, CZapitClient::EVT_SCAN_SERVICENAME, -#if 0 - CZapitClient::EVT_SCAN_FOUND_A_CHAN, -#endif CZapitClient::EVT_SCAN_FOUND_TV_CHAN, CZapitClient::EVT_SCAN_FOUND_RADIO_CHAN, CZapitClient::EVT_SCAN_FOUND_DATA_CHAN, @@ -1808,10 +1764,9 @@ void wake_up( bool &wakeup) } if(!wakeup){ - const char *neutrino_leave_deepstandby_script = CONFIGDIR "/deepstandby.off"; - printf("[%s] executing %s\n",__FILE__ ,neutrino_leave_deepstandby_script); - if (my_system(neutrino_leave_deepstandby_script) != 0) - perror( neutrino_leave_deepstandby_script ); + puts("[neutrino.cpp] executing " NEUTRINO_LEAVE_DEEPSTANDBY_SCRIPT "."); + if (my_system(NEUTRINO_LEAVE_DEEPSTANDBY_SCRIPT) != 0) + perror(NEUTRINO_LEAVE_DEEPSTANDBY_SCRIPT " failed"); } } @@ -1826,6 +1781,8 @@ TIMER_START(); cs_register_messenger(CSSendMessage); fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms() - starttime); + g_Locale = new CLocaleManager; + int loadSettingsErg = loadSetup(NEUTRINO_SETTINGS_FILE); fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms() - starttime); @@ -1846,10 +1803,7 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms SetupTiming(); fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms() - starttime); g_PicViewer = new CPictureViewer(); -fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms() - starttime); - colorSetupNotifier = new CColorSetupNotifier; -fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms() - starttime); - colorSetupNotifier->changeNotify(NONEXISTANT_LOCALE, NULL); + CColorSetupNotifier::setPalette(); CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_NEUTRINO_STARTING)); hintBox->paint(); @@ -1935,11 +1889,8 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms #endif dprintf(DEBUG_NORMAL, "g_info.has_fan: %d\n", g_info.has_fan); //fan speed - if (g_info.has_fan) { - CFanControlNotifier * funNotifier= new CFanControlNotifier(); - funNotifier->changeNotify(NONEXISTANT_LOCALE, (void*) &g_settings.fan_speed); - delete funNotifier; - } + if (g_info.has_fan) + CFanControlNotifier::setSpeed(g_settings.fan_speed); dvbsub_init(); @@ -1967,9 +1918,6 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms g_EventList = new CNeutrinoEventList; fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms() - starttime); - int dx, dy; - frameBuffer->getIconSize(NEUTRINO_ICON_VOLUME, &dx, &dy); - g_CamHandler = new CCAMMenuHandler(); g_CamHandler->init(); @@ -2053,14 +2001,8 @@ void CNeutrinoApp::quickZap(int msg) int res; StopSubtitles(); -#if 0 - CRecordManager::getInstance()->StopAutoRecord(); - if(CRecordManager::getInstance()->RecordingStatus()) -#else - //if(recordingstatus && !autoshift) printf("CNeutrinoApp::quickZap haveFreeFrontend %d\n", CFEManager::getInstance()->haveFreeFrontend()); if(!CFEManager::getInstance()->haveFreeFrontend()) -#endif { res = channelList->numericZap(g_settings.key_zaphistory); StartSubtitles(res < 0); @@ -2347,13 +2289,6 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) if(g_settings.audio_AnalogMode < 0 || g_settings.audio_AnalogMode > 2) g_settings.audio_AnalogMode = 0; -#if 0 // per-channel auto volume save/restore - unsigned int volume; - g_Zapit->getVolume(&volume, &volume); - current_volume = 100 - volume*100/63; - printf("zapit volume %d new current %d mode %d\n", volume, current_volume, g_settings.audio_AnalogMode); - g_volume->setvol(current_volume); -#endif g_RCInput->killTimer(scrambled_timer); scrambled_timer = g_RCInput->addTimer(10*1000*1000, true); @@ -2437,7 +2372,7 @@ _repeat: SetChannelMode(old_mode); bouquetList->activateBouquet(old_b, false); if(!bouquetList->Bouquets.empty()) - bouquetList->Bouquets[old_b]->channelList->setSelected(old_num); + bouquetList->Bouquets[bouquetList->getActiveBouquetNumber()]->channelList->setSelected(old_num); StartSubtitles(mode == mode_tv); } else if(nNewChannel == -3) { // list mode changed @@ -2631,12 +2566,7 @@ _repeat: } #endif else if( msg == NeutrinoMessages::EVT_MUTECHANGED ) { -#if 0 - CControldMsg::commandMute* cmd = (CControldMsg::commandMute*) data; - if(cmd->type == (CControld::volume_type)g_settings.audio_avs_Control) - g_volume->AudioMute(cmd->mute, true ); - delete[] (unsigned char*) data; -#endif + //FIXME unused ? return messages_return::handled; } else if( msg == NeutrinoMessages::EVT_SERVICESCHANGED ) { @@ -2699,11 +2629,8 @@ _repeat: CTimerd::RecordingStopInfo* recinfo = (CTimerd::RecordingStopInfo*)data; printf("NeutrinoMessages::RECORD_STOP: eventID %d channel_id %llx\n", recinfo->eventID, recinfo->channel_id); CRecordManager::getInstance()->Stop(recinfo); -#if 0 // done when EVT_RECORDMODE received ? - if((mode == mode_standby) && !CRecordManager::getInstance()->RecordingStatus()) - cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); -#endif autoshift = CRecordManager::getInstance()->TimeshiftOnly(); + delete[] (unsigned char*) data; return messages_return::handled; } @@ -2711,29 +2638,26 @@ _repeat: res = messages_return::handled; t_channel_id channel_id = *(t_channel_id*) data; CRecordManager::getInstance()->Update(channel_id); -#if 0 //TODO ? - /* if new vpid */ - if(CMoviePlayerGui::getInstance().timeshift) - res |= messages_return::cancel_all; - } -#endif return res; } + else if( msg == NeutrinoMessages::ZAPTO) { - CTimerd::EventInfo * eventinfo; - eventinfo = (CTimerd::EventInfo *) data; - if(recordingstatus==0) { - bool isTVMode = CServiceManager::getInstance()->IsChannelTVChannel(eventinfo->channel_id); + CTimerd::EventInfo * eventinfo = (CTimerd::EventInfo *) data; + if (eventinfo->channel_id != CZapit::getInstance()->GetCurrentChannelID()){ + if( (recordingstatus == 0) || (recordingstatus && CRecordManager::getInstance()->TimeshiftOnly()) || (recordingstatus && CFEManager::getInstance()->haveFreeFrontend()) || + (recordingstatus && channelList->SameTP(eventinfo->channel_id)) ) { + bool isTVMode = CServiceManager::getInstance()->IsChannelTVChannel(eventinfo->channel_id); - dvbsub_stop(); + dvbsub_stop(); - if ((!isTVMode) && (mode != mode_radio)) { - radioMode(false); + if ((!isTVMode) && (mode != mode_radio)) { + radioMode(false); + } + else if (isTVMode && (mode != mode_tv)) { + tvMode(false); + } + channelList->zapTo_ChannelID(eventinfo->channel_id); } - else if (isTVMode && (mode != mode_tv)) { - tvMode(false); - } - channelList->zapTo_ChannelID(eventinfo->channel_id); } delete[] (unsigned char*) data; return messages_return::handled; @@ -2743,52 +2667,19 @@ _repeat: standbyMode( false ); } if( mode != mode_scart ) { + CTimerd::RecordingInfo * eventinfo = (CTimerd::RecordingInfo *) data; std::string name = g_Locale->getText(LOCALE_ZAPTOTIMER_ANNOUNCE); - - CTimerd::TimerList tmpTimerList; - CTimerdClient tmpTimerdClient; - - tmpTimerList.clear(); - tmpTimerdClient.getTimerList( tmpTimerList ); - - if( !tmpTimerList.empty() ) { - sort( tmpTimerList.begin(), tmpTimerList.end() ); - - CTimerd::responseGetTimer &timer = tmpTimerList[0]; - - name += "\n"; - - std::string zAddData = CServiceManager::getInstance()->GetServiceName(timer.channel_id); - if( zAddData.empty()) { - zAddData = g_Locale->getText(LOCALE_TIMERLIST_PROGRAM_UNKNOWN); - } - - if(timer.epgID!=0) { - CEPGData epgdata; - zAddData += " :\n"; - if (CEitManager::getInstance()->getEPGid(timer.epgID, timer.epg_starttime, &epgdata)) { - zAddData += epgdata.title; - } - else if(strlen(timer.epgTitle)!=0) { - zAddData += timer.epgTitle; - } - } - else if(strlen(timer.epgTitle)!=0) { - zAddData += timer.epgTitle; - } - - name += zAddData; - } + getAnnounceEpgName( eventinfo, name); ShowHintUTF( LOCALE_MESSAGEBOX_INFO, name.c_str() ); } - + delete [] (unsigned char*) data; return messages_return::handled; } else if( msg == NeutrinoMessages::ANNOUNCE_RECORD) { my_system(NEUTRINO_RECORDING_TIMER_SCRIPT); - + CTimerd::RecordingInfo * eventinfo = (CTimerd::RecordingInfo *) data; if (g_settings.recording_type == RECORDING_FILE) { - char * recordingDir = ((CTimerd::RecordingInfo*)data)->recordingDir; + char * recordingDir = eventinfo->recordingDir; for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++) { if (strcmp(g_settings.network_nfs_local_dir[i],recordingDir) == 0) { printf("[neutrino] waking up %s (%s)\n",g_settings.network_nfs_ip[i].c_str(),recordingDir); @@ -2801,48 +2692,39 @@ _repeat: wakeup_hdd(g_settings.network_nfs_recordingdir); } } - if( g_settings.recording_zap_on_announce ) { - //TODO check transponder ? + + if( g_settings.recording_zap_on_announce && (mode != mode_standby) && (eventinfo->channel_id != CZapit::getInstance()->GetCurrentChannelID())) { CRecordManager::getInstance()->StopAutoRecord(); - if(!CRecordManager::getInstance()->RecordingStatus()) { - dvbsub_stop(); //FIXME if same channel ? - t_channel_id channel_id=((CTimerd::RecordingInfo*)data)->channel_id; + bool recordingStatus = CRecordManager::getInstance()->RecordingStatus(); + if ( !recordingStatus || (recordingStatus && CRecordManager::getInstance()->TimeshiftOnly()) || (recordingStatus && CFEManager::getInstance()->haveFreeFrontend()) || + (recordingStatus && channelList->SameTP(eventinfo->channel_id)) ){ + dvbsub_stop(); + t_channel_id channel_id=eventinfo->channel_id; g_Zapit->zapTo_serviceID_NOWAIT(channel_id); } } + if(( mode != mode_scart ) && ( mode != mode_standby )){ + std::string name = g_Locale->getText(LOCALE_RECORDTIMER_ANNOUNCE); + getAnnounceEpgName(eventinfo, name); + ShowHintUTF(LOCALE_MESSAGEBOX_INFO, name.c_str()); + } delete[] (unsigned char*) data; - if( mode != mode_scart ) - ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_RECORDTIMER_ANNOUNCE)); return messages_return::handled; } else if( msg == NeutrinoMessages::ANNOUNCE_SLEEPTIMER) { - if( mode != mode_scart ) - ShowHintUTF(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SLEEPTIMERBOX_ANNOUNCE)); + if( mode != mode_scart && mode != mode_standby) + skipSleepTimer = (ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_SLEEPTIMERBOX_ANNOUNCE,CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, true) == CMessageBox::mbrYes); return messages_return::handled; } else if( msg == NeutrinoMessages::SLEEPTIMER) { - if(data) { - skipShutdownTimer = - (ShowLocalizedMessage(LOCALE_MESSAGEBOX_INFO, LOCALE_SHUTDOWNTIMER_ANNOUNCE, - CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, true) == CMessageBox::mbrYes);//FIXME - if(skipShutdownTimer) { - printf("NeutrinoMessages::SLEEPTIMER: skiping\n"); - skipShutdownTimer = false; - return messages_return::handled; - } - else { -#if HAVE_TRIPLEDRAGON - /* TD has no FP for real shutdown -> do standby instead */ - standbyMode(true); - return messages_return::handled; -#endif - printf("NeutrinoMessages::SLEEPTIMER: shutdown\n"); - ExitRun(true, can_deepstandby); - } + if(skipSleepTimer) { + printf("NeutrinoMessages::SLEEPTIMER: skiping\n"); + skipSleepTimer = false; + return messages_return::handled; } - if(g_settings.shutdown_real) + if (g_settings.shutdown_real && can_deepstandby) ExitRun(true, can_deepstandby); - else + else if(mode != mode_standby) standbyMode( true ); return messages_return::handled; } @@ -2909,7 +2791,7 @@ _repeat: ShowMsgUTF(LOCALE_MESSAGEBOX_INFO, text, CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_INFO, 0, atoi(timeout.c_str())); } - delete (unsigned char*) data; + delete[] (unsigned char*) data; return messages_return::handled; } else if (msg == NeutrinoMessages::EVT_RECORDING_ENDED) { @@ -3050,10 +2932,9 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) #if HAVE_COOL_HARDWARE if(retcode) { #endif - const char *neutrino_enter_deepstandby_script = CONFIGDIR "/deepstandby.on"; - printf("[%s] executing %s\n",__FILE__ ,neutrino_enter_deepstandby_script); - if (my_system(neutrino_enter_deepstandby_script) != 0) - perror(neutrino_enter_deepstandby_script ); + puts("[neutrino.cpp] executing " NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT "."); + if (my_system(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT) != 0) + perror(NEUTRINO_ENTER_DEEPSTANDBY_SCRIPT " failed"); printf("entering off state\n"); printf("timer_minutes: %ld\n", timer_minutes); @@ -3120,46 +3001,6 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) } } } -#endif -#if 0 - neutrino_msg_t msg; - neutrino_msg_data_t data; - - cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); - powerManager->SetStandby(true, true); - if (g_info.delivery_system == DVB_S && (cs_get_revision() < 8)) { - int fspeed = 0; - CFanControlNotifier * funNotifier= new CFanControlNotifier(); - funNotifier->changeNotify(NONEXISTANT_LOCALE, (void *) &fspeed); - delete funNotifier; - } - if (powerManager) { - powerManager->Close(); - delete powerManager; - } - - delete &CMoviePlayerGui::getInstance(); - shutdown_cs_api(); - - my_system("/etc/init.d/rcK"); - CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, true); - InfoClock->StopClock(); - - g_RCInput->clearRCMsg(); - while( true ) { - g_RCInput->getMsg(&msg, &data, 10000); - if( msg == CRCInput::RC_standby ) { - printf("Power key, going to reboot...\n"); - sleep(2); - reboot(LINUX_REBOOT_CMD_RESTART); - } else if( ( msg == NeutrinoMessages::ANNOUNCE_RECORD) || ( msg == NeutrinoMessages::ANNOUNCE_ZAPTO) ) { - printf("Zap/record timer, going to reboot...\n"); - sleep(2); - reboot(LINUX_REBOOT_CMD_RESTART); - } - } -#endif -#if HAVE_COOL_HARDWARE } else { #endif if (timer_minutes) @@ -3179,9 +3020,7 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) g_RCInput = NULL; //fan speed if (g_info.has_fan) { - int fspeed = 0; - CFanControlNotifier funNotifier; - funNotifier.changeNotify(NONEXISTANT_LOCALE, (void *) &fspeed); + CFanControlNotifier::setSpeed(0); } //CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_MAINMENU_REBOOT)); delete CVFD::getInstance(); @@ -3206,6 +3045,16 @@ void CNeutrinoApp::saveEpg(bool cvfd_mode) { struct stat my_stat; if(stat(g_settings.epg_dir.c_str(), &my_stat) == 0){ + if(!cvfd_mode){//skip saveepg in standby mode, if last saveepg time < 15 Min. + std::string index_xml = g_settings.epg_dir.c_str(); + index_xml += "/index.xml"; + time_t t=0; + if(stat(index_xml.c_str(), &my_stat) == 0){ + if(difftime(time(&t), my_stat.st_ctime) < 900){ + return; + } + } + } printf("[neutrino] Saving EPG to %s...\n", g_settings.epg_dir.c_str()); CVFD::getInstance()->Clear(); @@ -3223,8 +3072,10 @@ void CNeutrinoApp::saveEpg(bool cvfd_mode) CVFD::getInstance()->Clear(); CVFD::getInstance()->setMode(cvfd_mode ? CVFD::MODE_SHUTDOWN : CVFD::MODE_STANDBY);// true CVFD::MODE_SHUTDOWN , false CVFD::MODE_STANDBY break; - } else if (!cvfd_mode) + } else if (!cvfd_mode){ + printf("wait for epg saving, Msg %x \n", (int) msg); handleMsg(msg, data); + } } } } @@ -3232,18 +3083,17 @@ void CNeutrinoApp::saveEpg(bool cvfd_mode) void CNeutrinoApp::tvMode( bool rezap ) { INFO("rezap %d current mode %d", rezap, mode); - if(mode==mode_radio ) { + if (mode == mode_radio) { if (g_settings.radiotext_enable && g_Radiotext) { delete g_Radiotext; g_Radiotext = NULL; } videoDecoder->StopPicture(); - g_RCInput->killTimer(g_InfoViewer->lcdUpdateTimer); - g_InfoViewer->lcdUpdateTimer = g_RCInput->addTimer( LCD_UPDATE_TIME_TV_MODE, false ); CVFD::getInstance()->ShowIcon(VFD_ICON_RADIO, false); StartSubtitles(!rezap); } + g_InfoViewer->setUpdateTimer(LCD_UPDATE_TIME_TV_MODE); g_volume->Init(); @@ -3325,11 +3175,12 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) { //static bool wasshift = false; INFO("%s", bOnOff ? "ON" : "OFF" ); - + if( bOnOff ) { if( mode == mode_scart ) { //g_Controld->setScartMode( 0 ); } + g_InfoViewer->setUpdateTimer(0); // delete timer StopSubtitles(); if(SDTreloadChannels && !CRecordManager::getInstance()->RecordingStatus()){ SDT_ReloadChannels(); @@ -3340,7 +3191,11 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) /* wasshift = */ CRecordManager::getInstance()->StopAutoRecord(); - if(!CRecordManager::getInstance()->RecordingStatus()) { + if(mode == mode_radio && g_Radiotext) + g_Radiotext->radiotext_stop(); + + + if(!fromDeepStandby && !CRecordManager::getInstance()->RecordingStatus()) { g_Zapit->setStandby(true); } else { g_Zapit->stopPlayBack(); @@ -3348,9 +3203,12 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) videoDecoder->Standby(true); - g_Sectionsd->setPauseScanning(true); + g_Sectionsd->setPauseScanning(!fromDeepStandby); g_Sectionsd->setServiceChanged(0, false); + lastMode = mode; + mode = mode_standby; + if(!CRecordManager::getInstance()->RecordingStatus() ) { //only save epg when not recording if(g_settings.epg_save && !fromDeepStandby) { @@ -3358,8 +3216,10 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) } } - CVFD::getInstance()->Clear(); - CVFD::getInstance()->setMode(CVFD::MODE_STANDBY); + if(CVFD::getInstance()->getMode() != CVFD::MODE_STANDBY){ + CVFD::getInstance()->Clear(); + CVFD::getInstance()->setMode(CVFD::MODE_STANDBY); + } if(g_settings.mode_clock) { InfoClock->StopClock(); @@ -3375,15 +3235,10 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) if(!CRecordManager::getInstance()->RecordingStatus()) cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); - lastMode = mode; - mode = mode_standby; //fan speed - if (g_info.has_fan) { - int fspeed = 1; - CFanControlNotifier * funNotifier= new CFanControlNotifier(); - funNotifier->changeNotify(NONEXISTANT_LOCALE, (void *) &fspeed); - delete funNotifier; - } + if (g_info.has_fan) + CFanControlNotifier::setSpeed(1); + frameBuffer->setActive(false); // Active standby on powerManager->SetStandby(true, false); @@ -3406,11 +3261,8 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) } frameBuffer->setActive(true); //fan speed - if (g_info.has_fan) { - CFanControlNotifier * funNotifier= new CFanControlNotifier(); - funNotifier->changeNotify(NONEXISTANT_LOCALE, (void*) &g_settings.fan_speed); - delete funNotifier; - } + if (g_info.has_fan) + CFanControlNotifier::setSpeed(g_settings.fan_speed); puts("[neutrino.cpp] executing " NEUTRINO_LEAVE_STANDBY_SCRIPT "."); if (my_system(NEUTRINO_LEAVE_STANDBY_SCRIPT) != 0) @@ -3451,15 +3303,6 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) InfoClock->StartClock(); g_volume->AudioMute(current_muted, true); -#if 0 - /* auto-record will be started when zap is complete - * FIXME is it needed to restart manual timeshift here ? */ - if((mode == mode_tv) && wasshift) { - //startAutoRecord(); - CRecordManager::getInstance()->StartAutoRecord(); - } - wasshift = false; -#endif StartSubtitles(); } } @@ -3468,12 +3311,11 @@ void CNeutrinoApp::radioMode( bool rezap) { //printf("radioMode: rezap %s\n", rezap ? "yes" : "no"); INFO("rezap %d current mode %d", rezap, mode); - if(mode==mode_tv ) { - g_RCInput->killTimer(g_InfoViewer->lcdUpdateTimer); - g_InfoViewer->lcdUpdateTimer = g_RCInput->addTimer( LCD_UPDATE_TIME_RADIO_MODE, false ); + if (mode == mode_tv) { CVFD::getInstance()->ShowIcon(VFD_ICON_TV, false); StopSubtitles(); } + g_InfoViewer->setUpdateTimer(LCD_UPDATE_TIME_RADIO_MODE); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); CVFD::getInstance()->ShowIcon(VFD_ICON_RADIO, true); @@ -3487,6 +3329,10 @@ void CNeutrinoApp::radioMode( bool rezap) g_RemoteControl->radioMode(); SetChannelMode(g_settings.channel_mode_radio); + + if (g_settings.radiotext_enable && !g_Radiotext) + g_Radiotext = new CRadioText; + if( rezap ) { t_channel_id last_chid = CZapit::getInstance()->GetLastRADIOChannel(); channelList->setSelected(0xfffffff); /* make sure that zapTo_ChannelID will zap */ @@ -3496,10 +3342,6 @@ void CNeutrinoApp::radioMode( bool rezap) channelList->zapTo(0); } videoDecoder->ShowPicture(DATADIR "/neutrino/icons/radiomode.jpg"); - - if (g_settings.radiotext_enable) { - g_Radiotext = new CRadioText; - } } //switching from current mode to tv or radio mode or to optional parameter prev_mode @@ -3665,12 +3507,6 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) MoviePluginSelector.exec(NULL, ""); return menu_return::RETURN_REPAINT; } -#if 0 // commented in menu, needed ? - else if(actionKey == "autolink") { - CRecordManager::getInstance()->LinkTimeshift(); - returnval = menu_return::RETURN_EXIT_ALL; - } -#endif else if(actionKey == "clearSectionsd") { g_Sectionsd->freeMemory(); @@ -3702,6 +3538,10 @@ void stop_daemons(bool stopall) tuxtxt_stop(); tuxtxt_close(); + if (g_Radiotext) { + delete g_Radiotext; + g_Radiotext = NULL; + } printf("httpd shutdown\n"); pthread_cancel(nhttpd_thread); pthread_join(nhttpd_thread, NULL); @@ -3782,12 +3622,12 @@ int main(int argc, char **argv) signal(SIGHUP, SIG_IGN); // process are unspecified (signal(2)) /* don't die in streamts.cpp from a SIGPIPE if client disconnects */ signal(SIGPIPE, SIG_IGN); -#if 0 - for(int i = 3; i < 256; i++) - close(i); -#endif + tzset(); - initGlobals(); + + g_info.hw_caps = get_hwcaps(); + can_deepstandby = g_info.hw_caps->can_shutdown; + g_info.has_fan = g_info.hw_caps->has_fan; return CNeutrinoApp::getInstance()->run(argc, argv); } @@ -3943,10 +3783,6 @@ void CNeutrinoApp::StartSubtitles(bool show) void CNeutrinoApp::SelectSubtitles() { -#if 0 - int curnum = channelList->getActiveChannelNumber(); - CZapitChannel * cc = channelList->getChannel(curnum); -#endif /* called on NeutrinoMessages::EVT_ZAP_COMPLETE, should be safe to use zapit current channel */ CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel(); @@ -4007,6 +3843,34 @@ void CNeutrinoApp::SDT_ReloadChannels() } } +void CNeutrinoApp::getAnnounceEpgName(CTimerd::RecordingInfo * eventinfo, std::string &name) +{ + + name += "\n"; + + std::string zAddData = CServiceManager::getInstance()->GetServiceName(eventinfo->channel_id); + if( zAddData.empty()) { + zAddData = g_Locale->getText(LOCALE_TIMERLIST_PROGRAM_UNKNOWN); + } + + if(eventinfo->epgID!=0) { + CEPGData epgdata; + zAddData += " :\n"; + if (CEitManager::getInstance()->getEPGid(eventinfo->epgID, eventinfo->epg_starttime, &epgdata)) { + zAddData += epgdata.title; + } + else if(strlen(eventinfo->epgTitle)!=0) { + zAddData += eventinfo->epgTitle; + } + } + else if(strlen(eventinfo->epgTitle)!=0) { + zAddData += " :\n"; + zAddData += eventinfo->epgTitle; + } + + name += zAddData; +} + void CNeutrinoApp::Cleanup() { #ifdef EXIT_CLEANUP @@ -4039,7 +3903,6 @@ void CNeutrinoApp::Cleanup() delete g_Radiotext; g_Radiotext = NULL; printf("cleanup 13\n");fflush(stdout); - delete colorSetupNotifier; colorSetupNotifier = NULL; delete audioSetupNotifier; audioSetupNotifier = NULL; delete MoviePluginChanger; MoviePluginChanger = NULL; printf("cleanup 14\n");fflush(stdout); diff --git a/src/neutrino.h b/src/neutrino.h index 3ff32bf3e..b129adfe6 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -118,12 +118,11 @@ private: int current_muted; bool skipShutdownTimer; + bool skipSleepTimer; bool pbBlinkChange; - int tvsort[LIST_MODE_LAST]; int radiosort[LIST_MODE_LAST]; - CColorSetupNotifier *colorSetupNotifier; CMoviePluginChangeExec *MoviePluginChanger; void SDT_ReloadChannels(); @@ -135,6 +134,7 @@ private: void scartMode( bool bOnOff ); void standbyMode( bool bOnOff, bool fromDeepStandby = false ); void saveEpg(bool cvfd_mode); + void getAnnounceEpgName(CTimerd::RecordingInfo * eventinfo, std::string &name); void ExitRun(const bool write_si = true, int retcode = 0); void RealRun(CMenuWidget &mainSettings); diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 8761e05fe..c761144ce 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -39,6 +39,8 @@ #ifdef SCREENSHOT #include #endif +#include "gui/rc_lock.h" + // yhttpd #include "yhttpd.h" #include "ytypes_globals.h" @@ -429,12 +431,14 @@ void CControlAPI::StandbyCGI(CyhookHandler *hh) { if (hh->ParamList["1"] == "on") // standby mode on { - NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_ON, CEventServer::INITID_HTTPD); + if(CNeutrinoApp::getInstance()->getMode() != 4) + NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_ON, CEventServer::INITID_HTTPD); hh->SendOk(); } else if (hh->ParamList["1"] == "off")// standby mode off { - NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_OFF, CEventServer::INITID_HTTPD); + if(CNeutrinoApp::getInstance()->getMode() == 4) + NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::STANDBY_OFF, CEventServer::INITID_HTTPD); hh->SendOk(); } else @@ -452,12 +456,18 @@ void CControlAPI::RCCGI(CyhookHandler *hh) { if (!(hh->ParamList.empty())) { - if (hh->ParamList["1"] == "lock") // lock remote control - NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD); - else if (hh->ParamList["1"] == "unlock")// unlock remote control - NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD); - else + if (hh->ParamList["1"] == "lock"){ // lock remote control + if(!CRCLock::locked) + NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD); + } + else if (hh->ParamList["1"] == "unlock"){// unlock remote control + if(CRCLock::locked) + NeutrinoAPI->EventServer->sendEvent(NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD); + + } + else{ hh->SendError(); + } } hh->SendOk(); } @@ -1478,15 +1488,19 @@ void CControlAPI::ZaptoCGI(CyhookHandler *hh) SendAllCurrentVAPid(hh); else if (hh->ParamList["1"] == "stopplayback") { - NeutrinoAPI->Zapit->stopPlayBack(); - NeutrinoAPI->Sectionsd->setPauseScanning(true); + if(NeutrinoAPI->Zapit->isPlayBackActive()){ + NeutrinoAPI->Zapit->stopPlayBack(); + NeutrinoAPI->Sectionsd->setPauseScanning(true); + } hh->SendOk(); } else if (hh->ParamList["1"] == "startplayback") { - NeutrinoAPI->Zapit->startPlayBack(); - NeutrinoAPI->Sectionsd->setPauseScanning(false); - dprintf("start playback requested..\n"); + if(!NeutrinoAPI->Zapit->isPlayBackActive()){ + NeutrinoAPI->Zapit->startPlayBack(); + NeutrinoAPI->Sectionsd->setPauseScanning(false); + dprintf("start playback requested..\n"); + } hh->SendOk(); } else if (hh->ParamList["1"] == "statusplayback") diff --git a/src/nhttpd/web/Y_Tools_Rcsim.yhtm b/src/nhttpd/web/Y_Tools_Rcsim.yhtm index 5418f02c1..ff2157ed7 100644 --- a/src/nhttpd/web/Y_Tools_Rcsim.yhtm +++ b/src/nhttpd/web/Y_Tools_Rcsim.yhtm @@ -5,9 +5,13 @@ // diff --git a/src/nhttpd/yhttpd_core/helper.cpp b/src/nhttpd/yhttpd_core/helper.cpp index 68d7b55e3..38b188ba2 100644 --- a/src/nhttpd/yhttpd_core/helper.cpp +++ b/src/nhttpd/yhttpd_core/helper.cpp @@ -44,6 +44,7 @@ void correctTime(struct tm *zt) { zt->tm_hour = minmax(zt->tm_hour, 0, 23); zt->tm_min = minmax(zt->tm_min, 0, 59); zt->tm_sec = minmax(zt->tm_sec, 0, 59); + zt->tm_isdst = -1; } //============================================================================= // Strings diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index a564982e6..c993bbf41 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -33,6 +33,7 @@ #include /* or */ #include #include +#include #include #include @@ -81,7 +82,7 @@ int my_system(const char * cmd, const char * arg1, const char * arg2, const char case 0: /* child process */ for(i = 3; i < maxfd; i++) close(i); - if(execlp(cmd, cmd, arg1, arg2, arg3, arg4, arg5, arg6, NULL)) + if(execlp(cmd, cmd, arg1, arg2, arg3, arg4, arg5, arg6, (char*)NULL)) { std::string txt = "ERROR: my_system \"" + (std::string) cmd + "\""; perror(txt.c_str()); @@ -235,3 +236,237 @@ bool get_mem_usage(unsigned long &kbtotal, unsigned long &kbfree) printf("mem: total %ld cached %ld free %ld\n", kbtotal, cached, kbfree); return true; } + +std::string trim(std::string &str, const std::string &trimChars /*= " \n\r\t"*/) +{ + std::string result = str.erase(str.find_last_not_of(trimChars) + 1); + return result.erase(0, result.find_first_not_of(trimChars)); +} + +CFileHelpers::CFileHelpers() +{ + FileBufSize = 0xFFFF; + FileBuf = new char[FileBufSize]; + doCopyFlag = true; +} + +CFileHelpers::~CFileHelpers() +{ + if (FileBuf != NULL) + delete [] FileBuf; +} + +CFileHelpers* CFileHelpers::getInstance() +{ + static CFileHelpers* FileHelpers = NULL; + if(!FileHelpers) + FileHelpers = new CFileHelpers(); + return FileHelpers; +} + +bool CFileHelpers::copyFile(const char *Src, const char *Dst, mode_t mode) +{ + doCopyFlag = true; + unlink(Dst); + if ((fd1 = open(Src, O_RDONLY)) < 0) + return false; + if ((fd2 = open(Dst, O_WRONLY | O_CREAT)) < 0) { + close(fd1); + return false; + } + + long block; + off64_t fsizeSrc64 = lseek64(fd1, 0, SEEK_END); + lseek64(fd1, 0, SEEK_SET); + if (fsizeSrc64 > 0x7FFFFFF0) { // > 2GB + off64_t fsize64 = fsizeSrc64; + block = FileBufSize; + //printf("#####[%s] fsizeSrc64: %lld 0x%010llX - large file\n", __FUNCTION__, fsizeSrc64, fsizeSrc64); + while(fsize64 > 0) { + if(fsize64 < (off64_t)FileBufSize) + block = (long)fsize64; + read(fd1, FileBuf, block); + write(fd2, FileBuf, block); + fsize64 -= block; + if (!doCopyFlag) + break; + } + if (doCopyFlag) { + lseek64(fd2, 0, SEEK_SET); + off64_t fsizeDst64 = lseek64(fd2, 0, SEEK_END); + if (fsizeSrc64 != fsizeDst64){ + close(fd1); + close(fd2); + return false; + } + } + } + else { // < 2GB + long fsizeSrc = lseek(fd1, 0, SEEK_END); + lseek(fd1, 0, SEEK_SET); + long fsize = fsizeSrc; + block = FileBufSize; + //printf("#####[%s] fsizeSrc: %ld 0x%08lX - normal file\n", __FUNCTION__, fsizeSrc, fsizeSrc); + while(fsize > 0) { + if(fsize < (long)FileBufSize) + block = fsize; + read(fd1, FileBuf, block); + write(fd2, FileBuf, block); + fsize -= block; + if (!doCopyFlag) + break; + } + if (doCopyFlag) { + lseek(fd2, 0, SEEK_SET); + long fsizeDst = lseek(fd2, 0, SEEK_END); + if (fsizeSrc != fsizeDst){ + close(fd1); + close(fd2); + return false; + } + } + } + close(fd1); + close(fd2); + + if (!doCopyFlag) { + sync(); + unlink(Dst); + return false; + } + + chmod(Dst, mode); + return true; +} + +bool CFileHelpers::copyDir(const char *Src, const char *Dst) +{ + DIR *Directory; + struct dirent *CurrentFile; + static struct stat FileInfo; + char srcPath[PATH_MAX]; + char dstPath[PATH_MAX]; + char buf[PATH_MAX]; + + //open directory + if ((Directory = opendir(Src)) == NULL) + return false; + if (lstat(Src, &FileInfo) == -1) { + closedir(Directory); + return false; + } + // create directory + // is symlink + if (S_ISLNK(FileInfo.st_mode)) { + int len = readlink(Src, buf, sizeof(buf)-1); + if (len != -1) { + buf[len] = '\0'; + symlink(buf, Dst); + } + } + else { + // directory + if (createDir(Dst, FileInfo.st_mode & 0x0FFF) == false) { + if (errno != EEXIST) { + closedir(Directory); + return false; + } + } + } + + // read directory + while ((CurrentFile = readdir(Directory)) != NULL) { + // ignore '.' and '..' + if (strcmp(CurrentFile->d_name, ".") && strcmp(CurrentFile->d_name, "..")) { + strcpy(srcPath, Src); + strcat(srcPath, "/"); + strcat(srcPath, CurrentFile->d_name); + if (lstat(srcPath, &FileInfo) == -1) { + closedir(Directory); + return false; + } + strcpy(dstPath, Dst); + strcat(dstPath, "/"); + strcat(dstPath, CurrentFile->d_name); + // is symlink + if (S_ISLNK(FileInfo.st_mode)) { + int len = readlink(srcPath, buf, sizeof(buf)-1); + if (len != -1) { + buf[len] = '\0'; + symlink(buf, dstPath); + } + } + // is directory + else if (S_ISDIR(FileInfo.st_mode)) { + copyDir(srcPath, dstPath); + } + // is file + else if (S_ISREG(FileInfo.st_mode)) { + copyFile(srcPath, dstPath, FileInfo.st_mode & 0x0FFF); + } + } + } + closedir(Directory); + return true; +} + +bool CFileHelpers::createDir(const char *Dir, mode_t mode) +{ + char dirPath[PATH_MAX]; + DIR *dir; + if ((dir = opendir(Dir)) != NULL) { + closedir(dir); + errno = EEXIST; + return false; + } + + int ret = -1; + while (ret == -1) { + strcpy(dirPath, Dir); + ret = mkdir(dirPath, mode); + if ((errno == ENOENT) && (ret == -1)) { + char * pos = strrchr(dirPath,'/'); + if (pos != NULL) { + pos[0] = '\0'; + createDir(dirPath, mode); + } + } + else { + if (ret == 0) + return true; + if (errno == EEXIST) + return true; + else + return false; + } + } + errno = 0; + return true; +} + +bool CFileHelpers::removeDir(const char *Dir) +{ + DIR *dir; + struct dirent *entry; + char path[PATH_MAX]; + + dir = opendir(Dir); + if (dir == NULL) { + printf("Error opendir()\n"); + return false; + } + while ((entry = readdir(dir)) != NULL) { + if (strcmp(entry->d_name, ".") && strcmp(entry->d_name, "..")) { + snprintf(path, (size_t) PATH_MAX, "%s/%s", Dir, entry->d_name); + if (entry->d_type == DT_DIR) + removeDir(path); + else + unlink(path); + } + } + closedir(dir); + rmdir(Dir); + + errno = 0; + return true; +} diff --git a/src/system/helpers.h b/src/system/helpers.h index c14938527..b3393a0d3 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -34,4 +34,26 @@ int check_dir(const char * dir); bool get_fs_usage(const char * dir, long &total, long &used); bool get_mem_usage(unsigned long &total, unsigned long &free); +std::string trim(std::string &str, const std::string &trimChars = " \n\r\t"); + +class CFileHelpers +{ + private: + int FileBufSize; + char *FileBuf; + int fd1, fd2; + + public: + CFileHelpers(); + ~CFileHelpers(); + static CFileHelpers* getInstance(); + bool doCopyFlag; + + bool copyFile(const char *Src, const char *Dst, mode_t mode); + bool copyDir(const char *Src, const char *Dst); + bool createDir(const char *Dir, mode_t mode); + bool removeDir(const char *Dir); + +}; + #endif diff --git a/src/system/locals.h b/src/system/locals.h index 4c1e6fdb3..14f9d4d6f 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -511,6 +511,9 @@ typedef enum LOCALE_FLASHUPDATE_SQUASHFS_NOVERSION, LOCALE_FLASHUPDATE_TITLEREADFLASH, LOCALE_FLASHUPDATE_TITLEWRITEFLASH, + LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_PROCESSED, + LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SKIPPED, + LOCALE_FLASHUPDATE_UPDATE_WITH_SETTINGS_SUCCESSFULLY, LOCALE_FLASHUPDATE_UPDATEMODE, LOCALE_FLASHUPDATE_UPDATEMODE_INTERNET, LOCALE_FLASHUPDATE_UPDATEMODE_MANUAL, @@ -952,6 +955,7 @@ typedef enum LOCALE_MENU_HINT_RECORD_CHANDIR, LOCALE_MENU_HINT_RECORD_DIR, LOCALE_MENU_HINT_RECORD_END, + LOCALE_MENU_HINT_RECORD_SLOW_WARN, LOCALE_MENU_HINT_RECORD_TDIR, LOCALE_MENU_HINT_RECORD_TIME, LOCALE_MENU_HINT_RECORD_TIMEAFTER, @@ -1521,6 +1525,7 @@ typedef enum LOCALE_RECORDINGMENU_SERVER, LOCALE_RECORDINGMENU_SERVER_MAC, LOCALE_RECORDINGMENU_SETUPNOW, + LOCALE_RECORDINGMENU_SLOW_WARN, LOCALE_RECORDINGMENU_TIMESHIFT, LOCALE_RECORDINGMENU_TSDIR, LOCALE_RECORDINGMENU_VCR, @@ -1696,6 +1701,7 @@ typedef enum LOCALE_TIMERLIST_ALARMTIME, LOCALE_TIMERLIST_APIDS, LOCALE_TIMERLIST_APIDS_DFLT, + LOCALE_TIMERLIST_ASK_TO_DELETE, LOCALE_TIMERLIST_BOUQUETSELECT, LOCALE_TIMERLIST_CHANNEL, LOCALE_TIMERLIST_CHANNELSELECT, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 808dfc6e0..d86a33a85 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -511,6 +511,9 @@ const char * locale_real_names[] = "flashupdate.squashfs.noversion", "flashupdate.titlereadflash", "flashupdate.titlewriteflash", + "flashupdate.update_with_settings_processed", + "flashupdate.update_with_settings_skipped", + "flashupdate.update_with_settings_successfully", "flashupdate.updatemode", "flashupdate.updatemode_internet", "flashupdate.updatemode_manual", @@ -952,6 +955,7 @@ const char * locale_real_names[] = "menu.hint_record_chandir", "menu.hint_record_dir", "menu.hint_record_end", + "menu.hint_record_slow_warn", "menu.hint_record_tdir", "menu.hint_record_time", "menu.hint_record_timeafter", @@ -1521,6 +1525,7 @@ const char * locale_real_names[] = "recordingmenu.server", "recordingmenu.server_mac", "recordingmenu.setupnow", + "recordingmenu.slow_warn", "recordingmenu.timeshift", "recordingmenu.tsdir", "recordingmenu.vcr", @@ -1696,6 +1701,7 @@ const char * locale_real_names[] = "timerlist.alarmtime", "timerlist.apids", "timerlist.apids_dflt", + "timerlist.ask_to_delete", "timerlist.bouquetselect", "timerlist.channel", "timerlist.channelselect", diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index f1ddda657..ad8a8e44a 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -129,10 +129,9 @@ bool CTouchFileNotifier::changeNotify(const neutrino_locale_t, void * data) return true; } -bool CColorSetupNotifier::changeNotify(const neutrino_locale_t, void *) +void CColorSetupNotifier::setPalette() { CFrameBuffer *frameBuffer = CFrameBuffer::getInstance(); -// unsigned char r,g,b; //setting colors-.. frameBuffer->paletteGenFade(COL_MENUHEAD, convertSetupColor2RGB(g_settings.menu_Head_red, g_settings.menu_Head_green, g_settings.menu_Head_blue), @@ -165,13 +164,6 @@ bool CColorSetupNotifier::changeNotify(const neutrino_locale_t, void *) convertSetupColor2RGB(g_settings.infobar_Text_red, g_settings.infobar_Text_green, g_settings.infobar_Text_blue), 8, convertSetupAlpha2Alpha(g_settings.infobar_alpha) ); -/* frameBuffer->paletteSetColor( COL_INFOBAR_SHADOW, - convertSetupColor2RGB( - int(g_settings.infobar_red*0.4), - int(g_settings.infobar_green*0.4), - int(g_settings.infobar_blue*0.4)), - g_settings.infobar_alpha); -*/ frameBuffer->paletteGenFade(COL_INFOBAR_SHADOW, convertSetupColor2RGB(int(g_settings.infobar_red*0.4), int(g_settings.infobar_green*0.4), int(g_settings.infobar_blue*0.4)), convertSetupColor2RGB(g_settings.infobar_Text_red, g_settings.infobar_Text_green, g_settings.infobar_Text_blue), @@ -189,10 +181,17 @@ bool CColorSetupNotifier::changeNotify(const neutrino_locale_t, void *) 8, convertSetupAlpha2Alpha(g_settings.infobar_alpha) ); frameBuffer->paletteSet(); +} + +bool CColorSetupNotifier::changeNotify(const neutrino_locale_t, void *) +{ + setPalette(); +#if 0 /* recalculate volumebar */ CVolume::getInstance()->Init(); /* recalculate infoclock */ CInfoClock::getInstance()->Init(); +#endif return false; } @@ -488,8 +487,7 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK //CNeutrinoApp::getInstance()->loadColors(NEUTRINO_SETTINGS_FILE); CNeutrinoApp::getInstance()->SetupFonts(); CNeutrinoApp::getInstance()->SetupTiming(); - CColorSetupNotifier colorSetupNotifier; - colorSetupNotifier.changeNotify(NONEXISTANT_LOCALE, NULL); + CColorSetupNotifier::setPalette(); CVFD::getInstance()->setlcdparameter(); CFrameBuffer::getInstance()->Clear(); } @@ -501,24 +499,26 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK } #if HAVE_COOL_HARDWARE -bool CFanControlNotifier::changeNotify(const neutrino_locale_t, void * data) +void CFanControlNotifier::setSpeed(unsigned int speed) { - int cfd, ret; - //unsigned char speed = (unsigned char) g_settings.fan_speed; - unsigned int speed = * (int *) data; + int cfd; printf("FAN Speed %d\n", speed); cfd = open("/dev/cs_control", O_RDONLY); if(cfd < 0) { perror("Cannot open /dev/cs_control"); - return false; + return; } - ret = ioctl(cfd, IOC_CONTROL_PWM_SPEED, speed); - close(cfd); - if(ret < 0) { + if (ioctl(cfd, IOC_CONTROL_PWM_SPEED, speed) < 0) perror("IOC_CONTROL_PWM_SPEED"); - return false; - } + + close(cfd); +} + +bool CFanControlNotifier::changeNotify(const neutrino_locale_t, void * data) +{ + unsigned int speed = * (int *) data; + setSpeed(speed); return false; } #else diff --git a/src/system/setting_helpers.h b/src/system/setting_helpers.h index 22d0b27c9..88207dc36 100644 --- a/src/system/setting_helpers.h +++ b/src/system/setting_helpers.h @@ -88,6 +88,7 @@ class CColorSetupNotifier : public CChangeObserver { public: bool changeNotify(const neutrino_locale_t, void *); + static void setPalette(); }; class CAudioSetupNotifier : public CChangeObserver @@ -154,6 +155,7 @@ class CFanControlNotifier : public CChangeObserver { public: bool changeNotify(const neutrino_locale_t, void * data); + static void setSpeed(unsigned int speed); }; class CCpuFreqNotifier : public CChangeObserver diff --git a/src/system/settings.h b/src/system/settings.h index fee77a8eb..260188f38 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -345,6 +345,7 @@ struct SNeutrinoSettings int recording_epg_for_end; int recording_save_in_channeldir; int recording_zap_on_announce; + int recording_slow_warning; int shutdown_timer_record_type; int filesystem_is_utf8; diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index ef84e1526..9f1386050 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -1250,8 +1250,15 @@ void CTimerEvent_Record::Refresh() //============================================================= void CTimerEvent_Zapto::announceEvent() { + Refresh(); + CTimerd::RecordingInfo ri=eventInfo; + ri.eventID=eventID; + ri.recordingDir[0] = 0; + strcpy(ri.epgTitle, epgTitle.substr(0,sizeof(ri.epgTitle)-1).c_str()); + CTimerManager::getInstance()->getEventServer()->sendEvent(CTimerdClient::EVT_ANNOUNCE_ZAPTO, - CEventServer::INITID_TIMERD); + CEventServer::INITID_TIMERD, + &ri,sizeof(CTimerd::RecordingInfo)); } //------------------------------------------------------------ void CTimerEvent_Zapto::fireEvent() diff --git a/src/zapit/include/zapit/capmt.h b/src/zapit/include/zapit/capmt.h index c24267c58..674429940 100644 --- a/src/zapit/include/zapit/capmt.h +++ b/src/zapit/include/zapit/capmt.h @@ -65,7 +65,7 @@ class CCam : public CBasicClient CCam(); virtual ~CCam() {}; bool sendMessage(const char * const data, const size_t length, bool update = false); - bool makeCaPmt(CZapitChannel * channel, uint8_t list = CAPMT_ONLY, const CaIdVector &caids = CaIdVector()); + bool makeCaPmt(CZapitChannel * channel, bool add_private, uint8_t list = CAPMT_ONLY, const CaIdVector &caids = CaIdVector()); bool setCaPmt(bool update = false); bool sendCaPmt(uint64_t tpid, uint8_t *rawpmt, int rawlen); int makeMask(int demux, bool add); diff --git a/src/zapit/include/zapit/zapit.h b/src/zapit/include/zapit/zapit.h index ef7f2d2e0..9bb814af9 100644 --- a/src/zapit/include/zapit/zapit.h +++ b/src/zapit/include/zapit/zapit.h @@ -17,6 +17,7 @@ #include #include #include +#include #define PAL 0 #define NTSC 1 @@ -34,7 +35,7 @@ typedef volume_map_t::iterator volume_map_iterator_t; typedef std::pair volume_map_range_t; #define VOLUME_PERCENT_AC3 100 -#define VOLUME_PERCENT_PCM 75 +#define VOLUME_PERCENT_PCM 100 /* complete zapit start thread-parameters in a struct */ typedef struct ZAPIT_start_arg @@ -128,7 +129,9 @@ class CZapit : public OpenThreads::Thread CZapitChannel * current_channel; t_channel_id live_channel_id; + /* scan params */ TP_params TP; + fast_scan_type_t scant; CFrontend * live_fe; diff --git a/src/zapit/src/capmt.cpp b/src/zapit/src/capmt.cpp index 64ec0edd9..ab2ce6e9a 100644 --- a/src/zapit/src/capmt.cpp +++ b/src/zapit/src/capmt.cpp @@ -32,7 +32,7 @@ #include #include -//#define DEBUG_CAPMT +#define DEBUG_CAPMT CCam::CCam() { @@ -76,12 +76,12 @@ bool CCam::sendMessage(const char * const data, const size_t length, bool update return send_data(data, length); } -bool CCam::makeCaPmt(CZapitChannel * channel, uint8_t list, const CaIdVector &caids) +bool CCam::makeCaPmt(CZapitChannel * channel, bool add_private, uint8_t list, const CaIdVector &caids) { int len; unsigned char * buffer = channel->getRawPmt(len); - DBG("cam %p source %d camask %d list %02x buffer", this, source_demux, camask, list); + INFO("cam %p source %d camask %d list %02x buffer", this, source_demux, camask, list); if(!buffer) return false; @@ -89,32 +89,34 @@ bool CCam::makeCaPmt(CZapitChannel * channel, uint8_t list, const CaIdVector &ca ProgramMapSection pmt(buffer); CaProgramMapSection capmt(&pmt, list, 0x01, caids); - uint8_t tmp[10]; - tmp[0] = 0x84; - tmp[1] = 0x02; - tmp[2] = channel->getPmtPid() >> 8; - tmp[3] = channel->getPmtPid() & 0xFF; - capmt.injectDescriptor(tmp, false); + if (add_private) { + uint8_t tmp[10]; + tmp[0] = 0x84; + tmp[1] = 0x02; + tmp[2] = channel->getPmtPid() >> 8; + tmp[3] = channel->getPmtPid() & 0xFF; + capmt.injectDescriptor(tmp, false); - tmp[0] = 0x82; - tmp[1] = 0x02; - tmp[2] = camask; - tmp[3] = source_demux; - capmt.injectDescriptor(tmp, false); + tmp[0] = 0x82; + tmp[1] = 0x02; + tmp[2] = camask; + tmp[3] = source_demux; + capmt.injectDescriptor(tmp, false); - memset(tmp, 0, sizeof(tmp)); - tmp[0] = 0x81; - tmp[1] = 0x08; - tmp[2] = channel->getSatellitePosition() >> 8; - tmp[3] = channel->getSatellitePosition() & 0xFF; - tmp[4] = channel->getFreqId() >> 8; - tmp[5] = channel->getFreqId() & 0xFF; - tmp[6] = channel->getTransportStreamId() >> 8; - tmp[7] = channel->getTransportStreamId() & 0xFF; - tmp[8] = channel->getOriginalNetworkId() >> 8; - tmp[9] = channel->getOriginalNetworkId() & 0xFF; + memset(tmp, 0, sizeof(tmp)); + tmp[0] = 0x81; + tmp[1] = 0x08; + tmp[2] = channel->getSatellitePosition() >> 8; + tmp[3] = channel->getSatellitePosition() & 0xFF; + tmp[4] = channel->getFreqId() >> 8; + tmp[5] = channel->getFreqId() & 0xFF; + tmp[6] = channel->getTransportStreamId() >> 8; + tmp[7] = channel->getTransportStreamId() & 0xFF; + tmp[8] = channel->getOriginalNetworkId() >> 8; + tmp[9] = channel->getOriginalNetworkId() & 0xFF; - capmt.injectDescriptor(tmp, false); + capmt.injectDescriptor(tmp, false); + } calen = capmt.writeToBuffer(cabuf); #ifdef DEBUG_CAPMT @@ -235,7 +237,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start if(newmask == 0) { cam->sendMessage(NULL, 0, false); } else { - cam->makeCaPmt(channel); + cam->makeCaPmt(channel, true); cam->setCaPmt(true); } } @@ -249,7 +251,10 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start } CaIdVector caids; cCA::GetInstance()->GetCAIDS(caids); - uint8_t list = CCam::CAPMT_FIRST; + //uint8_t list = CCam::CAPMT_FIRST; + uint8_t list = CCam::CAPMT_ONLY; + if (channel_map.size() > 1) + list = CCam::CAPMT_ADD; for (it = channel_map.begin(); it != channel_map.end(); /*++it*/) { cam = it->second; @@ -258,14 +263,16 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start if(!channel) continue; +#if 0 if (it == channel_map.end()) list |= CCam::CAPMT_LAST; // FIRST->ONLY or MORE->LAST +#endif - cam->makeCaPmt(channel, list, caids); + cam->makeCaPmt(channel, false, list, caids); int len; unsigned char * buffer = channel->getRawPmt(len); cam->sendCaPmt(channel->getTransponderId(), buffer, len); - list = CCam::CAPMT_MORE; + //list = CCam::CAPMT_MORE; } mutex.unlock(); diff --git a/src/zapit/src/fastscan.cpp b/src/zapit/src/fastscan.cpp index 0e9e8c7b4..8fb2b8324 100644 --- a/src/zapit/src/fastscan.cpp +++ b/src/zapit/src/fastscan.cpp @@ -63,13 +63,13 @@ void CServiceScan::InitFastscanLnb(int id) switch(id) { default: case CD_OPERATOR_ID: - case OPERATOR_TVV: + case TVV_OPERATOR_ID: satmap[192].diseqc = 0; satmap[235].diseqc = 1; satmap[282].diseqc = 2; satmap[130].diseqc = 3; break; - case OPERATOR_TELESAT: + case TELESAT_OPERATOR_ID: satmap[130].diseqc = 0; satmap[192].diseqc = 1; satmap[235].diseqc = 2; @@ -216,10 +216,10 @@ bool CServiceScan::ParseFst(unsigned short pid, fast_scan_operator_t * op) delete dmx; return false; } - +#if 0 g_bouquetManager->clearAll(); CServiceManager::getInstance()->RemoveAllChannels(); - +#endif do { if (dmx->Read(buffer, SEC_SIZE) < 0) { delete dmx; diff --git a/src/zapit/src/frontend.cpp b/src/zapit/src/frontend.cpp index ad7edb6d8..5e061b75a 100644 --- a/src/zapit/src/frontend.cpp +++ b/src/zapit/src/frontend.cpp @@ -958,7 +958,7 @@ void CFrontend::setDiseqcType(const diseqc_t newDiseqcType, bool force) return; } - if (force || ((config.diseqcType <= MINI_DISEQC) + if ((force && (newDiseqcType != NO_DISEQC)) || ((config.diseqcType <= MINI_DISEQC) && (newDiseqcType > MINI_DISEQC))) { secSetTone(SEC_TONE_OFF, 15); sendDiseqcPowerOn(); @@ -1121,7 +1121,7 @@ bool CFrontend::tuneChannel(CZapitChannel * /*channel*/, bool /*nvod*/) return false; return tuneFrequency(&transponder->second.feparams, transponder->second.polarization, false); } - +#if 0 bool CFrontend::retuneChannel(void) { mutex.lock(); @@ -1132,7 +1132,7 @@ bool CFrontend::retuneChannel(void) mutex.unlock(); return tuneFrequency(&transponder->second.feparams, transponder->second.polarization, true); } - +#endif int CFrontend::tuneFrequency(FrontendParameters * feparams, uint8_t polarization, bool nowait) { TP_params TP; diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index e0075aae1..f779c5ade 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -843,8 +843,6 @@ bool CZapit::StartScanTP(TP_params * TPparams) #if 0 bool CZapit::StartFastScan(int scan_mode, int opid) { - fast_scan_type_t scant; - scant.type = scan_mode; scant.op = (fs_operator_t) opid;