diff --git a/acinclude.m4 b/acinclude.m4 index d72eb52d7..20531ce97 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -139,6 +139,13 @@ AC_ARG_WITH(default-theme, [default_theme=""]) AC_DEFINE_UNQUOTED([DEFAULT_THEME], ["$default_theme"], [Default theme for gui]) +# default oled theme +AC_ARG_WITH(default-oled-theme, + AS_HELP_STRING([--with-default-oled-theme=THEMENAME], [Default theme for oled. Default it is empty for internal fallback to default colors.]), + [default_oled_theme="$withval"], + [default_oled_theme=""]) +AC_DEFINE_UNQUOTED([DEFAULT_OLED_THEME], ["$default_oled_theme"], [Default theme for oled.]) + AC_MSG_CHECKING(target) if test "$TARGET" = "native"; then diff --git a/configure.ac b/configure.ac index 9c5a96889..601a57e95 100644 --- a/configure.ac +++ b/configure.ac @@ -371,6 +371,9 @@ data/icons/headers/Makefile data/icons/hints/Makefile data/icons/locale/Makefile data/icons/movieplayer/Makefile +data/icons/oled/Makefile +data/icons/oled/clock/Makefile +data/icons/oled/weather/Makefile data/icons/radar/Makefile data/icons/slider/Makefile data/icons/status/Makefile @@ -390,6 +393,7 @@ data/lcd/clock/Makefile data/lcd/icons/Makefile data/license/Makefile data/locale/Makefile +data/othemes/Makefile data/pictures/Makefile data/pictures/backgrounds/Makefile data/pictures/screensaver/Makefile diff --git a/data/Makefile.am b/data/Makefile.am index 7225b4509..36fe57242 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -17,6 +17,12 @@ SUBDIRS = \ y-web \ zapit -if BOXTYPE_TRIPLE -SUBDIRS += lcd +if ENABLE_GRAPHLCD +SUBDIRS += \ + othemes +endif + +if BOXTYPE_TRIPLE +SUBDIRS += \ + lcd endif diff --git a/data/fonts/Makefile.am b/data/fonts/Makefile.am index 0d5d077dd..a861fb915 100644 --- a/data/fonts/Makefile.am +++ b/data/fonts/Makefile.am @@ -18,6 +18,12 @@ install_DATA += \ ubuntumono-b-webfont.ttf \ ubuntumono-r-webfont.ttf +if ENABLE_GRAPHLCD +install_DATA += \ + led.ttf \ + lcd.ttf +endif + install-data-hook: cd $(DESTDIR)$(FONTDIR); \ mv $(neutrino_ttf) neutrino.ttf; \ diff --git a/data/fonts/lcd.ttf b/data/fonts/lcd.ttf new file mode 100644 index 000000000..1d0a4011a Binary files /dev/null and b/data/fonts/lcd.ttf differ diff --git a/data/fonts/led.ttf b/data/fonts/led.ttf new file mode 100644 index 000000000..81775ee5b Binary files /dev/null and b/data/fonts/led.ttf differ diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index b73f283c1..0ebc9d3f7 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -11,5 +11,10 @@ SUBDIRS = \ various \ weather +if ENABLE_GRAPHLCD +SUBDIRS += \ + oled +endif + install-data-hook: $(INSTALL) -d $(DESTDIR)/$(ICONSDIR)/logo diff --git a/data/icons/oled/Makefile.am b/data/icons/oled/Makefile.am new file mode 100644 index 000000000..e123a3ab2 --- /dev/null +++ b/data/icons/oled/Makefile.am @@ -0,0 +1,14 @@ +SUBDIRS = \ + clock \ + weather + +installdir = $(ICONSDIR)/oled + +install_DATA = \ + advanced.png \ + blank.png \ + easy.png \ + medium.png \ + simple.png \ + standby.png \ + weather.png diff --git a/data/icons/oled/advanced.png b/data/icons/oled/advanced.png new file mode 100644 index 000000000..f0ac4c1e5 Binary files /dev/null and b/data/icons/oled/advanced.png differ diff --git a/data/icons/oled/blank.png b/data/icons/oled/blank.png new file mode 100644 index 000000000..e85c206c8 Binary files /dev/null and b/data/icons/oled/blank.png differ diff --git a/data/icons/oled/clock/Makefile.am b/data/icons/oled/clock/Makefile.am new file mode 100644 index 000000000..f128b4dd8 --- /dev/null +++ b/data/icons/oled/clock/Makefile.am @@ -0,0 +1,17 @@ +installdir = $(ICONSDIR)/oled/clock + +install_DATA = \ + analog_clock.png \ + analog_hour.png \ + analog_min.png \ + time_dots.png \ + time_eight.png \ + time_five.png \ + time_four.png \ + time_nine.png \ + time_one.png \ + time_seven.png \ + time_six.png \ + time_three.png \ + time_two.png \ + time_zero.png diff --git a/data/icons/oled/clock/analog_clock.png b/data/icons/oled/clock/analog_clock.png new file mode 100644 index 000000000..ce2526a4b Binary files /dev/null and b/data/icons/oled/clock/analog_clock.png differ diff --git a/data/icons/oled/clock/analog_hour.png b/data/icons/oled/clock/analog_hour.png new file mode 100644 index 000000000..b9976dfa1 Binary files /dev/null and b/data/icons/oled/clock/analog_hour.png differ diff --git a/data/icons/oled/clock/analog_min.png b/data/icons/oled/clock/analog_min.png new file mode 100644 index 000000000..cbfa92024 Binary files /dev/null and b/data/icons/oled/clock/analog_min.png differ diff --git a/data/icons/oled/clock/time_dots.png b/data/icons/oled/clock/time_dots.png new file mode 100644 index 000000000..ad1108bb4 Binary files /dev/null and b/data/icons/oled/clock/time_dots.png differ diff --git a/data/icons/oled/clock/time_eight.png b/data/icons/oled/clock/time_eight.png new file mode 100644 index 000000000..7efc32595 Binary files /dev/null and b/data/icons/oled/clock/time_eight.png differ diff --git a/data/icons/oled/clock/time_five.png b/data/icons/oled/clock/time_five.png new file mode 100644 index 000000000..cb877b20c Binary files /dev/null and b/data/icons/oled/clock/time_five.png differ diff --git a/data/icons/oled/clock/time_four.png b/data/icons/oled/clock/time_four.png new file mode 100644 index 000000000..cb2d72617 Binary files /dev/null and b/data/icons/oled/clock/time_four.png differ diff --git a/data/icons/oled/clock/time_nine.png b/data/icons/oled/clock/time_nine.png new file mode 100644 index 000000000..dd0c78e00 Binary files /dev/null and b/data/icons/oled/clock/time_nine.png differ diff --git a/data/icons/oled/clock/time_one.png b/data/icons/oled/clock/time_one.png new file mode 100644 index 000000000..f11757365 Binary files /dev/null and b/data/icons/oled/clock/time_one.png differ diff --git a/data/icons/oled/clock/time_seven.png b/data/icons/oled/clock/time_seven.png new file mode 100644 index 000000000..34836d00b Binary files /dev/null and b/data/icons/oled/clock/time_seven.png differ diff --git a/data/icons/oled/clock/time_six.png b/data/icons/oled/clock/time_six.png new file mode 100644 index 000000000..b228348d1 Binary files /dev/null and b/data/icons/oled/clock/time_six.png differ diff --git a/data/icons/oled/clock/time_three.png b/data/icons/oled/clock/time_three.png new file mode 100644 index 000000000..916d13dd2 Binary files /dev/null and b/data/icons/oled/clock/time_three.png differ diff --git a/data/icons/oled/clock/time_two.png b/data/icons/oled/clock/time_two.png new file mode 100644 index 000000000..5c94697ad Binary files /dev/null and b/data/icons/oled/clock/time_two.png differ diff --git a/data/icons/oled/clock/time_zero.png b/data/icons/oled/clock/time_zero.png new file mode 100644 index 000000000..a43bf12da Binary files /dev/null and b/data/icons/oled/clock/time_zero.png differ diff --git a/data/icons/oled/easy.png b/data/icons/oled/easy.png new file mode 100644 index 000000000..c599d06cd Binary files /dev/null and b/data/icons/oled/easy.png differ diff --git a/data/icons/oled/medium.png b/data/icons/oled/medium.png new file mode 100644 index 000000000..27827e97e Binary files /dev/null and b/data/icons/oled/medium.png differ diff --git a/data/icons/oled/simple.png b/data/icons/oled/simple.png new file mode 100644 index 000000000..fa6d0fcfd Binary files /dev/null and b/data/icons/oled/simple.png differ diff --git a/data/icons/oled/standby.png b/data/icons/oled/standby.png new file mode 100644 index 000000000..12becb1ec Binary files /dev/null and b/data/icons/oled/standby.png differ diff --git a/data/icons/oled/weather.png b/data/icons/oled/weather.png new file mode 100644 index 000000000..806c507eb Binary files /dev/null and b/data/icons/oled/weather.png differ diff --git a/data/icons/oled/weather/Makefile.am b/data/icons/oled/weather/Makefile.am new file mode 100644 index 000000000..c99f9a92a --- /dev/null +++ b/data/icons/oled/weather/Makefile.am @@ -0,0 +1,15 @@ +installdir = $(ICONSDIR)/oled/weather + +install_DATA = \ + clear-day.png \ + clear-night.png \ + cloudy.png \ + fog.png \ + hail.png \ + partly-cloudy-day.png \ + partly-cloudy-night.png \ + rain.png \ + sleet.png \ + snow.png \ + thunderstorm.png \ + wind.png diff --git a/data/icons/oled/weather/clear-day.png b/data/icons/oled/weather/clear-day.png new file mode 100644 index 000000000..52e5febac Binary files /dev/null and b/data/icons/oled/weather/clear-day.png differ diff --git a/data/icons/oled/weather/clear-night.png b/data/icons/oled/weather/clear-night.png new file mode 100644 index 000000000..60167a011 Binary files /dev/null and b/data/icons/oled/weather/clear-night.png differ diff --git a/data/icons/oled/weather/cloudy.png b/data/icons/oled/weather/cloudy.png new file mode 100644 index 000000000..7b0b65e21 Binary files /dev/null and b/data/icons/oled/weather/cloudy.png differ diff --git a/data/icons/oled/weather/fog.png b/data/icons/oled/weather/fog.png new file mode 100644 index 000000000..f7b63f758 Binary files /dev/null and b/data/icons/oled/weather/fog.png differ diff --git a/data/icons/oled/weather/hail.png b/data/icons/oled/weather/hail.png new file mode 100644 index 000000000..2f9dfbf1e Binary files /dev/null and b/data/icons/oled/weather/hail.png differ diff --git a/data/icons/oled/weather/partly-cloudy-day.png b/data/icons/oled/weather/partly-cloudy-day.png new file mode 100644 index 000000000..09f04b28f Binary files /dev/null and b/data/icons/oled/weather/partly-cloudy-day.png differ diff --git a/data/icons/oled/weather/partly-cloudy-night.png b/data/icons/oled/weather/partly-cloudy-night.png new file mode 100644 index 000000000..54128e8cb Binary files /dev/null and b/data/icons/oled/weather/partly-cloudy-night.png differ diff --git a/data/icons/oled/weather/rain.png b/data/icons/oled/weather/rain.png new file mode 100644 index 000000000..8e2c1c273 Binary files /dev/null and b/data/icons/oled/weather/rain.png differ diff --git a/data/icons/oled/weather/sleet.png b/data/icons/oled/weather/sleet.png new file mode 100644 index 000000000..7cc11ef8f Binary files /dev/null and b/data/icons/oled/weather/sleet.png differ diff --git a/data/icons/oled/weather/snow.png b/data/icons/oled/weather/snow.png new file mode 100644 index 000000000..36ac0f184 Binary files /dev/null and b/data/icons/oled/weather/snow.png differ diff --git a/data/icons/oled/weather/thunderstorm.png b/data/icons/oled/weather/thunderstorm.png new file mode 100644 index 000000000..96cac0d7c Binary files /dev/null and b/data/icons/oled/weather/thunderstorm.png differ diff --git a/data/icons/oled/weather/wind.png b/data/icons/oled/weather/wind.png new file mode 100644 index 000000000..d13baeb41 Binary files /dev/null and b/data/icons/oled/weather/wind.png differ diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 7969867ce..df6d505ea 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -886,10 +886,24 @@ fsk.from_7 ab 7 fsk.to_12 bis 12 fsk.to_16 bis 16 fsk.to_7 bis 7 +glcd.align_center zentriert +glcd.align_channel Sender ausrichten +glcd.align_duration Sendungsdauer ausrichten +glcd.align_end Sendungsende ausrichten +glcd.align_epg EPG ausrichten +glcd.align_left links +glcd.align_none keine +glcd.align_right rechts +glcd.align_start Sendungsstart ausrichten +glcd.align_time Zeit ausrichten +glcd.bar_width Fortschrittsbalken-Weite +glcd.bar_x_position Fortschrittsbalken x-Position +glcd.bar_y_position Fortschrittsbalken y-Position glcd.brightness Helligkeit -glcd.brightness_standby Helligkeit in Standby -glcd.clock.analog analog -glcd.clock.digital_hm digital +glcd.brightness_standby Helligkeit im Standby +glcd.brightness_dim Dimmen +glcd.brightness_dim_time Dimmen nach +glcd.brightness_settings Helligkeits-Einstellungen glcd.color.amber Amber glcd.color.black Schwarz glcd.color.blue Blau @@ -911,25 +925,62 @@ glcd.color.red Rot glcd.color.teal Teal glcd.color.white Weiß glcd.color.yellow Gelb +glcd.channel_x_position Sender x-Position +glcd.channel_y_position Sender y-Position +glcd.digital_clock_y_position Digitaluhr y-Position glcd.display Display-Typ +glcd.duration_x_position Sendungsdauer x-Position +glcd.duration_y_position Sendungsdauer y-Position glcd.enable GraphLCD aktiv +glcd.end_x_position Sendungsende x-Position +glcd.end_y_position Sendungsende y-Position +glcd.epg_x_position EPG x-Position +glcd.epg_y_position EPG x-Position glcd.font Schrift +glcd.font_autoresize Automatische SChriftgröße glcd.head GraphLCD-Unterstützung +glcd.logo_x_position Senderlogo x-Position +glcd.logo_y_position Senderlogo y-Position glcd.mirror_osd OSD-Menü auf GraphLCD anzeigen glcd.mirror_video Videobild auf GraphLCD anzeigen +glcd.position_settings Positions-Einstellungen glcd.restart Neu erkennen glcd.scroll_speed Scroll-Geschwindigkeit glcd.select.bar Fortschrittsbalken-Farbe glcd.select.bg Hintergrund-Farbe glcd.select.fg Vordergrund-Farbe -glcd.show_logo Sender-Logo anzeigen +glcd.show_duration Sendungsdauer zeigen +glcd.show_end Sendungsende zeigen +glcd.show_logo Senderlogo anzeigen +glcd.show_progressbar Fortschrittsbalken +glcd.show_start Sendungsstart zeigen +glcd.show_time Uhrzeit anzeigen +glcd.show_weather Wetter anzeigen +glcd.simple_clock_y_position Einfache Uhr y-Position glcd.size_bar Fortschrittsbalken-Größe glcd.size_channel Sender-Größe +glcd.size_duration Sendungsdauer-Größe +glcd.size_end Sendungsende-Größe glcd.size_epg EPG-Größe -glcd.size_logo Logo-Größe +glcd.size_logo Senderlogo-Größe +glcd.size_simple_clock Einfache Uhr-Größe +glcd.size_start Sendungsstart-Größe glcd.size_time Uhrzeit-Größe -glcd.size_time_standby Uhrzeit-Größe in Standby -glcd.time_in_standby Zeitanzeige in Standby +glcd.size_time_standby Uhrzeit-Größe im Standby +glcd.theme Thema +glcd.theme_position_settings Positions-Einstellungen +glcd.theme_settings Thema-Einstellungen +glcd.standby_analog_clock Analoge Uhr +glcd.standby_digital_clock Digitale Uhr +glcd.standby_lcd_clock LCD-Uhr +glcd.standby_led_clock LED-Uhr +glcd.standby_settings Standby-Einstellungen +glcd.standby_weather Wetter im Standby +glcd.start_x_position Sendungsstart x-Position +glcd.start_y_position Sendungsstart y-Position +glcd.time_in_standby Zeitanzeige im Standby +glcd.time_x_position Uhrzeit x-Position +glcd.time_y_position Uhrzeit y-Position glcd.volume Lautstärke hdd_10min 10 min. hdd_1min 1 min. @@ -1817,6 +1868,7 @@ menu.hint_volume_digits Zifferndarstellung der Lautstärkeanzeige ein- oder auss menu.hint_volume_pos Wählen Sie die Position der Lautstärkeanzeige aus menu.hint_volume_size Wählen Sie die Höhe der Lautstärkeanzeige menu.hint_weather_api_key Geben Sie den Dark Sky API Schlüssel ein. Eine leere Eingabe schaltet die Wetter-Unterstützung aus +menu.hint_weather_country menu.hint_weather_enabled Schaltet die Wetter-Unterstützung (darksky.net) ein bzw. aus menu.hint_weather_location Wählen Sie eine Stadt in ihrer Nähe zur Anzeige der Wetterdaten aus menu.hint_webradio_setup Hier konfigurierte WebRadio-Kanäle finden Sie in der Kanalverwaltung. @@ -2931,6 +2983,9 @@ videomenu.zappingmode Umschaltverhalten videomenu.zappingmode_mute Schwarzes Bild videomenu.zappingmode_hold Standbild weather.api_key Wetter API Schlüssel (Dark Sky) +weather.country Länderwahl +weather.country_deutschland Deutschland +weather.country_norway Norwegen weather.enabled Wetter-Unterstützung weather.location Wetter-Standort webradio.head WebRadio diff --git a/data/locale/english.locale b/data/locale/english.locale index c498e3ecd..1bcc260c1 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -888,8 +888,6 @@ fsk.to_16 to 16 fsk.to_7 to 7 glcd.brightness Brightness glcd.brightness_standby Brightness in standby -glcd.clock.analog analog -glcd.clock.digital_hm digital glcd.color.amber Amber glcd.color.black Black glcd.color.blue Blue diff --git a/data/othemes/Makefile.am b/data/othemes/Makefile.am new file mode 100644 index 000000000..655c7d8c9 --- /dev/null +++ b/data/othemes/Makefile.am @@ -0,0 +1,9 @@ +installdir = $(THEMESDIR) + +install_DATA = \ + advanced.otheme \ + default.otheme \ + easy.otheme \ + medium.otheme \ + simple.otheme \ + weather.otheme diff --git a/data/othemes/advanced.otheme b/data/othemes/advanced.otheme new file mode 100644 index 000000000..a0033ad4e --- /dev/null +++ b/data/othemes/advanced.otheme @@ -0,0 +1,72 @@ +# align none 0, align left 1, align center 2, align right 3 +# if align > 0 x position will be ignore +# if glcd_background != "" background color will be ignore +# if glcd_position_settings != false this allow to edit position settings over gui +glcd_color_fg_red=100 +glcd_color_fg_green=100 +glcd_color_fg_blue=100 +glcd_color_bg_red=0 +glcd_color_bg_green=0 +glcd_color_bg_blue=0 +glcd_color_bar_red=0 +glcd_color_bar_green=0 +glcd_color_bar_blue=100 +glcd_font=/usr/share/fonts/neutrino.ttf +glcd_background=/share/tuxbox/neutrino/icons/oled/advanced.png +glcd_align_channel=2 +glcd_align_epg=2 +glcd_align_duration=3 +glcd_align_start=0 +glcd_align_end=3 +glcd_align_time=1 +glcd_show_progressbar=true +glcd_show_duration=true +glcd_show_start=false +glcd_show_end=true +glcd_show_time=true +glcd_show_weather=false +glcd_percent_channel=22 +glcd_channel_x_position=0 +glcd_channel_y_position=22 +glcd_percent_epg=15 +glcd_epg_x_position=0 +glcd_epg_y_position=133 +glcd_percent_duration=14 +glcd_duration_x_position=0 +glcd_duration_y_position=261 +glcd_percent_start=0 +glcd_start_x_position=0 +glcd_start_y_position=0 +glcd_percent_end=14 +glcd_end_x_position=0 +glcd_end_y_position=224 +glcd_percent_time=14 +glcd_time_x_position=0 +glcd_time_y_position=261 +glcd_percent_bar=22 +glcd_bar_x_position=23 +glcd_bar_y_position=216 +glcd_bar_width=311 +glcd_percent_logo=22 +glcd_logo_x_position=0 +glcd_logo_y_position=22 +glcd_percent_smalltext=4 +glcd_smalltext_y_position=6 +glcd_rec_icon_x_position=398 +glcd_mute_icon_x_position=273 +glcd_ts_icon_x_position=443 +glcd_timer_icon_x_position=333 +glcd_ecm_icon_x_position=100 +glcd_dd_icon_x_position=238 +glcd_txt_icon_x_position=193 +glcd_cam_icon_x_position=148 +glcd_digital_clock_y_position=20 +glcd_size_simple_clock=40 +glcd_simple_clock_y_position=20 +glcd_weather_x_position_current=0 +glcd_weather_x_position_next=0 +glcd_weather_y_position=0 +glcd_weather_x_position_current_standby=10 +glcd_weather_x_position_next_standby=340 +glcd_weather_y_position_standby=175 +glcd_position_settings=true diff --git a/data/othemes/default.otheme b/data/othemes/default.otheme new file mode 100644 index 000000000..c859a3be4 --- /dev/null +++ b/data/othemes/default.otheme @@ -0,0 +1,72 @@ +# align none 0, align left 1, align center 2, align right 3 +# if align > 0 x position will be ignore +# if glcd_background != "" background color will be ignore +# if glcd_position_settings != false this allow to edit position settings over gui +glcd_color_fg_red=100 +glcd_color_fg_green=100 +glcd_color_fg_blue=100 +glcd_color_bg_red=0 +glcd_color_bg_green=0 +glcd_color_bg_blue=0 +glcd_color_bar_red=0 +glcd_color_bar_green=0 +glcd_color_bar_blue=100 +glcd_font=/usr/share/fonts/neutrino.ttf +glcd_background= +glcd_align_channel=2 +glcd_align_epg=2 +glcd_align_duration=0 +glcd_align_start=0 +glcd_align_end=0 +glcd_align_time=2 +glcd_show_progressbar=true +glcd_show_duration=false +glcd_show_start=false +glcd_show_end=false +glcd_show_time=true +glcd_show_weather=false +glcd_percent_channel=25 +glcd_channel_x_position=0 +glcd_channel_y_position=25 +glcd_percent_epg=15 +glcd_epg_x_position=0 +glcd_epg_y_position=130 +glcd_percent_duration=0 +glcd_duration_x_position=0 +glcd_duration_y_position=0 +glcd_percent_start=0 +glcd_start_x_position=0 +glcd_start_y_position=0 +glcd_percent_end=0 +glcd_end_x_position=0 +glcd_end_y_position=0 +glcd_percent_time=25 +glcd_time_x_position=0 +glcd_time_y_position=230 +glcd_percent_bar=20 +glcd_bar_x_position=0 +glcd_bar_y_position=210 +glcd_bar_width=485 +glcd_percent_logo=25 +glcd_logo_x_position=0 +glcd_logo_y_position=25 +glcd_percent_smalltext=4 +glcd_smalltext_y_position=6 +glcd_rec_icon_x_position=398 +glcd_mute_icon_x_position=273 +glcd_ts_icon_x_position=443 +glcd_timer_icon_x_position=333 +glcd_ecm_icon_x_position=100 +glcd_dd_icon_x_position=238 +glcd_txt_icon_x_position=193 +glcd_cam_icon_x_position=148 +glcd_digital_clock_y_position=20 +glcd_size_simple_clock=40 +glcd_simple_clock_y_position=20 +glcd_weather_x_position_current=0 +glcd_weather_x_position_next=0 +glcd_weather_y_position=0 +glcd_weather_x_position_current_standby=10 +glcd_weather_x_position_next_standby=340 +glcd_weather_y_position_standby=175 +glcd_position_settings=true diff --git a/data/othemes/easy.otheme b/data/othemes/easy.otheme new file mode 100644 index 000000000..f92e4aeae --- /dev/null +++ b/data/othemes/easy.otheme @@ -0,0 +1,72 @@ +# align none 0, align left 1, align center 2, align right 3 +# if align > 0 x position will be ignore +# if glcd_background != "" background color will be ignore +# if glcd_position_settings != false this allow to edit position settings over gui +glcd_color_fg_red=100 +glcd_color_fg_green=100 +glcd_color_fg_blue=100 +glcd_color_bg_red=0 +glcd_color_bg_green=0 +glcd_color_bg_blue=0 +glcd_color_bar_red=0 +glcd_color_bar_green=0 +glcd_color_bar_blue=100 +glcd_font=/usr/share/fonts/neutrino.ttf +glcd_background=/share/tuxbox/neutrino/icons/oled/easy.png +glcd_align_channel=2 +glcd_align_epg=2 +glcd_align_duration=3 +glcd_align_start=0 +glcd_align_end=0 +glcd_align_time=1 +glcd_show_progressbar=false +glcd_show_duration=true +glcd_show_start=false +glcd_show_end=false +glcd_show_time=true +glcd_show_weather=false +glcd_percent_channel=22 +glcd_channel_x_position=0 +glcd_channel_y_position=22 +glcd_percent_epg=18 +glcd_epg_x_position=0 +glcd_epg_y_position=152 +glcd_percent_duration=14 +glcd_duration_x_position=0 +glcd_duration_y_position=261 +glcd_percent_start=0 +glcd_start_x_position=0 +glcd_start_y_position=0 +glcd_percent_end=0 +glcd_end_x_position=0 +glcd_end_y_position=0 +glcd_percent_time=14 +glcd_time_x_position=0 +glcd_time_y_position=261 +glcd_percent_bar=0 +glcd_bar_x_position=0 +glcd_bar_y_position=0 +glcd_bar_width=0 +glcd_percent_logo=22 +glcd_logo_x_position=0 +glcd_logo_y_position=22 +glcd_percent_smalltext=4 +glcd_smalltext_y_position=6 +glcd_rec_icon_x_position=398 +glcd_mute_icon_x_position=273 +glcd_ts_icon_x_position=443 +glcd_timer_icon_x_position=333 +glcd_ecm_icon_x_position=100 +glcd_dd_icon_x_position=238 +glcd_txt_icon_x_position=193 +glcd_cam_icon_x_position=148 +glcd_digital_clock_y_position=20 +glcd_size_simple_clock=40 +glcd_simple_clock_y_position=20 +glcd_weather_x_position_current=0 +glcd_weather_x_position_next=0 +glcd_weather_y_position=0 +glcd_weather_x_position_current_standby=10 +glcd_weather_x_position_next_standby=340 +glcd_weather_y_position_standby=175 +glcd_position_settings=true diff --git a/data/othemes/medium.otheme b/data/othemes/medium.otheme new file mode 100644 index 000000000..a803ac883 --- /dev/null +++ b/data/othemes/medium.otheme @@ -0,0 +1,72 @@ +# align none 0, align left 1, align center 2, align right 3 +# if align > 0 x position will be ignore +# if glcd_background != "" background color will be ignore +# if glcd_position_settings != false this allow to edit position settings over gui +glcd_color_fg_red=100 +glcd_color_fg_green=100 +glcd_color_fg_blue=100 +glcd_color_bg_red=0 +glcd_color_bg_green=0 +glcd_color_bg_blue=0 +glcd_color_bar_red=0 +glcd_color_bar_green=0 +glcd_color_bar_blue=100 +glcd_font=/usr/share/fonts/neutrino.ttf +glcd_background=/share/tuxbox/neutrino/icons/oled/medium.png +glcd_align_channel=2 +glcd_align_epg=2 +glcd_align_duration=3 +glcd_align_start=0 +glcd_align_end=3 +glcd_align_time=1 +glcd_show_progressbar=true +glcd_show_duration=false +glcd_show_start=false +glcd_show_end=true +glcd_show_time=true +glcd_show_weather=false +glcd_percent_channel=22 +glcd_channel_x_position=0 +glcd_channel_y_position=22 +glcd_percent_epg=14 +glcd_epg_x_position=0 +glcd_epg_y_position=198 +glcd_percent_duration=14 +glcd_duration_x_position=0 +glcd_duration_y_position=261 +glcd_percent_start=0 +glcd_start_x_position=0 +glcd_start_y_position=0 +glcd_percent_end=14 +glcd_end_x_position=0 +glcd_end_y_position=116 +glcd_percent_time=14 +glcd_time_x_position=0 +glcd_time_y_position=116 +glcd_percent_bar=14 +glcd_bar_x_position=29 +glcd_bar_y_position=288 +glcd_bar_width=450 +glcd_percent_logo=22 +glcd_logo_x_position=0 +glcd_logo_y_position=22 +glcd_percent_smalltext=4 +glcd_smalltext_y_position=6 +glcd_rec_icon_x_position=398 +glcd_mute_icon_x_position=273 +glcd_ts_icon_x_position=443 +glcd_timer_icon_x_position=333 +glcd_ecm_icon_x_position=100 +glcd_dd_icon_x_position=238 +glcd_txt_icon_x_position=193 +glcd_cam_icon_x_position=148 +glcd_digital_clock_y_position=20 +glcd_size_simple_clock=40 +glcd_simple_clock_y_position=20 +glcd_weather_x_position_current=0 +glcd_weather_x_position_next=0 +glcd_weather_y_position=0 +glcd_weather_x_position_current_standby=10 +glcd_weather_x_position_next_standby=340 +glcd_weather_y_position_standby=175 +glcd_position_settings=true diff --git a/data/othemes/simple.otheme b/data/othemes/simple.otheme new file mode 100644 index 000000000..2836d53b9 --- /dev/null +++ b/data/othemes/simple.otheme @@ -0,0 +1,72 @@ +# align none 0, align left 1, align center 2, align right 3 +# if align > 0 x position will be ignore +# if glcd_background != "" background color will be ignore +# if glcd_position_settings != false this allow to edit position settings over gui +glcd_color_fg_red=100 +glcd_color_fg_green=100 +glcd_color_fg_blue=100 +glcd_color_bg_red=0 +glcd_color_bg_green=0 +glcd_color_bg_blue=0 +glcd_color_bar_red=0 +glcd_color_bar_green=0 +glcd_color_bar_blue=100 +glcd_font=/usr/share/fonts/neutrino.ttf +glcd_background=/share/tuxbox/neutrino/icons/oled/simple.png +glcd_align_channel=2 +glcd_align_epg=2 +glcd_align_duration=0 +glcd_align_start=0 +glcd_align_end=0 +glcd_align_time=0 +glcd_show_progressbar=false +glcd_show_duration=false +glcd_show_start=false +glcd_show_end=false +glcd_show_time=false +glcd_show_weather=false +glcd_percent_channel=20 +glcd_channel_x_position=0 +glcd_channel_y_position=51 +glcd_percent_epg=16 +glcd_epg_x_position=0 +glcd_epg_y_position=241 +glcd_percent_duration=0 +glcd_duration_x_position=0 +glcd_duration_y_position=0 +glcd_percent_start=0 +glcd_start_x_position=0 +glcd_start_y_position=0 +glcd_percent_end=14 +glcd_end_x_position=0 +glcd_end_y_position=0 +glcd_percent_time=0 +glcd_time_x_position=0 +glcd_time_y_position=0 +glcd_percent_bar=0 +glcd_bar_x_position=0 +glcd_bar_y_position=0 +glcd_bar_width=0 +glcd_percent_logo=20 +glcd_logo_x_position=0 +glcd_logo_y_position=51 +glcd_percent_smalltext=4 +glcd_smalltext_y_position=6 +glcd_rec_icon_x_position=398 +glcd_mute_icon_x_position=273 +glcd_ts_icon_x_position=443 +glcd_timer_icon_x_position=333 +glcd_ecm_icon_x_position=100 +glcd_dd_icon_x_position=238 +glcd_txt_icon_x_position=193 +glcd_cam_icon_x_position=148 +glcd_digital_clock_y_position=20 +glcd_size_simple_clock=40 +glcd_simple_clock_y_position=20 +glcd_weather_x_position_current=0 +glcd_weather_x_position_next=0 +glcd_weather_y_position=0 +glcd_weather_x_position_current_standby=10 +glcd_weather_x_position_next_standby=340 +glcd_weather_y_position_standby=175 +glcd_position_settings=true diff --git a/data/othemes/weather.otheme b/data/othemes/weather.otheme new file mode 100644 index 000000000..216f12207 --- /dev/null +++ b/data/othemes/weather.otheme @@ -0,0 +1,72 @@ +# align none 0, align left 1, align center 2, align right 3 +# if align > 0 x position will be ignore +# if glcd_background != "" background color will be ignore +# if glcd_position_settings != false this allow to edit position settings over gui +glcd_color_fg_red=100 +glcd_color_fg_green=100 +glcd_color_fg_blue=100 +glcd_color_bg_red=0 +glcd_color_bg_green=0 +glcd_color_bg_blue=0 +glcd_color_bar_red=0 +glcd_color_bar_green=0 +glcd_color_bar_blue=100 +glcd_font=/usr/share/fonts/neutrino.ttf +glcd_background=/share/tuxbox/neutrino/icons/oled/weather.png +glcd_align_channel=2 +glcd_align_epg=2 +glcd_align_duration=3 +glcd_align_start=0 +glcd_align_end=3 +glcd_align_time=1 +glcd_show_progressbar=true +glcd_show_duration=false +glcd_show_start=false +glcd_show_end=true +glcd_show_time=false +glcd_show_weather=true +glcd_percent_channel=22 +glcd_channel_x_position=0 +glcd_channel_y_position=22 +glcd_percent_epg=14 +glcd_epg_x_position=0 +glcd_epg_y_position=133 +glcd_percent_duration=14 +glcd_duration_x_position=0 +glcd_duration_y_position=261 +glcd_percent_start=0 +glcd_start_x_position=0 +glcd_start_y_position=0 +glcd_percent_end=14 +glcd_end_x_position=0 +glcd_end_y_position=185 +glcd_percent_time=0 +glcd_time_x_position=0 +glcd_time_y_position=0 +glcd_percent_bar=22 +glcd_bar_x_position=18 +glcd_bar_y_position=201 +glcd_bar_width=313 +glcd_percent_logo=22 +glcd_logo_x_position=0 +glcd_logo_y_position=22 +glcd_percent_smalltext=4 +glcd_smalltext_y_position=6 +glcd_rec_icon_x_position=398 +glcd_mute_icon_x_position=273 +glcd_ts_icon_x_position=443 +glcd_timer_icon_x_position=333 +glcd_ecm_icon_x_position=100 +glcd_dd_icon_x_position=238 +glcd_txt_icon_x_position=193 +glcd_cam_icon_x_position=148 +glcd_digital_clock_y_position=20 +glcd_size_simple_clock=40 +glcd_simple_clock_y_position=20 +glcd_weather_x_position_current=45 +glcd_weather_x_position_next=375 +glcd_weather_y_position=240 +glcd_weather_x_position_current_standby=10 +glcd_weather_x_position_next_standby=340 +glcd_weather_y_position_standby=175 +glcd_position_settings=true diff --git a/data/y-web/Makefile.am b/data/y-web/Makefile.am index 653eaec74..01bb19435 100644 --- a/data/y-web/Makefile.am +++ b/data/y-web/Makefile.am @@ -55,6 +55,7 @@ install_DATA = channels.js \ Y_Settings_automount.yhtm \ Y_Settings_Backup.yhtm \ Y_Settings_buttons.yhtm \ + Y_Settings_glcd.yhtm \ Y_Settings_lcd.yhtm \ Y_Settings_Live.yhtm \ Y_Settings_Menue.yhtm \ @@ -79,6 +80,7 @@ install_DATA = channels.js \ Y_Tools_Cmd.yhtm \ Y_Tools_Flash_Menue.yhtm \ Y_Tools_Flash_Upload.yhtm \ + Y_Tools_Glcd_Screenshot.yhtm \ Y_Tools_Info_Menue.yhtm \ Y_Tools_Installer.yhtm \ Y_Tools_lcshot.yhtm \ diff --git a/data/y-web/Y_Baselib.js b/data/y-web/Y_Baselib.js index e47890961..dcd498964 100644 --- a/data/y-web/Y_Baselib.js +++ b/data/y-web/Y_Baselib.js @@ -505,3 +505,8 @@ function saveTextAsFile(content, filename, filetype) } downloadLink.click(); } + +function glcdscreenshot(_filename) +{ + return loadSyncURL("/control/glcdscreenshot?name="+_filename); +} diff --git a/data/y-web/Y_Boxcontrol_Menue.yhtm b/data/y-web/Y_Boxcontrol_Menue.yhtm index e2d9a90ea..40393f4fc 100644 --- a/data/y-web/Y_Boxcontrol_Menue.yhtm +++ b/data/y-web/Y_Boxcontrol_Menue.yhtm @@ -148,6 +148,19 @@ function get_data(){
  • {=L:bc.menue.remote=}
  • + {=if-not-equal:{=var-get:boxtype=}~VU+ SOLO4K~ + {=if-not-equal:{=var-get:boxtype=}~VU+ DUO4K~ + {=if-not-equal:{=var-get:boxtype=}~VU+ ULTIMO4K~ + {=if-not-equal:{=var-get:boxtype=}~VU+ UNO4K~ + {=if-not-equal:{=var-get:boxtype=}~VU+ UNO4KSE~ +
  • + {=L:bc.menue.glcd_screenshot=} +
  • + ~=} + ~=} + ~=} + ~=} + ~=} {=if-not-equal:{=global-var-get:boxtype=}~coolstream~
  • {=if-empty:{=var-get:lcshot=}~ diff --git a/data/y-web/Y_Settings_Menue.yhtm b/data/y-web/Y_Settings_Menue.yhtm index e6b7c24d2..1a495ade9 100644 --- a/data/y-web/Y_Settings_Menue.yhtm +++ b/data/y-web/Y_Settings_Menue.yhtm @@ -84,6 +84,21 @@ function init(){ {=var-set:m_link_text={=L:set.menue.pictureviewer=}=} {=include-block:Y_Blocks.txt;management_link=}
  • + {=if-not-equal:{=var-get:boxtype=}~VU+ SOLO4K~ + {=if-not-equal:{=var-get:boxtype=}~VU+ DUO4K~ + {=if-not-equal:{=var-get:boxtype=}~VU+ ULTIMO4K~ + {=if-not-equal:{=var-get:boxtype=}~VU+ UNO4K~ + {=if-not-equal:{=var-get:boxtype=}~VU+ UNO4KSE~ +
  • + {=var-set:m_link_href=Y_Settings_glcd.yhtm=} + {=var-set:m_link_text={=L:set.menue.glcd_display=}=} + {=include-block:Y_Blocks.txt;management_link=} +
  • + ~=} + ~=} + ~=} + ~=} + ~=} {=if-not-equal:{=global-var-get:boxtype=}~coolstream~
  • {=var-set:m_link_href=Y_Settings_video_audio.yhtm=} diff --git a/data/y-web/Y_Settings_glcd.yhtm b/data/y-web/Y_Settings_glcd.yhtm new file mode 100644 index 000000000..b06da8d8e --- /dev/null +++ b/data/y-web/Y_Settings_glcd.yhtm @@ -0,0 +1,128 @@ +{=include-block:Y_Blocks.txt;management_check_top=} +{=include-block:Y_Blocks.txt;head=} + + + + + +{=var-set:wait_text={=L:save_values=}=}{=include-block:Y_Blocks.txt;snip_wait=} +
    +
    + {=var-set:help_url=Help-Settings-LCD=}{=var-set:menu=GLCD Einstellungen=}{=include-block:Y_Blocks.txt;work_menu=}
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    GLCD
    Power + AUS  + EIN +
    Invertieren + AUS  + EIN +
    Helligkeit nach dimm-Timeout + +
    Dimm-Timeout + +
    normale Helligkeit + +
    Standby Helligkeit + +
     Voreinstellung benutzen
    Anzeige-Modi
    +
    + +   +   + Hilfe +
    +
    +
    + + +{=include-block:Y_Blocks.txt;management_check_bottom=} diff --git a/data/y-web/Y_Tools_Glcd_Screenshot.yhtm b/data/y-web/Y_Tools_Glcd_Screenshot.yhtm new file mode 100644 index 000000000..6531cccdf --- /dev/null +++ b/data/y-web/Y_Tools_Glcd_Screenshot.yhtm @@ -0,0 +1,98 @@ + +{=include-block:Y_Blocks.txt;head=} + + + + + +
    +
    + {=var-set:help_url==}{=var-set:menu={=L:bc.menue.screenshot=}=}{=include-block:Y_Blocks.txt;work_menu=}
    +
    +
    +
    +
    +   +   +
    +
    +
    + {=L:filename=}: +
    +
    +
    +
    + Reload: +
    +
    +
    + +
    + + + + +
    + +
    +
    +
    + + + diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am index 1ddb6b376..6dcf0ff9b 100644 --- a/src/driver/Makefile.am +++ b/src/driver/Makefile.am @@ -50,7 +50,13 @@ libneutrino_driver_a_SOURCES = \ if ENABLE_GRAPHLCD libneutrino_driver_a_SOURCES += \ - nglcd.cpp + analogclock.cpp \ + digitalclock.cpp \ + lcdclock.cpp \ + ledclock.cpp \ + simpleclock.cpp \ + weather.cpp \ + glcd.cpp endif if BOXTYPE_COOL diff --git a/src/driver/analogclock.cpp b/src/driver/analogclock.cpp new file mode 100644 index 000000000..b31965257 --- /dev/null +++ b/src/driver/analogclock.cpp @@ -0,0 +1,179 @@ +/* + analog clock - DBoxII-Project + + Copyright (C) 2001 Steffen Hehn 'McClean', + 2003 thegoodguy + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include + +enum files +{ + ANALOG_CLOCK = 0, + ANALOG_HOUR = 1, + ANALOG_MIN = 2 +}; + +const char * const file_name[LCD_NUMBER_OF_FILES] = +{ + "analog_clock", + "analog_hour", + "analog_min" +}; + +#define NUMBER_OF_PATHS 2 +const char * const file_path[NUMBER_OF_PATHS] = +{ + LCDDIR_VAR "/oled/clock/", + DATADIR "/oled/clock/" +}; + +static std::string file[LCD_NUMBER_OF_FILES] = {""}; + +void InitAnalogClock(void) +{ + for (int i = 0; i < LCD_NUMBER_OF_FILES; i++) + { + std::string tmp_file; + for (int j = 0; j < NUMBER_OF_PATHS; j++) + { + std::string file_jpg = file_path[j]; + file_jpg += file_name[i]; + file_jpg += ".jpg"; + if (file_exists(file_jpg.c_str())) + { + tmp_file = file_jpg; + goto found; + } + std::string file_jpeg = file_path[j]; + file_jpeg += file_name[i]; + file_jpeg += ".jpeg"; + if (file_exists(file_jpeg.c_str())) + { + tmp_file = file_jpeg; + goto found; + } + std::string file_png = file_path[j]; + file_png += file_name[i]; + file_png += ".png"; + if (file_exists(file_png.c_str())) + { + tmp_file = file_png; + goto found; + } + std::string file_bmp = file_path[j]; + file_bmp += file_name[i]; + file_bmp += ".bmp"; + if (file_exists(file_bmp.c_str())) + { + tmp_file = file_bmp; + goto found; + } + std::string file_gif = file_path[j]; + file_gif += file_name[i]; + file_gif += ".gif"; + if (file_exists(file_gif.c_str())) + { + tmp_file = file_gif; + goto found; + } + } +found: + printf("[%s:%s] found file: %s\n", __file__, __func__, tmp_file.c_str()); + file[i] += std::string(tmp_file); + } + printf("[%s:%s] finish initialization\n", __file__, __func__); +} + +void RenderClock(int x, int y) +{ + cGLCD *cglcd = cGLCD::getInstance(); + cglcd->imageShow(file[ANALOG_CLOCK], x, y, 0, 0, false, true, false, false, false); +} + +void RenderHands(int hour, int min, int sec, int posx, int posy, int hour_size, int min_size, int sec_size) +{ + cGLCD *cglcd = cGLCD::getInstance(); + + int time_sec, time_min, time_hour, sec_x, sec_y, min_x, min_y, hour_x, hour_y, dia; + double pi = 3.1415926535897932384626433832795, sAngleInRad, mAngleInRad, mAngleSave, hAngleInRad; + + time_sec = sec; + time_min = min; + time_hour = hour; + + dia = 180; + + sAngleInRad = ((6 * time_sec) * (2 * pi / 360)); + sAngleInRad -= pi / 2; + + sec_x = int((dia * 0.9 * cos(sAngleInRad))); + sec_y = int((dia * 0.9 * sin(sAngleInRad))); + + mAngleInRad = ((6 * time_min) * (2 * pi / 360)); + mAngleSave = mAngleInRad; + mAngleInRad -= pi/2; + + min_x = int((dia * 0.7 * cos(mAngleInRad))); + min_y = int((dia * 0.7 * sin(mAngleInRad))); + + hAngleInRad = ((30 * time_hour) * (2 * pi / 360)); + hAngleInRad += mAngleSave/12; + hAngleInRad -= pi/2; + hour_x = int((dia * 0.5 * cos(hAngleInRad))); + hour_y = int((dia * 0.5 * sin(hAngleInRad))); + + //hour + for (int i = 0; i <= hour_size; i++) + { +#if 1 + cglcd->bitmap->DrawLine(posx-i, posy-i, posx + hour_x,posy + hour_y, GLCD::cColor::White); + cglcd->bitmap->DrawLine(posx+i, posy+i, posx + hour_x,posy + hour_y, GLCD::cColor::White); +#else + cglcd->bitmap->DrawLine(posx-i, posy-i, posx + hour_x-i,posy + hour_y-i, t.glcd_color_fg); + cglcd->bitmap->DrawLine(posx+i, posy+i, posx + hour_x+i,posy + hour_y+i, t.glcd_color_fg); +#endif + } + + //min + for (int i = 0; i <= min_size; i++) + { +#if 1 + cglcd->bitmap->DrawLine(posx-i, posy-i, posx + min_x,posy + min_y, GLCD::cColor::White); + cglcd->bitmap->DrawLine(posx+i, posy+i, posx + min_x,posy + min_y, GLCD::cColor::White); +#else + cglcd->bitmap->DrawLine(posx-i, posy-i, posx + min_x-i,posy + min_y-i, t.glcd_color_fg); + cglcd->bitmap->DrawLine(posx+i, posy+i, posx + min_x+i,posy + min_y+i, t.glcd_color_fg); +#endif + } +} + +void ShowAnalogClock(int hour, int min, int sec, int x, int y) +{ + RenderClock(0, 0); + RenderHands(hour, min, sec, x, y, 5, 3, 1); +} diff --git a/src/driver/analogclock.h b/src/driver/analogclock.h new file mode 100644 index 000000000..27eceee6a --- /dev/null +++ b/src/driver/analogclock.h @@ -0,0 +1,35 @@ +/* + LCD-Daemon - DBoxII-Project + + Copyright (C) 2001 Steffen Hehn 'McClean' + Homepage: http://dbox.cyberphoria.org/ + + + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "glcd.h" + +#define LCDDIR_VAR "/usr/share/tuxbox/neutrino/icons" + +#define LCD_NUMBER_OF_FILES 3 + +void InitAnalogClock(); +void RenderClock(int x, int y); +void RenderHands(int hour, int min, int sec, int posx, int posy, int hour_size, int min_size, int sec_size); +void ShowAnalogClock(int hour, int min, int sec, int x, int y); diff --git a/src/driver/digitalclock.cpp b/src/driver/digitalclock.cpp new file mode 100644 index 000000000..e86b7449a --- /dev/null +++ b/src/driver/digitalclock.cpp @@ -0,0 +1,164 @@ +/* + digital clock - DBoxII-Project + + Copyright (C) 2001 Steffen Hehn 'McClean', + 2003 thegoodguy + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include + +#include + +enum digits +{ + TIME_ZERO = 0, + TIME_ONE = 1, + TIME_TWO = 2, + TIME_THREE = 3, + TIME_FOUR = 4, + TIME_FIVE = 5, + TIME_SIX = 6, + TIME_SEVEN = 7, + TIME_EIGHT = 8, + TIME_NINE = 9, + TIME_DOTS = 10 +}; + +const char * const digit_name[LCD_NUMBER_OF_DIGITS] = +{ + "time_zero", + "time_one", + "time_two", + "time_three", + "time_four", + "time_five", + "time_six", + "time_seven", + "time_eight", + "time_nine", + "time_dots" +}; + +#define NUMBER_OF_PATHS 2 +const char * const digit_path[NUMBER_OF_PATHS] = +{ + LCDDIR_VAR "/oled/clock/", + DATADIR "/oled/clock/" +}; + +static std::string digit[LCD_NUMBER_OF_DIGITS] = {""}; + +void InitDigitalClock(void) +{ + for (int i = 0; i < LCD_NUMBER_OF_DIGITS; i++) + { + std::string digit_file; + for (int j = 0; j < NUMBER_OF_PATHS; j++) + { + std::string file_jpg = digit_path[j]; + file_jpg += digit_name[i]; + file_jpg += ".jpg"; + if (file_exists(file_jpg.c_str())) + { + digit_file = file_jpg; + goto found; + } + std::string file_jpeg = digit_path[j]; + file_jpeg += digit_name[i]; + file_jpeg += ".jpeg"; + if (file_exists(file_jpeg.c_str())) + { + digit_file = file_jpeg; + goto found; + } + std::string file_png = digit_path[j]; + file_png += digit_name[i]; + file_png += ".png"; + if (file_exists(file_png.c_str())) + { + digit_file = file_png; + goto found; + } + std::string file_bmp = digit_path[j]; + file_bmp += digit_name[i]; + file_bmp += ".bmp"; + if (file_exists(file_bmp.c_str())) + { + digit_file = file_bmp; + goto found; + } + std::string file_gif = digit_path[j]; + file_gif += digit_name[i]; + file_gif += ".gif"; + if (file_exists(file_gif.c_str())) + { + digit_file = file_gif; + goto found; + } + } +found: + printf("[%s:%s] found file: %s\n", __file__, __func__, digit_file.c_str()); + digit[i] += std::string(digit_file); + } + printf("[%s:%s] finish initialization\n", __file__, __func__); +} + +void RenderTimeDigit(int _digit, int x, int y) +{ + cGLCD *cglcd = cGLCD::getInstance(); + if (g_settings.glcd_standby_weather) + cglcd->imageShow(digit[_digit], x, y, 0, 0, false, false, false, false, false); + else + cglcd->imageShow(digit[_digit], x, y, 0, 0, false, false, false, false, true); +} + +void RenderDots(int x, int y) +{ + cGLCD *cglcd = cGLCD::getInstance(); + if (g_settings.glcd_standby_weather) + cglcd->imageShow(digit[TIME_DOTS], x, y, 0, 0, false, false, false, true, false); + else + cglcd->imageShow(digit[TIME_DOTS], x, y, 0, 0, false, false, false, true, true); +} + +void ShowDigitalClock(int hour, int minute) +{ + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + int y = g_settings.glcd_standby_weather ? t.glcd_digital_clock_y_position : cglcd->bitmap->Height() / 2; + + int a = 10; + int b = 117; + int c = cglcd->bitmap->Width() / 2; //center dots + int d = 258; + int e = 365; + + RenderTimeDigit(hour/10, a, y); + RenderTimeDigit(hour%10, b, y); + RenderDots(c ,(g_settings.glcd_standby_weather ? (y + 35) : y)); + RenderTimeDigit(minute/10, d, y); + RenderTimeDigit(minute%10, e, y); +} diff --git a/src/driver/digitalclock.h b/src/driver/digitalclock.h new file mode 100644 index 000000000..fe1116bac --- /dev/null +++ b/src/driver/digitalclock.h @@ -0,0 +1,38 @@ +/* + LCD-Daemon - DBoxII-Project + + Copyright (C) 2001 Steffen Hehn 'McClean' + Homepage: http://dbox.cyberphoria.org/ + + + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include +#pragma GCC diagnostic warning "-Wunused-parameter" +#include "glcd.h" + +#define LCDDIR_VAR "/usr/share/tuxbox/neutrino/icons" + +#define LCD_NUMBER_OF_DIGITS 11 + +void InitDigitalClock(); +void RenderTimeDigit(int _digit, int x, int y); +void RenderDots(int x, int y); +void ShowDigitalClock(int hour, int minute); diff --git a/src/driver/display.h b/src/driver/display.h index ea9185e85..f588ceb0a 100644 --- a/src/driver/display.h +++ b/src/driver/display.h @@ -9,5 +9,5 @@ #include #endif #ifdef ENABLE_GRAPHLCD -#include +#include #endif diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index ffd2bcd0b..79274dc6d 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -54,6 +54,8 @@ #include #include +#include + extern cVideo * videoDecoder; extern CPictureViewer * g_PicViewer; @@ -2018,3 +2020,10 @@ uint32_t CFrameBuffer::getWidth4FB_HW_ACC(const uint32_t /*x*/, const uint32_t w { return w; } + +void CFrameBuffer::blit() +{ +#ifdef ENABLE_GRAPHLCD + cGLCD::Blit(); +#endif +} diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index a35c99dda..c6e383fc2 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -346,7 +346,7 @@ class CFrameBuffer : public sigc::trackable void setFbArea(int element, int _x=0, int _y=0, int _dx=0, int _dy=0); void fbNoCheck(bool noCheck) { fb_no_check = noCheck; } void doPaintMuteIcon(bool mode) { do_paint_mute_icon = mode; } - void blit(void) {} + void blit(); sigc::signal OnAfterSetPallette; sigc::signal OnFallbackShowFrame; const char *fb_name; diff --git a/src/driver/glcd.cpp b/src/driver/glcd.cpp new file mode 100644 index 000000000..8e7ef9dbc --- /dev/null +++ b/src/driver/glcd.cpp @@ -0,0 +1,1727 @@ +/* + Neutrino graphlcd daemon thread + + (C) 2012-2014 by martii + + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "analogclock.h" +#include "digitalclock.h" +#include "lcdclock.h" +#include "ledclock.h" +#include "simpleclock.h" +#include "weather.h" + +#include "zlib.h" +#include "png.h" +#include "jpeglib.h" + +#define LCD_ICONSDIR "/share/lcd/icons/" +#define ICONSEXT ".png" + +static const char * kDefaultConfigFile = "/etc/graphlcd.conf"; +static cGLCD *cglcd = NULL; + +extern CRemoteControl *g_RemoteControl; +extern CPictureViewer * g_PicViewer; + +cGLCD::cGLCD() +{ + lcd = NULL; + Logo = ""; + Channel = "Neutrino"; + Epg = std::string(g_info.hw_caps->boxvendor) + " " + std::string(g_info.hw_caps->boxname); + + sem_init(&sem, 0, 1); + + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP); + pthread_mutex_init(&mutex, &attr); + + channelLocked = false; + timeLocked = false; + durationLocked = false; + startLocked = false; + endLocked = false; + recLocked = false; + muteLocked = false; + tsLocked = false; + ecmLocked = false; + timerLocked = false; + ddLocked = false; + txtLocked = false; + subLocked = false; + camLocked = false; + doRescan = false; + doStandby = false; + doStandbyTime = false; + doShowVolume = false; + doShowLcdIcon = false; + doSuspend = false; + doExit = false; + doMirrorOSD = false; + fontsize_channel = 0; + fontsize_epg = 0; + fontsize_time = 0; + fontsize_duration = 0; + fontsize_start = 0; + fontsize_end = 0; + fontsize_smalltext = 0; + fonts_initialized = false; + ismediaplayer = false; + doScrollChannel = false; + doScrollEpg = false; + percent_channel = 0; + percent_time = 0; + percent_duration = 0; + percent_start = 0; + percent_end = 0; + percent_smalltext = 0; + percent_epg = 0; + percent_bar = 0; + percent_logo = 0; + power_state = 1; + Scale = 0; + bitmap = NULL; + blitFlag = true; + timeout_cnt = 0; + locked_countdown = false; + time_thread_started = false; + + cglcd = this; + + if (!g_settings.glcd_enable) + doSuspend = true; + + if (pthread_create (&thrGLCD, 0, cGLCD::Run, this) != 0 ) + fprintf(stderr, "ERROR: pthread_create(cGLCD::Init)\n"); + + if (pthread_create (&thrTimeThread, 0, cGLCD::TimeThread, this) != 0 ) + fprintf(stderr, "ERROR: pthread_create(cGLCD::TimeThread)\n"); + + InitAnalogClock(); + InitDigitalClock(); + InitLcdClock(); + InitLedClock(); + InitSimpleClock(); + InitWeather(); + + Update(); +} + +void cGLCD::Lock(void) +{ + if (cglcd) + { + pthread_mutex_lock(&cglcd->mutex); + } +} + +void cGLCD::Unlock(void) +{ + if (cglcd) + { + pthread_mutex_unlock(&cglcd->mutex); + } +} + +cGLCD::~cGLCD() +{ + Suspend(); + cglcd = NULL; + if (lcd) + { + lcd->DeInit(); + delete lcd; + } + sem_destroy(&sem); + pthread_mutex_destroy(&mutex); +} + +cGLCD *cGLCD::getInstance() +{ + if (!cglcd) + cglcd = new cGLCD; + return cglcd; +} + +uint32_t cGLCD::ColorConvert3to1(uint32_t red, uint32_t green, uint32_t blue) +{ + unsigned int color_red_tmp = (static_cast(red) * 2.55) + 1; + unsigned int color_green_tmp = (static_cast(green) * 2.55) + 1; + unsigned int color_blue_tmp = (static_cast(blue) * 2.55) + 1; + + uint32_t color = 0xff; color <<= 8; + color |= color_red_tmp; color <<= 8; + color |= color_green_tmp; color <<= 8; + color |= color_blue_tmp; + + return color; +} + +void cGLCD::Exec() +{ + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + + if (!lcd) + return; + + bitmap->Clear(ColorConvert3to1(t.glcd_color_bg_red, t.glcd_color_bg_green, t.glcd_color_bg_blue)); + + if (Channel == "Neutrino") + { + if (g_settings.glcd_show_logo) + { + if (imageShow(DATADIR "/neutrino/icons/start.jpg", 0, 0, 0, 0, false, true, true, false, false)) + { + GLCD::cFont font_tmp; + + int fw = font_epg.Width(Epg); + font_tmp.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg * (bitmap->Width() - 4) / fw); + fw = font_tmp.Width(Epg); + + drawText(std::max(2,(bitmap->Width() - 4 - fw)/2), + 10 * bitmap->Height()/100, bitmap->Width() - 4, fw, Epg, + &font_tmp, ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent, true, 0, ALIGN_NONE); + + lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); + lcd->Refresh(true); + } + } else { + cglcd->bitmap->Clear(ColorConvert3to1(t.glcd_color_bg_red, t.glcd_color_bg_green, t.glcd_color_bg_blue)); + cglcd->lcd->Refresh(true); + } + return; + } + + if (doStandbyTime) + { + std::string Time; + if (g_settings.glcd_time_in_standby == 5) + { + ShowAnalogClock(tm->tm_hour, tm->tm_min, tm->tm_sec, bitmap->Width()/2, bitmap->Height()/2); + } + else if (g_settings.glcd_time_in_standby == 4) + { + ShowDigitalClock(tm->tm_hour, tm->tm_min); + } + else if (g_settings.glcd_time_in_standby == 3) + { + Time = strftime("%H:%M", tm); + ShowLcdClock(Time); + } + else if (g_settings.glcd_time_in_standby == 2) + { + Time = strftime("%H:%M", tm); + ShowLedClock(Time); + } + else + { + Time = strftime("%H:%M", tm); + ShowSimpleClock(Time); + } + if (g_settings.glcd_standby_weather == 1 && g_settings.glcd_time_in_standby != 5) + { + ShowWeather(true); + } + lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); + lcd->Refresh(false); + return; + } + + if (t.glcd_background != "") + imageShow(t.glcd_background, 0, 0, 0, 0, false, true, true, false, false); + + if (t.glcd_show_weather) + ShowWeather(false); + + switch (CAudioPlayer::getInstance()->getState()) + { + case CBaseDec::REV: + ismediaplayer = true; + Logo = ICONSDIR "/" NEUTRINO_ICON_REW ICONSEXT; + break; + case CBaseDec::FF: + ismediaplayer = true; + Logo = ICONSDIR "/" NEUTRINO_ICON_FF ICONSEXT; + break; + case CBaseDec::PAUSE: + ismediaplayer = true; + Logo = ICONSDIR "/" NEUTRINO_ICON_PAUSE ICONSEXT; + break; + case CBaseDec::PLAY: + ismediaplayer = true; + Logo = ICONSDIR "/" NEUTRINO_ICON_PLAY ICONSEXT; + break; + default: + ismediaplayer = false; + ; + } + + switch (CMoviePlayerGui::getInstance().getState()) + { + case CMoviePlayerGui::REW: + ismediaplayer = true; + Logo = ICONSDIR "/" NEUTRINO_ICON_REW ICONSEXT; + break; + case CMoviePlayerGui::FF: + ismediaplayer = true; + Logo = ICONSDIR "/" NEUTRINO_ICON_FF ICONSEXT; + break; + case CMoviePlayerGui::PAUSE: + ismediaplayer = true; + Logo = ICONSDIR "/" NEUTRINO_ICON_PAUSE ICONSEXT; + break; + case CMoviePlayerGui::PLAY: + ismediaplayer = true; + Logo = ICONSDIR "/" NEUTRINO_ICON_PLAY ICONSEXT; + break; + default: + ismediaplayer = false; + ; + } + + int icon_start_width = 0, icon_start_height = 0; + g_PicViewer->getSize(Logo.c_str(), &icon_start_width, &icon_start_height); + + if (g_settings.glcd_show_logo && percent_logo && + showImage(channel_id, Channel, 0, t.glcd_channel_x_position, t.glcd_channel_y_position, percent_logo * bitmap->Height()/100, true, false)) { + doScrollChannel = false; + scrollChannelSkip = 0; + } else if (percent_logo && icon_start_width && icon_start_height && + doShowLcdIcon && showImage(Logo, icon_start_width, icon_start_height, t.glcd_channel_x_position, t.glcd_channel_y_position, bitmap->Width() - 4, percent_logo * bitmap->Height()/100, true, false)) { + doScrollChannel = false; + scrollChannelSkip = 0; + } else if (percent_channel) { + if (ChannelWidth) { + if (scrollChannelForward) { + if (ChannelWidth - scrollChannelSkip < bitmap->Width() - 4) + scrollChannelForward = false; + } else if (scrollChannelSkip <= 0) { + scrollChannelSkip = 0; + doScrollChannel = false; + } + + drawText(t.glcd_channel_x_position + scrollChannelOffset, + t.glcd_channel_y_position, bitmap->Width() - 4, ChannelWidth, Channel, + &font_channel, ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent, true, scrollChannelSkip, t.glcd_align_channel); + + if (scrollChannelOffset > 0) + scrollChannelOffset -= g_settings.glcd_scroll_speed; + + if (scrollChannelOffset < 0) + scrollChannelOffset = 0; + + if (scrollChannelOffset == 0) { + if (scrollChannelForward) + scrollChannelSkip += g_settings.glcd_scroll_speed; + else + scrollChannelSkip -= g_settings.glcd_scroll_speed; + } + } + } + + if (percent_epg) + { + if (EpgWidth) + { + if (scrollEpgForward) { + if (EpgWidth - scrollEpgSkip < bitmap->Width() - 4) + scrollEpgForward = false; + } else if (scrollEpgSkip <= 0) { + scrollEpgSkip = 0; + doScrollEpg = false; + } + + drawText(t.glcd_epg_x_position + scrollEpgOffset, + t.glcd_epg_y_position, bitmap->Width() - 4, EpgWidth, Epg, + &font_epg, ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent, true, scrollEpgSkip, t.glcd_align_epg); + + if (scrollEpgOffset > 0) + scrollEpgOffset -= g_settings.glcd_scroll_speed; + + if (scrollEpgOffset < 0) + scrollEpgOffset = 0; + + if (scrollEpgOffset == 0) { + if (scrollEpgForward) + scrollEpgSkip += g_settings.glcd_scroll_speed; + else + scrollEpgSkip -= g_settings.glcd_scroll_speed; + } + } + } + + if (percent_bar && t.glcd_show_progressbar) + { + int tmp_pos = 0; + tmp_pos = t.glcd_bar_y_position; + + int bar_top = 0; + int bar_bottom = 0; + + bar_top = tmp_pos; + bar_bottom = tmp_pos + t.glcd_percent_bar; + + showProgressBarBorder(t.glcd_bar_x_position, bar_top, t.glcd_bar_width, bar_bottom, Scale, GLCD::cColor::White, ColorConvert3to1(t.glcd_color_bar_red, t.glcd_color_bar_green, t.glcd_color_bar_blue)); + } + + if (percent_time && t.glcd_show_time) + { + Lock(); + Time = strftime("%H:%M", tm); + TimeWidth = font_time.Width(Time); + Unlock(); + + drawText(t.glcd_time_x_position, + t.glcd_time_y_position, bitmap->Width() - 1, TimeWidth, Time, + &font_time, ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent, true, 0, t.glcd_align_time); + } + + if (percent_duration && t.glcd_show_duration) + { + + Lock(); + Duration = stagingDuration; + DurationWidth = font_duration.Width(Duration); + Unlock(); + + drawText(t.glcd_duration_x_position, + t.glcd_duration_y_position, bitmap->Width() - 1, DurationWidth, Duration, + &font_duration, ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent, true, 0, t.glcd_align_duration); + } + + if (percent_start && t.glcd_show_start) + { + + Lock(); + Start = stagingStart; + StartWidth = font_start.Width(Start); + Unlock(); + + drawText(t.glcd_start_x_position, + t.glcd_start_y_position, bitmap->Width() - 1, StartWidth, Start, + &font_start, ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent, true, 0, t.glcd_align_start); + } + + if (percent_end && t.glcd_show_end) + { + Lock(); + End = stagingEnd; + EndWidth = font_end.Width(End); + Unlock(); + + drawText(t.glcd_end_x_position, + t.glcd_end_y_position, bitmap->Width() - 1, EndWidth, End, + &font_end, ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent, true, 0, t.glcd_align_end); + } + + if (percent_smalltext && !doStandby) { + Lock(); + SmalltextWidth = font_smalltext.Width(Smalltext); + Unlock(); + + if (access("/tmp/ecm.info", F_OK) == 0) + { + struct stat buf; + stat("/tmp/ecm.info", &buf); + if (buf.st_size > 0) + ecmLocked = true; + else + ecmLocked = false; + } + + if (recLocked) { + drawText(t.glcd_rec_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "rec", &font_smalltext, GLCD::cColor::Red, + GLCD::cColor::Transparent, true, 0, 0); + } else { + drawText(t.glcd_rec_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "rec", &font_smalltext, GLCD::cColor::Gray, + GLCD::cColor::Transparent, true, 0, 0); + } + + if (muteLocked) { + drawText(t.glcd_mute_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "mute", &font_smalltext, GLCD::cColor::Green, + GLCD::cColor::Transparent, true, 0, 0); + } else { + drawText(t.glcd_mute_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "mute", &font_smalltext, GLCD::cColor::Gray, + GLCD::cColor::Transparent, true, 0, 0); + } + + if (tsLocked) { + drawText(t.glcd_ts_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "ts", &font_smalltext, GLCD::cColor::Red, + GLCD::cColor::Transparent, true, 0, 0); + } else { + drawText(t.glcd_ts_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "ts", &font_smalltext, GLCD::cColor::Gray, + GLCD::cColor::Transparent, true, 0, 0); + } + + if (ecmLocked) { + drawText(t.glcd_ecm_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "ecm", &font_smalltext, GLCD::cColor::Green, + GLCD::cColor::Transparent, true, 0, 0); + } else { + drawText(t.glcd_ecm_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "ecm", &font_smalltext, GLCD::cColor::Gray, + GLCD::cColor::Transparent, true, 0, 0); + } + + if (timerLocked) { + drawText(t.glcd_timer_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "timer", &font_smalltext, GLCD::cColor::Green, + GLCD::cColor::Transparent, true, 0, 0); + } else { + drawText(t.glcd_timer_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "timer", &font_smalltext, GLCD::cColor::Gray, + GLCD::cColor::Transparent, true, 0, 0); + } + + if (ddLocked) { + drawText(t.glcd_dd_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "dd", &font_smalltext, GLCD::cColor::Green, + GLCD::cColor::Transparent, true, 0, 0); + } else { + drawText(t.glcd_dd_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "dd", &font_smalltext, GLCD::cColor::Gray, + GLCD::cColor::Transparent, true, 0, 0); + } + + if (ismediaplayer) { + if (subLocked) { + drawText(t.glcd_txt_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "sub", &font_smalltext, GLCD::cColor::Green, + GLCD::cColor::Transparent, true, 0, 0); + } else { + drawText(t.glcd_txt_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "sub", &font_smalltext, GLCD::cColor::Gray, + GLCD::cColor::Transparent, true, 0, 0); + } + } else { + if (txtLocked) { + drawText(t.glcd_txt_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "txt", &font_smalltext, GLCD::cColor::Green, + GLCD::cColor::Transparent, true, 0, 0); + } else { + drawText(t.glcd_txt_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "txt", &font_smalltext, GLCD::cColor::Gray, + GLCD::cColor::Transparent, true, 0, 0); + } + } + + if (camLocked) { + drawText(t.glcd_cam_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "cam", &font_smalltext, GLCD::cColor::Green, + GLCD::cColor::Transparent, true, 0, 0); + } else { + drawText(t.glcd_cam_icon_x_position, t.glcd_smalltext_y_position, + bitmap->Width() - 1, SmalltextWidth, "cam", &font_smalltext, GLCD::cColor::Gray, + GLCD::cColor::Transparent, true, 0, 0); + } + } + + lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); + lcd->Refresh(false); +} + +void cGLCD::updateFonts() +{ + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + + percent_logo = std::min(t.glcd_percent_logo, 100); + percent_channel = std::min(t.glcd_percent_channel, 100); + percent_epg = std::min(t.glcd_percent_epg, 100); + percent_bar = std::min(t.glcd_percent_bar, 100); + percent_time = std::min(t.glcd_percent_time, 100); + percent_duration = std::min(t.glcd_percent_duration, 100); + percent_start = std::min(t.glcd_percent_start, 100); + percent_end = std::min(t.glcd_percent_end, 100); + percent_smalltext = std::min(t.glcd_percent_smalltext, 100); + + // calculate height + int fontsize_channel_new = percent_channel * cglcd->lcd->Height() / 100; + int fontsize_epg_new = percent_epg * cglcd->lcd->Height() / 100; + int fontsize_time_new = percent_time * cglcd->lcd->Height() / 100; + int fontsize_duration_new = percent_duration * cglcd->lcd->Height() / 100; + int fontsize_start_new = percent_start * cglcd->lcd->Height() / 100; + int fontsize_end_new = percent_end * cglcd->lcd->Height() / 100; + int fontsize_smalltext_new = percent_smalltext * cglcd->lcd->Height() / 100; + + if (!fonts_initialized || (fontsize_channel_new != fontsize_channel)) { + fontsize_channel = fontsize_channel_new; + if (!font_channel.LoadFT2(t.glcd_font, "UTF-8", fontsize_channel)) { + t.glcd_font = FONTDIR "/neutrino.ttf"; + font_channel.LoadFT2(t.glcd_font, "UTF-8", fontsize_channel); + } + } + if (!fonts_initialized || (fontsize_epg_new != fontsize_epg)) { + fontsize_epg = fontsize_epg_new; + if (!font_epg.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg)) { + t.glcd_font = FONTDIR "/neutrino.ttf"; + font_epg.LoadFT2(t.glcd_font, "UTF-8", fontsize_epg); + } + } + if (!fonts_initialized || (fontsize_time_new != fontsize_time)) { + fontsize_time = fontsize_time_new; + if (!font_time.LoadFT2(t.glcd_font, "UTF-8", fontsize_time)) { + t.glcd_font = FONTDIR "/neutrino.ttf"; + font_time.LoadFT2(t.glcd_font, "UTF-8", fontsize_time); + } + } + + if (!fonts_initialized || (fontsize_duration_new != fontsize_duration)) { + fontsize_duration = fontsize_duration_new; + if (!font_duration.LoadFT2(t.glcd_font, "UTF-8", fontsize_duration)) { + t.glcd_font = FONTDIR "/neutrino.ttf"; + font_duration.LoadFT2(t.glcd_font, "UTF-8", fontsize_duration); + } + } + + if (!fonts_initialized || (fontsize_start_new != fontsize_start)) { + fontsize_start = fontsize_start_new; + if (!font_start.LoadFT2(t.glcd_font, "UTF-8", fontsize_start)) { + t.glcd_font = FONTDIR "/neutrino.ttf"; + font_start.LoadFT2(t.glcd_font, "UTF-8", fontsize_start); + } + } + + if (!fonts_initialized || (fontsize_end_new != fontsize_end)) { + fontsize_end = fontsize_end_new; + if (!font_end.LoadFT2(t.glcd_font, "UTF-8", fontsize_end)) { + t.glcd_font = FONTDIR "/neutrino.ttf"; + font_end.LoadFT2(t.glcd_font, "UTF-8", fontsize_end); + } + } + + if (!fonts_initialized || (fontsize_smalltext_new != fontsize_smalltext)) { + fontsize_smalltext = fontsize_smalltext_new; + if (!font_smalltext.LoadFT2(/*t.glcd_font*/FONTDIR "/lcd.ttf", "UTF-8", fontsize_smalltext)) { + t.glcd_font = FONTDIR "/lcd.ttf"; + font_smalltext.LoadFT2(t.glcd_font, "UTF-8", fontsize_smalltext); + } + } + + fonts_initialized = true; +} + +bool cGLCD::getBoundingBox(uint32_t *buffer, int width, int height, int &bb_x, int &bb_y, int &bb_w, int &bb_h) +{ + if (!width || !height) { + bb_x = bb_y = bb_w = bb_h = 0; + return false; + } + + int y_min = height; + uint32_t *b = buffer; + for (int y = 0; y < height; y++) + for (int x = 0; x < width; x++, b++) + if (*b) { + y_min = y; + goto out1; + } +out1: + int y_max = y_min; + b = buffer + height * width - 1; + for (int y = height - 1; y_min < y; y--) + for (int x = 0; x < width; x++, b--) + if (*b) { + y_max = y; + goto out2; + } +out2: + int x_min = width; + for (int x = 0; x < width; x++) { + b = buffer + x + y_min * width; + for (int y = y_min; y < y_max; y++, b += width) + if (*b) { + x_min = x; + goto out3; + } + } +out3: + int x_max = x_min; + for (int x = width - 1; x_min < x; x--) { + b = buffer + x + y_min * width; + for (int y = y_min; y < y_max; y++, b += width) + if (*b) { + x_max = x; + goto out4; + } + } +out4: + bb_x = x_min; + bb_y = y_min; + bb_w = 1 + x_max - x_min; + bb_h = 1 + y_max - y_min; + + if (bb_x < 0) + bb_x = 0; + if (bb_y < 0) + bb_y = 0; + + return true; +} + +void* cGLCD::Run(void *arg) +{ + cGLCD *me = (cGLCD *)arg; + me->Run(); + pthread_exit(NULL); +} + +void cGLCD::CountDown() +{ + if (timeout_cnt > 0) + { + timeout_cnt--; + if (timeout_cnt == 0) + { + UpdateBrightness(); + cglcd->locked_countdown = false; + } + } +} + +void cGLCD::WakeUp() +{ + int tmp = atoi(g_settings.glcd_brightness_dim_time.c_str()); + if (tmp > 0) + { + timeout_cnt = (unsigned int)tmp; + UpdateBrightness(); + cglcd->locked_countdown = true; + } +} + +void* cGLCD::TimeThread(void *p) +{ + set_threadname("cGLCD:Time"); + ((cGLCD *)p)->time_thread_started = true; + while (((cGLCD *)p)->time_thread_started) + { + sleep(1); + if ((cglcd->locked_countdown == true || cglcd->channelLocked == true || cglcd->timeLocked == true || + cglcd->durationLocked == true || cglcd->startLocked == true || cglcd->endLocked == true || + cglcd->recLocked == true || cglcd->muteLocked == true || cglcd->tsLocked == true || + cglcd->ecmLocked == true || cglcd->timerLocked == true || cglcd->ddLocked == true || + cglcd->txtLocked == true || cglcd->camLocked == true || + cglcd->doShowVolume == true || cglcd->doMirrorOSD == true) && !cglcd->doExit) + { + cGLCD::getInstance()->CountDown(); + } + } + return NULL; +} + +void cGLCD::Run(void) +{ + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + + set_threadname("cGLCD::Run"); + + if (GLCD::Config.Load(kDefaultConfigFile) == false) + { + fprintf(stderr, "Error loading config file!\n"); + return; + } + if ((GLCD::Config.driverConfigs.size() < 1)) + { + fprintf(stderr, "No driver config found!\n"); + return; + } + + struct timespec ts; + + CSectionsdClient::CurrentNextInfo info_CurrentNext; + channel_id = -1; + info_CurrentNext.current_zeit.startzeit = 0; + info_CurrentNext.current_zeit.dauer = 0; + info_CurrentNext.flags = 0; + + fonts_initialized = false; + bool broken = false; + + do + { + if (broken) + { +#ifdef GLCD_DEBUG + fprintf(stderr, "No graphlcd display found ... sleeping for 30 seconds\n"); +#endif + clock_gettime(CLOCK_REALTIME, &ts); + ts.tv_sec += 30; + sem_timedwait(&sem, &ts); + broken = false; + if (doExit) + break; + if (!g_settings.glcd_enable) + continue; + } else + while ((doSuspend || doStandby || !g_settings.glcd_enable) && !doExit) + sem_wait(&sem); + + if (doExit) + break; + + int warmUp = 10; + lcd = GLCD::CreateDriver(GLCD::Config.driverConfigs[0].id, &GLCD::Config.driverConfigs[0]); + if (!lcd) { +#ifdef GLCD_DEBUG + fprintf(stderr, "CreateDriver failed.\n"); +#endif + broken = true; + continue; + } +#ifdef GLCD_DEBUG + fprintf(stderr, "CreateDriver succeeded.\n"); +#endif + if (lcd->Init()) + { + delete lcd; + lcd = NULL; +#ifdef GLCD_DEBUG + fprintf(stderr, "LCD init failed.\n"); +#endif + broken = true; + continue; + } +#ifdef GLCD_DEBUG + fprintf(stderr, "LCD init succeeded.\n"); +#endif + lcd->SetBrightness(0); + + if (!bitmap) + bitmap = new GLCD::cBitmap(lcd->Width(), lcd->Height(), ColorConvert3to1(t.glcd_color_bg_red, t.glcd_color_bg_green, t.glcd_color_bg_blue)); + + UpdateBrightness(); + Update(); + + doMirrorOSD = false; + + while ((!doSuspend && !doStandby) && !doExit && g_settings.glcd_enable) + { + if (doMirrorOSD && !doStandbyTime) + { + if (blitFlag) + { + blitFlag = false; + bitmap->Clear(GLCD::cColor::Black); + ts.tv_sec = 0; // don't wait + static CFrameBuffer* fb = CFrameBuffer::getInstance(); + static int fb_width = fb->getScreenWidth(true); + static int fb_height = fb->getScreenHeight(true); + static uint32_t *fbp = fb->getFrameBufferPointer(); + int lcd_width = bitmap->Width(); + int lcd_height = bitmap->Height(); +#if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE || BOXMODEL_VUUNO4K + unsigned int fb_stride = fb->getStride()/4; + if (!showImage(fbp, fb_stride, fb_height, 0, 0, lcd_width, lcd_height, false, true)) + { +#else + if (!showImage(fbp, fb_width, fb_height, 0, 0, lcd_width, lcd_height, false, true)) + { +#endif + usleep(500000); + } + else + { + lcd->SetScreen(bitmap->Data(), lcd_width, lcd_height); + lcd->Refresh(false); + } + } + else + usleep(100000); + continue; + } + + if (g_settings.glcd_mirror_video && !doStandbyTime) + { +#if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE || BOXMODEL_VUUNO4K + lcd->SetMirrorVideo(true); +#else + char ws[10]; + snprintf(ws, sizeof(ws), "%d", bitmap->Width()); + const char *bmpShot = "/tmp/glcd-video.bmp"; + my_system(4, "/bin/grab", "-vr", ws, bmpShot); + int bw = 0, bh = 0; + g_PicViewer->getSize(bmpShot, &bw, &bh); + if (bw > 0 && bh > 0) + { + int lcd_width = bitmap->Width(); + int lcd_height = bitmap->Height(); + if (!showImage(bmpShot, (uint32_t) bw, (uint32_t) bh, 0, 0, (uint32_t) lcd_width, (uint32_t) lcd_height, false, true)) + usleep(1000000); + else + { + lcd->SetScreen(bitmap->Data(), lcd_width, lcd_height); + lcd->Refresh(false); + } + } + else + usleep(1000000); + continue; +#endif + } +#if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE || BOXMODEL_VUUNO4K + else + lcd->SetMirrorVideo(false); +#endif + + clock_gettime(CLOCK_REALTIME, &ts); + tm = localtime(&ts.tv_sec); + updateFonts(); + Exec(); + clock_gettime(CLOCK_REALTIME, &ts); + tm = localtime(&ts.tv_sec); + if (warmUp > 0) + { + ts.tv_sec += 1; + warmUp--; + } + else + { + ts.tv_sec += 60 - tm->tm_sec; + ts.tv_nsec = 0; + } + + if (!doScrollChannel && !doScrollEpg) + sem_timedwait(&sem, &ts); + + while(!sem_trywait(&sem)); + + if(doRescan || doSuspend || doStandby || doExit) + break; + + if (doShowVolume) + { + if (ismediaplayer) + { + Channel = ""; + if (Epg.compare(g_Locale->getText(LOCALE_GLCD_VOLUME))) + { + Epg = g_Locale->getText(LOCALE_GLCD_VOLUME); + EpgWidth = font_epg.Width(Epg); + doScrollEpg = EpgWidth > bitmap->Width() - 4; + scrollEpgSkip = 0; + scrollEpgForward = true; + if (doScrollEpg) { + scrollEpgOffset = bitmap->Width()/g_settings.glcd_scroll_speed; + EpgWidth += scrollEpgOffset; + } + else + scrollEpgOffset = 0; + } + ChannelWidth = 0; + scrollChannelSkip = 0; + scrollChannelForward = true; + Scale = g_settings.current_volume; + //epg_id = -1; + } else { + Epg = ""; + if (Channel.compare(g_Locale->getText(LOCALE_GLCD_VOLUME))) + { + Channel = g_Locale->getText(LOCALE_GLCD_VOLUME); + ChannelWidth = font_channel.Width(Channel); + doScrollChannel = ChannelWidth > bitmap->Width() - 4; + scrollChannelSkip = 0; + scrollChannelForward = true; + if (doScrollChannel) { + scrollChannelOffset = bitmap->Width()/g_settings.glcd_scroll_speed; + ChannelWidth += scrollChannelOffset; + } + else + scrollChannelOffset = 0; + } + EpgWidth = 0; + scrollEpgSkip = 0; + scrollEpgForward = true; + Scale = g_settings.current_volume; + channel_id = -1; + } + } + else if (channelLocked) + { + Lock(); + if (Epg.compare(stagingEpg)) + { + Epg = stagingEpg; + EpgWidth = font_epg.Width(Epg); + doScrollEpg = EpgWidth > bitmap->Width() - 4; + scrollEpgSkip = 0; + scrollEpgForward = true; + if (doScrollEpg) + { + scrollEpgOffset = bitmap->Width()/g_settings.glcd_scroll_speed; + EpgWidth += scrollEpgOffset; + } + else + scrollChannelOffset = 0; + } + if (Channel.compare(stagingChannel)) + { + Channel = stagingChannel; + ChannelWidth = font_channel.Width(Channel); + doScrollChannel = ChannelWidth > bitmap->Width() - 4; + scrollChannelSkip = 0; + scrollChannelForward = true; + if (doScrollChannel) + { + scrollChannelOffset = bitmap->Width()/g_settings.glcd_scroll_speed; + ChannelWidth += scrollChannelOffset; + } + else + scrollChannelOffset = 0; + } + channel_id = -1; + Unlock(); + } + else + { + CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList; + if (!channelList) + continue; + t_channel_id new_channel_id = channelList->getActiveChannel_ChannelID(); + if (!new_channel_id) + continue; + + if ((new_channel_id != channel_id)) + { + Channel = channelList->getActiveChannelName (); + ChannelWidth = font_channel.Width(Channel); + Epg = ""; + EpgWidth = 0; + Scale = 0; + doScrollEpg = false; + doScrollChannel = ChannelWidth > bitmap->Width() - 4; + scrollChannelForward = true; + scrollChannelSkip = 0; + if (doScrollChannel) { + scrollChannelOffset = bitmap->Width()/g_settings.glcd_scroll_speed; + ChannelWidth += scrollChannelOffset; + } + else + scrollChannelOffset = 0; + warmUp = 10; + info_CurrentNext.current_name = ""; + info_CurrentNext.current_zeit.dauer = 0; + } + + CEitManager::getInstance()->getCurrentNextServiceKey(channel_id & 0xFFFFFFFFFFFFULL, info_CurrentNext); + channel_id = new_channel_id; + + if (info_CurrentNext.current_name.compare(Epg)) + { + Epg = info_CurrentNext.current_name; + EpgWidth = font_epg.Width(Epg); + doScrollEpg = EpgWidth > bitmap->Width() - 4; + scrollEpgForward = true; + scrollEpgSkip = 0; + if (doScrollEpg) + { + scrollEpgOffset = bitmap->Width()/g_settings.glcd_scroll_speed; + EpgWidth += scrollEpgOffset; + } else + scrollEpgOffset = 0; + } + + if (CSectionsdClient::epgflags::has_current) + { + if ((info_CurrentNext.current_zeit.dauer > 0) && (info_CurrentNext.current_zeit.dauer < 86400)) + { + Scale = (ts.tv_sec - info_CurrentNext.current_zeit.startzeit) * 100 / info_CurrentNext.current_zeit.dauer; + char tmp_duration[6] = {0}; + int total = info_CurrentNext.current_zeit.dauer / 60; + int done = (abs(time(NULL) - info_CurrentNext.current_zeit.startzeit) + 30) / 60; + int todo = total - done; + if ((time(NULL) < info_CurrentNext.current_zeit.startzeit) && todo >= 0) + { + done = 0; + todo = info_CurrentNext.current_zeit.dauer / 60; + } + snprintf(tmp_duration, sizeof(tmp_duration), "%d/%d", done, total); + Duration = tmp_duration; + } + if (Scale > 100) + Scale = 100; + else if (Scale < 0) + Scale = 0; + char tmp_start[6] = {0}; + tm = localtime(&info_CurrentNext.current_zeit.startzeit); + snprintf(tmp_start, sizeof(tmp_start), "%02d:%02d", tm->tm_hour, tm->tm_min); + Start = tmp_start; + } + + if (CSectionsdClient::epgflags::has_next) + { + char tmp_end[6] = {0}; + tm = localtime(&info_CurrentNext.next_zeit.startzeit); + snprintf(tmp_end, sizeof(tmp_end), "%02d:%02d", tm->tm_hour, tm->tm_min); + End = tmp_end; + } + } + } + + if(!g_settings.glcd_enable || doSuspend || doStandby) + { + // for restart, don't blacken screen + bitmap->Clear(GLCD::cColor::Black); + lcd->SetBrightness(0); + lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); + lcd->Refresh(false); + } + if(doExit) + { + if (g_settings.glcd_show_logo) + { + if (imageShow(DATADIR "/neutrino/icons/shutdown.jpg", 0, 0, 0, 0, false, true, true, false, false)) + { + lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); + lcd->Refresh(false); + sleep(3); + lcd->SetBrightness(0); + } + } else { + bitmap->Clear(GLCD::cColor::Black); + lcd->SetBrightness(0); + lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); + lcd->Refresh(false); + } + return; + } + if (doRescan) + { + doRescan = false; + Update(); + } + lcd->DeInit(); + delete lcd; + lcd = NULL; + } while(!doExit); +} + +void cGLCD::Update() +{ + if (cglcd) + { + sem_post(&cglcd->sem); + if (!cglcd->doExit) + cGLCD::getInstance()->WakeUp(); + } +} + +void cGLCD::StandbyMode(bool b) +{ + if (cglcd) + { + if (g_settings.glcd_time_in_standby) + { + cglcd->doStandbyTime = b; + cglcd->doStandby = false; + } else { + cglcd->doStandbyTime = false; + cglcd->doStandby = b; + } + if (b) + { + cglcd->doScrollChannel = false; + cglcd->doScrollEpg = false; + } else { + cglcd->doScrollChannel = true; + cglcd->doScrollEpg = true; + } + cglcd->doMirrorOSD = false; + cglcd->UpdateBrightness(); + cglcd->Update(); + } +} + +void cGLCD::ShowVolume(bool b) +{ + if (cglcd) + { + cglcd->doShowVolume = b; + cglcd->Update(); + } +} + +void cGLCD::ShowLcdIcon(bool b) +{ + if (cglcd) + { + cglcd->Lock(); + cglcd->doShowLcdIcon = b; + cglcd->Unlock(); + cglcd->Update(); + } +} + +void cGLCD::MirrorOSD(bool b) +{ + if (cglcd) + { + cglcd->doMirrorOSD = b; + cglcd->Update(); + } +} + +void cGLCD::Exit() +{ + if (cglcd) + { + cglcd->doMirrorOSD = false; + cglcd->doSuspend = false; + cglcd->time_thread_started = false; + cglcd->doExit = true; + cglcd->Update(); + void *res; + pthread_join(cglcd->thrGLCD, &res); + pthread_join(cglcd->thrTimeThread, NULL); + delete cglcd; + cglcd = NULL; + } +} + +void cGLCD::Rescan() +{ + doRescan = true; + Update(); +} + +void cGLCD::Suspend() +{ + if (cglcd) + { + cglcd->doSuspend = true; + cglcd->Update(); + } +} + +void cGLCD::Resume() +{ + if (cglcd) + { + cglcd->doSuspend = false; + cglcd->channelLocked = false; + cglcd->Update(); + } +} + +void cGLCD::lockChannel(std::string c, std::string e, int s) +{ + if(cglcd) + { + cglcd->Lock(); + cglcd->channelLocked = true; + cglcd->stagingChannel = c; + cglcd->stagingEpg = e; + cglcd->Scale = s; + cglcd->Unlock(); + cglcd->Update(); + } +} + +void cGLCD::unlockChannel(void) +{ + if(cglcd) + { + cglcd->channelLocked = false; + cglcd->Update(); + } +} + +void cGLCD::lockTime(std::string t) +{ + if(cglcd) + { + cglcd->Lock(); + cglcd->timeLocked = true; + cglcd->stagingTime = t; + cglcd->Unlock(); + cglcd->Update(); + } +} + +void cGLCD::unlockTime(void) +{ + if(cglcd) + { + cglcd->timeLocked = false; + cglcd->Update(); + } +} + +void cGLCD::lockDuration(std::string t) +{ + if(cglcd) + { + cglcd->Lock(); + cglcd->durationLocked = true; + cglcd->stagingDuration = t; + cglcd->Unlock(); + cglcd->Update(); + } +} + +void cGLCD::unlockDuration(void) +{ + if(cglcd) + { + cglcd->durationLocked = false; + cglcd->Update(); + } +} + +void cGLCD::lockStart(std::string t) +{ + if(cglcd) + { + cglcd->Lock(); + cglcd->startLocked = true; + cglcd->stagingStart = t; + cglcd->Unlock(); + cglcd->Update(); + } +} + +void cGLCD::unlockStart(void) +{ + if(cglcd) + { + cglcd->startLocked = false; + cglcd->Update(); + } +} + +void cGLCD::lockEnd(std::string t) +{ + if(cglcd) + { + cglcd->Lock(); + cglcd->endLocked = true; + cglcd->stagingEnd = t; + cglcd->Unlock(); + cglcd->Update(); + } +} + +void cGLCD::unlockEnd(void) +{ + if(cglcd) + { + cglcd->endLocked = false; + cglcd->Update(); + } +} + +void cGLCD::lockIcon(int type) +{ + if(cglcd) + { + cglcd->Lock(); + if (type == REC) + cglcd->recLocked = true; + else if (type == MUTE) + cglcd->muteLocked = true; + else if (type == TS) + cglcd->tsLocked = true; + else if (type == ECM) + cglcd->ecmLocked = true; + else if (type == TIMER) + cglcd->timerLocked = true; + else if (type == DD) + cglcd->ddLocked = true; + else if (type == TXT) + cglcd->txtLocked = true; + else if (type == SUB) + cglcd->subLocked = true; + else if (type == CAM) + cglcd->camLocked = true; + cglcd->Unlock(); + cglcd->Update(); + } +} + +void cGLCD::unlockIcon(int type) +{ + if(cglcd) + { + if (type == REC) + cglcd->recLocked = false; + else if (type == MUTE) + cglcd->muteLocked = false; + else if (type == TS) + cglcd->tsLocked = false; + else if (type == ECM) + cglcd->ecmLocked = false; + else if (type == TIMER) + cglcd->timerLocked = false; + else if (type == DD) + cglcd->ddLocked = false; + else if (type == TXT) + cglcd->txtLocked = false; + else if (type == SUB) + cglcd->subLocked = false; + else if (type == CAM) + cglcd->camLocked = false; + cglcd->Update(); + } +} + +bool cGLCD::showProgressBarBorder(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t scale, uint32_t color_border, uint32_t color_progress) +{ + cglcd->bitmap->DrawRectangle(x1, y1, x1 + (x2 - x1 - 1), y2, color_border, false); + if (scale) { + cglcd->bitmap->DrawRectangle(x1 + 1, y1 + 1, x1 + (scale * (x2 - x1 - 1) / 100), y2 - 1, color_progress, true); + return true; + } else + return false; +} + +bool cGLCD::showImage(fb_pixel_t *s, uint32_t sw, uint32_t sh, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp, bool maximize) +{ + int bb_x, bb_y, bb_w, bb_h; + + if (cglcd->getBoundingBox(s, sw, sh, bb_x, bb_y, bb_w, bb_h) && bb_w && bb_h) + { + if (!maximize) + { + if (bb_h * dw > bb_w * dh) + { + uint32_t dw_new = dh * bb_w / bb_h; + dx += (dw - dw_new) >> 1; + dw = dw_new; + } else { + uint32_t dh_new = dw * bb_h / bb_w; + dy += (dh - dh_new) >> 1; + dh = dh_new; + } + } + for (u_int y = 0; y < dh; y++) + { + for (u_int x = 0; x < dw; x++) + { + uint32_t pix = *(s + (y * bb_h / dh + bb_y) * sw + x * bb_w / dw + bb_x); + if (!transp || pix) + cglcd->bitmap->DrawPixel(x + dx, y + dy, pix); + } + } + return true; + } + return false; +} + +bool cGLCD::showImage(const std::string & filename, uint32_t sw, uint32_t sh, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp, bool maximize) +{ + bool res = false; + if (!dw || !dh) + return res; + fb_pixel_t *s = g_PicViewer->getImage(filename, sw, sh); + if (s && sw && sh) + res = showImage(s, sw, sh, dx, dy, dw, dh, transp, maximize); + if (s) + free(s); + return res; +} + +bool cGLCD::showImage(uint64_t cid, std::string cname, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp, bool maximize) +{ + std::string logo; + int sw, sh; + + if (g_PicViewer->GetLogoName(cid, cname, logo, &sw, &sh)) + { + return showImage(logo, (uint32_t) sw, (uint32_t) sh, dx, dy, dw, dh, transp, maximize); + } + return false; +} + +bool cGLCD::imageShow(const std::string & filename, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp, bool maximize, bool clear, bool center_sw, bool center_sh) +{ + bool ret = false; + int sw, sh; + + g_PicViewer->getSize(filename.c_str(), &sw, &sh); + if (sw && sh) + { + if (clear) + cglcd->bitmap->Clear(GLCD::cColor::Black); + if (maximize) + ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) cglcd->bitmap->Width(), (uint32_t) cglcd->bitmap->Height(), transp, false); + else + if (center_sw || center_sh) + { + int move_sw = 0; + int move_sh = 0; + if (center_sw) + move_sw = dx - (sw / 2); + else + move_sw = dx; + if (center_sh) + move_sh = dy - (sh / 2); + else + move_sh = dy; + if (dw > 0 && dh > 0) + ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) move_sw, (uint32_t) move_sh, (uint32_t) dw, (uint32_t) dh, transp, false); + else + ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) move_sw, (uint32_t) move_sh, (uint32_t) sw, (uint32_t) sh, transp, false); + } + else + if (dw > 0 && dh > 0) + ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) dw, (uint32_t) dh, transp, false); + else + ret = showImage(filename, (uint32_t) sw, (uint32_t) sh, (uint32_t) dx, (uint32_t) dy, (uint32_t) sw, (uint32_t) sh, transp, false); + } + return ret; +} + +bool cGLCD::drawText(int x, int y, int xmax, int text_width, const std::string & text, const GLCD::cFont * font, uint32_t color1, uint32_t color2, bool proportional, int skipPixels, int align) +{ + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + + int z = 0; + + if (align == ALIGN_NONE) + { + z = x; + } + else if (align == ALIGN_LEFT) + { + z = std::max(2, (bitmap->Width() - 4 - text_width) / 24); + } + else if (align == ALIGN_CENTER) + { + z = std::max(2, (bitmap->Width() - 4 - text_width) / 2); + } + else if (align == ALIGN_RIGHT) + { + z = std::max(2, (bitmap->Width() - 4 - text_width)); + } + + return bitmap->DrawText(z, y, xmax, text, font, color1, color2, proportional, skipPixels); +} + +bool cGLCD::dumpBuffer(fb_pixel_t *s, int format, const char *filename) +{ + int output_bytes = 4; + + int jpg_quality = 90; + + int xres = bitmap->Width(); + int yres = bitmap->Height(); + + unsigned char *output = (unsigned char *)s; + + FILE *fd = fopen(filename, "wr"); + if (!fd) + return false; + + if(cglcd) + cglcd->Lock(); + + if (format == BMP) { + // write bmp + unsigned char hdr[14 + 40]; + int i = 0; +#define PUT32(x) hdr[i++] = ((x)&0xFF); hdr[i++] = (((x)>>8)&0xFF); hdr[i++] = (((x)>>16)&0xFF); hdr[i++] = (((x)>>24)&0xFF); +#define PUT16(x) hdr[i++] = ((x)&0xFF); hdr[i++] = (((x)>>8)&0xFF); +#define PUT8(x) hdr[i++] = ((x)&0xFF); + PUT8('B'); PUT8('M'); + PUT32((((xres * yres) * 3 + 3) &~ 3) + 14 + 40); + PUT16(0); PUT16(0); PUT32(14 + 40); + PUT32(40); PUT32(xres); PUT32(yres); + PUT16(1); + PUT16(output_bytes*8); // bits + PUT32(0); PUT32(0); PUT32(0); PUT32(0); PUT32(0); PUT32(0); +#undef PUT32 +#undef PUT16 +#undef PUT8 + fwrite(hdr, 1, i, fd); + + int y; + for (y=yres-1; y>=0 ; y-=1) + fwrite(output + (y * xres * output_bytes), xres * output_bytes, 1, fd); + } else if (format == JPG) { + const int row_stride = xres * output_bytes; + // write jpg + if (output_bytes == 3) // swap bgr<->rgb + { + int y; + #pragma omp parallel for shared(output) + for (y = 0; y < yres; y++) + { + int xres1 = y * xres * 3; + int xres2 = xres1 + 2; + int x; + for (x = 0; x < xres; x++) + { + int x2 = x * 3; + SWAP(output[x2 + xres1], output[x2 + xres2]); + } + } + } + else // swap bgr<->rgb and eliminate alpha channel jpgs are always saved with 24bit without alpha channel + { + int y; + #pragma omp parallel for shared(output) + for (y = 0; y < yres; y++) + { + unsigned char *scanline = output + (y * row_stride); + int x; + for (x=0; xUnlock(); + + fclose(fd); + return true; +} + +void cGLCD::UpdateBrightness() +{ + int dim_time = atoi(g_settings.glcd_brightness_dim_time.c_str()); + int dim_brightness = g_settings.glcd_brightness_dim; + bool timeouted = (dim_time > 0) && (timeout_cnt == 0); + + if (cglcd && cglcd->lcd) + { + if (timeouted && !cglcd->doStandbyTime) + cglcd->lcd->SetBrightness((unsigned int) (dim_brightness)); + else + cglcd->lcd->SetBrightness((unsigned int) (cglcd->doStandbyTime ? g_settings.glcd_brightness_standby : g_settings.glcd_brightness)); + + } +} + +void cGLCD::SetBrightness(unsigned int b) +{ + if (cglcd) + cglcd->SetBrightness(b); +} + +void cGLCD::TogglePower() +{ + if (cglcd) + { + cglcd->power_state = 1 - cglcd->power_state; + if (cglcd->power_state) + cglcd->Resume(); + else + cglcd->Suspend(); + } +} + +void cGLCD::Blit() +{ + if (cglcd) + cglcd->blitFlag = true; +} + +int cGLCD::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t /* data */) +{ + if (msg == NeutrinoMessages::EVT_CURRENTNEXT_EPG) + { + Update(); + return messages_return::handled; + } + + return messages_return::unhandled; +} + diff --git a/src/driver/nglcd.h b/src/driver/glcd.h similarity index 57% rename from src/driver/nglcd.h rename to src/driver/glcd.h index d9c40ace0..f80326a15 100644 --- a/src/driver/nglcd.h +++ b/src/driver/glcd.h @@ -33,6 +33,9 @@ #include #include +#define CLAMP(x) ((x < 0) ? 0 : ((x > 255) ? 255 : x)) +#define SWAP(x,y) { x ^= y; y ^= x; x ^= y; } + #pragma GCC diagnostic ignored "-Wunused-parameter" #include #include @@ -41,37 +44,53 @@ #include #pragma GCC diagnostic warning "-Wunused-parameter" -class nGLCD +class cGLCD { private: - GLCD::cDriver * lcd; - GLCD::cFont font_channel; - GLCD::cFont font_epg; - GLCD::cFont font_time; - GLCD::cFont font_time_standby; int fontsize_channel; int fontsize_epg; int fontsize_time; - int fontsize_time_standby; + int fontsize_duration; + int fontsize_start; + int fontsize_end; + int fontsize_smalltext; int percent_channel; int percent_time; - int percent_time_standby; + int percent_duration; + int percent_start; + int percent_end; int percent_epg; + int percent_smalltext; int percent_bar; int percent_logo; - int percent_space; int power_state; - GLCD::cBitmap * bitmap; + std::string Logo; std::string Channel; std::string Epg; + std::string Time; + std::string Duration; + std::string Start; + std::string End; + std::string Smalltext; + std::string Temperature; std::string stagingChannel; std::string stagingEpg; + std::string stagingTime; + std::string stagingDuration; + std::string stagingStart; + std::string stagingEnd; + std::string stagingSmalltext; t_channel_id channel_id; int Scale; time_t now; struct tm *tm; int EpgWidth; int ChannelWidth; + int TimeWidth; + int DurationWidth; + int StartWidth; + int EndWidth; + int SmalltextWidth; int scrollEpgSkip; int scrollChannelSkip; int scrollEpgOffset; @@ -80,6 +99,19 @@ class nGLCD bool scrollChannelForward; bool blitFlag; bool channelLocked; + bool timeLocked; + bool durationLocked; + bool startLocked; + bool endLocked; + bool recLocked; + bool muteLocked; + bool tsLocked; + bool ecmLocked; + bool timerLocked; + bool ddLocked; + bool txtLocked; + bool subLocked; + bool camLocked; bool doRescan; bool doSuspend; bool doStandby; @@ -88,9 +120,15 @@ class nGLCD bool doScrollChannel; bool doScrollEpg; bool doShowVolume; + bool doShowLcdIcon; bool doMirrorOSD; bool fonts_initialized; + bool ismediaplayer; + int timeout_cnt; + bool locked_countdown; + bool time_thread_started; pthread_t thrGLCD; + pthread_t thrTimeThread; pthread_mutex_t mutex; sem_t sem; void updateFonts(); @@ -108,40 +146,79 @@ class nGLCD bool getBoundingBox(uint32_t *buffer, int width, int height, int &bb_x, int &bb_y, int &bb_width, int &bb_height); - void LcdAnalogClock(int posx,int posy,int dia); void Exec(); + void CountDown(); + void WakeUp(); + static void *TimeThread(void *); void Run(void); static void* Run(void *); static void Lock(); static void Unlock(); public: - enum - { - CLOCK_OFF = 0, - CLOCK_DIGITAL_HM = 1, - CLOCK_DIGITAL_HMS = 2, - CLOCK_ANALOG = 3 + enum { + BMP = 0, + JPG = 1, + PNG = 2, }; - - nGLCD(); - ~nGLCD(); + enum { + ALIGN_NONE = 0, + ALIGN_LEFT = 1, + ALIGN_CENTER = 2, + ALIGN_RIGHT = 3, + }; + enum { + REC = 0, + MUTE = 1, + TS = 2, + ECM = 3, + TIMER = 4, + DD = 5, + TXT = 6, + SUB = 7, + CAM = 8, + }; + GLCD::cDriver * lcd; + GLCD::cFont font_channel; + GLCD::cFont font_epg; + GLCD::cFont font_time; + GLCD::cFont font_duration; + GLCD::cFont font_start; + GLCD::cFont font_end; + GLCD::cFont font_smalltext; + GLCD::cBitmap * bitmap; + cGLCD(); + ~cGLCD(); + uint32_t ColorConvert3to1(uint32_t red, uint32_t green, uint32_t blue); void DeInit(); void Rescan(); - static nGLCD *getInstance(); + bool showProgressBarBorder(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t scale, uint32_t color_border, uint32_t color_progress); + bool imageShow(const std::string & filename, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp = false, bool maximize = false, bool clear = false, bool center_sw = false, bool center_sh = false); + bool drawText(int x, int y, int xmax, int text_width, const std::string & text, const GLCD::cFont * font, uint32_t color1, uint32_t color2, bool proportional, int skipPixels, int align); + static cGLCD *getInstance(); static void lockChannel(std::string txt, std::string epg = "", int scale = 0); static void unlockChannel(); + static void lockTime(std::string time); + static void unlockTime(); + static void lockDuration(std::string time); + static void unlockDuration(); + static void lockStart(std::string time); + static void unlockStart(); + static void lockEnd(std::string time); + static void unlockEnd(); + static void lockIcon(int type = 0); + static void unlockIcon(int type = 0); static void MirrorOSD(bool b = true); static void Update(); static void Suspend(); static void StandbyMode(bool); static void ShowVolume(bool); + static void ShowLcdIcon(bool); static void Resume(); static void Exit(); static void Blit(); static void SetBrightness(unsigned int b); static void TogglePower(); - int GetConfigSize(); - std::string GetConfigName(int); + bool dumpBuffer(fb_pixel_t *s, int format, const char *filename); void UpdateBrightness(); int handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data); }; diff --git a/src/driver/lcdclock.cpp b/src/driver/lcdclock.cpp new file mode 100644 index 000000000..d75380680 --- /dev/null +++ b/src/driver/lcdclock.cpp @@ -0,0 +1,74 @@ +/* + simple clock - DBoxII-Project + + Copyright (C) 2018 redblue + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include + +static bool fonts_initialized = false; + +GLCD::cFont font_time_standby_second; + +void InitLcdClock(void) +{ + printf("[%s:%s] finish initialization\n", __file__, __func__); +} + +void LcdClockUpdateFonts(void) +{ + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + int fontsize_time_standby = 0; + int percent_time_standby = std::min(t.glcd_size_simple_clock, 100); + int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100; + if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) { + fontsize_time_standby = fontsize_time_standby_new; + if (!font_time_standby_second.LoadFT2(/*t.glcd_font*/FONTDIR "/lcd.ttf", "UTF-8", fontsize_time_standby)) { + t.glcd_font = FONTDIR "/lcd.ttf"; + font_time_standby_second.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby); + } + } + fonts_initialized = true; +} + +void RenderLcdClock(std::string Time, int x, int y) +{ + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + LcdClockUpdateFonts(); + cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - font_time_standby_second.Width(Time))/2), + y, cglcd->bitmap->Width() - 1, Time, + &font_time_standby_second, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent); +} + +void ShowLcdClock(std::string Time) +{ + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - font_time_standby_second.Height(Time)) / 2; + RenderLcdClock(Time, 255, y); +} diff --git a/src/driver/lcdclock.h b/src/driver/lcdclock.h new file mode 100644 index 000000000..0965690ec --- /dev/null +++ b/src/driver/lcdclock.h @@ -0,0 +1,34 @@ +/* + LCD-Daemon - DBoxII-Project + + Copyright (C) 2001 Steffen Hehn 'McClean' + Homepage: http://dbox.cyberphoria.org/ + + + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include +#pragma GCC diagnostic warning "-Wunused-parameter" +#include "glcd.h" + +void InitLcdClock(); +void LcdClockUpdateFonts(); +void RenderLcdClock(std::string Time, int x, int y); +void ShowLcdClock(std::string Time); diff --git a/src/driver/ledclock.cpp b/src/driver/ledclock.cpp new file mode 100644 index 000000000..908194929 --- /dev/null +++ b/src/driver/ledclock.cpp @@ -0,0 +1,74 @@ +/* + simple clock - DBoxII-Project + + Copyright (C) 2018 redblue + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include + +static bool fonts_initialized = false; + +GLCD::cFont second_font_time_standby; + +void InitLedClock(void) +{ + printf("[%s:%s] finish initialization\n", __file__, __func__); +} + +void LedClockUpdateFonts(void) +{ + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + int fontsize_time_standby = 0; + int percent_time_standby = std::min(t.glcd_size_simple_clock, 100); + int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100; + if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) { + fontsize_time_standby = fontsize_time_standby_new; + if (!second_font_time_standby.LoadFT2(/*t.glcd_font*/FONTDIR "/led.ttf", "UTF-8", fontsize_time_standby)) { + t.glcd_font = FONTDIR "/led.ttf"; + second_font_time_standby.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby); + } + } + fonts_initialized = true; +} + +void RenderLedClock(std::string Time, int x, int y) +{ + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + LedClockUpdateFonts(); + cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - second_font_time_standby.Width(Time))/2), + y, cglcd->bitmap->Width() - 1, Time, + &second_font_time_standby, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent); +} + +void ShowLedClock(std::string Time) +{ + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - second_font_time_standby.Height(Time)) / 2; + RenderLedClock(Time, 255, y); +} diff --git a/src/driver/ledclock.h b/src/driver/ledclock.h new file mode 100644 index 000000000..8479fac8d --- /dev/null +++ b/src/driver/ledclock.h @@ -0,0 +1,34 @@ +/* + LCD-Daemon - DBoxII-Project + + Copyright (C) 2001 Steffen Hehn 'McClean' + Homepage: http://dbox.cyberphoria.org/ + + + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include +#pragma GCC diagnostic warning "-Wunused-parameter" +#include "glcd.h" + +void InitLedClock(); +void LedClockUpdateFonts(); +void RenderLedClock(std::string Time, int x, int y); +void ShowLedClock(std::string Time); diff --git a/src/driver/nglcd.cpp b/src/driver/nglcd.cpp deleted file mode 100644 index 207241083..000000000 --- a/src/driver/nglcd.cpp +++ /dev/null @@ -1,983 +0,0 @@ -/* - Neutrino graphlcd daemon thread - - (C) 2012-2014 by martii - - - License: GPL - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define LCD_ICONSDIR "/share/lcd/icons/" - -static const char * kDefaultConfigFile = "/etc/graphlcd.conf"; -static nGLCD *nglcd = NULL; - -extern CPictureViewer * g_PicViewer; - -nGLCD::nGLCD() { - lcd = NULL; - Channel = "Neutrino"; - Epg = std::string(g_info.hw_caps->boxvendor) + " " + std::string(g_info.hw_caps->boxname); - - sem_init(&sem, 0, 1); - - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP); - pthread_mutex_init(&mutex, &attr); - - channelLocked = false; - doRescan = false; - doStandby = false; - doStandbyTime = false; - doShowVolume = false; - doSuspend = false; - doExit = false; - doMirrorOSD = false; - fontsize_channel = 0; - fontsize_epg = 0; - fontsize_time = 0; - fontsize_time_standby = 0; - fonts_initialized = false; - doScrollChannel = false; - doScrollEpg = false; - percent_channel = 0; - percent_time = 0; - percent_time_standby = 0; - percent_epg = 0; - percent_bar = 0; - percent_space = 0; - percent_logo = 0; - power_state = 1; - Scale = 0; - bitmap = NULL; - blitFlag = true; - - nglcd = this; - - if (!g_settings.glcd_enable) - doSuspend = true; - - if (pthread_create (&thrGLCD, 0, nGLCD::Run, this) != 0 ) - fprintf(stderr, "ERROR: pthread_create(nGLCD::Init)\n"); - - Update(); -} - -void nGLCD::Lock(void) -{ - if (nglcd) - pthread_mutex_lock(&nglcd->mutex); -} - -void nGLCD::Unlock(void) -{ - if (nglcd) - pthread_mutex_unlock(&nglcd->mutex); -} - -nGLCD::~nGLCD() { - Suspend(); - nglcd = NULL; - if (lcd) { - lcd->DeInit(); - delete lcd; - } - sem_destroy(&sem); - pthread_mutex_destroy(&mutex); -} - -nGLCD *nGLCD::getInstance() -{ - if (!nglcd) - nglcd = new nGLCD; - return nglcd; -} - -void nGLCD::LcdAnalogClock(int posx,int posy,int dia) -{ - int tm_,th_,mx_,my_,hx_,hy_; - double pi_ = 3.1415926535897932384626433832795, mAngleInRad, mAngleSave, hAngleInRad; - - tm_ = tm->tm_min; - th_ = tm->tm_hour; - - mAngleInRad = ((6 * tm_) * (2*pi_ / 360)); - mAngleSave = mAngleInRad; - mAngleInRad -= pi_/2; -#if BOXMODEL_VUUNO4KSE - mx_ = int((dia * 0.55 * cos(mAngleInRad))); - my_ = int((dia * 0.55 * sin(mAngleInRad))); -#else - mx_ = int((dia * 0.7 * cos(mAngleInRad))); - my_ = int((dia * 0.7 * sin(mAngleInRad))); -#endif - - hAngleInRad = ((30 * th_)* (2*pi_ / 360)); - hAngleInRad += mAngleSave / 12; - hAngleInRad -= pi_/2; -#if BOXMODEL_VUUNO4KSE - hx_ = int((dia * 0.25 * cos(hAngleInRad))); - hy_ = int((dia * 0.25 * sin(hAngleInRad))); -#else - hx_ = int((dia * 0.4 * cos(hAngleInRad))); - hy_ = int((dia * 0.4 * sin(hAngleInRad))); -#endif - - std::string clock_face = LCD_ICONSDIR "/clock/analog/dial.png"; - - int clock_face_width = 0, clock_face_height = 0; - g_PicViewer->getSize(clock_face.c_str(), &clock_face_width, &clock_face_height); - if (clock_face_width && clock_face_height) - { - showImage(clock_face, (uint32_t) clock_face_width, (uint32_t) clock_face_height, - 0, 0, (uint32_t) nglcd->bitmap->Width(), (uint32_t) nglcd->bitmap->Height(), false, false); - - lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); - lcd->Refresh(true); - } - - // TODO: Fix these ugly and buggy clock hands - - // hour - bitmap->DrawLine(posx,posy-8,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-7,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-6,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-5,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-4,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-3,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-2,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-1,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx+1,posy,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+1,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+2,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+3,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+4,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+5,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+6,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+7,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+8,posx+hx_,posy+hy_, g_settings.glcd_color_fg); - - // minute - bitmap->DrawLine(posx,posy-6,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-5,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-4,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-3,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-2,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy-1,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx+1,posy,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+1,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+2,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+3,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+4,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+5,posx+mx_,posy+my_, g_settings.glcd_color_fg); - bitmap->DrawLine(posx,posy+6,posx+mx_,posy+my_, g_settings.glcd_color_fg); -} - -void nGLCD::Exec() { - if (!lcd) - return; - - bitmap->Clear(g_settings.glcd_color_bg); - - if (Channel.compare("Neutrino") == 0) { - int start_width = 0, start_height = 0; - g_PicViewer->getSize(DATADIR "/neutrino/icons/start.jpg", &start_width, &start_height); - if (start_width && start_height) { - showImage(DATADIR "/neutrino/icons/start.jpg", (uint32_t) start_width, (uint32_t) start_height, - 0, 0, (uint32_t) nglcd->bitmap->Width(), (uint32_t) nglcd->bitmap->Height(), false, true); - - GLCD::cFont font_tmp; - int fw = font_epg.Width(Epg); - font_tmp.LoadFT2(g_settings.glcd_font, "UTF-8", fontsize_epg * (bitmap->Width() - 4) / fw); - fw = font_tmp.Width(Epg); - - bitmap->DrawText(std::max(2,(bitmap->Width() - 4 - fw)/2), - 10 * bitmap->Height()/100, bitmap->Width() - 4, Epg, - &font_tmp, g_settings.glcd_color_fg, GLCD::cColor::Transparent); - - lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); - lcd->Refresh(true); - } - return; - } - - if (doStandbyTime) { - if (percent_time_standby) { - - std::string Time; - if (g_settings.glcd_time_in_standby == CLOCK_ANALOG) - LcdAnalogClock(bitmap->Width()/2, bitmap->Height()/2, 200); - else if (g_settings.glcd_time_in_standby == CLOCK_DIGITAL_HMS) - Time = strftime("%H:%M:%S", tm); - else - Time = strftime("%H:%M", tm); - - bitmap->DrawText(std::max(2,(bitmap->Width() - 4 - font_time_standby.Width(Time))/2), - (bitmap->Height() - font_time_standby.Height(Time))/2, bitmap->Width() - 1, Time, - &font_time_standby, g_settings.glcd_color_fg, GLCD::cColor::Transparent); - lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); - lcd->Refresh(false); - } - return; - } - - if (CNeutrinoApp::getInstance()->recordingstatus) { -#if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE || BOXMODEL_VUUNO4K - for (int bx = 0; bx < 9; bx++) { -#else - for (int bx = 0; bx < 3; bx++) { -#endif - bitmap->DrawRectangle(bx, bx, bitmap->Width() - bx + 1, bitmap->Height() - bx + 1, GLCD::cColor::Red, false); - } - } else - if (CNeutrinoApp::getInstance()->isMuted()) { -#if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE || BOXMODEL_VUUNO4K - for (int bx = 0; bx < 9; bx++) { -#else - for (int bx = 0; bx < 3; bx++) { -#endif - bitmap->DrawRectangle(bx, bx, bitmap->Width() - bx + 1, bitmap->Height() - bx + 1, GLCD::cColor::Blue, false); - } - } - - int off = percent_space; - - if (g_settings.glcd_show_logo && percent_logo && - showImage(channel_id, Channel, 0, off * bitmap->Height()/100, bitmap->Width() - 4, percent_logo * bitmap->Height()/100, true)) { - off += percent_logo; - off += percent_space; - doScrollChannel = false; - scrollChannelSkip = 0; - } else if (percent_channel) { - int logo_offset = 0; - if (g_settings.glcd_show_logo && percent_channel < percent_logo) { - int o = logo_offset = percent_logo - percent_channel; - o >>= 1; - off += o; - logo_offset -= o; - } - if (ChannelWidth) { - if (scrollChannelForward) { - if (ChannelWidth - scrollChannelSkip < bitmap->Width() - 4) - scrollChannelForward = false; - } else if (scrollChannelSkip <= 0) { - scrollChannelSkip = 0; - doScrollChannel = false; - } - - bitmap->DrawText(std::max(2,(bitmap->Width() - 4 - ChannelWidth)/2) + scrollChannelOffset, - off * bitmap->Height()/100, bitmap->Width() - 4, Channel, - &font_channel, g_settings.glcd_color_fg, GLCD::cColor::Transparent, true, scrollChannelSkip); - - if (scrollChannelOffset > 0) - scrollChannelOffset -= g_settings.glcd_scroll_speed; - - if (scrollChannelOffset < 0) - scrollChannelOffset = 0; - - if (scrollChannelOffset == 0) { - if (scrollChannelForward) - scrollChannelSkip += g_settings.glcd_scroll_speed; - else - scrollChannelSkip -= g_settings.glcd_scroll_speed; - } - } - off += percent_channel; - off += logo_offset; - off += percent_space; - } else - off = 0; - - if (percent_epg) { - off += percent_space; - if (EpgWidth) { - if (scrollEpgForward) { - if (EpgWidth - scrollEpgSkip < bitmap->Width() - 4) - scrollEpgForward = false; - } else if (scrollEpgSkip <= 0) { - scrollEpgSkip = 0; - doScrollEpg = false; - } - - bitmap->DrawText(std::max(2,(bitmap->Width() - 4 - EpgWidth)/2) + scrollEpgOffset, - off * bitmap->Height()/100, bitmap->Width() - 4, Epg, - &font_epg, g_settings.glcd_color_fg, GLCD::cColor::Transparent, true, scrollEpgSkip); - - if (scrollEpgOffset > 0) - scrollEpgOffset -= g_settings.glcd_scroll_speed; - - if (scrollEpgOffset < 0) - scrollEpgOffset = 0; - - if (scrollEpgOffset == 0) { - if (scrollEpgForward) - scrollEpgSkip += g_settings.glcd_scroll_speed; - else - scrollEpgSkip -= g_settings.glcd_scroll_speed; - } - } - off += percent_epg; - off += percent_space; - } - - if (percent_bar) { - off += percent_space; - int bar_top = off * bitmap->Height()/100; - off += percent_bar; - int bar_bottom = off * bitmap->Height()/100; - bitmap->DrawHLine(0, bar_top, bitmap->Width(), g_settings.glcd_color_fg); - bitmap->DrawHLine(0, bar_bottom, bitmap->Width(), g_settings.glcd_color_fg); - if (Scale) - bitmap->DrawRectangle(0, bar_top + 1, Scale * (bitmap->Width() - 1)/100, - bar_bottom - 1, g_settings.glcd_color_bar, true); - off += percent_space; - } - - if (percent_time) { - off += percent_space; - std::string Time = strftime("%H:%M", tm); - bitmap->DrawText(std::max(2,(bitmap->Width() - 4 - font_time.Width(Time))/2), - off * bitmap->Height()/100, bitmap->Width() - 1, Time, - &font_time, g_settings.glcd_color_fg, GLCD::cColor::Transparent); - } - - lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); - lcd->Refresh(false); -} - -void nGLCD::updateFonts() { - int percent; - percent = std::max(g_settings.glcd_percent_channel, g_settings.glcd_show_logo ? g_settings.glcd_percent_logo : 0) - + g_settings.glcd_percent_epg + g_settings.glcd_percent_bar + g_settings.glcd_percent_time; - - int div = 0; - - if (percent_channel || percent_logo) - div += 2; - if (percent_epg) - div += 2; - if (percent_bar) - div += 2; - if (percent_time) - div += 2; - - percent += div; - - if (percent < 100) - percent = 100; - - percent_logo = g_settings.glcd_show_logo ? g_settings.glcd_percent_logo * 100 / percent : 0; - percent_channel = g_settings.glcd_percent_channel * 100 / percent; - percent_epg = g_settings.glcd_percent_epg * 100 / percent; - percent_bar = g_settings.glcd_percent_bar * 100 / percent; - percent_time = g_settings.glcd_percent_time * 100 / percent; - percent_time_standby = std::min(g_settings.glcd_percent_time_standby, 100); - - percent_space = (100 - std::max(percent_logo, percent_channel) - percent_time - percent_epg - percent_bar) / div; - - // calculate height - int fontsize_channel_new = percent_channel * nglcd->lcd->Height() / 100; - int fontsize_epg_new = percent_epg * nglcd->lcd->Height() / 100; - int fontsize_time_new = percent_time * nglcd->lcd->Height() / 100; - int fontsize_time_standby_new = percent_time_standby * nglcd->lcd->Height() / 100; - - if (!fonts_initialized || (fontsize_channel_new != fontsize_channel)) { - fontsize_channel = fontsize_channel_new; - if (!font_channel.LoadFT2(g_settings.glcd_font, "UTF-8", fontsize_channel)) { - g_settings.glcd_font = FONTDIR "/neutrino.ttf"; - font_channel.LoadFT2(g_settings.glcd_font, "UTF-8", fontsize_channel); - } - } - if (!fonts_initialized || (fontsize_epg_new != fontsize_epg)) { - fontsize_epg = fontsize_epg_new; - if (!font_epg.LoadFT2(g_settings.glcd_font, "UTF-8", fontsize_epg)) { - g_settings.glcd_font = FONTDIR "/neutrino.ttf"; - font_epg.LoadFT2(g_settings.glcd_font, "UTF-8", fontsize_epg); - } - } - if (!fonts_initialized || (fontsize_time_new != fontsize_time)) { - fontsize_time = fontsize_time_new; - if (!font_time.LoadFT2(g_settings.glcd_font, "UTF-8", fontsize_time)) { - g_settings.glcd_font = FONTDIR "/neutrino.ttf"; - font_time.LoadFT2(g_settings.glcd_font, "UTF-8", fontsize_time); - } - } - if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) { - fontsize_time_standby = fontsize_time_standby_new; - if (!font_time_standby.LoadFT2(g_settings.glcd_font, "UTF-8", fontsize_time_standby)) { - g_settings.glcd_font = FONTDIR "/neutrino.ttf"; - font_time_standby.LoadFT2(g_settings.glcd_font, "UTF-8", fontsize_time_standby); - } - } - - fonts_initialized = true; -} - -bool nGLCD::getBoundingBox(uint32_t *buffer, int width, int height, int &bb_x, int &bb_y, int &bb_w, int &bb_h) -{ - if (!width || !height) { - bb_x = bb_y = bb_w = bb_h = 0; - return false; - } - - int y_min = height; - uint32_t *b = buffer; - for (int y = 0; y < height; y++) - for (int x = 0; x < width; x++, b++) - if (*b) { - y_min = y; - goto out1; - } - out1: - - int y_max = y_min; - b = buffer + height * width - 1; - for (int y = height - 1; y_min < y; y--) - for (int x = 0; x < width; x++, b--) - if (*b) { - y_max = y; - goto out2; - } - out2: - - int x_min = width; - for (int x = 0; x < width; x++) { - b = buffer + x + y_min * width; - for (int y = y_min; y < y_max; y++, b += width) - if (*b) { - x_min = x; - goto out3; - } - } - out3: - - int x_max = x_min; - for (int x = width - 1; x_min < x; x--) { - b = buffer + x + y_min * width; - for (int y = y_min; y < y_max; y++, b += width) - if (*b) { - x_max = x; - goto out4; - } - } - out4: - - bb_x = x_min; - bb_y = y_min; - bb_w = 1 + x_max - x_min; - bb_h = 1 + y_max - y_min; - - if (bb_x < 0) - bb_x = 0; - if (bb_y < 0) - bb_y = 0; - - return true; -} - -void* nGLCD::Run(void *arg) -{ - nGLCD *me = (nGLCD *) arg; - me->Run(); - pthread_exit(NULL); -} - -void nGLCD::Run(void) -{ - set_threadname("nGLCD::Run"); - - if (GLCD::Config.Load(kDefaultConfigFile) == false) { - fprintf(stderr, "Error loading config file!\n"); - return; - } - if ((GLCD::Config.driverConfigs.size() < 1)) { - fprintf(stderr, "No driver config found!\n"); - return; - } - - struct timespec ts; - - CSectionsdClient::CurrentNextInfo info_CurrentNext; - channel_id = -1; - info_CurrentNext.current_zeit.startzeit = 0; - info_CurrentNext.current_zeit.dauer = 0; - info_CurrentNext.flags = 0; - - fonts_initialized = false; - bool broken = false; - - do { - if (broken) { -#ifdef GLCD_DEBUG - fprintf(stderr, "No graphlcd display found ... sleeping for 30 seconds\n"); -#endif - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += 30; - sem_timedwait(&sem, &ts); - broken = false; - if (doExit) - break; - if (!g_settings.glcd_enable) - continue; - } else - while ((doSuspend || doStandby || !g_settings.glcd_enable) && !doExit) - sem_wait(&sem); - - if (doExit) - break; - - int warmUp = 10; - - if ((g_settings.glcd_selected_config < 0) || (g_settings.glcd_selected_config > GetConfigSize() - 1)) - g_settings.glcd_selected_config = 0; - - lcd = GLCD::CreateDriver(GLCD::Config.driverConfigs[g_settings.glcd_selected_config].id, &GLCD::Config.driverConfigs[g_settings.glcd_selected_config]); - if (!lcd) { -#ifdef GLCD_DEBUG - fprintf(stderr, "CreateDriver failed.\n"); -#endif - broken = true; - continue; - } -#ifdef GLCD_DEBUG - fprintf(stderr, "CreateDriver succeeded.\n"); -#endif - if (lcd->Init()) { - delete lcd; - lcd = NULL; -#ifdef GLCD_DEBUG - fprintf(stderr, "LCD init failed.\n"); -#endif - broken = true; - continue; - } -#ifdef GLCD_DEBUG - fprintf(stderr, "LCD init succeeded.\n"); -#endif - lcd->SetBrightness(0); - - if (!bitmap) - bitmap = new GLCD::cBitmap(lcd->Width(), lcd->Height(), g_settings.glcd_color_bg); - - UpdateBrightness(); - Update(); - - doMirrorOSD = false; - - while ((!doSuspend && !doStandby) && !doExit && g_settings.glcd_enable) { - if (doMirrorOSD && !doStandbyTime) { - if (blitFlag) { - blitFlag = false; - bitmap->Clear(GLCD::cColor::Black); - ts.tv_sec = 0; // don't wait - static CFrameBuffer* fb = CFrameBuffer::getInstance(); -#if !BOXMODEL_VUSOLO4K && !BOXMODEL_VUDUO4K && !BOXMODEL_VUULTIMO4K && !BOXMODEL_VUUNO4KSE - static int fb_width = fb->getScreenWidth(true); -#endif - static int fb_height = fb->getScreenHeight(true); - static uint32_t *fbp = fb->getFrameBufferPointer(); - int lcd_width = bitmap->Width(); - int lcd_height = bitmap->Height(); -#if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE - unsigned int fb_stride = fb->getStride()/4; - if (!showImage(fbp, fb_stride, fb_height, 0, 0, lcd_width, lcd_height, false)) { -#else - if (!showImage(fbp, fb_width, fb_height, 0, 0, lcd_width, lcd_height, false)) { -#endif - usleep(500000); - } else { - lcd->SetScreen(bitmap->Data(), lcd_width, lcd_height); - lcd->Refresh(false); - } - } else - usleep(100000); - continue; - } - if (g_settings.glcd_mirror_video && !doStandbyTime) { - char ws[10]; - snprintf(ws, sizeof(ws), "%d", bitmap->Width()); - const char *bmpShot = "/tmp/nglcd-video.bmp"; - my_system(4, "/bin/grab", "-vr", ws, bmpShot); - int bw = 0, bh = 0; - g_PicViewer->getSize(bmpShot, &bw, &bh); - if (bw > 0 && bh > 0) { - int lcd_width = bitmap->Width(); - int lcd_height = bitmap->Height(); - if (!showImage(bmpShot, (uint32_t) bw, (uint32_t) bh, 0, 0, (uint32_t) lcd_width, lcd_height, false, true)) - usleep(1000000); - else { - lcd->SetScreen(bitmap->Data(), lcd_width, lcd_height); - lcd->Refresh(false); - } - } - else - usleep(1000000); - continue; - } - - clock_gettime(CLOCK_REALTIME, &ts); - tm = localtime(&ts.tv_sec); - updateFonts(); - Exec(); - clock_gettime(CLOCK_REALTIME, &ts); - tm = localtime(&ts.tv_sec); - if (warmUp > 0) { - ts.tv_sec += 1; - warmUp--; - } else { - ts.tv_sec += 60 - tm->tm_sec; - ts.tv_nsec = 0; - } - - if (!doScrollChannel && !doScrollEpg) - sem_timedwait(&sem, &ts); - - while(!sem_trywait(&sem)); - - if(doRescan || doSuspend || doStandby || doExit) - break; - - if (doShowVolume) { - Epg = ""; - if (Channel.compare(g_Locale->getText(LOCALE_GLCD_VOLUME))) { - Channel = g_Locale->getText(LOCALE_GLCD_VOLUME); - ChannelWidth = font_channel.Width(Channel); - doScrollChannel = ChannelWidth > bitmap->Width() - 4; - scrollChannelSkip = 0; - scrollChannelForward = true; - if (doScrollChannel) { - scrollChannelOffset = bitmap->Width()/g_settings.glcd_scroll_speed; - ChannelWidth += scrollChannelOffset; - } else - scrollChannelOffset = 0; - } - EpgWidth = 0; - scrollEpgSkip = 0; - scrollEpgForward = true; - Scale = g_settings.current_volume; - channel_id = -1; - } else if (channelLocked) { - Lock(); - if (Epg.compare(stagingEpg)) { - Epg = stagingEpg; - EpgWidth = font_epg.Width(Epg); - doScrollEpg = EpgWidth > bitmap->Width() - 4; - scrollEpgSkip = 0; - scrollEpgForward = true; - if (doScrollEpg) { - scrollEpgOffset = bitmap->Width()/g_settings.glcd_scroll_speed; - EpgWidth += scrollEpgOffset; - } else - scrollChannelOffset = 0; - } - if (Channel.compare(stagingChannel)) { - Channel = stagingChannel; - ChannelWidth = font_channel.Width(Channel); - doScrollChannel = ChannelWidth > bitmap->Width() - 4; - scrollChannelSkip = 0; - scrollChannelForward = true; - if (doScrollChannel) { - scrollChannelOffset = bitmap->Width()/g_settings.glcd_scroll_speed; - ChannelWidth += scrollChannelOffset; - } else - scrollChannelOffset = 0; - } - channel_id = -1; - Unlock(); - } else { - CChannelList *channelList = CNeutrinoApp::getInstance ()->channelList; - if (!channelList) - continue; - t_channel_id new_channel_id = channelList->getActiveChannel_ChannelID(); - if (!new_channel_id) - continue; - - if ((new_channel_id != channel_id)) { - Channel = channelList->getActiveChannelName (); - ChannelWidth = font_channel.Width(Channel); - Epg = ""; - EpgWidth = 0; - Scale = 0; - doScrollEpg = false; - doScrollChannel = ChannelWidth > bitmap->Width() - 4; - scrollChannelForward = true; - scrollChannelSkip = 0; - if (doScrollChannel) { - scrollChannelOffset = bitmap->Width()/g_settings.glcd_scroll_speed; - ChannelWidth += scrollChannelOffset; - } else - scrollChannelOffset = 0; - warmUp = 10; - info_CurrentNext.current_name = ""; - info_CurrentNext.current_zeit.dauer = 0; - } - - CEitManager::getInstance()->getCurrentNextServiceKey(channel_id & 0xFFFFFFFFFFFFULL, info_CurrentNext); - channel_id = new_channel_id; - - if (info_CurrentNext.current_name.compare(Epg)) { - Epg = info_CurrentNext.current_name; - EpgWidth = font_epg.Width(Epg); - doScrollEpg = EpgWidth > bitmap->Width() - 4; - scrollEpgForward = true; - scrollEpgSkip = 0; - if (doScrollEpg) { - scrollEpgOffset = bitmap->Width()/g_settings.glcd_scroll_speed; - EpgWidth += scrollEpgOffset; - } else - scrollEpgOffset = 0; - } - if (info_CurrentNext.current_zeit.dauer > 0) - Scale = (ts.tv_sec - info_CurrentNext.current_zeit.startzeit) * 100 / info_CurrentNext.current_zeit.dauer; - if (Scale > 100) - Scale = 100; - else if (Scale < 0) - Scale = 0; - } - } - - if(!g_settings.glcd_enable || doSuspend || doStandby || doExit) { - // for restart, don't blacken screen - bitmap->Clear(GLCD::cColor::Black); - lcd->SetBrightness(0); - lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height()); - lcd->Refresh(false); - } - if (doRescan) { - doRescan = false; - Update(); - } - lcd->DeInit(); - delete lcd; - lcd = NULL; - } while(!doExit); -} - -void nGLCD::Update() { - if (nglcd) - sem_post(&nglcd->sem); -} - -void nGLCD::StandbyMode(bool b) { - if (nglcd) { - if (g_settings.glcd_time_in_standby != CLOCK_OFF) { - nglcd->doStandbyTime = b; - nglcd->doStandby = false; - } else { - nglcd->doStandbyTime = false; - nglcd->doStandby = b; - } - if (b) { - nglcd->doScrollChannel = false; - nglcd->doScrollEpg = false; - } else { - nglcd->doScrollChannel = true; - nglcd->doScrollEpg = true; - } - nglcd->doMirrorOSD = false; - nglcd->UpdateBrightness(); - nglcd->Update(); - } -} - -void nGLCD::ShowVolume(bool b) { - if (nglcd) { - nglcd->doShowVolume = b; - nglcd->Update(); - } -} - -void nGLCD::MirrorOSD(bool b) { - if (nglcd) { - nglcd->doMirrorOSD = b; - nglcd->Update(); - } -} - -void nGLCD::Exit() { - if (nglcd) { - nglcd->doMirrorOSD = false; - nglcd->doSuspend = false; - nglcd->doExit = true; - nglcd->Update(); - void *res; - pthread_join(nglcd->thrGLCD, &res); - delete nglcd; - nglcd = NULL; - } -} - -void nGLCD::Rescan() { - doRescan = true; - Update(); -} - -void nGLCD::Suspend() { - if (nglcd) { - nglcd->doSuspend = true; - nglcd->Update(); - } -} - -void nGLCD::Resume() { - if (nglcd) { - nglcd->doSuspend = false; - nglcd->channelLocked = false; - nglcd->Update(); - } -} - -void nGLCD::lockChannel(std::string c, std::string e, int s) -{ - if(nglcd) { - nglcd->Lock(); - nglcd->channelLocked = true; - nglcd->stagingChannel = c; - nglcd->stagingEpg = e; - nglcd->Scale = s; - nglcd->Unlock(); - nglcd->Update(); - } -} - -void nGLCD::unlockChannel(void) -{ - if(nglcd) { - nglcd->channelLocked = false; - nglcd->Update(); - } -} - -bool nGLCD::showImage(fb_pixel_t *s, uint32_t sw, uint32_t sh, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp, bool maximize) -{ - int bb_x, bb_y, bb_w, bb_h; - - if (nglcd->getBoundingBox(s, sw, sh, bb_x, bb_y, bb_w, bb_h) && bb_w && bb_h) { - if (!maximize) { - if (bb_h * dw > bb_w * dh) { - uint32_t dw_new = dh * bb_w / bb_h; - dx += (dw - dw_new) >> 1; - dw = dw_new; - } else { - uint32_t dh_new = dw * bb_h / bb_w; - dy += (dh - dh_new) >> 1; - dh = dh_new; - } - } - for (u_int y = 0; y < dh; y++) { - for (u_int x = 0; x < dw; x++) { - uint32_t pix = *(s + (y * bb_h / dh + bb_y) * sw + x * bb_w / dw + bb_x); - if (!transp || pix) - nglcd->bitmap->DrawPixel(x + dx, y + dy, pix); - } - } - return true; - } - return false; -} - -bool nGLCD::showImage(const std::string & filename, uint32_t sw, uint32_t sh, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp, bool maximize) -{ - bool res = false; - if (!dw || !dh) - return res; - fb_pixel_t *s = g_PicViewer->getImage(filename, sw, sh); - if (s && sw && sh) - res = showImage(s, sw, sh, dx, dy, dw, dh, transp, maximize); - if (s) - free(s); - return res; -} - -bool nGLCD::showImage(uint64_t cid, std::string cname, uint32_t dx, uint32_t dy, uint32_t dw, uint32_t dh, bool transp, bool maximize) -{ - std::string logo; - int sw, sh; - - if (g_PicViewer->GetLogoName(cid, cname, logo, &sw, &sh)) { - return showImage(logo, (uint32_t) sw, (uint32_t) sh, dx, dy, dw, dh, transp, maximize); - } - return false; -} - -void nGLCD::UpdateBrightness() -{ - if (nglcd && nglcd->lcd) - nglcd->lcd->SetBrightness((unsigned int) (nglcd->doStandbyTime ? g_settings.glcd_brightness_standby : g_settings.glcd_brightness)); -} - -void nGLCD::SetBrightness(unsigned int b) -{ - if (nglcd) - nglcd->SetBrightness(b); -} - -void nGLCD::TogglePower() -{ - if (nglcd) - { - nglcd->power_state = 1 - nglcd->power_state; - if (nglcd->power_state) - nglcd->Resume(); - else - nglcd->Suspend(); - } -} - -void nGLCD::Blit() -{ - if (nglcd) - nglcd->blitFlag = true; -} - -int nGLCD::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t /* data */) -{ - if (msg == NeutrinoMessages::EVT_CURRENTNEXT_EPG) { - Update(); - return messages_return::handled; - } - - return messages_return::unhandled; -} - -int nGLCD::GetConfigSize() -{ - return (int) GLCD::Config.driverConfigs.size(); -} - -std::string nGLCD::GetConfigName(int driver) -{ - if ((driver < 0) || (driver > GetConfigSize() - 1)) - driver = 0; - return GLCD::Config.driverConfigs[driver].name; -} diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 82706d33e..3ea9dee02 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -310,6 +310,16 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel) CCamManager::getInstance()->Start(channel->getChannelID(), CCamManager::RECORD); //CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, true); +#ifdef ENABLE_GRAPHLCD + if (CRecordManager::getInstance()->GetRecordMode() == CRecordManager::RECMODE_REC) + cGLCD::lockIcon(cGLCD::REC); + else if (CRecordManager::getInstance()->GetRecordMode() == CRecordManager::RECMODE_TSHIFT) + cGLCD::lockIcon(cGLCD::TS); + else if (CRecordManager::getInstance()->GetRecordMode() == CRecordManager::RECMODE_REC_TSHIFT) { + cGLCD::lockIcon(cGLCD::REC); + cGLCD::lockIcon(cGLCD::TS); + } +#endif WaitRecMsg(msg_start_time, 2); hintBox.hide(); return RECORD_OK; @@ -356,6 +366,9 @@ bool CRecordInstance::Stop(bool remove_event) recording_id = 0; } //CVFD::getInstance()->ShowIcon(VFD_ICON_CAM1, false); +#ifdef ENABLE_GRAPHLCD + cGLCD::unlockIcon(cGLCD::REC); +#endif WaitRecMsg(end_time, 2); hintBox.hide(); return true; @@ -1119,7 +1132,7 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons recordingstatus = 1; #endif #ifdef ENABLE_GRAPHLCD - nGLCD::Update(); + cGLCD::Update(); #endif } else { delete inst; @@ -1326,7 +1339,7 @@ bool CRecordManager::Stop(const CTimerd::RecordingStopInfo * recinfo) StopInstance(inst, false); ret = true; #ifdef ENABLE_GRAPHLCD - nGLCD::Update(); + cGLCD::Update(); #endif } else { for(nextmap_iterator_t it = nextmap.begin(); it != nextmap.end(); it++) { diff --git a/src/driver/simpleclock.cpp b/src/driver/simpleclock.cpp new file mode 100644 index 000000000..d5685cde9 --- /dev/null +++ b/src/driver/simpleclock.cpp @@ -0,0 +1,74 @@ +/* + simple clock - DBoxII-Project + + Copyright (C) 2018 redblue + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include + +static bool fonts_initialized = false; + +GLCD::cFont font_time_standby; + +void InitSimpleClock(void) +{ + printf("[%s:%s] finish initialization\n", __file__, __func__); +} + +void SimpleClockUpdateFonts(void) +{ + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + int fontsize_time_standby = 0; + int percent_time_standby = std::min(t.glcd_size_simple_clock, 100); + int fontsize_time_standby_new = percent_time_standby * cglcd->lcd->Height() / 100; + if (!fonts_initialized || (fontsize_time_standby_new != fontsize_time_standby)) { + fontsize_time_standby = fontsize_time_standby_new; + if (!font_time_standby.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby)) { + t.glcd_font = FONTDIR "/neutrino.ttf"; + font_time_standby.LoadFT2(t.glcd_font, "UTF-8", fontsize_time_standby); + } + } + fonts_initialized = true; +} + +void RenderSimpleClock(std::string Time, int x, int y) +{ + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + SimpleClockUpdateFonts(); + cglcd->bitmap->DrawText(std::max(2,(cglcd->bitmap->Width() - 4 - font_time_standby.Width(Time))/2), + y, cglcd->bitmap->Width() - 1, Time, + &font_time_standby, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent); +} + +void ShowSimpleClock(std::string Time) +{ + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + int y = g_settings.glcd_standby_weather ? t.glcd_simple_clock_y_position : (cglcd->bitmap->Height() - font_time_standby.Height(Time)) / 2; + RenderSimpleClock(Time, 255, y); +} diff --git a/src/driver/simpleclock.h b/src/driver/simpleclock.h new file mode 100644 index 000000000..0767d5cf0 --- /dev/null +++ b/src/driver/simpleclock.h @@ -0,0 +1,34 @@ +/* + LCD-Daemon - DBoxII-Project + + Copyright (C) 2001 Steffen Hehn 'McClean' + Homepage: http://dbox.cyberphoria.org/ + + + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include +#pragma GCC diagnostic warning "-Wunused-parameter" +#include "glcd.h" + +void InitSimpleClock(); +void SimpleClockUpdateFonts(); +void RenderSimpleClock(std::string Time, int x, int y); +void ShowSimpleClock(std::string Time); diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index 225ae2282..e6c1def00 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -174,7 +174,7 @@ void CVolume::setVolume(const neutrino_msg_t key) } g_settings.current_volume = v; #ifdef ENABLE_GRAPHLCD - nGLCD::ShowVolume(true); + cGLCD::ShowVolume(true); #endif } } @@ -211,7 +211,7 @@ void CVolume::setVolume(const neutrino_msg_t key) } while (msg != CRCInput::RC_timeout); #ifdef ENABLE_GRAPHLCD - nGLCD::ShowVolume(false); + cGLCD::ShowVolume(false); #endif hideVolscale(); } diff --git a/src/driver/weather.cpp b/src/driver/weather.cpp new file mode 100644 index 000000000..47555f6e5 --- /dev/null +++ b/src/driver/weather.cpp @@ -0,0 +1,270 @@ +/* + weather - DBoxII-Project + + Copyright (C) 2018 redblue + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +#include +#include +#include +#include +#include + +enum weathers +{ + CLEAR_DAY = 0, + CLEAR_NIGHT = 1, + CLOUDY = 2, + FOG = 3, + PARTLY_CLOUDY_DAY = 4, + PARTLY_CLOUDY_NIGHT = 5, + RAIN = 6, + SLEET = 7, + SNOW = 8, + WIND = 9, + //WEATHER_UNKNOWN = 10 +}; + +const char * const weather_name[LCD_NUMBER_OF_WEATHERS] = +{ + "clear-day", + "clear-night", + "cloudy", + "fog", + "partly-cloudy-day", + "partly-cloudy-night", + "rain", + "sleet", + "snow", + "wind", + //"unknown" +}; + +#define NUMBER_OF_PATHS 2 +const char * const weather_path[NUMBER_OF_PATHS] = +{ + LCDDIR_VAR "/oled/weather/", + DATADIR "/oled/weather/" +}; + +static bool ForceUpdate = true; +static bool fonts_initialized = false; + +GLCD::cFont font_temperature; + +static std::string weather[LCD_NUMBER_OF_WEATHERS] = {""}; + +static std::string st_current_wcity = ""; +static std::string st_current_wtimestamp = ""; +static std::string st_current_wtemp = ""; +static std::string st_current_wwind = ""; +static std::string st_current_wicon = ""; + +static std::string st_next_wcity = ""; +static std::string st_next_wtimestamp = ""; +static std::string st_next_wtemp = ""; +static std::string st_next_wwind = ""; +static std::string st_next_wicon = ""; + +void InitWeather(void) +{ + for (int i = 0; i < LCD_NUMBER_OF_WEATHERS; i++) + { + std::string weather_file; + for (int j = 0; j < NUMBER_OF_PATHS; j++) + { + std::string file_jpg = weather_path[j]; + file_jpg += weather_name[i]; + file_jpg += ".jpg"; + if (file_exists(file_jpg.c_str())) + { + weather_file = file_jpg; + goto found; + } + std::string file_jpeg = weather_path[j]; + file_jpeg += weather_name[i]; + file_jpeg += ".jpeg"; + if (file_exists(file_jpeg.c_str())) + { + weather_file = file_jpeg; + goto found; + } + std::string file_png = weather_path[j]; + file_png += weather_name[i]; + file_png += ".png"; + if (file_exists(file_png.c_str())) + { + weather_file = file_png; + goto found; + } + std::string file_bmp = weather_path[j]; + file_bmp += weather_name[i]; + file_bmp += ".bmp"; + if (file_exists(file_bmp.c_str())) + { + weather_file = file_bmp; + goto found; + } + std::string file_gif = weather_path[j]; + file_gif += weather_name[i]; + file_gif += ".gif"; + if (file_exists(file_gif.c_str())) + { + weather_file = file_gif; + goto found; + } + } +found: + printf("[%s:%s] found file: %s\n", __file__, __func__, weather_file.c_str()); + weather[i] += std::string(weather_file); + } + printf("[%s:%s] finish initialization\n", __file__, __func__); +} + +void WeatherUpdateFonts(void) +{ + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + int fontsize_temperature = 0; + int percent_temperature = std::min(24, 100); + int fontsize_temperature_new = percent_temperature * cglcd->lcd->Height() / 100; + if (!fonts_initialized || (fontsize_temperature_new != fontsize_temperature)) { + fontsize_temperature = fontsize_temperature_new; + if (!font_temperature.LoadFT2(/*t.glcd_font*/FONTDIR "/pakenham.ttf", "UTF-8", fontsize_temperature)) { + t.glcd_font = FONTDIR "/pakenham.ttf"; + font_temperature.LoadFT2(t.glcd_font, "UTF-8", fontsize_temperature); + } + } + fonts_initialized = true; +} + +int WeatherNameToNumber(std::string name) +{ + std::map weather_name + { + { "clear-day", 0 }, + { "clear-night", 1 }, + { "cloudy", 2 }, + { "fog", 3 }, + { "partly-cloudy-day", 4 }, + { "partly-cloudy-night", 5 }, + { "rain", 6 }, + { "sleet", 7 }, + { "snow", 8 }, + { "wind", 9 }, + //{ "unknown", 10 }, + }; + + const auto iter = weather_name.find(name); + + if (iter != weather_name.cend()) + return iter->second; +} + +void RenderWeather(int cx, int cy, int nx, int ny, bool standby) +{ + int forecast = 0; + + std::string current_wcity = ""; + std::string current_wtimestamp = ""; + std::string current_wtemp = ""; + std::string current_wwind = ""; + std::string current_wicon = ""; + + std::string next_wcity = ""; + std::string next_wtimestamp = ""; + std::string next_wtemp = ""; + std::string next_wwind = ""; + std::string next_wicon = ""; + + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + if (g_settings.weather_enabled) + { + if (CWeather::getInstance()->checkUpdate(ForceUpdate)) + { + current_wcity = st_current_wcity = CWeather::getInstance()->getCity(); + current_wtimestamp = st_current_wtimestamp = to_string((int)CWeather::getInstance()->getCurrentTimestamp()); + current_wtemp = st_current_wtemp = CWeather::getInstance()->getCurrentTemperature(); + current_wwind = st_current_wwind = CWeather::getInstance()->getCurrentWindSpeed(); + current_wicon = st_current_wicon = CWeather::getInstance()->getCurrentIconOnlyName(); + + next_wcity = st_next_wcity = CWeather::getInstance()->getCity(); + next_wtimestamp = st_next_wtimestamp = to_string((int)CWeather::getInstance()->getForecastWeekday(forecast)); + next_wtemp = st_next_wtemp = CWeather::getInstance()->getForecastTemperatureMin(forecast); + next_wtemp = st_next_wtemp += "|" + CWeather::getInstance()->getForecastTemperatureMax(forecast); + next_wwind = st_next_wwind = CWeather::getInstance()->getForecastWindBearing(forecast); + next_wicon = st_next_wicon = CWeather::getInstance()->getForecastIconOnlyNane(forecast); + } + else + { + current_wcity = st_current_wcity; + current_wtimestamp = st_current_wtimestamp; + current_wtemp = st_current_wtemp; + current_wwind = st_current_wwind; + current_wicon = st_current_wicon; + + next_wcity = st_next_wcity; + next_wtimestamp = st_next_wtimestamp; + next_wtemp = st_next_wtemp; + next_wwind = st_next_wwind; + next_wicon = st_next_wicon; + } + + if (current_wicon != "") { + if (!standby) + cglcd->imageShow(weather[WeatherNameToNumber(current_wicon)], cx, cy, 64, 64, false, false, false, false, false); + else + cglcd->imageShow(weather[WeatherNameToNumber(current_wicon)], cx, cy, 0, 0, false, false, false, false, false); + } + if (current_wtemp != "") { + current_wtemp += "°"; + WeatherUpdateFonts(); + cglcd->bitmap->DrawText(170, 240, cglcd->bitmap->Width() - 1, current_wtemp, + &font_temperature, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent); + } + if (next_wicon != "") { + if (!standby) + cglcd->imageShow(weather[WeatherNameToNumber(next_wicon)], nx, ny, 64, 64, false, false, false, false, false); + else + cglcd->imageShow(weather[WeatherNameToNumber(next_wicon)], nx, ny, 0, 0, false, false, false, false, false); + } + if (next_wtemp != "") { + next_wtemp += "°"; + WeatherUpdateFonts(); + cglcd->bitmap->DrawText(270, 240, cglcd->bitmap->Width() - 1, next_wtemp, + &font_temperature, cglcd->ColorConvert3to1(t.glcd_color_fg_red, t.glcd_color_fg_green, t.glcd_color_fg_blue), GLCD::cColor::Transparent); + } + } +} + +void ShowWeather(bool standby) +{ + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + + if (!standby) { + RenderWeather(t.glcd_weather_x_position_current, t.glcd_weather_y_position, t.glcd_weather_x_position_next, t.glcd_weather_y_position, standby); + } else { + RenderWeather(t.glcd_weather_x_position_current_standby, t.glcd_weather_y_position_standby, t.glcd_weather_x_position_next_standby, t.glcd_weather_y_position_standby, standby); + } + + if (ForceUpdate) + ForceUpdate = false; +} diff --git a/src/driver/weather.h b/src/driver/weather.h new file mode 100644 index 000000000..c1860f487 --- /dev/null +++ b/src/driver/weather.h @@ -0,0 +1,39 @@ +/* + LCD-Daemon - DBoxII-Project + + Copyright (C) 2001 Steffen Hehn 'McClean' + Homepage: http://dbox.cyberphoria.org/ + + + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#pragma GCC diagnostic ignored "-Wunused-parameter" +#include +#pragma GCC diagnostic warning "-Wunused-parameter" +#include "glcd.h" + +#define LCDDIR_VAR "/usr/share/tuxbox/neutrino/icons" + +#define LCD_NUMBER_OF_WEATHERS 10 + +void InitWeather(); +void WeatherUpdateFonts(); +int WeatherNameToNumber(std::string name); +void RenderWeather(int cx, int cy, int nx, int ny, bool standby); +void ShowWeather(bool standby); diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index ba754b3e2..8a71befb2 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -121,7 +121,8 @@ libneutrino_gui_a_SOURCES = \ if ENABLE_GRAPHLCD libneutrino_gui_a_SOURCES += \ - glcdsetup.cpp + glcdsetup.cpp \ + glcdthemes.cpp endif if BOXTYPE_COOL diff --git a/src/gui/audiomute.cpp b/src/gui/audiomute.cpp index 928410450..803da7024 100644 --- a/src/gui/audiomute.cpp +++ b/src/gui/audiomute.cpp @@ -63,6 +63,12 @@ void CAudioMute::AudioMute(int newValue, bool isEvent) bool doInit = newValue != (int) neutrino->isMuted(); CVFD::getInstance()->setMuted(newValue); +#ifdef ENABLE_GRAPHLCD + if (newValue) + cGLCD::lockIcon(cGLCD::MUTE); + else + cGLCD::unlockIcon(cGLCD::MUTE); +#endif neutrino->setCurrentMuted(newValue); #if HAVE_ARM_HARDWARE || HAVE_MIPS_HARDWARE if (g_settings.hdmi_cec_volume) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 0212e730c..048c858cb 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -313,6 +313,10 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey) printf("[audioplayer.cpp] wakeup_hdd(%s)\n", g_settings.network_nfs_audioplayerdir.c_str()); wakeup_hdd(g_settings.network_nfs_audioplayerdir.c_str(),true); +#ifdef ENABLE_GRAPHLCD + cGLCD::MirrorOSD(false); +#endif + exec_controlscript(AUDIOPLAYER_START_SCRIPT); int res = show(); @@ -334,6 +338,15 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey) CNeutrinoApp::getInstance()->StartSubtitles(); +#ifdef ENABLE_GRAPHLCD + cGLCD::MirrorOSD(g_settings.glcd_mirror_osd); + cGLCD::unlockChannel(); + cGLCD::unlockDuration(); + cGLCD::unlockStart(); + cGLCD::unlockEnd(); + cGLCD::ShowLcdIcon(false); +#endif + return res; } @@ -2372,6 +2385,27 @@ void CAudioPlayerGui::updateTimes(const bool force) } if ((updatePlayed || updateTotal) && m_curr_audiofile.FileType != CFile::STREAM_AUDIO && m_time_total != 0) { +#ifdef ENABLE_GRAPHLCD + //glcd_duration = to_string(m_time_played / (60 * 1000)) + "/" + to_string(m_time_total / (60 * 1000)); + glcd_duration = to_string(m_time_played/60) + ":" + to_string(m_time_played%60) + "/" + to_string(m_time_total/60) + ":" + to_string(m_time_total%60); + + time_t sTime = time(NULL); + sTime -= m_time_played; + tm_struct = localtime(&sTime); + start = to_string(tm_struct->tm_hour/10) + to_string(tm_struct->tm_hour%10) + ":" + to_string(tm_struct->tm_min/10) + to_string(tm_struct->tm_min%10); + + time_t eTime = time(NULL); + eTime += m_time_total - m_time_played; + tm_struct = localtime(&eTime); + end = to_string(tm_struct->tm_hour/10) + to_string(tm_struct->tm_hour%10) + ":" + to_string(tm_struct->tm_min/10) + to_string(tm_struct->tm_min%10); + + glcd_position = 100 * m_time_played / m_time_total; + + cGLCD::lockChannel(channel, epg, uint8_t(glcd_position)); + cGLCD::lockDuration(glcd_duration); + cGLCD::lockStart(start); + cGLCD::lockEnd(end); +#endif CVFD::getInstance()->showAudioProgress(uint8_t(100 * m_time_played / m_time_total)); } } @@ -2379,27 +2413,82 @@ void CAudioPlayerGui::updateTimes(const bool force) void CAudioPlayerGui::paintLCD() { +#ifdef ENABLE_GRAPHLCD + const CAudioMetaData meta = CAudioPlayer::getInstance()->getMetaData(); + if ( !meta.artist.empty() ) + epg = meta.artist; + if ( !meta.artist.empty() && !meta.title.empty() ) + epg = " - "; + if ( !meta.title.empty() ) + epg = meta.title; +#endif switch (m_state) { case CAudioPlayerGui::STOP: +#ifdef ENABLE_GRAPHLCD + if (m_inetmode) + channel = g_Locale->getText(LOCALE_INETRADIO_NAME); + else + channel = g_Locale->getText(LOCALE_AUDIOPLAYER_NAME); + + epg = g_Locale->getText(LOCALE_MPKEY_STOP); + + cGLCD::ShowLcdIcon(false); + cGLCD::lockChannel(channel, epg, 0); + cGLCD::lockDuration("00/00"); + cGLCD::lockStart("00:00"); + cGLCD::lockEnd("00:00"); +#endif CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_STOP); CVFD::getInstance()->showAudioProgress(0); break; case CAudioPlayerGui::PLAY: +#ifdef ENABLE_GRAPHLCD + channel = ""; + cGLCD::lockChannel(channel, epg, uint8_t(glcd_position)); + cGLCD::lockDuration(glcd_duration); + cGLCD::lockStart(start); + cGLCD::lockEnd(end); + cGLCD::ShowLcdIcon(true); +#endif CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_PLAY); CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title, m_curr_audiofile.MetaData.album); if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO && m_time_total != 0) CVFD::getInstance()->showAudioProgress(uint8_t(100 * m_time_played / m_time_total)); break; case CAudioPlayerGui::PAUSE: +#ifdef ENABLE_GRAPHLCD + channel = ""; + cGLCD::lockChannel(channel, epg, uint8_t(glcd_position)); + cGLCD::lockDuration(glcd_duration); + cGLCD::lockStart(start); + cGLCD::lockEnd(end); + cGLCD::ShowLcdIcon(true); +#endif CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_PAUSE); CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title, m_curr_audiofile.MetaData.album); break; case CAudioPlayerGui::FF: +#ifdef ENABLE_GRAPHLCD + channel = ""; + cGLCD::lockChannel(channel, epg, uint8_t(glcd_position)); + cGLCD::lockDuration(glcd_duration); + cGLCD::lockStart(start); + cGLCD::lockEnd(end); + cGLCD::ShowLcdIcon(true); +#endif CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_FF); CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title, m_curr_audiofile.MetaData.album); break; case CAudioPlayerGui::REV: +#ifdef ENABLE_GRAPHLCD + channel = ""; + cGLCD::lockChannel(channel, epg, uint8_t(glcd_position)); + cGLCD::lockDuration(glcd_duration); + cGLCD::lockStart(start); + cGLCD::lockEnd(end); + cGLCD::ShowLcdIcon(true); +#endif CVFD::getInstance()->showAudioPlayMode(CVFD::AUDIO_MODE_REV); CVFD::getInstance()->showAudioTrack(m_curr_audiofile.MetaData.artist, m_curr_audiofile.MetaData.title, m_curr_audiofile.MetaData.album); break; diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index d83ab6f0d..e1a02dcd3 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -114,6 +114,16 @@ class CAudioPlayerGui : public CMenuTarget bool m_streamripper_available; bool m_streamripper_active; +#if ENABLE_GRAPHLCD + struct tm *tm_struct; + int glcd_position; + std::string channel; + std::string epg; + std::string glcd_duration; + std::string start; + std::string end; +#endif + CAudioPlayList m_playlist; CAudioPlayList m_radiolist; CAudioPlayList m_filelist; diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 2e3d3c3db..8028c8c00 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -593,7 +593,7 @@ int CBouquetList::show(bool bShowChannelList) hide(); #ifdef ENABLE_GRAPHLCD - nGLCD::unlockChannel(); + cGLCD::unlockChannel(); #endif LCD4l->RemoveFile("/tmp/lcd/menu"); @@ -656,7 +656,7 @@ void CBouquetList::paintItem(int pos) CVFD::getInstance()->showMenuText(0, lname, -1, true); #ifdef ENABLE_GRAPHLCD if(g_settings.glcd_enable) - nGLCD::lockChannel(g_Locale->getText(LOCALE_BOUQUETLIST_HEAD), lname, 0); + cGLCD::lockChannel(g_Locale->getText(LOCALE_BOUQUETLIST_HEAD), lname, 0); #endif if(g_settings.lcd4l_support) LCD4l->CreateFile("/tmp/lcd/menu", lname, g_settings.lcd4l_convert); diff --git a/src/gui/cec_setup.cpp b/src/gui/cec_setup.cpp index 3a154ad88..048f55ca5 100644 --- a/src/gui/cec_setup.cpp +++ b/src/gui/cec_setup.cpp @@ -47,7 +47,15 @@ #include #include +#if HAVE_SH4_HARDWARE +#include +#include +#include +#include +#include +#else extern cVideo *videoDecoder; +#endif CCECSetup::CCECSetup() { @@ -76,21 +84,38 @@ int CCECSetup::exec(CMenuTarget* parent, const std::string &/*actionKey*/) } +#if HAVE_SH4_HARDWARE +#define VIDEOMENU_HDMI_CEC_STANDBY_OPTION_COUNT 3 +const CMenuOptionChooser::keyval VIDEOMENU_HDMI_CEC_STANDBY_OPTIONS[VIDEOMENU_HDMI_CEC_STANDBY_OPTION_COUNT] = +{ + { 0 , LOCALE_OPTIONS_OFF }, + { 1 , LOCALE_OPTIONS_ON }, + { 2 , LOCALE_VIDEOMENU_HDMI_CEC_STANDBY_NOT_TIMER } +}; +#else #define VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT 3 const CMenuOptionChooser::keyval VIDEOMENU_HDMI_CEC_MODE_OPTIONS[VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT] = { { VIDEO_HDMI_CEC_MODE_OFF , LOCALE_VIDEOMENU_HDMI_CEC_MODE_OFF }, { VIDEO_HDMI_CEC_MODE_TUNER , LOCALE_VIDEOMENU_HDMI_CEC_MODE_TUNER }, - { VIDEO_HDMI_CEC_MODE_RECORDER , LOCALE_VIDEOMENU_HDMI_CEC_MODE_RECORDER }, + { VIDEO_HDMI_CEC_MODE_RECORDER , LOCALE_VIDEOMENU_HDMI_CEC_MODE_RECORDER } }; +#endif int CCECSetup::showMenu() { //menue init - CMenuWidget *cec = new CMenuWidget(LOCALE_MISCSETTINGS_HEAD, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_CEC); + CMenuWidget *cec = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_CEC); cec->addIntroItems(LOCALE_VIDEOMENU_HDMI_CEC); //cec +#if HAVE_SH4_HARDWARE + CKernelOptions ko; + g_settings.hdmi_cec_mode = ko.isEnabled("cec"); + CMenuOptionChooser *cec_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_MODE, &g_settings.hdmi_cec_mode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this); + cec1 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_STANDBY, &g_settings.hdmi_cec_standby, VIDEOMENU_HDMI_CEC_STANDBY_OPTIONS, VIDEOMENU_HDMI_CEC_STANDBY_OPTION_COUNT, g_settings.hdmi_cec_mode != 0, this); + cec2 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_BROADCAST, &g_settings.hdmi_cec_broadcast, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF, this); +#else CMenuOptionChooser *cec_ch = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_MODE, &g_settings.hdmi_cec_mode, VIDEOMENU_HDMI_CEC_MODE_OPTIONS, VIDEOMENU_HDMI_CEC_MODE_OPTION_COUNT, true, this); cec_ch->setHint("", LOCALE_MENU_HINT_CEC_MODE); cec1 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_VIEW_ON, &g_settings.hdmi_cec_view_on, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF, this); @@ -100,10 +125,13 @@ int CCECSetup::showMenu() #if HAVE_ARM_HARDWARE || HAVE_MIPS_HARDWARE cec3 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_VOLUME, &g_settings.hdmi_cec_volume, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF, this); cec3->setHint("", LOCALE_MENU_HINT_CEC_VOLUME); +#endif #endif cec->addItem(cec_ch); +#if !HAVE_SH4_HARDWARE cec->addItem(GenericMenuSeparatorLine); +#endif //------------------------------------------------------- cec->addItem(cec1); cec->addItem(cec2); @@ -117,6 +145,32 @@ int CCECSetup::showMenu() return res; } +#if HAVE_SH4_HARDWARE +void CCECSetup::setCECSettings(bool b) +{ + printf("[neutrino CEC Settings] %s init CEC settings...\n", __FUNCTION__); + if (b) { + // wakeup + if (g_settings.hdmi_cec_mode && + ((g_settings.hdmi_cec_standby == 1) || + (g_settings.hdmi_cec_standby == 2 && !CNeutrinoApp::getInstance()->timer_wakeup))) { + int otp = ::open("/proc/stb/cec/onetouchplay", O_WRONLY); + if (otp > -1) { + write(otp, g_settings.hdmi_cec_broadcast ? "f\n" : "0\n", 2); + close(otp); + } + } + } else { + if (g_settings.hdmi_cec_mode && g_settings.hdmi_cec_standby) { + int otp = ::open("/proc/stb/cec/systemstandby", O_WRONLY); + if (otp > -1) { + write(otp, g_settings.hdmi_cec_broadcast ? "f\n" : "0\n", 2); + close(otp); + } + } + } +} +#else void CCECSetup::setCECSettings() { printf("[neutrino CEC Settings] %s init CEC settings...\n", __FUNCTION__); @@ -124,9 +178,21 @@ void CCECSetup::setCECSettings() videoDecoder->SetCECAutoView(g_settings.hdmi_cec_view_on == 1); videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)g_settings.hdmi_cec_mode); } +#endif bool CCECSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data*/) { +#if HAVE_SH4_HARDWARE + if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_MODE)) + { + printf("[neutrino CEC Settings] %s set CEC settings...\n", __FUNCTION__); + cec1->setActive(g_settings.hdmi_cec_mode != 0); + cec2->setActive(g_settings.hdmi_cec_mode != 0); + CKernelOptions ko; + ko.Enable("cec", g_settings.hdmi_cec_mode != 0); + g_settings.hdmi_cec_mode = ko.isEnabled("cec"); + } +#else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_MODE)) { @@ -146,6 +212,7 @@ bool CCECSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data*/ { videoDecoder->SetCECAutoView(g_settings.hdmi_cec_view_on == 1); } +#endif return false; } diff --git a/src/gui/cec_setup.h b/src/gui/cec_setup.h index c5aa3f1b5..4c41de252 100644 --- a/src/gui/cec_setup.h +++ b/src/gui/cec_setup.h @@ -46,7 +46,11 @@ class CCECSetup : public CMenuTarget, CChangeObserver public: CCECSetup(); ~CCECSetup(); +#if HAVE_SH4_HARDWARE + void setCECSettings(bool); +#else void setCECSettings(); +#endif int exec(CMenuTarget* parent, const std::string & actionKey); virtual bool changeNotify(const neutrino_locale_t OptionName, void * data); }; diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 03a84868c..c41be3b41 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -967,7 +967,7 @@ int CChannelList::show() editMode(false); #ifdef ENABLE_GRAPHLCD - nGLCD::unlockChannel(); + cGLCD::unlockChannel(); #endif LCD4l->RemoveFile("/tmp/lcd/menu"); @@ -2252,7 +2252,7 @@ void CChannelList::updateVfd() #ifdef ENABLE_GRAPHLCD if(g_settings.glcd_enable) - nGLCD::lockChannel(g_Locale->getText(LOCALE_BOUQUETLIST_HEAD), chan->getName().c_str(), 0); + cGLCD::lockChannel(g_Locale->getText(LOCALE_BOUQUETLIST_HEAD), chan->getName().c_str(), 0); #endif if (g_settings.lcd4l_support) LCD4l->CreateFile("/tmp/lcd/menu", chan->getName().c_str(), g_settings.lcd4l_convert); diff --git a/src/gui/glcdsetup.cpp b/src/gui/glcdsetup.cpp index 6f26075d3..a87ae7a3e 100644 --- a/src/gui/glcdsetup.cpp +++ b/src/gui/glcdsetup.cpp @@ -30,12 +30,34 @@ #include #include #include -#include +#include #include #include #include "glcdsetup.h" #include +#include +#include +#include "glcdthemes.h" +#define ONOFFSEC_OPTION_COUNT 6 +static const CMenuOptionChooser::keyval ONOFFSEC_OPTIONS[ONOFFSEC_OPTION_COUNT] = { + { 0, LOCALE_OPTIONS_OFF }, + { 1, LOCALE_OPTIONS_ON }, + { 2, LOCALE_GLCD_STANDBY_LED_CLOCK }, + { 3, LOCALE_GLCD_STANDBY_LCD_CLOCK }, + { 4, LOCALE_GLCD_STANDBY_DIGITAL_CLOCK }, + { 5, LOCALE_GLCD_STANDBY_ANALOG_CLOCK } +}; + +#define ONOFFPRI_OPTION_COUNT 4 +static const CMenuOptionChooser::keyval ONOFFPRI_OPTIONS[ONOFFPRI_OPTION_COUNT] = { + { 0, LOCALE_GLCD_ALIGN_NONE }, + { 1, LOCALE_GLCD_ALIGN_LEFT }, + { 2, LOCALE_GLCD_ALIGN_CENTER }, + { 3, LOCALE_GLCD_ALIGN_RIGHT }, +}; + +#if 0 #define KEY_GLCD_BLACK 0 #define KEY_GLCD_WHITE 1 #define KEY_GLCD_RED 2 @@ -120,6 +142,7 @@ int GLCD_Menu::color2index(uint32_t color) { uint32_t GLCD_Menu::index2color(int i) { return (i < GLCD_COLOR_OPTION_COUNT) ? colormap[i] : GLCD::cColor::ERRCOL; } +#endif GLCD_Menu::GLCD_Menu() { @@ -130,37 +153,57 @@ GLCD_Menu::GLCD_Menu() int GLCD_Menu::exec(CMenuTarget* parent, const std::string & actionKey) { int res = menu_return::RETURN_REPAINT; - nGLCD *nglcd = nGLCD::getInstance(); + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + if(parent) + parent->hide(); if(actionKey == "rescan") { - nglcd->Rescan(); + cglcd->Rescan(); return res; } +#if 0 if(actionKey == "select_driver") { if(parent) parent->hide(); GLCD_Menu_Select_Driver(); - nglcd->Exit(); + cglcd->Exit(); return menu_return::RETURN_EXIT; } +#endif if(actionKey == "select_font") { - if(parent) - parent->hide(); CFileBrowser fileBrowser; CFileFilter fileFilter; fileFilter.addFilter("ttf"); fileBrowser.Filter = &fileFilter; if (fileBrowser.exec(FONTDIR) == true) { - g_settings.glcd_font = fileBrowser.getSelectedFile()->Name; - nglcd->Rescan(); + t.glcd_font = fileBrowser.getSelectedFile()->Name; + cglcd->Rescan(); } return res; + } else if (actionKey == "theme_settings") { + GLCD_Theme_Settings(); + return res; + } else if (actionKey == "brightness_default") { + g_settings.glcd_brightness = GLCD_DEFAULT_BRIGHTNESS; + g_settings.glcd_brightness_standby = GLCD_DEFAULT_BRIGHTNESS_STANDBY; + g_settings.glcd_brightness_dim = GLCD_DEFAULT_BRIGHTNESS_DIM; + g_settings.glcd_brightness_dim_time = GLCD_DEFAULT_BRIGHTNESS_DIM_TIME; + cglcd->UpdateBrightness(); + return res; + } else if (actionKey == "brightness_settings") { + GLCD_Brightness_Settings(); + return res; + } else if (actionKey == "standby_settings") { + GLCD_Standby_Settings(); + return res; + } else if (actionKey == "position_settings") { + GLCD_Theme_Position_Settings(); + return res; + } else { + GLCD_Menu_Settings(); + return res; } - if (parent) - parent->hide(); - - GLCD_Menu_Settings(); - return res; } @@ -172,155 +215,307 @@ bool GLCD_Menu::changeNotify (const neutrino_locale_t OptionName, void *Data) { if (!Data) return false; - nGLCD *nglcd = nGLCD::getInstance(); + cGLCD *cglcd = cGLCD::getInstance(); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; switch(OptionName) { case LOCALE_GLCD_SELECT_FG: - g_settings.glcd_color_fg = GLCD_Menu::index2color(*((int *) Data)); - break; case LOCALE_GLCD_SELECT_BG: - g_settings.glcd_color_bg = GLCD_Menu::index2color(*((int *) Data)); - break; case LOCALE_GLCD_SELECT_BAR: - g_settings.glcd_color_bar = GLCD_Menu::index2color(*((int *) Data)); + cglcd->Update(); break; case LOCALE_GLCD_ENABLE: if (g_settings.glcd_enable) - nglcd->Resume(); + cglcd->Resume(); else - nglcd->Suspend(); + cglcd->Suspend(); return true; case LOCALE_GLCD_MIRROR_OSD: - nglcd->MirrorOSD(*((int *) Data)); + cglcd->MirrorOSD(*((int *) Data)); break; case LOCALE_GLCD_MIRROR_VIDEO: - nglcd->Update(); + cglcd->Update(); break; case LOCALE_GLCD_BRIGHTNESS: case LOCALE_GLCD_BRIGHTNESS_STANDBY: + case LOCALE_GLCD_BRIGHTNESS_DIM: + case LOCALE_GLCD_BRIGHTNESS_DIM_TIME: + cglcd->Update(); + break; + case LOCALE_GLCD_SHOW_PROGRESSBAR: + case LOCALE_GLCD_SHOW_DURATION: + case LOCALE_GLCD_SHOW_START: + case LOCALE_GLCD_SHOW_END: + case LOCALE_GLCD_SHOW_TIME: + case LOCALE_GLCD_SHOW_WEATHER: case LOCALE_GLCD_SHOW_LOGO: case LOCALE_GLCD_SIZE_BAR: + case LOCALE_GLCD_BAR_X_POSITION: + case LOCALE_GLCD_BAR_Y_POSITION: + case LOCALE_GLCD_BAR_WIDTH: case LOCALE_GLCD_SIZE_CHANNEL: + case LOCALE_GLCD_CHANNEL_X_POSITION: + case LOCALE_GLCD_CHANNEL_Y_POSITION: case LOCALE_GLCD_SIZE_EPG: + case LOCALE_GLCD_EPG_X_POSITION: + case LOCALE_GLCD_EPG_Y_POSITION: + case LOCALE_GLCD_SIZE_DURATION: + case LOCALE_GLCD_DURATION_X_POSITION: + case LOCALE_GLCD_DURATION_Y_POSITION: + case LOCALE_GLCD_SIZE_START: + case LOCALE_GLCD_START_X_POSITION: + case LOCALE_GLCD_START_Y_POSITION: + case LOCALE_GLCD_SIZE_END: + case LOCALE_GLCD_END_X_POSITION: + case LOCALE_GLCD_END_Y_POSITION: case LOCALE_GLCD_SIZE_LOGO: + case LOCALE_GLCD_LOGO_X_POSITION: + case LOCALE_GLCD_LOGO_Y_POSITION: case LOCALE_GLCD_SIZE_TIME: - case LOCALE_GLCD_SIZE_TIME_STANDBY: + case LOCALE_GLCD_TIME_X_POSITION: + case LOCALE_GLCD_TIME_Y_POSITION: case LOCALE_GLCD_TIME_IN_STANDBY: case LOCALE_GLCD_SCROLL_SPEED: + case LOCALE_GLCD_THEME_POSITION_SETTINGS: break; default: return false; } - if (((OptionName == LOCALE_GLCD_TIME_IN_STANDBY || OptionName == LOCALE_GLCD_BRIGHTNESS_STANDBY) && g_settings.glcd_percent_time_standby) || OptionName == LOCALE_GLCD_SIZE_TIME_STANDBY) - nglcd->StandbyMode(true); - else - nglcd->StandbyMode(false); - nglcd->Update(); + if (OptionName == LOCALE_GLCD_TIME_IN_STANDBY || OptionName == LOCALE_GLCD_BRIGHTNESS_STANDBY || OptionName == LOCALE_GLCD_STANDBY_LED_CLOCK || OptionName == LOCALE_GLCD_STANDBY_LCD_CLOCK + || OptionName == LOCALE_GLCD_STANDBY_DIGITAL_CLOCK || OptionName == LOCALE_GLCD_STANDBY_DIGITAL_CLOCK || OptionName == LOCALE_GLCD_STANDBY_ANALOG_CLOCK || OptionName == LOCALE_GLCD_STANDBY_WEATHER + || OptionName == LOCALE_GLCD_DIGITAL_CLOCK_Y_POSITION || OptionName == LOCALE_GLCD_SIZE_SIMPLE_CLOCK || OptionName == LOCALE_GLCD_SIMPLE_CLOCK_Y_POSITION) + cglcd->StandbyMode(true); + else + cglcd->StandbyMode(false); + + cglcd->Update(); return true; } -static const CMenuOptionChooser::keyval GLCD_CLOCK_OPTIONS[] = { - { nGLCD::CLOCK_OFF, LOCALE_OPTIONS_OFF }, - { nGLCD::CLOCK_DIGITAL_HM, LOCALE_GLCD_CLOCK_DIGITAL_HM }, -// { nGLCD::CLOCK_DIGITAL_HMS, LOCALE_GLCD_CLOCK_DIGITAL_HMS }, -// { nGLCD::CLOCK_ANALOG, LOCALE_GLCD_CLOCK_ANALOG } -}; -#define GLCD_CLOCK_OPTIONS_COUNT (sizeof(GLCD_CLOCK_OPTIONS)/sizeof(CMenuOptionChooser::keyval)) - void GLCD_Menu::GLCD_Menu_Settings() { - int color_bg = color2index(g_settings.glcd_color_bg); - int color_fg = color2index(g_settings.glcd_color_fg); - int color_bar = color2index(g_settings.glcd_color_bar); - CMenuWidget m(LOCALE_GLCD_HEAD, NEUTRINO_ICON_SETTINGS, width); m.addIntroItems(); m.setSelected(selected); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + sigc::slot0 slot_repaint = sigc::mem_fun(m, &CMenuWidget::paint); //we want to repaint after changed Option + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_ENABLE, &g_settings.glcd_enable, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); - - m.addItem(new CMenuForwarder(LOCALE_GLCD_DISPLAY, (nGLCD::getInstance()->GetConfigSize() > 1), - nGLCD::getInstance()->GetConfigName(g_settings.glcd_selected_config).c_str(), this, "select_driver")); int shortcut = 1; m.addItem(GenericMenuSeparatorLine); - m.addItem(new CMenuOptionChooser(LOCALE_GLCD_SELECT_FG, &color_fg, - GLCD_COLOR_OPTIONS, GLCD_COLOR_OPTION_COUNT, true, this, - CRCInput::convertDigitToKey(shortcut++), NULL, true)); - m.addItem(new CMenuOptionChooser(LOCALE_GLCD_SELECT_BG, &color_bg, - GLCD_COLOR_OPTIONS, GLCD_COLOR_OPTION_COUNT, true, this, - CRCInput::convertDigitToKey(shortcut++), NULL, true)); - m.addItem(new CMenuOptionChooser(LOCALE_GLCD_SELECT_BAR, &color_bar, - GLCD_COLOR_OPTIONS, GLCD_COLOR_OPTION_COUNT, true, this, + m.addItem(new CMenuForwarder(LOCALE_GLCD_THEME_SETTINGS, true, NULL, this, "theme_settings", CRCInput::convertDigitToKey(shortcut++))); - m.addItem(new CMenuForwarder(LOCALE_GLCD_FONT, true, g_settings.glcd_font, this, "select_font", - CRCInput::convertDigitToKey(shortcut++))); - m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_CHANNEL, - &g_settings.glcd_percent_channel, true, 0, 100, this)); - m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_EPG, - &g_settings.glcd_percent_epg, true, 0, 100, this)); - m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_BAR, - &g_settings.glcd_percent_bar, true, 0, 100, this)); - m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_TIME, - &g_settings.glcd_percent_time, true, 0, 100, this)); - m.addItem(new CMenuOptionChooser(LOCALE_GLCD_SHOW_LOGO, &g_settings.glcd_show_logo, - OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, - CRCInput::convertDigitToKey(shortcut++))); - m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_LOGO, - &g_settings.glcd_percent_logo, true, 0, 100, this)); - m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_BRIGHTNESS, - &g_settings.glcd_brightness, true, 0, 100, this)); m.addItem(GenericMenuSeparatorLine); - m.addItem(new CMenuOptionChooser(LOCALE_GLCD_TIME_IN_STANDBY, &g_settings.glcd_time_in_standby, - GLCD_CLOCK_OPTIONS, GLCD_CLOCK_OPTIONS_COUNT, true, this, + m.addItem(new CMenuForwarder(LOCALE_GLCD_BRIGHTNESS_SETTINGS, true, NULL, this, "brightness_settings", + CRCInput::convertDigitToKey(shortcut++))); + m.addItem(GenericMenuSeparatorLine); + m.addItem(new CMenuForwarder(LOCALE_GLCD_STANDBY_SETTINGS, true, NULL, this, "standby_settings", CRCInput::convertDigitToKey(shortcut++))); - m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_TIME_STANDBY, - &g_settings.glcd_percent_time_standby, true, 0, 100, this)); - m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_BRIGHTNESS_STANDBY, - &g_settings.glcd_brightness_standby, true, 0, 100, this)); m.addItem(GenericMenuSeparatorLine); m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SCROLL_SPEED, &g_settings.glcd_scroll_speed, true, 1, 63, this)); m.addItem(GenericMenuSeparatorLine); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_SHOW_LOGO, &g_settings.glcd_show_logo, + OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, + CRCInput::convertDigitToKey(shortcut++))); + m.addItem(GenericMenuSeparatorLine); m.addItem(new CMenuOptionChooser(LOCALE_GLCD_MIRROR_OSD, &g_settings.glcd_mirror_osd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::RC_green)); m.addItem(new CMenuOptionChooser(LOCALE_GLCD_MIRROR_VIDEO, &g_settings.glcd_mirror_video, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::RC_yellow)); m.addItem(GenericMenuSeparatorLine); - m.addItem(new CMenuForwarder(LOCALE_GLCD_RESTART, true, NULL, this, "rescan", CRCInput::RC_red)); + m.addItem(new CMenuForwarder(LOCALE_GLCD_RESTART, true, NULL, this, "rescan", CRCInput::RC_blue)); + m.exec(NULL, ""); selected = m.getSelected(); - nGLCD::getInstance()->StandbyMode(false); + cGLCD::getInstance()->StandbyMode(false); m.hide(); } -void GLCD_Menu::GLCD_Menu_Select_Driver() +void GLCD_Menu::GLCD_Standby_Settings() { - int select = 0; + CMenuWidget m(LOCALE_GLCD_STANDBY_SETTINGS, NEUTRINO_ICON_SETTINGS, width); + m.addIntroItems(); + m.setSelected(selected); - if (nGLCD::getInstance()->GetConfigSize() > 1) - { - CMenuWidget *m = new CMenuWidget(LOCALE_GLCD_HEAD, NEUTRINO_ICON_SETTINGS); - CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + sigc::slot0 slot_repaint = sigc::mem_fun(m, &CMenuWidget::paint); //we want to repaint after changed Option - // we don't show introitems, so we add a separator for a smoother view - m->addItem(GenericMenuSeparator); - - CMenuForwarder* mf; - for (int i = 0; i < nGLCD::getInstance()->GetConfigSize(); i++) - { - mf = new CMenuForwarder(nGLCD::getInstance()->GetConfigName(i), true, NULL, selector,to_string(i).c_str()); - m->addItem(mf); - } - - m->enableSaveScreen(); - m->exec(NULL, ""); - - if (!m->gotAction()) - return; - - delete selector; - m->hide(); + int shortcut = 1; + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_TIME_IN_STANDBY, &g_settings.glcd_time_in_standby, + ONOFFSEC_OPTIONS, ONOFFSEC_OPTION_COUNT, true, this, + CRCInput::convertDigitToKey(shortcut++))); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_STANDBY_WEATHER, &g_settings.glcd_standby_weather, + OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); + if (t.glcd_position_settings) { + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_DIGITAL_CLOCK_Y_POSITION, + &t.glcd_digital_clock_y_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_SIMPLE_CLOCK, + &t.glcd_size_simple_clock, true, 0, 100, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIMPLE_CLOCK_Y_POSITION, + &t.glcd_simple_clock_y_position, true, 0, 500, this)); } - g_settings.glcd_selected_config = select; + m.exec(NULL, ""); + selected = m.getSelected(); + cGLCD::getInstance()->StandbyMode(false); + m.hide(); +} + +void GLCD_Menu::GLCD_Brightness_Settings() +{ + CMenuWidget m(LOCALE_GLCD_BRIGHTNESS_SETTINGS, NEUTRINO_ICON_SETTINGS, width); + m.addIntroItems(); + m.setSelected(selected); + + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + sigc::slot0 slot_repaint = sigc::mem_fun(m, &CMenuWidget::paint); //we want to repaint after changed Option + + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_BRIGHTNESS, + &g_settings.glcd_brightness, true, 0, 10, this, CRCInput::RC_nokey, NULL, 0, 0, NONEXISTANT_LOCALE, true)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_BRIGHTNESS_STANDBY, + &g_settings.glcd_brightness_standby, true, 0, 10, this, CRCInput::RC_nokey, NULL, 0, 0, NONEXISTANT_LOCALE, true)); + m.addItem(GenericMenuSeparatorLine); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_BRIGHTNESS_DIM, + &g_settings.glcd_brightness_dim, true, 0, 10, this, CRCInput::RC_nokey, NULL, 0, 0, NONEXISTANT_LOCALE, true)); + CStringInput *dim_time = new CStringInput(LOCALE_GLCD_BRIGHTNESS_DIM_TIME, &g_settings.glcd_brightness_dim_time, 5, NONEXISTANT_LOCALE, NONEXISTANT_LOCALE,"0123456789 "); + m.addItem(new CMenuForwarder(LOCALE_GLCD_BRIGHTNESS_DIM_TIME, true, g_settings.glcd_brightness_dim_time, dim_time)); + + m.addItem(GenericMenuSeparatorLine); + m.addItem(new CMenuForwarder(LOCALE_OPTIONS_DEFAULT, true, NULL, this, "brightness_default", CRCInput::RC_nokey)); + + m.exec(NULL, ""); + selected = m.getSelected(); + cGLCD::getInstance()->StandbyMode(false); + m.hide(); +} + +void GLCD_Menu::GLCD_Theme_Settings() +{ + CMenuWidget m(LOCALE_GLCD_THEME_SETTINGS, NEUTRINO_ICON_SETTINGS, width); + m.addIntroItems(); + m.setSelected(selected); + + int shortcut = 1; + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + sigc::slot0 slot_repaint = sigc::mem_fun(m, &CMenuWidget::paint); //we want to repaint after changed Option + + m.addItem(new CMenuForwarder(LOCALE_GLCD_THEME, true, NULL, CGLCDThemes::getInstance(), NULL, CRCInput::convertDigitToKey(shortcut++))); + + m.addItem(new CMenuForwarder(LOCALE_GLCD_FONT, true, t.glcd_font, this, "select_font", + CRCInput::convertDigitToKey(shortcut++))); + + m.addItem(GenericMenuSeparatorLine); + CColorSetupNotifier *colorSetupNotifier = new CColorSetupNotifier(); + + CColorChooser* fg = new CColorChooser(LOCALE_GLCD_SELECT_FG, &t.glcd_color_fg_red, &t.glcd_color_fg_green, &t.glcd_color_fg_blue, NULL, colorSetupNotifier); + m.addItem(new CMenuDForwarder(LOCALE_GLCD_SELECT_FG, true, NULL, fg)); + + CColorChooser* bg = new CColorChooser(LOCALE_GLCD_SELECT_BG, &t.glcd_color_bg_red, &t.glcd_color_bg_green, &t.glcd_color_bg_blue, NULL, colorSetupNotifier); + m.addItem(new CMenuDForwarder(LOCALE_GLCD_SELECT_BG, true, NULL, bg)); + + CColorChooser* bar = new CColorChooser(LOCALE_GLCD_SELECT_BAR, &t.glcd_color_bar_red, &t.glcd_color_bar_green, &t.glcd_color_bar_blue, NULL, colorSetupNotifier); + m.addItem(new CMenuDForwarder(LOCALE_GLCD_SELECT_BAR, true, NULL, bar)); + + if (t.glcd_position_settings) + m.addItem(new CMenuForwarder(LOCALE_GLCD_POSITION_SETTINGS, true, NULL, this, "position_settings", + CRCInput::convertDigitToKey(shortcut++))); + + //delete colorSetupNotifier; + m.exec(NULL, ""); + selected = m.getSelected(); + cGLCD::getInstance()->StandbyMode(false); + m.hide(); +} + +void GLCD_Menu::GLCD_Theme_Position_Settings() +{ + CMenuWidget m(LOCALE_GLCD_THEME_POSITION_SETTINGS, NEUTRINO_ICON_SETTINGS, width); + m.addIntroItems(); + m.setSelected(selected); + + SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + sigc::slot0 slot_repaint = sigc::mem_fun(m, &CMenuWidget::paint); //we want to repaint after changed Option + + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_SHOW_PROGRESSBAR, &t.glcd_show_progressbar, + OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_SHOW_DURATION, &t.glcd_show_duration, + OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_SHOW_START, &t.glcd_show_start, + OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_SHOW_END, &t.glcd_show_end, + OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_SHOW_TIME, &t.glcd_show_time, + OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_SHOW_WEATHER, &t.glcd_show_weather, + OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this)); + m.addItem(GenericMenuSeparatorLine); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_CHANNEL, + &t.glcd_percent_channel, true, 0, 100, this)); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_ALIGN_CHANNEL, &t.glcd_align_channel, + ONOFFPRI_OPTIONS, ONOFFPRI_OPTION_COUNT, true, NULL)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_CHANNEL_X_POSITION, + &t.glcd_channel_x_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_CHANNEL_Y_POSITION, + &t.glcd_channel_y_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_EPG, + &t.glcd_percent_epg, true, 0, 100, this)); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_ALIGN_EPG, &t.glcd_align_epg, + ONOFFPRI_OPTIONS, ONOFFPRI_OPTION_COUNT, true, NULL)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_EPG_X_POSITION, + &t.glcd_epg_x_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_EPG_Y_POSITION, + &t.glcd_epg_y_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_DURATION, + &t.glcd_percent_duration, true, 0, 100, this)); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_ALIGN_DURATION, &t.glcd_align_duration, + ONOFFPRI_OPTIONS, ONOFFPRI_OPTION_COUNT, true, this, NULL)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_DURATION_X_POSITION, + &t.glcd_duration_x_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_DURATION_Y_POSITION, + &t.glcd_duration_y_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_START, + &t.glcd_percent_start, true, 0, 100, this)); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_ALIGN_START, &t.glcd_align_start, + ONOFFPRI_OPTIONS, ONOFFPRI_OPTION_COUNT, true, NULL)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_START_X_POSITION, + &t.glcd_start_x_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_START_Y_POSITION, + &t.glcd_start_y_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_END, + &t.glcd_percent_end, true, 0, 100, this)); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_ALIGN_END, &t.glcd_align_end, + ONOFFPRI_OPTIONS, ONOFFPRI_OPTION_COUNT, true, NULL)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_END_X_POSITION, + &t.glcd_end_x_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_END_Y_POSITION, + &t.glcd_end_y_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_TIME, + &t.glcd_percent_time, true, 0, 100, this)); + m.addItem(new CMenuOptionChooser(LOCALE_GLCD_ALIGN_TIME, &t.glcd_align_time, + ONOFFPRI_OPTIONS, ONOFFPRI_OPTION_COUNT, true, NULL)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_TIME_X_POSITION, + &t.glcd_time_x_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_TIME_Y_POSITION, + &t.glcd_time_y_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_BAR, + &t.glcd_percent_bar, true, 0, 100, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_BAR_X_POSITION, + &t.glcd_bar_x_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_BAR_Y_POSITION, + &t.glcd_bar_y_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_BAR_WIDTH, + &t.glcd_bar_width, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_SIZE_LOGO, + &t.glcd_percent_logo, true, 0, 100, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_LOGO_X_POSITION, + &t.glcd_logo_x_position, true, 0, 500, this)); + m.addItem(new CMenuOptionNumberChooser(LOCALE_GLCD_LOGO_Y_POSITION, + &t.glcd_logo_y_position, true, 0, 500, this)); + + m.exec(NULL, ""); + selected = m.getSelected(); + cGLCD::getInstance()->StandbyMode(false); + m.hide(); } diff --git a/src/gui/glcdsetup.h b/src/gui/glcdsetup.h index b9cb9c0ab..54a1994f9 100644 --- a/src/gui/glcdsetup.h +++ b/src/gui/glcdsetup.h @@ -28,22 +28,26 @@ #include #include #include -#include +#include +#include +#include class GLCD_Menu : public CMenuTarget, public CChangeObserver { private: int width; int selected; - static int color2index(uint32_t color); - void GLCD_Menu_Select_Driver(); + SNeutrinoGlcdTheme oldTheme; public: - static uint32_t index2color(int i); GLCD_Menu(); void hide(); int exec(CMenuTarget* parent, const std::string & actionKey); bool changeNotify(const neutrino_locale_t, void *); void GLCD_Menu_Settings(); + void GLCD_Standby_Settings(); + void GLCD_Brightness_Settings(); + void GLCD_Theme_Settings(); + void GLCD_Theme_Position_Settings(); }; #endif // __glcdsetup_h__ #endif // ENABLE_GRAPHLCD diff --git a/src/gui/glcdthemes.cpp b/src/gui/glcdthemes.cpp new file mode 100644 index 000000000..ffa30a2b7 --- /dev/null +++ b/src/gui/glcdthemes.cpp @@ -0,0 +1,474 @@ +/* + $port: themes.cpp,v 1.16 2010/09/05 21:27:44 tuxbox-cvs Exp $ + + Neutrino-GUI - DBoxII-Project + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + Copyright (C) 2007, 2008, 2009 (flasher) Frank Liebelt + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "widget/menue.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "glcdthemes.h" + +#define USERDIR "/var" THEMESDIR +#define FILE_SUFFIX ".otheme" + +static SNeutrinoGlcdTheme &t = g_settings.glcd_theme; + +CGLCDThemes::CGLCDThemes() +: themefile('\t') +{ + width = 40; + + hasThemeChanged = false; +} + +CGLCDThemes* CGLCDThemes::getInstance() +{ + static CGLCDThemes* th = NULL; + + if(!th) { + th = new CGLCDThemes(); + dprintf(DEBUG_DEBUG, "CGLCDThemes Instance created\n"); + } + return th; +} + +int CGLCDThemes::exec(CMenuTarget* parent, const std::string & actionKey) +{ + int res = menu_return::RETURN_REPAINT; + + if( !actionKey.empty() ) + { + if (actionKey=="default_theme") + { + if(!applyDefaultTheme()) + setupDefaultColors(); // fallback + changeNotify(NONEXISTANT_LOCALE, NULL); + } + else + { + std::string themeFile = actionKey; + if ( strstr(themeFile.c_str(), "{U}") != 0 ) + { + themeFile.erase(0, 3); + readFile(((std::string)THEMESDIR_VAR + "/" + themeFile + FILE_SUFFIX).c_str()); + } + else + readFile(((std::string)THEMESDIR + "/" + themeFile + FILE_SUFFIX).c_str()); + g_settings.glcd_theme_name = themeFile; + } + OnAfterSelectTheme(); + CFrameBuffer::getInstance()->clearIconCache(); + return res; + } + + + if (parent) + parent->hide(); + + if ( !hasThemeChanged ) + rememberOldTheme( true ); + + return Show(); +} + +void CGLCDThemes::initThemesMenu(CMenuWidget &themes) +{ + struct dirent **themelist; + int n; + const char *pfade[] = {THEMESDIR, THEMESDIR_VAR}; + bool hasCVSThemes, hasUserThemes; + hasCVSThemes = hasUserThemes = false; + std::string userThemeFile = ""; + CMenuForwarder* oj; + + // only to visualize if we have a migrated theme + if (g_settings.glcd_theme_name.empty() || g_settings.glcd_theme_name == MIGRATE_THEME_OLED_NAME) + { + themes.addItem(new CMenuSeparator(CMenuSeparator::LINE)); + themes.addItem(new CMenuForwarder(MIGRATE_THEME_OLED_NAME, false, "", this)); + } + + for(int p = 0;p < 2;p++) + { + n = scandir(pfade[p], &themelist, 0, alphasort); + if(n < 0) + perror("loading glcd themes: scandir"); + else + { + for(int count=0;countd_name; + char *pos = strstr(file, ".otheme"); + if(pos != NULL) + { + if ( p == 0 && hasCVSThemes == false ) { + themes.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORTHEMEMENU_SELECT2)); + hasCVSThemes = true; + } else if ( p == 1 && hasUserThemes == false ) { + themes.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_COLORTHEMEMENU_SELECT1)); + hasUserThemes = true; + } + *pos = '\0'; + if ( p == 1 ) { + userThemeFile = "{U}" + (std::string)file; + oj = new CMenuForwarder(file, true, "", this, userThemeFile.c_str()); + } else + oj = new CMenuForwarder(file, true, "", this, file); + + themes.addItem( oj ); + } + free(themelist[count]); + } + free(themelist); + } + } + + //on first paint exec this methode to set marker to item + markSelectedTheme(&themes); + + //for all next menu paints markers are setted with this slot inside exec() + if (OnAfterSelectTheme.empty()) + OnAfterSelectTheme.connect(sigc::bind(sigc::mem_fun(this, &CGLCDThemes::markSelectedTheme), &themes)); +} + +int CGLCDThemes::Show() +{ + move_userDir(); + + std::string file_name = ""; + + CMenuWidget themes (LOCALE_COLORMENU_MENUCOLORS, NEUTRINO_ICON_SETTINGS, width); + sigc::slot0 slot_repaint = sigc::mem_fun(themes, &CMenuWidget::hide); //we want to clean screen before repaint after changed Option + themes.OnBeforePaint.connect(slot_repaint); + + themes.addIntroItems(LOCALE_COLORTHEMEMENU_HEAD2); + + //set default theme + std::string default_theme = DEFAULT_OLED_THEME; + CMenuForwarder* fw = new CMenuForwarder(LOCALE_COLORTHEMEMENU_NEUTRINO_THEME, true, default_theme.c_str(), this, "default_theme", CRCInput::RC_red); + themes.addItem(fw); + fw->setHint("", LOCALE_COLORTHEMEMENU_NEUTRINO_THEME_HINT); + + initThemesMenu(themes); + + CKeyboardInput nameInput(LOCALE_COLORTHEMEMENU_NAME, &file_name); + CMenuForwarder *m1 = new CMenuForwarder(LOCALE_COLORTHEMEMENU_SAVE, true , NULL, &nameInput, NULL, CRCInput::RC_green); + + if (!CFileHelpers::createDir(THEMESDIR_VAR)) { + printf("[neutrino glcd theme] error creating %s\n", THEMESDIR_VAR); + } + + if (access(THEMESDIR_VAR, F_OK) == 0 ) { + themes.addItem(GenericMenuSeparatorLine); + themes.addItem(m1); + } else { + delete m1; + printf("[neutrino glcd theme] error accessing %s\n", THEMESDIR_VAR); + } + + int res = themes.exec(NULL, ""); + + if (!file_name.empty()) { + saveFile(((std::string)THEMESDIR_VAR + "/" + file_name + FILE_SUFFIX).c_str()); + } + + if (hasThemeChanged) { + if (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_COLORTHEMEMENU_QUESTION, CMsgBox::mbrYes, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_SETTINGS) != CMsgBox::mbrYes) + rememberOldTheme( false ); + else + hasThemeChanged = false; + } + return res; +} + +void CGLCDThemes::rememberOldTheme(bool remember) +{ + if ( remember ) { + oldTheme = t; + oldTheme_name = g_settings.glcd_theme_name; + } else { + t = oldTheme; + g_settings.glcd_theme_name = oldTheme_name; + + changeNotify(NONEXISTANT_LOCALE, NULL); + hasThemeChanged = false; + } +} + +void CGLCDThemes::readFile(const char *themename) +{ + if(themefile.loadConfig(themename)) + { + getTheme(themefile); + + changeNotify(NONEXISTANT_LOCALE, NULL); + hasThemeChanged = true; + } + else + printf("[neutrino glcd theme] %s not found\n", themename); +} + +void CGLCDThemes::saveFile(const char *themename) +{ + setTheme(themefile); + + if (themefile.getModifiedFlag()){ + printf("[neutrino glcd theme] save theme into %s\n", themename); + if (!themefile.saveConfig(themename)) + printf("[neutrino glcd theme] %s write error\n", themename); + } +} + +bool CGLCDThemes::applyDefaultTheme() +{ + g_settings.glcd_theme_name = DEFAULT_OLED_THEME; + std::string default_theme = THEMESDIR "/" + g_settings.glcd_theme_name + ".otheme"; + if(themefile.loadConfig(default_theme)){ + getTheme(themefile); + return true; + } + dprintf(DEBUG_NORMAL, "[CGLCDThemes]\t[%s - %d], No default theme found, creating migrated theme from current theme settings\n", __func__, __LINE__); + return false; +} + +// setup default Colors +void CGLCDThemes::setupDefaultColors() +{ + CConfigFile empty(':'); + getTheme(empty); +} + +void CGLCDThemes::setTheme(CConfigFile &configfile) +{ + configfile.setInt32("glcd_color_fg_red", t.glcd_color_fg_red); + configfile.setInt32("glcd_color_fg_green", t.glcd_color_fg_green); + configfile.setInt32("glcd_color_fg_blue", t.glcd_color_fg_blue); + configfile.setInt32("glcd_color_bg_red", t.glcd_color_bg_red); + configfile.setInt32("glcd_color_bg_green", t.glcd_color_bg_green); + configfile.setInt32("glcd_color_bg_blue", t.glcd_color_bg_blue); + configfile.setInt32("glcd_color_bar_red", t.glcd_color_bar_red); + configfile.setInt32("glcd_color_bar_green", t.glcd_color_bar_green); + configfile.setInt32("glcd_color_bar_blue", t.glcd_color_bar_blue); + configfile.setString("glcd_font", t.glcd_font); + configfile.setString("glcd_background", t.glcd_background); + configfile.setBool("glcd_show_progressbar", t.glcd_show_progressbar); + configfile.setBool("glcd_show_duration", t.glcd_show_duration); + configfile.setBool("glcd_show_start", t.glcd_show_start); + configfile.setBool("glcd_show_end", t.glcd_show_end); + configfile.setBool("glcd_show_time", t.glcd_show_time); + configfile.setBool("glcd_show_weather", t.glcd_show_weather); + configfile.setInt32("glcd_align_channel", t.glcd_align_channel); + configfile.setInt32("glcd_align_epg", t.glcd_align_epg); + configfile.setInt32("glcd_align_duration", t.glcd_align_duration); + configfile.setInt32("glcd_align_start", t.glcd_align_start); + configfile.setInt32("glcd_align_end", t.glcd_align_end); + configfile.setInt32("glcd_align_time", t.glcd_align_time); + configfile.setInt32("glcd_percent_channel", t.glcd_percent_channel); + configfile.setInt32("glcd_channel_x_position", t.glcd_channel_x_position); + configfile.setInt32("glcd_channel_y_position", t.glcd_channel_y_position); + configfile.setInt32("glcd_percent_epg", t.glcd_percent_epg); + configfile.setInt32("glcd_epg_x_position", t.glcd_epg_x_position); + configfile.setInt32("glcd_epg_y_position", t.glcd_epg_y_position); + configfile.setInt32("glcd_percent_duration", t.glcd_percent_duration); + configfile.setInt32("glcd_duration_x_position", t.glcd_duration_x_position); + configfile.setInt32("glcd_duration_y_position", t.glcd_duration_y_position); + configfile.setInt32("glcd_percent_start", t.glcd_percent_start); + configfile.setInt32("glcd_start_x_position", t.glcd_start_x_position); + configfile.setInt32("glcd_start_y_position", t.glcd_start_y_position); + configfile.setInt32("glcd_percent_end", t.glcd_percent_end); + configfile.setInt32("glcd_end_x_position", t.glcd_end_x_position); + configfile.setInt32("glcd_end_y_position", t.glcd_end_y_position); + configfile.setInt32("glcd_percent_time", t.glcd_percent_time); + configfile.setInt32("glcd_time_x_position", t.glcd_time_x_position); + configfile.setInt32("glcd_time_y_position", t.glcd_time_y_position); + configfile.setInt32("glcd_percent_bar", t.glcd_percent_bar); + configfile.setInt32("glcd_bar_x_position", t.glcd_bar_x_position); + configfile.setInt32("glcd_bar_y_position", t.glcd_bar_y_position); + configfile.setInt32("glcd_bar_width", t.glcd_bar_width); + configfile.setInt32("glcd_percent_logo", t.glcd_percent_logo); + configfile.setInt32("glcd_logo_x_position", t.glcd_logo_x_position); + configfile.setInt32("glcd_logo_y_position", t.glcd_logo_y_position); + configfile.setInt32("glcd_percent_smalltext", t.glcd_percent_smalltext); + configfile.setInt32("glcd_smalltext_y_position", t.glcd_smalltext_y_position); + configfile.setInt32("glcd_rec_icon_x_position", t.glcd_rec_icon_x_position); + configfile.setInt32("glcd_mute_icon_x_position", t.glcd_mute_icon_x_position); + configfile.setInt32("glcd_ts_icon_x_position", t.glcd_ts_icon_x_position); + configfile.setInt32("glcd_timer_icon_x_position", t.glcd_timer_icon_x_position); + configfile.setInt32("glcd_ecm_icon_x_position", t.glcd_ecm_icon_x_position); + configfile.setInt32("glcd_dd_icon_x_position", t.glcd_dd_icon_x_position); + configfile.setInt32("glcd_txt_icon_x_position", t.glcd_txt_icon_x_position); + configfile.setInt32("glcd_cam_icon_x_position", t.glcd_cam_icon_x_position); + configfile.setInt32("glcd_digital_clock_y_position", t.glcd_digital_clock_y_position); + configfile.setInt32("glcd_size_simple_clock", t.glcd_size_simple_clock); + configfile.setInt32("glcd_simple_clock_y_position", t.glcd_simple_clock_y_position); + configfile.setInt32("glcd_weather_x_position_current", t.glcd_weather_x_position_current); + configfile.setInt32("glcd_weather_x_position_next", t.glcd_weather_x_position_next); + configfile.setInt32("glcd_weather_y_position", t.glcd_weather_y_position); + configfile.setInt32("glcd_weather_x_position_current_standby", t.glcd_weather_x_position_current_standby); + configfile.setInt32("glcd_weather_x_position_next_standby", t.glcd_weather_x_position_next_standby); + configfile.setInt32("glcd_weather_y_position_standby", t.glcd_weather_y_position_standby); + configfile.setInt32("glcd_position_settings", t.glcd_position_settings); +} + +void CGLCDThemes::getTheme(CConfigFile &configfile) +{ + t.glcd_color_fg_red = configfile.getInt32("glcd_color_fg_red", 0x00); + t.glcd_color_fg_green = configfile.getInt32("glcd_color_fg_green", 0x00); + t.glcd_color_fg_blue = configfile.getInt32("glcd_color_fg_blue", 0x00); + t.glcd_color_bg_red = configfile.getInt32("glcd_color_bg_red", 0x00); + t.glcd_color_bg_green = configfile.getInt32("glcd_color_bg_green", 0x00); + t.glcd_color_bg_blue = configfile.getInt32("glcd_color_bg_blue", 0x00); + t.glcd_color_bar_red = configfile.getInt32("glcd_color_bar_red", 0x00); + t.glcd_color_bar_green = configfile.getInt32("glcd_color_bar_green", 0x00); + t.glcd_color_bar_blue = configfile.getInt32("glcd_color_bar_blue", 0x00); + t.glcd_font = configfile.getString("glcd_font", ""); + t.glcd_background = configfile.getString("glcd_background", ""); + t.glcd_show_progressbar = configfile.getBool("glcd_show_progressbar", false); + t.glcd_show_duration = configfile.getBool("glcd_show_duration", false); + t.glcd_show_start = configfile.getBool("glcd_show_start", false); + t.glcd_show_end = configfile.getBool("glcd_show_end", false); + t.glcd_show_time = configfile.getBool("glcd_show_time", false); + t.glcd_show_weather = configfile.getBool("glcd_show_weather", false); + t.glcd_align_channel = configfile.getInt32("glcd_align_channel", 0); + t.glcd_align_epg = configfile.getInt32("glcd_align_epg", 0); + t.glcd_align_duration = configfile.getInt32("glcd_align_duration", 0); + t.glcd_align_start = configfile.getInt32("glcd_align_start", 0); + t.glcd_align_end = configfile.getInt32("glcd_align_end", 0); + t.glcd_align_time = configfile.getInt32("glcd_align_time", 0); + t.glcd_percent_channel = configfile.getInt32("glcd_percent_channel", 0); + t.glcd_channel_x_position = configfile.getInt32("glcd_channel_x_position", 0); + t.glcd_channel_y_position = configfile.getInt32("glcd_channel_y_position", 0); + t.glcd_percent_epg = configfile.getInt32("glcd_percent_epg", 0); + t.glcd_epg_x_position = configfile.getInt32("glcd_epg_x_position", 0); + t.glcd_epg_y_position = configfile.getInt32("glcd_epg_y_position", 0); + t.glcd_percent_duration = configfile.getInt32("glcd_percent_duration", 0); + t.glcd_duration_x_position = configfile.getInt32("glcd_duration_x_position", 0); + t.glcd_duration_y_position = configfile.getInt32("glcd_duration_y_position", 0); + t.glcd_percent_start = configfile.getInt32("glcd_percent_start", 0); + t.glcd_start_x_position = configfile.getInt32("glcd_start_x_position", 0); + t.glcd_start_y_position = configfile.getInt32("glcd_start_y_position", 0); + t.glcd_percent_end = configfile.getInt32("glcd_percent_end", 0); + t.glcd_end_x_position = configfile.getInt32("glcd_end_x_position", 0); + t.glcd_end_y_position = configfile.getInt32("glcd_end_y_position", 0); + t.glcd_percent_time = configfile.getInt32("glcd_percent_time", 0); + t.glcd_time_x_position = configfile.getInt32("glcd_time_x_position", 0); + t.glcd_time_y_position = configfile.getInt32("glcd_time_y_position", 0); + t.glcd_percent_bar = configfile.getInt32("glcd_percent_bar", 0); + t.glcd_bar_x_position = configfile.getInt32("glcd_bar_x_position", 0); + t.glcd_bar_y_position = configfile.getInt32("glcd_bar_y_position", 0); + t.glcd_bar_width = configfile.getInt32("glcd_bar_width", 0); + t.glcd_percent_logo = configfile.getInt32("glcd_percent_logo", 0); + t.glcd_logo_x_position = configfile.getInt32("glcd_logo_x_position", 0); + t.glcd_logo_y_position = configfile.getInt32("glcd_logo_y_position", 0); + t.glcd_percent_smalltext = configfile.getInt32("glcd_percent_smalltext", 0); + t.glcd_smalltext_y_position = configfile.getInt32("glcd_smalltext_y_position", 0); + t.glcd_rec_icon_x_position = configfile.getInt32("glcd_rec_icon_x_position", 0); + t.glcd_mute_icon_x_position = configfile.getInt32("glcd_mute_icon_x_position", 0); + t.glcd_ts_icon_x_position = configfile.getInt32("glcd_ts_icon_x_position", 0); + t.glcd_timer_icon_x_position = configfile.getInt32("glcd_timer_icon_x_position", 0); + t.glcd_ecm_icon_x_position = configfile.getInt32("glcd_ecm_icon_x_position", 0); + t.glcd_dd_icon_x_position = configfile.getInt32("glcd_dd_icon_x_position", 0); + t.glcd_txt_icon_x_position = configfile.getInt32("glcd_txt_icon_x_position", 0); + t.glcd_cam_icon_x_position = configfile.getInt32("glcd_cam_icon_x_position", 0); + t.glcd_digital_clock_y_position = configfile.getInt32("glcd_digital_clock_y_position", 0); + t.glcd_size_simple_clock = configfile.getInt32("glcd_size_simple_clock", 0); + t.glcd_simple_clock_y_position = configfile.getInt32("glcd_simple_clock_y_position", 0); + t.glcd_weather_x_position_current = configfile.getInt32("glcd_weather_x_position_current", 0); + t.glcd_weather_x_position_next = configfile.getInt32("glcd_weather_x_position_next", 0); + t.glcd_weather_y_position = configfile.getInt32("glcd_weather_y_position", 0); + t.glcd_weather_x_position_current_standby = configfile.getInt32("glcd_weather_x_position_current_standby", 0); + t.glcd_weather_x_position_next_standby = configfile.getInt32("glcd_weather_x_position_next_standby", 0); + t.glcd_weather_y_position_standby = configfile.getInt32("glcd_weather_y_position_standby", 0); + t.glcd_position_settings = configfile.getInt32("glcd_position_settings", 0); + + if (g_settings.glcd_theme_name.empty()) + applyDefaultTheme(); +} + +void CGLCDThemes::move_userDir() +{ + if (access(USERDIR, F_OK) == 0) + { + if (!CFileHelpers::createDir(THEMESDIR_VAR)) + { + printf("[neutrino glcd theme] error creating %s\n", THEMESDIR_VAR); + return; + } + struct dirent **themelist; + int n = scandir(USERDIR, &themelist, 0, alphasort); + if (n < 0) + { + perror("loading glcd themes: scandir"); + return; + } + else + { + for (int count = 0; count < n; count++) + { + const char *file = themelist[count]->d_name; + if (strcmp(file, ".") == 0 || strcmp(file, "..") == 0) + continue; + const char *dest = ((std::string)USERDIR + "/" + file).c_str(); + const char *target = ((std::string)THEMESDIR_VAR + "/" + file).c_str(); + printf("[neutrino gcdl theme] moving %s to %s\n", dest, target); + rename(dest, target); + free(themelist[count]); + } + free(themelist); + } + printf("[neutrino gcld theme] removing %s\n", USERDIR); + remove(USERDIR); + } +} + +void CGLCDThemes::markSelectedTheme(CMenuWidget *w) +{ + for (int i = 0; i < w->getItemsCount(); i++){ + w->getItem(i)->setInfoIconRight(NULL); + if (g_settings.glcd_theme_name == w->getItem(i)->getName()) + w->getItem(i)->setInfoIconRight(NEUTRINO_ICON_MARKER_DIALOG_OK); + } +} diff --git a/src/gui/glcdthemes.h b/src/gui/glcdthemes.h new file mode 100644 index 000000000..f1421b7ff --- /dev/null +++ b/src/gui/glcdthemes.h @@ -0,0 +1,66 @@ +/* + $port: themes.h,v 1.6 2010/06/01 19:58:38 tuxbox-cvs Exp $ + + Neutrino-GUI - DBoxII-Project + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + Copyright (C) 2007, 2008, 2009 (flasher) Frank Liebelt +*/ + +#ifndef __cglcdthemes__ +#define __cglcdthemes__ +#include +#include +#include +#include +#include + +#define MIGRATE_THEME_OLED_NAME "Unknown-Migrated-Oled-Theme" + +class CGLCDThemes : public CMenuTarget, CColorSetupNotifier, public sigc::trackable +{ + private: + CConfigFile themefile; + + int width; + SNeutrinoGlcdTheme oldTheme; + std::string oldTheme_name; + + bool hasThemeChanged; + + int Show(); + void readFile(const char *themename); + void saveFile(const char *themename); + void initThemesMenu(CMenuWidget &); + void rememberOldTheme(bool remember); + void move_userDir(); + bool applyDefaultTheme(); + ///signal after select theme is completed + sigc::signal OnAfterSelectTheme; + void markSelectedTheme(CMenuWidget *w); + + public: + CGLCDThemes(); + static CGLCDThemes* getInstance(); + void setupDefaultColors(); + int exec(CMenuTarget* parent, const std::string & actionKey); + void setTheme(CConfigFile &configfile); + void getTheme(CConfigFile &configfile); +}; + +#endif diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 7450feae6..820eb9641 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -1546,12 +1546,20 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) showLcdPercentOver (); eventname = info_CurrentNext.current_name; CVFD::getInstance()->setEPGTitle(eventname); +#ifdef ENABLE_GRAPHLCD + if (g_settings.glcd_enable) + cGLCD::lockChannel("", eventname, 0); +#endif return messages_return::handled; } else if (msg == NeutrinoMessages::EVT_ZAP_SUB_FAILED) { //chanready = 1; showSNR (); // show failure..! CVFD::getInstance ()->showServicename ("(" + g_RemoteControl->getCurrentChannelName () + ')', g_RemoteControl->getCurrentChannelNumber()); +#ifdef ENABLE_GRAPHLCD + if (g_settings.glcd_enable) + cGLCD::lockChannel("(" + g_RemoteControl->getCurrentChannelName () + ')', "", 0); +#endif printf ("zap failed!\n"); showFailure (); CVFD::getInstance ()->showPercentOver (255); @@ -1562,6 +1570,10 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) if ((*(t_channel_id *) data) == current_channel_id) { // show failure..! CVFD::getInstance ()->showServicename ("(" + g_RemoteControl->getCurrentChannelName () + ')', g_RemoteControl->getCurrentChannelNumber()); +#ifdef ENABLE_GRAPHLCD + if (g_settings.glcd_enable) + cGLCD::lockChannel("(" + g_RemoteControl->getCurrentChannelName () + ')', "", 0); +#endif printf ("zap failed!\n"); showFailure (); CVFD::getInstance ()->showPercentOver (255); diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 9f6522ee1..67c6ee4bc 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -512,6 +513,12 @@ void CInfoViewerBB::showIcon_SubT() have_sub = true; showBBIcons(CInfoViewerBB::ICON_SUBT, (have_sub) ? NEUTRINO_ICON_SUBT : NEUTRINO_ICON_SUBT_GREY); +#ifdef ENABLE_GRAPHLCD + if (cc && cc->getSubtitleCount()) + cGLCD::lockIcon(cGLCD::SUB); + else + cGLCD::unlockIcon(cGLCD::SUB); +#endif } void CInfoViewerBB::showIcon_VTXT() @@ -519,6 +526,12 @@ void CInfoViewerBB::showIcon_VTXT() if (!is_visible) return; showBBIcons(CInfoViewerBB::ICON_VTXT, (g_RemoteControl->current_PIDs.PIDs.vtxtpid != 0) ? NEUTRINO_ICON_VTXT : NEUTRINO_ICON_VTXT_GREY); +#ifdef ENABLE_GRAPHLCD + if (g_RemoteControl->current_PIDs.PIDs.vtxtpid) + cGLCD::lockIcon(cGLCD::TXT); + else + cGLCD::unlockIcon(cGLCD::TXT); +#endif } void CInfoViewerBB::showIcon_DD() @@ -529,10 +542,17 @@ void CInfoViewerBB::showIcon_DD() if ((g_RemoteControl->current_PIDs.PIDs.selected_apid < g_RemoteControl->current_PIDs.APIDs.size()) && (g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].is_ac3)) dd_icon = NEUTRINO_ICON_DD; - else + else dd_icon = g_RemoteControl->has_ac3 ? NEUTRINO_ICON_DD_AVAIL : NEUTRINO_ICON_DD_GREY; showBBIcons(CInfoViewerBB::ICON_DD, dd_icon); +#ifdef ENABLE_GRAPHLCD + if ((g_RemoteControl->current_PIDs.PIDs.selected_apid < g_RemoteControl->current_PIDs.APIDs.size()) && + (g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].is_ac3)) + cGLCD::lockIcon(cGLCD::DD); + else + cGLCD::unlockIcon(cGLCD::DD); +#endif } void CInfoViewerBB::showIcon_RadioText(bool rt_available) diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index 03fc07a10..f666dbeaa 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -36,6 +36,8 @@ #include #include #include +#include +#include #include #include #include @@ -177,6 +179,13 @@ int CMiscMenue::exec(CMenuTarget* parent, const std::string &actionKey) return showMiscSettingsMenu(); } +#define WEATHER_COUNTRY_OPTION_COUNT 2 +const CMenuOptionChooser::keyval WEATHER_COUNTRY_OPTIONS[WEATHER_COUNTRY_OPTION_COUNT] = +{ + { 0, LOCALE_WEATHER_COUNTRY_DEUTSCHLAND }, + { 1, LOCALE_WEATHER_COUNTRY_NORWAY } +}; + #if 0 //not used #define MISCSETTINGS_FB_DESTINATION_OPTION_COUNT 3 const CMenuOptionChooser::keyval MISCSETTINGS_FB_DESTINATION_OPTIONS[MISCSETTINGS_FB_DESTINATION_OPTION_COUNT] = @@ -618,6 +627,9 @@ int CMiscMenue::showMiscSettingsMenuOnlineServices() mf_we->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_WEATHER_API_KEY); ms_oservices->addItem(mf_we); #endif + CMenuOptionChooser *mf_wc = new CMenuOptionChooser(LOCALE_WEATHER_COUNTRY, &g_settings.weather_country, WEATHER_COUNTRY_OPTIONS, WEATHER_COUNTRY_OPTION_COUNT, true); + mf_wc->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_WEATHER_COUNTRY); + ms_oservices->addItem(mf_wc); CMenuForwarder *mf_wl = new CMenuForwarder(LOCALE_WEATHER_LOCATION, g_settings.weather_enabled, g_settings.weather_city, this, "select_location"); mf_wl->setHint(NEUTRINO_ICON_HINT_SETTINGS, LOCALE_MENU_HINT_WEATHER_LOCATION); @@ -719,7 +731,17 @@ int CMiscMenue::showMiscSettingsSelectWeatherLocation() int select = 0; int res = 0; - if (WEATHER_LOCATION_OPTION_COUNT > 1) + int location_option_count = 0; + const struct weather_loc *location = NULL; + if (g_settings.weather_country == DEUTSCHLAND) { + location_option_count = WEATHER_DEUTSCHLAND_LOCATION_OPTION_COUNT; + location = WEATHER_DEUTSCHLAND_LOCATION_OPTIONS; + } else if (g_settings.weather_country == NORWAY) { + location_option_count = WEATHER_NORWAY_LOCATION_OPTION_COUNT; + location = WEATHER_NORWAY_LOCATION_OPTIONS; + } + + if (location_option_count > 1) { CMenuWidget *m = new CMenuWidget(LOCALE_WEATHER_LOCATION, NEUTRINO_ICON_LANGUAGE); CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); @@ -727,10 +749,10 @@ int CMiscMenue::showMiscSettingsSelectWeatherLocation() m->addItem(GenericMenuSeparator); CMenuForwarder* mf; - for (size_t i = 0; i < WEATHER_LOCATION_OPTION_COUNT; i++) + for (int i = 0; i < location_option_count; i++) { - mf = new CMenuForwarder(WEATHER_LOCATION_OPTIONS[i].key, true, NULL, selector, to_string(i).c_str()); - mf->setHint(NEUTRINO_ICON_HINT_SETTINGS, WEATHER_LOCATION_OPTIONS[i].value.c_str()); + mf = new CMenuForwarder(location[i].key, true, NULL, selector, to_string(i).c_str()); + mf->setHint(NEUTRINO_ICON_HINT_SETTINGS, location[i].value.c_str()); m->addItem(mf); } @@ -742,8 +764,8 @@ int CMiscMenue::showMiscSettingsSelectWeatherLocation() delete selector; } - g_settings.weather_location = WEATHER_LOCATION_OPTIONS[select].value; - g_settings.weather_city = std::string(WEATHER_LOCATION_OPTIONS[select].key); + g_settings.weather_location = location[select].value; + g_settings.weather_city = std::string(location[select].key); CWeather::getInstance()->setCoords(g_settings.weather_location, g_settings.weather_city); return res; } diff --git a/src/gui/miscsettings_menu.h b/src/gui/miscsettings_menu.h index c8d0e98a4..376d136d8 100644 --- a/src/gui/miscsettings_menu.h +++ b/src/gui/miscsettings_menu.h @@ -38,6 +38,10 @@ class CMiscMenue : public CMenuTarget, CChangeObserver { private: + enum { + DEUTSCHLAND = 0, + NORWAY = 1, + }; CFanControlNotifier *fanNotifier; CSectionsdConfigNotifier* sectionsdConfigNotifier; //COnOffNotifier* miscNotifier; diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index ddc86b5e6..6fb2d0ca8 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -84,10 +84,6 @@ //NI InfoIcons #include -#ifdef ENABLE_GRAPHLCD -bool glcd_play = false; -#endif - #if HAVE_COOL_HARDWARE || HAVE_ARM_HARDWARE || HAVE_MIPS_HARDWARE #define LCD_MODE CVFD::MODE_MENU_UTF8 #else @@ -391,6 +387,21 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) } } +#ifdef ENABLE_GRAPHLCD + if (!bgThread) { + cGLCD::MirrorOSD(false); + + channel = g_Locale->getText(LOCALE_MOVIEPLAYER_HEAD); + + epg = g_Locale->getText(LOCALE_MPKEY_STOP); + cGLCD::ShowLcdIcon(false); + cGLCD::lockChannel(channel, epg, 0); + cGLCD::lockDuration("00/00"); + cGLCD::lockStart("00:00"); + cGLCD::lockEnd("00:00"); + } +#endif + exec_controlscript(MOVIEPLAYER_START_SCRIPT); Cleanup(); @@ -488,11 +499,39 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) timeshift = TSHIFT_MODE_OFF; return menu_return::RETURN_EXIT_ALL; } + +#ifdef ENABLE_GRAPHLCD + if (!isHTTP || !isUPNP || !bgThread) { + cGLCD::MirrorOSD(g_settings.glcd_mirror_osd); + cGLCD::ShowLcdIcon(false); + cGLCD::unlockChannel(); + cGLCD::unlockDuration(); + cGLCD::unlockStart(); + cGLCD::unlockEnd(); + } +#endif + return menu_ret; } void CMoviePlayerGui::updateLcd(bool display_playtime) { +#ifdef ENABLE_GRAPHLCD + if (!bgThread) { + if (CMoviePlayerGui::getInstance().p_movie_info) + { + if (!CMoviePlayerGui::getInstance().p_movie_info->channelName.empty()) + channel = CMoviePlayerGui::getInstance().p_movie_info->channelName; + if (!CMoviePlayerGui::getInstance().p_movie_info->epgTitle.empty()) + epg = CMoviePlayerGui::getInstance().p_movie_info->epgTitle; + } else if (!CMoviePlayerGui::getInstance().GetFile().empty()) { + epg = CMoviePlayerGui::getInstance().GetFile(); + } + + if (channel.empty()) + channel = g_Locale->getText(LOCALE_MOVIEPLAYER_HEAD); + } +#endif char tmp[20]; std::string lcd; std::string name; @@ -515,7 +554,32 @@ void CMoviePlayerGui::updateLcd(bool display_playtime) switch (playstate) { + case CMoviePlayerGui::STOPPED: +#ifdef ENABLE_GRAPHLCD + if (!bgThread) { + channel = g_Locale->getText(LOCALE_MOVIEPLAYER_HEAD); + + epg = g_Locale->getText(LOCALE_MPKEY_STOP); + + cGLCD::ShowLcdIcon(false); + cGLCD::lockChannel(channel, epg, 0); + cGLCD::lockDuration("00/00"); + cGLCD::lockStart("00:00"); + cGLCD::lockEnd("00:00"); + } +#endif + break; case CMoviePlayerGui::PAUSE: +#ifdef ENABLE_GRAPHLCD + if (!bgThread) { + channel = ""; + cGLCD::lockChannel(channel, epg, glcd_position); + cGLCD::lockDuration(glcd_duration); + cGLCD::lockStart(start); + cGLCD::lockEnd(end); + cGLCD::ShowLcdIcon(true); + } +#endif if (speed < 0) { sprintf(tmp, "%dx<| ", abs(speed)); @@ -530,14 +594,44 @@ void CMoviePlayerGui::updateLcd(bool display_playtime) lcd = "|| "; break; case CMoviePlayerGui::REW: +#ifdef ENABLE_GRAPHLCD + if (!bgThread) { + channel = ""; + cGLCD::lockChannel(channel, epg, glcd_position); + cGLCD::lockDuration(glcd_duration); + cGLCD::lockStart(start); + cGLCD::lockEnd(end); + cGLCD::ShowLcdIcon(true); + } +#endif sprintf(tmp, "%dx<< ", abs(speed)); lcd = tmp; break; case CMoviePlayerGui::FF: +#ifdef ENABLE_GRAPHLCD + if (!bgThread) { + channel = ""; + cGLCD::lockChannel(channel, epg, glcd_position); + cGLCD::lockDuration(glcd_duration); + cGLCD::lockStart(start); + cGLCD::lockEnd(end); + cGLCD::ShowLcdIcon(true); + } +#endif sprintf(tmp, "%dx>> ", abs(speed)); lcd = tmp; break; case CMoviePlayerGui::PLAY: +#ifdef ENABLE_GRAPHLCD + if (!bgThread) { + channel = ""; + cGLCD::lockChannel(channel, epg, glcd_position); + cGLCD::lockDuration(glcd_duration); + cGLCD::lockStart(start); + cGLCD::lockEnd(end); + cGLCD::ShowLcdIcon(true); + } +#endif lcd = "> "; break; default: @@ -1292,6 +1386,19 @@ void CMoviePlayerGui::stopPlayBack(void) webtv_started = false; if(playback) playback->RequestAbort(); +#ifdef ENABLE_GRAPHLCD + if (!bgThread) { + channel = g_Locale->getText(LOCALE_MOVIEPLAYER_HEAD); + + epg = g_Locale->getText(LOCALE_MPKEY_STOP); + + cGLCD::ShowLcdIcon(false); + cGLCD::lockChannel(channel, epg, 0); + cGLCD::lockDuration("00/00"); + cGLCD::lockStart("00:00"); + cGLCD::lockEnd("00:00"); + } +#endif mutex.unlock(); cond.broadcast(); pthread_join(bgThread, NULL); @@ -1375,13 +1482,7 @@ bool CMoviePlayerGui::PlayFileStart(void) } #ifdef ENABLE_GRAPHLCD - nGLCD::MirrorOSD(false); - if (p_movie_info) - nGLCD::lockChannel(p_movie_info->channelName, p_movie_info->epgTitle); - else { - glcd_play = true; - nGLCD::lockChannel(g_Locale->getText(LOCALE_MOVIEPLAYER_HEAD), file_name.c_str(), file_prozent); - } + cGLCD::MirrorOSD(false); #endif file_prozent = 0; @@ -1578,14 +1679,6 @@ void CMoviePlayerGui::PlayFileLoop(void) while (playstate >= CMoviePlayerGui::PLAY) { -#ifdef ENABLE_GRAPHLCD - if (p_movie_info) - nGLCD::lockChannel(p_movie_info->channelName, p_movie_info->epgTitle, duration ? (100 * position / duration) : 0); - else { - glcd_play = true; - nGLCD::lockChannel(g_Locale->getText(LOCALE_MOVIEPLAYER_HEAD), file_name.c_str(), file_prozent); - } -#endif if (update_lcd || g_settings.movieplayer_display_playtime) { update_lcd = false; updateLcd(g_settings.movieplayer_display_playtime); @@ -1639,6 +1732,32 @@ void CMoviePlayerGui::PlayFileLoop(void) if (duration > 100) file_prozent = (unsigned char) (position / (duration / 100)); +#ifdef ENABLE_GRAPHLCD + if (!bgThread) { + int pos = position / (60 * 1000); + int dur = duration / (60 * 1000); + + glcd_duration = to_string(position / (60 * 1000)) + "/" + to_string(duration / (60 * 1000)); + //glcd_duration = to_string(pos/10) + to_string(pos%10) + "/" + to_string(dur/10) + to_string(dur%10); + + time_t sTime = time(NULL); + sTime -= (position / 1000); + tm_struct = localtime(&sTime); + start = to_string(tm_struct->tm_hour/10) + to_string(tm_struct->tm_hour%10) + ":" + to_string(tm_struct->tm_min/10) + to_string(tm_struct->tm_min%10); + + time_t eTime = time(NULL); + eTime += (duration / 1000) - (position / 1000); + tm_struct = localtime(&eTime); + end = to_string(tm_struct->tm_hour/10) + to_string(tm_struct->tm_hour%10) + ":" + to_string(tm_struct->tm_min/10) + to_string(tm_struct->tm_min%10); + + //glcd_position = duration ? 100 * (position / duration) : 0; + glcd_position = file_prozent; + cGLCD::lockChannel(channel, epg, glcd_position); + cGLCD::lockDuration(glcd_duration); + cGLCD::lockStart(start); + cGLCD::lockEnd(end); + } +#endif CVFD::getInstance()->showPercentOver(file_prozent); playback->GetSpeed(speed); @@ -2098,9 +2217,16 @@ void CMoviePlayerGui::PlayFileEnd(bool restore) playback->SetSpeed(1); playback->Close(); #ifdef ENABLE_GRAPHLCD - if (p_movie_info || glcd_play == true) { - glcd_play = false; - nGLCD::unlockChannel(); + if (!bgThread) { + channel = g_Locale->getText(LOCALE_MOVIEPLAYER_HEAD); + + epg = g_Locale->getText(LOCALE_MPKEY_STOP); + + cGLCD::ShowLcdIcon(false); + cGLCD::lockChannel(channel, epg, 0); + cGLCD::lockDuration("00/00"); + cGLCD::lockStart("00:00"); + cGLCD::lockEnd("00:00"); } #endif if (iso_file) { @@ -2252,8 +2378,10 @@ void CMoviePlayerGui::callInfoViewer(bool init_vzap_it) if (!movie_info.channelName.empty() || !movie_info.epgTitle.empty()) p_movie_info = &movie_info; #ifdef ENABLE_GRAPHLCD + if (!bgThread) { if (p_movie_info) - nGLCD::lockChannel(p_movie_info->channelName, p_movie_info->epgTitle); + cGLCD::lockChannel(p_movie_info->channelName, p_movie_info->epgTitle); + } #endif } diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index a9096b35b..bee808f96 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -115,6 +115,16 @@ class CMoviePlayerGui : public CMenuTarget int m_LastMode; int m_ThisMode; +#ifdef ENABLE_GRAPHLCD + struct tm *tm_struct; + int glcd_position; + std::string channel; + std::string epg; + std::string glcd_duration; + std::string start; + std::string end; +#endif + std::string cookie_header; std::string info_1, info_2; std::string currentaudioname; diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index eda9868d6..e5537e5b9 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -166,6 +166,13 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey) selected = 0; +#ifdef ENABLE_GRAPHLCD + cGLCD::MirrorOSD(false); + channel = g_Locale->getText(LOCALE_PICTUREVIEWER_HEAD); + epg = ""; + cGLCD::lockChannel(channel, epg, 0); +#endif + width = frameBuffer->getWindowWidth(); height = frameBuffer->getWindowHeight(); @@ -243,6 +250,11 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey) if (m_LastMode == NeutrinoModes::mode_ts) videoDecoder->setBlank(false); +#ifdef ENABLE_GRAPHLCD + cGLCD::MirrorOSD(g_settings.glcd_mirror_osd); + cGLCD::unlockChannel(); +#endif + // always exit all return menu_return::RETURN_REPAINT; } @@ -588,6 +600,10 @@ int CPictureViewerGui::show() CNFSSmallMenu nfsMenu; nfsMenu.exec(this, ""); update=true; +#ifdef ENABLE_GRAPHLCD + epg = ""; + cGLCD::lockChannel(channel, epg, 0); +#endif CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, g_Locale->getText(LOCALE_PICTUREVIEWER_HEAD)); } } @@ -802,6 +818,10 @@ void CPictureViewerGui::view(unsigned int index, bool unscaled) m_unscaled = unscaled; selected=index; +#ifdef ENABLE_GRAPHLCD + epg = playlist[index].Name.c_str(); + cGLCD::lockChannel(channel, epg, 0); +#endif CVFD::getInstance()->showMenuText(0, playlist[index].Name.c_str()); char timestring[19]; strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&playlist[index].Date)); @@ -852,6 +872,11 @@ void CPictureViewerGui::thrView() void CPictureViewerGui::endView() { +#ifdef ENABLE_GRAPHLCD + epg = ""; + cGLCD::lockChannel(channel, epg, 0); +#endif + if (m_state != MENU) m_state=MENU; @@ -864,6 +889,10 @@ void CPictureViewerGui::endView() void CPictureViewerGui::deletePicFile(unsigned int index, bool mode) { +#ifdef ENABLE_GRAPHLCD + epg = playlist[index].Name.c_str(); + cGLCD::lockChannel(channel, epg, 0); +#endif CVFD::getInstance()->showMenuText(0, playlist[index].Name.c_str()); if (ShowMsg(LOCALE_FILEBROWSER_DELETE, playlist[index].Filename, CMsgBox::mbrNo, CMsgBox::mbYes|CMsgBox::mbNo)==CMsgBox::mbrYes) { diff --git a/src/gui/pictureviewer.h b/src/gui/pictureviewer.h index 70b38fd16..be4793102 100644 --- a/src/gui/pictureviewer.h +++ b/src/gui/pictureviewer.h @@ -86,6 +86,11 @@ class CPictureViewerGui : public CMenuTarget CViewList playlist; std::string Path; +#ifdef ENABLE_GRAPHLCD + std::string channel; + std::string epg; +#endif + int width; int height; int x; diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index af8e95f9d..62eb2728f 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -385,6 +386,9 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) CNeutrinoApp::getInstance()->channelList->zapTo_ChannelID(CZapit::getInstance()->GetCurrentChannelID(), true); /* force re-zap */ CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); +#ifdef ENABLE_GRAPHLCD + cGLCD::unlockChannel(); +#endif return menu_return::RETURN_REPAINT; } @@ -409,6 +413,11 @@ neutrino_msg_t CScanTs::handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data) total = data; snprintf(str, sizeof(buffer), "scan: %d/%d", done, total); CVFD::getInstance()->showMenuText(0, str, -1, true); +#ifdef ENABLE_GRAPHLCD + if (g_settings.glcd_enable) + cGLCD::lockChannel(g_Locale->getText(LOCALE_SCANTS_HEAD), str, 0); + //cGLCD::lockChannel(g_Locale->getText(LOCALE_BOUQUETLIST_HEAD), chan->getName().c_str(), 0); +#endif break; case NeutrinoMessages::EVT_SCAN_REPORT_NUM_SCANNED_TRANSPONDERS: @@ -418,6 +427,10 @@ neutrino_msg_t CScanTs::handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data) paintLine(xpos2, ypos_transponder, (ypos_transponder > ypos_radar + 66) ? w : w_to_radar, buffer); snprintf(str, sizeof(buffer), "scan %d/%d", done, total); CVFD::getInstance()->showMenuText(0, str, -1, true); +#ifdef ENABLE_GRAPHLCD + if (g_settings.glcd_enable) + cGLCD::lockChannel(g_Locale->getText(LOCALE_SCANTS_HEAD), str, 0); +#endif break; case NeutrinoMessages::EVT_SCAN_REPORT_FREQUENCYP: diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 2f3030d31..ab07ec85a 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -187,6 +187,11 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/ CNeutrinoApp::getInstance()->stopPlayBack(true); m_frameBuffer->showFrame("mp3.jpg"); +#ifdef ENABLE_GRAPHLCD + cGLCD::MirrorOSD(false); + cGLCD::lockChannel(g_Locale->getText(LOCALE_UPNPBROWSER_HEAD), "", 0); +#endif + // tell neutrino we're in upnp mode CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , NeutrinoModes::mode_upnp); @@ -210,6 +215,11 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/ CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE , m_LastMode); g_RCInput->postMsg(NeutrinoMessages::SHOW_INFOBAR, 0); +#ifdef ENABLE_GRAPHLCD + cGLCD::MirrorOSD(g_settings.glcd_mirror_osd); + cGLCD::unlockChannel(); +#endif + return menu_return::RETURN_REPAINT; } diff --git a/src/gui/vfd_setup.cpp b/src/gui/vfd_setup.cpp index 2a8a348c6..d8d35e9a4 100644 --- a/src/gui/vfd_setup.cpp +++ b/src/gui/vfd_setup.cpp @@ -195,8 +195,6 @@ int CVfdSetup::showSetup() #ifdef ENABLE_GRAPHLCD GLCD_Menu glcdMenu; - - vfds->addItem(GenericMenuSeparatorLine); vfds->addItem(new CMenuForwarder(LOCALE_GLCD_HEAD, true, NULL, &glcdMenu, NULL, CRCInput::RC_blue)); #endif diff --git a/src/gui/weather.cpp b/src/gui/weather.cpp index 0cba28a36..a62042ea8 100644 --- a/src/gui/weather.cpp +++ b/src/gui/weather.cpp @@ -139,11 +139,15 @@ bool CWeather::GetWeatherDetails() current.humidity = DataValues["currently"].get("humidity", "").asFloat(); current.windSpeed = DataValues["currently"].get("windSpeed", "").asFloat(); current.windBearing = DataValues["currently"].get("windBearing", "").asDouble(); - current.icon = DataValues["currently"].get("icon", "").asString(); + current.icon = current.icon_only_name = DataValues["currently"].get("icon", "").asString(); if (current.icon.empty()) current.icon = "unknown.png"; else current.icon = current.icon + ".png"; + + if (current.icon_only_name.empty()) + current.icon_only_name = "unknown"; + printf("[CWeather]: temp in %s (%s): %.1f - %s\n", city.c_str(), timezone.c_str(), current.temperature, current.icon.c_str()); forecast_data daily_data; @@ -152,11 +156,15 @@ bool CWeather::GetWeatherDetails() { daily_data.timestamp = elements[i].get("time", 0).asDouble(); daily_data.weekday = (int)(localtime(&daily_data.timestamp)->tm_wday); - daily_data.icon = elements[i].get("icon", "").asString(); + daily_data.icon = daily_data.icon_only_name = elements[i].get("icon", "").asString(); if (daily_data.icon.empty()) daily_data.icon = "unknown.png"; else daily_data.icon = daily_data.icon + ".png"; + + if (daily_data.icon_only_name.empty()) + daily_data.icon_only_name = "unknown"; + daily_data.temperatureMin = elements[i].get("temperatureMin", "").asFloat(); daily_data.temperatureMax = elements[i].get("temperatureMax", "").asFloat(); daily_data.sunriseTime = elements[i].get("sunriseTime", 0).asDouble(); diff --git a/src/gui/weather.h b/src/gui/weather.h index f1162ac8f..0f9438364 100644 --- a/src/gui/weather.h +++ b/src/gui/weather.h @@ -39,6 +39,7 @@ struct current_data { time_t timestamp; std::string icon; + std::string icon_only_name; float temperature; float humidity; float pressure; @@ -48,6 +49,7 @@ struct current_data current_data(): timestamp(0), icon("unknown.png"), + icon_only_name("unknown"), temperature(0), humidity(0), pressure(0), @@ -61,6 +63,7 @@ typedef struct time_t timestamp; int weekday; // 0=Sunday, 1=Monday, ... std::string icon; + std::string icon_only_name; float temperatureMin; float temperatureMax; time_t sunriseTime; @@ -130,6 +133,10 @@ class CWeather { return ICONSDIR"/weather/" + current.icon; }; + std::string getCurrentIconOnlyName() + { + return current.icon_only_name; + }; // forecast conditions int getForecastSize() @@ -172,6 +179,12 @@ class CWeather i = (int)v_forecast.size(); return ICONSDIR"/weather/" + v_forecast[i].icon; }; + std::string getForecastIconOnlyNane(int i = 0) + { + if (i > (int)v_forecast.size()) + i = (int)v_forecast.size(); + return v_forecast[i].icon_only_name; + }; void show(int x = 50, int y = 50); void hide(); diff --git a/src/gui/weather_deutschland_locations.h b/src/gui/weather_deutschland_locations.h new file mode 100644 index 000000000..e771e2ca9 --- /dev/null +++ b/src/gui/weather_deutschland_locations.h @@ -0,0 +1,319 @@ +/* + Copyright (C) 2017,2018,2019 TangoCash + + “Powered by Dark Sky” https://darksky.net/poweredby/ + + 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; + + 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. +*/ + +#ifndef _WEATHER_DEUTSCHLAND_LOCATION_H_ +#define _WEATHER_DEUTSCHLAND_LOCATION_H_ + +#include "weather_locations.h" + +// locations and coords taken from tuxwetter plugin +const weather_loc WEATHER_DEUTSCHLAND_LOCATION_OPTIONS[] = +{ + { "Aachen", "50.77,6.13" }, + { "Ahaus", "52.07,7.00" }, + { "Ahrensburg", "53.06,10.25" }, + { "Allendorf", "51.28,7.95" }, + { "Alsenz", "49.72,7.82" }, + { "Altenbruch", "53.82,8.77" }, + { "Amberg", "49.44,11.86" }, + { "Ansbach", "49.30,10.58" }, + { "Aschaffenburg", "49.97,9.15" }, + { "Augsburg", "48.37,10.88" }, + { "Aurich", "53.47,7.48" }, + { "Bad Hersfeld", "50.870,9.702" }, + { "Bad Tölz", "47.77,11.57" }, + { "Bamberg", "50.87,9.70" }, + { "Barweiler", "50.35,6.98" }, + { "Bayreuth", "49.95,11.56" }, + { "Bedburg", "50.98,6.57" }, + { "Bergen auf Rügen", "54.42,13.44" }, + { "Bergisch-Gladbach", "49.94,11.57" }, + { "Berlin", "52.52,13.40" }, + { "Bielefeld", "52.03,8.53" }, + { "Bitburg", "49.96,6.52" }, + { "Blexen", "49.96,6.52" }, + { "Bonn", "50.73,7.09" }, + { "Bottrop", "51.52,6.94" }, + { "Brandenburg", "52.41,12.53" }, + { "Braunschweig", "52.26,10.52" }, + { "Bremen", "53.07,8.80" }, + { "Bremerhaven", "53.53,8.58" }, + { "Brüggen", "51.03,6.33" }, + { "Brunsbüttel", "53.89,9.13" }, + { "Bückeburg", "52.25,9.05" }, + { "Büttgen", "51.19,6.60" }, + { "Celle", "52.25,9.05" }, + { "Chemnitz", "50.82,12.92" }, + { "Cloppenburg", "50.82,12.92" }, + { "Coburg", "50.26,10.96" }, + { "Cottbus", "51.75,14.33" }, + { "Cuxhaven", "53.85,8.68" }, + { "Dachau", "48.26,11.43" }, + { "Darmstadt", "49.87,8.65" }, + { "Deggendorf", "48.84,12.95" }, + { "Delmenhorst", "53.05,8.63" }, + { "Dessau", "51.82,12.24" }, + { "Detmold", "51.93,8.86" }, + { "Döbeln", "51.12,13.11" }, + { "Donaueschingen", "47.95,8.49" }, + { "Dortmund", "51.51,7.46" }, + { "Dresden", "51.05,13.73" }, + { "Duhnen", "53.88,8.64" }, + { "Duisburg", "51.43,6.76" }, + { "Düsseldorf", "51.22,6.77" }, + { "Ebersberg", "48.07,11.96" }, + { "Eberswalde", "52.837,13.788" }, + { "Eckernförde", "54.469,9.838" }, + { "Eggenfelden", "48.40,12.75" }, + { "Eichstätt", "48.89,11.18" }, + { "Elmshorn", "53.75,9.66" }, + { "Emden", "53.35,7.20" }, + { "Erding", "48.31,11.91" }, + { "Erfurt", "50.98,11.02" }, + { "Erkrath", "51.22,6.91" }, + { "Erlangen", "49.58,11.01" }, + { "Eschlkam", "49.29,12.91" }, + { "Eschwege", "51.18,10.03" }, + { "Essen", "51.45,7.01" }, + { "Esslingen", "48.74,9.32" }, + { "Euskirchen", "50.65,6.78" }, + { "Eutin", "54.13,10.60" }, + { "Falkensee", "52.56,13.07" }, + { "Feucht", "49.37,11.21" }, + { "Flensburg", "54.79,9.44" }, + { "Frankfurt am Main", "50.11,8.68" }, + { "Frankfurt an der Oder", "52.350,14.550" }, + { "Freiburg", "47.99,7.84" }, + { "Freigericht", "50.142,9.166" }, + { "Freising", "48.40,11.74" }, + { "Freudenstadt", "48.46,8.41" }, + { "Freyung", "48.80,13.54" }, + { "Friedrichshafen", "47.66,9.48" }, + { "Friesoythe", "53.02,7.85" }, + { "Fritzlar", "51.13,9.27" }, + { "Fulda", "50.55,9.68" }, + { "Fürstenfeldbruck", "48.17,11.24" }, + { "Fürth", "49.47,10.98" }, + { "Garmisch-Partenkirchen", "47.49,11.10" }, + { "Geilenkirchen", "50.97,6.12" }, + { "Gelnhausen", "50.20,9.19" }, + { "Gelsenkirchen", "51.52,7.09" }, + { "Gera", "50.89,12.08" }, + { "Geretsried", "47.86,11.49" }, + { "Germersheim", "49.21,8.37" }, + { "Gettorf", "54.41,9.98" }, + { "Gießen", "50.58,8.68" }, + { "Glauchau", "50.82,12.55" }, + { "Göppingen", "48.71,9.65" }, + { "Görlitz", "51.15,14.97" }, + { "Göttingen", "51.54,9.92" }, + { "Grafenau", "48.86,13.39" }, + { "Grafenwöhr", "49.71,11.91" }, + { "Greifswald", "54.09,13.39" }, + { "Grünberg", "50.59,8.96" }, + { "Gütersloh", "51.90,8.39" }, + { "Hagen", "51.37,7.46" }, + { "Hahn", "49.96,7.27" }, + { "Halle (Saale)", "51.497,11.969" }, + { "Halle (Westfalen)", "52.06,8.36" }, + { "Hamburg", "53.55,9.99" }, + { "Hamm", "51.67,7.82" }, + { "Hanau", "50.13,8.93" }, + { "Hannover", "52.38,9.73" }, + { "Harrislee", "54.80,9.39" }, + { "Heidelberg", "49.40,8.67" }, + { "Heilbronn", "49.14,9.21" }, + { "Helgoland", "54.18,7.89" }, + { "Hennigsdorf", "52.63,13.20" }, + { "Herne", "51.54,7.20" }, + { "Hilden", "51.17,6.93" }, + { "Hildesheim", "52.15,9.96" }, + { "Hinte", "53.41,7.20" }, + { "Hochheim", "50.01,8.36" }, + { "Hockenheimring", "49.33,8.57" }, + { "Hof", "50.31,11.91" }, + { "Holzkirchen", "47.88,11.70" }, + { "Hosten", "49.89,6.62" }, + { "Hürth", "50.88,6.89" }, + { "Husby", "54.50,9.48" }, + { "Husum", "54.48,9.06" }, + { "Idar-Oberstein", "49.71,7.31" }, + { "Ingolstadt", "48.77,11.43" }, + { "Iserlohn", "51.38,7.70" }, + { "Itzehoe", "53.93,9.51" }, + { "Jever", "53.57,7.90" }, + { "Jülich", "50.92,6.36" }, + { "Kall", "50.54,6.56" }, + { "Karlsruhe", "49.01,8.40" }, + { "Kassel", "51.31,9.48" }, + { "Kaufbeuren", "47.88,10.63" }, + { "Kempten", "47.73,10.32" }, + { "Kiel", "54.32,10.12" }, + { "Kitzingen", "49.73,10.15" }, + { "Koblenz", "50.36,7.59" }, + { "Köln", "50.94,6.96" }, + { "Konstanz", "47.68,9.17" }, + { "Krefeld", "51.34,6.59" }, + { "Kronshagen", "54.34,10.09" }, + { "Krumbach", "48.25,10.37" }, + { "Laarbruch", "51.60,6.15" }, + { "Lahr", "48.33,7.87" }, + { "Landshut", "48.54,12.15" }, + { "Langenhagen", "52.45,9.74" }, + { "Lausitzring", "51.54,13.89" }, + { "Lechfeld", "48.19,10.86" }, + { "Leck", "54.77,8.98" }, + { "Leer", "53.24,7.47" }, + { "Leipzig", "51.34,12.37" }, + { "Leverkusen", "51.05,7.02" }, + { "Lindenberg", "47.60,9.89" }, + { "List", "55.02,8.43" }, + { "Lübeck", "53.87,10.69" }, + { "Lüchow", "52.97,11.15" }, + { "Luckenwalde", "52.09,13.16" }, + { "Ludwigsburg", "48.89,9.20" }, + { "Ludwigshafen", "49.48,8.45" }, + { "Lüneburg", "53.25,10.41" }, + { "Magdeburg", "52.12,11.63" }, + { "Mainz", "49.99,8.25" }, + { "Mannheim", "49.49,8.47" }, + { "Marburg", "50.80,8.77" }, + { "Marienfelde", "52.42,13.37" }, + { "Marktbreit", "49.67,10.15" }, + { "Meiningen", "50.57,10.42" }, + { "Memmingen", "47.98,10.18" }, + { "Meppen", "52.70,7.30" }, + { "Merzig", "49.45,6.64" }, + { "Minden", "52.30,8.89" }, + { "Mönchengladbach", "51.18,6.44" }, + { "Mühldorf", "48.25,12.52" }, + { "München", "48.14,11.58" }, + { "Münster", "51.96,7.63" }, + { "Murnau", "47.68,11.20" }, + { "Mylau", "50.62,12.26" }, + { "Naumburg (Saale)", "51.15,11.82" }, + { "Neuberg", "48.11,12.12" }, + { "Neubrandenburg", "53.57,13.28" }, + { "Neumarkt", "49.28,11.47" }, + { "Neumünster", "54.07,9.98" }, + { "Neunkirchen", "49.35,7.19" }, + { "Neuruppin", "52.92,12.80" }, + { "Neuss", "51.20,6.69" }, + { "Neuwied", "50.44,7.47" }, + { "Niendorf (Ostsee)", "53.99,10.83" }, + { "Norden", "53.60,7.20" }, + { "Nordenham", "53.50,8.49" }, + { "Norderney", "53.71,7.16" }, + { "Nordhausen", "51.50,10" }, + { "Nordhausen", "51.50,10" }, + { "Nordheide", "53.12,8.46" }, + { "Nordhorn", "52.43,7.07" }, + { "Nördlingen", "48.85,10.49" }, + { "Nürburgring", "50.34,6.95" }, + { "Oberhausen", "51.50,6.86" }, + { "Oberpfaffenhofen", "48.07,11.26" }, + { "Oberstdorf", "47.41,10.28" }, + { "Ochsenfurt", "49.66,10.07" }, + { "Oeversee", "54.70,9.43" }, + { "Offenbach", "50.10,8.78" }, + { "Oldenburg", "53.14,8.21" }, + { "Oldersum", "53.33,7.34" }, + { "Oranienburg", "52.75,13.24" }, + { "Osnabrück", "52.28,8.05" }, + { "Otterndorf", "53.81,8.90" }, + { "Paderborn", "51.72,8.76" }, + { "Passau", "48.57,13" }, + { "Peine", "52.32,10.24" }, + { "Pfaffenhofen", "48.52,11.50" }, + { "Pfarrkirchen", "48.42,12.94" }, + { "Pforzheim", "48.89,8.69" }, + { "Pinneberg", "53.65,9.79" }, + { "Pirmasens", "49.20,7.60" }, + { "Plauen", "50.50,12.14" }, + { "Pocking", "48.40,13.32" }, + { "Potsdam", "52.39,13.06" }, + { "Prenzlau", "53.32,13.86" }, + { "Quickborn", "53.73,9.91" }, + { "Rastede", "53.24,8.20" }, + { "Recklinghausen", "51.61,7.20" }, + { "Regensburg", "49.01,12.10" }, + { "Remscheid", "51.18,7.19" }, + { "Rendsburg", "54.31,9.66" }, + { "Rennerod", "50.61,8.07" }, + { "Rosenheim", "47.86,12.12" }, + { "Rostock", "54.09,12.10" }, + { "Rüsselsheim", "50.00,8.42" }, + { "Saarbrücken", "49.230,7.000" }, + { "Sahlenburg", "53.870,8.630" }, + { "Salzgitter", "52.080,10.330" }, + { "Salzwedel", "52.850,11.150" }, + { "Schiffdorf", "53.530,8.650" }, + { "Schleswig", "54.520,9.550" }, + { "Schrobenhausen", "48.550,11.270" }, + { "Schwabach", "49.330,11.030" }, + { "Schwäbisch Hall", "49.110,9.730" }, + { "Schweinfurt", "50.050,10.230" }, + { "Schwerin", "53.630,11.380" }, + { "Siegburg", "50.800,7.200" }, + { "Siegen", "50.870,8.030" }, + { "Solingen", "51.180,7.080" }, + { "Starnberg", "48.000,11.350" }, + { "Straubing", "48.880,12.570" }, + { "Stuttgart", "48.770,9.180" }, + { "Sulingen", "52.680,8.800" }, + { "Sylt", "54.880,8.350" }, + { "Tönning", "54.320,8.950" }, + { "Traunstein", "47.87,12.62" }, + { "Travemünde", "53.970,10.870" }, + { "Trier", "49.750,6.630" }, + { "Tübingen", "48.530,9.050" }, + { "Ulm", "48.400,10.000" }, + { "Varel", "53.18,9.49" }, + { "Veitsbronn", "49.520,10.880" }, + { "Villingen-Schwenningen", "48.070,8.450" }, + { "Vilsbiburg", "48.450,12.350" }, + { "Vilshofen", "49.23,12.04" }, + { "Waldkirchen/Bayr.-Wald", "48.730,13.600" }, + { "Wallsbüll", "54.580,9.000" }, + { "Warnemünde", "54.170,12.080" }, + { "Weiden", "49.680,12.160" }, + { "Weimar", "50.980,11.320" }, + { "Weißenburg/Bayern", "49.030,10.980" }, + { "Wernigerode", "51.830,10.780" }, + { "Westerland/Sylt", "54.900,8.300" }, + { "Westerstede", "53.250,7.930" }, + { "Wetzlar", "50.550,8.500" }, + { "Wiesbaden", "50.080,8.250" }, + { "Wilhelmshaven", "53.520,8.130" }, + { "Wittenberge", "53.000,11.750" }, + { "Wittingen", "52.730,10.720" }, + { "Wolfsburg", "52.430,10.800" }, + { "Worms", "49.61,8.31" }, + { "Wuppertal", "51.270,7.180" }, + { "Würzburg", "49.790,9.940" }, + { "Zeven", "53.300,9.280" }, + { "Zirndorf", "49.450,10.950" }, + { "Zwickau", "50.720,12.500" } +}; + +#define WEATHER_DEUTSCHLAND_LOCATION_OPTION_COUNT (sizeof(WEATHER_DEUTSCHLAND_LOCATION_OPTIONS)/sizeof(weather_loc)) + +#endif diff --git a/src/gui/weather_locations.h b/src/gui/weather_locations.h index 184a26304..577031d46 100644 --- a/src/gui/weather_locations.h +++ b/src/gui/weather_locations.h @@ -19,300 +19,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifndef _WEATHER_LOCATIONS_ +#define _WEATHER_LOCATIONS_ + struct weather_loc { const char *key; const std::string value; }; -// locations and coords taken from tuxwetter plugin -const weather_loc WEATHER_LOCATION_OPTIONS[] = -{ - { "Aachen", "50.77,6.13" }, - { "Ahaus", "52.07,7.00" }, - { "Ahrensburg", "53.06,10.25" }, - { "Allendorf", "51.28,7.95" }, - { "Alsenz", "49.72,7.82" }, - { "Altenbruch", "53.82,8.77" }, - { "Amberg", "49.44,11.86" }, - { "Ansbach", "49.30,10.58" }, - { "Aschaffenburg", "49.97,9.15" }, - { "Augsburg", "48.37,10.88" }, - { "Aurich", "53.47,7.48" }, - { "Bad Hersfeld", "50.870,9.702" }, - { "Bad Tölz", "47.77,11.57" }, - { "Bamberg", "50.87,9.70" }, - { "Barweiler", "50.35,6.98" }, - { "Bayreuth", "49.95,11.56" }, - { "Bedburg", "50.98,6.57" }, - { "Bergen auf Rügen", "54.42,13.44" }, - { "Bergisch-Gladbach", "49.94,11.57" }, - { "Berlin", "52.52,13.40" }, - { "Bielefeld", "52.03,8.53" }, - { "Bitburg", "49.96,6.52" }, - { "Blexen", "49.96,6.52" }, - { "Bonn", "50.73,7.09" }, - { "Bottrop", "51.52,6.94" }, - { "Brandenburg", "52.41,12.53" }, - { "Braunschweig", "52.26,10.52" }, - { "Bremen", "53.07,8.80" }, - { "Bremerhaven", "53.53,8.58" }, - { "Brüggen", "51.03,6.33" }, - { "Brunsbüttel", "53.89,9.13" }, - { "Bückeburg", "52.25,9.05" }, - { "Büttgen", "51.19,6.60" }, - { "Celle", "52.25,9.05" }, - { "Chemnitz", "50.82,12.92" }, - { "Cloppenburg", "50.82,12.92" }, - { "Coburg", "50.26,10.96" }, - { "Cottbus", "51.75,14.33" }, - { "Cuxhaven", "53.85,8.68" }, - { "Dachau", "48.26,11.43" }, - { "Darmstadt", "49.87,8.65" }, - { "Deggendorf", "48.84,12.95" }, - { "Delmenhorst", "53.05,8.63" }, - { "Dessau", "51.82,12.24" }, - { "Detmold", "51.93,8.86" }, - { "Döbeln", "51.12,13.11" }, - { "Donaueschingen", "47.95,8.49" }, - { "Dortmund", "51.51,7.46" }, - { "Dresden", "51.05,13.73" }, - { "Duhnen", "53.88,8.64" }, - { "Duisburg", "51.43,6.76" }, - { "Düsseldorf", "51.22,6.77" }, - { "Ebersberg", "48.07,11.96" }, - { "Eberswalde", "52.837,13.788" }, - { "Eckernförde", "54.469,9.838" }, - { "Eggenfelden", "48.40,12.75" }, - { "Eichstätt", "48.89,11.18" }, - { "Elmshorn", "53.75,9.66" }, - { "Emden", "53.35,7.20" }, - { "Erding", "48.31,11.91" }, - { "Erfurt", "50.98,11.02" }, - { "Erkrath", "51.22,6.91" }, - { "Erlangen", "49.58,11.01" }, - { "Eschlkam", "49.29,12.91" }, - { "Eschwege", "51.18,10.03" }, - { "Essen", "51.45,7.01" }, - { "Esslingen", "48.74,9.32" }, - { "Euskirchen", "50.65,6.78" }, - { "Eutin", "54.13,10.60" }, - { "Falkensee", "52.56,13.07" }, - { "Feucht", "49.37,11.21" }, - { "Flensburg", "54.79,9.44" }, - { "Frankfurt am Main", "50.11,8.68" }, - { "Frankfurt an der Oder", "52.350,14.550" }, - { "Freiburg", "47.99,7.84" }, - { "Freigericht", "50.142,9.166" }, - { "Freising", "48.40,11.74" }, - { "Freudenstadt", "48.46,8.41" }, - { "Freyung", "48.80,13.54" }, - { "Friedrichshafen", "47.66,9.48" }, - { "Friesoythe", "53.02,7.85" }, - { "Fritzlar", "51.13,9.27" }, - { "Fulda", "50.55,9.68" }, - { "Fürstenfeldbruck", "48.17,11.24" }, - { "Fürth", "49.47,10.98" }, - { "Garmisch-Partenkirchen", "47.49,11.10" }, - { "Geilenkirchen", "50.97,6.12" }, - { "Gelnhausen", "50.20,9.19" }, - { "Gelsenkirchen", "51.52,7.09" }, - { "Gera", "50.89,12.08" }, - { "Geretsried", "47.86,11.49" }, - { "Germersheim", "49.21,8.37" }, - { "Gettorf", "54.41,9.98" }, - { "Gießen", "50.58,8.68" }, - { "Glauchau", "50.82,12.55" }, - { "Göppingen", "48.71,9.65" }, - { "Görlitz", "51.15,14.97" }, - { "Göttingen", "51.54,9.92" }, - { "Grafenau", "48.86,13.39" }, - { "Grafenwöhr", "49.71,11.91" }, - { "Greifswald", "54.09,13.39" }, - { "Grünberg", "50.59,8.96" }, - { "Gütersloh", "51.90,8.39" }, - { "Hagen", "51.37,7.46" }, - { "Hahn", "49.96,7.27" }, - { "Halle (Saale)", "51.497,11.969" }, - { "Halle (Westfalen)", "52.06,8.36" }, - { "Hamburg", "53.55,9.99" }, - { "Hamm", "51.67,7.82" }, - { "Hanau", "50.13,8.93" }, - { "Hannover", "52.38,9.73" }, - { "Harrislee", "54.80,9.39" }, - { "Heidelberg", "49.40,8.67" }, - { "Heilbronn", "49.14,9.21" }, - { "Helgoland", "54.18,7.89" }, - { "Hennigsdorf", "52.63,13.20" }, - { "Herne", "51.54,7.20" }, - { "Hilden", "51.17,6.93" }, - { "Hildesheim", "52.15,9.96" }, - { "Hinte", "53.41,7.20" }, - { "Hochheim", "50.01,8.36" }, - { "Hockenheimring", "49.33,8.57" }, - { "Hof", "50.31,11.91" }, - { "Holzkirchen", "47.88,11.70" }, - { "Hosten", "49.89,6.62" }, - { "Hürth", "50.88,6.89" }, - { "Husby", "54.50,9.48" }, - { "Husum", "54.48,9.06" }, - { "Idar-Oberstein", "49.71,7.31" }, - { "Ingolstadt", "48.77,11.43" }, - { "Iserlohn", "51.38,7.70" }, - { "Itzehoe", "53.93,9.51" }, - { "Jever", "53.57,7.90" }, - { "Jülich", "50.92,6.36" }, - { "Kall", "50.54,6.56" }, - { "Karlsruhe", "49.01,8.40" }, - { "Kassel", "51.31,9.48" }, - { "Kaufbeuren", "47.88,10.63" }, - { "Kempten", "47.73,10.32" }, - { "Kiel", "54.32,10.12" }, - { "Kitzingen", "49.73,10.15" }, - { "Koblenz", "50.36,7.59" }, - { "Köln", "50.94,6.96" }, - { "Konstanz", "47.68,9.17" }, - { "Krefeld", "51.34,6.59" }, - { "Kronshagen", "54.34,10.09" }, - { "Krumbach", "48.25,10.37" }, - { "Laarbruch", "51.60,6.15" }, - { "Lahr", "48.33,7.87" }, - { "Landshut", "48.54,12.15" }, - { "Langenhagen", "52.45,9.74" }, - { "Lausitzring", "51.54,13.89" }, - { "Lechfeld", "48.19,10.86" }, - { "Leck", "54.77,8.98" }, - { "Leer", "53.24,7.47" }, - { "Leipzig", "51.34,12.37" }, - { "Leverkusen", "51.05,7.02" }, - { "Lindenberg", "47.60,9.89" }, - { "List", "55.02,8.43" }, - { "Lübeck", "53.87,10.69" }, - { "Lüchow", "52.97,11.15" }, - { "Luckenwalde", "52.09,13.16" }, - { "Ludwigsburg", "48.89,9.20" }, - { "Ludwigshafen", "49.48,8.45" }, - { "Lüneburg", "53.25,10.41" }, - { "Magdeburg", "52.12,11.63" }, - { "Mainz", "49.99,8.25" }, - { "Mannheim", "49.49,8.47" }, - { "Marburg", "50.80,8.77" }, - { "Marienfelde", "52.42,13.37" }, - { "Marktbreit", "49.67,10.15" }, - { "Meiningen", "50.57,10.42" }, - { "Memmingen", "47.98,10.18" }, - { "Meppen", "52.70,7.30" }, - { "Merzig", "49.45,6.64" }, - { "Minden", "52.30,8.89" }, - { "Mönchengladbach", "51.18,6.44" }, - { "Mühldorf", "48.25,12.52" }, - { "München", "48.14,11.58" }, - { "Münster", "51.96,7.63" }, - { "Murnau", "47.68,11.20" }, - { "Mylau", "50.62,12.26" }, - { "Naumburg (Saale)", "51.15,11.82" }, - { "Neuberg", "48.11,12.12" }, - { "Neubrandenburg", "53.57,13.28" }, - { "Neumarkt", "49.28,11.47" }, - { "Neumünster", "54.07,9.98" }, - { "Neunkirchen", "49.35,7.19" }, - { "Neuruppin", "52.92,12.80" }, - { "Neuss", "51.20,6.69" }, - { "Neuwied", "50.44,7.47" }, - { "Niendorf (Ostsee)", "53.99,10.83" }, - { "Norden", "53.60,7.20" }, - { "Nordenham", "53.50,8.49" }, - { "Norderney", "53.71,7.16" }, - { "Nordhausen", "51.50,10" }, - { "Nordhausen", "51.50,10" }, - { "Nordheide", "53.12,8.46" }, - { "Nordhorn", "52.43,7.07" }, - { "Nördlingen", "48.85,10.49" }, - { "Nürburgring", "50.34,6.95" }, - { "Oberhausen", "51.50,6.86" }, - { "Oberpfaffenhofen", "48.07,11.26" }, - { "Oberstdorf", "47.41,10.28" }, - { "Ochsenfurt", "49.66,10.07" }, - { "Oeversee", "54.70,9.43" }, - { "Offenbach", "50.10,8.78" }, - { "Oldenburg", "53.14,8.21" }, - { "Oldersum", "53.33,7.34" }, - { "Oranienburg", "52.75,13.24" }, - { "Osnabrück", "52.28,8.05" }, - { "Otterndorf", "53.81,8.90" }, - { "Paderborn", "51.72,8.76" }, - { "Passau", "48.57,13" }, - { "Peine", "52.32,10.24" }, - { "Pfaffenhofen", "48.52,11.50" }, - { "Pfarrkirchen", "48.42,12.94" }, - { "Pforzheim", "48.89,8.69" }, - { "Pinneberg", "53.65,9.79" }, - { "Pirmasens", "49.20,7.60" }, - { "Plauen", "50.50,12.14" }, - { "Pocking", "48.40,13.32" }, - { "Potsdam", "52.39,13.06" }, - { "Prenzlau", "53.32,13.86" }, - { "Quickborn", "53.73,9.91" }, - { "Rastede", "53.24,8.20" }, - { "Recklinghausen", "51.61,7.20" }, - { "Regensburg", "49.01,12.10" }, - { "Remscheid", "51.18,7.19" }, - { "Rendsburg", "54.31,9.66" }, - { "Rennerod", "50.61,8.07" }, - { "Rosenheim", "47.86,12.12" }, - { "Rostock", "54.09,12.10" }, - { "Rüsselsheim", "50.00,8.42" }, - { "Saarbrücken", "49.230,7.000" }, - { "Sahlenburg", "53.870,8.630" }, - { "Salzgitter", "52.080,10.330" }, - { "Salzwedel", "52.850,11.150" }, - { "Schiffdorf", "53.530,8.650" }, - { "Schleswig", "54.520,9.550" }, - { "Schrobenhausen", "48.550,11.270" }, - { "Schwabach", "49.330,11.030" }, - { "Schwäbisch Hall", "49.110,9.730" }, - { "Schweinfurt", "50.050,10.230" }, - { "Schwerin", "53.630,11.380" }, - { "Siegburg", "50.800,7.200" }, - { "Siegen", "50.870,8.030" }, - { "Solingen", "51.180,7.080" }, - { "Starnberg", "48.000,11.350" }, - { "Straubing", "48.880,12.570" }, - { "Stuttgart", "48.770,9.180" }, - { "Sulingen", "52.680,8.800" }, - { "Sylt", "54.880,8.350" }, - { "Tönning", "54.320,8.950" }, - { "Traunstein", "47.87,12.62" }, - { "Travemünde", "53.970,10.870" }, - { "Trier", "49.750,6.630" }, - { "Tübingen", "48.530,9.050" }, - { "Ulm", "48.400,10.000" }, - { "Varel", "53.18,9.49" }, - { "Veitsbronn", "49.520,10.880" }, - { "Villingen-Schwenningen", "48.070,8.450" }, - { "Vilsbiburg", "48.450,12.350" }, - { "Vilshofen", "49.23,12.04" }, - { "Waldkirchen/Bayr.-Wald", "48.730,13.600" }, - { "Wallsbüll", "54.580,9.000" }, - { "Warnemünde", "54.170,12.080" }, - { "Weiden", "49.680,12.160" }, - { "Weimar", "50.980,11.320" }, - { "Weißenburg/Bayern", "49.030,10.980" }, - { "Wernigerode", "51.830,10.780" }, - { "Westerland/Sylt", "54.900,8.300" }, - { "Westerstede", "53.250,7.930" }, - { "Wetzlar", "50.550,8.500" }, - { "Wiesbaden", "50.080,8.250" }, - { "Wilhelmshaven", "53.520,8.130" }, - { "Wittenberge", "53.000,11.750" }, - { "Wittingen", "52.730,10.720" }, - { "Wolfsburg", "52.430,10.800" }, - { "Worms", "49.61,8.31" }, - { "Wuppertal", "51.270,7.180" }, - { "Würzburg", "49.790,9.940" }, - { "Zeven", "53.300,9.280" }, - { "Zirndorf", "49.450,10.950" }, - { "Zwickau", "50.720,12.500" } -}; - -#define WEATHER_LOCATION_OPTION_COUNT (sizeof(WEATHER_LOCATION_OPTIONS)/sizeof(weather_loc)) +#endif diff --git a/src/gui/weather_norway_locations.h b/src/gui/weather_norway_locations.h new file mode 100644 index 000000000..1ec86431e --- /dev/null +++ b/src/gui/weather_norway_locations.h @@ -0,0 +1,334 @@ +/* + Copyright (C) 2017,2018,2019 TangoCash + + “Powered by Dark Sky” https://darksky.net/poweredby/ + + 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; + + 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. +*/ + +#ifndef _WEATHER_NORWAY_LOCATION_H_ +#define _WEATHER_NORWAY_LOCATION_H_ + +#include "weather_locations.h" + +// locations and coords taken from http://www.tageo.com +const weather_loc WEATHER_NORWAY_LOCATION_OPTIONS[] = +{ + { "Agotnes", "60.410,5.020" }, + { "Akrehamn-vedavagen", "59.260,5.200" }, + { "Alesund", "62.480,6.200" }, + { "Algard-figgjo", "58.770,5.850" }, + { "Alta", "69.980,23.270" }, + { "Al", "60.640,8.560" }, + { "Amot-geithus", "59.900,9.900" }, + { "Andalsnes", "52.570,7.720" }, + { "Andebu", "59.330,10.080" }, + { "Andenes", "69.320,16.110" }, + { "Aneby", "60.080,10.870" }, + { "Ardalstangen", "61.240,7.700" }, + { "Arendal", "58.460,8.760" }, + { "Arnes", "60.130,11.470" }, + { "Aroysund", "59.180,10.460" }, + { "Asgardstrand", "59.350,10.460" }, + { "Askim", "59.580,11.160" }, + { "Askoy", "60.400,5.180" }, + { "As", "59.670,10.780" }, + { "Aulifeltet", "60.030,11.400" }, + { "Aursmoen", "59.920,11.430" }, + { "Batsfjord", "70.630,29.730" }, + { "Bergen", "60.380,5.340" }, + { "Biri", "60.970,10.500" }, + { "Birkeland", "58.330,8.230" }, + { "Bjerkvik", "68.560,17.520" }, + { "Bjervamoen", "59.320,9.130" }, + { "Bjorkelangen", "59.880,11.570" }, + { "Bjornevatn", "69.670,29.980" }, + { "Blakstad", "59.820,10.470" }, + { "Bodo", "67.290,14.370" }, + { "Borkenes", "68.780,16.180" }, + { "Bo", "59.420,9.060" }, + { "Brandbu-jaren", "60.430,10.470" }, + { "Brattvag", "62.600,6.450" }, + { "Brekstad", "63.680,9.680" }, + { "Bronnoysund", "65.470,12.220" }, + { "Brumunddal", "60.890,10.930" }, + { "Bryne", "58.730,5.650" }, + { "Buvika-ilhaugen", "63.250,10.070" }, + { "Dokka", "60.830,10.080" }, + { "Dombas", "62.080,9.130" }, + { "Drammen", "59.750,10.200" }, + { "Drobak", "59.670,10.650" }, + { "Egersund", "58.460,6.010" }, + { "Eidsvoll", "60.340,11.270" }, + { "Eike", "59.400,5.360" }, + { "Elnesvagen", "62.860,7.150" }, + { "Elverum", "60.890,11.540" }, + { "Espeland", "60.380,5.470" }, + { "Evje", "68.270,13.730" }, + { "Fagernes", "60.990,9.250" }, + { "Fagerstrand", "59.730,10.590" }, + { "Fanahammeren", "60.260,5.340" }, + { "Farsund", "58.090,6.780" }, + { "Fauske", "67.250,15.400" }, + { "Fetsund", "59.930,11.170" }, + { "Fevik", "58.380,8.700" }, + { "Finnsnes", "69.230,17.980" }, + { "Fitjar", "59.920,5.320" }, + { "Flateby", "59.830,11.170" }, + { "Flekkefjord", "58.310,6.680" }, + { "Flisa", "60.620,12.030" }, + { "Floro", "61.600,5.030" }, + { "Fordesfjorden", "59.420,5.400" }, + { "Forde", "61.460,5.870" }, + { "Fosnavag-leinstrand", "62.350,5.650" }, + { "Fredrikstad-sarpsborg", "59.240,10.940" }, + { "Frekhaug", "60.520,5.250" }, + { "Geilo", "60.520,8.200" }, + { "Gjovik", "60.790,10.650" }, + { "Gjusvik", "58.200,8.030" }, + { "Glomfjord", "66.820,13.970" }, + { "Gol", "60.700,8.950" }, + { "Gran-ringstad", "60.370,10.570" }, + { "Granrudmoen", "61.280,10.440" }, + { "Gravdal", "68.120,13.500" }, + { "Grimstad", "58.350,8.600" }, + { "Gronlund", "60.080,11.100" }, + { "Gronvoll", "60.120,10.940" }, + { "Grua", "60.270,10.670" }, + { "Gullhaug", "59.500,10.250" }, + { "Hagavik", "60.180,5.430" }, + { "Halden", "59.130,11.370" }, + { "Hamar", "60.810,11.080" }, + { "Hammerfest", "70.680,23.710" }, + { "Hareid", "62.370,6.030" }, + { "Harestua", "60.100,10.720" }, + { "Harstad", "68.810,16.520" }, + { "Haugesund", "59.420,5.270" }, + { "Hauge", "58.350,6.280" }, + { "Hauknes", "66.280,14.070" }, + { "Helgeroa-nevlunghamn", "59.000,9.850" }, + { "Hermannsverk-leikanger", "61.190,6.780" }, + { "Herre", "59.100,9.570" }, + { "Hesseng", "69.680,29.990" }, + { "Holmestrand", "59.500,10.310" }, + { "Hommelvik", "63.420,10.800" }, + { "Hommersak", "58.930,5.850" }, + { "Honefoss", "60.190,10.230" }, + { "Honningsvag", "70.980,25.980" }, + { "Horten", "59.420,10.470" }, + { "Hov", "60.710,10.360" }, + { "Hoyanger", "61.220,6.080" }, + { "Husnes", "59.870,5.770" }, + { "Hylkje", "60.510,5.350" }, + { "Indre arna", "60.420,5.480" }, + { "Innbygda", "61.320,12.270" }, + { "Jessheim", "60.150,11.180" }, + { "Jevnaker", "60.260,10.400" }, + { "Jorpeland", "59.020,6.050" }, + { "Jorstadmoen-faberg", "61.170,10.420" }, + { "Kabelvag", "68.210,14.480" }, + { "Kapp", "60.710,10.860" }, + { "Karasjok", "69.450,25.500" }, + { "Karlshus", "59.350,10.870" }, + { "Kautokeino", "68.980,23.130" }, + { "Kirkenaer", "60.470,12.050" }, + { "Kirkenes", "69.730,30.030" }, + { "Kjenner", "59.790,10.280" }, + { "Klaebu", "64.080,11.730" }, + { "Kleppe-verdalen", "58.780,5.640" }, + { "Klofta", "60.070,11.150" }, + { "Knarrevik-straume", "60.370,5.160" }, + { "Knarvik", "60.540,5.290" }, + { "Kolvereid", "64.850,11.600" }, + { "Kongsberg", "59.670,9.630" }, + { "Kongsvinger", "60.200,11.990" }, + { "Kopervik", "59.290,5.310" }, + { "Koppang", "61.570,11.070" }, + { "Kragero", "58.870,9.400" }, + { "Kristiansand", "58.150,7.990" }, + { "Kristiansund", "63.120,7.760" }, + { "Kvernaland", "58.790,5.730" }, + { "Kyrksaeterora", "63.280,9.100" }, + { "Lakselv", "70.050,24.930" }, + { "Larkollen", "59.330,10.670" }, + { "Larvik", "59.070,9.990" }, + { "Lauve-viksjord", "59.070,10.150" }, + { "Leirvik", "59.800,5.490" }, + { "Leknes", "68.160,13.600" }, + { "Lervik", "59.270,10.760" }, + { "Levanger", "63.750,11.320" }, + { "Lierbyen", "59.830,10.250" }, + { "Liknes", "58.320,58.320" }, + { "Lillehammer", "61.120,10.470" }, + { "Lillesand", "58.250,8.390" }, + { "Lodingen", "68.420,15.960" }, + { "Loding", "67.300,14.750" }, + { "Lopsmarka", "67.320,14.450" }, + { "Lostad", "60.110,10.930" }, + { "Loten", "60.810,11.330" }, + { "Lyefjell", "58.750,5.750" }, + { "Lyngdal", "58.150,7.100" }, + { "Maloy", "61.930,5.110" }, + { "Malvik", "63.430,10.680" }, + { "Mandal", "58.030,7.440" }, + { "Maura", "60.260,11.040" }, + { "Melbu", "68.510,14.800" }, + { "Melhus", "63.300,10.290" }, + { "Melsomvik", "59.230,10.340" }, + { "Moelv", "60.930,10.700" }, + { "Moi", "58.460,6.540" }, + { "Molde", "62.740,7.180" }, + { "Mosjoen", "65.840,13.220" }, + { "Moss", "59.430,10.680" }, + { "Mo i rana", "66.330,14.170" }, + { "Myre", "69.110,15.960" }, + { "Mysen", "59.560,11.330" }, + { "Naerbo", "58.670,5.650" }, + { "Namsos", "64.480,11.520" }, + { "Narvik", "68.450,17.420" }, + { "Nesbyen", "60.580,9.110" }, + { "Nesna", "66.210,13.030" }, + { "Nesoddtangen", "59.860,10.670" }, + { "Nodeland", "58.160,7.840" }, + { "Nordfjordeid", "61.900,6.000" }, + { "Nordstrand", "62.510,6.050" }, + { "Norheimsund", "60.370,6.140" }, + { "Notodden", "59.570,9.260" }, + { "Odda", "60.070,6.540" }, + { "Oppdal", "62.600,9.660" }, + { "Orje", "59.480,11.670" }, + { "Orkanger-fannrem", "63.300,9.860" }, + { "Ornes", "66.870,13.700" }, + { "Orsta", "62.210,6.140" }, + { "Oslo", "59.910,10.750" }, + { "Osoyro", "60.190,5.450" }, + { "Otta", "61.780,9.520" }, + { "Ovre ardal", "61.320,7.810" }, + { "Oystese", "60.400,6.210" }, + { "Porsgrunn-skien", "59.150,9.660" }, + { "Raholt", "60.270,11.180" }, + { "Rakkestad", "59.420,11.360" }, + { "Raufoss", "60.730,10.630" }, + { "Rena", "61.150,11.330" }, + { "Rensvik", "63.100,7.820" }, + { "Revetal-bergsasen", "59.360,10.280" }, + { "Ringebu", "61.550,10.110" }, + { "Risor", "58.730,9.220" }, + { "Rjukan", "59.880,8.560" }, + { "Roa-lunner", "60.300,10.620" }, + { "Rognan", "67.100,15.390" }, + { "Roros", "62.580,11.380" }, + { "Rorvik", "64.870,11.240" }, + { "Rotnes", "60.050,10.880" }, + { "Royken", "59.750,10.380" }, + { "Ryggebyen", "59.390,10.720" }, + { "Rypefjord", "70.630,23.670" }, + { "Saetre", "59.680,10.520" }, + { "Sagvag", "59.780,5.380" }, + { "Sandane", "61.780,6.220" }, + { "Sandefjord", "59.140,10.210" }, + { "Sande", "59.590,10.210" }, + { "Sandnessjoen", "66.020,12.630" }, + { "Sauda", "59.650,6.340" }, + { "Selvik", "59.570,10.270" }, + { "Sem", "59.290,10.300" }, + { "Setermoen", "68.890,18.330" }, + { "Siggerud", "59.810,10.880" }, + { "Silsand", "69.230,17.930" }, + { "Skalevik", "58.080,8.010" }, + { "Skarnes", "60.250,11.700" }, + { "Skei-surnadalsora", "62.970,8.650" }, + { "Skiptvet", "59.460,11.180" }, + { "Ski", "59.720,10.830" }, + { "Skjeberg", "59.220,11.200" }, + { "Skjervoy", "70.050,21.000" }, + { "Skjonhaug", "59.640,11.310" }, + { "Skodje", "62.510,6.670" }, + { "Skogn", "63.710,11.230" }, + { "Skoppum", "59.380,10.420" }, + { "Skotterud", "59.980,12.130" }, + { "Skreia", "60.650,10.940" }, + { "Skudeneshamn", "59.160,5.250" }, + { "Skulestadmoen", "60.690,6.450" }, + { "Softeland", "60.250,5.430" }, + { "Sogndalsfjora", "60.250,5.440" }, + { "Sogne", "58.100,7.780" }, + { "Son-store", "4700,59.520" }, + { "Sorreisa", "69.150,18.120" }, + { "Sortland", "68.710,15.380" }, + { "Sorumsand", "59.990,11.260" }, + { "Spetalen", "60.180,11.900" }, + { "Spydeberg", "59.620,11.090" }, + { "Stange", "60.730,11.220" }, + { "Stavanger", "58.970,5.710" }, + { "Stavern", "59.000,10.030" }, + { "Steinkjer", "64.020,11.480" }, + { "Steinsasen", "60.090,10.270" }, + { "Stjordalshalsen", "63.480,10.940" }, + { "Stokke", "59.230,10.310" }, + { "Stokmarknes", "68.560,14.910" }, + { "Storen", "63.040,10.260" }, + { "Storslett", "69.770,21.070" }, + { "Stranda", "62.320,6.930" }, + { "Stryn", "61.920,6.780" }, + { "Sunde-valen", "59.850,5.710" }, + { "Sunndalsora", "62.680,8.580" }, + { "Svelvik", "59.620,10.410" }, + { "Svolvaer", "68.260,14.550" }, + { "Svortland", "59.770,5.120" }, + { "Sykkylven", "62.400,6.590" }, + { "Tananger", "58.940,5.600" }, + { "Tau", "59.080,5.920" }, + { "Teigebyen", "60.230,11.000" }, + { "Tjome", "59.130,10.390" }, + { "Tofte", "59.570,10.610" }, + { "Togrenda", "59.740,10.750" }, + { "Tomter", "59.670,11.010" }, + { "Tonsberg", "59.270,10.420" }, + { "Tranby", "59.790,10.280" }, + { "Tromso", "69.660,18.940" }, + { "Trondheim", "63.440,10.400" }, + { "Tvedestrand", "58.620,8.930" }, + { "Tveit", "58.260,8.130" }, + { "Tynset", "62.280,10.770" }, + { "Ulefoss", "59.280,9.260" }, + { "Ulsteinvik", "62.340,5.870" }, + { "Vadfoss-helle", "58.900,9.360" }, + { "Vadso", "70.090,29.740" }, + { "Vagamo", "61.880,9.110" }, + { "Vang", "60.210,10.330" }, + { "Vanse", "58.100,6.690" }, + { "Vardo", "70.390,31.060" }, + { "Varhaug", "58.630,5.650" }, + { "Vatne", "62.560,6.620" }, + { "Vear", "59.250,10.360" }, + { "Vennesla", "58.260,7.960" }, + { "Verdalsora", "63.800,11.490" }, + { "Vestby", "59.600,10.740" }, + { "Vestfossen", "58.750,9.870" }, + { "Vestnes", "62.620,7.080" }, + { "Vigrestad", "58.580,5.680" }, + { "Vikersund", "59.990,10.010" }, + { "Vinstra", "61.600,9.750" }, + { "Volda", "62.150,6.070" }, + { "Vossevangen", "60.640,6.430" }, + { "Ytre arna", "60.470,5.430" }, + { "Ytre enebakk", "59.730,11.060" } +}; + +#define WEATHER_NORWAY_LOCATION_OPTION_COUNT (sizeof(WEATHER_NORWAY_LOCATION_OPTIONS)/sizeof(weather_loc)) + +#endif diff --git a/src/gui/widget/keyboard_input.cpp b/src/gui/widget/keyboard_input.cpp index 8605d2a29..4f36e3c2a 100644 --- a/src/gui/widget/keyboard_input.cpp +++ b/src/gui/widget/keyboard_input.cpp @@ -485,6 +485,9 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) { changed = false; CVFD::getInstance()->showMenuText(1, inputString->c_str() , selected+1); +#ifdef ENABLE_GRAPHLCD + cGLCD::lockChannel(inputString->c_str(), "", 0); +#endif } g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd, true); @@ -588,6 +591,10 @@ int CKeyboardInput::exec(CMenuTarget* parent, const std::string &) OnAfterSave(); } +#ifdef ENABLE_GRAPHLCD + cGLCD::unlockChannel(); +#endif + return res; } diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index d59b759db..038af77ef 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -262,7 +262,7 @@ void CMenuItem::paintItemCaption(const bool select_mode, const char * right_text #ifdef ENABLE_GRAPHLCD if (g_settings.glcd_enable) - nGLCD::lockChannel(g_Locale->getText(LOCALE_MAINMENU_HEAD), graphlcd_text, 0); + cGLCD::lockChannel(g_Locale->getText(LOCALE_MAINMENU_HEAD), graphlcd_text, 0); #endif if (g_settings.lcd4l_support) LCD4l->CreateFile("/tmp/lcd/menu", lcd4l_text, g_settings.lcd4l_convert); @@ -1036,7 +1036,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) case (CRCInput::RC_ok): if (hasItem() && selected > -1 && (int)items.size() > selected) { #ifdef ENABLE_GRAPHLCD - nGLCD::unlockChannel(); + cGLCD::unlockChannel(); #endif LCD4l->RemoveFile("/tmp/lcd/menu"); @@ -1055,7 +1055,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) #ifdef ENABLE_GRAPHLCD if (g_settings.glcd_enable) - nGLCD::lockChannel(g_Locale->getText(LOCALE_MAINMENU_HEAD), item->graphlcd_text, 0); + cGLCD::lockChannel(g_Locale->getText(LOCALE_MAINMENU_HEAD), item->graphlcd_text, 0); #endif if (g_settings.lcd4l_support) LCD4l->CreateFile("/tmp/lcd/menu", item->lcd4l_text, g_settings.lcd4l_convert); @@ -1145,7 +1145,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &) CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); #ifdef ENABLE_GRAPHLCD - nGLCD::unlockChannel(); + cGLCD::unlockChannel(); #endif LCD4l->RemoveFile("/tmp/lcd/menu"); diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index b29f4e080..fed248c07 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -412,6 +412,9 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) if (*valueString != dispval) { CVFD::getInstance()->showMenuText(1,valueString->c_str() , selected+1); +#ifdef ENABLE_GRAPHLCD + cGLCD::lockChannel(valueString->c_str(), "", 0); +#endif dispval = *valueString; } @@ -535,6 +538,9 @@ int CStringInput::exec( CMenuTarget* parent, const std::string & ) { observ->changeNotify(name, (void *) valueString->c_str()); } +#ifdef ENABLE_GRAPHLCD + cGLCD::unlockChannel(); +#endif return res; } diff --git a/src/gui/widget/stringinput_ext.cpp b/src/gui/widget/stringinput_ext.cpp index 192440491..a9a665e65 100644 --- a/src/gui/widget/stringinput_ext.cpp +++ b/src/gui/widget/stringinput_ext.cpp @@ -196,6 +196,9 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) if (*valueString != dispval) { CVFD::getInstance()->showMenuText(1, valueString->c_str(), selectedChar+1); +#ifdef ENABLE_GRAPHLCD + cGLCD::lockChannel(valueString->c_str(), "", 0); +#endif dispval = *valueString; } @@ -225,6 +228,9 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) inputFields[oldSelectedChar]->paint(x+ offset, y+ hheight+ offset, false ); inputFields[selectedChar]->paint(x+ offset, y+ hheight+ offset, true ); CVFD::getInstance()->showMenuText(1, valueString->c_str(), selectedChar+1); +#ifdef ENABLE_GRAPHLCD + cGLCD::lockChannel(valueString->c_str(), "", 0); +#endif } } else if (msg==CRCInput::RC_right) { bool found = false; @@ -252,6 +258,9 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) inputFields[oldSelectedChar]->paint(x+ offset, y+ hheight+ offset, false ); inputFields[selectedChar]->paint(x+ offset, y+ hheight+ offset, true ); CVFD::getInstance()->showMenuText(1, valueString->c_str(), selectedChar+1); +#ifdef ENABLE_GRAPHLCD + cGLCD::lockChannel(valueString->c_str(), "", 0); +#endif } } else if ( (*CRCInput::getUnicodeValue(msg)) || (msg == CRCInput::RC_red) || (msg == CRCInput::RC_green) || (msg == CRCInput::RC_blue) || (msg == CRCInput::RC_yellow) @@ -314,6 +323,10 @@ int CExtendedInput::exec( CMenuTarget* parent, const std::string & ) if ((observ) && (msg == CRCInput::RC_ok)) observ->changeNotify(name, (void *)valueString->c_str()); +#ifdef ENABLE_GRAPHLCD + cGLCD::unlockChannel(); +#endif + return res; } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index a053336e0..8d66af892 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -75,6 +75,9 @@ #include "gui/favorites.h" #include "gui/filebrowser.h" #include "gui/followscreenings.h" +#ifdef ENABLE_GRAPHLCD +#include "gui/glcdthemes.h" +#endif #include "gui/hdd_menu.h" #include "gui/infoviewer.h" #include "gui/mediaplayer.h" @@ -359,6 +362,11 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.theme_name = configfile.getString("theme_name", !access(NEUTRINO_SETTINGS_FILE, F_OK) ? MIGRATE_THEME_NAME : ""); CThemes::getInstance()->getTheme(configfile); +#ifdef ENABLE_GRAPHLCD + g_settings.glcd_theme_name = configfile.getString("glcd_theme_name", !access(NEUTRINO_SETTINGS_FILE, F_OK) ? MIGRATE_THEME_OLED_NAME : ""); + CGLCDThemes::getInstance()->getTheme(configfile); +#endif + //NI g_settings.inetradio_autostart = configfile.getInt32("inetradio_autostart" , 0); g_settings.lcd4l_support = configfile.getInt32("lcd4l_support" , 0); @@ -685,27 +693,17 @@ int CNeutrinoApp::loadSetup(const char * fname) #ifdef ENABLE_GRAPHLCD g_settings.glcd_enable = configfile.getInt32("glcd_enable", 1); - g_settings.glcd_color_fg = configfile.getInt32("glcd_color_fg", GLCD::cColor::White); - g_settings.glcd_color_bg = configfile.getInt32("glcd_color_bg", GLCD::cColor::Black); - g_settings.glcd_color_bar = configfile.getInt32("glcd_color_bar", GLCD::cColor::Gray); - g_settings.glcd_percent_channel = configfile.getInt32("glcd_percent_channel", 22); - g_settings.glcd_percent_epg = configfile.getInt32("glcd_percent_epg", 16); - g_settings.glcd_percent_bar = configfile.getInt32("glcd_percent_bar", 8); - g_settings.glcd_percent_time = configfile.getInt32("glcd_percent_time", 35); - g_settings.glcd_percent_time_standby = configfile.getInt32("glcd_percent_time_standby", 50); - g_settings.glcd_percent_logo = configfile.getInt32("glcd_percent_logo", 50); + + g_settings.glcd_time_in_standby = configfile.getInt32("glcd_time_in_standby", 1); + g_settings.glcd_standby_weather = configfile.getInt32("glcd_standby_weather", 1); + g_settings.glcd_mirror_osd = configfile.getInt32("glcd_mirror_osd", 0); g_settings.glcd_mirror_video = configfile.getInt32("glcd_mirror_video", 0); - g_settings.glcd_time_in_standby = configfile.getInt32("glcd_time_in_standby", 1); g_settings.glcd_show_logo = configfile.getInt32("glcd_show_logo", 1); - g_settings.glcd_font = configfile.getString("glcd_font", FONTDIR "/neutrino.ttf"); -#if BOXMODEL_VUUNO4KSE - g_settings.glcd_brightness = configfile.getInt32("glcd_brightness", 25); - g_settings.glcd_brightness_standby = configfile.getInt32("glcd_brightness_standby", 5); -#else - g_settings.glcd_brightness = configfile.getInt32("glcd_brightness", 75); - g_settings.glcd_brightness_standby = configfile.getInt32("glcd_brightness_standby", 45); -#endif + g_settings.glcd_brightness = configfile.getInt32("glcd_brightness", GLCD_DEFAULT_BRIGHTNESS); + g_settings.glcd_brightness_dim = configfile.getInt32("glcd_brightness_dim", GLCD_DEFAULT_BRIGHTNESS_DIM); + g_settings.glcd_brightness_standby = configfile.getInt32("glcd_brightness_standby", GLCD_DEFAULT_BRIGHTNESS_STANDBY); + g_settings.glcd_brightness_dim_time = configfile.getString("glcd_brightness_dim_time", GLCD_DEFAULT_BRIGHTNESS_DIM_TIME); #if BOXMODEL_VUUNO4KSE g_settings.glcd_scroll_speed = configfile.getInt32("glcd_scroll_speed", 1); #elif BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUULTIMO4K @@ -713,7 +711,7 @@ int CNeutrinoApp::loadSetup(const char * fname) #else g_settings.glcd_scroll_speed = configfile.getInt32("glcd_scroll_speed", 5); #endif - g_settings.glcd_selected_config = configfile.getInt32("glcd_selected_config", 0); + //g_settings.glcd_selected_config = configfile.getInt32("glcd_selected_config", 0); #endif //personalize @@ -1069,6 +1067,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.weather_api_key = configfile.getString("weather_api_key", g_settings.weather_api_key.empty() ? "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" : g_settings.weather_api_key); #endif g_settings.weather_enabled = configfile.getInt32("weather_enabled", 1); + g_settings.weather_country = configfile.getInt32("weather_country", 0); g_settings.weather_enabled = g_settings.weather_enabled && CApiKey::check_weather_api_key(); g_settings.weather_location = configfile.getString("weather_location", "52.52,13.40" ); @@ -1430,6 +1429,11 @@ void CNeutrinoApp::saveSetup(const char * fname) CThemes::getInstance()->setTheme(configfile); configfile.setString( "theme_name", g_settings.theme_name ); +#ifdef ENABLE_GRAPHLCD + CGLCDThemes::getInstance()->setTheme(configfile); + configfile.setString( "glcd_theme_name", g_settings.glcd_theme_name ); +#endif + //NI configfile.setInt32("inetradio_autostart" , g_settings.inetradio_autostart); configfile.setInt32("lcd4l_support" , g_settings.lcd4l_support); @@ -1669,24 +1673,17 @@ void CNeutrinoApp::saveSetup(const char * fname) #ifdef ENABLE_GRAPHLCD configfile.setInt32("glcd_enable", g_settings.glcd_enable); - configfile.setInt32("glcd_color_fg", g_settings.glcd_color_fg); - configfile.setInt32("glcd_color_bg", g_settings.glcd_color_bg); - configfile.setInt32("glcd_color_bar", g_settings.glcd_color_bar); - configfile.setInt32("glcd_percent_channel", g_settings.glcd_percent_channel); - configfile.setInt32("glcd_percent_epg", g_settings.glcd_percent_epg); - configfile.setInt32("glcd_percent_bar", g_settings.glcd_percent_bar); - configfile.setInt32("glcd_percent_time", g_settings.glcd_percent_time); - configfile.setInt32("glcd_percent_time_standby", g_settings.glcd_percent_time_standby); - configfile.setInt32("glcd_percent_logo", g_settings.glcd_percent_logo); + configfile.setInt32("glcd_time_in_standby", g_settings.glcd_time_in_standby); + configfile.setInt32("glcd_standby_weather", g_settings.glcd_standby_weather); configfile.setInt32("glcd_mirror_osd", g_settings.glcd_mirror_osd); configfile.setInt32("glcd_mirror_video", g_settings.glcd_mirror_video); - configfile.setInt32("glcd_time_in_standby", g_settings.glcd_time_in_standby); configfile.setInt32("glcd_show_logo", g_settings.glcd_show_logo); - configfile.setString("glcd_font", g_settings.glcd_font); configfile.setInt32("glcd_brightness", g_settings.glcd_brightness); + configfile.setInt32("glcd_brightness_dim", g_settings.glcd_brightness_dim); configfile.setInt32("glcd_brightness_standby", g_settings.glcd_brightness_standby); configfile.setInt32("glcd_scroll_speed", g_settings.glcd_scroll_speed); - configfile.setInt32("glcd_selected_config", g_settings.glcd_selected_config); + configfile.setString("glcd_brightness_dim_time", g_settings.glcd_brightness_dim_time); + //configfile.setInt32("glcd_selected_config", g_settings.glcd_selected_config); #endif //personalize @@ -1935,7 +1932,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setString( "weather_api_key", g_settings.weather_api_key ); #endif configfile.setInt32( "weather_enabled", g_settings.weather_enabled ); - + configfile.setInt32( "weather_country", g_settings.weather_country ); configfile.setString( "weather_location", g_settings.weather_location ); configfile.setString( "weather_city", g_settings.weather_city ); @@ -2293,36 +2290,51 @@ void CNeutrinoApp::SetChannelMode(int newmode) switch(newmode) { case LIST_MODE_FAV: - if (isRadioMode) + if (isRadioMode) { +#ifdef ENABLE_GRAPHLCD + cGLCD::MirrorOSD(false); +#endif bouquetList = RADIOfavList; - else + } else bouquetList = TVfavList; break; case LIST_MODE_SAT: - if (isRadioMode) + if (isRadioMode) { +#ifdef ENABLE_GRAPHLCD + cGLCD::MirrorOSD(false); +#endif bouquetList = RADIOsatList; - else + } else bouquetList = TVsatList; break; case LIST_MODE_WEB: - if (isRadioMode) + if (isRadioMode) { +#ifdef ENABLE_GRAPHLCD + cGLCD::MirrorOSD(false); +#endif bouquetList = RADIOwebList; - else + } else bouquetList = TVwebList; break; case LIST_MODE_ALL: - if (isRadioMode) + if (isRadioMode) { +#ifdef ENABLE_GRAPHLCD + cGLCD::MirrorOSD(false); +#endif bouquetList = RADIOallList; - else + } else bouquetList = TVallList; break; default: newmode = LIST_MODE_PROV; /* fall through */ case LIST_MODE_PROV: - if (isRadioMode) + if (isRadioMode) { +#ifdef ENABLE_GRAPHLCD + cGLCD::MirrorOSD(false); +#endif bouquetList = RADIObouquetList; - else + } else bouquetList = TVbouquetList; break; } @@ -2769,7 +2781,7 @@ TIMER_START(); CVFD::getInstance()->setScrollMode(g_settings.lcd_scroll); #ifdef ENABLE_GRAPHLCD - nGLCD::getInstance(); + cGLCD::getInstance(); #endif if (!scanSettings.loadSettings(NEUTRINO_SCAN_SETTINGS_FILE)) @@ -2951,6 +2963,13 @@ TIMER_START(); CVFD::getInstance()->showVolume(g_settings.current_volume, false); //CVFD::getInstance()->setMuted(current_muted); +#ifdef ENABLE_GRAPHLCD + if (current_muted) + cGLCD::lockIcon(cGLCD::MUTE); + else + cGLCD::unlockIcon(cGLCD::MUTE); +#endif + if (show_startwizard) { hintBox->hide(); CStartUpWizard startwizard; @@ -3433,7 +3452,7 @@ void CNeutrinoApp::RealRun() } #ifdef ENABLE_GRAPHLCD if (msg == NeutrinoMessages::EVT_CURRENTNEXT_EPG) { - nGLCD::Update(); + cGLCD::Update(); } #endif } @@ -3718,7 +3737,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) CVFD::getInstance()->UpdateIcons(); #ifdef ENABLE_GRAPHLCD - nGLCD::Update(); + cGLCD::Update(); #endif g_RCInput->killTimer(scrambled_timer); if (mode != NeutrinoModes::mode_webtv) { @@ -3901,7 +3920,8 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) //switch lcd off/on CVFD::getInstance()->togglePower(); #ifdef ENABLE_GRAPHLCD - nGLCD::TogglePower(); + if (g_settings.glcd_enable) + cGLCD::TogglePower(); #endif } else { @@ -4575,7 +4595,7 @@ void CNeutrinoApp::ExitRun(int exit_code) #ifdef ENABLE_GRAPHLCD if (exit_code == CNeutrinoApp::EXIT_SHUTDOWN) - nGLCD::SetBrightness(0); + cGLCD::SetBrightness(0); #endif Cleanup(); @@ -4746,7 +4766,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) fclose(f); #ifdef ENABLE_GRAPHLCD - nGLCD::StandbyMode(true); + cGLCD::StandbyMode(true); #endif CVFD::getInstance()->ShowText("Standby ..."); if( mode == NeutrinoModes::mode_scart ) { @@ -4841,7 +4861,8 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) g_RCInput->killTimer(fst_timer); #ifdef ENABLE_GRAPHLCD - nGLCD::StandbyMode(false); + cGLCD::Resume(); + cGLCD::StandbyMode(false); #endif if(init_cec_setting){ @@ -5287,7 +5308,7 @@ void stop_daemons(bool stopall, bool for_flash) tuxtxt_close(); #ifdef ENABLE_GRAPHLCD - nGLCD::Exit(); + cGLCD::Exit(); #endif if (g_Radiotext) { @@ -5622,7 +5643,7 @@ void CNeutrinoApp::StopSubtitles(bool enable_glcd_mirroring) } #ifdef ENABLE_GRAPHLCD if (enable_glcd_mirroring) - nGLCD::MirrorOSD(g_settings.glcd_mirror_osd); + cGLCD::MirrorOSD(g_settings.glcd_mirror_osd); #else (void) enable_glcd_mirroring; // avoid compiler warning #endif @@ -5634,7 +5655,7 @@ void CNeutrinoApp::StartSubtitles(bool show) { //printf("%s: %s\n", __FUNCTION__, show ? "Show" : "Not show"); #ifdef ENABLE_GRAPHLCD - nGLCD::MirrorOSD(false); + cGLCD::MirrorOSD(false); #endif if(!show) return; diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 2da8f3f11..1ff9f7d3f 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -35,6 +35,7 @@ #include #include //for relodplugins #include +#include #include #include #include @@ -202,6 +203,9 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]= {"reloadchannels", &CControlAPI::ReloadChannelsCGI, ""}, #ifdef SCREENSHOT {"screenshot", &CControlAPI::ScreenshotCGI, ""}, +#endif +#ifdef ENABLE_GRAPHLCD + {"glcdscreenshot", &CControlAPI::GlcdScreenshotCGI, ""}, #endif // boxcontrol - devices {"volume", &CControlAPI::VolumeCGI, "text/plain"}, @@ -2177,6 +2181,23 @@ void CControlAPI::ScreenshotCGI(CyhookHandler *hh) } } #endif +#ifdef ENABLE_GRAPHLCD +void CControlAPI::GlcdScreenshotCGI(CyhookHandler *hh) +{ + std::string filename = "/tmp/glcdscreenshot.png"; + + if(!hh->ParamList["name"].empty()) + filename = hh->ParamList["name"]; + + cGLCD *cglcd = cGLCD::getInstance(); + if (cglcd) { + if (cglcd->dumpBuffer((uint32_t*)cglcd->bitmap->Data(), cGLCD::PNG, filename.c_str())) + hh->SendOk(); + else + hh->SendError(); + } +} +#endif //----------------------------------------------------------------------------- void CControlAPI::ZaptoCGI(CyhookHandler *hh) diff --git a/src/nhttpd/tuxboxapi/controlapi.h b/src/nhttpd/tuxboxapi/controlapi.h index 597fea1bc..534e9afb5 100644 --- a/src/nhttpd/tuxboxapi/controlapi.h +++ b/src/nhttpd/tuxboxapi/controlapi.h @@ -105,6 +105,7 @@ private: void ReloadPluginsCGI(CyhookHandler *hh); void ReloadChannelsCGI(CyhookHandler *hh); void ScreenshotCGI(CyhookHandler *hh); + void GlcdScreenshotCGI(CyhookHandler *hh); void ZaptoCGI(CyhookHandler *hh); void StartPluginCGI(CyhookHandler *hh); void LCDAction(CyhookHandler *hh); diff --git a/src/system/locals.h b/src/system/locals.h index 33f5c7779..6914c93e6 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -913,10 +913,24 @@ typedef enum LOCALE_FSK_TO_12, LOCALE_FSK_TO_16, LOCALE_FSK_TO_7, + LOCALE_GLCD_ALIGN_CENTER, + LOCALE_GLCD_ALIGN_CHANNEL, + LOCALE_GLCD_ALIGN_DURATION, + LOCALE_GLCD_ALIGN_END, + LOCALE_GLCD_ALIGN_EPG, + LOCALE_GLCD_ALIGN_LEFT, + LOCALE_GLCD_ALIGN_NONE, + LOCALE_GLCD_ALIGN_RIGHT, + LOCALE_GLCD_ALIGN_START, + LOCALE_GLCD_ALIGN_TIME, + LOCALE_GLCD_BAR_WIDTH, + LOCALE_GLCD_BAR_X_POSITION, + LOCALE_GLCD_BAR_Y_POSITION, LOCALE_GLCD_BRIGHTNESS, + LOCALE_GLCD_BRIGHTNESS_DIM, + LOCALE_GLCD_BRIGHTNESS_DIM_TIME, + LOCALE_GLCD_BRIGHTNESS_SETTINGS, LOCALE_GLCD_BRIGHTNESS_STANDBY, - LOCALE_GLCD_CLOCK_ANALOG, - LOCALE_GLCD_CLOCK_DIGITAL_HM, LOCALE_GLCD_COLOR_AMBER, LOCALE_GLCD_COLOR_BLACK, LOCALE_GLCD_COLOR_BLUE, @@ -938,25 +952,62 @@ typedef enum LOCALE_GLCD_COLOR_TEAL, LOCALE_GLCD_COLOR_WHITE, LOCALE_GLCD_COLOR_YELLOW, + LOCALE_GLCD_CHANNEL_X_POSITION, + LOCALE_GLCD_CHANNEL_Y_POSITION, + LOCALE_GLCD_DIGITAL_CLOCK_Y_POSITION, LOCALE_GLCD_DISPLAY, + LOCALE_GLCD_DURATION_X_POSITION, + LOCALE_GLCD_DURATION_Y_POSITION, LOCALE_GLCD_ENABLE, + LOCALE_GLCD_END_X_POSITION, + LOCALE_GLCD_END_Y_POSITION, + LOCALE_GLCD_EPG_X_POSITION, + LOCALE_GLCD_EPG_Y_POSITION, LOCALE_GLCD_FONT, + LOCALE_GLCD_FONT_AUTORESIZE, LOCALE_GLCD_HEAD, + LOCALE_GLCD_LOGO_X_POSITION, + LOCALE_GLCD_LOGO_Y_POSITION, LOCALE_GLCD_MIRROR_OSD, LOCALE_GLCD_MIRROR_VIDEO, + LOCALE_GLCD_POSITION_SETTINGS, LOCALE_GLCD_RESTART, LOCALE_GLCD_SCROLL_SPEED, LOCALE_GLCD_SELECT_BAR, LOCALE_GLCD_SELECT_BG, LOCALE_GLCD_SELECT_FG, + LOCALE_GLCD_SHOW_DURATION, + LOCALE_GLCD_SHOW_END, LOCALE_GLCD_SHOW_LOGO, + LOCALE_GLCD_SHOW_PROGRESSBAR, + LOCALE_GLCD_SHOW_START, + LOCALE_GLCD_SHOW_TIME, + LOCALE_GLCD_SHOW_WEATHER, + LOCALE_GLCD_SIMPLE_CLOCK_Y_POSITION, LOCALE_GLCD_SIZE_BAR, LOCALE_GLCD_SIZE_CHANNEL, + LOCALE_GLCD_SIZE_DURATION, + LOCALE_GLCD_SIZE_END, LOCALE_GLCD_SIZE_EPG, LOCALE_GLCD_SIZE_LOGO, + LOCALE_GLCD_SIZE_SIMPLE_CLOCK, + LOCALE_GLCD_SIZE_START, LOCALE_GLCD_SIZE_TIME, LOCALE_GLCD_SIZE_TIME_STANDBY, + LOCALE_GLCD_THEME, + LOCALE_GLCD_THEME_POSITION_SETTINGS, + LOCALE_GLCD_THEME_SETTINGS, + LOCALE_GLCD_STANDBY_ANALOG_CLOCK, + LOCALE_GLCD_STANDBY_DIGITAL_CLOCK, + LOCALE_GLCD_STANDBY_LCD_CLOCK, + LOCALE_GLCD_STANDBY_LED_CLOCK, + LOCALE_GLCD_STANDBY_SETTINGS, + LOCALE_GLCD_STANDBY_WEATHER, + LOCALE_GLCD_START_X_POSITION, + LOCALE_GLCD_START_Y_POSITION, LOCALE_GLCD_TIME_IN_STANDBY, + LOCALE_GLCD_TIME_X_POSITION, + LOCALE_GLCD_TIME_Y_POSITION, LOCALE_GLCD_VOLUME, LOCALE_HDD_10MIN, LOCALE_HDD_1MIN, @@ -1844,6 +1895,7 @@ typedef enum LOCALE_MENU_HINT_VOLUME_POS, LOCALE_MENU_HINT_VOLUME_SIZE, LOCALE_MENU_HINT_WEATHER_API_KEY, + LOCALE_MENU_HINT_WEATHER_COUNTRY, LOCALE_MENU_HINT_WEATHER_ENABLED, LOCALE_MENU_HINT_WEATHER_LOCATION, LOCALE_MENU_HINT_WEBRADIO_SETUP, @@ -2958,6 +3010,9 @@ typedef enum LOCALE_VIDEOMENU_ZAPPINGMODE_MUTE, LOCALE_VIDEOMENU_ZAPPINGMODE_HOLD, LOCALE_WEATHER_API_KEY, + LOCALE_WEATHER_COUNTRY, + LOCALE_WEATHER_COUNTRY_DEUTSCHLAND, + LOCALE_WEATHER_COUNTRY_NORWAY, LOCALE_WEATHER_ENABLED, LOCALE_WEATHER_LOCATION, LOCALE_WEBRADIO_HEAD, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index b56a704dd..b3066f5c0 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -913,10 +913,24 @@ const char * locale_real_names[] = "fsk.to_12", "fsk.to_16", "fsk.to_7", + "glcd.align_center", + "glcd.align_channel", + "glcd.align_duration", + "glcd.align_end", + "glcd.align_epg", + "glcd.align_left", + "glcd.align_none", + "glcd.align_right", + "glcd.align_start", + "glcd.align_time", + "glcd.bar_width", + "glcd.bar_x_position", + "glcd.bar_y_position", "glcd.brightness", + "glcd.brightness_dim", + "glcd.brightness_dim_time", + "glcd.brightness_settings", "glcd.brightness_standby", - "glcd.clock.analog", - "glcd.clock.digital_hm", "glcd.color.amber", "glcd.color.black", "glcd.color.blue", @@ -938,25 +952,62 @@ const char * locale_real_names[] = "glcd.color.teal", "glcd.color.white", "glcd.color.yellow", + "glcd.channel_x_position", + "glcd.channel_y_position", + "glcd.digital_clock_y_position", "glcd.display", + "glcd.duration_x_position", + "glcd.duration_y_position", "glcd.enable", + "glcd.end_x_position", + "glcd.end_y_position", + "glcd.epg_x_position", + "glcd.epg_y_position", "glcd.font", + "glcd.font_autoresize", "glcd.head", + "glcd.logo_x_position", + "glcd.logo_y_position", "glcd.mirror_osd", "glcd.mirror_video", + "glcd.position_settings", "glcd.restart", "glcd.scroll_speed", "glcd.select.bar", "glcd.select.bg", "glcd.select.fg", + "glcd.show_duration", + "glcd.show_end", "glcd.show_logo", + "glcd.show_progressbar", + "glcd.show_start", + "glcd.show_time", + "glcd.show_weather", + "glcd.simple_clock_y_position", "glcd.size_bar", "glcd.size_channel", + "glcd.size_duration", + "glcd.size_end", "glcd.size_epg", "glcd.size_logo", + "glcd.size_simple_clock", + "glcd.size_start", "glcd.size_time", "glcd.size_time_standby", + "glcd.theme", + "glcd.theme_position_settings", + "glcd.theme_settings", + "glcd.standby_analog_clock", + "glcd.standby_digital_clock", + "glcd.standby_lcd_clock", + "glcd.standby_led_clock", + "glcd.standby_settings", + "glcd.standby_weather", + "glcd.start_x_position", + "glcd.start_y_position", "glcd.time_in_standby", + "glcd.time_x_position", + "glcd.time_y_position", "glcd.volume", "hdd_10min", "hdd_1min", @@ -1844,6 +1895,7 @@ const char * locale_real_names[] = "menu.hint_volume_pos", "menu.hint_volume_size", "menu.hint_weather_api_key", + "menu.hint_weather_country", "menu.hint_weather_enabled", "menu.hint_weather_location", "menu.hint_webradio_setup", @@ -2958,6 +3010,9 @@ const char * locale_real_names[] = "videomenu.zappingmode_mute", "videomenu.zappingmode_hold", "weather.api_key", + "weather.country", + "weather.country_deutschland", + "weather.country_norway", "weather.enabled", "weather.location", "webradio.head", diff --git a/src/system/settings.h b/src/system/settings.h index dfc8f3e5c..6c6e33755 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -183,6 +183,108 @@ struct timer_remotebox_item bool online; }; +#if BOXMODEL_VUSOLO4K || BOXMODEL_VUDUO4K || BOXMODEL_VUULTIMO4K || BOXMODEL_VUUNO4KSE || BOXMODEL_VUUNO4K +#define GLCD_DEFAULT_BRIGHTNESS 7 +#define GLCD_DEFAULT_BRIGHTNESS_STANDBY 1 +#define GLCD_DEFAULT_BRIGHTNESS_DIM 3 +#define GLCD_DEFAULT_BRIGHTNESS_DIM_TIME "10" +#else +#define GLCD_DEFAULT_BRIGHTNESS 70 +#define GLCD_DEFAULT_BRIGHTNESS_STANDBY 10 +#define GLCD_DEFAULT_BRIGHTNESS_DIM 30 +#define GLCD_DEFAULT_BRIGHTNESS_DIM_TIME "30" +#endif + +struct SNeutrinoGlcdTheme +{ + unsigned char glcd_color_fg_red; + unsigned char glcd_color_fg_green; + unsigned char glcd_color_fg_blue; + unsigned char glcd_color_bg_red; + unsigned char glcd_color_bg_green; + unsigned char glcd_color_bg_blue; + unsigned char glcd_color_bar_red; + unsigned char glcd_color_bar_green; + unsigned char glcd_color_bar_blue; + + std::string glcd_font; + std::string glcd_background; + + int glcd_show_progressbar; + int glcd_show_duration; + int glcd_show_start; + int glcd_show_end; + int glcd_show_time; + int glcd_show_weather; + + int glcd_align_channel; + int glcd_align_epg; + int glcd_align_duration; + int glcd_align_start; + int glcd_align_end; + int glcd_align_time; + + int glcd_percent_channel; + int glcd_channel_x_position; + int glcd_channel_y_position; + + int glcd_percent_epg; + int glcd_epg_x_position; + int glcd_epg_y_position; + + int glcd_percent_duration; + int glcd_duration_x_position; + int glcd_duration_y_position; + + int glcd_percent_start; + int glcd_start_x_position; + int glcd_start_y_position; + + int glcd_percent_end; + int glcd_end_x_position; + int glcd_end_y_position; + + int glcd_percent_time; + int glcd_time_x_position; + int glcd_time_y_position; + + int glcd_percent_bar; + int glcd_bar_x_position; + int glcd_bar_y_position; + int glcd_bar_width; + + int glcd_percent_logo; + int glcd_logo_x_position; + int glcd_logo_y_position; + + int glcd_percent_smalltext; + int glcd_smalltext_y_position; + + int glcd_rec_icon_x_position; + int glcd_mute_icon_x_position; + int glcd_ts_icon_x_position; + int glcd_timer_icon_x_position; + int glcd_ecm_icon_x_position; + int glcd_dd_icon_x_position; + int glcd_txt_icon_x_position; + int glcd_cam_icon_x_position; + + int glcd_standby_weather; + int glcd_digital_clock_y_position; + int glcd_size_simple_clock; + int glcd_simple_clock_y_position; + + int glcd_weather_x_position_current; + int glcd_weather_x_position_next; + int glcd_weather_y_position; + + int glcd_weather_x_position_current_standby; + int glcd_weather_x_position_next_standby; + int glcd_weather_y_position_standby; + + int glcd_position_settings; +}; + struct SNeutrinoSettings { std::string version_pseudo; @@ -485,6 +587,8 @@ struct SNeutrinoSettings //theme/color options SNeutrinoTheme theme; std::string theme_name; + SNeutrinoGlcdTheme glcd_theme; + std::string glcd_theme_name; bool osd_colorsettings_advanced_mode; //network @@ -810,22 +914,18 @@ struct SNeutrinoSettings #ifdef ENABLE_GRAPHLCD // graphlcd int glcd_enable; - uint32_t glcd_color_fg; - uint32_t glcd_color_bg; - uint32_t glcd_color_bar; - std::string glcd_font; - int glcd_percent_channel; - int glcd_percent_epg; - int glcd_percent_bar; - int glcd_percent_time; - int glcd_percent_time_standby; - int glcd_percent_logo; + + int glcd_time_in_standby; + int glcd_standby_weather; + int glcd_mirror_osd; int glcd_mirror_video; - int glcd_time_in_standby; + int glcd_show_logo; int glcd_brightness; int glcd_brightness_standby; + int glcd_brightness_dim; + std::string glcd_brightness_dim_time; int glcd_scroll_speed; int glcd_selected_config; #endif @@ -904,6 +1004,7 @@ struct SNeutrinoSettings //online services std::string weather_api_key; int weather_enabled; + int weather_country; std::string weather_location; std::string weather_city; std::string youtube_dev_id; diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index e94ccdcbb..f9c493b62 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -44,6 +44,8 @@ #include "timermanager.h" #include +#include + extern bool timeset; time_t timer_minutes; bool timer_is_rec; @@ -93,6 +95,8 @@ void* CTimerManager::timerThread(void *arg) CTimerManager *timerManager = (CTimerManager*) arg; + bool setTimerIcon = false; + int sleeptime=(timerd_debug)?10:20; while(1) { @@ -126,6 +130,12 @@ void* CTimerManager::timerThread(void *arg) CTimerEventMap::iterator pos = timerManager->events.begin(); for(;pos != timerManager->events.end();++pos) { +#ifdef ENABLE_GRAPHLCD + if (!setTimerIcon) { + cGLCD::lockIcon(cGLCD::TIMER); + setTimerIcon = true; + } +#endif event = pos->second; dprintf("checking event: %03d\n",event->eventID); if (timerd_debug) @@ -149,6 +159,12 @@ void* CTimerManager::timerThread(void *arg) if(event->stopTime == 0) // if event needs no stop event event->setState(CTimerd::TIMERSTATE_HASFINISHED); timerManager->m_saveEvents = true; +#ifdef ENABLE_GRAPHLCD + if (setTimerIcon) { + cGLCD::unlockIcon(cGLCD::TIMER); + setTimerIcon = false; + } +#endif } if(event->stopTime > 0 && event->eventState == CTimerd::TIMERSTATE_ISRUNNING ) // check if stopevent is wanted @@ -223,6 +239,9 @@ CTimerEvent* CTimerManager::getNextEvent() //------------------------------------------------------------ int CTimerManager::addEvent(CTimerEvent* evt, bool save) { +#ifdef ENABLE_GRAPHLCD + cGLCD::lockIcon(cGLCD::TIMER); +#endif pthread_mutex_lock(&tm_eventsMutex); eventID++; // increase unique event id evt->eventID = eventID;