Experimental: save/restore channel list mode for history zaps

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1870 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: a9cb9c4733
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2011-11-22 (Tue, 22 Nov 2011)



------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2011-11-22 09:49:51 +00:00
parent f11a59b82c
commit 10803d3b6b
4 changed files with 41 additions and 0 deletions

View File

@@ -442,6 +442,11 @@ int CChannelList::exec()
int nNewChannel = show(); int nNewChannel = show();
if ( nNewChannel > -1) { if ( nNewChannel > -1) {
#if 1 #if 1
if(this->historyMode && chanlist[nNewChannel]) {
int new_mode = CNeutrinoApp::getInstance ()->channelList->getLastChannels().get_mode(chanlist[nNewChannel]->channel_id);
if(new_mode >= 0)
CNeutrinoApp::getInstance()->SetChannelMode(new_mode);
}
CNeutrinoApp::getInstance ()->channelList->zapTo(getKey(nNewChannel)-1); CNeutrinoApp::getInstance ()->channelList->zapTo(getKey(nNewChannel)-1);
#else #else
CNeutrinoApp::getInstance ()->channelList->NewZap(chanlist[nNewChannel]->channel_id); CNeutrinoApp::getInstance ()->channelList->NewZap(chanlist[nNewChannel]->channel_id);
@@ -1181,6 +1186,7 @@ void CChannelList::zapTo(int pos, bool /* forceStoreToLastChannels */)
} }
g_RCInput->postMsg( NeutrinoMessages::SHOW_INFOBAR, 0 ); g_RCInput->postMsg( NeutrinoMessages::SHOW_INFOBAR, 0 );
CNeutrinoApp::getInstance ()->channelList->getLastChannels().set_mode(chan->channel_id);
} }
} }
@@ -1224,6 +1230,9 @@ int CChannelList::numericZap(int key)
t_channel_id channel_id = lastChList.getlast(1); t_channel_id channel_id = lastChList.getlast(1);
if(channel_id && SameTP(channel_id)) { if(channel_id && SameTP(channel_id)) {
lastChList.clear_storedelay (); // ignore store delay lastChList.clear_storedelay (); // ignore store delay
int new_mode = lastChList.get_mode(channel_id);
if(new_mode >= 0)
CNeutrinoApp::getInstance()->SetChannelMode(new_mode);
zapTo_ChannelID(channel_id); zapTo_ChannelID(channel_id);
res = 0; res = 0;
} }

View File

@@ -148,6 +148,7 @@ public:
void SortTP(void); void SortTP(void);
void ClearList(void); void ClearList(void);
bool SameTP(t_channel_id channel_id = 0); bool SameTP(t_channel_id channel_id = 0);
CLastChannel & getLastChannels() { return lastChList; }
//friend class CZapitChannel; //friend class CZapitChannel;
}; };
#endif #endif

View File

@@ -18,6 +18,8 @@ nicht gespeichert werden.
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include <global.h>
#include <neutrino.h>
#include "lastchannel.h" #include "lastchannel.h"
CLastChannel::CLastChannel (void) CLastChannel::CLastChannel (void)
@@ -57,6 +59,8 @@ void CLastChannel::store (int channel, t_channel_id channel_id, bool /* forceSto
/* push new channel to the head */ /* push new channel to the head */
_LastCh newChannel = {channel, channel_id, tv.tv_sec}; _LastCh newChannel = {channel, channel_id, tv.tv_sec};
newChannel.channel_mode = CNeutrinoApp::getInstance()->GetChannelMode();
this->lastChannels.push_front(newChannel); this->lastChannels.push_front(newChannel);
/* this zap time was more than treshhold, it will stay, remove last in the list */ /* this zap time was more than treshhold, it will stay, remove last in the list */
@@ -125,3 +129,27 @@ int CLastChannel::get_store_difftime (void) const
{ {
return secs_diff_before_store; return secs_diff_before_store;
} }
int CLastChannel::get_mode(t_channel_id channel_id)
{
std::list<_LastCh>::iterator It;
for (It = this->lastChannels.begin(); It != this->lastChannels.end() ; ++It) {
if (channel_id == It->channel_id)
return It->channel_mode;
}
return -1;
}
bool CLastChannel::set_mode(t_channel_id channel_id)
{
std::list<_LastCh>::iterator It;
for (It = this->lastChannels.begin(); It != this->lastChannels.end() ; ++It) {
if (channel_id == It->channel_id) {
It->channel_mode = CNeutrinoApp::getInstance()->GetChannelMode();
return true;
}
}
return false;
}

View File

@@ -35,6 +35,7 @@ class CLastChannel
int channel; int channel;
t_channel_id channel_id; t_channel_id channel_id;
unsigned long timestamp; unsigned long timestamp;
int channel_mode;
}; };
std::list<_LastCh> lastChannels; std::list<_LastCh> lastChannels;
@@ -52,6 +53,8 @@ class CLastChannel
void clear_storedelay (void); void clear_storedelay (void);
void set_store_difftime (int secs); void set_store_difftime (int secs);
int get_store_difftime (void) const; int get_store_difftime (void) const;
int get_mode(t_channel_id channel_id);
bool set_mode(t_channel_id channel_id);
}; };