mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Fixed a problem in DisplayTimerConflict
This commit is contained in:
parent
9044e092f8
commit
874f5cd9d5
@ -130,7 +130,7 @@ cTimer *cRecManager::createLocalTimer(const cEvent *event, std::string path) {
|
|||||||
isyslog("timer %s added (active)", *timer->ToDescr());
|
isyslog("timer %s added (active)", *timer->ToDescr());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return timer;
|
return timers->GetTimer(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
cTimer *cRecManager::createRemoteTimer(const cEvent *event, std::string path) {
|
cTimer *cRecManager::createRemoteTimer(const cEvent *event, std::string path) {
|
||||||
|
@ -589,10 +589,14 @@ void cRecMenu::UpdateActiveMenuItem(void) {
|
|||||||
|
|
||||||
|
|
||||||
void cRecMenu::DrawScrollBar(void) {
|
void cRecMenu::DrawScrollBar(void) {
|
||||||
|
if (!pixmapScrollBar)
|
||||||
|
return;
|
||||||
pixmapScrollBar->Fill(theme.Color(clrBorder));
|
pixmapScrollBar->Fill(theme.Color(clrBorder));
|
||||||
pixmapScrollBar->DrawRectangle(cRect(2,2,pixmapScrollBar->ViewPort().Width()-4, pixmapScrollBar->ViewPort().Height() - 4), theme.Color(clrBackground));
|
pixmapScrollBar->DrawRectangle(cRect(2,2,pixmapScrollBar->ViewPort().Width()-4, pixmapScrollBar->ViewPort().Height() - 4), theme.Color(clrBackground));
|
||||||
|
|
||||||
int totalNumItems = GetTotalNumMenuItems();
|
int totalNumItems = GetTotalNumMenuItems();
|
||||||
|
if (!totalNumItems)
|
||||||
|
return;
|
||||||
if (imgScrollBar == NULL) {
|
if (imgScrollBar == NULL) {
|
||||||
int scrollBarImgHeight = (pixmapScrollBar->ViewPort().Height() - 8) * numItems / totalNumItems;
|
int scrollBarImgHeight = (pixmapScrollBar->ViewPort().Height() - 8) * numItems / totalNumItems;
|
||||||
imgScrollBar = createScrollbar(pixmapScrollBar->ViewPort().Width()-8, scrollBarImgHeight, theme.Color(clrHighlight), theme.Color(clrHighlightBlending));
|
imgScrollBar = createScrollbar(pixmapScrollBar->ViewPort().Width()-8, scrollBarImgHeight, theme.Color(clrHighlight), theme.Color(clrHighlightBlending));
|
||||||
|
@ -1548,6 +1548,7 @@ cRecMenuItemTimer::cRecMenuItemTimer(const cTimer *timer,
|
|||||||
this->overlapStop = overlapStop;
|
this->overlapStop = overlapStop;
|
||||||
this->active = active;
|
this->active = active;
|
||||||
height = 3 * font->Height();
|
height = 3 * font->Height();
|
||||||
|
pixmapStatus = NULL;
|
||||||
pixmapIcons = NULL;
|
pixmapIcons = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1585,6 +1586,8 @@ void cRecMenuItemTimer::Show(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cRecMenuItemTimer::Draw(void) {
|
void cRecMenuItemTimer::Draw(void) {
|
||||||
|
if (!timer)
|
||||||
|
return;
|
||||||
const cChannel *channel = timer->Channel();
|
const cChannel *channel = timer->Channel();
|
||||||
int channelTransponder = 0;
|
int channelTransponder = 0;
|
||||||
cString channelName = "";
|
cString channelName = "";
|
||||||
@ -1740,8 +1743,13 @@ cRecMenuItemTimerConflictHeader::~cRecMenuItemTimerConflictHeader(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cRecMenuItemTimerConflictHeader::SetPixmaps(void) {
|
void cRecMenuItemTimerConflictHeader::SetPixmaps(void) {
|
||||||
pixmap = osdManager.requestPixmap(4, cRect(x, y, width, height));
|
if (!pixmap) {
|
||||||
pixmapStatus = osdManager.requestPixmap(5, cRect(x, y, width, height));
|
pixmap = osdManager.requestPixmap(4, cRect(x, y, width, height));
|
||||||
|
pixmapStatus = osdManager.requestPixmap(5, cRect(x, y, width, height));
|
||||||
|
} else {
|
||||||
|
pixmap->SetViewPort(cRect(x, y, width, height));
|
||||||
|
pixmapStatus->SetViewPort(cRect(x, y, width, height));
|
||||||
|
}
|
||||||
pixmapStatus->Fill(clrTransparent);
|
pixmapStatus->Fill(clrTransparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
recmenus.c
11
recmenus.c
@ -194,8 +194,9 @@ cRecMenuAskDeleteTimer::cRecMenuAskDeleteTimer(const cEvent *event) {
|
|||||||
|
|
||||||
// --- cRecMenuTimerConflicts ---------------------------------------------------------
|
// --- cRecMenuTimerConflicts ---------------------------------------------------------
|
||||||
cRecMenuTimerConflicts::cRecMenuTimerConflicts(cTVGuideTimerConflicts *conflicts) {
|
cRecMenuTimerConflicts::cRecMenuTimerConflicts(cTVGuideTimerConflicts *conflicts) {
|
||||||
int numConflicts = conflicts->NumConflicts();
|
SetWidthPercent(50);
|
||||||
|
|
||||||
|
int numConflicts = (conflicts) ? conflicts->NumConflicts() : 0;
|
||||||
cString text;
|
cString text;
|
||||||
if (numConflicts == 1) {
|
if (numConflicts == 1) {
|
||||||
text = cString::sprintf("%s %s %s", tr("One"), tr("Timer Conflict"), tr("detected"));
|
text = cString::sprintf("%s %s %s", tr("One"), tr("Timer Conflict"), tr("detected"));
|
||||||
@ -233,6 +234,8 @@ int cRecMenuTimerConflicts::GetTimerConflict(void) {
|
|||||||
cRecMenuTimerConflict::cRecMenuTimerConflict(cTVGuideTimerConflict *conflict) {
|
cRecMenuTimerConflict::cRecMenuTimerConflict(cTVGuideTimerConflict *conflict) {
|
||||||
SetWidthPercent(95);
|
SetWidthPercent(95);
|
||||||
this->conflict = conflict;
|
this->conflict = conflict;
|
||||||
|
totalNumMenuItems = (int)conflict->timerIDs.size();
|
||||||
|
|
||||||
SetHeader(new cRecMenuItemTimerConflictHeader(conflict->timeStart,
|
SetHeader(new cRecMenuItemTimerConflictHeader(conflict->timeStart,
|
||||||
conflict->timeStop,
|
conflict->timeStop,
|
||||||
conflict->overlapStart,
|
conflict->overlapStart,
|
||||||
@ -242,7 +245,7 @@ cRecMenuTimerConflict::cRecMenuTimerConflict(cTVGuideTimerConflict *conflict) {
|
|||||||
for(std::vector<int>::iterator it = conflict->timerIDs.begin(); it != conflict->timerIDs.end(); it++) {
|
for(std::vector<int>::iterator it = conflict->timerIDs.begin(); it != conflict->timerIDs.end(); it++) {
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
LOCK_TIMERS_READ;
|
LOCK_TIMERS_READ;
|
||||||
const cTimer *timer = Timers->Get(*it);
|
const cTimer *timer = Timers->GetById(*it + 1);
|
||||||
#else
|
#else
|
||||||
const cTimer *timer = Timers.Get(*it);
|
const cTimer *timer = Timers.Get(*it);
|
||||||
#endif
|
#endif
|
||||||
@ -268,7 +271,7 @@ cRecMenuTimerConflict::cRecMenuTimerConflict(cTVGuideTimerConflict *conflict) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cRecMenuItem *cRecMenuTimerConflict::GetMenuItem(int number) {
|
cRecMenuItem *cRecMenuTimerConflict::GetMenuItem(int number) {
|
||||||
if ((number >= 0) && (number < (int)conflict->timerIDs.size())) {
|
if ((number >= 0) && (number < totalNumMenuItems)) {
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
LOCK_TIMERS_READ;
|
LOCK_TIMERS_READ;
|
||||||
const cTimer *timer = Timers->Get(conflict->timerIDs[number]);
|
const cTimer *timer = Timers->Get(conflict->timerIDs[number]);
|
||||||
@ -291,7 +294,7 @@ cRecMenuItem *cRecMenuTimerConflict::GetMenuItem(int number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int cRecMenuTimerConflict::GetTotalNumMenuItems(void) {
|
int cRecMenuTimerConflict::GetTotalNumMenuItems(void) {
|
||||||
return conflict->timerIDs.size();
|
return totalNumMenuItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cRecMenuTimerConflict::GetTimerConflictIndex(void) {
|
int cRecMenuTimerConflict::GetTimerConflictIndex(void) {
|
||||||
|
@ -77,11 +77,12 @@ public:
|
|||||||
class cRecMenuTimerConflict: public cRecMenu {
|
class cRecMenuTimerConflict: public cRecMenu {
|
||||||
private:
|
private:
|
||||||
cTVGuideTimerConflict *conflict;
|
cTVGuideTimerConflict *conflict;
|
||||||
|
int totalNumMenuItems;
|
||||||
public:
|
public:
|
||||||
cRecMenuTimerConflict(cTVGuideTimerConflict *conflict);
|
cRecMenuTimerConflict(cTVGuideTimerConflict *conflict);
|
||||||
|
virtual ~cRecMenuTimerConflict(void) {};
|
||||||
cRecMenuItem *GetMenuItem(int number);
|
cRecMenuItem *GetMenuItem(int number);
|
||||||
int GetTotalNumMenuItems(void);
|
int GetTotalNumMenuItems(void);
|
||||||
virtual ~cRecMenuTimerConflict(void) {};
|
|
||||||
int GetTimerConflictIndex(void);
|
int GetTimerConflictIndex(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,7 +93,6 @@ void cRecMenuView::DisplaySearchTimerList(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cRecMenuView::DisplayTimerConflict(const cTimer *timer) {
|
bool cRecMenuView::DisplayTimerConflict(const cTimer *timer) {
|
||||||
int timerID = 0;
|
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
LOCK_TIMERS_READ;
|
LOCK_TIMERS_READ;
|
||||||
for (const cTimer *t = Timers->First(); t; t = Timers->Next(t)) {
|
for (const cTimer *t = Timers->First(); t; t = Timers->Next(t)) {
|
||||||
@ -101,8 +100,7 @@ bool cRecMenuView::DisplayTimerConflict(const cTimer *timer) {
|
|||||||
for (const cTimer *t = Timers.First(); t; t = Timers.Next(t)) {
|
for (const cTimer *t = Timers.First(); t; t = Timers.Next(t)) {
|
||||||
#endif
|
#endif
|
||||||
if (t == timer)
|
if (t == timer)
|
||||||
return DisplayTimerConflict(timerID);
|
return DisplayTimerConflict(timer->Id() - 1);
|
||||||
timerID++;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -229,10 +227,10 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
|
|||||||
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
||||||
timerIndex = menu->GetTimerConflictIndex();
|
timerIndex = menu->GetTimerConflictIndex();
|
||||||
} else break;
|
} else break;
|
||||||
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex);
|
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex) + 1;
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
LOCK_TIMERS_READ;
|
LOCK_TIMERS_READ;
|
||||||
const cTimer *t = Timers->Get(timerID);
|
const cTimer *t = Timers->GetById(timerID);
|
||||||
#else
|
#else
|
||||||
const cTimer *t = Timers.Get(timerID);
|
const cTimer *t = Timers.Get(timerID);
|
||||||
#endif
|
#endif
|
||||||
@ -250,7 +248,7 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
|
|||||||
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
||||||
timerIndex = menu->GetTimerConflictIndex();
|
timerIndex = menu->GetTimerConflictIndex();
|
||||||
} else break;
|
} else break;
|
||||||
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex);
|
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex) + 1;
|
||||||
const cTimers* timers;
|
const cTimers* timers;
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
{
|
{
|
||||||
@ -260,10 +258,11 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
|
|||||||
#else
|
#else
|
||||||
timers = &Timers;
|
timers = &Timers;
|
||||||
#endif
|
#endif
|
||||||
recManager->DeleteTimer(timers->Get(timerID)->Event());
|
const cEvent *event = timers->GetById(timerID)->Event();
|
||||||
|
recManager->DeleteTimer(event); // (timerID);
|
||||||
delete activeMenu;
|
delete activeMenu;
|
||||||
if (!DisplayTimerConflict(timerID)) {
|
if (!DisplayTimerConflict(timerID)) {
|
||||||
activeMenu = new cRecMenuConfirmTimer(timers->Get(timerID)->Event());
|
activeMenu = new cRecMenuConfirmDeleteTimer(event);
|
||||||
activeMenu->Display();
|
activeMenu->Display();
|
||||||
}
|
}
|
||||||
break; }
|
break; }
|
||||||
@ -274,10 +273,10 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
|
|||||||
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
||||||
timerIndex = menu->GetTimerConflictIndex();
|
timerIndex = menu->GetTimerConflictIndex();
|
||||||
} else break;
|
} else break;
|
||||||
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex);
|
int timerID = timerConflicts->GetCurrentConflictTimerID(timerIndex) + 1;
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
LOCK_TIMERS_READ;
|
LOCK_TIMERS_READ;
|
||||||
const cTimer *timer = Timers->Get(timerID);
|
const cTimer *timer = Timers->GetById(timerID);
|
||||||
#else
|
#else
|
||||||
const cTimer *timer = Timers.Get(timerID);
|
const cTimer *timer = Timers.Get(timerID);
|
||||||
#endif
|
#endif
|
||||||
@ -660,10 +659,10 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) {
|
|||||||
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
if (cRecMenuTimerConflict *menu = dynamic_cast<cRecMenuTimerConflict*>(activeMenu)) {
|
||||||
timerConflict = menu->GetTimerConflictIndex();
|
timerConflict = menu->GetTimerConflictIndex();
|
||||||
} else break;
|
} else break;
|
||||||
int timerID = timerConflicts->GetCurrentConflictTimerID(timerConflict);
|
int timerID = timerConflicts->GetCurrentConflictTimerID(timerConflict) + 1;
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
LOCK_TIMERS_READ;
|
LOCK_TIMERS_READ;
|
||||||
const cTimer *timer = Timers->Get(timerID);
|
const cTimer *timer = Timers->GetById(timerID);
|
||||||
#else
|
#else
|
||||||
cTimer *timer = Timers.Get(timerID);
|
cTimer *timer = Timers.Get(timerID);
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,12 +16,11 @@ cTVGuideTimerConflict::cTVGuideTimerConflict(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cTVGuideTimerConflict::~cTVGuideTimerConflict(void) {
|
cTVGuideTimerConflict::~cTVGuideTimerConflict(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cTVGuideTimerConflict::timerInvolved(int involvedID) {
|
bool cTVGuideTimerConflict::timerInvolved(int involvedID) {
|
||||||
int numConflicts = timerIDs.size();
|
int numConflicts = timerIDs.size();
|
||||||
for (int i=0; i<numConflicts; i++) {
|
for (int i = 0; i < numConflicts; i++) {
|
||||||
if (timerIDs[i] == involvedID)
|
if (timerIDs[i] == involvedID)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -44,13 +43,12 @@ cTVGuideTimerConflicts::~cTVGuideTimerConflicts(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cTVGuideTimerConflicts::AddConflict(std::string epgSearchConflictLine) {
|
void cTVGuideTimerConflicts::AddConflict(std::string epgSearchConflictLine) {
|
||||||
/* TIMERCONFLICT FORMAT:
|
/* TIMERCONFLICT FORMAT:
|
||||||
The result list looks like this for example when we have 2 timer conflicts at one time:
|
The result list looks like this for example when we have 2 timer conflicts at one time:
|
||||||
1190232780:152|30|50#152#45:45|10|50#152#45
|
1190232780:152|30|50#152#45:45|10|50#152#45
|
||||||
'1190232780' is the time of the conflict in seconds since 1970-01-01.
|
'1190232780' is the time of the conflict in seconds since 1970-01-01.
|
||||||
It's followed by list of timers that have a conflict at this time:
|
It's followed by list of timers that have a conflict at this time:
|
||||||
'152|30|50#1 int editTimer(cTimer *timer, bool active, int prio, int start, int stop);
|
'152|30|50#152#45' is the description of the first conflicting timer. Here:
|
||||||
52#45' is the description of the first conflicting timer. Here:
|
|
||||||
'152' is VDR's timer id of this timer as returned from VDR's LSTT command
|
'152' is VDR's timer id of this timer as returned from VDR's LSTT command
|
||||||
'30' is the percentage of recording that would be done (0...100)
|
'30' is the percentage of recording that would be done (0...100)
|
||||||
'50#152#45' is the list of concurrent timers at this conflict
|
'50#152#45' is the list of concurrent timers at this conflict
|
||||||
@ -90,7 +88,7 @@ void cTVGuideTimerConflicts::CalculateConflicts(void) {
|
|||||||
const cTimers* timers = &Timers;
|
const cTimers* timers = &Timers;
|
||||||
#endif
|
#endif
|
||||||
for (int j=0; j < numTimers; j++) {
|
for (int j=0; j < numTimers; j++) {
|
||||||
const cTimer *timer = timers->Get(conflicts[i]->timerIDs[j]);
|
const cTimer *timer = timers->GetById(conflicts[i]->timerIDs[j] + 1);
|
||||||
if (timer) {
|
if (timer) {
|
||||||
if (!unionSet) {
|
if (!unionSet) {
|
||||||
unionSet = new cTimeInterval(timer->StartTime(), timer->StopTime());
|
unionSet = new cTimeInterval(timer->StartTime(), timer->StopTime());
|
||||||
@ -109,7 +107,7 @@ void cTVGuideTimerConflicts::CalculateConflicts(void) {
|
|||||||
|
|
||||||
cTimeInterval *intersect = NULL;
|
cTimeInterval *intersect = NULL;
|
||||||
for (int j=0; j < numTimers; j++) {
|
for (int j=0; j < numTimers; j++) {
|
||||||
const cTimer *timer = timers->Get(conflicts[i]->timerIDs[j]);
|
const cTimer *timer = timers->GetById(conflicts[i]->timerIDs[j] + 1);
|
||||||
if (timer) {
|
if (timer) {
|
||||||
if (!intersect) {
|
if (!intersect) {
|
||||||
intersect = new cTimeInterval(timer->StartTime(), timer->StopTime());
|
intersect = new cTimeInterval(timer->StartTime(), timer->StopTime());
|
||||||
@ -152,7 +150,7 @@ int cTVGuideTimerConflicts::GetCurrentConflictTimerID(int timerIndex) {
|
|||||||
int cTVGuideTimerConflicts::GetCorrespondingConflict(int timerID) {
|
int cTVGuideTimerConflicts::GetCorrespondingConflict(int timerID) {
|
||||||
int conflictIndex = -1;
|
int conflictIndex = -1;
|
||||||
if (numConflicts > 0) {
|
if (numConflicts > 0) {
|
||||||
for (int i=0; i<numConflicts; i++) {
|
for (int i = 0; i < numConflicts; i++) {
|
||||||
if (conflicts[i]->timerInvolved(timerID)) {
|
if (conflicts[i]->timerInvolved(timerID)) {
|
||||||
conflictIndex = i;
|
conflictIndex = i;
|
||||||
break;
|
break;
|
||||||
@ -172,7 +170,7 @@ cTVGuideTimerConflict *cTVGuideTimerConflicts::GetConflict(int conflictIndex) {
|
|||||||
|
|
||||||
std::vector<cTVGuideTimerConflict*> cTVGuideTimerConflicts::GetConflictsBetween(time_t start, time_t stop) {
|
std::vector<cTVGuideTimerConflict*> cTVGuideTimerConflicts::GetConflictsBetween(time_t start, time_t stop) {
|
||||||
std::vector<cTVGuideTimerConflict*> conflictsFound;
|
std::vector<cTVGuideTimerConflict*> conflictsFound;
|
||||||
for (int i=0; i < numConflicts; i++) {
|
for (int i = 0; i < numConflicts; i++) {
|
||||||
if ((conflicts[i]->timeStart > start) && (conflicts[i]->timeStart < stop)||
|
if ((conflicts[i]->timeStart > start) && (conflicts[i]->timeStart < stop)||
|
||||||
(conflicts[i]->timeStop > start) && (conflicts[i]->timeStop < stop))
|
(conflicts[i]->timeStop > start) && (conflicts[i]->timeStop < stop))
|
||||||
conflictsFound.push_back(conflicts[i]);
|
conflictsFound.push_back(conflicts[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user