Bug #2260 » favorites-0.0.2-vdr-2.3.1-porting.diff
favoritechannel.c 2011-06-12 18:41:59.000000000 +0200 → favoritechannel.c 2015-10-22 19:02:55.000000000 +0200 | ||
---|---|---|
{
|
||
/* Fix crash problem reported by Manuel Hartl */
|
||
/* when loading a non existing favoriteed channel */
|
||
cChannel *channel;
|
||
channel = Channels.GetByChannelID(GetIndex(), true);
|
||
LOCK_CHANNELS_READ;
|
||
const cChannel* channel = Channels->GetByChannelID(GetIndex(), true);
|
||
if (!channel)
|
||
{
|
||
isyslog("Favorite channel '%s' does not exist anymore. Removing\n", *(Index.ToString()) );
|
||
... | ... | |
else if (config.sortby == 2)
|
||
{
|
||
/* Sort by same order as channels.conf */
|
||
if (strcmp(Channels.GetByChannelID(l->Index)->Name(), Channels.GetByChannelID(Index)->Name()) == 0)
|
||
LOCK_CHANNELS_READ;
|
||
if (strcmp(Channels->GetByChannelID(l->Index)->Name(), Channels->GetByChannelID(Index)->Name()) == 0)
|
||
return 0;
|
||
for (cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel))
|
||
for (const cChannel *channel = Channels->First(); channel; channel = Channels->Next(channel))
|
||
{
|
||
if (!channel->GroupSep() || *channel->Name())
|
||
{
|
||
if (!strcmp(channel->Name(), Channels.GetByChannelID(l->Index)->Name()))
|
||
if (!strcmp(channel->Name(), Channels->GetByChannelID(l->Index)->Name()))
|
||
{
|
||
return 1;
|
||
}
|
||
else if (!strcmp(channel->Name(), Channels.GetByChannelID(Index)->Name()))
|
||
else if (!strcmp(channel->Name(), Channels->GetByChannelID(Index)->Name()))
|
||
{
|
||
return -1;
|
||
}
|
||
... | ... | |
else if (config.sortby == 3)
|
||
{
|
||
/* Sort by channel name */
|
||
return strcasecmp( Channels.GetByChannelID(l->Index)->Name(), Channels.GetByChannelID(Index)->Name())*-1;
|
||
LOCK_CHANNELS_READ;
|
||
return strcasecmp( Channels->GetByChannelID(l->Index)->Name(), Channels->GetByChannelID(Index)->Name())*-1;
|
||
}
|
||
else
|
||
{
|
||
... | ... | |
tChannelID cFavoriteChannels::GetCurrentFavorite()
|
||
{
|
||
cChannel *Channel = Channels.GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
|
||
LOCK_CHANNELS_READ;
|
||
const cChannel *Channel = Channels->GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
|
||
if (Channel)
|
||
{
|
||
tChannelID current_channel = Channel->GetChannelID();
|
favoriteosd.c 2011-06-12 19:35:17.000000000 +0200 → favoriteosd.c 2015-10-22 19:04:37.000000000 +0200 | ||
---|---|---|
ReadFavoriteChannels();
|
||
// find the actual current
|
||
cChannel *Channel = Channels.GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
|
||
LOCK_CHANNELS_READ;
|
||
const cChannel *Channel = Channels->GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
|
||
if (Channel)
|
||
{
|
||
tChannelID myCurrent = Channel->GetChannelID();
|
||
... | ... | |
Clear();
|
||
for (int i=0; i<number; i++)
|
||
{
|
||
if (Channels.GetByChannelID(favoritechannels[i]))
|
||
LOCK_CHANNELS_READ;
|
||
if (Channels->GetByChannelID(favoritechannels[i]))
|
||
{
|
||
Add (new cOsdItem((Channels.GetByChannelID(favoritechannels[i]))->Name()));
|
||
Add (new cOsdItem((Channels->GetByChannelID(favoritechannels[i]))->Name()));
|
||
}
|
||
}
|
||
Display();
|
||
... | ... | |
* If current channel is a favoritered one we remember it as the lastChannel
|
||
*/
|
||
lastChannel = FavoriteChannelsList.GetCurrentFavorite();
|
||
cChannel *Channel = Channels.GetByChannelID(favoritechannels[current]);
|
||
LOCK_CHANNELS_READ;
|
||
const cChannel *Channel = Channels->GetByChannelID(favoritechannels[current]);
|
||
if (Channel)
|
||
cDevice::PrimaryDevice()->SwitchChannel(Channel, true);
|
||
}
|
||
... | ... | |
{
|
||
if (number < CHANNELSMAX)
|
||
{
|
||
cChannel *Channel = Channels.GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
|
||
LOCK_CHANNELS_READ;
|
||
const cChannel *Channel = Channels->GetByNumber(cDevice::PrimaryDevice()->CurrentChannel());
|
||
if (Channel)
|
||
{
|
||
tChannelID Current_channel = Channel->GetChannelID();
|
- « Previous
- 1
- 2
- Next »