mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -18,6 +18,8 @@ nicht gespeichert werden.
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#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;
|
||||
}
|
||||
|
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user