summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2013-03-15 18:21:15 +0100
committerlouis <louis.braun@gmx.de>2013-03-15 18:21:15 +0100
commitc9a59aca1a7669002aa24de714f4c332c9a46df9 (patch)
tree9ff9bd53d0f9e314c48749646505cfbeafc648ed
parent23cbb493b183ec28bacd9ad2525f33062c129985 (diff)
downloadskin-nopacity-c9a59aca1a7669002aa24de714f4c332c9a46df9.tar.gz
skin-nopacity-c9a59aca1a7669002aa24de714f4c332c9a46df9.tar.bz2
graphical progress bar if default menu item style for schedules is used
-rw-r--r--HISTORY4
-rw-r--r--displaymenu.c2
-rw-r--r--menuitem.c53
-rw-r--r--menuitem.h5
4 files changed, 54 insertions, 10 deletions
diff --git a/HISTORY b/HISTORY
index 4d6a10c..cf39490 100644
--- a/HISTORY
+++ b/HISTORY
@@ -158,3 +158,7 @@ Version 0.1.0:
- Updated README
- Added more plugin icons (thanks @BooStar)
- Added Slovak translation
+
+Version 0.1.1
+- graphical progress bar if default menu item style for schedules is used
+ for epgsearchs What's on now
diff --git a/displaymenu.c b/displaymenu.c
index d4ef064..2b840d6 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -537,7 +537,7 @@ void cNopacityDisplayMenu::SetItem(const char *Text, int Index, bool Current, bo
if (config.useMenuIcons)
hasIcons = true;
} else {
- item = new cNopacityDefaultMenuItem(osd, Text, Selectable);
+ item = new cNopacityDefaultMenuItem(osd, Text, Selectable, MenuCategory());
menuView->GetMenuItemSize(mcUnknown, &itemSize);
item->SetFont(menuView->GetMenuItemFont(mcUnknown));
}
diff --git a/menuitem.c b/menuitem.c
index 73cd660..7baff3e 100644
--- a/menuitem.c
+++ b/menuitem.c
@@ -1052,23 +1052,56 @@ void cNopacityRecordingMenuItem::Render() {
// cNopacityDefaultMenuItem -------------
-cNopacityDefaultMenuItem::cNopacityDefaultMenuItem(cOsd *osd, const char *text, bool sel) : cNopacityMenuItem (osd, text, sel) {
+cNopacityDefaultMenuItem::cNopacityDefaultMenuItem(cOsd *osd, const char *text, bool sel, eMenuCategory menuCat) : cNopacityMenuItem (osd, text, sel) {
scrollCol = -1;
+ this->menuCat = menuCat;
}
cNopacityDefaultMenuItem::~cNopacityDefaultMenuItem(void) {
}
+bool cNopacityDefaultMenuItem::CheckProgressBar(const char *text) {
+ if (strlen(text) > 5 && text[0] == '[' && text[strlen(text) - 1] == ']')
+ return true;
+ return false;
+}
+
+void cNopacityDefaultMenuItem::DrawProgressBar(int x, int width, const char *bar, tColor color) {
+ const char *p = bar + 1;
+ bool isProgressbar = true;
+ int total = 0;
+ int now = 0;
+ for (; *p != ']'; ++p) {
+ if (*p == ' ' || *p == '|') {
+ ++total;
+ if (*p == '|')
+ ++now;
+ } else {
+ isProgressbar = false;
+ break;
+ }
+ }
+ if (isProgressbar) {
+ pixmap->DrawRectangle(cRect(x+5, height/4, width-10, height/2), color);
+ pixmap->DrawRectangle(cRect(x+7, height/4+2, width-14, height/2-4), Theme.Color(clrMenuItemBlend));
+ double progress = (double)now/(double)total;
+ pixmap->DrawRectangle(cRect(x+8, height/4+3, (width-16)*progress, height/2-6), color);
+
+ }
+}
+
void cNopacityDefaultMenuItem::SetTextFull(void) {
tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem);
pixmapTextScroller->Fill(clrTransparent);
- pixmapTextScroller->DrawText(cPoint(5, (height - font->Height()) / 2), strEntryFull.c_str(), clrFont, clrTransparent, font);
+ int x = (scrollCol == 0)?5:0;
+ pixmapTextScroller->DrawText(cPoint(x, (height - font->Height()) / 2), strEntryFull.c_str(), clrFont, clrTransparent, font);
}
void cNopacityDefaultMenuItem::SetTextShort(void) {
tColor clrFont = (current)?Theme.Color(clrMenuFontMenuItemHigh):Theme.Color(clrMenuFontMenuItem);
pixmapTextScroller->Fill(clrTransparent);
- pixmapTextScroller->DrawText(cPoint(5, (height - font->Height()) / 2), strEntry.c_str(), clrFont, clrTransparent, font);
+ int x = (scrollCol == 0)?5:0;
+ pixmapTextScroller->DrawText(cPoint(x, (height - font->Height()) / 2), strEntry.c_str(), clrFont, clrTransparent, font);
}
int cNopacityDefaultMenuItem::CheckScrollable(bool hasIcon) {
@@ -1078,6 +1111,8 @@ int cNopacityDefaultMenuItem::CheckScrollable(bool hasIcon) {
int colTextWidth = 0;
for (int i=0; i<numTabs; i++) {
if (tabWidth[i] > 0) {
+ if ((menuCat == mcScheduleNow)&&(CheckProgressBar(*itemTabs[i])))
+ continue;
colWidth = tabWidth[i+cSkinDisplayMenu::MaxTabs];
colTextWidth = font->Width(*itemTabs[i]);
if (colTextWidth > colWidth) {
@@ -1087,8 +1122,8 @@ int cNopacityDefaultMenuItem::CheckScrollable(bool hasIcon) {
strEntryFull = *itemTabs[i];
itemTextWrapped.Set(*itemTabs[i], font, colWidth - font->Width("... "));
strEntry = cString::sprintf("%s... ", itemTextWrapped.GetLine(0));
+ break;
}
- break;
} else
break;
}
@@ -1113,8 +1148,11 @@ void cNopacityDefaultMenuItem::Render() {
for (int i=0; i<numTabs; i++) {
if (tabWidth[i] > 0) {
if (selectable) {
- if (i != scrollCol) {
- colWidth = tabWidth[i+cSkinDisplayMenu::MaxTabs];
+ colWidth = tabWidth[i+cSkinDisplayMenu::MaxTabs];
+ int posX = tabWidth[i];
+ if ((menuCat == mcScheduleNow)&&(CheckProgressBar(*itemTabs[i]))) {
+ DrawProgressBar(posX, colWidth, *itemTabs[i], clrFont);
+ } else if (i != scrollCol) {
colTextWidth = font->Width(*itemTabs[i]);
if (colTextWidth > colWidth) {
cTextWrapper itemTextWrapped;
@@ -1123,7 +1161,6 @@ void cNopacityDefaultMenuItem::Render() {
} else {
itemText = itemTabs[i];
}
- int posX = tabWidth[i];
if (i==0) posX += 5;
pixmap->DrawText(cPoint(posX, (height - font->Height()) / 2), *itemText, clrFont, clrTransparent, font);
} else {
@@ -1137,7 +1174,7 @@ void cNopacityDefaultMenuItem::Render() {
break;
}
if (!selectable) {
- pixmap->DrawText(cPoint(1, (height - font->Height()) / 2), sstrText.str().c_str(), clrFont, clrTransparent, font);
+ pixmap->DrawText(cPoint(10, (height - font->Height()) / 2), sstrText.str().c_str(), clrFont, clrTransparent, font);
}
if (current && scrollable && !Running() && config.menuScrollSpeed) {
Start();
diff --git a/menuitem.h b/menuitem.h
index 04e467a..374dd8e 100644
--- a/menuitem.h
+++ b/menuitem.h
@@ -174,13 +174,16 @@ public:
class cNopacityDefaultMenuItem : public cNopacityMenuItem {
private:
+ eMenuCategory menuCat;
+ bool CheckProgressBar(const char *text);
+ void DrawProgressBar(int x, int width, const char *bar, tColor color);
std::string strEntry;
std::string strEntryFull;
int scrollCol;
void SetTextFull(void);
void SetTextShort(void);
public:
- cNopacityDefaultMenuItem(cOsd *osd, const char *text, bool sel);
+ cNopacityDefaultMenuItem(cOsd *osd, const char *text, bool sel, eMenuCategory menuCat);
~cNopacityDefaultMenuItem(void);
int CheckScrollable(bool hasIcon);
void Render();