diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 93ccf6883..2f2bed520 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -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); diff --git a/src/neutrino_menue.cpp b/src/neutrino_menue.cpp index 1d1ed2c4e..60210c677 100644 --- a/src/neutrino_menue.cpp +++ b/src/neutrino_menue.cpp @@ -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++) diff --git a/src/system/lastchannel.cpp b/src/system/lastchannel.cpp index 66c4b3b9a..235f56035 100644 --- a/src/system/lastchannel.cpp +++ b/src/system/lastchannel.cpp @@ -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; } - diff --git a/src/system/lastchannel.h b/src/system/lastchannel.h index 453835e35..15b180e09 100644 --- a/src/system/lastchannel.h +++ b/src/system/lastchannel.h @@ -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;