diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index ba8325e6a..918bd4bab 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -442,6 +442,11 @@ int CChannelList::exec() int nNewChannel = show(); if ( nNewChannel > -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); #else 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 ); + 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); if(channel_id && SameTP(channel_id)) { 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); res = 0; } diff --git a/src/gui/channellist.h b/src/gui/channellist.h index fb90c5334..71ec431c5 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -148,6 +148,7 @@ public: void SortTP(void); void ClearList(void); bool SameTP(t_channel_id channel_id = 0); + CLastChannel & getLastChannels() { return lastChList; } //friend class CZapitChannel; }; #endif diff --git a/src/system/lastchannel.cpp b/src/system/lastchannel.cpp index d960d9e64..61a91d85c 100644 --- a/src/system/lastchannel.cpp +++ b/src/system/lastchannel.cpp @@ -18,6 +18,8 @@ nicht gespeichert werden. #include #include +#include +#include #include "lastchannel.h" 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 */ _LastCh newChannel = {channel, channel_id, tv.tv_sec}; + newChannel.channel_mode = CNeutrinoApp::getInstance()->GetChannelMode(); + this->lastChannels.push_front(newChannel); /* 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; } + +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; +} diff --git a/src/system/lastchannel.h b/src/system/lastchannel.h index 15b180e09..0b1a0112a 100644 --- a/src/system/lastchannel.h +++ b/src/system/lastchannel.h @@ -35,6 +35,7 @@ class CLastChannel int channel; t_channel_id channel_id; unsigned long timestamp; + int channel_mode; }; std::list<_LastCh> lastChannels; @@ -52,6 +53,8 @@ class CLastChannel void clear_storedelay (void); void set_store_difftime (int secs); int get_store_difftime (void) const; + int get_mode(t_channel_id channel_id); + bool set_mode(t_channel_id channel_id); };