CComponents: add progressbar class to cc-items

CProgressbar moved into components sub directory and adapt includes.
Progressbar objects are now usable as cc-item

TODO:
-some color and size corrections
-found some dub codes for sig and snr-bars, needs rework
This commit is contained in:
2013-04-01 22:01:55 +02:00
parent d391bedd5f
commit 860be9a412
28 changed files with 616 additions and 590 deletions

View File

@@ -48,7 +48,7 @@
#include <gui/widget/hintbox.h>
#include <gui/widget/helpbox.h>
#include <gui/widget/icons.h>
#include <gui/widget/progressbar.h>
#include <gui/components/cc_item_progressbar.h>
#include <gui/widget/messagebox.h>
#include <gui/widget/stringinput.h>
#include <gui/widget/stringinput_ext.h>
@@ -1283,10 +1283,13 @@ void CMovieBrowser::info_hdd_level(bool paint_hdd)
if(tmp_blocks_percent_used != blocks_percent_used || paint_hdd){
tmp_blocks_percent_used = blocks_percent_used;
CProgressBar pb(true, -1, -1, 30, 100, 70, true);
const short pbw = 100;
const short border = m_cBoxFrameTitleRel.iHeight/4;
pb.paintProgressBarDefault(m_cBoxFrame.iX+ m_cBoxFrameFootRel.iWidth - pbw - border, m_cBoxFrame.iY+m_cBoxFrameTitleRel.iY + border, pbw, m_cBoxFrameTitleRel.iHeight/2, blocks_percent_used, 100);
CProgressBar pb(m_cBoxFrame.iX+ m_cBoxFrameFootRel.iWidth - pbw - border, m_cBoxFrame.iY+m_cBoxFrameTitleRel.iY + border, pbw, m_cBoxFrameTitleRel.iHeight/2);
pb.setBlink();
pb.setInvert();
pb.setValues( blocks_percent_used, 100);
pb.paint(false);
}
}
@@ -4006,12 +4009,14 @@ static off64_t cut_movie(MI_MOVIE_INFO * minfo, CMovieInfo * cmovie)
CFrameBuffer * frameBuffer = CFrameBuffer::getInstance();
if (! timescale)
timescale = new CProgressBar(g_settings.progressbar_color, 200, 15, 0, 100, 0);
timescale = new CProgressBar();//new CProgressBar(g_settings.progressbar_color, 200, 15, 0, 100, 0);
timescale->setBlink();
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;
frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0);
timescale->paintProgressBar2(x + 41, y + 12, percent);
frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0);//TODO: remove unneeded box paints
timescale->setProgress(x + 41, y + 12, 200, 15, percent, 200);
timescale->paint();
int len = minfo->length;
off64_t size = minfo->file.Size;
//off64_t secsize = len ? size/len/60 : 511040;
@@ -4131,7 +4136,7 @@ printf("\ncut: reading from %" PRId64 " to %" PRId64 " (%" PRId64 ") want gop %d
}
if(msg) {
timescale->reset();
frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0);
frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0);//TODO: remove unneeded box paints
}
size_t toread = (until-sdone) > BUF_SIZE ? BUF_SIZE : until - sdone;
#if REAL_CUT
@@ -4157,7 +4162,8 @@ if(buf[0] != 0x47) printf("cut: buffer not aligned at %" PRId64 "\n", sdone);
sdone += r;
spos += r - wptr;
percent = (int) ((float)(spos)/(float)(newsize)*100.);
timescale->paintProgressBar2(x + 41, y + 12, percent);
timescale->setProgress(x + 41, y + 12, 200, 15, percent, 200);
timescale->paint();
#if REAL_CUT
int wr = write(dstfd, &buf[wptr], r-wptr);
if(wr < (r-wptr)) {
@@ -4263,12 +4269,14 @@ printf("copy: len %d minute %" PRId64 " second %" PRId64 "\n", len, len ? size/l
CFrameBuffer * frameBuffer = CFrameBuffer::getInstance();
if (! timescale)
timescale = new CProgressBar(true, 200, 15, 0, 100, 0);
timescale = new CProgressBar();//new CProgressBar(g_settings.progressbar_color, 200, 15, 0, 100, 0);
timescale->setBlink();
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;
frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0);
timescale->paintProgressBar2(x + 41, y + 12, percent);
frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0); //TODO: remove unneeded box paints
timescale->setProgress(x + 41, y + 12, 200, 15, percent, 200);
timescale->paint();
newsize = 0;
for(int book_nr = 0; book_nr < MI_MOVIE_BOOK_USER_MAX; book_nr++) {
@@ -4358,7 +4366,7 @@ printf("copy: read from %" PRId64 " to %" PRId64 " read size %d want gop %d\n",
goto ret_err;
}
if(msg) {
frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0);
frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0);//TODO: remove unneeded box paints
timescale->reset();
}
#if REAL_CUT
@@ -4386,7 +4394,8 @@ if(buf[0] != 0x47) printf("copy: buffer not aligned at %" PRId64 "\n", sdone);
spos += r - wptr;
btotal += r;
percent = (int) ((float)(btotal)/(float)(newsize)*100.);
timescale->paintProgressBar2(x + 41, y + 12, percent);
timescale->setProgress(x + 41, y + 12, 200, 15, percent, 200);
timescale->paint();
#if REAL_CUT
int wr = write(dstfd, &buf[wptr], r-wptr);
if(wr < (r-wptr)) {