diff --git a/.gitignore b/.gitignore index 7fe0b0260..08aca6a64 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ src/rcsim.h src/rcsim src/gui/version.h src/nhttpd/nhttpd.conf +src/mdev_helper diff --git a/configure.ac b/configure.ac index b0a58dcd8..04832071d 100644 --- a/configure.ac +++ b/configure.ac @@ -102,6 +102,7 @@ TUXBOX_APPS_LIB_PKGCONFIG(PNG,libpng) TUXBOX_APPS_LIB_PKGCONFIG(AVFORMAT,libavformat) TUXBOX_APPS_LIB_PKGCONFIG(AVCODEC,libavcodec) TUXBOX_APPS_LIB_PKGCONFIG(AVUTIL,libavutil) +TUXBOX_APPS_LIB_PKGCONFIG(BLURAY,libbluray) # either use dynamic lualib in package lua (openSUSE) # ... or in package lua5.2 (debian-derivates) @@ -253,6 +254,7 @@ AC_SUBST(STB_HAL_INC) AC_SUBST(STB_HAL_LIB) AC_SUBST(LUA_CFLAGS) AC_SUBST(LUA_LIBS) +AC_SUBST(BLURAY_LIBS) AC_OUTPUT([ Makefile diff --git a/data/Makefile.am b/data/Makefile.am index 520c059e1..5f4751b23 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -5,9 +5,7 @@ SUBDIRS += lcd endif configdir = $(CONFIGDIR) -config_DATA = cables.xml satellites.xml encoding.conf tobackup.conf providermap.xml settingsupdate.conf - -config_DATA += terrestrial.xml +config_DATA = cables.xml satellites.xml encoding.conf tobackup.conf providermap.xml settingsupdate.conf terrestrial.xml install-data-hook: $(INSTALL) -d $(DESTDIR)/$(CONFIGDIR)/zapit diff --git a/data/cables.xml b/data/cables.xml index 610fa2fc8..3220eb5f9 100644 --- a/data/cables.xml +++ b/data/cables.xml @@ -247,17 +247,13 @@ - - - - - + diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index 71ee57bb2..28076ef7d 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -57,6 +57,7 @@ install_DATA += \ ca.png \ ca2.png \ ca2_gray.png \ + checkmark.png \ colors.png \ conax_green.png \ conax_white.png \ @@ -74,6 +75,7 @@ install_DATA += \ dummy.png \ dummy_small.png \ error.png \ + epg.png \ features.png \ file.png \ folder.png \ diff --git a/data/icons/checkmark.png b/data/icons/checkmark.png new file mode 100755 index 000000000..59495a665 Binary files /dev/null and b/data/icons/checkmark.png differ diff --git a/data/icons/epg.png b/data/icons/epg.png new file mode 100644 index 000000000..0dea572be Binary files /dev/null and b/data/icons/epg.png differ diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index cd0c60592..e43d94c1f 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -240,6 +240,7 @@ channellist.nonefound Es wurden keine Kanäle gefunden!\nFühren Sie bitte eine channellist.numeric_adjust Numeric zap adjust channellist.provs Anbieter channellist.recording_not_possible Aufnahme nicht möglich! +channellist.remember Zuletzt verwendete channellist.reset_all Entferne Markierung "Neu" für alle Kanäle channellist.reset_flags Entferne Kanal-Markierung "Neu" channellist.sats Satelliten @@ -316,6 +317,11 @@ date.Sun So date.Thu Do date.Tue Di date.Wed Mi +debug Debug Ausgabe +debug.level Stufe +debug.level_1 normal +debug.level_2 informativ +debug.level_3 ausführlich epg.saving Speichere EPG epgextended.actors Darsteller epgextended.director Regie @@ -390,7 +396,7 @@ extra.key_pic_size 4:3 Anzeigeverhalten extra.key_pip_close Stop/Start PiP extra.key_pip_setup PiP Konfiguration extra.key_pip_swap Umschalten PiP/live -extra.key_plugin One-touch-Plugin +extra.key_plugin Schnellstart-Plugin extra.key_screenshot Screenshot Taste extra.key_timeshift Timeshift extra.key_unlock Entsperrtaste @@ -402,7 +408,8 @@ extra.lodirection Längengrad-Ausrichtung extra.longitude Längengrad extra.menu_left_exit "links" = Menü zurück extra.north Norden -extra.record_time Maximale Aufnahmezeit +extra.record_time Maximale Aufnahmedauer +extra.record_time_ts Maximale Timeshiftdauer extra.rotor_swap Rotor dreht Ost/West extra.rounded_corners Eckendarstellung extra.rounded_corners_off eckig @@ -617,18 +624,21 @@ hdd_check_format_bad Überprüfung von Datenträgern mit Format %s wird nicht un hdd_extended_settings Erweiterte Festplatteneinstellungen hdd_fast Schnell hdd_format Formatiere Festplatte -hdd_format_failed Formatierung fehlgeschlagen -hdd_format_warn Formatierung wird gestartet +hdd_format_failed Formatierung fehlgeschlagen! Stellen Sie sicher, dass der Datenträger nicht in Verwendung ist und versuchen Sie es erneut. +hdd_format_warn Alle Daten auf dem Datenträger werden gelöscht! Formatierung starten? hdd_fs Dateisystem zum formatieren hdd_fs_unknown unbekannt hdd_manage Laufwerke verwalten hdd_middle Mittel +hdd_mount Mount +hdd_mount_umount Mount/Unmount hdd_noise Akustikkontrolle (AAM) hdd_not_found Keine Festplatte hdd_removable_device Wechseldatenträger hdd_settings Laufwerke hdd_sleep Ausschalten nach... hdd_slow Langsam +hdd_umount Unmount hdd_umount_warn Laufwerk aushängen imageinfo.creator Ersteller: imageinfo.date Datum: @@ -675,6 +685,7 @@ keybindingmenu.channellist Kanalliste keybindingmenu.channelup Kanal hoch keybindingmenu.head Tasten-Belegungen bearbeiten keybindingmenu.lastchannel Letzter Kanal +keybindingmenu.longkeypress_duration Langer Tastendruck keybindingmenu.misc Sonstige keybindingmenu.mode_left_right_key_tv Funktion li/re Tasten im TV-Modus keybindingmenu.mode_left_right_key_tv_infobar Infobar einblenden @@ -738,6 +749,9 @@ ledcontroler.off LED1 & LED2 aus ledcontroler.on.all LED1 & LED2 an ledcontroler.on.led1 LED1 an ledcontroler.on.led2 LED2 an +lua.function_deprecated1 Achtung! +lua.function_deprecated2 Die Funktion +lua.function_deprecated3 ist veraltet,\n bitte nutzen Sie mainmenu.audioplayer Audioplayer mainmenu.channels Kanalliste mainmenu.clearsectionsd Lösche EPG Cache @@ -804,6 +818,7 @@ menu.hint_audioplayer_title Aktivieren Sie die Titelsuche (SMS-Stil) in der Play menu.hint_auto_lang Wählen Sie, ob automatisch ihre bevorzugte Tonspur ausgewählt wird, wenn sie vorhanden ist menu.hint_auto_subs Automatische Anzeige der Untertitel in Ihrer bevorzugten Sprache menu.hint_back Zurück zum vorherigen Menü.\nDie Taste 'Menü' schließt alle Menüs +menu.hint_back_brief Zurück zum vorherigen Menü. menu.hint_backlight Konfigurieren Sie die Hintergrundbeleuchtung der Buttons menu.hint_backup Sichern von Konfigurationen und Kanallisten menu.hint_bedit Bearbeiten ihrer Favoriten und der Bouquets @@ -818,6 +833,8 @@ menu.hint_channellist_epg_align Legen Sie fest, wie der Text für das EPG in der menu.hint_channellist_extended Bei aktivierter Funktion wird vor dem Sendernamen ein Balken eingeblendet, der den Sendungsfortschritt anzeigt menu.hint_channellist_fonts Ändern Sie die Schriftgrößen in der Kanalliste menu.hint_channellist_foot Definiert, welche Informationen im unteren Sendungsfenster angezeigt werden sollen +menu.hint_channellist_mode Wählen Sie die Start-Kanalliste im TV-Modus +menu.hint_channellist_mode_radio Wählen Sie die Start-Kanalliste im Radio-Modus menu.hint_channellist_setup Wählen Sie die Anzeigeoptionen für die Kanalliste menu.hint_channellist_show_channellogo Zeigt Senderlogos in der Kanalliste. menu.hint_channels Kanalliste öffnen @@ -843,6 +860,7 @@ menu.hint_epg_old_events Veraltete EPG-Daten werden nach dieser Zeit (in Stunden menu.hint_epg_save Speichert die EPG-Daten auf einem externen Datenträger und läd es von dort nach einen Neustart menu.hint_epg_save_standby Speichert die EPG-Daten auch im Standby-Modus menu.hint_epg_scan Aktivieren Sie den Hintergrundscan der EPG-Daten, wenn ein freier Tuner vorhanden ist, im aktuellen Bouquet oder in allen Favoriten +menu.hint_epg_scan_mode Wählen Sie den Modus für den EPG Scan aus. menu.hint_event_textcolor Ändern Sie die Farbe für farbige Events in der Kanalliste und der Infobar menu.hint_eventlist_additional Definiert, ob zusätzliche Informationen im Hauptfenster angezeigt werden sollen menu.hint_eventlist_fonts Ändern Sie die Schriftgröße in der Event-Liste @@ -934,6 +952,7 @@ menu.hint_key_pic_size_active Die Taste für das 4:3 Anzeigeverhalten deaktivier menu.hint_key_pip_close Tastenzuordnung für Stop PiP oder Start mit aktuellem Kanal menu.hint_key_pip_setup Tastenzuordnung für PiP Konfiguration menu.hint_key_pip_swap Tastenzuordnung zum Umschalten PiP und aktuellem Kanal +menu.hint_key_plugin Wählen Sie eine Taste für das Schnellstart-Plugin menu.hint_key_poweroff Wählen Sie eine Taste für den Standby und für das Verhalten für Standby und Deep-Standby menu.hint_key_quickzap Konfigurieren Sie die Tastenbelegung für die Schnellumschaltung menu.hint_key_repeatblock Die Verzögerung nach einem Tastendruck bis die Box reagieren soll @@ -960,6 +979,7 @@ menu.hint_leds_record Definiert, ob die Power-LEDs blinken sollen, wenn eine Auf menu.hint_leds_standby Definiert den Status der Power-LEDs im Standby menu.hint_leds_tv Definiert den Status der Power-LEDs im TV-Modus menu.hint_load Laden der Neutrino-HD-Einstellungen aus einer Datei +menu.hint_longkeypress_duration Tasten, die länger als die angegebene Zeit betätigt werden, werden als "langer Tastendruck" behandelt. menu.hint_lua Plugins ausführen menu.hint_make_hdlist Bei aktiver Option wird ein Bouquet namens 'HD' erzeugt, in dem alle HD-Sender zusammengefasst sind menu.hint_make_newlist Nach einer Kanalsuche wird ein Bouquet namens 'neue Kanäle' erzeugt @@ -979,6 +999,7 @@ menu.hint_misc_filebrowser Dateisystem, Dateirechte anzeigen im Dateibrowser, St menu.hint_misc_general Standby-, Teletext- und Rotor-Einstellungen, Pluginverzeichnis auf externem Datenträger menu.hint_misc_zapit Verwaltung der Start-Kanäle für den TV/Radio-Modus menu.hint_movie Wiedergabe von Filmen +menu.hint_movieplayer_plugin Wählen Sie ein Plugin, das mit einer Schnellstart-Taste im Movieplayer-Modus gestartet wird menu.hint_net_broadcast Ändern Sie die Broadcast-Adresse.\nWenn Sie unsicher sind, verwenden Sie zuletzt .255 menu.hint_net_dhcp Verwenden Sie einen DHCP-Server für die automatische Vergabe einer IP-Adresse im Netzwerk menu.hint_net_djmount Mountet UPnP-Geräte als Dateisystem unter /media/00upnp @@ -1014,6 +1035,9 @@ menu.hint_net_xupnpd Freigabe von Live Channels über UPNP menu.hint_network IP-Adresse, Gateway, DNS, Zeit-Sync, Netzwerk-Freigaben, Dienste und mehr menu.hint_new_zap_mode Aktiviert Quickzap in der Kanalliste. Nach Betätigen der Mute-Taste wird mit den Hoch/Runter-Tasten direkt umgeschalten menu.hint_numeric_adjust Adjust channel list mode on numeric zap +menu.hint_onekey_plugin Wählen Sie ein Plugin, das mit einer Schnellstart-Taste gestartet wird +menu.hint_opkg Hier können Sie neue Software-Pakete installieren oder vorhandene aktualisieren +menu.hint_opkg_upgrade Aktualisiert alle installierten Pakete auf die neueste verfügbare Version menu.hint_osd Farben, Schriftarten, Anzeigegröße, Ansichtsoptionen der Menüs und mehr menu.hint_osd_language Wählen Sie ihre Menü-Sprache menu.hint_osd_preset Wählen Sie zwischen Röhren-TV (CRT) oder Flachbildschirm (LCD) @@ -1050,10 +1074,12 @@ menu.hint_record_data_dvbsub Untertitel-Spur zu Aufnahme hinzufügen menu.hint_record_data_vtxt Teletext-Spur zu Aufnahme hinzufügen menu.hint_record_dir Wählen Sie das Aufnahmeverzeichnis menu.hint_record_end Wählen Sie zwischen maximaler Aufnahmezeit oder einem Aufnahmeende anhand der EPG-Daten +menu.hint_record_filename_template Vorlagemuster für den Dateinamen bearbeiten menu.hint_record_slow_warn Zeige Warnung, wenn der Aufnahmepuffer zu überlaufen droht menu.hint_record_startstop_msg Schaltet die Meldung bei Aufnahmestart/ende ein oder aus. menu.hint_record_tdir Wählen Sie ein Verzeichnis für Ihre Timeshift-Aufnahmen im temporären Timeshift-Modus -menu.hint_record_time Geben Sie eine maximale Aufnahmezeit in Stunden ein, wenn Sie die Aufnahme nicht vorzeitig stoppen +menu.hint_record_time Aufzeichnungsdauer vor dem Stopp bei der Verwendung von Direktaufzeichnung mit Record-Taste. +menu.hint_record_time_ts Timeshiftdauer vor dem Stopp, wenn temporäres Timeshift aktiviert. menu.hint_record_timeafter Stellen Sie die Nachlaufzeit für Timer-Aufnahmen ein\nEin Wert von 2 beendet die Aufnahme 2 Minuten nach dem Sendungsende menu.hint_record_timebefore Stellen Sie die Vorlaufzeit für Timer-Aufnahmen ein\nEin Wert von 2 startet die Aufnahme 2 Minuten vor dem Sendungsbeginn menu.hint_record_timer Konfigurieren Sie Optionen für Timer-Aufnahmen @@ -1085,8 +1111,10 @@ menu.hint_scan_diseqcorder Diseqc command order for cascaded switches menu.hint_scan_diseqcrepeat DiSEqC-Wiederholungen für kaskadierte Schaltungen menu.hint_scan_diseqctype Wählen Sie ihr DiSEqC-Protokoll\nMit 'Erweitert' können Sie ihre Anlage einbinden menu.hint_scan_fast Schnell-Suchlauf eines ausgewählten Anbieters\nWARNUNG: DiSEqC-Einstellung wird überschrieben +menu.hint_scan_fastdiseqc Start DiSEqC-Autokonfiguration menu.hint_scan_fastprov Wählen Sie einen Anbieter (Provider) für den Suchlauf menu.hint_scan_fasttype Wählen Sie das Sendeformat +menu.hint_scan_fastupdate Aktivieren/Deaktivieren Fastscan Auto-Update menu.hint_scan_fec Wählen Sie eine Transponder-FEC menu.hint_scan_felink Select tuner to link tuner to menu.hint_scan_femode Wählen Sie den Verbindungstyp für den zweiten Tuner @@ -1106,6 +1134,7 @@ menu.hint_scan_logical_hd Wenn der Kanal in SD und in HD verfügbar ist, wird HD menu.hint_scan_longitude Geben Sie ihren Längengrad ein menu.hint_scan_manual Manueller Transponder-Suchlauf mit ausgewählten Parametern menu.hint_scan_mod Wählen Sie eine Transponder-Modulation +menu.hint_scan_motor Rotor Optionen, Satfinder menu.hint_scan_motor_18v Benutze 18V für Motorbewegungen menu.hint_scan_motor_speed Rotor-Bewegungsgeschwindigkeit in 1/10 Grad pro Sekunde menu.hint_scan_motorpos Wählen Sie eine gespeicherten Positions-Nummer für diesen Satelliten,\nwird ignoriert, wenn USALS aktiv @@ -1130,6 +1159,7 @@ menu.hint_scan_start Startet die Kanalsuche mit den angegebenen Parametern.\nMit menu.hint_scan_test Testen Sie das Signal für diesen Transponder menu.hint_scan_tpselect Wählen Sie einen einzelnen Transponder für den Suchlauf menu.hint_scan_uncommited Wählen Sie nicht festgeschriebene Angaben für diesen Satelliten +menu.hint_scan_usals USALS Optionen menu.hint_scan_usals_repeat Geben Sie die USALS-Wiederholungen für den Rotor ein menu.hint_scan_usalsall Verwenden Sie USALS für alle Satelliten an diesem Tuner menu.hint_scan_useusals Verwenden Sie USALS für diesen Satelliten,\nwenn aktiv, wird Rotorposition ignoriert @@ -1201,6 +1231,7 @@ menu.hint_video_modes Definiert, welche Videosysteme mit der VF-Taste der Fernbe menu.hint_video_pip Bild in Bild Größe und Position menu.hint_video_saturation Change picture saturation menu.hint_video_scart_mode Wählen Sie den Modus des Ausgangssignals für den SCART-Anschluss +menu.hint_video_sdosd Aktivieren/Deaktivieren der OSD Anzeige am Analogausgang (Scart, Cinch) menu.hint_volume Wählen Sie die Anzeigeoptionen für die Lautstärke menu.hint_volume_digits Zifferndarstellung der Lautstärkeanzeige ein- oder ausschalten menu.hint_volume_pos Wählen Sie die Position der Lautstärkeanzeige aus @@ -1241,8 +1272,12 @@ miscsettings.epg_old_events_hint2 Angabe in Stunden miscsettings.epg_save EPG zwischenspeichern miscsettings.epg_save_standby EPG speichern in Standby-Modus miscsettings.epg_scan Hintergrundscan EPG +miscsettings.epg_scan_always Immer miscsettings.epg_scan_bq Aktuelles Bouquet miscsettings.epg_scan_fav Alle Favoriten +miscsettings.epg_scan_live Bei eingeschalteter Box +miscsettings.epg_scan_sel Markierte Bouquets +miscsettings.epg_scan_standby Im Standby Modus miscsettings.general Allgemein miscsettings.head Erweitert miscsettings.infobar Infobar @@ -1497,7 +1532,7 @@ mpkey.bookmark Speichere Lesezeichen mpkey.forward Vorlauf mpkey.pause Pause mpkey.play Play -mpkey.plugin Starte Plugin +mpkey.plugin Movieplayer-Plugin mpkey.rewind Rücklauf mpkey.stop Stopp mpkey.subtitle Untertitel @@ -1564,6 +1599,19 @@ nvod.starting (Beginn in %d min) nvodselector.directormode Bildregie-Modus nvodselector.head Anfangszeit auswählen nvodselector.subservice Perspektiven +opkg.button.expert_off Standard-Modus +opkg.button.expert_on Experten-Modus +opkg.button.info Paket-Informationen +opkg.button.install Paket installieren +opkg.button.uninstall Paket entfernen +opkg.failure.install Installation fehlgeschlagen (%d) +opkg.failure.update Update fehlgeschlagen (%d) +opkg.failure.upgrade Upgrade fehlgeschlagen (%d) +opkg.messagebox.reinstall %s erneut installieren? +opkg.messagebox.remove %s entfernen? +opkg.success.install Installation erfolgreich, Neustart von Neutrino kann erforderlich sein. +opkg.title Paketverwaltung +opkg.upgrade Installierte Pakete aktualisieren options.default Voreinstellungen benutzen options.fb framebuffer options.ntp_off DVB @@ -1691,6 +1739,9 @@ recordingmenu.end_of_recording_epg EPG aktuelles Event recordingmenu.end_of_recording_max max. Aufnahmezeit recordingmenu.end_of_recording_name Ende der Sofortaufnahme recordingmenu.file Direkt (Datei) +recordingmenu.filename_template Vorlage für Dateiname +recordingmenu.filename_template_hint Platzhalter werden durch folgende Werte ersetzt: +recordingmenu.filename_template_hint2 %C = Kanal, %T = Titel, %I = Info, %d = Datum, %t = Zeit recordingmenu.help Aufnahmegeräte:\n-----------------------\nServer:\nauf PC mit Hilfe eines Streaming-Programmes\n\n(analoger) Videorekorder:\nüber VCR-Ausgang\n\nDirekt (Datei):\nauf ein per NFS gemountetes Verzeichnis\noder eine interne Festplatte\nTS: SPTS-Mode Treiber laden(dbox2)\nPES: SPTS-Mode Treiber nicht laden(dbox2)\n\n\nMaximale Dateigröße:\n----------------------\nNFS V2: 2 GB (2048 MB)\nNFS V3: fast unendlich (0 MB)\nFAT: 2 GB (2048 MB)\nFAT32: 4 GB (4096 MB) recordingmenu.multimenu.ask_stop_all Wirklich alle %d Aufnahmen beenden? recordingmenu.multimenu.info_stop_all %d von %d Aufnahmen werden beendet. @@ -1734,14 +1785,24 @@ satsetup.diseqcrepeat DiSEqC-Wiederholungen satsetup.extended DiSEqC-Einstellungen satsetup.extended_motor Motor-Einstellungen satsetup.fastscan_all SD und HD +satsetup.fastscan_auto_diseqc Start automatische Diseqc Konfiguration +satsetup.fastscan_auto_diseqc_wait Automatische Diseqc Konfiguration wird durchgeführt satsetup.fastscan_hd nur HD -satsetup.fastscan_head Schnellscan (Astra 1, 19.2E, 12.515Mhz) +satsetup.fastscan_head Schnellscan satsetup.fastscan_prov Anbieter: -satsetup.fastscan_prov_cd CanalDigitaal -satsetup.fastscan_prov_telesat TéléSAT -satsetup.fastscan_prov_tvv TV Vlaanderen +satsetup.fastscan_prov_cd_hd CanalDigitaal (HD) +satsetup.fastscan_prov_cd_sd CanalDigitaal (SD) +satsetup.fastscan_prov_hda HD Austria +satsetup.fastscan_prov_hello Hello +satsetup.fastscan_prov_skylink_c Skylink Czech +satsetup.fastscan_prov_skylink_s Skylink Slovak +satsetup.fastscan_prov_telesat_b TéléSAT Belgium +satsetup.fastscan_prov_telesat_l TéléSAT Luxemburg +satsetup.fastscan_prov_tvv_hd TV Vlaanderen (HD) +satsetup.fastscan_prov_tvv_sd TV Vlaanderen (SD) satsetup.fastscan_sd nur SD satsetup.fastscan_type Scantyp +satsetup.fastscan_update Auto-Update satsetup.fe_mode Tuner Modus satsetup.fe_mode_independent Independent satsetup.fe_mode_link_loop Loop @@ -1875,9 +1936,11 @@ streaming.slow System oder Datenträger zu langsam! Bitte ggf. einige Aufnahmen streaming.write_error Die Aufnahme wurde leider abgebrochen,\nda ein Fehler beim Schreiben der Daten auftrat. stringinput.caps Groß-/Kleinbuchstaben stringinput.clear Alles löschen +subtitles.charset Zeichensatz subtitles.head Untertitel subtitles.stop Untertitel aus -terrestrialsetup.provider DVB-T Region +terrestrialsetup.area Region +terrestrialsetup.provider DVB-T Versorgungsbereich timer.eventrecord.msg Die Sendung wurde zur Aufnahme vorgemerkt. timer.eventrecord.title Aufnahme vormerken timer.eventtimed.msg Die Sendung wurde vorgemerkt. @@ -2031,6 +2094,7 @@ videomenu.pip_error PiP Startfehler videomenu.saturation Sättigung videomenu.scart Scart videomenu.screensetup Bildbereich +videomenu.sdosd SD OSD videomenu.sharpness Schärfe videomenu.tv-scart TV Scart videomenu.vcrsignal VCR-Ausgang Signalart @@ -2057,8 +2121,10 @@ zapit.scantype.all Alle Services zapit.scantype.radio Nur Radio zapit.scantype.tv Nur TV zapit.scantype.tvradio Nur TV & Radio +zapitsetup.channelmode Start-Kanalliste für TV +zapitsetup.channelmode_radio Start-Kanalliste für Radio zapitsetup.head Startkanal-Verwaltung -zapitsetup.info Start Kanal +zapitsetup.info Startkanal zapitsetup.last_radio Radio Kanal zapitsetup.last_tv TV Kanal zapitsetup.last_use Kanal beim Runterfahren speichern diff --git a/data/locale/english.locale b/data/locale/english.locale index 3efafb348..77695ab3b 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -240,6 +240,7 @@ channellist.nonefound No channels were found!\nPlease execute a scan\n(MENU-key channellist.numeric_adjust Numeric zap adjust channellist.provs Providers channellist.recording_not_possible Recording not possible! +channellist.remember Last used channellist.reset_all Reset 'new' flag for all channels channellist.reset_flags Reset 'new' channel flag channellist.sats Satellites @@ -316,6 +317,11 @@ date.Sun Sun date.Thu Thu date.Tue Tue date.Wed Wed +debug Debug Output +debug.level Level +debug.level_1 normal +debug.level_2 informative +debug.level_3 verbose epg.saving Saving EPG epgextended.actors Actors epgextended.director Director @@ -402,7 +408,8 @@ extra.lodirection LoDirection extra.longitude Longitude extra.menu_left_exit "Left" = menu back extra.north North -extra.record_time Maximal recording time +extra.record_time Maximal recording duration +extra.record_time_ts Maximal timeshift duration extra.rotor_swap Swap rotor east/west extra.rounded_corners Shape of corners extra.rounded_corners_off angular @@ -617,18 +624,24 @@ hdd_check_format_bad Checking of disks with format %s is not supported. hdd_extended_settings Extended HDD-Settings hdd_fast Fast hdd_format Formating drive... -hdd_format_failed Formating failed! -hdd_format_warn Start format... +hdd_format_failed Formating failed! Make sure device not in use, reboot and try again +hdd_format_warn All data on device will be lost ! Continue with format ? hdd_fs Filesystem used to format hdd_fs_unknown unknown hdd_manage Manage drives hdd_middle Mid +hdd_mount Mount +hdd_mount_ok Device ready to use. +hdd_mount_failed Failed to mount, check HDD settings menu. +hdd_mount_umount Mount/Unmount hdd_noise Acoustic-control (AAM) hdd_not_found No HDD found hdd_removable_device Removable device hdd_settings Hard Disk Drive/USB hdd_sleep Switch off after... hdd_slow Slow +hdd_umount Unmount +hdd_umounted Device removed hdd_umount_warn unmount device imageinfo.creator Creator: imageinfo.date Date: @@ -675,6 +688,7 @@ keybindingmenu.channellist Channellist keybindingmenu.channelup channel up keybindingmenu.head Edit Keybindings keybindingmenu.lastchannel Quick Zap +keybindingmenu.longkeypress_duration Long key-press keybindingmenu.misc Misc keybindingmenu.mode_left_right_key_tv Left/Right Key Behavior in TV-Mode keybindingmenu.mode_left_right_key_tv_infobar Show Infobar @@ -738,6 +752,9 @@ ledcontroler.off Led1 & Led2 off ledcontroler.on.all Led1 & Led2 on ledcontroler.on.led1 Led1 on ledcontroler.on.led2 Led2 on +lua.function_deprecated1 Attention! +lua.function_deprecated2 Function +lua.function_deprecated3 is deprecated,\n please use mainmenu.audioplayer Audioplayer mainmenu.channels Channels mainmenu.clearsectionsd Clear EPG Cache @@ -804,6 +821,7 @@ menu.hint_audioplayer_title Enable SMS-style title search in playlist menu.hint_auto_lang Auto-switch audio to preferred language menu.hint_auto_subs Auto-start subtitles for preferred language menu.hint_back Return to previous menu\nPress menu key to close all menus +menu.hint_back_brief Return to previous menu menu.hint_backlight Configure buttons backlight menu.hint_backup Backup configs and channels to selected dir menu.hint_bedit Edit favorites and bouquets @@ -818,6 +836,8 @@ menu.hint_channellist_epg_align EPG event align menu.hint_channellist_extended Show current event progress bar menu.hint_channellist_fonts Change channel list font sizes menu.hint_channellist_foot Show additional information\nin bottom box +menu.hint_channellist_mode Use the selected channel list mode on startup if last mode is TV +menu.hint_channellist_mode_radio Use the selected channel list mode on startup if last mode is Radio menu.hint_channellist_setup Configure channel list GUI options menu.hint_channellist_show_channellogo Show channellogos in channel list menu.hint_channels Open channel list @@ -843,6 +863,7 @@ menu.hint_epg_old_events Hours after event end time to consider\nevent old and r menu.hint_epg_save Save cached EPG to harddisk or usb flash\nand load it after boot menu.hint_epg_save_standby Save EPG on soft standby mode menu.hint_epg_scan Enable background epg scan using free tuner,\ncurrent bouquet or all favorites +menu.hint_epg_scan_mode Select box state to run epg scan menu.hint_event_textcolor Change event color for colored-event options\nin channel list and infobar menu.hint_eventlist_additional Show additional informations\nin main box menu.hint_eventlist_fonts Change event list font sizes @@ -934,6 +955,7 @@ menu.hint_key_pic_size_active Disable/enable key for the 4:3 display behavior menu.hint_key_pip_close Assign button to stop PiP\nor start it for current channel menu.hint_key_pip_setup Assign button to configure PiP menu.hint_key_pip_swap Assign button to swap PiP and live channel +menu.hint_key_plugin Assign button to execute the one touch plugin menu.hint_key_poweroff Assign button to switch power state\n (standby/deepstandby <-> running) menu.hint_key_quickzap Configure keybingdings for quick\nchannel switch menu.hint_key_repeatblock Delay after button press and before\nfirst key repeat @@ -960,6 +982,7 @@ menu.hint_leds_record LEDs state when box recording menu.hint_leds_standby LEDs state in soft-standby mode menu.hint_leds_tv Working LEDs state menu.hint_load Load Neutrino-HD GUI settings from file +menu.hint_longkeypress_duration A key press will be considered as "long key press" if it's pressed longer than the specified time. menu.hint_lua Run Plugins menu.hint_make_hdlist Auto-create HD channel list based on\nchannel type and name menu.hint_make_newlist Create list of recently added channels @@ -979,6 +1002,7 @@ menu.hint_misc_filebrowser Filesystem encoding, file rights\ndeny directory leav menu.hint_misc_general Start to standby, cache teletext, swp rotor\nplugin hdd dir menu.hint_misc_zapit Initial TV/Radio channels menu.hint_movie Play movies +menu.hint_movieplayer_plugin Choose a plugin that's executed with the one touch key in movieplayer mode menu.hint_net_broadcast Enter broadcast address\nif unsure, use IP address with last .255 menu.hint_net_dhcp Use DHCP server to auto-configure menu.hint_net_djmount Mount UPnP devices as filesystem\nunder /media/00upnp @@ -1014,6 +1038,9 @@ menu.hint_net_xupnpd Share live channels over UPNP menu.hint_network IP address, gateway, DNS, Time sync\nNetwork shares and services menu.hint_new_zap_mode Allow channel switch while browsing\n(toggle mode with 'mute' in channel list) menu.hint_numeric_adjust Adjust channel list mode on numeric zap +menu.hint_onekey_plugin Choose a plugin that's executed with the one touch key +menu.hint_opkg Install or update software packages +menu.hint_opkg_upgrade Updates all installed packages to the most recent version available menu.hint_osd Colors, fonts, screen size\nGUI look and feel options menu.hint_osd_language Select OSD language menu.hint_osd_preset Pre-configured screen margins for CRT and LCD TV @@ -1044,16 +1071,19 @@ menu.hint_record_apid_alt Record alternative non-AC3 audio pids menu.hint_record_apid_std Record first audio pid menu.hint_record_apids Configure audio pids to record menu.hint_record_apply Apply record options +menu.hint_record_auto_cover Auto-create movie thumbnail for movie browser on record playback menu.hint_record_chandir Create directory with name of channel\nto store recording menu.hint_record_data Record (VideoText, subtitles) data streams menu.hint_record_data_dvbsub subtitle stream menu.hint_record_data_vtxt VideoText stream menu.hint_record_dir Select directory to store recordings menu.hint_record_end Stop direct record after maximal time or after current event end time +menu.hint_record_filename_template edit filename template menu.hint_record_slow_warn Show warning, when record buffer is close to overflow menu.hint_record_startstop_msg Turns the message when recording start/end on or off. 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_time Record duration before stop when\nusing direct record with record button +menu.hint_record_time_ts Timeshift duration before stop when\ntemporary timeshift enabled menu.hint_record_timeafter Stop record after event end\nin minutes menu.hint_record_timebefore Start record before event start\nin minutes menu.hint_record_timer Configure record by timer options @@ -1085,8 +1115,10 @@ menu.hint_scan_diseqcorder Diseqc command order for cascaded switches menu.hint_scan_diseqcrepeat Diseqc repeat for cascaded switches menu.hint_scan_diseqctype Select your diseqc switch protocol\nwith 'advanced' you can use uncommited switches menu.hint_scan_fast CanalDigitaal/TéléSAT/TV Vlaanderen provider scan\nWARNING: diseqc config will be overwritten +menu.hint_scan_fastdiseqc Start diseqc auto-configuration menu.hint_scan_fastprov Select provider to scan menu.hint_scan_fasttype Select fast scan type +menu.hint_scan_fastupdate Enable/disable fast scan auto-update menu.hint_scan_fec Select transponder FEC menu.hint_scan_felink Select tuner to link tuner to menu.hint_scan_femode Select tuner connection type @@ -1106,6 +1138,7 @@ menu.hint_scan_logical_hd If both SD and HD channel versions present\nput HD to menu.hint_scan_longitude Enter your longtitude menu.hint_scan_manual Manual transponder scan using\nselected parameters menu.hint_scan_mod Select transponder modulation +menu.hint_scan_motor Rotor options, satellite finder menu.hint_scan_motor_18v Use 18V when moving rotor menu.hint_scan_motor_speed Rotor moving speed in 1/10 degree\nper second menu.hint_scan_motorpos Select stored position number for this satellite,\nignored, if USALS enabled @@ -1130,6 +1163,7 @@ menu.hint_scan_start Start scan. You can use 'exit' button to stop menu.hint_scan_test Test signal for this transponder menu.hint_scan_tpselect Select transponder to scan menu.hint_scan_uncommited Select uncommited input for\nthis satellite +menu.hint_scan_usals USALS options menu.hint_scan_usals_repeat Repeat usals move rotor commands\nif you expirience unstable rotor move menu.hint_scan_usalsall Use USALS for all satellites on this frontend menu.hint_scan_useusals Use USALS for this satellite,\nif ON, rotor position ignored @@ -1201,6 +1235,7 @@ menu.hint_video_modes VF key will cycle between enabled modes menu.hint_video_pip Picture in picture size and position menu.hint_video_saturation Change picture saturation menu.hint_video_scart_mode Select analog output mode for SCART connectors +menu.hint_video_sdosd Enable/disable OSD display on SD output (scart, cinch) menu.hint_volume Configure Volume GUI options menu.hint_volume_digits Numeric display of the volumebar on/off menu.hint_volume_pos Select volume indicator position @@ -1241,8 +1276,12 @@ miscsettings.epg_old_events_hint2 Set in hours miscsettings.epg_save Save/Restore epg on reboot miscsettings.epg_save_standby Save epg on soft standby miscsettings.epg_scan EPG scan +miscsettings.epg_scan_always Always miscsettings.epg_scan_bq bouquet miscsettings.epg_scan_fav favorites +miscsettings.epg_scan_live Live +miscsettings.epg_scan_sel Selected +miscsettings.epg_scan_standby Standby miscsettings.general General miscsettings.head Extended settings miscsettings.infobar Infobar @@ -1497,7 +1536,7 @@ mpkey.bookmark save bookmark mpkey.forward Forward mpkey.pause Pause mpkey.play Play -mpkey.plugin Run plugin +mpkey.plugin Movieplayer plugin mpkey.rewind Rewind mpkey.stop Stop mpkey.subtitle Subtitles @@ -1564,6 +1603,19 @@ nvod.starting (starting in %d min) nvodselector.directormode Direct-Mode nvodselector.head Select starting-time nvodselector.subservice Select Subservice +opkg.button.expert_off Standard mode +opkg.button.expert_on Expert mode +opkg.button.info Package information +opkg.button.install Install package +opkg.button.uninstall Uninstall package +opkg.failure.install Install failed (%d) +opkg.failure.update Update failed (%d) +opkg.failure.upgrade Upgrade failed (%d) +opkg.messagebox.reinstall Re-install %s? +opkg.messagebox.remove Remove %s? +opkg.success.install Install successful, restart of Neutrino might be required. +opkg.title Package Management +opkg.upgrade Upgrade installed packages options.default Reset to defaults options.fb framebuffer options.ntp_off DVB @@ -1684,6 +1736,7 @@ recordingmenu.apids Audio streams recordingmenu.apids_ac3 record AC3 streams recordingmenu.apids_alt record alternative streams recordingmenu.apids_std record standard stream +recordingmenu.auto_cover Auto-thumbnail recordingmenu.data_pids Data streams recordingmenu.defdir Recording directory recordingmenu.dvbsub_pids record dvbsub stream @@ -1691,6 +1744,9 @@ recordingmenu.end_of_recording_epg EPG act. Event recordingmenu.end_of_recording_max max. Recordingtime recordingmenu.end_of_recording_name Endtime of Recording recordingmenu.file direct (file) +recordingmenu.filename_template filename template +recordingmenu.filename_template_hint wildcards will be replaced +recordingmenu.filename_template_hint2 %C = channel, %T = title, %I = info, %d = date, %t = time recordingmenu.help Recording devices:\n--------------------------\nserver:\nusing streaming software on a PC\n\n(analog) vcr:\nusing the vcr outlet\n\ndirect (file):\ndirectly into an NFS mounted directory\nor onto an internal hard drive\nTS: use spts mode(dbox2)\nPES: do not use spts mode(dbox2)\n\n\nMax. file size:\n---------------------\nNFS V2: 2 GB (2048 MB)\nNFS V3: almost unlimited (0 MB)\nFAT: 2 GB (2048 MB)\nFAT32: 4 GB (4096 MB) recordingmenu.multimenu.ask_stop_all really stop all %d recordings? recordingmenu.multimenu.info_stop_all %d of %d recordings will be stopped. @@ -1734,14 +1790,24 @@ satsetup.diseqcrepeat DiSEqC-repeats satsetup.extended DiSEqC-Settings satsetup.extended_motor Motor-Settings satsetup.fastscan_all SD and HD +satsetup.fastscan_auto_diseqc Start auto-diseqc configuration +satsetup.fastscan_auto_diseqc_wait Auto-diseqc configuration in progress satsetup.fastscan_hd HD only -satsetup.fastscan_head Fast scan (Astra 1, 19.2E, 12.515Mhz) +satsetup.fastscan_head Fast scan satsetup.fastscan_prov Provider -satsetup.fastscan_prov_cd CanalDigitaal -satsetup.fastscan_prov_telesat TéléSAT -satsetup.fastscan_prov_tvv TV Vlaanderen +satsetup.fastscan_prov_cd_hd CanalDigitaal (HD) +satsetup.fastscan_prov_cd_sd CanalDigitaal (SD) +satsetup.fastscan_prov_hda HD Austria +satsetup.fastscan_prov_hello Hello +satsetup.fastscan_prov_skylink_c Skylink Czech +satsetup.fastscan_prov_skylink_s Skylink Slovak +satsetup.fastscan_prov_telesat_b TéléSAT Belgium +satsetup.fastscan_prov_telesat_l TéléSAT Luxemburg +satsetup.fastscan_prov_tvv_hd TV Vlaanderen (HD) +satsetup.fastscan_prov_tvv_sd TV Vlaanderen (SD) satsetup.fastscan_sd SD only satsetup.fastscan_type Scan type +satsetup.fastscan_update Auto update satsetup.fe_mode Tuner mode satsetup.fe_mode_independent Independent satsetup.fe_mode_link_loop Loop @@ -1794,7 +1860,7 @@ scants.channel Channel: scants.failed Transponderscan failed! scants.finished Transponderscan finished successfully! scants.freqdata Frequency: -scants.head Scan transponder +scants.head Service scan scants.numberofdataservices Data scants.numberofradioservices Radio scants.numberoftotalservices Total @@ -1875,8 +1941,10 @@ streaming.slow System/hdd too slow, consider to stop some records streaming.write_error The recording was aborted,\nsince an error occured during the writing process. stringinput.caps caps / no caps stringinput.clear clear all +subtitles.charset Charset subtitles.head Subtitles subtitles.stop Stop subtitles +terrestrialsetup.area Area terrestrialsetup.provider Terrestrial Provider timer.eventrecord.msg The event is scheduled for recording.\nTo edit the schedule open the timer list. timer.eventrecord.title Schedule Record @@ -2031,6 +2099,7 @@ videomenu.pip_error PiP start failed videomenu.saturation Saturation videomenu.scart Scart videomenu.screensetup Screen Setup +videomenu.sdosd SD OSD videomenu.sharpness Sharpness videomenu.tv-scart Video videomenu.vcrsignal VCR Output Signal Type @@ -2057,6 +2126,8 @@ zapit.scantype.all all services zapit.scantype.radio only radio zapit.scantype.tv only tv zapit.scantype.tvradio tv & radio +zapitsetup.channelmode Initial TV channel list +zapitsetup.channelmode_radio Initial Radio channel list zapitsetup.head Start Channel Settings zapitsetup.info Start Channel zapitsetup.last_radio Radio Channel diff --git a/data/locale/nederlands.locale b/data/locale/nederlands.locale index 5f4d0e229..6688ca37b 100644 --- a/data/locale/nederlands.locale +++ b/data/locale/nederlands.locale @@ -314,6 +314,11 @@ date.Sun Zo date.Thu Do date.Tue Di date.Wed Wo +debug Debug Output +debug.level Level +debug.level_1 normaal +debug.level_2 informatieve +debug.level_3 verbose epg.saving Opslaan EPG epgextended.actors Acteurs epgextended.director Regisseur @@ -1713,8 +1718,8 @@ settings.backup_failed Backup maken mislukt settings.help Help settings.menu_hints Menu hints weergeven settings.menu_pos Menu positie -settings.missingoptionsconffile De instellingen zijn geupdate. \nNieuwe opties zijn standaard ingesteld. -settings.noconffile Geen Neutrino-HD instellingen gevonden.\n Gebruikt standaard instellingen. +settings.missingoptionsconffile De instellingen zijn geupdate.\nNieuwe opties zijn standaard ingesteld. +settings.noconffile Geen Neutrino-HD instellingen gevonden.\nGebruikt standaard instellingen. settings.pos_bottom_left Links onder settings.pos_bottom_right Rechts onder settings.pos_default_center Gecentreerd boven @@ -1724,8 +1729,8 @@ settings.pos_top_right Rechts boven settings.restore Instellingen herstellen settings.restore_warn Alle instellingen zullen vervangen worden.\nDe ontvanger zal opnieuw opstarten\nWilt u verder gaan? shutdown.recoding_query Wilt u de opname stoppen? -shutdowntimer.announce De ontvanger zal binnen 1 minuut uitschakelen./nWilt u het uitschakelen annuleren? -sleeptimerbox.announce De ontvanger zal binnen 1 minunut in standby schakelen./nlWilt u dit annuleren? +shutdowntimer.announce De ontvanger zal binnen 1 minuut uitschakelen.\nWilt u het uitschakelen annuleren? +sleeptimerbox.announce De ontvanger zal binnen 1 minuut in standby schakelen.\nWilt u dit annuleren? sleeptimerbox.hint1 Afsluit tijd in minuten (000=uit) sleeptimerbox.hint2 De ontvanger schakelt zichzelf uit na deze periode in standby. sleeptimerbox.hint3 De ontvanger zal automatisch uitschakelen indien u de afstandsbediening niet gebruikt. diff --git a/data/locale/slovak.locale b/data/locale/slovak.locale index de11ee7c4..51b9187d9 100644 --- a/data/locale/slovak.locale +++ b/data/locale/slovak.locale @@ -316,6 +316,11 @@ date.Sun Ne date.Thu Št date.Tue Ut date.Wed St +debug Debug Output +debug.level Rovina +debug.level_1 normálne +debug.level_2 informatívny +debug.level_3 detail epg.saving Uloženie EPG epgextended.actors Herci epgextended.director Režisér @@ -1726,7 +1731,7 @@ satsetup.extended Nastavenia DiSEqC satsetup.extended_motor Nastavenia motora satsetup.fastscan_all SD a HD satsetup.fastscan_hd len HD -satsetup.fastscan_head Rýchle prehľadanie (Astra 1 - 12515 MHz) +satsetup.fastscan_head Rýchle prehľadanie satsetup.fastscan_prov Poskytovateľ satsetup.fastscan_prov_cd CanalDigitaal satsetup.fastscan_prov_telesat TéléSAT diff --git a/data/satellites.xml b/data/satellites.xml index 6496837e3..d28eb8946 100644 --- a/data/satellites.xml +++ b/data/satellites.xml @@ -1428,11 +1428,11 @@ - + - + @@ -1440,10 +1440,11 @@ + + - - + @@ -1454,7 +1455,6 @@ - @@ -1474,30 +1474,20 @@ - + - + - + - - - - - + + + - - - - - - - - @@ -1505,19 +1495,18 @@ - - - - + + - + + @@ -1525,18 +1514,20 @@ - - + + + + - - + + + - - + diff --git a/lib/libcoolstream2/dmx_cs.h b/lib/libcoolstream2/dmx_cs.h index 2e7630508..df105dcff 100644 --- a/lib/libcoolstream2/dmx_cs.h +++ b/lib/libcoolstream2/dmx_cs.h @@ -23,7 +23,12 @@ #endif #define DMX_FILTER_SIZE MAX_FILTER_LENGTH -#define MAX_DMX_UNITS 5 +#define MAX_DMX_UNITS cDemux::GetCount(DMX_TS) + +typedef enum { + DMX_TS = 0, + DMX_DMA, +} DMX_TYPE; typedef enum { DMX_VIDEO_CHANNEL = 1, @@ -81,5 +86,6 @@ public: int GetSource(); static bool SetSource(int unit, int source); static int GetSource(int unit); + static u32 GetCount(DMX_TYPE Type = DMX_TS); }; #endif //__DMX_CS_H_ diff --git a/lib/libcoolstream2/video_cs.h b/lib/libcoolstream2/video_cs.h index 07310e313..9f15eb8fc 100644 --- a/lib/libcoolstream2/video_cs.h +++ b/lib/libcoolstream2/video_cs.h @@ -130,6 +130,8 @@ typedef enum { VIDEO_STD_1080P25, VIDEO_STD_1080P50, VIDEO_STD_1080P60, + VIDEO_STD_1080P2397, + VIDEO_STD_1080P2997, VIDEO_STD_AUTO, VIDEO_STD_MAX = VIDEO_STD_AUTO } VIDEO_STD; diff --git a/src/Makefile.am b/src/Makefile.am index 2bb2ad126..93478530f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -33,12 +33,10 @@ else VORBISLIBS = -lvorbisfile -lvorbis -logg endif -bin_PROGRAMS = neutrino rcsim +bin_PROGRAMS = neutrino neutrino_SOURCES = neutrino_menue.cpp neutrino.cpp -rcsim_SOURCES = rcsim.c rcsim.h - if ENABLE_FLAC FLACLIBS = -lFLAC else @@ -101,6 +99,7 @@ neutrino_LDADD = \ @CURL_LIBS@ \ @FREETYPE_LIBS@ \ @PNG_LIBS@ \ + @BLURAY_LIBS@ \ @LIBCS_LIBS@ \ @AVFORMAT_LIBS@ \ @AVUTIL_LIBS@ \ @@ -136,11 +135,19 @@ neutrino_LDADD += -lnxp endif endif +if BOXMODEL_APOLLO +neutrino_LDADD += -liconv +endif + bin_PROGRAMS += drivertool drivertool_SOURCES = drivertool.c bin_PROGRAMS += dt dt_SOURCES = dt.c endif +bin_PROGRAMS += rcsim +rcsim_SOURCES = rcsim.c rcsim.h +bin_PROGRAMS += mdev_helper +mdev_helper_SOURCES = mdev_helper.cpp if USE_STB_HAL neutrino_LDADD += \ diff --git a/src/daemonc/remotecontrol.cpp b/src/daemonc/remotecontrol.cpp index 57364ee1e..37109315c 100644 --- a/src/daemonc/remotecontrol.cpp +++ b/src/daemonc/remotecontrol.cpp @@ -443,7 +443,7 @@ void CRemoteControl::processAPIDnames() const char *desc; char lang[4]; - if(g_settings.auto_lang) { + if(g_settings.auto_lang && (current_PIDs.APIDs.size() > 1)) { /* first we check prefs to find pid according to pref index */ for(int i = 0; i < 3; i++) { for(int j = 0; j < (int) current_PIDs.APIDs.size(); j++) { diff --git a/src/driver/file.cpp b/src/driver/file.cpp index 8bbb099b5..aa3002c98 100644 --- a/src/driver/file.cpp +++ b/src/driver/file.cpp @@ -43,7 +43,7 @@ const char * const file_extension_list[] = { "aac", "asf", "avi", "bmp", "cdr", "crw", - "dts", "flac", "gif", "imu", "jpeg", "jpg", + "dts", "flac", "gif", "imu", "iso", "jpeg", "jpg", "m2a", "m3u", "m4a", "mkv", "mp2", "mp3", "mpa", "ogg", "pls", "png", "sh", "txt", "url", "wav", "xml" @@ -53,7 +53,7 @@ const char * const file_extension_list[] = const CFile::FileType file_type_list[] = { CFile::FILE_AAC , CFile::FILE_ASF , CFile::FILE_AVI , CFile::FILE_PICTURE , CFile::FILE_CDR , CFile::FILE_PICTURE , - CFile::FILE_WAV , CFile::FILE_FLAC , CFile::FILE_PICTURE , CFile::STREAM_PICTURE, CFile::FILE_PICTURE , CFile::FILE_PICTURE , + CFile::FILE_WAV , CFile::FILE_FLAC , CFile::FILE_PICTURE , CFile::STREAM_PICTURE, CFile::FILE_ISO , CFile::FILE_PICTURE , CFile::FILE_PICTURE , CFile::FILE_MP3 , CFile::FILE_PLAYLIST , CFile::FILE_AAC , CFile::FILE_MKV , CFile::FILE_MP3 , CFile::FILE_MP3 , CFile::FILE_MP3 , CFile::FILE_OGG , CFile::FILE_PLAYLIST, CFile::FILE_PICTURE , CFile::FILE_TEXT , CFile::FILE_TEXT , CFile::STREAM_AUDIO , CFile::FILE_WAV , CFile::FILE_XML diff --git a/src/driver/file.h b/src/driver/file.h index c807d1bae..1b578ca51 100644 --- a/src/driver/file.h +++ b/src/driver/file.h @@ -60,6 +60,7 @@ public: FILE_AVI, FILE_ASF, FILE_DIR, + FILE_ISO, FILE_TEXT, FILE_CDR, FILE_MP3, diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index d42b6f606..809523849 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -102,6 +102,29 @@ CPictureViewer::CFormathandler * CPictureViewer::fh_getsize (const char *name, i } return (NULL); } +std::string CPictureViewer::DownloadImage(std::string url) +{ + if (strstr(url.c_str(), "://")) { + std::string tmpname = "/tmp/pictureviewer" + url.substr(url.find_last_of(".")); + FILE *tmpFile = fopen(tmpname.c_str(), "wb"); + if (tmpFile) { + CURL *ch = curl_easy_init(); + curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); + curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); + curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, NULL); + curl_easy_setopt(ch, CURLOPT_WRITEDATA, tmpFile); + curl_easy_setopt(ch, CURLOPT_FAILONERROR, 1L); + curl_easy_setopt(ch, CURLOPT_URL, url.c_str()); + curl_easy_perform(ch); + curl_easy_cleanup(ch); + fclose(tmpFile); + url = true; + } + url = tmpname; + } + return url; +} bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign, bool unscaled) { @@ -121,29 +144,9 @@ bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign, if (showBusySign) showBusy (m_startx + 3, m_starty + 3, 10, 0xff, 00, 00); - std::string name = _name; bool url = false; - if (strstr(name.c_str(), "://")) { - std::string tmpname; - tmpname = "/tmp/pictureviewer" + name.substr(name.find_last_of(".")); - FILE *tmpFile = fopen(tmpname.c_str(), "wb"); - if (tmpFile) { - CURL *ch = curl_easy_init(); - curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); - curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); - curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); - curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, NULL); - curl_easy_setopt(ch, CURLOPT_WRITEDATA, tmpFile); - curl_easy_setopt(ch, CURLOPT_FAILONERROR, 1L); - curl_easy_setopt(ch, CURLOPT_URL, name.c_str()); - curl_easy_perform(ch); - curl_easy_cleanup(ch); - fclose(tmpFile); - url = true; - } - name = tmpname; - } + std::string name = DownloadImage(_name); CFormathandler *fh; if (unscaled) @@ -499,6 +502,7 @@ void CPictureViewer::getSize(const char* name, int* width, int *height) } #define LOGO_FLASH_DIR DATADIR "/neutrino/icons/logo" +#define LOGO_FLASH_DIR_VAR "/var/tuxbox/icons/logo" bool CPictureViewer::GetLogoName(const uint64_t& channel_id, const std::string& ChannelName, std::string & name, int *width, int *height) { @@ -523,6 +527,16 @@ bool CPictureViewer::GetLogoName(const uint64_t& channel_id, const std::string& id_tmp_path += strChnId + fileType[i]; v_path.push_back(id_tmp_path); + //create filename with channel name (LOGO_FLASH_DIR_VAR) + id_tmp_path = LOGO_FLASH_DIR_VAR "/"; + id_tmp_path += ChannelName + fileType[i]; + v_path.push_back(id_tmp_path); + + //create filename with id (LOGO_FLASH_DIR_VAR) + id_tmp_path = LOGO_FLASH_DIR_VAR "/"; + id_tmp_path += strChnId + fileType[i]; + v_path.push_back(id_tmp_path); + //create filename with channel name (LOGO_FLASH_DIR) id_tmp_path = LOGO_FLASH_DIR "/"; id_tmp_path += ChannelName + fileType[i]; diff --git a/src/driver/pictureviewer/pictureviewer.h b/src/driver/pictureviewer/pictureviewer.h index 71d8d256f..4326c45d4 100644 --- a/src/driver/pictureviewer/pictureviewer.h +++ b/src/driver/pictureviewer/pictureviewer.h @@ -54,6 +54,7 @@ class CPictureViewer bool ShowImage(const std::string & filename, bool unscaled=false); bool DecodeImage(const std::string & name, bool showBusySign=false, bool unscaled=false); bool DisplayNextImage(); + std::string DownloadImage(std::string url); void SetScaling(ScalingMode s){m_scaling=s;} void SetAspectRatio(float aspect_ratio) {m_aspect=aspect_ratio;} void showBusy(int sx, int sy, int width, char r, char g, char b); diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 02353ef3f..c161b7c6f 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -5,6 +5,7 @@ 2003 thegoodguy Copyright (C) 2008-2012 Stefan Seyfried + Copyright (C) 2013-2014 martii License: GPL @@ -29,6 +30,7 @@ #include #include +#include #include #include @@ -52,13 +54,14 @@ #include #include -#include +//#include +#include #include #include +#include #include //#define RCDEBUG -//#define USE_GETTIMEOFDAY #define ENABLE_REPEAT_CHECK @@ -88,6 +91,8 @@ static bool input_stopped = false; CRCInput::CRCInput() { timerid= 1; + repeatkeys = NULL; + longPressAny = false; // pipe for internal event-queue // ----------------------------- @@ -119,7 +124,7 @@ CRCInput::CRCInput() int clilen; memset(&servaddr, 0, sizeof(struct sockaddr_un)); servaddr.sun_family = AF_UNIX; - strcpy(servaddr.sun_path, NEUTRINO_UDS_NAME); + cstrncpy(servaddr.sun_path, NEUTRINO_UDS_NAME, sizeof(servaddr.sun_path)); clilen = sizeof(servaddr.sun_family) + strlen(servaddr.sun_path); unlink(NEUTRINO_UDS_NAME); @@ -150,7 +155,7 @@ CRCInput::CRCInput() repeat_block = repeat_block_generic = 0; open(); rc_last_key = KEY_MAX; - firstKey = true; + longPressEnd = 0; //select and setup remote control hardware set_rc_hw(); @@ -176,6 +181,8 @@ void CRCInput::open(int dev) //+++++++++++++++++++++++++++++++++++++++ #ifdef KEYBOARD_INSTEAD_OF_REMOTE_CONTROL fd_keyb = STDIN_FILENO; + if (fd_rc[0] < 0) + fd_rc[0] = fd_keyb; #else fd_keyb = 0; #endif /* KEYBOARD_INSTEAD_OF_REMOTE_CONTROL */ @@ -352,13 +359,7 @@ int CRCInput::messageLoop( bool anyKeyCancels, int timeout ) int CRCInput::addTimer(uint64_t Interval, bool oneshot, bool correct_time ) { -#ifdef USE_GETTIMEOFDAY - struct timeval tv; - gettimeofday( &tv, NULL ); - uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t timeNow = time_monotonic_us(); -#endif timer _newtimer; if (!oneshot) @@ -390,19 +391,6 @@ int CRCInput::addTimer(uint64_t Interval, bool oneshot, bool correct_time ) return _newtimer.id; } -#ifdef USE_GETTIMEOFDAY -int CRCInput::addTimer(struct timeval Timeout) -{ - uint64_t timesout = (uint64_t) Timeout.tv_usec + (uint64_t)((uint64_t) Timeout.tv_sec * (uint64_t) 1000000); - return addTimer( timesout, true, false ); -} - -int CRCInput::addTimer(const time_t *Timeout) -{ - return addTimer( (uint64_t)*Timeout* (uint64_t) 1000000, true, false ); -} -#endif - void CRCInput::killTimer(uint32_t &id) { //printf("killing timer %d\n", id); @@ -422,13 +410,7 @@ void CRCInput::killTimer(uint32_t &id) int CRCInput::checkTimers() { int _id = 0; -#ifdef USE_GETTIMEOFDAY - struct timeval tv; - gettimeofday( &tv, NULL ); - uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t timeNow = time_monotonic_us(); -#endif std::vector::iterator e; for ( e= timers.begin(); e!= timers.end(); ++e ) if ( e->times_out< timeNow+ 2000 ) @@ -468,36 +450,18 @@ int CRCInput::checkTimers() int64_t CRCInput::calcTimeoutEnd(const int timeout_in_seconds) { -#ifdef USE_GETTIMEOFDAY - struct timeval tv; - gettimeofday(&tv, NULL); - return (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec + (uint64_t)timeout_in_seconds) * (uint64_t) 1000000; -#else return time_monotonic_us() + ((uint64_t)timeout_in_seconds * (uint64_t) 1000000); -#endif } int64_t CRCInput::calcTimeoutEnd_MS(const int timeout_in_milliseconds) { -#ifdef USE_GETTIMEOFDAY - struct timeval tv; - gettimeofday(&tv, NULL); - uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t timeNow = time_monotonic_us(); -#endif return ( timeNow + timeout_in_milliseconds * 1000 ); } void CRCInput::getMsgAbsoluteTimeout(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint64_t *TimeoutEnd, bool bAllowRepeatLR) { -#ifdef USE_GETTIMEOFDAY - struct timeval tv; - gettimeofday( &tv, NULL ); - uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t timeNow = time_monotonic_us(); -#endif uint64_t diff; if ( *TimeoutEnd < timeNow+ 100 ) @@ -507,16 +471,6 @@ void CRCInput::getMsgAbsoluteTimeout(neutrino_msg_t * msg, neutrino_msg_data_t * //printf("CRCInput::getMsgAbsoluteTimeout diff %llx TimeoutEnd %llx now %llx\n", diff, *TimeoutEnd, timeNow); getMsg_us( msg, data, diff, bAllowRepeatLR ); -#ifdef USE_GETTIMEOFDAY - if ( *msg == NeutrinoMessages::EVT_TIMESET ) - { - // recalculate timeout.... - //uint64_t ta= *TimeoutEnd; - *TimeoutEnd= *TimeoutEnd + *(int64_t*) *data; - - //printf("[getMsgAbsoluteTimeout]: EVT_TIMESET - recalculate timeout\n%llx/%llx - %llx/%llx\n", timeNow, *(int64_t*) *data, *TimeoutEnd, ta ); - } -#endif } void CRCInput::getMsg(neutrino_msg_t * msg, neutrino_msg_data_t * data, int Timeout, bool bAllowRepeatLR) @@ -529,6 +483,43 @@ void CRCInput::getMsg_ms(neutrino_msg_t * msg, neutrino_msg_data_t * data, int T getMsg_us(msg, data, (uint64_t) Timeout * 1000, bAllowRepeatLR); } +uint32_t *CRCInput::setAllowRepeat(uint32_t *rk) { + uint32_t *r = repeatkeys; + repeatkeys = rk; + return r; +} + +bool checkLongPress(uint32_t key); // keybind_setup.cpp + +bool CRCInput::mayLongPress(uint32_t key, bool bAllowRepeatLR) +{ + if (mayRepeat(key, bAllowRepeatLR)) + return false; + if (longPressAny) + return true; + return checkLongPress(key); +} + +bool CRCInput::mayRepeat(uint32_t key, bool bAllowRepeatLR) +{ + if((key == RC_up) || (key == RC_down) + || (key == RC_plus) || (key == RC_minus) + || (key == RC_page_down) || (key == RC_page_up) + || ((bAllowRepeatLR) && ((key == RC_left ) || (key == RC_right)))) + return true; + + if (repeatkeys) { + uint32_t *k = repeatkeys; + while (*k != RC_nokey) { + if (*k == key) { + return true; + } + k++; + } + } + return false; +} + void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint64_t Timeout, bool bAllowRepeatLR) { static uint64_t last_keypress = 0ULL; @@ -544,7 +535,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 int timer_id; fd_set rfds; - t_input_event ev; *data = 0; @@ -559,25 +549,13 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } // wiederholung reinmachen - dass wirklich die ganze zeit bis timeout gewartet wird! -#ifdef USE_GETTIMEOFDAY - gettimeofday( &tv, NULL ); - uint64_t getKeyBegin = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t getKeyBegin = time_monotonic_us(); -#endif + while(1) { - /* we later check for ev.type = EV_SYN which is 0x00, so set something invalid here... */ - memset(&ev, 0, sizeof(ev)); - ev.type = EV_MAX; timer_id = 0; if ( !timers.empty() ) { -#ifdef USE_GETTIMEOFDAY - gettimeofday( &tv, NULL ); - uint64_t t_n= (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); -#else uint64_t t_n = time_monotonic_us(); -#endif if ( timers[0].times_out< t_n ) { timer_id = checkTimers(); @@ -950,12 +928,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 if ((int64_t)last_keypress > *(int64_t*)p) last_keypress += *(int64_t *)p; -#ifdef USE_GETTIMEOFDAY - // Timer anpassen - for(std::vector::iterator e = timers.begin(); e != timers.end(); ++e) - if (e->correct_time) - e->times_out+= *(int64_t*) p; -#endif *msg = NeutrinoMessages::EVT_TIMESET; *data = (neutrino_msg_data_t) p; dont_delete_p = true; @@ -1197,7 +1169,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 *data = (unsigned long) p; dont_delete_p = true; break; - default : printf("[neutrino] event INITID_TIMERD - unknown eventID 0x%x\n", emsg.eventID ); @@ -1205,6 +1176,13 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } else if (emsg.initiatorID == CEventServer::INITID_NEUTRINO) { + printf("CRCInput::getMsg_us: INITID_NEUTRINO: msg %x size %d data %x\n", (int) emsg.eventID, emsg.dataSize, (int) p); + if (emsg.eventID == NeutrinoMessages::EVT_HOTPLUG) { + printf("EVT_HOTPLUG: [%s]\n", (char *) p); + *msg = emsg.eventID; + *data = (neutrino_msg_data_t) p; + dont_delete_p = true; + } #if 0 if ((emsg.eventID == NeutrinoMessages::EVT_RECORDING_ENDED) && (read_bytes == sizeof(stream2file_status2_t))) @@ -1225,10 +1203,21 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } else printf("[neutrino] event - unknown initiatorID 0x%x\n", emsg.initiatorID); - if ( !dont_delete_p ) - { - delete[] p;//new [] delete [] - p= NULL; + + switch (emsg.eventID) { + case NeutrinoMessages::EVT_CURRENTEPG: + case NeutrinoMessages::EVT_NEXTEPG: + { + CSectionsdClient::CurrentNextInfo *cn = (CSectionsdClient::CurrentNextInfo *) p; + delete cn; + p = NULL; + break; + } + default: + if (!dont_delete_p) { + delete[] p; + p = NULL; + } } } } @@ -1249,8 +1238,11 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { if ((fd_rc[i] != -1) && (FD_ISSET(fd_rc[i], &rfds))) { - int ret; - ret = read(fd_rc[i], &ev, sizeof(t_input_event)); + t_input_event ev; + memset(&ev, 0, sizeof(ev)); + /* we later check for ev.type = EV_SYN = 0x00, so set something invalid here... */ + ev.type = EV_MAX; + int ret = read(fd_rc[i], &ev, sizeof(t_input_event)); if (ret != sizeof(t_input_event)) { if (errno == ENODEV) { /* hot-unplugged? */ @@ -1262,19 +1254,44 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 if (ev.type == EV_SYN) continue; /* ignore... */ SHTDCNT::getInstance()->resetSleepTimer(); - if (firstKey) { - firstKey = false; - CTimerManager::getInstance()->cancelShutdownOnWakeup(); - } uint32_t trkey = translate(ev.code); #ifdef _DEBUG printf("key: %04x value %d, translate: %04x -%s-\n", ev.code, ev.value, trkey, getKeyName(trkey).c_str()); #endif if (trkey == RC_nokey) continue; + + if (g_settings.longkeypress_duration > LONGKEYPRESS_OFF) { + uint64_t longPressNow = time_monotonic_us(); + if (ev.value == 0 && longPressEnd) { + if (longPressNow < longPressEnd) { + // Key was a potential long press, but wasn't pressed long enough + longPressEnd = 0; + ev.value = 1; + } else { + // Long-press, key released after time limit + longPressEnd = 0; + continue; + } + } else if (ev.value == 1 && mayLongPress(trkey, bAllowRepeatLR)) { + // A long-press may start here. + longPressEnd = longPressNow + 1000 * g_settings.longkeypress_duration; + rc_last_key = KEY_MAX; + continue; + } else if (ev.value == 2 && longPressEnd) { + if (longPressEnd < longPressNow) { + // Key was pressed long enough. + ev.value = 1; + trkey |= RC_Repeat; + } else { + // Long-press, but key still not released. Skip. + continue; + } + } + } + if (ev.value) { #ifdef RCDEBUG - printf("got keydown native key: %04x %04x, translate: %04x -%s-\n", ev.code, ev.code&0x1f, translate(ev.code, 0), getKeyName(translate(ev.code, 0)).c_str()); printf("rc_last_key %04x rc_last_repeat_key %04x\n\n", rc_last_key, rc_last_repeat_key); #endif uint64_t now_pressed; @@ -1282,21 +1299,17 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 tv = ev.time; now_pressed = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); - if (ev.code == rc_last_key) { + if (trkey == rc_last_key) { /* only allow selected keys to be repeated */ - /* (why?) */ - if( (trkey == RC_up) || (trkey == RC_down ) || - (trkey == RC_plus ) || (trkey == RC_minus ) || - (trkey == RC_page_down ) || (trkey == RC_page_up ) || - ((bAllowRepeatLR) && ((trkey == RC_left ) || (trkey == RC_right))) || - (g_settings.shutdown_real_rcdelay && ((trkey == RC_standby) && (g_info.hw_caps->can_shutdown)))) + if (mayRepeat(trkey, bAllowRepeatLR) || + (g_settings.shutdown_real_rcdelay && ((trkey == RC_standby) && (g_info.hw_caps->can_shutdown)))) { #ifdef ENABLE_REPEAT_CHECK - if (rc_last_repeat_key != ev.code) { + if (rc_last_repeat_key != trkey) { if ((now_pressed > last_keypress + repeat_block) || /* accept all keys after time discontinuity: */ (now_pressed < last_keypress)) - rc_last_repeat_key = ev.code; + rc_last_repeat_key = trkey; else keyok = false; } @@ -1308,7 +1321,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 else rc_last_repeat_key = KEY_MAX; - rc_last_key = ev.code; + rc_last_key = trkey; if (keyok) { #ifdef ENABLE_REPEAT_CHECK @@ -1329,9 +1342,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } /* if (ev.value) */ else { // clear rc_last_key on keyup event -#ifdef RCDEBUG - printf("got keyup native key: %04x %04x, translate: %04x -%s-\n", ev.code, ev.code&0x1f, translate(ev.code, 0), getKeyName(translate(ev.code, 0)).c_str() ); -#endif rc_last_key = KEY_MAX; if (trkey == RC_standby) { *msg = RC_standby; @@ -1341,8 +1351,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } }/* if FDSET */ } /* for NUMBER_OF_EVENT_DEVICES */ - if (ev.type == EV_SYN) - continue; /* ignore... */ if(FD_ISSET(fd_pipe_low_priority[0], &rfds)) { @@ -1368,12 +1376,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 else { //timeout neu kalkulieren -#ifdef USE_GETTIMEOFDAY - gettimeofday( &tv, NULL ); - int64_t getKeyNow = (int64_t) tv.tv_usec + (int64_t)((int64_t) tv.tv_sec * (int64_t) 1000000); -#else int64_t getKeyNow = time_monotonic_us(); -#endif int64_t diff = (getKeyNow - getKeyBegin); if( Timeout <= (uint64_t) diff ) { @@ -1447,21 +1450,21 @@ unsigned int CRCInput::convertDigitToKey(const unsigned int digit) } /************************************************************************** -* getUnicodeValue - return unicode value of the key or -1 +* getUnicodeValue - return unicode value of the key or \0 * **************************************************************************/ #define UNICODE_VALUE_SIZE 58 -static const int unicode_value[UNICODE_VALUE_SIZE] = {-1 , -1 , '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', -1 , -1 , - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', -1 , -1 , 'A', 'S', - 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', -1 /* FIXME */, -1 /* FIXME */, -1 , '\\', 'Z', 'X', 'C', 'V', - 'B', 'N', 'M', ',', '.', '/', -1, -1, -1, ' '}; +static const char unicode_value[UNICODE_VALUE_SIZE * 2] = + "\0\0" "\0\0" "1\0" "2\0" "3\0" "4\0" "5\0" "6\0" "7\0" "8\0" "9\0" "0\0" "-\0" "=\0" "\0\0" "\0\0" + "Q\0" "W\0" "E\0" "R\0" "T\0" "Y\0" "U\0" "I\0" "O\0" "P\0" "{\0" "}\0" "\0\0" "\0\0" "A\0" "S\0" + "D\0" "F\0" "G\0" "H\0" "J\0" "K\0" "L\0" ";\0" "'\0" "\140\0" "\0\0" "\\\0" "Z\0" "X\0" "C\0" "V\0" + "B\0" "N\0" "M\0" "\0\0" ".\0" "/\0" "\0\0" "\0\0" "\0\0" " "; -int CRCInput::getUnicodeValue(const neutrino_msg_t key) +const char *CRCInput::getUnicodeValue(const neutrino_msg_t key) { if (key < UNICODE_VALUE_SIZE) - return unicode_value[key]; - else - return -1; + return unicode_value + key * 2; + return ""; } /************************************************************************** @@ -1524,20 +1527,6 @@ const char * CRCInput::getSpecialKeyName(const unsigned int key) return "radio"; case RC_text: return "text"; -#if 0 - case RC_shift_red: - return "shift-red"; - case RC_shift_green: - return "shift-green"; - case RC_shift_yellow: - return "shift-yellow"; - case RC_shift_blue: - return "shift-blue"; - case RC_shift_tv: - return "shift-tv"; - case RC_shift_radio: - return "shift-radio"; -#endif case RC_epg: return "epg"; case RC_recall: @@ -1606,21 +1595,18 @@ const char * CRCInput::getSpecialKeyName(const unsigned int key) std::string CRCInput::getKeyName(const unsigned int key) { - return (std::string)getKeyNameC(key); + std::string res(getKeyNameC(key & ~RC_Repeat)); + if ((key & RC_Repeat) && res != "unknown") + res += " (long)"; + return res; } const char *CRCInput::getKeyNameC(const unsigned int key) { - int lunicode_value = getUnicodeValue(key); - if (lunicode_value == -1) - return getSpecialKeyName(key); - else - { - static char tmp[2]; - tmp[0] = lunicode_value; - tmp[1] = 0; - return tmp; - } + const char *lunicode_value = getUnicodeValue(key); + if (*lunicode_value) + return lunicode_value; + return getSpecialKeyName(key); } /************************************************************************** @@ -1631,9 +1617,9 @@ int CRCInput::translate(int code) { switch(code) { - case 0x100: + case 0x100: // FIXME -- needed? return RC_up; - case 0x101: + case 0x101: // FIXME -- needed? return RC_down; #ifdef HAVE_AZBOX_HARDWARE case KEY_HOME: diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index b2015351f..99dc6f149 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -141,6 +141,9 @@ class CRCInput uint32_t timerid; std::vector timers; + uint32_t *repeatkeys; + uint64_t longPressEnd; + bool longPressAny; int fd_pipe_high_priority[2]; int fd_pipe_low_priority[2]; int fd_gamerc; @@ -155,7 +158,6 @@ class CRCInput int fd_max; int clickfd; - bool firstKey; __u16 rc_last_key; void set_dsp(); @@ -164,6 +166,8 @@ class CRCInput int translate(int code); void calculateMaxFd(void); int checkTimers(); + bool mayRepeat(uint32_t key, bool bAllowRepeatLR = false); + bool mayLongPress(uint32_t key, bool bAllowRepeatLR = false); #ifdef IOC_IR_SET_PRI_PROTOCOL void set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address); #endif @@ -290,7 +294,8 @@ class CRCInput static bool isNumeric(const neutrino_msg_t key); static int getNumericValue(const neutrino_msg_t key); static unsigned int convertDigitToKey(const unsigned int digit); - static int getUnicodeValue(const neutrino_msg_t key); + static const char *getUnicodeValue(const neutrino_msg_t key); + uint32_t *setAllowRepeat(uint32_t *); static const char * getSpecialKeyName(const unsigned int key); static const char *getKeyNameC(const unsigned int key); @@ -317,6 +322,8 @@ class CRCInput void close_click(); void play_click(); void reset_dsp(int rate); + + void setLongPressAny(bool b) { longPressAny = b; }; }; diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 586545ee3..e91769897 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -97,7 +97,6 @@ CRecordInstance::CRecordInstance(const CTimerd::RecordingInfo * const eventinfo, cMovieInfo = new CMovieInfo(); recMovieInfo = new MI_MOVIE_INFO(); record = NULL; - tshift_mode = TSHIFT_MODE_OFF; rec_stop_msg = g_Locale->getText(LOCALE_RECORDING_STOP); } @@ -260,6 +259,7 @@ bool CRecordInstance::Stop(bool remove_event) hintBox.paint(); printf("%s: channel %" PRIx64 " recording_id %d\n", __func__, channel_id, recording_id); + printf("%s: file %s.ts\n", __FUNCTION__, filename); SaveXml(); /* Stop do close fd - if started */ record->Stop(); @@ -450,15 +450,19 @@ record_error_msg_t CRecordInstance::Record() //FIXME recording_id (timerd eventID) is 0 means its user recording, in this case timer always added ? if(ret == RECORD_OK && recording_id == 0) { time_t now = time(NULL); - int record_end = now+g_settings.record_hours*60*60; - if (g_settings.recording_epg_for_end) - { - int pre=0, post=0; - CEPGData epgData; - if (CEitManager::getInstance()->getActualEPGServiceKey(channel_id, &epgData )) { - g_Timerd->getRecordingSafety(pre, post); - if (epgData.epg_times.startzeit > 0) - record_end = epgData.epg_times.startzeit + epgData.epg_times.dauer + post; + int record_end; + if (autoshift) { + record_end = now+g_settings.timeshift_hours*60*60; + } else { + record_end = now+g_settings.record_hours*60*60; + if (g_settings.recording_epg_for_end) { + int pre=0, post=0; + CEPGData epgData; + if (CEitManager::getInstance()->getActualEPGServiceKey(channel_id, &epgData )) { + g_Timerd->getRecordingSafety(pre, post); + if (epgData.epg_times.startzeit > 0) + record_end = epgData.epg_times.startzeit + epgData.epg_times.dauer + post; + } } } recording_id = g_Timerd->addImmediateRecordTimerEvent(channel_id, now, record_end, epgid, epg_time, apidmode); @@ -676,25 +680,13 @@ record_error_msg_t CRecordInstance::MakeFileName(CZapitChannel * channel) strncat(filename, "_",FILENAMEBUFFERSIZE - strlen(filename)-1); } - pos = strlen(filename); - if (g_settings.recording_epg_for_filename) { - if(epgid != 0) { - CShortEPGData epgdata; - if(CEitManager::getInstance()->getEPGidShort(epgid, &epgdata)) { - if (!(epgdata.title.empty())) { - strcpy(&(filename[pos]), epgdata.title.c_str()); - ZapitTools::replace_char(&filename[pos]); - } - } - } else if (!epgTitle.empty()) { - strcpy(&(filename[pos]), epgTitle.c_str()); - ZapitTools::replace_char(&filename[pos]); - } - } + pos = strlen(filename) - ((!autoshift && g_settings.recording_save_in_channeldir) ? 0 : (ext_channel_name.length() /*remove last "_"*/ +1)); + + std::string ext_file_name = g_settings.recording_filename_template; + MakeExtFileName(channel, ext_file_name); + strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(ext_file_name.c_str())); pos = strlen(filename); - time_t t = time(NULL); - pos += strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t)); if(autoshift) strncat(filename, "_temp",FILENAMEBUFFERSIZE - strlen(filename)-1); @@ -702,6 +694,60 @@ record_error_msg_t CRecordInstance::MakeFileName(CZapitChannel * channel) return RECORD_OK; } +void CRecordInstance::StringReplace(std::string &str, const std::string search, const std::string rstr) +{ + std::string::size_type ptr = 0; + std::string::size_type pos = 0; + while((ptr = str.find(search,pos)) != std::string::npos){ + str.replace(ptr,search.length(),rstr); + pos = ptr + rstr.length(); + } +} + +void CRecordInstance::MakeExtFileName(CZapitChannel * channel, std::string &FilenameTemplate) +{ + char buf[256]; + + // %C == channel, %T == title, %I == info1, %d == date, %t == time_t + if (FilenameTemplate.empty()) + FilenameTemplate = "%C_%T_%d_%t"; + + time_t t = time(NULL); + strftime(buf,sizeof(buf),"%Y%m%d",localtime(&t)); + StringReplace(FilenameTemplate,"%d",buf); + + strftime(buf,sizeof(buf),"%H%M%S",localtime(&t)); + StringReplace(FilenameTemplate,"%t",buf); + + std::string channel_name = channel->getName(); + if (!(channel_name.empty())) { + strcpy(buf, UTF8_TO_FILESYSTEM_ENCODING(channel_name.c_str())); + ZapitTools::replace_char(buf); + StringReplace(FilenameTemplate,"%C",buf); + } + else + StringReplace(FilenameTemplate,"%C","no_channel"); + + CShortEPGData epgdata; + if(CEitManager::getInstance()->getEPGidShort(epgid, &epgdata)) { + if (!(epgdata.title.empty())) { + strcpy(buf, epgdata.title.c_str()); + ZapitTools::replace_char(buf); + StringReplace(FilenameTemplate,"%T",buf); + } + else + StringReplace(FilenameTemplate,"%T","no_title"); + + if (!(epgdata.info1.empty())) { + strcpy(buf, epgdata.info1.c_str()); + ZapitTools::replace_char(buf); + StringReplace(FilenameTemplate,"%I",buf); + } + else + StringReplace(FilenameTemplate,"%I","no_info"); + } +} + void CRecordInstance::GetRecordString(std::string &str, std::string &dur) { CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); @@ -832,28 +878,6 @@ const std::string CRecordManager::GetFileName(t_channel_id channel_id, bool time /* return record mode mask, for channel_id not 0, or global */ int CRecordManager::GetRecordMode(const t_channel_id channel_id) { -#if 0 - if (RecordingStatus(channel_id) || IsTimeshift(channel_id)) - { - if (RecordingStatus(channel_id) && !IsTimeshift(channel_id)) - return RECMODE_REC; - if (channel_id == 0) - { - int records = GetRecordCount(); - if (IsTimeshift(channel_id) && (records == 1)) - return RECMODE_TSHIFT; - else if (IsTimeshift(channel_id) && (records > 1)) - return RECMODE_REC_TSHIFT; - else - return RECMODE_OFF; - } else - { - if (IsTimeshift(channel_id)) - return RECMODE_TSHIFT; - } - } - return RECMODE_OFF; -#endif int recmode = RECMODE_OFF; mutex.lock(); if (channel_id == 0) { @@ -913,10 +937,6 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons if (g_settings.recording_type == CNeutrinoApp::RECORDING_OFF) return false; -#if 0 - if(!CheckRecording(eventinfo)) - return false; -#endif #if 1 // FIXME test StopSectionsd = false; @@ -926,18 +946,6 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons RunStartScript(); mutex.lock(); -#if 0 - inst = FindInstance(eventinfo->channel_id); - if(inst) { - if(direct_record) { - error_msg = RECORD_BUSY; - } else { - CTimerd::RecordingInfo * evt = new CTimerd::RecordingInfo(*eventinfo); - printf("%s add %llx : %s to pending\n", __FUNCTION__, evt->channel_id, evt->epgTitle); - nextmap.push_back((CTimerd::RecordingInfo *)evt); - } - } else -#endif if(recmap.size() < RECORD_MAX_COUNT) { CFrontend * frontend = NULL; if(CutBackNeutrino(eventinfo->channel_id, frontend)) { @@ -1034,18 +1042,6 @@ bool CRecordManager::StopAutoRecord(bool lock) return (inst != NULL); } -#if 0 -bool CRecordManager::CheckRecording(const CTimerd::RecordingInfo * const eventinfo) -{ - t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); - /* FIXME check if frontend used for timeshift the same and will zap ?? */ - if(/*(eventinfo->channel_id == live_channel_id) ||*/ !SAME_TRANSPONDER(eventinfo->channel_id, live_channel_id)) - StopAutoRecord(); - - return true; -} -#endif - void CRecordManager::StartNextRecording() { CTimerd::RecordingInfo * eventinfo = NULL; @@ -1053,25 +1049,6 @@ void CRecordManager::StartNextRecording() for(nextmap_iterator_t it = nextmap.begin(); it != nextmap.end(); it++) { eventinfo = *it; -#if 0 - bool tested = true; - if( !recmap.empty() ) { - CRecordInstance * inst = FindInstance(eventinfo->channel_id); - /* same channel recording and not auto - skip */ - if(inst && !inst->Timeshift()) - tested = false; - /* there is only auto-record which can be stopped */ - else if(recmap.size() == 1 && autoshift) - tested = true; - else { - /* there are some recordings, test any (first) for now */ - recmap_iterator_t fit = recmap.begin(); - t_channel_id channel_id = fit->second->GetChannelId(); - tested = (SAME_TRANSPONDER(channel_id, eventinfo->channel_id)); - } - } - if(tested) -#endif CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(eventinfo->channel_id); if (channel && CFEManager::getInstance()->canTune(channel)) { @@ -1140,11 +1117,6 @@ void CRecordManager::StopInstance(CRecordInstance * inst, bool remove_event) if(inst->Timeshift()) autoshift = false; -#if 0 - t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); - if(inst->GetChannelId() == live_channel_id) - recordingstatus = 0; -#endif delete inst; } @@ -1278,47 +1250,6 @@ int CRecordManager::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data return messages_return::unhandled; } -#if 0 -bool CRecordManager::IsTimeshift(t_channel_id channel_id) -{ - bool ret = false; - CRecordInstance * inst; - mutex.lock(); - if (channel_id != 0) - { - inst = FindInstance(channel_id); - if(inst && inst->tshift_mode) - ret = true; - else - ret = false; - } else - { - for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) - { - if(it->second->tshift_mode) - { - mutex.unlock(); - return true; - } - } - } - mutex.unlock(); - return ret; -} - -void CRecordManager::SetTimeshiftMode(CRecordInstance * inst, int mode) -{ - mutex.lock(); - /* reset all instances mode ? */ - for(recmap_iterator_t it = recmap.begin(); it != recmap.end(); it++) - it->second->tshift_mode = TSHIFT_MODE_OFF; - - mutex.unlock(); - if (inst) - inst->tshift_mode = mode; -} -#endif - void CRecordManager::StartTimeshift() { if(g_RemoteControl->is_video_started) @@ -1326,26 +1257,6 @@ void CRecordManager::StartTimeshift() std::string tmode = "ptimeshift"; // already recording, pause bool res = true; t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); -#if 0 - if(RecordingStatus(live_channel_id)) - { - tmode = "ptimeshift"; // already recording, pause - if(GetRecordMode(live_channel_id) == RECMODE_TSHIFT) - SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_PAUSE); - } else - { - if(g_settings.temp_timeshift) - { - res = StartAutoRecord(); - SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_TEMPORAER); - } else - { - res = Record(live_channel_id); - SetTimeshiftMode(FindInstance(live_channel_id), TSHIFT_MODE_PERMANET); - } - tmode = "timeshift"; // record just started - } -#endif /* start temporary timeshift if enabled and not running, but dont start second record */ if (g_settings.temp_timeshift) { if (!FindTimeshift()) { @@ -1427,10 +1338,6 @@ int CRecordManager::exec(CMenuTarget* parent, const std::string & actionKey ) return menu_return::RETURN_EXIT_ALL; } -#if 0 - else - DisplayInfoMessage(g_Locale->getText(LOCALE_RECORDING_IS_RUNNING)); -#endif } else if(actionKey == "Timeshift") { StartTimeshift(); @@ -1497,7 +1404,6 @@ bool CRecordManager::ShowMenu(void) durations.push_back(duration); const char* mode_icon = NEUTRINO_ICON_REC; - //if (inst->tshift_mode) if (inst->Timeshift()) mode_icon = NEUTRINO_ICON_AUTO_SHIFT; @@ -1551,7 +1457,6 @@ bool CRecordManager::ShowMenu(void) bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid) { - //int recording_id = 0; std::string title, duration; CRecordInstance * inst; @@ -1562,7 +1467,6 @@ bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid) inst = FindInstance(channel_id); if(inst) { - //recording_id = inst->GetRecordingId(); inst->GetRecordString(title, duration); title += duration; } @@ -1572,9 +1476,6 @@ bool CRecordManager::AskToStop(const t_channel_id channel_id, const int recid) if(ShowMsg(LOCALE_SHUTDOWN_RECODING_QUERY, title.c_str(), CMessageBox::mbrYes, CMessageBox::mbYes | CMessageBox::mbNo, NULL, 450, 30, false) == CMessageBox::mbrYes) { -#if 0 - g_Timerd->stopTimerEvent(recording_id); -#endif mutex.lock(); if (recid) inst = FindInstanceID(recid); diff --git a/src/driver/record.h b/src/driver/record.h index ca2c7b539..eb69837cf 100644 --- a/src/driver/record.h +++ b/src/driver/record.h @@ -82,6 +82,7 @@ class CRecordInstance t_channel_id channel_id; event_id_t epgid; std::string epgTitle; + std::string epgInfo1; unsigned char apidmode; time_t epg_time; time_t start_time; @@ -110,7 +111,9 @@ class CRecordInstance bool SaveXml(); record_error_msg_t Start(CZapitChannel * channel); void WaitRecMsg(time_t StartTime, time_t WaitTime); - public: + void MakeExtFileName(CZapitChannel * channel, std::string &FilenameTemplate); + void StringReplace(std::string &str, const std::string search, const std::string rstr); + public: CRecordInstance(const CTimerd::RecordingInfo * const eventinfo, std::string &dir, bool timeshift = false, bool stream_vtxt_pid = false, bool stream_pmt_pid = false, bool stream_subtitle_pids = false); ~CRecordInstance(); @@ -166,14 +169,12 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/ bool CutBackNeutrino(const t_channel_id channel_id, CFrontend * &frontend); void RestoreNeutrino(void); - bool CheckRecording(const CTimerd::RecordingInfo * const eventinfo); void StartNextRecording(); void StopPostProcess(); void StopInstance(CRecordInstance * inst, bool remove_event = true); CRecordInstance * FindInstance(t_channel_id); CRecordInstance * FindInstanceID(int recid); CRecordInstance * FindTimeshift(); - //void SetTimeshiftMode(CRecordInstance * inst=NULL, int mode=TSHIFT_MODE_OFF); public: enum record_modes_t @@ -228,7 +229,6 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/ CRecordInstance* getRecordInstance(std::string file); // old code #if 0 - bool IsTimeshift(t_channel_id channel_id=0); bool MountDirectory(const char *recordingDir); bool ChooseRecDir(std::string &dir); int recordingstatus; diff --git a/src/driver/scanepg.cpp b/src/driver/scanepg.cpp index a2bd09bc6..db30ed3f1 100644 --- a/src/driver/scanepg.cpp +++ b/src/driver/scanepg.cpp @@ -37,11 +37,13 @@ #include #include +#include #define EPG_RESCAN_TIME (24*60*60) extern CBouquetList * bouquetList; extern CBouquetList * TVfavList; +extern CBouquetList * TVbouquetList; CEpgScan::CEpgScan() { @@ -71,11 +73,12 @@ void CEpgScan::Clear() current_bmode = -1; next_chid = 0; allfav_done = false; + selected_done = false; } bool CEpgScan::Running() { - return (g_settings.epg_scan && !scanmap.empty()); + return (CheckMode() && !scanmap.empty()); } void CEpgScan::AddBouquet(CChannelList * clist) @@ -90,7 +93,7 @@ void CEpgScan::AddBouquet(CChannelList * clist) bool CEpgScan::AddFavorites() { INFO("allfav_done: %d", allfav_done); - if ((g_settings.epg_scan != 2) || allfav_done) + if ((g_settings.epg_scan != SCAN_FAV) || allfav_done) return false; allfav_done = true; @@ -103,6 +106,30 @@ bool CEpgScan::AddFavorites() return (old_size != scanmap.size()); } +bool CEpgScan::AddSelected() +{ + INFO("selected_done: %d", selected_done); + if ((g_settings.epg_scan != SCAN_SEL) || selected_done) + return false; + + selected_done = true; + unsigned old_size = scanmap.size(); + for (unsigned j = 0; j < TVfavList->Bouquets.size(); ++j) { + if (TVfavList->Bouquets[j]->zapitBouquet && TVfavList->Bouquets[j]->zapitBouquet->bScanEpg) { + CChannelList * clist = TVfavList->Bouquets[j]->channelList; + AddBouquet(clist); + } + } + for (unsigned j = 0; j < TVbouquetList->Bouquets.size(); ++j) { + if (TVbouquetList->Bouquets[j]->zapitBouquet && TVbouquetList->Bouquets[j]->zapitBouquet->bScanEpg) { + CChannelList * clist = TVbouquetList->Bouquets[j]->channelList; + AddBouquet(clist); + } + } + INFO("scan map size: %d -> %d\n", old_size, scanmap.size()); + return (old_size != scanmap.size()); +} + void CEpgScan::AddTransponders() { if(bouquetList->Bouquets.empty()) @@ -114,7 +141,25 @@ void CEpgScan::AddTransponders() } int mode = CNeutrinoApp::getInstance()->GetChannelMode(); - if ((g_settings.epg_scan == 1) || (mode == LIST_MODE_FAV)) { + if (g_settings.epg_scan == SCAN_SEL) { + if (current_bmode != mode) { + current_bmode = mode; + current_bnum = -1; + } + int bnum = bouquetList->getActiveBouquetNumber(); + bool bscan = bouquetList->Bouquets[bnum]->zapitBouquet && + bouquetList->Bouquets[bnum]->zapitBouquet->bScanEpg; + + if ((current_bnum != bnum) && bscan) { + current_bnum = bnum; + AddBouquet(bouquetList->Bouquets[current_bnum]->channelList); + } else { + AddSelected(); + } + return; + } + + if ((g_settings.epg_scan == SCAN_CURRENT) || (mode == LIST_MODE_FAV)) { /* current bouquet mode */ if (current_bmode != mode) { current_bmode = mode; @@ -132,17 +177,23 @@ void CEpgScan::AddTransponders() } } +bool CEpgScan::CheckMode() +{ + if (!g_settings.epg_scan + || (standby && !(g_settings.epg_scan_mode & MODE_STANDBY)) + || (!standby && !(g_settings.epg_scan_mode & MODE_LIVE)) + || (!standby && (CFEManager::getInstance()->getEnabledCount() <= 1))) { + return false; + } + return true; + +} + void CEpgScan::Start(bool instandby) { - if (!g_settings.epg_scan) - return; - if (!instandby && (CFEManager::getInstance()->getEnabledCount() <= 1)) - return; - + standby = instandby; live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); AddTransponders(); - standby = instandby; - //g_RCInput->killTimer(rescan_timer); INFO("starting %s scan, scanning %d, scan map size: %d", standby ? "standby" : "live", scan_in_progress, scanmap.size()); if (standby || !scan_in_progress) Next(); @@ -167,14 +218,16 @@ int CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) scanned.clear(); Clear(); g_RCInput->killTimer(rescan_timer); - if (standby || (CFEManager::getInstance()->getEnabledCount() > 1)) { + if (CheckMode()) { if (standby) - g_Zapit->setStandby(false); + CNeutrinoApp::getInstance()->wakeupFromStandby(); Start(standby); + } else { + AddTimer(); } return messages_return::handled; } - if (!g_settings.epg_scan || (!standby && (CFEManager::getInstance()->getEnabledCount() <= 1))) { + if (!CheckMode()) { int ret = messages_return::handled; if (msg == NeutrinoMessages::EVT_EIT_COMPLETE) scan_in_progress = false; @@ -232,36 +285,44 @@ int CEpgScan::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) return messages_return::unhandled; } -void CEpgScan::EnterStandby() +void CEpgScan::AddTimer() { - if (standby) { - CZapit::getInstance()->SetCurrentChannelID(live_channel_id); - //CZapit::getInstance()->EnablePlayback(true); - g_Zapit->setStandby(true); - g_Sectionsd->setPauseScanning(true); - } - //g_RCInput->killTimer(rescan_timer); if (rescan_timer == 0) rescan_timer = g_RCInput->addTimer(EPG_RESCAN_TIME*1000ULL*1000ULL, true); INFO("rescan timer id %d", rescan_timer); } +void CEpgScan::EnterStandby() +{ + AddTimer(); + if (standby) { + CZapit::getInstance()->SetCurrentChannelID(live_channel_id); + CNeutrinoApp::getInstance()->standbyToStandby(); + } +} + void CEpgScan::Next() { bool locked = false; next_chid = 0; +#if 0 if (!g_settings.epg_scan) return; + if (!CheckMode()) + return; +#endif if (!standby && CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) return; - if (CRecordManager::getInstance()->RecordingStatus()) + if (CRecordManager::getInstance()->RecordingStatus() || CStreamManager::getInstance()->StreamStatus()) return; - if (g_settings.epg_scan == 2 && scanmap.empty()) + if (g_settings.epg_scan == SCAN_FAV && scanmap.empty()) AddFavorites(); + if (g_settings.epg_scan == SCAN_SEL && scanmap.empty()) + AddSelected(); - if (scanmap.empty()) { + if (!CheckMode() || scanmap.empty()) { EnterStandby(); return; } @@ -299,7 +360,9 @@ _repeat: INFO("skip [%s], cannot tune", newchan->getName().c_str()); ++it; } - if (!next_chid && AddFavorites()) + if (!next_chid && ((g_settings.epg_scan == SCAN_FAV) && AddFavorites())) + goto _repeat; + if (!next_chid && ((g_settings.epg_scan == SCAN_SEL) && AddSelected())) goto _repeat; if (locked) { diff --git a/src/driver/scanepg.h b/src/driver/scanepg.h index 07057494e..989e2a63b 100644 --- a/src/driver/scanepg.h +++ b/src/driver/scanepg.h @@ -28,11 +28,24 @@ typedef eit_scanmap_t::iterator eit_scanmap_iterator_t; class CEpgScan { + public: + enum { + SCAN_OFF, + SCAN_CURRENT, + SCAN_FAV, + SCAN_SEL + }; + enum { + MODE_LIVE = 0x1, + MODE_STANDBY = 0x2, + MODE_ALWAYS = 0x3 + }; private: int current_bnum; int current_mode; int current_bmode; bool allfav_done; + bool selected_done; bool standby; eit_scanmap_t scanmap; t_channel_id next_chid; @@ -43,8 +56,11 @@ class CEpgScan void AddBouquet(CChannelList * clist); bool AddFavorites(); + bool AddSelected(); void AddTransponders(); void EnterStandby(); + bool CheckMode(); + void AddTimer(); CEpgScan(); public: diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 857a4f4fc..4e66460a2 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -1,9 +1,7 @@ /* Neutrino-GUI - DBoxII-Project - Copyright (C) 2011-2012 CoolStream International Ltd - - Copyright (C) 2010-2012, 2014 Stefan Seyfried + Copyright (C) 2011-2014 CoolStream International Ltd based on code which is Copyright (C) 2002 Andreas Oberritter @@ -58,17 +56,12 @@ #include #include #include -#include - -/* defined in neutrino.cpp */ -extern cCpuFreqManager * cpuFreq; /* experimental mode: * stream not possible, if record running * pids in url ignored, and added from channel, with fake PAT/PMT - * different channels supported, only from the same transponder - no zap is done, + * different channels supported, * with url like http://coolstream:31339/id=c32400030070283e (channel id) - * TODO: multi-tuner support */ #define ENABLE_MULTI_CHANNEL @@ -120,23 +113,28 @@ bool CStreamInstance::Stop() bool CStreamInstance::Send(ssize_t r) { + //OpenThreads::ScopedLock m_lock(mutex); + stream_fds_t cfds; mutex.lock(); - for (stream_fds_t::iterator it = fds.begin(); it != fds.end(); ++it) { - int ret, i = 10; - do { - ret = send(*it, buf, r, MSG_DONTWAIT); -#if 0 - if (ret != r) - usleep(100); -#endif - } while ((ret != r) && (i-- > 0)); - if (ret != r) { - if (r < 0) - perror("send"); - printf("send err, fd %d: (%d from %d)\n", *it, ret, (int)r); - } - } + cfds = fds; mutex.unlock(); + int flags = 0; + if (cfds.size() > 1) + flags = MSG_DONTWAIT; + for (stream_fds_t::iterator it = cfds.begin(); it != cfds.end(); ++it) { + int i = 10; + unsigned char *b = buf; + ssize_t count = r; + do { + int ret = send(*it, b, count, flags); + if (ret > 0) { + b += ret; + count -= ret; + } + } while ((count > 0) && (i-- > 0)); + if (count) + printf("send err, fd %d: (%d from %d)\n", *it, r-count, r); + } return true; } @@ -149,35 +147,23 @@ void CStreamInstance::Close() void CStreamInstance::AddClient(int clientfd) { - mutex.lock(); + OpenThreads::ScopedLock m_lock(mutex); fds.insert(clientfd); printf("CStreamInstance::AddClient: %d (count %d)\n", clientfd, (int)fds.size()); - mutex.unlock(); } void CStreamInstance::RemoveClient(int clientfd) { - mutex.lock(); + OpenThreads::ScopedLock m_lock(mutex); fds.erase(clientfd); close(clientfd); printf("CStreamInstance::RemoveClient: %d (count %d)\n", clientfd, (int)fds.size()); - mutex.unlock(); } void CStreamInstance::run() { printf("CStreamInstance::run: %" PRIx64 "\n", channel_id); -#if 0 -// TODO: check if this works... #ifndef HAVE_COOL_HARDWARE - /* right now, only one stream is possible anyway and it is not possible - * to stream a different channel than the live channel AFAICT, so we can - * as well use the live demux */ - dmx = new cDemux(0); -#endif -#if 0 - dmx = new cDemux(STREAM_DEMUX);//FIXME -#endif CZapitChannel * tmpchan = CServiceManager::getInstance()->FindChannel(channel_id); if (!tmpchan) return; @@ -204,7 +190,7 @@ void CStreamInstance::run() while (running) { ssize_t r = dmx->Read(buf, IN_SIZE, 100); - if(r > 0) + if (r > 0) Send(r); } @@ -265,7 +251,10 @@ bool CStreamManager::Stop() if (!running) return false; running = false; - return (OpenThreads::Thread::join() == 0); + cancel(); + bool ret = (OpenThreads::Thread::join() == 0); + StopAll(); + return ret; } bool CStreamManager::SetPort(int newport) @@ -286,13 +275,83 @@ bool CStreamManager::SetPort(int newport) return ret; } -bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) +CFrontend * CStreamManager::FindFrontend(CZapitChannel * channel) +{ + std::set frontends; + CFrontend * frontend = NULL; + + t_channel_id chid = channel->getChannelID(); + if (CRecordManager::getInstance()->RecordingStatus(chid)) { + printf("CStreamManager::Parse: channel %llx recorded, aborting..\n", chid); + return frontend; + } + + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); + CFrontend *live_fe = CZapit::getInstance()->GetLiveFrontend(); + + if (live_channel_id == chid) + return live_fe; + + CFEManager::getInstance()->Lock(); + + bool unlock = true; + CFEManager::getInstance()->lockFrontend(live_fe); + + OpenThreads::ScopedLock m_lock(mutex); + for (streammap_iterator_t it = streams.begin(); it != streams.end(); ++it) + frontends.insert(it->second->frontend); + + for (std::set::iterator ft = frontends.begin(); ft != frontends.end(); ft++) + CFEManager::getInstance()->lockFrontend(*ft); + + frontend = CFEManager::getInstance()->allocateFE(channel, true); + + if (frontend == NULL) { + unlock = false; + CFEManager::getInstance()->unlockFrontend(live_fe); + frontend = CFEManager::getInstance()->allocateFE(channel, true); + } + + CFEManager::getInstance()->Unlock(); + + if (frontend) { + bool found = (live_fe != frontend) || SAME_TRANSPONDER(live_channel_id, chid); + bool ret = false; + if (found) + ret = zapit.zapTo_record(chid) > 0; + else + ret = zapit.zapTo_serviceID(chid) > 0; + + if (ret) { +#ifdef ENABLE_PIP + /* FIXME until proper demux management */ + t_channel_id pip_channel_id = CZapit::getInstance()->GetPipChannelID(); + if ((pip_channel_id == chid) && (channel->getRecordDemux() == channel->getPipDemux())) + zapit.stopPip(); +#endif + } else { + frontend = NULL; + } + } + + CFEManager::getInstance()->Lock(); + for (std::set::iterator ft = frontends.begin(); ft != frontends.end(); ft++) + CFEManager::getInstance()->unlockFrontend(*ft); + + if (unlock) + CFEManager::getInstance()->unlockFrontend(live_fe); + + CFEManager::getInstance()->Unlock(); + return frontend; +} + +bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid, CFrontend * &frontend) { char cbuf[512]; char *bp; FILE * fp = fdopen(fd, "r+"); - if(fp == NULL) { + if (fp == NULL) { perror("fdopen"); return false; } @@ -303,7 +362,7 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) while (bp - &cbuf[0] < (int) sizeof(cbuf)) { unsigned char c; int res = read(fd, &c, 1); - if(res < 0) { + if (res < 0) { perror("read"); return false; } @@ -326,74 +385,54 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) return false; } + chid = CZapit::getInstance()->GetCurrentChannelID(); + CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); + #ifndef ENABLE_MULTI_CHANNEL /* parse stdin / url path, start dmx filters */ do { int pid; int res = sscanf(bp, "%x", &pid); - if(res == 1) { - printf("New pid: 0x%x\n", pid); + if (res == 1) { + printf("CStreamManager::Parse: pid: 0x%x\n", pid); pids.insert(pid); } + } while ((bp = strchr(bp, ',')) && (bp++)); +#else + t_channel_id tmpid; + bp = &cbuf[5]; + if (sscanf(bp, "id=%llx", &tmpid) == 1) { + channel = CServiceManager::getInstance()->FindChannel(tmpid); + chid = tmpid; } - while ((bp = strchr(bp, ',')) && (bp++)); #endif + if (!channel) + return false; - chid = CZapit::getInstance()->GetCurrentChannelID(); - CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); + printf("CStreamManager::Parse: channel_id %llx [%s]\n", chid, channel->getName().c_str()); - int mode = CNeutrinoApp::getInstance()->getMode(); - if (mode == NeutrinoMessages::mode_standby && streams.empty()) { - printf("CStreamManager::Parse: wakeup zapit..\n"); - cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); - g_Zapit->setStandby(false); - g_Zapit->getMode(); + frontend = FindFrontend(channel); + if (!frontend) { + printf("CStreamManager::Parse: no free frontend\n"); + return false; } - if(pids.empty()) { -#ifdef ENABLE_MULTI_CHANNEL - t_channel_id tmpid; - bp = &cbuf[5]; - if (sscanf(bp, "id=%" SCNx64, &tmpid) == 1) { - printf("############################# channel_id %" PRIx64 "\n", tmpid); - CZapitChannel * tmpchan = CServiceManager::getInstance()->FindChannel(tmpid); - /* we may switch channels if neutrino is in standby and we are not recording - * the current channel TODO: check interaction with recording */ - bool may_switch = - (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) && - !CRecordManager::getInstance()->RecordingStatus(chid); - if (tmpchan && (tmpid != chid) && (may_switch || SAME_TRANSPONDER(tmpid, chid))) { - printf("############################# channel_id %" PRIx64 " -> zap\n", tmpid); - bool ret = g_Zapit->zapTo_record(tmpid) > 0; - if (ret) { - channel = tmpchan; - chid = tmpid; - } - } - } - if(CRecordManager::getInstance()->RecordingStatus(chid)) { - printf("CStreamManager::Parse: channel %" PRIx64 " recorded, aborting..\n", chid); - return false; - } -#ifdef ENABLE_PIP - t_channel_id pip_channel_id = CZapit::getInstance()->GetPipChannelID(); - if ((chid == pip_channel_id) && (channel->getRecordDemux() == channel->getPipDemux())) { - printf("CStreamManager::Parse: channel %llx used for pip, aborting..\n", chid); - return false; - } -#endif -#endif + AddPids(fd, channel, pids); - printf("CStreamManager::Parse: no pids in url, using channel %" PRIx64 " pids\n", chid); - if(!channel) - return false; - //pids.insert(0); - //pids.insert(channel->getPmtPid()); - pids.insert(channel->getVideoPid()); + return !pids.empty(); +} + +void CStreamManager::AddPids(int fd, CZapitChannel *channel, stream_pids_t &pids) +{ + if (pids.empty()) { + printf("CStreamManager::AddPids: no pids in url, using channel %llx pids\n", channel->getChannelID()); + if (channel->getVideoPid()) + pids.insert(channel->getVideoPid()); for (int i = 0; i < channel->getAudioChannelCount(); i++) pids.insert(channel->getAudioChannel(i)->pid); } + CGenPsi psi; for (stream_pids_t::iterator it = pids.begin(); it != pids.end(); ++it) { if (*it == channel->getVideoPid()) { @@ -404,9 +443,9 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) if (*it == channel->getAudioChannel(i)->pid) { CZapitAudioChannel::ZapitAudioChannelType atype = channel->getAudioChannel(i)->audioChannelType; printf("CStreamManager::Parse: genpsi apid %x (%d)\n", *it, atype); - if(channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3){ + if (channel->getAudioChannel(i)->audioChannelType == CZapitAudioChannel::EAC3) { psi.addPid(*it, EN_TYPE_AUDIO_EAC3, atype, channel->getAudioChannel(i)->description.c_str()); - }else{ + } else { psi.addPid(*it, EN_TYPE_AUDIO, atype, channel->getAudioChannel(i)->description.c_str()); } } @@ -414,43 +453,85 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid) } } //add pcr pid - if(channel->getPcrPid() != channel->getVideoPid()){ + if (channel->getPcrPid() && (channel->getPcrPid() != channel->getVideoPid())) { pids.insert(channel->getPcrPid()); psi.addPid(channel->getPcrPid(), EN_TYPE_PCR, 0); } //add teletext pid - if (g_settings.recording_stream_vtxt_pid && channel->getTeletextPid() != 0){ + if (g_settings.recording_stream_vtxt_pid && channel->getTeletextPid() != 0) { pids.insert(channel->getTeletextPid()); psi.addPid(channel->getTeletextPid(), EN_TYPE_TELTEX, 0, channel->getTeletextLang()); } //add dvb sub pid - if (g_settings.recording_stream_subtitle_pids){ + if (g_settings.recording_stream_subtitle_pids) { for (int i = 0 ; i < (int)channel->getSubtitleCount() ; ++i) { CZapitAbsSub* s = channel->getChannelSub(i); if (s->thisSubType == CZapitAbsSub::DVB) { - if(i>9)//max sub pids + if (i>9)//max sub pids break; CZapitDVBSub* sd = reinterpret_cast(s); pids.insert(sd->pId); - psi.addPid( sd->pId, EN_TYPE_DVBSUB, 0, sd->ISO639_language_code.c_str() ); + psi.addPid(sd->pId, EN_TYPE_DVBSUB, 0, sd->ISO639_language_code.c_str()); } } - } psi.genpsi(fd); +} - return !pids.empty(); +bool CStreamManager::AddClient(int connfd) +{ + stream_pids_t pids; + t_channel_id channel_id; + CFrontend *frontend; + + if (Parse(connfd, pids, channel_id, frontend)) { + OpenThreads::ScopedLock m_lock(mutex); + streammap_iterator_t it = streams.find(channel_id); + if (it != streams.end()) { + it->second->AddClient(connfd); + } else { + CStreamInstance * stream = new CStreamInstance(connfd, channel_id, pids); + stream->frontend = frontend; + + int sendsize = 10*IN_SIZE; + unsigned int m = sizeof(sendsize); + setsockopt(listenfd, SOL_SOCKET, SO_SNDBUF, (void *)&sendsize, m); + if (stream->Start()) + streams.insert(streammap_pair_t(channel_id, stream)); + else + delete stream; + } + return true; + } + return false; +} + +void CStreamManager::RemoveClient(int fd) +{ + OpenThreads::ScopedLock m_lock(mutex); + for (streammap_iterator_t it = streams.begin(); it != streams.end(); ++it) { + if (it->second->HasFd(fd)) { + CStreamInstance *stream = it->second; + stream->RemoveClient(fd); + if (stream->GetFds().empty()) { + streams.erase(stream->GetChannelId()); + delete stream; + } + break; + } + } } void CStreamManager::run() { struct sockaddr_in servaddr; - int clilen = sizeof(servaddr);; + int clilen = sizeof(servaddr); struct pollfd pfd[128]; int poll_cnt; + int poll_timeout = -1; printf("Starting STREAM thread keeper, tid %ld\n", syscall(__NR_gettid)); @@ -471,67 +552,36 @@ void CStreamManager::run() } mutex.unlock(); //printf("polling, count= %d\n", poll_cnt); - int pollres = poll (pfd, poll_cnt, 1000); - if (pollres < 0) { - perror("CStreamManager::run(): poll"); + int pollres = poll (pfd, poll_cnt, poll_timeout); + if (pollres <= 0) { + if (pollres < 0) + perror("CStreamManager::run(): poll"); continue; } - if(pollres == 0) - continue; for (int i = poll_cnt - 1; i >= 0; i--) { if (pfd[i].revents & (POLLIN | POLLPRI | POLLHUP | POLLRDHUP)) { printf("fd %d has events %x\n", pfd[i].fd, pfd[i].revents); if (pfd[i].fd == listenfd) { - int connfd = accept (listenfd, (struct sockaddr *) &servaddr, (socklen_t *) & clilen); + int connfd = accept(listenfd, (struct sockaddr *) &servaddr, (socklen_t *) & clilen); printf("CStreamManager::run(): connection, fd %d\n", connfd); - if(connfd < 0) { + if (connfd < 0) { perror("CStreamManager::run(): accept"); continue; } - stream_pids_t pids; - t_channel_id channel_id; - if (Parse(connfd, pids, channel_id)) { - mutex.lock(); - streammap_iterator_t it = streams.find(channel_id); - if (it != streams.end()) { - it->second->AddClient(connfd); - } else { - CStreamInstance * stream = new CStreamInstance(connfd, channel_id, pids); - if (stream->Start()) - streams.insert(streammap_pair_t(channel_id, stream)); - else - delete stream; - } - mutex.unlock(); - } else { +#if 0 + if (!AddClient(connfd)) close(connfd); - } +#endif + g_RCInput->postMsg(NeutrinoMessages::EVT_STREAM_START, connfd); + poll_timeout = 1000; } else { if (pfd[i].revents & (POLLHUP | POLLRDHUP)) { printf("CStreamManager::run(): POLLHUP, fd %d\n", pfd[i].fd); - mutex.lock(); - for (streammap_iterator_t it = streams.begin(); it != streams.end(); ++it) { - if (it->second->HasFd(pfd[i].fd)) { - CStreamInstance *stream = it->second; - stream->RemoveClient(pfd[i].fd); - if (stream->GetFds().empty()) { - streams.erase(stream->GetChannelId()); - delete stream; - } - break; - } + RemoveClient(pfd[i].fd); + if (streams.empty()) { + poll_timeout = -1; + g_RCInput->postMsg(NeutrinoMessages::EVT_STREAM_STOP, 0); } - mutex.unlock(); - } - } - /* this is a cheap check */ - if (streams.empty() && - CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_standby) { - /* this check is more expensive (goes through the socket) */ - if (g_Zapit->getMode() != 0) { - printf("CStreamManager::run: put zapit into standby...\n"); - g_Zapit->setStandby(true); - cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); } } } @@ -588,8 +638,6 @@ bool CStreamManager::Listen() { struct sockaddr_in socketAddr; int socketOptActive = 1; - int sendsize = 10*IN_SIZE; - unsigned int m = sizeof(sendsize); if ((listenfd = socket (AF_INET, SOCK_STREAM, 0)) < 0) { fprintf (stderr, "network port %u open: ", port); @@ -619,12 +667,7 @@ bool CStreamManager::Listen() goto _error; } -#if 1 - setsockopt(listenfd, SOL_SOCKET, SO_SNDBUF, (void *)&sendsize, m); - sendsize = 0; - getsockopt(listenfd, SOL_SOCKET, SO_SNDBUF, (void *)&sendsize, &m); - printf("CStreamManager::Listen: on %d, fd %d (%d)\n", port, listenfd, sendsize); -#endif + printf("CStreamManager::Listen: on %d, fd %d\n", port, listenfd); return true; _error: close (listenfd); diff --git a/src/driver/streamts.h b/src/driver/streamts.h index 9b10ddeca..e1a6915a1 100644 --- a/src/driver/streamts.h +++ b/src/driver/streamts.h @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -38,6 +39,7 @@ class CStreamInstance : public OpenThreads::Thread private: bool running; cDemux * dmx; + CFrontend * frontend; OpenThreads::Mutex mutex; unsigned char * buf; @@ -48,6 +50,7 @@ class CStreamInstance : public OpenThreads::Thread bool Send(ssize_t r); void Close(); void run(); + friend class CStreamManager; public: CStreamInstance(int clientfd, t_channel_id chid, stream_pids_t &pids); ~CStreamInstance(); @@ -74,12 +77,17 @@ class CStreamManager : public OpenThreads::Thread OpenThreads::Mutex mutex; static CStreamManager * sm; + CZapitClient zapit; streammap_t streams; bool Listen(); - bool Parse(int fd, stream_pids_t &pids, t_channel_id &chid); + bool Parse(int fd, stream_pids_t &pids, t_channel_id &chid, CFrontend * &frontend); + void AddPids(int fd, CZapitChannel * channel, stream_pids_t &pids); + void CheckStandby(bool enter); + CFrontend * FindFrontend(CZapitChannel * channel); bool StopAll(); + void RemoveClient(int fd); void run(); CStreamManager(); public: @@ -91,6 +99,7 @@ class CStreamManager : public OpenThreads::Thread bool StreamStatus(t_channel_id channel_id = 0); bool SetPort(int newport); int GetPort() { return port; } + bool AddClient(int fd); }; #endif diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 72985a68b..a93d4df6c 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -473,7 +473,7 @@ xprintf("addEvent: ch %012" PRIx64 " running %d (%s) got_CN %d\n", evt.get_chann // Damit in den nicht nach Event-ID sortierten Mengen // Mehrere Events mit gleicher ID sind, diese vorher loeschen deleteEvent(e->uniqueKey()); - if ( !mySIeventsOrderUniqueKey.empty() && mySIeventsOrderUniqueKey.size() >= max_events && max_events != 0 ) { + if ( !mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.empty() && mySIeventsOrderUniqueKey.size() >= max_events && max_events != 0 ) { MySIeventsOrderFirstEndTimeServiceIDEventUniqueKey::iterator lastEvent = mySIeventsOrderFirstEndTimeServiceIDEventUniqueKey.begin(); @@ -484,7 +484,7 @@ xprintf("addEvent: ch %012" PRIx64 " running %d (%s) got_CN %d\n", evt.get_chann #else time_t now = time(NULL); bool back = false; - if (*lastEvent!=NULL && (*lastEvent)->times.size() == 1) + if ((*lastEvent)->times.size() == 1) { if ((*lastEvent)->times.begin()->startzeit + (long)(*lastEvent)->times.begin()->dauer >= now - oldEventsAre) back = true; @@ -505,9 +505,9 @@ xprintf("addEvent: ch %012" PRIx64 " running %d (%s) got_CN %d\n", evt.get_chann } unlockMessaging(); } + event_id_t uniqueKey = (*lastEvent)->uniqueKey(); // else fprintf(stderr, ">"); - if(*lastEvent!=NULL) - deleteEvent((*lastEvent)->uniqueKey()); + deleteEvent(uniqueKey); } // Pruefen ob es ein Meta-Event ist MySIeventUniqueKeysMetaOrderServiceUniqueKey::iterator i = mySIeventUniqueKeysMetaOrderServiceUniqueKey.find(e->get_channel_id()); diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 37bb35190..cefc80618 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -65,6 +65,7 @@ libneutrino_gui_a_SOURCES = \ network_service.cpp \ network_setup.cpp \ nfs.cpp \ + opkg_manager.cpp \ osd_setup.cpp \ osdlang_setup.cpp \ parentallock_setup.cpp \ diff --git a/src/gui/audio_select.cpp b/src/gui/audio_select.cpp index 5ec7c5fd7..57109bc03 100644 --- a/src/gui/audio_select.cpp +++ b/src/gui/audio_select.cpp @@ -128,11 +128,12 @@ int CAudioSelectMenuHandler::doMenu () AudioSelector.addItem( oj ); - oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_OUT, &g_settings.analog_out, - OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, - true, audioSetupNotifier, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); - - AudioSelector.addItem( oj ); + if (!g_settings.easymenu) { + oj = new CMenuOptionChooser(LOCALE_AUDIOMENU_ANALOG_OUT, &g_settings.analog_out, + OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, + true, audioSetupNotifier, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN); + AudioSelector.addItem( oj ); + } CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList; int curnum = channelList->getActiveChannelNumber(); diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 823a0ff99..0cdaed6fe 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1588,7 +1588,7 @@ void CAudioPlayerGui::paintHead() #ifdef ENABLE_GUI_MOUNT if (!m_inetmode) - header.addButtonIcon(NEUTRINO_ICON_BUTTON_MENU); + header.setContextButton(NEUTRINO_ICON_BUTTON_MENU); #endif header.paint(CC_SAVE_SCREEN_NO); diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 484c27958..8ad1567e8 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -114,7 +114,10 @@ void CBEChannelWidget::paintItem(int pos) frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, RADIUS_LARGE); } else { - color = COL_MENUCONTENT_TEXT; + if(current < Channels->size() && ((*Channels)[current]->flags & CZapitChannel::NOT_FOUND )) + color = COL_MENUCONTENTINACTIVE_TEXT;// extra color for channels not found in service + else + color = COL_MENUCONTENT_TEXT; bgcolor = COL_MENUCONTENT_PLUS_0; frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor); } diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 1312d6ec0..64ea35627 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -45,17 +45,22 @@ #include #include #include +#include #include #include #include #include #include +#include + #include #include #include #include +#include +#include extern CBouquetManager *g_bouquetManager; @@ -65,6 +70,7 @@ CBouquetList::CBouquetList(const char * const Name) selected = 0; liststart = 0; favonly = false; + save_bouquets = false; if(Name == NULL) name = g_Locale->getText(LOCALE_BOUQUETLIST_HEAD); else @@ -230,7 +236,7 @@ int CBouquetList::doMenu() zapitBouquet = Bouquets[selected]->zapitBouquet; /* zapitBouquet not NULL only on real bouquets, not on virtual SAT or HD */ - if(!zapitBouquet) + if(!zapitBouquet && Bouquets[selected]->satellitePosition == INVALID_SAT_POSITION) return 0; CMenuWidget* menu = new CMenuWidget(LOCALE_CHANNELLIST_EDIT, NEUTRINO_ICON_SETTINGS); @@ -238,12 +244,18 @@ int CBouquetList::doMenu() CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); sprintf(cnt, "%d", i); - if(!zapitBouquet->bUser) { + if (zapitBouquet && !zapitBouquet->bUser) { + bool old_epg = zapitBouquet->bScanEpg; menu->addItem(new CMenuForwarder(LOCALE_FAVORITES_COPY, true, NULL, selector, cnt, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE), old_selected == i ++); + if (g_settings.epg_scan == CEpgScan::SCAN_SEL) + menu->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &zapitBouquet->bScanEpg, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); menu->exec(NULL, ""); delete menu; delete selector; printf("CBouquetList::doMenu: %d selected\n", select); + if (old_epg != zapitBouquet->bScanEpg) + save_bouquets = true; + bool added = false; if(select >= 0) { old_selected = select; @@ -283,23 +295,37 @@ int CBouquetList::doMenu() return -1; } else { menu->addItem(new CMenuForwarder(LOCALE_BOUQUETEDITOR_DELETE, true, NULL, selector, cnt, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED), old_selected == i ++); + int old_epg = zapitBouquet ? zapitBouquet->bScanEpg : 0; + if (zapitBouquet && (g_settings.epg_scan == CEpgScan::SCAN_SEL)) + menu->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &zapitBouquet->bScanEpg, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); + menu->exec(NULL, ""); delete menu; delete selector; + if (zapitBouquet && (old_epg != zapitBouquet->bScanEpg)) + save_bouquets = true; + printf("CBouquetList::doMenu: %d selected\n", select); if(select >= 0) { old_selected = select; - switch(select) { - case 0: - hide(); - bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName()); - if(bouquet_id >= 0) { - g_bouquetManager->deleteBouquet(bouquet_id); - return 1; - } - break; - default: - break; + hide(); + + int result = ShowMsg ( LOCALE_BOUQUETEDITOR_DELETE, Bouquets[selected]->channelList->getName(), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo ); + if(result != CMessageBox::mbrYes) + return -1; + + if (zapitBouquet) { + bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName()); + if(bouquet_id >= 0) { + g_bouquetManager->deleteBouquet(bouquet_id); + return 1; + } + } else { + CServiceManager::getInstance()->RemovePosition(Bouquets[selected]->satellitePosition); + g_bouquetManager->loadBouquets(); + g_bouquetManager->deletePosition(Bouquets[selected]->satellitePosition); + CServiceManager::getInstance()->SetServicesChanged(true); + return 1; } } return -1; @@ -539,6 +565,16 @@ int CBouquetList::show(bool bShowChannelList) fader.Stop(); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); + if (save_bouquets) { + save_bouquets = false; + if (CNeutrinoApp::getInstance()->GetChannelMode() == LIST_MODE_FAV) + g_bouquetManager->saveUBouquets(); + else + g_bouquetManager->saveBouquets(); + + if (g_settings.epg_scan == CEpgScan::SCAN_SEL) + CEpgScan::getInstance()->Start(); + } if(zapOnExit) { return (selected); } else { @@ -570,7 +606,7 @@ void CBouquetList::paintItem(int pos) if(npos < (int) Bouquets.size()) CVFD::getInstance()->showMenuText(0, lname, -1, true); } else { - if(npos < (int) Bouquets.size()) + if(!favonly && (npos < (int) Bouquets.size())) iscurrent = !Bouquets[npos]->channelList->isEmpty(); color = iscurrent ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT; bgcolor = iscurrent ? COL_MENUCONTENT_PLUS_0 : COL_MENUCONTENTINACTIVE_PLUS_0; @@ -580,11 +616,20 @@ void CBouquetList::paintItem(int pos) if(npos < (int) Bouquets.size()) { char tmp[10]; sprintf((char*) tmp, "%d", npos+ 1); - + int iw = 0, ih = 0; + if ((g_settings.epg_scan == CEpgScan::SCAN_SEL) && + Bouquets[npos]->zapitBouquet && Bouquets[npos]->zapitBouquet->bScanEpg) { + frameBuffer->getIconSize(NEUTRINO_ICON_EPG, &iw, &ih); + if (iw && ih) { + int icon_x = (x+width-2) - RADIUS_LARGE/2 - iw; + frameBuffer->paintIcon(NEUTRINO_ICON_EPG, icon_x - iw, ypos, fheight); + iw = iw + 12 + RADIUS_LARGE/2; + } + } int numpos = x+5+numwidth- g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp); g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos,ypos+fheight, numwidth+5, tmp, color, fheight); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10, ypos+ fheight, width- numwidth- 20- 15, lname, color, 0, true); // UTF-8 + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10, ypos+ fheight, width- numwidth- 20- 15 - iw, lname, color, 0, true); // UTF-8 //CVFD::getInstance()->showMenuText(0, bouq->channelList->getName(), -1, true); } } diff --git a/src/gui/bouquetlist.h b/src/gui/bouquetlist.h index c8eb4b3ec..0c8741c84 100644 --- a/src/gui/bouquetlist.h +++ b/src/gui/bouquetlist.h @@ -58,12 +58,14 @@ class CBouquet bool bLocked; CChannelList* channelList; CZapitBouquet * zapitBouquet; + t_satellite_position satellitePosition; CBouquet(const int Unique_key, const char * const Name, const bool locked, bool vlist = false) { zapitBouquet = NULL; unique_key = Unique_key; bLocked = locked; + satellitePosition = INVALID_SAT_POSITION; channelList = new CChannelList(Name, false, vlist); } @@ -95,6 +97,7 @@ class CBouquetList int y; bool favonly; + bool save_bouquets; void paintItem(int pos); void paint(); diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index 48b208061..a13420251 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Copyright (C) 2013, M. Liebmann 'micha-bbg' - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -45,7 +45,7 @@ CBuildInfo::CBuildInfo() : CComponentsWindow(0, 0, 700, 500, LOCALE_BUILDINFO_ME //init all var members void CBuildInfo::initVarBuildInfo() { - doCenter(); + setCenterPos(); font = NULL; setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); @@ -176,11 +176,10 @@ void CBuildInfo::InitInfoItems() //init info texts for(size_t i=0; igetText(v_info[i].caption), v_info[i].info_text); + CComponentsExtTextForm *info = new CComponentsExtTextForm(10, CC_APPEND, w_info, h_info, g_Locale->getText(v_info[i].caption), v_info[i].info_text, ccw_body); info->setLabelAndTextFont(font); info->setTextModes(CTextBox::TOP , CTextBox::AUTO_HIGH | CTextBox::TOP | CTextBox::AUTO_LINEBREAK_NO_BREAKCHARS); info->doPaintBg(false); - ccw_body->addCCItem(info); } } diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index 5df3bcd01..232538b86 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -57,6 +57,9 @@ void CCAMMenuHandler::init(void) { hintBox = NULL; ca = cCA::GetInstance(); + close_timer = 0; + in_menu = false; + menu_type = menu_slot = -1; } int CCAMMenuHandler::exec(CMenuTarget* parent, const std::string &actionkey) @@ -103,8 +106,6 @@ int CCAMMenuHandler::doMainMenu() int CiSlots = ca->GetNumberCISlots(); CMenuWidget* cammenu = new CMenuWidget(LOCALE_CI_SETTINGS, NEUTRINO_ICON_SETTINGS); - //cammenu->addItem( GenericMenuBack ); - //cammenu->addItem( GenericMenuSeparatorLine ); cammenu->addIntroItems(); if (!g_settings.easymenu) { @@ -173,25 +174,23 @@ int CCAMMenuHandler::doMainMenu() cammenu->addItem( GenericMenuSeparatorLine ); i++; } - + in_menu = true; ret = cammenu->exec(NULL, ""); delete cammenu; + in_menu = false; return ret; } #define CI_MSG_TIME 5 -int CCAMMenuHandler::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) +int CCAMMenuHandler::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) { - int ret = messages_return::handled; //printf("CCAMMenuHandler::handleMsg: msg 0x%x data 0x%x\n", msg, data); - int camret = handleCamMsg(msg, data); - if(camret < 0) { - ret = messages_return::unhandled; - } - return ret; + int msgret; + handleCamMsg(msg, data, msgret); + return msgret; } -void CCAMMenuHandler::showHintBox (const neutrino_locale_t /*Caption*/, const char * const Text, uint32_t timeout) +void CCAMMenuHandler::showHintBox(const neutrino_locale_t /*Caption*/, const char * const Text, uint32_t timeout) { hideHintBox(); hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, Text); @@ -211,9 +210,8 @@ void CCAMMenuHandler::hideHintBox(void) } } -int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t data, bool from_menu) +int CCAMMenuHandler::handleCamMsg(const neutrino_msg_t msg, neutrino_msg_data_t data, int &msgret, bool from_menu) { - int ret = 0; char str[255]; char cnt[5]; int i; @@ -223,12 +221,20 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t MMI_ENQUIRY_INFO *pMmiEnquiry = &MmiEnquiry; CA_MESSAGE Msg, *rMsg; - if (msg != NeutrinoMessages::EVT_CA_MESSAGE) - return from_menu ? 1 : -1; + //printf("CCAMMenuHandler::handleCamMsg: msg %x data %x from %s\n", msg, data, from_menu ? "menu" : "neutrino"); + msgret = messages_return::unhandled; - if (g_settings.ci_ignore_messages && !from_menu) + if ((msg == NeutrinoMessages::EVT_TIMER) && (data == close_timer)) { + printf("CCAMMenuHandler::handleCamMsg: EVT_TIMER close_timer %d\n", close_timer); + g_RCInput->killTimer(close_timer); + msgret = messages_return::cancel_info; + } + + if (msg != NeutrinoMessages::EVT_CA_MESSAGE) return 1; + msgret = messages_return::handled; + rMsg = (CA_MESSAGE *)data; if (!rMsg) return -1; @@ -240,37 +246,36 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t CA_SLOT_TYPE SlotType = Msg.SlotType; int curslot = Msg.Slot; - printf("CCAMMenuHandler::handleCamMsg: msg %d from %s\n", MsgId, from_menu ? "menu" : "neutrino"); + printf("CCAMMenuHandler::handleCamMsg: CA msg %x from %s\n", MsgId, from_menu ? "menu" : "neutrino"); + + if (g_settings.ci_ignore_messages && !from_menu) + return 1; + + hideHintBox(); if (SlotType != CA_SLOT_TYPE_SMARTCARD && SlotType != CA_SLOT_TYPE_CI) return -1; if(MsgId == CA_MESSAGE_MSG_INSERTED) { - hideHintBox(); snprintf(str, sizeof(str), "%s %d", g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INSERTED : LOCALE_SC_INSERTED), (int)curslot+1); printf("CCAMMenuHandler::handleCamMsg: %s\n", str); - ShowHint(LOCALE_MESSAGEBOX_INFO, str); -#if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); -#endif + ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3); + if (in_menu) + msgret = messages_return::cancel_all; } else if (MsgId == CA_MESSAGE_MSG_REMOVED) { - hideHintBox(); - snprintf(str, sizeof(str), "%s %d", g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_REMOVED : LOCALE_SC_REMOVED), (int)curslot+1); printf("CCAMMenuHandler::handleCamMsg: %s\n", str); - ShowHint(LOCALE_MESSAGEBOX_INFO, str); + ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3); #if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); + if (menu_slot == curslot && menu_type == SlotType) + return 3; #endif + if (in_menu) + msgret = messages_return::cancel_all; } else if(MsgId == CA_MESSAGE_MSG_INIT_OK) { - if(hintBox != NULL) { - hintBox->hide(); - delete hintBox; - hintBox = NULL; - } char name[255] = "Unknown"; if (ca) ca->ModuleName(SlotType, curslot, name); @@ -279,13 +284,8 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t 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); - ShowHint(LOCALE_MESSAGEBOX_INFO, str); -#if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); -#endif + ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3); } else if(MsgId == CA_MESSAGE_MSG_INIT_FAILED) { - hideHintBox(); - char name[255] = "Unknown"; if (ca) ca->ModuleName(SlotType, curslot, name); @@ -294,10 +294,7 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_FAILED : LOCALE_SC_INIT_FAILED), (int)curslot+1, name); printf("CCAMMenuHandler::handleCamMsg: %s\n", str); - ShowHint(LOCALE_MESSAGEBOX_INFO, str); -#if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, str, CI_MSG_TIME); -#endif + ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3); } else if(MsgId == CA_MESSAGE_MSG_MMI_MENU || MsgId == CA_MESSAGE_MSG_MMI_LIST) { bool sublevel = false; @@ -312,10 +309,9 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t printf("CCAMMenuHandler::handleCamMsg: slot %d menu ready, title %s choices %d\n", curslot, convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), pMenu->choice_nb); - hideHintBox(); - + int menuret = menu_return::RETURN_REPAINT; int selected = -1; - if(pMenu->choice_nb) { + if(pMenu->choice_nb && from_menu) { CMenuWidget* menu = new CMenuWidget(convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), NEUTRINO_ICON_SETTINGS); menu->enableSaveScreen(true); @@ -353,8 +349,7 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t menu->addItem(new CMenuForwarder(convertDVBUTF8(pMenu->bottom, slen, 0).c_str(), false)); } - menu->exec(NULL, ""); - + menuret = menu->exec(NULL, ""); delete menu; delete selector; } else { @@ -362,35 +357,22 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t char lstr[255]; int slen = 0; - hideHintBox(); -#if 1 if(strlen(pMenu->title)) - slen += snprintf(&lstr[slen], 255-slen, "%s", pMenu->title); + slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->title); if(strlen(pMenu->subtitle)) - slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->subtitle); + slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->subtitle); if(strlen(pMenu->bottom)) - slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->bottom); + slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->bottom); + + for(i = 0; (i < pMenu->choice_nb) && (i < MAX_MMI_ITEMS); i++) + slen += snprintf(&lstr[slen], 255-slen, "%s\n", pMenu->choice_item[i]); ShowHint(LOCALE_MESSAGEBOX_INFO, convertDVBUTF8(lstr, slen, 0).c_str()); -#else - if(strlen(pMenu->subtitle)) - slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->subtitle); - if(strlen(pMenu->bottom)) - slen += snprintf(&lstr[slen], 255-slen, "\n%s", pMenu->bottom); - ShowHint(convertDVBUTF8(pMenu->title, strlen(pMenu->title), 0).c_str(), convertDVBUTF8(lstr, slen, 0).c_str()); -#endif -#if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, convertDVBUTF8(lstr, slen, 0).c_str()); - sleep(4);//FIXME - if(!from_menu) { - hideHintBox(); - } -#endif return 0; } if(sublevel) - return 0; + return menuret == menu_return::RETURN_EXIT_ALL ? 3 : 0; if(selected >= 0) { printf("CCAMMenuHandler::handleCamMsg: selected %d:%s sublevel %s\n", selected, pMenu->choice_item[i], sublevel ? "yes" : "no"); @@ -398,7 +380,7 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t timeoutEnd = CRCInput::calcTimeoutEnd(10); return 1; } else { - return 2; + return menuret == menu_return::RETURN_EXIT_ALL ? 3 : 2; } } else if(MsgId == CA_MESSAGE_MSG_MMI_REQ_INPUT) { @@ -408,7 +390,6 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t memmove(pMmiEnquiry, (MMI_ENQUIRY_INFO *)Msg.Msg.Data[0], sizeof(MMI_ENQUIRY_INFO)); free((void *)Msg.Msg.Data[0]); printf("CCAMMenuHandler::handleCamMsg: slot %d input request, text %s\n", curslot, convertDVBUTF8(pMmiEnquiry->enquiryText, strlen(pMmiEnquiry->enquiryText), 0).c_str()); - hideHintBox(); std::string ENQAnswer; @@ -428,9 +409,15 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t } } else if(MsgId == CA_MESSAGE_MSG_MMI_CLOSE) { - printf("CCAMMenuHandler::handleCamMsg: close request slot: %d\n", curslot); - hideHintBox(); - ca->MenuClose(SlotType, curslot); + int timeout = 0; + if (Msg.Flags & CA_MESSAGE_HAS_PARAM1_INT) + timeout = Msg.Msg.Param[0]; + printf("CCAMMenuHandler::handleCamMsg: close request slot: %d (timeout %d)\n", curslot, timeout); + //ca->MenuClose(SlotType, curslot); + if (timeout) + close_timer = g_RCInput->addTimer(timeout*1000*1000, true); + else + msgret = messages_return::cancel_info; return 0; } else if(MsgId == CA_MESSAGE_MSG_MMI_TEXT) { @@ -448,10 +435,8 @@ int CCAMMenuHandler::handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t return -1; } CNeutrinoApp::getInstance()->zapTo(channel->getChannelID()); - } else - ret = -1; - //printf("CCAMMenuHandler::handleCamMsg: return %d\n", ret); - return ret; + } + return 1; } int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) @@ -461,6 +446,8 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) neutrino_msg_data_t data; bool doexit = false; + menu_slot = slot; + menu_type = slotType; while(!doexit) { printf("CCAMMenuHandler::doMenu: enter menu for slot %d\n", slot); @@ -477,23 +464,23 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) printf("CCAMMenuHandler::doMenu: menu timeout\n"); hideHintBox(); ShowHint(LOCALE_MESSAGEBOX_INFO, - g_Locale->getText(slotType == CA_SLOT_TYPE_CI ? LOCALE_CI_TIMEOUT : LOCALE_SC_TIMEOUT)); -#if 0 - showHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_CI_TIMEOUT), 5); -#endif + g_Locale->getText(slotType == CA_SLOT_TYPE_CI ? LOCALE_CI_TIMEOUT : LOCALE_SC_TIMEOUT), 450, 3); ca->MenuClose(slotType, slot); return menu_return::RETURN_REPAINT; } - /* -1 = not our event, 0 = back to top menu, 1 = continue loop, 2 = quit */ - int ret = handleCamMsg(msg, data, true); - printf("CCAMMenuHandler::doMenu: handleCamMsg %d\n", ret); - if(ret < 0 && (msg > CRCInput::RC_Messages)) { - if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & ( messages_return::cancel_all | messages_return::cancel_info ) ) + /* -1 = not our event, 0 = back to top menu, 1 = continue loop, 2 = quit , 3 = quit all*/ + int msgret; + int ret = handleCamMsg(msg, data, msgret, true); + printf("CCAMMenuHandler::doMenu: handleCamMsg ret: %d\n", ret); + if((msgret & messages_return::unhandled) && (msg > CRCInput::RC_Events)) { + if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & (messages_return::cancel_all | messages_return::cancel_info)) { doexit = true; res = menu_return::RETURN_EXIT_ALL; + break; } - } else if (ret == 1) { + } + if (ret == 1) { /* workaround: dont cycle here on timers */ if (msg != NeutrinoMessages::EVT_TIMER) timeoutEnd = CRCInput::calcTimeoutEnd(10); @@ -501,6 +488,10 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) } else if (ret == 2) { doexit = true; break; + } else if (ret == 3) { + res = menu_return::RETURN_EXIT_ALL; + doexit = true; + break; } else { // ret == 0 break; } @@ -508,6 +499,7 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) } ca->MenuClose(slotType, slot); hideHintBox(); + menu_type = menu_slot = -1; printf("CCAMMenuHandler::doMenu: return\n"); return res; } diff --git a/src/gui/cam_menu.h b/src/gui/cam_menu.h index 4a8c1fa43..829aa3433 100644 --- a/src/gui/cam_menu.h +++ b/src/gui/cam_menu.h @@ -37,10 +37,13 @@ class CCAMMenuHandler : public CMenuTarget, public CChangeObserver CHintBox * hintBox; cCA *ca; uint64_t timeoutEnd; - //int slot; + uint32_t close_timer; + int menu_slot; + int menu_type; + bool in_menu; int doMenu(int slot, CA_SLOT_TYPE slotType); int doMainMenu(); - int handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t data, bool from_menu = false); + int handleCamMsg (const neutrino_msg_t msg, neutrino_msg_data_t data, int &msgret, bool from_menu = false); void hideHintBox(void); void showHintBox(const neutrino_locale_t Caption, const char * const Text, uint32_t timeout = 0); public: diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index c70d7cdcf..faca079fc 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2265,6 +2265,7 @@ void CChannelList::paintPig (int _x, int _y, int w, int h) } //set changeable minitv properties cc_minitv->setDimensionsAll(_x, _y, w, h); + cc_minitv->setCorner(0); cc_minitv->setColorFrame(COL_MENUCONTENT_PLUS_0); cc_minitv->paint(false); } diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index c9c49528a..d704dfb43 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -31,30 +31,11 @@ #include #include #include "cc_base.h" - +#include using namespace std; //abstract basic class CComponents CComponents::CComponents() -{ - initVarBasic(); -} - -CComponents::~CComponents() -{ - hide(); - clearSavedScreen(); - clearFbData(); -} - -void CComponents::clearSavedScreen() -{ - if (saved_screen.pixbuf) - delete[] saved_screen.pixbuf; - saved_screen.pixbuf = NULL; -} - -void CComponents::initVarBasic() { x = saved_screen.x = 0; y = saved_screen.y = 0; @@ -73,7 +54,7 @@ void CComponents::initVarBasic() shadow_w = SHADOW_OFFSET; fr_thickness = 0; fr_thickness_sel = 3; - + firstPaint = true; is_painted = false; paint_bg = true; @@ -83,17 +64,55 @@ void CComponents::initVarBasic() saved_screen.pixbuf = NULL; } +CComponents::~CComponents() +{ + hide(); + clearSavedScreen(); + clearFbData(); +} + +void CComponents::clearSavedScreen() +{ + if (saved_screen.pixbuf) + delete[] saved_screen.pixbuf; + saved_screen.pixbuf = NULL; +} + +bool CComponents::CheckFbData(const comp_fbdata_t& fbdata, const char* func, const int line) +{ + int32_t rows = fbdata.dx / (int32_t)frameBuffer->getScreenWidth(true) - 1 + fbdata.y; + int32_t rest = fbdata.dx % (int32_t)frameBuffer->getScreenWidth(true); + int32_t end = rows * (int32_t)frameBuffer->getScreenWidth(true) + rest; + if ( (fbdata.x < 0 || fbdata.y < 0) || + (end >= (int32_t)frameBuffer->getScreenWidth(true)*(int32_t)frameBuffer->getScreenHeight(true)) + ) { + dprintf(DEBUG_NORMAL, "[CComponents] ERROR! Position < 0 or > FB end [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n", + func, line, + fbdata.x, fbdata.y, + fbdata.dx, fbdata.dy); + return false; + } + if (fbdata.dx == 0 || fbdata.dy == 0) { + dprintf(DEBUG_DEBUG,"[CComponents] INFO! dx and/or dy = 0 [%s - %d]\n\tx = %d y = %d\n\tdx = %d dy = %d\n", + func, line, + fbdata.x, fbdata.y, + fbdata.dx, fbdata.dy); + return false; + } + return true; +} + //paint framebuffer stuff and fill buffer void CComponents::paintFbItems(bool do_save_bg) { //save background before first paint, do_save_bg must be true - if (firstPaint && do_save_bg) { + if (firstPaint && do_save_bg){ for(size_t i=0; isave screen: %d, fbdata_type: %d\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", + if (!CheckFbData(v_fbdata[i], __func__, __LINE__)){ + break; + } + + dprintf(DEBUG_DEBUG, "[CComponents]\n\t[%s - %d] firstPaint->save screen: %d, fbdata_type: %d\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", __func__, __LINE__, firstPaint, @@ -102,31 +121,26 @@ void CComponents::paintFbItems(bool do_save_bg) v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); -#endif - saved_screen.x = v_fbdata[i].x; - saved_screen.y = v_fbdata[i].y; - saved_screen.dx = v_fbdata[i].dx; - saved_screen.dy = v_fbdata[i].dy; - clearSavedScreen(); - saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy); - firstPaint = false; - break; - } + + saved_screen.x = v_fbdata[i].x; + saved_screen.y = v_fbdata[i].y; + saved_screen.dx = v_fbdata[i].dx; + saved_screen.dy = v_fbdata[i].dy; + clearSavedScreen(); + saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy); + firstPaint = false; + break; } } - for(size_t i=0; i< v_fbdata.size() ;i++){ - // Don't paint if dx or dy are 0 - if ((v_fbdata[i].dx == 0) || (v_fbdata[i].dy == 0)){ -#ifdef DEBUG_CC - printf("\t[CComponents] WARNING: [%s - %d], dx = %d dy = %d\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy); -#endif + for(size_t i=0; i< v_fbdata.size(); i++){ + // Don't paint on dimension or position error dx or dy are 0 + if (!CheckFbData(v_fbdata[i], __func__, __LINE__)){ continue; } - int fbtype = v_fbdata[i].fbdata_type; -#ifdef DEBUG_CC - printf("\t[CComponents]\n\t[%s - %d], fbdata_[%d]\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", + + dprintf(DEBUG_DEBUG, "[CComponents]\n\t[%s - %d], fbdata_[%d]\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", __func__, __LINE__, (int)i, @@ -134,7 +148,7 @@ void CComponents::paintFbItems(bool do_save_bg) v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); -#endif + //some elements can be assembled from lines and must be handled as one unit (see details line), //so all individual backgrounds of boxes must be saved and painted in "firstpaint mode" if (firstPaint){ @@ -224,10 +238,20 @@ void CComponents::kill() } //clean old screen buffer -inline void CComponents::clearFbData() +void CComponents::clearFbData() { for(size_t i =0; i< v_fbdata.size() ;i++) if (v_fbdata[i].pixbuf) delete[] v_fbdata[i].pixbuf; v_fbdata.clear(); } + +inline void CComponents::setXPos(const int& xpos) +{ + x = xpos; +} + +inline void CComponents::setYPos(const int& ypos) +{ + y = ypos; +} diff --git a/src/gui/components/cc_base.h b/src/gui/components/cc_base.h index a726361a8..57db14785 100644 --- a/src/gui/components/cc_base.h +++ b/src/gui/components/cc_base.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -33,8 +33,6 @@ #include #include - - /// Basic component class. /*! Basic attributes and member functions for component sub classes @@ -45,9 +43,7 @@ class CComponents private: ///pixel buffer handling, returns pixel buffer depends of given parameters fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); - ///initialize of basic attributes, no parameters required - void initVarBasic(); - + protected: ///object: framebuffer object, usable in all sub classes CFrameBuffer * frameBuffer; @@ -104,6 +100,9 @@ class CComponents ///parameter do_save_bg=true, saves background of element to pixel buffer, this can be restore with hide() void paintFbItems(bool do_save_bg = true); + ///check current fbdtata position and dimensions, parameter fbdata is an element of v_fbdata, returns false on error + bool CheckFbData(const comp_fbdata_t& fbdata, const char* func, const int line); + ///clean up old screen buffer saved in v_fbdata virtual void clearFbData(); @@ -117,11 +116,11 @@ class CComponents CComponents(); virtual~CComponents(); - ///set screen x-position - inline virtual void setXPos(const int& xpos){x = xpos;}; - ///set screen y-position, - inline virtual void setYPos(const int& ypos){y = ypos;}; - ///set x and y position + ///set screen x-position, parameter as int + virtual void setXPos(const int& xpos); + ///set screen y-position, parameter as int + virtual void setYPos(const int& ypos); + ///set x and y position at once ///Note: position of bound components (items) means position related within parent form, not for screen! ///to set the real screen position, look at setRealPos() inline virtual void setPos(const int& xpos, const int& ypos){x = xpos; y = ypos;}; @@ -218,9 +217,6 @@ class CComponents class CComponentsItem : public CComponents { - private: - ///initialize all required attributes - void initVarItem(); protected: ///property: define of item type, see cc_types.h for possible types int cc_item_type; @@ -235,7 +231,7 @@ class CComponentsItem : public CComponents ///Pointer to the form object in which this item is embedded. ///Is typically the type CComponentsForm or derived classes, default intialized with NULL - CComponentsItem *cc_parent; + CComponentsForm *cc_parent; ///hides item, arg: no_restore=true causes no restore of background, but clean up pixel buffer if required void hideCCItem(bool no_restore = false); @@ -247,14 +243,17 @@ class CComponentsItem : public CComponents ///an item will be hide or overpainted with other methods, or it's embedded (bound) in a parent form. void paintInit(bool do_save_bg); + ///add "this" current item to parent + void initParent(CComponentsForm* parent); + public: - CComponentsItem(); + CComponentsItem(CComponentsForm *parent = NULL); ///sets pointer to the form object in which this item is embedded. - virtual void setParent(CComponentsItem *parent){cc_parent = parent;}; + virtual void setParent(CComponentsForm *parent){cc_parent = parent;}; ///returns pointer to the form object in which this item is embedded. - virtual CComponentsItem * getParent(){return cc_parent;}; + virtual CComponentsForm* getParent(){return cc_parent;}; ///property: returns true if item is added to a form virtual bool isAdded(); @@ -283,6 +282,21 @@ class CComponentsItem : public CComponents ///set an index to item, see also attribut cc_item_index. ///To generate an index, use genIndex() virtual void setIndex(const int& index){cc_item_index = index;}; + + ///set screen x-position, parameter as uint8_t, percent x value related to current width of parent form or screen + virtual void setXPosP(const uint8_t& xpos_percent); + ///set screen y-position, parameter as uint8_t, percent y value related to current height of parent form or screen + virtual void setYPosP(const uint8_t& ypos_percent); + ///set x and y position as percent value related to current parent form or screen dimensions at once + virtual void setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent); + + ///do center item on screen or within a parent form, parameter along_mode assigns direction of centering + virtual void setCenterPos(int along_mode = CC_ALONG_X | CC_ALONG_Y); + + ///set item height, parameter as uint8_t, as percent value related to current height of parent form or screen + virtual void setHeightP(const uint8_t& h_percent); + ///set item width, parameter as uint8_t, as percent value related to current width of parent form or screen + virtual void setWidthP(const uint8_t& w_percent); }; #endif diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 37bda8853..fbf203048 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -31,24 +31,21 @@ #include "cc_frm.h" #include #include - +#include using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsForm from CComponentsItem -CComponentsForm::CComponentsForm() +CComponentsForm::CComponentsForm( const int x_pos, const int y_pos, const int w, const int h, + CComponentsForm* parent, + bool has_shadow, + fb_pixel_t color_frame, + fb_pixel_t color_body, + fb_pixel_t color_shadow) + :CComponentsItem(parent) { - //CComponentsForm - initVarForm(); -} + cc_item_type = CC_ITEMTYPE_FRM; -CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - //CComponentsForm - initVarForm(); - - //CComponents x = x_pos; y = y_pos; cc_xr = x; @@ -60,6 +57,16 @@ CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; + + shadow_w = SHADOW_OFFSET; + corner_rad = RADIUS_LARGE; + corner_type = CORNER_ALL; + cc_item_index = 0; + + v_cc_items.clear(); + + append_x_offset = 0; + append_y_offset = 0; } CComponentsForm::~CComponentsForm() @@ -72,15 +79,12 @@ void CComponentsForm::clear() { if (v_cc_items.empty()) return; -#ifdef DEBUG_CC - printf(" [CComponentsForm] %s... delete %d cc-item(s) \n", __func__, (int)v_cc_items.size()); -#endif for(size_t i=0; igetItemType()); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s... delete form cc-item %d of %d (type=%d)\n", __func__, (int)i+1, (int)v_cc_items.size(), v_cc_items[i]->getItemType()); + delete v_cc_items[i]; v_cc_items[i] = NULL; } @@ -89,54 +93,25 @@ void CComponentsForm::clear() } -void CComponentsForm::initVarForm() -{ - - - //simple default dimensions - x = 0; - y = 0; - width = 150; - height = 150; - shadow = CC_SHADOW_OFF; - shadow_w = SHADOW_OFFSET; - col_frame = COL_MENUCONTENT_PLUS_6; - col_body = COL_MENUCONTENT_PLUS_0; - col_shadow = COL_MENUCONTENTDARK_PLUS_0; - corner_rad = RADIUS_LARGE; - corner_type = CORNER_ALL; - cc_item_index = 0; - - //CComponentsForm - v_cc_items.clear(); - cc_item_type = CC_ITEMTYPE_FRM; - append_x_offset = 0; - append_y_offset = 0; -} - void CComponentsForm::addCCItem(CComponentsItem* cc_Item) { if (cc_Item){ -#ifdef DEBUG_CC - printf(" [CComponentsForm] %s-%d try to add cc_Item [type %d] to form [current index=%d] \n", __func__, __LINE__, cc_Item->getItemType(), cc_item_index); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s-%d try to add cc_Item [type %d] to form [current index=%d] \n", __func__, __LINE__, cc_Item->getItemType(), cc_item_index); + cc_Item->setParent(this); v_cc_items.push_back(cc_Item); -#ifdef DEBUG_CC - printf(" added cc_Item [type %d] to form [current index=%d] \n", cc_Item->getItemType(), cc_item_index); -#endif + + dprintf(DEBUG_DEBUG, "\tadded cc_Item [type %d] to form [current index=%d] \n", cc_Item->getItemType(), cc_item_index); //assign item index int new_index = genIndex(); cc_Item->setIndex(new_index); -#ifdef DEBUG_CC - printf(" %s-%d parent index = %d, assigned index ======> %d\n", __func__, __LINE__, cc_item_index, new_index); -#endif + + dprintf(DEBUG_DEBUG, "\t%s-%d parent index = %d, assigned index ======> %d\n", __func__, __LINE__, cc_item_index, new_index); + } -#ifdef DEBUG_CC else - printf(" [CComponentsForm] %s-%d tried to add an empty or invalide cc_item !!!\n", __func__, __LINE__); -#endif + dprintf(DEBUG_NORMAL, "[CComponentsForm] %s-%d tried to add an empty or invalide cc_item !!!\n", __func__, __LINE__); } void CComponentsForm::addCCItem(const std::vector &cc_Items) @@ -177,7 +152,7 @@ void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new if (!v_cc_items.empty()){ CComponentsItem* old_Item = v_cc_items[cc_item_id]; if (old_Item){ - CComponentsItem * old_parent = old_Item->getParent(); + CComponentsForm * old_parent = old_Item->getParent(); new_cc_Item->setParent(old_parent); new_cc_Item->setIndex(old_parent->getIndex()); delete old_Item; @@ -185,11 +160,8 @@ void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new v_cc_items[cc_item_id] = new_cc_Item; } } -#ifdef DEBUG_CC else - printf("[CComponentsForm] %s replace cc_Item not possible, v_cc_items is empty\n", __func__); -#endif - + dprintf(DEBUG_NORMAL, "[CComponentsForm] %s replace cc_Item not possible, v_cc_items is empty\n", __func__); } void CComponentsForm::replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item) @@ -201,17 +173,13 @@ void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_I { if (cc_Item == NULL){ -#ifdef DEBUG_CC - printf("[CComponentsForm] %s parameter: cc_Item = %p...\n", __func__, cc_Item); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s parameter: cc_Item = %p...\n", __func__, cc_Item); return; } if (v_cc_items.empty()){ addCCItem(cc_Item); -#ifdef DEBUG_CC - printf("[CComponentsForm] %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __func__); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __func__); }else{ v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item); cc_Item->setParent(this); @@ -228,12 +196,11 @@ void CComponentsForm::removeCCItem(const uint& cc_item_id) delete v_cc_items[cc_item_id]; v_cc_items[cc_item_id] = NULL; v_cc_items.erase(v_cc_items.begin()+cc_item_id); + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s removing cc_Item [id=%u]...\n", __func__, cc_item_id); } } -#ifdef DEBUG_CC else - printf("[CComponentsForm] %s removing cc_Item not possible, v_cc_items is empty...\n", __func__); -#endif + dprintf(DEBUG_NORMAL, "[CComponentsForm] %s removing of cc_Item [id=%u] not possible, v_cc_items is empty...\n", __func__, cc_item_id); } void CComponentsForm::removeCCItem(CComponentsItem* cc_Item) diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index d532cdbfc..fc5b21dcd 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -31,8 +31,6 @@ class CComponentsForm : public CComponentsItem { - private: - void initVarForm(); protected: std::vector v_cc_items; void paintForm(bool do_save_bg); @@ -42,10 +40,12 @@ class CComponentsForm : public CComponentsItem int append_x_offset; int append_y_offset; public: - - CComponentsForm(); - CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); virtual ~CComponentsForm(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 005455d5a..69d25ed65 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -37,41 +37,41 @@ using namespace std; -CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, +CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, const std::string& icon_name, - bool selected, bool enabled, bool has_shadow, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarButton(); - cc_btn_icon = icon_name; - cc_btn_capt = caption; - cc_btn_capt_col = COL_MENUCONTENT_TEXT; - - x = x_pos; - y = y_pos; - width = w; - height = h; - shadow = has_shadow; - shadow_w = SHADOW_OFFSET; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - cc_item_enabled = enabled; - cc_item_selected = selected; - fr_thickness = FRAME_TH; + cc_btn_capt_locale = NONEXISTANT_LOCALE; + initVarButton(x_pos, y_pos, w, h, caption, icon_name, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow); } -CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, +CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, const std::string& icon_name, - bool selected, bool enabled, bool has_shadow, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarButton(); - cc_btn_icon = icon_name; cc_btn_capt_locale = caption_locale; - cc_btn_capt = g_Locale->getText(cc_btn_capt_locale); - cc_btn_capt_col = COL_MENUCONTENT_TEXT; - + initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_capt_locale), icon_name, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow); +} + +void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h, + const std::string& caption, + const std::string& icon_name, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + cc_item_type = CC_ITEMTYPE_BUTTON; + x = x_pos; y = y_pos; width = w; @@ -84,18 +84,16 @@ CComponentsButton::CComponentsButton( const int x_pos, const int y_pos, const i cc_item_enabled = enabled; cc_item_selected = selected; fr_thickness = FRAME_TH; -} - -void CComponentsButton::initVarButton() -{ - cc_item_type = CC_ITEMTYPE_BUTTON; + + cc_btn_capt_col = COL_MENUCONTENT_TEXT; cc_btn_icon_obj = NULL; cc_btn_capt_obj = NULL; cc_btn_dy_font = CNeutrinoFonts::getInstance(); cc_btn_font = NULL; - cc_btn_icon = ""; - cc_btn_capt = ""; - cc_btn_capt_locale = NONEXISTANT_LOCALE; + cc_btn_icon = icon_name; + cc_btn_capt = caption; + + initParent(parent); } void CComponentsButton::initIcon() @@ -195,7 +193,7 @@ void CComponentsButton::setCaption(const std::string& text) void CComponentsButton::setCaption(const neutrino_locale_t locale_text) { cc_btn_capt_locale = locale_text; - cc_btn_capt = g_Locale->getText(cc_btn_capt_locale); + setCaption(g_Locale->getText(cc_btn_capt_locale)); } void CComponentsButton::initCCBtnItems() diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index 976433e81..5df275521 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -45,7 +45,14 @@ class CComponentsButton : public CComponentsForm CComponentsLabel *cc_btn_capt_obj; ///initialize all required attributes and objects - void initVarButton(); + void initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h, + const std::string& caption, + const std::string& icon_name, + CComponentsForm* parent, + bool selected, + bool enabled, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow); ///property: button text as string, see also setCaption() and getCaptionString() std::string cc_btn_capt; @@ -72,13 +79,21 @@ class CComponentsButton : public CComponentsForm public: ///basic constructor for button object with most needed params, no button icon is definied here - CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, const std::string& icon_name = "", - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - CComponentsButton( const int x_pos, const int y_pos, const int w, const int h, - const neutrino_locale_t& caption_locale, const std::string& icon_name = "", - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + + CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, + const neutrino_locale_t& caption_locale, + const std::string& icon_name = "", + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ///set text color @@ -108,19 +123,25 @@ Shows a button box with caption and prepared red icon. class CComponentsButtonRed : public CComponentsButton { public: - CComponentsButtonRed( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonRed( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_RED, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_RED, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_RED; }; - CComponentsButtonRed( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonRed( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_RED, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_RED, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_RED; }; @@ -133,19 +154,25 @@ Shows a button box with caption and prepared green icon. class CComponentsButtonGreen : public CComponentsButton { public: - CComponentsButtonGreen( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonGreen( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_GREEN, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_GREEN, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_GREEN; }; - CComponentsButtonGreen( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonGreen( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_GREEN, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_GREEN, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_GREEN; }; @@ -158,19 +185,25 @@ Shows a button box with caption and prepared yellow icon. class CComponentsButtonYellow : public CComponentsButton { public: - CComponentsButtonYellow( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonYellow( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_YELLOW, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_YELLOW, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW; }; - CComponentsButtonYellow( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonYellow( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_YELLOW, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_YELLOW, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_YELLOW; }; @@ -183,19 +216,25 @@ Shows a button box with caption and prepared blue icon. class CComponentsButtonBlue : public CComponentsButton { public: - CComponentsButtonBlue( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonBlue( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_BLUE, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption, NEUTRINO_ICON_BUTTON_BLUE, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_BLUE; }; - CComponentsButtonBlue( const int x_pos, const int y_pos, const int w, const int h, + CComponentsButtonBlue( const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& caption_locale, - bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF, + CComponentsForm *parent = NULL, + bool selected = false, + bool enabled = true, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_BLUE, selected, enabled, has_shadow, color_frame, color_body, color_shadow) + :CComponentsButton(x_pos, y_pos, w, h, caption_locale, NEUTRINO_ICON_BUTTON_BLUE, parent, selected, enabled, has_shadow, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_BUTTON_BLUE; }; diff --git a/src/gui/components/cc_frm_chain.cpp b/src/gui/components/cc_frm_chain.cpp index 6603b18bf..f57be9161 100644 --- a/src/gui/components/cc_frm_chain.cpp +++ b/src/gui/components/cc_frm_chain.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -31,23 +31,21 @@ using namespace std; //sub class CComponentsFrmChain CComponentsFrmChain::CComponentsFrmChain( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::vector *v_items, - bool horizontal, - bool dynamic_width, - bool dynamic_height, + int direction, + CComponentsForm* parent, bool has_shadow, fb_pixel_t& color_frame, fb_pixel_t& color_body, fb_pixel_t& color_shadow) { - initVarChain(x_pos, y_pos, w, h, v_items, horizontal, dynamic_width, dynamic_height, has_shadow, color_frame, color_body, color_shadow); + initVarChain(x_pos, y_pos, w, h, v_items, direction, parent, has_shadow, color_frame, color_body, color_shadow); } void CComponentsFrmChain::initVarChain( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::vector *v_items, - bool horizontal, - bool dynamic_width, - bool dynamic_height, + int direction, + CComponentsForm* parent, bool has_shadow, fb_pixel_t& color_frame, fb_pixel_t& color_body, @@ -66,61 +64,49 @@ void CComponentsFrmChain::initVarChain( const int& x_pos, const int& y_pos, cons col_body = color_body; col_shadow = color_shadow; - chn_horizontal = horizontal; - chn_dyn_height = dynamic_height; - chn_dyn_width = dynamic_width; + chn_direction = direction; - if (v_items){ + if (v_items) addCCItem(*v_items); - initCChainItems(); - } + + initChainItems(); + initParent(parent); } -void CComponentsFrmChain::initCChainItems() +void CComponentsFrmChain::setDirection(int direction) { - if (!v_cc_items.empty()){ - if (chn_dyn_height) - height = 0; - if (chn_dyn_width) - width = 0; - } - + chn_direction = direction; + initChainItems(); +}; + +void CComponentsFrmChain::initChainItems() +{ + //init required dimensions, preferred are current width and height + int w_tmp = width; + int h_tmp = height; + + //exit if no item available + if (v_cc_items.empty()) + return; + + //set new values + w_tmp = append_x_offset; + h_tmp = append_y_offset; + for (size_t i= 0; i< v_cc_items.size(); i++){ - //set general start position for all items - if (i == 0) - v_cc_items[i]->setPos(0, 0); - - //set arrangement with required direction - if (chn_horizontal){ - if (i > 0) - v_cc_items[i]->setPos(CC_APPEND, 0); - } - else{ - if (i > 0) - v_cc_items[i]->setPos(0, CC_APPEND); + if (chn_direction & CC_DIR_X){ + w_tmp += v_cc_items[i]->getWidth(); + w_tmp += append_x_offset; + v_cc_items[i]->setPos(CC_APPEND, CC_CENTERED); } - //assign size - if (chn_horizontal){ - //assign dynamic width - if (chn_dyn_width) - width += v_cc_items[i]->getWidth(); - //assign dynamic height - if (chn_dyn_height) - height = max(v_cc_items[i]->getHeight(), height); - else - v_cc_items[i]->setHeight(height); - } - else{ - //assign dynamic height - if (chn_dyn_height) - height += v_cc_items[i]->getHeight(); - //assign dynamic width - if (chn_dyn_width) - width = max(v_cc_items[i]->getWidth(), width); - else - v_cc_items[i]->setWidth(width); + if (chn_direction & CC_DIR_Y){ + h_tmp += v_cc_items[i]->getHeight(); + h_tmp += append_y_offset; + v_cc_items[i]->setPos(CC_CENTERED, CC_APPEND); } } + width = max (w_tmp, width); + height = max (h_tmp, height); } diff --git a/src/gui/components/cc_frm_chain.h b/src/gui/components/cc_frm_chain.h index d18461f06..3005942d6 100644 --- a/src/gui/components/cc_frm_chain.h +++ b/src/gui/components/cc_frm_chain.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -36,43 +36,46 @@ You can set default form parameters like position, size, colors etc. and additi to display with defined direction. */ +//direction types +enum +{ + CC_DIR_X = 0x1, + CC_DIR_Y = 0x2 +}; + class CComponentsFrmChain : public CComponentsForm { private: - ///property: defined arrangement mode of items, can be vertical or horizontal - int chn_horizontal; - - ///property: defines height from sum of all contained items - bool chn_dyn_height; - ///property: defines width from sum of all contained items - bool chn_dyn_width; - ///init all required variables void initVarChain( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::vector *v_items, - bool horizontal, - bool dynamic_width, - bool dynamic_height, + int direction, + CComponentsForm* parent, bool has_shadow, fb_pixel_t& color_frame, fb_pixel_t& color_body, fb_pixel_t& color_shadow); - - void initCChainItems(); protected: + ///property: mode for arrangement direction of items, see also setDirection(), getDirection() + int chn_direction; + void initChainItems(); public: CComponentsFrmChain( const int& x_pos = 1, const int& y_pos = 1, const int& w = 720, const int& h = 32, const std::vector *v_items = NULL, - bool horizontal = true, - bool dynamic_width = false, - bool dynamic_height = false, + int direction = CC_DIR_X, + CComponentsForm* parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t& color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t& color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t& color_shadow = COL_MENUCONTENTDARK_PLUS_0); // ~CComponentsSlider(); //inherited from CComponentsForm + + ///defines mode for arrangement direction of items, see also chn_direction + virtual void setDirection(int direction); + ///gets the mode of arrangment direction + virtual int getDirection(){return chn_direction;}; }; #endif diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index e329ed275..12dfbaeb1 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -41,16 +41,12 @@ using namespace std; CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, const int& y_pos, const int& w, const int& h, - const char* format_str, bool activ, bool has_shadow, + const char* format_str, + bool activ, + CComponentsForm* parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - initVarClock(x_pos, y_pos, w, h, format_str, activ, has_shadow, color_frame, color_body, color_shadow); -} - -void CComponentsFrmClock::initVarClock( const int& x_pos, const int& y_pos, const int& w, const int& h, - const char* format_str, bool activ, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { x = x_pos; y = y_pos; @@ -80,14 +76,17 @@ void CComponentsFrmClock::initVarClock( const int& x_pos, const int& y_pos, cons paintClock = false; activeClock = activ; + + initCCLockItems(); + initParent(parent); + if (activeClock) startThread(); } CComponentsFrmClock::~CComponentsFrmClock() { - if (activeClock) - stopThread(); + stopThread(); } void CComponentsFrmClock::initTimeString() diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index 81e0e7a59..f8725cd4a 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -57,7 +57,7 @@ class CComponentsFrmClock : public CComponentsForm ///raw time chars char cl_timestr[20]; - ///allow to paint clock within thread and is not similar to cc_allow_paint + ///handle paint clock within thread and is not similar to cc_allow_paint bool paintClock; //TODO: please add comments! bool activeClock; @@ -77,11 +77,6 @@ class CComponentsFrmClock : public CComponentsForm ///time string align, default allign is ver and hor centered int cl_align; - ///initialize all attributes and required objects - void initVarClock( const int& x_pos, const int& y_pos, const int& w, const int& h, - const char* format_str, bool activ, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow); - ///initialize clock contents void initCCLockItems(); ///initialize timestring, called in initCCLockItems() @@ -94,7 +89,10 @@ class CComponentsFrmClock : public CComponentsForm public: CComponentsFrmClock( const int& x_pos = 1, const int& y_pos = 1, const int& w = 200, const int& h = 48, - const char* format_str = "%H:%M", bool activ=false, bool has_shadow = CC_SHADOW_OFF, + const char* format_str = "%H:%M", + bool activ=false, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); virtual ~CComponentsFrmClock(); diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 05196bd78..b3e3e263e 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -36,28 +36,32 @@ using namespace std; CComponentsExtTextForm::CComponentsExtTextForm( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& label_text, const std::string& text, + CComponentsForm* parent, bool has_shadow, fb_pixel_t label_color, fb_pixel_t text_color, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarExtTextForm(x_pos, y_pos, w, h, label_text, text, has_shadow, label_color, text_color, color_frame, color_body, color_shadow); + initVarExtTextForm(x_pos, y_pos, w, h, label_text, text, parent, has_shadow, label_color, text_color, color_frame, color_body, color_shadow); initCCTextItems(); } CComponentsExtTextFormLocalized::CComponentsExtTextFormLocalized(const int& x_pos, const int& y_pos, const int& w, const int& h, const neutrino_locale_t& locale_label_text, const neutrino_locale_t& locale_text, + CComponentsForm* parent, bool has_shadow, fb_pixel_t label_color, fb_pixel_t text_color, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) : CComponentsExtTextForm( x_pos, y_pos, w, h, g_Locale->getText(locale_label_text), g_Locale->getText(locale_text), + parent, has_shadow, label_color, text_color, color_frame, color_body, color_shadow){}; void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& label_text, const std::string& text, + CComponentsForm* parent, bool has_shadow, fb_pixel_t label_color, fb_pixel_t text_color, @@ -90,7 +94,8 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p int dx = 0, dy = DEF_HEIGHT; ccx_font = *(CNeutrinoFonts::getInstance()->getDynFont(dx, dy)); ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK; - + + initParent(parent); } diff --git a/src/gui/components/cc_frm_ext_text.h b/src/gui/components/cc_frm_ext_text.h index 59a837b97..66a2172fb 100644 --- a/src/gui/components/cc_frm_ext_text.h +++ b/src/gui/components/cc_frm_ext_text.h @@ -68,6 +68,7 @@ class CComponentsExtTextForm : public CComponentsForm ///initialize basic variables void initVarExtTextForm(const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& label_text, const std::string& text, + CComponentsForm* parent, bool has_shadow, fb_pixel_t label_color, fb_pixel_t text_color, @@ -77,10 +78,13 @@ class CComponentsExtTextForm : public CComponentsForm ///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as string CComponentsExtTextForm( const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48, const std::string& label_text = "", const std::string& text = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT, fb_pixel_t text_color = COL_MENUCONTENT_TEXT, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); // ~CComponentsExtTextForm(); //inherited from CComponentsForm ///assigns texts for label and text, parameter as string, parameter Font is optional for required font type, default font is dependently from defined item height @@ -119,6 +123,7 @@ class CComponentsExtTextFormLocalized : public CComponentsExtTextForm ///advanced constructor for CComponentsExtTextForm, provides parameters for the most required properties, and caption as locales CComponentsExtTextFormLocalized(const int& x_pos = 1, const int& y_pos = 1, const int& w = 300, const int& h = 48, const neutrino_locale_t& locale_label_text = NONEXISTANT_LOCALE, const neutrino_locale_t& locale_text = NONEXISTANT_LOCALE, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t label_color = COL_MENUCONTENTINACTIVE_TEXT, fb_pixel_t text_color = COL_MENUCONTENT_TEXT, diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 59d5c6154..2fa63df8e 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -33,25 +33,27 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsFooter inherit from CComponentsHeader -CComponentsFooter::CComponentsFooter() +CComponentsFooter::CComponentsFooter(CComponentsForm* parent) { //CComponentsFooter - initVarFooter(1, 1, 0, 0); + initVarFooter(1, 1, 0, 0, 0, parent); } CComponentsFooter::CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow ) { //CComponentsFooter - initVarFooter(x_pos, y_pos, w, h, buttons, has_shadow, color_frame, color_body, color_shadow); + initVarFooter(x_pos, y_pos, w, h, buttons, parent, has_shadow, color_frame, color_body, color_shadow); } void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -71,7 +73,6 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const else height = cch_font->getHeight(); - cch_buttons = buttons; shadow = has_shadow; col_frame = color_frame; col_body = color_body; @@ -80,6 +81,7 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const corner_rad = RADIUS_LARGE; corner_type = CORNER_BOTTOM; - initDefaultButtons(); + addContextButton(buttons); initCCItems(); + initParent(parent); } diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index dd96a02bd..f0fad0646 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -36,14 +36,16 @@ class CComponentsFooter : public CComponentsHeader protected: void initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); public: - CComponentsFooter(); + CComponentsFooter(CComponentsForm *parent = NULL); CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1, diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 4c1cc4c4b..248977542 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -29,33 +29,35 @@ #include #include #include "cc_frm_header.h" - +#include using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsHeader inherit from CComponentsForm -CComponentsHeader::CComponentsHeader() +CComponentsHeader::CComponentsHeader(CComponentsForm* parent) { //CComponentsHeader - initVarHeader(1, 1, 0, 0, "", "", 0); + initVarHeader(1, 1, 0, 0, "", "", 0, parent); } CComponentsHeader::CComponentsHeader( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption, const std::string& icon_name, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarHeader(x_pos, y_pos, w, h, caption, icon_name, buttons, has_shadow, color_frame, color_body, color_shadow); + initVarHeader(x_pos, y_pos, w, h, caption, icon_name, buttons, parent, has_shadow, color_frame, color_body, color_shadow); } CComponentsHeaderLocalized::CComponentsHeaderLocalized( const int& x_pos, const int& y_pos, const int& w, const int& h, neutrino_locale_t caption_locale, const std::string& icon_name, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -63,6 +65,7 @@ CComponentsHeaderLocalized::CComponentsHeaderLocalized( const int& x_pos, const :CComponentsHeader( x_pos, y_pos, w, h, g_Locale->getText(caption_locale), icon_name, buttons, + parent, has_shadow, color_frame, color_body, color_shadow){}; @@ -70,6 +73,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const const std::string& caption, const std::string& icon_name, const int& buttons, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -96,7 +100,6 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const col_body = COL_MENUHEAD_PLUS_0; cch_text = caption; cch_icon_name = icon_name; - cch_buttons = buttons; corner_rad = RADIUS_LARGE, corner_type = CORNER_TOP; @@ -111,19 +114,16 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const cch_icon_x = cch_offset; cch_icon_w = 0; cch_text_x = cch_offset; - cch_buttons_w = 0; - cch_buttons_h = 0; cch_buttons_space = cch_offset; - initDefaultButtons(); + addContextButton(buttons); initCCItems(); + initParent(parent); } CComponentsHeader::~CComponentsHeader() { -#ifdef DEBUG_CC - printf("[~CComponentsHeader] [%s - %d] delete...\n", __func__, __LINE__); -#endif + dprintf(DEBUG_DEBUG, "[~CComponentsHeader] [%s - %d] delete...\n", __func__, __LINE__); v_cch_btn.clear(); } @@ -167,7 +167,7 @@ void CComponentsHeader::initCaptionFont(Font* font) void CComponentsHeader::setIcon(const char* icon_name) { if (icon_name){ - string s_icon = static_cast(icon_name); + string s_icon = string(icon_name); setIcon(s_icon); } else @@ -191,20 +191,12 @@ void CComponentsHeader::initIcon() return; } - //create instance for cch_icon_obj + //create instance for cch_icon_obj and add to container at once if (cch_icon_obj == NULL){ -#ifdef DEBUG_CC - printf(" [CComponentsHeader]\n [%s - %d] init header icon: %s\n", __func__, __LINE__, cch_icon_name.c_str()); -#endif - cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); + dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init header icon: %s\n", __func__, __LINE__, cch_icon_name.c_str()); + cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, this); } - //add item only one time - if (!cch_icon_obj->isAdded()) - addCCItem(cch_icon_obj); //icon - - - //set properties for icon object if (cch_icon_obj){ //get dimensions of header icon @@ -214,7 +206,6 @@ void CComponentsHeader::initIcon() cch_icon_obj->setWidth(iw); cch_icon_obj->setHeight(ih); cch_icon_obj->doPaintBg(false); - cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); //set corner mode of icon item int cc_icon_corner_type = corner_type; @@ -235,57 +226,36 @@ void CComponentsHeader::initIcon() } } -void CComponentsHeader::addButtonIcon(const std::string& button_name) +void CComponentsHeader::addContextButton(const std::string& button_name) { v_cch_btn.push_back(button_name); - initButtons(); + dprintf(DEBUG_DEBUG, "[CComponentsHeader] %s added %d default buttons...\n", __func__, (int)v_cch_btn.size()); } -void CComponentsHeader::removeButtonIcons() +void CComponentsHeader::addContextButton(const std::vector& v_button_names) { + for (size_t i= 0; i< v_button_names.size(); i++) + addContextButton(v_button_names[i]); +} + +void CComponentsHeader::addContextButton(const int& buttons) +{ + if (buttons & CC_BTN_EXIT) + addContextButton(NEUTRINO_ICON_BUTTON_HOME); + if (buttons & CC_BTN_HELP) + addContextButton(NEUTRINO_ICON_BUTTON_HELP); + if (buttons & CC_BTN_INFO) + addContextButton(NEUTRINO_ICON_BUTTON_INFO); + if (buttons & CC_BTN_MENU) + addContextButton(NEUTRINO_ICON_BUTTON_MENU); +} + +void CComponentsHeader::removeContextButtons() +{ + dprintf(DEBUG_DEBUG, "[CComponentsHeader]\t [%s - %d] removing %u context buttons...\n", __func__, __LINE__, v_cch_btn.size()); v_cch_btn.clear(); - cch_btn_obj->removeAllIcons(); - initButtons(); -} - -void CComponentsHeader::initDefaultButtons() -{ - if (cch_buttons & CC_BTN_EXIT) - v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HOME); - if (cch_buttons & CC_BTN_HELP) - v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HELP); - if (cch_buttons & CC_BTN_INFO) - v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_INFO); - if (cch_buttons & CC_BTN_MENU) - v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_MENU); -#ifdef DEBUG_CC - printf("[CComponentsHeader] %s added %d default buttons...\n", __func__, (int)v_cch_btn.size()); -#endif -} - -void CComponentsHeader::setDefaultButtons(const int buttons) -{ - cch_buttons = buttons; - v_cch_btn.clear(); - initDefaultButtons(); -} - -// calculate minimal width of icon form -void CComponentsHeader::initButtonFormSize() -{ - cch_buttons_w = 0; - cch_buttons_h = 0; - - if (cch_btn_obj == NULL) - return; - - for(size_t i=0; igetIconSize(v_cch_btn[i].c_str(), &bw, &bh); - cch_buttons_w += (bw + cch_buttons_space); - cch_buttons_h = std::max(cch_buttons_h, bh); - } - cch_buttons_w -= cch_buttons_space; + if (cch_btn_obj) + cch_btn_obj->clear();; } void CComponentsHeader::initButtons() @@ -293,30 +263,21 @@ void CComponentsHeader::initButtons() //exit if no button defined if (v_cch_btn.empty()){ if (cch_btn_obj) - delete cch_btn_obj; - cch_btn_obj = NULL; + cch_btn_obj->clear(); //clean up, but hold instance return; } - - initButtonFormSize(); + //create instance for header buttons chain object and add to container if (cch_btn_obj == NULL){ - cch_btn_obj = new CComponentsIconForm(); -#ifdef DEBUG_CC - printf(" [CComponentsHeader]\n [%s - %d] init header buttons...\n", __func__, __LINE__); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init header buttons...\n", __func__, __LINE__); + cch_btn_obj = new CComponentsIconForm(this); } - //add button form only one time - if (!cch_btn_obj->isAdded()) - addCCItem(cch_btn_obj); //buttons - //set button form properties if (cch_btn_obj){ - cch_btn_obj->setDimensionsAll(width-cch_offset-cch_buttons_w, cch_items_y, cch_buttons_w, cch_buttons_h); + cch_btn_obj->setDimensionsAll(0, cch_items_y, 0, 0); cch_btn_obj->doPaintBg(false); - cch_btn_obj->setIconOffset(cch_buttons_space); - cch_btn_obj->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); + cch_btn_obj->setAppendOffset(cch_buttons_space, 0); cch_btn_obj->removeAllIcons(); cch_btn_obj->addIcon(v_cch_btn); @@ -350,14 +311,19 @@ void CComponentsHeader::initCaption() //calc width of text object in header cc_text_w = width-cch_text_x-cch_offset; - if (cch_buttons_w) - cc_text_w -= cch_buttons_w-cch_offset; + int buttons_w = 0; + if (cch_btn_obj){ + //get width of buttons object + buttons_w = cch_btn_obj->getWidth(); + //set x position of buttons + cch_btn_obj->setXPos(width - buttons_w); + } + //set required width of caption object + cc_text_w -= buttons_w-cch_offset; //create cch_text_obj and add to collection if (cch_text_obj == NULL){ -#ifdef DEBUG_CC - printf(" [CComponentsHeader]\n [%s - %d] init header text: %s [ x %d w %d ]\n", __func__, __LINE__, cch_text.c_str(), cch_text_x, cc_text_w); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init header text: %s [ x %d w %d ]\n", __func__, __LINE__, cch_text.c_str(), cch_text_x, cc_text_w); cch_text_obj = new CComponentsText(); } @@ -371,7 +337,7 @@ void CComponentsHeader::initCaption() if (cch_caption_align == CTextBox::CENTER) cch_text_x = CC_CENTERED; cch_text_obj->setDimensionsAll(cch_text_x, cch_items_y, cc_text_w, height); - cch_text_obj->doPaintBg(false); + cch_text_obj->doPaintBg(true); cch_text_obj->setText(cch_text, cch_caption_align, cch_font); cch_text_obj->forceTextPaint(); //here required cch_text_obj->setTextColor(cch_col_text); diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 7756b269e..d30522d0b 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -42,6 +42,7 @@ class CComponentsHeader : public CComponentsForm const std::string& caption = "header", const std::string& = "", const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, @@ -52,7 +53,7 @@ class CComponentsHeader : public CComponentsForm CComponentsPicture * cch_icon_obj; ///object: caption object, see also setCaption() CComponentsText * cch_text_obj; - ///object: context button object, see also addButtonIcon(), removeButtonIcons() + ///object: context button object, see also addContextButton(), removeContextButtons() CComponentsIconForm * cch_btn_obj; ///property: caption text, see also setCaption() @@ -72,17 +73,11 @@ class CComponentsHeader : public CComponentsForm int cch_icon_w; ///property: internal x-position for caption object int cch_text_x; - ///property: internal context button definition button icons, see modes CC_BTN_HELP, CC_BTN_INFO, CC_BTN_MENU, CC_BTN_EXIT - int cch_buttons; - ///property: internal width for context button object - int cch_buttons_w; - ///property: internal height for context button object - int cch_buttons_h; ///property: internal offset of context button icons within context button object int cch_buttons_space; ///property: internal offset for header items int cch_offset; - ///property: internal container of icon names for context button object, see also addButtonIcon() + ///property: internal container of icon names for context button object, see also addContextButton() std::vector v_cch_btn; ///property: size of header, possible values are CC_HEADER_SIZE_LARGE, CC_HEADER_SIZE_SMALL int cch_size_mode; @@ -97,10 +92,6 @@ class CComponentsHeader : public CComponentsForm void initCaption(); ///sub: init context button object void initButtons(); - ///sub: init default buttons for context button object - void initDefaultButtons(); - ///sub: init default buttons for context button object - void initButtonFormSize(); public: enum @@ -110,11 +101,12 @@ class CComponentsHeader : public CComponentsForm CC_HEADER_ITEM_BUTTONS = 2 }; - CComponentsHeader(); + CComponentsHeader(CComponentsForm *parent = NULL); CComponentsHeader( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, const std::string& caption = "", const std::string& = "", const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, @@ -141,10 +133,23 @@ class CComponentsHeader : public CComponentsForm ///set name of icon virtual void setIcon(const std::string& icon_name); - ///add separate button icons to context button object - virtual void addButtonIcon(const std::string& button_name); - ///remove button icons from context button object - virtual void removeButtonIcons(); + ///context buttons are to find on the right part of header + ///add a single context button icon to the header object, arg as string, icon will just add, existing icons are preserved + virtual void addContextButton(const std::string& button_name); + ///add a group of context button icons to the header object, arg as string vector, icons will just add, existing icons are preserved + virtual void addContextButton(const std::vector& v_button_names); + ///add a single context button icon or combined button icons to the header object, possible types are for example: CC_BTN_HELP, CC_BTN_INFO, CC_BTN_MENU, CC_BTN_EXIT + ///icons will just add, existing icons are preserved + virtual void addContextButton(const int& buttons); + ///remove context buttons from context button object + virtual void removeContextButtons(); + ///sets a single context button icon to the header object, arg as string, existing buttons are removed + virtual void setContextButton(const std::string& button_name){removeContextButtons(); addContextButton(button_name);}; + ///sets a group of context button icons to the header object, arg as string vector, existing buttons are removed + virtual void setContextButton(const std::vector& v_button_names){removeContextButtons(); addContextButton(v_button_names);}; + ///sets a single context button icon or combined button icons to the header object, possible types are for example: CC_BTN_HELP, CC_BTN_INFO, CC_BTN_MENU, CC_BTN_EXIT + ///existing buttons are removed + virtual void setContextButton(const int& buttons){removeContextButtons(); addContextButton(buttons);}; enum { @@ -154,8 +159,6 @@ class CComponentsHeader : public CComponentsForm CC_BTN_EXIT = 0x80 }; - ///set internal context button icons, possible modes CC_BTN_HELP, CC_BTN_INFO, CC_BTN_MENU, CC_BTN_EXIT - virtual void setDefaultButtons(const int buttons); ///set offset between icons within context button object virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;}; @@ -188,6 +191,7 @@ class CComponentsHeaderLocalized : public CComponentsHeader neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const std::string& = "", const int& buttons = 0, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp index aa6b84d92..67349abf8 100644 --- a/src/gui/components/cc_frm_icons.cpp +++ b/src/gui/components/cc_frm_icons.cpp @@ -33,21 +33,23 @@ using namespace std; //sub class CComponentsIconForm inherit from CComponentsForm -CComponentsIconForm::CComponentsIconForm() +CComponentsIconForm::CComponentsIconForm(CComponentsForm* parent) { - initVarIconForm(1, 1, 0, 0, vector()); + initVarIconForm(1, 1, 0, 0, vector(), parent); } CComponentsIconForm::CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::vector &v_icon_names, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarIconForm(x_pos, y_pos, w, h, v_icon_names, has_shadow, color_frame, color_body, color_shadow); + initVarIconForm(x_pos, y_pos, w, h, v_icon_names, parent, has_shadow, color_frame, color_body, color_shadow); } void CComponentsIconForm::initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::vector &v_icon_names, + CComponentsForm* parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { @@ -63,51 +65,52 @@ void CComponentsIconForm::initVarIconForm( const int &x_pos, const int &y_pos, c col_body = color_body; col_shadow = color_shadow; - ccif_offset = 2; - ccif_icon_align = CC_ICONS_FRM_ALIGN_LEFT; + chn_direction = CC_DIR_X; + + append_y_offset = 2; + + initChainItems(); + initParent(parent); } void CComponentsIconForm::addIcon(const std::string& icon_name) { - v_icons.push_back(icon_name); + //create new cc-picture item object + CComponentsPicture *ccp = new CComponentsPicture(0, 0, 0, 0, icon_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, this); + ccp->doPaintBg(false); + + initChainItems(); } void CComponentsIconForm::addIcon(std::vector icon_name) { for (size_t i= 0; i< icon_name.size(); i++) - v_icons.push_back(icon_name[i]); + addIcon(icon_name[i]); } void CComponentsIconForm::insertIcon(const uint& icon_id, const std::string& icon_name) { - v_icons.insert(v_icons.begin()+icon_id, icon_name); + //create new cc-picture item object + CComponentsPicture *ccp = new CComponentsPicture(0, 0, 0, 0, icon_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); + ccp->doPaintBg(false); + + insertCCItem(icon_id, ccp); + initChainItems(); } void CComponentsIconForm::removeIcon(const uint& icon_id) { - v_icons.erase(v_icons.begin()+icon_id); -} - -void CComponentsIconForm::removeIcon(const std::string& icon_name) -{ - int id = getIconId(icon_name); - removeIcon(id); -} - -int CComponentsIconForm::getIconId(const std::string& icon_name) -{ - for (size_t i= 0; i< v_icons.size(); i++) - if (v_icons[i] == icon_name) - return i; - return -1; + removeCCItem(icon_id); + initChainItems(); } //For existing instances it's recommended //to remove old items before add new icons, otherwise icons will be appended. -void CComponentsIconForm::removeAllIcons() +void CComponentsIconForm::removeAllIcons()//TODO { clear(); v_icons.clear(); + initChainItems(); } //get maximal form height depends of biggest icon height, but don't touch defined form height @@ -120,72 +123,3 @@ void CComponentsIconForm::initMaxHeight(int *pheight) } } -void CComponentsIconForm::initCCIcons() -{ - int ccp_y = 0; - int ccp_h = 0; - int ccp_w = 0; - //calculate start pos of first icon - int ccp_x = 0 + fr_thickness; //CC_ICONS_FRM_ALIGN_LEFT; - - if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) - ccp_x += (width - fr_thickness); - - //get width of first icon - frameBuffer->getIconSize(v_icons[0].c_str(), &ccp_w, &ccp_h); - - //get maximal form height - int h = 0; - initMaxHeight(&h); - - //set xpos of first icon with right alignment, icon must positionized on the right border reduced with icon width - if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) - ccp_x -= ccp_w; - - //init and add item objects - size_t i_cnt = v_icons.size(); //icon count - - for (size_t i= 0; i< i_cnt; i++){ - //create new cc-picture item object - CComponentsPicture *ccp = new CComponentsPicture(ccp_x, ccp_y, ccp_w, h, v_icons[i]); - ccp->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); - ccp->doPaintBg(false); - //add item to form - addCCItem(ccp); - - //reset current width for next object - ccp_w = 0; - //get next icon size if available - size_t next_i = i+1; - if (next_i != i_cnt) - frameBuffer->getIconSize(v_icons[next_i].c_str(), &ccp_w, &ccp_h); - - //set next icon position - int tmp_offset = ( igetWidth() + tmp_offset); - if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) - ccp_x -= (ccp_w + tmp_offset); - } - - //calculate width and height of form - int w_tmp = 0; - int h_tmp = 0; - for (size_t i= 0; i< i_cnt; i++){ - w_tmp += v_cc_items[i]->getWidth()+ccif_offset+fr_thickness; - h_tmp = max(h_tmp, v_cc_items[i]->getHeight()+2*fr_thickness); - - } - width = max(w_tmp, width); - height = max(h_tmp, height); -} - -void CComponentsIconForm::paint(bool do_save_bg) -{ - //init and add icons - initCCIcons(); - - //paint form contents - paintForm(do_save_bg); -} diff --git a/src/gui/components/cc_frm_icons.h b/src/gui/components/cc_frm_icons.h index 83b86c5f8..302294800 100644 --- a/src/gui/components/cc_frm_icons.h +++ b/src/gui/components/cc_frm_icons.h @@ -24,51 +24,39 @@ #ifndef __CC_FORM_ICONS_H__ #define __CC_FORM_ICONS_H__ -#include "cc_frm.h" +#include "cc_frm_chain.h" -class CComponentsIconForm : public CComponentsForm +class CComponentsIconForm : public CComponentsFrmChain { private: std::vector v_icons; - int ccif_offset, ccif_icon_align; void initMaxHeight(int *pheight); protected: void initVarIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::vector &v_icon_names, + CComponentsForm* parent, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); public: - CComponentsIconForm(); + CComponentsIconForm(CComponentsForm *parent = NULL); CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::vector &v_icon_names, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); // ~CComponentsIconForm(); //inherited from CComponentsForm - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void initCCIcons(); void addIcon(const std::string& icon_name); void addIcon(std::vector icon_name); void removeIcons(){v_icons.clear();}; void insertIcon(const uint& icon_id, const std::string& icon_name); void removeIcon(const uint& icon_id); - void removeIcon(const std::string& icon_name); void removeAllIcons(); - void setIconOffset(const int offset){ccif_offset = offset;}; - - enum //alignements - { - CC_ICONS_FRM_ALIGN_RIGHT , - CC_ICONS_FRM_ALIGN_LEFT - }; - void setIconAlign(int alignment){ccif_icon_align = alignment;}; - - int getIconId(const std::string& icon_name); }; #endif diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index 1b2d21295..7b44dee5b 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Class for signalbar based up CComponent classes. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-1014, Thilo Graf 'dbt' License: GPL @@ -37,16 +37,17 @@ using namespace std; -CSignalBar::CSignalBar() +CSignalBar::CSignalBar(CComponentsForm *parent) { initVarSigBar(); sb_name = "SIG"; initDimensions(); initSBItems(); + initParent(parent); } -CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname) +CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const string& sbname, CComponentsForm *parent) { initVarSigBar(); sb_frontend = frontend_ref; @@ -58,6 +59,7 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int initDimensions(); initSBItems(); + initParent(parent); } void CSignalBar::initDimensions() @@ -256,7 +258,7 @@ void CSignalNoiseRatioBar::Refresh() //********************************************************************************************************************** -CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vert) +CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vert, CComponentsForm *parent) { initVarSigBox(); vertical = vert; @@ -284,6 +286,7 @@ CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int addCCItem(snrbar); initSignalItems(); + initParent(parent); } void CSignalBox::initVarSigBox() diff --git a/src/gui/components/cc_frm_signalbars.h b/src/gui/components/cc_frm_signalbars.h index c7474ffa7..a5cb7dcd9 100644 --- a/src/gui/components/cc_frm_signalbars.h +++ b/src/gui/components/cc_frm_signalbars.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Class for signalbar based up CComponent classes. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -110,9 +110,9 @@ class CSignalBar : public CComponentsForm std::string sb_name; public: - CSignalBar(); + CSignalBar(CComponentsForm *parent = NULL); ///basic component class constructor for signal. - CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG"); + CSignalBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& sb_name = "SIG", CComponentsForm *parent = NULL); ///assigns the current used frontend, simplified a tuner object, see frontend_c.h virtual void setFrontEnd(CFrontend *frontend_ref){sb_frontend = frontend_ref;}; @@ -157,10 +157,11 @@ class CSignalNoiseRatioBar : public CSignalBar void Refresh(); public: - CSignalNoiseRatioBar(){}; + CSignalNoiseRatioBar(CComponentsForm *parent = NULL) + : CSignalBar(parent){}; ///basic component class constructor for signal noise ratio. - CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref) - : CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR"){}; + CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, CComponentsForm *parent = NULL) + : CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR", parent){}; }; /// Class CSignalBox() provides CSignalBar(), CSignalNoiseRatioBar() scales at once. @@ -268,7 +269,7 @@ class CSignalBox : public CComponentsForm public: ///class constructor for signal noise ratio. - CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref = NULL, const bool vertical = true); + CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref = NULL, const bool vertical = true, CComponentsForm *parent = NULL); ///returns the signal object, type = CSignalBar* CSignalBar* getScaleObject(){return sbar;}; diff --git a/src/gui/components/cc_frm_slider.cpp b/src/gui/components/cc_frm_slider.cpp index f61b37fa6..bed4cbd64 100644 --- a/src/gui/components/cc_frm_slider.cpp +++ b/src/gui/components/cc_frm_slider.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -33,20 +33,7 @@ CComponentsSlider::CComponentsSlider( const int& x_pos, const int& y_pos, const const int& current_value, const int& min_value, const int& max_value, - bool has_shadow, - fb_pixel_t& color_frame, - fb_pixel_t& color_body, - fb_pixel_t& color_shadow) -{ - initVarSlider(x_pos, y_pos, w, h, current_value, min_value, max_value, has_shadow, color_frame, color_body, color_shadow); - initCCSlItems(); -} - - -void CComponentsSlider::initVarSlider( const int& x_pos, const int& y_pos, const int& w, const int& h, - const int& current_value, - const int& min_value, - const int& max_value, + CComponentsForm *parent, bool has_shadow, fb_pixel_t& color_frame, fb_pixel_t& color_body, @@ -74,6 +61,9 @@ void CComponentsSlider::initVarSlider( const int& x_pos, const int& y_pos, const csl_body_icon = NEUTRINO_ICON_VOLUMEBODY; csl_slider_icon =NEUTRINO_ICON_VOLUMESLIDER2; + + initCCSlItems(); + initParent(parent); } //set current value diff --git a/src/gui/components/cc_frm_slider.h b/src/gui/components/cc_frm_slider.h index 9241dc49c..08395d759 100644 --- a/src/gui/components/cc_frm_slider.h +++ b/src/gui/components/cc_frm_slider.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2013, Thilo Graf 'dbt' + Copyright (C) 2013-2014, Thilo Graf 'dbt' License: GPL @@ -60,23 +60,12 @@ class CComponentsSlider : public CComponentsForm ///init all items at once void initCCSlItems(); - ///init all required variables - void initVarSlider( const int& x_pos, const int& y_pos, const int& w, const int& h, - const int& current_value, - const int& min_value, - const int& max_value, - bool has_shadow, - fb_pixel_t& color_frame, - fb_pixel_t& color_body, - fb_pixel_t& color_shadow); - protected: - - public: - CComponentsSlider( const int& x_pos = 1, const int& y_pos = 1, const int& w = 120+16, const int& h = 32, + CComponentsSlider( const int& x_pos = 0, const int& y_pos = 0, const int& w = 120+16, const int& h = 32, const int& current_value = 0, const int& min_value = 0, const int& max_value = 100, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t& color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t& color_body = COL_MENUHEAD_PLUS_0, diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index f5021d580..ed0d536ad 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, 2014 Thilo Graf 'dbt' + Copyright (C) 2012-2014 Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -29,62 +29,66 @@ #include #include #include "cc_frm_window.h" -#include - +#include using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsWindow inherit from CComponentsForm -CComponentsWindow::CComponentsWindow() +CComponentsWindow::CComponentsWindow(CComponentsForm *parent) { - initVarWindow(); + initVarWindow(0, 0, 800, 600, "", "", parent); } CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, neutrino_locale_t locale_caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { string s_caption = locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : ""; - initVarWindow(x_pos, y_pos, w, h, s_caption, iconname, has_shadow, color_frame, color_body, color_shadow); + initVarWindow(x_pos, y_pos, w, h, s_caption, iconname, parent, has_shadow, color_frame, color_body, color_shadow); } CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const string& caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarWindow(x_pos, y_pos, w, h, caption, iconname, has_shadow, color_frame, color_body, color_shadow); + initVarWindow(x_pos, y_pos, w, h, caption, iconname, parent, has_shadow, color_frame, color_body, color_shadow); } CComponentsWindowMax::CComponentsWindowMax( const string& caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) :CComponentsWindow(0, 0, 0, 0, caption, - iconname, has_shadow, color_frame, color_body, color_shadow){}; + iconname, parent, has_shadow, color_frame, color_body, color_shadow){}; CComponentsWindowMax::CComponentsWindowMax( neutrino_locale_t locale_caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) :CComponentsWindow(0, 0, 0, 0, locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "", - iconname, has_shadow, color_frame, color_body, color_shadow){}; + iconname, parent, has_shadow, color_frame, color_body, color_shadow){}; void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const string& caption, const string& iconname, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, @@ -104,9 +108,9 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const ccw_caption = caption; ccw_icon_name = iconname; -#ifdef DEBUG_CC - printf("[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str()); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str()); + shadow = has_shadow; col_frame = color_frame; col_body = color_body; @@ -122,6 +126,7 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const ccw_align_mode = CTextBox::NO_AUTO_LINEBREAK; initCCWItems(); + initParent(parent); } void CComponentsWindow::initWindowSize() @@ -146,11 +151,6 @@ void CComponentsWindow::initWindowPos() y = frameBuffer->getScreenY(); } -void CComponentsWindow::doCenter(){ - x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width); - y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height); -} - void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const int& align_mode) { ccw_caption = g_Locale->getText(locale_text); @@ -168,7 +168,7 @@ void CComponentsWindow::initHeader() ccw_head->setPos(0, 0); ccw_head->setIcon(ccw_icon_name); ccw_head->setCaption(ccw_caption, ccw_align_mode); - ccw_head->setDefaultButtons(ccw_buttons); + ccw_head->setContextButton(ccw_buttons); ccw_head->setCorner(corner_rad, CORNER_TOP); } } @@ -209,9 +209,8 @@ void CComponentsWindow::initBody() void CComponentsWindow::initCCWItems() { -#ifdef DEBUG_CC - printf("[CComponentsWindow] [%s - %d] init items...\n", __func__, __LINE__); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsWindow] [%s - %d] init items...\n", __func__, __LINE__); + //add/remove header if required if (ccw_show_header){ initHeader(); diff --git a/src/gui/components/cc_frm_window.h b/src/gui/components/cc_frm_window.h index d658bd090..30838c1c2 100644 --- a/src/gui/components/cc_frm_window.h +++ b/src/gui/components/cc_frm_window.h @@ -86,12 +86,11 @@ class CComponentsWindow : public CComponentsForm void initVarWindow( const int& x_pos = CC_CENTERED, const int& y_pos = CC_CENTERED, const int& w = 0, const int& h = 0, const std::string& caption = "", const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - ///allow centering of window on screen, mostly senseful for window object without parent - void doCenter(); ///initialize width and height void initWindowSize(); ///initialize position @@ -103,12 +102,13 @@ class CComponentsWindow : public CComponentsForm CC_WINDOW_ITEM_HEADER = 0 }; ///simple constructor for CComponentsWindow, this shows a window over full screen - CComponentsWindow(); + CComponentsWindow(CComponentsForm *parent = NULL); ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption = "", const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, @@ -118,6 +118,7 @@ class CComponentsWindow : public CComponentsForm CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, @@ -165,6 +166,7 @@ class CComponentsWindowMax : public CComponentsWindow public: ///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, this shows a centered window based up current screen settings CComponentsWindowMax( const std::string& caption, const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, @@ -172,6 +174,7 @@ class CComponentsWindowMax : public CComponentsWindow ///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, this shows a centered window based up current screen settings CComponentsWindowMax( neutrino_locale_t locale_caption, const std::string& iconname = "", + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 08902596b..a35b2e33c 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -31,17 +31,10 @@ #include #include #include "cc_base.h" - +#include +#include using namespace std; -//abstract sub class CComponentsItem from CComponents -CComponentsItem::CComponentsItem() -{ - //CComponentsItem - initVarItem(); - cc_item_type = CC_ITEMTYPE_BASE; -} - // y // x+------f-r-a-m-e-------+ // | | @@ -49,13 +42,21 @@ CComponentsItem::CComponentsItem() // | | // +--------width---------+ -void CComponentsItem::initVarItem() +//abstract sub class CComponentsItem from CComponents +CComponentsItem::CComponentsItem(CComponentsForm* parent) { - //CComponents + cc_item_type = CC_ITEMTYPE_BASE; cc_item_index = CC_NO_INDEX; cc_item_enabled = true; cc_item_selected = false; - cc_parent = NULL; + initParent(parent); +} + +void CComponentsItem::initParent(CComponentsForm* parent) +{ + cc_parent = parent; + if (cc_parent) + cc_parent->addCCItem(this); } // Paint container background in cc-items with shadow, background and frame. @@ -99,9 +100,9 @@ void CComponentsItem::paintInit(bool do_save_bg) continue; v_fbdata.push_back(fbdata[i]); } -#ifdef DEBUG_CC - printf("[CComponentsItem] %s:\ncc_item_type: %d\ncc_item_index = %d\nheight = %d\nwidth = %d\n", __func__, cc_item_type, cc_item_index, height, width); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsItem] %s:\ncc_item_type: %d\ncc_item_index = %d\nheight = %d\nwidth = %d\n", __func__, cc_item_type, cc_item_index, height, width); + paintFbItems(do_save_bg); } @@ -149,9 +150,9 @@ int CComponentsItem::getItemType() if (i == cc_item_type) return i; } -#ifdef DEBUG_CC - printf("[CComponentsItem] %s: unknown item type requested...\n", __func__); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsItem] %s: unknown item type requested...\n", __func__); + return -1; } @@ -163,3 +164,39 @@ bool CComponentsItem::isAdded() return false; } + +void CComponentsItem::setXPosP(const uint8_t& xpos_percent) +{ + int x_tmp = cc_parent ? xpos_percent*cc_parent->getWidth() : xpos_percent*frameBuffer->getScreenWidth(); + x = x_tmp/100; +} + +void CComponentsItem::setYPosP(const uint8_t& ypos_percent) +{ + int y_tmp = cc_parent ? ypos_percent*cc_parent->getHeight() : ypos_percent*frameBuffer->getScreenHeight(); + x = y_tmp/100; +} + +void CComponentsItem::setPosP(const uint8_t& xpos_percent, const uint8_t& ypos_percent) +{ + setXPosP(xpos_percent); + setYPosP(ypos_percent); +} + +void CComponentsItem::setCenterPos(int along_mode) +{ + if (along_mode & CC_ALONG_X) + x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width); + if (along_mode & CC_ALONG_Y) + y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height); +} + +void CComponentsItem::setHeightP(const uint8_t& h_percent) +{ + height = cc_parent ? h_percent*cc_parent->getWidth()/100 : h_percent*frameBuffer->getScreenWidth()/100; +} + +void CComponentsItem::setWidthP(const uint8_t& w_percent) +{ + width = cc_parent ? w_percent*cc_parent->getHeight()/100 : w_percent*frameBuffer->getScreenHeight()/100; +} diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 77ff00bd5..30e41c234 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -35,20 +35,16 @@ using namespace std; //sub class CComponentsInfoBox from CComponentsItem -CComponentsInfoBox::CComponentsInfoBox() +CComponentsInfoBox::CComponentsInfoBox( const int& x_pos, const int& y_pos, const int& w, const int& h, + std::string info_text, + const int mode, + Font* font_text, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - //CComponentsInfoBox - initVarInfobox(); -} + cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; -CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, - std::string info_text, const int mode, Font* font_text, - bool has_shadow, - fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - //CComponentsInfoBox - initVarInfobox(); - x = x_pos; y = y_pos; width = w; @@ -62,6 +58,13 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i ct_text_mode = mode; ct_font = font_text; ct_col_text = color_text; + + //CComponentsInfoBox + pic = NULL; + cctext = NULL; + pic_name = ""; + x_offset = 10; + initParent(parent); } CComponentsInfoBox::~CComponentsInfoBox() @@ -70,15 +73,17 @@ CComponentsInfoBox::~CComponentsInfoBox() delete cctext; } -void CComponentsInfoBox::initVarInfobox() +void CComponentsInfoBox::setPicture(const std::string& picture_name) { - cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; + pic_name = picture_name; +} - //CComponentsInfoBox - pic = NULL; - cctext = NULL; - pic_name = ""; - x_offset = 10; +void CComponentsInfoBox::setPicture(const char* picture_name) +{ + string s_tmp = ""; + if (picture_name) + s_tmp = string(picture_name); + setPicture(s_tmp); } void CComponentsInfoBox::paintPicture() diff --git a/src/gui/components/cc_item_infobox.h b/src/gui/components/cc_item_infobox.h index afcfffd5b..4e22c97ca 100644 --- a/src/gui/components/cc_item_infobox.h +++ b/src/gui/components/cc_item_infobox.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -52,8 +52,6 @@ class CComponentsInfoBox : public CComponentsText ///property: path or default name of displayed image std::string pic_default_name; - ///initialize all needed default attributes - void initVarInfobox(); ///paint picture, used in initVarInfobox() void paintPicture(); ///property: path or name of displayed image @@ -63,9 +61,11 @@ class CComponentsInfoBox : public CComponentsText ///object: internal used CTextBox object CComponentsText * cctext; - CComponentsInfoBox(); - CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, - std::string info_text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + CComponentsInfoBox( const int& x_pos = 0, const int& y_pos = 0, const int& w = 800, const int& h = 600, + std::string info_text = "", + const int mode = CTextBox::AUTO_WIDTH, + Font* font_text = NULL, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENT_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); @@ -73,8 +73,10 @@ class CComponentsInfoBox : public CComponentsText ///set property: space around fram and beetween picture and textbox inline void setSpaceOffset(const int offset){x_offset = offset;}; - ///set property: path or name of displayed image - inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; + ///set property: path or name of displayed image, parameter as string + void setPicture(const std::string& picture_name); + ///set property: path or name of displayed image, parameter as const char* + void setPicture(const char* picture_name); ///paint item void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index bc8f67472..ecf5d1cc8 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -32,7 +32,7 @@ #include #include "cc_item_picture.h" #include - +#include extern CPictureViewer * g_PicViewer; using namespace std; @@ -41,13 +41,20 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsPicture from CComponentsItem CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h, - const std::string& image_name, const int &alignment, bool has_shadow, + const std::string& image_name, + const int &alignment, + CComponentsForm *parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) { - init(x_pos, y_pos, w, h, image_name, alignment, has_shadow, color_frame, color_background, color_shadow); + init(x_pos, y_pos, w, h, image_name, alignment, parent, has_shadow, color_frame, color_background, color_shadow); } -void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h, const string& image_name, const int &alignment, bool has_shadow, +void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h, + const string& image_name, + const int &alignment, + CComponentsForm *parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) { //CComponents, CComponentsItem @@ -79,6 +86,7 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, pic_width = pic_height = 0; initCCItem(); + initParent(parent); } void CComponentsPicture::setPicture(const std::string& picture_name) @@ -87,6 +95,13 @@ void CComponentsPicture::setPicture(const std::string& picture_name) initCCItem(); } +void CComponentsPicture::setPicture(const char* picture_name) +{ + string s_tmp = ""; + if (picture_name) + s_tmp = string(picture_name); + setPicture(s_tmp); +} void CComponentsPicture::setPictureAlign(const int alignment) { @@ -133,10 +148,8 @@ void CComponentsPicture::initCCItem() g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, pic_max_w, pic_max_h); } -#ifdef DEBUG_CC if (pic_width == 0 || pic_height == 0) - printf("[CComponentsPicture] %s file: %s, no icon dimensions found! width = %d, height = %d\n", __func__, pic_name.c_str(), pic_width, pic_height); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsPicture] %s file: %s, no icon dimensions found! width = %d, height = %d\n", __func__, pic_name.c_str(), pic_width, pic_height); initPosition(); @@ -144,10 +157,8 @@ void CComponentsPicture::initCCItem() width = max(max(pic_width, pic_max_w), width) + sw ; height = max(max(pic_height, pic_max_h), height) + sw ; -#ifdef DEBUG_CC - printf("[CComponentsPicture] %s initialized Image: ====>> %s\n\titem x = %d\n\tdx = %d (image dx = %d)\n\titem y = %d\n\titem dy = %d (image dy = %d)\n", + dprintf(DEBUG_DEBUG, "[CComponentsPicture] %s initialized Image: ====>> %s\n\titem x = %d\n\tdx = %d (image dx = %d)\n\titem y = %d\n\titem dy = %d (image dy = %d)\n", __func__, pic_name.c_str(), x, width, pic_width, y, height, pic_height); -#endif } void CComponentsPicture::initPosition() @@ -182,9 +193,8 @@ void CComponentsPicture::paintPicture() pic_painted = false; if (do_paint && cc_allow_paint){ -#ifdef DEBUG_CC - printf(" [CComponentsPicture] %s: paint image: %s (do_paint=%d) with mode %d\n", __func__, pic_name.c_str(), do_paint, pic_paint_mode); -#endif + dprintf(DEBUG_DEBUG, "[CComponentsPicture] %s: paint image: %s (do_paint=%d) with mode %d\n", __func__, pic_name.c_str(), do_paint, pic_paint_mode); + if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF) pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0 /*pic_max_h*/, pic_offset, pic_paint, pic_paintBg, col_body); else if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON) @@ -210,11 +220,14 @@ void CComponentsPicture::hide(bool no_restore) CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_pos, const int &w, const int &h, - const uint64_t& channelId, const std::string& channelName, - const int &alignment, bool has_shadow, + const uint64_t& channelId, + const std::string& channelName, + const int &alignment, + CComponentsForm *parent, + bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) :CComponentsPicture(x_pos, y_pos, w, h, - "", alignment, has_shadow, + "", alignment, parent, has_shadow, color_frame, color_background, color_shadow) { channel_id = channelId; @@ -230,6 +243,14 @@ void CComponentsChannelLogo::setPicture(const std::string& picture_name) initVarPictureChannellLogo(); } +void CComponentsChannelLogo::setPicture(const char* picture_name) +{ + string s_tmp = ""; + if (picture_name) + s_tmp = string(picture_name); + this->setPicture(s_tmp); +} + void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName) { channel_id = channelId; @@ -248,10 +269,8 @@ void CComponentsChannelLogo::initVarPictureChannellLogo() if (!has_logo) pic_name = tmp_logo; -#ifdef DEBUG_CC - printf("\t[CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%" PRIu64 ")\n", __func__, pic_name.c_str(), has_logo, channel_id); -#endif - + dprintf(DEBUG_DEBUG, "\t[CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%" PRIu64 ")\n", __func__, pic_name.c_str(), has_logo, channel_id); + initCCItem(); } diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 0b2710be9..149174e3d 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -63,6 +63,7 @@ class CComponentsPicture : public CComponentsItem void init( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& image_name, const int &alignment, + CComponentsForm *parent, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, @@ -78,6 +79,7 @@ class CComponentsPicture : public CComponentsItem CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& image_name, const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, @@ -87,9 +89,12 @@ class CComponentsPicture : public CComponentsItem virtual inline void setPicturePaint(bool paint_p){pic_paint = paint_p;}; virtual inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; virtual void setPicture(const std::string& picture_name); + virtual void setPicture(const char* picture_name); virtual void setPictureAlign(const int alignment); + ///return paint mode of internal image, true=image was painted, please do not to confuse with isPainted()! isPainted() is related to item itself. virtual inline bool isPicPainted(){return pic_painted;}; + virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); virtual void hide(bool no_restore = false); virtual inline void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; @@ -113,6 +118,7 @@ class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer const uint64_t& channelId =0, const std::string& channelName = "", const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, @@ -120,6 +126,7 @@ class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer void setChannel(const uint64_t& channelId, const std::string& channelName); void setPicture(const std::string& picture_name); + void setPicture(const char* picture_name); bool hasLogo(){return has_logo;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 8c5944a41..3aefc7363 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -2,7 +2,7 @@ Based up Neutrino-GUI - Tuxbox-Project Copyright (C) 2001 by Steffen Hehn 'McClean' - (C) 2008, 2013 by Thilo Graf + (C) 2008,2013,2014 by Thilo Graf (C) 2009,2010,2013 Stefan Seyfried License: GPL @@ -39,19 +39,16 @@ #define GREEN 0x00FF00 #define YELLOW 0xFFFF00 -CProgressBar::CProgressBar() -{ - initVarProgressbar(); -} - CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const int h, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow, const fb_pixel_t active_col, const fb_pixel_t passive_col, const bool blinkenlights, const int r, const int g, const int b, - const bool inv) + const bool inv, + CComponentsForm *parent) { - initVarProgressbar(); + //CComponentsItem + cc_item_type = CC_ITEMTYPE_PROGRESSBAR; //CComponents x = x_pos; @@ -70,24 +67,9 @@ CProgressBar::CProgressBar( const int x_pos, const int y_pos, const int w, const pb_yellow = b; pb_active_col = active_col; pb_passive_col = passive_col; -} - -void CProgressBar::initVarProgressbar() -{ - //CComponentsItem - cc_item_type = CC_ITEMTYPE_PROGRESSBAR; - - //CProgressBar - pb_blink = false; - pb_invert = false; pb_bl_changed = g_settings.progressbar_color; pb_last_width = -1; - pb_red = 40; - pb_green = 100; - pb_yellow = 70; - pb_active_col = COL_INFOBAR_PLUS_7; - pb_passive_col = COL_INFOBAR_PLUS_3; pb_value = 0; pb_max_value = 0; pb_paint_zero = false; @@ -100,7 +82,8 @@ void CProgressBar::initVarProgressbar() pb_height = 0; pb_start_x_passive = 0; pb_passive_width = width; -} + initParent(parent); +} //calculate bar dimensions void CProgressBar::initDimensions() @@ -138,7 +121,7 @@ void CProgressBar::initDimensions() void CProgressBar::paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_t &col) { - CComponentsShapeSquare shape(shx, shy, shw, shh, false); + CComponentsShapeSquare shape(shx, shy, shw, shh, NULL, false); shape.setColorBody(col); shape.allowPaint(cc_allow_paint); shape.paint(false); diff --git a/src/gui/components/cc_item_progressbar.h b/src/gui/components/cc_item_progressbar.h index ecc074eee..515761b24 100644 --- a/src/gui/components/cc_item_progressbar.h +++ b/src/gui/components/cc_item_progressbar.h @@ -2,7 +2,7 @@ Based up Neutrino-GUI - Tuxbox-Project Copyright (C) 2001 by Steffen Hehn 'McClean' - (C) 2008, 2013 by Thilo Graf + (C) 2008,2013,2014 by Thilo Graf (C) 2009,2010,2013 Stefan Seyfried License: GPL @@ -50,7 +50,8 @@ #define __CC_PROGRESSBAR_H__ #include "config.h" -#include +#include "cc_base.h" + #include class CProgressBar : public CComponentsItem @@ -110,14 +111,14 @@ class CProgressBar : public CComponentsItem ///inv: false => red on the left side, true: red on right side. ///active_col, passive_col: sets colors for displayed values, activ_col means the the displayed progress ///color_frame, color_body, color_shadow: colores of progressbar for frame, body and shadow, Note: color of frame is ineffective on fr_thickness = 0 - CProgressBar(); - CProgressBar( const int x_pos, const int y_pos, + CProgressBar( const int x_pos = 0, const int y_pos = 0, const int w = -1, const int h = -1, fb_pixel_t color_frame = 0, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0, const fb_pixel_t active_col = COL_INFOBAR_PLUS_7, const fb_pixel_t passive_col = COL_INFOBAR_PLUS_3, const bool blinkenlights = false, const int r = 40, const int g = 100, const int b =70, - const bool inv = false ); + const bool inv = false, + CComponentsForm *parent = NULL); ///set up to display available values diff --git a/src/gui/components/cc_item_shapes.cpp b/src/gui/components/cc_item_shapes.cpp index 14393b610..c4acb6514 100644 --- a/src/gui/components/cc_item_shapes.cpp +++ b/src/gui/components/cc_item_shapes.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -35,7 +35,10 @@ using namespace std; //sub class CComponentsShapeSquare from CComponentsItem -CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +CComponentsShapeSquare::CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponentsItem cc_item_type = CC_ITEMTYPE_SHAPE_SQUARE; @@ -49,6 +52,7 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; + initParent(parent); } void CComponentsShapeSquare::paint(bool do_save_bg) @@ -59,8 +63,10 @@ void CComponentsShapeSquare::paint(bool do_save_bg) //------------------------------------------------------------------------------------------------------- //sub class CComponentsShapeCircle from CComponentsItem -CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponents, CComponentsItem cc_item_type = CC_ITEMTYPE_SHAPE_CIRCLE; @@ -80,6 +86,7 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, //CComponentsItem corner_rad = d/2; + initParent(parent); } // y diff --git a/src/gui/components/cc_item_shapes.h b/src/gui/components/cc_item_shapes.h index e9e879033..db53d66ec 100644 --- a/src/gui/components/cc_item_shapes.h +++ b/src/gui/components/cc_item_shapes.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014 Thilo Graf 'dbt' License: GPL @@ -43,7 +43,9 @@ class CComponentsShapeCircle : public CComponentsItem ///property: diam int d; public: - CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON, + CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_ON, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ///set property: diam @@ -58,7 +60,9 @@ class CComponentsShapeCircle : public CComponentsItem class CComponentsShapeSquare : public CComponentsItem { public: - CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, + CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_ON, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index e681dbca5..7ecda826c 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -34,46 +34,31 @@ #include #include #include - +#include using namespace std; //sub class CComponentsText from CComponentsItem -CComponentsText::CComponentsText() -{ - //CComponentsText - initVarText(); - - initCCText(); -} - -CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h, - std::string text, const int mode, Font* font_text, +CComponentsText::CComponentsText( CComponentsForm *parent, + const int x_pos, const int y_pos, const int w, const int h, + std::string text, + const int mode, + Font* font_text, bool has_shadow, fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - //CComponentsText - initVarText(); - - //CComponents - x = x_pos, - y = y_pos, - width = w; - height = h; - - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - shadow = has_shadow; - - ct_font = font_text; - ct_text = text; - ct_text_mode = mode; - ct_col_text = color_text; - - initCCText(); + initVarText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow); } - +CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h, + std::string text, + const int mode, + Font* font_text, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + initVarText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow); +} CComponentsText::~CComponentsText() { @@ -82,18 +67,26 @@ CComponentsText::~CComponentsText() } -void CComponentsText::initVarText() +void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w, const int h, + std::string text, + const int mode, + Font* font_text, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - //CComponents, CComponentsItem - cc_item_type = CC_ITEMTYPE_TEXT; - - //CComponentsText - ct_font = NULL; + cc_item_type = CC_ITEMBOX_TEXT; + ct_font = font_text; ct_textbox = NULL; - ct_text = ""; + ct_text = text; ct_old_text = ct_text; - ct_text_mode = CTextBox::AUTO_WIDTH; + ct_text_mode = mode; + x = x_pos; + y = y_pos; + width = w; + height = h; + pX = &x; pY = &y; pHeight = &height; @@ -105,11 +98,19 @@ void CComponentsText::initVarText() ct_text_Hborder = 1; ct_text_Vborder = 0; - ct_col_text = COL_MENUCONTENT_TEXT; + shadow = has_shadow; + ct_col_text = color_text; ct_old_col_text = 0; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + ct_text_sent = false; ct_paint_textbg = false; ct_force_text_paint = false; + + initCCText(); + initParent(parent); } @@ -168,9 +169,8 @@ void CComponentsText::initCCText() ct_old_text = ct_text; ct_old_col_text = ct_col_text; } -#ifdef DEBUG_CC - printf(" [CComponentsText] [%s - %d] init text: %s [x %d, y %d, w %d, h %d]\n", __func__, __LINE__, ct_text.c_str(), this->iX, this->iY, this->iWidth, this->iHeight); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsText] [%s - %d] init text: %s [x %d, y %d, w %d, h %d]\n", __func__, __LINE__, ct_text.c_str(), this->iX, this->iY, this->iWidth, this->iHeight); } void CComponentsText::clearCCText() @@ -186,9 +186,8 @@ void CComponentsText::setText(const std::string& stext, const int mode, Font* fo ct_text = stext; ct_text_mode = mode; ct_font = font_text; -#ifdef DEBUG_CC - printf(" [CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str()); -#endif + + dprintf(DEBUG_DEBUG, "[CComponentsText] [%s - %d] ct_text: %s \n", __func__, __LINE__, ct_text.c_str()); } void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text) @@ -286,7 +285,7 @@ string CComponentsText::iToString(int int_val) //helper, get lines per textbox page int CComponentsText::getTextLinesAutoHeight(const int& textMaxHeight, const int& textWidth, const int& mode) { - CComponentsText box; + CBox box; box.iX = 0; box.iY = 0; box.iWidth = textWidth; diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 8d44d7f55..362d26224 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -72,8 +72,14 @@ class CComponentsText : public CComponentsItem, public CBox ///helper: convert int to string static std::string iToString(int int_val); //helper to convert int to string - ///initialize all required default attributes - void initVarText(); + ///initialize all required attributes + void initVarText( const int x_pos, const int y_pos, const int w, const int h, + std::string text, + const int mode, + Font* font_text, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow); ///destroy current CTextBox and CBox objects void clearCCText(); @@ -83,11 +89,22 @@ class CComponentsText : public CComponentsItem, public CBox ///paint CCItem backckrond (if paint_bg=true), apply initCCText() and send paint() to the CTextBox object void paintText(bool do_save_bg = CC_SAVE_SCREEN_YES); public: - CComponentsText(); - CComponentsText( const int x_pos, const int y_pos, const int w, const int h, - std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + CComponentsText( const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50, + std::string text = "", + const int mode = CTextBox::AUTO_WIDTH, + Font* font_text = NULL, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENT_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + + CComponentsText( CComponentsForm *parent, + const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50, + std::string text = "", + const int mode = CTextBox::AUTO_WIDTH, + Font* font_text = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_text = COL_MENUCONTENT_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + virtual ~CComponentsText(); ///default members to paint a text box and hide painted text @@ -151,10 +168,16 @@ class CComponentsLabel : public CComponentsText { public: CComponentsLabel( const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50, - std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + std::string text = "", + const int mode = CTextBox::AUTO_WIDTH, + Font* font_text = NULL, + CComponentsForm *parent = NULL, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_text = COL_MENUCONTENTINACTIVE_TEXT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, has_shadow, color_text, color_frame, color_body, color_shadow) + fb_pixel_t color_text = COL_MENUCONTENTINACTIVE_TEXT, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, parent, has_shadow, color_text, color_frame, color_body, color_shadow) { cc_item_type = CC_ITEMTYPE_LABEL; }; diff --git a/src/gui/components/cc_item_tvpic.cpp b/src/gui/components/cc_item_tvpic.cpp index 19dc1faa0..8cdf6e873 100644 --- a/src/gui/components/cc_item_tvpic.cpp +++ b/src/gui/components/cc_item_tvpic.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL @@ -40,7 +40,10 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsPIP from CComponentsItem -CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow) +CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, + CComponentsForm *parent, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponents, CComponentsItem cc_item_type = CC_ITEMTYPE_PIP; @@ -58,9 +61,13 @@ CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int perc height = percent*screen_h/100; shadow = has_shadow; shadow_w = SHADOW_OFFSET; - col_frame = COL_BACKGROUND; - col_body = COL_BACKGROUND; - col_shadow = COL_MENUCONTENTDARK_PLUS_0; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + fr_thickness = 2; + corner_rad = RADIUS_SMALL; + corner_type = CORNER_ALL; + initParent(parent); } CComponentsPIP::~CComponentsPIP() @@ -92,7 +99,8 @@ void CComponentsPIP::paint(bool do_save_bg) videoDecoder->Pig(pig_x, pig_y, pig_w, pig_h, screen_w, screen_h); } else{ //paint an alternate image if no tv mode available - CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); + CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, NULL, false, col_frame, col_frame); + pic.setCorner(corner_rad, corner_type); pic.paint(CC_SAVE_SCREEN_NO); } } diff --git a/src/gui/components/cc_item_tvpic.h b/src/gui/components/cc_item_tvpic.h index fef5a23b8..c9df98018 100644 --- a/src/gui/components/cc_item_tvpic.h +++ b/src/gui/components/cc_item_tvpic.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -50,7 +50,10 @@ class CComponentsPIP : public CComponentsItem std::string pic_name; public: ///constructor: initialize of position like all other items with x and y values, but dimensions in percent - CComponentsPIP( const int x_pos, const int y_pos, const int percent = 30, bool has_shadow = CC_SHADOW_OFF); + CComponentsPIP( const int x_pos = 0, const int y_pos = 0, const int percent = 30, + CComponentsForm *parent = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_BLACK, fb_pixel_t color_body = COL_BACKGROUND, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsPIP(); ///set property: width of tv box in pixel diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 401c3c44d..c8f23b386 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012-2014, Thilo Graf 'dbt' License: GPL @@ -30,7 +30,9 @@ #include #include -// #define DEBUG_CC + + +class CComponentsForm; ///cc item types typedef enum @@ -110,6 +112,13 @@ enum CC_ALIGN_VER_CENTER = 32 }; +//item centering modes, see also CComponentsItem::setCenterPos() +enum +{ + CC_ALONG_X = 1, + CC_ALONG_Y = 2 +}; + enum { CC_ITEMBOX_ICON, diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index 495f13f46..8ec9e6d27 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -498,6 +499,7 @@ void CDBoxInfoWidget::paint() ypos += mheight; int width_i = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("i", true); + CRecordManager * crm = CRecordManager::getInstance(); for (std::map::iterator it = mounts.begin(); it != mounts.end(); ++it) { struct statfs s; @@ -549,7 +551,7 @@ void CDBoxInfoWidget::paint() _w = width - (mpOffset + space); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + mpOffset + space, ypos+ mheight, _w, tmp, COL_MENUCONTENT_TEXT); if ((*it).second && icon_w>0 && icon_h>0) - frameBuffer->paintIcon(NEUTRINO_ICON_REC, x + nameWidth - icon_w + width_i/2, ypos + (mheight/2 - icon_h/2)); + frameBuffer->paintIcon(crm->RecordingStatus() ? NEUTRINO_ICON_REC:NEUTRINO_ICON_REC_GRAY, x + nameWidth - icon_w + width_i/2, ypos + (mheight/2 - icon_h/2)); } if (pbw > 8) /* smaller progressbar is not useful ;) */ { diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index ee9320703..1ad763a34 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -3,13 +3,14 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2010-2014 Stefan Seyfried + Copyright (C) 2013-2014 martii + Copyright (C) 2009-2014 CoolStream International Ltd - License: GPL + License: GPLv2 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -58,12 +59,11 @@ #include #include -#define e2fsckBinary "/sbin/e2fsck" -#define ext3FsckBinary "/sbin/fsck.ext3" -#define ext4FsckBinary "/sbin/fsck.ext4" -#define ext3MkfsBinary "/sbin/mkfs.ext3" -#define ext4MkfsBinary "/sbin/mkfs.ext4" -#define blkidBinary "/sbin/blkid" +#define BLKID_BIN "/sbin/blkid" +#define EJECT_BIN "/bin/eject" + +#define MDEV_MOUNT "/lib/mdev/fs/mount" +#define MOUNT_BASE "/media/" #define HDD_NOISE_OPTION_COUNT 4 const CMenuOptionChooser::keyval HDD_NOISE_OPTIONS[HDD_NOISE_OPTION_COUNT] = @@ -74,12 +74,6 @@ const CMenuOptionChooser::keyval HDD_NOISE_OPTIONS[HDD_NOISE_OPTION_COUNT] = { 254, LOCALE_HDD_FAST } }; -#define HDD_FILESYS_OPTION_COUNT 2 -const CMenuOptionChooser::keyval_ext HDD_FILESYS_OPTIONS[HDD_FILESYS_OPTION_COUNT] = -{ - { fs_ext3, NONEXISTANT_LOCALE, "ext3" }, - { fs_ext4, NONEXISTANT_LOCALE, "ext4" } -}; #define HDD_SLEEP_OPTION_COUNT 6 const CMenuOptionChooser::keyval HDD_SLEEP_OPTIONS[HDD_SLEEP_OPTION_COUNT] = { @@ -92,72 +86,408 @@ const CMenuOptionChooser::keyval HDD_SLEEP_OPTIONS[HDD_SLEEP_OPTION_COUNT] = { 242, LOCALE_HDD_60MIN } }; -static int my_filter(const struct dirent *d) -{ - if ((d->d_name[0] == 's' || d->d_name[0] == 'h') && d->d_name[1] == 'd') - return 1; - return 0; -} +devtool_s CHDDMenuHandler::devtools[] = { + { "ext2", "/sbin/fsck.ext2", "-C 1 -f -y", "/sbin/mkfs.ext2", "-T largefile -m0", false, false }, + { "ext3", "/sbin/fsck.ext3", "-C 1 -f -y", "/sbin/mkfs.ext3", "-T largefile -m0", false, false }, + { "ext4", "/sbin/fsck.ext4", "-C 1 -f -y", "/sbin/mkfs.ext4", "-T largefile -m0", false, false }, + { "vfat", "/sbin/fsck.vfat", "-a", "/sbin/mkfs.vfat", "", false, false }, + { "exfat", "/sbin/fsck.exfat", "", "/sbin/mkfs.exfat", "", false, false }, + { "xfs", "/sbin/xfs_repair", "", "/sbin/mkfs.xfs", "-f", false, false }, +}; +#define FS_MAX (sizeof(CHDDMenuHandler::devtools)/sizeof(devtool_s)) -std::string getFmtType(const char* name, int num) +static int my_filter(const struct dirent * dent) { - pid_t pid; - std::string ret = ""; - std::string blkid = find_executable("blkid"); - if (blkid.empty()) - return ret; - std::string pcmd = blkid + (std::string)" -s TYPE /dev/" + (std::string)name + to_string(num); - dprintf(DEBUG_INFO, ">>>>>[%s #%d] pcmd: %s\n", __func__, __LINE__, pcmd.c_str()); - FILE* f = my_popen(pid, pcmd.c_str(), "r"); - if (f != NULL) { - char buff[512]; - if (!fgets(buff, sizeof(buff), f)) - buff[0] = '\0'; - fclose(f); - ret = buff; - std::string search = "TYPE=\""; - size_t pos = ret.find(search); - if (pos == std::string::npos) - return ""; - ret = ret.substr(pos + search.length()); - pos = ret.find("\""); - if (pos != std::string::npos) - ret = ret.substr(0, pos); - } - return ret; + return CHDDMenuHandler::getInstance()->filterDevName(dent->d_name); } CHDDMenuHandler::CHDDMenuHandler() { width = w_max (58, 10); + show_menu = false; } CHDDMenuHandler::~CHDDMenuHandler() { - } -int CHDDMenuHandler::exec(CMenuTarget* parent, const std::string &/*actionkey*/) +CHDDMenuHandler* CHDDMenuHandler::getInstance() +{ + static CHDDMenuHandler* me = NULL; + + if(!me) + me = new CHDDMenuHandler(); + + return me; +} + +int CHDDMenuHandler::filterDevName(const char * name) +{ + if (((name[0] == 's' || name[0] == 'h') && (name[1] == 'd' || name[1] == 'r')) || + !strncmp(name, "mmcblk", 6)) + return 1; + return 0; +} + +int CHDDMenuHandler::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data) +{ + if(msg != NeutrinoMessages::EVT_HOTPLUG) + return messages_return::unhandled; + + std::string str((char *) data); + std::map smap; + + if (!split_config_string(str, smap)) + return messages_return::handled; + + std::map::iterator it = smap.find("MDEV"); + if (it == smap.end()) + return messages_return::handled; + + std::string dev = it->second; + + it = smap.find("ACTION"); + if (it == smap.end()) + return messages_return::handled; + + bool added = it->second == "add"; + + printf("CHDDMenuHandler::handleMsg: %s MDEV=%s\n", it->second.c_str(), dev.c_str()); + + if (!filterDevName(dev.c_str())) + return messages_return::handled; + + bool mounted = is_mounted(dev.c_str()); + std::string message = dev + ": " + (added ? + g_Locale->getText(mounted ? LOCALE_HDD_MOUNT_OK : LOCALE_HDD_MOUNT_FAILED) + : g_Locale->getText(LOCALE_HDD_UMOUNTED)); + + ShowHint(LOCALE_MESSAGEBOX_INFO, message.c_str()); + + return messages_return::handled; +} + +bool CHDDMenuHandler::is_mounted(const char *dev) +{ + bool res = false; + char devpath[40]; + if (!strncmp(dev, "/dev/", 5)) + snprintf(devpath, sizeof(devpath), "%s", dev); + else + snprintf(devpath, sizeof(devpath), "/dev/%s", dev); + + int devpathlen = strlen(devpath); + char buffer[255]; + FILE *f = fopen("/proc/mounts", "r"); + if(f) { + while (!res && fgets(buffer, sizeof(buffer), f)) + if (!strncmp(buffer, devpath, devpathlen) + && (buffer[devpathlen] == ' ' || buffer[devpathlen] == '\t')) + res = true; + fclose(f); + } + printf("CHDDMenuHandler::is_mounted: dev [%s] is %s\n", devpath, res ? "mounted" : "not mounted"); + return res; +} + +void CHDDMenuHandler::getBlkIds() +{ + pid_t pid; + std::string blkid = find_executable("blkid"); + if (blkid.empty()) + return; + std::string pcmd = blkid + (std::string)" -s TYPE"; + + FILE* f = my_popen(pid, pcmd.c_str(), "r"); + if (!f) { + printf("getBlkIds: cmd [%s] failed\n", pcmd.c_str()); + return; + } + + hdd_list.clear(); + char buff[512]; + while (fgets(buff, sizeof(buff), f)) { + + std::string ret = buff; + std::string search = "TYPE=\""; + size_t pos = ret.find(search); + if (pos == std::string::npos) + continue; + + ret = ret.substr(pos + search.length()); + pos = ret.find("\""); + if (pos != std::string::npos) + ret = ret.substr(0, pos); + + char *e = strstr(buff + 7, ":"); + if (!e) + continue; + *e = 0; + + hdd_s hdd; + hdd.devname = std::string(buff + 5); + hdd.mounted = is_mounted(buff + 5); + hdd.fmt = ret; + hdd.desc = hdd.devname + " (" + hdd.fmt + ")"; + printf("device: %s filesystem %s (%s)\n", hdd.devname.c_str(), hdd.fmt.c_str(), hdd.mounted ? "mounted" : "not mounted" ); + hdd_list.push_back(hdd); + } + fclose(f); +} + +std::string CHDDMenuHandler::getDefaultPart(std::string dev) +{ + std::string part = "1"; + if (dev == "mmcblk0") + part = "p1"; + return part; +} + +std::string CHDDMenuHandler::getFmtType(std::string name, std::string part) +{ + std::string ret = ""; + std::string dev = name + part; + for (std::vector::iterator it = hdd_list.begin(); it != hdd_list.end(); ++it) { + if (it->devname == dev) { + ret = it->fmt; + break; + } + } + printf("getFmtType: dev [%s] fmt [%s]\n", dev.c_str(), ret.c_str()); + return ret; +} + +void CHDDMenuHandler::check_dev_tools() +{ + for (unsigned i = 0; i < FS_MAX; i++) { + if (!access(devtools[i].fsck.c_str(), X_OK)) + devtools[i].fsck_supported = true; + if (!access(devtools[i].mkfs.c_str(), X_OK)) + devtools[i].mkfs_supported = true; + printf("check_dev_tools: %s: fsck %d mkfs %d\n", devtools[i].fmt.c_str(), devtools[i].fsck_supported, devtools[i].mkfs_supported); + } +} + +devtool_s * CHDDMenuHandler::get_dev_tool(std::string fmt) +{ + for (unsigned i = 0; i < FS_MAX; i++) { + if (fmt == devtools[i].fmt) + return &devtools[i]; + } + return NULL; +} + +bool CHDDMenuHandler::mount_dev(std::string name) +{ + std::string dev = name.substr(0, 2); + if (dev == "sr" && !access(EJECT_BIN, X_OK)) { + std::string eject = std::string(EJECT_BIN) + " -t /dev/" + name; + system(eject.c_str()); + sleep(3); + } +#ifdef ASSUME_MDEV + std::string cmd = std::string("ACTION=add") + " MDEV=" + name + " " + MDEV_MOUNT; +#else + std::string cmd = std::string("mount ") + "/dev/" + name + " " + MOUNT_BASE + name; +#endif + printf("CHDDMenuHandler::mount_dev: mount cmd [%s]\n", cmd.c_str()); + system(cmd.c_str()); + return is_mounted(name.c_str()); +} + +bool CHDDMenuHandler::umount_dev(std::string name) +{ +#ifdef ASSUME_MDEV + std::string cmd = std::string("ACTION=remove") + " MDEV=" + name + " " + MDEV_MOUNT; + printf("CHDDMenuHandler::umount_dev: umount cmd [%s]\n", cmd.c_str()); + system(cmd.c_str()); +#else + std::string path = MOUNT_BASE + name; + if (::umount(path.c_str())) + return false; +#endif + std::string dev = name.substr(0, 2); + if (dev == "sr" && !access(EJECT_BIN, X_OK)) { + std::string eject = std::string(EJECT_BIN) + " /dev/" + name; + system(eject.c_str()); + } + return !is_mounted(name.c_str()); +} + +bool CHDDMenuHandler::umount_all(std::string dev) +{ + bool ret = true; + for (std::vector::iterator it = hdd_list.begin(); it != hdd_list.end(); ++it) { + std::string mdev = it->devname.substr(0, dev.size()); + if (mdev == dev) { + if (is_mounted(it->devname.c_str())) + ret &= umount_dev(it->devname); + } + } + return ret; +} + +#ifdef ASSUME_MDEV +bool CHDDMenuHandler::add_dev(std::string dev, std::string part) +{ + std::string filename = "/sys/block/" + dev + "/" + dev + part + "/uevent"; + if (!access(filename.c_str(), W_OK)) { + FILE *f = fopen(filename.c_str(), "w"); + if (!f) + printf("HDD: %s could not open %s: %m\n", __func__, filename.c_str()); + else { + printf("-> triggering add uevent in %s\n", filename.c_str()); + fprintf(f, "add\n"); + fclose(f); + return true; + } + } + return false; +} +#endif +#ifdef ASSUME_MDEV +bool CHDDMenuHandler::waitfordev(std::string dev, int maxwait) +{ + int ret = true; + int waitcount = 0; + /* wait for the device to show up... */ + while (access(dev.c_str(), W_OK)) { + if (!waitcount) + printf("CHDDFmtExec: waiting for %s", dev.c_str()); + else + printf("."); + fflush(stdout); + waitcount++; + if (waitcount > maxwait) { + fprintf(stderr, "CHDDFmtExec: device %s did not appear!\n", dev.c_str()); + ret = false; + break; + } + sleep(1); + } + if (waitcount && waitcount <= maxwait) + printf("\n"); + return ret; +} +#endif + +int CHDDMenuHandler::exec(CMenuTarget* parent, const std::string &actionkey) { if (parent) parent->hide(); - return doMenu (); + if (actionkey.empty()) + return doMenu(); + + std::string dev = actionkey.substr(1); + printf("CHDDMenuHandler::exec actionkey %s dev %s\n", actionkey.c_str(), dev.c_str()); + if (actionkey[0] == 'm') { + for (std::vector::iterator it = hdd_list.begin(); it != hdd_list.end(); ++it) { + if (it->devname == dev) { + CHintBox * hintbox = new CHintBox(it->mounted ? LOCALE_HDD_UMOUNT : LOCALE_HDD_MOUNT, it->devname.c_str()); + hintbox->paint(); + if (it->mounted) + umount_dev(it->devname); + else + mount_dev(it->devname); + + it->mounted = is_mounted(it->devname.c_str()); + it->cmf->setOption(it->mounted ? umount : mount); + delete hintbox; + return menu_return::RETURN_REPAINT; + } + } + } + else if (actionkey[0] == 'd') { + return showDeviceMenu(dev); + } + else if (actionkey[0] == 'c') { + return checkDevice(dev); + } + else if (actionkey[0] == 'f') { + return formatDevice(dev); + } + return menu_return::RETURN_REPAINT; } -int CHDDMenuHandler::doMenu () +int CHDDMenuHandler::showDeviceMenu(std::string dev) +{ + printf("CHDDMenuHandler::showDeviceMenu: dev %s\n", dev.c_str()); + CMenuWidget* hddmenu = new CMenuWidget(devtitle[dev].c_str(), NEUTRINO_ICON_SETTINGS); + hddmenu->addIntroItems(); + + CMenuForwarder * mf; + + std::string fmt_type = getFmtType(dev, getDefaultPart(dev)); + bool fsck_enabled = false; + bool mkfs_enabled = false; + struct CMenuOptionChooser::keyval_ext fsoptions[FS_MAX]; + int opcount = 0; + for (unsigned i = 0; i < FS_MAX; i++) { + if (devtools[i].mkfs_supported) { + fsoptions[opcount].key = i; + fsoptions[opcount].value = NONEXISTANT_LOCALE; + fsoptions[opcount].valname = devtools[i].fmt.c_str(); + mkfs_enabled = true; + opcount++; + } + if (fmt_type == devtools[i].fmt) + g_settings.hdd_fs = i; + } + if (!opcount) { + fsoptions[0].key = 0; + fsoptions[0].valname = devtools[0].fmt.c_str(); + opcount++; + } + int cnt = 0; + bool found = false; + for (std::vector::iterator it = hdd_list.begin(); it != hdd_list.end(); ++it) { + std::string mdev = it->devname.substr(0, dev.size()); + if (mdev == dev) { + printf("found %s partition %s\n", dev.c_str(), it->devname.c_str()); + fsck_enabled = false; + devtool_s * devtool = get_dev_tool(it->fmt); + if (devtool) { + fsck_enabled = devtool->fsck_supported; + } + + std::string key = "c" + it->devname; + mf = new CMenuForwarder(LOCALE_HDD_CHECK, fsck_enabled, it->desc, this, key.c_str()); + mf->setHint("", LOCALE_MENU_HINT_HDD_CHECK); + hddmenu->addItem(mf); + found = true; + cnt++; + } + } + + if (found) + hddmenu->addItem(new CMenuSeparator(CMenuSeparator::LINE)); + + CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_HDD_FS, &g_settings.hdd_fs, fsoptions, opcount, mkfs_enabled); + mc->setHint("", LOCALE_MENU_HINT_HDD_FMT); + hddmenu->addItem(mc); + + std::string key = "f" + dev; + mf = new CMenuForwarder(LOCALE_HDD_FORMAT, true, "", this, key.c_str()); + mf->setHint("", LOCALE_MENU_HINT_HDD_FORMAT); + hddmenu->addItem(mf); + + + int res = hddmenu->exec(NULL, ""); + delete hddmenu; + return res; +} + +int CHDDMenuHandler::doMenu() { - FILE * f; - int fd; struct dirent **namelist; int ret; struct stat s; int root_dev = -1; - bool ext4MkfsBinaryExist = !find_executable("mkfs.ext4").empty(); - bool blkidBinaryExist = !find_executable("blkid").empty(); - - bool hdd_found = 0; + check_dev_tools(); +_show_menu: + bool hdd_found = false; int n = scandir("/sys/block", &namelist, my_filter, alphasort); if (n < 0) { @@ -165,24 +495,15 @@ int CHDDMenuHandler::doMenu () return menu_return::RETURN_REPAINT; } - CMenuWidget* hddmenu = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_DRIVESETUP); - //if no drives found, select 'back' - if (hdd_found == 0 && hddmenu->getSelected() != -1) - hddmenu->setSelected(2); - - hddmenu->addIntroItems(LOCALE_HDD_SETTINGS); - CHDDFmtExec fmtexec; - CHDDChkExec chkexec; + hddmenu->addIntroItems(LOCALE_HDD_SETTINGS, LOCALE_HDD_EXTENDED_SETTINGS); CHDDDestExec hddexec; CMenuForwarder * mf = new CMenuForwarder(LOCALE_HDD_ACTIVATE, true, "", &hddexec, NULL, CRCInput::RC_red,NEUTRINO_ICON_BUTTON_RED); mf->setHint("", LOCALE_MENU_HINT_HDD_APPLY); hddmenu->addItem(mf); - hddmenu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_HDD_EXTENDED_SETTINGS)); - CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_HDD_SLEEP, &g_settings.hdd_sleep, HDD_SLEEP_OPTIONS, HDD_SLEEP_OPTION_COUNT, true); mc->setHint("", LOCALE_MENU_HINT_HDD_SLEEP); hddmenu->addItem(mc); @@ -196,7 +517,6 @@ int CHDDMenuHandler::doMenu () hddmenu->addItem(mc); } - //if(n > 0) hddmenu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_HDD_MANAGE)); ret = stat("/", &s); @@ -207,14 +527,14 @@ int CHDDMenuHandler::doMenu () root_dev = (s.st_dev & drive_mask); } printf("HDD: root_dev: 0x%04x\n", root_dev); - std::string tmp_str[n]; - CMenuWidget * tempMenu[n]; + + getBlkIds(); + for(int i = 0; i < n;i++) { - tempMenu[i] = NULL; char str[256]; - char sstr[256]; - char vendor[128], model[128]; - int64_t bytes; + char vendor[128] = { 0 }; + char model[128] = { 0 }; + int64_t bytes = 0; int64_t megabytes; int removable = 0; bool oldkernel = false; @@ -222,35 +542,39 @@ int CHDDMenuHandler::doMenu () printf("HDD: checking /sys/block/%s\n", namelist[i]->d_name); snprintf(str, sizeof(str), "/dev/%s", namelist[i]->d_name); - fd = open(str, O_RDONLY); - if(fd < 0) { - printf("Cant open %s\n", str); - continue; - } - if (ioctl(fd, BLKGETSIZE64, &bytes)) - perror("BLKGETSIZE64"); + int fd = open(str, O_RDONLY); + if (fd >= 0) { + if (ioctl(fd, BLKGETSIZE64, &bytes)) + perror("BLKGETSIZE64"); - ret = fstat(fd, &s); - if (ret != -1) { - if ((int)(s.st_rdev & drive_mask) == root_dev) { - isroot = true; - /* dev_t is different sized on different architectures :-( */ - printf("-> root device is on this disk 0x%04x, skipping\n", (int)s.st_rdev); + ret = fstat(fd, &s); + if (ret != -1) { + if ((int)(s.st_rdev & drive_mask) == root_dev) { + isroot = true; + /* dev_t is different sized on different architectures :-( */ + printf("-> root device is on this disk 0x%04x, skipping\n", (int)s.st_rdev); + } } + close(fd); + } else { + printf("Cant open %s\n", str); } - close(fd); megabytes = bytes/1000000; snprintf(str, sizeof(str), "/sys/block/%s/device/vendor", namelist[i]->d_name); - f = fopen(str, "r"); + FILE * f = fopen(str, "r"); if(!f) { - oldkernel = true; - strcpy(vendor, ""); - } else { + printf("Cant open %s\n", str); + snprintf(str, sizeof(str), "/sys/block/%s/device/type", namelist[i]->d_name); + f = fopen(str, "r"); + } + if (f) { fscanf(f, "%s", vendor); fclose(f); - strcat(vendor, "-"); + } else { + oldkernel = true; + strcpy(vendor, ""); } /* the Tripledragon only has kernel 2.6.12 available.... :-( */ @@ -261,10 +585,13 @@ int CHDDMenuHandler::doMenu () f = fopen(str, "r"); if(!f) { printf("Cant open %s\n", str); - continue; + snprintf(str, sizeof(str), "/sys/block/%s/device/name", namelist[i]->d_name); + f = fopen(str, "r"); + } + if (f) { + fscanf(f, "%s", model); + fclose(f); } - fscanf(f, "%s", model); - fclose(f); snprintf(str, sizeof(str), "/sys/block/%s/removable", namelist[i]->d_name); f = fopen(str, "r"); @@ -275,123 +602,69 @@ int CHDDMenuHandler::doMenu () fscanf(f, "%d", &removable); fclose(f); - bool enabled = !CNeutrinoApp::getInstance()->recordingstatus && !isroot; + std::string dev = std::string(namelist[i]->d_name).substr(0, 2); + std::string fmt = getFmtType(namelist[i]->d_name); + /* epmty cdrom do not appear in blkid output */ + if (fmt.empty() && dev == "sr") { + hdd_s hdd; + hdd.devname = namelist[i]->d_name; + hdd.mounted = false; + hdd.fmt = ""; + hdd.desc = hdd.devname; + hdd_list.push_back(hdd); + } - std::string fmt_type = ""; - if (blkidBinaryExist) - fmt_type = getFmtType(namelist[i]->d_name, 1); - std::string tmpType = (fmt_type == "") ? "" : " (" + fmt_type + (std::string)")"; + bool enabled = !CNeutrinoApp::getInstance()->recordingstatus && !isroot && dev != "sr"; - snprintf(str, sizeof(str), "%s %s %ld %s%s", vendor, model, (long)(megabytes < 10000 ? megabytes : megabytes/1000), megabytes < 10000 ? "MB" : "GB", tmpType.c_str()); + snprintf(str, sizeof(str), "%s %s %ld %s", vendor, model, (long)(megabytes < 10000 ? megabytes : megabytes/1000), megabytes < 10000 ? "MB" : "GB"); printf("HDD: %s\n", str); - tmp_str[i]=str; - tempMenu[i] = new CMenuWidget(str, NEUTRINO_ICON_SETTINGS); - tempMenu[i]->addIntroItems(); - if (fmt_type == "ext3") - g_settings.hdd_fs = fs_ext3; - else if (fmt_type == "ext4") - g_settings.hdd_fs = fs_ext4; - else - g_settings.hdd_fs = fs_ext3; - if (!ext4MkfsBinaryExist) - g_settings.hdd_fs = fs_ext3; - mc = new CMenuOptionChooser(LOCALE_HDD_FS, &g_settings.hdd_fs, HDD_FILESYS_OPTIONS, HDD_FILESYS_OPTION_COUNT, ext4MkfsBinaryExist); - mc->setHint("", LOCALE_MENU_HINT_HDD_FMT); - tempMenu[i]->addItem(mc); + devtitle[namelist[i]->d_name] = str; - mf = new CMenuForwarder(LOCALE_HDD_FORMAT, true, "", &fmtexec, namelist[i]->d_name); - mf->setHint("", LOCALE_MENU_HINT_HDD_FORMAT); - tempMenu[i]->addItem(mf); - - mf = new CMenuForwarder(LOCALE_HDD_CHECK, true, "", &chkexec, namelist[i]->d_name); - mf->setHint("", LOCALE_MENU_HINT_HDD_CHECK); - tempMenu[i]->addItem(mf); - - snprintf(sstr, sizeof(sstr), "%s (%s)", g_Locale->getText(LOCALE_HDD_REMOVABLE_DEVICE), namelist[i]->d_name); - mf = new CMenuForwarder((removable ? sstr : namelist[i]->d_name), enabled, tmp_str[i], tempMenu[i]); + std::string key = "d" + std::string(namelist[i]->d_name); + mf = new CMenuForwarder(namelist[i]->d_name, enabled, devtitle[namelist[i]->d_name], this, key.c_str()); mf->setHint("", LOCALE_MENU_HINT_HDD_TOOLS); hddmenu->addItem(mf); - hdd_found = 1; + hdd_found = true; free(namelist[i]); } if (n >= 0) free(namelist); - if(!hdd_found) + if(!hdd_found) { + //if no drives found, select 'back' + if (hddmenu->getSelected() != -1) + hddmenu->setSelected(2); hddmenu->addItem(new CMenuForwarder(LOCALE_HDD_NOT_FOUND, false)); + } - ret = hddmenu->exec(NULL, ""); - for(int i = 0; i < n;i++) { - if( hdd_found && tempMenu[i] != NULL ){ - delete tempMenu[i]; + if (!hdd_list.empty()) { + sort(hdd_list.begin(), hdd_list.end(), cmp_hdd_by_name()); + mount = g_Locale->getText(LOCALE_HDD_MOUNT); + umount = g_Locale->getText(LOCALE_HDD_UMOUNT); + int shortcut = 1; + hddmenu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_HDD_MOUNT_UMOUNT)); + for (std::vector::iterator it = hdd_list.begin(); it != hdd_list.end(); ++it) { + std::string key = "m" + it->devname; + it->cmf = new CMenuForwarder(it->desc, true, it->mounted ? umount : mount , this, + key.c_str(), CRCInput::convertDigitToKey(shortcut++)); + hddmenu->addItem(it->cmf); } } + ret = hddmenu->exec(NULL, ""); + delete hddmenu; + hdd_list.clear(); + devtitle.clear(); + if (show_menu) { + show_menu = false; + goto _show_menu; + } return ret; } -int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&) -{ - struct dirent **namelist; - int n = scandir("/sys/block", &namelist, my_filter, alphasort); - - if (n < 0) - return menu_return::RETURN_NONE; - - const char hdidle[] = "/sbin/hd-idle"; - bool have_hdidle = !access(hdidle, X_OK); - - if (g_settings.hdd_sleep < 60) - g_settings.hdd_sleep = 60; - - if (have_hdidle) { - system("kill $(pidof hd-idle)"); - int sleep_seconds = g_settings.hdd_sleep; - switch (sleep_seconds) { - case 241: - sleep_seconds = 30 * 60; - break; - case 242: - sleep_seconds = 60 * 60; - break; - default: - sleep_seconds *= 5; - } - if (sleep_seconds) - my_system(3, hdidle, "-i", to_string(sleep_seconds).c_str()); - } - - const char hdparm[] = "/sbin/hdparm"; - bool have_hdparm = !access(hdparm, X_OK); - if (!have_hdparm) - return menu_return::RETURN_NONE; - - struct stat stat_buf; - bool have_nonbb_hdparm = !::lstat(hdparm, &stat_buf) && !S_ISLNK(stat_buf.st_mode); - - for (int i = 0; i < n; i++) { - printf("CHDDDestExec: noise %d sleep %d /dev/%s\n", - g_settings.hdd_noise, g_settings.hdd_sleep, namelist[i]->d_name); - - char M_opt[50],S_opt[50], opt[100]; - snprintf(S_opt, sizeof(S_opt), "-S%d", g_settings.hdd_sleep); - snprintf(M_opt, sizeof(M_opt), "-M%d", g_settings.hdd_noise); - snprintf(opt, sizeof(opt), "/dev/%s",namelist[i]->d_name); - - if (have_hdidle) - my_system(3, hdparm, M_opt, opt); - else if (have_nonbb_hdparm) - my_system(4, hdparm, M_opt, S_opt, opt); - else // busybox hdparm doesn't support "-M" - my_system(3, hdparm, S_opt, opt); - free(namelist[i]); - } - free(namelist); - return menu_return::RETURN_NONE; -} - +#if 0 static int dev_umount(char *dev) { char buffer[255]; @@ -516,59 +789,54 @@ static void waitfordev(const char *, int) { } #endif - -#if 0 -static int check_and_umount(char * dev, char * path) -{ - char buffer[255]; - FILE *f = fopen("/proc/mounts", "r"); - if(f == NULL) - return -1; - while (fgets (buffer, 255, f) != NULL) { - if(strstr(buffer, dev)) { - printf("HDD: %s mounted\n", path); - fclose(f); - return umount(path); - } - } - fclose(f); - printf("HDD: %s not mounted\n", path); - return 0; -} #endif -int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key) +void CHDDMenuHandler::showError(neutrino_locale_t err) +{ + ShowMsg(LOCALE_MESSAGEBOX_ERROR, g_Locale->getText(err), CMessageBox::mbrOk, CMessageBox::mbOk); +} + +int CHDDMenuHandler::formatDevice(std::string dev) { char cmd[100]; char cmd2[100]; - CHintBox * hintbox; int res; FILE * f; - char src[128], dst[128]; CProgressWindow * progress; - std::string fdisk, sfdisk, mke3fs, mke4fs, tune2fs; + std::string fdisk, sfdisk, tune2fs; - snprintf(src, sizeof(src), "/dev/%s1", key.c_str()); - snprintf(dst, sizeof(dst), "/media/%s1", key.c_str()); + printf("CHDDMenuHandler::formatDevice: dev %s hdd_fs %d\n", dev.c_str(), g_settings.hdd_fs); - printf("CHDDFmtExec: key %s\n", key.c_str()); + if (g_settings.hdd_fs < 0 || g_settings.hdd_fs >= (int) FS_MAX) + return menu_return::RETURN_REPAINT; + + devtool_s * devtool = &devtools[g_settings.hdd_fs]; + if (!devtool || !devtool->mkfs_supported) { + printf("CHDDMenuHandler::formatDevice: mkfs.%s is not supported\n", devtool ? devtool->fmt.c_str() : "unknown"); + return menu_return::RETURN_REPAINT; + } + + std::string devname = "/dev/" + dev; + std::string part = getDefaultPart(dev); + + std::string devpart = dev + part; + std::string partname = devname + part; + + std::string mkfscmd = devtool->mkfs + " " + devtool->mkfs_options + " " + partname; + printf("mkfs cmd: [%s]\n", mkfscmd.c_str()); res = ShowMsg ( LOCALE_HDD_FORMAT, g_Locale->getText(LOCALE_HDD_FORMAT_WARN), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo ); if(res != CMessageBox::mbrYes) - return 0; + return menu_return::RETURN_REPAINT; bool srun = my_system(3, "killall", "-9", "smbd"); - //res = check_and_umount(dst); - //res = check_and_umount(src, dst); - res = umount_all(key.c_str()); - printf("CHDDFmtExec: umount res %d\n", res); + res = umount_all(dev); + printf("CHDDMenuHandler::formatDevice: umount res %d\n", res); + system("df"); // FIXME: debug - if(res) { - hintbox = new CHintBox(LOCALE_HDD_FORMAT, g_Locale->getText(LOCALE_HDD_UMOUNT_WARN)); - hintbox->paint(); - sleep(2); - delete hintbox; + if(!res) { + showError(LOCALE_HDD_UMOUNT_WARN); goto _return; } @@ -578,83 +846,59 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key) fprintf(f, "none\n"); fclose(f); } -#else - creat("/tmp/.nomdevmount", 00660); #endif + creat("/tmp/.nomdevmount", 00660); progress = new CProgressWindow(); progress->setTitle(LOCALE_HDD_FORMAT); progress->exec(NULL,""); - progress->showStatusMessageUTF("Executing fdisk"); progress->showGlobalStatus(0); fdisk = find_executable("fdisk"); sfdisk = find_executable("sfdisk"); - mke3fs = find_executable("mkfs.ext3"); - mke4fs = find_executable("mkfs.ext4"); tune2fs = find_executable("tune2fs"); - if (! fdisk.empty()) { - snprintf(cmd, sizeof(cmd), "%s -f -uM /dev/%s", fdisk.c_str(), key.c_str()); + if (! sfdisk.empty()) { + snprintf(cmd, sizeof(cmd), "%s -f -uM %s", sfdisk.c_str(), devname.c_str()); strcpy(cmd2, "0,\n;\n;\n;\ny\n"); } else if (! fdisk.empty()) { - snprintf(cmd, sizeof(cmd), "%s -u /dev/%s", fdisk.c_str(), key.c_str()); + snprintf(cmd, sizeof(cmd), "%s -u /dev/%s", fdisk.c_str(), devname.c_str()); strcpy(cmd2, "o\nn\np\n1\n2048\n\nw\n"); } else { /* cannot do anything */ fprintf(stderr, "CHDDFmtExec: neither fdisk nor sfdisk found in $PATH :-(\n"); - hintbox = new CHintBox(LOCALE_HDD_FORMAT, g_Locale->getText(LOCALE_HDD_FORMAT_FAILED)); - hintbox->paint(); - sleep(2); - delete hintbox; + showError(LOCALE_HDD_FORMAT_FAILED); goto _remount; } + progress->showStatusMessageUTF(cmd); + #ifdef ASSUME_MDEV /* mdev will create it and waitfordev will wait for it... */ - unlink(src); + unlink(partname.c_str()); #endif - printf("CHDDFmtExec: executing %s\n", cmd); - f=popen(cmd, "w"); + printf("CHDDMenuHandler::formatDevice: executing %s\n", cmd); + f = popen(cmd, "w"); if (!f) { - hintbox = new CHintBox(LOCALE_HDD_FORMAT, g_Locale->getText(LOCALE_HDD_FORMAT_FAILED)); - hintbox->paint(); - sleep(2); - delete hintbox; goto _remount; } + show_menu = true; fprintf(f, "%s", cmd2); - pclose(f); - //sleep(1); - - switch(g_settings.hdd_fs) { - case fs_ext3: - if (mke3fs.empty()) { - fprintf(stderr, "CHDDFmtExec: ext3 requested, but mkfs.ext3 not found!\n"); - mke3fs = "/bin/false"; /* returns failure */ - } - snprintf(cmd, sizeof(cmd), "%s -T largefile -m0 %s", mke3fs.c_str(), src); - break; - case fs_ext4: - if (mke4fs.empty()) { - fprintf(stderr, "CHDDFmtExec: ext4 requested, but mkfs.ext4 not found!\n"); - mke4fs = "/bin/false"; - } - snprintf(cmd, sizeof(cmd), "%s -T largefile -m0 %s", mke4fs.c_str(), src); - break; - default: - return 0; + res = pclose(f); + printf("CHDDMenuHandler::formatDevice: (s)fdisk res: %d\n", res); + if (res) { + showError(LOCALE_HDD_FORMAT_FAILED); + goto _return; } + sleep(2); +#ifdef ASSUME_MDEV + add_dev(dev, part); + waitfordev(devname + part, 30); +#endif - waitfordev(src, 30); - - printf("CHDDFmtExec: executing %s\n", cmd); - - f=popen(cmd, "r"); + progress->showStatusMessageUTF(mkfscmd.c_str()); + f = popen(mkfscmd.c_str(), "r"); if (!f) { - hintbox = new CHintBox(LOCALE_HDD_FORMAT, g_Locale->getText(LOCALE_HDD_FORMAT_FAILED)); - hintbox->paint(); - sleep(2); - delete hintbox; + showError(LOCALE_HDD_FORMAT_FAILED); goto _remount; } @@ -719,76 +963,51 @@ int CHDDFmtExec::exec(CMenuTarget* /*parent*/, const std::string& key) } } progress->showLocalStatus(100); - pclose(f); + res = pclose(f); + printf("CHDDMenuHandler::formatDevice: mkfs res: %d\n", res); progress->showGlobalStatus(100); + if (res) { + showError(LOCALE_HDD_FORMAT_FAILED); + goto _return; + } sleep(2); - waitfordev(src, 30); /* mdev can somtimes takes long to create devices, especially after mkfs? */ - - if (!tune2fs.empty()) { - printf("CHDDFmtExec: executing %s %s %s\n", tune2fs.c_str(), "-r 0 -c 0 -i 0", src); - my_system(8, tune2fs.c_str(), "-r", "0", "-c", "0", "-i", "0", src); - } else - printf("CHDDFmtExec: tune2fs not found, not tuning the file system\n"); + if (devtool->fmt.substr(0, 3) == "ext" && ! tune2fs.empty()) { + std::string d = "/dev/" + devpart; + printf("CHDDMenuHandler::formatDevice: executing %s %s %s\n", tune2fs.c_str(), "-r 0 -c 0 -i 0", d.c_str()); + my_system(8, tune2fs.c_str(), "-r", "0", "-c", "0", "-i", "0", d.c_str()); + } + show_menu = true; _remount: unlink("/tmp/.nomdevmount"); progress->hide(); delete progress; - if ((res = mount_all(key.c_str()))) - { - switch(g_settings.hdd_fs) { - case fs_ext3: - safe_mkdir(dst); - res = mount(src, dst, "ext3", 0, NULL); - break; - case fs_ext4: - safe_mkdir(dst); - res = mount(src, dst, "ext4", 0, NULL); - break; - default: - break; - } - } + //getBlkIds(); #ifndef ASSUME_MDEV f = fopen("/proc/sys/kernel/hotplug", "w"); if(f) { -#ifdef ASSUME_MDEV - fprintf(f, "/sbin/mdev\n"); -#else fprintf(f, "/sbin/hotplug\n"); -#endif fclose(f); } -#else - /* mounting is asynchronous via mdev, so wait for the directory to appear */ - for (int i = 0; i < 20; i++) { - struct statfs s; - if (::statfs(dst, &s) == 0) { - if (s.f_type == 0xEF53) /* EXT3_SUPER_MAGIC */ - break; - if (s.f_type == 0x52654973) /* REISERFS_SUPER_MAGIC */ - break; - } - if (i == 0) - printf("CHDDFmtExec: waiting for %s to be mounted\n", dst); - sleep(1); - } #endif + res = mount_dev(devpart); + system("df"); // FIXME: debug - if(!res) { - snprintf(cmd, sizeof(cmd), "%s/movies", dst); + if(res) { + std::string dst = MOUNT_BASE + devpart; + snprintf(cmd, sizeof(cmd), "%s/movies", dst.c_str()); safe_mkdir(cmd); - snprintf(cmd, sizeof(cmd), "%s/pictures", dst); + snprintf(cmd, sizeof(cmd), "%s/pictures", dst.c_str()); safe_mkdir(cmd); - snprintf(cmd, sizeof(cmd), "%s/epg", dst); + snprintf(cmd, sizeof(cmd), "%s/epg", dst.c_str()); safe_mkdir(cmd); - snprintf(cmd, sizeof(cmd), "%s/music", dst); + snprintf(cmd, sizeof(cmd), "%s/music", dst.c_str()); safe_mkdir(cmd); - snprintf(cmd, sizeof(cmd), "%s/logos", dst); + snprintf(cmd, sizeof(cmd), "%s/logos", dst.c_str()); safe_mkdir(cmd); - snprintf(cmd, sizeof(cmd), "%s/plugins", dst); + snprintf(cmd, sizeof(cmd), "%s/plugins", dst.c_str()); safe_mkdir(cmd); sync(); #if HAVE_TRIPLEDRAGON @@ -810,15 +1029,15 @@ _remount: if (ret < 0) break; /* remove lines that start with the same disk we formatted - src is "/dev/xda1", we only compare "/dev/xda" */ - if (strncmp(line, src, strlen(src)-1) != 0) + devname is /dev/xda" */ + if (strncmp(line, devname.c_str(), devname.length()) != 0) fprintf(g, "%s", line); } free(line); fclose(f); } /* now add our new entry */ - fprintf(g, "%s %s auto defaults 0 0\n", src, dst); + fprintf(g, "%s %s auto defaults 0 0\n", partname.c_str(), dst.c_str()); fclose(g); rename("/etc/fstab", "/etc/fstab.old"); rename("/etc/fstab.new", "/etc/fstab"); @@ -827,101 +1046,57 @@ _remount: } _return: if (!srun) my_system(1, "smbd"); + if (show_menu) + return menu_return::RETURN_EXIT_ALL; + return menu_return::RETURN_REPAINT; } -int CHDDChkExec::exec(CMenuTarget* /*parent*/, const std::string& key) +int CHDDMenuHandler::checkDevice(std::string dev) { - char cmd[100]; - CHintBox * hintbox; int res; - char src[128], dst[128]; FILE * f; CProgressWindow * progress; int oldpass = 0, pass, step, total; int percent = 0, opercent = 0; + char buf[256] = { 0 }; - std::string e2fsck = find_executable("e2fsck"); - std::string fscke3 = find_executable("fsck.ext3"); - std::string fscke4 = find_executable("fsck.ext4"); - /* this is quite bogus since the same binary can check ext2,3,4... */ - bool ext4FsckBinaryExist = !fscke4.empty(); - bool e2fsckBinaryExist = !e2fsck.empty(); - bool blkidBinaryExist = !find_executable("blkid").empty(); + std::string devname = "/dev/" + dev; - if (blkidBinaryExist) { - std::string fmt_type = getFmtType(key.c_str(), 1); - if (((fmt_type != "ext2") && (fmt_type != "ext3") && (fmt_type != "ext4")) || - ((fmt_type == "ext4") && (!ext4FsckBinaryExist) && (!e2fsckBinaryExist))) { + printf("CHDDMenuHandler::checkDevice: dev %s\n", dev.c_str()); - char msg1[512], msg2[512]; - if (fmt_type.empty()) - fmt_type = g_Locale->getText(LOCALE_HDD_FS_UNKNOWN); - snprintf(msg1, sizeof(msg1)-1, "%s", g_Locale->getText(LOCALE_HDD_CHECK_FORMAT_BAD)); - snprintf(msg2, sizeof(msg2)-1, msg1, fmt_type.c_str()); - hintbox = new CHintBox(LOCALE_HDD_CHECK, msg2); - hintbox->paint(); - sleep(3); - delete hintbox; - return menu_return::RETURN_REPAINT; - } - } + std::string fmt = getFmtType(dev); + devtool_s * devtool = get_dev_tool(fmt); + if (!devtool || !devtool->fsck_supported) + return menu_return::RETURN_REPAINT; - snprintf(src, sizeof(src), "/dev/%s1", key.c_str()); - snprintf(dst, sizeof(dst), "/media/%s1", key.c_str()); - -printf("CHDDChkExec: key %s\n", key.c_str()); + std::string cmd = devtool->fsck + " " + devtool->fsck_options + " " + devname; + printf("fsck cmd: [%s]\n", cmd.c_str()); bool srun = my_system(3, "killall", "-9", "smbd"); - //res = check_and_umount(dst); - //res = check_and_umount(src, dst); - res = umount_all(key.c_str()); - printf("CHDDChkExec: umount res %d\n", res); - if(res) { - hintbox = new CHintBox(LOCALE_HDD_CHECK, g_Locale->getText(LOCALE_HDD_UMOUNT_WARN)); - hintbox->paint(); - sleep(2); - delete hintbox; + res = true; + if (is_mounted(dev.c_str())) + res = umount_dev(dev); + + printf("CHDDMenuHandler::checkDevice: umount res %d\n", res); + if(!res) { + showError(LOCALE_HDD_UMOUNT_WARN); return menu_return::RETURN_REPAINT; } - if (e2fsckBinaryExist) { - snprintf(cmd, sizeof(cmd), "%s -C 1 -f -y %s", e2fsck.c_str(), src); - } else { - snprintf(cmd, sizeof(cmd), "%s -C 1 -f -y %s", fscke3.c_str(), src); - if ((ext4FsckBinaryExist) && (g_settings.hdd_fs == fs_ext4)) - snprintf(cmd, sizeof(cmd), "%s -C 1 -f -y %s", fscke4.c_str(), src); - -#if 0 - switch(g_settings.hdd_fs) { - case fs_ext3: - snprintf(cmd, sizeof(cmd), "%s -C 1 -f -y %s", ext3FsckBinary, src); - break; - case fs_ext4: - snprintf(cmd, sizeof(cmd), "%s -C 1 -f -y %s", ext4FsckBinary, src); - break; - default: - return 0; - } -#endif - } - - printf("CHDDChkExec: Executing %s\n", cmd); - f=popen(cmd, "r"); + printf("CHDDMenuHandler::checkDevice: Executing %s\n", cmd.c_str()); + f=popen(cmd.c_str(), "r"); if(!f) { - hintbox = new CHintBox(LOCALE_HDD_CHECK, g_Locale->getText(LOCALE_HDD_CHECK_FAILED)); - hintbox->paint(); - sleep(2); - delete hintbox; + showError(LOCALE_HDD_CHECK_FAILED); goto ret1; } progress = new CProgressWindow(); progress->setTitle(LOCALE_HDD_CHECK); progress->exec(NULL,""); + progress->showStatusMessageUTF(cmd.c_str()); - char buf[256]; while(fgets(buf, 255, f) != NULL) { if(isdigit(buf[0])) { @@ -947,7 +1122,10 @@ printf("CHDDChkExec: key %s\n", key.c_str()); } } //printf("CHDDChkExec: %s\n", buf); - pclose(f); + res = pclose(f); + if(res) + showError(LOCALE_HDD_CHECK_FAILED); + progress->showGlobalStatus(100); progress->showStatusMessageUTF(buf); sleep(2); @@ -955,24 +1133,69 @@ printf("CHDDChkExec: key %s\n", key.c_str()); delete progress; ret1: - - if ((res = mount_all(key.c_str()))) - { - switch(g_settings.hdd_fs) { - case fs_ext3: - safe_mkdir(dst); - res = mount(src, dst, "ext3", 0, NULL); - break; - case fs_ext4: - safe_mkdir(dst); - res = mount(src, dst, "ext4", 0, NULL); - break; - default: - break; - } - } - printf("CHDDChkExec: mount res %d\n", res); + res = mount_dev(dev); + printf("CHDDMenuHandler::checkDevice: mount res %d\n", res); if (!srun) my_system(1, "smbd"); return menu_return::RETURN_REPAINT; } + +int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&) +{ + struct dirent **namelist; + int n = scandir("/sys/block", &namelist, my_filter, alphasort); + + if (n < 0) + return menu_return::RETURN_NONE; + + const char hdidle[] = "/sbin/hd-idle"; + bool have_hdidle = !access(hdidle, X_OK); + + if (g_settings.hdd_sleep > 0 && g_settings.hdd_sleep < 60) + g_settings.hdd_sleep = 60; + + if (have_hdidle) { + system("kill $(pidof hd-idle)"); + int sleep_seconds = g_settings.hdd_sleep; + switch (sleep_seconds) { + case 241: + sleep_seconds = 30 * 60; + break; + case 242: + sleep_seconds = 60 * 60; + break; + default: + sleep_seconds *= 5; + } + if (sleep_seconds) + my_system(3, hdidle, "-i", to_string(sleep_seconds).c_str()); + } + + const char hdparm[] = "/sbin/hdparm"; + bool have_hdparm = !access(hdparm, X_OK); + if (!have_hdparm) + return menu_return::RETURN_NONE; + + struct stat stat_buf; + bool have_nonbb_hdparm = !::lstat(hdparm, &stat_buf) && !S_ISLNK(stat_buf.st_mode); + + for (int i = 0; i < n; i++) { + printf("CHDDDestExec: noise %d sleep %d /dev/%s\n", + g_settings.hdd_noise, g_settings.hdd_sleep, namelist[i]->d_name); + + char M_opt[50],S_opt[50], opt[100]; + snprintf(S_opt, sizeof(S_opt), "-S%d", g_settings.hdd_sleep); + snprintf(M_opt, sizeof(M_opt), "-M%d", g_settings.hdd_noise); + snprintf(opt, sizeof(opt), "/dev/%s",namelist[i]->d_name); + + if (have_hdidle) + my_system(3, hdparm, M_opt, opt); + else if (have_nonbb_hdparm) + my_system(4, hdparm, M_opt, S_opt, opt); + else // busybox hdparm doesn't support "-M" + my_system(3, hdparm, S_opt, opt); + free(namelist[i]); + } + free(namelist); + return menu_return::RETURN_NONE; +} diff --git a/src/gui/hdd_menu.h b/src/gui/hdd_menu.h index cd91e8ac9..97cc6b447 100644 --- a/src/gui/hdd_menu.h +++ b/src/gui/hdd_menu.h @@ -2,12 +2,14 @@ Neutrino-GUI - DBoxII-Project - License: GPL + Copyright (C) 2009-2014 CoolStream International Ltd + Copyright (C) 2013-2014 martii + + License: GPLv2 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,11 +30,14 @@ using namespace std; -enum { - fs_ext3, - fs_ext4, - - fs_max +struct devtool_s { + std::string fmt; + std::string fsck; + std::string fsck_options; + std::string mkfs; + std::string mkfs_options; + bool fsck_supported; + bool mkfs_supported; }; class CHDDDestExec : public CMenuTarget @@ -40,27 +45,59 @@ class CHDDDestExec : public CMenuTarget public: int exec(CMenuTarget* parent, const std::string&); }; -class CHDDFmtExec : public CMenuTarget -{ -public: - int exec(CMenuTarget* parent, const std::string&); -}; -class CHDDChkExec : public CMenuTarget -{ -public: - int exec(CMenuTarget* parent, const std::string&); -}; class CHDDMenuHandler : public CMenuTarget { private: int width; - public: + std::string mount; + std::string umount; + bool show_menu; + std::map devtitle; + struct hdd_s { + std::string devname; + std::string fmt; + std::string desc; + CMenuForwarder *cmf; + bool mounted; + }; + std::vector hdd_list; + struct cmp_hdd_by_name: public binary_function + { + bool operator() (const struct hdd_s c1, const struct hdd_s c2) + { + return std::lexicographical_compare(c1.devname.begin(), c1.devname.end(), c2.devname.begin(), c2.devname.end()); + }; + }; + + static devtool_s devtools[]; + + bool is_mounted(const char *dev); + void getBlkIds(); + std::string getFmtType(std::string name, std::string part = ""); + std::string getDefaultPart(std::string dev); + bool mount_dev(std::string name); + bool umount_dev(std::string name); + bool umount_all(std::string dev); + bool add_dev(std::string dev, std::string part); + bool waitfordev(std::string dev, int maxwait); + void check_dev_tools(); + devtool_s * get_dev_tool(std::string fmt); + + int showDeviceMenu(std::string dev); + int checkDevice(std::string dev); + int formatDevice(std::string dev); + void showError(neutrino_locale_t err); CHDDMenuHandler(); + + public: ~CHDDMenuHandler(); - int exec( CMenuTarget* parent, const std::string &actionkey); - int doMenu(); + + static CHDDMenuHandler* getInstance(); + int exec( CMenuTarget* parent, const std::string &actionkey); + int doMenu(); + int filterDevName(const char * name); + int handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data); }; #endif - diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 297334d67..8675636e0 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -181,12 +181,11 @@ void CImageInfo::ShowWindow() { CComponentsFooter *footer = NULL; if (cc_win == NULL){ - cc_win = new CComponentsWindowMax(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO, CC_SHADOW_ON); + cc_win = new CComponentsWindowMax(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO, 0, CC_SHADOW_ON); cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); footer = cc_win->getFooterObject(); footer->setColorBody(COL_INFOBAR_SHADOW_PLUS_1); - btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, footer->getHeight(), LOCALE_BUILDINFO_MENU, false , true, false, footer->getColorBody(), footer->getColorBody()); - footer->addCCItem(btn_red); + btn_red = new CComponentsButtonRed(10, CC_CENTERED, 250, footer->getHeight(), LOCALE_BUILDINFO_MENU, footer, false , true, false, footer->getColorBody(), footer->getColorBody()); } //prepare minitv diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index 0a96fad82..769276713 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -36,7 +36,7 @@ -CInfoClock::CInfoClock():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) +CInfoClock::CInfoClock():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, NULL, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) { initVarInfoClock(); } diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index 82f5bf093..bf7214aa7 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -185,7 +185,7 @@ const key_settings_struct_t key_settings[CKeybindSetup::KEYBINDS_COUNT] = {LOCALE_MPKEY_BOOKMARK, &g_settings.mpkey_bookmark, LOCALE_MENU_HINT_KEY_MPBOOKMARK }, {LOCALE_EXTRA_KEY_TIMESHIFT, &g_settings.key_timeshift, LOCALE_MENU_HINT_KEY_MPTIMESHIFT }, {LOCALE_MPKEY_PLUGIN, &g_settings.mpkey_plugin, LOCALE_MENU_HINT_KEY_MPPLUGIN }, - /*{LOCALE_EXTRA_KEY_PLUGIN, &g_settings.key_plugin, },*/ + {LOCALE_EXTRA_KEY_PLUGIN, &g_settings.key_plugin, LOCALE_MENU_HINT_KEY_PLUGIN }, {LOCALE_EXTRA_KEY_UNLOCK, &g_settings.key_unlock, LOCALE_MENU_HINT_KEY_UNLOCK}, {LOCALE_EXTRA_KEY_SCREENSHOT, &g_settings.key_screenshot, LOCALE_MENU_HINT_KEY_SCREENSHOT }, {LOCALE_EXTRA_KEY_PIP_CLOSE, &g_settings.key_pip_close, LOCALE_MENU_HINT_KEY_PIP_CLOSE }, @@ -196,6 +196,17 @@ const key_settings_struct_t key_settings[CKeybindSetup::KEYBINDS_COUNT] = {LOCALE_EXTRA_KEY_PIC_SIZE, &g_settings.key_pic_size_active, LOCALE_MENU_HINT_KEY_PIC_SIZE_ACTIVE } }; +// used by driver/rcinput.cpp +bool checkLongPress(uint32_t key) +{ + if (g_settings.longkeypress_duration == LONGKEYPRESS_OFF) + return false; + key |= CRCInput::RC_Repeat; + for (unsigned int i = 0; i < CKeybindSetup::KEYBINDS_COUNT; i++) + if ((uint32_t)*key_settings[i].keyvalue_p == key) + return true; + return false; +} int CKeybindSetup::showKeySetup() { @@ -244,9 +255,18 @@ int CKeybindSetup::showKeySetup() mc->setHint("", LOCALE_MENU_HINT_KEY_HARDWARE); keySettings->addItem(mc); } + std::string ms_number_format("%d "); ms_number_format += g_Locale->getText(LOCALE_UNIT_SHORT_MILLISECOND); CMenuOptionNumberChooser *cc; + + cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_LONGKEYPRESS_DURATION, + &g_settings.longkeypress_duration, true, LONGKEYPRESS_OFF, 9999, NULL, 0, LONGKEYPRESS_OFF, LOCALE_OPTIONS_OFF); + cc->setNumberFormat(ms_number_format); + cc->setNumericInput(true); + cc->setHint("", LOCALE_MENU_HINT_LONGKEYPRESS_DURATION); + keySettings->addItem(cc); + cc = new CMenuOptionNumberChooser(LOCALE_KEYBINDINGMENU_REPEATBLOCK, &g_settings.repeat_blocker, true, 0, 999); cc->setNumberFormat(ms_number_format); @@ -319,7 +339,6 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) //misc bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_MISC)); - //bindSettings->addItem(new CMenuForwarder(keydescription[KEY_PLUGIN], true, NULL, keychooser[KEY_PLUGIN])); //Special keys CMenuWidget* bindSettings_special = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING, width, MN_WIDGET_ID_KEYSETUP_KEYBINDING_SPECIAL); @@ -328,6 +347,10 @@ void CKeybindSetup::showKeyBindSetup(CMenuWidget *bindSettings) mf->setHint("", LOCALE_MENU_HINT_KEY_SPECIAL_ACTIVE); bindSettings->addItem(mf); + //onekey-plugin + mf = new CMenuForwarder(key_settings[KEY_PLUGIN].keydescription, true, keychooser[KEY_PLUGIN]->getKeyName(), keychooser[KEY_PLUGIN]); + mf->setHint("", key_settings[KEY_PLUGIN].hint); + bindSettings->addItem(mf); // unlock mf = new CMenuForwarder(key_settings[KEY_UNLOCK].keydescription, true, keychooser[KEY_UNLOCK]->getKeyName(), keychooser[KEY_UNLOCK]); mf->setHint("", key_settings[KEY_UNLOCK].hint); @@ -416,7 +439,7 @@ void CKeybindSetup::showKeyBindMovieplayerSetup(CMenuWidget *bindSettings_mplaye { bindSettings_mplayer->addIntroItems(LOCALE_MAINMENU_MOVIEPLAYER); - for (int i = MPKEY_REWIND; i < MPKEY_PLUGIN; i++) { + for (int i = MPKEY_REWIND; i <= MPKEY_PLUGIN; i++) { CMenuForwarder * mf = new CMenuForwarder(key_settings[i].keydescription, true, keychooser[i]->getKeyName(), keychooser[i]); mf->setHint("", key_settings[i].hint); bindSettings_mplayer->addItem(mf); diff --git a/src/gui/keybind_setup.h b/src/gui/keybind_setup.h index 7a6313793..8b0de168d 100644 --- a/src/gui/keybind_setup.h +++ b/src/gui/keybind_setup.h @@ -74,7 +74,7 @@ class CKeybindSetup : public CMenuTarget, public CChangeObserver MPKEY_BOOKMARK, KEY_TIMESHIFT, MPKEY_PLUGIN, - /*KEY_PLUGIN,*/ + KEY_PLUGIN, KEY_UNLOCK, KEY_SCREENSHOT, KEY_PIP_CLOSE, diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index 1940ae7fe..a34f3675a 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -306,6 +307,18 @@ CLuaInstance::~CLuaInstance() } } +void CLuaInstance::functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc) +{ + lua_Debug ar; + lua_getstack(L, 1, &ar); + lua_getinfo(L, "Sl", &ar); + printf("[Lua Script] \33[1;31m%s\33[0m %s \33[33m%s\33[0m %s \33[1;33m%s\33[0m.\n (%s:%d)\n", + g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED1), + g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED2), oldFunc, + g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED3), newFunc, + ar.short_src, ar.currentline); +} + #define SET_VAR1(NAME) \ lua_pushinteger(lua, NAME); \ lua_setglobal(lua, #NAME); @@ -314,7 +327,7 @@ CLuaInstance::~CLuaInstance() lua_setglobal(lua, #NAME); /* Run the given script. */ -void CLuaInstance::runScript(const char *fileName) +void CLuaInstance::runScript(const char *fileName, std::vector *argv, std::string *result_code, std::string *result_string, std::string *error_string) { // luaL_dofile(lua, fileName); /* run the script */ @@ -322,17 +335,68 @@ void CLuaInstance::runScript(const char *fileName) if (status) { fprintf(stderr, "[CLuaInstance::%s] Can't load file: %s\n", __func__, lua_tostring(lua, -1)); ShowMsg2UTF("Lua script error:", lua_tostring(lua, -1), CMsgBox::mbrBack, CMsgBox::mbBack); + if (error_string) + *error_string = std::string(lua_tostring(lua, -1)); return; } + int argvSize = 1; + int n = 0; set_lua_variables(lua); + if (argv && (!argv->empty())) + argvSize += argv->size(); + lua_createtable(lua, argvSize, 0); + + // arg0 is scriptname + lua_pushstring(lua, fileName); + lua_rawseti(lua, -2, n++); + + if (argv && (!argv->empty())) { + for(std::vector::iterator it = argv->begin(); it != argv->end(); ++it) { + lua_pushstring(lua, it->c_str()); + lua_rawseti(lua, -2, n++); + } + } + lua_setglobal(lua, "arg"); status = lua_pcall(lua, 0, LUA_MULTRET, 0); + if (result_code) + *result_code = to_string(status); + if (result_string && lua_isstring(lua, -1)) + *result_string = std::string(lua_tostring(lua, -1)); if (status) { fprintf(stderr, "[CLuaInstance::%s] error in script: %s\n", __func__, lua_tostring(lua, -1)); ShowMsg2UTF("Lua script error:", lua_tostring(lua, -1), CMsgBox::mbrBack, CMsgBox::mbBack); + if (error_string) + *error_string = std::string(lua_tostring(lua, -1)); } } +// Example: runScript(fileName, "Arg1", "Arg2", "Arg3", ..., NULL); +// Type of all parameters: const char* +// The last parameter to NULL is imperative. +void CLuaInstance::runScript(const char *fileName, const char *arg0, ...) +{ + int i = 0; + std::vector args; + args.push_back(arg0); + va_list list; + va_start(list, arg0); + const char* temp = va_arg(list, const char*); + while (temp != NULL) { + if (i >= 64) { + fprintf(stderr, "CLuaInstance::runScript: too many arguments!\n"); + args.clear(); + return; + } + args.push_back(temp); + temp = va_arg(list, const char*); + i++; + } + va_end(list); + runScript(fileName, &args); + args.clear(); +} + const luaL_Reg CLuaInstance::methods[] = { { "PaintBox", CLuaInstance::PaintBox }, @@ -345,6 +409,7 @@ const luaL_Reg CLuaInstance::methods[] = { "DisplayImage", CLuaInstance::DisplayImage }, { "Blit", CLuaInstance::Blit }, { "GetLanguage", CLuaInstance::GetLanguage }, + { "runScript", CLuaInstance::runScriptExt }, { NULL, NULL } }; @@ -419,6 +484,7 @@ void CLuaInstance::registerFunctions() CWindowRegister(lua); ComponentsTextRegister(lua); SignalBoxRegister(lua); + CPictureRegister(lua); } CLuaData *CLuaInstance::CheckData(lua_State *L, int narg) @@ -619,7 +685,7 @@ int CLuaInstance::GetInput(lua_State *L) /* TODO: I'm not sure if this works... */ if (msg != CRCInput::RC_timeout && msg > CRCInput::RC_MaxRC) { - DBG("CLuaInstance::%s: msg 0x%08"PRIx32" data 0x%08"PRIx32"\n", __func__, msg, data); + DBG("CLuaInstance::%s: msg 0x%08" PRIx32 " data 0x%08" PRIx32 "\n", __func__, msg, data); CNeutrinoApp::getInstance()->handleMsg(msg, data); } /* signed int is debatable, but the "big" messages can't yet be handled @@ -681,6 +747,27 @@ int CLuaInstance::GetLanguage(lua_State *L) return 1; } +int CLuaInstance::runScriptExt(lua_State *L) +{ + CLuaData *W = CheckData(L, 1); + if (!W) return 0; + + int numargs = lua_gettop(L); + const char *script = luaL_checkstring(L, 2); + std::vector args; + for (int i = 3; i <= numargs; i++) { + std::string arg = luaL_checkstring(L, i); + if (!arg.empty()) + args.push_back(arg); + } + + CLuaInstance *lua = new CLuaInstance(); + lua->runScript(script, &args); + args.clear(); + delete lua; + return 0; +} + bool CLuaInstance::tableLookup(lua_State *L, const char *what, std::string &value) { bool res = false; @@ -705,6 +792,18 @@ bool CLuaInstance::tableLookup(lua_State *L, const char *what, lua_Integer &valu return res; } +bool CLuaInstance::tableLookup(lua_State *L, const char *what, void** value) +{ + bool res = false; + lua_pushstring(L, what); + lua_gettable(L, -2); + res = lua_isuserdata(L, -1); + if (res) + *value = lua_unboxpointer(L, -1); + lua_pop(L, 1); + return res; +} + bool CLuaMenuChangeObserver::changeNotify(lua_State *L, const std::string &luaAction, const std::string &luaId, void *Data) { const char *optionValue = (const char *) Data; @@ -1325,7 +1424,12 @@ void CLuaInstance::CWindowRegister(lua_State *L) { "new", CLuaInstance::CWindowNew }, { "paint", CLuaInstance::CWindowPaint }, { "hide", CLuaInstance::CWindowHide }, - { "header_height", CLuaInstance::CWindowGetHeaderHeight }, + { "setCaption", CLuaInstance::CWindowSetCaption }, + { "paintHeader", CLuaInstance::CWindowPaintHeader }, + { "headerHeight", CLuaInstance::CWindowGetHeaderHeight }, + { "footerHeight", CLuaInstance::CWindowGetFooterHeight }, + { "header_height", CLuaInstance::CWindowGetHeaderHeight_dep }, /* function 'header_height' is deprecated */ + { "footer_height", CLuaInstance::CWindowGetFooterHeight_dep }, /* function 'footer_height' is deprecated */ { "__gc", CLuaInstance::CWindowDelete }, { NULL, NULL } }; @@ -1341,11 +1445,15 @@ int CLuaInstance::CWindowNew(lua_State *L) { lua_assert(lua_istable(L,1)); - std::string name, icon = std::string(NEUTRINO_ICON_INFO); - std::string btnRed = ""; - std::string btnGreen = ""; - std::string btnYellow = ""; - std::string btnBlue = ""; + std::string name, icon = std::string(NEUTRINO_ICON_INFO); + lua_Integer color_frame = (lua_Integer)COL_MENUCONTENT_PLUS_6; + lua_Integer color_body = (lua_Integer)COL_MENUCONTENT_PLUS_0; + lua_Integer color_shadow = (lua_Integer)COL_MENUCONTENTDARK_PLUS_0; + std::string tmp1 = "false"; + std::string btnRed = ""; + std::string btnGreen = ""; + std::string btnYellow = ""; + std::string btnBlue = ""; lua_Integer x = 100, y = 100, dx = 450, dy = 250; tableLookup(L, "x", x); tableLookup(L, "y", y); @@ -1353,6 +1461,11 @@ int CLuaInstance::CWindowNew(lua_State *L) tableLookup(L, "dy", dy); tableLookup(L, "name", name) || tableLookup(L, "title", name) || tableLookup(L, "caption", name); tableLookup(L, "icon", icon); + tableLookup(L, "has_shadow" , tmp1); + bool has_shadow = (tmp1 == "true" || tmp1 == "1" || tmp1 == "yes"); + tableLookup(L, "color_frame" , color_frame); + tableLookup(L, "color_body" , color_body); + tableLookup(L, "color_shadow", color_shadow); tableLookup(L, "btnRed", btnRed); tableLookup(L, "btnGreen", btnGreen); tableLookup(L, "btnYellow", btnYellow); @@ -1360,7 +1473,7 @@ int CLuaInstance::CWindowNew(lua_State *L) CLuaCWindow **udata = (CLuaCWindow **) lua_newuserdata(L, sizeof(CLuaCWindow *)); *udata = new CLuaCWindow(); - (*udata)->w = new CComponentsWindow(x, y, dx, dy, name.c_str(), icon.c_str()); + (*udata)->w = new CComponentsWindow(x, y, dx, dy, name.c_str(), icon.c_str(), 0, has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); CComponentsFooter* footer = (*udata)->w->getFooterObject(); if (footer) { @@ -1375,13 +1488,13 @@ int CLuaInstance::CWindowNew(lua_State *L) int btnh = footer->getHeight(); int start = 10; if (btnRed != "") - footer->addCCItem(new CComponentsButtonRed(start, CC_CENTERED, btnw, btnh, btnRed, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonRed(start, CC_CENTERED, btnw, btnh, btnRed, 0, false , true, false, col, col)); if (btnGreen != "") - footer->addCCItem(new CComponentsButtonGreen(start+=btnw, CC_CENTERED, btnw, btnh, btnGreen, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonGreen(start+=btnw, CC_CENTERED, btnw, btnh, btnGreen, 0, false , true, false, col, col)); if (btnYellow != "") - footer->addCCItem(new CComponentsButtonYellow(start+=btnw, CC_CENTERED, btnw, btnh, btnYellow, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonYellow(start+=btnw, CC_CENTERED, btnw, btnh, btnYellow, 0, false , true, false, col, col)); if (btnBlue != "") - footer->addCCItem(new CComponentsButtonBlue(start+=btnw, CC_CENTERED, btnw, btnh, btnBlue, false , true, false, col, col)); + footer->addCCItem(new CComponentsButtonBlue(start+=btnw, CC_CENTERED, btnw, btnh, btnBlue, 0, false , true, false, col, col)); } } @@ -1425,6 +1538,46 @@ int CLuaInstance::CWindowHide(lua_State *L) return 0; } +int CLuaInstance::CWindowSetCaption(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaCWindow *m = CWindowCheck(L, 1); + if (!m) return 0; + + std::string name = ""; + tableLookup(L, "name", name) || tableLookup(L, "title", name) || tableLookup(L, "caption", name); + + m->w->setWindowCaption(name); + return 0; +} + +int CLuaInstance::CWindowPaintHeader(lua_State *L) +{ + CLuaCWindow *m = CWindowCheck(L, 1); + if (!m) return 0; + + CComponentsHeader* header = m->w->getHeaderObject(); + if (header) + m->w->showHeader(); + header->paint(); + + return 0; +} + +// function 'header_height' is deprecated +int CLuaInstance::CWindowGetHeaderHeight_dep(lua_State *L) +{ + functionDeprecated(L, "header_height", "headerHeight"); + return CWindowGetHeaderHeight(L); +} + +// function 'footer_height' is deprecated +int CLuaInstance::CWindowGetFooterHeight_dep(lua_State *L) +{ + functionDeprecated(L, "footer_height", "footerHeight"); + return CWindowGetFooterHeight(L); +} + int CLuaInstance::CWindowGetHeaderHeight(lua_State *L) { CLuaCWindow *m = CWindowCheck(L, 1); @@ -1439,13 +1592,28 @@ int CLuaInstance::CWindowGetHeaderHeight(lua_State *L) return 1; } -int CLuaInstance::CWindowDelete(lua_State *L) +int CLuaInstance::CWindowGetFooterHeight(lua_State *L) { CLuaCWindow *m = CWindowCheck(L, 1); if (!m) return 0; - m->w->kill(); + CComponentsFooter* footer = m->w->getFooterObject(); + int fh = 0; + if (footer) + fh = footer->getHeight(); + lua_pushinteger(L, fh); + return 1; +} + +int CLuaInstance::CWindowDelete(lua_State *L) +{ + DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); + CLuaCWindow *m = CWindowCheck(L, 1); + if (!m) + return 0; + + m->w->hide(); delete m; return 0; } @@ -1524,7 +1692,7 @@ int CLuaInstance::SignalBoxDelete(lua_State *L) CLuaComponentsText *CLuaInstance::ComponentsTextCheck(lua_State *L, int n) { - return *(CLuaComponentsText **) luaL_checkudata(L, n, "componentstext"); + return *(CLuaComponentsText **) luaL_checkudata(L, n, "ctext"); } void CLuaInstance::ComponentsTextRegister(lua_State *L) @@ -1533,22 +1701,24 @@ void CLuaInstance::ComponentsTextRegister(lua_State *L) { "new", CLuaInstance::ComponentsTextNew }, { "paint", CLuaInstance::ComponentsTextPaint }, { "hide", CLuaInstance::ComponentsTextHide }, + { "setText", CLuaInstance::ComponentsTextSetText }, { "scroll", CLuaInstance::ComponentsTextScroll }, { "__gc", CLuaInstance::ComponentsTextDelete }, { NULL, NULL } }; - luaL_newmetatable(L, "componentstext"); + luaL_newmetatable(L, "ctext"); luaL_setfuncs(L, meth, 0); lua_pushvalue(L, -1); lua_setfield(L, -1, "__index"); - lua_setglobal(L, "componentstext"); + lua_setglobal(L, "ctext"); } int CLuaInstance::ComponentsTextNew(lua_State *L) { lua_assert(lua_istable(L,1)); + CLuaCWindow* parent = NULL; lua_Integer x = 10, y = 10, dx = 100, dy = 100; std::string text = ""; std::string tmpMode = ""; @@ -1560,6 +1730,7 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) lua_Integer color_shadow = (lua_Integer)COL_MENUCONTENTDARK_PLUS_0; std::string tmp1 = "false"; + tableLookup(L, "parent" , (void**)&parent); tableLookup(L, "x" , x); tableLookup(L, "y" , y); tableLookup(L, "dx" , dx); @@ -1586,6 +1757,7 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) { "ALIGN_TOP", CTextBox::TOP }, { "ALIGN_BOTTOM", CTextBox::BOTTOM }, { "ALIGN_NO_AUTO_LINEBREAK", CTextBox::NO_AUTO_LINEBREAK }, + { "DECODE_HTML", 0 }, { NULL, 0 } }; mode = 0; @@ -1593,12 +1765,19 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) if (tmpMode.find(txt_align[i].name) != std::string::npos) mode |= txt_align[i].code; } + if (tmpMode.find("DECODE_HTML") != std::string::npos) + htmlEntityDecode(text); } + CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL; + CLuaComponentsText **udata = (CLuaComponentsText **) lua_newuserdata(L, sizeof(CLuaComponentsText *)); *udata = new CLuaComponentsText(); - (*udata)->ct = new CComponentsText(x, y, dx, dy, text, mode, g_Font[font_text], has_shadow, (fb_pixel_t)color_text, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); - luaL_getmetatable(L, "componentstext"); + (*udata)->ct = new CComponentsText(x, y, dx, dy, text, mode, g_Font[font_text], pw, has_shadow, (fb_pixel_t)color_text, (fb_pixel_t)color_frame, (fb_pixel_t)color_body, (fb_pixel_t)color_shadow); + (*udata)->parent = pw; + (*udata)->mode = mode; + (*udata)->font_text = font_text; + luaL_getmetatable(L, "ctext"); lua_setmetatable(L, -2); return 1; } @@ -1606,14 +1785,13 @@ int CLuaInstance::ComponentsTextNew(lua_State *L) int CLuaInstance::ComponentsTextPaint(lua_State *L) { lua_assert(lua_istable(L,1)); + CLuaComponentsText *m = ComponentsTextCheck(L, 1); + if (!m) return 0; + std::string tmp = "true"; tableLookup(L, "do_save_bg", tmp); bool do_save_bg = (tmp == "true" || tmp == "1" || tmp == "yes"); - CLuaComponentsText *m = ComponentsTextCheck(L, 1); - if (!m) - return 0; - m->ct->paint(do_save_bg); return 0; } @@ -1621,29 +1799,48 @@ int CLuaInstance::ComponentsTextPaint(lua_State *L) int CLuaInstance::ComponentsTextHide(lua_State *L) { lua_assert(lua_istable(L,1)); + CLuaComponentsText *m = ComponentsTextCheck(L, 1); + if (!m) return 0; + std::string tmp = "false"; tableLookup(L, "no_restore", tmp); bool no_restore = (tmp == "true" || tmp == "1" || tmp == "yes"); - CLuaComponentsText *m = ComponentsTextCheck(L, 1); - if (!m) - return 0; + if (m->parent) { + m->ct->setText("", m->mode, g_Font[m->font_text]); + m->ct->paint(); + } else + m->ct->hide(no_restore); + return 0; +} - m->ct->hide(no_restore); +int CLuaInstance::ComponentsTextSetText(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaComponentsText *m = ComponentsTextCheck(L, 1); + if (!m) return 0; + + std::string text = ""; + int mode = m->mode; + int font_text = m->font_text; + tableLookup(L, "text", text); + tableLookup(L, "mode", mode); + tableLookup(L, "font_text", font_text); + + m->ct->setText(text, mode, g_Font[font_text]); return 0; } int CLuaInstance::ComponentsTextScroll(lua_State *L) { lua_assert(lua_istable(L,1)); + CLuaComponentsText *m = ComponentsTextCheck(L, 1); + if (!m) return 0; + std::string tmp = "true"; tableLookup(L, "dir", tmp); bool scrollDown = (tmp == "down" || tmp == "1"); - CLuaComponentsText *m = ComponentsTextCheck(L, 1); - if (!m) - return 0; - //get the textbox instance from lua object and use CTexBbox scroll methods CTextBox* ctb = m->ct->getCTextBoxObject(); if (ctb) { @@ -1659,11 +1856,131 @@ int CLuaInstance::ComponentsTextScroll(lua_State *L) int CLuaInstance::ComponentsTextDelete(lua_State *L) { + DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); CLuaComponentsText *m = ComponentsTextCheck(L, 1); if (!m) return 0; - m->ct->kill(); + m->ct->hide(); + delete m; + return 0; +} + +// -------------------------------------------------------------------------------- + +CLuaPicture *CLuaInstance::CPictureCheck(lua_State *L, int n) +{ + return *(CLuaPicture **) luaL_checkudata(L, n, "cpicture"); +} + +void CLuaInstance::CPictureRegister(lua_State *L) +{ + luaL_Reg meth[] = { + { "new", CLuaInstance::CPictureNew }, + { "paint", CLuaInstance::CPicturePaint }, + { "hide", CLuaInstance::CPictureHide }, + { "setPicture", CLuaInstance::CPictureSetPicture }, + { "__gc", CLuaInstance::CPictureDelete }, + { NULL, NULL } + }; + + luaL_newmetatable(L, "cpicture"); + luaL_setfuncs(L, meth, 0); + lua_pushvalue(L, -1); + lua_setfield(L, -1, "__index"); + lua_setglobal(L, "cpicture"); +} + +int CLuaInstance::CPictureNew(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + + CLuaCWindow* parent = NULL; + int x=10, y=10, dx=100, dy=100; + std::string image_name = ""; + int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER; + + std::string tmp1 = "false"; // has_shadow + lua_Integer color_frame = (lua_Integer)COL_MENUCONTENT_PLUS_6; + lua_Integer color_background = (lua_Integer)COL_MENUCONTENT_PLUS_0; + lua_Integer color_shadow = (lua_Integer)COL_MENUCONTENTDARK_PLUS_0; + + tableLookup(L, "parent" , (void**)&parent); + tableLookup(L, "x" , x); + tableLookup(L, "y" , y); + tableLookup(L, "dx" , dx); + tableLookup(L, "dy" , dy); + tableLookup(L, "image" , image_name); + tableLookup(L, "alignment" , alignment); + tableLookup(L, "has_shadow" , tmp1); + bool has_shadow = (tmp1 == "true" || tmp1 == "1" || tmp1 == "yes"); + tableLookup(L, "color_frame" , color_frame); + tableLookup(L, "color_background" , color_background); + tableLookup(L, "color_shadow" , color_shadow); + + CComponentsForm* pw = (parent && parent->w) ? parent->w->getBodyObject() : NULL; + + CLuaPicture **udata = (CLuaPicture **) lua_newuserdata(L, sizeof(CLuaPicture *)); + *udata = new CLuaPicture(); + (*udata)->cp = new CComponentsPicture(x, y, dx, dy, image_name, alignment, pw, has_shadow, (fb_pixel_t)color_frame, (fb_pixel_t)color_background, (fb_pixel_t)color_shadow); + (*udata)->parent = pw; + luaL_getmetatable(L, "cpicture"); + lua_setmetatable(L, -2); + return 1; +} + +int CLuaInstance::CPicturePaint(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaPicture *m = CPictureCheck(L, 1); + if (!m) return 0; + + std::string tmp = "true"; + tableLookup(L, "do_save_bg", tmp); + bool do_save_bg = (tmp == "true" || tmp == "1" || tmp == "yes"); + + m->cp->paint(do_save_bg); + return 0; +} + +int CLuaInstance::CPictureHide(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaPicture *m = CPictureCheck(L, 1); + if (!m) return 0; + + std::string tmp = "false"; + tableLookup(L, "no_restore", tmp); + bool no_restore = (tmp == "true" || tmp == "1" || tmp == "yes"); + + if (m->parent) { + m->cp->setPicture(""); + m->cp->paint(); + } else + m->cp->hide(no_restore); + return 0; +} + +int CLuaInstance::CPictureSetPicture(lua_State *L) +{ + lua_assert(lua_istable(L,1)); + CLuaPicture *m = CPictureCheck(L, 1); + if (!m) return 0; + + std::string image_name = ""; + tableLookup(L, "image", image_name); + + m->cp->setPicture(image_name); + return 0; +} + +int CLuaInstance::CPictureDelete(lua_State *L) +{ + DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); + CLuaPicture *m = CPictureCheck(L, 1); + if (!m) return 0; + + m->cp->hide(); delete m; return 0; } diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 90e1e78ac..8994f8655 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -30,6 +30,7 @@ extern "C" { #include #include #include +#include /* this is stored as userdata in the lua_State */ struct CLuaData @@ -138,8 +139,19 @@ class CLuaComponentsText { public: CComponentsText *ct; - CLuaComponentsText() { ct = NULL; } - ~CLuaComponentsText() { delete ct; } + CComponentsForm *parent; + int mode, font_text; + CLuaComponentsText() { ct = NULL; parent = NULL; mode = 0; font_text = 0;} + ~CLuaComponentsText() { if (parent == NULL) delete ct; } +}; + +class CLuaPicture +{ + public: + CComponentsPicture *cp; + CComponentsForm *parent; + CLuaPicture() { cp = NULL; parent = NULL; } + ~CLuaPicture() { if (parent == NULL) delete cp; } }; @@ -153,12 +165,19 @@ class CLuaInstance public: CLuaInstance(); ~CLuaInstance(); - void runScript(const char *fileName); + void runScript(const char *fileName, std::vector *argv = NULL, std::string *result_code = NULL, std::string *result_string = NULL, std::string *error_string = NULL); + + // Example: runScript(fileName, "Arg1", "Arg2", "Arg3", ..., NULL); + // Type of all parameters: const char* + // The last parameter to NULL is imperative. + void runScript(const char *fileName, const char *arg0, ...); private: lua_State* lua; void registerFunctions(); + static void functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc); + static int NewWindow(lua_State *L); static int PaintBox(lua_State *L); static int PaintIcon(lua_State *L); @@ -169,6 +188,7 @@ private: static int GCWindow(lua_State *L); static int Blit(lua_State *L); static int GetLanguage(lua_State *L); + static int runScriptExt(lua_State *L); static int GetSize(lua_State *L); static int DisplayImage(lua_State *L); @@ -198,7 +218,12 @@ private: static CLuaCWindow *CWindowCheck(lua_State *L, int n); static int CWindowPaint(lua_State *L); static int CWindowHide(lua_State *L); + static int CWindowSetCaption(lua_State *L); + static int CWindowPaintHeader(lua_State *L); static int CWindowGetHeaderHeight(lua_State *L); + static int CWindowGetFooterHeight(lua_State *L); + static int CWindowGetHeaderHeight_dep(lua_State *L); // function 'header_height' is deprecated + static int CWindowGetFooterHeight_dep(lua_State *L); // function 'footer_height' is deprecated static int CWindowDelete(lua_State *L); static CLuaSignalBox *SignalBoxCheck(lua_State *L, int n); @@ -212,11 +237,21 @@ private: static int ComponentsTextNew(lua_State *L); static int ComponentsTextPaint(lua_State *L); static int ComponentsTextHide(lua_State *L); + static int ComponentsTextSetText(lua_State *L); static int ComponentsTextScroll(lua_State *L); static int ComponentsTextDelete(lua_State *L); + static CLuaPicture *CPictureCheck(lua_State *L, int n); + static void CPictureRegister(lua_State *L); + static int CPictureNew(lua_State *L); + static int CPicturePaint(lua_State *L); + static int CPictureHide(lua_State *L); + static int CPictureSetPicture(lua_State *L); + static int CPictureDelete(lua_State *L); + static bool tableLookup(lua_State*, const char*, std::string&); static bool tableLookup(lua_State*, const char*, lua_Integer&); + static bool tableLookup(lua_State*, const char*, void**); }; #endif /* _LUAINSTANCE_H */ diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index 3ac223e05..2a1405782 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -35,7 +35,7 @@ #include #include #include - +#include #include #include #include @@ -49,6 +49,7 @@ #include #include +#include #include #include @@ -56,8 +57,6 @@ #include -//#define ONE_KEY_PLUGIN - extern CPlugins * g_PluginList; extern cVideo *videoDecoder; @@ -94,10 +93,31 @@ int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_REPAINT; } -#ifdef ONE_KEY_PLUGIN - else if(actionKey == "onekeyplugin") + else if(actionKey == "onekey_plugin") { - CMenuWidget MoviePluginSelector(LOCALE_EXTRA_KEY_PLUGIN, NEUTRINO_ICON_FEATURES); + CMenuWidget OneKeyPluginSelector(LOCALE_EXTRA_KEY_PLUGIN, NEUTRINO_ICON_FEATURES); + OneKeyPluginSelector.addItem(GenericMenuSeparator); + + char id[5]; + int cnt = 0; + int enabled_count = 0; + for(unsigned int count=0;count < (unsigned int) g_PluginList->getNumberOfPlugins();count++) + { + if (!g_PluginList->isHidden(count)) + { + sprintf(id, "%d", count); + enabled_count++; + OneKeyPluginSelector.addItem(new CMenuForwarder(g_PluginList->getName(count), true, NULL, new COnekeyPluginChangeExec(), id, CRCInput::convertDigitToKey(count)), (cnt == 0)); + cnt++; + } + } + + OneKeyPluginSelector.exec(NULL, ""); + return menu_return::RETURN_REPAINT; + } + else if(actionKey == "movieplayer_plugin") + { + CMenuWidget MoviePluginSelector(LOCALE_MOVIEPLAYER_DEFPLUGIN, NEUTRINO_ICON_FEATURES); MoviePluginSelector.addItem(GenericMenuSeparator); char id[5]; @@ -105,12 +125,11 @@ int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey) int enabled_count = 0; for(unsigned int count=0;count < (unsigned int) g_PluginList->getNumberOfPlugins();count++) { - if (g_PluginList->getType(count)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(count)) + if (!g_PluginList->isHidden(count)) { - // e.g. vtxt-plugins sprintf(id, "%d", count); enabled_count++; - MoviePluginSelector.addItem(new CMenuForwarder(g_PluginList->getName(count), true, NULL, new COnekeyPluginChangeExec(), id, CRCInput::convertDigitToKey(count)), (cnt == 0)); + MoviePluginSelector.addItem(new CMenuForwarder(g_PluginList->getName(count), true, NULL, new CMoviePluginChangeExec(), id, CRCInput::convertDigitToKey(count)), (cnt == 0)); cnt++; } } @@ -118,7 +137,6 @@ int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey) MoviePluginSelector.exec(NULL, ""); return menu_return::RETURN_REPAINT; } -#endif /*ONE_KEY_PLUGIN*/ else if(actionKey == "info") { unsigned num = CEitManager::getInstance()->getEventsCount(); @@ -183,13 +201,22 @@ const CMenuOptionChooser::keyval_ext CPU_FREQ_OPTIONS[CPU_FREQ_OPTION_COUNT] = }; #endif /*CPU_FREQ*/ -#define EPG_SCAN_OPTION_COUNT 3 -const CMenuOptionChooser::keyval EPG_SCAN_OPTIONS[EPG_SCAN_OPTION_COUNT] = +const CMenuOptionChooser::keyval EPG_SCAN_OPTIONS[] = { - { 0, LOCALE_OPTIONS_OFF }, - { 1, LOCALE_MISCSETTINGS_EPG_SCAN_BQ }, - { 2, LOCALE_MISCSETTINGS_EPG_SCAN_FAV }, + { CEpgScan::SCAN_OFF, LOCALE_OPTIONS_OFF }, + { CEpgScan::SCAN_CURRENT, LOCALE_MISCSETTINGS_EPG_SCAN_BQ }, + { CEpgScan::SCAN_FAV, LOCALE_MISCSETTINGS_EPG_SCAN_FAV }, + { CEpgScan::SCAN_SEL, LOCALE_MISCSETTINGS_EPG_SCAN_SEL }, }; +#define EPG_SCAN_OPTION_COUNT (sizeof(EPG_SCAN_OPTIONS)/sizeof(CMenuOptionChooser::keyval)) + +const CMenuOptionChooser::keyval EPG_SCAN_MODE_OPTIONS[] = +{ + { CEpgScan::MODE_LIVE, LOCALE_MISCSETTINGS_EPG_SCAN_LIVE }, + { CEpgScan::MODE_STANDBY, LOCALE_MISCSETTINGS_EPG_SCAN_STANDBY }, + { CEpgScan::MODE_ALWAYS, LOCALE_MISCSETTINGS_EPG_SCAN_ALWAYS } +}; +#define EPG_SCAN_MODE_OPTION_COUNT (sizeof(EPG_SCAN_MODE_OPTIONS)/sizeof(CMenuOptionChooser::keyval)) #define SLEEPTIMER_MIN_OPTION_COUNT 7 const CMenuOptionChooser::keyval_ext SLEEPTIMER_MIN_OPTIONS[SLEEPTIMER_MIN_OPTION_COUNT] = @@ -292,6 +319,13 @@ int CMiscMenue::showMiscSettingsMenu() return res; } +const CMenuOptionChooser::keyval DEBUG_MODE_OPTIONS[DEBUG_MODES] = +{ + { DEBUG_NORMAL , LOCALE_DEBUG_LEVEL_1 }, + { DEBUG_INFO , LOCALE_DEBUG_LEVEL_2 }, + { DEBUG_DEBUG , LOCALE_DEBUG_LEVEL_3 } +}; + //general settings void CMiscMenue::showMiscSettingsMenuGeneral(CMenuWidget *ms_general) { @@ -314,20 +348,25 @@ void CMiscMenue::showMiscSettingsMenuGeneral(CMenuWidget *ms_general) ms_general->addItem(mn); } - //rotor - //don't show rotor settings on cable box - if (CFEManager::getInstance()->haveSat()) { - mc = new CMenuOptionChooser(LOCALE_EXTRA_ROTOR_SWAP, &g_settings.rotor_swap, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - mc->setHint("", LOCALE_MENU_HINT_ROTOR_SWAP); - ms_general->addItem(mc); - } + ms_general->addItem(GenericMenuSeparatorLine); CMenuForwarder * mf = new CMenuForwarder(LOCALE_PLUGINS_HDD_DIR, true, g_settings.plugin_hdd_dir, this, "plugin_dir"); mf->setHint("", LOCALE_MENU_HINT_PLUGINS_HDD_DIR); ms_general->addItem(mf); -#ifdef ONE_KEY_PLUGIN - ms_general->addItem(new CMenuForwarder(LOCALE_EXTRA_KEY_PLUGIN, true, g_settings.onekey_plugin,this,"onekeyplugin")); -#endif /*ONE_KEY_PLUGIN*/ + + mf = new CMenuForwarder(LOCALE_EXTRA_KEY_PLUGIN, true, g_settings.onekey_plugin, this, "onekey_plugin"); + mf->setHint("", LOCALE_MENU_HINT_ONEKEY_PLUGIN); + ms_general->addItem(mf); + + mf = new CMenuForwarder(LOCALE_MPKEY_PLUGIN, true, g_settings.movieplayer_plugin, this, "movieplayer_plugin"); + mf->setHint("", LOCALE_MENU_HINT_MOVIEPLAYER_PLUGIN); + ms_general->addItem(mf); + + //set debug level + ms_general->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_DEBUG)); + CMenuOptionChooser * md = new CMenuOptionChooser(LOCALE_DEBUG_LEVEL, &debug, DEBUG_MODE_OPTIONS, DEBUG_MODES, true); +// mc->setHint("", LOCALE_MENU_HINT_START_TOSTANDBY); + ms_general->addItem(md); } #define VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT 2 @@ -442,6 +481,10 @@ void CMiscMenue::showMiscSettingsMenuEpg(CMenuWidget *ms_epg) true /*CFEManager::getInstance()->getEnabledCount() > 1*/); mc2->setHint("", LOCALE_MENU_HINT_EPG_SCAN); + CMenuOptionChooser * mc3 = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &g_settings.epg_scan_mode, EPG_SCAN_MODE_OPTIONS, EPG_SCAN_MODE_OPTION_COUNT, + CFEManager::getInstance()->getEnabledCount() > 1); + mc3->setHint("", LOCALE_MENU_HINT_EPG_SCAN_MODE); + ms_epg->addItem(mc); ms_epg->addItem(mc1); ms_epg->addItem(mf); @@ -450,6 +493,7 @@ void CMiscMenue::showMiscSettingsMenuEpg(CMenuWidget *ms_epg) ms_epg->addItem(mf3); ms_epg->addItem(mf4); ms_epg->addItem(mc2); + ms_epg->addItem(mc3); } //filebrowser settings diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index 1eca47b51..a61b120e5 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -90,6 +90,7 @@ void CMotorControl::Init(void) satellitePosition = 0; stepDelay = 10; signalbox = NULL; + rotor_swap = frontend->getRotorSwap(); } int CMotorControl::exec(CMenuTarget* parent, const std::string &) @@ -197,7 +198,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) else if (msg == CRCInput::RC_4) { if (installerMenue) { printf("[motorcontrol] 4 key received... set west (soft) limit\n"); - if(g_settings.rotor_swap) lim_cmd = 0x66; + if(rotor_swap) lim_cmd = 0x66; else lim_cmd = 0x67; g_Zapit->sendMotorCommand(0xE1, 0x31, lim_cmd, 0, 0, 0); //g_Zapit->tune_TP(TP); @@ -233,7 +234,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) else if (msg == CRCInput::RC_6) { if (installerMenue) { printf("[motorcontrol] 6 key received... set east (soft) limit\n"); - if(g_settings.rotor_swap) lim_cmd = 0x67; + if(rotor_swap) lim_cmd = 0x67; else lim_cmd = 0x66; g_Zapit->sendMotorCommand(0xE1, 0x31, lim_cmd, 0, 0, 0); //g_Zapit->tune_TP(TP); @@ -320,10 +321,10 @@ void CMotorControl::motorStep(bool west) { int cmd; if (west) { - if(g_settings.rotor_swap) cmd = 0x68; + if(rotor_swap) cmd = 0x68; else cmd = 0x69; } else { - if(g_settings.rotor_swap) cmd = 0x69; + if(rotor_swap) cmd = 0x69; else cmd = 0x68; } printf("[motorcontrol] motorStep: %s\n", west ? "West" : "East"); @@ -602,6 +603,6 @@ void CMotorControl::readNetwork() network = "unknown"; char net[100]; - snprintf(net, sizeof(net), "%03d.%d, %s", abs(pos)/10, abs(pos)%10, network.c_str()); + snprintf(net, sizeof(net), "%03d.%d, %s", abs((int)pos)/10, abs((int)pos)%10, network.c_str()); network = net; } diff --git a/src/gui/motorcontrol.h b/src/gui/motorcontrol.h index 5ca924dc8..b7e01b321 100644 --- a/src/gui/motorcontrol.h +++ b/src/gui/motorcontrol.h @@ -50,6 +50,7 @@ class CMotorControl : public CMenuTarget void Init(void); CFrameBuffer *frameBuffer; CFrontend *frontend; + bool rotor_swap; int x; int y; int width; diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index d8ee4d71a..8b138c49f 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -1028,6 +1028,8 @@ int CMovieBrowser::exec(const char* path) //refreshMovieInfo(); refreshTitle(); + refreshFoot(); + refreshLCD(); onSetGUIWindow(m_settings.gui); bool loop = true; @@ -1144,11 +1146,7 @@ void CMovieBrowser::hide(void) m_pcLastRecord = NULL; } if (m_pcInfo != NULL) delete m_pcInfo; - //if (m_pcWindow != NULL) delete m_pcWindow; - - //m_pcWindow = NULL; m_pcInfo = NULL; - } int CMovieBrowser::paint(void) @@ -1195,7 +1193,7 @@ int CMovieBrowser::paint(void) //refreshTitle(); //refreshFoot(); //refreshLCD(); - refresh(); + //refresh(); return (true); } @@ -1272,12 +1270,8 @@ void CMovieBrowser::refreshMovieInfo(void) m_pcInfo->setText(&emptytext); } else { - bool logo_ok = false; - int picw = m_cBoxFrameInfo.iHeight * 16 / 9; - int pich = m_cBoxFrameInfo.iHeight; - + printf("CMovieBrowser::refreshMovieInfo\n"); std::string fname; -printf("CMovieBrowser::refreshMovieInfo\n"); if (show_mode == MB_SHOW_YT) { fname = m_movieSelectionHandler->tfile; } else { @@ -1288,11 +1282,17 @@ printf("CMovieBrowser::refreshMovieInfo\n"); fname = getScreenshotName(cover); } } - logo_ok = (!fname.empty()); + bool logo_ok = (!fname.empty()); int flogo_w = 0, flogo_h = 0; if(logo_ok) { + int picw = m_cBoxFrameInfo.iHeight * 16 / 9; + int pich = m_cBoxFrameInfo.iHeight; g_PicViewer->getSize(fname.c_str(), &flogo_w, &flogo_h); g_PicViewer->rescaleImageDimensions(&flogo_w, &flogo_h, picw-2, pich-2); +#ifdef BOXMODEL_APOLLO + /* align for hw blit */ + flogo_w = ((flogo_w + 3) / 4) * 4; +#endif } m_pcInfo->setText(&m_movieSelectionHandler->epgInfo2, logo_ok ? m_cBoxFrameInfo.iWidth-flogo_w-20 : 0); @@ -1938,15 +1938,15 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) } } } - } else if (msg == CRCInput::RC_topleft) { - if (m_movieSelectionHandler != NULL) { - if(ShowMsg (LOCALE_MESSAGEBOX_INFO, "Remove screenshot ?", CMessageBox::mbrNo, CMessageBox:: mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes) { - std::string fname = getScreenshotName(m_movieSelectionHandler->file.Name); - if (fname != "") - unlink(fname.c_str()); - refresh(); + } else if (msg == CRCInput::RC_favorites) { + if (m_movieSelectionHandler != NULL) { + if(ShowMsg (LOCALE_MESSAGEBOX_INFO, "Remove screenshot ?", CMessageBox::mbrNo, CMessageBox:: mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes) { + std::string fname = getScreenshotName(m_movieSelectionHandler->file.Name); + if (fname != "") + unlink(fname.c_str()); + refresh(); + } } - } } else { @@ -2719,7 +2719,7 @@ bool CMovieBrowser::delFile_std(CFile& file) void CMovieBrowser::updateMovieSelection(void) { - //TRACE("[mb]->updateMovieSelection %d\r\n",m_windowFocus); + //TRACE("[mb]->updateMovieSelection %d\r\n",m_windowFocus); if (m_vMovieInfo.empty()) return; bool new_selection = false; diff --git a/src/gui/movieinfo.cpp b/src/gui/movieinfo.cpp index 106536ef5..6d9a1bc1e 100644 --- a/src/gui/movieinfo.cpp +++ b/src/gui/movieinfo.cpp @@ -121,23 +121,23 @@ bool CMovieInfo::convertTs2XmlName(std::string * filename) ************************************************************************/ #define XML_ADD_TAG_STRING(_xml_text_,_tag_name_,_tag_content_){ \ - _xml_text_ += "\t\t<"_tag_name_">"; \ + _xml_text_ += "\t\t<" _tag_name_ ">"; \ _xml_text_ += ZapitTools::UTF8_to_UTF8XML(_tag_content_.c_str()); \ - _xml_text_ += "\n";} + _xml_text_ += "\n";} #define XML_ADD_TAG_UNSIGNED(_xml_text_,_tag_name_,_tag_content_){\ - _xml_text_ += "\t\t<"_tag_name_">";\ + _xml_text_ += "\t\t<" _tag_name_ ">";\ char _tmp_[50];\ sprintf(_tmp_, "%u", (unsigned int) _tag_content_);\ _xml_text_ += _tmp_;\ - _xml_text_ += "\n";} + _xml_text_ += "\n";} #define XML_ADD_TAG_LONG(_xml_text_,_tag_name_,_tag_content_){\ - _xml_text_ += "\t\t<"_tag_name_">";\ + _xml_text_ += "\t\t<" _tag_name_ ">";\ char _tmp_[50];\ sprintf(_tmp_, "%" PRIu64 "", (uint64_t)_tag_content_);\ _xml_text_ += _tmp_;\ - _xml_text_ += "\n";} + _xml_text_ += "\n";} #define XML_GET_DATA_STRING(_node_,_tag_,_string_dest_){\ if(!strcmp(_node_->GetType(), _tag_))\ diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 9338dc77d..935f39b88 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -61,6 +62,7 @@ #include #include #include +#include //extern CPlugins *g_PluginList; #ifndef HAVE_COOL_HARDWARE @@ -74,6 +76,7 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern CInfoClock *InfoClock; #define TIMESHIFT_SECONDS 3 +#define ISO_MOUNT_POINT "/media/iso" CMoviePlayerGui* CMoviePlayerGui::instance_mp = NULL; @@ -108,7 +111,7 @@ void CMoviePlayerGui::Init(void) frameBuffer = CFrameBuffer::getInstance(); - playback = new cPlayback(3); + playback = new cPlayback(0); moviebrowser = new CMovieBrowser(); bookmarkmanager = new CBookmarkManager(); @@ -121,6 +124,8 @@ void CMoviePlayerGui::Init(void) tsfilefilter.addFilter("wav"); tsfilefilter.addFilter("asf"); tsfilefilter.addFilter("aiff"); + tsfilefilter.addFilter("mp4"); + tsfilefilter.addFilter("mov"); #endif tsfilefilter.addFilter("mpg"); tsfilefilter.addFilter("mpeg"); @@ -128,15 +133,14 @@ void CMoviePlayerGui::Init(void) tsfilefilter.addFilter("mpv"); tsfilefilter.addFilter("vob"); tsfilefilter.addFilter("m2ts"); - tsfilefilter.addFilter("mp4"); - tsfilefilter.addFilter("mov"); tsfilefilter.addFilter("m3u"); tsfilefilter.addFilter("pls"); -#ifdef HAVE_SPARK_HARDWARE tsfilefilter.addFilter("vdr"); +#ifdef HAVE_SPARK_HARDWARE tsfilefilter.addFilter("flv"); tsfilefilter.addFilter("wmv"); #endif + tsfilefilter.addFilter("iso"); if (g_settings.network_nfs_moviedir.empty()) Path_local = "/"; @@ -161,6 +165,7 @@ void CMoviePlayerGui::Init(void) min_y = 0; max_y = 0; ext_subs = false; + iso_file = false; } void CMoviePlayerGui::cutNeutrino() @@ -371,6 +376,27 @@ void CMoviePlayerGui::Cleanup() startposition = 0; is_file_player = false; p_movie_info = NULL; + autoshot_done = false; +} + +void CMoviePlayerGui::makeFilename() +{ + if(file_name.empty()) { + std::string::size_type pos = full_name.find_last_of('/'); + if(pos != std::string::npos) { + file_name = full_name.substr(pos+1); + std::replace(file_name.begin(), file_name.end(), '_', ' '); + } else + file_name = full_name; + + if(file_name.substr(0,14)=="videoplayback?"){//youtube name + if(!p_movie_info->epgTitle.empty()) + file_name = p_movie_info->epgTitle; + else + file_name = ""; + } + printf("CMoviePlayerGui::makeFilename: full_name [%s] file_name [%s]\n", full_name.c_str(), file_name.c_str()); + } } bool CMoviePlayerGui::SelectFile() @@ -441,55 +467,18 @@ bool CMoviePlayerGui::SelectFile() is_file_player = true; full_name = file->Name.c_str(); ret = true; - if(file->getType() == CFile::FILE_PLAYLIST) { - std::ifstream infile; - char cLine[1024]; - char name[1024] = { 0 }; - infile.open(file->Name.c_str(), std::ifstream::in); - while (infile.good()) - { - infile.getline(cLine, sizeof(cLine)); - if (cLine[strlen(cLine)-1]=='\r') - cLine[strlen(cLine)-1]=0; - - int dur; - sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &dur, name); - if (strlen(cLine) > 0 && cLine[0]!='#') - { - char *url = NULL; - if ( (url = strstr(cLine, "http://")) || (url = strstr(cLine, "rtmp://")) || (url = strstr(cLine, "rtsp://")) ){ - if (url != NULL) { - printf("name %s [%d] url: %s\n", name, dur, url); - full_name = url; - if(strlen(name)) - file_name = name; - } - } - } - } - } + if(file->getType() == CFile::FILE_PLAYLIST) + parsePlaylist(file); + else if(file->getType() == CFile::FILE_ISO) + ret = mountIso(file); } } else menu_ret = filebrowser->getMenuRet(); CAudioMute::getInstance()->enableMuteIcon(true); InfoClock->enableInfoClock(true); } - if(ret && file_name.empty()) { - std::string::size_type pos = full_name.find_last_of('/'); - if(pos != std::string::npos) { - file_name = full_name.substr(pos+1); - std::replace(file_name.begin(), file_name.end(), '_', ' '); - } else - file_name = full_name; - - if(file_name.substr(0,14)=="videoplayback?"){//youtube name - if(!p_movie_info->epgTitle.empty()) - file_name = p_movie_info->epgTitle; - else - file_name = ""; - } - printf("CMoviePlayerGui::SelectFile: full_name [%s] file_name [%s]\n", full_name.c_str(), file_name.c_str()); - } + if (ret) + makeFilename(); //store last multiformat play dir g_settings.network_nfs_moviedir = Path_local; @@ -512,6 +501,8 @@ void *CMoviePlayerGui::ShowStartHint(void *arg) if (msg == CRCInput::RC_home || msg == CRCInput::RC_stop) { if(caller->playback) caller->playback->RequestAbort(); + } else if (msg != CRCInput::RC_timeout && msg > CRCInput::RC_MaxRC) { + CNeutrinoApp::getInstance()->handleMsg(msg, data); } } if(hintbox != NULL){ @@ -547,7 +538,15 @@ void CMoviePlayerGui::PlayFile(void) printf("IS FILE PLAYER: %s\n", is_file_player ? "true": "false" ); - if(p_movie_info != NULL) { + MI_MOVIE_INFO mi; + + if (p_movie_info) { + if (timeshift != TSHIFT_MODE_OFF) { + // p_movie_info may be invalidated by CRecordManager while we're still using it. Create and use a copy. + mi = *p_movie_info; + p_movie_info = &mi; + } + duration = p_movie_info->length * 60 * 1000; int percent = CZapit::getInstance()->GetPidVolume(p_movie_info->epgId, currentapid, currentac3 == 1); CZapit::getInstance()->SetVolumePercent(percent); @@ -668,9 +667,11 @@ void CMoviePlayerGui::PlayFile(void) showSubtitle(0); if (msg == (neutrino_msg_t) g_settings.mpkey_plugin) { - //g_PluginList->start_plugin_by_name (g_settings.movieplayer_plugin.c_str (), pidt); + g_PluginList->startPlugin_by_name(g_settings.movieplayer_plugin.c_str ()); } else if (msg == (neutrino_msg_t) g_settings.mpkey_stop) { playstate = CMoviePlayerGui::STOPPED; + if ((duration - position) > 600000) + makeScreenShot(true); } else if (msg == (neutrino_msg_t) g_settings.mpkey_play) { if (time_forced) { time_forced = false; @@ -800,37 +801,10 @@ void CMoviePlayerGui::PlayFile(void) } if(restore) FileTime.show(position); -#ifdef SCREENSHOT + } else if (msg == NeutrinoMessages::SHOW_EPG) { + handleMovieBrowser(NeutrinoMessages::SHOW_EPG, position); } else if (msg == (neutrino_msg_t) g_settings.key_screenshot) { - - char ending[(sizeof(int)*2) + 6] = ".jpg"; - if(!g_settings.screenshot_cover) - snprintf(ending, sizeof(ending) - 1, "_%x.jpg", position); - - std::string fname = full_name; - std::string::size_type pos = fname.find_last_of('.'); - if(pos != std::string::npos) { - fname.replace(pos, fname.length(), ending); - } else - fname += ending; - - if(!g_settings.screenshot_cover){ - pos = fname.find_last_of('/'); - if(pos != std::string::npos) { - fname.replace(0, pos, g_settings.screenshot_dir); - } - } - -#if 0 // TODO disable overwrite ? - if(!access(fname.c_str(), F_OK)) { - } -#endif - CScreenShot * sc = new CScreenShot(fname); - if(g_settings.screenshot_cover && !g_settings.screenshot_video) - sc->EnableVideo(true); - sc->Start(); -#endif - + makeScreenShot(); } else if ( msg == NeutrinoMessages::EVT_SUBT_MESSAGE) { showSubtitle(data); } else if ( msg == NeutrinoMessages::ANNOUNCE_RECORD || @@ -846,9 +820,12 @@ void CMoviePlayerGui::PlayFile(void) playstate = CMoviePlayerGui::STOPPED; g_RCInput->postMsg(msg, data); - } else if (msg == CRCInput::RC_timeout) { - // nothing - } else if (msg == CRCInput::RC_sat || msg == CRCInput::RC_favorites) { + } else if (msg == CRCInput::RC_timeout || msg == NeutrinoMessages::EVT_TIMER) { + if (playstate == CMoviePlayerGui::PLAY && (position >= 300000 || (duration<300000 && (position>(duration /2))))) + makeScreenShot(true); + } else if (msg == CRCInput::RC_favorites) { + makeScreenShot(false, true); + } else if (msg == CRCInput::RC_sat) { //FIXME do nothing ? } else { if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all) { @@ -874,6 +851,11 @@ void CMoviePlayerGui::PlayFile(void) playback->SetSpeed(1); playback->Close(); + if (iso_file) { + iso_file = false; + if (umount2(ISO_MOUNT_POINT ,MNT_FORCE)) + perror(ISO_MOUNT_POINT); + } CVFD::getInstance()->ShowIcon(FP_ICON_PLAY, false); CVFD::getInstance()->ShowIcon(FP_ICON_PAUSE, false); @@ -1311,6 +1293,20 @@ void CMoviePlayerGui::handleMovieBrowser(neutrino_msg_t msg, int /*position*/) cSelectedMenuBookStart[5].selected = false; // clear for next bookmark menu } } + } else if (msg == NeutrinoMessages::SHOW_EPG && p_movie_info) { + CTimeOSD::mode m_mode = FileTime.getMode(); + bool restore = FileTime.IsVisible(); + if (restore) + FileTime.kill(); + InfoClock->enableInfoClock(false); + + cMovieInfo.showMovieInfo(*p_movie_info); + + InfoClock->enableInfoClock(true); + if (restore) { + FileTime.setMode(m_mode); + FileTime.update(position, duration); + } } return; } @@ -1413,9 +1409,21 @@ void CMoviePlayerGui::selectSubtitle() int select = -1; CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); - if(!numsubs) { + if(!numsubs) playback->FindAllSubs(spids, sub_supported, &numsubs, slanguage); - } + + CMenuOptionStringChooser * sc = new CMenuOptionStringChooser(LOCALE_SUBTITLES_CHARSET, &g_settings.subs_charset, true, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); + sc->addOption("UTF-8"); + sc->addOption("UCS-2"); + sc->addOption("CP1250"); + sc->addOption("CP1251"); + sc->addOption("CP1252"); + sc->addOption("CP1253"); + sc->addOption("KOI8-R"); + + APIDSelector.addItem(sc); + APIDSelector.addItem(GenericMenuSeparatorLine); + char cnt[5]; unsigned int count; for (count = 0; count < numsubs; count++) { @@ -1470,6 +1478,39 @@ void CMoviePlayerGui::clearSubtitle() fb_pixel_t * simple_resize32(uint8_t * orgin, uint32_t * colors, int nb_colors, int ox, int oy, int dx, int dy); +bool CMoviePlayerGui::convertSubtitle(std::string &text) +{ + bool ret = false; + iconv_t cd = iconv_open("UTF-8", g_settings.subs_charset.c_str()); + if (cd == (iconv_t)-1) { + perror("iconv_open"); + return ret; + } + size_t ilen = text.length(); + size_t olen = ilen*4; + size_t len = olen; + char * buf = (char *) malloc(olen+1); + if (buf == NULL) { + iconv_close(cd); + return ret; + } + memset(buf, olen+1, 0); + char * out = buf; + char * in = (char *) text.c_str(); + if (iconv(cd, &in, &ilen, &out, &olen) == (size_t)-1) { + printf("CMoviePlayerGui::convertSubtitle: iconv error\n"); + } + else { + memset(buf + (len - olen), 0, olen); + text = buf; + ret = true; + } + + free(buf); + iconv_close(cd); + return true; +} + void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data) { if (!data) { @@ -1573,8 +1614,12 @@ void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data) } } for (unsigned i = 0; i < subtext.size(); i++) { - if (!isUTF8(subtext[i])) - subtext[i] = convertLatin1UTF8(subtext[i]); + if (!isUTF8(subtext[i])) { + if (g_settings.subs_charset != "UTF-8") + convertSubtitle(subtext[i]); + else + subtext[i] = convertLatin1UTF8(subtext[i]); + } printf("subtext %d: [%s]\n", i, subtext[i].c_str()); } printf("********************************************************************\n"); @@ -1621,7 +1666,7 @@ void CMoviePlayerGui::selectAutoLang() } } } - if(g_settings.auto_lang) { + if(g_settings.auto_lang && (numpida > 1)) { int pref_idx = -1; playback->FindAllPids(apids, ac3flags, &numpida, language); @@ -1652,3 +1697,95 @@ void CMoviePlayerGui::selectAutoLang() } } } + +void CMoviePlayerGui::parsePlaylist(CFile *file) +{ + std::ifstream infile; + char cLine[1024]; + char name[1024] = { 0 }; + infile.open(file->Name.c_str(), std::ifstream::in); + while (infile.good()) + { + infile.getline(cLine, sizeof(cLine)); + if (cLine[strlen(cLine)-1]=='\r') + cLine[strlen(cLine)-1]=0; + + int dur; + sscanf(cLine, "#EXTINF:%d,%[^\n]\n", &dur, name); + if (strlen(cLine) > 0 && cLine[0]!='#') + { + char *url = NULL; + if ( (url = strstr(cLine, "http://")) || (url = strstr(cLine, "rtmp://")) || (url = strstr(cLine, "rtsp://")) ){ + if (url != NULL) { + printf("name %s [%d] url: %s\n", name, dur, url); + full_name = url; + if(strlen(name)) + file_name = name; + } + } + } + } +} + +bool CMoviePlayerGui::mountIso(CFile *file) +{ + printf("ISO file passed: %s\n", file->Name.c_str()); + safe_mkdir(ISO_MOUNT_POINT); + if (my_system(5, "mount", "-o", "loop", file->Name.c_str(), ISO_MOUNT_POINT) == 0) { + makeFilename(); + full_name = "/media/iso"; + iso_file = true; + return true; + } + return false; +} + +void CMoviePlayerGui::makeScreenShot(bool autoshot, bool forcover) +{ + if (autoshot) { + if (autoshot_done || !g_settings.auto_cover) + return; + autoshot_done = true; + } + +#ifdef SCREENSHOT + bool cover = autoshot || g_settings.screenshot_cover || forcover; + char ending[(sizeof(int)*2) + 6] = ".jpg"; + if (!cover) + snprintf(ending, sizeof(ending) - 1, "_%x.jpg", position); + + std::string fname = full_name; + std::string::size_type pos = fname.find_last_of('.'); + if (pos != std::string::npos) { + fname.replace(pos, fname.length(), ending); + } else + fname += ending; + + if (autoshot && !access(fname.c_str(), F_OK)) { + printf("CMoviePlayerGui::makeScreenShot: cover [%s] already exist..\n", fname.c_str()); + return; + } + + if (!cover) { + pos = fname.find_last_of('/'); + if(pos != std::string::npos) + fname.replace(0, pos, g_settings.screenshot_dir); + } + + + CScreenShot * sc = new CScreenShot(fname); + if (cover) { + sc->EnableVideo(true); + } + if (autoshot || forcover) { + int xres = 0, yres = 0, framerate; + videoDecoder->getPictureInfo(xres, yres, framerate); + if (xres && yres) { + int w = std::min(300, xres); + int h = (float) yres / ((float) xres / (float) w); + sc->SetSize(w, h); + } + } + sc->Start(); +#endif +} diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 7a2144951..9c65e5268 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -108,10 +108,12 @@ class CMoviePlayerGui : public CMenuTarget /* playback from file */ bool is_file_player; + bool iso_file; CFileBrowser * filebrowser; CFileFilter tsfilefilter; std::string Path_local; int menu_ret; + bool autoshot_done; /* playback from bookmark */ CBookmarkManager * bookmarkmanager; @@ -138,10 +140,15 @@ class CMoviePlayerGui : public CMenuTarget void updateLcd(); void selectSubtitle(); + bool convertSubtitle(std::string &text); void showSubtitle(neutrino_msg_data_t data); void clearSubtitle(); void selectChapter(); void selectAutoLang(); + void parsePlaylist(CFile *file); + bool mountIso(CFile *file); + void makeFilename(); + void makeScreenShot(bool autoshot = false, bool forcover = false); void Cleanup(); static void *ShowStartHint(void *arg); diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp new file mode 100644 index 000000000..7bac91044 --- /dev/null +++ b/src/gui/opkg_manager.cpp @@ -0,0 +1,380 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + OPKG-Manager Class for Neutrino-GUI + + Implementation: + Copyright (C) 2012 T. Graf 'dbt' + www.dbox2-tuning.net + + Adaptions: + Copyright (C) 2013 martii + gitorious.org/neutrino-mp/martiis-neutrino-mp + + License: GPL + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define OPKG_CL find_executable("opkg-cl") +#define OPKG_KEY find_executable("opkg-key") + +enum +{ + OM_LIST, + OM_LIST_INSTALLED, + OM_LIST_UPGRADEABLE, + OM_UPDATE, + OM_UPGRADE, + OM_REMOVE, + OM_INFO, + OM_INSTALL, + OM_MAX +}; + +static const std::string pkg_types[OM_MAX] = +{ + OPKG_CL + " list", + OPKG_CL + " list-installed", + OPKG_CL + " list-upgradable", + OPKG_CL + " update", + OPKG_CL + " upgrade ", + OPKG_CL + " remove ", + OPKG_CL + " info ", + OPKG_CL + " install " +}; + +COPKGManager::COPKGManager() +{ + width = w_max (40, 10); //% + frameBuffer = CFrameBuffer::getInstance(); + pkg_map.clear(); + list_installed_done = false; + list_upgradeable_done = false; + expert_mode = false; +} + +COPKGManager::~COPKGManager() +{ +} + +int COPKGManager::exec(CMenuTarget* parent, const std::string &actionKey) +{ + int res = menu_return::RETURN_REPAINT; + + if (actionKey == "") { + if (parent) + parent->hide(); + return showMenu(); + } + int selected = menu->getSelected() - menu_offset; + + if (expert_mode && actionKey == "rc_blue") { + if (selected < 0 || selected >= (int) pkg_vec.size() || !pkg_vec[selected]->installed) + return menu_return::RETURN_NONE; + + char loc[200]; + snprintf(loc, sizeof(loc), g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_REMOVE), pkg_vec[selected]->name.c_str()); + if (ShowMsg(LOCALE_OPKG_TITLE, loc, CMessageBox::mbrCancel, CMessageBox::mbYes | CMessageBox::mbCancel) != CMessageBox::mbrCancel) { + if (parent) + parent->hide(); + execCmd(pkg_types[OM_REMOVE] + pkg_vec[selected]->name, true, true); + refreshMenu(); + } + return res; + } + if (actionKey == "rc_info") { + if (selected < 0 || selected >= (int) pkg_vec.size()) + return menu_return::RETURN_NONE; + if (parent) + parent->hide(); + execCmd(pkg_types[OM_INFO] + pkg_vec[selected]->name, true, true); + return res; + } + if (actionKey == "rc_red") { + expert_mode = !expert_mode; + updateMenu(); + return res; + } + if(actionKey == pkg_types[OM_UPGRADE]) { + if (parent) + parent->hide(); + int r = execCmd(actionKey, true, true); + if (r) { + std::string loc = g_Locale->getText(LOCALE_OPKG_FAILURE_UPGRADE); + char rs[strlen(loc.c_str()) + 20]; + snprintf(rs, sizeof(rs), loc.c_str(), r); + DisplayInfoMessage(rs); + } else + installed = true; + refreshMenu(); + g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_up, 0); + return res; + } + + std::map::iterator it = pkg_map.find(actionKey); + if (it != pkg_map.end()) { + if (parent) + parent->hide(); + std::string force = ""; + if (it->second.installed && !it->second.upgradable) { + char l[200]; + snprintf(l, sizeof(l), g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_REINSTALL), actionKey.c_str()); + l[sizeof(l) - 1] = 0; + if (ShowMsg(LOCALE_OPKG_TITLE, l, CMessageBox::mbrCancel, CMessageBox::mbYes | CMessageBox::mbCancel) == CMessageBox::mbrCancel) + return res; + force = "--force-reinstall "; + } + int r = execCmd(pkg_types[OM_INSTALL] + force + actionKey, true, true); + if (r) { + std::string err = g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL); + char rs[strlen(err.c_str()) + 20]; + snprintf(rs, sizeof(rs), err.c_str(), r); + DisplayInfoMessage(rs); + } else + installed = true; + refreshMenu(); + } + return res; +} + +#define COPKGManagerFooterButtonCount 3 +static const struct button_label COPKGManagerFooterButtons[COPKGManagerFooterButtonCount] = { + { NEUTRINO_ICON_BUTTON_RED, LOCALE_OPKG_BUTTON_EXPERT_ON }, + { NEUTRINO_ICON_BUTTON_INFO_SMALL, LOCALE_OPKG_BUTTON_INFO }, + { NEUTRINO_ICON_BUTTON_OKAY, LOCALE_OPKG_BUTTON_INSTALL } +}; +#define COPKGManagerFooterButtonCountExpert 4 +static const struct button_label COPKGManagerFooterButtonsExpert[COPKGManagerFooterButtonCountExpert] = { + { NEUTRINO_ICON_BUTTON_RED, LOCALE_OPKG_BUTTON_EXPERT_OFF }, + { NEUTRINO_ICON_BUTTON_INFO_SMALL, LOCALE_OPKG_BUTTON_INFO }, + { NEUTRINO_ICON_BUTTON_OKAY, LOCALE_OPKG_BUTTON_INSTALL }, + { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_OPKG_BUTTON_UNINSTALL } +}; + +void COPKGManager::updateMenu() +{ + bool upgradesAvailable = false; + getPkgData(OM_LIST_INSTALLED); + getPkgData(OM_LIST_UPGRADEABLE); + for (std::map::iterator it = pkg_map.begin(); it != pkg_map.end(); it++) { + it->second.forwarder->iconName_Info_right = ""; + it->second.forwarder->setActive(true); + if (it->second.upgradable) { + it->second.forwarder->iconName_Info_right = NEUTRINO_ICON_WARNING; + upgradesAvailable = true; + } else if (it->second.installed) { + it->second.forwarder->iconName_Info_right = NEUTRINO_ICON_CHECKMARK; + it->second.forwarder->setActive(expert_mode); + } + } + + upgrade_forwarder->setActive(upgradesAvailable); + + if (expert_mode) + menu->setFooter(COPKGManagerFooterButtonsExpert, COPKGManagerFooterButtonCountExpert); + else + menu->setFooter(COPKGManagerFooterButtons, COPKGManagerFooterButtonCount); +} + +void COPKGManager::refreshMenu() { + list_installed_done = false, + list_upgradeable_done = false; + updateMenu(); +} + +int COPKGManager::showMenu() +{ + installed = false; + + int r = execCmd(pkg_types[OM_UPDATE]); + if (r) { + std::string loc = g_Locale->getText(LOCALE_OPKG_FAILURE_UPDATE); + char rs[strlen(loc.c_str()) + 20]; + snprintf(rs, sizeof(rs), loc.c_str(), r); + DisplayInfoMessage(rs); + } + + getPkgData(OM_LIST); + getPkgData(OM_LIST_UPGRADEABLE); + + menu = new CMenuWidget(g_Locale->getText(LOCALE_OPKG_TITLE), NEUTRINO_ICON_UPDATE, width, MN_WIDGET_ID_SOFTWAREUPDATE); + CMenuForwarder menuBack(LOCALE_MENU_BACK, true, NULL, NULL, NULL, CRCInput::RC_nokey, NEUTRINO_ICON_BUTTON_LEFT, NULL, true); + menuBack.setItemButton(!g_settings.menu_left_exit ? NEUTRINO_ICON_BUTTON_HOME : NEUTRINO_ICON_BUTTON_LEFT); + menu->addItem(&menuBack); + menuBack.setHint(NEUTRINO_ICON_HINT_BACK, LOCALE_MENU_HINT_BACK_BRIEF); + menu->addItem(GenericMenuSeparatorLine); + + upgrade_forwarder = new CMenuForwarder(LOCALE_OPKG_UPGRADE, true, NULL , this, pkg_types[OM_UPGRADE].c_str(), CRCInput::RC_red); + upgrade_forwarder->setHint(NEUTRINO_ICON_HINT_SW_UPDATE, LOCALE_MENU_HINT_OPKG_UPGRADE); + menu->addItem(upgrade_forwarder); + menu->addItem(GenericMenuSeparatorLine); + + menu_offset = menu->getItemsCount(); + + menu->addKey(CRCInput::RC_info, this, "rc_info"); + menu->addKey(CRCInput::RC_blue, this, "rc_blue"); + menu->addKey(CRCInput::RC_red, this, "rc_red"); + + pkg_vec.clear(); + for (std::map::iterator it = pkg_map.begin(); it != pkg_map.end(); it++) { + it->second.forwarder = new CMenuForwarder(it->second.desc, true, NULL , this, it->second.name.c_str()); + it->second.forwarder->setHint("", it->second.desc); + menu->addItem(it->second.forwarder); + pkg_vec.push_back(&it->second); + } + + updateMenu(); + + int res = menu->exec(NULL, ""); + + menu->hide (); + + if (installed) + DisplayInfoMessage(g_Locale->getText(LOCALE_OPKG_SUCCESS_INSTALL)); + delete menu; + return res; +} + +bool COPKGManager::hasOpkgSupport() +{ + string deps[] = {OPKG_CL, OPKG_KEY, "/etc/opkg/opkg.conf", "/var/lib/opkg"}; + + for(size_t i=0; i::iterator it = pkg_map.begin(); it != pkg_map.end(); it++) + it->second.installed = false; + break; + case OM_LIST_UPGRADEABLE: + if (list_upgradeable_done) + return; + list_upgradeable_done = true; + for (std::map::iterator it = pkg_map.begin(); it != pkg_map.end(); it++) + it->second.upgradable = false; + break; + } + + FILE *f = popen(pkg_types[pkg_content_id].c_str(), "r"); + if (!f) { + DisplayInfoMessage("Command failed"); + return; + } + + char buf[256]; + + while (fgets(buf, sizeof(buf), f)) + { + std::string line(buf); + trim(line); + + std::string name = getBlankPkgName(line); + + switch (pkg_content_id) { + case OM_LIST: { + pkg_map[name] = pkg(name, line); + break; + } + case OM_LIST_INSTALLED: { + std::map::iterator it = pkg_map.find(name); + if (it != pkg_map.end()) + it->second.installed = true; + break; + } + case OM_LIST_UPGRADEABLE: { + std::map::iterator it = pkg_map.find(name); + if (it != pkg_map.end()) + it->second.upgradable = true; + break; + } + default: + fprintf(stderr, "%s %s %d: unrecognized content id %d\n", __FILE__, __func__, __LINE__, pkg_content_id); + break; + } + } + + pclose(f); +} + +std::string COPKGManager::getBlankPkgName(const std::string& line) +{ + size_t l_pos = line.find(" "); + if (l_pos != string::npos) + return line.substr(0, l_pos); + return line; +} + +int COPKGManager::execCmd(const char *cmdstr, bool verbose, bool acknowledge) +{ +fprintf(stderr, "execCmd(%s)\n", cmdstr); + std::string cmd(cmdstr); + if (verbose) { + cmd += " 2>&1"; + int res; + CShellWindow(cmd, (verbose ? CShellWindow::VERBOSE : 0) | (acknowledge ? CShellWindow::ACKNOWLEDGE : 0), &res); + return res; + } else { + cmd += " 2>/dev/null >&2"; + int r = system(cmd.c_str()); + if (r == -1) + return r; + return WEXITSTATUS(r); + } +} diff --git a/src/gui/opkg_manager.h b/src/gui/opkg_manager.h new file mode 100644 index 000000000..26e89afcb --- /dev/null +++ b/src/gui/opkg_manager.h @@ -0,0 +1,88 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + OPKG-Manager Class for Neutrino-GUI + + Implementation: + Copyright (C) 2012 T. Graf 'dbt' + www.dbox2-tuning.net + + Adaptions: + Copyright (C) 2013 martii + gitorious.org/neutrino-mp/martiis-neutrino-mp + + License: GPL + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef __OPKG_MANAGER__ +#define __OPKG_MANAGER__ + +#include +#include + +#include +#include +#include + +class COPKGManager : public CMenuTarget +{ + private: + int width; + + CFrameBuffer *frameBuffer; + + struct pkg; + + std::map pkg_map; + std::vector pkg_vec; + + CMenuWidget *menu; + CMenuForwarder *upgrade_forwarder; + bool list_installed_done; + bool list_upgradeable_done; + bool installed; + bool expert_mode; + int menu_offset; + + int execCmd(const char* cmdstr, bool verbose = false, bool acknowledge = false); + int execCmd(std::string cmdstr, bool verbose = false, bool acknowledge = false) { + return execCmd(cmdstr.c_str(), verbose, acknowledge); + }; + void getPkgData(const int pkg_content_id); + static std::string getBlankPkgName(const std::string& line); + int showMenu(); + void updateMenu(); + void refreshMenu(); + + struct pkg { + std::string name; + std::string desc; + bool installed; + bool upgradable; + CMenuForwarder *forwarder; + pkg() { } + pkg(std::string &_name, std::string &_desc) + : name(_name), desc(_desc), installed(false), upgradable(false) { } + }; + public: + COPKGManager(); + ~COPKGManager(); + + int exec(CMenuTarget* parent, const std::string & actionKey); + static bool hasOpkgSupport(); +}; +#endif diff --git a/src/gui/osdlang_setup.cpp b/src/gui/osdlang_setup.cpp index ffc0d47bb..9042f4eaa 100644 --- a/src/gui/osdlang_setup.cpp +++ b/src/gui/osdlang_setup.cpp @@ -68,12 +68,18 @@ COsdLangSetup::~COsdLangSetup() } -int COsdLangSetup::exec(CMenuTarget* parent, const std::string &/*actionKey*/) +int COsdLangSetup::exec(CMenuTarget* parent, const std::string &actionKey) { dprintf(DEBUG_DEBUG, "init international setup\n"); if(parent != NULL) parent->hide(); + if (actionKey != "") { + g_settings.language = actionKey; + g_Locale->loadLocale(g_settings.language.c_str()); + return menu_return::RETURN_EXIT; + } + int res = showLocalSetup(); return res; @@ -93,7 +99,7 @@ int COsdLangSetup::showLocalSetup() CMenuWidget osdl_setup(LOCALE_LANGUAGESETUP_OSD, NEUTRINO_ICON_LANGUAGE, width, MN_WIDGET_ID_LANGUAGESETUP_LOCALE); showLanguageSetup(&osdl_setup); - CMenuForwarder * mf = new CMenuForwarder(LOCALE_LANGUAGESETUP_OSD, true, NULL, &osdl_setup, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); + CMenuForwarder * mf = new CMenuForwarder(LOCALE_LANGUAGESETUP_OSD, true, g_settings.language, &osdl_setup, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED); mf->setHint("", LOCALE_MENU_HINT_OSD_LANGUAGE); localSettings->addItem(mf); @@ -192,8 +198,12 @@ void COsdLangSetup::showLanguageSetup(CMenuWidget *osdl_setup) if (pos != NULL) { *pos = '\0'; - CMenuOptionLanguageChooser* oj = new CMenuOptionLanguageChooser((char*)locale, this, locale); - osdl_setup->addItem( oj ); + std::string loc(locale); + loc.at(0) = toupper(loc.at(0)); + + CMenuForwarder *mf = new CMenuForwarder(loc, true, NULL, this, locale); + mf->iconName = mf->getActionKey(); + osdl_setup->addItem(mf, !strcmp(locale, g_settings.language.c_str())); } free(namelist[count]); } diff --git a/src/gui/personalize.cpp b/src/gui/personalize.cpp index 27c7478d1..62161e234 100644 --- a/src/gui/personalize.cpp +++ b/src/gui/personalize.cpp @@ -553,7 +553,7 @@ int CPersonalizeGui::ShowMenuOptions(const int& widget) //required for first view: check active mode of option chooser and disable if it's an observed item and item mode is set to 'not visible' for (uint j = 0; j < v_observ.size(); j++) - if (opt->getOptionName()== g_Locale->getText(v_observ[j].to_observ_locale) && *p_mode == PERSONALIZE_MODE_NOTVISIBLE) + if (opt->getName()== g_Locale->getText(v_observ[j].to_observ_locale) && *p_mode == PERSONALIZE_MODE_NOTVISIBLE) opt->setActive(false); pm->addItem(opt); //add option chooser @@ -620,7 +620,7 @@ bool CPersonalizeGui::changeNotify(const neutrino_locale_t locale, void *data) { //if found an optionchooser, then extract option name CMenuOptionChooser* chooser = static_cast (item); - string opt_name = chooser->getOptionName(); + string opt_name = chooser->getName(); for (uint j = 0; j < v_observ.size(); j++) { @@ -639,6 +639,7 @@ bool CPersonalizeGui::changeNotify(const neutrino_locale_t locale, void *data) chooser->setActive(true); chooser->setOption(PERSONALIZE_MODE_VISIBLE); } + chooser->paint(false); } } } @@ -882,7 +883,7 @@ void CPersonalizeGui::addPersonalizedItems() //convert item to locked forwarder and use generated pin mode for usage as ask parameter v_item[i].menuItem = new CLockedMenuForwarder(fw->getTextLocale(), g_settings.easymenu ? g_settings.parentallock_pincode : g_settings.personalize_pincode, - use_pin, fw->active, NULL, fw->getTarget(), fw->getActionKey().c_str(), d_key, fw->iconName.c_str(), lock_icon); + use_pin, fw->active, NULL, fw->getTarget(), fw->getActionKey(), d_key, fw->iconName.c_str(), lock_icon); v_item[i].menuItem->hintIcon = fw->hintIcon; v_item[i].menuItem->hint = fw->hint; //add item if it's set to visible or pin protected and allow to add an forwarder as next diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index 2eaf46696..e3ea16f6b 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -710,7 +710,7 @@ void CPictureViewerGui::paintHead() CComponentsHeaderLocalized header(x, y, width, theight, LOCALE_PICTUREVIEWER_HEAD, NEUTRINO_ICON_MP3, CComponentsHeaderLocalized::CC_BTN_HELP); #ifdef ENABLE_GUI_MOUNT - header.addButtonIcon(NEUTRINO_ICON_BUTTON_MENU); + header.setContextButton(NEUTRINO_ICON_BUTTON_MENU); #endif header.paint(CC_SAVE_SCREEN_NO); diff --git a/src/gui/pipsetup.cpp b/src/gui/pipsetup.cpp index 98692ad7a..6be220ec7 100644 --- a/src/gui/pipsetup.cpp +++ b/src/gui/pipsetup.cpp @@ -25,10 +25,22 @@ extern cVideo *pipDecoder; CPipSetup::CPipSetup() { frameBuffer = CFrameBuffer::getInstance(); - x_coord = g_settings.pip_x; - y_coord = g_settings.pip_y; - width = g_settings.pip_width; - height = g_settings.pip_height; + + if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio) { + gx = &g_settings.pip_radio_x; + gy = &g_settings.pip_radio_y; + gw = &g_settings.pip_radio_width; + gh = &g_settings.pip_radio_height; + } else { + gx = &g_settings.pip_x; + gy = &g_settings.pip_y; + gw = &g_settings.pip_width; + gh = &g_settings.pip_height; + } + x_coord = *gx; + y_coord = *gy; + width = *gw; + height = *gh; maxw = frameBuffer->getScreenWidth(true); maxh = frameBuffer->getScreenHeight(true); @@ -53,8 +65,8 @@ void CPipSetup::move(int x, int y, bool abs) } x_coord = newx; y_coord = newy; - g_settings.pip_x = x_coord; - g_settings.pip_y = y_coord; + *gx = x_coord; + *gy = y_coord; printf("CPipSetup::move: x %d y %d\n", x_coord, y_coord); pipDecoder->Pig(x_coord, y_coord, width, height, maxw, maxh); @@ -85,8 +97,8 @@ void CPipSetup::resize(int w, int h, bool abs) width = neww; height = newh; } - g_settings.pip_width = width; - g_settings.pip_height = height; + *gw = width; + *gh = height; printf("CPipSetup::resize: w %d h %d \n", width, height); pipDecoder->Pig(x_coord, y_coord, width, height, maxw, maxh); diff --git a/src/gui/pipsetup.h b/src/gui/pipsetup.h index 373f3096b..0111569d8 100644 --- a/src/gui/pipsetup.h +++ b/src/gui/pipsetup.h @@ -17,6 +17,8 @@ class CPipSetup : public CMenuTarget int maxh; int minw; int minh; + + int *gx, *gy, *gw, *gh; void paint(); void hide(); void clear(); diff --git a/src/gui/pluginlist.cpp b/src/gui/pluginlist.cpp index 990f59f70..92af63578 100644 --- a/src/gui/pluginlist.cpp +++ b/src/gui/pluginlist.cpp @@ -57,326 +57,80 @@ #include #include +#include #include "plugins.h" -/* for alexW images with old drivers: - * #define USE_VBI_INTERFACE 1 - */ - -#ifdef USE_VBI_INTERFACE - #define AVIA_VBI_START_VTXT 1 - #define AVIA_VBI_STOP_VTXT 2 -#endif - -#include extern CPlugins * g_PluginList; /* neutrino.cpp */ -extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ -CPluginList::CPluginList(const neutrino_locale_t Name, const uint32_t listtype) +CPluginList::CPluginList(const neutrino_locale_t Title, const uint32_t listtype) { - frameBuffer = CFrameBuffer::getInstance(); - name = Name; + title = Title; pluginlisttype = listtype; - selected = 0; - width = w_max( 500, 0 ); - height = h_max( 526, 50 ); // 2*25 pixel frei - theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - // - fheight1 = g_Font[SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMLARGE]->getHeight(); - fheight2 = g_Font[SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMSMALL]->getHeight(); - fheight = fheight1 + fheight2 + 2; - // - listmaxshow = (height-theight-0)/fheight; - height = theight+0+listmaxshow*fheight; // recalc height - x=getScreenStartX( width ); - y=getScreenStartY( height ); - liststart = 0; + width = w_max (40, 10); + selected = -1; + number = -1; } -CPluginList::~CPluginList() +int CPluginList::run() { - for(unsigned int count=0;countstartPlugin(number); + if (!g_PluginList->getScriptOutput().empty()) { + hide(); + ShowMsg(LOCALE_PLUGINS_RESULT, g_PluginList->getScriptOutput(), CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_SHELL); } - pluginlist.clear(); + return menu_return::RETURN_REPAINT; } -int CPluginList::exec(CMenuTarget* parent, const std::string & /*actionKey*/) +int CPluginList::exec(CMenuTarget* parent, const std::string &actionKey) { - neutrino_msg_t msg; - neutrino_msg_data_t data; - - int res = menu_return::RETURN_REPAINT; - if (parent) - { parent->hide(); - } - //scan4plugins here! - for(unsigned int count=0;countname = g_Locale->getText(LOCALE_MENU_BACK); - pluginlist.push_back(tmp); + if (number > -1) + return run(); - for(unsigned int count=0;count < (unsigned int)g_PluginList->getNumberOfPlugins();count++) - { - if ((g_PluginList->getType(count) & pluginlisttype) && !g_PluginList->isHidden(count)) - { - tmp = new pluginitem(); - tmp->number = count; - tmp->name = g_PluginList->getName(count); - tmp->desc = g_PluginList->getDescription(count); - if (tmp->desc == "") - tmp->desc = "---"; - pluginlist.push_back(tmp); + const char *icon = ""; + if (pluginlisttype == CPlugins::P_TYPE_GAME) + icon = NEUTRINO_ICON_GAMES; + else + icon = NEUTRINO_ICON_SHELL; + + CMenuWidget m(title, icon, width); + m.setSelected(selected); + m.addIntroItems(); + + int nop = g_PluginList->getNumberOfPlugins(); + + int shortcut = 1; + + for(int count = 0; count < nop; count++) { + if ((g_PluginList->getType(count) & pluginlisttype) && !g_PluginList->isHidden(count)) { + CMenuForwarder *f = new CMenuForwarder(std::string(g_PluginList->getName(count)), true, "", this, to_string(count).c_str(), CRCInput::convertDigitToKey(shortcut++)); + //TODO: use hint-icons; header-icons are to small + f->setHint("", g_PluginList->getDescription(count)); + m.addItem(f); } } + int res = m.exec(NULL, ""); + m.hide(); + selected = m.getSelected(); - COSDFader fader(g_settings.menu_Content_alpha); - fader.StartFadeIn(); - - paint(); - - uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); - - bool loop=true; - while (loop) - { - g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); - - if ( msg <= CRCInput::RC_MaxRC ) - timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_MENU]); - - if((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetTimer())) { - if(fader.Fade()) { - loop = false; - } - } - else if ( ( msg == CRCInput::RC_timeout ) || - ( msg == (neutrino_msg_t)g_settings.key_channelList_cancel ) ) - { - if(fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); - msg = 0; - } else - loop=false; - } - else if ( msg == (neutrino_msg_t)g_settings.key_channelList_pageup ) - { - if ((int(selected)-int(listmaxshow))<0) - selected=0; - else - selected -= listmaxshow; - liststart = (selected/listmaxshow)*listmaxshow; - paintItems(); - } - else if ( msg == (neutrino_msg_t)g_settings.key_channelList_pagedown ) - { - selected+=listmaxshow; - if (selected>pluginlist.size()-1) - selected=pluginlist.size()-1; - liststart = (selected/listmaxshow)*listmaxshow; - paintItems(); - } - else if ( msg == CRCInput::RC_up ) - { - int prevselected=selected; - if(selected==0) - { - selected = pluginlist.size()-1; - } - else - selected--; - paintItem(prevselected - liststart); - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if(oldliststart!=liststart) - { - paintItems(); - } - else - { - paintItem(selected - liststart); - } - } - else if ( msg == CRCInput::RC_down ) - { - int prevselected=selected; - selected = (selected+1)%pluginlist.size(); - paintItem(prevselected - liststart); - unsigned int oldliststart = liststart; - liststart = (selected/listmaxshow)*listmaxshow; - if(oldliststart!=liststart) - { - paintItems(); - } - else - { - paintItem(selected - liststart); - } - } - else if ( msg == CRCInput::RC_ok ) - { - if(selected==0) - { - loop=false; - } - else - {//exec the plugin :)) - if (pluginSelected() == close) - { - loop=false; - } - } - } - else if( (msg== CRCInput::RC_red) || - (msg==CRCInput::RC_green) || - (msg==CRCInput::RC_yellow) || - (msg==CRCInput::RC_blue) || - (CRCInput::isNumeric(msg)) ) - { - g_RCInput->postMsg(msg, data); - loop=false; - } - else if ( CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all ) - { - loop = false; - res = menu_return::RETURN_EXIT_ALL; - } - } - hide(); - - fader.Stop(); return res; } -void CPluginList::hide() +CPluginChooser::CPluginChooser(const neutrino_locale_t Name, const uint32_t listtype, std::string &selectedFile) : CPluginList(Name, listtype) { - frameBuffer->paintBackgroundBoxRel(x,y, width+15,height); + selectedFilePtr = &selectedFile; } -void CPluginList::paintItem(int pos) +int CPluginChooser::run() { - int ypos = (y+theight) + pos*fheight; - int itemheight = fheight; - - fb_pixel_t color = COL_MENUCONTENT_TEXT; - fb_pixel_t bgcolor = COL_MENUCONTENT_PLUS_0; - - if (liststart+pos==selected) - { - color = COL_MENUCONTENTSELECTED_TEXT; - bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; - } - - if(liststart+pos==0) - { //back is half-height... - itemheight = (fheight / 2) + 3; - frameBuffer->paintBoxRel(x , ypos + itemheight , width , 15, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x + 10, ypos + itemheight + 5, width - 20, 1, COL_MENUCONTENT_PLUS_5); - frameBuffer->paintBoxRel(x + 10, ypos + itemheight + 6, width - 20, 1, COL_MENUCONTENT_PLUS_2); - } - else if(liststart==0) - { - ypos -= (fheight / 2) - 15; - //if(pos==(int)listmaxshow-1) - // frameBuffer->paintBoxRel(x,ypos+itemheight, width, (fheight / 2)-15, COL_MENUCONTENT_PLUS_0); - - } - //frameBuffer->paintBoxRel(x, ypos, width, itemheight, bgcolor); - - if(liststart+pos < pluginlist.size()) - { - frameBuffer->paintBoxRel(x, ypos, width, itemheight, bgcolor, RADIUS_LARGE); - pluginitem* actplugin = pluginlist[liststart+pos]; - g_Font[SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMLARGE]->RenderString(x+10, ypos+fheight1+3, width-20, actplugin->name, color, 0, true); // UTF-8 - g_Font[SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMSMALL]->RenderString(x+20, ypos+fheight, width-20, actplugin->desc, color, 0, true); // UTF-8 - } + if (number > -1) + *selectedFilePtr = g_PluginList->getFileName(number); + return menu_return::RETURN_EXIT; } - -void CPluginList::paintHead() -{ - int h_width = width; - if (listmaxshow < pluginlist.size()) - h_width += 15; - - CComponentsHeaderLocalized header(x, y, h_width, theight, name); - - if (pluginlisttype == CPlugins::P_TYPE_GAME) - header.setIcon(NEUTRINO_ICON_GAMES); - else - header.setIcon(NEUTRINO_ICON_SHELL); - - header.paint(CC_SAVE_SCREEN_NO); -} - -void CPluginList::paint() -{ - hide(); - width = w_max( 500, 0 ); - height = h_max( 526, 50 ); // 2*25 pixel frei - listmaxshow = (height-theight-0)/fheight; - if (pluginlist.size() < listmaxshow) - listmaxshow = pluginlist.size(); - height = theight+0+listmaxshow*fheight; // recalc height - x=getScreenStartX( width ); - y=getScreenStartY( height ); - - liststart = (selected/listmaxshow)*listmaxshow; - - paintHead(); - paintItems(); -} - -void CPluginList::paintItems() -{ - if(listmaxshow < pluginlist.size()) - { - // Scrollbar - int nrOfPages = ((pluginlist.size()-1) / listmaxshow)+1; - int currPage = (liststart/listmaxshow) +1; - - frameBuffer->paintBoxRel(x, y+theight, width+15, height-theight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - - frameBuffer->paintBoxRel(x+width, y+theight, 15, height-theight-RADIUS_LARGE, COL_MENUCONTENT_PLUS_1); - frameBuffer->paintBoxRel(x+ width +2, y+theight+2+(currPage-1)*(height-theight-4-RADIUS_LARGE)/nrOfPages, 11, (height-theight-4-RADIUS_LARGE)/nrOfPages, COL_MENUCONTENT_PLUS_3); - } else - frameBuffer->paintBoxRel(x, y+theight, width, height-theight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); - - for(unsigned int count=0;countstartPlugin(pluginlist[selected]->number,0); - if (!g_PluginList->getScriptOutput().empty()) - { - ShowMsg(LOCALE_PLUGINS_RESULT, g_PluginList->getScriptOutput(), CMessageBox::mbrBack,CMessageBox::mbBack,NEUTRINO_ICON_SHELL); - } - paint(); - return resume; -} - -CPluginChooser::CPluginChooser(const neutrino_locale_t Name, const uint32_t listtype, char* pluginname) - : CPluginList(Name, listtype), selected_plugin(pluginname) -{ -} - -CPluginList::result_ CPluginChooser::pluginSelected() -{ - strcpy(selected_plugin,g_PluginList->getFileName(pluginlist[selected]->number)); - return CPluginList::close; -} - diff --git a/src/gui/pluginlist.h b/src/gui/pluginlist.h index 3f7642d31..02a17f0c8 100644 --- a/src/gui/pluginlist.h +++ b/src/gui/pluginlist.h @@ -43,71 +43,28 @@ class CPluginList : public CMenuTarget { - public: - enum result_ - { - close = 0, - resume = 1 - } result; - private: - - CFrameBuffer *frameBuffer; - - struct pluginitem - { - int number; - std::string name; // UTF-8 encoded - std::string desc; // UTF-8 encoded - }; - - unsigned int liststart; - unsigned int listmaxshow; - int key; - neutrino_locale_t name; + neutrino_locale_t title; uint32_t pluginlisttype; - - int fheight; // Fonthoehe Channellist-Inhalt - int theight; // Fonthoehe Channellist-Titel - - int fheight1,fheight2; - - int width; - int height; - int x; - int y; - - void paintItem(int pos); - void paintItems(); - void paint(); - void paintHead(); + int width; protected: - - unsigned int selected; - std::vector pluginlist; - - virtual CPluginList::result_ pluginSelected(); + int selected; + int number; public: - - CPluginList(const neutrino_locale_t Name, const uint32_t listtype); - virtual ~CPluginList(); - - void hide(); + CPluginList(const neutrino_locale_t Title, const uint32_t listtype); int exec(CMenuTarget* parent, const std::string & actionKey); + virtual int run (); }; class CPluginChooser : public CPluginList { private: - char* selected_plugin; - protected: - - CPluginList::result_ pluginSelected(); - + std::string *selectedFilePtr; public: - CPluginChooser(const neutrino_locale_t Name, const uint32_t listtype, char* pluginname); + CPluginChooser(const neutrino_locale_t Name, const uint32_t listtype, std::string &selectedFile); + int run (); }; #endif diff --git a/src/gui/plugins.cpp b/src/gui/plugins.cpp index 8d1d7ab8d..396231f5f 100644 --- a/src/gui/plugins.cpp +++ b/src/gui/plugins.cpp @@ -53,14 +53,6 @@ #include #include "plugins.h" -/* for alexW images with old drivers: - * #define USE_VBI_INTERFACE 1 - */ - -#ifdef USE_VBI_INTERFACE -#define AVIA_VBI_START_VTXT 1 -#define AVIA_VBI_STOP_VTXT 2 -#endif #include #include @@ -69,7 +61,6 @@ extern CPlugins * g_PluginList; /* neutrino.cpp */ extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ #define PLUGINDIR_VAR "/var/tuxbox/plugins" -#define PLUGINDIR_USB "/mnt/usb/tuxbox/plugins" CPlugins::CPlugins() { @@ -77,6 +68,11 @@ CPlugins::CPlugins() number_of_plugins = 0; } +CPlugins::~CPlugins() +{ + plugin_list.clear(); +} + bool CPlugins::plugin_exists(const std::string & filename) { return (find_plugin(filename) >= 0); @@ -151,22 +147,14 @@ void CPlugins::loadPlugins() plugin_list.clear(); sindex = 100; scanDir(g_settings.plugin_hdd_dir.c_str()); - scanDir(PLUGINDIR_USB); scanDir(PLUGINDIR_VAR); scanDir(PLUGINDIR); sort (plugin_list.begin(), plugin_list.end()); } -CPlugins::~CPlugins() -{ - plugin_list.clear(); -} - bool CPlugins::parseCfg(plugin *plugin_data) { -// FILE *fd; - std::ifstream inFile; std::string line[20]; int linecount = 0; @@ -280,13 +268,13 @@ PluginParam * CPlugins::makeParam(const char * const id, const int value, Plugin return makeParam(id, aval, next); } -void CPlugins::start_plugin_by_name(const std::string & filename,int param) +void CPlugins::startPlugin_by_name(const std::string & name) { for (int i = 0; i < (int) plugin_list.size(); i++) { - if (filename.compare(g_PluginList->getName(i))==0) + if (name.compare(g_PluginList->getName(i))==0) { - startPlugin(i,param); + startPlugin(i); return; } } @@ -296,7 +284,7 @@ void CPlugins::startPlugin(const char * const name) { int pluginnr = find_plugin(name); if (pluginnr > -1) - startPlugin(pluginnr,0); + startPlugin(pluginnr); else printf("[CPlugins] could not find %s\n", name); @@ -351,7 +339,7 @@ void CPlugins::startLuaPlugin(int number) delete lua; } -void CPlugins::startPlugin(int number,int /*param*/) +void CPlugins::startPlugin(int number) { // always delete old output delScriptOutput(); @@ -366,9 +354,8 @@ void CPlugins::startPlugin(int number,int /*param*/) sprintf(tmp, "%d", g_settings.screen_EndY); setenv("SCREEN_END_Y", tmp, 1); - //bool ispip = strncmp(plugin_list[number].pluginfile.c_str(), "pip", 3) ? false : true; bool ispip = strstr(plugin_list[number].pluginfile.c_str(), "pip") != 0; -//printf("exec: %s pip: %d\n", plugin_list[number].pluginfile.c_str(), ispip); + //printf("exec: %s pip: %d\n", plugin_list[number].pluginfile.c_str(), ispip); if (ispip && !g_RemoteControl->is_video_started) return; if (plugin_list[number].type == CPlugins::P_TYPE_SCRIPT) @@ -388,229 +375,15 @@ void CPlugins::startPlugin(int number,int /*param*/) return; } -#if 0 - PluginExec execPlugin; - char depstring[129]; - char *argv[20]; - void *libhandle[20]; - int argc = 0, i = 0, lcd_fd=-1; - char *p; - char *np; - void *handle; - char * error; - int vtpid = 0; - PluginParam * startparam = 0; -#endif - g_RCInput->clearRCMsg(); -#if 0 - if (plugin_list[number].fb) - { - startparam = makeParam(P_ID_FBUFFER , frameBuffer->getFileHandle() , startparam); - } - if (plugin_list[number].rc) - { - startparam = makeParam(P_ID_RCINPUT , g_RCInput->getFileHandle() , startparam); - startparam = makeParam(P_ID_RCBLK_ANF, g_settings.repeat_genericblocker, startparam); - startparam = makeParam(P_ID_RCBLK_REP, g_settings.repeat_blocker , startparam); - } - else - { - g_RCInput->stopInput(); - } - if (plugin_list[number].lcd) - { - CLCD::getInstance()->pause(); - - lcd_fd = open("/dev/dbox/lcd0", O_RDWR); - - startparam = makeParam(P_ID_LCD , lcd_fd , startparam); - } - if (plugin_list[number].vtxtpid) - { - vtpid = g_RemoteControl->current_PIDs.PIDs.vtxtpid; -#ifdef USE_VBI_INTERFACE - int fd = open("/dev/dbox/vbi0", O_RDWR); - if (fd > 0) - { - ioctl(fd, AVIA_VBI_STOP_VTXT, 0); - close(fd); - } -#endif - if (param>0) - vtpid=param; - startparam = makeParam(P_ID_VTXTPID, vtpid, startparam); - } - if (plugin_list[number].needoffset) - { - startparam = makeParam(P_ID_VFORMAT , g_settings.video_Format , startparam); - startparam = makeParam(P_ID_OFF_X , g_settings.screen_StartX , startparam); - startparam = makeParam(P_ID_OFF_Y , g_settings.screen_StartY , startparam); - startparam = makeParam(P_ID_END_X , g_settings.screen_EndX , startparam); - startparam = makeParam(P_ID_END_Y , g_settings.screen_EndY , startparam); - } - - PluginParam *par = startparam; - for ( ; par; par=par->next ) - { - printf("[CPlugins] (id,val):(%s,%s)\n", par->id, par->val); - } - std::string pluginname = plugin_list[number].filename; - - strcpy(depstring, plugin_list[number].depend.c_str()); - - argc=0; - if ( depstring[0] ) - { - p=depstring; - while ( 1 ) - { - argv[ argc ] = p; - argc++; - np = strchr(p,','); - if ( !np ) - break; - - *np=0; - p=np+1; - if ( argc == 20 ) // mehr nicht ! - break; - } - } - for ( i=0; isetPauseScanning (true); - g_Zapit->setEventMode(false); - if (g_Zapit->isPlayBackActive()) { - if (!CNeutrinoApp::getInstance()->recordingstatus) - g_Zapit->setRecordMode(true); - } else { - /* no playback, we playing file ? zap to channel */ - t_channel_id current_channel = g_Zapit->getCurrentServiceID(); - g_Zapit->zapTo_serviceID(current_channel); - } - } - g_RCInput->close_click(); -#ifndef FB_USE_PALETTE - if (plugin_list[number].fb) { - frameBuffer->setMode(720, 576, 8); - frameBuffer->paletteSet(); - } -#endif - execPlugin(startparam); - dlclose(handle); - printf("[CPlugins] exec done...\n"); - g_RCInput->open_click(); - } - } - //restore framebuffer... -//#if 0 -// g_RCInput->open_click(); -//#endif - - //if (!plugin_list[number].rc) - g_RCInput->restartInput(); - g_RCInput->clearRCMsg(); - - if (plugin_list[number].lcd) - { - if (lcd_fd != -1) - close(lcd_fd); - CLCD::getInstance()->resume(); - } - - if (plugin_list[number].fb) - { -#ifdef FB_USE_PALETTE - frameBuffer->paletteSet(); -#else - frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t)); -#endif - } - frameBuffer->paintBackgroundBox(0,0,720,576); - if (ispip) { - if (!CNeutrinoApp::getInstance()->recordingstatus) { - g_Zapit->setRecordMode(false); - } - g_Zapit->setEventMode(true); - g_Sectionsd->setPauseScanning (false); - } - -#ifdef USE_VBI_INTERFACE - if (plugin_list[number].vtxtpid) - { - if (vtpid != 0) - { - // versuche, den gtx/enx_vbi wieder zu starten - int fd = open("/dev/dbox/vbi0", O_RDWR); - if (fd > 0) - { - ioctl(fd, AVIA_VBI_START_VTXT, vtpid); - close(fd); - } - } - } -#endif - } - - /* unload shared libs */ - for ( i=0; iid, since it is the original */ - free(par->val); - PluginParam * tmp = par; - par = par->next; - delete tmp; - } - g_RCInput->clearRCMsg(); -#else g_RCInput->clearRCMsg(); g_RCInput->stopInput(); - /* stop automatic updates etc. */ - frameBuffer->Lock(); - //frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t)); + printf("Starting %s\n", plugin_list[number].pluginfile.c_str()); my_system(2, plugin_list[number].pluginfile.c_str(), NULL); - //frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t)); - frameBuffer->Unlock(); + frameBuffer->paintBackground(); g_RCInput->restartInput(); g_RCInput->clearRCMsg(); -#endif } bool CPlugins::hasPlugin(CPlugins::p_type_t type) @@ -656,5 +429,3 @@ CPlugins::p_type_t CPlugins::getPluginType(int type) return P_TYPE_DISABLED; } } - - diff --git a/src/gui/plugins.h b/src/gui/plugins.h index 787ff98ca..63d22df03 100644 --- a/src/gui/plugins.h +++ b/src/gui/plugins.h @@ -121,12 +121,11 @@ class CPlugins inline int getIndex (const int number) const { return plugin_list[number].index ; } inline neutrino_msg_t getKey (const int number) const { return (neutrino_msg_t)plugin_list[number].key; } - void startPlugin(int number,int param); - void start_plugin_by_name(const std::string & filename,int param);// start plugins by "name=" in .cfg + void startPlugin(int number); // start plugins by number + void startPlugin(const char * const filename); // start plugins by filename + void startPlugin_by_name(const std::string & name); // start plugins by "name=" in .cfg void startScriptPlugin(int number); void startLuaPlugin(int number); - - void startPlugin(const char * const filename); // start plugins also by name bool hasPlugin(CPlugins::p_type_t type); const std::string& getScriptOutput() const; diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index 207b6ea94..3b6b19c7f 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -239,9 +239,16 @@ int CRecordSetup::showRecordSetup() recordingSettings->addItem(startstop_msg); } - //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); + //filename template + CStringInputSMS* filename_template = new CStringInputSMS(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, &g_settings.recording_filename_template, 21, LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT, LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT2, "%/-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 "); + CMenuForwarder* ft = new CMenuDForwarder(LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, true, g_settings.recording_filename_template, filename_template, NULL, CRCInput::RC_1); + ft->setHint("", LOCALE_MENU_HINT_RECORD_FILENAME_TEMPLATE); + recordingSettings->addItem(ft); + + CMenuOptionChooser* cover = new CMenuOptionChooser(LOCALE_RECORDINGMENU_AUTO_COVER, &g_settings.auto_cover, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + cover->setHint("", LOCALE_MENU_HINT_RECORD_AUTO_COVER); + recordingSettings->addItem(cover); + recordingSettings->addItem(GenericMenuSeparatorLine); if (!g_settings.easymenu) { @@ -267,7 +274,7 @@ int CRecordSetup::showRecordSetup() //datasettings showRecordDataSetup(&recordingaDataSettings); - mf = new CMenuForwarder(LOCALE_RECORDINGMENU_DATA_PIDS, true, NULL, &recordingaDataSettings, NULL, CRCInput::RC_1); + mf = new CMenuForwarder(LOCALE_RECORDINGMENU_DATA_PIDS, true, NULL, &recordingaDataSettings, NULL, CRCInput::RC_2); mf->setHint("", LOCALE_MENU_HINT_RECORD_DATA); recordingSettings->addItem(mf); } @@ -390,6 +397,12 @@ void CRecordSetup::showRecordTimeShiftSetup(CMenuWidget *menu_ts) mc = new CMenuOptionChooser(LOCALE_EXTRA_TEMP_TIMESHIFT, &g_settings.temp_timeshift, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); mc->setHint("", LOCALE_MENU_HINT_RECORD_TIMESHIFT_TEMP); menu_ts->addItem(mc); + + //rec hours + mn = new CMenuOptionNumberChooser(LOCALE_EXTRA_RECORD_TIME_TS, &g_settings.timeshift_hours, true, 1, 24, NULL); + mn->setNumberFormat(std::string("%d ") + g_Locale->getText(LOCALE_UNIT_SHORT_HOUR)); + mn->setHint("", LOCALE_MENU_HINT_RECORD_TIME_TS); + menu_ts->addItem(mn); } } diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index cfc7bb16c..8e1a4a57b 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -60,7 +60,6 @@ extern cVideo * videoDecoder; #define NEUTRINO_SCAN_START_SCRIPT CONFIGDIR "/scan.start" #define NEUTRINO_SCAN_STOP_SCRIPT CONFIGDIR "/scan.stop" -#define NEUTRINO_SCAN_SETTINGS_FILE CONFIGDIR "/scan.conf" #define BAR_BORDER 2 #define BAR_WIDTH 150 @@ -154,7 +153,8 @@ void CScanTs::testFunc() } else if (deltype == FE_OFDM) { sprintf(buffer, "%u", TP.feparams.dvb_feparams.frequency); /* no way int can overflow the buffer */ } -printf("CScanTs::testFunc: %s\n", buffer); + + printf("CScanTs::testFunc: %s\n", buffer); paintLine(xpos2, ypos_cur_satellite, w - 95, pname.c_str()); paintLine(xpos2, ypos_frequency, w, buffer); paintRadar(); @@ -308,7 +308,8 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) } else if(manual) success = g_Zapit->scan_TP(TP); else if(fast) { -// success = CZapit::getInstance()->StartFastScan(scansettings.fast_type, scansettings.fast_op); + CServiceScan::getInstance()->QuietFastScan(false); + success = CZapit::getInstance()->StartFastScan(scansettings.fast_type, scansettings.fast_op); } else success = g_Zapit->startScan(scan_flags); @@ -525,6 +526,7 @@ void CScanTs::paintLine(int px, int py, int w, const char * const txt) void CScanTs::paint(bool fortest) { CComponentsHeaderLocalized header(x, y, width, hheight, fortest ? LOCALE_SCANTS_TEST : LOCALE_SCANTS_HEAD); + header.setCaptionAlignment(CTextBox::CENTER); header.paint(CC_SAVE_SCREEN_NO); frameBuffer->paintBoxRel(x, y + hheight, width, height - hheight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index d744e1123..ed3750cd6 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -309,6 +309,10 @@ int CScanSetup::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_EXIT_ALL; return res; } + if (actionKey == "fastdiseqc") { + printf("[neutrino] CScanSetup::%s: showFastscanDiseqcSetup()\n", __FUNCTION__); + return showFastscanDiseqcSetup(); + } std::string scants_key[] = {"all", "manual", "test", "fast", "auto"/*doesn't exists in CScanTs!*/}; if (actionKey.size() > 1) { @@ -330,8 +334,16 @@ int CScanSetup::exec(CMenuTarget* parent, const std::string &actionKey) //...then start scan CScanTs scanTs(delsys); scanTs.exec(NULL, scants_key[i]); - if (is_wizard && as == "fast") - return menu_return::RETURN_EXIT_ALL; +#if 0 + /* FIXME save fst version. other than fast scan will reset it to 0 + to disable fast scan updates */ + scansettings.fst_version = CServiceScan::getInstance()->GetFstVersion(); +#endif + if (as == "fast") { + scansettings.fst_update = 1; + if (is_wizard) + return menu_return::RETURN_EXIT_ALL; + } return res; } } @@ -375,7 +387,7 @@ int CScanSetup::showScanMenu() printf("[neutrino] CScanSetup call %s...\n", __FUNCTION__); int shortcut = 1; int w = getSatMenuListWidth(); -printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager::getInstance()->haveSat(), CFEManager::getInstance()->haveTerr()); + printf("C: %d S: %d T: %d\n", CFEManager::getInstance()->haveCable(),CFEManager::getInstance()->haveSat(), CFEManager::getInstance()->haveTerr()); CMenuForwarder * mf; CMenuOptionChooser * mc; @@ -549,7 +561,6 @@ neutrino_locale_t CScanSetup::getModeLocale(int mode) int CScanSetup::showScanMenuFrontendSetup() { CMenuForwarder * mf; - int shortcut = 1; fe_restart = false; allow_start = !CRecordManager::getInstance()->RecordingStatus() || CRecordManager::getInstance()->TimeshiftOnly(); @@ -571,10 +582,12 @@ int CScanSetup::showScanMenuFrontendSetup() if (g_settings.easymenu) snprintf(name, sizeof(name), "%s %d: %s", g_Locale->getText(LOCALE_SATSETUP_FE_SETUP), i+1, fe->getInfo()->type == FE_QPSK ? g_Locale->getText(LOCALE_SCANTS_ACTSATELLITE) + : fe->getInfo()->type == FE_OFDM ? g_Locale->getText(LOCALE_SCANTS_ACTTERRESTRIAL) : g_Locale->getText(LOCALE_SCANTS_ACTCABLE)); else snprintf(name, sizeof(name), "%s %d: %s %s", g_Locale->getText(LOCALE_SATSETUP_FE_SETUP), i+1, fe->getInfo()->type == FE_QPSK ? g_Locale->getText(LOCALE_SCANTS_ACTSATELLITE) + : fe->getInfo()->type == FE_OFDM ? g_Locale->getText(LOCALE_SCANTS_ACTTERRESTRIAL) : g_Locale->getText(LOCALE_SCANTS_ACTCABLE), fe->getInfo()->name); @@ -616,28 +629,35 @@ int CScanSetup::showScanMenuFrontendSetup() zapit_lat_str = std::string(zapit_lat); zapit_long_str = std::string(zapit_long); - setupMenu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SATSETUP_EXTENDED_MOTOR)); + CMenuWidget * rotorMenu = new CMenuWidget(LOCALE_SATSETUP_EXTENDED_MOTOR, NEUTRINO_ICON_SETTINGS, width); + rotorMenu->addIntroItems(); + + int shortcut = 1; CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_EXTRA_LADIRECTION, (int *)&zapitCfg.gotoXXLaDirection, OPTIONS_SOUTH0_NORTH1_OPTIONS, OPTIONS_SOUTH0_NORTH1_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++)); mc->setHint("", LOCALE_MENU_HINT_SCAN_LADIRECTION); - setupMenu->addItem(mc); + rotorMenu->addItem(mc); CStringInput * toff1 = new CStringInput(LOCALE_EXTRA_LATITUDE, &zapit_lat_str, 10, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789."); mf = new CMenuDForwarder(LOCALE_EXTRA_LATITUDE, true, zapit_lat, toff1, "", CRCInput::convertDigitToKey(shortcut++)); mf->setHint("", LOCALE_MENU_HINT_SCAN_LATITUDE); - setupMenu->addItem(mf); + rotorMenu->addItem(mf); mc = new CMenuOptionChooser(LOCALE_EXTRA_LODIRECTION, (int *)&zapitCfg.gotoXXLoDirection, OPTIONS_EAST0_WEST1_OPTIONS, OPTIONS_EAST0_WEST1_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++)); mc->setHint("", LOCALE_MENU_HINT_SCAN_LODIRECTION); - setupMenu->addItem(mc); + rotorMenu->addItem(mc); CStringInput * toff2 = new CStringInput(LOCALE_EXTRA_LONGITUDE, &zapit_long_str, 10, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789."); mf = new CMenuDForwarder(LOCALE_EXTRA_LONGITUDE, true, zapit_long, toff2, "", CRCInput::convertDigitToKey(shortcut++)); mf->setHint("", LOCALE_MENU_HINT_SCAN_LONGITUDE); - setupMenu->addItem(mf); + rotorMenu->addItem(mf); nc = new CMenuOptionNumberChooser(LOCALE_SATSETUP_USALS_REPEAT, (int *)&zapitCfg.repeatUsals, true, 0, 10, NULL, 0, 0, LOCALE_OPTIONS_OFF); nc->setHint("", LOCALE_MENU_HINT_SCAN_USALS_REPEAT); - setupMenu->addItem(nc); + rotorMenu->addItem(nc); + + mf = new CMenuDForwarder(LOCALE_SATSETUP_EXTENDED_MOTOR, true, NULL, rotorMenu); + mf->setHint("", LOCALE_MENU_HINT_SCAN_USALS); + setupMenu->addItem(mf); } int res = setupMenu->exec(NULL, ""); @@ -662,6 +682,38 @@ static std::string rotationSpeed2str(int i) return to_string(i/10) + g_Locale->getText(LOCALE_UNIT_DECIMAL) + to_string(i%10) + "°/" + g_Locale->getText(LOCALE_UNIT_SHORT_SECOND); } +static struct CMenuOptionChooser::keyval_ext twin_doptions[2]; +void CScanSetup::setDiseqcOptions(int number) +{ + CFrontend * fe = CFEManager::getInstance()->getFE(number); + + int mode = fe->getMode(); + if (CFrontend::linked(femode)) { + printf("CScanSetup::setDiseqcOptions: set options for linked\n"); + CFrontend * mfe = CFEManager::getInstance()->getFE(femaster); + frontend_config_t & mfe_config = mfe->getConfig(); + + int count = 1; + twin_doptions[0].key = mfe_config.diseqcType; + twin_doptions[0].value = (mfe_config.diseqcType == NO_DISEQC ? LOCALE_SATSETUP_NODISEQC : + mfe_config.diseqcType == MINI_DISEQC ? LOCALE_SATSETUP_MINIDISEQC : + mfe_config.diseqcType == DISEQC_1_0 ? LOCALE_SATSETUP_DISEQC10 : + mfe_config.diseqcType == DISEQC_1_1 ? LOCALE_SATSETUP_DISEQC11 : + mfe_config.diseqcType == DISEQC_ADVANCED ? LOCALE_SATSETUP_DISEQC_ADVANCED : + LOCALE_SATSETUP_UNICABLE); + + if (mode == CFrontend::FE_MODE_LINK_TWIN && mfe_config.diseqcType != DISEQC_UNICABLE) { + count++; + twin_doptions[1].key = DISEQC_UNICABLE; + twin_doptions[1].value = LOCALE_SATSETUP_UNICABLE; + } + dtype->setOptions(twin_doptions, count); + } else if( mode != CFrontend::FE_MODE_UNUSED) { + printf("CScanSetup::setDiseqcOptions: set default options\n"); + dtype->setOptions(SATSETUP_DISEQC_OPTIONS, SATSETUP_DISEQC_OPTION_COUNT); + } +} + int CScanSetup::showFrontendSetup(int number) { int shortcut = 1; @@ -679,6 +731,7 @@ int CScanSetup::showFrontendSetup(int number) if (g_settings.easymenu) snprintf(name, sizeof(name), "%s %d: %s", g_Locale->getText(LOCALE_SATSETUP_FE_SETUP), number+1, fe->getInfo()->type == FE_QPSK ? g_Locale->getText(LOCALE_SCANTS_ACTSATELLITE) + : fe->getInfo()->type == FE_OFDM ? g_Locale->getText(LOCALE_SCANTS_ACTTERRESTRIAL) : g_Locale->getText(LOCALE_SCANTS_ACTCABLE)); else snprintf(name, sizeof(name), "%s %d: %s", g_Locale->getText(LOCALE_SATSETUP_FE_SETUP), number+1, fe->getInfo()->name); @@ -757,6 +810,9 @@ int CScanSetup::showFrontendSetup(int number) dtype->setHint("", LOCALE_MENU_HINT_SCAN_DISEQCTYPE); setupMenu->addItem(dtype); + if (fecount > 1) + setDiseqcOptions(fenumber); + /* diseqc repeats */ ojDiseqcRepeats = new CMenuOptionNumberChooser(LOCALE_SATSETUP_DISEQCREPEAT, (int *)&fe_config.diseqcRepeats, allow_moptions && (dmode != NO_DISEQC) && (dmode != DISEQC_ADVANCED), 0, 2, NULL); ojDiseqcRepeats->setHint("", LOCALE_MENU_HINT_SCAN_DISEQCREPEAT); @@ -791,27 +847,38 @@ int CScanSetup::showFrontendSetup(int number) uniSetup = new CMenuForwarder(LOCALE_SATSETUP_UNI_SETTINGS, (dmode == DISEQC_UNICABLE), NULL, this, "unisetup", CRCInput::convertDigitToKey(shortcut++)); setupMenu->addItem(uniSetup); - setupMenu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_SATSETUP_EXTENDED_MOTOR)); + CMenuWidget * rotorMenu = new CMenuWidget(LOCALE_SATSETUP_EXTENDED_MOTOR, NEUTRINO_ICON_SETTINGS, width); + rotorMenu->addIntroItems(); + CMenuOptionNumberChooser * nc = new CMenuOptionNumberChooser(LOCALE_EXTRA_ZAPIT_MOTOR_SPEED, (int *)&fe_config.motorRotationSpeed, allow_moptions, 0, 64, NULL); nc->setNumberFormat(rotationSpeed2str); nc->setHint("", LOCALE_MENU_HINT_SCAN_MOTOR_SPEED); - setupMenu->addItem(nc); + rotorMenu->addItem(nc); msettings.Add(nc); mc = new CMenuOptionChooser(LOCALE_EXTRA_ZAPIT_HVOLTAGE, (int *)&fe_config.highVoltage, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, allow_moptions); mc->setHint("", LOCALE_MENU_HINT_SCAN_MOTOR_18V); - setupMenu->addItem(mc); + rotorMenu->addItem(mc); msettings.Add(mc); mc = new CMenuOptionChooser(LOCALE_SATSETUP_USE_USALS, &fe_config.use_usals, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, allow_moptions, this); mc->setHint("", LOCALE_MENU_HINT_SCAN_USALSALL); - setupMenu->addItem(mc); + rotorMenu->addItem(mc); + msettings.Add(mc); + + mc = new CMenuOptionChooser(LOCALE_EXTRA_ROTOR_SWAP, &fe_config.rotor_swap, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, allow_moptions, this); + mc->setHint("", LOCALE_MENU_HINT_ROTOR_SWAP); + rotorMenu->addItem(mc); msettings.Add(mc); CMenuForwarder * mf = new CMenuForwarder(LOCALE_MOTORCONTROL_HEAD, allow_moptions, NULL, this, "satfind", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); mf->setHint("", LOCALE_MENU_HINT_SCAN_SATFIND); - setupMenu->addItem(mf); + rotorMenu->addItem(mf); msettings.Add(mf); + + mf = new CMenuDForwarder(LOCALE_SATSETUP_EXTENDED_MOTOR, allow_moptions, NULL, rotorMenu, "", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); + mf->setHint("", LOCALE_MENU_HINT_SCAN_MOTOR); + setupMenu->addItem(mf); } int res = setupMenu->exec(NULL, ""); @@ -1188,6 +1255,7 @@ void CScanSetup::addScanMenuAutoScanAll(CMenuWidget *auto_ScanAll) } #ifdef ENABLE_FASTSCAN +#if 0 #define FAST_SCAN_OPTIONS_COUNT 2 const CMenuOptionChooser::keyval FAST_SCAN_OPTIONS[FAST_SCAN_OPTIONS_COUNT] = { @@ -1195,14 +1263,22 @@ const CMenuOptionChooser::keyval FAST_SCAN_OPTIONS[FAST_SCAN_OPTIONS_COUNT] = { FAST_SCAN_HD, LOCALE_SATSETUP_FASTSCAN_HD } /*{ FAST_SCAN_ALL, LOCALE_SATSETUP_FASTSCAN_ALL }*/ }; +#endif -#define FAST_SCAN_PROV_OPTIONS_COUNT 3 -const CMenuOptionChooser::keyval FAST_SCAN_PROV_OPTIONS[FAST_SCAN_PROV_OPTIONS_COUNT] = +const CMenuOptionChooser::keyval FAST_SCAN_PROV_OPTIONS[] = { - { OPERATOR_CD, LOCALE_SATSETUP_FASTSCAN_PROV_CD }, - { OPERATOR_TVV, LOCALE_SATSETUP_FASTSCAN_PROV_TVV }, - { OPERATOR_TELESAT, LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT } + { OPERATOR_CD_SD, LOCALE_SATSETUP_FASTSCAN_PROV_CD_SD }, + { OPERATOR_CD_HD, LOCALE_SATSETUP_FASTSCAN_PROV_CD_HD }, + { OPERATOR_TVV_SD, LOCALE_SATSETUP_FASTSCAN_PROV_TVV_SD }, + { OPERATOR_TVV_HD, LOCALE_SATSETUP_FASTSCAN_PROV_TVV_HD }, + { OPERATOR_TELESAT_B, LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT_B }, + { OPERATOR_TELESAT_L, LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT_L }, + { OPERATOR_HD_AUSTRIA, LOCALE_SATSETUP_FASTSCAN_PROV_HDA }, + { OPERATOR_SKYLINK_C, LOCALE_SATSETUP_FASTSCAN_PROV_SKYLINK_C }, + { OPERATOR_SKYLINK_S, LOCALE_SATSETUP_FASTSCAN_PROV_SKYLINK_S }, + { OPERATOR_HELLO, LOCALE_SATSETUP_FASTSCAN_PROV_HELLO } }; +#define FAST_SCAN_PROV_OPTIONS_COUNT (sizeof(FAST_SCAN_PROV_OPTIONS)/sizeof(CMenuOptionChooser::keyval)) //init fast scan menu void CScanSetup::addScanMenuFastScan(CMenuWidget *fast_ScanMenu) @@ -1212,18 +1288,58 @@ void CScanSetup::addScanMenuFastScan(CMenuWidget *fast_ScanMenu) CMenuOptionChooser* fastProv = new CMenuOptionChooser(LOCALE_SATSETUP_FASTSCAN_PROV, (int *)&scansettings.fast_op, FAST_SCAN_PROV_OPTIONS, FAST_SCAN_PROV_OPTIONS_COUNT, true, NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED, true); fastProv->setHint("", LOCALE_MENU_HINT_SCAN_FASTPROV); + fast_ScanMenu->addItem(fastProv); +#if 0 CMenuOptionChooser* fastType = new CMenuOptionChooser(LOCALE_SATSETUP_FASTSCAN_TYPE, (int *)&scansettings.fast_type, FAST_SCAN_OPTIONS, FAST_SCAN_OPTIONS_COUNT, true, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN, true); fastType->setHint("", LOCALE_MENU_HINT_SCAN_FASTTYPE); - - //---------------------------------------------------------------------- - fast_ScanMenu->addItem(fastProv); fast_ScanMenu->addItem(fastType); - //---------------------------------------------------------------------- +#endif + CMenuOptionChooser* fastUp = new CMenuOptionChooser(LOCALE_SATSETUP_FASTSCAN_UPDATE, (int *)&scansettings.fst_update, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN, true); + fastUp->setHint("", LOCALE_MENU_HINT_SCAN_FASTUPDATE); + fast_ScanMenu->addItem(fastUp); fast_ScanMenu->addItem(GenericMenuSeparatorLine); - CMenuForwarder * mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, "sfast", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + + CMenuForwarder * mf = new CMenuForwarder(LOCALE_SATSETUP_FASTSCAN_AUTO_DISEQC, allow_start, NULL, this, "fastdiseqc", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + mf->setHint("", LOCALE_MENU_HINT_SCAN_FASTDISEQC); + fast_ScanMenu->addItem(mf); + + mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, "sfast", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); mf->setHint("", LOCALE_MENU_HINT_SCAN_START); fast_ScanMenu->addItem(mf); } + +int CScanSetup::showFastscanDiseqcSetup() +{ + CHintBox * hintbox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SATSETUP_FASTSCAN_AUTO_DISEQC_WAIT)); + hintbox->paint(); + + CServiceScan::getInstance()->TestDiseqcConfig(scansettings.fast_op); + delete hintbox; + + CMenuWidget * sat_setup = new CMenuWidget(LOCALE_SATSETUP_DISEQC_INPUT, NEUTRINO_ICON_SETTINGS, width); + sat_setup->addIntroItems(); + + CFrontend * fe = CFEManager::getInstance()->getFE(0); + satellite_map_t & satmap = fe->getSatellites(); + INFO("satmap size = %d", (int)satmap.size()); + for (sat_iterator_t sit = satmap.begin(); sit != satmap.end(); ++sit) + { + if(!sit->second.configured) + continue; + + std::string satname = CServiceManager::getInstance()->GetSatelliteName(sit->first); + CMenuOptionNumberChooser *diseqc = new CMenuOptionNumberChooser(satname, &sit->second.diseqc, true, -1, 15, this, 1, -1, LOCALE_OPTIONS_OFF); + sat_setup->addItem(diseqc); + } + sat_setup->addItem(GenericMenuSeparatorLine); + CMenuForwarder * mf = new CMenuForwarder(LOCALE_SCANTS_STARTNOW, allow_start, NULL, this, "sfast", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + mf->setHint("", LOCALE_MENU_HINT_SCAN_START); + sat_setup->addItem(mf); + + int res = sat_setup->exec(NULL, ""); + delete sat_setup; + return res; +} #endif /*ENABLE_FASTSCAN*/ //init auto scan menu @@ -1359,6 +1475,7 @@ int CScanSetup::addScanOptionsItems(CMenuWidget *options_menu, const int &shortc mod_pol = new CMenuOptionChooser(LOCALE_EXTRA_TP_MOD, (int *)&scansettings.cable_TP_mod, SATSETUP_SCANTP_MOD, SATSETUP_SCANTP_MOD_COUNT, true, NULL, CRCInput::convertDigitToKey(shortCut++)); mod_pol->setHint("", LOCALE_MENU_HINT_SCAN_MOD); } else if (r_system == DVB_T) { + // TODO: more params ? CStringInput *freq = new CStringInput(LOCALE_EXTRA_TP_FREQ, &scansettings.terr_TP_freq, 6, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "0123456789"); Freq = new CMenuDForwarder(LOCALE_EXTRA_TP_FREQ, true, scansettings.terr_TP_freq, freq, "", CRCInput::convertDigitToKey(shortCut++)); Freq->setHint("", LOCALE_MENU_HINT_SCAN_FREQ); @@ -1456,7 +1573,6 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data* bool enable = (dmode < DISEQC_ADVANCED) && (dmode != NO_DISEQC); ojDiseqcRepeats->setActive(enable && !CFrontend::linked(femode) && femode != CFrontend::FE_MODE_UNUSED); dorder->setActive(!CFrontend::linked(femode) && femode != CFrontend::FE_MODE_UNUSED && dmode == DISEQC_ADVANCED); - } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SATSETUP_FE_MODE)) { printf("[neutrino] CScanSetup::%s: fe%d mode %d master %d\n", __FUNCTION__, fenumber, femode, femaster); @@ -1484,6 +1600,7 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data* /* if mode changed, set current master too */ if (femaster >= 0) fe->setMaster(femaster); + setDiseqcOptions(fenumber); } } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SATSETUP_FE_MODE_MASTER)) { @@ -1492,6 +1609,7 @@ bool CScanSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data* CFrontend * fe = CFEManager::getInstance()->getFE(fenumber); if (fe) fe->setMaster(femaster); + setDiseqcOptions(fenumber); } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_CABLESETUP_PROVIDER)) { printf("[neutrino] CScanSetup::%s: new provider: [%s]\n", __FUNCTION__, scansettings.cableName.c_str()); diff --git a/src/gui/scan_setup.h b/src/gui/scan_setup.h index 5e416f97b..60a2c4d7d 100644 --- a/src/gui/scan_setup.h +++ b/src/gui/scan_setup.h @@ -116,6 +116,10 @@ class CScanSetup : public CMenuTarget, public CChangeObserver int addScanOptionsItems(CMenuWidget *options_menu, const int &shortcut = 1); int addListFlagsItems(CMenuWidget *listflags_menu, const int &shortcut = 1, bool manual = false); +#ifdef ENABLE_FASTSCAN + int showFastscanDiseqcSetup(); +#endif + void setDiseqcOptions(int number); void saveScanSetup(); diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 2f1be463a..0d771a936 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -560,6 +560,8 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) sprintf (buf, "%s:",g_Locale->getText (LOCALE_SATSETUP_SATELLITE));//swiped locale else if(t.deltype == FE_QAM) sprintf (buf, "%s:",g_Locale->getText (LOCALE_CHANNELLIST_PROVS)); + else + snprintf (buf, sizeof(buf), "%s:",g_Locale->getText (LOCALE_TERRESTRIALSETUP_AREA)); g_Font[font_info]->RenderString(xpos, ypos, box_width, buf, COL_INFOBAR_TEXT, 0, true); // UTF-8 diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 58ca0a506..e3f30b380 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -379,7 +379,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "circle"){ if (circle == NULL) - circle = new CComponentsShapeCircle (100, 100, 100, false); + circle = new CComponentsShapeCircle (100, 100, 100, NULL, false); if (!circle->isPainted()) circle->paint(); @@ -389,7 +389,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "square"){ if (sq == NULL) - sq = new CComponentsShapeSquare (100, 220, 100, 100, false); + sq = new CComponentsShapeSquare (100, 220, 100, 100, NULL, false); if (!sq->isPainted()) sq->paint(); @@ -438,7 +438,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) CComponentsText *t2 = new CComponentsText(t1->getXPos()+t1->getWidth(), 0, 200, 50, "Text2", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT); t2->setCorner(RADIUS_MID, CORNER_TOP_RIGHT); - form->addCCItem(t2); + form->addCCItem(t2); CComponentsShapeCircle *c1 = new CComponentsShapeCircle(28, 40, 28); c1->setColorBody(COL_RED); @@ -487,12 +487,12 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) int hh = 30;//g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); if (header == NULL){ header = new CComponentsHeader (100, 50, 500, hh, "Test-Header"/*, NEUTRINO_ICON_INFO, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU*/); -// header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); - header->setDefaultButtons(CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU); + header->addContextButton(NEUTRINO_ICON_BUTTON_RED); + header->addContextButton(CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU); } -// else //For existing instances it's recommended -// //to remove old button icons before add new buttons, otherwise icons will be appended. -// header->removeHeaderButtons(); + else //For existing instances it's recommended to remove old button icons before add new buttons, + //otherwise icons will be appended to already existant icons, alternatively use the setContextButton() methode + header->removeContextButtons(); // example to manipulate header items // header->setFrameThickness(5); @@ -502,9 +502,19 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) // change text of header header->setCaption("Test"); -// add any other button icon -// header->addButton(NEUTRINO_ICON_BUTTON_BLUE); -// header->addButton(NEUTRINO_ICON_BUTTON_GREEN); + //add context buttons via vector +// vector v_buttons; +// v_buttons.push_back(NEUTRINO_ICON_BUTTON_YELLOW); +// v_buttons.push_back(NEUTRINO_ICON_BUTTON_RED); +// header->addContextButton(v_buttons); +// +// // add any other button icon via string +// header->addContextButton(NEUTRINO_ICON_BUTTON_BLUE); +// header->addContextButton(NEUTRINO_ICON_BUTTON_GREEN); +// header->addContextButton(CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU); + +// set a single button, this will also remove all existant context button icons from header +// header->setContextButton(NEUTRINO_ICON_HINT_AUDIO); // example to replace the text item with an image item // get text x position @@ -528,7 +538,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "footer"){ int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); if (footer == NULL){ - footer = new CComponentsFooter (100, 50, 500, hh, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU, true); + footer = new CComponentsFooter (100, 50, 500, hh, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU, NULL, true); int start = 5, btnw =90, btnh = 37; footer->addCCItem(new CComponentsButtonRed(start, 0, btnw, btnh, "Button1")); footer->addCCItem(new CComponentsButtonGreen(start+=btnw, 0, btnw, btnh, "Button2")); @@ -545,11 +555,12 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) if (iconform == NULL) iconform = new CComponentsIconForm(); iconform->setColorBody(COL_LIGHT_GRAY); - iconform->setDimensionsAll(100, 100, 480, 60); + iconform->setDimensionsAll(100, 100,80/*480*/, 80); iconform->setFrameThickness(2); iconform->setColorFrame(COL_WHITE); - iconform->setIconOffset(5); - iconform->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); + iconform->setDirection(CC_DIR_X); + iconform->setAppendOffset(5, 5); + //For existing instances it's recommended //to remove old items before add new icons, otherwise icons will be appended. iconform->removeAllIcons(); @@ -649,6 +660,21 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } return res; } + else if (actionKey == "footer_key"){ + neutrino_msg_t msg; + neutrino_msg_data_t data; + CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, "Footer-Key pressed. Press EXIT to return"); + hintBox->paint(); + while (1) + { + g_RCInput->getMsg(&msg, &data, 100); + if (msg == CRCInput::RC_home) + break; + } + delete hintBox; + + return res; + } return showTestMenu(); @@ -683,6 +709,16 @@ int CTestMenu::showTestMenu() f_bi->setHint(NEUTRINO_ICON_HINT_IMAGEINFO, LOCALE_MENU_HINT_BUILDINFO); w_test.addItem(f_bi); + //footer buttons + static const struct button_label footerButtons[2] = { + { NEUTRINO_ICON_BUTTON_RED, LOCALE_COLORCHOOSER_RED }, + { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_COLORCHOOSER_GREEN } + }; + + w_test.setFooter(footerButtons, 2); + w_test.addKey(CRCInput::RC_red, this, "footer_key"); + w_test.addKey(CRCInput::RC_green, this, "footer_key"); + //exit return w_test.exec(NULL, "");; } diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index e08164061..74af715f2 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -36,7 +36,7 @@ -CTimeOSD::CTimeOSD():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) +CTimeOSD::CTimeOSD():CComponentsFrmClock( 0, 0, 0, 50, "%H:%M:%S", true, NULL, CC_SHADOW_ON, COL_LIGHT_GRAY, COL_MENUCONTENT_PLUS_0,COL_MENUCONTENTDARK_PLUS_0) { Init(); } diff --git a/src/gui/timeosd.h b/src/gui/timeosd.h index 3b030a861..b46fdbecd 100644 --- a/src/gui/timeosd.h +++ b/src/gui/timeosd.h @@ -58,5 +58,7 @@ class CTimeOSD : public CComponentsFrmClock bool IsVisible() {return m_mode != MODE_HIDE;} void update(int position, int duration); void switchMode(int position, int duration); + mode getMode() { return m_mode; }; + void setMode (mode mode_) { m_mode = mode_; }; }; #endif diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 12abe4efb..2a1945d90 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -65,6 +65,7 @@ #include #include +#include #include #include @@ -262,6 +263,7 @@ CTimerList::CTimerList() Timer = new CTimerdClient(); skipEventID=0; timerNew_message = ""; + timerNew_pluginName = ""; /* most probable default */ saved_dispmode = (int)CVFD::MODE_TVRADIO; @@ -342,9 +344,9 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) data = (void*)timerNew_message.c_str(); else if (timerNew.eventType==CTimerd::TIMER_EXEC_PLUGIN) { - if (strcmp(timerNew.pluginName, "---") == 0) + if (timerNew_pluginName == "---") return menu_return::RETURN_REPAINT; - data= timerNew.pluginName; + data = (void*)timerNew_pluginName.c_str(); } if (timerNew.eventRepeat >= CTimerd::TIMERREPEAT_WEEKDAYS) Timer->getWeekdaysFromStr(&timerNew.eventRepeat, m_weekdaysStr); @@ -1223,13 +1225,13 @@ int CTimerList::newTimer() CStringInputSMS timerSettings_msg(LOCALE_TIMERLIST_MESSAGE, &timerNew_message, 30, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, "abcdefghijklmnopqrstuvwxyz0123456789-.,:!?/ "); CMenuForwarder *m9 = new CMenuForwarder(LOCALE_TIMERLIST_MESSAGE, false, timerNew_message, &timerSettings_msg ); - strcpy(timerNew.pluginName,"---"); + timerNew_pluginName = "---"; CPluginChooser plugin_chooser(LOCALE_TIMERLIST_PLUGIN, CPlugins::P_TYPE_SCRIPT | CPlugins::P_TYPE_TOOL #if ENABLE_LUA | CPlugins::P_TYPE_LUA #endif - , timerNew.pluginName); - CMenuForwarder *m10 = new CMenuForwarder(LOCALE_TIMERLIST_PLUGIN, false, timerNew.pluginName, &plugin_chooser); + , timerNew_pluginName); + CMenuForwarder *m10 = new CMenuForwarder(LOCALE_TIMERLIST_PLUGIN, false, timerNew_pluginName, &plugin_chooser); CTimerListNewNotifier notifier2((int *)&timerNew.eventType, @@ -1258,7 +1260,8 @@ int CTimerList::newTimer() notifier2.changeNotify(NONEXISTANT_LOCALE, NULL); int ret=timerSettings.exec(this,""); - strncpy(timerNew.message, timerNew_message.c_str(), sizeof(timerNew.message)); + cstrncpy(timerNew.pluginName, timerNew_pluginName, sizeof(timerNew.pluginName)); + cstrncpy(timerNew.message, timerNew_message, sizeof(timerNew.message)); // delete dynamic created objects for (unsigned int count=0; count #include #include @@ -113,7 +113,15 @@ int CSoftwareUpdate::showSoftwareUpdate() mf->setHint("", LOCALE_MENU_HINT_SOFTUPDATE_EXPERT); softUpdate.addItem(mf); + //firmware update via opkg + if (COPKGManager::hasOpkgSupport()) { + mf = new CMenuForwarder(LOCALE_OPKG_TITLE, true, NULL, new COPKGManager()); + mf->setHint(NEUTRINO_ICON_HINT_SW_UPDATE, LOCALE_MENU_HINT_OPKG); + softUpdate.addItem(mf); + } + } + #ifdef BOXMODEL_APOLLO softUpdate.addItem(GenericMenuSeparatorLine); diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 5a06e0953..1383ee643 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -261,7 +261,7 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) for (node=root->GetChild(); node; node=node->GetNext()) { bool isdir; - std::string title, artist = "", album = "", id, children; + std::string title, artist = "", album = "", albumArtURI = "", id, children; const char *type, *p; if (!strcmp(node->GetType(), "container")) @@ -292,7 +292,7 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) p = ""; children=std::string(p); - UPnPEntry entry={id, isdir, title, artist, album, children, resources, -1}; + UPnPEntry entry={id, isdir, title, artist, album, albumArtURI, children, resources, -1}; entries->push_back(entry); } if (!strcmp(node->GetType(), "item")) @@ -331,6 +331,13 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) p = ""; album=std::string(p); } + else if (!strcmp(type,"albumArtURI")) + { + p=snode->GetData(); + if (!p) + p = ""; + albumArtURI=std::string(p); + } else if (!strcmp(type,"res")) { p = snode->GetData(); @@ -417,8 +424,7 @@ std::vector *CUpnpBrowserGui::decodeResult(std::string result) p = ""; children=std::string(p); - UPnPEntry entry={id, isdir, title, artist, album, children, resources, preferred}; - + UPnPEntry entry={id, isdir, title, artist, album, albumArtURI, children, resources, preferred}; entries->push_back(entry); } } @@ -951,7 +957,7 @@ void CUpnpBrowserGui::paintDevices() // Head CComponentsHeaderLocalized header(m_x, m_y + m_title_height, m_width, m_theight, LOCALE_UPNPBROWSER_HEAD, NEUTRINO_ICON_UPNP); if (CNeutrinoApp::getInstance()->isMuted()) - header.addButtonIcon(NEUTRINO_ICON_BUTTON_MUTE_SMALL); + header.addContextButton(NEUTRINO_ICON_BUTTON_MUTE_SMALL); header.paint(CC_SAVE_SCREEN_NO); // Items @@ -1095,6 +1101,20 @@ void CUpnpBrowserGui::paintItemInfo(std::vector *entry, unsigned int xstart = (m_width - w) / 2; g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + 4 + 3*m_mheight, m_width - 20, tmp, COL_MENUCONTENTSELECTED_TEXT, 0, true); // UTF-8 + static std::string lastname = "", tmpname = ""; + if(!(*entry)[selected].albumArtURI.empty()){ + static int flogo_w = 0, flogo_h = 0; + if(lastname != (*entry)[selected].albumArtURI){ + tmpname = lastname = (*entry)[selected].albumArtURI.c_str(); + tmpname = g_PicViewer->DownloadImage(tmpname ); + flogo_w = 0, flogo_h = 0; + g_PicViewer->getSize(tmpname.c_str(), &flogo_w, &flogo_h); + if((flogo_h > m_title_height-14) || (m_title_height*2 > flogo_h)){ + g_PicViewer->rescaleImageDimensions(&flogo_w, &flogo_h, m_title_height*2, m_title_height-14); + } + } + g_PicViewer->DisplayImage(tmpname.c_str(), m_x+m_width-flogo_w-2-RADIUS_MID, m_y + 2, flogo_w, flogo_h); + } } void CUpnpBrowserGui::paintItems(std::vector *entry, unsigned int selected, unsigned int max, unsigned int offset) @@ -1111,7 +1131,7 @@ printf("CUpnpBrowserGui::paintItem:s selected %d max %d offset %d\n", selected, name += m_devices[m_selecteddevice].friendlyname; CComponentsHeader header(m_x, m_y + m_title_height, m_width, m_theight, name, NEUTRINO_ICON_UPNP); if (CNeutrinoApp::getInstance()->isMuted()) - header.addButtonIcon(NEUTRINO_ICON_BUTTON_MUTE_SMALL); + header.setContextButton(NEUTRINO_ICON_BUTTON_MUTE_SMALL); header.paint(CC_SAVE_SCREEN_NO); // Items @@ -1141,7 +1161,6 @@ void CUpnpBrowserGui::paintDetails(std::vector *entry, unsigned int i // Foot info int top = m_y + (m_height - m_info_height - 1 * m_buttonHeight) + 2; int text_start = m_x + 10; - printf("paintDetails: index %d use_playing %d shown %d\n", index, use_playing, m_playing_entry_is_shown); if ((!use_playing) && ((*entry)[index].isdir)) { diff --git a/src/gui/upnpbrowser.h b/src/gui/upnpbrowser.h index 4014ff6aa..ae7dba0f4 100644 --- a/src/gui/upnpbrowser.h +++ b/src/gui/upnpbrowser.h @@ -57,6 +57,7 @@ struct UPnPEntry std::string title; std::string artist; std::string album; + std::string albumArtURI; std::string children; std::vector resources; int preferred; diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 4d176c652..b8fcecf94 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -112,14 +112,14 @@ bool CUserMenu::showUserMenu(int button) int menu_prev = -1; // define classes - CFavorites* tmpFavorites = NULL; - CAudioSelectMenuHandler* tmpAudioSelectMenuHandler = NULL; - CMenuWidget* tmpNVODSelector = NULL; + CFavorites* tmpFavorites = NULL; + CAudioSelectMenuHandler* tmpAudioSelectMenuHandler = NULL; + CMenuWidget* tmpNVODSelector = NULL; CSubChannelSelectMenu subchanselect; CStreamInfo2 * streamInfo = NULL; - CEventListHandler* tmpEventListHandler = NULL; - CEPGplusHandler* tmpEPGplusHandler = NULL; - CEPGDataHandler* tmpEPGDataHandler = NULL; + CEventListHandler* tmpEventListHandler = NULL; + CEPGplusHandler* tmpEPGplusHandler = NULL; + CEPGDataHandler* tmpEPGDataHandler = NULL; CTimerList* Timerlist = NULL; CRCLock *rcLock = NULL; CStreamFeaturesChangeExec *StreamFeaturesChanger = NULL; @@ -144,7 +144,7 @@ bool CUserMenu::showUserMenu(int button) if ( txt.empty() ) txt = g_Locale->getText(caption); - CMenuWidget *menu = new CMenuWidget(txt.c_str() , user_menu[button].menu_icon_def, width); + CMenuWidget *menu = new CMenuWidget(txt.c_str(), user_menu[button].menu_icon_def, width); if (menu == NULL) return 0; @@ -215,7 +215,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_REMOTE; keyhelper.get(&key,&icon,feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_RC_LOCK]].key); //CRCInput::RC_nokey); rcLock = new CRCLock(); - menu_item = new CMenuForwarder(LOCALE_RCLOCK_MENUEADD, true, NULL, rcLock, "-1" , key, icon ); + menu_item = new CMenuForwarder(LOCALE_RCLOCK_MENUEADD, true, NULL, rcLock, "-1", key, icon ); menu->addItem(menu_item, false); break; @@ -224,7 +224,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_EPG_SUPER; tmpEPGplusHandler = new CEPGplusHandler(); keyhelper.get(&key,&icon,CRCInput::RC_green); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EPGPLUS , true, NULL, tmpEPGplusHandler , "-1", key, icon); + menu_item = new CMenuForwarder(LOCALE_EPGMENU_EPGPLUS, true, NULL, tmpEPGplusHandler, "-1", key, icon); menu->addItem(menu_item, false); break; @@ -233,7 +233,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_EPG_LIST; tmpEventListHandler = new CEventListHandler(); keyhelper.get(&key,&icon,CRCInput::RC_red); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTLIST , true, NULL, tmpEventListHandler, "-1", key, icon); + menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTLIST, true, NULL, tmpEventListHandler, "-1", key, icon); menu->addItem(menu_item, false); break; @@ -242,7 +242,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_EPG_INFO; tmpEPGDataHandler = new CEPGDataHandler(); keyhelper.get(&key,&icon,CRCInput::RC_yellow); - menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTINFO , true, NULL, tmpEPGDataHandler , "-1", key, icon); + menu_item = new CMenuForwarder(LOCALE_EPGMENU_EVENTINFO, true, NULL, tmpEPGDataHandler, "-1", key, icon); menu->addItem(menu_item, false); break; @@ -252,7 +252,7 @@ bool CUserMenu::showUserMenu(int button) dummy = g_Sectionsd->getIsScanningActive(); //dummy = sectionsd_scanning; keyhelper.get(&key,&icon); - menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_PAUSESECTIONSD, &dummy, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this , key, icon ); + menu_item = new CMenuOptionChooser(LOCALE_MAINMENU_PAUSESECTIONSD, &dummy, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, key, icon ); menu->addItem(menu_item, false); menu_items++; keyhelper.get(&key,&icon); @@ -352,7 +352,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_PLUGIN_TYPES; neutrino_msg_t d_key = g_PluginList->getKey(count); //printf("[neutrino usermenu] plugin %d, set key %d...\n", count, g_PluginList->getKey(count)); - StreamFeaturesChanger = new CStreamFeaturesChangeExec(); + StreamFeaturesChanger = new CStreamFeaturesChangeExec(); keyhelper.get(&key,&icon, d_key); menu_item = new CMenuForwarder(g_PluginList->getName(count), true, NULL, StreamFeaturesChanger, id, key, icon); menu->addItem(menu_item, 0); @@ -366,7 +366,7 @@ bool CUserMenu::showUserMenu(int button) menu_items++; menu_prev = SNeutrinoSettings::ITEM_VTXT; keyhelper.get(&key,&icon, feat_key[g_settings.personalize[SNeutrinoSettings::P_FEAT_KEY_VTXT]].key); //CRCInput::RC_blue - StreamFeaturesChanger = new CStreamFeaturesChangeExec(); + StreamFeaturesChanger = new CStreamFeaturesChangeExec(); menu_item = new CMenuForwarder(LOCALE_USERMENU_ITEM_VTXT, true, NULL, StreamFeaturesChanger, "teletext", key, icon); menu->addItem(menu_item, 0); break; @@ -375,7 +375,7 @@ bool CUserMenu::showUserMenu(int button) menu_prev = SNeutrinoSettings::ITEM_IMAGEINFO; imageinfo = new CImageInfo(); keyhelper.get(&key,&icon); - menu->addItem(new CMenuForwarder(LOCALE_SERVICEMENU_IMAGEINFO, true, NULL, imageinfo, NULL, key, icon ), false); + menu->addItem(new CMenuForwarder(LOCALE_SERVICEMENU_IMAGEINFO, true, NULL, imageinfo, NULL, key, icon ), false); break; case SNeutrinoSettings::ITEM_BOXINFO: menu_items++; @@ -452,25 +452,25 @@ bool CUserMenu::showUserMenu(int button) user_menu[button].selected = menu->getSelected(); // clear the heap - if (tmpFavorites) delete tmpFavorites; - if (tmpAudioSelectMenuHandler) delete tmpAudioSelectMenuHandler; - if (tmpNVODSelector) delete tmpNVODSelector; - if (streamInfo) delete streamInfo; - if (tmpEventListHandler) delete tmpEventListHandler; - if (tmpEPGplusHandler) delete tmpEPGplusHandler; - if (tmpEPGDataHandler) delete tmpEPGDataHandler; - if (Timerlist) delete Timerlist; - if (rcLock) delete rcLock; - if (StreamFeaturesChanger) delete StreamFeaturesChanger; - if (imageinfo) delete imageinfo; - if (boxinfo) delete boxinfo; - if (games) delete games; + if (tmpFavorites) delete tmpFavorites; + if (tmpAudioSelectMenuHandler) delete tmpAudioSelectMenuHandler; + if (tmpNVODSelector) delete tmpNVODSelector; + if (streamInfo) delete streamInfo; + if (tmpEventListHandler) delete tmpEventListHandler; + if (tmpEPGplusHandler) delete tmpEPGplusHandler; + if (tmpEPGDataHandler) delete tmpEPGDataHandler; + if (Timerlist) delete Timerlist; + if (rcLock) delete rcLock; + if (StreamFeaturesChanger) delete StreamFeaturesChanger; + if (imageinfo) delete imageinfo; + if (boxinfo) delete boxinfo; + if (games) delete games; #if 0 - if (scripts) delete scripts; - if (tools) delete tools; + if (tools) delete tools; + if (scripts) delete scripts; #endif - if (lua) delete lua; - if (menu) delete menu; + if (lua) delete lua; + if (menu) delete menu; InfoClock->enableInfoClock(true); diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index 0b1c5ee53..cdd304da8 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -57,6 +57,8 @@ #include #include +#include + extern cVideo *videoDecoder; #ifdef ENABLE_PIP extern cVideo *pipDecoder; @@ -237,7 +239,9 @@ CMenuOptionChooser::keyval_ext VIDEOMENU_VIDEOMODE_OPTIONS[VIDEOMENU_VIDEOMODE_O { VIDEO_STD_1080I60, NONEXISTANT_LOCALE, "1080i 60Hz" }, #ifdef BOXMODEL_APOLLO /* TODO: fix this crap */ - { VIDEO_STD_1080P60, NONEXISTANT_LOCALE, "1080p 60Hz" }, + { VIDEO_STD_1080P60, NONEXISTANT_LOCALE, "1080p 60Hz" }, + { VIDEO_STD_1080P2397, NONEXISTANT_LOCALE, "1080p 23.97Hz"}, + { VIDEO_STD_1080P2997, NONEXISTANT_LOCALE, "1080p 29.97Hz"}, #endif { VIDEO_STD_AUTO, NONEXISTANT_LOCALE, "Auto" } }; @@ -428,6 +432,10 @@ int CVideoSettings::showVideoSetup() videosetup->addItem(bcont); videosetup->addItem(ccont); videosetup->addItem(scont); + + CMenuOptionChooser * sd = new CMenuOptionChooser(LOCALE_VIDEOMENU_SDOSD, &g_settings.enable_sd_osd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this); + sd->setHint("", LOCALE_MENU_HINT_VIDEO_SDOSD); + videosetup->addItem(sd); } #endif #ifdef ENABLE_PIP @@ -484,6 +492,7 @@ void CVideoSettings::setVideoSettings() changeNotify(LOCALE_VIDEOMENU_BRIGHTNESS, NULL); changeNotify(LOCALE_VIDEOMENU_CONTRAST, NULL); changeNotify(LOCALE_VIDEOMENU_SATURATION, NULL); + changeNotify(LOCALE_VIDEOMENU_SDOSD, NULL); #endif #ifdef ENABLE_PIP pipDecoder->Pig(g_settings.pip_x, g_settings.pip_y, g_settings.pip_width, g_settings.pip_height, frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); @@ -566,6 +575,14 @@ bool CVideoSettings::changeNotify(const neutrino_locale_t OptionName, void * /* { videoDecoder->SetControl(VIDEO_CONTROL_SATURATION, g_settings.saturation*3); } + else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_SDOSD)) + { + int val = g_settings.enable_sd_osd; + printf("SD OSD enable: %d\n", val); + int fd = CFrameBuffer::getInstance()->getFileHandle(); + if (ioctl(fd, FBIO_SCALE_SD_OSD, &val)) + perror("FBIO_SCALE_SD_OSD"); + } #endif #if 0 else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_SHARPNESS)) diff --git a/src/gui/widget/Makefile.am b/src/gui/widget/Makefile.am index 42c3bb830..8e345c9d7 100644 --- a/src/gui/widget/Makefile.am +++ b/src/gui/widget/Makefile.am @@ -27,6 +27,7 @@ libneutrino_gui_widget_a_SOURCES = \ messagebox.cpp \ mountchooser.cpp \ msgbox.cpp \ + shellwindow.cpp \ stringinput.cpp \ stringinput_ext.cpp \ textbox.cpp diff --git a/src/gui/widget/icons.h b/src/gui/widget/icons.h index 1461a7fcc..1f7115bf6 100644 --- a/src/gui/widget/icons.h +++ b/src/gui/widget/icons.h @@ -248,9 +248,15 @@ #define NEUTRINO_ICON_HINT_RESTORE "hint_restore" #define NEUTRINO_ICON_HINT_FACTORY "hint_factory" +/* opkg manager */ +#define NEUTRINO_ICON_CHECKMARK "checkmark" +#define NEUTRINO_ICON_WARNING "warning" + /* misc */ #define NEUTRINO_ICON_HINT_YTPLAY "hint_ytplay" +#define NEUTRINO_ICON_EPG "epg" + #define NEUTRINO_ICON_VARPATH "/var/share/tuxbox/neutrino/icons/" //alternatively path for user-defined icons #endif /* __gui_widget_icons_h__ */ diff --git a/src/gui/widget/keychooser.cpp b/src/gui/widget/keychooser.cpp index ed146b8fa..f11a0d28b 100644 --- a/src/gui/widget/keychooser.cpp +++ b/src/gui/widget/keychooser.cpp @@ -119,6 +119,7 @@ int CKeyChooserItem::exec(CMenuTarget* parent, const std::string &) paint(); g_RCInput->clearRCMsg(); + g_RCInput->setLongPressAny(true); timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_MENU] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings ::TIMING_MENU]); @@ -138,6 +139,7 @@ int CKeyChooserItem::exec(CMenuTarget* parent, const std::string &) goto get_Message; } + g_RCInput->setLongPressAny(false); hide(); return res; } diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index b026f679f..430a6d55d 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -139,24 +139,13 @@ void CMenuItem::initItemColors(const bool select_mode) } } -void CMenuItem::paintItemBackground (const bool select_mode, const int &item_height) -{ - CFrameBuffer *frameBuffer = CFrameBuffer::getInstance(); - //FIXME what select_mode change here ?? - if(select_mode) - frameBuffer->paintBoxRel(x, y, dx, item_height, item_bgcolor, RADIUS_LARGE); - else - frameBuffer->paintBoxRel(x, y, dx, item_height, item_bgcolor, RADIUS_LARGE); -} - void CMenuItem::paintItemCaption(const bool select_mode, const int &item_height, const char * left_text, const char * right_text, const fb_pixel_t right_bgcol) { if (select_mode) { - char str[256]; - if (right_text != NULL) { + char str[256]; snprintf(str, 255, "%s %s", left_text, right_text); CVFD::getInstance()->showMenuText(0, str, -1, true); } @@ -192,7 +181,7 @@ void CMenuItem::paintItemCaption(const bool select_mode, const int &item_height, right_bg_col = COL_MENUCONTENTINACTIVE_TEXT; right_frame_col = COL_MENUCONTENTINACTIVE_TEXT; } - CComponentsShapeSquare col(stringstartposOption, y + 2, dx - stringstartposOption + x - 2, item_height - 4, false, right_frame_col, right_bg_col); + CComponentsShapeSquare col(stringstartposOption, y + 2, dx - stringstartposOption + x - 2, item_height - 4, NULL, false, right_frame_col, right_bg_col); col.setFrameThickness(3); col.setCorner(RADIUS_LARGE); col.paint(false); @@ -210,7 +199,7 @@ void CMenuItem::prepareItem(const bool select_mode, const int &item_height) initItemColors(select_mode); //paint item background - paintItemBackground(select_mode, item_height); + CFrameBuffer::getInstance()->paintBoxRel(x, y, dx, item_height, item_bgcolor, RADIUS_LARGE); } void CMenuItem::paintItemSlider( const bool select_mode, const int &item_height, const int &optionvalue, const int &factor, const char * left_text, const char * right_text) @@ -346,6 +335,7 @@ CMenuWidget::CMenuWidget() from_wizard = false; fade = true; sb_width = 0; + sb_height = 0; savescreen = false; background = NULL; preselected = -1; @@ -419,6 +409,9 @@ void CMenuWidget::Init(const std::string & Icon, const int mwidth, const mn_widg has_hints = false; hint_painted = false; hint_height = 0; + fbutton_count = 0; + fbutton_labels = NULL; + fbutton_height = 0; } void CMenuWidget::move(int xoff, int yoff) @@ -520,6 +513,9 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) int pos = 0; if (selected > 0 && selected < (int)items.size()) pos = selected; + else if (selected >= (int)items.size()) + selected = -1; + exit_pressed = false; frameBuffer->Lock(); @@ -880,7 +876,7 @@ void CMenuWidget::calcSize() for (unsigned int i= 0; i< items.size(); i++) { int item_height=items[i]->getHeight(); heightCurrPage+=item_height; - if(heightCurrPage > (height-hheight)) { + if(heightCurrPage > (height-hheight-fbutton_height)) { page_start.push_back(i); total_pages++; heightCurrPage=item_height; @@ -912,13 +908,14 @@ void CMenuWidget::calcSize() width = frameBuffer->getScreenWidth(); // shrink menu if less items - if(hheight+itemHeightTotal < height) - height=hheight+itemHeightTotal; + if (hheight + itemHeightTotal + fbutton_height < height) + height = hheight + itemHeightTotal + fbutton_height; - //scrollbar width + //scrollbar sb_width=0; if(total_pages > 1) sb_width=15; + sb_height=itemHeightTotal; full_width = /*ConnectLineBox_Width+*/width+sb_width+SHADOW_OFFSET; full_height = height+RADIUS_LARGE+SHADOW_OFFSET*2 /*+hint_height+INFO_BOX_Y_OFFSET*/; @@ -950,11 +947,13 @@ void CMenuWidget::paint() // paint body shadow frameBuffer->paintBoxRel(x+SHADOW_OFFSET, y + hheight + SHADOW_OFFSET, width + sb_width, height - hheight + RADIUS_LARGE, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); // paint body background - frameBuffer->paintBoxRel(x ,y+hheight, width + sb_width, height-hheight + RADIUS_LARGE ,COL_MENUCONTENT_PLUS_0 ,RADIUS_LARGE, CORNER_BOTTOM); + frameBuffer->paintBoxRel(x, y + hheight, width + sb_width, height - hheight + RADIUS_LARGE - fbutton_height, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, (fbutton_count ? 0 /*CORNER_NONE*/ : CORNER_BOTTOM)); item_start_y = y+hheight; paintItems(); washidden = false; + if (fbutton_count) + ::paintButtons(x, y + height + RADIUS_LARGE - fbutton_height, width + sb_width, fbutton_count, fbutton_labels, width, fbutton_height); } void CMenuWidget::setMenuPos(const int& menu_width) @@ -1013,12 +1012,11 @@ void CMenuWidget::paintItems() // Scrollbar if(total_pages>1) { - int item_height=height-(item_start_y-y); - frameBuffer->paintBoxRel(x+ width,item_start_y, 15, item_height, COL_MENUCONTENT_PLUS_1, RADIUS_MIN); - frameBuffer->paintBoxRel(x+ width +2, item_start_y+ 2+ current_page*(item_height-4)/total_pages, 11, (item_height-4)/total_pages, COL_MENUCONTENT_PLUS_3, RADIUS_MIN); + frameBuffer->paintBoxRel(x+ width,item_start_y, sb_width, sb_height, COL_MENUCONTENT_PLUS_1, RADIUS_MIN); + frameBuffer->paintBoxRel(x+ width +2, item_start_y+ 2+ current_page*(sb_height-4)/total_pages, sb_width-4, (sb_height-4)/total_pages, COL_MENUCONTENT_PLUS_3, RADIUS_MIN); /* background of menu items, paint every time because different items can have * different height and this might leave artifacts otherwise after changing pages */ - frameBuffer->paintBoxRel(x,item_start_y, width,item_height, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x,item_start_y, width, sb_height, COL_MENUCONTENT_PLUS_0); } int ypos=item_start_y; for (int count = 0; count < (int)items.size(); count++) @@ -1194,53 +1192,78 @@ void CMenuWidget::addKey(neutrino_msg_t key, CMenuTarget *menue, const std::stri keyActionMap[key].action = action; } -//------------------------------------------------------------------------------------------------------------------------------- -CMenuOptionNumberChooser::CMenuOptionNumberChooser(const neutrino_locale_t Name, int * const OptionValue, const bool Active, const int min_value, const int max_value, CChangeObserver * const Observ, const int print_offset, const int special_value, const neutrino_locale_t special_value_name, bool sliderOn) +void CMenuWidget::setFooter(const struct button_label *_fbutton_labels, const int _fbutton_count, bool repaint) { - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - name = Name; - active = Active; - optionValue = OptionValue; - - lower_bound = min_value; - upper_bound = max_value; - - display_offset = print_offset; - - localized_value = special_value; - localized_value_name = special_value_name; - - nameString = ""; - numberFormat = "%d"; - numberFormatFunction = NULL; - observ = Observ; - slider_on = sliderOn; - - numeric_input = false; + fbutton_count = _fbutton_count; + fbutton_labels = _fbutton_labels; + fbutton_height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight() + 6; // init min buttonbar height + int h = 0, w = 0; + for (int i = 0; i < fbutton_count; i++) { + frameBuffer->getIconSize(fbutton_labels[i].button, &w, &h); + fbutton_height = std::max(fbutton_height, h + 4); + } + if (repaint) + paint(); } -CMenuOptionNumberChooser::CMenuOptionNumberChooser(const std::string &Name, int * const OptionValue, const bool Active, const int min_value, const int max_value, CChangeObserver * const Observ, const int print_offset, const int special_value, const neutrino_locale_t special_value_name, bool sliderOn) + +//------------------------------------------------------------------------------------------------------------------------------- +CMenuOptionNumberChooser::CMenuOptionNumberChooser( const neutrino_locale_t Name, + int * const OptionValue, + const bool Active, + const int min_value, + const int max_value, + CChangeObserver * const Observ, + const int print_offset, + const int special_value, + const neutrino_locale_t special_value_name, + bool sliderOn) { - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - name = NONEXISTANT_LOCALE; - active = Active; - optionValue = OptionValue; + initMenuOptionNumberChooser("", Name, OptionValue, Active, min_value, max_value, Observ, print_offset, special_value, special_value_name, sliderOn); +} - lower_bound = min_value; - upper_bound = max_value; +CMenuOptionNumberChooser::CMenuOptionNumberChooser( const std::string &Name, + int * const OptionValue, + const bool Active, + const int min_value, + const int max_value, + CChangeObserver * const Observ, + const int print_offset, + const int special_value, + const neutrino_locale_t special_value_name, + bool sliderOn) +{ + initMenuOptionNumberChooser(Name, NONEXISTANT_LOCALE, OptionValue, Active, min_value, max_value, Observ, print_offset, special_value, special_value_name, sliderOn); +} - display_offset = print_offset; +void CMenuOptionNumberChooser::initMenuOptionNumberChooser( const std::string &s_name, + const neutrino_locale_t l_name, + int * const OptionValue, + const bool Active, + const int min_value, + const int max_value, + CChangeObserver * const Observ, + const int print_offset, + const int special_value, + const neutrino_locale_t special_value_name, + bool sliderOn) +{ + height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); + nameString = s_name; + name = l_name; + optionValue = OptionValue; + active = Active; + lower_bound = min_value; + upper_bound = max_value; + observ = Observ; + display_offset = print_offset; + localized_value = special_value; + localized_value_name = special_value_name; + slider_on = sliderOn; - localized_value = special_value; - localized_value_name = special_value_name; - - nameString = Name; - numberFormat = "%d"; - numberFormatFunction = NULL; - observ = Observ; - slider_on = sliderOn; - - numeric_input = false; + numberFormat = "%d"; + numberFormatFunction = NULL; + numeric_input = false; } int CMenuOptionNumberChooser::exec(CMenuTarget*) @@ -1357,126 +1380,171 @@ int CMenuOptionNumberChooser::getWidth(void) //------------------------------------------------------------------------------------------------------------------------------- -CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown, bool OptionsSort) +CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, + int * const OptionValue, + const struct keyval * const Options, + const unsigned Number_Of_Options, + const bool Active, + CChangeObserver * const Observ, + const neutrino_msg_t DirectKey, + const std::string & IconName, + bool Pulldown, + bool OptionsSort) { - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - nameString = ""; - name = OptionName; - active = Active; - optionValue = OptionValue; + initVarOptionChooser("", OptionName, OptionValue, Active, Observ, DirectKey, IconName, Pulldown, OptionsSort); + number_of_options = Number_Of_Options; - observ = Observ; - directKey = DirectKey; - iconName = IconName; - pulldown = Pulldown; - optionsSort = OptionsSort; + for (unsigned int i = 0; i < number_of_options; i++) { struct keyval_ext opt; - opt.key = Options[i].key; - opt.value = Options[i].value; - opt.valname = NULL; + opt = Options[i]; options.push_back(opt); } } -CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, int * const OptionValue, const struct keyval * const Options, const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown, bool OptionsSort) +CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, + int * const OptionValue, + const struct keyval * const Options, + const unsigned Number_Of_Options, + const bool Active, + CChangeObserver * const Observ, + neutrino_msg_t DirectKey, + const std::string & IconName, + bool Pulldown, + bool OptionsSort) { - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - nameString = OptionName; - name = NONEXISTANT_LOCALE; - active = Active; - optionValue = OptionValue; + initVarOptionChooser(OptionName, NONEXISTANT_LOCALE, OptionValue, Active, Observ, DirectKey, IconName, Pulldown, OptionsSort); + number_of_options = Number_Of_Options; - observ = Observ; - directKey = DirectKey; - iconName = IconName; - pulldown = Pulldown; - optionsSort = OptionsSort; + for (unsigned int i = 0; i < number_of_options; i++) { struct keyval_ext opt; - opt.key = Options[i].key; - opt.value = Options[i].value; - opt.valname = NULL; + opt = Options[i]; options.push_back(opt); } } -CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, const struct keyval_ext * const Options, - const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ, - const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown, bool OptionsSort) +CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, + int * const OptionValue, + const struct keyval_ext * const Options, + const unsigned Number_Of_Options, + const bool Active, + CChangeObserver * const Observ, + const neutrino_msg_t DirectKey, + const std::string & IconName, + bool Pulldown, + bool OptionsSort) { - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - nameString = ""; - name = OptionName; - active = Active; - optionValue = OptionValue; + initVarOptionChooser("", OptionName, OptionValue, Active, Observ, DirectKey, IconName, Pulldown, OptionsSort); + number_of_options = Number_Of_Options; - observ = Observ; - directKey = DirectKey; - iconName = IconName; - pulldown = Pulldown; - optionsSort = OptionsSort; + for (unsigned int i = 0; i < number_of_options; i++) options.push_back(Options[i]); } -CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, int * const OptionValue, const struct keyval_ext * const Options, - const unsigned Number_Of_Options, const bool Active, CChangeObserver * const Observ, - const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown, bool OptionsSort) +CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, + int * const OptionValue, + const struct keyval_ext * const Options, + const unsigned Number_Of_Options, + const bool Active, + CChangeObserver * const Observ, + const neutrino_msg_t DirectKey, + const std::string & IconName, + bool Pulldown, + bool OptionsSort) { - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - nameString = OptionName; - name = NONEXISTANT_LOCALE; - active = Active; - optionValue = OptionValue; + initVarOptionChooser(OptionName, NONEXISTANT_LOCALE, OptionValue, Active, Observ, DirectKey, IconName, Pulldown, OptionsSort); + number_of_options = Number_Of_Options; - observ = Observ; - directKey = DirectKey; - iconName = IconName; - pulldown = Pulldown; - optionsSort = OptionsSort; + for (unsigned int i = 0; i < number_of_options; i++) options.push_back(Options[i]); } -CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, int * const OptionValue, std::vector &Options, const bool Active, CChangeObserver * const Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown, bool OptionsSort) +CMenuOptionChooser::CMenuOptionChooser(const neutrino_locale_t OptionName, + int * const OptionValue, + std::vector &Options, + const bool Active, + CChangeObserver * const Observ, + const neutrino_msg_t DirectKey, + const std::string & IconName, + bool Pulldown, + bool OptionsSort) { - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - nameString = ""; - name = OptionName; - active = Active; - optionValue = OptionValue; + initVarOptionChooser("", OptionName, OptionValue, Active, Observ, DirectKey, IconName, Pulldown, OptionsSort); + options = Options; - observ = Observ; - directKey = DirectKey; - iconName = IconName; - pulldown = Pulldown; - optionsSort = OptionsSort; } -CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, int * const OptionValue, std::vector &Options, const bool Active, CChangeObserver * const Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown, bool OptionsSort) +CMenuOptionChooser::CMenuOptionChooser(const std::string &OptionName, + int * const OptionValue, + std::vector &Options, + const bool Active, + CChangeObserver * const Observ, + const neutrino_msg_t DirectKey, + const std::string & IconName, + bool Pulldown, + bool OptionsSort) { - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - nameString = OptionName; - name = NONEXISTANT_LOCALE; - active = Active; - optionValue = OptionValue; + initVarOptionChooser(OptionName, NONEXISTANT_LOCALE, OptionValue, Active, Observ, DirectKey, IconName, Pulldown, OptionsSort); + options = Options; - observ = Observ; - directKey = DirectKey; - iconName = IconName; - pulldown = Pulldown; - optionsSort = OptionsSort; +} + +void CMenuOptionChooser::initVarOptionChooser( const std::string &OptionName, + const neutrino_locale_t Name, + int * const OptionValue, + const bool Active, + CChangeObserver * const Observ, + neutrino_msg_t DirectKey, + const std::string & IconName, + bool Pulldown, + bool OptionsSort) +{ + height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); + nameString = OptionName; + name = Name; + optionValue = OptionValue; + active = Active; + observ = Observ; + directKey = DirectKey; + iconName = IconName; + pulldown = Pulldown; + optionsSort = OptionsSort; } CMenuOptionChooser::~CMenuOptionChooser() { - options.clear(); clearChooserOptions(); } +void CMenuOptionChooser::setOptions(const struct keyval * const Options, const unsigned Number_Of_Options) +{ + options.clear(); + number_of_options = Number_Of_Options; + for (unsigned int i = 0; i < number_of_options; i++) + { + struct keyval_ext opt; + opt = Options[i]; + options.push_back(opt); + } + if (used && x != -1) + paint(false); +} + +void CMenuOptionChooser::setOptions(const struct keyval_ext * const Options, const unsigned Number_Of_Options) +{ + options.clear(); + number_of_options = Number_Of_Options; + for (unsigned int i = 0; i < number_of_options; i++) + options.push_back(Options[i]); + if (used && x != -1) + paint(false); +} + void CMenuOptionChooser::setOption(const int newvalue) { *optionValue = newvalue; @@ -1650,30 +1718,44 @@ int CMenuOptionChooser::getWidth(void) //------------------------------------------------------------------------------------------------------------------------------- -CMenuOptionStringChooser::CMenuOptionStringChooser(const neutrino_locale_t OptionName, std::string* OptionValue, bool Active, CChangeObserver* Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown) +CMenuOptionStringChooser::CMenuOptionStringChooser(const neutrino_locale_t OptionName, + std::string* OptionValue, + bool Active, CChangeObserver* Observ, + const neutrino_msg_t DirectKey, + const std::string & IconName, + bool Pulldown) { - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - nameString = ""; - name = OptionName; - active = Active; - optionValueString = OptionValue; - observ = Observ; - directKey = DirectKey; - iconName = IconName; - pulldown = Pulldown; + initVarMenuOptionStringChooser("", OptionName, OptionValue, Active, Observ, DirectKey, IconName, Pulldown); } -CMenuOptionStringChooser::CMenuOptionStringChooser(const std::string &OptionName, std::string* OptionValue, bool Active, CChangeObserver* Observ, const neutrino_msg_t DirectKey, const std::string & IconName, bool Pulldown) +CMenuOptionStringChooser::CMenuOptionStringChooser(const std::string &OptionName, + std::string* OptionValue, + bool Active, CChangeObserver* Observ, + const neutrino_msg_t DirectKey, + const std::string & IconName, + bool Pulldown) { - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - nameString = OptionName; - name = NONEXISTANT_LOCALE; - active = Active; - optionValueString = OptionValue; - observ = Observ; - directKey = DirectKey; - iconName = IconName; - pulldown = Pulldown; + initVarMenuOptionStringChooser(OptionName, NONEXISTANT_LOCALE, OptionValue, Active, Observ, DirectKey, IconName, Pulldown); +} + +void CMenuOptionStringChooser::initVarMenuOptionStringChooser( const std::string &string_Name, + const neutrino_locale_t locale_Name, + std::string* OptionValue, + bool Active, + CChangeObserver* Observ, + const neutrino_msg_t DirectKey, + const std::string & IconName, + bool Pulldown) +{ + height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); + nameString = string_Name; + name = locale_Name; + active = Active; + optionValueString = OptionValue; + observ = Observ; + directKey = DirectKey; + iconName = IconName; + pulldown = Pulldown; } @@ -1769,107 +1851,81 @@ int CMenuOptionStringChooser::paint( bool selected ) //------------------------------------------------------------------------------------------------------------------------------- -CMenuOptionLanguageChooser::CMenuOptionLanguageChooser(char* OptionValue, CChangeObserver* Observ, const char * const IconName) +CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, + const bool Active, + const std::string &Option, + CMenuTarget* Target, + const char * const ActionKey, + neutrino_msg_t DirectKey, + const char * const IconName, + const char * const IconName_Info_right, + bool IsStatic) { - height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - optionValue = OptionValue; - observ = Observ; - - directKey = CRCInput::RC_nokey; - iconName = IconName ? IconName : ""; + initVarMenuForwarder("", Text, Active, &Option, NULL, Target, ActionKey, DirectKey, IconName, IconName_Info_right, IsStatic); } - -CMenuOptionLanguageChooser::~CMenuOptionLanguageChooser() +CMenuForwarder::CMenuForwarder(const std::string& Text, + const bool Active, + const std::string &Option, + CMenuTarget* Target, + const char * const ActionKey, + neutrino_msg_t DirectKey, + const char * const IconName, + const char * const IconName_Info_right, + bool IsStatic) { + initVarMenuForwarder(Text, NONEXISTANT_LOCALE, Active, &Option, NULL, Target, ActionKey, DirectKey, IconName, IconName_Info_right, IsStatic); } -int CMenuOptionLanguageChooser::exec(CMenuTarget*) +CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, + const bool Active, + const char * const Option, + CMenuTarget* Target, + const char * const ActionKey, + neutrino_msg_t DirectKey, + const char * const IconName, + const char * const IconName_Info_right, + bool IsStatic) { - g_settings.language = optionValue; - if(observ) - observ->changeNotify(LOCALE_LANGUAGESETUP_SELECT, (void *) optionValue.c_str()); - return menu_return::RETURN_EXIT; + initVarMenuForwarder("", Text, Active, NULL, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right, IsStatic); } -int CMenuOptionLanguageChooser::paint( bool selected ) +CMenuForwarder::CMenuForwarder(const std::string& Text, + const bool Active, + const char * const Option, + CMenuTarget* Target, + const char * const ActionKey, + neutrino_msg_t DirectKey, + const char * const IconName, + const char * const IconName_Info_right, + bool IsStatic) { - active = true; - - //paint item - prepareItem(selected, height); - - paintItemButton(selected, height, iconName); - - //convert first letter to large - std::string s_optionValue = optionValue; - if(!s_optionValue.empty()) - s_optionValue[0] = (char)toupper(s_optionValue[0]); - //paint text - paintItemCaption(selected, height , s_optionValue.c_str()); - - return y+height; + initVarMenuForwarder(Text, NONEXISTANT_LOCALE, Active, NULL, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right, IsStatic); } -//------------------------------------------------------------------------------------------------------------------------------- -CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) +void CMenuForwarder::initVarMenuForwarder( const std::string& string_text, + const neutrino_locale_t& locale_text, + const bool Active, + const std::string * Option_string, + const char * const Option_cstring, + CMenuTarget* Target, + const char * const ActionKey, + neutrino_msg_t DirectKey, + const char * const IconName, + const char * const IconName_Info_right, + bool IsStatic) { - option_string = &Option; - option = NULL; - name = Text; - nameString = ""; - active = Active; - jumpTarget = Target; - actionKey = ActionKey ? ActionKey : ""; - directKey = DirectKey; - iconName = IconName ? IconName : ""; - iconName_Info_right = IconName_Info_right ? IconName_Info_right : ""; - isStatic = IsStatic; -} - -CMenuForwarder::CMenuForwarder(const std::string& Text, const bool Active, const std::string &Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) -{ - option_string = &Option; - option = NULL; - name = NONEXISTANT_LOCALE; - nameString = Text; - active = Active; - jumpTarget = Target; - actionKey = ActionKey ? ActionKey : ""; - directKey = DirectKey; - iconName = IconName ? IconName : ""; - iconName_Info_right = IconName_Info_right ? IconName_Info_right : ""; - isStatic = IsStatic; -} - -CMenuForwarder::CMenuForwarder(const neutrino_locale_t Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) -{ - option_string = NULL; - option = Option; - name = Text; - nameString = ""; - active = Active; - jumpTarget = Target; - actionKey = ActionKey ? ActionKey : ""; - directKey = DirectKey; - iconName = IconName ? IconName : ""; - iconName_Info_right = IconName_Info_right ? IconName_Info_right : ""; - isStatic = IsStatic; -} - -CMenuForwarder::CMenuForwarder(const std::string& Text, const bool Active, const char * const Option, CMenuTarget* Target, const char * const ActionKey, neutrino_msg_t DirectKey, const char * const IconName, const char * const IconName_Info_right, bool IsStatic) -{ - option_string = NULL; - option = Option; - name = NONEXISTANT_LOCALE; - nameString = Text; - active = Active; - jumpTarget = Target; - actionKey = ActionKey ? ActionKey : ""; - directKey = DirectKey; - iconName = IconName ? IconName : ""; - iconName_Info_right = IconName_Info_right ? IconName_Info_right : ""; - isStatic = IsStatic; + name = locale_text; + nameString = string_text; + active = Active; + option_string = Option_string; + option = Option_cstring; + jumpTarget = Target; + actionKey = ActionKey ? ActionKey : ""; + directKey = DirectKey; + iconName = IconName ? IconName : ""; + iconName_Info_right = IconName_Info_right ? IconName_Info_right : ""; + isStatic = IsStatic; } void CMenuForwarder::setName(const std::string& t) @@ -1971,22 +2027,23 @@ int CMenuForwarder::paint(bool selected) //------------------------------------------------------------------------------------------------------------------------------- CMenuSeparator::CMenuSeparator(const int Type, const neutrino_locale_t Text, bool IsStatic) { - directKey = CRCInput::RC_nokey; - iconName = ""; - type = Type; - name = Text; - nameString = ""; - isStatic = IsStatic; + initVarMenuSeparator(Type, "", Text, IsStatic); } -CMenuSeparator::CMenuSeparator(const int Type, const std::string Text, bool IsStatic) +CMenuSeparator::CMenuSeparator(const int Type, const std::string& Text, bool IsStatic) { + initVarMenuSeparator(Type, Text, NONEXISTANT_LOCALE, IsStatic); +} + +void CMenuSeparator::initVarMenuSeparator(const int Type, const std::string& string_Text, const neutrino_locale_t locale_Text, bool IsStatic) +{ + type = Type; + name = locale_Text; + nameString = string_Text; + isStatic = IsStatic; + directKey = CRCInput::RC_nokey; iconName = ""; - type = Type; - name = NONEXISTANT_LOCALE; - nameString = Text; - isStatic = IsStatic; } int CMenuSeparator::getHeight(void) const diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 420c312a2..21e79f159 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -156,8 +157,6 @@ class CMenuItem virtual void paintItemButton(const bool select_mode, const int &item_height, const std::string& icon_Name = NEUTRINO_ICON_BUTTON_RIGHT); - virtual void paintItemBackground (const bool select_mode, const int &item_height); - virtual void prepareItem(const bool select_mode, const int &item_height); virtual void setItemButton(const std::string& icon_Name, const bool is_select_button = false); @@ -177,7 +176,12 @@ class CMenuItem class CMenuSeparator : public CMenuItem { + private: int type; + void initVarMenuSeparator( const int Type, + const std::string& string_Text, + const neutrino_locale_t locale_Text, + bool IsStatic); public: @@ -194,7 +198,7 @@ class CMenuSeparator : public CMenuItem CMenuSeparator(const int Type = 0, const neutrino_locale_t Text = NONEXISTANT_LOCALE, bool IsStatic = false); - CMenuSeparator(const int Type, const std::string Text, bool IsStatic = false); + CMenuSeparator(const int Type, const std::string& Text, bool IsStatic = false); virtual ~CMenuSeparator(){} int paint(bool selected=false); @@ -216,20 +220,60 @@ class CMenuForwarder : public CMenuItem virtual std::string getOption(void); + void initVarMenuForwarder( const std::string& string_text, + const neutrino_locale_t& locale_text, + const bool Active, + const std::string * Option_string, + const char * const Option_cstring, + CMenuTarget* Target, + const char * const ActionKey, + neutrino_msg_t DirectKey, + const char * const IconName, + const char * const IconName_Info_right, + bool IsStatic); + public: - CMenuForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, - CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, - const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false); - CMenuForwarder(const std::string & Text, const bool Active, const std::string &Option, - CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, - const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false); - CMenuForwarder(const neutrino_locale_t Text, const bool Active = true, const char * const Option=NULL, - CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, - const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false); - CMenuForwarder(const std::string & Text, const bool Active = true, const char * const Option=NULL, - CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, - const char * const IconName = NULL, const char * const IconName_Info_right = NULL, bool IsStatic = false); + CMenuForwarder( const neutrino_locale_t Text, + const bool Active, + const std::string &Option, + CMenuTarget* Target=NULL, + const char * const ActionKey = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, + const char * const IconName_Info_right = NULL, + bool IsStatic = false); + + CMenuForwarder( const std::string& Text, + const bool Active, + const std::string &Option, + CMenuTarget* Target=NULL, + const char * const ActionKey = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, + const char * const IconName_Info_right = NULL, + bool IsStatic = false); + + CMenuForwarder( const neutrino_locale_t Text, + const bool Active = true, + const char * const Option=NULL, + CMenuTarget* Target=NULL, + const char * const ActionKey = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, + const char * const IconName_Info_right = NULL, + bool IsStatic = false); + + CMenuForwarder( const std::string& Text, + const bool Active = true, + const char * const Option=NULL, + CMenuTarget* Target=NULL, + const char * const ActionKey = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, + const char * const IconName_Info_right = NULL, + bool IsStatic = false); + virtual ~CMenuForwarder(){} @@ -238,7 +282,7 @@ class CMenuForwarder : public CMenuItem int getWidth(void); neutrino_locale_t getTextLocale() const {return name;} CMenuTarget* getTarget() const {return jumpTarget;} - std::string getActionKey(){return actionKey;} + const char *getActionKey(){return actionKey.c_str();} int exec(CMenuTarget* parent); bool isSelectable(void) const { return active; } @@ -251,21 +295,44 @@ class CMenuForwarder : public CMenuItem class CMenuDForwarder : public CMenuForwarder { public: - CMenuDForwarder(const neutrino_locale_t Text, const bool Active, const std::string &Option, - CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, - const char * const IconName = NULL, const char * const IconName_Info_right = NULL) + CMenuDForwarder(const neutrino_locale_t Text, + const bool Active, + const std::string &Option, + CMenuTarget* Target=NULL, + const char * const ActionKey = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, + const char * const IconName_Info_right = NULL) : CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { }; - CMenuDForwarder(const std::string & Text, const bool Active, const std::string &Option, - CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, - const char * const IconName = NULL, const char * const IconName_Info_right = NULL) + + CMenuDForwarder(const std::string& Text, + const bool Active, + const std::string &Option, + CMenuTarget* Target=NULL, + const char * const ActionKey = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, + const char * const IconName_Info_right = NULL) : CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { }; - CMenuDForwarder(const neutrino_locale_t Text, const bool Active=true, const char * const Option=NULL, - CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, - const char * const IconName = NULL, const char * const IconName_Info_right = NULL) + + CMenuDForwarder(const neutrino_locale_t Text, + const bool Active=true, + const char * const Option=NULL, + CMenuTarget* Target=NULL, + const char * const ActionKey = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, + const char * const IconName_Info_right = NULL) : CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { }; - CMenuDForwarder(const std::string & Text, const bool Active=true, const char * const Option=NULL, - CMenuTarget* Target=NULL, const char * const ActionKey = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, - const char * const IconName = NULL, const char * const IconName_Info_right = NULL) + + CMenuDForwarder(const std::string& Text, + bool Active=true, + const char * const Option=NULL, + CMenuTarget* Target=NULL, + const char * const ActionKey = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const char * const IconName = NULL, + const char * const IconName_Info_right = NULL) : CMenuForwarder(Text, Active, Option, Target, ActionKey, DirectKey, IconName, IconName_Info_right) { }; ~CMenuDForwarder() { delete jumpTarget; } @@ -307,13 +374,40 @@ private: std::string numberFormat; std::string (*numberFormatFunction)(int num); + void initMenuOptionNumberChooser( const std::string &s_name, + const neutrino_locale_t l_name, + int * const OptionValue, + const bool Active, + const int min_value, + const int max_value, + CChangeObserver * const Observ, + const int print_offset, + const int special_value, + const neutrino_locale_t special_value_name, + bool sliderOn); + public: - CMenuOptionNumberChooser(const neutrino_locale_t name, int * const OptionValue, const bool Active, - const int min_value, const int max_value, CChangeObserver * const Observ = NULL, const int print_offset = 0, - const int special_value = 0, const neutrino_locale_t special_value_name = NONEXISTANT_LOCALE, bool sliderOn = false ); - CMenuOptionNumberChooser(const std::string &name, int * const OptionValue, const bool Active, - const int min_value, const int max_value, CChangeObserver * const Observ = NULL, const int print_offset = 0, - const int special_value = 0, const neutrino_locale_t special_value_name = NONEXISTANT_LOCALE, bool sliderOn = false ); + CMenuOptionNumberChooser(const neutrino_locale_t name, + int * const OptionValue, + const bool Active, + const int min_value, + const int max_value, + CChangeObserver * const Observ = NULL, + const int print_offset = 0, + const int special_value = 0, + const neutrino_locale_t special_value_name = NONEXISTANT_LOCALE, + bool sliderOn = false ); + + CMenuOptionNumberChooser(const std::string &name, + int * const OptionValue, + const bool Active, + const int min_value, + const int max_value, + CChangeObserver * const Observ = NULL, + const int print_offset = 0, + const int special_value = 0, + const neutrino_locale_t special_value_name = NONEXISTANT_LOCALE, + bool sliderOn = false ); int paint(bool selected); @@ -348,17 +442,24 @@ struct CMenuOptionChooserCompareItem: public std::binary_function &Options, - const bool Active = false, CChangeObserver * const Observ = NULL, - const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "", - bool Pulldown = false, bool OptionsSort = false); - CMenuOptionChooser(const std::string &Name, int * const OptionValue, std::vector &Options, - const bool Active = false, CChangeObserver * const Observ = NULL, - const neutrino_msg_t DirectKey = CRCInput::RC_nokey, const std::string & IconName= "", - bool Pulldown = false, bool OptionsSort = false); + CMenuOptionChooser( const neutrino_locale_t Name, + int * const OptionValue, + const struct keyval * const Options, + const unsigned Number_Of_Options, + const bool Active = false, + CChangeObserver * const Observ = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const std::string & IconName= "", + bool Pulldown = false, bool OptionsSort = false); + + CMenuOptionChooser( const neutrino_locale_t Name, + int * const OptionValue, + const struct keyval_ext * const Options, + const unsigned Number_Of_Options, + const bool Active = false, + CChangeObserver * const Observ = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const std::string & IconName= "", + bool Pulldown = false, + bool OptionsSort = false); + + CMenuOptionChooser( const std::string &Name, + int * const OptionValue, const struct keyval * const Options, + const unsigned Number_Of_Options, + const bool Active = false, + CChangeObserver * const Observ = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const std::string & IconName= "", + bool Pulldown = false, + bool OptionsSort = false); + + CMenuOptionChooser( const std::string &Name, + int * const OptionValue, + const struct keyval_ext * const Options, + const unsigned Number_Of_Options, + const bool Active = false, + CChangeObserver * const Observ = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const std::string & IconName= "", + bool Pulldown = false, + bool OptionsSort = false); + + CMenuOptionChooser( const neutrino_locale_t Name, + int * const OptionValue, + std::vector &Options, + const bool Active = false, + CChangeObserver * const Observ = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const std::string & IconName= "", + bool Pulldown = false, + bool OptionsSort = false); + + CMenuOptionChooser( const std::string &Name, + int * const OptionValue, + std::vector &Options, + const bool Active = false, + CChangeObserver * const Observ = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const std::string & IconName= "", + bool Pulldown = false, + bool OptionsSort = false); + ~CMenuOptionChooser(); void setOption(const int newvalue); int getOption(void) const; int getWidth(void); + void setOptions(const struct keyval * const Options, const unsigned Number_Of_Options); + void setOptions(const struct keyval_ext * const Options, const unsigned Number_Of_Options); int paint(bool selected); - std::string getOptionName()const {return nameString;}; int exec(CMenuTarget* parent); int isMenueOptionChooser(void) const{return 1;} @@ -411,19 +561,37 @@ class CMenuOptionChooser : public CAbstractMenuOptionChooser class CMenuOptionStringChooser : public CMenuItem { + private: int height; std::string * optionValueString; std::vector options; CChangeObserver * observ; bool pulldown; + void initVarMenuOptionStringChooser( const std::string &string_Name, + const neutrino_locale_t locale_Name, + std::string* OptionValue, + bool Active, + CChangeObserver* Observ, + const neutrino_msg_t DirectKey, + const std::string & IconName, + bool Pulldown); public: - CMenuOptionStringChooser(const neutrino_locale_t Name, std::string* OptionValue, bool Active = false, - CChangeObserver* Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, - const std::string & IconName= "", bool Pulldown = false); - CMenuOptionStringChooser(const std::string &Name, std::string* OptionValue, bool Active = false, - CChangeObserver* Observ = NULL, const neutrino_msg_t DirectKey = CRCInput::RC_nokey, - const std::string & IconName= "", bool Pulldown = false); + CMenuOptionStringChooser( const neutrino_locale_t Name, + std::string* OptionValue, + bool Active = false, + CChangeObserver* Observ = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const std::string & IconName= "", + bool Pulldown = false); + + CMenuOptionStringChooser( const std::string &Name, + std::string* OptionValue, + bool Active = false, + CChangeObserver* Observ = NULL, + const neutrino_msg_t DirectKey = CRCInput::RC_nokey, + const std::string & IconName= "", + bool Pulldown = false); ~CMenuOptionStringChooser(); @@ -437,29 +605,6 @@ class CMenuOptionStringChooser : public CMenuItem int isMenueOptionChooser(void) const{return 1;} }; -class CMenuOptionLanguageChooser : public CMenuItem -{ - int height; - std::string optionValue; - CChangeObserver * observ; - - public: - CMenuOptionLanguageChooser(char* OptionValue, CChangeObserver* Observ = NULL, const char * const IconName = NULL); - ~CMenuOptionLanguageChooser(); - - int paint(bool selected); - int getHeight(void) const - { - return height; - } - bool isSelectable(void) const - { - return true; - } - - int exec(CMenuTarget* parent); -}; - class CMenuGlobal { public: @@ -501,12 +646,17 @@ class CMenuWidget : public CMenuTarget int selected; int iconOffset; int sb_width; + int sb_height; fb_pixel_t *background; int full_width, full_height; bool savescreen; bool has_hints; // is any items has hints bool hint_painted; // is hint painted + int fbutton_height; + int fbutton_count; + const struct button_label *fbutton_labels; + unsigned int item_start_y; unsigned int current_page; unsigned int total_pages; @@ -568,6 +718,7 @@ class CMenuWidget : public CMenuTarget MENU_POS_BOTTOM_RIGHT }; void addKey(neutrino_msg_t key, CMenuTarget *menue, const std::string &action); + void setFooter(const struct button_label *_fbutton_label, const int _fbutton_count, bool repaint = false); }; class CPINProtection diff --git a/src/gui/widget/shellwindow.cpp b/src/gui/widget/shellwindow.cpp new file mode 100644 index 000000000..46a9e43ec --- /dev/null +++ b/src/gui/widget/shellwindow.cpp @@ -0,0 +1,205 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Shell window class, visualize of system events on gui screen. + + Implementation: + Copyright (C) 2013 martii + gitorious.org/neutrino-mp/martiis-neutrino-mp + + License: GPL + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + + +#include "shellwindow.h" + +#include +#include +#include +#include +#include +#include +#include + +CShellWindow::CShellWindow(const std::string &command, const int _mode, int *res) { + textBox = NULL; + std::string cmd; + mode = _mode; + if (!(mode & VERBOSE)){ + cmd = "PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin ; export PATH ; " + command + " 2>/dev/null >&2"; + int r = system(cmd.c_str()); + if (res) { + if (r == -1) + *res = r; + else + *res = WEXITSTATUS(r); + } + return; + } + + cmd = command + " 2>&1"; + FILE *f = popen(cmd.c_str(), "r"); + if (!f) { + if (res) + *res = -1; + return; + } + Font *font = g_Font[SNeutrinoSettings::FONT_TYPE_GAMELIST_ITEMSMALL]; + frameBuffer = CFrameBuffer::getInstance(); + unsigned int lines_max = frameBuffer->getScreenHeight() / font->getHeight(); + list lines; + CBox textBoxPosition(frameBuffer->getScreenX(), frameBuffer->getScreenY(), frameBuffer->getScreenWidth(), frameBuffer->getScreenHeight()); + textBox = new CTextBox(cmd.c_str(), font, CTextBox::BOTTOM, &textBoxPosition); + struct pollfd fds; + fds.fd = fileno(f); + fds.events = POLLIN | POLLHUP | POLLERR; + fcntl(fds.fd, F_SETFL, fcntl(fds.fd, F_GETFL, 0) | O_NONBLOCK); + + struct timeval tv; + gettimeofday(&tv,NULL); + uint64_t lastPaint = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); + bool ok = true, nlseen = false, dirty = false, pushed = false; + char output[1024]; + int off = 0; + std::string txt = ""; + + do { + uint64_t now; + fds.revents = 0; + int r = poll(&fds, 1, 300); + + if (r > 0) { + if (!feof(f)) { + gettimeofday(&tv,NULL); + now = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); + + unsigned int lines_read = 0; + while (fgets(output + off, sizeof(output) - off, f)) { + char *outputp = output + off; + dirty = true; + + for (int i = off; output[i] && !nlseen; i++) + switch (output[i]) { + case '\b': + if (outputp > output) + outputp--; + *outputp = 0; + break; + case '\r': + outputp = output; + break; + case '\n': + lines_read++; + nlseen = true; + *outputp = 0; + break; + default: + *outputp++ = output[i]; + break; + } + + if (outputp < output + sizeof(output)) + *outputp = 0; + if (nlseen) { + pushed = false; + nlseen = false; + off = 0; + } else { + off = strlen(output); + if (pushed) + lines.pop_back(); + } + lines.push_back(std::string((output))); + pushed = true; + if (lines.size() > lines_max) + lines.pop_front(); + txt = ""; + bool first = true; + for (std::list::const_iterator it = lines.begin(), end = lines.end(); it != end; ++it) { + if (first) + first = false; + else + txt += '\n'; + txt += *it; + } + if (((lines_read == lines_max) && (lastPaint + 100000 < now)) || (lastPaint + 250000 < now)) { + textBox->setText(&txt); + textBox->paint(); + lines_read = 0; + lastPaint = now; + dirty = false; + } + } + } else + ok = false; + } else if (r < 0) + ok = false; + + gettimeofday(&tv,NULL); + now = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); + if (r < 1 || dirty || lastPaint + 250000 < now) { + textBox->setText(&txt); + textBox->paint(); + lastPaint = now; + dirty = false; + } + } while(ok); + + int r = pclose(f); + + if (res) { + if (r == -1) + *res = r; + else + *res = WEXITSTATUS(r); + } +} + +CShellWindow::~CShellWindow() +{ + if (textBox && (mode & ACKNOWLEDGE)) { + int iw, ih; + frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_OKAY, &iw, &ih); + Font *font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; + int b_width = font->getRenderWidth(g_Locale->getText(LOCALE_MESSAGEBOX_OK), true) + 36 + ih + (RADIUS_LARGE / 2); + int fh = font->getHeight(); + int b_height = std::max(fh, ih) + 8 + (RADIUS_LARGE / 2); + int xpos = frameBuffer->getScreenWidth() - b_width; + int ypos = frameBuffer->getScreenHeight() - b_height; + frameBuffer->paintBoxRel(xpos, ypos, b_width, b_height, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, xpos + ((b_height - ih) / 2), ypos + ((b_height - ih) / 2), ih); + font->RenderString(xpos + iw + 17, ypos + fh + ((b_height - fh) / 2), b_width - (iw + 21), g_Locale->getText(LOCALE_MESSAGEBOX_OK), COL_MENUCONTENT_TEXT, 0, true); + frameBuffer->blit(); + + neutrino_msg_t msg; + neutrino_msg_data_t data; + do + g_RCInput->getMsg(&msg, &data, 100); + while (msg != CRCInput::RC_ok && msg != CRCInput::RC_home); + + frameBuffer->Clear(); + frameBuffer->blit(); + } + if (textBox) { + textBox->hide(); + delete textBox; + } +} diff --git a/src/gui/widget/shellwindow.h b/src/gui/widget/shellwindow.h new file mode 100644 index 000000000..a7c05b7fd --- /dev/null +++ b/src/gui/widget/shellwindow.h @@ -0,0 +1,48 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Shell window class, visualize of system events on gui screen. + + Implementation: + Copyright (C) 2013 martii + gitorious.org/neutrino-mp/martiis-neutrino-mp + + License: GPL + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef __WIDGET_SHELLWINDOW_H__ +#define __WIDGET_SHELLWINDOW_H__ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +class CShellWindow +{ + public: + enum shellwindow_modes { VERBOSE = 1, ACKNOWLEDGE = 2 }; + CShellWindow(const std::string &cmd, const int mode = 0, int *res = NULL); + ~CShellWindow(); + private: + int mode; + CFrameBuffer *frameBuffer; + CTextBox *textBox; +}; + +#endif diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index 1fead0be5..debb27d40 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -431,7 +431,7 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) { keyRightPressed(); } - else if (CRCInput::getUnicodeValue(msg) != -1) + else if (*CRCInput::getUnicodeValue(msg)) { NormalKeyPressed(msg); } @@ -637,7 +637,7 @@ void CStringInputSMS::initSMS(const char * const Valid_Chars) { last_digit = -1; // no key pressed yet const char CharList[10][11] = { "0 -_/()<>=", // 10 characters - "1+.,:!?\\'",//' for c't search ;) + "1+.,:!?%\\'", //' for c't search ;) "abc2ä", "def3", "ghi4", @@ -702,7 +702,7 @@ void CStringInputSMS::NormalKeyPressed(const neutrino_msg_t key) } else { - valueString->at(selected) = (char)CRCInput::getUnicodeValue(key); + valueString->at(selected) = *CRCInput::getUnicodeValue(key); keyRedPressed(); /* to lower, paintChar */ keyRightPressed(); /* last_digit = -1, move to next position */ } diff --git a/src/gui/widget/stringinput_ext.cpp b/src/gui/widget/stringinput_ext.cpp index 9a9bb5446..810108f94 100644 --- a/src/gui/widget/stringinput_ext.cpp +++ b/src/gui/widget/stringinput_ext.cpp @@ -219,7 +219,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) CVFD::getInstance()->showMenuText(1, valueString->c_str(), selectedChar+1); } } - else if ( (CRCInput::getUnicodeValue(msg) != -1) || (msg == CRCInput::RC_red) || (msg == CRCInput::RC_green) || (msg == CRCInput::RC_blue) || (msg == CRCInput::RC_yellow) + else if ( (*CRCInput::getUnicodeValue(msg)) || (msg == CRCInput::RC_red) || (msg == CRCInput::RC_green) || (msg == CRCInput::RC_blue) || (msg == CRCInput::RC_yellow) || (msg == CRCInput::RC_up) || (msg == CRCInput::RC_down)) { inputFields[selectedChar]->keyPressed(msg); @@ -378,12 +378,12 @@ int CExtendedInput_Item_Char::getCharID( char ch ) void CExtendedInput_Item_Char::keyPressed(const int key) { - int value = CRCInput::getUnicodeValue(key); - if (value != -1) + const char *value = CRCInput::getUnicodeValue(key); + if (*value) { - if (isAllowedChar((char)value)) + if (isAllowedChar(*value)) { - *data = (char)value; + *data = *value; g_RCInput->postMsg( CRCInput::RC_right, 0 ); } } diff --git a/src/gui/zapit_setup.cpp b/src/gui/zapit_setup.cpp index a9b2e8bc3..eb368339f 100644 --- a/src/gui/zapit_setup.cpp +++ b/src/gui/zapit_setup.cpp @@ -75,6 +75,20 @@ int CZapitSetup::showMenu() CMenuForwarder *zapit2 = new CMenuForwarder(LOCALE_ZAPITSETUP_LAST_RADIO , !g_settings.uselastchannel, g_settings.StartChannelRadio, &select, "radio", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW ); zapit2->setHint("", LOCALE_MENU_HINT_LAST_RADIO); + #define CHANNEL_LIST_MODE_OPTION_COUNT 5 + const CMenuOptionChooser::keyval CHANNEL_LIST_MODE_OPTIONS[CHANNEL_LIST_MODE_OPTION_COUNT] = { + { -1, LOCALE_CHANNELLIST_REMEMBER } + , { LIST_MODE_FAV, LOCALE_CHANNELLIST_FAVS } + , { LIST_MODE_PROV, LOCALE_CHANNELLIST_PROVS } + , { LIST_MODE_SAT, LOCALE_CHANNELLIST_SATS } + , { LIST_MODE_ALL, LOCALE_CHANNELLIST_HEAD } + }; + + CMenuOptionChooser *channel_mode = new CMenuOptionChooser(LOCALE_ZAPITSETUP_CHANNELMODE, &g_settings.channel_mode_initial, CHANNEL_LIST_MODE_OPTIONS, CHANNEL_LIST_MODE_OPTION_COUNT, true, NULL, CRCInput::RC_1, NEUTRINO_ICON_BUTTON_1); + channel_mode->setHint("", LOCALE_MENU_HINT_CHANNELLIST_MODE); + CMenuOptionChooser *channel_mode_radio = new CMenuOptionChooser(LOCALE_ZAPITSETUP_CHANNELMODE_RADIO, &g_settings.channel_mode_initial_radio, CHANNEL_LIST_MODE_OPTIONS, CHANNEL_LIST_MODE_OPTION_COUNT, true, NULL, CRCInput::RC_2, NEUTRINO_ICON_BUTTON_2); + channel_mode_radio->setHint("", LOCALE_MENU_HINT_CHANNELLIST_MODE_RADIO); + miscZapitNotifier->addItem(zapit1); miscZapitNotifier->addItem(zapit2); @@ -82,6 +96,9 @@ int CZapitSetup::showMenu() zapit->addItem(GenericMenuSeparatorLine); zapit->addItem(zapit1); zapit->addItem(zapit2); + zapit->addItem(GenericMenuSeparatorLine); + zapit->addItem(channel_mode); + zapit->addItem(channel_mode_radio); int res = zapit->exec(NULL, ""); delete miscZapitNotifier; diff --git a/src/mdev_helper.cpp b/src/mdev_helper.cpp new file mode 100644 index 000000000..26d35d781 --- /dev/null +++ b/src/mdev_helper.cpp @@ -0,0 +1,98 @@ +/* + Neutrino-GUI - DBoxII-Project + + Copyright (C) 2014 CoolStream International Ltd + + License: GPLv2 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include +#include +#include +#include +#include + +#include "config.h" +#include +#include + +#include + +const char *mdev_env[] = +{ + "ACTION" , + "MDEV" , + "DEVPATH" , + "INTERFACE", +}; + +#define ENV_SIZE (sizeof(mdev_env)/sizeof(char *)) + +int main (int /*argc*/, char **argv) +{ + struct sockaddr_un servaddr; + int clilen, sock_fd; + std::string data; + + memset(&servaddr, 0, sizeof(struct sockaddr_un)); + servaddr.sun_family = AF_UNIX; + strncpy(servaddr.sun_path, NEUTRINO_UDS_NAME, sizeof(servaddr.sun_path) - 1); + clilen = sizeof(servaddr.sun_family) + strlen(servaddr.sun_path); + + if ((sock_fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) + { + perror("error open socket " NEUTRINO_UDS_NAME); + exit(1); + } + + if (connect(sock_fd, (struct sockaddr*) &servaddr, clilen) < 0) + { + perror("error connect socket " NEUTRINO_UDS_NAME); + goto _error; + } + + for (unsigned i = 0; i < ENV_SIZE; i++) { + char * s = getenv(mdev_env[i]); + if (s) + data += std::string(mdev_env[i]) + "=" + s + " "; + } + + if (data.empty()) { + printf("%s: env data empty\n", argv[0]); + goto _error; + } + + CEventServer::eventHead head; + + head.eventID = NeutrinoMessages::EVT_HOTPLUG; + head.initiatorID = CEventServer::INITID_NEUTRINO; + head.dataSize = data.size() + 1; + + if (write(sock_fd, &head, sizeof(head)) != sizeof(head)) { + perror("write event"); + goto _error; + } + + if (write(sock_fd, data.c_str(), head.dataSize) != (ssize_t) head.dataSize) { + perror("write data"); + goto _error; + } + close(sock_fd); + exit(0); +_error: + close(sock_fd); + exit(1); +} diff --git a/src/neutrino.cpp b/src/neutrino.cpp index e75c8d5a8..1aeb28b20 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -118,6 +118,7 @@ #include #include #include +#include #include #include @@ -137,6 +138,7 @@ char zapit_lat[20]="#"; char zapit_long[20]="#"; bool autoshift = false; uint32_t scrambled_timer; +uint32_t fst_timer; t_channel_id standby_channel_id = 0; //NEW @@ -151,6 +153,9 @@ static bool nhttpd_thread_started = false; //#define DISABLE_SECTIONSD extern cVideo * videoDecoder; +#ifdef ENABLE_PIP +extern cVideo *pipDecoder; +#endif extern cDemux *videoDemux; extern cAudio * audioDecoder; cPowerManager *powerManager; @@ -356,6 +361,12 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.current_volume_step = configfile.getInt32("current_volume_step", 2); g_settings.channel_mode = configfile.getInt32("channel_mode", LIST_MODE_PROV); g_settings.channel_mode_radio = configfile.getInt32("channel_mode_radio", LIST_MODE_PROV); + g_settings.channel_mode_initial = configfile.getInt32("channel_mode_initial", -1); + g_settings.channel_mode_initial_radio = configfile.getInt32("channel_mode_initial_radio", -1); + if (g_settings.channel_mode_initial > -1) + g_settings.channel_mode = g_settings.channel_mode_initial; + if (g_settings.channel_mode_initial_radio > -1) + g_settings.channel_mode_radio = g_settings.channel_mode_initial_radio; g_settings.fan_speed = configfile.getInt32( "fan_speed", 1); if(g_settings.fan_speed < 1) g_settings.fan_speed = 1; @@ -384,7 +395,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.standby_cpufreq = configfile.getInt32("standby_cpufreq", 100); g_settings.rounded_corners = configfile.getInt32("rounded_corners", 1); g_settings.ci_standby_reset = configfile.getInt32("ci_standby_reset", 0); - g_settings.ci_clock = configfile.getInt32("ci_clock", 7); + g_settings.ci_clock = configfile.getInt32("ci_clock", 9); g_settings.ci_ignore_messages = configfile.getInt32("ci_ignore_messages", 0); #ifndef CPU_FREQ @@ -399,7 +410,6 @@ int CNeutrinoApp::loadSetup(const char * fname) //misc g_settings.power_standby = configfile.getInt32( "power_standby", 0); - g_settings.rotor_swap = configfile.getInt32( "rotor_swap", 0); //led g_settings.led_tv_mode = configfile.getInt32( "led_tv_mode", 2); @@ -478,6 +488,7 @@ int CNeutrinoApp::loadSetup(const char * fname) sprintf(cfg_key, "pref_subs_%d", i); g_settings.pref_subs[i] = configfile.getString(cfg_key, "none"); } + g_settings.subs_charset = configfile.getString("subs_charset", "CP1252"); g_settings.zap_cycle = configfile.getInt32( "zap_cycle", 0 ); //vcr @@ -502,6 +513,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.epg_save = configfile.getBool("epg_save", false); g_settings.epg_save_standby = configfile.getBool("epg_save_standby", true); g_settings.epg_scan = configfile.getInt32("epg_scan", 0); + g_settings.epg_scan_mode = configfile.getInt32("epg_scan_mode", CEpgScan::MODE_ALWAYS); //widget settings g_settings.widget_fade = false; g_settings.widget_fade = configfile.getBool("widget_fade" , false ); @@ -633,6 +645,7 @@ int CNeutrinoApp::loadSetup(const char * fname) } } g_settings.record_hours = configfile.getInt32( "record_hours", 4 ); + g_settings.timeshift_hours = configfile.getInt32( "timeshift_hours", 4 ); g_settings.filesystem_is_utf8 = configfile.getBool("filesystem_is_utf8" , true ); //recording (server + vcr) @@ -646,6 +659,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.recording_stream_vtxt_pid = configfile.getBool("recordingmenu.stream_vtxt_pid" , true); g_settings.recording_stream_subtitle_pids = configfile.getBool("recordingmenu.stream_subtitle_pids", true); g_settings.recording_stream_pmt_pid = configfile.getBool("recordingmenu.stream_pmt_pid" , false); + g_settings.recording_filename_template = configfile.getString("recordingmenu.filename_template" , "%C_%T%d_%t"); 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" , true); @@ -654,7 +668,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.recording_startstop_msg = configfile.getBool("recording_startstop_msg" , true); // default plugin for movieplayer - g_settings.movieplayer_plugin = configfile.getString( "movieplayer_plugin", "Teletext" ); + g_settings.movieplayer_plugin = configfile.getString( "movieplayer_plugin", "noplugin" ); g_settings.onekey_plugin = configfile.getString( "onekey_plugin", "noplugin" ); g_settings.plugin_hdd_dir = configfile.getString( "plugin_hdd_dir", "/media/sda1/plugins" ); g_settings.logo_hdd_dir = configfile.getString( "logo_hdd_dir", "/media/sda1/logos" ); @@ -669,6 +683,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.screenshot_mode = configfile.getInt32( "screenshot_mode", 0); g_settings.screenshot_video = configfile.getInt32( "screenshot_video", 1); g_settings.screenshot_scale = configfile.getInt32( "screenshot_scale", 0); + g_settings.auto_cover = configfile.getInt32( "auto_cover", 0); g_settings.screenshot_dir = configfile.getString( "screenshot_dir", "/media/sda1/movies" ); g_settings.cacheTXT = configfile.getInt32( "cacheTXT", 0); @@ -872,12 +887,18 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.brightness = configfile.getInt32("brightness", 0); g_settings.contrast = configfile.getInt32("contrast", 0); g_settings.saturation = configfile.getInt32("saturation", 0); + g_settings.enable_sd_osd = configfile.getInt32("enable_sd_osd", 1); #endif #ifdef ENABLE_PIP g_settings.pip_x = configfile.getInt32("pip_x", 50); g_settings.pip_y = configfile.getInt32("pip_y", 50); g_settings.pip_width = configfile.getInt32("pip_width", 365); g_settings.pip_height = configfile.getInt32("pip_height", 200); + + g_settings.pip_radio_x = configfile.getInt32("pip_radio_x", g_settings.pip_x); + g_settings.pip_radio_y = configfile.getInt32("pip_radio_y", g_settings.pip_y); + g_settings.pip_radio_width = configfile.getInt32("pip_radio_width", g_settings.pip_width); + g_settings.pip_radio_height = configfile.getInt32("pip_radio_height", g_settings.pip_height); #endif g_settings.infoClockFontSize = configfile.getInt32("infoClockFontSize", 30); @@ -914,6 +935,8 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32( "current_volume_step", g_settings.current_volume_step ); configfile.setInt32( "channel_mode", g_settings.channel_mode ); configfile.setInt32( "channel_mode_radio", g_settings.channel_mode_radio ); + configfile.setInt32( "channel_mode_initial", g_settings.channel_mode_initial ); + configfile.setInt32( "channel_mode_initial_radio", g_settings.channel_mode_initial_radio ); configfile.setInt32( "fan_speed", g_settings.fan_speed); @@ -955,7 +978,6 @@ void CNeutrinoApp::saveSetup(const char * fname) //misc configfile.setInt32( "power_standby", g_settings.power_standby); - configfile.setInt32( "rotor_swap", g_settings.rotor_swap); configfile.setInt32( "zap_cycle", g_settings.zap_cycle ); configfile.setInt32( "hdd_fs", g_settings.hdd_fs); configfile.setInt32( "hdd_sleep", g_settings.hdd_sleep); @@ -998,6 +1020,7 @@ void CNeutrinoApp::saveSetup(const char * fname) sprintf(cfg_key, "pref_subs_%d", i); configfile.setString(cfg_key, g_settings.pref_subs[i]); } + configfile.setString("subs_charset", g_settings.subs_charset); //vcr configfile.setBool("vcr_AutoSwitch" , g_settings.vcr_AutoSwitch ); @@ -1009,6 +1032,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool("epg_save", g_settings.epg_save); configfile.setBool("epg_save_standby", g_settings.epg_save_standby); configfile.setInt32("epg_scan", g_settings.epg_scan); + configfile.setInt32("epg_scan_mode", g_settings.epg_scan_mode); configfile.setInt32("epg_cache_time" ,g_settings.epg_cache ); configfile.setInt32("epg_extendedcache_time" ,g_settings.epg_extendedcache); configfile.setInt32("epg_old_events" ,g_settings.epg_old_events ); @@ -1135,6 +1159,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool ("recordingmenu.stream_vtxt_pid" , g_settings.recording_stream_vtxt_pid ); configfile.setBool ("recordingmenu.stream_subtitle_pids" , g_settings.recording_stream_subtitle_pids ); configfile.setBool ("recordingmenu.stream_pmt_pid" , g_settings.recording_stream_pmt_pid ); + configfile.setString("recordingmenu.filename_template" , g_settings.recording_filename_template ); configfile.setInt32 ("recording_choose_direct_rec_dir" , g_settings.recording_choose_direct_rec_dir); configfile.setBool ("recording_epg_for_filename" , g_settings.recording_epg_for_filename ); configfile.setBool ("recording_epg_for_end" , g_settings.recording_epg_for_end ); @@ -1155,6 +1180,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32( "auto_timeshift", g_settings.auto_timeshift ); configfile.setInt32( "auto_delete", g_settings.auto_delete ); configfile.setInt32( "record_hours", g_settings.record_hours ); + configfile.setInt32( "timeshift_hours", g_settings.timeshift_hours ); //printf("set: key_unlock =============== %d\n", g_settings.key_unlock); configfile.setInt32( "screenshot_count", g_settings.screenshot_count ); configfile.setInt32( "screenshot_format", g_settings.screenshot_format ); @@ -1162,6 +1188,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32( "screenshot_mode", g_settings.screenshot_mode ); configfile.setInt32( "screenshot_video", g_settings.screenshot_video ); configfile.setInt32( "screenshot_scale", g_settings.screenshot_scale ); + configfile.setInt32( "auto_cover", g_settings.auto_cover ); configfile.setString( "screenshot_dir", g_settings.screenshot_dir); configfile.setInt32( "cacheTXT", g_settings.cacheTXT ); @@ -1300,13 +1327,18 @@ void CNeutrinoApp::saveSetup(const char * fname) #ifdef BOXMODEL_APOLLO configfile.setInt32("brightness", g_settings.brightness ); configfile.setInt32("contrast", g_settings.contrast ); - configfile.setInt32("saturation", g_settings.saturation ); + configfile.setInt32("enable_sd_osd", g_settings.enable_sd_osd ); #endif #ifdef ENABLE_PIP configfile.setInt32("pip_x", g_settings.pip_x); configfile.setInt32("pip_y", g_settings.pip_y); configfile.setInt32("pip_width", g_settings.pip_width); configfile.setInt32("pip_height", g_settings.pip_height); + + configfile.setInt32("pip_radio_x", g_settings.pip_radio_x); + configfile.setInt32("pip_radio_y", g_settings.pip_radio_y); + configfile.setInt32("pip_radio_width", g_settings.pip_radio_width); + configfile.setInt32("pip_radio_height", g_settings.pip_radio_height); #endif configfile.setInt32("infoClockFontSize", g_settings.infoClockFontSize); configfile.setInt32("infoClockBackground", g_settings.infoClockBackground); @@ -1414,6 +1446,7 @@ void CNeutrinoApp::channelsInit(bool bOnly) tvi = 0, ri = 0; CBouquet* tmp1 = TVsatList->addBouquet(sit->second.name.c_str()); CBouquet* tmp2 = RADIOsatList->addBouquet(sit->second.name.c_str()); + tmp1->satellitePosition = tmp2->satellitePosition = sit->first; for(zapit_list_it_t it = zapitList.begin(); it != zapitList.end(); it++) { if ((*it)->getServiceType() == ST_DIGITAL_TELEVISION_SERVICE) { @@ -1425,7 +1458,7 @@ void CNeutrinoApp::channelsInit(bool bOnly) ri++; } } - printf("[neutrino] created %s bouquet with %d TV and %d RADIO channels\n", sit->second.name.c_str(), tvi, ri); + printf("[neutrino] created %s (%d) bouquet with %d TV and %d RADIO channels\n", sit->second.name.c_str(), sit->first, tvi, ri); if(!tvi) TVsatList->deleteBouquet(tmp1); if(!ri) @@ -1574,7 +1607,7 @@ void CNeutrinoApp::SetChannelMode(int newmode) if(g_settings.channellist_sort_mode == CChannelList::SORT_CH_NUMBER) bouquetList->Bouquets[i]->channelList->SortChNumber(); } - channelList->adjustToChannelID(channelList->getActiveChannel_ChannelID()); + channelList->adjustToChannelID(CZapit::getInstance()->GetCurrentChannelID()); } lastChannelMode = newmode; } @@ -1908,6 +1941,9 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms() - starttime); CVFD::getInstance()->setBacklight(g_settings.backlight_tv); + if (!scanSettings.loadSettings(NEUTRINO_SCAN_SETTINGS_FILE)) + dprintf(DEBUG_NORMAL, "Loading of scan settings failed. Using defaults.\n"); + /* set service manager options before starting zapit */ CServiceManager::getInstance()->KeepNumbers(g_settings.keep_channel_numbers); //zapit start parameters @@ -1951,6 +1987,8 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms InitZapitClient(); g_Zapit->setStandby(false); + CheckFastScan(); + //timer start long timerd_signal = 0; timer_wakeup = false;//init @@ -1989,7 +2027,7 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms } #if HAVE_COOL_HARDWARE /* only SAT-hd1 before rev 8 has fan */ - g_info.has_fan = (cs_get_revision() < 8 && g_info.delivery_system == DVB_S); + g_info.has_fan = (cs_get_revision() < 8 && CFEManager::getInstance()->getFE(0)->getInfo()->type == FE_QPSK); #endif dprintf(DEBUG_NORMAL, "g_info.has_fan: %d\n", g_info.has_fan); //fan speed @@ -2010,10 +2048,6 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms CEitManager::getInstance()->Start(); #endif - if (!scanSettings.loadSettings(NEUTRINO_SCAN_SETTINGS_FILE, g_info.delivery_system)) { - dprintf(DEBUG_NORMAL, "Loading of scan settings failed. Using defaults.\n"); - } - CVFD::getInstance()->showVolume(g_settings.current_volume); CVFD::getInstance()->setMuted(current_muted); @@ -2040,8 +2074,6 @@ fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms //load Pluginlist before main menu (only show script menu if at least one script is available g_PluginList->loadPlugins(); - MoviePluginChanger = new CMoviePluginChangeExec; - // setup recording device setupRecordingDevice(); fprintf(stderr, "[neutrino start] %d -> %5ld ms\n", __LINE__, time_monotonic_ms() - starttime); @@ -2212,11 +2244,12 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) InfoClock->enableInfoClock(false); int old_ttx = g_settings.cacheTXT; int old_epg = g_settings.epg_scan; + int old_mode = g_settings.epg_scan_mode; mainMenu.exec(NULL, ""); InfoClock->enableInfoClock(true); StartSubtitles(); saveSetup(NEUTRINO_SETTINGS_FILE); - if (old_epg != g_settings.epg_scan) { + if (old_epg != g_settings.epg_scan || old_mode != g_settings.epg_scan_mode) { if (g_settings.epg_scan) CEpgScan::getInstance()->Start(); else @@ -2301,7 +2334,7 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) numericZap( msg ); } else if( msg == (neutrino_msg_t) g_settings.key_plugin ) { - g_PluginList->start_plugin_by_name(g_settings.onekey_plugin.c_str(), 0); + g_PluginList->startPlugin_by_name(g_settings.onekey_plugin.c_str()); } else if(msg == (neutrino_msg_t) g_settings.key_timeshift) { CRecordManager::getInstance()->StartTimeshift(); @@ -2359,12 +2392,6 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT),450, 10); } - else if ((msg == CRCInput::RC_audio) && !g_settings.audio_run_player) - { - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_GREEN); - StartSubtitles(); - } else if( msg == CRCInput::RC_green) { if (g_settings.personalize[SNeutrinoSettings::P_MAIN_GREEN_BUTTON] == CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED) @@ -2386,17 +2413,6 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT),450, 10); } - else if( (msg == CRCInput::RC_green) || ((msg == CRCInput::RC_audio) && !g_settings.audio_run_player) ) - { - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_GREEN); - StartSubtitles(); - } - else if( msg == CRCInput::RC_yellow ) { // NVODs - StopSubtitles(); - usermenu.showUserMenu(SNeutrinoSettings::BUTTON_YELLOW); - StartSubtitles(); - } else if( msg == CRCInput::RC_blue ) { if (g_settings.personalize[SNeutrinoSettings::P_MAIN_BLUE_BUTTON] == CPersonalizeGui::PERSONALIZE_ACTIVE_MODE_ENABLED)// Features Menu - Personalization Check { @@ -2407,6 +2423,12 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) else ShowHint(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_PERSONALIZE_MENUDISABLEDHINT), 450, 10); } + else if ((msg == CRCInput::RC_audio) && !g_settings.audio_run_player) + { + StopSubtitles(); + usermenu.showUserMenu(SNeutrinoSettings::BUTTON_GREEN); + StartSubtitles(); + } else if( (msg == CRCInput::RC_audio) && g_settings.audio_run_player) { //open mediaplayer menu in audio mode, user can select between audioplayer and internetradio CMediaPlayerMenu * media = CMediaPlayerMenu::getInstance(); @@ -2446,7 +2468,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) if (msg == CRCInput::RC_home) { CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); } - handleMsg(msg, data); + if (msg != CRCInput::RC_timeout) + handleMsg(msg, data); } } else { @@ -2458,7 +2481,8 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu) } } else { - handleMsg(msg, data); + if (msg != CRCInput::RC_timeout) + handleMsg(msg, data); } } } @@ -2507,9 +2531,9 @@ _show: nNewChannel = bouquetList->exec(true); } _repeat: - CVFD::getInstance ()->showServicename(channelList->getActiveChannelName()); - CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); printf("************************* ZAP RES: nNewChannel %d\n", nNewChannel);fflush(stdout); + //CVFD::getInstance ()->showServicename(channelList->getActiveChannelName()); + CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); if(nNewChannel == -1) { // restore orig. bouquet and selected channel on cancel /* FIXME if mode was changed while browsing, * other modes selected bouquet not restored */ @@ -2570,6 +2594,42 @@ void CNeutrinoApp::zapTo(t_channel_id channel_id) } } +bool CNeutrinoApp::wakeupFromStandby(void) +{ + bool alive = recordingstatus || CEpgScan::getInstance()->Running() || + CStreamManager::getInstance()->StreamStatus(); + + if ((mode == mode_standby) && !alive) { + cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); + if(g_settings.ci_standby_reset) { + g_CamHandler->exec(NULL, "ca_ci_reset0"); + g_CamHandler->exec(NULL, "ca_ci_reset1"); + } + g_Zapit->setStandby(false); + g_Zapit->getMode(); + return true; + } + return false; +} + +void CNeutrinoApp::standbyToStandby(void) +{ + bool alive = recordingstatus || CEpgScan::getInstance()->Running() || + CStreamManager::getInstance()->StreamStatus(); + + if ((mode == mode_standby) && !alive) { + // zap back to pre-recording channel if necessary + t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); + if (standby_channel_id && (live_channel_id != standby_channel_id)) { + live_channel_id = standby_channel_id; + channelList->zapTo_ChannelID(live_channel_id); + } + g_Zapit->setStandby(true); + g_Sectionsd->setPauseScanning(true); + cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); + } +} + int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) { int res = 0; @@ -2598,6 +2658,16 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) } return messages_return::handled; } + if(data == fst_timer) { + g_RCInput->killTimer(fst_timer); + if (wakeupFromStandby()) { + CheckFastScan(true); + standbyToStandby(); + } else if (mode == mode_standby) { + fst_timer = g_RCInput->addTimer(30*1000*1000, true); + } + return messages_return::handled; + } } res = res | g_RemoteControl->handleMsg(msg, data); @@ -2607,6 +2677,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) // else fprintf(stderr, "channelList = NULL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); res = res | CRecordManager::getInstance()->handleMsg(msg, data); res = res | CEpgScan::getInstance()->handleMsg(msg, data); + res = res | CHDDMenuHandler::getInstance()->handleMsg(msg, data); if( res != messages_return::unhandled ) { if( ( msg>= CRCInput::RC_WithData ) && ( msg< CRCInput::RC_WithData+ 0x10000000 ) ) { @@ -2816,27 +2887,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) /* sent by rcinput, when got msg from zapit about record activated/deactivated */ /* should be sent when no record running */ printf("NeutrinoMessages::EVT_RECORDMODE: %s\n", ( data ) ? "on" : "off"); - //if(!CRecordManager::getInstance()->RecordingStatus() && was_record && (!data)) - - /* no records left and record mode off FIXME check !*/ - if(!CRecordManager::getInstance()->RecordingStatus() && (!data)) - { - if(mode == mode_standby) { - // zap back to pre-recording channel if necessary - t_channel_id live_channel_id = CZapit::getInstance()->GetCurrentChannelID(); - if (standby_channel_id && (live_channel_id != standby_channel_id)) { - live_channel_id = standby_channel_id; - channelList->zapTo_ChannelID(live_channel_id); - } - /* do not put zapit to standby, if epg scan not finished */ - if (!CEpgScan::getInstance()->Running()) - g_Zapit->setStandby(true); - cpuFreq->SetCpuFreq(g_settings.standby_cpufreq * 1000 * 1000); - } - /* try to wakeup epg scan */ - CEpgScan::getInstance()->Next(); - } recordingstatus = data; + CEpgScan::getInstance()->Next(); + standbyToStandby(); autoshift = CRecordManager::getInstance()->TimeshiftOnly(); CVFD::getInstance()->ShowIcon(FP_ICON_CAM1, recordingstatus != 0); @@ -2846,15 +2899,8 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } else if (msg == NeutrinoMessages::RECORD_START) { - //FIXME better at announce ? - if( mode == mode_standby ) { - cpuFreq->SetCpuFreq(g_settings.cpufreq * 1000 * 1000); - if(!recordingstatus && g_settings.ci_standby_reset) { - g_CamHandler->exec(NULL, "ca_ci_reset0"); - g_CamHandler->exec(NULL, "ca_ci_reset1"); - } - } + wakeupFromStandby(); #if 0 //zap to rec channel if box start from deepstandby if(timer_wakeup){ @@ -2891,11 +2937,25 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) delete[] (unsigned char*) data; return messages_return::handled; } + else if (msg == NeutrinoMessages::EVT_STREAM_START) { + int fd = (int) data; + printf("NeutrinoMessages::EVT_STREAM_START: fd %d\n", fd); + wakeupFromStandby(); + + if (!CStreamManager::getInstance()->AddClient(fd)) + close(fd); + return messages_return::handled; + } + else if (msg == NeutrinoMessages::EVT_STREAM_STOP) { + printf("NeutrinoMessages::EVT_STREAM_STOP\n"); + CEpgScan::getInstance()->Next(); + standbyToStandby(); + return messages_return::handled; + } else if( msg == NeutrinoMessages::EVT_PMT_CHANGED) { - res = messages_return::handled; t_channel_id channel_id = *(t_channel_id*) data; CRecordManager::getInstance()->Update(channel_id); - return res; + return messages_return::handled; } else if( msg == NeutrinoMessages::ZAPTO) { @@ -2908,10 +2968,10 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) dvbsub_stop(); if ((!isTVMode) && (mode != mode_radio)) { - radioMode(false); + radioMode(true); } else if (isTVMode && (mode != mode_tv)) { - tvMode(false); + tvMode(true); } channelList->zapTo_ChannelID(eventinfo->channel_id); } @@ -3163,9 +3223,11 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) g_volume->setVolumeExt((int)data); return messages_return::handled; } - if ((msg >= CRCInput::RC_WithData) && (msg < CRCInput::RC_WithData + 0x10000000)) + if ((msg >= CRCInput::RC_WithData) && (msg < CRCInput::RC_WithData + 0x10000000)) { + INFO("###################################### DELETED msg %x data %x\n", msg, data); delete [] (unsigned char*) data; - + return messages_return::handled; + } return messages_return::unhandled; } @@ -3205,6 +3267,11 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) g_Sectionsd->setPauseScanning(true); saveEpg(true);// true CVFD::MODE_SHUTDOWN } + + /* on shutdown force load new fst */ + if (retcode) + CheckFastScan(true, false); + CVFD::getInstance()->setMode(CVFD::MODE_SHUTDOWN); stop_daemons(true /*retcode*/);//need here for timer_is_rec before saveSetup @@ -3400,7 +3467,7 @@ void CNeutrinoApp::tvMode( bool rezap ) delete g_Radiotext; g_Radiotext = NULL; } - + videoDecoder->StopPicture(); CVFD::getInstance()->ShowIcon(FP_ICON_RADIO, false); StartSubtitles(!rezap); @@ -3417,6 +3484,11 @@ void CNeutrinoApp::tvMode( bool rezap ) bool stopauto = (mode != mode_ts); mode = mode_tv; +#ifdef ENABLE_PIP + pipDecoder->Pig(g_settings.pip_x, g_settings.pip_y, + g_settings.pip_width, g_settings.pip_height, + frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); +#endif if(stopauto /*&& autoshift*/) { //printf("standby on: autoshift ! stopping ...\n"); CRecordManager::getInstance()->StopAutoRecord(); @@ -3561,6 +3633,8 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) // Active standby on powerManager->SetStandby(false, false); CEpgScan::getInstance()->Start(true); + if (scansettings.fst_update) + fst_timer = g_RCInput->addTimer(30*1000*1000, true); } else { // Active standby off powerManager->SetStandby(false, false); @@ -3571,6 +3645,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) CEpgScan::getInstance()->Stop(); CSectionsdClient::CurrentNextInfo dummy; g_InfoViewer->getEPG(0, dummy); + g_RCInput->killTimer(fst_timer); if(init_cec_setting){ //init cec settings @@ -3655,7 +3730,11 @@ void CNeutrinoApp::radioMode( bool rezap) videoDecoder->Standby(false); } mode = mode_radio; - +#ifdef ENABLE_PIP + pipDecoder->Pig(g_settings.pip_radio_x, g_settings.pip_radio_y, + g_settings.pip_radio_width, g_settings.pip_radio_height, + frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); +#endif CRecordManager::getInstance()->StopAutoRecord(); g_RemoteControl->radioMode(); @@ -3817,27 +3896,6 @@ int CNeutrinoApp::exec(CMenuTarget* parent, const std::string & actionKey) return menu_return::RETURN_REPAINT; } - else if(actionKey == "movieplugin") { - parent->hide(); - CMenuWidget MoviePluginSelector(LOCALE_MOVIEPLAYER_DEFPLUGIN, NEUTRINO_ICON_FEATURES); - MoviePluginSelector.addItem(GenericMenuSeparator); - - char id[5]; - int cnt = 0; - int enabled_count = 0; - for(unsigned int count=0;count < (unsigned int) g_PluginList->getNumberOfPlugins();count++) { - if (g_PluginList->getType(count)== CPlugins::P_TYPE_TOOL && !g_PluginList->isHidden(count)) { - // zB vtxt-plugins - sprintf(id, "%d", count); - enabled_count++; - MoviePluginSelector.addItem(new CMenuForwarder(g_PluginList->getName(count), true, NULL, MoviePluginChanger, id, CRCInput::convertDigitToKey(count)), (cnt == 0)); - cnt++; - } - } - - MoviePluginSelector.exec(NULL, ""); - return menu_return::RETURN_REPAINT; - } else if(actionKey == "clearSectionsd") { g_Sectionsd->freeMemory(); @@ -3909,7 +3967,9 @@ void stop_daemons(bool stopall, bool for_flash) pthread_join(nhttpd_thread, NULL); } printf("httpd shutdown done\n"); + printf("streaming shutdown\n"); CStreamManager::getInstance()->Stop(); + printf("streaming shutdown done\n"); if(stopall || for_flash) { printf("timerd shutdown\n"); if (g_Timerd) @@ -4064,7 +4124,7 @@ void CNeutrinoApp::loadKeys(const char * fname) g_settings.mpkey_audio = tconfig.getInt32( "mpkey.audio", CRCInput::RC_green ); g_settings.mpkey_time = tconfig.getInt32( "mpkey.time", CRCInput::RC_setup ); g_settings.mpkey_bookmark = tconfig.getInt32( "mpkey.bookmark", CRCInput::RC_blue ); - g_settings.mpkey_plugin = tconfig.getInt32( "mpkey.plugin", CRCInput::RC_red ); + g_settings.mpkey_plugin = tconfig.getInt32( "mpkey.plugin", (unsigned int)CRCInput::RC_nokey ); g_settings.mpkey_subtitle = tconfig.getInt32( "mpkey.subtitle", CRCInput::RC_sub ); g_settings.key_format_mode_active = tconfig.getInt32( "key_format_mode_active", 1 ); @@ -4077,6 +4137,7 @@ void CNeutrinoApp::loadKeys(const char * fname) g_settings.key_click = tconfig.getInt32( "key_click", 1 ); g_settings.repeat_blocker = tconfig.getInt32("repeat_blocker", 450); g_settings.repeat_genericblocker = tconfig.getInt32("repeat_genericblocker", 100); + g_settings.longkeypress_duration = tconfig.getInt32("longkeypress_duration", LONGKEYPRESS_OFF); g_settings.bouquetlist_mode = tconfig.getInt32( "bouquetlist_mode", 0 ); g_settings.sms_channel = tconfig.getInt32( "sms_channel", 0 ); @@ -4144,6 +4205,7 @@ void CNeutrinoApp::saveKeys(const char * fname) tconfig.setInt32( "key_click", g_settings.key_click ); tconfig.setInt32( "repeat_blocker", g_settings.repeat_blocker ); tconfig.setInt32( "repeat_genericblocker", g_settings.repeat_genericblocker ); + tconfig.setInt32( "longkeypress_duration", g_settings.longkeypress_duration ); tconfig.setInt32( "bouquetlist_mode", g_settings.bouquetlist_mode ); tconfig.setInt32( "sms_channel", g_settings.sms_channel ); @@ -4329,7 +4391,6 @@ void CNeutrinoApp::Cleanup() printf("cleanup 13\n");fflush(stdout); delete audioSetupNotifier; audioSetupNotifier = NULL; - delete MoviePluginChanger; MoviePluginChanger = NULL; printf("cleanup 14\n");fflush(stdout); delete TVbouquetList; TVbouquetList = NULL; @@ -4368,3 +4429,33 @@ void CNeutrinoApp::Cleanup() #endif #endif } + +void CNeutrinoApp::CheckFastScan(bool standby, bool reload) +{ + if (scansettings.fst_update) { + g_Zapit->getMode(); + INFO("fst version %02x (%s)", scansettings.fst_version, standby ? "force" : "check"); + CServiceScan::getInstance()->QuietFastScan(true); + int new_fst = scansettings.fst_version; + if (!standby) { + if (CServiceScan::getInstance()->ReadFstVersion(scansettings.fast_op)) + new_fst = CServiceScan::getInstance()->GetFstVersion(); + } + if (standby || (new_fst != scansettings.fst_version)) { + CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); + CVFD::getInstance()->ShowText(g_Locale->getText(LOCALE_SATSETUP_FASTSCAN_HEAD)); + CHintBox * fhintbox = NULL; + if (!standby) { + fhintbox = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_SATSETUP_FASTSCAN_HEAD)); + fhintbox->paint(); + } + if (CServiceScan::getInstance()->ScanFast(scansettings.fast_op, reload)) { + scanSettings.fst_version = CServiceScan::getInstance()->GetFstVersion(); + scanSettings.saveSettings(NEUTRINO_SCAN_SETTINGS_FILE); + } + delete fhintbox; + if (standby) + CVFD::getInstance()->setMode(CVFD::MODE_STANDBY); + } + } +} diff --git a/src/neutrino.h b/src/neutrino.h index 821468789..f91a107f5 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -102,7 +102,6 @@ private: int tvsort[LIST_MODE_LAST]; int radiosort[LIST_MODE_LAST]; - CMoviePluginChangeExec *MoviePluginChanger; bool channellist_visible; void SDT_ReloadChannels(); @@ -131,6 +130,7 @@ private: void SetupFrameBuffer(); void CmdParser(int argc, char **argv); void Cleanup(); + void CheckFastScan(bool standby = false, bool reload = true); CNeutrinoApp(); public: @@ -214,6 +214,8 @@ public: CPersonalizeGui & getPersonalizeGui() { return personalize; } bool getChannellistIsVisible() { return channellist_visible; } void zapTo(t_channel_id channel_id); + bool wakeupFromStandby(void); + void standbyToStandby(void); }; #endif diff --git a/src/neutrinoMessages.h b/src/neutrinoMessages.h index 95f590b10..a6a72efac 100644 --- a/src/neutrinoMessages.h +++ b/src/neutrinoMessages.h @@ -113,6 +113,8 @@ struct NeutrinoMessages { EVT_HDMI_CEC_STANDBY = CRCInput::RC_Events + 42, EVT_SET_MUTE = CRCInput::RC_Events + 43, EVT_SET_VOLUME = CRCInput::RC_Events + 44, + EVT_STREAM_START = CRCInput::RC_Events + 45, /* data = fd */ + EVT_STREAM_STOP = CRCInput::RC_Events + 46, /* NEVER CHANGE THIS */ EVT_CA_MESSAGE = CRCInput::RC_Events + 60, /* data = CA_MESSAGE pointer */ @@ -157,6 +159,8 @@ struct NeutrinoMessages { /* sectionsd */ EVT_EIT_COMPLETE = CRCInput::RC_WithData + 24, /* data: (t_channel_id *) */ EVT_BACK_ZAP_COMPLETE = CRCInput::RC_WithData + 25, /* data: (t_channel_id *) */ + + EVT_HOTPLUG = CRCInput::RC_WithData + 26 /* data: char */ }; enum { diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 79fc88fd4..ba5ec147b 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -422,7 +422,7 @@ void CNeutrinoApp::InitMenuSettings() // drive settings if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) { - mf = new CMenuForwarder(LOCALE_HDD_SETTINGS, true, NULL, new CHDDMenuHandler()); + mf = new CMenuForwarder(LOCALE_HDD_SETTINGS, true, NULL, CHDDMenuHandler::getInstance()); mf->setHint(NEUTRINO_ICON_HINT_HDD, LOCALE_MENU_HINT_HDD); personalize.addItem(MENU_SETTINGS, mf, &g_settings.personalize[SNeutrinoSettings::P_MSET_DRIVES]); } @@ -518,6 +518,9 @@ void CNeutrinoApp::InitMenuService() } //separator + personalize.addSeparator(MENU_SERVICE); + + if (!g_settings.easymenu) { personalize.addSeparator(MENU_SERVICE); diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 0b7e9ff5b..1a85ba524 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -632,12 +632,13 @@ void CControlAPI::InfoCGI(CyhookHandler *hh) void CControlAPI::HWInfoCGI(CyhookHandler *hh) { std::string boxname = NeutrinoAPI->NeutrinoYParser->func_get_boxtype(hh, ""); + std::string boxmodel = NeutrinoAPI->NeutrinoYParser->func_get_boxmodel(hh, ""); static CNetAdapter netadapter; std::string eth_id = netadapter.getMacAddr(); std::transform(eth_id.begin(), eth_id.end(), eth_id.begin(), ::tolower); - hh->printf("%s\nMAC:%s\n", boxname.c_str(),eth_id.c_str()); + hh->printf("%s (%s)\nMAC:%s\n", boxname.c_str(), boxmodel.c_str(), eth_id.c_str()); } //----------------------------------------------------------------------------- void CControlAPI::ShutdownCGI(CyhookHandler *hh) diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index 593c74c51..dee74317a 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -119,6 +119,7 @@ const CNeutrinoYParser::TyFuncCall CNeutrinoYParser::yFuncCallList[]= {"umount_get_list", &CNeutrinoYParser::func_unmount_get_list}, {"get_partition_list", &CNeutrinoYParser::func_get_partition_list}, {"get_boxtype", &CNeutrinoYParser::func_get_boxtype}, + {"get_boxmodel", &CNeutrinoYParser::func_get_boxmodel}, {"get_current_stream_info", &CNeutrinoYParser::func_get_current_stream_info}, {"get_timer_list", &CNeutrinoYParser::func_get_timer_list}, {"set_timer_form", &CNeutrinoYParser::func_set_timer_form}, @@ -303,7 +304,7 @@ std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler *, st std::string _sid = std::string(id); sel = (_sid == achannel_id) ? "selected=\"selected\"" : ""; CEitManager::getInstance()->getActualEPGServiceKey(channel->channel_id, &epg); - sprintf(buf,"\n", channel->channel_id, sel.c_str(), channel->getName().c_str(),epg.title.c_str()); + sprintf(buf,"\n", channel->channel_id, sel.c_str(), channel->getName().c_str(),epg.title.c_str()); yresult += buf; } } @@ -366,7 +367,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: yresult += ""; if(have_logos) - yresult += string_printf("", classname, channel->channel_id, (NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->channel_id)).c_str()); @@ -486,7 +487,7 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: yresult += string_printf("\n"); } else - yresult += string_printf("\n"); + yresult += string_printf(" 
 \n",classname); } return yresult; } @@ -685,7 +686,7 @@ std::string CNeutrinoYParser::func_get_partition_list(CyhookHandler *, std::str //------------------------------------------------------------------------- // y-func : get boxtypetext //------------------------------------------------------------------------- -std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) +std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) { unsigned int system_rev = cs_get_revision(); std::string boxname = "CST "; @@ -729,11 +730,35 @@ std::string CNeutrinoYParser::func_get_boxtype(CyhookHandler *, std::string) break; } - if (system_rev != 9) // don't add delivery_system for Tank - boxname += (g_info.delivery_system == DVB_S || (system_rev == 1)) ? " SAT":" CABLE"; return boxname; } //------------------------------------------------------------------------- +// y-func : get boxmodel +//------------------------------------------------------------------------- +std::string CNeutrinoYParser::func_get_boxmodel(CyhookHandler *, std::string) +{ + unsigned int system_rev = cs_get_revision(); + std::string boxmodel = "Unknown"; + + switch(system_rev) + { + case 6: + case 7: + case 8: + case 10: + boxmodel = "Nevis"; + break; + case 9: + case 11: + boxmodel = "Apollo"; + break; + default: + break; + } + + return boxmodel; +} +//------------------------------------------------------------------------- // y-func : get stream info //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_get_current_stream_info(CyhookHandler *hh, std::string) diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h index 6b934c37d..d21e8afba 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h @@ -67,6 +67,7 @@ public: // func TUXBOX std::string func_get_boxtype(CyhookHandler *hh, std::string para); + std::string func_get_boxmodel(CyhookHandler *hh, std::string para); }; #endif /*__nhttpd_neutrinoyparser_h__*/ diff --git a/src/nhttpd/web/Y_Blocks.txt b/src/nhttpd/web/Y_Blocks.txt index d9fc4081a..4f6c332ac 100644 --- a/src/nhttpd/web/Y_Blocks.txt +++ b/src/nhttpd/web/Y_Blocks.txt @@ -501,18 +501,14 @@ start-block~remote {=if-equal:{=var-get:yfbtype=}~0~ {=if-equal:{=var-get:nfbtype=}~2~ {=include-block:Y_Blocks.txt;rc_dbox_philips=}~ {=if-equal:{=var-get:nfbtype=}~1~ {=include-block:Y_Blocks.txt;rc_dbox_nokia_old=}~ - {=if-equal:{=var-get:boxtype=}~CST Neo SAT~ {=include-block:Y_Blocks.txt;rc_cst_v2=}~ - {=if-equal:{=var-get:boxtype=}~CST Neo CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v2=}~ - {=if-equal:{=var-get:boxtype=}~CST Zee SAT~ {=include-block:Y_Blocks.txt;rc_cst_v3=}~ - {=if-equal:{=var-get:boxtype=}~CST Zee CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v3=}~ - {=if-equal:{=var-get:boxtype=}~CST Neo Twin SAT~ {=include-block:Y_Blocks.txt;rc_cst_v4=}~ - {=if-equal:{=var-get:boxtype=}~CST Neo Twin CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v4=}~ - {=if-equal:{=var-get:boxtype=}~CST Tank~ {=include-block:Y_Blocks.txt;rc_cst_v5=}~ - {=if-equal:{=var-get:boxtype=}~CST Trinity SAT~ {=include-block:Y_Blocks.txt;rc_cst_v6=}~ - {=if-equal:{=var-get:boxtype=}~CST Trinity CABLE~ {=include-block:Y_Blocks.txt;rc_cst_v6=}~ + {=if-equal:{=var-get:boxtype=}~CST Neo~ {=include-block:Y_Blocks.txt;rc_cst_v2=}~ + {=if-equal:{=var-get:boxtype=}~CST Zee~ {=include-block:Y_Blocks.txt;rc_cst_v3=}~ + {=if-equal:{=var-get:boxtype=}~CST Neo Twin~ {=include-block:Y_Blocks.txt;rc_cst_v4=}~ + {=if-equal:{=var-get:boxtype=}~CST Tank~ {=include-block:Y_Blocks.txt;rc_cst_v5=}~ + {=if-equal:{=var-get:boxtype=}~CST Trinity~ {=include-block:Y_Blocks.txt;rc_cst_v6=}~ - {=comment:fallback~=} {=include-block:Y_Blocks.txt;rc_cst_v1=} - =}=}=}=}=}=}=}=}=} + {=comment:fallback~=} {=include-block:Y_Blocks.txt;rc_cst_v1=} + =}=}=}=}=} =}=} ~ {=if-equal:{=var-get:yfbtype=}~-2~ {=include-block:Y_Blocks.txt;rc_dbox_philips=}~ diff --git a/src/nhttpd/web/Y_Live.js b/src/nhttpd/web/Y_Live.js index 2e936f371..77ae189d3 100644 --- a/src/nhttpd/web/Y_Live.js +++ b/src/nhttpd/web/Y_Live.js @@ -16,6 +16,7 @@ var Mode = "tv"; var AudioChannel = 0; var isSubs=false; var g_intervall=null; +var current_channel = 0; /*resize,init*/ function do_onload(){ if(Mode != "tv" && Mode != "radio") @@ -194,7 +195,11 @@ function do_play_state(_state, _options){ if(Mode == "tv" && isUDP) mrl = "udp://@:31330"; else - mrl = loadSyncURL("/control/build_live_url"); + if(current_channel) + mrl = "http://" + window.location.host + ":31339/id=" + current_channel; + else + mrl = loadSyncURL("/control/build_live_url"); + V2.set_actual_mrl(mrl); V2.play(); V2.next(); @@ -236,8 +241,10 @@ function change_channel(){ var dd = id('channels'); var channel = -1; var sel = dd.selectedIndex; - if(sel != -1) + if(sel != -1){ channel = dd[sel].value; + current_channel = channel; + } do_stop(); AudioChannel = 0; window.setTimeout("change_channel_zapto(\""+channel+"\")",100); @@ -246,14 +253,16 @@ function change_sub_channel(){ var dd = id('subs'); var channel = -1; var sel = dd.selectedIndex; - if(sel != -1) + if(sel != -1){ channel = dd[sel].value; + current_channel = channel; + } do_stop(); AudioChannel = 0; window.setTimeout("change_channel_zapto(\""+channel+"\")",100); } function change_channel_zapto(channel){ - dbox_zapto(channel); + //dbox_zapto(channel); window.setTimeout("change_channel_play()",500); } function build_subchannels(){ diff --git a/src/nhttpd/web/Y_Main.css b/src/nhttpd/web/Y_Main.css index b9f71adfe..f6e44e168 100644 --- a/src/nhttpd/web/Y_Main.css +++ b/src/nhttpd/web/Y_Main.css @@ -591,16 +591,42 @@ tr { .y_epg_info #info2 { font-size:8pt; } +.a, .b, .c { + vertical-align: top; +} +.bouquetitemlist .logo_cell { + background: #A1CCF2; + border-bottom: 1px solid white; + margin: 0; + padding: 0; +} +.bouquetitemlist .logo_cell a { + display: table-cell; + text-align: center; + vertical-align: middle; + min-width: 185px; + height: 60px; + padding: 0 5px; +} +.channel_logo { + background: #A1CCF2; + max-width: 175px; +} +.aepg, .bepg, .cepg { + white-space: nowrap; +} .channel_logos { - max-width: 44px; + background: #A1CCF2; + vertical-align: middle; + max-width: 100px; max-height: 40px; } #epg_plus { border-top : #BBBBBB solid 1px; border-left : #BBBBBB solid 1px; border-right : #BBBBBB solid 1px; - margin: 0px; + margin: 1em 0; /* width:auto;*/ overflow:auto; } @@ -612,6 +638,7 @@ tr { min-height: 40px; } .ep_bouquet_name { + background: #A1CCF2; border-right : #BBBBBB solid 1px; width : 100px; /* height: 1.3em;*/ @@ -622,6 +649,12 @@ tr { text-align: center; min-height: 40px; } +.ep_bouquet_name a { + display: table-cell; + vertical-align: middle; + min-width: 100px; + height: 40px; +} .ep_bouquet_item { border-right : #BBBBBB solid 1px; overflow:hidden; @@ -631,6 +664,12 @@ tr { height: 100%; font-size:8pt; } +.ep_bouquet_item:hover { + background-color: #D3E7F8; +} +.ep_bouquet_item span:hover { + cursor: pointer; +} .ep_bouquet_rec { border-right : #BBBBBB solid 1px; overflow:hidden; diff --git a/src/nhttpd/web/Y_Version.txt b/src/nhttpd/web/Y_Version.txt index 56230142c..8c0df9096 100644 --- a/src/nhttpd/web/Y_Version.txt +++ b/src/nhttpd/web/Y_Version.txt @@ -1,4 +1,4 @@ -version=2.8.0.59 -date=12.02.2014 +version=2.8.0.60 +date=01.04.2014 type=Release info=Port CST diff --git a/src/nhttpd/web/languages/Czech b/src/nhttpd/web/languages/Czech new file mode 100644 index 000000000..d747a1703 --- /dev/null +++ b/src/nhttpd/web/languages/Czech @@ -0,0 +1,596 @@ +# yWeb language file (Czech) by marsim21 +# language version: 1.0 +# $Date: 2014-04-09 16:02:10 +0100 (st, 09 Duben 2014) $ +# $Revision: 213 $ +#========= Hlavní / Celkové nastavení +global.no_iframes= Váš prohlížeč nepodporuje i-frame. +clear=Vymazat +submit=Spustit +action=Akce +user=Uživatel +password=Heslo +language=Jazyk +general=Základní +logos=Loga +url=URL +server=Server +refreshing=Aktualizovat ... +refresh=Aktualizuje +record=Nahrávání +zap=Přepnout +lookup=Nahlédnout +save_values_desc=Odeslat a uložit hodnoty +save_values=Ukladaní hodnot ... +save=Uložit +save_all=Uložit vše +administration=Administrace +normal=Normál +management=Menežment +uninstaller=Odinstalovat +send=Odeslat +cancel=Zrušit +answer=Odpověď +reboot=ReBoot +shutdown=Vypnutí +status=Stav +restart=Restart +on=Zapnuto +off=Vypnuto +download=Stáhnut +back=Zpět +date=Datum +from=Od +to=Do +program=Program +others=Ostatní +description=Popis +color=Barva +tag=Název +empty=Prázdný +check=Ověřit +help=Nápověda +attention=Upozornění! +directory=Adresář +filename=Název souboru +restriced_by_management_ip=Omezení Manažmentem-IP +automatic=Automaticé +show=Ukázat +hide=Skrýt + +#======== Hlavní nabídka +main.boxcontrol=Ovládání zařízení +main.boxcontrol_desc=Ovládání zařízení a Oblíbených +main.live=Naživo +main.live_desc=Živá TV, Synchronizace časovače & Nastavení +main.tools=Nástroje +main.tools_desc=Připojení, WOL, Rozšířené nástroje +main.settings=Nastavení +main.settings_desc=Nastavení zařízení, Prohlížeč, Doplńky ... +main.extensions=Rozšíření +main.extensions_desc=Uživatelské rozšíření ... +main.info=Informace +main.info_desc=Informace o yWeb, Aktualizace +main.live_tv_desc=Živá TV +main.live_tv_popup_desc=Okno Živá TV +main.remote_full_desc=Dálkové ovládaní a OSD +main.stream_to_vlc_client_desc=Stream do VLC klienta +main.version=Verze + +#========= Nabídka ovládaní boxu +bc.menue.bouquets_desc=Přepínaní kanálů +bc.menue.bouquets=Oblíbené +bc.menue.control_desc=funkce ovládaní zařízení (reBoot , Dálkové ovládání, SPTS, ...) +bc.menue.control=Ovládání +bc.menue.messages_desc=Poslat Zprávu do zařízení +bc.menue.messages=Zprávy +bc.menue.remote_desc=Webový Dálkový ovladač +bc.menue.remote=Ovladač +bc.menue.lcd_screenshot_desc=Vytvoří obrázek OSD zobrazení v mřížce +bc.menue.lcd_screenshot=Zesnímání OSD obrazovky +bc.menue.lcd_screenshot_desc_ni=lcshot není inštalovaný v /bin nebo /var/bin +bc.menue.screenshot=Zesnímání TV obrazovky +bc.menue.screenshot_desc=vytvoří obrázek z osd a/nebo TV bez mřižky + +bc.menue.decrease_volume=Snížit hlasitost +bc.menue.increase_volume=Zvýšit hlasitost +bc.menue.mute_volume=umlčet hlasitost +bc.menue.switch_to_tv=Přepnout do TV +bc.menue.switch_to_radio=Přepnout do Rádio +bc.menue.webinf_slavebox=Webinterface pro podřízené zařízení +bc.menue.volumen_display=Zobrazení hlasitosti + +bc.menue.signal=Síla signálu + +#========= Ovládání +bc.control.freemem=Volná pamět +bc.control.lock=Zamčené +bc.control.unlock=Odemčené +bc.control.standby_mode=Režim připravenosti +bc.control.recording_mode=Režim nahrávaní +bc.control.box=Box +bc.control.remote=Ovladač +bc.control.playback=Režim přehrávání +bc.control.epg_sectiond=EPG Sekce +bc.control.live_lock=Naživo zamčené +bc.control.reboot.ask=Skutečně restartovat zařízení? +bc.control.reboot=ReBoot +bc.control.shutdown.ask=Skutečně vypnout zařízení? +bc.control.shutdown=Vypnout +bc.control.status=Stav +bc.control.restart=Restart + +========= Ovládání - Zpráva +bc.msg.message_to_screen_desc=Vložte zprávu pro odeslání na TV obrazovku +bc.msg.message_to_screen=Zprávu na obrazovku +bc.msg.popup_to_screen=Zprávu do okna +bc.msg.send_message=Poslat zprávu + +======== Ovládání - Zesnímání obrazu obrazovky +bc.screenshot.create=Zesnímat obrazovku +bc.screenshot.delete=Vymazat obrazovku +bc.screenshot.zoom=Zoomovat obrazovku +bc.screenshot.wait_text=Vytvářím obrázek obrazovky +bc.screenshot.checkenable=OSD a/nebo TV musí být použitý! + +========= Ovládání - Jiné +bc.channels=Kanály + +====== Rozšíření +ext.installer_updater=Instalace/Aktualizace +ext.uninstaller=Odinstalovat rozšíření +ext.search_for_ext=Vyhledávání rozšíření ... +ext.installed_extensions=Instalované rozšíření +ext.type=Typ +ext.extension=Rozšíření +ext.tag=Událost +ext.version=Verze +ext.size=Velikost +ext.uninstall=Odinstalovat +ext.info=Informace +ext.free=Volné +ext.action=Akce +ext.status=Stav +ext.preview=Nastavení nového rozšíření (přehled) +ext.update_preview=Přehled seznamu aktualizácí +ext.your=Vaše +ext.update=Aktuální +ext.update_install=Aktualizovat/instalovat +ext.site=Stránka +ext.refresh_now=Nastavení uložené. Nyní obnovte Menu. +ext.ext_saved=Nastavení rozšíření uložení + +====== Oblíbené +bou.bouquet=Oblíbené +bou.bouquets_must_be_saved=Všechny Oblíbené musí být uložené! +bou.bouquet_editor=Úprava oblíbených +bou.bouquet_add=Přidat oblíbené +bou.name_of_bouquet=Název pro oblíbené +bou.rename_bouquet=Přejmenovat oblíbené +bou.move_up=Přesun nahoru +bou.move_down=přesun dolů +bou.remove=Odstranit +bou.delete=Vymazat +bou.add=Přidat +bou.rename=Přejmenovat +bou.bouqets_saved=Oblíbené uložené +bou.delete1=Skutečně vymazat oblíbené? +bou.delete2=Opravdu odstranit +bou.no_bouquet_name=Nezadaný název oblíbených + +======= EPG +epg.get_epg=Načtení EPG ... +epg.epg_plus=EPG Plus +epg.select_bouquet=Výběr oblíbených - kanály budou aktualizované +epg.hover_for_details=Přesun ukazatela na stanici pro získání podrobností +epg.refresh=Obnovovaní EPG +epg.past_hours=Předchádzející hodiny +epg.next_hours=Následující hodiny +epg.set_timer=Nastavení časovače. Vykonané. +epg.zap_to=Přepnutí na kanál. Vykonané. + +======= EPG Streaminfo +epg.si.streaminfo=Informace streamu +epg.si.resolution=Rozlíšení +epg.si.ratio=Poměr stran +epg.si.fps=Snímek za sekundu +epg.si.audiotype=Druh zvuku +epg.si.frequence=Kmitočet +epg.si.onid=Originální síťový ID (ONID) +epg.si.sid=Služba ID (SID) +epg.si.tsid=Transpondér stream ID (TID) +epg.si.vpid=Obrazový PID +epg.si.pmtpid=Program Map Table PID +epg.si.pcrpid=Program Clock Reference PID +epg.si.apid=Zvukový PID +epg.si.vtxtpid=TeleText PID +epg.si.crypt=Kodovací systém + +======= Nastavení +set.reload_neutrino=Restart Neutrina +set.reboot_required=Nutný ReBoot +set.sync_with_neutrino_desc=Po změnách nastavení přes yWeb:
Vybrat na TV "Hlavní Menu-> Služby-> Restart software", pro přijetí změn uvnitř neutrína.
Po změnách nastavení uvnitř Neutrina:
Vybrat na TV "Hlavní Menu-> Nastavení-> Uložení nastavení", pro použití těchto změn a znovu načíst tuto stránku. +set.sync_with_neutrino=Synchronizovat s Neutrínem + +====== Hlavné nastavenia a Ponuka +set.menue.webserver=Webservr +set.menue.timer_settings=Nastavení tvinfo.de +set.menue.zapit=Přepínání +set.menue.backup_restore=Záloha a Obnova +set.menue.bouquet_editor=Úprava oblíbených +set.menue.video_audio=Obraz / Zvuk +set.menue.parental=Rodičovská kontrola +set.menue.direct_recording=Přímé nahrávání +set.menue.recording=Nahrávání +set.menue.audio_player=Přehrávač hudby +set.menue.esound_server=Server Esound +set.menue.movieplayer=Přehrávač filmů +set.menue.pictureviewer=Prohlížeč obrázků +set.menue.lcd_display=LCD zobrazovač +set.menue.key_settings=Nákres klíče +set.menue.boot_options=Volby zavádění +set.menue.peronalization=Osobní zohlednění +set.menue.plugins=Doplňky +set.menue.others=Ostatní +======= Nastavení nahrávání v Neutrine +set.rec.rec_dest=Umístění nahrávek +set.rec.device=Nahrávací zařízení +set.rec.recmode=Nastavení režimu nahrávání +set.rec.server=Server +set.rec.recorder=Nahrávání na videorekordér +set.rec.file=Soubor +set.rec.recserver_ip=IP serveru nahrávání +set.rec.recserver_port=Port serveru nahrávání +set.rec.recserver_wol=WOL serveru nahrávání +set.rec.mac_adress=MAC adresa +set.rec.rec_behavior=Správa nahrávání +set.rec.stop_playback=Zastavení přehrávání +set.rec.epg_sectionsd_desc=Nastavení nahrávání podle EPG +set.rec.epg_sectionsd=EPG (dílčí ) +set.rec.dont_stop=Nezastavovat +set.rec.stop=Zastavit +set.rec.restart=ReStart +set.rec.zap=Oznámení přepnutí +set.rec.scart=Předcházet přepnutí scartu +set.rec.spts=Nahrávání v SPTS režimu +set.rec.timer_settings=Nastavení korekcí časovače +set.rec.start_delay=Korekce startu nahrávání ( sekundy ) +set.rec.stop_delay=Korekce ukončení nahrávání ( sekundy ) +set.rec.zap_delay=Korekce zapnutí provolby ( sekundy ) +set.rec.audio_channels=Zvukové stopy +set.rec.audio_standard=Standartní kanál nahrávání zvuku +set.rec.audio_alternate=Volitelný kanál módu nahrávání zvuku +set.rec.audio_ac3=Nahrávání DolbyDigital ( AC3 ) zvuku +set.rec.channeldir=Uložit v adresáři kanálu +set.rec.epg_end=Nahrávání až do konce EPG +set.rec.recordtime=Doba záznamu v hodinách +set.rec.timeshift_desc=Časový posun ( Timeshift ) +set.rec.timeshift.pause=Spuštění klávesou PAUSE +set.rec.timeshift.auto_record=Automatické nahrávání ( v sec , 0 = deaktivováno ) +set.rec.timeshift.auto_delete=Automatické vymazání časového posunu +set.rec.timeshift.tmp_timeshift=Dočasný časový posun + +======= Nastavení Movieplayera v Neutrine +set.mp.sources=Volba zdroje +set.mp.streamingserver_ip=IP Stream serveru +set.mp.streamingserver_port=Port Stream serveru +set.mp.streamingserver=Streamovací server +set.mp.dvd_device=DVD zařízení +set.mp.vlc_dir=Adresář (VLC) +set.mp.transcoding=Transkódovanie +set.mp.video_datarate=Datová rychlost obrazu +set.mp.transcode=Transkódovať +set.mp.video_codec=MPEG obrazový kodek +set.mp.resolution=Rozlišení +set.mp.audio_datarate=Datová rychlost zvuku +set.mp.transcode_audio=Transkódovanie zvuku (dvd / vcd / mpg) +set.mp.force_ac3=Jak AC3 pro AVI +set.mp.player=Přehrávač +set.mp.start_directory=Startovací adresář +set.mp.only_movieplayer=Pouze přehrávač filmů +set.mp.used_buffer=Použij buffer (WabberQueue) +set.mp.number_buffersegments=Čislo segmentu bufferu +set.mp.picture_in_browser=TV obrázek v prohlížeči + +======= Rodičovské nastavení v Neutrine +set.parental.activate=Aktivace +set.parental.type.never=Nikdy +set.parental.type.bouquet=Oblíbené +set.parental.type.preset=Předdefinovaným +set.parental.minimum_age=Minimální věk +set.parental.pin=PIN + +======= Nastavení NHTTP +set.nhttpd.webserver=Webserver +set.nhttpd.authentication=Autorizace +set.nhttpd.client_without_authentication_desc=Klient bez kontroly autorizace . Vložení IP . +set.nhttpd.client_without_authentication=Klient bez autorizace +set.nhttpd.active_after_boot=Aktivní po nabootování +set.nhttpd.port=Vydavatel +set.nhttpd.threading=Propojené +set.nhttpd.alternate_web_folder=Alternativní web - adresář +set.nhttpd.hosted_folder=Připojené adresáře +set.nhttpd.allowed_file_extensions=Povolené přípony souboru / MIME +set.nhttpd.allow_all_file_extensions=Povolit všechny přípony souboru +set.nhttpd.url_of_logos_desc=Vložení adresáře s logy stanic +set.nhttpd.url_of_logos=Adresář s logy stanic +set.nhttpd.server=Server +set.nhttpd.ips_without_keep_alive_desc=(např. JTG Server , oddělené s comma ) +set.nhttpd.ips_without_keep_alive=IP s No keep - alive +set.nhttpd.cache=Cache +set.nhttpd.cache_info=Informace o Cache +set.nhttpd.clear_cache=Vyčistit cache +set.nhttpd.server_configuration=Konfigurace serveru +set.nhttpd.check_password=Heslo pro potvrzení , minimum 4 písmena +set.nhttpd.check_port=Port je potřebný + +========= Nastavení yWeb +set.yweb.enter_ip_desc=Zadání IP (xxx.xxx.xxx.xxx) +set.yweb.enter_mac_desc=Zadání MAC adresy (xx: xx: xx: xx: xx: xx) +set.yweb.description=Popis +set.yweb.enter_description_desc=Vložení popisu +set.yweb.management_IPs=Manažovateľné IP +set.yweb.wake_on_lan=Probudit na síti +set.yweb.box_tag_desc=Pojmenování zařízení ve vrchním menu. +set.yweb.box_tag=Název zařízení +set.yweb.box_color_desc=Barva názvu zařízení ve vrchním menu. např.. vložte 2188e0 bez # +set.yweb.box_color=Barva +set.yweb.start_page=Startovní stránka +set.yweb.remote=Ovladač + +======== Nastavení prohlížeče obrázků +set.pv.pictureviewer=Prohlížeč obrázků +set.pv.scale=Zobrazení +set.pv.scale.none=Žádné +set.pv.scale.simple=Jednoduché +set.pv.scale.complex=Kompletní +set.pv.slideshow_duration=Čas prezentace +set.pv.start_dir=Startovací adresář +set.pv.decoding_server_ip=IP do Serveru-Dekódovací +set.pv.decoding_server_port=Port Serveru-Dekódovací + +======== Nastavení přehrávače hudby +set.ap.audioplayer=Přehrávač hudby +set.ap.display_order.actor_title=Umělec, Titul +set.ap.display_order.title_actor=Titul, Umělec +set.ap.display_order=Zobrazení +set.ap.select_actual_track=Volba stopy +set.ap.search_by_name=Hledání podle názvu +set.ap.repeat_mode=Režim opakování +set.ap.show_playlist=Zobrazení seznamu +set.ap.screensaver=Obrazový spořič (min, 0 = vypnuto) +set.ap.decode_priority=Vyšší priorita dekódování +set.ap.start_dir=Startovací adresář +set.ap.parse_shoutcast=Shoutcast Meta-Data + +======= Nastavení časovače +set.timer.header=Nastavení časovače tvinfo.de +set.timer.username=Uživatel +set.timer.password=Heslo +set.timer.klack.url_desc=( " & " bude převedeny do " ; " pro uložení ) +set.timer.klack.url=Osobní RSS TV- Plánovač URL +set.timer.klack.security_code_desc=váš " klackem " Bezpečnostní kód dostane vaše data bez přihlášení +set.timer.klack.security_code=Bezpečnostní kód +set.timer.channel_name_replacelist=Název kanálu směnného seznamu + +======= Nastavení Zálohy / Obnovení +set.settings.backup=Záloha +set.settings.backup_desc=Zálohování vašich nastavení +set.settings.restore=Obnova +set.settings.restore_desc=Nahrání a obnova vašich nastavení . Váš STB bude rebootnutý . +set.settings.warning=Záloha a Obnovení je možné pouze pro tentýž Image se stejnou úrovní vývoje. + +============ Nástroje Info +tools.info.show_messages=Zprávy kernelu +tools.info.processes=Procesy +tools.info.memory=Paměť +tools.info.cpu_info=Informace o CPU +tools.info.mem_info=Informace o paměti +tools.info.partitions=Informace o oddílu +tools.info.mtd=mtd +tools.info.stat=Stav +tools.info.version=Verze + +============ Nástroje yInstaller +tools.yinstaller.no_file_given=Vybrán soubor ! +tools.yinstaller.space.mtd=Celková kapacita +tools.yinstaller.space.user=Použitá +tools.yinstaller.space.free=Volná +tools.yinstaller.space.percentage=Použitá v procentech +tools.yinstaller.not_determine=Nelze určit volná kapacita . +tools.yinstaller.head=yInstaller +tools.yinstaller.tar_file=tar - Soubor +tools.yinstaller.upload_install=Nahrát a instalovat + +============ Nástroje +tools.automount_desc=Správu automaticky připojených souborů +tools.automount=Automatické připojení +tools.mounts_desc=Správa připojených souborů +tools.mounts=Připojení +tools.wake_on_lan=Probudit na síti +tools.check_install=Ověření instalace +tools.expert=Rozšířené +tools.image_desc=Záloha nebo programování paměti +tools.image = Image +tools.command_shell=Příkazy Shell-u +tools.not_installed=Nenainstalované +tools.cmd_shell.output_desc=Automatický posun (pouze IE) +tools.path=Cesta +tools.command=Příkaz +tools.cmd.enter_command=Vložení příkazu pro provedení +tools.cmd.execute_command=Provedení operačního příkazu +tools.boot_logo=Bootovací logo + +=========== Nabídka ŽIVÁ TV +live.heading=ŽIVÁ TV / Časovač +live.live=ŽIVÁ TV +live.tv_popup_desc=ŽIVÁ TV (okno) +live.tv=TV +live.radio_popup_desc=ŽIVÉ Radio (okno) +live.radio=Rádio +live.double_view=Dvojnásobná velikost +live.timer=Časovač +live.epg=EPG +live.epg_plus_popup_desc=EPG + (okno) +live.epg_plus=EPG Plus +live.timer_sync=Synchronizace časovače + +=========== ŽIVÉ TV / Rádio +live.get_stream_info=Získávání
informaci streamování . +live.getting_bouquets=Získávání oblíbených .... +live.getting_channels=Získávání kanálů ... +live.select_resolution=Výběr rozlišení +live.change_channel=Změna kanálu +live.view_epg=Viz EPG pro vybraný kanál +live.reload=Aktualizuj kanály +live.getting_subchannels=Jdi na Subkanály ... +live.mute=Zapni / Vypni hlasitost +live.stop=Zastavit streamování +live.play_or_pause=Přehrát nebo pozastavit streamování +live.lower_volume=Snížit hlasitost +live.higher_volume=Zvýšit hlasitost +live.fullscreen=Přepnutí na celu obrazovku dvojklikem +live.lock_unlock=Zamknout / odemknout TV ( mód uploadovat , rc , lcd ) +live.toggle_udp=UDP Streamování Zap / Vyp +live.settings=Nastavení ŽiváTV +live.snapshot=Udělat snímek obrazovky +live.record=Nahrávací režim +live.transcode=Transkódovací režim +live.build_vlc=... vestavěné řízení vlc ... +live.select_bouquet=Výběr buketu ( kanály budou aktualizovány ) +live.select_channel=Výběr kanálu (použije na přepnutí ) +live.live_popup_msg=V módu Live - View není přepínání kanálů přímo ovládané přes Web , Box - dálkově ovládání +live.unlock=Odblokování RC (dálkové ovládání) + +=========== Nahrávání přes živou Tv +live.rec.record_mode=Režim nahrávání +live.rec.filename=Název souboru +live.rec.display_on=Zapnout zobrazení +live.rec.transcoding_on=Zapnout transkódovanie +live.rec.record=Spustit nahrávání +live.rec.stop_record=Zastavit nahrávání +live.rec.tanscode=Transkódovanie nahrávání +live.rec.profile=Profily +live.rec.video=Obraz +live.rec.width=Šířka +live.rec.height=Výška +live.rec.codec=Kodek +live.rec.bitrate=Bitrate +live.rec.scale=Měřítko +live.rec.audio=Zvuk +live.rec.channels=Kanály +live.rec.trans_broadcast=Transkódované vysílání +live.rec.access=Přístup +live.rec.type=Typ +live.rec.ip_port=IP : Port + +=========== Nastavení ŽIVÁ TV +live.set.vlc_settings=Nastavení VLC ( IE & Mozilla > = 0.8.6.1 ) +live.set.deinterlace=Deinterlace +live.set.http_caching=Vyrovnávací paměť http +live.set.udp_defaul=Přednastavit UDP port +live.set.slavebox_ip=IP druhého Boxu ( 2. dbox ) +live.set.enter_ip=Vložit IP ( xxx.xxx.xxx.xxx ) druhého Boxu +live.set.vlc_rec_dir=VLC nahrávací adresář +live.set.refresh_liveview=Obnovit ŽiváTV + +=========== ŽIVÉ Timer Edit +live.timer_edit.timer=Úprava časovače +live.timer_edit.times=Časy +live.timer_edit.alarm_date=Nastavená doba spuštění +live.timer_edit.time=Čas +live.timer_edit.stop_date=Nastavená doba zastavení +live.timer_edit.repeat=Opakování +live.timer_edit.repeat1=Opakování [ 0 - bez omezení ] +live.timer_edit.weekdays.format=( Pon - Ned , X = Timer ) +live.timer_edit.weekdays=Týdně +live.timer_edit.values ​=Hodnoty +live.timer_edit.channel=Kanál +live.timer_edit.apids=Audio pidy +live.timer_edit.apids.default=Přednastavené +live.timer_edit.apids.standard=Standartní +live.timer_edit.apids.alt=Alternativa +live.timer_edit.apids.ac3=AC3 +live.timer_edit.apids=A - pidy +live.timer_edit.standby=Režim spánku +live.timer_edit.plugin=Doplněk +live.timer_edit.rec_dir=Adresář nahrávání +live.timer_edit.description=Popis + +=========== LIVE Timer Sync +live.timer-sync.get_timer=Načíst časovač . +live.timer-sync.header=Synchronizace TVInfo časovače +live.timer-sync.timer_source=Zdroj časovače +live.timer-sync.rec_dir=Nahrávací adresář +live.timer-sync.settings=Nastavení +live.timer-sync.debugging=Debugování +live.timer-sync.get_selected=Načítání vybraných +live.timer-sync.clear_all=Smazat vše +live.timer-sync.timer_preview=Přehledový seznam časovače +live.timer-sync.start_time=Čas začátku +live.timer-sync.end_time=Čas konce +live.timer-sync.channel=Kanál +live.timer-sync.programm=Relace +live.timer-sync.source=Zdroj +live.timer-sync.set_timer=Nastav časovač +live.timer-sync.clear_log=Vyčisti log +live.timer-sync.log=Log +live.timer-sync.action=Akce +live.timer-sync.status=Stav + +========== INFO +info.hel=Pomoc +info.About=O programu +info.check_for_updates=Kontrola aktualizace +info.your_version=Vaše instalována verze +info.actual_version=Aktuální verze + +========= Dálkové ovládání +rc.key_power=Spánek +rc.key_mute=Umlčení +rc.key_1=1 +rc.key_2=2 +rc.key_3=3 +rc.key_4=4 +rc.key_5=5 +rc.key_6=6 +rc.key_7=7 +rc.key_8=8 +rc.key_9=9 +rc.key_0=0 +rc.key_text=TXT +rc.key_favorites=Oblíbené +rc.key_volumeup=Hlas + +rc.key_volumedown=Hlas - +rc.key_pageup=Strana + +rc.key_pagedown=Strana - +rc.key_mode=TV / Radio +rc.key_next=Vynechat - +rc.key_previous=Vynechat + +rc.key_sleep=Uspat +rc.key_audio=Zvuk +rc.key_help=Pomoc +rc.key_red=Červený +rc.key_green=Zelený +rc.key_yellow=Žlutý +rc.key_blue=Modrý +rc.key_epg=EPG +rc.key_info=Info +rc.key_ok=OK +rc.key_up=Nahoru +rc.key_down=Dolů +rc.key_left=Vlevo +rc.key_right=Vpravo +rc.key_setup=Nabídka +rc.key_home=Ukončit +rc.key_sat=Družice +rc.key_www= +rc.key_rewind=Vpřed +rc.key_play=Přehrát +rc.key_forward=Vzad +rc.key_stop=Zastavit +rc.key_record=Nahrát +rc.key_pause=Pozastavit +rc.key_games= +rc.key_time= +rc.key_picsize=Velikost obrazu +rc.key_picmode=Režim obrazu diff --git a/src/nhttpd/web/languages/Makefile.am b/src/nhttpd/web/languages/Makefile.am index ed32f57d3..036c37d42 100644 --- a/src/nhttpd/web/languages/Makefile.am +++ b/src/nhttpd/web/languages/Makefile.am @@ -1,4 +1,4 @@ installdir = $(DATADIR)/neutrino/httpd/languages -install_DATA = Deutsch English Portuguese Slovak +install_DATA = Czech Deutsch English Portuguese Slovak diff --git a/src/system/debug.h b/src/system/debug.h index 9ba7bfc83..62ea60732 100644 --- a/src/system/debug.h +++ b/src/system/debug.h @@ -27,9 +27,15 @@ extern int debug; -#define DEBUG_NORMAL 0 -#define DEBUG_INFO 1 -#define DEBUG_DEBUG 2 +enum +{ + DEBUG_NORMAL , // 0 + DEBUG_INFO , // 1 + DEBUG_DEBUG , // 2 + + DEBUG_MODES // 3 count of available modes +}; + void setDebugLevel( int level ); diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 18c01ed43..12f6222c5 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -404,6 +404,50 @@ time_t toEpoch(std::string &date) } +std::string& str_replace(const std::string &search, const std::string &replace, std::string &text) +{ + if (search.empty() || text.empty()) + return text; + + size_t searchLen = search.length(); + while (1) { + size_t pos = text.find(search); + if (pos == std::string::npos) + break; + text.replace(pos, searchLen, replace); + } + return text; +} + +std::string& htmlEntityDecode(std::string& text) +{ + struct decode_table { + const char* code; + const char* htmlCode; + }; + decode_table dt[] = + { + {" ", " "}, + {"&", "&"}, + {"<", "<"}, + {">", ">"}, + {"\"", """}, + {"'", "'"}, + {"€", "€"}, + {"–", "–"}, + {"“", "“"}, + {"”", "”"}, + {"„", "„"}, + {"•", "•"}, + {"…", "…"}, + {NULL, NULL} + }; + for (int i = 0; dt[i].code != NULL; i++) + text = str_replace(dt[i].htmlCode, dt[i].code, text); + + return text; +} + CFileHelpers::CFileHelpers() { FileBufSize = 0xFFFF; @@ -662,3 +706,20 @@ void hdd_flush(const char * fname) close(fd); } } + +/* split string like PARAM1=value1 PARAM2=value2 into map */ +bool split_config_string(const std::string &str, std::map &smap) +{ + smap.clear(); + std::string::size_type start = 0; + std::string::size_type end = 0; + while ((end = str.find(" ", start)) != std::string::npos) { + std::string param = str.substr(start, end - start); + std::string::size_type i = param.find("="); + if (i != std::string::npos) { + smap[param.substr(0,i).c_str()] = param.substr(i+1).c_str(); + } + start = end + 1; + } + return !smap.empty(); +} diff --git a/src/system/helpers.h b/src/system/helpers.h index 161544b27..0612e4562 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -23,8 +23,10 @@ */ #include +#include #include #include +#include int my_system(const char * cmd); int my_system(int argc, const char *arg, ...); /* argc is number of arguments including command */ @@ -53,6 +55,8 @@ std::string getFileExt(std::string &file); std::string getNowTimeStr(const char* format); std::string trim(std::string &str, const std::string &trimChars = " \n\r\t"); time_t toEpoch(std::string &date); +std::string& str_replace(const std::string &search, const std::string &replace, std::string &text); +std::string& htmlEntityDecode(std::string& text); class CFileHelpers { @@ -79,4 +83,7 @@ template std::string to_string(C i) return s.str(); } +inline void cstrncpy(char *dest, const char * const src, size_t n) { n--; strncpy(dest, src, n); dest[n] = 0; } +inline void cstrncpy(char *dest, const std::string &src, size_t n) { n--; strncpy(dest, src.c_str(), n); dest[n] = 0; } +bool split_config_string(const std::string &str, std::map &smap); #endif diff --git a/src/system/localize.cpp b/src/system/localize.cpp index 6a3f2cb1d..c1be218fe 100644 --- a/src/system/localize.cpp +++ b/src/system/localize.cpp @@ -108,7 +108,8 @@ CLocaleManager::~CLocaleManager() ::free(defaultDataMem); } -const char * path[2] = { CONFIGDIR "/locale/", DATADIR "/neutrino/locale/"}; +#define LOCALEDIR_VAR "/var/tuxbox/locale/" +const char * path[2] = { LOCALEDIR_VAR, DATADIR "/neutrino/locale/"}; CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const locale, bool asdefault) { diff --git a/src/system/locals.h b/src/system/locals.h index 51c2dd90a..2df3143e2 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -267,6 +267,7 @@ typedef enum LOCALE_CHANNELLIST_NUMERIC_ADJUST, LOCALE_CHANNELLIST_PROVS, LOCALE_CHANNELLIST_RECORDING_NOT_POSSIBLE, + LOCALE_CHANNELLIST_REMEMBER, LOCALE_CHANNELLIST_RESET_ALL, LOCALE_CHANNELLIST_RESET_FLAGS, LOCALE_CHANNELLIST_SATS, @@ -343,6 +344,11 @@ typedef enum LOCALE_DATE_THU, LOCALE_DATE_TUE, LOCALE_DATE_WED, + LOCALE_DEBUG, + LOCALE_DEBUG_LEVEL, + LOCALE_DEBUG_LEVEL_1, + LOCALE_DEBUG_LEVEL_2, + LOCALE_DEBUG_LEVEL_3, LOCALE_EPG_SAVING, LOCALE_EPGEXTENDED_ACTORS, LOCALE_EPGEXTENDED_DIRECTOR, @@ -430,6 +436,7 @@ typedef enum LOCALE_EXTRA_MENU_LEFT_EXIT, LOCALE_EXTRA_NORTH, LOCALE_EXTRA_RECORD_TIME, + LOCALE_EXTRA_RECORD_TIME_TS, LOCALE_EXTRA_ROTOR_SWAP, LOCALE_EXTRA_ROUNDED_CORNERS, LOCALE_EXTRA_ROUNDED_CORNERS_OFF, @@ -650,12 +657,18 @@ typedef enum LOCALE_HDD_FS_UNKNOWN, LOCALE_HDD_MANAGE, LOCALE_HDD_MIDDLE, + LOCALE_HDD_MOUNT, + LOCALE_HDD_MOUNT_OK, + LOCALE_HDD_MOUNT_FAILED, + LOCALE_HDD_MOUNT_UMOUNT, LOCALE_HDD_NOISE, LOCALE_HDD_NOT_FOUND, LOCALE_HDD_REMOVABLE_DEVICE, LOCALE_HDD_SETTINGS, LOCALE_HDD_SLEEP, LOCALE_HDD_SLOW, + LOCALE_HDD_UMOUNT, + LOCALE_HDD_UMOUNTED, LOCALE_HDD_UMOUNT_WARN, LOCALE_IMAGEINFO_CREATOR, LOCALE_IMAGEINFO_DATE, @@ -702,6 +715,7 @@ typedef enum LOCALE_KEYBINDINGMENU_CHANNELUP, LOCALE_KEYBINDINGMENU_HEAD, LOCALE_KEYBINDINGMENU_LASTCHANNEL, + LOCALE_KEYBINDINGMENU_LONGKEYPRESS_DURATION, LOCALE_KEYBINDINGMENU_MISC, LOCALE_KEYBINDINGMENU_MODE_LEFT_RIGHT_KEY_TV, LOCALE_KEYBINDINGMENU_MODE_LEFT_RIGHT_KEY_TV_INFOBAR, @@ -765,6 +779,9 @@ typedef enum LOCALE_LEDCONTROLER_ON_ALL, LOCALE_LEDCONTROLER_ON_LED1, LOCALE_LEDCONTROLER_ON_LED2, + LOCALE_LUA_FUNCTION_DEPRECATED1, + LOCALE_LUA_FUNCTION_DEPRECATED2, + LOCALE_LUA_FUNCTION_DEPRECATED3, LOCALE_MAINMENU_AUDIOPLAYER, LOCALE_MAINMENU_CHANNELS, LOCALE_MAINMENU_CLEARSECTIONSD, @@ -831,6 +848,7 @@ typedef enum LOCALE_MENU_HINT_AUTO_LANG, LOCALE_MENU_HINT_AUTO_SUBS, LOCALE_MENU_HINT_BACK, + LOCALE_MENU_HINT_BACK_BRIEF, LOCALE_MENU_HINT_BACKLIGHT, LOCALE_MENU_HINT_BACKUP, LOCALE_MENU_HINT_BEDIT, @@ -845,6 +863,8 @@ typedef enum LOCALE_MENU_HINT_CHANNELLIST_EXTENDED, LOCALE_MENU_HINT_CHANNELLIST_FONTS, LOCALE_MENU_HINT_CHANNELLIST_FOOT, + LOCALE_MENU_HINT_CHANNELLIST_MODE, + LOCALE_MENU_HINT_CHANNELLIST_MODE_RADIO, LOCALE_MENU_HINT_CHANNELLIST_SETUP, LOCALE_MENU_HINT_CHANNELLIST_SHOW_CHANNELLOGO, LOCALE_MENU_HINT_CHANNELS, @@ -870,6 +890,7 @@ typedef enum LOCALE_MENU_HINT_EPG_SAVE, LOCALE_MENU_HINT_EPG_SAVE_STANDBY, LOCALE_MENU_HINT_EPG_SCAN, + LOCALE_MENU_HINT_EPG_SCAN_MODE, LOCALE_MENU_HINT_EVENT_TEXTCOLOR, LOCALE_MENU_HINT_EVENTLIST_ADDITIONAL, LOCALE_MENU_HINT_EVENTLIST_FONTS, @@ -961,6 +982,7 @@ typedef enum LOCALE_MENU_HINT_KEY_PIP_CLOSE, LOCALE_MENU_HINT_KEY_PIP_SETUP, LOCALE_MENU_HINT_KEY_PIP_SWAP, + LOCALE_MENU_HINT_KEY_PLUGIN, LOCALE_MENU_HINT_KEY_POWEROFF, LOCALE_MENU_HINT_KEY_QUICKZAP, LOCALE_MENU_HINT_KEY_REPEATBLOCK, @@ -987,6 +1009,7 @@ typedef enum LOCALE_MENU_HINT_LEDS_STANDBY, LOCALE_MENU_HINT_LEDS_TV, LOCALE_MENU_HINT_LOAD, + LOCALE_MENU_HINT_LONGKEYPRESS_DURATION, LOCALE_MENU_HINT_LUA, LOCALE_MENU_HINT_MAKE_HDLIST, LOCALE_MENU_HINT_MAKE_NEWLIST, @@ -1006,6 +1029,7 @@ typedef enum LOCALE_MENU_HINT_MISC_GENERAL, LOCALE_MENU_HINT_MISC_ZAPIT, LOCALE_MENU_HINT_MOVIE, + LOCALE_MENU_HINT_MOVIEPLAYER_PLUGIN, LOCALE_MENU_HINT_NET_BROADCAST, LOCALE_MENU_HINT_NET_DHCP, LOCALE_MENU_HINT_NET_DJMOUNT, @@ -1041,6 +1065,9 @@ typedef enum LOCALE_MENU_HINT_NETWORK, LOCALE_MENU_HINT_NEW_ZAP_MODE, LOCALE_MENU_HINT_NUMERIC_ADJUST, + LOCALE_MENU_HINT_ONEKEY_PLUGIN, + LOCALE_MENU_HINT_OPKG, + LOCALE_MENU_HINT_OPKG_UPGRADE, LOCALE_MENU_HINT_OSD, LOCALE_MENU_HINT_OSD_LANGUAGE, LOCALE_MENU_HINT_OSD_PRESET, @@ -1071,16 +1098,19 @@ typedef enum LOCALE_MENU_HINT_RECORD_APID_STD, LOCALE_MENU_HINT_RECORD_APIDS, LOCALE_MENU_HINT_RECORD_APPLY, + LOCALE_MENU_HINT_RECORD_AUTO_COVER, LOCALE_MENU_HINT_RECORD_CHANDIR, LOCALE_MENU_HINT_RECORD_DATA, LOCALE_MENU_HINT_RECORD_DATA_DVBSUB, LOCALE_MENU_HINT_RECORD_DATA_VTXT, LOCALE_MENU_HINT_RECORD_DIR, LOCALE_MENU_HINT_RECORD_END, + LOCALE_MENU_HINT_RECORD_FILENAME_TEMPLATE, LOCALE_MENU_HINT_RECORD_SLOW_WARN, LOCALE_MENU_HINT_RECORD_STARTSTOP_MSG, LOCALE_MENU_HINT_RECORD_TDIR, LOCALE_MENU_HINT_RECORD_TIME, + LOCALE_MENU_HINT_RECORD_TIME_TS, LOCALE_MENU_HINT_RECORD_TIMEAFTER, LOCALE_MENU_HINT_RECORD_TIMEBEFORE, LOCALE_MENU_HINT_RECORD_TIMER, @@ -1112,8 +1142,10 @@ typedef enum LOCALE_MENU_HINT_SCAN_DISEQCREPEAT, LOCALE_MENU_HINT_SCAN_DISEQCTYPE, LOCALE_MENU_HINT_SCAN_FAST, + LOCALE_MENU_HINT_SCAN_FASTDISEQC, LOCALE_MENU_HINT_SCAN_FASTPROV, LOCALE_MENU_HINT_SCAN_FASTTYPE, + LOCALE_MENU_HINT_SCAN_FASTUPDATE, LOCALE_MENU_HINT_SCAN_FEC, LOCALE_MENU_HINT_SCAN_FELINK, LOCALE_MENU_HINT_SCAN_FEMODE, @@ -1133,6 +1165,7 @@ typedef enum LOCALE_MENU_HINT_SCAN_LONGITUDE, LOCALE_MENU_HINT_SCAN_MANUAL, LOCALE_MENU_HINT_SCAN_MOD, + LOCALE_MENU_HINT_SCAN_MOTOR, LOCALE_MENU_HINT_SCAN_MOTOR_18V, LOCALE_MENU_HINT_SCAN_MOTOR_SPEED, LOCALE_MENU_HINT_SCAN_MOTORPOS, @@ -1157,6 +1190,7 @@ typedef enum LOCALE_MENU_HINT_SCAN_TEST, LOCALE_MENU_HINT_SCAN_TPSELECT, LOCALE_MENU_HINT_SCAN_UNCOMMITED, + LOCALE_MENU_HINT_SCAN_USALS, LOCALE_MENU_HINT_SCAN_USALS_REPEAT, LOCALE_MENU_HINT_SCAN_USALSALL, LOCALE_MENU_HINT_SCAN_USEUSALS, @@ -1228,6 +1262,7 @@ typedef enum LOCALE_MENU_HINT_VIDEO_PIP, LOCALE_MENU_HINT_VIDEO_SATURATION, LOCALE_MENU_HINT_VIDEO_SCART_MODE, + LOCALE_MENU_HINT_VIDEO_SDOSD, LOCALE_MENU_HINT_VOLUME, LOCALE_MENU_HINT_VOLUME_DIGITS, LOCALE_MENU_HINT_VOLUME_POS, @@ -1268,8 +1303,12 @@ typedef enum LOCALE_MISCSETTINGS_EPG_SAVE, LOCALE_MISCSETTINGS_EPG_SAVE_STANDBY, LOCALE_MISCSETTINGS_EPG_SCAN, + LOCALE_MISCSETTINGS_EPG_SCAN_ALWAYS, LOCALE_MISCSETTINGS_EPG_SCAN_BQ, LOCALE_MISCSETTINGS_EPG_SCAN_FAV, + LOCALE_MISCSETTINGS_EPG_SCAN_LIVE, + LOCALE_MISCSETTINGS_EPG_SCAN_SEL, + LOCALE_MISCSETTINGS_EPG_SCAN_STANDBY, LOCALE_MISCSETTINGS_GENERAL, LOCALE_MISCSETTINGS_HEAD, LOCALE_MISCSETTINGS_INFOBAR, @@ -1591,6 +1630,19 @@ typedef enum LOCALE_NVODSELECTOR_DIRECTORMODE, LOCALE_NVODSELECTOR_HEAD, LOCALE_NVODSELECTOR_SUBSERVICE, + LOCALE_OPKG_BUTTON_EXPERT_OFF, + LOCALE_OPKG_BUTTON_EXPERT_ON, + LOCALE_OPKG_BUTTON_INFO, + LOCALE_OPKG_BUTTON_INSTALL, + LOCALE_OPKG_BUTTON_UNINSTALL, + LOCALE_OPKG_FAILURE_INSTALL, + LOCALE_OPKG_FAILURE_UPDATE, + LOCALE_OPKG_FAILURE_UPGRADE, + LOCALE_OPKG_MESSAGEBOX_REINSTALL, + LOCALE_OPKG_MESSAGEBOX_REMOVE, + LOCALE_OPKG_SUCCESS_INSTALL, + LOCALE_OPKG_TITLE, + LOCALE_OPKG_UPGRADE, LOCALE_OPTIONS_DEFAULT, LOCALE_OPTIONS_FB, LOCALE_OPTIONS_NTP_OFF, @@ -1711,6 +1763,7 @@ typedef enum LOCALE_RECORDINGMENU_APIDS_AC3, LOCALE_RECORDINGMENU_APIDS_ALT, LOCALE_RECORDINGMENU_APIDS_STD, + LOCALE_RECORDINGMENU_AUTO_COVER, LOCALE_RECORDINGMENU_DATA_PIDS, LOCALE_RECORDINGMENU_DEFDIR, LOCALE_RECORDINGMENU_DVBSUB_PIDS, @@ -1718,6 +1771,9 @@ typedef enum LOCALE_RECORDINGMENU_END_OF_RECORDING_MAX, LOCALE_RECORDINGMENU_END_OF_RECORDING_NAME, LOCALE_RECORDINGMENU_FILE, + LOCALE_RECORDINGMENU_FILENAME_TEMPLATE, + LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT, + LOCALE_RECORDINGMENU_FILENAME_TEMPLATE_HINT2, LOCALE_RECORDINGMENU_HELP, LOCALE_RECORDINGMENU_MULTIMENU_ASK_STOP_ALL, LOCALE_RECORDINGMENU_MULTIMENU_INFO_STOP_ALL, @@ -1761,14 +1817,24 @@ typedef enum LOCALE_SATSETUP_EXTENDED, LOCALE_SATSETUP_EXTENDED_MOTOR, LOCALE_SATSETUP_FASTSCAN_ALL, + LOCALE_SATSETUP_FASTSCAN_AUTO_DISEQC, + LOCALE_SATSETUP_FASTSCAN_AUTO_DISEQC_WAIT, LOCALE_SATSETUP_FASTSCAN_HD, LOCALE_SATSETUP_FASTSCAN_HEAD, LOCALE_SATSETUP_FASTSCAN_PROV, - LOCALE_SATSETUP_FASTSCAN_PROV_CD, - LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT, - LOCALE_SATSETUP_FASTSCAN_PROV_TVV, + LOCALE_SATSETUP_FASTSCAN_PROV_CD_HD, + LOCALE_SATSETUP_FASTSCAN_PROV_CD_SD, + LOCALE_SATSETUP_FASTSCAN_PROV_HDA, + LOCALE_SATSETUP_FASTSCAN_PROV_HELLO, + LOCALE_SATSETUP_FASTSCAN_PROV_SKYLINK_C, + LOCALE_SATSETUP_FASTSCAN_PROV_SKYLINK_S, + LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT_B, + LOCALE_SATSETUP_FASTSCAN_PROV_TELESAT_L, + LOCALE_SATSETUP_FASTSCAN_PROV_TVV_HD, + LOCALE_SATSETUP_FASTSCAN_PROV_TVV_SD, LOCALE_SATSETUP_FASTSCAN_SD, LOCALE_SATSETUP_FASTSCAN_TYPE, + LOCALE_SATSETUP_FASTSCAN_UPDATE, LOCALE_SATSETUP_FE_MODE, LOCALE_SATSETUP_FE_MODE_INDEPENDENT, LOCALE_SATSETUP_FE_MODE_LINK_LOOP, @@ -1902,8 +1968,10 @@ typedef enum LOCALE_STREAMING_WRITE_ERROR, LOCALE_STRINGINPUT_CAPS, LOCALE_STRINGINPUT_CLEAR, + LOCALE_SUBTITLES_CHARSET, LOCALE_SUBTITLES_HEAD, LOCALE_SUBTITLES_STOP, + LOCALE_TERRESTRIALSETUP_AREA, LOCALE_TERRESTRIALSETUP_PROVIDER, LOCALE_TIMER_EVENTRECORD_MSG, LOCALE_TIMER_EVENTRECORD_TITLE, @@ -2058,6 +2126,7 @@ typedef enum LOCALE_VIDEOMENU_SATURATION, LOCALE_VIDEOMENU_SCART, LOCALE_VIDEOMENU_SCREENSETUP, + LOCALE_VIDEOMENU_SDOSD, LOCALE_VIDEOMENU_SHARPNESS, LOCALE_VIDEOMENU_TV_SCART, LOCALE_VIDEOMENU_VCRSIGNAL, @@ -2084,6 +2153,8 @@ typedef enum LOCALE_ZAPIT_SCANTYPE_RADIO, LOCALE_ZAPIT_SCANTYPE_TV, LOCALE_ZAPIT_SCANTYPE_TVRADIO, + LOCALE_ZAPITSETUP_CHANNELMODE, + LOCALE_ZAPITSETUP_CHANNELMODE_RADIO, LOCALE_ZAPITSETUP_HEAD, LOCALE_ZAPITSETUP_INFO, LOCALE_ZAPITSETUP_LAST_RADIO, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 4ee043bff..6b90b98a0 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -267,6 +267,7 @@ const char * locale_real_names[] = "channellist.numeric_adjust", "channellist.provs", "channellist.recording_not_possible", + "channellist.remember", "channellist.reset_all", "channellist.reset_flags", "channellist.sats", @@ -343,6 +344,11 @@ const char * locale_real_names[] = "date.Thu", "date.Tue", "date.Wed", + "debug", + "debug.level", + "debug.level_1", + "debug.level_2", + "debug.level_3", "epg.saving", "epgextended.actors", "epgextended.director", @@ -430,6 +436,7 @@ const char * locale_real_names[] = "extra.menu_left_exit", "extra.north", "extra.record_time", + "extra.record_time_ts", "extra.rotor_swap", "extra.rounded_corners", "extra.rounded_corners_off", @@ -650,12 +657,18 @@ const char * locale_real_names[] = "hdd_fs_unknown", "hdd_manage", "hdd_middle", + "hdd_mount", + "hdd_mount_ok", + "hdd_mount_failed", + "hdd_mount_umount", "hdd_noise", "hdd_not_found", "hdd_removable_device", "hdd_settings", "hdd_sleep", "hdd_slow", + "hdd_umount", + "hdd_umounted", "hdd_umount_warn", "imageinfo.creator", "imageinfo.date", @@ -702,6 +715,7 @@ const char * locale_real_names[] = "keybindingmenu.channelup", "keybindingmenu.head", "keybindingmenu.lastchannel", + "keybindingmenu.longkeypress_duration", "keybindingmenu.misc", "keybindingmenu.mode_left_right_key_tv", "keybindingmenu.mode_left_right_key_tv_infobar", @@ -765,6 +779,9 @@ const char * locale_real_names[] = "ledcontroler.on.all", "ledcontroler.on.led1", "ledcontroler.on.led2", + "lua.function_deprecated1", + "lua.function_deprecated2", + "lua.function_deprecated3", "mainmenu.audioplayer", "mainmenu.channels", "mainmenu.clearsectionsd", @@ -831,6 +848,7 @@ const char * locale_real_names[] = "menu.hint_auto_lang", "menu.hint_auto_subs", "menu.hint_back", + "menu.hint_back_brief", "menu.hint_backlight", "menu.hint_backup", "menu.hint_bedit", @@ -845,6 +863,8 @@ const char * locale_real_names[] = "menu.hint_channellist_extended", "menu.hint_channellist_fonts", "menu.hint_channellist_foot", + "menu.hint_channellist_mode", + "menu.hint_channellist_mode_radio", "menu.hint_channellist_setup", "menu.hint_channellist_show_channellogo", "menu.hint_channels", @@ -870,6 +890,7 @@ const char * locale_real_names[] = "menu.hint_epg_save", "menu.hint_epg_save_standby", "menu.hint_epg_scan", + "menu.hint_epg_scan_mode", "menu.hint_event_textcolor", "menu.hint_eventlist_additional", "menu.hint_eventlist_fonts", @@ -961,6 +982,7 @@ const char * locale_real_names[] = "menu.hint_key_pip_close", "menu.hint_key_pip_setup", "menu.hint_key_pip_swap", + "menu.hint_key_plugin", "menu.hint_key_poweroff", "menu.hint_key_quickzap", "menu.hint_key_repeatblock", @@ -987,6 +1009,7 @@ const char * locale_real_names[] = "menu.hint_leds_standby", "menu.hint_leds_tv", "menu.hint_load", + "menu.hint_longkeypress_duration", "menu.hint_lua", "menu.hint_make_hdlist", "menu.hint_make_newlist", @@ -1006,6 +1029,7 @@ const char * locale_real_names[] = "menu.hint_misc_general", "menu.hint_misc_zapit", "menu.hint_movie", + "menu.hint_movieplayer_plugin", "menu.hint_net_broadcast", "menu.hint_net_dhcp", "menu.hint_net_djmount", @@ -1041,6 +1065,9 @@ const char * locale_real_names[] = "menu.hint_network", "menu.hint_new_zap_mode", "menu.hint_numeric_adjust", + "menu.hint_onekey_plugin", + "menu.hint_opkg", + "menu.hint_opkg_upgrade", "menu.hint_osd", "menu.hint_osd_language", "menu.hint_osd_preset", @@ -1071,16 +1098,19 @@ const char * locale_real_names[] = "menu.hint_record_apid_std", "menu.hint_record_apids", "menu.hint_record_apply", + "menu.hint_record_auto_cover", "menu.hint_record_chandir", "menu.hint_record_data", "menu.hint_record_data_dvbsub", "menu.hint_record_data_vtxt", "menu.hint_record_dir", "menu.hint_record_end", + "menu.hint_record_filename_template", "menu.hint_record_slow_warn", "menu.hint_record_startstop_msg", "menu.hint_record_tdir", "menu.hint_record_time", + "menu.hint_record_time_ts", "menu.hint_record_timeafter", "menu.hint_record_timebefore", "menu.hint_record_timer", @@ -1112,8 +1142,10 @@ const char * locale_real_names[] = "menu.hint_scan_diseqcrepeat", "menu.hint_scan_diseqctype", "menu.hint_scan_fast", + "menu.hint_scan_fastdiseqc", "menu.hint_scan_fastprov", "menu.hint_scan_fasttype", + "menu.hint_scan_fastupdate", "menu.hint_scan_fec", "menu.hint_scan_felink", "menu.hint_scan_femode", @@ -1133,6 +1165,7 @@ const char * locale_real_names[] = "menu.hint_scan_longitude", "menu.hint_scan_manual", "menu.hint_scan_mod", + "menu.hint_scan_motor", "menu.hint_scan_motor_18v", "menu.hint_scan_motor_speed", "menu.hint_scan_motorpos", @@ -1157,6 +1190,7 @@ const char * locale_real_names[] = "menu.hint_scan_test", "menu.hint_scan_tpselect", "menu.hint_scan_uncommited", + "menu.hint_scan_usals", "menu.hint_scan_usals_repeat", "menu.hint_scan_usalsall", "menu.hint_scan_useusals", @@ -1228,6 +1262,7 @@ const char * locale_real_names[] = "menu.hint_video_pip", "menu.hint_video_saturation", "menu.hint_video_scart_mode", + "menu.hint_video_sdosd", "menu.hint_volume", "menu.hint_volume_digits", "menu.hint_volume_pos", @@ -1268,8 +1303,12 @@ const char * locale_real_names[] = "miscsettings.epg_save", "miscsettings.epg_save_standby", "miscsettings.epg_scan", + "miscsettings.epg_scan_always", "miscsettings.epg_scan_bq", "miscsettings.epg_scan_fav", + "miscsettings.epg_scan_live", + "miscsettings.epg_scan_sel", + "miscsettings.epg_scan_standby", "miscsettings.general", "miscsettings.head", "miscsettings.infobar", @@ -1591,6 +1630,19 @@ const char * locale_real_names[] = "nvodselector.directormode", "nvodselector.head", "nvodselector.subservice", + "opkg.button.expert_off", + "opkg.button.expert_on", + "opkg.button.info", + "opkg.button.install", + "opkg.button.uninstall", + "opkg.failure.install", + "opkg.failure.update", + "opkg.failure.upgrade", + "opkg.messagebox.reinstall", + "opkg.messagebox.remove", + "opkg.success.install", + "opkg.title", + "opkg.upgrade", "options.default", "options.fb", "options.ntp_off", @@ -1711,6 +1763,7 @@ const char * locale_real_names[] = "recordingmenu.apids_ac3", "recordingmenu.apids_alt", "recordingmenu.apids_std", + "recordingmenu.auto_cover", "recordingmenu.data_pids", "recordingmenu.defdir", "recordingmenu.dvbsub_pids", @@ -1718,6 +1771,9 @@ const char * locale_real_names[] = "recordingmenu.end_of_recording_max", "recordingmenu.end_of_recording_name", "recordingmenu.file", + "recordingmenu.filename_template", + "recordingmenu.filename_template_hint", + "recordingmenu.filename_template_hint2", "recordingmenu.help", "recordingmenu.multimenu.ask_stop_all", "recordingmenu.multimenu.info_stop_all", @@ -1761,14 +1817,24 @@ const char * locale_real_names[] = "satsetup.extended", "satsetup.extended_motor", "satsetup.fastscan_all", + "satsetup.fastscan_auto_diseqc", + "satsetup.fastscan_auto_diseqc_wait", "satsetup.fastscan_hd", "satsetup.fastscan_head", "satsetup.fastscan_prov", - "satsetup.fastscan_prov_cd", - "satsetup.fastscan_prov_telesat", - "satsetup.fastscan_prov_tvv", + "satsetup.fastscan_prov_cd_hd", + "satsetup.fastscan_prov_cd_sd", + "satsetup.fastscan_prov_hda", + "satsetup.fastscan_prov_hello", + "satsetup.fastscan_prov_skylink_c", + "satsetup.fastscan_prov_skylink_s", + "satsetup.fastscan_prov_telesat_b", + "satsetup.fastscan_prov_telesat_l", + "satsetup.fastscan_prov_tvv_hd", + "satsetup.fastscan_prov_tvv_sd", "satsetup.fastscan_sd", "satsetup.fastscan_type", + "satsetup.fastscan_update", "satsetup.fe_mode", "satsetup.fe_mode_independent", "satsetup.fe_mode_link_loop", @@ -1902,8 +1968,10 @@ const char * locale_real_names[] = "streaming.write_error", "stringinput.caps", "stringinput.clear", + "subtitles.charset", "subtitles.head", "subtitles.stop", + "terrestrialsetup.area", "terrestrialsetup.provider", "timer.eventrecord.msg", "timer.eventrecord.title", @@ -2058,6 +2126,7 @@ const char * locale_real_names[] = "videomenu.saturation", "videomenu.scart", "videomenu.screensetup", + "videomenu.sdosd", "videomenu.sharpness", "videomenu.tv-scart", "videomenu.vcrsignal", @@ -2084,6 +2153,8 @@ const char * locale_real_names[] = "zapit.scantype.radio", "zapit.scantype.tv", "zapit.scantype.tvradio", + "zapitsetup.channelmode", + "zapitsetup.channelmode_radio", "zapitsetup.head", "zapitsetup.info", "zapitsetup.last_radio", diff --git a/src/system/mtdutils/include/common.h b/src/system/mtdutils/include/common.h index 8e186ec69..d70f49b02 100644 --- a/src/system/mtdutils/include/common.h +++ b/src/system/mtdutils/include/common.h @@ -55,8 +55,8 @@ extern "C" { #define PRIxoff_t PRIx64 #define PRIdoff_t PRId64 #else -#define PRIxoff_t "l"PRIx32 -#define PRIdoff_t "l"PRId32 +#define PRIxoff_t "l" PRIx32 +#define PRIdoff_t "l" PRId32 #endif /* Verbose messages */ diff --git a/src/system/mtdutils/lib/libmtd.cpp b/src/system/mtdutils/lib/libmtd.cpp index da32324ba..1b3d3f5d7 100644 --- a/src/system/mtdutils/lib/libmtd.cpp +++ b/src/system/mtdutils/lib/libmtd.cpp @@ -1063,7 +1063,7 @@ int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs, /* Seek to the beginning of the eraseblock */ seek = (off_t)eb * mtd->eb_size + offs; if (lseek(fd, seek, SEEK_SET) != seek) - return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t, + return sys_errmsg("cannot seek mtd%d to offset %" PRIdoff_t, mtd->mtd_num, seek); while (rd < len) { @@ -1173,7 +1173,7 @@ int mtd_write(libmtd_t desc, const struct mtd_dev_info *mtd, int fd, int eb, if (data) { /* Seek to the beginning of the eraseblock */ if (lseek(fd, seek, SEEK_SET) != seek) - return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t, + return sys_errmsg("cannot seek mtd%d to offset %" PRIdoff_t, mtd->mtd_num, seek); ret = write(fd, data, len); if (ret != len) @@ -1331,7 +1331,7 @@ int mtd_write_img(const struct mtd_dev_info *mtd, int fd, int eb, int offs, /* Seek to the beginning of the eraseblock */ seek = (off_t)eb * mtd->eb_size + offs; if (lseek(fd, seek, SEEK_SET) != seek) { - sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t, + sys_errmsg("cannot seek mtd%d to offset %" PRIdoff_t, mtd->mtd_num, seek); goto out_close; } diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 165d38089..48bba1bc8 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -387,7 +387,7 @@ int CStreamFeaturesChangeExec::exec(CMenuTarget* parent, const std::string & act } else if (sel>=0) { - g_PluginList->startPlugin(sel,0); + g_PluginList->startPlugin(sel); } return menu_return::RETURN_EXIT; @@ -544,6 +544,13 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK CZapit::getInstance()->GetConfig(zapitCfg); g_RCInput->postMsg( NeutrinoMessages::REBOOT, 0); ret = menu_return::RETURN_EXIT_ALL; +#ifdef BOXMODEL_APOLLO + /* flag file to erase /var partition on factory reset, + will be done by init scripts */ + FILE * fp = fopen("/var_init/etc/.reset", "w"); + if (fp) + fclose(fp); +#endif } if(delete_set) { unlink(NEUTRINO_SETTINGS_FILE); diff --git a/src/system/settings.cpp b/src/system/settings.cpp index 098c47c80..33f0d42f6 100644 --- a/src/system/settings.cpp +++ b/src/system/settings.cpp @@ -116,25 +116,16 @@ const struct personalize_settings_t personalize_settings[SNeutrinoSettings::P_SE CScanSettings::CScanSettings(void) : configfile('\t') { - delivery_system = DVB_S; bouquetMode = CZapitClient::BM_UPDATEBOUQUETS; scanType = CServiceScan::SCAN_TVRADIO; satName = "none"; cableName ="none"; } -bool CScanSettings::loadSettings(const char * const fileName, const delivery_system_t dsys) +bool CScanSettings::loadSettings(const char * const fileName) { bool ret = configfile.loadConfig(fileName); - if (configfile.getInt32("delivery_system", -1) != dsys) - { - // configfile is not for this delivery system - configfile.clear(); - ret = false; - } - delivery_system = dsys; - bouquetMode = (CZapitClient::bouquetMode) configfile.getInt32("bouquetMode" , bouquetMode); scanType = (CZapitClient::scanType) configfile.getInt32("scanType", scanType); @@ -162,6 +153,8 @@ bool CScanSettings::loadSettings(const char * const fileName, const delivery_sys #endif fast_type = configfile.getInt32("fast_type", 2); fast_op = configfile.getInt32("fast_op", 0); + fst_version = configfile.getInt32("fst_version", 0); + fst_update = configfile.getInt32("fst_update", 0); cable_nid = configfile.getInt32("cable_nid", 0); return ret; @@ -169,7 +162,6 @@ bool CScanSettings::loadSettings(const char * const fileName, const delivery_sys bool CScanSettings::saveSettings(const char * const fileName) { - configfile.setInt32("delivery_system", delivery_system); configfile.setInt32("bouquetMode", bouquetMode); configfile.setInt32("scanType", scanType); @@ -182,6 +174,8 @@ bool CScanSettings::saveSettings(const char * const fileName) configfile.setInt32("scan_logical_hd", scan_logical_hd); configfile.setInt32("fast_type", fast_type); configfile.setInt32("fast_op", fast_op); + configfile.setInt32("fst_version", fst_version); + configfile.setInt32("fst_update", fst_update); configfile.setInt32("cable_nid", cable_nid); configfile.setString("satName", satName); diff --git a/src/system/settings.h b/src/system/settings.h index a308c75ea..9e16111cb 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -47,7 +47,7 @@ #include #ifdef BOXMODEL_APOLLO -#define VIDEOMENU_VIDEOMODE_OPTION_COUNT 14 +#define VIDEOMENU_VIDEOMODE_OPTION_COUNT 16 #else #define VIDEOMENU_VIDEOMODE_OPTION_COUNT 13 #endif @@ -64,11 +64,14 @@ struct SNeutrinoSettings int brightness; int contrast; int saturation; + int enable_sd_osd; #endif char current_volume; int current_volume_step; int channel_mode; int channel_mode_radio; + int channel_mode_initial; + int channel_mode_initial_radio; //misc int shutdown_real; @@ -143,6 +146,7 @@ struct SNeutrinoSettings std::string pref_lang[3]; std::string pref_subs[3]; + std::string subs_charset; // EPG int epg_save; @@ -153,6 +157,7 @@ struct SNeutrinoSettings int epg_extendedcache; std::string epg_dir; int epg_scan; + int epg_scan_mode; int epg_search_history_size; int epg_search_history_max; @@ -378,6 +383,7 @@ struct SNeutrinoSettings int recording_slow_warning; int recording_startstop_msg; int shutdown_timer_record_type; + std::string recording_filename_template; int filesystem_is_utf8; // default plugin for ts-movieplayer (red button) @@ -416,6 +422,7 @@ struct SNeutrinoSettings int temp_timeshift; int auto_delete; int record_hours; + int timeshift_hours; int mpkey_rewind; int mpkey_forward; @@ -439,6 +446,7 @@ struct SNeutrinoSettings int screenshot_mode; int screenshot_video; int screenshot_scale; + int auto_cover; std::string screenshot_dir; int key_current_transponder; @@ -467,6 +475,10 @@ struct SNeutrinoSettings int pip_height; int pip_x; int pip_y; + int pip_radio_width; + int pip_radio_height; + int pip_radio_x; + int pip_radio_y; int bigFonts; int window_size; int window_width; @@ -482,6 +494,8 @@ struct SNeutrinoSettings int channellist_show_channellogo; int repeat_blocker; int repeat_genericblocker; +#define LONGKEYPRESS_OFF 499 + int longkeypress_duration; int remote_control_hardware; int audiochannel_up_down_enable; @@ -629,7 +643,6 @@ struct SNeutrinoSettings int uselastchannel; int power_standby; - int rotor_swap; int hdd_sleep; int hdd_noise; int hdd_fs; @@ -768,7 +781,6 @@ class CScanSettings int bouquetMode; int scanType; - delivery_system_t delivery_system; int scan_nit; int scan_nit_manual; int scan_bat; @@ -778,6 +790,8 @@ class CScanSettings int scan_logical_hd; int fast_type; int fast_op; + int fst_version; + int fst_update; int cable_nid; std::string satName; @@ -796,8 +810,7 @@ class CScanSettings std::string terr_TP_freq; CScanSettings(); - //void useDefaults(const delivery_system_t _delivery_system); - bool loadSettings(const char * const fileName, const delivery_system_t _delivery_system); + bool loadSettings(const char * const fileName); bool saveSettings(const char * const fileName); }; diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index fe5b6870b..7e7622757 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -406,7 +406,7 @@ bool cYTFeedParser::decodeVideoInfo(std::string &answer, cYTVideoInfo &vinfo) std::string infofile = thumbnail_dir; infofile += "/"; infofile += vinfo.id; - infofile += ".txt" + infofile += ".txt"; saveToFile(infofile.c_str(), answer); #endif if(answer.find("token=") == std::string::npos) @@ -440,7 +440,17 @@ bool cYTFeedParser::decodeVideoInfo(std::string &answer, cYTVideoInfo &vinfo) #endif cYTVideoUrl yurl; yurl.url = smap["url"]; - yurl.sig = smap["sig"]; + + std::string::size_type ptr = smap["url"].find("signature="); + if (ptr != std::string::npos) + { + ptr = smap["url"].find("=", ptr); + smap["url"].erase(0,ptr+1); + + if((ptr = smap["url"].find("&")) != std::string::npos) + yurl.sig = smap["url"].substr(0,ptr); + } + int id = atoi(smap["itag"].c_str()); if (supportedFormat(id) && !yurl.url.empty() && !yurl.sig.empty()) { yurl.quality = smap["quality"]; diff --git a/src/zapit/data/frontend.conf b/src/zapit/data/frontend.conf index 013cef302..9f5939a13 100644 --- a/src/zapit/data/frontend.conf +++ b/src/zapit/data/frontend.conf @@ -8,13 +8,3 @@ fe0_satellites=192 fe0_uni_qrg=0 fe0_uni_scr=-1 fe0_mode=1 -fe1_diseqcRepeats=0 -fe1_diseqcType=0 -fe1_highVoltage=0 -fe1_lastSatellitePosition=360 -fe1_motorRotationSpeed=18 -fe1_position_192=192,-1,-1,-1,0,0,9750,10600,11700,0,0,1 -fe1_satellites=192 -fe1_uni_qrg=0 -fe1_uni_scr=-1 -fe1_mode=0 diff --git a/src/zapit/include/zapit/bouquets.h b/src/zapit/include/zapit/bouquets.h index ca26782a3..11b8cdeff 100644 --- a/src/zapit/include/zapit/bouquets.h +++ b/src/zapit/include/zapit/bouquets.h @@ -36,12 +36,13 @@ class CZapitBouquet bool bUser; bool bFav; bool bOther; + int bScanEpg; t_satellite_position satellitePosition; ZapitChannelList radioChannels; ZapitChannelList tvChannels; - inline CZapitBouquet(const std::string name) { Name = name; bHidden = false; bLocked = false; bUser = true; } + inline CZapitBouquet(const std::string name) { Name = name; bHidden = false; bLocked = false; bUser = false; bOther = false; bScanEpg = false; } void addService(CZapitChannel* newChannel); @@ -105,11 +106,11 @@ class CBouquetManager void saveBouquets(void); void saveUBouquets(void); - void saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName); + void saveBouquets(const CZapitClient::bouquetMode bouquetMode, const char * const providerName, t_satellite_position satellitePosition = INVALID_SAT_POSITION); void loadBouquets(bool ignoreBouquetFile = false); void renumServices(); - CZapitBouquet* addBouquet(const std::string & name, bool ub = false, bool myfav = false); + CZapitBouquet* addBouquet(const std::string & name, bool ub = false, bool myfav = false, bool to_begin = false); void deleteBouquet(const unsigned int id); void deleteBouquet(const CZapitBouquet* bouquet); int existsBouquet(char const * const name, bool ignore_user = false); @@ -118,6 +119,7 @@ class CBouquetManager bool existsChannelInBouquet(unsigned int bq_id, const t_channel_id channel_id); void clearAll(bool user = true); + void deletePosition(t_satellite_position satellitePosition); void sortBouquets(void); }; diff --git a/src/zapit/include/zapit/capmt.h b/src/zapit/include/zapit/capmt.h index b16180262..8b360bb5a 100644 --- a/src/zapit/include/zapit/capmt.h +++ b/src/zapit/include/zapit/capmt.h @@ -39,17 +39,14 @@ #define DEMUX_SOURCE_2 2 #define LIVE_DEMUX 0 -#define STREAM_DEMUX 1 -#define RECORD_DEMUX 2 -#define PIP_DEMUX 3 - class CCam : public CBasicClient { private: virtual unsigned char getVersion(void) const; virtual const char *getSocketName(void) const; - int camask, demuxes[MAX_DMX_UNITS]; + int camask; + int *demuxes; int source_demux; uint8_t cabuf[2048]; int calen; @@ -65,7 +62,7 @@ class CCam : public CBasicClient CAPMT_UPDATE = 0x05 }; CCam(); - virtual ~CCam() {}; + virtual ~CCam(); bool sendMessage(const char * const data, const size_t length, bool update = false); bool makeCaPmt(CZapitChannel * channel, bool add_private, uint8_t list = CAPMT_ONLY, const CaIdVector &caids = CaIdVector()); bool setCaPmt(bool update = false); @@ -94,6 +91,7 @@ class CCamManager OpenThreads::Mutex mutex; static CCamManager * manager; bool SetMode(t_channel_id id, enum runmode mode, bool enable, bool force_update = false); + void StopCam(t_channel_id id, CCam *cam); public: CCamManager(); diff --git a/src/zapit/include/zapit/channel.h b/src/zapit/include/zapit/channel.h index 185d3ea68..3017a8791 100644 --- a/src/zapit/include/zapit/channel.h +++ b/src/zapit/include/zapit/channel.h @@ -173,6 +173,7 @@ class CZapitChannel UPDATED = 0x04, NOT_FOUND = 0x08, PRESENT = 0x05, // NEW + UPDATED + FASTSCAN = 0x10, ANY = 0xFF } channel_flags_t; casys_map_t camap; diff --git a/src/zapit/include/zapit/fastscan.h b/src/zapit/include/zapit/fastscan.h index bc3083a1c..397f6c470 100644 --- a/src/zapit/include/zapit/fastscan.h +++ b/src/zapit/include/zapit/fastscan.h @@ -23,15 +23,25 @@ #define _FASTSCAN_H_ typedef enum fs_operator { - OPERATOR_CD, - OPERATOR_TVV, - OPERATOR_TELESAT, + OPERATOR_CD_SD, + OPERATOR_CD_HD, + OPERATOR_TVV_SD, + OPERATOR_TVV_HD, + OPERATOR_TELESAT_B, + OPERATOR_TELESAT_L, + OPERATOR_HD_AUSTRIA, + OPERATOR_SKYLINK_C, + OPERATOR_SKYLINK_S, + OPERATOR_HELLO, OPERATOR_MAX } fs_operator_t; #define CD_OPERATOR_ID (106) #define TVV_OPERATOR_ID (108) #define TELESAT_OPERATOR_ID (109) +#define HDAUSTRIA_OPERATOR_ID (100) +#define SKYLINK_OPERATOR_ID (200) +#define HELLO_OPERATOR_ID (300) #define FAST_SCAN_SD 1 #define FAST_SCAN_HD 2 @@ -39,8 +49,7 @@ typedef enum fs_operator { typedef struct fast_scan_operator { int id; - unsigned short sd_pid; - unsigned short hd_pid; + unsigned short pid; char * name; } fast_scan_operator_t; diff --git a/src/zapit/include/zapit/femanager.h b/src/zapit/include/zapit/femanager.h index d57aedeca..aaf063620 100644 --- a/src/zapit/include/zapit/femanager.h +++ b/src/zapit/include/zapit/femanager.h @@ -120,7 +120,6 @@ class CFEManager CFrontend * allocateFE(CZapitChannel * channel, bool forrecord = false); fe_mode_t getMode() { return mode; }; - void setMode(fe_mode_t newmode, bool initial = false); int getFrontendCount() { return femap.size(); }; int getEnabledCount(); @@ -149,6 +148,5 @@ class CFEManager bool terrOnly() { return (have_terr && !have_sat && ! have_cable); } void Lock() { mutex.lock(); } void Unlock() { mutex.unlock(); } - }; #endif /* __femanager_h__ */ diff --git a/src/zapit/include/zapit/frontend_c.h b/src/zapit/include/zapit/frontend_c.h index ad35e03fd..0623d5def 100644 --- a/src/zapit/include/zapit/frontend_c.h +++ b/src/zapit/include/zapit/frontend_c.h @@ -138,6 +138,8 @@ class CFrontend TP_params currentTransponder; bool slave; fe_work_mode_t femode; + bool have_loop; + bool have_rotor; int masterkey; fe_linkmap_t linkmap; int fenumber; @@ -180,6 +182,7 @@ class CFrontend static fe_modulation_t getModulation(const uint8_t modulation); uint8_t getPolarization(void) const; const struct dvb_frontend_info *getInfo(void) const { return &info; }; + bool getRotorSwap() { return config.rotor_swap; } uint32_t getBitErrorRate(void) const; uint16_t getSignalNoiseRatio(void) const; diff --git a/src/zapit/include/zapit/frontend_types.h b/src/zapit/include/zapit/frontend_types.h index 51ee653b9..090832425 100644 --- a/src/zapit/include/zapit/frontend_types.h +++ b/src/zapit/include/zapit/frontend_types.h @@ -40,6 +40,7 @@ typedef struct frontend_config { int highVoltage; int diseqc_order; int use_usals; + int rotor_swap; } frontend_config_t; #endif // __FRONTEND_TYPES_H__ diff --git a/src/zapit/include/zapit/getservices.h b/src/zapit/include/zapit/getservices.h index 2dc1cd0dc..bfc4e0014 100644 --- a/src/zapit/include/zapit/getservices.h +++ b/src/zapit/include/zapit/getservices.h @@ -123,6 +123,7 @@ class CServiceManager void ResetChannelNumbers(bool bouquets = true, bool numbers = false); void RemoveChannel(const t_channel_id channel_id); + void RemovePosition(t_satellite_position satellitePosition); void RemoveAllChannels(); void RemoveCurrentChannels(); void RemoveNVODChannels(); diff --git a/src/zapit/include/zapit/satconfig.h b/src/zapit/include/zapit/satconfig.h index 5dc5c2f3f..06abb71d5 100644 --- a/src/zapit/include/zapit/satconfig.h +++ b/src/zapit/include/zapit/satconfig.h @@ -46,6 +46,9 @@ typedef enum diseqc_cmd_order { COMMITED_FIRST } diseqc_cmd_order_t; +#define SAT_POSITION_CABLE(satellitePosition) ((satellitePosition > 0) && ((satellitePosition & 0xF00) == 0xF00)) +#define SAT_POSITION_TERR(satellitePosition) ((satellitePosition > 0) && ((satellitePosition & 0xF00) == 0xE00)) + typedef std::pair satellite_pair_t; typedef std::map satellite_map_t; typedef std::map::iterator sat_iterator_t; diff --git a/src/zapit/include/zapit/scan.h b/src/zapit/include/zapit/scan.h index 0040e0624..32fab7085 100644 --- a/src/zapit/include/zapit/scan.h +++ b/src/zapit/include/zapit/scan.h @@ -26,11 +26,12 @@ #include #include +#include #include #include #include -//#include +#include #include "bouquets.h" #include @@ -42,7 +43,7 @@ class CServiceScan : public OpenThreads::Thread typedef enum scan_type { SCAN_PROVIDER, SCAN_TRANSPONDER, -// SCAN_FAST + SCAN_FAST } scan_type_t; typedef enum scan_flags { SCAN_NIT = 0x01, @@ -101,20 +102,25 @@ class CServiceScan : public OpenThreads::Thread void CleanAllMaps(); bool ReplaceTransponderParams(freq_id_t freq, t_satellite_position satellitePosition, struct dvb_frontend_parameters * feparams, uint8_t polarization); -#if 0 /* fast scan */ std::map fast_services_sat; std::map fast_services_freq; std::map fast_services_number; + std::list > fst_sections; + unsigned char fst_version; + bool quiet_fastscan; void InitFastscanLnb(int id); + bool FastscanTune(int id); + bool ReadFst(unsigned short pid, unsigned short operator_id, bool one_section = false); bool ParseFst(unsigned short pid, fast_scan_operator_t * op); bool ParseFnt(unsigned short pid, unsigned short operator_id); void process_logical_service_descriptor(const unsigned char * const buffer, const t_transport_stream_id transport_stream_id, const t_original_network_id original_network_id, t_satellite_position satellitePosition, freq_id_t freq); void process_service_list_descriptor(const unsigned char * const buffer, const t_transport_stream_id transport_stream_id, const t_original_network_id original_network_id, t_satellite_position satellitePosition, freq_id_t freq); void process_satellite_delivery_system_descriptor(const unsigned char * const buffer, FrontendParameters * feparams, uint8_t * polarization, t_satellite_position * satellitePosition); bool ScanFast(); -#endif + void ReportFastScan(FrontendParameters &feparams, uint8_t polarization, t_satellite_position satellitePosition); + void run(); CFrontend * frontend; @@ -145,6 +151,12 @@ class CServiceScan : public OpenThreads::Thread bool isFtaOnly() { return flags & SCAN_FTA; } int GetFlags() { return flags; } bool SatHaveChannels() { return satHaveChannels; } + /* fast-scan */ + bool TestDiseqcConfig(int num); + bool ReadFstVersion(int num); + unsigned char GetFstVersion() { return fst_version; } + void QuietFastScan(bool enable) { quiet_fastscan = enable; } + bool ScanFast(int num, bool reload = true); }; #endif /* __scan_h__ */ diff --git a/src/zapit/include/zapit/types.h b/src/zapit/include/zapit/types.h index 6ec6994e0..6f62866c0 100644 --- a/src/zapit/include/zapit/types.h +++ b/src/zapit/include/zapit/types.h @@ -81,4 +81,6 @@ typedef uint64_t transponder_id_t; #define GET_FREQ_FROM_TPID(transponder_id) ((freq_id_t)(transponder_id >> 48)) #define CREATE_FREQ_ID(frequency, cable) (freq_id_t)(cable ? frequency/100 : frequency/1000) +#define INVALID_SAT_POSITION 0x1FFF + #endif /* __zapit__types_h__ */ diff --git a/src/zapit/include/zapit/zapit.h b/src/zapit/include/zapit/zapit.h index d519da0be..e0fe20e76 100644 --- a/src/zapit/include/zapit/zapit.h +++ b/src/zapit/include/zapit/zapit.h @@ -220,7 +220,7 @@ class CZapit : public OpenThreads::Thread bool PrepareChannels(); bool StartScan(int scan_mode); bool StartScanTP(TP_params * TPparams); -// bool StartFastScan(int scan_mode, int opid); + bool StartFastScan(int scan_mode, int opid); void addChannelToBouquet(const unsigned int bouquet, const t_channel_id channel_id); void SetConfig(Zapit_config * Cfg); diff --git a/src/zapit/src/Makefile.am b/src/zapit/src/Makefile.am index 9887883df..5a75e1842 100644 --- a/src/zapit/src/Makefile.am +++ b/src/zapit/src/Makefile.am @@ -18,6 +18,7 @@ libzapit_a_SOURCES = \ bouquets.cpp \ capmt.cpp \ channel.cpp \ + fastscan.cpp \ femanager.cpp \ frontend.cpp \ getservices.cpp \ @@ -29,7 +30,6 @@ libzapit_a_SOURCES = \ scansdt.cpp \ transponder.cpp \ zapit.cpp -# fastscan.cpp bin_PROGRAMS = pzapit sbin_PROGRAMS = udpstreampes diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 81048e0c6..0ed30d522 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -211,8 +211,8 @@ CBouquetManager::~CBouquetManager() void CBouquetManager::writeBouquetHeader(FILE * bouq_fd, uint32_t i, const char * bouquetName) { //printf("[bouquets] writing bouquet header: %s\n", bouquetName); - fprintf(bouq_fd, "\t