Trying to fix #311

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


Origin commit data
------------------
Branch: ni/coolstream
Commit: d7c2303239
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2010-06-28 (Mon, 28 Jun 2010)



------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2010-06-28 18:52:48 +00:00
parent 80834fc5cd
commit 5283167785
4 changed files with 37 additions and 55 deletions

View File

@@ -1042,9 +1042,11 @@ printf("**************************** CChannelList::zapTo me %x %s tuned %d new %
}
if(!new_mode_active) {
selected = pos;
#if 0
/* TODO lastChList.store also called in adjustToChannelID, which is called
only from "whole" channel list. Why here too ? */
lastChList.store (selected, chan->channel_id, forceStoreToLastChannels);
#endif
/* remove recordModeActive from infobar */
if(g_settings.auto_timeshift && !CNeutrinoApp::getInstance()->recordingstatus) {
g_InfoViewer->handleMsg(NeutrinoMessages::EVT_RECORDMODE, 0);
@@ -1135,7 +1137,7 @@ int CChannelList::numericZap(int key)
if (this->lastChList.size() > 1) {
CChannelList * channelList = new CChannelList(g_Locale->getText(LOCALE_CHANNELLIST_HISTORY), true, true);
for(unsigned int i = 1 ; i < this->lastChList.size() ; ++i) {
for(unsigned int i = 1; i < this->lastChList.size() ; ++i) {
t_channel_id channel_id = this->lastChList.getlast(i);
if(channel_id) {
CZapitChannel* channel = getChannel(channel_id);

View File

@@ -2765,6 +2765,9 @@ void CNeutrinoApp::InitKeySettings(CMenuWidget &keySettings)
{
CMenuWidget* bindSettings = new CMenuWidget(LOCALE_KEYBINDINGMENU_HEAD, NEUTRINO_ICON_KEYBINDING);
bindSettings->addItem(GenericMenuSeparator);
bindSettings->addItem(GenericMenuBack);
addMenueIntroItems(keySettings);
int shortcut = 1;
keySettings.addItem(new CMenuForwarder(LOCALE_EXTRA_LOADKEYS, true, NULL, this, "loadkeys", CRCInput::convertDigitToKey(shortcut++)));
@@ -2845,7 +2848,7 @@ void CNeutrinoApp::InitKeySettings(CMenuWidget &keySettings)
bindSettings->addItem(new CMenuForwarder(keydescription[i], true, NULL, keychooser[i]));
bindSettings->addItem(new CMenuOptionChooser(LOCALE_EXTRA_SMS_CHANNEL, &g_settings.sms_channel, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
// Zapping keys
// Zapping keys
bindSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_KEYBINDINGMENU_QUICKZAP));
for (int i = KEY_CHANNEL_UP; i <= KEY_LASTCHANNEL; i++)

View File

@@ -20,8 +20,6 @@ nicht gespeichert werden.
#include "lastchannel.h"
// // -- Init Class Contructor //
CLastChannel::CLastChannel (void)
: secs_diff_before_store(3)
, maxSize(11)
@@ -36,56 +34,45 @@ void CLastChannel::clear (void)
}
// -- Store a channelnumber in Buffer
// -- Store only if channel != last channel...
// -- and time store delay is large enough
// -- Store only if channel != last channel and time store delay is large enough
// forceStoreToLastChannels default to false
void CLastChannel::store (int channel, t_channel_id channel_id, bool forceStoreToLastChannels)
{
struct timeval tv;
unsigned long lastTimestamp(0);
unsigned long timeDiff;
std::list<_LastCh>::iterator It;
gettimeofday (&tv, NULL);
int lastChannel(-1);
t_channel_id lastChannel_id(0);
unsigned long lastTimestamp(0);
if (!this->lastChannels.empty())
{
lastChannel = this->lastChannels.front().channel;
lastChannel_id = this->lastChannels.front().channel_id;
lastTimestamp = this->lastChannels.front().timestamp;
}
if (((forceStoreToLastChannels || (tv.tv_sec - lastTimestamp) > secs_diff_before_store))
&& (lastChannel != channel) )
{
if (this->shallRemoveEqualChannel && (this->lastChannels.size() > 1))
{
std::list<_LastCh>::iterator It = this->lastChannels.begin();
++It;
for (; It != this->lastChannels.end() ; ++It) {
if (lastChannel_id == It->channel_id) {
this->lastChannels.erase(It);
break;
}
timeDiff = tv.tv_sec - lastTimestamp;
/* prev zap time was less than treshhold, remove prev channel */
if(!this->lastChannels.empty() && (timeDiff <= secs_diff_before_store))
this->lastChannels.pop_front();
/* push new channel to the head */
_LastCh newChannel = {channel, channel_id, tv.tv_sec};
this->lastChannels.push_front(newChannel);
/* this zap time was more than treshhold, it will stay, remove last in the list */
if ((timeDiff > secs_diff_before_store) && (this->lastChannels.size() > this->maxSize))
this->lastChannels.pop_back();
/* remove this channel at other than 0 position */
if(this->lastChannels.size() > 1) {
It = this->lastChannels.begin();
It++;
for (; It != this->lastChannels.end() ; It++) {
if (channel_id == It->channel_id) {
this->lastChannels.erase(It);
break;
}
}
// -- store channel on next pos (new channel)
_LastCh newChannel = {channel, channel_id, tv.tv_sec};
this->lastChannels.push_front(newChannel);
if (this->lastChannels.size() > this->maxSize)
{
this->lastChannels.pop_back();
}
}
// -- remember time (secs)
if (!this->lastChannels.empty())
{
this->lastChannels.front().channel = channel;
this->lastChannels.front().channel_id = channel_id;
this->lastChannels.front().timestamp = tv.tv_sec;
}
}
@@ -94,11 +81,9 @@ unsigned int CLastChannel::size () const
return this->lastChannels.size();
}
//
// -- Clear store time delay
// -- means: set last time stamp to zero
// -- means: store next channel with "store" always
//
void CLastChannel::clear_storedelay (void)
@@ -109,7 +94,6 @@ void CLastChannel::clear_storedelay (void)
}
}
//
// -- Get last Channel-Entry
// -- IN: n number of last channel in queue [0..]
// -- 0 = current channel
@@ -117,26 +101,20 @@ void CLastChannel::clear_storedelay (void)
t_channel_id CLastChannel::getlast (int n)
{
if ( (n < int(this->lastChannels.size()))
&&(n > -1)
&&(!this->lastChannels.empty())
)
if((n < int(this->lastChannels.size())) && (n > -1) && (!this->lastChannels.empty()))
{
std::list<_LastCh>::const_iterator It = this->lastChannels.begin();
std::advance(It, n);
//return It->channel;
return It->channel_id;
}
//return -1;
return 0;
}
//
// -- set delaytime in secs, for accepting a new value
// -- get returns the value
//
void CLastChannel::set_store_difftime (int secs)
{
secs_diff_before_store = secs;
@@ -147,4 +125,3 @@ int CLastChannel::get_store_difftime (void) const
{
return secs_diff_before_store;
}

View File

@@ -33,8 +33,8 @@ class CLastChannel
struct _LastCh
{
int channel;
unsigned long timestamp;
t_channel_id channel_id;
unsigned long timestamp;
};
std::list<_LastCh> lastChannels;