mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Sorting timers in the 'Timers' menu
This commit is contained in:
parent
7092907ccd
commit
6f68910828
3
HISTORY
3
HISTORY
@ -673,3 +673,6 @@ Video Disk Recorder Revision History
|
|||||||
calculation of matching timers has been completely rewritten).
|
calculation of matching timers has been completely rewritten).
|
||||||
- Timers that are currently recording are now marked with '#' in the "Timers"
|
- Timers that are currently recording are now marked with '#' in the "Timers"
|
||||||
menu.
|
menu.
|
||||||
|
- Timers are now sorted in the "Timers" menu, showing the sequence in which
|
||||||
|
they will be recording. This can be disabled in the "Setup" menu. Note
|
||||||
|
that the "Mark" button doesn't work if timers are displayed sorted.
|
||||||
|
17
MANUAL
17
MANUAL
@ -8,7 +8,7 @@ Video Disk Recorder User's Manual
|
|||||||
possible, several keys have different meanings in the various
|
possible, several keys have different meanings in the various
|
||||||
modes:
|
modes:
|
||||||
|
|
||||||
Key Normal Main Channels Timer Edit/New Recordings Replay
|
Key Normal Main Channels Timers Edit/New Recordings Replay
|
||||||
|
|
||||||
Up Ch up Crsr up Crsr up Crsr up Crsr up Crsr up Play
|
Up Ch up Crsr up Crsr up Crsr up Crsr up Crsr up Play
|
||||||
Down Ch down Crsr down Crsr down Crsr down Crsr down Crsr down Pause
|
Down Ch down Crsr down Crsr down Crsr down Crsr down Crsr down Pause
|
||||||
@ -20,9 +20,12 @@ Video Disk Recorder User's Manual
|
|||||||
Red - Record Edit Edit - Play Jump
|
Red - Record Edit Edit - Play Jump
|
||||||
Green - Language New New - Rewind Skip -60s
|
Green - Language New New - Rewind Skip -60s
|
||||||
Yellow - Eject DVD Delete Delete - Delete Skip +60s
|
Yellow - Eject DVD Delete Delete - Delete Skip +60s
|
||||||
Blue - Resume Mark Mark - Summary Stop
|
Blue - Resume Mark Mark(1) - Summary Stop
|
||||||
0..9 Ch select - - - Numeric inp. - Editing
|
0..9 Ch select - - - Numeric inp. - Editing
|
||||||
|
|
||||||
|
(1) The "Mark" button in the "Timers" menu only works if sorting the timers
|
||||||
|
has been disabled in the "Setup" menu.
|
||||||
|
|
||||||
* Navigating through the On Screen Menus
|
* Navigating through the On Screen Menus
|
||||||
|
|
||||||
The "Main" menu can be called up with the "Menu" key of your remote
|
The "Main" menu can be called up with the "Menu" key of your remote
|
||||||
@ -297,6 +300,12 @@ Video Disk Recorder User's Manual
|
|||||||
OSDLanguage = 0 Defines the language used to display the OSD texts.
|
OSDLanguage = 0 Defines the language used to display the OSD texts.
|
||||||
0 = Englisch
|
0 = Englisch
|
||||||
1 = Deutsch
|
1 = Deutsch
|
||||||
|
2 = Slovenian
|
||||||
|
3 = Italian
|
||||||
|
4 = Dutch
|
||||||
|
5 = Portugese
|
||||||
|
6 = French
|
||||||
|
7 = Norwegian
|
||||||
|
|
||||||
PrimaryDVB = 1 Defines the primary DVB interface (i.e. the one that
|
PrimaryDVB = 1 Defines the primary DVB interface (i.e. the one that
|
||||||
will display the menus and will react on input through
|
will display the menus and will react on input through
|
||||||
@ -374,6 +383,10 @@ Video Disk Recorder User's Manual
|
|||||||
connection after which the connection is automatically
|
connection after which the connection is automatically
|
||||||
closed. Default is 300, a value of 0 means no timeout.
|
closed. Default is 300, a value of 0 means no timeout.
|
||||||
|
|
||||||
|
SortTimers = 1 Turns sorting the timers in the "Timers" menu on/off.
|
||||||
|
Timers are sorted by ascending start times, with the
|
||||||
|
first one being the next timer that will start.
|
||||||
|
|
||||||
PrimaryLimit = 0 The minimum priority a timer must have to be allowed to
|
PrimaryLimit = 0 The minimum priority a timer must have to be allowed to
|
||||||
use the primary DVB interface, or to force another timer
|
use the primary DVB interface, or to force another timer
|
||||||
with higher priority to use the primary DVB interface.
|
with higher priority to use the primary DVB interface.
|
||||||
|
12
config.c
12
config.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: config.c 1.57 2001/08/26 11:57:52 kls Exp $
|
* $Id: config.c 1.58 2001/08/26 14:11:29 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -394,6 +394,13 @@ cTimer& cTimer::operator= (const cTimer &Timer)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cTimer::operator< (const cTimer &Timer)
|
||||||
|
{
|
||||||
|
time_t t1 = StartTime();
|
||||||
|
time_t t2 = (*(cTimer *)&Timer).StartTime();
|
||||||
|
return t1 < t2 || (t1 == t2 && priority > Timer.priority);
|
||||||
|
}
|
||||||
|
|
||||||
const char *cTimer::ToText(cTimer *Timer)
|
const char *cTimer::ToText(cTimer *Timer)
|
||||||
{
|
{
|
||||||
delete buffer;
|
delete buffer;
|
||||||
@ -799,6 +806,7 @@ cSetup::cSetup(void)
|
|||||||
EPGScanTimeout = 5;
|
EPGScanTimeout = 5;
|
||||||
EPGBugfixLevel = 2;
|
EPGBugfixLevel = 2;
|
||||||
SVDRPTimeout = 300;
|
SVDRPTimeout = 300;
|
||||||
|
SortTimers = 1;
|
||||||
PrimaryLimit = 0;
|
PrimaryLimit = 0;
|
||||||
DefaultPriority = 50;
|
DefaultPriority = 50;
|
||||||
DefaultLifetime = 50;
|
DefaultLifetime = 50;
|
||||||
@ -831,6 +839,7 @@ bool cSetup::Parse(char *s)
|
|||||||
else if (!strcasecmp(Name, "EPGScanTimeout")) EPGScanTimeout = atoi(Value);
|
else if (!strcasecmp(Name, "EPGScanTimeout")) EPGScanTimeout = atoi(Value);
|
||||||
else if (!strcasecmp(Name, "EPGBugfixLevel")) EPGBugfixLevel = atoi(Value);
|
else if (!strcasecmp(Name, "EPGBugfixLevel")) EPGBugfixLevel = atoi(Value);
|
||||||
else if (!strcasecmp(Name, "SVDRPTimeout")) SVDRPTimeout = atoi(Value);
|
else if (!strcasecmp(Name, "SVDRPTimeout")) SVDRPTimeout = atoi(Value);
|
||||||
|
else if (!strcasecmp(Name, "SortTimers")) SortTimers = atoi(Value);
|
||||||
else if (!strcasecmp(Name, "PrimaryLimit")) PrimaryLimit = atoi(Value);
|
else if (!strcasecmp(Name, "PrimaryLimit")) PrimaryLimit = atoi(Value);
|
||||||
else if (!strcasecmp(Name, "DefaultPriority")) DefaultPriority = atoi(Value);
|
else if (!strcasecmp(Name, "DefaultPriority")) DefaultPriority = atoi(Value);
|
||||||
else if (!strcasecmp(Name, "DefaultLifetime")) DefaultLifetime = atoi(Value);
|
else if (!strcasecmp(Name, "DefaultLifetime")) DefaultLifetime = atoi(Value);
|
||||||
@ -898,6 +907,7 @@ bool cSetup::Save(const char *FileName)
|
|||||||
fprintf(f, "EPGScanTimeout = %d\n", EPGScanTimeout);
|
fprintf(f, "EPGScanTimeout = %d\n", EPGScanTimeout);
|
||||||
fprintf(f, "EPGBugfixLevel = %d\n", EPGBugfixLevel);
|
fprintf(f, "EPGBugfixLevel = %d\n", EPGBugfixLevel);
|
||||||
fprintf(f, "SVDRPTimeout = %d\n", SVDRPTimeout);
|
fprintf(f, "SVDRPTimeout = %d\n", SVDRPTimeout);
|
||||||
|
fprintf(f, "SortTimers = %d\n", SortTimers);
|
||||||
fprintf(f, "PrimaryLimit = %d\n", PrimaryLimit);
|
fprintf(f, "PrimaryLimit = %d\n", PrimaryLimit);
|
||||||
fprintf(f, "DefaultPriority = %d\n", DefaultPriority);
|
fprintf(f, "DefaultPriority = %d\n", DefaultPriority);
|
||||||
fprintf(f, "DefaultLifetime = %d\n", DefaultLifetime);
|
fprintf(f, "DefaultLifetime = %d\n", DefaultLifetime);
|
||||||
|
14
config.h
14
config.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: config.h 1.64 2001/08/26 11:35:00 kls Exp $
|
* $Id: config.h 1.65 2001/08/26 14:08:23 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CONFIG_H
|
#ifndef __CONFIG_H
|
||||||
@ -137,15 +137,16 @@ public:
|
|||||||
cTimer(const cEventInfo *EventInfo);
|
cTimer(const cEventInfo *EventInfo);
|
||||||
virtual ~cTimer();
|
virtual ~cTimer();
|
||||||
cTimer& operator= (const cTimer &Timer);
|
cTimer& operator= (const cTimer &Timer);
|
||||||
|
bool operator< (const cTimer &Timer);
|
||||||
const char *ToText(void);
|
const char *ToText(void);
|
||||||
bool Parse(const char *s);
|
bool Parse(const char *s);
|
||||||
bool Save(FILE *f);
|
bool Save(FILE *f);
|
||||||
bool IsSingleEvent(void);
|
bool IsSingleEvent(void);
|
||||||
int cTimer::GetMDay(time_t t);
|
int GetMDay(time_t t);
|
||||||
int cTimer::GetWDay(time_t t);
|
int GetWDay(time_t t);
|
||||||
bool cTimer::DayMatches(time_t t);
|
bool DayMatches(time_t t);
|
||||||
time_t cTimer::IncDay(time_t t, int Days);
|
time_t IncDay(time_t t, int Days);
|
||||||
time_t cTimer::SetTime(time_t t, int SecondsFromMidnight);
|
time_t SetTime(time_t t, int SecondsFromMidnight);
|
||||||
bool Matches(time_t t = 0);
|
bool Matches(time_t t = 0);
|
||||||
time_t StartTime(void);
|
time_t StartTime(void);
|
||||||
time_t StopTime(void);
|
time_t StopTime(void);
|
||||||
@ -287,6 +288,7 @@ public:
|
|||||||
int EPGScanTimeout;
|
int EPGScanTimeout;
|
||||||
int EPGBugfixLevel;
|
int EPGBugfixLevel;
|
||||||
int SVDRPTimeout;
|
int SVDRPTimeout;
|
||||||
|
int SortTimers;
|
||||||
int PrimaryLimit;
|
int PrimaryLimit;
|
||||||
int DefaultPriority, DefaultLifetime;
|
int DefaultPriority, DefaultLifetime;
|
||||||
int VideoFormat;
|
int VideoFormat;
|
||||||
|
11
i18n.c
11
i18n.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: i18n.c 1.34 2001/08/25 13:41:57 kls Exp $
|
* $Id: i18n.c 1.35 2001/08/26 13:45:10 kls Exp $
|
||||||
*
|
*
|
||||||
* Slovenian translations provided by Miha Setina <mihasetina@softhome.net>
|
* Slovenian translations provided by Miha Setina <mihasetina@softhome.net>
|
||||||
* Italian translations provided by Alberto Carraro <bertocar@tin.it>
|
* Italian translations provided by Alberto Carraro <bertocar@tin.it>
|
||||||
@ -794,6 +794,15 @@ const tPhrase Phrases[] = {
|
|||||||
"Temps maxi SVDRP",
|
"Temps maxi SVDRP",
|
||||||
"Ubrukt SVDRP-levetid",
|
"Ubrukt SVDRP-levetid",
|
||||||
},
|
},
|
||||||
|
{ "SortTimers",
|
||||||
|
"Timer sortieren",
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
"", // TODO
|
||||||
|
},
|
||||||
{ "PrimaryLimit",
|
{ "PrimaryLimit",
|
||||||
"Primär-Limit",
|
"Primär-Limit",
|
||||||
"", // TODO
|
"", // TODO
|
||||||
|
53
menu.c
53
menu.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: menu.c 1.108 2001/08/26 12:13:24 kls Exp $
|
* $Id: menu.c 1.109 2001/08/26 14:03:27 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
@ -957,20 +957,25 @@ eOSState cMenuEditTimer::ProcessKey(eKeys Key)
|
|||||||
|
|
||||||
class cMenuTimerItem : public cOsdItem {
|
class cMenuTimerItem : public cOsdItem {
|
||||||
private:
|
private:
|
||||||
int index;
|
|
||||||
cTimer *timer;
|
cTimer *timer;
|
||||||
public:
|
public:
|
||||||
cMenuTimerItem(int Index, cTimer *Timer);
|
cMenuTimerItem(cTimer *Timer);
|
||||||
|
virtual bool operator< (const cListObject &ListObject);
|
||||||
virtual void Set(void);
|
virtual void Set(void);
|
||||||
|
cTimer *Timer(void) { return timer; }
|
||||||
};
|
};
|
||||||
|
|
||||||
cMenuTimerItem::cMenuTimerItem(int Index, cTimer *Timer)
|
cMenuTimerItem::cMenuTimerItem(cTimer *Timer)
|
||||||
{
|
{
|
||||||
index = Index;
|
|
||||||
timer = Timer;
|
timer = Timer;
|
||||||
Set();
|
Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cMenuTimerItem::operator< (const cListObject &ListObject)
|
||||||
|
{
|
||||||
|
return *timer < *((cMenuTimerItem *)&ListObject)->timer;
|
||||||
|
}
|
||||||
|
|
||||||
void cMenuTimerItem::Set(void)
|
void cMenuTimerItem::Set(void)
|
||||||
{
|
{
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
@ -996,6 +1001,7 @@ private:
|
|||||||
eOSState Del(void);
|
eOSState Del(void);
|
||||||
virtual void Move(int From, int To);
|
virtual void Move(int From, int To);
|
||||||
eOSState Summary(void);
|
eOSState Summary(void);
|
||||||
|
cTimer *CurrentTimer(void);
|
||||||
public:
|
public:
|
||||||
cMenuTimers(void);
|
cMenuTimers(void);
|
||||||
virtual eOSState ProcessKey(eKeys Key);
|
virtual eOSState ProcessKey(eKeys Key);
|
||||||
@ -1008,15 +1014,23 @@ cMenuTimers::cMenuTimers(void)
|
|||||||
cTimer *timer;
|
cTimer *timer;
|
||||||
|
|
||||||
while ((timer = Timers.Get(i)) != NULL) {
|
while ((timer = Timers.Get(i)) != NULL) {
|
||||||
Add(new cMenuTimerItem(i, timer));
|
Add(new cMenuTimerItem(timer));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
SetHelp(tr("Edit"), tr("New"), tr("Delete"), tr("Mark"));
|
if (Setup.SortTimers)
|
||||||
|
Sort();
|
||||||
|
SetHelp(tr("Edit"), tr("New"), tr("Delete"), Setup.SortTimers ? NULL : tr("Mark"));
|
||||||
|
}
|
||||||
|
|
||||||
|
cTimer *cMenuTimers::CurrentTimer(void)
|
||||||
|
{
|
||||||
|
cMenuTimerItem *item = (cMenuTimerItem *)Get(Current());
|
||||||
|
return item ? item->Timer() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
eOSState cMenuTimers::Activate(bool On)
|
eOSState cMenuTimers::Activate(bool On)
|
||||||
{
|
{
|
||||||
cTimer *timer = Timers.Get(Current());
|
cTimer *timer = CurrentTimer();
|
||||||
if (timer && timer->active != On) {
|
if (timer && timer->active != On) {
|
||||||
timer->active = On;
|
timer->active = On;
|
||||||
RefreshCurrent();
|
RefreshCurrent();
|
||||||
@ -1031,8 +1045,8 @@ eOSState cMenuTimers::Edit(void)
|
|||||||
{
|
{
|
||||||
if (HasSubMenu() || Count() == 0)
|
if (HasSubMenu() || Count() == 0)
|
||||||
return osContinue;
|
return osContinue;
|
||||||
isyslog(LOG_INFO, "editing timer %d", Current() + 1);
|
isyslog(LOG_INFO, "editing timer %d", CurrentTimer()->Index() + 1);
|
||||||
return AddSubMenu(new cMenuEditTimer(Current()));
|
return AddSubMenu(new cMenuEditTimer(CurrentTimer()->Index()));
|
||||||
}
|
}
|
||||||
|
|
||||||
eOSState cMenuTimers::New(void)
|
eOSState cMenuTimers::New(void)
|
||||||
@ -1041,22 +1055,22 @@ eOSState cMenuTimers::New(void)
|
|||||||
return osContinue;
|
return osContinue;
|
||||||
cTimer *timer = new cTimer;
|
cTimer *timer = new cTimer;
|
||||||
Timers.Add(timer);
|
Timers.Add(timer);
|
||||||
Add(new cMenuTimerItem(timer->Index()/*XXX*/, timer), true);
|
Add(new cMenuTimerItem(timer), true);
|
||||||
Timers.Save();
|
Timers.Save();
|
||||||
isyslog(LOG_INFO, "timer %d added", timer->Index() + 1);
|
isyslog(LOG_INFO, "timer %d added", timer->Index() + 1);
|
||||||
return AddSubMenu(new cMenuEditTimer(Current(), true));
|
return AddSubMenu(new cMenuEditTimer(timer->Index(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
eOSState cMenuTimers::Del(void)
|
eOSState cMenuTimers::Del(void)
|
||||||
{
|
{
|
||||||
// Check if this timer is active:
|
// Check if this timer is active:
|
||||||
int Index = Current();
|
cTimer *ti = CurrentTimer();
|
||||||
cTimer *ti = Timers.Get(Index);
|
|
||||||
if (ti) {
|
if (ti) {
|
||||||
if (!ti->recording) {
|
if (!ti->recording) {
|
||||||
if (Interface->Confirm(tr("Delete timer?"))) {
|
if (Interface->Confirm(tr("Delete timer?"))) {
|
||||||
Timers.Del(Timers.Get(Index));
|
int Index = ti->Index();
|
||||||
cOsdMenu::Del(Index);
|
Timers.Del(ti);
|
||||||
|
cOsdMenu::Del(Current());
|
||||||
Timers.Save();
|
Timers.Save();
|
||||||
Display();
|
Display();
|
||||||
isyslog(LOG_INFO, "timer %d deleted", Index + 1);
|
isyslog(LOG_INFO, "timer %d deleted", Index + 1);
|
||||||
@ -1081,7 +1095,7 @@ eOSState cMenuTimers::Summary(void)
|
|||||||
{
|
{
|
||||||
if (HasSubMenu() || Count() == 0)
|
if (HasSubMenu() || Count() == 0)
|
||||||
return osContinue;
|
return osContinue;
|
||||||
cTimer *ti = Timers.Get(Current());
|
cTimer *ti = CurrentTimer();
|
||||||
if (ti && ti->summary && *ti->summary)
|
if (ti && ti->summary && *ti->summary)
|
||||||
return AddSubMenu(new cMenuText(tr("Summary"), ti->summary));
|
return AddSubMenu(new cMenuText(tr("Summary"), ti->summary));
|
||||||
return Edit(); // convenience for people not using the Summary feature ;-)
|
return Edit(); // convenience for people not using the Summary feature ;-)
|
||||||
@ -1109,7 +1123,9 @@ eOSState cMenuTimers::ProcessKey(eKeys Key)
|
|||||||
case kRed: return Edit();
|
case kRed: return Edit();
|
||||||
case kGreen: return New();
|
case kGreen: return New();
|
||||||
case kYellow: return Del();
|
case kYellow: return Del();
|
||||||
case kBlue: Mark(); break;
|
case kBlue: if (!Setup.SortTimers)
|
||||||
|
Mark();
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1706,6 +1722,7 @@ void cMenuSetup::Set(void)
|
|||||||
Add(new cMenuEditIntItem( tr("EPGScanTimeout"), &data.EPGScanTimeout));
|
Add(new cMenuEditIntItem( tr("EPGScanTimeout"), &data.EPGScanTimeout));
|
||||||
Add(new cMenuEditIntItem( tr("EPGBugfixLevel"), &data.EPGBugfixLevel, 0, 3));
|
Add(new cMenuEditIntItem( tr("EPGBugfixLevel"), &data.EPGBugfixLevel, 0, 3));
|
||||||
Add(new cMenuEditIntItem( tr("SVDRPTimeout"), &data.SVDRPTimeout));
|
Add(new cMenuEditIntItem( tr("SVDRPTimeout"), &data.SVDRPTimeout));
|
||||||
|
Add(new cMenuEditBoolItem(tr("SortTimers"), &data.SortTimers));
|
||||||
Add(new cMenuEditIntItem( tr("PrimaryLimit"), &data.PrimaryLimit, 0, MAXPRIORITY));
|
Add(new cMenuEditIntItem( tr("PrimaryLimit"), &data.PrimaryLimit, 0, MAXPRIORITY));
|
||||||
Add(new cMenuEditIntItem( tr("DefaultPriority"), &data.DefaultPriority, 0, MAXPRIORITY));
|
Add(new cMenuEditIntItem( tr("DefaultPriority"), &data.DefaultPriority, 0, MAXPRIORITY));
|
||||||
Add(new cMenuEditIntItem( tr("DefaultLifetime"), &data.DefaultLifetime, 0, MAXLIFETIME));
|
Add(new cMenuEditIntItem( tr("DefaultLifetime"), &data.DefaultLifetime, 0, MAXLIFETIME));
|
||||||
|
18
tools.c
18
tools.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: tools.c 1.41 2001/08/25 13:21:22 kls Exp $
|
* $Id: tools.c 1.42 2001/08/26 13:11:17 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
@ -692,3 +692,19 @@ int cListBase::Count(void) const
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cListBase::Sort(void)
|
||||||
|
{
|
||||||
|
bool swapped;
|
||||||
|
do {
|
||||||
|
swapped = false;
|
||||||
|
cListObject *object = objects;
|
||||||
|
while (object) {
|
||||||
|
if (object->Next() && *object->Next() < *object) {
|
||||||
|
Move(object->Next(), object);
|
||||||
|
swapped = true;
|
||||||
|
}
|
||||||
|
object = object->Next();
|
||||||
|
}
|
||||||
|
} while (swapped);
|
||||||
|
}
|
||||||
|
|
||||||
|
4
tools.h
4
tools.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: tools.h 1.30 2001/08/25 13:20:54 kls Exp $
|
* $Id: tools.h 1.31 2001/08/26 12:52:49 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __TOOLS_H
|
#ifndef __TOOLS_H
|
||||||
@ -95,6 +95,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
cListObject(void);
|
cListObject(void);
|
||||||
virtual ~cListObject();
|
virtual ~cListObject();
|
||||||
|
virtual bool operator< (const cListObject &ListObject) { return false; }
|
||||||
void Append(cListObject *Object);
|
void Append(cListObject *Object);
|
||||||
void Unlink(void);
|
void Unlink(void);
|
||||||
int Index(void);
|
int Index(void);
|
||||||
@ -115,6 +116,7 @@ public:
|
|||||||
virtual void Clear(void);
|
virtual void Clear(void);
|
||||||
cListObject *Get(int Index) const;
|
cListObject *Get(int Index) const;
|
||||||
int Count(void) const;
|
int Count(void) const;
|
||||||
|
void Sort(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T> class cList : public cListBase {
|
template<class T> class cList : public cListBase {
|
||||||
|
Loading…
Reference in New Issue
Block a user