From a0c7d1cee5c99556b266aae8a5b263fe390bb31d Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 3 Jan 2010 12:06:13 +0000 Subject: [PATCH] neutrino: make blinkenlights runtime configurable Get rid of "--disable-blinkenlights" configure switch. Colored progress bars can be disabled with "neutrino -noblink" now. Unfortunately CProgressBar had to be touched again to avoid ambiguities in the constructor, but should be done for now. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@133 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/691811695a0f14d364a874b60f012a1d6eb9eb0f Author: Stefan Seyfried Date: 2010-01-03 (Sun, 03 Jan 2010) ------------------ This commit was generated by Migit --- configure.ac | 8 ------- src/gui/epgview.cpp | 5 ++-- src/gui/infoviewer.cpp | 43 +++++++++++++++++----------------- src/gui/motorcontrol.cpp | 5 ++-- src/gui/moviebrowser.cpp | 5 ++-- src/gui/scan.cpp | 5 ++-- src/gui/streaminfo2.cpp | 5 ++-- src/gui/timeosd.cpp | 3 ++- src/gui/widget/progressbar.cpp | 21 +++-------------- src/gui/widget/progressbar.h | 26 ++++++++++---------- src/neutrino.cpp | 11 +++++++-- 11 files changed, 63 insertions(+), 74 deletions(-) diff --git a/configure.ac b/configure.ac index 21108915f..44ba69398 100644 --- a/configure.ac +++ b/configure.ac @@ -41,14 +41,6 @@ AC_ARG_ENABLE(restore-prev-mode, [ --enable-restore-prev-mode enable return from graphics mode], [AC_DEFINE(RETURN_FROM_GRAPHICS_MODE,1,[enable return from graphics mode])]) -AC_ARG_ENABLE(blinkenlights, - AS_HELP_STRING(--disable-blinkenlights, disable colorful progress bars and use classical style), - ,[enable_blinkenlights=yes]) - -if test "$enable_blinkenlights" != "yes"; then -AC_DEFINE(NO_BLINKENLIGHTS, 1, [disable colorful progress bars, use classical style]) -fi - # # Check for libtdservicedb - the new one - for testing only # diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 0e15f21c9..3cc0ca072 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -52,6 +52,7 @@ #include #include +extern bool pb_blink; extern CPictureViewer * g_PicViewer; #define PIC_W 52 #define PIC_H 39 @@ -626,7 +627,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ if ( epg_done!= -1 ) { int pbx = sx + 10 + widthl + 10 + ((ox-104-widthr-widthl-10-10-20)>>1); - CProgressBar pb; + CProgressBar pb(pb_blink); pb.paintProgressBarDefault(pbx, sy+oy-height, 104, height-6, epg_done, 104); } @@ -666,7 +667,7 @@ int CEpgData::show(const t_channel_id channel_id, unsigned long long a_id, time_ if (data == g_InfoViewer->lcdUpdateTimer) { GetEPGData(channel_id, id, &startzeit ); if ( epg_done!= -1 ) { - CProgressBar pb; + CProgressBar pb(pb_blink); int pbx = sx + 10 + widthl + 10 + ((ox-104-widthr-widthl-10-10-20)>>1); pb.paintProgressBarDefault(pbx, sy+oy-height, 104, height-6, epg_done, 104); } diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index e0ada8c76..6366bd748 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -82,13 +82,6 @@ extern t_channel_id live_channel_id; //zapit #define ICON_OFFSET (2 + ICON_LARGE_WIDTH + 2 + ICON_LARGE_WIDTH + 2 + ICON_SMALL_WIDTH + 2) -#ifdef NO_BLINKENLIGHTS -#define BOTTOM_BAR_OFFSET 0 -#else -/* BOTTOM_BAR_OFFSET is used for the blinkenlights iconbar */ -#define BOTTOM_BAR_OFFSET 22 -#endif - #define borderwidth 4 #define LEFT_OFFSET 5 #define ASIZE 100 @@ -108,6 +101,9 @@ bool newfreq = true; char old_timestr[10]; static event_id_t last_curr_id = 0, last_next_id = 0; +extern bool pb_blink; +int bottom_bar_offset; + extern CZapitClient::SatelliteList satList; static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& b) { @@ -161,22 +157,27 @@ void CInfoViewer::Init() chanready = 1; fileplay = 0; + /* maybe we should not tie this to the blinkenlights settings? */ + if (pb_blink) + bottom_bar_offset = 22; + else + bottom_bar_offset = 0; /* after font size changes, Init() might be called multiple times */ if (sigscale != NULL) delete sigscale; - sigscale = new CProgressBar(BAR_WIDTH, 10, PB_COLORED, RED_BAR, GREEN_BAR, YELLOW_BAR); + sigscale = new CProgressBar(pb_blink, BAR_WIDTH, 10, RED_BAR, GREEN_BAR, YELLOW_BAR); if (snrscale != NULL) delete snrscale; - snrscale = new CProgressBar(BAR_WIDTH, 10, PB_COLORED, RED_BAR, GREEN_BAR, YELLOW_BAR); + snrscale = new CProgressBar(pb_blink, BAR_WIDTH, 10, RED_BAR, GREEN_BAR, YELLOW_BAR); if (hddscale != NULL) delete hddscale; - hddscale = new CProgressBar(100, 6, PB_COLORED, 50, GREEN_BAR, 75, true); + hddscale = new CProgressBar(pb_blink, 100, 6, 50, GREEN_BAR, 75, true); if (varscale != NULL) delete varscale; - varscale = new CProgressBar(100, 6, PB_COLORED, 50, GREEN_BAR, 75, true); + varscale = new CProgressBar(pb_blink, 100, 6, 50, GREEN_BAR, 75, true); if (timescale != NULL) delete timescale; - timescale = new CProgressBar(PB_COLORED, 30, GREEN_BAR, 70, true); + timescale = new CProgressBar(pb_blink, -1, -1, 30, GREEN_BAR, 70, true); channel_id = live_channel_id; lcdUpdateTimer = 0; @@ -199,7 +200,7 @@ void CInfoViewer::Init() |02:34 Next Event | | | | | BoxEndY----+----------------------------------------------------+--+ - | optional blinkenlights iconbar | BOTTOM_BAR_OFFSET + | optional blinkenlights iconbar | bottom_bar_offset BBarY------+----------------------------------------------------+--+ | * red * green * yellow * blue ====== [DD][16:9]| InfoHeightY_Info +----------------------------------------------------+--+ @@ -222,10 +223,10 @@ void CInfoViewer::start () #endif BoxStartX = g_settings.screen_StartX + 10; BoxEndX = g_settings.screen_EndX - 10; - BoxEndY = g_settings.screen_EndY - 10 - InfoHeightY_Info - BOTTOM_BAR_OFFSET; + BoxEndY = g_settings.screen_EndY - 10 - InfoHeightY_Info - bottom_bar_offset; BoxStartY = BoxEndY - InfoHeightY - ChanHeight / 2; - BBarY = BoxEndY + BOTTOM_BAR_OFFSET; + BBarY = BoxEndY + bottom_bar_offset; BBarFontY = BBarY + InfoHeightY_Info - (InfoHeightY_Info - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()) / 2; /* center in buttonbar */ ChanNameX = BoxStartX + ChanWidth + SHADOW_OFFSET; @@ -303,7 +304,7 @@ void CInfoViewer::paintBackground(int col_NumBox) int c_rad_mid = RADIUS_MID; int BoxEndInfoY = BoxEndY; if (showButtonBar) // add button bar and blinkenlights - BoxEndInfoY += InfoHeightY_Info + BOTTOM_BAR_OFFSET; + BoxEndInfoY += InfoHeightY_Info + bottom_bar_offset; // kill left side frameBuffer->paintBackgroundBox(BoxStartX, BoxStartY + ChanHeight - 6, @@ -481,11 +482,11 @@ void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, con if (showButtonBar) { sec_timer_id = g_RCInput->addTimer (1*1000*1000, false); - if (BOTTOM_BAR_OFFSET > 0) + if (bottom_bar_offset > 0) { // FIXME - frameBuffer->paintBox(ChanInfoX, BoxEndY, BoxEndX, BoxEndY + BOTTOM_BAR_OFFSET, COL_BLACK); + frameBuffer->paintBox(ChanInfoX, BoxEndY, BoxEndX, BoxEndY + bottom_bar_offset, COL_BLACK); int xcnt = (BoxEndX - ChanInfoX) / 4; - int ycnt = (BOTTOM_BAR_OFFSET) / 4; + int ycnt = bottom_bar_offset / 4; for(int i = 0; i < xcnt; i++) { for(int j = 0; j < ycnt; j++) /* BoxEndY + 2 is the magic number that also appears in paint_ca_icons */ @@ -1462,7 +1463,7 @@ void CInfoViewer::killTitle() if (is_visible) { is_visible = false; - int bottom = BoxEndY + SHADOW_OFFSET + BOTTOM_BAR_OFFSET; + int bottom = BoxEndY + SHADOW_OFFSET + bottom_bar_offset; if (showButtonBar) bottom += InfoHeightY_Info; frameBuffer->paintBackgroundBox(BoxStartX, BoxStartY, BoxEndX+ SHADOW_OFFSET, bottom); @@ -1531,7 +1532,7 @@ int CInfoViewerHandler::exec (CMenuTarget * parent, const std::string & /*action void CInfoViewer::paint_ca_icons(int caid, char * icon) { - if (BOTTOM_BAR_OFFSET == 0) + if (bottom_bar_offset == 0) return; char buf[20]; diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index 513a395aa..0a21ecf6d 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -46,6 +46,7 @@ #include extern CFrontend * frontend; +extern bool pb_blink; static int g_sig; static int g_snr; @@ -89,8 +90,8 @@ void CMotorControl::Init(void) motorPosition = 1; satellitePosition = 0; stepDelay = 10; - sigscale = new CProgressBar(BAR_WIDTH, BAR_HEIGHT); - snrscale = new CProgressBar(BAR_WIDTH, BAR_HEIGHT); + sigscale = new CProgressBar(pb_blink, BAR_WIDTH, BAR_HEIGHT); + snrscale = new CProgressBar(pb_blink, BAR_WIDTH, BAR_HEIGHT); } int CMotorControl::exec(CMenuTarget* parent, const std::string &) diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index f3733a2d1..a0d0f6637 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -68,6 +68,7 @@ #include #include +extern bool pb_blink; extern CPictureViewer * g_PicViewer; #define PIC_W 52 #define PIC_H 39 @@ -3894,7 +3895,7 @@ static off64_t cut_movie(MI_MOVIE_INFO * minfo, CMovieInfo * cmovie) CFrameBuffer * frameBuffer = CFrameBuffer::getInstance(); if (! timescale) - timescale = new CProgressBar(200, 15, PB_COLORED, 0, 100, 0); + timescale = new CProgressBar(pb_blink, 200, 15, 0, 100, 0); int dx = 256; int x = (((g_settings.screen_EndX- g_settings.screen_StartX)- dx) / 2) + g_settings.screen_StartX; int y = g_settings.screen_EndY - 50; @@ -4148,7 +4149,7 @@ printf("copy: len %d minute %lld second %lld\n", len, len ? size/len : 511040*60 CFrameBuffer * frameBuffer = CFrameBuffer::getInstance(); if (! timescale) - timescale = new CProgressBar(200, 15, PB_COLORED, 0, 100, 0); + timescale = new CProgressBar(pb_blink, 200, 15, 0, 100, 0); int dx = 256; int x = (((g_settings.screen_EndX- g_settings.screen_StartX)- dx) / 2) + g_settings.screen_StartX; int y = g_settings.screen_EndY - 50; diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index 99bdd92cd..941a0c34e 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -60,6 +60,7 @@ #include extern cVideo * videoDecoder; extern CFrontend * frontend; +extern bool pb_blink; #define NEUTRINO_SCAN_START_SCRIPT CONFIGDIR "/scan.start" #define NEUTRINO_SCAN_STOP_SCRIPT CONFIGDIR "/scan.stop" @@ -79,8 +80,8 @@ CScanTs::CScanTs() total = done = 0; freqready = 0; - sigscale = new CProgressBar(BAR_WIDTH, BAR_HEIGHT); - snrscale = new CProgressBar(BAR_WIDTH, BAR_HEIGHT); + sigscale = new CProgressBar(pb_blink, BAR_WIDTH, BAR_HEIGHT); + snrscale = new CProgressBar(pb_blink, BAR_WIDTH, BAR_HEIGHT); } diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index c24121443..63028ccfa 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -56,6 +56,7 @@ extern cAudio * audioDecoder; extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern CZapitClient::SatelliteList satList; +extern bool pb_blink; #if 0 extern CPipSetup * g_Pip0; @@ -137,8 +138,8 @@ int CStreamInfo2::doSignalStrengthLoop () { #define BAR_WIDTH 150 #define BAR_HEIGHT 12 - sigscale = new CProgressBar(BAR_WIDTH, BAR_HEIGHT); - snrscale = new CProgressBar(BAR_WIDTH, BAR_HEIGHT); + sigscale = new CProgressBar(pb_blink, BAR_WIDTH, BAR_HEIGHT); + snrscale = new CProgressBar(pb_blink, BAR_WIDTH, BAR_HEIGHT); neutrino_msg_t msg; unsigned long long maxb, minb, lastb, tmp_rate; diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index 11a90ac0a..189c1f08c 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -32,6 +32,7 @@ #include static CProgressBar *timescale; +extern bool pb_blink; #define TIMEOSD_FONT SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME #define TIMEBARH 38 @@ -43,7 +44,7 @@ CTimeOSD::CTimeOSD() m_mode=MODE_ASC; GetDimensions(); if (! timescale) - timescale = new CProgressBar(200, 32, PB_COLORED, 40, 100, 70, true); + timescale = new CProgressBar(pb_blink, 200, 32, 40, 100, 70, true); } CTimeOSD::~CTimeOSD() diff --git a/src/gui/widget/progressbar.cpp b/src/gui/widget/progressbar.cpp index fbd9e7f04..7ce45abc0 100644 --- a/src/gui/widget/progressbar.cpp +++ b/src/gui/widget/progressbar.cpp @@ -33,23 +33,8 @@ #define GREEN 0x00FF00 #define YELLOW 0xFFFF00 - -CProgressBar::CProgressBar(const bool bl, const int r, const int g, const int b, const bool inv) -{ - frameBuffer = CFrameBuffer::getInstance(); - font_pbar = SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL; - // frame width around active bar - frame_widht = 2; - blink = bl; - invert = inv; - red = r; - green = g; - yellow = b; - width = height = -1; -} - -CProgressBar::CProgressBar(const int w, const int h, - const bool bl, const int r, const int g, const int b, const bool inv) +CProgressBar::CProgressBar(const bool bl, const int w, const int h, + const int r, const int g, const int b, const bool inv) { frameBuffer = CFrameBuffer::getInstance(); font_pbar = SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL; @@ -132,7 +117,7 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, const int c_rad = 0; /* if the bar is too small, do not draw the borders around it */ - if (height / 2 <= frame_widht || blink) + if (height / 2 <= frame_widht || blink || backgroundbar_col == 0) frame_widht = 0; // get icon size int icon_w = 0, icon_h = 0; diff --git a/src/gui/widget/progressbar.h b/src/gui/widget/progressbar.h index be683bb06..113c27ca7 100644 --- a/src/gui/widget/progressbar.h +++ b/src/gui/widget/progressbar.h @@ -27,11 +27,6 @@ #include #include -#ifdef NO_BLINKENLIGHTS -#define PB_COLORED false -#else -#define PB_COLORED true -#endif #include class CProgressBar @@ -57,15 +52,20 @@ class CProgressBar public: - CProgressBar(const bool blinkenlights = PB_COLORED, + /* parameters: + blinkenligts: true if you want colored progressbars. needed, no default. + w, h: width / height of bar. Can later be set with paintProgressbar. + paintProgressBar2 can oly be used if w and h are set. + r, g, b: percentage of the bar where red/green/yellow is used. + only used if blinkenlights == true. + inv: false => red on the left side, true: red on right side. */ + CProgressBar(const bool blinkenlights, + const int w = -1, + const int h = -1, const int r = 40, const int g = 100, - const int b =70, const bool inv = false); - CProgressBar(const int w, const int h, - const bool blinkenlights = PB_COLORED, - const int r = 40, - const int g = 100, - const int b =70, const bool inv = false); + const int b =70, + const bool inv = false); ~CProgressBar(); /// void paintProgressBar(...) @@ -93,8 +93,6 @@ class CProgressBar iconfile > optional, name of iconfile paintZero > optional, if set to true and value = 0, then paints a diagonal line instead of active bar as symbolic for a zero value */ - - void paintProgressBar ( const int pos_x, const int pos_y, const int pb_width, diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 5de913bb8..a9b92246d 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1860,6 +1860,7 @@ printf("CNeutrinoApp::SetChannelMode %d\n", newmode); extern int cnxt_debug; extern int sections_debug; extern int zapit_debug; +bool pb_blink; /* TODO: get rid of global external variable for this */ void CNeutrinoApp::CmdParser(int argc, char **argv) { @@ -1868,6 +1869,7 @@ void CNeutrinoApp::CmdParser(int argc, char **argv) global_argv[i] = argv[i]; global_argv[argc] = NULL; + pb_blink = true; softupdate = false; fromflash = false; @@ -1906,8 +1908,13 @@ void CNeutrinoApp::CmdParser(int argc, char **argv) xres = atoi(argv[x++]); if (x < argc) yres = atoi(argv[x++]); + } + else if (!strcmp(argv[x], "-noblink")) { + pb_blink = false; + x++; } else { - dprintf(DEBUG_NORMAL, "Usage: neutrino [-u | --enable-update] [-f | --enable-flash] [-v | --verbose 0..3]\n"); + dprintf(DEBUG_NORMAL, "Usage: neutrino [-u | --enable-update] [-f | --enable-flash] " + "[-v | --verbose 0..3] [-noblink]\n"); exit(1); } } @@ -2376,7 +2383,7 @@ int CNeutrinoApp::run(int argc, char **argv) g_EpgData = new CEpgData; g_InfoViewer = new CInfoViewer; g_EventList = new EventList; - g_volscale = new CProgressBar(200, 15, PB_COLORED, 50, 100, 80, true); + g_volscale = new CProgressBar(pb_blink, 200, 15, 50, 100, 80, true); g_CamHandler = new CCAMMenuHandler(); g_CamHandler->init();