diff --git a/acinclude.m4 b/acinclude.m4 index 6212c1f25..be7f8f602 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -21,6 +21,14 @@ if test "$DEBUG" = "yes"; then AC_DEFINE(DEBUG,1,[Enable debug messages]) fi +AC_ARG_ENABLE(reschange, + AS_HELP_STRING(--enable-reschange,enable change the osd resolution (default for hd2))) + +AM_CONDITIONAL(ENABLE_RESCHANGE,test "$enable_reschange" = "yes") +if test "$enable_reschange" = "yes"; then + AC_DEFINE(ENABLE_CHANGE_OSD_RESOLUTION,1,[enable change the osd resolution]) +fi + AC_MSG_CHECKING(target) if test "$TARGET" = "native"; then @@ -354,6 +362,7 @@ if test "$BOXMODEL" = "hd1"; then AC_DEFINE(BOXMODEL_CS_HD1, 1, [coolstream hd1/neo/neo2/zee]) elif test "$BOXMODEL" = "hd2"; then AC_DEFINE(BOXMODEL_CS_HD2, 1, [coolstream tank/trinity/trinity v2/trinity duo/zee2/link]) + AC_DEFINE(ENABLE_CHANGE_OSD_RESOLUTION,1,[enable change the osd resolution]) elif test "$BOXMODEL" = "raspi"; then AC_DEFINE(BOXMODEL_RASPI, 1, [Raspberry pi]) fi diff --git a/configure.ac b/configure.ac index 1346482b2..db3335157 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(Neutrino-MP,3.4.2) +AC_INIT(Neutrino-MP,3.5.0) AM_INIT_AUTOMAKE([1.0.1 nostdinc]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) diff --git a/data/icons/filetypes/Makefile.am b/data/icons/filetypes/Makefile.am index ec9f09d5a..d71903773 100644 --- a/data/icons/filetypes/Makefile.am +++ b/data/icons/filetypes/Makefile.am @@ -3,4 +3,6 @@ installdir = $(ICONSDIR) install_DATA = \ file.png \ folder.png \ - movie.png + movie.png \ + mp3.png \ + picture.png diff --git a/data/icons/filetypes/mp3.png b/data/icons/filetypes/mp3.png new file mode 100644 index 000000000..7c4bb1eb8 Binary files /dev/null and b/data/icons/filetypes/mp3.png differ diff --git a/data/icons/filetypes/picture.png b/data/icons/filetypes/picture.png new file mode 100644 index 000000000..f1f450c78 Binary files /dev/null and b/data/icons/filetypes/picture.png differ diff --git a/data/icons/headers/Makefile.am b/data/icons/headers/Makefile.am index 29328dcbf..b56c38768 100644 --- a/data/icons/headers/Makefile.am +++ b/data/icons/headers/Makefile.am @@ -17,7 +17,6 @@ install_DATA = \ language.png \ lcd.png \ mainmenue.png \ - mp3.png \ multimedia.png \ network.png \ personalize.png \ diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index a703b17c4..4da0a1eb2 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -322,10 +322,9 @@ colormenu.clock_textcolor Ziffernfarbe colormenu.fade Ein-/Ausblenden colormenu.font Verwendete Schriftart colormenu.font_ttx Teletext Schriftart -colormenu.hd_preset LCD colormenu.menucolors Farben colormenu.osd_preset Monitor Auswahl -colormenu.sd_preset CRT +colormenu.osd_resolution OSD-Auflösung colormenu.textcolor Textfarbe colormenu.themeselect Theme auswählen colormenu.timing Timeouts @@ -593,11 +592,11 @@ filebrowser.prevpage Seite zurück filebrowser.scan Durchsuche Verzeichnisse filebrowser.select Auswählen filebrowser.showrights Dateirechte anzeigen -filebrowser.sort.date (Datum) -filebrowser.sort.name (Dateiname) -filebrowser.sort.namedirsfirst (Dateiname2) -filebrowser.sort.size (Größe) -filebrowser.sort.type (Typ) +filebrowser.sort.date Datum +filebrowser.sort.name Name +filebrowser.sort.namedirsfirst Name, Verz. zuerst +filebrowser.sort.size Größe +filebrowser.sort.type Typ filesystem.is.utf8 Dateisystem filesystem.is.utf8.option.iso8859.1 ISO-8859-1 filesystem.is.utf8.option.utf8 UTF-8 @@ -1254,6 +1253,7 @@ menu.hint_opkg_upgrade Aktualisiert alle installierten Pakete auf die neueste ve menu.hint_osd Farben, Schriftarten, Anzeigegröße, Ansichtsoptionen der Menüs usw. menu.hint_osd_language Wählen Sie ihre Menü-Sprache menu.hint_osd_preset Wählen Sie zwischen Röhren-TV (CRT) oder Flachbildschirm (LCD) +menu.hint_osd_resolution Wählen Sie eine OSD-Auflösung menu.hint_osd_timing Einblendzeit, die das OSD auf dem TV angezeigt wird menu.hint_other_fonts Ändern Sie andere Schriftgrößen menu.hint_parentallock_changepin Geben Sie den 4-stelligen PIN-Code ein, der dann ggf. abgefragt wird @@ -2320,9 +2320,11 @@ streaminfo.framerate Bildrate streaminfo.framerate_unknown unbekannt streaminfo.head Tech. Information streaminfo.not_available nicht verfügbar +streaminfo.osd_resolution OSD-Auflösung streaminfo.resolution Auflösung streaminfo.signal Empfangssignal -streaming.busy Ein oder mehrere Aufnahmeprozesse sind aktiv.\nSollte die Aufnahme eigentlich beendet sein,\nschafft ein Neustart von Neutrino Abhilfe. +streaminfo.videosystem Videosystem +streaming.busy Einer oder mehrere Aufnahmeprozesse sind aktiv.\nSollte die Aufnahme eigentlich beendet sein,\nschafft ein Neustart der GUI Abhilfe. streaming.dir_not_writable Das Aufnahmeverzeichnis ist nicht beschreibbar.\nAufnahmen sind daher nicht möglich. streaming.overflow Aufnahme-Puffer Überlauf! Bitte ggf. einige Aufnahmen beenden. streaming.slow System oder Datenträger zu langsam! Bitte ggf. einige Aufnahmen beenden. diff --git a/data/locale/english.locale b/data/locale/english.locale index 5d16d8705..3c931f111 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -322,10 +322,9 @@ colormenu.clock_textcolor Digit color colormenu.fade Fade GUI colormenu.font Select GUI font colormenu.font_ttx Select Teletext font -colormenu.hd_preset LCD colormenu.menucolors Colors colormenu.osd_preset TV preset -colormenu.sd_preset CRT +colormenu.osd_resolution OSD resolution colormenu.textcolor Text color colormenu.themeselect Select theme colormenu.timing Timeouts @@ -593,11 +592,11 @@ filebrowser.prevpage Prev. Page filebrowser.scan Scaning folder filebrowser.select Select filebrowser.showrights Show file rights -filebrowser.sort.date (date) -filebrowser.sort.name (name) -filebrowser.sort.namedirsfirst (name, dir first) -filebrowser.sort.size (Size) -filebrowser.sort.type (type) +filebrowser.sort.date Date +filebrowser.sort.name Name +filebrowser.sort.namedirsfirst Name, dirs first +filebrowser.sort.size Size +filebrowser.sort.type Type filesystem.is.utf8 file system filesystem.is.utf8.option.iso8859.1 ISO-8859-1 filesystem.is.utf8.option.utf8 UTF-8 @@ -1172,7 +1171,7 @@ menu.hint_key_volumedown Assign button to decrease volume menu.hint_key_volumeup Assign button to increase volume menu.hint_keys Remote control repeat rate\nEdit key bindings menu.hint_lang_pref Configure preferred audio, EPG\nand subtitle languages -menu.hint_language OSD language, timezone\nPreffered audio and subtitles languages +menu.hint_language OSD language, timezone\nPrefered audio and subtitles languages menu.hint_last_radio Start box on selected channel\nif last mode is Radio menu.hint_last_tv Start box on selected channel\nif last mode is TV menu.hint_last_use Start box on last used channel @@ -1254,6 +1253,7 @@ menu.hint_opkg_upgrade Updates all installed packages to the most recent version menu.hint_osd Colors, fonts, screen size\nGUI look and feel options menu.hint_osd_language Select OSD language menu.hint_osd_preset Pre-configured screen margins for CRT and LCD TV +menu.hint_osd_resolution Change OSD resolution menu.hint_osd_timing After this time the OSD will be faded out menu.hint_other_fonts Change other font sizes menu.hint_parentallock_changepin Change PIN code @@ -2320,9 +2320,11 @@ streaminfo.framerate Framerate streaminfo.framerate_unknown unknown streaminfo.head Stream-Information streaminfo.not_available not available +streaminfo.osd_resolution OSD resolution streaminfo.resolution Resolution streaminfo.signal Receipt signal -streaming.busy One or several recording processes are active.\nIf you encounter this message and no recording is active, please restart Neutrino. +streaminfo.videosystem Videosystem +streaming.busy One or several recording processes are active.\nIf you encounter this message and no recording is active, please restart GUI. streaming.dir_not_writable The recording directory is not writable.\nRecording will not work. streaming.overflow Record buffer overflow, consider to stop some records streaming.slow System/hdd too slow, consider to stop some records diff --git a/lib/hardware/coolstream/hardware_caps.cpp b/lib/hardware/coolstream/hardware_caps.cpp index b4d4c0a46..865e8ccf5 100644 --- a/lib/hardware/coolstream/hardware_caps.cpp +++ b/lib/hardware/coolstream/hardware_caps.cpp @@ -6,6 +6,7 @@ * * License: GPL v2 or later */ +#include #include "cs_api.h" #include #include @@ -20,7 +21,10 @@ hw_caps_t *get_hwcaps(void) { if (initialized) return ∩︀ int rev = cs_get_revision(); - int chip = cs_get_chip_type(); + int chip = 0; +#ifdef BOXMODEL_CS_HD2 + chip = cs_get_chip_type(); +#endif caps.has_fan = (rev < 8 && CFEManager::getInstance()->getFE(0)->hasSat()); // only SAT-HD1 before rev 8 has fan caps.has_HDMI = 1; caps.has_SCART = (rev != 10); diff --git a/lib/hardware/coolstream/hd1/libcoolstream/cs_api.h b/lib/hardware/coolstream/hd1/libcoolstream/cs_api.h index 9a4e77259..80dd47ade 100644 --- a/lib/hardware/coolstream/hd1/libcoolstream/cs_api.h +++ b/lib/hardware/coolstream/hd1/libcoolstream/cs_api.h @@ -82,7 +82,7 @@ int cs_get_tsp_config(unsigned int port, tsrouter_tsp_config_t *tsp_config); unsigned long long cs_get_serial(void); unsigned int cs_get_revision(void); /* Dummy function for compatibility with hd2 */ -unsigned int cs_get_chip_type(void); +//unsigned int cs_get_chip_type(void); // library version functions diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index 4fec1c501..714494681 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -5234,7 +5234,7 @@ void RenderPage() { page_atrb[32].fg = yellow; page_atrb[32].bg = menu1; - int showpage = tuxtxt_cache.page_receiving; + int showpage = tuxtxt_cache.page_receiving < 0 ? 0 : tuxtxt_cache.page_receiving; int showsubpage = tuxtxt_cache.subpagetable[showpage]; if (showsubpage!=0xff) { @@ -5524,7 +5524,7 @@ void CopyBB2FB() { fb_pixel_t *src, *dst, *topsrc; int fillcolor, i, screenwidth, swtmp; -#if defined(HAVE_SPARK_HARDWARE) || defined(BOXMODEL_CS_HD2) +#if defined(HAVE_SPARK_HARDWARE) || defined(HAVE_COOL_HARDWARE) CFrameBuffer *f = CFrameBuffer::getInstance(); #endif @@ -5537,10 +5537,20 @@ void CopyBB2FB() { #ifdef HAVE_SPARK_HARDWARE f->blit2FB(lbb, var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, 0, true); -#elif defined BOXMODEL_CS_HD2 +#elif defined(HAVE_COOL_HARDWARE) f->fbCopyArea(var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, var_screeninfo.yres); #else - memcpy(lfb, lbb, fix_screeninfo.line_length*var_screeninfo.yres); + if ((uint32_t)stride > var_screeninfo.xres) { + fb_pixel_t *lfb_ = lfb; + fb_pixel_t *lbb_ = lbb; + for (uint32_t i1 = 0; i1 < var_screeninfo.yres; i1++) { + memcpy(lfb_, lbb_, var_screeninfo.xres * sizeof(fb_pixel_t)); + lfb_ += stride; + lbb_ += stride; + } + } + else + memcpy(lfb, lbb, fix_screeninfo.line_length*var_screeninfo.yres); #endif /* adapt background of backbuffer if changed */ @@ -5576,7 +5586,7 @@ void CopyBB2FB() if (screenmode == 1) { screenwidth = ( TV43STARTX ); -#if defined(HAVE_SPARK_HARDWARE) || defined(BOXMODEL_CS_HD2) +#if defined(HAVE_SPARK_HARDWARE) int cx = var_screeninfo.xres - TV43STARTX; /* x start */ int cw = TV43STARTX; /* width */ int cy = StartY; @@ -5584,8 +5594,6 @@ void CopyBB2FB() #endif #ifdef HAVE_SPARK_HARDWARE f->blit2FB(lbb, cw, ch, cx, cy, cx, cy, true); -#elif defined BOXMODEL_CS_HD2 - f->fbCopyArea(cw, ch, cx, cy, cx, cy+var_screeninfo.yres); #else fb_pixel_t *topdst = dst; size_t width = (ex - screenwidth) * sizeof(fb_pixel_t); diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am index adbef6c4b..a19c4fadb 100644 --- a/src/driver/Makefile.am +++ b/src/driver/Makefile.am @@ -47,6 +47,8 @@ libneutrino_driver_a_SOURCES = \ volume.cpp if BOXTYPE_COOL +libneutrino_driver_a_SOURCES += \ + fb_accel_cs_hdx.cpp if BOXMODEL_CS_HD2 libneutrino_driver_a_SOURCES += \ fb_accel_cs_hd2.cpp \ diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index 72bca8aa5..6343056f9 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -78,17 +78,41 @@ class CFbAccelSTi void setBlendLevel(int); }; -class CFbAccelCSHD1 +class CFbAccelCSHDx : public CFbAccel { private: + + protected: + OpenThreads::Mutex mutex; + + int fbCopy(uint32_t *mem_p, int width, int height, int dst_x, int dst_y, int src_x, int src_y, int mode); + int fbFill(int sx, int sy, int width, int height, fb_pixel_t color, int mode=0); + + public: + CFbAccelCSHDx(); +// ~CFbAccelCSHDx(); + +#if 0 + /* TODO: Run this functions with hardware acceleration */ + void SaveScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp); + void RestoreScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp); + void Clear(); +#endif +}; + +class CFbAccelCSHD1 + : public CFbAccelCSHDx +{ + private: fb_pixel_t lastcol; + fb_pixel_t *backbuffer; int devmem_fd; /* to access the GXA register we use /dev/mem */ unsigned int smem_start; /* as aquired from the fbdev, the framebuffers physical start address */ volatile uint8_t *gxa_base; /* base address for the GXA's register access */ + void setColor(fb_pixel_t col); - void run(void); - fb_pixel_t *backbuffer; + public: CFbAccelCSHD1(); ~CFbAccelCSHD1(); @@ -109,13 +133,16 @@ class CFbAccelCSHD1 void setBlendLevel(int); void add_gxa_sync_marker(void); void setupGXA(void); + void setOsdResolutions(); }; class CFbAccelCSHD2 - : public CFbAccel + : public CFbAccelCSHDx { private: fb_pixel_t *backbuffer; + int sysRev; + bool IsApollo; public: CFbAccelCSHD2(); @@ -130,6 +157,9 @@ class CFbAccelCSHD2 fb_pixel_t * getBackBufferPointer() const; void setBlendMode(uint8_t); void setBlendLevel(int); + int scale2Res(int size); + bool fullHdAvailable(); + void setOsdResolutions(); uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true); bool needAlign4Blit() { return true; }; }; diff --git a/src/driver/fb_accel_cs_hd1.cpp b/src/driver/fb_accel_cs_hd1.cpp index 2672dfd58..2b6b0e0dd 100644 --- a/src/driver/fb_accel_cs_hd1.cpp +++ b/src/driver/fb_accel_cs_hd1.cpp @@ -264,13 +264,21 @@ void CFbAccelCSHD1::paintBoxRel(const int x, const int y, const int dx, const in void CFbAccelCSHD1::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y) { + if ((width == 0) || (height == 0)) + return; + uint32_t w_, h_; w_ = (width > xRes) ? xRes : width; h_ = (height > yRes) ? yRes : height; - //printf("\033[33m>>>>\033[0m [CFbAccelCSHD1::%s:%d] fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); - printf("\033[31m>>>>\033[0m [CFbAccelCSHD1::%s:%d] sw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); - CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y); + int mode = CS_FBCOPY_FB2FB; + uint32_t src_y_ = src_y; + if (src_y >= yRes) { + mode = CS_FBCOPY_BB2FB; + src_y_ -= yRes; + } + fbCopy(NULL, w_, h_, dst_x, dst_y, src_x, src_y_, mode); +// printf("\033[31m>>>>\033[0m%s hw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func_ext__, w_, h_, dst_x, dst_y, src_x, src_y); } void CFbAccelCSHD1::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) @@ -336,9 +344,26 @@ void CFbAccelCSHD1::setupGXA() add_gxa_sync_marker(); } -/* wrong name... */ +void CFbAccelCSHD1::setOsdResolutions() +{ + /* FIXME: Infos available in driver? */ + osd_resolution_t res; + osd_resolutions.clear(); + res.xRes = 1280; + res.yRes = 720; + res.bpp = 32; + res.mode = OSDMODE_720; + osd_resolutions.push_back(res); +} + int CFbAccelCSHD1::setMode(unsigned int, unsigned int, unsigned int) { + if (!available&&!active) + return -1; + + if (osd_resolutions.empty()) + setOsdResolutions(); + fb_fix_screeninfo _fix; if (ioctl(fd, FBIOGET_FSCREENINFO, &_fix) < 0) { @@ -353,6 +378,10 @@ int CFbAccelCSHD1::setMode(unsigned int, unsigned int, unsigned int) yRes = screeninfo.yres; bpp = screeninfo.bits_per_pixel; printf(LOGTAG "%dx%dx%d line length %d. using %s graphics accelerator.\n", xRes, yRes, bpp, stride, _fix.id); + + if (videoDecoder != NULL) + videoDecoder->updateOsdScreenInfo(); + int needmem = stride * yRes * 2; if (available >= needmem) { diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index ce20ce051..cfafaf4bf 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -28,7 +28,9 @@ CFbAccelCSHD2::CFbAccelCSHD2() { - fb_name = "Coolstream HD2 framebuffer"; + fb_name = "Coolstream HD2 framebuffer"; + IsApollo = false; + sysRev = -1; } /* @@ -143,11 +145,22 @@ void CFbAccelCSHD2::paintBoxRel(const int x, const int y, const int dx, const in void CFbAccelCSHD2::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y) { + if ((width == 0) || (height == 0)) + return; + uint32_t w_, h_; w_ = (width > xRes) ? xRes : width; h_ = (height > yRes) ? yRes : height; - if(!(w_%4)) { + if (sysRev < 0) { + sysRev = cs_get_revision(); + IsApollo = (sysRev == 9); + } + + if(!(w_ % 4) && !IsApollo) { + /* workaround for bad fb driver */ + w_ -= 1; + h_ -= 1; fb_copyarea area; area.dx = dst_x; area.dy = dst_y; @@ -156,11 +169,18 @@ void CFbAccelCSHD2::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, area.sx = src_x; area.sy = src_y; ioctl(fd, FBIO_COPY_AREA, &area); - //printf("\033[33m>>>>\033[0m [CFbAccelCSHD2::%s:%d] fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); - return; +// printf("\033[33m>>>>\033[0m%s fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func_ext__, w_, h_, dst_x, dst_y, src_x, src_y); + } + else { + int mode = CS_FBCOPY_FB2FB; + uint32_t src_y_ = src_y; + if (src_y >= yRes) { + mode = CS_FBCOPY_BB2FB; + src_y_ -= yRes; + } + fbCopy(NULL, w_, h_, dst_x, dst_y, src_x, src_y_, mode); +// printf("\033[31m>>>>\033[0m%s fbCopy w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func_ext__, w_, h_, dst_x, dst_y, src_x, src_y); } - //printf("\033[31m>>>>\033[0m [CFbAccelCSHD2::%s:%d] sw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); - CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y); } void CFbAccelCSHD2::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) @@ -207,22 +227,91 @@ void CFbAccelCSHD2::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_ CFrameBuffer::blitBox2FB(boxBuf, width, height, xoff, yoff); } -int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int) +void CFbAccelCSHD2::setOsdResolutions() { + /* FIXME: Infos available in driver? */ + osd_resolution_t res; + osd_resolutions.clear(); + res.xRes = 1280; + res.yRes = 720; + res.bpp = 32; + res.mode = OSDMODE_720; + osd_resolutions.push_back(res); + if (fullHdAvailable()) { + res.xRes = 1920; + res.yRes = 1080; + res.bpp = 32; + res.mode = OSDMODE_1080; + osd_resolutions.push_back(res); + } +} + +int CFbAccelCSHD2::setMode(unsigned int nxRes, unsigned int nyRes, unsigned int nbpp) +{ + if (!available&&!active) + return -1; + + if (osd_resolutions.empty()) + setOsdResolutions(); + + unsigned int nxRes_ = nxRes; + unsigned int nyRes_ = nyRes; + unsigned int nbpp_ = nbpp; + if (!fullHdAvailable()) { + nxRes_ = 1280; + nyRes_ = 720; + nbpp_ = 32; + } + screeninfo.xres=nxRes_; + screeninfo.yres=nyRes_; + screeninfo.xres_virtual=nxRes_; + screeninfo.yres_virtual=nyRes_*2; + screeninfo.height=0; + screeninfo.width=0; + screeninfo.xoffset=screeninfo.yoffset=0; + screeninfo.bits_per_pixel=nbpp_; + + if (ioctl(fd, FBIOPUT_VSCREENINFO, &screeninfo)<0) + perror(LOGTAG "FBIOPUT_VSCREENINFO"); + + printf(LOGTAG "SetMode: %dbits, red %d:%d green %d:%d blue %d:%d transp %d:%d\n", + screeninfo.bits_per_pixel, screeninfo.red.length, screeninfo.red.offset, screeninfo.green.length, screeninfo.green.offset, screeninfo.blue.length, screeninfo.blue.offset, screeninfo.transp.length, screeninfo.transp.offset); + if ((screeninfo.xres != nxRes_) || + (screeninfo.yres != nyRes_) || + (screeninfo.bits_per_pixel != nbpp_)) { + printf(LOGTAG "SetMode failed: wanted: %dx%dx%d, got %dx%dx%d\n", + nxRes_, nyRes_, nbpp_, + screeninfo.xres, screeninfo.yres, screeninfo.bits_per_pixel); + return -1; + } + fb_fix_screeninfo _fix; if (ioctl(fd, FBIOGET_FSCREENINFO, &_fix) < 0) { - perror("FBIOGET_FSCREENINFO"); + perror(LOGTAG "FBIOGET_FSCREENINFO"); return -1; } stride = _fix.line_length; swidth = stride / sizeof(fb_pixel_t); if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) - printf("screen unblanking failed\n"); + printf(LOGTAG "screen unblanking failed\n"); xRes = screeninfo.xres; yRes = screeninfo.yres; bpp = screeninfo.bits_per_pixel; - printf(LOGTAG "%dx%dx%d line length %d. using hd2 graphics accelerator.\n", xRes, yRes, bpp, stride); + printf(LOGTAG "%dx%dx%d line length %d. using %s graphics accelerator.\n", xRes, yRes, bpp, stride, _fix.id); + +/* +max res 1280x720 + available 14745600 + stride 5120 +max res 1920x1080 + available 16588800 + stride 7680 +*/ + + if (videoDecoder != NULL) + videoDecoder->updateOsdScreenInfo(); + int needmem = stride * yRes * 2; if (available >= needmem) { @@ -260,6 +349,30 @@ void CFbAccelCSHD2::setBlendLevel(int level) usleep(20000); } +int CFbAccelCSHD2::scale2Res(int size) +{ + /* + The historic resolution 1280x720 is default for some values/sizes. + So let's scale these values to other resolutions. + */ + +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + if (screeninfo.xres == 1920) + size += size/2; +#endif + + return size; +} + +bool CFbAccelCSHD2::fullHdAvailable() +{ +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + if (available >= 16588800) /* new fb driver with maxres 1920x1080(*8) */ + return true; +#endif + return false; +} + /* align for hw blit */ uint32_t CFbAccelCSHD2::getWidth4FB_HW_ACC(const uint32_t _x, const uint32_t _w, const bool max) { diff --git a/src/driver/fb_accel_cs_hdx.cpp b/src/driver/fb_accel_cs_hdx.cpp new file mode 100644 index 000000000..3ab238f35 --- /dev/null +++ b/src/driver/fb_accel_cs_hdx.cpp @@ -0,0 +1,122 @@ +/* + Framebuffer acceleration hardware abstraction functions. + The common functions for coolstream hd1/hd2 graphic chips + are represented in this class. + + (C) 2017 M. Liebmann + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "fb_accel_cs_hdx_inc.h" + +#define LOGTAG "[fb_accel_cs_hdx] " + +CFbAccelCSHDx::CFbAccelCSHDx() +{ + fb_name = "CST HDx framebuffer"; +} + +/* +CFbAccelCSHDx::~CFbAccelCSHDx() +{ +} +*/ + +int CFbAccelCSHDx::fbCopy(uint32_t *mem_p, int width, int height, + int dst_x, int dst_y, int src_x, int src_y, int mode) +{ + if (videoDecoder == NULL) { + if (dst_y < (int)yRes) { + uint32_t src_y_ = src_y; + if (mode == CS_FBCOPY_BB2FB) + src_y_ += yRes; + CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y_); + return 0; + } + return -1; + } + + mutex.lock(); + setActive(false); + int ret = videoDecoder->fbCopy(mem_p, width, height, dst_x, dst_y, src_x, src_y, mode); + add_gxa_sync_marker(); + setActive(true); + mutex.unlock(); + return ret; +} + +int CFbAccelCSHDx::fbFill(int sx, int sy, int width, int height, fb_pixel_t color, int mode/*=0*/) +{ + if (videoDecoder == NULL) { + CFbAccel::paintRect(sx, sy, width, height, color); + return 0; + } + + mutex.lock(); + setActive(false); + int ret = videoDecoder->fbFill(sx, sy, width, height, color, mode); + add_gxa_sync_marker(); + setActive(true); + mutex.unlock(); + return ret; +} + +#if 0 +/* TODO: Run this functions with hardware acceleration */ +void CFbAccelCSHDx::SaveScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp) +{ + if (!getActive()) + return; + + checkFbArea(x, y, dx, dy, true); + fb_pixel_t * pos = getFrameBufferPointer() + x + swidth * y; + fb_pixel_t * bkpos = memp; + for (int count = 0; count < dy; count++) { + fb_pixel_t * dest = (fb_pixel_t *)pos; + for (int i = 0; i < dx; i++) + *(bkpos++) = *(dest++); + pos += swidth; + } + checkFbArea(x, y, dx, dy, false); +printf("%s\n", __func_ext__); +} + +void CFbAccelCSHDx::RestoreScreen(int x, int y, int dx, int dy, fb_pixel_t * const memp) +{ + if (!getActive()) + return; + + checkFbArea(x, y, dx, dy, true); + fb_pixel_t * fbpos = getFrameBufferPointer() + x + swidth * y; + fb_pixel_t * bkpos = memp; + for (int count = 0; count < dy; count++) + { + memmove(fbpos, bkpos, dx * sizeof(fb_pixel_t)); + fbpos += swidth; + bkpos += dx; + } + mark(x, y, x + dx, y + dy); + checkFbArea(x, y, dx, dy, false); +printf("%s\n", __func_ext__); +} + +void CFbAccelCSHDx::Clear() +{ + paintBackground(); +printf("%s\n", __func_ext__); +} +#endif diff --git a/src/driver/fb_accel_cs_hdx_inc.h b/src/driver/fb_accel_cs_hdx_inc.h index cd38baa72..5f98cd34b 100644 --- a/src/driver/fb_accel_cs_hdx_inc.h +++ b/src/driver/fb_accel_cs_hdx_inc.h @@ -1,6 +1,6 @@ /* Framebuffer acceleration hardware abstraction functions. - The hardware dependent acceleration functions for coolstream hdx graphic chips + The common functions for coolstream hd1/hd2 graphic chips are represented in this class. (C) 2017 M. Liebmann @@ -23,6 +23,8 @@ along with this program. If not, see . */ +#ifndef FB_ACCEL_CS_HDX_INC_H +#define FB_ACCEL_CS_HDX_INC_H #include #include @@ -31,8 +33,16 @@ #include #include #include -#include -#include +#include +#include +#include +#include #include +#include +#include #include + +extern cVideo * videoDecoder; + +#endif // FB_ACCEL_CS_HDX_INC_H diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 3a4aca1ac..e21edd310 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -350,8 +351,34 @@ int CFrameBuffer::setMode(unsigned int /*nxRes*/, unsigned int /*nyRes*/, unsign if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) { printf("screen unblanking failed\n"); } + return 0; } + +void CFrameBuffer::setOsdResolutions() +{ + /* FIXME: Infos available in driver? */ + osd_resolution_t res; + osd_resolutions.clear(); + res.xRes = 1280; + res.yRes = 720; + res.bpp = 32; + res.mode = OSDMODE_720; + osd_resolutions.push_back(res); +} + +size_t CFrameBuffer::getIndexOsdResolution(uint32_t mode) +{ + if (osd_resolutions.size() == 1) + return 0; + + for (size_t i = 0; i < osd_resolutions.size(); i++) { + if (osd_resolutions[i].mode == mode) + return i; + } + return 0; +} + #if 0 //never used void CFrameBuffer::setTransparency( int /*tr*/ ) diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index c3b9a6f4c..364654eb1 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -39,6 +39,14 @@ typedef struct fb_var_screeninfo t_fb_var_screeninfo; +typedef struct osd_resolution_t +{ + uint32_t yRes; + uint32_t xRes; + uint32_t bpp; + uint32_t mode; +} osd_resolution_struct_t; + typedef struct gradientData_t { fb_pixel_t* gradientBuf; @@ -269,6 +277,13 @@ class CFrameBuffer : public sigc::trackable virtual void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); virtual void mark(int x, int y, int dx, int dy); +/* Remove this when pu/fb-setmode branch is merged to master */ +#define SCALE2RES_DEFINED + virtual int scale2Res(int size) { return size; }; + virtual bool fullHdAvailable() { return false; }; + virtual void setOsdResolutions(); + std::vector osd_resolutions; + size_t getIndexOsdResolution(uint32_t mode); enum { diff --git a/src/driver/file.cpp b/src/driver/file.cpp index ce4c809f5..7e02bdf10 100644 --- a/src/driver/file.cpp +++ b/src/driver/file.cpp @@ -34,43 +34,65 @@ #include #endif /* HAVE_CONFIG_H */ -#include #include #include #include -/* ATTENTION: the array file_extension_list MUST BE SORTED ASCENDING (cf. sort, man bsearch) - otherwise bsearch will not work correctly! */ -const char * const file_extension_list[] = -{ - "aac", "asf", "avi", "bin", "bmp", "cdr", "crw", - "dts", "flac", "flv", "gif", "imu", "ipk", "iso", "jpeg", "jpg", - "m2a", "m3u", "m3u8", "m4a", "mkv", "mp2", "mp3", - "mpa", "ogg", "opk", "pls", "png", "sh", - "txt", "url", "wav", "xml" +struct file_ext_s { + const char *ext; + const CFile::FileType type; }; -/* ATTENTION: the array file_extension_list MUST BE SORTED ASCENDING (cf. sort, man bsearch) - otherwise bsearch will not work correctly! */ -const CFile::FileType file_type_list[] = +// ATTENTION: the array MUST BE SORTED ASCENDING (cf. sort, man bsearch) - otherwise bsearch will not work correctly! +static const file_ext_s file_ext[] = { - CFile::FILE_AAC , CFile::FILE_ASF , CFile::FILE_AVI , CFile::FILE_BIN_PACKAGE ,CFile::FILE_PICTURE , CFile::FILE_CDR , CFile::FILE_PICTURE , - CFile::FILE_WAV , CFile::FILE_FLAC , CFile::FILE_FLV , CFile::FILE_PICTURE , CFile::STREAM_PICTURE , CFile::FILE_PKG_PACKAGE ,CFile::FILE_ISO , CFile::FILE_PICTURE , CFile::FILE_PICTURE , - CFile::FILE_MP3 , CFile::FILE_PLAYLIST , CFile::FILE_PLAYLIST , CFile::FILE_AAC , CFile::FILE_MKV , CFile::FILE_MP3 , CFile::FILE_MP3 , - CFile::FILE_MP3 , CFile::FILE_OGG , CFile::FILE_PKG_PACKAGE, CFile::FILE_PLAYLIST , CFile::FILE_PICTURE , CFile::FILE_TEXT , - CFile::FILE_TEXT , CFile::STREAM_AUDIO , CFile::FILE_WAV , CFile::FILE_XML + { "aac", CFile::FILE_AAC }, + { "asf", CFile::FILE_ASF }, + { "avi", CFile::FILE_AVI }, + { "bin", CFile::FILE_BIN_PACKAGE }, + { "bmp", CFile::FILE_PICTURE }, + { "cdr", CFile::FILE_CDR }, + { "crw", CFile::FILE_PICTURE }, + { "dts", CFile::FILE_WAV }, + { "flac", CFile::FILE_FLAC }, + { "flv", CFile::FILE_MPG }, + { "gif", CFile::FILE_PICTURE }, + { "imu", CFile::STREAM_PICTURE }, + { "ipk", CFile::FILE_PKG_PACKAGE }, + { "iso", CFile::FILE_ISO }, + { "jpeg", CFile::FILE_PICTURE }, + { "jpg", CFile::FILE_PICTURE }, + { "m2a", CFile::FILE_MP3 }, + { "m3u", CFile::FILE_PLAYLIST }, + { "m3u8", CFile::FILE_PLAYLIST }, + { "m4a", CFile::FILE_AAC }, + { "mkv", CFile::FILE_MKV }, + { "mp2", CFile::FILE_MP3 }, + { "mp3", CFile::FILE_MP3 }, + { "mp4", CFile::FILE_MPG }, + { "mpa", CFile::FILE_MP3 }, + { "mpeg", CFile::FILE_MPG }, + { "mpg", CFile::FILE_MPG }, + { "ogg", CFile::FILE_OGG }, + { "opk", CFile::FILE_PKG_PACKAGE }, + { "pls", CFile::FILE_PLAYLIST }, + { "png", CFile::FILE_PICTURE }, + { "sh", CFile::FILE_TEXT }, + { "ts", CFile::FILE_TS }, + { "txt", CFile::FILE_TEXT }, + { "url", CFile::STREAM_AUDIO }, + { "vob", CFile::FILE_VOB }, + { "wav", CFile::FILE_WAV }, + { "xml", CFile::FILE_XML } }; int mycasecmp(const void * a, const void * b) { - return strcasecmp(*(const char * *)a, *(const char * *)b); + return strcasecmp(((file_ext_s *)a)->ext, ((file_ext_s *)b)->ext); } -//------------------------------------------------------------------------ -//------------------------------------------------------------------------ - -CFile::CFile() - : Size( 0 ), Mode( 0 ), Marked( false ), Time( 0 ) +CFile::CFile() : Size( 0 ), Mode( 0 ), Marked( false ), Time( 0 ) { - Type = -1; } CFile::FileType CFile::getType(void) const @@ -78,24 +100,17 @@ CFile::FileType CFile::getType(void) const if(S_ISDIR(Mode)) return FILE_DIR; - if (Type < 0) { - Type = (int) FILE_UNKNOWN; - std::string::size_type ext_pos = Name.rfind('.'); + std::string::size_type ext_pos = Name.rfind('.'); - if (ext_pos != std::string::npos) { - const char * key = &(Name.c_str()[ext_pos + 1]); - - void * result = ::bsearch(&key, file_extension_list, sizeof(file_extension_list) / sizeof(const char *), sizeof(const char *), mycasecmp); - - if (result != NULL) - Type = (int) file_type_list[(const char * *)result - (const char * *)&file_extension_list]; - } + if (ext_pos != std::string::npos) { + const char * key = &(Name.c_str()[ext_pos + 1]); + void * result = ::bsearch(&key, file_ext, sizeof(file_ext) / sizeof(file_ext_s), sizeof(file_ext_s), mycasecmp); + if (result) + return ((file_ext_s *)result)->type; } - return (CFile::FileType) Type; + return FILE_UNKNOWN; } -//------------------------------------------------------------------------ - std::string CFile::getFileName(void) const // return name.extension or folder name without trailing / { std::string::size_type namepos = Name.rfind('/'); @@ -103,8 +118,6 @@ std::string CFile::getFileName(void) const // return name.extension or folder n return (namepos == std::string::npos) ? Name : Name.substr(namepos + 1); } -//------------------------------------------------------------------------ - std::string CFile::getPath(void) const // return complete path including trailing / { int pos = 0; diff --git a/src/driver/file.h b/src/driver/file.h index e8d7ff8b8..60801a871 100644 --- a/src/driver/file.h +++ b/src/driver/file.h @@ -59,25 +59,28 @@ class CFile { FILE_UNKNOWN = 0, FILE_AAC, - FILE_AVI, FILE_ASF, - FILE_DIR, - FILE_ISO, - FILE_TEXT, + FILE_AVI, + FILE_BIN_PACKAGE, FILE_CDR, - FILE_MP3, - FILE_MKV, - FILE_OGG, - FILE_WAV, + FILE_DIR, FILE_FLAC, FILE_FLV, - FILE_XML, - FILE_PLAYLIST, - STREAM_AUDIO, + FILE_ISO, + FILE_MKV, + FILE_MP3, + FILE_MPG, + FILE_OGG, FILE_PICTURE, - STREAM_PICTURE, - FILE_BIN_PACKAGE, - FILE_PKG_PACKAGE + FILE_PKG_PACKAGE, + FILE_PLAYLIST, + FILE_TEXT, + FILE_TS, + FILE_VOB, + FILE_WAV, + FILE_XML, + STREAM_AUDIO, + STREAM_PICTURE }; FileType getType(void) const; diff --git a/src/driver/neutrinofonts.cpp b/src/driver/neutrinofonts.cpp index 8c200a301..16fa1de89 100644 --- a/src/driver/neutrinofonts.cpp +++ b/src/driver/neutrinofonts.cpp @@ -176,12 +176,15 @@ void CNeutrinoFonts::SetupNeutrinoFonts(bool initRenderClass/*=true*/) fontStyle[2] = "Italic"; } + int fontSize; for (int i = 0; i < SNeutrinoSettings::FONT_TYPE_COUNT; i++) { if (g_Font[i]) delete g_Font[i]; - g_Font[i] = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[neutrino_font[i].style].c_str(), CNeutrinoApp::getInstance()->getConfigFile()->getInt32(locale_real_names[neutrino_font[i].name], neutrino_font[i].defaultsize) + neutrino_font[i].size_offset * fontDescr.size_offset); + fontSize = CFrameBuffer::getInstance()->scale2Res(CNeutrinoApp::getInstance()->getConfigFile()->getInt32(locale_real_names[neutrino_font[i].name], neutrino_font[i].defaultsize)) + neutrino_font[i].size_offset * fontDescr.size_offset; + g_Font[i] = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[neutrino_font[i].style].c_str(), fontSize); } if (g_SignalFont) delete g_SignalFont; - g_SignalFont = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[signal_font.style].c_str(), signal_font.defaultsize + signal_font.size_offset * fontDescr.size_offset); + fontSize = CFrameBuffer::getInstance()->scale2Res(signal_font.defaultsize) + signal_font.size_offset * fontDescr.size_offset; + g_SignalFont = g_fontRenderer->getFont(fontDescr.name.c_str(), fontStyle[signal_font.style].c_str(), fontSize); } void CNeutrinoFonts::refreshDynFonts() @@ -242,7 +245,7 @@ int CNeutrinoFonts::getFontHeight(Font* fnt) int CNeutrinoFonts::getDynFontSize(int dx, int dy, std::string text, int style) { int dynSize = dy/1.6; - if (dx == 0) dx = 1280; + if (dx == 0) dx = CFrameBuffer::getInstance()->getScreenWidth(true); if (!vDynSize.empty()) { for (size_t i = 0; i < vDynSize.size(); i++) { diff --git a/src/driver/screenshot.cpp b/src/driver/screenshot.cpp index 288ead93c..95cdac159 100644 --- a/src/driver/screenshot.cpp +++ b/src/driver/screenshot.cpp @@ -63,6 +63,7 @@ CScreenShot::CScreenShot(const std::string fname, screenshot_format_t fmt) fd = NULL; xres = 0; yres = 0; + extra_osd = false; scs_thread = 0; pthread_mutex_init(&thread_mutex, NULL); pthread_mutex_init(&getData_mutex, NULL); @@ -78,9 +79,66 @@ CScreenShot::~CScreenShot() // printf("[CScreenShot::%s:%d] thread: %p\n", __func__, __LINE__, this); } +#ifdef BOXMODEL_CS_HD2 + +bool CScreenShot::mergeOsdScreen(uint32_t dx, uint32_t dy, fb_pixel_t* osdData) +{ + uint8_t* d = (uint8_t *)pixel_data; + fb_pixel_t* d2; + + for (uint32_t count = 0; count < dy; count++ ) { + fb_pixel_t *pixpos = (fb_pixel_t*)&osdData[count*dx]; + d2 = (fb_pixel_t*)d; + for (uint32_t count2 = 0; count2 < dx; count2++ ) { + //don't paint backgroundcolor (*pixpos = 0x00000000) + if (*pixpos) { + fb_pixel_t pix = *pixpos; + if ((pix & 0xff000000) == 0xff000000) + *d2 = (pix & 0x00ffffff); + else { + uint8_t *in = (uint8_t *)(pixpos); + uint8_t *out = (uint8_t *)d2; + int a = in[3]; + *out = (*out + ((*in - *out) * a) / 256); + in++; out++; + *out = (*out + ((*in - *out) * a) / 256); + in++; out++; + *out = (*out + ((*in - *out) * a) / 256); + } + } + d2++; + pixpos++; + } + d += dx*sizeof(fb_pixel_t); + } + return true; +} +#endif + /* try to get video frame data in ARGB format, restore GXA state */ bool CScreenShot::GetData() { +#ifdef BOXMODEL_CS_HD2 + /* Workaround for broken osd screenshot with new fb driver and 1280x720 resolution */ + CFrameBuffer* frameBuffer = CFrameBuffer::getInstance(); + fb_pixel_t* screenBuf = NULL; + uint32_t _xres = 0, _yres = 0; + if (frameBuffer->fullHdAvailable() && (frameBuffer->getScreenWidth(true) == 1280)) { + _xres = xres = 1280; + _yres = yres = 720; + get_osd = false; + extra_osd = true; + screenBuf = new fb_pixel_t[_xres*_yres*sizeof(fb_pixel_t)]; + if (screenBuf == NULL) { + printf("[CScreenShot::%s:%d] memory error\n", __func__, __LINE__); + return false; + } + printf("\n[CScreenShot::%s:%d] Read osd screen...", __func__, __LINE__); + frameBuffer->SaveScreen(0, 0, _xres, _yres, screenBuf); + printf(" done.\n"); + } +#endif + bool res = false; pthread_mutex_lock(&getData_mutex); @@ -89,6 +147,20 @@ bool CScreenShot::GetData() #endif if (videoDecoder->getBlank()) get_video = false; +#ifdef BOXMODEL_CS_HD2 + if (extra_osd && !get_video) { + uint32_t memSize = xres * yres * sizeof(fb_pixel_t) * 2; + pixel_data = (uint8_t*)cs_malloc_uncached(memSize); + if (pixel_data == NULL) { + printf("[CScreenShot::%s:%d] memory error\n", __func__, __LINE__); + pthread_mutex_unlock(&getData_mutex); + return false; + } + memset(pixel_data, 0, memSize); + res = true; + } + else +#endif #ifdef SCREENSHOT res = videoDecoder->GetScreenImage(pixel_data, xres, yres, get_video, get_osd, scale_to_video); #endif @@ -106,6 +178,14 @@ bool CScreenShot::GetData() return false; } +#ifdef BOXMODEL_CS_HD2 + if (extra_osd && screenBuf) { + printf("[CScreenShot::%s:%d] Merge osd screen to screenshot...", __func__, __LINE__); + mergeOsdScreen(_xres, _yres, screenBuf); + delete[] screenBuf; + printf(" done.\n \n"); + } +#endif printf("[CScreenShot::%s:%d] data: %p %d x %d\n", __func__, __LINE__, pixel_data, xres, yres); return true; } @@ -308,7 +388,7 @@ bool CScreenShot::SaveJpg() int xres2 = xres1+2; for (int x = 0; x < xres; x++) { int x2 = x*3; - memmove(pixel_data + x2 + xres1, pixel_data + x*4 + y*xres*4, 3); + memcpy(pixel_data + x2 + xres1, pixel_data + x*4 + y*xres*4, 3); SWAP(pixel_data[x2 + xres1], pixel_data[x2 + xres2]); } } diff --git a/src/driver/screenshot.h b/src/driver/screenshot.h index fefaf7c78..bf17e72bf 100644 --- a/src/driver/screenshot.h +++ b/src/driver/screenshot.h @@ -40,6 +40,7 @@ class CScreenShot unsigned char * pixel_data; int xres; int yres; + bool extra_osd; bool get_osd; bool get_video; bool scale_to_video; @@ -61,6 +62,10 @@ class CScreenShot void runThread(); static void cleanupThread(void *arg); +#ifdef BOXMODEL_CS_HD2 + bool mergeOsdScreen(uint32_t dx, uint32_t dy, fb_pixel_t* osdData); +#endif + public: CScreenShot(const std::string fname = "", screenshot_format_t fmt = CScreenShot::FORMAT_JPG); ~CScreenShot(); diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index cabaf9297..b4dcfc413 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -73,6 +73,7 @@ libneutrino_gui_a_SOURCES = \ network_setup.cpp \ nfs.cpp \ opkg_manager.cpp \ + osd_helpers.cpp \ osd_progressbar_setup.cpp \ osd_setup.cpp \ osdlang_setup.cpp \ diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 4c17fb630..e956071ce 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -262,7 +262,7 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey) m_fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); int iw, ih; - m_frameBuffer->getIconSize(NEUTRINO_ICON_MP3, &iw, &ih); + m_frameBuffer->getIconSize(NEUTRINO_ICON_AUDIO, &iw, &ih); m_theight = std::max(m_theight, ih+4); m_title_height = m_fheight*2 + 20 + m_sheight + 4; @@ -1537,7 +1537,7 @@ void CAudioPlayerGui::paintHead() if (!m_show_playlist || m_screensaver) return; - CComponentsHeaderLocalized header(m_x, m_y + m_title_height, m_width, m_theight, LOCALE_AUDIOPLAYER_HEAD, NEUTRINO_ICON_MP3); + CComponentsHeaderLocalized header(m_x, m_y + m_title_height, m_width, m_theight, LOCALE_AUDIOPLAYER_HEAD, NEUTRINO_ICON_AUDIO); header.setCorner(RADIUS_MID, CORNER_TOP); if (m_inetmode) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 0575adf3d..6104e7489 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -414,7 +414,7 @@ int CBouquetList::show(bool bShowChannelList) for (unsigned int count = 0; count < sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]); count++) { - int w_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getRenderWidth(g_Locale->getText(CBouquetListButtons[count].locale)); + int w_text = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT]->getRenderWidth(g_Locale->getText(CBouquetListButtons[count].locale)); w_max_text = std::max(w_max_text, w_text); frameBuffer->getIconSize(CBouquetListButtons[count].button, &icol_w, &icol_h); w_max_icon = std::max(w_max_icon, icol_w); diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index 848f6fb66..4047e6326 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -37,7 +37,7 @@ using namespace std; -CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, 700, 500, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) +CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, CCW_PERCENT 90, CCW_PERCENT 90, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) { initVarBuildInfo(); if (show) diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp index 81da16c5e..82dd27cca 100644 --- a/src/gui/components/cc_detailsline.cpp +++ b/src/gui/components/cc_detailsline.cpp @@ -61,7 +61,7 @@ void CComponentsDetailsLine::initVarDline( const int& x_pos, const int& y_pos_to shadow_w = 1; //CComponentsDetailsLine - thickness = 4; /* MUST be an even value! */ + dl_w = CFrameBuffer::getInstance()->scale2Res(3); cc_body_gradient_enable = false; } @@ -101,6 +101,7 @@ void CComponentsDetailsLine::paint(bool do_save_bg) int y_mark_top = y-h_mark_top/2; int y_mark_down = y_down-h_mark_down/2; + int dx_c = dl_w%2; //correction for odd values cc_fbdata_t fbdata[] = { @@ -108,26 +109,26 @@ void CComponentsDetailsLine::paint(bool do_save_bg) {true, CC_FBDATA_TYPE_BGSCREEN, x, y_mark_top, width, y_mark_down-y_mark_top+h_mark_down+sw, 0, 0, 0, 0, NULL, NULL, NULL, false}, /* vertical item mark | */ - {true, CC_FBDATA_TYPE_BOX, x+width-thickness-sw, y_mark_top, thickness, h_mark_top, col_body, 0, 0, 0, NULL, NULL, NULL, false}, + {true, CC_FBDATA_TYPE_BOX, x+width-dl_w-sw, y_mark_top, dl_w, h_mark_top, col_body, 0, 0, 0, NULL, NULL, NULL, false}, {true, CC_FBDATA_TYPE_BOX, x+width-sw, y_mark_top+sw, sw, h_mark_top-sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, - {true, CC_FBDATA_TYPE_BOX, x+width-thickness, y_mark_top+h_mark_top, thickness, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, + {true, CC_FBDATA_TYPE_BOX, x+width-dl_w, y_mark_top+h_mark_top, dl_w, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, /* horizontal item line - */ - {true, CC_FBDATA_TYPE_BOX, x, y-thickness/2, width-thickness-sw, thickness, col_body, 0, 0, 0, NULL, NULL, NULL, false}, - {true, CC_FBDATA_TYPE_BOX, x+thickness, y+thickness/2, width-2*thickness-sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, + {true, CC_FBDATA_TYPE_BOX, x, y-dl_w/2, width-dl_w-sw, dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false}, + {true, CC_FBDATA_TYPE_BOX, x+dl_w, y+dl_w/2+dx_c, width-2*dl_w-sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, /* vertical connect line [ */ - {true, CC_FBDATA_TYPE_BOX, x, y+thickness/2, thickness, y_down-y-thickness, col_body, 0, 0, 0, NULL, NULL, NULL, false}, - {true, CC_FBDATA_TYPE_BOX, x+thickness, y+thickness/2+sw, sw, y_down-y-thickness-sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, + {true, CC_FBDATA_TYPE_BOX, x, y+dl_w/2+dx_c, dl_w, y_down-y-dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false}, + {true, CC_FBDATA_TYPE_BOX, x+dl_w, y+dl_w/2+dx_c, sw, y_down-y-dl_w, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, /* horizontal info line - */ - {true, CC_FBDATA_TYPE_BOX, x, y_down-thickness/2, width-thickness-sw, thickness, col_body, 0, 0, 0, NULL, NULL, NULL, false}, - {true, CC_FBDATA_TYPE_BOX, x+sw, y_down+thickness/2, width-thickness-2*sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, + {true, CC_FBDATA_TYPE_BOX, x, y_down-dl_w/2, width-dl_w-sw, dl_w, col_body, 0, 0, 0, NULL, NULL, NULL, false}, + {true, CC_FBDATA_TYPE_BOX, x+sw, y_down+dl_w/2+dx_c, width-dl_w-2*sw, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, /* vertical info mark | */ - {true, CC_FBDATA_TYPE_BOX, x+width-thickness-sw, y_mark_down, thickness, h_mark_down, col_body, 0, 0, 0, NULL, NULL, NULL, false}, + {true, CC_FBDATA_TYPE_BOX, x+width-dl_w-sw, y_mark_down, dl_w, h_mark_down, col_body, 0, 0, 0, NULL, NULL, NULL, false}, {true, CC_FBDATA_TYPE_BOX, x+width-sw, y_mark_down+sw, sw, h_mark_down-sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, - {true, CC_FBDATA_TYPE_BOX, x+width-thickness, y_mark_down+h_mark_down,thickness, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, + {true, CC_FBDATA_TYPE_BOX, x+width-dl_w, y_mark_down+h_mark_down,dl_w, sw, col_shadow, 0, 0, 0, NULL, NULL, NULL, false}, }; for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) diff --git a/src/gui/components/cc_detailsline.h b/src/gui/components/cc_detailsline.h index be07ef57f..66197f51f 100644 --- a/src/gui/components/cc_detailsline.h +++ b/src/gui/components/cc_detailsline.h @@ -40,8 +40,8 @@ Not usable as CCItem! class CComponentsDetailsLine : public CComponents { private: - ///property: line thickness - int thickness; + ///property: line width + int dl_w; ///property: lowest y position int y_down; ///property: height of top marker @@ -73,6 +73,8 @@ class CComponentsDetailsLine : public CComponents ///set all positions and dimensions of details line at once void setDimensionsAll(const int& x_pos,const int& y_pos, const int& y_pos_down, const int& h_mark_top_ , const int& h_mark_down_) {setXPos(x_pos); setYPos(y_pos); setYPosDown(y_pos_down); setHMarkTop(h_mark_top_); setHMarkDown(h_mark_down_);} + ///property: set line thickness + void setLineWidth(const int& w){dl_w = w;} ///paint all to screen void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 864336d91..0587d90db 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -31,7 +31,8 @@ #include -#define DEF_HEIGHT 27 +#define DEF_HEIGHT CFrameBuffer::getInstance()->scale2Res(27) +#define DEF_WIDTH CFrameBuffer::getInstance()->scale2Res(300) #define DEF_LABEL_WIDTH_PERCENT 30 using namespace std; @@ -39,7 +40,7 @@ using namespace std; CComponentsExtTextForm::CComponentsExtTextForm(CComponentsForm* parent) { Font* t_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_INFO]; - initVarExtTextForm(0, 0, 300, t_font->getHeight(), "", "", t_font, parent, CC_SHADOW_OFF, COL_MENUCONTENTINACTIVE_TEXT, COL_MENUCONTENT_TEXT, COL_FRAME_PLUS_0, COL_MENUCONTENT_PLUS_0, COL_SHADOW_PLUS_0); + initVarExtTextForm(0, 0, DEF_WIDTH, t_font->getHeight(), "", "", t_font, parent, CC_SHADOW_OFF, COL_MENUCONTENTINACTIVE_TEXT, COL_MENUCONTENT_TEXT, COL_FRAME_PLUS_0, COL_MENUCONTENT_PLUS_0, COL_SHADOW_PLUS_0); initCCTextItems(); } @@ -86,8 +87,7 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p width = w; //init ccx_label_width and ccx_text_width //default ccx_label_width = 30% of form width - ccx_percent_label_w = DEF_LABEL_WIDTH_PERCENT; - ccx_label_width = ccx_percent_label_w * width/100; + ccx_label_width = DEF_LABEL_WIDTH_PERCENT * width/100; ccx_text_width = width-ccx_label_width; height = h; @@ -223,7 +223,8 @@ void CComponentsExtTextForm::initCCTextItems() void CComponentsExtTextForm::setLabelWidthPercent(const uint8_t& percent_val) { - ccx_percent_label_w = (int)percent_val; + ccx_label_width = (int)percent_val * width/100; + ccx_text_width = width-ccx_label_width; initCCTextItems(); } diff --git a/src/gui/components/cc_frm_ext_text.h b/src/gui/components/cc_frm_ext_text.h index 837eb8c18..4e37efd0f 100644 --- a/src/gui/components/cc_frm_ext_text.h +++ b/src/gui/components/cc_frm_ext_text.h @@ -49,8 +49,6 @@ class CComponentsExtTextForm : public CComponentsForm, public CCTextScreen int ccx_text_width; ///property: font type of both items (label and text), see also setLabelAndText() Font* ccx_font; - ///property: percentage val of label width related to full width, causes fit of text automatically into the available remaining size of item, see also setLabelWidthPercent() - uint8_t ccx_percent_label_w; ///centered y position of label and text int y_text; diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 4d43e08be..39aaffbf8 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -169,9 +169,13 @@ void CComponentsWindow::initWindowSize() if (cc_parent) return; + if (width < 0 && width >= -100) //percentage conversion TODO: behavior inside parent + width = frameBuffer->getScreenWidth()*abs(width)/100; if (width == 0 || (unsigned)width > frameBuffer->getScreenWidth()) width = frameBuffer->getScreenWidth(); + if (height < 0 && height >= -100) //percentage conversion TODO: behavior inside parent + height = frameBuffer->getScreenHeight()*abs(height)/100; if (height == 0 || (unsigned)height > frameBuffer->getScreenHeight()) height = frameBuffer->getScreenHeight(); } diff --git a/src/gui/components/cc_frm_window.h b/src/gui/components/cc_frm_window.h index f6eb80f20..6dfe67df8 100644 --- a/src/gui/components/cc_frm_window.h +++ b/src/gui/components/cc_frm_window.h @@ -29,6 +29,8 @@ #include "cc_frm_header.h" #include "cc_frm_footer.h" +#define CCW_PERCENT - //placeholder for negative sign '-', used for discret dimensions parameters + //! Sub class of CComponentsForm. Shows a window with prepared items. /*! CComponentsWindow provides prepared items like header, footer and a container for @@ -128,10 +130,56 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes { CC_WINDOW_ITEM_HEADER = 0 }; - ///simple constructor for CComponentsWindow, this shows a window over full screen + + enum + { + CC_WINDOW_LEFT_SIDEBAR = 1, + CC_WINDOW_RIGHT_SIDEBAR = 2 + }; + + + /**simple constructor for CComponentsWindow, this shows a window over full screen + * @param[in] parent + * @li optional: expects type CComponentsForm * as possible parent object, default = NULL + */ CComponentsWindow(CComponentsForm *parent = NULL); - ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window + /** + * advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window + * @param[in] x_pos + * @li expects type const &int, defines x position on screen + * @param[in] y_pos + * @li expects type const &int, defines y position on screen + * @param[in] w + * @li expects type const &int, width of window, Note: value = 0 uses full screen + * @param[in] h + * @li expects type const &int, height of window, Note: value = 0 uses full screen + * @param[in] caption + * @li optional: expects type const std::string&, defines title of window header + * @param[in] iconname + * @li optional: expects type const std::string&, defines icon name of window header + * @param[in] parent + * @li optional: expects type CComponentsForm * as possible parent object, default = NULL + * @param[in] shadow_mode + * @li optional: expects type int as mode, default = CC_SHADOW_OFF \n + * possible values are \n + * CC_SHADOW_ON = (CC_SHADOW_RIGHT | CC_SHADOW_BOTTOM | CC_SHADOW_CORNER_BOTTOM_LEFT | CC_SHADOW_CORNER_BOTTOM_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT) \n + * Take a look into cc_types.h + * @param[in] color_frame + * @li optional: expects type fb_pixel_t, defines frame color, default = COL_FRAME_PLUS_0 + * @param[in] color_body + * @li optional: expects type fb_pixel_t, defines color color, default = COL_MENUCONTENT_PLUS_0 + * @param[in] color_shadow + * @li optional: expects type fb_pixel_t, defines shadow color, default = COL_SHADOW_PLUS_0 + * + * @note Discret dimensions parameters: values < 0 to -100 will be interpreted as percent values related to screen. + * For better readability please use placeholder 'CCW_PERCENT' as negative sign '-' \n + * Example: \n + * this inits a window with position x100 y100 on screen with dimensions 700px x 800px \n + * CComponentsWindow win(100, 100, 700, 800, "Test window");\n + * this inits a window with position x100 y100 on screen with 50% of screen size assigned with discret percental screen dimensions \n + * CComponentsWindow win(100, 100, CCW_PERCENT 50, CCW_PERCENT 50, "Test window"); + */ CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption = "", const std::string& iconname = "", @@ -141,7 +189,12 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); - ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption from locales, x_pos or y_pos = 0 will center window + /** + * advanced constructor for CComponentsWindow, provides parameters for the most required properties + * @param[in] locale_text + * @li optional: expects type neutrino_locale_t, defines title of window header + * @see for other parameters take a look to CComponentsWindow base class above + */ CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const std::string& iconname = "", @@ -151,92 +204,249 @@ class CComponentsWindow : public CComponentsForm, CCHeaderTypes fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); - ///add item to body object, also usable is addCCItem() to add items to the windo object + /** + * Add an item to body object, also usable is addCCItem() to add items to the window object + * @param[in] cc_Item + * @li expects type CComponentsItem* , defines a cc item + * @return Returns item ID + * @see Take a look to cc_types.h for possible types. + */ int addWindowItem(CComponentsItem* cc_Item); - ///allow/disallow paint a footer, default true, see also ccw_show_footer, showHeader() - void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();}; - ///allow/disallow paint a header, default true, see also ccw_show_header, showFooter() - void showHeader(bool show = true){ccw_show_header = show; initCCWItems();}; + /** + * enable/disable paint of footer, default true + * @param[in] show + * @li expects type bool, default = true + * @see ccw_show_footer, showHeader() + */ + void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();} - enum - { - CC_WINDOW_LEFT_SIDEBAR = 1, - CC_WINDOW_RIGHT_SIDEBAR = 2 - }; - ///allow/disallow paint a sidebar, default are enabled + /** + * enable/disable paint of header, default true + * @param[in] show + * @li expects type bool, default = true + * @see ccw_show_header, showFooter() + */ + void showHeader(bool show = true){ccw_show_header = show; initCCWItems();} + + /** + * enable/disable paint of sidebar, + * @param[in] show + * @li optional: expects type const int&, default = enabled + */ void enableSidebar(const int& sidbar_type = CC_WINDOW_LEFT_SIDEBAR | CC_WINDOW_RIGHT_SIDEBAR); - ///set caption in header with string, see also getHeaderObject() + /** + * sets title text in header + * @param[in] text + * @li expects type const std::string&, defines title of window header + * @param[in] align_mode + * @li optional: expects type const cc_title_alignment_t&, defines allignment of title text + * @see CTextBox for alignment modes + */ void setWindowCaption(const std::string& text, const cc_title_alignment_t& align_mode = DEFAULT_TITLE_ALIGN){ccw_caption = text; ccw_align_mode = align_mode;} - ///set header text color + /** + * sets title text in header + * @param[in] text + * @li expects type neutrino_locale_t + * @param[in] align_mode + * @li optional: expects type const cc_title_alignment_t&, defines allignment of title text + * @see CTextBox for alignment modes + */ + void setWindowCaption(neutrino_locale_t locale_text, const cc_title_alignment_t& align_mode = DEFAULT_TITLE_ALIGN); + + /** + * Sets header text color + * @param[in] const fb_pixel_t& + * @li expects type const fb_pixel_t& + */ void setWindowHeaderTextColor(const fb_pixel_t& color){ccw_col_head_text = color;} - ///set background to header + + /** + * Sets header background color + * @param[in] const fb_pixel_t& + * @li expects type const fb_pixel_t& + */ void setWindowHeaderColor(const fb_pixel_t& color){ccw_col_head = color;} - ///set caption in header from locales, see also getHeaderObject() - void setWindowCaption(neutrino_locale_t locale_text, const cc_title_alignment_t& align_mode = DEFAULT_TITLE_ALIGN); - ///set caption alignment, see CTextBox for possible modes + /** + * sets title text alignment + * @param[in] align_mode + * @li expects type const cc_title_alignment_t& + * @see CTextBox for alignment modes + */ void setWindowCaptionAlignment(const cc_title_alignment_t& align_mode){ccw_align_mode = align_mode;}; - ///set icon name in header, see also getHeaderObject() + /** + * Sets icon name of window header. + * @param[in] iconname + * @li expects type const std::string& + */ void setWindowIcon(const std::string& iconname){ccw_icon_name = iconname; initHeader();}; ///set default header icon buttons, see also getHeaderObject() - void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;}; + /** + * Sets context buttons in window header. + * @param[in] buttons + * @li expects type const int& + * @note possible types are: + * CC_BTN_HELP, + CC_BTN_INFO, + CC_BTN_MENU, + CC_BTN_EXIT, + CC_BTN_MUTE_ZAP_ACTIVE, + CC_BTN_MUTE_ZAP_INACTIVE, + CC_BTN_OKAY, + CC_BTN_MUTE, + CC_BTN_UP, + CC_BTN_DOWN, + CC_BTN_LEFT, + CC_BTN_RIGHT, + CC_BTN_FORWARD, + CC_BTN_BACKWARD, + CC_BTN_PAUSE, + CC_BTN_PLAY, + CC_BTN_RECORD_ACTIVE, + CC_BTN_RECORD_INACTIVE, + CC_BTN_RECORD_STOP, + * @see cc_frm_header.h for current types + */ + void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;} - ///returns a pointer to the internal header object, use this to get access to header properities - CComponentsHeader* getHeaderObject(){return ccw_head;}; + /** + * Gets a pointer to the internal header object, use this to get direct access to header properities + * @return CComponentsHeader* + */ + CComponentsHeader* getHeaderObject(){return ccw_head;} - ///returns a pointer to the internal body object, use this to get access to body properities - CComponentsForm* getBodyObject(){return ccw_body;}; - ///returns a pointer to the internal footer object, use this to get access to footer properities - CComponentsFooter* getFooterObject(){return ccw_footer;}; + /** + * Gets a pointer to the internal body object, use this to get access to body properities + * @return CComponentsForm* + */ + CComponentsForm* getBodyObject(){return ccw_body;} - ///set background to footer + /** + * Gets a pointer to the internal footer object, use this to get access to footer properities + * @return CComponentsFooter* + */ + CComponentsFooter* getFooterObject(){return ccw_footer;} + + /** + * Sets footer background color + * @param[in] color + * @li expects type const fb_pixel_t& + */ void setWindowFooterColor(const fb_pixel_t& color){ccw_col_footer = color;} - ///set font for footer buttons + + /** + * Sets font for footer buttons + * @param[in] font_type + * @li expects type Font* + */ void setWindowFooterFont(Font* font_type){ccw_button_font = font_type;} - ///returns a pointer to the internal left side bar object, use this to get access to left sidebar properities - CComponentsFrmChain* getLeftSidebarObject(){return ccw_left_sidebar;}; - ///returns a pointer to the internal right side bar object, use this to get access to right sidebar properities - CComponentsFrmChain* getRightSidebarObject(){return ccw_right_sidebar;}; - ///sets width of sidebars - void setWidthSidebar(const int& sidebar_width){ccw_w_sidebar = sidebar_width; initCCWItems();}; + /** + * Gets a pointer to the internal left side bar object, use this to get access to left sidebar properities + * @return CComponentsFrmChain* + */ + CComponentsFrmChain* getLeftSidebarObject(){return ccw_left_sidebar;} - ///sets current page, NOTE: this is simliar with setCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object + /** + * Gets a pointer to the internal right side bar object, use this to get access to right sidebar properities + * @return CComponentsFrmChain* + */ + CComponentsFrmChain* getRightSidebarObject(){return ccw_right_sidebar;} + + /** + * Sets width of sidebars + * @param[in] sidebar_width + * @li expects type const int& + */ + void setWidthSidebar(const int& sidebar_width){ccw_w_sidebar = sidebar_width; initCCWItems();} + + /** + * Sets current page number + * @param[in] sidebar_width + * @li expects type const int& + * @note This is simliar to setCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object. + */ void setCurrentPage(const u_int8_t& current_page); - ///get current page, NOTE: this is simliar with getCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object + + /** + * Gets current page number + * @return CComponentsFrmChain* + * @note This simliar to getCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object + */ u_int8_t getCurrentPage(); - ///paint window body items, this paints only the current page, body = page, current page is definied in body object, see setCurrentPage() + /** + * Paints window body items, this paints only the current page, body = page, current page is definied in body object, see setCurrentPage() + * @param[in] do_save_bg + * @li optional: expects type bool, default = CC_SAVE_SCREEN_NO (false), sets background save mode + */ void paintCurPage(bool do_save_bg = CC_SAVE_SCREEN_NO); - ///paint defined page of body, parameter number 0...n + + /** + * Paints defined page of body, parameter number 0...n + * @param[in] page_number + * @li expects type const u_int8_t& as page number + * @param[in] do_save_bg + * @li optional: expects type bool, default = CC_SAVE_SCREEN_NO (false), sets background save mode + */ void paintPage(const u_int8_t& page_number, bool do_save_bg = CC_SAVE_SCREEN_NO); - ///enable/disable page scroll, parameter1 default enabled for up/down keys, only for body! + + /** + * enable/disable page scroll + * @param[in] mode + * @li optional: expects type const int&, default enabled for up/down keys, only for body! + */ void enablePageScroll(const int& mode = PG_SCROLL_M_UP_DOWN_KEY); - ///set width of body scrollbar + /** + * Sets width of body scrollbar + * @param[in] crollbar_width + * @li expects type const int& + */ void setScrollBarWidth(const int& scrollbar_width); - ///refresh position and dimension and reinitialize elemenatary properties + /** + * Reinit position and dimensions and reinitialize mostly elemenatary properties + */ void Refresh(){initCCWItems();}; - ///paint all window items, this overwriting paint() from CComponentsForm + /** + * Paint window + * @param[in] do_save_bg + * @li optional: expects type bool, sets background save mode + */ void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - ///adds additional exec key to current collection, default exit keys are CRCInput::RC_home and CRCInput::RC_setup + /** + * Adds an additional exec key to current collection, default exit keys are CRCInput::RC_home and CRCInput::RC_setup + * @param[in] key + * @li expects type const neutrino_msg_t& + * @see river/rcinput.h for possible keys + */ virtual void addExitKey(const neutrino_msg_t& key){getBodyObject()->addExitKey(key);} - ///remove all current exec keys from current collection, NOTE: use addExitKey() if new exec key is required + + /** + * Removes all current exec keys from current collection. + * @note use addExitKey() if new exec key is required + */ virtual void removeExitKeys(){getBodyObject()->removeExitKeys();} }; class CComponentsWindowMax : public CComponentsWindow { public: - ///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, this shows a centered window based up current screen settings + /** + * Simple constructor for CComponentsWindow, this shows only a centered window based up current screen settings + * @see for other parameters take a look to CComponentsWindow base class above + * @param[in] caption + * @li expects type const std::string&, defines title of window header + * @see for other parameters take a look to CComponentsWindow base class above + */ CComponentsWindowMax( const std::string& caption, const std::string& iconname = "", CComponentsForm *parent = NULL, int shadow_mode = CC_SHADOW_OFF, @@ -244,7 +454,13 @@ class CComponentsWindowMax : public CComponentsWindow fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); - ///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, this shows a centered window based up current screen settings + /** + * Simple constructor for CComponentsWindow, this shows only a centered window based up current screen settings + * @see for other parameters take a look to CComponentsWindow base class above + * @param[in] locale_text + * @li expects type neutrino_locale_t, defines title of window header + * @see for other parameters take a look to CComponentsWindow base class above + */ CComponentsWindowMax( neutrino_locale_t locale_caption, const std::string& iconname = "", CComponentsForm *parent = NULL, int shadow_mode = CC_SHADOW_OFF, diff --git a/src/gui/components/cc_item_progressbar.h b/src/gui/components/cc_item_progressbar.h index b158bd49e..610402687 100644 --- a/src/gui/components/cc_item_progressbar.h +++ b/src/gui/components/cc_item_progressbar.h @@ -157,9 +157,6 @@ class CProgressBar : public CComponentsItem //set gradient (overides g_settings.theme.progressbar_gradient) void setGradient(int &gradient) { pb_gradient = &gradient; } - - void setXPos(const int& xpos){CCDraw::setXPos(xpos);} - void setYPos(const int& ypos){CCDraw::setYPos(ypos);} }; #endif /* __CC_PROGRESSBAR_H__ */ diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 532aba066..1db5ed7aa 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -197,8 +197,8 @@ typedef struct button_label_cc directKeys(1, CRCInput::RC_nokey){} } button_label_cc_struct; -#define CC_WIDTH_MIN 16 -#define CC_HEIGHT_MIN 16 +#define CC_WIDTH_MIN CFrameBuffer::getInstance()->scale2Res(16) +#define CC_HEIGHT_MIN CC_WIDTH_MIN #define CC_SHADOW_OFF 0x0 #define CC_SHADOW_RIGHT 0x2 diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 7d554df79..f740daafc 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -1383,6 +1383,8 @@ void EpgPlus::hide() if (this->header->head) { this->header->head->kill(); + delete this->header->head; + this->header->head = NULL; } this->frameBuffer->paintBackgroundBoxRel(this->usableScreenX - DETAILSLINE_WIDTH, this->usableScreenY, DETAILSLINE_WIDTH + this->usableScreenWidth, this->usableScreenHeight); } diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index f861a2d35..fcc4c0682 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -269,19 +269,18 @@ void CFileBrowser::fontInit() height = frameBuffer->getScreenHeightRel(); x = getScreenStartX(width); - theight = fnt_title->getHeight(); - fheight = fnt_item->getHeight(); - if (fheight == 0) - fheight = 1; /* avoid div by zero on invalid font */ - //foheight = fnt_foot->getHeight()+6; //initial height value for buttonbar; TODO get value from buttonbar - foheight = paintFoot(false); - skwidth = 26; + header_height = fnt_title->getHeight(); + item_height = fnt_item->getHeight(); + if (item_height == 0) + item_height = 1; /* avoid div by zero on invalid font */ + footer_height = paintFoot(false); + smskey_width = fnt_foot->getRenderWidth("M") + OFFSET_INNER_MID; liststart = 0; - listmaxshow = std::max(1,(int)(height - theight - foheight)/fheight); + listmaxshow = std::max(1,(int)(height - header_height - footer_height)/item_height); //recalc height - height = theight + listmaxshow * fheight + foheight; + height = header_height + listmaxshow * item_height + footer_height; y = getScreenStartY(height); } @@ -1168,8 +1167,8 @@ void CFileBrowser::hide() void CFileBrowser::paintItem(unsigned int pos) { - int colwidth1, colwidth2, colwidth3; - int ypos = y+ theight+0 + pos*fheight; + int col1_width, col2_width, col3_width; + int ypos = y + header_height + pos*item_height; CFile * actual_file = NULL; std::string fileicon; unsigned int currpos = liststart + pos; @@ -1177,7 +1176,7 @@ void CFileBrowser::paintItem(unsigned int pos) if (currpos >= filelist.size()) { // just paint an empty line - frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, COL_MENUCONTENT_PLUS_0); return; } @@ -1197,15 +1196,15 @@ void CFileBrowser::paintItem(unsigned int pos) i_radius = RADIUS_LARGE; if (i_radius) - frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, bgcolor, i_radius); if (g_settings.filebrowser_showrights == 0 && S_ISREG(actual_file->Mode)) - colwidth2 = 0; + col2_width = 0; else - colwidth2 = fnt_item->getRenderWidth("rwxrwxrwx"); - colwidth3 = fnt_item->getRenderWidth("222.222G"); - colwidth1 = width - 35 - colwidth2 - colwidth3 - 10; + col2_width = fnt_item->getRenderWidth("rwxrwxrwx"); + col3_width = fnt_item->getRenderWidth("222.222G"); + col1_width = width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - col3_width - OFFSET_INNER_MID - col2_width - OFFSET_INNER_MID; if ( !actual_file->Name.empty() ) { @@ -1220,6 +1219,7 @@ void CFileBrowser::paintItem(unsigned int pos) case CFile::FILE_WAV: case CFile::FILE_FLAC: case CFile::FILE_AAC: + case CFile::FILE_PLAYLIST: fileicon = NEUTRINO_ICON_MP3; break; @@ -1228,13 +1228,31 @@ void CFileBrowser::paintItem(unsigned int pos) break; case CFile::FILE_PICTURE: + fileicon = NEUTRINO_ICON_PICTURE; + break; + + case CFile::FILE_AVI: + case CFile::FILE_ASF: + case CFile::FILE_MKV: + case CFile::FILE_VOB: + case CFile::FILE_MPG: + case CFile::FILE_TS: + fileicon = NEUTRINO_ICON_MOVIE; + break; + case CFile::FILE_TEXT: default: fileicon = NEUTRINO_ICON_FILE; } - frameBuffer->paintIcon(fileicon, x+5 , ypos + (fheight-16) / 2 ); - fnt_item->RenderString(x + 35, ypos + fheight, colwidth1 - 10 , FILESYSTEM_ENCODING_TO_UTF8_STRING(actual_file->getFileName()), color); + int icon_w = 0; + int icon_h = 0; + frameBuffer->getIconSize(NEUTRINO_ICON_FILE, &icon_w, &icon_h); + + frameBuffer->paintIcon(fileicon, x + OFFSET_INNER_MID, ypos, item_height); + + int col1_offset = OFFSET_INNER_MID + icon_w + OFFSET_INNER_MID; + fnt_item->RenderString(x + col1_offset, ypos + item_height, col1_width - col1_offset, FILESYSTEM_ENCODING_TO_UTF8_STRING(actual_file->getFileName()), color); if( S_ISREG(actual_file->Mode) ) { @@ -1247,13 +1265,13 @@ void CFileBrowser::paintItem(unsigned int pos) modestring[9] = 0; - fnt_item->RenderString(x + width - 25 - colwidth3 - colwidth2 , ypos+ fheight, colwidth2, modestring, color); + fnt_item->RenderString(x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - col3_width - OFFSET_INNER_MID - col2_width , ypos + item_height, col2_width, modestring, color); } #define GIGABYTE 1073741824LL #define MEGABYTE 1048576LL #define KILOBYTE 1024LL - char tmpstr[256]; + char sizestring[256]; const char *unit = ""; int64_t factor = 0; if (actual_file->Size >= GIGABYTE) @@ -1275,14 +1293,14 @@ void CFileBrowser::paintItem(unsigned int pos) { int a = actual_file->Size / factor; int b = (actual_file->Size - a * factor) * 1000 / factor; - snprintf(tmpstr, sizeof(tmpstr), "%d.%03d%s", a, b, unit); + snprintf(sizestring, sizeof(sizestring), "%d.%03d%s", a, b, unit); } else - snprintf(tmpstr,sizeof(tmpstr),"%d", (int)actual_file->Size); + snprintf(sizestring,sizeof(sizestring),"%d", (int)actual_file->Size); /* right align file size */ - int sz_w = fnt_item->getRenderWidth(tmpstr); - fnt_item->RenderString(x + width - sz_w - 25, ypos+ fheight, sz_w, tmpstr, color); + int sz_w = fnt_item->getRenderWidth(sizestring); + fnt_item->RenderString(x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - sz_w, ypos + item_height, sz_w, sizestring, color); } if(actual_file->isDir()) @@ -1293,7 +1311,7 @@ void CFileBrowser::paintItem(unsigned int pos) strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&rawtime)); /* right align directory time */ int time_w = fnt_item->getRenderWidth(timestring); - fnt_item->RenderString(x + width - time_w - 25, ypos+ fheight, time_w, timestring, color); + fnt_item->RenderString(x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - time_w, ypos + item_height, time_w, timestring, color); } } } @@ -1318,16 +1336,16 @@ void CFileBrowser::paintHead() /* too long? Leave out the "Filebrowser" or "Shoutcast" prefix * the allocated space is sufficient since it is surely shorter than before */ - if (fnt_title->getRenderWidth(l_name) > width - 11) + if (fnt_title->getRenderWidth(l_name) > width - 2*OFFSET_INNER_MID) l = sprintf(l_name, "%s", FILESYSTEM_ENCODING_TO_UTF8_STRING(name).c_str()); if (l_name[l - 1] == '/') l_name[--l] = '\0'; /* still too long? the last part is probably more interesting than the first part... */ - while ((fnt_title->getRenderWidth(&l_name[i]) > width - 20) && (i < l)) + while ((fnt_title->getRenderWidth(&l_name[i]) > width - 2*OFFSET_INNER_MID) && (i < l)) i++; - CComponentsHeader header(x, y, width, theight, &l_name[i]); + CComponentsHeader header(x, y, width, header_height, &l_name[i]); header.paint(CC_SAVE_SCREEN_NO); free(l_name); @@ -1361,17 +1379,12 @@ bool chooserDir(std::string &setting_dir, bool test_dir, const char *action_str, return false; } -const struct button_label FileBrowserFilterButton[2] = -{ - { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_FILEBROWSER_FILTER_INACTIVE }, - { NEUTRINO_ICON_BUTTON_BLUE , LOCALE_FILEBROWSER_FILTER_ACTIVE }, -}; - int CFileBrowser::paintFoot(bool show) { - int cnt,res; + int cnt, res; std::string sort_text = g_Locale->getText(LOCALE_MOVIEBROWSER_FOOT_SORT); + sort_text += " "; sort_text += g_Locale->getText(sortByNames[g_settings.filebrowser_sortmethod]); int sort_text_len = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getRenderWidth(g_Locale->getText(LOCALE_MOVIEBROWSER_FOOT_SORT)); @@ -1381,65 +1394,72 @@ int CFileBrowser::paintFoot(bool show) sort_text_len += len; - neutrino_locale_t f_loc = LOCALE_FILEBROWSER_FILTER_INACTIVE; + neutrino_locale_t locale_filebrowser_filter = LOCALE_FILEBROWSER_FILTER_INACTIVE; if (Filter != NULL && use_filter) - f_loc = LOCALE_FILEBROWSER_FILTER_ACTIVE; + locale_filebrowser_filter = LOCALE_FILEBROWSER_FILTER_ACTIVE; - button_label_ext footerButtons_pm[] = { + button_label_ext buttons_playlistmode[] = { { NEUTRINO_ICON_BUTTON_RED, LOCALE_FILEBROWSER_DELETE, NULL, 0, false }, - { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_FILEBROWSER_ADD, NULL, 0, false }, + { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_FILEBROWSER_ADD, NULL, 0, false }, { NEUTRINO_ICON_BUTTON_YELLOW, NONEXISTANT_LOCALE, sort_text.c_str(), sort_text_len, false }, - { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_AUDIOPLAYER_SHUFFLE, NULL, 0, false }, + { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_AUDIOPLAYER_SHUFFLE, NULL, 0, false }, { NEUTRINO_ICON_BUTTON_OKAY, LOCALE_FILEBROWSER_SELECT, NULL, 0, false }, { NEUTRINO_ICON_BUTTON_PLAY, LOCALE_FILEBROWSER_MARK, NULL, 0, false }, }; - button_label_ext footerButtons[] = { + button_label_ext buttons_filelistmode[] = { { NEUTRINO_ICON_BUTTON_RED, NONEXISTANT_LOCALE, sort_text.c_str(), sort_text_len, false }, { NEUTRINO_ICON_BUTTON_OKAY, LOCALE_FILEBROWSER_SELECT, NULL, 0, false }, { NEUTRINO_ICON_BUTTON_MUTE_SMALL, LOCALE_FILEBROWSER_DELETE, NULL, 0, false }, { NEUTRINO_ICON_BUTTON_PLAY, LOCALE_FILEBROWSER_MARK, NULL, 0, false }, - { NEUTRINO_ICON_BUTTON_BLUE, f_loc, NULL, 0, false }, + { NEUTRINO_ICON_BUTTON_BLUE, locale_filebrowser_filter, NULL, 0, false }, }; if (playlistmode) { - cnt = sizeof(footerButtons_pm) / sizeof(button_label_ext); + cnt = sizeof(buttons_playlistmode)/sizeof(button_label_ext); if (!show) - return paintButtons(footerButtons_pm, cnt, 0, 0, 0, 0, 0, false, NULL, NULL); + return paintButtons(buttons_playlistmode, cnt, 0, 0, 0, 0, 0, false, NULL, NULL); } else { - cnt = sizeof(footerButtons) / sizeof(button_label_ext); + cnt = sizeof(buttons_filelistmode)/sizeof(button_label_ext); if (!show) - return paintButtons(footerButtons, cnt, 0, 0, 0, 0, 0, false, NULL, NULL); + return paintButtons(buttons_filelistmode, cnt, 0, 0, 0, 0, 0, false, NULL, NULL); } - int fowidth = width - skwidth; + int footer_width = width - smskey_width; - - if (filelist.empty()) { - frameBuffer->paintBoxRel(x, y + height - foheight, width, foheight, COL_MENUFOOT_PLUS_0, RADIUS_MID, CORNER_BOTTOM); - return foheight; + if (filelist.empty()) + { + // show an empty footer + frameBuffer->paintBoxRel(x, y + height - footer_height, width, footer_height, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); + return footer_height; } + + /* + We can't use CComponentsFooter because + CComponentsFooter can't handle button_label_ext + */ if (playlistmode) - res = paintButtons(footerButtons_pm, Filter ? cnt : cnt - 1, x, y + height - foheight, width, foheight, fowidth); + res = paintButtons(buttons_playlistmode, cnt, x, y + height - footer_height, width, footer_height, footer_width); else - res = paintButtons(footerButtons, Filter ? cnt : cnt - 1, x, y + height - foheight, width, foheight, fowidth); + res = paintButtons(buttons_filelistmode, cnt, x, y + height - footer_height, width, footer_height, footer_width); + paintSMSKey(); return res; } void CFileBrowser::paintSMSKey() { - int skheight = fnt_foot->getHeight(); + int smskey_height = fnt_foot->getHeight(); //background - frameBuffer->paintBoxRel(x + width - skwidth, y + height - foheight, skwidth, foheight, COL_MENUFOOT_PLUS_0, RADIUS_MID, CORNER_BOTTOM_RIGHT); + frameBuffer->paintBoxRel(x + width - smskey_width, y + height - footer_height, smskey_width, footer_height, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM_RIGHT); if(m_SMSKeyInput.getOldKey()!=0) { char cKey[2] = {m_SMSKeyInput.getOldKey(), 0}; cKey[0] = toupper(cKey[0]); int len = fnt_foot->getRenderWidth(cKey); - fnt_foot->RenderString(x + width - skwidth, y + height - foheight + foheight/2 + skheight/2, len, cKey, COL_MENUHEAD_TEXT); + fnt_foot->RenderString(x + width - smskey_width, y + height - footer_height + footer_height/2 + smskey_height/2, len, cKey, COL_MENUHEAD_TEXT); } } @@ -1453,16 +1473,10 @@ void CFileBrowser::paint() paintItem(count); //scrollbar - int ypos = y+ theight; - int sb = fheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); + int total_pages = ((filelist.size() - 1) / listmaxshow) + 1; + int current_page = (selected / listmaxshow); - int sbc= ((filelist.size()- 1)/ listmaxshow)+ 1; - int sbs= (selected/listmaxshow); - if (sbc < 1) - sbc = 1; - - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs*(sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0, RADIUS_SMALL); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); } void CFileBrowser::SMSInput(const neutrino_msg_t msg) diff --git a/src/gui/filebrowser.h b/src/gui/filebrowser.h index 3d458125d..4de5981c2 100644 --- a/src/gui/filebrowser.h +++ b/src/gui/filebrowser.h @@ -162,10 +162,10 @@ class CFileBrowser unsigned int listmaxshow; std::vector selections; - int fheight; // Fonthoehe Filelist-Inhalt - int theight; // Fonthoehe Filelist-Titel - int foheight; // Hoehe der button leiste - int skwidth; // width SMSKey field + int item_height; + int header_height; + int footer_height; + int smskey_width; std::string name; std::string base; std::string m_baseurl; diff --git a/src/gui/followscreenings.cpp b/src/gui/followscreenings.cpp index 2ee471fd6..9f33be0a7 100644 --- a/src/gui/followscreenings.cpp +++ b/src/gui/followscreenings.cpp @@ -67,7 +67,7 @@ CChannelEventList *CFollowScreenings::getFollowScreenings(void) continue; followlist.push_back(*e); - if (followlist.size() == 1 && !g_settings.timer_followscreenings) + if (followlist.size() == 1 && g_settings.timer_followscreenings == FOLLOWSCREENINGS_OFF) break; } } diff --git a/src/gui/followscreenings.h b/src/gui/followscreenings.h index 53e362e3e..d24d39171 100644 --- a/src/gui/followscreenings.h +++ b/src/gui/followscreenings.h @@ -59,6 +59,12 @@ class CFollowScreenings : public CMenuTarget std::vector forwarders; void updateRightIcon(int i, time_t start, unsigned int duration); public: + enum + { + FOLLOWSCREENINGS_OFF = 0, + FOLLOWSCREENINGS_ON = 1, + }; + CFollowScreenings(const t_channel_id Channel_id, time_t Starttime, time_t Stoptime, const std::string &Title, uint64_t EpgID=0, unsigned char Apids=TIMERD_APIDS_STD, bool Safety=false, std::string RecDir="", CChannelEventList *Evtlist=NULL) : CMenuTarget () { this->channel_id = Channel_id; diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 48884f300..9f6a4ed64 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -89,12 +89,12 @@ const CMenuOptionChooser::keyval HDD_SLEEP_OPTIONS[HDD_SLEEP_OPTION_COUNT] = }; devtool_s CHDDMenuHandler::devtools[] = { - { "ext4", "/sbin/fsck.ext4", "-C 1 -f -y", "/sbin/mkfs.ext4", "-T largefile -m0", false, false }, - { "ext3", "/sbin/fsck.ext3", "-C 1 -f -y", "/sbin/mkfs.ext3", "-T largefile -m0", false, false }, - { "ext2", "/sbin/fsck.ext2", "-C 1 -f -y", "/sbin/mkfs.ext2", "-T largefile -m0", false, false }, - { "vfat", "/sbin/fsck.vfat", "-a", "/sbin/mkfs.vfat", "", false, false }, - { "exfat", "/sbin/fsck.exfat", "", "/sbin/mkfs.exfat", "", false, false }, - { "xfs", "/sbin/xfs_repair", "", "/sbin/mkfs.xfs", "-f", false, false }, + { "ext4", "/sbin/fsck.ext4", "-C 1 -f -y", "/sbin/mkfs.ext4", "-m 0", false, false }, + { "ext3", "/sbin/fsck.ext3", "-C 1 -f -y", "/sbin/mkfs.ext3", "-m 0", false, false }, + { "ext2", "/sbin/fsck.ext2", "-C 1 -f -y", "/sbin/mkfs.ext2", "-m 0", false, false }, + { "vfat", "/sbin/fsck.vfat", "-a", "/sbin/mkfs.vfat", "", false, false }, + { "exfat", "/sbin/fsck.exfat", "", "/sbin/mkfs.exfat", "", false, false }, + { "xfs", "/sbin/xfs_repair", "", "/sbin/mkfs.xfs", "-f", false, false }, }; #define FS_MAX (sizeof(CHDDMenuHandler::devtools)/sizeof(devtool_s)) diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 8dd342ed8..d62fa7487 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -69,7 +69,7 @@ void CImageInfo::Init(void) cc_sub_caption = NULL; b_info = NULL; btn_red = NULL; - item_offset = 10; + item_offset = OFFSET_INNER_MID; item_font = NULL; item_height = 0; y_tmp = 0; @@ -355,7 +355,7 @@ void CImageInfo::InitInfos() y_tmp = 0; for (size_t i=0; igetWidth(), 0, g_Locale->getText(v_info[i].caption), v_info[i].info_text); - item->setLabelWidthPercent(20); + item->setLabelWidthPercent(15); if (!item_font){ item_font = item->getFont(); diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index 54b485b09..5e770faac 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -75,7 +75,7 @@ void CInfoClock::initCCLockItems() setClockFormat("%H:%M", "%H %M"); //set height, NOTE: height is strictly bound to settings - height = g_settings.infoClockFontSize; + height = CFrameBuffer::getInstance()->scale2Res(g_settings.infoClockFontSize); initClockFont(0, height); // set corner radius depending on clock height diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index c590b849c..211cd9fea 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -695,15 +695,15 @@ void CInfoViewer::check_channellogo_ca_SettingsChange() } } -void CInfoViewer::showTitle(t_channel_id chid, const bool calledFromNumZap, int epgpos) +void CInfoViewer::showTitle(t_channel_id chid, const bool calledFromNumZap, int epgpos, bool forcePaintButtonBar/*=false*/) { CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(chid); if(channel) - showTitle(channel, calledFromNumZap, epgpos); + showTitle(channel, calledFromNumZap, epgpos, forcePaintButtonBar); } -void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap, int epgpos) +void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap, int epgpos, bool forcePaintButtonBar/*=false*/) { if(!calledFromNumZap && !(zap_mode & IV_MODE_DEFAULT)) resetSwitchMode(); @@ -727,7 +727,8 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap check_channellogo_ca_SettingsChange(); aspectRatio = 0; last_curr_id = last_next_id = 0; - showButtonBar = !calledFromNumZap; + showButtonBar = (!calledFromNumZap || forcePaintButtonBar); + bool noTimer = (calledFromNumZap && forcePaintButtonBar); fileplay = (ChanNum == 0); newfreq = true; @@ -777,7 +778,7 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap show_dot = !show_dot; if (showButtonBar) { - infoViewerBB->paintshowButtonBar(); + infoViewerBB->paintshowButtonBar(noTimer); } int ChanNumWidth = 0; diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index 415f84f8c..c8df0a74a 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -173,8 +173,8 @@ class CInfoViewer void start(); void showEpgInfo(); - void showTitle(CZapitChannel * channel, const bool calledFromNumZap = false, int epgpos = 0); - void showTitle(t_channel_id channel_id, const bool calledFromNumZap = false, int epgpos = 0); + void showTitle(CZapitChannel * channel, const bool calledFromNumZap = false, int epgpos = 0, bool forcePaintButtonBar = false); + void showTitle(t_channel_id channel_id, const bool calledFromNumZap = false, int epgpos = 0, bool forcePaintButtonBar = false); void lookAheadEPG(const int ChanNum, const std::string & Channel, const t_channel_id new_channel_id = 0, const bool calledFromNumZap = false); //alpha: fix for nvod subchannel update void killTitle(); void getEPG(const t_channel_id for_channel_id, CSectionsdClient::CurrentNextInfo &info); diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index d82f08267..5118bc3f9 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -458,7 +458,7 @@ void CInfoViewerBB::showBBIcons(const int modus, const std::string & icon) } } -void CInfoViewerBB::paintshowButtonBar() +void CInfoViewerBB::paintshowButtonBar(bool noTimer/*=false*/) { if (!is_visible) return; @@ -466,7 +466,9 @@ void CInfoViewerBB::paintshowButtonBar() for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { tmp_bbButtonInfoText[i] = ""; } - g_InfoViewer->sec_timer_id = g_RCInput->addTimer(1*1000*1000, false); + + if (!noTimer) + g_InfoViewer->sec_timer_id = g_RCInput->addTimer(1*1000*1000, false); if (g_settings.infobar_casystem_display < 2) paint_ca_bar(); diff --git a/src/gui/infoviewer_bb.h b/src/gui/infoviewer_bb.h index 753e32a2e..765ddc20a 100644 --- a/src/gui/infoviewer_bb.h +++ b/src/gui/infoviewer_bb.h @@ -141,7 +141,7 @@ class CInfoViewerBB void showIcon_Tuner(void); void showIcon_DD(void); void showBBButtons(bool paintFooter = false); - void paintshowButtonBar(); + void paintshowButtonBar(bool noTimer = false); void getBBButtonInfo(void); void reset_allScala(void); void initBBOffset(void); diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 920c2a8b0..b437c0c41 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2755,7 +2755,7 @@ void CMovieBrowser::updateDir(void) void CMovieBrowser::loadAllTsFileNamesFromStorage(void) { //TRACE("[mb]->loadAllTsFileNamesFromStorage \n"); - int i,size; + size_t i,size; m_movieSelectionHandler = NULL; m_dirNames.clear(); @@ -2766,8 +2766,10 @@ void CMovieBrowser::loadAllTsFileNamesFromStorage(void) size = m_dir.size(); for (i=0; i < size;i++) { - if (*m_dir[i].used == true) + if (*m_dir[i].used == true){ + OnGlobalProgress(i, size, m_dir[i].name); loadTsFileNamesFromDir(m_dir[i].name); + } } TRACE("[mb] Dir%d, Files:%d\n", (int)m_dirNames.size(), (int)m_vMovieInfo.size()); @@ -2875,7 +2877,8 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname) CFileList flist; if (readDir(dirname, &flist) == true) { - for (size_t i = 0; i < flist.size(); i++) + size_t count = flist.size(); + for (size_t i = 0; i < count; i++) { if (S_ISDIR(flist[i].Mode)) { if (m_settings.ts_only || !CFileBrowser::checkBD(flist[i])) { @@ -2886,7 +2889,8 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname) } else { result |= addFile(flist[i], dirItNr); } - OnLoadFile(i, flist.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); + if (result) + OnLocalProgress(i, count, dirname ); } //result = true; } @@ -3125,7 +3129,10 @@ void CMovieBrowser::loadMovies(bool doRefresh) { TRACE("[mb] loadMovies: \n"); - CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_HEAD, 500, 150, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile); + struct timeval t1, t2; + gettimeofday(&t1, NULL); + + CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, CCW_PERCENT 50, CCW_PERCENT 10, NULL, show_mode == MB_SHOW_YT ? &ytparser.OnProgress : &OnLocalProgress, &OnGlobalProgress); loadBox.enableShadow(); loadBox.paint(); @@ -3140,6 +3147,11 @@ void CMovieBrowser::loadMovies(bool doRefresh) } m_file_info_stale = false; + gettimeofday(&t2, NULL); + uint64_t duration = ((t2.tv_sec * 1000000ULL + t2.tv_usec) - (t1.tv_sec * 1000000ULL + t1.tv_usec)) / 1000ULL; + if (duration) + fprintf(stderr, "\033[33m[CMovieBrowser] %s: %" PRIu64 " ms to scan movies \033[0m\n",__func__, duration); + loadBox.hide(); if (doRefresh) diff --git a/src/gui/moviebrowser/mb.h b/src/gui/moviebrowser/mb.h index 607528821..bbaecf735 100644 --- a/src/gui/moviebrowser/mb.h +++ b/src/gui/moviebrowser/mb.h @@ -57,6 +57,7 @@ #include #include #include +#include #define MAX_NUMBER_OF_BOOKMARK_ITEMS MI_MOVIE_BOOK_USER_MAX // we just use the same size as used in Movie info (MAX_NUMBER_OF_BOOKMARK_ITEMS is used for the number of menu items) #define MOVIEBROWSER_SETTINGS_FILE CONFIGDIR "/moviebrowser.conf" @@ -133,7 +134,7 @@ class CYTCacheSelectorTarget : public CMenuTarget }; // Priorities for Developmemt: P1: critical feature, P2: important feature, P3: for next release, P4: looks nice, lets see -class CMovieBrowser : public CMenuTarget +class CMovieBrowser : public CMenuTarget, public CProgressSignals { friend class CYTCacheSelectorTarget; @@ -362,7 +363,6 @@ class CMovieBrowser : public CMenuTarget void clearSelection(); bool supportedExtension(CFile &file); bool addFile(CFile &file, int dirItNr); - sigc::signal OnLoadFile; }; // I tried a lot to use the menu.cpp as ListBox selection, and I got three solution which are all garbage. diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 626882f71..65db7df10 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -157,6 +158,8 @@ void CMoviePlayerGui::Init(void) { playing = false; stopped = true; + currentVideoSystem = -1; + currentOsdResolution = 0; frameBuffer = CFrameBuffer::getInstance(); @@ -242,6 +245,12 @@ void CMoviePlayerGui::cutNeutrino() if (playing) return; +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + COsdHelpers *coh = COsdHelpers::getInstance(); + currentVideoSystem = coh->getVideoSystem(); + currentOsdResolution = coh->getOsdResolution(); +#endif + playing = true; /* set g_InfoViewer update timer to 1 sec, should be reset to default from restoreNeutrino->set neutrino mode */ if (!isWebTV) @@ -274,6 +283,19 @@ void CMoviePlayerGui::restoreNeutrino() if (!playing) return; +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + if ((currentVideoSystem > -1) && + (g_settings.video_Mode == VIDEO_STD_AUTO) && + (g_settings.enabled_auto_modes[currentVideoSystem] == 1)) { + COsdHelpers *coh = COsdHelpers::getInstance(); + if (currentVideoSystem != coh->getVideoSystem()) { + coh->setVideoSystem(currentVideoSystem, false); + coh->changeOsdResolution(currentOsdResolution, false, true); + } + currentVideoSystem = -1; + } +#endif + playing = false; #ifdef HAVE_AZBOX_HARDWARE g_Zapit->setStandby(false); @@ -1358,7 +1380,7 @@ void CMoviePlayerGui::PlayFileLoop(void) } #endif /* in case ffmpeg report incorrect values */ - if(file_prozent > 96 && (playstate == CMoviePlayerGui::PLAY) && (speed == 1)){ + if(file_prozent > 89 && (playstate == CMoviePlayerGui::PLAY) && (speed == 1)){ if(position_tmp != position){ position_tmp = position ; eof2 = 0; diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 1e15997d7..0b6cd507d 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -118,6 +118,8 @@ class CMoviePlayerGui : public CMenuTarget int startposition; int position; int duration; + int currentVideoSystem; + uint32_t currentOsdResolution; unsigned short numpida; unsigned short vpid; diff --git a/src/gui/osd_helpers.cpp b/src/gui/osd_helpers.cpp new file mode 100644 index 000000000..2675cffef --- /dev/null +++ b/src/gui/osd_helpers.cpp @@ -0,0 +1,224 @@ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +extern CInfoClock *InfoClock; +extern CTimeOSD *FileTimeOSD; +extern cVideo *videoDecoder; + +COsdHelpers::COsdHelpers() +{ + g_settings_osd_resolution_save = 0; +} + +COsdHelpers::~COsdHelpers() +{ +} + +COsdHelpers* COsdHelpers::getInstance() +{ + static COsdHelpers* osdh = NULL; + if(!osdh) + osdh = new COsdHelpers(); + + return osdh; +} + +#ifdef ENABLE_CHANGE_OSD_RESOLUTION +void COsdHelpers::changeOsdResolution(uint32_t mode, bool automode/*=false*/, bool forceOsdReset/*=false*/) +{ + size_t idx = 0; + bool resetOsd = false; + uint32_t modeNew; + + CFrameBuffer *frameBuffer = CFrameBuffer::getInstance(); + + if (automode) { + if (g_settings.video_Mode == VIDEO_STD_AUTO) + modeNew = OSDMODE_1080; + else + modeNew = g_settings_osd_resolution_save; + } + else { + modeNew = mode; + } + + int videoSystem = getVideoSystem(); + + if ((g_settings.video_Mode == VIDEO_STD_AUTO) && + (g_settings.enabled_auto_modes[videoSystem] == 1) && + (!isVideoSystem1080(videoSystem))) + modeNew = OSDMODE_720; + +// if (!isVideoSystem1080(videoSystem)) +// modeNew = OSDMODE_720; + + idx = frameBuffer->getIndexOsdResolution(modeNew); + resetOsd = (modeNew != getOsdResolution()) ? true : false; +#if 1 + printf(">>>>>[%s:%d] osd mode: %s => %s, automode: %s, forceOsdReset: %s\n", __func__, __LINE__, + (g_settings.osd_resolution == OSDMODE_720)?"OSDMODE_720":"OSDMODE_1080", + (modeNew == OSDMODE_720)?"OSDMODE_720":"OSDMODE_1080", + (automode)?"true":"false", + (forceOsdReset)?"true":"false"); +#endif + if (forceOsdReset) + resetOsd = true; + + if (frameBuffer->fullHdAvailable()) { + if (frameBuffer->osd_resolutions.empty()) + return; + + bool ivVisible = false; + if (g_InfoViewer && g_InfoViewer->is_visible) { + g_InfoViewer->killTitle(); + ivVisible = true; + } + + int switchFB = frameBuffer->setMode(frameBuffer->osd_resolutions[idx].xRes, + frameBuffer->osd_resolutions[idx].yRes, + frameBuffer->osd_resolutions[idx].bpp); + + if (switchFB == 0) { +//printf("\n>>>>>[%s:%d] New res: %dx%dx%d\n \n", __func__, __LINE__, resW, resH, bpp); + g_settings.osd_resolution = modeNew; + if (InfoClock) + InfoClock->enableInfoClock(false); + frameBuffer->Clear(); + if (resetOsd) { + CNeutrinoApp::getInstance()->setScreenSettings(); + CNeutrinoApp::getInstance()->SetupFonts(CNeutrinoFonts::FONTSETUP_NEUTRINO_FONT); + CVolumeHelper::getInstance()->refresh(); + if (InfoClock) + CInfoClock::getInstance()->ClearDisplay(); + if (FileTimeOSD) + FileTimeOSD->Init(); + if (CNeutrinoApp::getInstance()->channelList) + CNeutrinoApp::getInstance()->channelList->ResetModules(); + } + if (InfoClock) + InfoClock->enableInfoClock(true); + } + if (g_InfoViewer) { + g_InfoViewer->ResetModules(); + g_InfoViewer->start(); + } + if (ivVisible) { + CNeutrinoApp::getInstance()->StopSubtitles(); + g_InfoViewer->showTitle(CNeutrinoApp::getInstance()->channelList->getActiveChannel(), true, 0, true); + CNeutrinoApp::getInstance()->StartSubtitles(); + } + } +} +#else +void COsdHelpers::changeOsdResolution(uint32_t, bool, bool) +{ +} +#endif + +int COsdHelpers::isVideoSystem1080(int res) +{ + if ((res == VIDEO_STD_1080I60) || + (res == VIDEO_STD_1080I50) || + (res == VIDEO_STD_1080P30) || + (res == VIDEO_STD_1080P24) || + (res == VIDEO_STD_1080P25)) + return true; + +#ifdef BOXMODEL_CS_HD2 + if ((res == VIDEO_STD_1080P50) || + (res == VIDEO_STD_1080P60) || + (res == VIDEO_STD_1080P2397) || + (res == VIDEO_STD_1080P2997)) + return true; +#endif + +#if 0 + /* for testing only */ + if (res == VIDEO_STD_720P50) + return true; +#endif + + return false; +} + +#ifdef ENABLE_CHANGE_OSD_RESOLUTION +int COsdHelpers::getVideoSystem() +{ + return videoDecoder->GetVideoSystem(); +} +#else +int COsdHelpers::getVideoSystem() +{ + return g_settings.video_Mode; +} +#endif + +uint32_t COsdHelpers::getOsdResolution() +{ + CFrameBuffer *frameBuffer = CFrameBuffer::getInstance(); + if (frameBuffer->osd_resolutions.size() == 1) + return 0; + + uint32_t yRes = frameBuffer->getScreenHeight(true); + for (size_t i = 0; i < frameBuffer->osd_resolutions.size(); i++) { + if (frameBuffer->osd_resolutions[i].yRes == yRes) + return frameBuffer->osd_resolutions[i].mode; + } + return 0; +} + +#define DEBUGINFO_SETVIDEOSYSTEM + +int COsdHelpers::setVideoSystem(int newSystem, bool remember/* = true*/) +{ + if ((newSystem < 0) || (newSystem > VIDEO_STD_MAX)) + return -1; + + if (newSystem == getVideoSystem()) + return 0; + +#ifdef DEBUGINFO_SETVIDEOSYSTEM + int fd = CFrameBuffer::getInstance()->getFileHandle(); + fb_var_screeninfo var; + fb_fix_screeninfo fix; + + ioctl(fd, FBIOGET_VSCREENINFO, &var); + ioctl(fd, FBIOGET_FSCREENINFO, &fix); + printf(">>>>>[%s - %s:%d] before SetVideoSystem:\n" + " var.xres : %4d, var.yres : %4d, var.yres_virtual: %4d\n" + " fix.line_length : %4d, fix.smem_len: %d Byte\n", + __path_file__, __func__, __LINE__, + var.xres, var.yres, var.yres_virtual, + fix.line_length, fix.smem_len); +#endif + + int ret = videoDecoder->SetVideoSystem(newSystem, remember); + +#ifdef DEBUGINFO_SETVIDEOSYSTEM + ioctl(fd, FBIOGET_VSCREENINFO, &var); + ioctl(fd, FBIOGET_FSCREENINFO, &fix); + printf(">>>>>[%s - %s:%d] after SetVideoSystem:\n" + " var.xres : %4d, var.yres : %4d, var.yres_virtual: %4d\n" + " fix.line_length : %4d, fix.smem_len: %d Byte\n", + __path_file__, __func__, __LINE__, + var.xres, var.yres, var.yres_virtual, + fix.line_length, fix.smem_len); +#endif + + return ret; +} diff --git a/src/gui/osd_helpers.h b/src/gui/osd_helpers.h new file mode 100644 index 000000000..9c78886f0 --- /dev/null +++ b/src/gui/osd_helpers.h @@ -0,0 +1,29 @@ + +#ifndef __osd_helpers__ +#define __osd_helpers__ + +enum { + OSDMODE_720 = 0, + OSDMODE_1080 = 1 +}; + +class COsdHelpers +{ + private: + + public: + COsdHelpers(); + ~COsdHelpers(); + static COsdHelpers* getInstance(); + + int g_settings_osd_resolution_save; + + void changeOsdResolution(uint32_t mode, bool automode=false, bool forceOsdReset=false); + int isVideoSystem1080(int res); + int getVideoSystem(); + uint32_t getOsdResolution(); + int setVideoSystem(int newSystem, bool remember = true); +}; + + +#endif //__osd_helpers__ diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 42b37c424..52ba05713 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -40,6 +40,7 @@ #include #include "osd_setup.h" +#include "osd_helpers.h" #include "themes.h" #include "screensetup.h" #include "osdlang_setup.h" @@ -215,7 +216,7 @@ font_sizes_struct neutrino_font[SNeutrinoSettings::FONT_TYPE_COUNT] = {LOCALE_FONTSIZE_INFOBAR_CHANNAME , 30, CNeutrinoFonts::FONT_STYLE_BOLD , 0}, {LOCALE_FONTSIZE_INFOBAR_INFO , 20, CNeutrinoFonts::FONT_STYLE_REGULAR, 1}, {LOCALE_FONTSIZE_INFOBAR_SMALL , 14, CNeutrinoFonts::FONT_STYLE_REGULAR, 1}, - {LOCALE_FONTSIZE_FILEBROWSER_ITEM , 16, CNeutrinoFonts::FONT_STYLE_BOLD , 1}, + {LOCALE_FONTSIZE_FILEBROWSER_ITEM , 17, CNeutrinoFonts::FONT_STYLE_REGULAR, 1}, {LOCALE_FONTSIZE_MENU_HINT , 16, CNeutrinoFonts::FONT_STYLE_REGULAR, 0}, {LOCALE_FONTSIZE_MOVIEBROWSER_HEAD , 15, CNeutrinoFonts::FONT_STYLE_REGULAR, 2}, {LOCALE_FONTSIZE_MOVIEBROWSER_LIST , 17, CNeutrinoFonts::FONT_STYLE_REGULAR, 0}, @@ -394,12 +395,11 @@ int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey) return res; } - #define OSD_PRESET_OPTIONS_COUNT 2 -const CMenuOptionChooser::keyval OSD_PRESET_OPTIONS[OSD_PRESET_OPTIONS_COUNT] = +const CMenuOptionChooser::keyval_ext OSD_PRESET_OPTIONS[] = { - { 0, LOCALE_COLORMENU_SD_PRESET }, - { 1, LOCALE_COLORMENU_HD_PRESET } + { COsdSetup::PRESET_CRT, NONEXISTANT_LOCALE, "CRT" }, + { COsdSetup::PRESET_LCD, NONEXISTANT_LOCALE, "LCD" } }; #define INFOBAR_CASYSTEM_MODE_OPTION_COUNT 4 @@ -648,6 +648,34 @@ int COsdSetup::showOsdSetup() osd_menu->addItem(GenericMenuSeparatorLine); +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + // osd resolution + size_t resCount = frameBuffer->osd_resolutions.size(); + struct CMenuOptionChooser::keyval_ext kext[resCount]; + char valname[resCount][255]; + if (resCount > 0) { + for (size_t i = 0; i < resCount; i++) { + kext[i].key = i; + kext[i].value = NONEXISTANT_LOCALE; + snprintf(valname[i], sizeof(valname[resCount]), "%dx%d", frameBuffer->osd_resolutions[i].xRes, frameBuffer->osd_resolutions[i].yRes); + kext[i].valname = valname[i]; + } + } + else { + kext[0].key = 0; + kext[0].value = NONEXISTANT_LOCALE; + kext[0].valname = "-"; + resCount = 1; + } + int videoSystem = COsdHelpers::getInstance()->getVideoSystem(); + bool enable = ((resCount > 1) && + COsdHelpers::getInstance()->isVideoSystem1080(videoSystem) && + (g_settings.video_Mode != VIDEO_STD_AUTO)); + CMenuOptionChooser * osd_res = new CMenuOptionChooser(LOCALE_COLORMENU_OSD_RESOLUTION, &g_settings.osd_resolution, kext, resCount, enable, this); + osd_res->setHint("", LOCALE_MENU_HINT_OSD_RESOLUTION); + osd_menu->addItem(osd_res); +#endif + //monitor CMenuOptionChooser *mc; if (cs_get_revision() != 1) { /* 1 == Tripledragon */ @@ -656,6 +684,8 @@ int COsdSetup::showOsdSetup() osd_menu->addItem(mc); } + osd_menu->addItem(GenericMenuSeparatorLine); + // round corners mc = new CMenuOptionChooser(LOCALE_EXTRA_ROUNDED_CORNERS, &g_settings.rounded_corners, MENU_CORNERSETTINGS_TYPE_OPTIONS, MENU_CORNERSETTINGS_TYPE_OPTION_COUNT, true, this); mc->setHint("", LOCALE_MENU_HINT_ROUNDED_CORNERS); @@ -1372,16 +1402,56 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) int preset = * (int *) data; printf("preset %d (setting %d)\n", preset, g_settings.screen_preset); - g_settings.screen_StartX = g_settings.screen_preset ? g_settings.screen_StartX_lcd : g_settings.screen_StartX_crt; - g_settings.screen_StartY = g_settings.screen_preset ? g_settings.screen_StartY_lcd : g_settings.screen_StartY_crt; - g_settings.screen_EndX = g_settings.screen_preset ? g_settings.screen_EndX_lcd : g_settings.screen_EndX_crt; - g_settings.screen_EndY = g_settings.screen_preset ? g_settings.screen_EndY_lcd : g_settings.screen_EndY_crt; + CNeutrinoApp::getInstance()->setScreenSettings(); osd_menu->hide(); if (g_InfoViewer == NULL) g_InfoViewer = new CInfoViewer; g_InfoViewer->changePB(); return true; } +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_COLORMENU_OSD_RESOLUTION)) + { + if (frameBuffer->osd_resolutions.empty()) + return true; + osd_menu->hide(); + uint32_t osd_mode = (uint32_t)*(int*)data; + COsdHelpers::getInstance()->g_settings_osd_resolution_save = osd_mode; + COsdHelpers::getInstance()->changeOsdResolution(osd_mode); +#if 0 + if (frameBuffer->fullHdAvailable()) { + if (frameBuffer->osd_resolutions.empty()) + return true; + + size_t index = (size_t)*(int*)data; + size_t resCount = frameBuffer->osd_resolutions.size(); + if (index >= resCount) + index = 0; + + uint32_t resW = frameBuffer->osd_resolutions[index].xRes; + uint32_t resH = frameBuffer->osd_resolutions[index].yRes; + uint32_t bpp = frameBuffer->osd_resolutions[index].bpp; + int switchFB = frameBuffer->setMode(resW, resH, bpp); + + if (switchFB == 0) { +//printf("\n>>>>>[%s:%d] New res: %dx%dx%d\n \n", __func__, __LINE__, resW, resH, bpp); + osd_menu->hide(); + frameBuffer->Clear(); + CNeutrinoApp::getInstance()->setScreenSettings(); + CNeutrinoApp::getInstance()->SetupFonts(CNeutrinoFonts::FONTSETUP_NEUTRINO_FONT); + CVolumeHelper::getInstance()->refresh(); + CInfoClock::getInstance()->ClearDisplay(); + FileTimeOSD->Init(); + if (CNeutrinoApp::getInstance()->channelList) + CNeutrinoApp::getInstance()->channelList->ResetModules(); + if (g_InfoViewer) + g_InfoViewer->ResetModules(); + } + } +#endif + return true; + } +#endif else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_EXTRA_ROUNDED_CORNERS)) { osd_menu->hide(); g_settings.rounded_corners = * (int*) data; diff --git a/src/gui/osd_setup.h b/src/gui/osd_setup.h index 18adc6311..cdea56535 100644 --- a/src/gui/osd_setup.h +++ b/src/gui/osd_setup.h @@ -96,6 +96,12 @@ class COsdSetup : public CMenuTarget, public CChangeObserver INFOBAR_LOGO_FRAMED, INFOBAR_LOGO_SHADED }; + + enum + { + PRESET_CRT, + PRESET_LCD + }; COsdSetup(int wizard_mode = SNeutrinoSettings::WIZARD_OFF); ~COsdSetup(); diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index 00cd52f39..4213ecf21 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -41,6 +41,7 @@ #include "record_setup.h" #include +#include #include #include @@ -173,6 +174,13 @@ const CMenuOptionChooser::keyval END_OF_RECORDING[END_OF_RECORDING_COUNT] = {1, LOCALE_RECORDINGMENU_END_OF_RECORDING_EPG} }; +const CMenuOptionChooser::keyval timer_followscreenings_options[] = +{ + {CFollowScreenings::FOLLOWSCREENINGS_OFF ,LOCALE_OPTIONS_OFF }, + {CFollowScreenings::FOLLOWSCREENINGS_ON ,LOCALE_OPTIONS_ON } +}; +size_t timer_followscreenings_options_count = sizeof(timer_followscreenings_options)/sizeof(CMenuOptionChooser::keyval); + int CRecordSetup::showRecordSetup() { CMenuForwarder * mf; diff --git a/src/gui/screensetup.cpp b/src/gui/screensetup.cpp index b1327fed2..207020eab 100644 --- a/src/gui/screensetup.cpp +++ b/src/gui/screensetup.cpp @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -109,27 +110,61 @@ int CScreenSetup::exec(CMenuTarget* parent, const std::string &) switch ( msg ) { - case CRCInput::RC_ok: + case CRCInput::RC_ok: { // abspeichern g_settings.screen_StartX = x_coord[0]; g_settings.screen_EndX = x_coord[1]; g_settings.screen_StartY = y_coord[0]; g_settings.screen_EndY = y_coord[1]; - if(g_settings.screen_preset) { - g_settings.screen_StartX_lcd = g_settings.screen_StartX; - g_settings.screen_StartY_lcd = g_settings.screen_StartY; - g_settings.screen_EndX_lcd = g_settings.screen_EndX; - g_settings.screen_EndY_lcd = g_settings.screen_EndY; - } else { - g_settings.screen_StartX_crt = g_settings.screen_StartX; - g_settings.screen_StartY_crt = g_settings.screen_StartY; - g_settings.screen_EndX_crt = g_settings.screen_EndX; - g_settings.screen_EndY_crt = g_settings.screen_EndY; + switch (g_settings.osd_resolution) { +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + case 1: + { + switch (g_settings.screen_preset) { + case COsdSetup::PRESET_CRT: + g_settings.screen_StartX_crt_1 = g_settings.screen_StartX; + g_settings.screen_StartY_crt_1 = g_settings.screen_StartY; + g_settings.screen_EndX_crt_1 = g_settings.screen_EndX; + g_settings.screen_EndY_crt_1 = g_settings.screen_EndY; + break; + case COsdSetup::PRESET_LCD: + default: + g_settings.screen_StartX_lcd_1 = g_settings.screen_StartX; + g_settings.screen_StartY_lcd_1 = g_settings.screen_StartY; + g_settings.screen_EndX_lcd_1 = g_settings.screen_EndX; + g_settings.screen_EndY_lcd_1 = g_settings.screen_EndY; + break; + } + } + break; +#endif + case 0: + default: + { + switch (g_settings.screen_preset) { + case COsdSetup::PRESET_CRT: + g_settings.screen_StartX_crt_0 = g_settings.screen_StartX; + g_settings.screen_StartY_crt_0 = g_settings.screen_StartY; + g_settings.screen_EndX_crt_0 = g_settings.screen_EndX; + g_settings.screen_EndY_crt_0 = g_settings.screen_EndY; + break; + case COsdSetup::PRESET_LCD: + default: + g_settings.screen_StartX_lcd_0 = g_settings.screen_StartX; + g_settings.screen_StartY_lcd_0 = g_settings.screen_StartY; + g_settings.screen_EndX_lcd_0 = g_settings.screen_EndX; + g_settings.screen_EndY_lcd_0 = g_settings.screen_EndY; + break; + } + } + break; } + if (g_InfoViewer) /* recalc infobar position */ g_InfoViewer->start(); loop = false; break; + } case CRCInput::RC_home: if ( ( ( g_settings.screen_StartX != x_coord[0] ) || diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index f65f6424b..a3cb47ae9 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -522,18 +522,20 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) if(!channel) return; - int array[6]={g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_RESOLUTION)), + int array[]= {g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_RESOLUTION)), + g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_VIDEOSYSTEM)), + g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_OSD_RESOLUTION)), g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_ARATIO)), g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_BITRATE)), g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_FRAMERATE)), g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_STREAMINFO_AUDIOTYPE)), g_Font[font_info]->getRenderWidth(g_Locale->getText (LOCALE_SCANTS_FREQDATA))}; - for(i=0 ; i<6; i++) { + for(i=0 ; i<(int)(sizeof(array)/sizeof(array[0])); i++) { if(spaceoffset < array[i]) spaceoffset = array[i]; } - spaceoffset += g_Font[font_info]->getRenderWidth(" "); + spaceoffset += g_Font[font_info]->getRenderWidth(" "); average_bitrate_offset = spaceoffset; int box_width2 = box_width-(spaceoffset+xpos); @@ -552,7 +554,30 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) snprintf(buf, sizeof(buf), "%dx%d", xres, yres); g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width2, buf, COL_MENUCONTENT_TEXT); - //audio rate +#if HAVE_COOL_HARDWARE + //Video SYSTEM + ypos += iheight; + snprintf(buf, sizeof(buf), "%s:", g_Locale->getText (LOCALE_STREAMINFO_VIDEOSYSTEM)); + g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_MENUCONTENT_TEXT); + cs_vs_format_t vsfn; + videoDecoder->GetVideoSystemFormatName(&vsfn); +#ifdef BOXMODEL_CS_HD1 + snprintf(buf, sizeof(buf), "HDMI: %s%s", vsfn.format, +#else + snprintf(buf, sizeof(buf), "HDMI: %s, Scart/Cinch: %s%s", vsfn.formatHD, vsfn.formatSD, +#endif + (g_settings.video_Mode == VIDEO_STD_AUTO)?" (AUTO)":""); + g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width2, buf, COL_MENUCONTENT_TEXT); +#endif + + //OSD RESOLUTION + ypos += iheight; + snprintf(buf, sizeof(buf), "%s:",g_Locale->getText (LOCALE_STREAMINFO_OSD_RESOLUTION)); + g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_MENUCONTENT_TEXT); + snprintf(buf, sizeof(buf), "%dx%d", frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); + g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width2, buf, COL_MENUCONTENT_TEXT); + + //Aspect Ratio ypos += iheight; snprintf(buf, sizeof(buf), "%s:",g_Locale->getText (LOCALE_STREAMINFO_ARATIO)); g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_MENUCONTENT_TEXT); diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 31ef6fadd..36a407bf3 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -841,6 +842,55 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } return res; } + else if (actionKey == "progress_window"){ + //classical + CProgressWindow pw0("Progress Single Test"); + pw0.paint(); + size_t max = 3; + for(size_t i = 0; i< max; i++){ + pw0.showStatus(i, max, to_string(i)); + sleep(1); + } + pw0.hide(); + + CProgressWindow pw1("Progress Local/Global Test"); + pw1.paint(); + for(size_t i = 0; i< max; i++){ + pw1.showGlobalStatus(i, max, to_string(i)); + for(size_t j = 0; j< max; j++){ + pw1.showLocalStatus(j, max, to_string(j)); + sleep(1); + } + } + pw1.hide(); + + //with signals + sigc::signal OnProgress0, OnProgress1; + CProgressWindow pw2("Progress Single Test -> single Signal", CCW_PERCENT 50, CCW_PERCENT 30, &OnProgress0); + pw2.paint(); + + for(size_t i = 0; i< max; i++){ + OnProgress0(i, max, to_string(i)); + sleep(1); + } + pw2.hide(); + + OnProgress0.clear(); + OnProgress1.clear(); + CProgressWindow pw3("Progress Single Test -> dub Signal", CCW_PERCENT 50, CCW_PERCENT 20, NULL, &OnProgress0, &OnProgress1); + pw3.paint(); + + for(size_t i = 0; i< max; i++){ + OnProgress1(i, max, to_string(i)); + for(size_t j = 0; j< max; j++){ + OnProgress0(j, max, to_string(j)); + sleep(1); + } + } + pw3.hide(); + + return menu_return::RETURN_REPAINT; + } else if (actionKey == "hintbox_test") { ShowHint("Testmenu: Hintbox popup test", "Test for HintBox,\nPlease press any key or wait some seconds! ...", 700, 10, NULL, NEUTRINO_ICON_HINT_IMAGEINFO, CComponentsHeader::CC_BTN_EXIT); @@ -1085,6 +1135,7 @@ int CTestMenu::showTestMenu() void CTestMenu::showCCTests(CMenuWidget *widget) { widget->addIntroItems(); + widget->addItem(new CMenuForwarder("Progress Window", true, NULL, this, "progress_window")); widget->addItem(new CMenuForwarder("Running Clock", true, NULL, this, "running_clock")); widget->addItem(new CMenuForwarder("Clock", true, NULL, this, "clock")); widget->addItem(new CMenuForwarder("Button", true, NULL, this, "button")); diff --git a/src/gui/videosettings.cpp b/src/gui/videosettings.cpp index 093ec094e..ede56a046 100644 --- a/src/gui/videosettings.cpp +++ b/src/gui/videosettings.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -517,7 +518,8 @@ void CVideoSettings::setVideoSettings() void CVideoSettings::setupVideoSystem(bool do_ask) { printf("[neutrino VideoSettings] %s setup videosystem...\n", __FUNCTION__); - videoDecoder->SetVideoSystem(g_settings.video_Mode); //FIXME + COsdHelpers::getInstance()->setVideoSystem(g_settings.video_Mode); //FIXME + COsdHelpers::getInstance()->changeOsdResolution(0, true, false); if (do_ask) { @@ -527,7 +529,8 @@ void CVideoSettings::setupVideoSystem(bool do_ask) if (ShowMsg(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_VIDEO_MODE_OK), CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NEUTRINO_ICON_INFO) != CMsgBox::mbrYes) { g_settings.video_Mode = prev_video_mode; - videoDecoder->SetVideoSystem(g_settings.video_Mode); + COsdHelpers::getInstance()->setVideoSystem(g_settings.video_Mode); + COsdHelpers::getInstance()->changeOsdResolution(0, true, false); } else prev_video_mode = g_settings.video_Mode; @@ -714,7 +717,8 @@ void CVideoSettings::nextMode(void) else if(res == messages_return::cancel_info) { g_settings.video_Mode = VIDEOMENU_VIDEOMODE_OPTIONS[curmode].key; //CVFD::getInstance()->ShowText(text); - videoDecoder->SetVideoSystem(g_settings.video_Mode); + COsdHelpers::getInstance()->setVideoSystem(g_settings.video_Mode); + COsdHelpers::getInstance()->changeOsdResolution(0, true, false); //return; disp_cur = 1; } diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 9f9921ad6..1c79b22fa 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -53,7 +53,7 @@ void CVolumeBar::initVarVolumeBar() col_body = COL_MENUCONTENT_PLUS_0; corner_rad = CORNER_RADIUS_MID; vb_item_offset = OFFSET_INNER_SMALL; - height = g_settings.volume_size; //default height + height = CFrameBuffer::getInstance()->scale2Res(g_settings.volume_size); //assume volume value as pointer to global setting vb_vol = &g_settings.current_volume; @@ -91,7 +91,7 @@ void CVolumeBar::initVolumeBarSize() //vb_digit_w += corner_rad/2; //scale - vb_pbw = 200; + vb_pbw = CFrameBuffer::getInstance()->scale2Res(200); vb_pbh = height-4*vb_item_offset; //result for width @@ -362,7 +362,7 @@ void CVolumeHelper::initVolBarSize() icon_height += 2; icon_width += 8; g_settings.volume_size = max(g_settings.volume_size, icon_height); - vol_height = g_settings.volume_size; + vol_height = CFrameBuffer::getInstance()->scale2Res(g_settings.volume_size); if (g_settings.volume_digits) { CNeutrinoFonts *cnf = CNeutrinoFonts::getInstance(); diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index e0eec64f8..e0b6bfd4c 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -67,7 +67,7 @@ CHintBox::CHintBox( const neutrino_locale_t Caption, const char * const Picon, const int& header_buttons, const int& text_mode, - const int& indent): CComponentsWindow( 0, 0, width, + const int& indent): CComponentsWindow( 0, 0, Width, HINTBOX_MIN_HEIGHT, Caption, string(Icon == NULL ? "" : Icon), @@ -84,7 +84,7 @@ CHintBox::CHintBox( const char * const Caption, const char * const Picon, const int& header_buttons, const int& text_mode, - const int& indent):CComponentsWindow( 0, 0, width, + const int& indent):CComponentsWindow( 0, 0, Width, HINTBOX_MIN_HEIGHT, Caption, string(Icon == NULL ? "" : Icon), @@ -101,7 +101,7 @@ CHintBox::CHintBox( const neutrino_locale_t Caption, const char * const Picon, const int& header_buttons, const int& text_mode, - const int& indent):CComponentsWindow( 0, 0, width, + const int& indent):CComponentsWindow( 0, 0, Width, HINTBOX_MIN_HEIGHT, Caption, string(Icon == NULL ? "" : Icon), @@ -118,7 +118,7 @@ CHintBox::CHintBox( const char * const Caption, const char * const Picon, const int& header_buttons, const int& text_mode, - const int& indent):CComponentsWindow( 0, 0, width, + const int& indent):CComponentsWindow( 0, 0, Width, HINTBOX_MIN_HEIGHT, Caption, string(Icon == NULL ? "" : Icon), diff --git a/src/gui/widget/hintbox.h b/src/gui/widget/hintbox.h index 187752286..9019228a6 100644 --- a/src/gui/widget/hintbox.h +++ b/src/gui/widget/hintbox.h @@ -32,14 +32,15 @@ #include -#define HINTBOX_MIN_WIDTH 320 -#define HINTBOX_MIN_HEIGHT 125 -#define HINTBOX_MAX_HEIGHT 520 +#define HINTBOX_MIN_WIDTH CFrameBuffer::getInstance()->scale2Res(320) +#define HINTBOX_MIN_HEIGHT CFrameBuffer::getInstance()->scale2Res(125) +#define HINTBOX_MAX_HEIGHT CFrameBuffer::getInstance()->scale2Res(520) + #define HINTBOX_DEFAULT_TIMEOUT g_settings.timing[SNeutrinoSettings::TIMING_POPUP_MESSAGES] #define NO_TIMEOUT 0 #define DEFAULT_TIMEOUT -1 //frame around hint container as indent -#define W_FRAME std::max(HINTBOX_MIN_WIDTH, HINTBOX_MIN_HEIGHT) * 2/100 +#define W_FRAME OFFSET_INNER_MID //frame color around hint/message box #define HINTBOX_DEFAULT_FRAME_COLOR COL_FRAME #define TIMEOUT_BAR_HEIGHT OFFSET_SHADOW/2 diff --git a/src/gui/widget/icons.h b/src/gui/widget/icons.h index cafb9b343..d1664d75c 100644 --- a/src/gui/widget/icons.h +++ b/src/gui/widget/icons.h @@ -91,8 +91,6 @@ #define NEUTRINO_ICON_EPGINFO "epginfo" #define NEUTRINO_ICON_ERROR "error" #define NEUTRINO_ICON_FEATURES "features" -#define NEUTRINO_ICON_FILE "file" -#define NEUTRINO_ICON_FOLDER "folder" #define NEUTRINO_ICON_GAMES "games" #define NEUTRINO_ICON_INFO "information" #define NEUTRINO_ICON_IMPORTANT "important" @@ -101,7 +99,6 @@ #define NEUTRINO_ICON_LOCK_PASSIVE "lock_passive" #define NEUTRINO_ICON_HIDDEN "hidden" #define NEUTRINO_ICON_MOUNTED "mounted" -#define NEUTRINO_ICON_MP3 "mp3" #define NEUTRINO_ICON_MULTIMEDIA "multimedia" #define NEUTRINO_ICON_MOVIEPLAYER "icon_movieplayer" #define NEUTRINO_ICON_NKPLAY "icon_nkplay" @@ -259,6 +256,13 @@ #define NEUTRINO_ICON_HINT_RESTORE "hint_restore" #define NEUTRINO_ICON_HINT_FACTORY "hint_factory" +/* filetypes */ +#define NEUTRINO_ICON_FILE "file" +#define NEUTRINO_ICON_FOLDER "folder" +#define NEUTRINO_ICON_MOVIE "movie" +#define NEUTRINO_ICON_MP3 "mp3" +#define NEUTRINO_ICON_PICTURE "picture" + /* plugins */ #define NEUTRINO_ICON_HINT_PLUGIN "hint_plugin" diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 7b2178e5f..822794b8a 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -600,6 +600,7 @@ void CMenuWidget::Init(const std::string &NameString, const std::string &Icon, c selected = (widget_index == NO_WIDGET_ID ? preselected : mglobal->v_selected[widget_index]); //dimension + mwidth_save = mwidth; min_width = 0; width = 0; /* is set in paint() */ if (mwidth > 100){ @@ -1095,6 +1096,13 @@ void CMenuWidget::checkHints() void CMenuWidget::calcSize() { + // recalc min_width + min_width = 0; + int mwidth = std::min(mwidth_save, 100); + min_width = frameBuffer->getScreenWidth(true) * mwidth / 100; + if (min_width > (int)frameBuffer->getScreenWidth()) + min_width = frameBuffer->getScreenWidth(); + width = min_width; int wi, hi; @@ -1103,35 +1111,35 @@ void CMenuWidget::calcSize() if (items[i]->iconName_Info_right) { frameBuffer->getIconSize(items[i]->iconName_Info_right, &wi, &hi); if ((wi > 0) && (hi > 0)) - wi += 10; + wi += OFFSET_INNER_MID; else wi = 0; } - int tmpw = items[i]->getWidth() + 10 + 10 + wi; /* 10 pixels to the left and right of the text */ + int tmpw = items[i]->getWidth() + 2*OFFSET_INNER_MID + wi; /* 10 pixels to the left and right of the text */ if (tmpw > width) width = tmpw; } hint_height = 0; if(g_settings.show_menu_hints && has_hints) { - hint_height = 60; //TODO: rework calculation of hint_height + hint_height = frameBuffer->scale2Res(60); //TODO: rework calculation of hint_height int fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight(); - int h_tmp = 16 + 2*fheight; + int h_tmp = OFFSET_INNER_LARGE + 2*fheight; /* assuming all hint icons has the same size ! */ int iw, ih; frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &iw, &ih); - h_tmp = std::max(h_tmp, ih+10); + h_tmp = std::max(h_tmp, ih+OFFSET_INNER_MID); hint_height = std::max(h_tmp, hint_height); } /* set the max height to 9/10 of usable screen height debatable, if the callers need a possibility to set this */ height = (frameBuffer->getScreenHeight() - fbutton_height - hint_height) / 20 * 18; /* make sure its a multiple of 2 */ - if(height > ((int)frameBuffer->getScreenHeight() - 10)) - height = frameBuffer->getScreenHeight() - 10; + if(height > ((int)frameBuffer->getScreenHeight() - OFFSET_INNER_MID)) + height = frameBuffer->getScreenHeight() - OFFSET_INNER_MID; int neededWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(getName()); - if (neededWidth > width-48) { - width= neededWidth+ 49; + if (neededWidth > width - frameBuffer->scale2Res(48)) { + width = neededWidth + frameBuffer->scale2Res(48)+1; } hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); @@ -1165,7 +1173,7 @@ void CMenuWidget::calcSize() iconOffset = w; } - iconOffset += 10; + iconOffset += OFFSET_INNER_MID; width += iconOffset; if (fbutton_count) diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index de1d58744..ff4f3e008 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -513,6 +513,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals std::string iconfile; int min_width; + int mwidth_save; int width; int height; int hheight; // header diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index 0fed059cd..68952e8d1 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -59,8 +59,19 @@ CProgressWindow::CProgressWindow(const neutrino_locale_t title, Init(statusSignal, localSignal, globalSignal); } +CProgressWindow::CProgressWindow(const std::string &title, + const int &dx, + const int &dy, + signal *statusSignal, + signal *localSignal, + signal *globalSignal) + : CComponentsWindow(0, 0, dx, dy, title, NEUTRINO_ICON_INFO, NULL, CC_SHADOW_ON) +{ + Init(statusSignal, localSignal, globalSignal); +} + void CProgressWindow::Init( signal *statusSignal, - signal *localSignal, + signal *localSignal, signal *globalSignal) { if (statusSignal) @@ -70,112 +81,82 @@ void CProgressWindow::Init( signal *statusSignal, if (globalSignal) *globalSignal->connect(mem_fun(*this, &CProgressWindow::showGlobalStatus)); - global_progress = local_progress = 100; + global_progress = local_progress = percent_progress = 0; showFooter(false); - shadow = true; - - int x_item = 10; - int y_item = 10; - - int w_item = width-2*x_item; - int h_item = 14; - int h_pbar = 20; - w_bar_frame = 0; //create status text object status_txt = new CComponentsLabel(); - int h_txt = max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(), h_item); - status_txt->setDimensionsAll(x_item, y_item, w_item, h_txt); + status_txt->setDimensionsAll(OFFSET_INNER_MID, OFFSET_INNER_MID, width-2*OFFSET_INNER_MID, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); status_txt->setColorBody(col_body); status_txt->doPaintTextBoxBg(true); status_txt->doPaintBg(false); addWindowItem(status_txt); - y_item += h_txt + 10; + + cur_statusText = string(); //create local_bar object - local_bar = new CProgressBar(); - local_bar->allowPaint(false); - local_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar); - local_bar->setColorBody(col_body); - local_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0); - local_bar->setFrameThickness(w_bar_frame); - local_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0); - addWindowItem(local_bar); - y_item += 2*h_pbar; + local_bar = getProgressItem(); //create global_bar object - global_bar = new CProgressBar(); - global_bar->allowPaint(false); - global_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar); - global_bar->setColorBody(col_body); - global_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0); - global_bar->setFrameThickness(w_bar_frame); - global_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0); - addWindowItem(global_bar); - y_item += 2*h_pbar; + global_bar = getProgressItem(); + //set window height h_height = ccw_head->getHeight(); - height = max(height, y_item + h_height); + ccw_body->setHeight(ccw_body->back()->getYPos()+ ccw_body->back()->getHeight()+ OFFSET_INNER_MID); + height = max(height, ccw_body->getHeight() + h_height); + //set position on screen setCenterPos(); } -void CProgressWindow::setTitle(const neutrino_locale_t title) +CProgressBar* CProgressWindow::getProgressItem() { - setWindowCaption(title); + CProgressBar *pBar = new CProgressBar(); + pBar->allowPaint(false); + int y_tmp = 0; + for(size_t i = ccw_body->size()-1; i< ccw_body->size(); i++){ + y_tmp += ccw_body->getCCItem(i)->getYPos() + ccw_body->getCCItem(i)->getHeight(); + y_tmp += OFFSET_INNER_MID; + } + pBar->setDimensionsAll(OFFSET_INNER_MID, y_tmp, width-2*OFFSET_INNER_MID, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); + pBar->setColorBody(col_body); + pBar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0); + pBar->setFrameThickness(1); + pBar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0); + addWindowItem(pBar); -#ifdef VFD_UPDATE - CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD -#endif // VFD_UPDATE + return pBar; } -void CProgressWindow::setTitle(const string & title) +void CProgressWindow::initStatus(const unsigned int prog, const unsigned int max, const string &statusText, CProgressBar *pBar) { - setWindowCaption(title); - -#ifdef VFD_UPDATE - CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD -#endif // VFD_UPDATE -} - -//if header is disabled we need new position for body items -void CProgressWindow::fitItems() -{ - if (ccw_show_header) - return; - - for(size_t i=0; isize() ;i++){ - int y_item = ccw_body->getCCItem(i)->getYPos() + h_height - 10; - ccw_body->getCCItem(i)->setYPos(y_item); + pBar->allowPaint(true); + unsigned int cur_perc = prog*100/(max+1); + if (percent_progress != cur_perc || prog == 0){ + pBar->setValues(prog, (int)max); + if (!statusText.empty() && (cur_statusText != statusText)){ + showStatusMessageUTF(statusText); + cur_statusText = statusText; + } + pBar->paint(false); + percent_progress = cur_perc; } } void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max, const string &statusText) { - if (global_progress == prog) - return; - - if (!global_bar->isPainted()){ - int g_height = global_bar->getHeight(); - global_bar->setYPos(local_bar->getYPos() + g_height/2); - global_bar->setHeight(g_height + g_height/2); - } - - showGlobalStatus(prog, max, statusText); + showLocalStatus(prog, max, statusText); } void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned int max, const string &statusText) { - if (global_progress == prog) + if (!local_bar->isPainted()) + showLocalStatus(0, 0, statusText); // ensure first paint of local bar on painted global bar at same time + if (global_progress == prog && global_bar->isPainted()) return; - - global_bar->allowPaint(true); global_progress = prog; - global_bar->setValues(prog, (int)max); - if (!statusText.empty()) - showStatusMessageUTF(statusText); - global_bar->paint(false); + initStatus(prog, max, statusText, global_bar); #ifdef VFD_UPDATE CVFD::getInstance()->showProgressBar2(-1,NULL,global_progress); @@ -184,15 +165,10 @@ void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned i void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned int max, const string &statusText) { - if (local_progress == prog) + if (local_progress == prog && local_bar->isPainted()) return; - - local_bar->allowPaint(true); local_progress = prog; - local_bar->setValues(prog, (int)max); - if (!statusText.empty()) - showStatusMessageUTF(statusText); - local_bar->paint(false); + initStatus(prog, max, statusText, local_bar); #ifdef VFD_UPDATE CVFD::getInstance()->showProgressBar2(local_progress); @@ -242,3 +218,33 @@ void CProgressWindow::paint(bool do_save_bg) fitItems(); CComponentsWindow::paint(do_save_bg); } + +void CProgressWindow::setTitle(const neutrino_locale_t title) +{ + setWindowCaption(title); + +#ifdef VFD_UPDATE + CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD +#endif // VFD_UPDATE +} + +void CProgressWindow::setTitle(const string & title) +{ + setWindowCaption(title); + +#ifdef VFD_UPDATE + CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD +#endif // VFD_UPDATE +} + +//if header is disabled we need new position for body items +void CProgressWindow::fitItems() +{ + if (ccw_show_header) + return; + + for(size_t i=0; isize() ;i++){ + int y_item = ccw_body->getCCItem(i)->getYPos() + h_height - OFFSET_INNER_MID; + ccw_body->getCCItem(i)->setYPos(y_item); + } +} \ No newline at end of file diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index 811b5714a..1be4255a9 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -28,6 +28,9 @@ #include #include "menue.h" +#define PW_MIN_WIDTH CCW_PERCENT 50 +#define PW_MIN_HEIGHT CCW_PERCENT 20 + class CProgressWindow : public CComponentsWindow, public CMenuTarget { private: @@ -36,11 +39,15 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget unsigned int global_progress; unsigned int local_progress; - int w_bar_frame; + unsigned int percent_progress; + std::string cur_statusText; int h_height; void Init( sigc::signal *statusSignal, sigc::signal *localSignal, sigc::signal *globalSignal); + + CProgressBar* getProgressItem(); + void initStatus(const unsigned int prog, const unsigned int max, const std::string &statusText, CProgressBar *pBar); void fitItems(); public: @@ -84,10 +91,10 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget * status.hide(); * } * - * //That's it. Until now these steps are a classical way inside neutrino, but you can use proress window with signals too. - * //Working with signals have the advantage that the implementation could be more compactly, because - * //complex constructions within the classes are usually unnecessary, - * //beacuse of the signals can be installed where they directly take the required values. See next example: + * //That's it. Until now these steps are a classical way inside neutrino, but you can use proress window with signals too. + * //Working with signals have the advantage that the implementation could be more compactly, because + * //complex constructions within the classes are usually unnecessary, + * //beacuse of the signals can be installed where they directly catching the required values. See next example: * * class CFooClass * { @@ -96,6 +103,7 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget * private: * //other members... * sigc::signal OnProgress; + * void DoCount(); * //other members... * public: * //other members... @@ -127,12 +135,57 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget * //finally remove window from screen * progress.hide(); * } + * + * //Another and a recommended way to implement signals is to inherit prepared signals with + * //class CProgressSignals. This class contains prepared signals for implemantation and disconnetion of slots + * //is performed automatically. + * //See next example: + * class CFooClass : public CProgressSignals + * { + * private: + * //other members... + * void DoCount(); + * //other members... + * public: + * //other members... + * void DoAnything(); + * //other members... + * }; + * + * //add the OnGlobalProgress and OnLocalProgress signals into a counter methode + * void CFooClass::DoCount();{ + * size_t max = 10; + * for (size_t i = 0; i < max; i++){ + * OnGlobalProgress(i, max, "Test"); //visualize global progress + * for (size_t j = 0; j < max; j++){ + * OnLocalProgress(ij, max, "Test"); // visualize local progress + * } + * } + * } + * + * void CFooClass::DoAnything{ + * //inside of methode which calls the progress define a CProgressWindow object and the counter method: + * //...any code + * CProgressWindow progress(NULL, 500, 150, NULL, &OnLocalProgress, &OnGlobalProgress); + * progress.paint(); // paint window + * + * //... + * + * void DoCount(); + * + * //... + * + * //finally remove window from screen + * progress.hide(); + * } + * * @note - * Don't use status_Signal at same time with localSignal and globalSignal. In This case please set status_Signal = NULL + * Don't use status_Signal at same time with localSignal and globalSignal. \n + * In This case please set prameter 'status_Signal' = NULL */ CProgressWindow(CComponentsForm *parent = NULL, - const int &dx = 700, - const int &dy = 200, + const int &dx = PW_MIN_WIDTH, + const int &dy = PW_MIN_HEIGHT, sigc::signal *status_Signal = NULL, sigc::signal *localSignal = NULL, sigc::signal *globalSignal = NULL); @@ -144,8 +197,21 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget * @see For other arguments and examples, see related constructor(s) */ CProgressWindow(const neutrino_locale_t title, - const int &dx = 700, - const int &dy = 200, + const int &dx = PW_MIN_WIDTH, + const int &dy = PW_MIN_HEIGHT, + sigc::signal *status_Signal = NULL, + sigc::signal *localSignal = NULL, + sigc::signal *globalSignal = NULL); + + /**CProgressWindow Constructor + * @param[in] title + * @li expects type std::string as window title + * + * @see For other arguments and examples, see related constructor(s) + */ + CProgressWindow(const std::string &title, + const int &dx = PW_MIN_WIDTH, + const int &dy = PW_MIN_HEIGHT, sigc::signal *status_Signal = NULL, sigc::signal *localSignal = NULL, sigc::signal *globalSignal = NULL); @@ -223,5 +289,25 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget void paint(bool do_save_bg = true); }; +class CProgressSignals : public sigc::trackable +{ + public: + /**CProgressSignals Constructor: + * Additional class for inherited signal implemantations into classes with used CProgressWindow instances. + */ + CProgressSignals() + { + //obligatory init of signals. Not really required but just to be safe. + OnProgress.clear(); + OnLocalProgress.clear(); + OnGlobalProgress.clear(); + }; + + /** + * For general usage for implementations of signals for classes which are using CProgressBar() window instances based on inheritance. + * @see Take a look into examples to find in progressbar.h + */ + sigc::signal OnProgress, OnLocalProgress, OnGlobalProgress; +}; #endif diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 34b0a941e..23ed96132 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -68,14 +68,14 @@ #endif #include -#define SCROLL_FRAME_WIDTH 10 -#define SCROLL_MARKER_BORDER 2 +#define SCROLL_FRAME_WIDTH SCROLLBAR_WIDTH +#define SCROLL_MARKER_BORDER OFFSET_INNER_MIN -#define MAX_WINDOW_WIDTH (g_settings.screen_EndX - g_settings.screen_StartX - 40) -#define MAX_WINDOW_HEIGHT (g_settings.screen_EndY - g_settings.screen_StartY - 40) +#define MAX_WINDOW_WIDTH (g_settings.screen_EndX - g_settings.screen_StartX - CFrameBuffer::getInstance()->scale2Res(40)) +#define MAX_WINDOW_HEIGHT (g_settings.screen_EndY - g_settings.screen_StartY - CFrameBuffer::getInstance()->scale2Res(40)) #define MIN_WINDOW_WIDTH ((g_settings.screen_EndX - g_settings.screen_StartX)>>1) -#define MIN_WINDOW_HEIGHT 40 +#define MIN_WINDOW_HEIGHT CFrameBuffer::getInstance()->scale2Res(40) CTextBox::CTextBox(const char * text, Font* font_text, const int pmode, const CBox* position, CFBWindow::color_t textBackgroundColor) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 4cbba72dc..5d7644938 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -76,10 +76,12 @@ #include "gui/eventlist.h" #include "gui/favorites.h" #include "gui/filebrowser.h" +#include "gui/followscreenings.h" #include "gui/hdd_menu.h" #include "gui/infoviewer.h" #include "gui/mediaplayer.h" #include "gui/movieplayer.h" +#include "gui/osd_helpers.h" #include "gui/osd_setup.h" #include "gui/osdlang_setup.h" #include "gui/pictureviewer.h" @@ -231,6 +233,8 @@ CNeutrinoApp::CNeutrinoApp() init_td_api(); // shutdown_td_api(); #endif + osd_resolution_tmp = -1; + frameBufferInitialized = false; frameBuffer = CFrameBuffer::getInstance(); frameBuffer->setIconBasePath(ICONSDIR); @@ -336,22 +340,27 @@ int CNeutrinoApp::loadSetup(const char * fname) int erg = 0; configfile.clear(); - //settings laden - und dabei Defaults setzen! - if(!configfile.loadConfig(fname)) { - //file existiert nicht + // load settings; setup defaults + if (!configfile.loadConfig(fname)) + { + // file doesn't exist erg = 1; - } else { + } + else + { +#if 0 /* try to detect bad / broken config file */ - if (!configfile.getInt32("screen_EndX_crt", 0) || - !configfile.getInt32("screen_EndY_crt", 0) || - !configfile.getInt32("screen_EndX_lcd", 0) || - !configfile.getInt32("screen_EndY_lcd", 0)) { + if (!configfile.getInt32("screen_EndX_crt_0", 0) || + !configfile.getInt32("screen_EndY_crt_0", 0) || + !configfile.getInt32("screen_EndX_lcd_0", 0) || + !configfile.getInt32("screen_EndY_lcd_0", 0)) { printf("[neutrino] config file %s is broken, using defaults\n", fname); configfile.clear(); - } else { + } else +#endif migrateConfig(fname); - } } + parentallocked = !access(NEUTRINO_PARENTALLOCKED_FILE, R_OK); //theme/color options @@ -520,7 +529,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.timer_remotebox_ip.push_back(timer_rb); } } - g_settings.timer_followscreenings = configfile.getInt32( "timer_followscreenings", 1 ); + g_settings.timer_followscreenings = configfile.getInt32( "timer_followscreenings", CFollowScreenings::FOLLOWSCREENINGS_ON ); g_settings.infobar_sat_display = configfile.getBool("infobar_sat_display" , true ); g_settings.infobar_show_channeldesc = configfile.getBool("infobar_show_channeldesc" , false ); @@ -755,34 +764,32 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.channellist_show_numbers = configfile.getInt32("channellist_show_numbers", 1); //screen configuration - g_settings.screen_StartX_crt = configfile.getInt32( "screen_StartX_crt", DEFAULT_X_START_SD); - g_settings.screen_StartY_crt = configfile.getInt32( "screen_StartY_crt", DEFAULT_Y_START_SD ); - g_settings.screen_EndX_crt = configfile.getInt32( "screen_EndX_crt", DEFAULT_X_END_SD); - g_settings.screen_EndY_crt = configfile.getInt32( "screen_EndY_crt", DEFAULT_Y_END_SD); - g_settings.screen_StartX_lcd = configfile.getInt32( "screen_StartX_lcd", DEFAULT_X_START_HD); - g_settings.screen_StartY_lcd = configfile.getInt32( "screen_StartY_lcd", DEFAULT_Y_START_HD ); - g_settings.screen_EndX_lcd = configfile.getInt32( "screen_EndX_lcd", DEFAULT_X_END_HD); - g_settings.screen_EndY_lcd = configfile.getInt32( "screen_EndY_lcd", DEFAULT_Y_END_HD); - g_settings.screen_preset = configfile.getInt32( "screen_preset", 1); - -#if HAVE_TRIPLEDRAGON - g_settings.screen_preset = 0; /* does not make sense to have two configurations for that... */ -#elif ! HAVE_COOLSTREAM - g_settings.screen_preset = 1; /* spark is now always using 1280x720 framebuffer */ -#endif - g_settings.screen_StartX = g_settings.screen_preset ? g_settings.screen_StartX_lcd : g_settings.screen_StartX_crt; - g_settings.screen_StartY = g_settings.screen_preset ? g_settings.screen_StartY_lcd : g_settings.screen_StartY_crt; - g_settings.screen_EndX = g_settings.screen_preset ? g_settings.screen_EndX_lcd : g_settings.screen_EndX_crt; - g_settings.screen_EndY = g_settings.screen_preset ? g_settings.screen_EndY_lcd : g_settings.screen_EndY_crt; - - g_settings.screen_width = frameBuffer->getScreenWidth(true); - g_settings.screen_height = frameBuffer->getScreenHeight(true); + g_settings.osd_resolution = (osd_resolution_tmp == -1) ? configfile.getInt32("osd_resolution", 0) : osd_resolution_tmp; + COsdHelpers::getInstance()->g_settings_osd_resolution_save = g_settings.osd_resolution; + g_settings.screen_StartX_crt_0 = configfile.getInt32("screen_StartX_crt_0", 80); + g_settings.screen_StartY_crt_0 = configfile.getInt32("screen_StartY_crt_0", 45); + g_settings.screen_EndX_crt_0 = configfile.getInt32("screen_EndX_crt_0" , 1280 - g_settings.screen_StartX_crt_0 - 1); + g_settings.screen_EndY_crt_0 = configfile.getInt32("screen_EndY_crt_0" , 580 - g_settings.screen_StartY_crt_0 - 1); + g_settings.screen_StartX_lcd_0 = configfile.getInt32("screen_StartX_lcd_0", 40); + g_settings.screen_StartY_lcd_0 = configfile.getInt32("screen_StartY_lcd_0", 25); + g_settings.screen_EndX_lcd_0 = configfile.getInt32("screen_EndX_lcd_0" , 1280 - g_settings.screen_StartX_lcd_0 - 1); + g_settings.screen_EndY_lcd_0 = configfile.getInt32("screen_EndY_lcd_0" , 720 - g_settings.screen_StartY_lcd_0 - 1); + g_settings.screen_StartX_crt_1 = configfile.getInt32("screen_StartX_crt_1", 80); + g_settings.screen_StartY_crt_1 = configfile.getInt32("screen_StartY_crt_1", 45); + g_settings.screen_EndX_crt_1 = configfile.getInt32("screen_EndX_crt_1" , 1920 - g_settings.screen_StartX_crt_1 - 1); + g_settings.screen_EndY_crt_1 = configfile.getInt32("screen_EndY_crt_1" , 870 - g_settings.screen_StartY_crt_1 - 1); + g_settings.screen_StartX_lcd_1 = configfile.getInt32("screen_StartX_lcd_1", 40); + g_settings.screen_StartY_lcd_1 = configfile.getInt32("screen_StartY_lcd_1", 25); + g_settings.screen_EndX_lcd_1 = configfile.getInt32("screen_EndX_lcd_1" , 1920 - g_settings.screen_StartX_lcd_1 - 1); + g_settings.screen_EndY_lcd_1 = configfile.getInt32("screen_EndY_lcd_1" , 1080 - g_settings.screen_StartY_lcd_1 - 1); + g_settings.screen_preset = configfile.getInt32("screen_preset", COsdSetup::PRESET_LCD); + setScreenSettings(); // avoid configuration mismatch - if (g_settings.screen_EndX > g_settings.screen_width) - g_settings.screen_EndX = g_settings.screen_width; - if (g_settings.screen_EndY > g_settings.screen_height) - g_settings.screen_EndY = g_settings.screen_height; + if (g_settings.screen_EndX >= g_settings.screen_width) + g_settings.screen_EndX = g_settings.screen_width - 1; + if (g_settings.screen_EndY >= g_settings.screen_height) + g_settings.screen_EndY = g_settings.screen_height - 1; g_settings.bigFonts = configfile.getInt32("bigFonts", 1); g_settings.window_size = configfile.getInt32("window_size", 100); @@ -885,7 +892,7 @@ int CNeutrinoApp::loadSetup(const char * fname) //Filebrowser g_settings.filebrowser_showrights = configfile.getInt32("filebrowser_showrights", 1); - g_settings.filebrowser_sortmethod = configfile.getInt32("filebrowser_sortmethod", 0); + g_settings.filebrowser_sortmethod = configfile.getInt32("filebrowser_sortmethod", 1); if ((g_settings.filebrowser_sortmethod < 0) || (g_settings.filebrowser_sortmethod >= FILEBROWSER_NUMBER_OF_SORT_VARIANTS)) g_settings.filebrowser_sortmethod = 0; g_settings.filebrowser_denydirectoryleave = configfile.getBool("filebrowser_denydirectoryleave", false); @@ -994,6 +1001,56 @@ int CNeutrinoApp::loadSetup(const char * fname) return erg; } +void CNeutrinoApp::setScreenSettings() +{ + g_settings.screen_width = frameBuffer->getScreenWidth(true); + g_settings.screen_height = frameBuffer->getScreenHeight(true); + + switch (g_settings.osd_resolution) { +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + case 1: + { + switch (g_settings.screen_preset) { + case COsdSetup::PRESET_CRT: + g_settings.screen_StartX = g_settings.screen_StartX_crt_1; + g_settings.screen_StartY = g_settings.screen_StartY_crt_1; + g_settings.screen_EndX = g_settings.screen_EndX_crt_1; + g_settings.screen_EndY = g_settings.screen_EndY_crt_1; + break; + case COsdSetup::PRESET_LCD: + default: + g_settings.screen_StartX = g_settings.screen_StartX_lcd_1; + g_settings.screen_StartY = g_settings.screen_StartY_lcd_1; + g_settings.screen_EndX = g_settings.screen_EndX_lcd_1; + g_settings.screen_EndY = g_settings.screen_EndY_lcd_1; + break; + } + } + break; +#endif + case 0: + default: + { + switch (g_settings.screen_preset) { + case COsdSetup::PRESET_CRT: + g_settings.screen_StartX = g_settings.screen_StartX_crt_0; + g_settings.screen_StartY = g_settings.screen_StartY_crt_0; + g_settings.screen_EndX = g_settings.screen_EndX_crt_0; + g_settings.screen_EndY = g_settings.screen_EndY_crt_0; + break; + case COsdSetup::PRESET_LCD: + default: + g_settings.screen_StartX = g_settings.screen_StartX_lcd_0; + g_settings.screen_StartY = g_settings.screen_StartY_lcd_0; + g_settings.screen_EndX = g_settings.screen_EndX_lcd_0; + g_settings.screen_EndY = g_settings.screen_EndY_lcd_0; + break; + } + } + break; + } +} + void CNeutrinoApp::upgradeSetup(const char * fname) { dprintf(DEBUG_NORMAL, "upgrade/cleanup %s\n", fname); @@ -1357,15 +1414,24 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("channellist_show_numbers", g_settings.channellist_show_numbers); //screen configuration - configfile.setInt32( "screen_StartX_lcd", g_settings.screen_StartX_lcd ); - configfile.setInt32( "screen_StartY_lcd", g_settings.screen_StartY_lcd ); - configfile.setInt32( "screen_EndX_lcd", g_settings.screen_EndX_lcd ); - configfile.setInt32( "screen_EndY_lcd", g_settings.screen_EndY_lcd ); - configfile.setInt32( "screen_StartX_crt", g_settings.screen_StartX_crt ); - configfile.setInt32( "screen_StartY_crt", g_settings.screen_StartY_crt ); - configfile.setInt32( "screen_EndX_crt", g_settings.screen_EndX_crt ); - configfile.setInt32( "screen_EndY_crt", g_settings.screen_EndY_crt ); - configfile.setInt32( "screen_preset", g_settings.screen_preset ); + configfile.setInt32("osd_resolution" , COsdHelpers::getInstance()->g_settings_osd_resolution_save); + configfile.setInt32("screen_StartX_lcd_0", g_settings.screen_StartX_lcd_0); + configfile.setInt32("screen_StartY_lcd_0", g_settings.screen_StartY_lcd_0); + configfile.setInt32("screen_EndX_lcd_0" , g_settings.screen_EndX_lcd_0); + configfile.setInt32("screen_EndY_lcd_0" , g_settings.screen_EndY_lcd_0); + configfile.setInt32("screen_StartX_crt_0", g_settings.screen_StartX_crt_0); + configfile.setInt32("screen_StartY_crt_0", g_settings.screen_StartY_crt_0); + configfile.setInt32("screen_EndX_crt_0" , g_settings.screen_EndX_crt_0); + configfile.setInt32("screen_EndY_crt_0" , g_settings.screen_EndY_crt_0); + configfile.setInt32("screen_StartX_lcd_1", g_settings.screen_StartX_lcd_1); + configfile.setInt32("screen_StartY_lcd_1", g_settings.screen_StartY_lcd_1); + configfile.setInt32("screen_EndX_lcd_1" , g_settings.screen_EndX_lcd_1); + configfile.setInt32("screen_EndY_lcd_1" , g_settings.screen_EndY_lcd_1); + configfile.setInt32("screen_StartX_crt_1", g_settings.screen_StartX_crt_1); + configfile.setInt32("screen_StartY_crt_1", g_settings.screen_StartY_crt_1); + configfile.setInt32("screen_EndX_crt_1" , g_settings.screen_EndX_crt_1); + configfile.setInt32("screen_EndY_crt_1" , g_settings.screen_EndY_crt_1); + configfile.setInt32("screen_preset" , g_settings.screen_preset); //Software-update configfile.setInt32 ("softupdate_mode" , g_settings.softupdate_mode ); @@ -1859,14 +1925,50 @@ void CNeutrinoApp::CmdParser(int argc, char **argv) /************************************************************************************** * CNeutrinoApp - setup the framebuffer * **************************************************************************************/ + void CNeutrinoApp::SetupFrameBuffer() { frameBuffer->init(); - if(frameBuffer->setMode(720, 576, 8 * sizeof(fb_pixel_t))) { + int setFbMode = 0; + osd_resolution_tmp = -1; +#ifdef ENABLE_CHANGE_OSD_RESOLUTION + frameBuffer->setOsdResolutions(); + if (frameBuffer->osd_resolutions.empty()) { + dprintf(DEBUG_NORMAL, "Error while setting framebuffer mode\n"); + exit(-1); + } + + uint32_t ort; + configfile.loadConfig(NEUTRINO_SETTINGS_FILE); + ort = configfile.getInt32("osd_resolution", 0); + + size_t resCount = frameBuffer->osd_resolutions.size(); + + if (ort > (resCount - 1)) + osd_resolution_tmp = ort = 0; + + if (resCount == 1) + ort = 0; + + setFbMode = frameBuffer->setMode(frameBuffer->osd_resolutions[ort].xRes, + frameBuffer->osd_resolutions[ort].yRes, + frameBuffer->osd_resolutions[ort].bpp); + +/* + setFbMode = 0; + COsdHelpers::getInstance()->changeOsdResolution(0, true); +*/ +#else + /* all other hardware ignores setMode parameters */ + setFbMode = frameBuffer->setMode(0, 0, 0); +#endif + + if (setFbMode == -1) { dprintf(DEBUG_NORMAL, "Error while setting framebuffer mode\n"); exit(-1); } frameBuffer->Clear(); + frameBufferInitialized = true; } /************************************************************************************** @@ -2093,6 +2195,9 @@ int CNeutrinoApp::run(int argc, char **argv) TIMER_START(); cs_api_init(); cs_register_messenger(CSSendMessage); +#if defined(HAVE_COOL_HARDWARE) && defined(ENABLE_CHANGE_OSD_RESOLUTION) + cs_new_auto_videosystem(); +#endif g_info.hw_caps = get_hwcaps(); @@ -2153,6 +2258,8 @@ TIMER_START(); ZapStart_arg.volume = g_settings.current_volume; ZapStart_arg.webtv_xml = &g_settings.webtv_xml; + ZapStart_arg.osd_resolution = g_settings.osd_resolution; + CCamManager::getInstance()->SetCITuner(g_settings.ci_tuner); /* create decoders, read channels */ bool zapit_init = CZapit::getInstance()->Start(&ZapStart_arg); @@ -2955,6 +3062,18 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) CMoviePlayerGui::getInstance(true).showSubtitle(data); return messages_return::handled; } + if (msg == NeutrinoMessages::EVT_AUTO_SET_VIDEOSYSTEM) { + printf(">>>>>[CNeutrinoApp::%s:%d] Receive EVT_AUTO_SET_VIDEOSYSTEM message\n", __func__, __LINE__); + COsdHelpers *coh = COsdHelpers::getInstance(); + int videoSystem = (int)data; + if ((videoSystem != -1) /* -1 => not enabled for automode */ && + (coh->getVideoSystem() != videoSystem)) { + coh->setVideoSystem(videoSystem, false); + if (frameBufferInitialized) + coh->changeOsdResolution(0, true, false); + } + return messages_return::handled; + } if(msg == NeutrinoMessages::EVT_ZAP_COMPLETE) { CZapit::getInstance()->GetAudioMode(g_settings.audio_AnalogMode); if(g_settings.audio_AnalogMode < 0 || g_settings.audio_AnalogMode > 2) @@ -5001,11 +5120,7 @@ bool CNeutrinoApp::adjustToChannelID(const t_channel_id channel_id) } /* - * commit 523b273a changed the names of config file entries: - * casystem_display => infobar_casystem_display - * casystem_dotmatrix => infobar_casystem_dotmatrix - * casystem_frame => infobar_casystem_frame - * convert these, so that users do not need to set up their system again + * convert config keys, so that users do not need to set up their system again */ struct __key_rename { const char *from; @@ -5016,6 +5131,14 @@ static struct __key_rename key_rename[] = { { "casystem_display", "infobar_casystem_display" }, { "casystem_dotmatrix", "infobar_casystem_dotmatrix"}, { "casystem_frame", "infobar_casystem_frame" }, + { "screen_StartX_crt", "screen_StartX_crt_0" }, + { "screen_StartY_crt", "screen_StartY_crt_0" }, + { "screen_EndX_crt", "screen_EndX_crt_0" }, + { "screen_EndY_crt", "screen_EndY_crt_0" }, + { "screen_StartX_lcd", "screen_StartX_lcd_0" }, + { "screen_StartY_lcd", "screen_StartY_lcd_0" }, + { "screen_EndX_lcd", "screen_EndX_lcd_0" }, + { "screen_EndY_lcd", "screen_EndY_lcd_0" }, { NULL, NULL } }; @@ -5038,9 +5161,8 @@ void CNeutrinoApp::migrateConfig(const char *fname) /* only set new key to old value if the new key does not yet exist */ if (configfile.getInt32(to, magic) == magic) configfile.setInt32(to, tmp); - /* always remove old key*/ + /* always remove old key */ configfile.deleteKey(from); } /* more complex migration, including converting values etc. could be done here */ } - diff --git a/src/neutrino.h b/src/neutrino.h index 406a934b7..b70f5586f 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -108,6 +108,8 @@ private: bool channelList_allowed; bool channelList_painted; int first_mode_found; + int osd_resolution_tmp; + bool frameBufferInitialized; void SDT_ReloadChannels(); void setupNetwork( bool force= false ); @@ -162,6 +164,7 @@ public: void saveSetup(const char * fname); int loadSetup(const char * fname); + void setScreenSettings(); void upgradeSetup(const char * fname); void loadKeys(const char * fname = NULL); void saveKeys(const char * fname = NULL); diff --git a/src/neutrinoMessages.h b/src/neutrinoMessages.h index fe89d019a..81f77fa6c 100644 --- a/src/neutrinoMessages.h +++ b/src/neutrinoMessages.h @@ -123,6 +123,7 @@ struct NeutrinoMessages { /* NEVER CHANGE THIS */ EVT_CA_MESSAGE = CRCInput::RC_Events + 60, /* data = CA_MESSAGE pointer */ EVT_SUBT_MESSAGE = CRCInput::RC_Events + 61, /* data = subtitles pointer */ + EVT_AUTO_SET_VIDEOSYSTEM = CRCInput::RC_Events + 62, /* data = new video system */ /* END */ EVT_CURRENTEPG = CRCInput::RC_WithData + 1, diff --git a/src/system/locals.h b/src/system/locals.h index 965508c82..a7147a146 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -349,10 +349,9 @@ typedef enum LOCALE_COLORMENU_FADE, LOCALE_COLORMENU_FONT, LOCALE_COLORMENU_FONT_TTX, - LOCALE_COLORMENU_HD_PRESET, LOCALE_COLORMENU_MENUCOLORS, LOCALE_COLORMENU_OSD_PRESET, - LOCALE_COLORMENU_SD_PRESET, + LOCALE_COLORMENU_OSD_RESOLUTION, LOCALE_COLORMENU_TEXTCOLOR, LOCALE_COLORMENU_THEMESELECT, LOCALE_COLORMENU_TIMING, @@ -1281,6 +1280,7 @@ typedef enum LOCALE_MENU_HINT_OSD, LOCALE_MENU_HINT_OSD_LANGUAGE, LOCALE_MENU_HINT_OSD_PRESET, + LOCALE_MENU_HINT_OSD_RESOLUTION, LOCALE_MENU_HINT_OSD_TIMING, LOCALE_MENU_HINT_OTHER_FONTS, LOCALE_MENU_HINT_PARENTALLOCK_CHANGEPIN, @@ -2347,8 +2347,10 @@ typedef enum LOCALE_STREAMINFO_FRAMERATE_UNKNOWN, LOCALE_STREAMINFO_HEAD, LOCALE_STREAMINFO_NOT_AVAILABLE, + LOCALE_STREAMINFO_OSD_RESOLUTION, LOCALE_STREAMINFO_RESOLUTION, LOCALE_STREAMINFO_SIGNAL, + LOCALE_STREAMINFO_VIDEOSYSTEM, LOCALE_STREAMING_BUSY, LOCALE_STREAMING_DIR_NOT_WRITABLE, LOCALE_STREAMING_OVERFLOW, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 0a256f41c..adb7a51b0 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -349,10 +349,9 @@ const char * locale_real_names[] = "colormenu.fade", "colormenu.font", "colormenu.font_ttx", - "colormenu.hd_preset", "colormenu.menucolors", "colormenu.osd_preset", - "colormenu.sd_preset", + "colormenu.osd_resolution", "colormenu.textcolor", "colormenu.themeselect", "colormenu.timing", @@ -1281,6 +1280,7 @@ const char * locale_real_names[] = "menu.hint_osd", "menu.hint_osd_language", "menu.hint_osd_preset", + "menu.hint_osd_resolution", "menu.hint_osd_timing", "menu.hint_other_fonts", "menu.hint_parentallock_changepin", @@ -2347,8 +2347,10 @@ const char * locale_real_names[] = "streaminfo.framerate_unknown", "streaminfo.head", "streaminfo.not_available", + "streaminfo.osd_resolution", "streaminfo.resolution", "streaminfo.signal", + "streaminfo.videosystem", "streaming.busy", "streaming.dir_not_writable", "streaming.overflow", diff --git a/src/system/settings.h b/src/system/settings.h index 26e743d66..e9f4b8457 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -618,14 +618,23 @@ struct SNeutrinoSettings int screen_StartY; int screen_EndX; int screen_EndY; - int screen_StartX_crt; - int screen_StartY_crt; - int screen_EndX_crt; - int screen_EndY_crt; - int screen_StartX_lcd; - int screen_StartY_lcd; - int screen_EndX_lcd; - int screen_EndY_lcd; + int screen_StartX_crt_0; + int screen_StartY_crt_0; + int screen_EndX_crt_0; + int screen_EndY_crt_0; + int screen_StartX_lcd_0; + int screen_StartY_lcd_0; + int screen_EndX_lcd_0; + int screen_EndY_lcd_0; + int screen_StartX_crt_1; + int screen_StartY_crt_1; + int screen_EndX_crt_1; + int screen_EndY_crt_1; + int screen_StartX_lcd_1; + int screen_StartY_lcd_1; + int screen_EndX_lcd_1; + int screen_EndY_lcd_1; + int osd_resolution; int screen_preset; int screen_width; int screen_height; @@ -908,10 +917,10 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO #define DEFAULT_LCD_AUTODIMM 0x00 #define DEFAULT_LCD_SHOW_VOLUME 0x01 -#define CORNER_RADIUS_LARGE 11 -#define CORNER_RADIUS_MID 7 -#define CORNER_RADIUS_SMALL 5 -#define CORNER_RADIUS_MIN 3 +#define CORNER_RADIUS_LARGE CFrameBuffer::getInstance()->scale2Res(11) +#define CORNER_RADIUS_MID CFrameBuffer::getInstance()->scale2Res(7) +#define CORNER_RADIUS_SMALL CFrameBuffer::getInstance()->scale2Res(5) +#define CORNER_RADIUS_MIN CFrameBuffer::getInstance()->scale2Res(3) #define CORNER_RADIUS_NONE 0 #define RADIUS_LARGE (g_settings.rounded_corners ? CORNER_RADIUS_LARGE : 0) @@ -921,17 +930,17 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO #define RADIUS_NONE 0 // offsets -#define OFFSET_SHADOW 6 -#define OFFSET_INTER 6 -#define OFFSET_INNER_LARGE 20 -#define OFFSET_INNER_MID 10 -#define OFFSET_INNER_SMALL 5 -#define OFFSET_INNER_MIN 2 +#define OFFSET_SHADOW CFrameBuffer::getInstance()->scale2Res(6) +#define OFFSET_INTER CFrameBuffer::getInstance()->scale2Res(6) +#define OFFSET_INNER_LARGE CFrameBuffer::getInstance()->scale2Res(20) +#define OFFSET_INNER_MID CFrameBuffer::getInstance()->scale2Res(10) +#define OFFSET_INNER_SMALL CFrameBuffer::getInstance()->scale2Res(5) +#define OFFSET_INNER_MIN CFrameBuffer::getInstance()->scale2Res(2) #define OFFSET_INNER_NONE 0 #define SCROLLBAR_WIDTH (OFFSET_INNER_MID + 2*OFFSET_INNER_MIN) -#define DETAILSLINE_WIDTH 16 // TODO: scale2Res() ? +#define DETAILSLINE_WIDTH CFrameBuffer::getInstance()->scale2Res(16) #define BIGFONT_FACTOR 1.5 diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index 3c558ee1b..407d452a4 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -323,7 +323,7 @@ bool cYTFeedParser::parseFeedJSON(std::string &answer) Json::Value elements = root["items"]; for(unsigned int i=0; igetText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); + OnProgress(i, elements.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); #ifdef DEBUG_PARSER printf("=========================================================\n"); printf("Element %d in elements\n", i); diff --git a/src/system/ytparser.h b/src/system/ytparser.h index c54c2239b..dcc8f1322 100644 --- a/src/system/ytparser.h +++ b/src/system/ytparser.h @@ -30,6 +30,7 @@ #include #include #include +#include class cYTVideoUrl { @@ -68,7 +69,7 @@ class cYTVideoInfo typedef std::vector yt_video_list_t; -class cYTFeedParser +class cYTFeedParser : public CProgressSignals { private: std::string error; @@ -155,8 +156,6 @@ class cYTFeedParser void SetMaxResults(int count) { max_results = count; } void SetConcurrentDownloads(int count) { concurrent_downloads = count; } void SetThumbnailDir(std::string &_thumbnail_dir); - - sigc::signal OnLoadVideoInfo; }; #endif diff --git a/src/zapit/include/zapit/zapit.h b/src/zapit/include/zapit/zapit.h index e774cf9c4..2d34ea1a3 100644 --- a/src/zapit/include/zapit/zapit.h +++ b/src/zapit/include/zapit/zapit.h @@ -42,6 +42,7 @@ typedef struct ZAPIT_start_arg t_channel_id startchannelradio_id; int uselastchannel; int video_mode; + uint32_t osd_resolution; int volume; int ci_clock; std::list *webtv_xml; diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index acb7df7fa..98bedaf5d 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -78,6 +78,7 @@ #include #include +#include #ifdef PEDANTIC_VALGRIND_SETUP #define VALGRIND_PARANOIA(x) memset(&x, 0, sizeof(x)) @@ -1723,7 +1724,8 @@ bool CZapit::ParseCommand(CBasicMessage::Header &rmsg, int connfd) case CZapitMessages::CMD_SET_VIDEO_SYSTEM: { CZapitMessages::commandInt msg; CBasicServer::receive_data(connfd, &msg, sizeof(msg)); - videoDecoder->SetVideoSystem(msg.val); + COsdHelpers::getInstance()->setVideoSystem(msg.val); + COsdHelpers::getInstance()->changeOsdResolution(0, true); CNeutrinoApp::getInstance()->g_settings_video_Mode(msg.val); break; } @@ -2482,7 +2484,9 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg) audioDecoder = cAudio::GetDecoder(0); videoDecoder->SetDemux(videoDemux); - videoDecoder->SetVideoSystem(video_mode); + COsdHelpers::getInstance()->setVideoSystem(video_mode); + uint32_t osd_resolution = ZapStart_arg->osd_resolution; + COsdHelpers::getInstance()->changeOsdResolution(osd_resolution); videoDecoder->Standby(false); audioDecoder->SetDemux(audioDemux);