diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 291745661..af125a2a8 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -242,6 +242,7 @@ channellist.recording_not_possible Aufnahme nicht möglich! channellist.reset_all Entferne Markierung "Neu" für alle Kanäle channellist.reset_flags Entferne Kanal-Markierung "Neu" channellist.sats Satelliten +channellist.show_channellogo Senderlogos zeigen channellist.since seit channellist.start Start ci.clock CI Takt (Mhz) @@ -812,6 +813,7 @@ menu.hint_channellist_extended Bei aktivierter Funktion wird vor dem Sendernamen menu.hint_channellist_fonts Ändern Sie die Schriftgrößen in der Kanalliste menu.hint_channellist_foot Definiert, welche Informationen im unteren Sendungsfenster angezeigt werden sollen menu.hint_channellist_setup Wählen Sie die Anzeigeoptionen für die Kanalliste +menu.hint_channellist_show_channellogo Zeigt Senderlogos in der Kanalliste. menu.hint_channels Kanalliste öffnen menu.hint_ci Conditional-Access-Menü zum Einrichten Ihres CI-Moduls oder der eingebetteten Conax-Karte menu.hint_clock_background Lassen Sie die Uhr mit Hintergrund anzeigen diff --git a/data/locale/english.locale b/data/locale/english.locale index e4839f722..f835b0e32 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -242,6 +242,7 @@ channellist.recording_not_possible Recording not possible! channellist.reset_all Reset 'new' flag for all channels channellist.reset_flags Reset 'new' channel flag channellist.sats Satellites +channellist.show_channellogo Show channellogos channellist.since since channellist.start starts ci.clock CI clock (Mhz) @@ -812,6 +813,7 @@ menu.hint_channellist_extended Show current event progress bar menu.hint_channellist_fonts Change channel list font sizes menu.hint_channellist_foot Show additional information\nin bottom box menu.hint_channellist_setup Configure channel list GUI options +menu.hint_channellist_show_channellogo Show channellogos in channel list menu.hint_channels Open channel list menu.hint_ci Conditional access menu\nto setup your CI CAM or embeded Conax card menu.hint_clock_background Show clock with theme's background color diff --git a/lib/libcoolstream/playback_cs.h b/lib/libcoolstream/playback_cs.h index 5a5c61fb6..0a8359389 100644 --- a/lib/libcoolstream/playback_cs.h +++ b/lib/libcoolstream/playback_cs.h @@ -29,6 +29,8 @@ typedef struct { std::string codec_name; } playback_audio_pid_info_t; +#define MAX_PLAYBACK_PIDS 40 + class cPlayback { private: cPlaybackData * pd; diff --git a/lib/libcoolstream2/playback_cs.h b/lib/libcoolstream2/playback_cs.h index 1f7ded7bd..04dc7b45a 100644 --- a/lib/libcoolstream2/playback_cs.h +++ b/lib/libcoolstream2/playback_cs.h @@ -30,6 +30,8 @@ typedef struct { std::string codec_name; } playback_audio_pid_info_t; +#define MAX_PLAYBACK_PIDS 40 + class cPlayback { private: cPlaybackData * pd; diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 745b7450e..6bbd8e80b 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1768,7 +1768,7 @@ void CChannelList::paintItem2DetailsLine (int pos) void CChannelList::showChannelLogo() { - if(g_settings.infobar_show_channellogo){ + if(g_settings.channellist_show_channellogo){ static int logo_w = 0; static int logo_h = 0; int logo_w_max = full_width / 4; diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index 557042c88..82e3246fe 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include #include @@ -45,15 +44,20 @@ #include #include +#include #include #include #include #include +#include + #include #include #include #include +#include +#include #include static const int FSHIFT = 16; /* nr of bits of precision */ @@ -66,12 +70,12 @@ CDBoxInfoWidget::CDBoxInfoWidget() frameBuffer = CFrameBuffer::getInstance(); hheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); mheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - // width = 600; - // height = hheight+13*mheight+ 10; + mheight += mheight & 1; width = 0; height = 0; x = 0; y = 0; + stat_total = 0; } @@ -85,6 +89,7 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) fader.StartFadeIn(); paint(); + frameBuffer->blit(); //int res = g_RCInput->messageLoop(); neutrino_msg_t msg; @@ -146,6 +151,7 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) } } } + frameBuffer->blit(); } hide(); @@ -157,85 +163,66 @@ int CDBoxInfoWidget::exec(CMenuTarget* parent, const std::string &) void CDBoxInfoWidget::hide() { frameBuffer->paintBackgroundBoxRel(x,y, width,height); + frameBuffer->blit(); } -static void bytes2string(uint64_t bytes, char *result, size_t len) +static std::string bytes2string(uint64_t bytes, bool binary = true); + +static std::string bytes2string(uint64_t bytes, bool binary) { - static const char units[] = " kMGT"; - unsigned int magnitude = 0; - uint64_t factor = 1; uint64_t b = bytes; + uint64_t base = binary ? 1024 : 1000; + uint64_t factor = 1; + const char *unit = binary ? "\0KMGT" : "\0kMGT"; - while ((b > 1024) && (magnitude < strlen(units) - 1)) - { - magnitude++; - b /= 1024; - factor *= 1024; + while (b > base) { + b /= base; + factor *= base; + if (!*(unit + 1)) + break; + unit++; } - if (b < 1024) /* no need for fractions for big numbers */ - snprintf(result, len, "%3d.%02d%c", (int)b, - (int)((bytes - b * factor) * 100 / factor), units[magnitude]); - else - snprintf(result, len, "%d%c", (int)bytes, units[magnitude]); - result[len - 1] = '\0'; - //printf("b2s: b:%lld r:'%s' mag:%d u:%d\n", bytes, result, magnitude, (int)strlen(units)); + char result[80]; + + if (b < base) + snprintf(result, sizeof(result), "%d%s%02d ", (int)b, g_Locale->getText(LOCALE_UNIT_DECIMAL), + (int)((bytes - b * factor) * 100 / factor)); + else // no need for fractions for larger numbers + snprintf(result, sizeof(result), "%d ", (int)bytes); + + std::string res(result); + if (*unit) { + res.append(1, *unit); + if (binary) + res.append(1, 'i'); + } + res.append(1, 'B'); + return res; } void CDBoxInfoWidget::paint() { const int headSize = 5; - const char *head[headSize] = {"Filesystem", "Size", "Used", "Available", "Use%"}; + const char *head[headSize] = {"Filesystem", "Size", "Used", "Available", "Use"}; int fontWidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getWidth(); - int sizeOffset = fontWidth * 7;//9999.99M - int percOffset = fontWidth * 3 ;//100% - int nameOffset = fontWidth * 17;//WWWwwwwwww - height = hheight + 8 * mheight; + int sizeWidth = fontWidth * 11;//9999.99 MiB + int percWidth = fontWidth * 4 ;//100% + int nameWidth = fontWidth * 17;//WWWwwwwwww + height = hheight; + height += mheight/2; // space + height += mheight; // time + height += mheight; // uptime + height += mheight; // load + height += mheight/2; // space + + int frontend_count = CFEManager::getInstance()->getFrontendCount(); + if (frontend_count) + height += mheight * frontend_count + mheight/2; int icon_w = 0, icon_h = 0; frameBuffer->getIconSize(NEUTRINO_ICON_REC, &icon_w, &icon_h); - struct statfs s; - FILE * mountFile; - struct mntent * mnt; - - /* this is lame, as it duplicates code. OTOH, it is small and fast enough... - The algorithm is exactly the same as below in the display routine */ - if ((mountFile = setmntent("/proc/mounts", "r")) == NULL) { - perror("/proc/mounts"); - } else { - mapseen; - while ((mnt = getmntent(mountFile)) != NULL) { - if (strcmp(mnt->mnt_fsname, "rootfs") == 0) - continue; - if (::statfs(mnt->mnt_dir, &s) == 0) { - struct stat st; - if (!stat(mnt->mnt_dir, &st) && seen.find(st.st_dev) != seen.end()) - continue; - seen[st.st_dev] = true; - switch (s.f_type) /* f_type is long */ - { - case 0xEF53L: /*EXT2 & EXT3*/ - case 0x6969L: /*NFS*/ - case 0xFF534D42L: /*CIFS*/ - case 0x517BL: /*SMB*/ - case 0x52654973L: /*REISERFS*/ - case 0x65735546L: /*fuse for ntfs*/ - case 0x58465342L: /*xfs*/ - case 0x4d44L: /*msdos*/ - case 0x72b6L: /*jffs2*/ - case 0x5941ff53L: /*yaffs2*/ - break; - default: - continue; - } - height += mheight; - } - nameOffset = std::max(nameOffset, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(basename(mnt->mnt_dir), true) + icon_w + 20); - } - endmntent(mountFile); - } - int m[2][3] = { { 0, 0, 0 }, { 0, 0, 0 } }; // size, used, available #define DBINFO_TOTAL 0 #define DBINFO_USED 1 @@ -263,20 +250,60 @@ void CDBoxInfoWidget::paint() fclose(procmeminfo); } bool have_swap = m[DBINFO_SWAP][DBINFO_TOTAL]; + height += mheight; // header + height += mheight; // ram + height += have_swap * mheight; // swap + height += mheight/2; // space - if (have_swap) - height += mheight; + std::ifstream in; - int offsetw = nameOffset+ (sizeOffset+10)*3 +10+percOffset+10; - offsetw += 20; + std::map mounts; + in.open("/proc/mounts"); + if (in.is_open()) { + struct stat rec_st; + struct statfs s; + if (stat(g_settings.network_nfs_recordingdir.c_str(), &rec_st) + || (!::statfs(g_settings.network_nfs_recordingdir.c_str(), &s) && ((s.f_type == 0x72b6) || (s.f_type == 0x5941ff53)))) + memset(&rec_st, 0, sizeof(rec_st)); + + std::map seen; + std::string line; + + while (getline(in, line)) { + if ((line.at(0) != '/') && (line.find("rootfs") != 0)) + continue; + size_t firstspace = line.find_first_of(' '); + if (firstspace != string::npos) { + firstspace++; + size_t nextspace = line.find_first_of(' ', firstspace); + if (nextspace == string::npos || line.find("nodev", nextspace + 1) != string::npos) + continue; + std::string mountpoint = line.substr(firstspace, nextspace - firstspace); + struct stat st; + if (stat(mountpoint.c_str(), &st) || (seen.find(st.st_dev) != seen.end())) + continue; + seen[st.st_dev] = mountpoint; + bool is_rec = (st.st_dev == rec_st.st_dev); + mounts[mountpoint] = is_rec; + int icon_space = is_rec ? 10 + icon_w : 0; + nameWidth = std::max(nameWidth, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(mountpoint, true) + icon_space + 10); + } + } + in.close(); + } + + height += mheight; // header + height += mounts.size() * mheight; // file systems + height += mheight/2; // space + + int offsetw = nameWidth+ (sizeWidth+10)*3 +10+percWidth+10; width = offsetw + 10 + 120; - int _width = w_max(width, 0); - if (_width < width) { - int diff = width - _width; - width = _width; + int diff = frameBuffer->getScreenWidth() - width; + if (diff < 0) { + width -= diff; offsetw -= diff; - nameOffset -= width; + nameWidth -= diff; } height = h_max(height, 0); x = getScreenStartX(width); @@ -285,7 +312,6 @@ void CDBoxInfoWidget::paint() // fprintf(stderr, "CDBoxInfoWidget::CDBoxInfoWidget() x = %d, y = %d, width = %d height = %d\n", x, y, width, height); int ypos=y; - int i = 0; frameBuffer->paintBoxRel(x, ypos, width, hheight, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); frameBuffer->paintBoxRel(x, ypos+ hheight, width, height- hheight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); @@ -298,302 +324,222 @@ void CDBoxInfoWidget::paint() HeadiconOffset = w+6; } int fw = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getWidth(); - int binfo_w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(g_Locale->getText(LOCALE_EXTRA_DBOXINFO)); - + std::string title(g_Locale->getText(LOCALE_EXTRA_DBOXINFO)); + std::map cpuinfo; + in.open("/proc/cpuinfo"); + if (in.is_open()) { + std::string line; + while (getline(in, line)) { + size_t colon = line.find_first_of(':'); + if (colon != string::npos && colon > 1) { + std::string key = line.substr(0, colon - 1); + std::string val = line.substr(colon + 1); + cpuinfo[trim(key)] = trim(val); + } + } + in.close(); + } + if (!cpuinfo["Hardware"].empty()) { + title += ": "; + title += cpuinfo["Hardware"]; + } else if (!cpuinfo["machine"].empty()) { + title += ": "; + title + cpuinfo["machine"]; + } g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+(fw/3)+HeadiconOffset,y+hheight+1, - width-((fw/3)+HeadiconOffset), g_Locale->getText(LOCALE_EXTRA_DBOXINFO), - COL_MENUHEAD_TEXT, 0, true); // UTF-8 + width-((fw/3)+HeadiconOffset), title, COL_MENUHEAD_TEXT, 0, true); // UTF-8 frameBuffer->paintIcon(iconfile, x + fw/4, y, hheight); - ypos+= hheight + (mheight >>1); - FILE* fd = fopen("/proc/cpuinfo", "rt"); - if (fd==NULL) { - printf("error while opening proc-cpuinfo\n" ); - } else { - char *buffer=NULL; - size_t len = 0; - ssize_t read; - while ((read = getline(&buffer, &len, fd)) != -1) { -#if HAVE_TRIPLEDRAGON - if (!(strncmp(const_cast("machine"),buffer,7))) -#else - if (!(strncmp(const_cast("Hardware"),buffer,8))) -#endif - { - char *t=rindex(buffer,'\n'); - if (t) - *t='\0'; + ypos += hheight + mheight/2; - std::string hw; - char *p=rindex(buffer,':'); - if (p) - hw=++p; - g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+10+binfo_w+HeadiconOffset, y + hheight+1, width - 10, hw.c_str(), COL_MENUHEAD_TEXT, 0, true); // UTF-8 + long current_load = -1; + in.open("/proc/stat"); + if (in.is_open()) { + std::string line; + while (getline(in, line)) { + unsigned long _stat_user, _stat_nice, _stat_system, _stat_idle; + if (4 == sscanf(line.c_str(), "cpu %lu %lu %lu %lu", &_stat_user, &_stat_nice, &_stat_system, &_stat_idle)) { + if (stat_total) { + unsigned long div = _stat_user + _stat_nice + _stat_system + _stat_idle - stat_total; + if (div > 0) + current_load = (long)(1000 - 1000 * (_stat_idle - stat_idle) / div); + } + stat_idle = _stat_idle; + stat_total = _stat_user + _stat_nice + _stat_system + _stat_idle; break; } - i++; -#if HAVE_TRIPLEDRAGON - if (i == 1 || i > 3) -#else - if (i > 2) -#endif - continue; - if (read > 0 && buffer[read-1] == '\n') - buffer[read-1] = '\0'; - buffer[0] = toupper(buffer[0]); - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width - 10, buffer, COL_MENUCONTENT_TEXT); - ypos+= mheight; } - fclose(fd); - if (buffer) - free(buffer); + in.close(); } - char *ubuf=NULL, *sbuf=NULL; - int buf_size=256; - ubuf = new char[buf_size]; - sbuf = new char[buf_size]; - if (sbuf != NULL && ubuf != NULL) { - int updays, uphours, upminutes; - struct sysinfo info; - struct tm *current_time; - time_t current_secs; - memset(sbuf, 0, 256); - time(¤t_secs); - current_time = localtime(¤t_secs); + char ubuf[80]; - sysinfo(&info); + time_t now = time(NULL); + strftime(ubuf, sizeof(ubuf), "Time: %F %H:%M:%S%z", localtime(&now)); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width - 10, ubuf, COL_MENUCONTENT_TEXT); + ypos += mheight; - snprintf( ubuf,buf_size, "Uptime: %2d:%02d%s up ", - current_time->tm_hour%12 ? current_time->tm_hour%12 : 12, - current_time->tm_min, current_time->tm_hour > 11 ? "pm" : "am"); - strcat(sbuf, ubuf); - updays = (int) info.uptime / (60*60*24); - if (updays) { - snprintf(ubuf,buf_size, "%d day%s, ", updays, (updays != 1) ? "s" : ""); - strcat(sbuf, ubuf); - } - upminutes = (int) info.uptime / 60; - uphours = (upminutes / 60) % 24; - upminutes %= 60; - if (uphours) - snprintf(ubuf,buf_size,"%2d:%02d, ", uphours, upminutes); - else - snprintf(ubuf,buf_size,"%d min, ", upminutes); - strcat(sbuf, ubuf); + struct sysinfo info; + sysinfo(&info); + now -= info.uptime; + strftime(ubuf, sizeof(ubuf), "Boot: %F %H:%M:%S%z", localtime(&now)); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width - 10, ubuf, COL_MENUCONTENT_TEXT); + ypos += mheight; - snprintf(ubuf,buf_size, "load: %ld.%02ld, %ld.%02ld, %ld.%02ld", - LOAD_INT(info.loads[0]), LOAD_FRAC(info.loads[0]), - LOAD_INT(info.loads[1]), LOAD_FRAC(info.loads[1]), - LOAD_INT(info.loads[2]), LOAD_FRAC(info.loads[2])); - strcat(sbuf, ubuf); - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width - 10, sbuf, COL_MENUCONTENT_TEXT); - ypos+= mheight/2; - ypos+= mheight; - int headOffset=0; - int mpOffset=0; - bool rec_mp=false, memory_flag = false; - const int headSize_mem = 5; - const char *head_mem[headSize_mem] = {"Memory", "Size", "Used", "Available", "Use%"}; - // paint mount head - for (int j = 0; j < headSize_mem; j++) { - switch (j) - { - case 0: - headOffset = 10; - break; - case 1: - headOffset = nameOffset + 20; - break; - case 2: - headOffset = nameOffset + sizeOffset+10 +20; - break; - case 3: - headOffset = nameOffset + (sizeOffset+10)*2+15; - break; - case 4: - headOffset = nameOffset + (sizeOffset+10)*3+15; - break; + if (current_load > -1) { + snprintf(ubuf, sizeof(ubuf), "Load: %ld%s%ld%%", current_load/10, g_Locale->getText(LOCALE_UNIT_DECIMAL), current_load%10); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width - 10, ubuf, COL_MENUCONTENT_TEXT); + } + ypos += mheight; + + ypos += mheight/2; + + if (frontend_count) { + for (int i = 0; i < frontend_count; i++) { + CFrontend *fe = CFEManager::getInstance()->getFE(i); + if (fe) { + std::string s("Frontend "); + s += to_string(i) + ": " + fe->getInfo()->name; + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ 10, ypos+ mheight, width - 10, s, COL_MENUCONTENT_TEXT); + ypos += mheight; } - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ headOffset, ypos+ mheight, width - 10, head_mem[j], COL_MENUCONTENTINACTIVE_TEXT); } - ypos+= mheight; + ypos += mheight/2; + } - for (int k = 0; k < 1 + have_swap; k++) { - m[k][DBINFO_USED] = m[k][DBINFO_TOTAL] - m[k][DBINFO_FREE]; - for (int j = 0; j < headSize_mem; j++) { - switch (j) { + int headOffset=0; + int mpOffset=0; + const int headSize_mem = 5; + const char *head_mem[headSize_mem] = {"Memory", "Size", "Used", "Available", "Use"}; + int offsets[] = { + 10, + nameWidth + 10, + nameWidth + 10 + (sizeWidth+10)*1, + nameWidth + 10 + (sizeWidth+10)*2, + nameWidth + 10 + (sizeWidth+10)*3, + }; + int widths[] = { 0, sizeWidth, sizeWidth, sizeWidth, percWidth }; + + // paint mount head + for (int j = 0; j < headSize_mem; j++) { + headOffset = offsets[j]; + int center = 0; + if (j > 0) + center = (widths[j] - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(head_mem[j], true))/2; + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ headOffset + center, ypos+ mheight, width - 10, head_mem[j], COL_MENUCONTENTINACTIVE_TEXT); + } + ypos += mheight; + + for (int k = 0; k < 1 + have_swap; k++) { + std::string tmp; + m[k][DBINFO_USED] = m[k][DBINFO_TOTAL] - m[k][DBINFO_FREE]; + for (int j = 0; j < headSize_mem; j++) { + switch (j) { + case 0: + tmp = n[k]; + break; + case 1: + tmp = bytes2string(1024 * m[k][DBINFO_TOTAL]); + break; + case 2: + tmp = bytes2string(1024 * m[k][DBINFO_USED]); + break; + case 3: + tmp = bytes2string(1024 * m[k][DBINFO_FREE]); + break; + case 4: + tmp = to_string(m[k][DBINFO_TOTAL] ? (m[k][DBINFO_USED] * 100) / m[k][DBINFO_TOTAL] : 0) + "%"; + break; + } + mpOffset = offsets[j]; + int center = 0; + if (j > 0) + center = (widths[j] - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true))/2; + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + mpOffset + center, ypos+ mheight, width - 10, tmp, COL_MENUCONTENT_TEXT); + } + int pbw = width - offsetw - 10; + if (pbw > 8) /* smaller progressbar is not useful ;) */ + { + CProgressBar pb(x+offsetw, ypos+3, pbw, mheight-10); + pb.setBlink(); + pb.setInvert(); + pb.setValues(m[k][0] ? (m[k][1] * 100) / m[k][0] : 0, 100); + pb.paint(false); + } + ypos += mheight; + } + ypos += mheight/2; + + // paint mount head + for (int j = 0; j < headSize; j++) { + headOffset = offsets[j]; + int center = 0; + if (j > 0) + center = (widths[j] - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(head[j], true))/2; + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ headOffset + center, ypos+ mheight, width - 10, head[j], COL_MENUCONTENTINACTIVE_TEXT); + } + ypos += mheight; + + for (std::map::iterator it = mounts.begin(); it != mounts.end(); ++it) { + struct statfs s; + if (::statfs((*it).first.c_str(), &s) == 0) { + if (s.f_blocks > 0) { + int percent_used; + uint64_t bytes_total; + uint64_t bytes_used; + uint64_t bytes_free; + bytes_total = s.f_blocks * s.f_bsize; + bytes_free = s.f_bfree * s.f_bsize; + bytes_used = bytes_total - bytes_free; + percent_used = (bytes_used * 200 + bytes_total) / 2 / bytes_total; + //paint mountpoints + for (int j = 0; j < headSize; j++) { + std::string tmp; + mpOffset = offsets[j]; + int _w = width; + switch (j) { case 0: - mpOffset = 10; - snprintf(ubuf,buf_size,"%-20.20s", n[k]); + tmp = (*it).first; + if (tmp == "/") + tmp = "rootfs"; + _w = nameWidth - mpOffset; + if ((*it).second) + _w -= icon_w + 10; break; case 1: - mpOffset = nameOffset + 10; - bytes2string(1024 * m[k][DBINFO_TOTAL], ubuf, buf_size); + tmp = bytes2string(bytes_total, false); break; case 2: - mpOffset = nameOffset+ (sizeOffset+10)*1+10; - bytes2string(1024 * m[k][DBINFO_FREE], ubuf, buf_size); + tmp = bytes2string(bytes_used, false); break; case 3: - mpOffset = nameOffset+ (sizeOffset+10)*2+10; - bytes2string(1024 * m[k][DBINFO_USED], ubuf, buf_size); + tmp = bytes2string(bytes_free, false); break; case 4: - mpOffset = nameOffset+ (sizeOffset+10)*3+10; - snprintf(ubuf, buf_size, "%4d%%", m[k][DBINFO_TOTAL] ? (m[k][DBINFO_FREE] * 100) / m[k][DBINFO_TOTAL] : 0); + tmp = to_string(percent_used) + "%"; break; - } - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + mpOffset, ypos+ mheight, width - 10, ubuf, COL_MENUCONTENT_TEXT); - } - int pbw = width - offsetw - 10; - if (pbw > 8) /* smaller progressbar is not useful ;) */ - { - CProgressBar pb(x+offsetw, ypos+3, pbw, mheight-10); - pb.setBlink(); - pb.setInvert(); - pb.setValues(m[k][0] ? (m[k][1] * 100) / m[k][0] : 0, 100); - pb.paint(false); - } - ypos+= mheight; - } - ypos+= mheight; - - // paint mount head - for (int j = 0; j < headSize; j++) { - switch (j) - { - case 0: - headOffset = 10; - break; - case 1: - headOffset = nameOffset + 20; - break; - case 2: - headOffset = nameOffset + sizeOffset+10 +20; - break; - case 3: - headOffset = nameOffset + (sizeOffset+10)*2+15; - break; - case 4: - headOffset = nameOffset + (sizeOffset+10)*3+15; - break; - } - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+ headOffset, ypos+ mheight, width - 10, head[j], COL_MENUCONTENTINACTIVE_TEXT); - } - ypos+= mheight; - - if ((mountFile = setmntent("/proc/mounts", "r")) == 0 ) { - perror("/proc/mounts"); - } - else { - mapseen; - while ((mnt = getmntent(mountFile)) != 0) { - if (::statfs(mnt->mnt_dir, &s) == 0) { - - struct stat st; - if (!stat(mnt->mnt_dir, &st) && seen.find(st.st_dev) != seen.end()) - continue; - seen[st.st_dev] = true; - switch (s.f_type) { - case (int) 0xEF53: /*EXT2 & EXT3*/ - case (int) 0x6969: /*NFS*/ - case (int) 0xFF534D42: /*CIFS*/ - case (int) 0x517B: /*SMB*/ - case (int) 0x52654973: /*REISERFS*/ - case (int) 0x65735546: /*fuse for ntfs*/ - case (int) 0x58465342: /*xfs*/ - case (int) 0x4d44: /*msdos*/ - case (int) 0x72b6: /*jffs2*/ - case (int) 0x5941ff53: /*yaffs2*/ - break; - default: - continue; } - if ( s.f_blocks > 0 || memory_flag ) { - int percent_used; - uint64_t bytes_total; - uint64_t bytes_used; - uint64_t bytes_free; - if (memory_flag) - { - //bytes_total = info.totalram; - //bytes_free = info.freeram; - unsigned long t, f; - get_mem_usage(t, f); - bytes_total = t*1024; - bytes_free = f*1024; - } - else - { - bytes_total = s.f_blocks * s.f_bsize; - bytes_free = s.f_bfree * s.f_bsize; - } - bytes_used = bytes_total - bytes_free; - percent_used = (bytes_used * 200 + bytes_total) / 2 / bytes_total; - struct statfs rec_s; - if (statfs(g_settings.network_nfs_recordingdir.c_str(), &rec_s)) - memset(&rec_s, 0, sizeof(rec_s)); - //paint mountpoints - for (int j = 0; j < headSize; j++) { - int _w = width; - switch (j) { - case 0: - rec_mp = !memcmp(&s.f_fsid, &rec_s.f_fsid, sizeof(s.f_fsid)) && (s.f_type != 0x72b6) && (s.f_type != 0x5941ff53); - mpOffset = 10; - strncpy(ubuf, basename(mnt->mnt_dir), buf_size); - _w = nameOffset - mpOffset; - if (rec_mp) - _w -= icon_w; - break; - case 1: - mpOffset = nameOffset + 10; - bytes2string(bytes_total, ubuf, buf_size); - break; - case 2: - mpOffset = nameOffset+ (sizeOffset+10)*1+10; - bytes2string(bytes_used, ubuf, buf_size); - break; - case 3: - mpOffset = nameOffset+ (sizeOffset+10)*2+10; - bytes2string(bytes_free, ubuf, buf_size); - break; - case 4: - mpOffset = nameOffset+ (sizeOffset+10)*3+10; - snprintf(ubuf, buf_size, "%4d%%", percent_used); - break; - } - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + mpOffset, ypos+ mheight, _w - 10, ubuf, COL_MENUCONTENT_TEXT); - if (rec_mp) { - if (icon_w>0 && icon_h>0) - frameBuffer->paintIcon(NEUTRINO_ICON_REC, x + nameOffset - 10 - icon_w, ypos + (mheight/2 - icon_h/2)); - rec_mp = false; - } - } - int pbw = width - offsetw - 10; - memory_flag = false; + int center = 0; + if (j > 0) + center = (widths[j] - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp, true))/2; + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + mpOffset + center, ypos+ mheight, _w - 10, tmp, COL_MENUCONTENT_TEXT); + if ((*it).second && icon_w>0 && icon_h>0) + frameBuffer->paintIcon(NEUTRINO_ICON_REC, x + nameWidth - icon_w, ypos + (mheight/2 - icon_h/2)); + } + int pbw = width - offsetw - 10; //fprintf(stderr, "width: %d offsetw: %d pbw: %d\n", width, offsetw, pbw); - if (pbw > 8) /* smaller progressbar is not useful ;) */ - { - CProgressBar pb(x+offsetw, ypos+3, pbw, mheight-10); - pb.setBlink(); - pb.setInvert(); - pb.setValues(percent_used, 100); - pb.paint(false); - } - ypos+= mheight; - } - i++; + if (pbw > 8) /* smaller progressbar is not useful ;) */ + { + CProgressBar pb(x+offsetw, ypos+3, pbw, mheight-10); + pb.setBlink(); + pb.setInvert(); + pb.setValues(percent_used, 100); + pb.paint(false); } - if (ypos > y + height - mheight) /* the screen is not high enough */ - break; /* todo: scrolling? */ + ypos += mheight; } - endmntent(mountFile); } + if (ypos > y + height - mheight) /* the screen is not high enough */ + break; /* todo: scrolling? */ } - if (sbuf) - delete[] sbuf; - if (ubuf) - delete[] ubuf; - } diff --git a/src/gui/dboxinfo.h b/src/gui/dboxinfo.h index 4d454e01d..4a8cc52ee 100644 --- a/src/gui/dboxinfo.h +++ b/src/gui/dboxinfo.h @@ -34,12 +34,9 @@ #define __dboxinfo__ #include - #include - #include - class CDBoxInfoWidget : public CMenuTarget { private: @@ -50,6 +47,7 @@ class CDBoxInfoWidget : public CMenuTarget int width; int height; int hheight,mheight; // head/menu font height + unsigned long stat_total, stat_idle; void paint(); diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 7a726cb0c..059d5143b 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -109,110 +109,23 @@ unsigned char SMSKeyInput::handleMsg(const neutrino_msg_t msg) // m_oldKeyTime.tv_sec*1000+m_oldKeyTime.tv_usec/1000, // m_timeout,!timeoutNotReached); - unsigned char key = 0; - if(msg == CRCInput::RC_1) - { - key = '1'; - } - if(msg == CRCInput::RC_2) - { - if(m_oldKey == 'a' && timeoutNotReached) - key = 'b'; - else if(m_oldKey == 'b' && timeoutNotReached) - key = 'c'; - else if(m_oldKey == 'c' && timeoutNotReached) - key = '2'; - else - key = 'a'; - } - else if(msg == CRCInput::RC_3) - { - if(m_oldKey == 'd' && timeoutNotReached) - key = 'e'; - else if(m_oldKey == 'e' && timeoutNotReached) - key = 'f'; - else if(m_oldKey == 'f' && timeoutNotReached) - key = '3'; - else - key = 'd'; - } - else if(msg == CRCInput::RC_4) - { - if(m_oldKey == 'g' && timeoutNotReached) - key = 'h'; - else if(m_oldKey == 'h' && timeoutNotReached) - key = 'i'; - else if(m_oldKey == 'i' && timeoutNotReached) - key = '4'; - else - key = 'g'; - } - else if(msg == CRCInput::RC_5) - { - if(m_oldKey == 'j' && timeoutNotReached) - key = 'k'; - else if(m_oldKey == 'k' && timeoutNotReached) - key = 'l'; - else if(m_oldKey == 'l' && timeoutNotReached) - key = '5'; - else - key = 'j'; - } - else if(msg == CRCInput::RC_6) - { - if(m_oldKey == 'm' && timeoutNotReached) - key = 'n'; - else if(m_oldKey == 'n' && timeoutNotReached) - key = 'o'; - else if(m_oldKey == 'o' && timeoutNotReached) - key = '6'; - else - key = 'm'; - } - else if(msg == CRCInput::RC_7) - { - if(m_oldKey == 'p' && timeoutNotReached) - key = 'q'; - else if(m_oldKey == 'q' && timeoutNotReached) - key = 'r'; - else if(m_oldKey == 'r' && timeoutNotReached) - key = 's'; - else if(m_oldKey == 's' && timeoutNotReached) - key = 's'; - else - key = 'p'; - } - else if(msg == CRCInput::RC_8) - { - if(m_oldKey == 't' && timeoutNotReached) - key = 'u'; - else if(m_oldKey == 'u' && timeoutNotReached) - key = 'v'; - else if(m_oldKey == 'v' && timeoutNotReached) - key = '8'; - else - key = 't'; - } - else if(msg == CRCInput::RC_9) - { - if(m_oldKey == 'w' && timeoutNotReached) - key = 'x'; - else if(m_oldKey == 'x' &&timeoutNotReached) - key = 'y'; - else if(m_oldKey == 'y' &&timeoutNotReached) - key = 'z'; - else if(m_oldKey == 'z' && timeoutNotReached) - key = '9'; - else - key = 'w'; - } - else if(msg == CRCInput::RC_0) - { - key = '0'; + const char *key = ""; + if (CRCInput::isNumeric(msg)) { + int n = CRCInput::getNumericValue(msg); + const char *Chars[10] = { "0", "1", "abc2", "def3", "ghi4", "jkl5", "mno6", "pqrs7", "tuv8", "wxyz9" }; + if (timeoutNotReached) { + key = Chars[n]; + while (*key && *key != m_oldKey) + key++; + if (*key) + key++; + } + if (!*key) + key = Chars[n]; } m_oldKeyTime=keyTime; - m_oldKey=key; - return key; + m_oldKey=*key; + return *key; } //------------------------------------------------------------------------ diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index 4d9b4d12e..03f10ebe7 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -400,7 +400,7 @@ void CMiscMenue::showMiscSettingsMenuEpg(CMenuWidget *ms_epg) if (epg_cache.length() < 2) epg_cache.insert(0, 2 - epg_cache.length(), ' '); CStringInput * miscSettings_epg_cache = new CStringInput(LOCALE_MISCSETTINGS_EPG_CACHE, &epg_cache, 2,LOCALE_MISCSETTINGS_EPG_CACHE_HINT1, LOCALE_MISCSETTINGS_EPG_CACHE_HINT2 , "0123456789 ", sectionsdConfigNotifier); - CMenuForwarder * mf = new CMenuDForwarder(LOCALE_MISCSETTINGS_EPG_CACHE, true, NULL, miscSettings_epg_cache); + CMenuForwarder * mf = new CMenuDForwarder(LOCALE_MISCSETTINGS_EPG_CACHE, true, epg_cache, miscSettings_epg_cache); mf->setHint("", LOCALE_MENU_HINT_EPG_CACHE); epg_extendedcache = to_string(g_settings.epg_extendedcache); diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 5cab46337..b4e705da7 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -82,16 +82,16 @@ class CMoviePlayerGui : public CMenuTarget unsigned short numpida; unsigned short vpid; unsigned short vtype; - std::string language[REC_MAX_APIDS]; - unsigned short apids[REC_MAX_APIDS]; - unsigned short ac3flags[REC_MAX_APIDS]; + std::string language[MAX_PLAYBACK_PIDS]; + unsigned short apids[MAX_PLAYBACK_PIDS]; + unsigned short ac3flags[MAX_PLAYBACK_PIDS]; unsigned short currentapid, currentac3; /* subtitles vars */ unsigned short numsubs; - std::string slanguage[REC_MAX_APIDS]; - unsigned short spids[REC_MAX_APIDS]; - unsigned short sub_supported[REC_MAX_APIDS]; + std::string slanguage[MAX_PLAYBACK_PIDS]; + unsigned short spids[MAX_PLAYBACK_PIDS]; + unsigned short sub_supported[MAX_PLAYBACK_PIDS]; int currentspid; int min_x, min_y, max_x, max_y; time_t end_time; diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 1489321bc..f058733f7 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -1000,6 +1000,11 @@ void COsdSetup::showOsdChanlistSetup(CMenuWidget *menu_chanlist) mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_CHANNELLIST_COLORED_EVENTS, &g_settings.colored_events_channellist, OPTIONS_COLORED_EVENTS_OPTIONS, OPTIONS_COLORED_EVENTS_OPTION_COUNT, true); mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_COLORED); menu_chanlist->addItem(mc); + + //show channel logo + mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_SHOW_CHANNELLOGO, &g_settings.channellist_show_channellogo, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SHOW_CHANNELLOGO); + menu_chanlist->addItem(mc); } //eventlist @@ -1175,6 +1180,11 @@ int COsdSetup::showContextChanlistMenu() mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_COLORED); menu_chanlist->addItem(mc); + //show channel logo + mc = new CMenuOptionChooser(LOCALE_CHANNELLIST_SHOW_CHANNELLOGO, &g_settings.channellist_show_channellogo, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + mc->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SHOW_CHANNELLOGO); + menu_chanlist->addItem(mc); + menu_chanlist->addItem(new CMenuSeparator(CMenuSeparator::LINE)); CMenuWidget *fontSettingsSubMenu = new CMenuWidget(LOCALE_FONTMENU_HEAD, NEUTRINO_ICON_KEYBINDING); diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index 02b8aebfc..7349c9ac2 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -291,14 +291,14 @@ void CRecordSetup::showRecordTimerSetup(CMenuWidget *menu_timersettings) //start CMenuOptionNumberChooser *ch = new CMenuOptionNumberChooser(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE, - &g_settings.record_safety_time_before, true, 0, 99, NULL); + &g_settings.record_safety_time_before, true, 0, 99, this); ch->setNumberFormat(nf); ch->setHint("", LOCALE_MENU_HINT_RECORD_TIMEBEFORE); menu_timersettings->addItem(ch); //end ch = new CMenuOptionNumberChooser(LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER, - &g_settings.record_safety_time_after, true, 0, 99, NULL); + &g_settings.record_safety_time_after, true, 0, 99, this); ch->setNumberFormat(nf); ch->setHint("", LOCALE_MENU_HINT_RECORD_TIMEAFTER); menu_timersettings->addItem(ch); @@ -391,7 +391,7 @@ bool CRecordSetup::changeNotify(const neutrino_locale_t OptionName, void * /*dat { if (ARE_LOCALES_EQUAL(OptionName, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_BEFORE) || ARE_LOCALES_EQUAL(OptionName, LOCALE_TIMERSETTINGS_RECORD_SAFETY_TIME_AFTER)) { - g_Timerd->setRecordingSafety(g_settings.record_safety_time_before*60, g_settings.record_safety_time_after); + g_Timerd->setRecordingSafety(g_settings.record_safety_time_before*60, g_settings.record_safety_time_after*60); } else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_RECORDINGMENU_APIDS_STD) || ARE_LOCALES_EQUAL(OptionName, LOCALE_RECORDINGMENU_APIDS_ALT) || ARE_LOCALES_EQUAL(OptionName, LOCALE_RECORDINGMENU_APIDS_AC3)) { diff --git a/src/gui/widget/stringinput.cpp b/src/gui/widget/stringinput.cpp index 52d409eff..7904aeb3f 100644 --- a/src/gui/widget/stringinput.cpp +++ b/src/gui/widget/stringinput.cpp @@ -654,7 +654,7 @@ void CStringInput::paint(bool sms) if (sms) { frameBuffer->getIconSize(NEUTRINO_ICON_NUMERIC_PAD, &icol_w, &icol_h); - frameBuffer->paintIcon(NEUTRINO_ICON_NUMERIC_PAD, x + (width/2) - (icol_w/2), tmp_y, 0, 1, true, true, COL_MENUCONTENT_TEXT); + frameBuffer->paintIcon(NEUTRINO_ICON_NUMERIC_PAD, x + (width/2) - (icol_w/2), tmp_y); //buttonbar ::paintButtons(x, y+ hheight+ bheight, width, CStringInputSMSButtonsCount, CStringInputSMSButtons, width, fheight); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 41d98d131..d1eaeed6e 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -679,6 +679,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.channellist_new_zap_mode = configfile.getInt32("channellist_new_zap_mode", 1); g_settings.channellist_sort_mode = configfile.getInt32("channellist_sort_mode", 0);//sort mode: alpha, freq, sat g_settings.channellist_numeric_adjust = configfile.getInt32("channellist_numeric_adjust", 0); + g_settings.channellist_show_channellogo = configfile.getInt32("channellist_show_channellogo", 1); //screen configuration g_settings.screen_xres = configfile.getInt32("screen_xres", 100); @@ -1170,6 +1171,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool ( "audiochannel_up_down_enable", g_settings.audiochannel_up_down_enable ); configfile.setInt32("channellist_sort_mode", g_settings.channellist_sort_mode); configfile.setInt32("channellist_numeric_adjust", g_settings.channellist_numeric_adjust); + configfile.setInt32("channellist_show_channellogo", g_settings.channellist_show_channellogo); //screen configuration configfile.setInt32( "screen_xres", g_settings.screen_xres); diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 295a5b947..cd299eaa4 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -941,14 +941,14 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh) { std::string result = ""; if (!(hh->ParamList.empty())) { - int mode = CZapitClient::MODE_CURRENT; + int mode = NeutrinoAPI->Zapit->getMode(); - if (!(hh->ParamList["mode"].empty())) { - if (hh->ParamList["mode"].compare("TV") == 0) - mode = CZapitClient::MODE_TV; - if (hh->ParamList["mode"].compare("RADIO") == 0) - mode = CZapitClient::MODE_RADIO; - } + if (hh->ParamList["mode"].compare("TV") == 0) + mode = CZapitClient::MODE_TV; + else if (hh->ParamList["mode"].compare("RADIO") == 0) + mode = CZapitClient::MODE_RADIO; + else if (hh->ParamList["mode"].compare("all") == 0) + mode = CZapitClient::MODE_ALL; // Get Bouquet Number. First matching current channel if (hh->ParamList["1"] == "actual") { @@ -962,7 +962,6 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh) { hh->printf("%d", actual); } else { - ZapitChannelList channels; int BouquetNr = -1; // -1 = all bouquets int startBouquet = 0; int bsize = (int) g_bouquetManager->Bouquets.size(); @@ -979,22 +978,31 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh) { } if (!(hh->ParamList["epg"].empty())) NeutrinoAPI->GetChannelEvents(); - for (int i = startBouquet; i < bsize; i++) { - channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[i]->radioChannels : g_bouquetManager->Bouquets[i]->tvChannels; - int num = 1 + (mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin().getNrofFirstChannelofBouquet(i) - : g_bouquetManager->tvChannelsBegin().getNrofFirstChannelofBouquet(i)); - int size = (int) channels.size(); - for (int j = 0; j < size; j++) { - CZapitChannel * channel = channels[j]; - result += _GetBouquetWriteItem(hh, channel, i, num + j); - if (j < (size - 1) && outType == json) { - result += ",\n"; + const char *json_delimiter = ""; + if (mode == CZapitClient::MODE_RADIO || mode == CZapitClient::MODE_ALL) + for (int i = startBouquet; i < bsize; i++) { + ZapitChannelList channels = g_bouquetManager->Bouquets[i]->radioChannels; + int num = 1 + g_bouquetManager->radioChannelsBegin().getNrofFirstChannelofBouquet(i); + int size = (int) channels.size(); + for (int j = 0; j < size; j++) { + CZapitChannel * channel = channels[j]; + result += json_delimiter; + json_delimiter = (outType == json) ? ",\n" : ""; + result += _GetBouquetWriteItem(hh, channel, i, num + j); } } - if (i < (bsize - 1) && outType == json && size > 0) { - result += ",\n"; + if (mode == CZapitClient::MODE_TV || mode == CZapitClient::MODE_ALL) + for (int i = startBouquet; i < bsize; i++) { + ZapitChannelList channels = g_bouquetManager->Bouquets[i]->tvChannels; + int num = 1 + g_bouquetManager->tvChannelsBegin().getNrofFirstChannelofBouquet(i); + int size = (int) channels.size(); + for (int j = 0; j < size; j++) { + CZapitChannel * channel = channels[j]; + result += json_delimiter; + json_delimiter = (outType == json) ? ",\n" : ""; + result += _GetBouquetWriteItem(hh, channel, i, num + j); + } } - } result = hh->outArray("channels", result); // write footer if (outType == json) { @@ -1095,7 +1103,9 @@ void CControlAPI::GetBouquetsCGI(CyhookHandler *hh) { fav = true; int mode = NeutrinoAPI->Zapit->getMode(); - if (hh->ParamList["mode"].compare("TV") == 0) + if (hh->ParamList["mode"].compare("all") == 0) + mode = CZapitClient::MODE_ALL; + else if (hh->ParamList["mode"].compare("TV") == 0) mode = CZapitClient::MODE_TV; else if (hh->ParamList["mode"].compare("RADIO") == 0) mode = CZapitClient::MODE_RADIO; @@ -1103,8 +1113,18 @@ void CControlAPI::GetBouquetsCGI(CyhookHandler *hh) { std::string bouquet; for (int i = 0, size = (int) g_bouquetManager->Bouquets.size(); i < size; i++) { std::string item = ""; - ZapitChannelList * channels = mode == CZapitClient::MODE_RADIO ? &g_bouquetManager->Bouquets[i]->radioChannels : &g_bouquetManager->Bouquets[i]->tvChannels; - if (!channels->empty() && (!g_bouquetManager->Bouquets[i]->bHidden || show_hidden) && (!fav || g_bouquetManager->Bouquets[i]->bUser)) { + unsigned int channel_count = 0; + switch (mode) { + case CZapitClient::MODE_RADIO: + channel_count = g_bouquetManager->Bouquets[i]->radioChannels.size(); + break; + case CZapitClient::MODE_TV: + channel_count = g_bouquetManager->Bouquets[i]->tvChannels.size(); + break; + case CZapitClient::MODE_ALL: + channel_count = g_bouquetManager->Bouquets[i]->radioChannels.size() + g_bouquetManager->Bouquets[i]->tvChannels.size(); + } + if (channel_count && (!g_bouquetManager->Bouquets[i]->bHidden || show_hidden) && (!fav || g_bouquetManager->Bouquets[i]->bUser)) { bouquet = std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[i]->Name.c_str()); if (encode) bouquet = encodeString(bouquet); // encode (URLencode) the bouquetname diff --git a/src/system/locals.h b/src/system/locals.h index f3573b6f9..770775708 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -269,6 +269,7 @@ typedef enum LOCALE_CHANNELLIST_RESET_ALL, LOCALE_CHANNELLIST_RESET_FLAGS, LOCALE_CHANNELLIST_SATS, + LOCALE_CHANNELLIST_SHOW_CHANNELLOGO, LOCALE_CHANNELLIST_SINCE, LOCALE_CHANNELLIST_START, LOCALE_CI_CLOCK, @@ -839,6 +840,7 @@ typedef enum LOCALE_MENU_HINT_CHANNELLIST_FONTS, LOCALE_MENU_HINT_CHANNELLIST_FOOT, LOCALE_MENU_HINT_CHANNELLIST_SETUP, + LOCALE_MENU_HINT_CHANNELLIST_SHOW_CHANNELLOGO, LOCALE_MENU_HINT_CHANNELS, LOCALE_MENU_HINT_CI, LOCALE_MENU_HINT_CLOCK_BACKGROUND, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index e7ce80868..0af0d3eea 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -269,6 +269,7 @@ const char * locale_real_names[] = "channellist.reset_all", "channellist.reset_flags", "channellist.sats", + "channellist.show_channellogo", "channellist.since", "channellist.start", "ci.clock", @@ -839,6 +840,7 @@ const char * locale_real_names[] = "menu.hint_channellist_fonts", "menu.hint_channellist_foot", "menu.hint_channellist_setup", + "menu.hint_channellist_show_channellogo", "menu.hint_channels", "menu.hint_ci", "menu.hint_clock_background", diff --git a/src/system/settings.h b/src/system/settings.h index b8e652217..35009ff04 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -469,6 +469,7 @@ struct SNeutrinoSettings int channellist_new_zap_mode; int channellist_sort_mode; int channellist_numeric_adjust; + int channellist_show_channellogo; int repeat_blocker; int repeat_genericblocker; int remote_control_hardware; diff --git a/src/zapit/include/zapit/client/zapitclient.h b/src/zapit/include/zapit/client/zapitclient.h index eb43dfd78..bb5efa31b 100644 --- a/src/zapit/include/zapit/client/zapitclient.h +++ b/src/zapit/include/zapit/client/zapitclient.h @@ -104,7 +104,8 @@ class CZapitClient:public CBasicClient { MODE_CURRENT, MODE_TV, - MODE_RADIO + MODE_RADIO, + MODE_ALL } channelsMode; typedef enum channelsOrder_