neutrino: add an option to choose the classic progress bar style

add a #define NO_BLINKENLIGHTS in scale.h to choose the classic
progress bar style instead of the colorful blinkenlights.

TODO: make this a configure option.

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@48 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: 143c5948fc
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2009-12-13 (Sun, 13 Dec 2009)



------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2009-12-13 22:23:32 +00:00
parent 9adb82d668
commit 5d3d121adf
2 changed files with 28 additions and 6 deletions

View File

@@ -39,20 +39,22 @@ inline unsigned int make16color(__u32 rgb)
CScale::CScale (int w, int h, int r, int g, int b, bool inv) CScale::CScale (int w, int h, int r, int g, int b, bool inv)
{ {
double div;
//printf("new SCALE, w %d h %d size %d\n", w, h, sizeof(CScale)); fflush(stdout);
frameBuffer = CFrameBuffer::getInstance ();
width = w; width = w;
height = h; height = h;
inverse = inv; inverse = inv;
#ifndef NO_BLINKENLIGHTS
double div;
//printf("new SCALE, w %d h %d size %d\n", w, h, sizeof(CScale)); fflush(stdout);
frameBuffer = CFrameBuffer::getInstance ();
div = (double) 100 / (double) width; div = (double) 100 / (double) width;
red = (double) r / (double) div / (double) ITEMW; red = (double) r / (double) div / (double) ITEMW;
green = (double) g / (double) div / (double) ITEMW; green = (double) g / (double) div / (double) ITEMW;
yellow = (double) b / (double) div / (double) ITEMW; yellow = (double) b / (double) div / (double) ITEMW;
#endif
percent = 255; percent = 255;
} }
#ifndef NO_BLINKENLIGHTS
void CScale::paint (int x, int y, int pcr) void CScale::paint (int x, int y, int pcr)
{ {
int i, j, siglen; int i, j, siglen;
@@ -118,6 +120,15 @@ void CScale::paint (int x, int y, int pcr)
percent = pcr; percent = pcr;
} }
} }
#else
void CScale::paint (int x, int y, int pcr)
{
if (pcr == percent)
return;
percent = pcr;
pb.paintProgressBar(x, y, width, height, pcr * width / 100, width, COL_INFOBAR_PLUS_3, COL_INFOBAR_PLUS_0, COL_INFOBAR_PLUS_3);
}
#endif
void CScale::reset () void CScale::reset ()
{ {

View File

@@ -1,17 +1,28 @@
#ifndef __scale_ #ifndef __scale_
#define __scale_ #define __scale_
/* define this if you do not want colorful blinkenlights
the classical progressbars will be used instead. */
// #define NO_BLINKENLIGHTS
#include <driver/framebuffer.h> #include <driver/framebuffer.h>
#ifdef NO_BLINKENLIGHTS
#include <gui/widget/progressbar.h>
#endif
class CScale class CScale
{ {
private: private:
#ifdef NO_BLINKENLIGHTS
CProgressBar pb;
#else
CFrameBuffer * frameBuffer; CFrameBuffer * frameBuffer;
short red, green, yellow;
#endif
short width; short width;
short height; short height;
char percent; char percent;
short red, green, yellow;
bool inverse; bool inverse;
public: public:
CScale(int w, int h, int r, int g, int b, bool inv = false); CScale(int w, int h, int r, int g, int b, bool inv = false);
void paint(int x, int y, int pcr); void paint(int x, int y, int pcr);