The status markers in the "Schedule" menu are now only updated if a submenu is closed in which a timer has been modified

This commit is contained in:
Klaus Schmidinger 2006-01-15 13:44:55 +01:00
parent 197b8c27fa
commit cad1a88a7b
5 changed files with 36 additions and 22 deletions

View File

@ -4181,3 +4181,5 @@ Video Disk Recorder Revision History
This can be used to find reruns of a given show, or the episodes of a series.
Note that if there are many channels in your channels.conf, displaying the
"All events on all channels" page may take a while.
- The status markers in the "Schedule" menu are now only updated if a submenu is
closed in which a timer has been modified, which speeds up closing submenus.

28
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.394 2006/01/15 12:46:07 kls Exp $
* $Id: menu.c 1.395 2006/01/15 13:35:05 kls Exp $
*/
#include "menu.h"
@ -1030,6 +1030,7 @@ class cMenuWhatsOn : public cOsdMenu {
private:
bool now;
int helpKeys;
int timerState;
eOSState Record(void);
eOSState Switch(void);
static int currentChannel;
@ -1052,6 +1053,8 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentCha
{
now = Now;
helpKeys = -1;
timerState = 0;
Timers.Modified(timerState);
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
if (!Channel->GroupSep()) {
const cSchedule *Schedule = Schedules->GetSchedule(Channel);
@ -1069,10 +1072,12 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentCha
bool cMenuWhatsOn::Update(void)
{
bool result = false;
for (cOsdItem *item = First(); item; item = Next(item)) {
if (((cMenuScheduleItem *)item)->Update())
result = true;
}
if (Timers.Modified(timerState)) {
for (cOsdItem *item = First(); item; item = Next(item)) {
if (((cMenuScheduleItem *)item)->Update())
result = true;
}
}
return result;
}
@ -1188,6 +1193,7 @@ private:
bool now, next;
int otherChannel;
int helpKeys;
int timerState;
eOSState Number(void);
eOSState Record(void);
eOSState Switch(void);
@ -1209,6 +1215,8 @@ cMenuSchedule::cMenuSchedule(void)
now = next = false;
otherChannel = 0;
helpKeys = -1;
timerState = 0;
Timers.Modified(timerState);
cMenuScheduleItem::SetSortMode(cMenuScheduleItem::ssmAllThis);
cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
if (channel) {
@ -1306,10 +1314,12 @@ void cMenuSchedule::PrepareScheduleAllAll(const cEvent *Event, const cChannel *C
bool cMenuSchedule::Update(void)
{
bool result = false;
for (cOsdItem *item = First(); item; item = Next(item)) {
if (((cMenuScheduleItem *)item)->Update())
result = true;
}
if (Timers.Modified(timerState)) {
for (cOsdItem *item = First(); item; item = Next(item)) {
if (((cMenuScheduleItem *)item)->Update())
result = true;
}
}
return result;
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.c 1.42 2006/01/14 14:56:11 kls Exp $
* $Id: timers.c 1.43 2006/01/15 13:31:11 kls Exp $
*/
#include "timers.h"
@ -515,7 +515,7 @@ cTimers Timers;
cTimers::cTimers(void)
{
modified = false;
state = 0;
beingEdited = 0;;
lastSetEvents = 0;
}
@ -574,13 +574,13 @@ cTimer *cTimers::GetNextActiveTimer(void)
void cTimers::SetModified(void)
{
modified = true;
state++;
}
bool cTimers::Modified(void)
bool cTimers::Modified(int &State)
{
bool Result = modified;
modified = false;
bool Result = state != State;
State = state;
return Result;
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.h 1.23 2006/01/06 14:13:17 kls Exp $
* $Id: timers.h 1.24 2006/01/15 13:29:44 kls Exp $
*/
#ifndef __TIMERS_H
@ -96,7 +96,7 @@ public:
class cTimers : public cConfig<cTimer> {
private:
bool modified;
int state;
int beingEdited;
time_t lastSetEvents;
public:
@ -109,9 +109,10 @@ public:
void IncBeingEdited(void) { beingEdited++; }
void DecBeingEdited(void) { if (!--beingEdited) lastSetEvents = 0; }
void SetModified(void);
bool Modified(void);
///< Returns true if any of the timers have been modified.
///< Calling this function resets the 'modified' flag to false.
bool Modified(int &State);
///< Returns true if any of the timers have been modified, which
///< is detected by State being different than the internal state.
///< Upon return the internal state will be stored in State.
void SetEvents(void);
void DeleteExpired(void);
};

5
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/vdr
*
* $Id: vdr.c 1.237 2006/01/14 10:20:50 kls Exp $
* $Id: vdr.c 1.238 2006/01/15 13:31:57 kls Exp $
*/
#include <getopt.h>
@ -690,9 +690,10 @@ int main(int argc, char *argv[])
if (!Channels.BeingEdited() && !Timers.BeingEdited()) {
int modified = Channels.Modified();
static time_t ChannelSaveTimeout = 0;
static int TimerState = 0;
// Channels and timers need to be stored in a consistent manner,
// therefore if one of them is changed, we save both.
if (modified == CHANNELSMOD_USER || Timers.Modified())
if (modified == CHANNELSMOD_USER || Timers.Modified(TimerState))
ChannelSaveTimeout = 1; // triggers an immediate save
else if (modified && !ChannelSaveTimeout)
ChannelSaveTimeout = time(NULL) + CHANNELSAVEDELTA;