diff options
author | louis <louis.braun@gmx.de> | 2013-02-15 17:25:39 +0100 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2013-02-15 17:25:39 +0100 |
commit | b1780705c88cbaa8a07f8426a8b37de1a225a58f (patch) | |
tree | aacc29632eef19ef028438556ddd078e29d8ed0e | |
parent | 0c453b24c61063c43bec999359723a429fd6011b (diff) | |
download | skin-nopacity-b1780705c88cbaa8a07f8426a8b37de1a225a58f.tar.gz skin-nopacity-b1780705c88cbaa8a07f8426a8b37de1a225a58f.tar.bz2 |
Added remotetimers support for displaying timers in main menu
-rw-r--r-- | displaymenu.c | 24 | ||||
-rw-r--r-- | timers.c | 11 |
2 files changed, 35 insertions, 0 deletions
diff --git a/displaymenu.c b/displaymenu.c index 2d2bbbc..dc06c62 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -1,3 +1,10 @@ +#include "services/remotetimers.h" +namespace PluginRemoteTimers { + static int CompareTimers(const void *a, const void *b) { + return (*(const cTimer **)a)->Compare(**(const cTimer **)b); + } +} + #include "displaymenu.h" #include <string> @@ -88,8 +95,25 @@ void cNopacityDisplayMenu::DrawTimers(bool timersChanged, int numConflicts) { int maxTimersHeight = menuView->GetTimersMaxHeight(); if (initial || ((menuCategoryLast!=mcMain)&&(MenuCategory()==mcMain)&&!timersDrawn)) { if (timersChanged) { + //check if remotetimers plugin is available + static cPlugin* pRemoteTimers = cPluginManager::CallFirstService("RemoteTimers::RefreshTimers-v1.0", NULL); + bool drawRemoteTimers = false; + cString errorMsg; + if (pRemoteTimers) { + drawRemoteTimers = pRemoteTimers->Service("RemoteTimers::RefreshTimers-v1.0", &errorMsg); + } timers.Clear(); cSortedTimers SortedTimers; + //if remotetimers plugin is available, take timers also from him + if (drawRemoteTimers) { + cTimer* remoteTimer = NULL; + int numRemoteTimers = 0; + while (pRemoteTimers->Service("RemoteTimers::ForEach-v1.0", &remoteTimer) && remoteTimer != NULL) { + SortedTimers.Append(remoteTimer); + numRemoteTimers++; + } + SortedTimers.Sort(PluginRemoteTimers::CompareTimers); + } int numTimers = SortedTimers.Size(); int currentHeight = menuView->GetTimersInitHeight(); if (numConflicts > 0) { @@ -65,6 +65,17 @@ void cNopacityTimer::CreateShowName(void) { cString title("");
if (Event) {
title = Event->Title();
+ } else {
+ const char *File = Setup.FoldersInTimerMenu ? NULL : strrchr(timer->File(), FOLDERDELIMCHAR);
+ if (File && strcmp(File + 1, TIMERMACRO_TITLE) && strcmp(File + 1, TIMERMACRO_EPISODE))
+ File++;
+ else
+ File = timer->File();
+ title = File;
+ std::string name(title);
+ size_t index = name.find_last_of(FOLDERDELIMCHAR);
+ if (index != std::string::npos)
+ title = File + index + 1;
}
showName.Set(*title, font, width-10);
}
|