From 2a58ea17389c0a6024cd0ff7697e96dffbc0990e Mon Sep 17 00:00:00 2001 From: Martin Schirrmacher Date: Thu, 16 Oct 2014 20:53:56 +0200 Subject: add options to show channel, timer and recording count in title --- HISTORY | 5 +++- baserender.c | 23 ++++++++++++++++++ baserender.h | 3 +++ config.c | 7 ++++++ config.h | 4 ++++ displaymenu.c | 39 +++++++++++++++++++++++++++---- icons/default/menuIcons/RecsSortDate.png | Bin 4665 -> 3010 bytes icons/default/menuIcons/RecsSortName.png | Bin 3242 -> 2664 bytes po/de_DE.po | 11 ++++++++- setup.c | 13 +++++++++++ 10 files changed, 98 insertions(+), 7 deletions(-) diff --git a/HISTORY b/HISTORY index 5e91e52b..9358e468 100644 --- a/HISTORY +++ b/HISTORY @@ -3,7 +3,10 @@ VDR Plugin 'skinflatplus' Revision History 2014-XX-XX: Version 0.4.3 - [add] option to draw the menu background over the entire height -- [add] sort icons in recordings menu +- [add] sort icon in recordings menu +- [add] options to show the number of recordings in title in recording menu +- [add] options to show the number of timers in title in timer menu +- [add] options to show the number of channels in title in channel menu 2014-08-10: Version 0.4.2 - [update] change direcotry of config-files diff --git a/baserender.c b/baserender.c index de05ee41..a622f309 100644 --- a/baserender.c +++ b/baserender.c @@ -22,7 +22,10 @@ cFlatBaseRender::cFlatBaseRender(void) { topBarUpdateTitle = false; topBarHeight = 0; topBarExtraIconSet = false; + topBarMenuIcon = ""; topBarMenuIconSet = false; + topBarMenuIconRight = ""; + topBarMenuIconRightSet = false; topBarMenuLogo = ""; topBarMenuLogoSet = false; @@ -140,6 +143,8 @@ void cFlatBaseRender::TopBarSetTitle(cString title) { tobBarTitleExtra2 = ""; topBarExtraIcon = ""; topBarMenuIcon = ""; + topBarMenuIconRight = ""; + topBarMenuIconRightSet = false; topBarUpdateTitle = true; topBarExtraIconSet = false; topBarMenuIconSet = false; @@ -171,6 +176,14 @@ void cFlatBaseRender::TopBarSetMenuIcon(cString icon) { topBarUpdateTitle = true; } +void cFlatBaseRender::TopBarSetMenuIconRight(cString icon) { + if( !strcmp(*icon, "") ) + return; + topBarMenuIconRight = icon; + topBarMenuIconRightSet = true; + topBarUpdateTitle = true; +} + void cFlatBaseRender::TopBarSetMenuLogo(cString icon) { if( !strcmp(*icon, "") ) return; @@ -429,6 +442,16 @@ void cFlatBaseRender::TopBarUpdate(void) { Right += topBarFontSml->Width(*ConNum) + marginItem; } + if( topBarMenuIconRightSet ) { + cImage *img = imgLoader.LoadIcon(*topBarMenuIconRight, 999, topBarHeight - marginItem*2); + if( img ) { + titleMaxWidth -= img->Width()+marginItem*2; + int IconLeft = titleLeft + topBarFont->Width(topBarTitle) + marginItem; + int iconTop = (topBarHeight / 2 - img->Height()/2); + topBarIconPixmap->DrawImage(cPoint(IconLeft, iconTop), *img); + } + } + topBarPixmap->DrawText(cPoint(titleLeft, fontTop), topBarTitle, Theme.Color(clrTopBarFont), Theme.Color(clrTopBarBg), topBarFont, titleMaxWidth); DecorBorderDraw(Config.decorBorderTopBarSize, Config.decorBorderTopBarSize, osdWidth - Config.decorBorderTopBarSize*2, topBarHeight, Config.decorBorderTopBarSize, Config.decorBorderTopBarType, Config.decorBorderTopBarFg, Config.decorBorderTopBarBg); diff --git a/baserender.h b/baserender.h index 1d4eab4f..81fc913d 100644 --- a/baserender.h +++ b/baserender.h @@ -51,6 +51,8 @@ class cFlatBaseRender bool topBarExtraIconSet; cString topBarMenuIcon; bool topBarMenuIconSet; + cString topBarMenuIconRight; + bool topBarMenuIconRightSet; cString topBarMenuLogo; bool topBarMenuLogoSet; @@ -140,6 +142,7 @@ class cFlatBaseRender void TopBarSetTitle(cString title); void TopBarSetTitleExtra(cString extra1, cString extra2); void TopBarSetMenuIcon(cString icon); + void TopBarSetMenuIconRight(cString icon); void TopBarSetMenuLogo(cString icon); void TopBarSetExtraIcon(cString icon); void TopBarUpdate(void); diff --git a/config.c b/config.c index 68aac22e..cf5d0340 100644 --- a/config.c +++ b/config.c @@ -59,6 +59,10 @@ cFlatConfig::cFlatConfig(void) { MenuEventView = 1; MenuRecordingView = 1; + MenuRecordingShowCount = 1; + MenuTimerShowCount = 1; + MenuChannelShowCount = 1; + MenuFullOsd = 0; MenuItemRecordingClearPercent = 1; @@ -264,6 +268,9 @@ bool cFlatConfig::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "TopBarHideClockText") == 0) TopBarHideClockText = atoi(Value); else if (strcmp(Name, "ChannelTimeLeft") == 0) ChannelTimeLeft = atoi(Value); else if (strcmp(Name, "MenuFullOsd") == 0) MenuFullOsd = atoi(Value); + else if (strcmp(Name, "MenuRecordingShowCount") == 0) MenuRecordingShowCount = atoi(Value); + else if (strcmp(Name, "MenuTimerShowCount") == 0) MenuTimerShowCount = atoi(Value); + else if (strcmp(Name, "MenuChannelShowCount") == 0) MenuChannelShowCount = atoi(Value); else return false; diff --git a/config.h b/config.h index 9732214c..593d6c9e 100644 --- a/config.h +++ b/config.h @@ -223,6 +223,10 @@ class cFlatConfig int MenuRecordingView; int MenuFullOsd; + int MenuRecordingShowCount; + int MenuTimerShowCount; + int MenuChannelShowCount; + // 0 = vertikal // 1 = horizontal int MessageColorPosition; diff --git a/displaymenu.c b/displaymenu.c index 7ffd12b0..54d09121 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -216,7 +216,7 @@ void cFlatDisplayMenu::SetTitle(const char *Title) { TopBarSetTitle(Title); if( Config.TopBarMenuIconShow ) { - cString icon; + cString icon = ""; switch( menuCategory ) { case mcMain: TopBarSetTitle(""); @@ -229,17 +229,46 @@ void cFlatDisplayMenu::SetTitle(const char *Title) { break; case mcChannel: icon = "menuIcons/Channels"; + if( Config.MenuChannelShowCount ) { + int chanCount = 0; + for(cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) { + if( !Channel->GroupSep() ) + chanCount++; + } + cString newTitle = cString::sprintf("%s (%d)", Title, chanCount); + TopBarSetTitle(*newTitle); + } break; case mcTimer: icon = "menuIcons/Timers"; + if( Config.MenuTimerShowCount ) { + int timerCount = 0, timerRecCount = 0; + for(cTimer *Timer = Timers.First(); Timer; Timer = Timers.Next(Timer)) { + timerCount++; + if( Timer->Recording() ) + timerRecCount++; + } + cString newTitle = cString::sprintf("%s (%d/%d)", Title, timerRecCount, timerCount); + TopBarSetTitle(*newTitle); + } break; case mcRecording: if( RecordingsSortMode == rsmName ) - icon = "menuIcons/RecsSortName"; + TopBarSetMenuIconRight("menuIcons/RecsSortName"); else if( RecordingsSortMode == rsmTime ) - icon = "menuIcons/RecsSortDate"; - else - icon = "menuIcons/Recordings"; + TopBarSetMenuIconRight("menuIcons/RecsSortDate"); + + if( Config.MenuRecordingShowCount ) { + int recCount = 0, recNewCount = 0; + for(cRecording *Rec = Recordings.First(); Rec; Rec = Recordings.Next(Rec)) { + recCount++; + if( Rec->IsNew() ) + recNewCount++; + } + cString newTitle = cString::sprintf("%s (%d*/%d)", Title, recNewCount, recCount); + TopBarSetTitle(*newTitle); + } + icon = "menuIcons/Recordings"; break; case mcSetup: icon = "menuIcons/Setup"; diff --git a/icons/default/menuIcons/RecsSortDate.png b/icons/default/menuIcons/RecsSortDate.png index de718d00..d563cd9d 100644 Binary files a/icons/default/menuIcons/RecsSortDate.png and b/icons/default/menuIcons/RecsSortDate.png differ diff --git a/icons/default/menuIcons/RecsSortName.png b/icons/default/menuIcons/RecsSortName.png index a47eb345..daaf4258 100644 Binary files a/icons/default/menuIcons/RecsSortName.png and b/icons/default/menuIcons/RecsSortName.png differ diff --git a/po/de_DE.po b/po/de_DE.po index 79cd39c6..86b97120 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skinflat 0.4.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-09-26 15:04+0200\n" +"POT-Creation-Date: 2014-10-16 20:16+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -483,6 +483,15 @@ msgstr "Hauptmen msgid "Menu draw background over the entire height" msgstr "Menü zeichne Hintergrund über gesamte Höhe" +msgid "Recording menu show recording count in title" +msgstr "" + +msgid "Timer menu show timer count in title" +msgstr "" + +msgid "Channel menu show channel count in title" +msgstr "" + msgid "Menu channel view" msgstr "Menü Kanal Ansicht" diff --git a/setup.c b/setup.c index ceb5d106..585bf902 100644 --- a/setup.c +++ b/setup.c @@ -270,6 +270,9 @@ void cFlatSetup::Store(void) { SetupStore("TopBarHideClockText", Config.TopBarHideClockText); SetupStore("ChannelTimeLeft", Config.ChannelTimeLeft); SetupStore("MenuFullOsd", Config.MenuFullOsd); + SetupStore("MenuRecordingShowCount", Config.MenuRecordingShowCount); + SetupStore("MenuTimerShowCount", Config.MenuTimerShowCount); + SetupStore("MenuChannelShowCount", Config.MenuChannelShowCount); Config.Init(); } @@ -413,6 +416,9 @@ bool cFlatSetupGeneral::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "TopBarHideClockText") == 0) SetupConfig->TopBarHideClockText = atoi(Value); else if (strcmp(Name, "ChannelTimeLeft") == 0) SetupConfig->ChannelTimeLeft = atoi(Value); else if (strcmp(Name, "MenuFullOsd") == 0) SetupConfig->MenuFullOsd = atoi(Value); + else if (strcmp(Name, "MenuRecordingShowCount") == 0) SetupConfig->MenuRecordingShowCount = atoi(Value); + else if (strcmp(Name, "MenuTimerShowCount") == 0) SetupConfig->MenuTimerShowCount = atoi(Value); + else if (strcmp(Name, "MenuChannelShowCount") == 0) SetupConfig->MenuChannelShowCount = atoi(Value); else return false; return true; @@ -537,6 +543,9 @@ void cFlatSetupGeneral::SaveCurrentSettings(void) { Config.Store("TopBarHideClockText", SetupConfig->TopBarHideClockText, *Filename); Config.Store("ChannelTimeLeft", SetupConfig->ChannelTimeLeft, *Filename); Config.Store("MenuFullOsd", SetupConfig->MenuFullOsd, *Filename); + Config.Store("MenuRecordingShowCount", SetupConfig->MenuRecordingShowCount, *Filename); + Config.Store("MenuTimerShowCount", SetupConfig->MenuTimerShowCount, *Filename); + Config.Store("MenuChannelShowCount", SetupConfig->MenuChannelShowCount, *Filename); cString msg = cString::sprintf("%s %s", tr("saved settings in file:"), *File); Skins.Message(mtInfo, msg); @@ -808,6 +817,10 @@ void cFlatSetupMenu::Setup(void) { Add(new cMenuEditPrcItem(tr("Main menuitem scale"), &SetupConfig->MainMenuItemScale, 0.2, 1, 0)); Add(new cMenuEditBoolItem(tr("Menu draw background over the entire height"), &SetupConfig->MenuFullOsd)); + Add(new cMenuEditBoolItem(tr("Recording menu show recording count in title"), &SetupConfig->MenuRecordingShowCount)); + Add(new cMenuEditBoolItem(tr("Timer menu show timer count in title"), &SetupConfig->MenuTimerShowCount)); + Add(new cMenuEditBoolItem(tr("Channel menu show channel count in title"), &SetupConfig->MenuChannelShowCount)); + Add(new cMenuEditStraItem(tr("Menu channel view"), &SetupConfig->MenuChannelView, MenuChannelViews.Size(), &MenuChannelViews[0])); Add(new cMenuEditStraItem(tr("Menu timer view"), &SetupConfig->MenuTimerView, MenuTimerViews.Size(), &MenuTimerViews[0])); Add(new cMenuEditStraItem(tr("Menu event view"), &SetupConfig->MenuEventView, MenuEventViews.Size(), &MenuEventViews[0])); -- cgit v1.2.3