Ticket #4501: mythtv_browseall_03.diff
File mythtv_browseall_03.diff, 8.1 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/tv_play.h
221 221 void SetCurrentlyPlaying(ProgramInfo *pginfo); 222 222 223 223 void GetNextProgram(RemoteEncoder *enc, int direction, 224 InfoMap &infoMap) ;224 InfoMap &infoMap) const; 225 225 226 226 // static functions 227 227 static void InitKeys(void); … … 399 399 void ToggleRecord(void); 400 400 void BrowseChannel(const QString &channum); 401 401 402 uint GetChanIDAnyTuner(const QString &chan) const; 403 QString GetChanNumAnyTuner(const uint &chanid) const; 404 void GetNextProgramAnyTuner(int direction, InfoMap &infoMap, 405 ProgramInfo *prog) const; 406 402 407 void DoTogglePictureAttribute(PictureAdjustType type); 403 408 void DoChangePictureAttribute( 404 409 PictureAdjustType type, PictureAttribute attr, bool up); … … 586 591 QString browsechannum; 587 592 QString browsechanid; 588 593 QString browsestarttime; 594 bool browsealltuners; 595 DBChanList allchannels; 589 596 590 597 // Program Info for currently playing video 591 598 // (or next video if InChangeState() is true) -
libs/libmythtv/tv_play.cpp
586 586 browsemode(false), persistentbrowsemode(false), 587 587 browseTimer(new QTimer(this)), 588 588 browsechannum(""), browsechanid(""), browsestarttime(""), 589 browsealltuners(false), 589 590 // Program Info for currently playing video 590 591 recorderPlaybackInfo(NULL), 591 592 playbackinfo(NULL), playbackLen(0), … … 675 676 ff_rew_speeds.push_back( 676 677 gContext->GetNumSetting(QString("FFRewSpeed%1").arg(i), def[i])); 677 678 679 browsealltuners = gContext->GetNumSetting("BrowseAllTuners", 0); 680 if (browsealltuners) 681 { 682 QString channelOrdering = gContext->GetSetting("ChannelOrdering", "channum"); 683 allchannels = ChannelUtil::GetChannels(0, true, "channum, callsign"); 684 ChannelUtil::SortChannels(allchannels, channelOrdering, true); 685 }; 686 678 687 vbimode = VBIMode::Parse(gContext->GetSetting("VbiFormat")); 679 688 680 689 if (createWindow) … … 5618 5627 * \param infoMap InfoMap to fill in with returned data 5619 5628 */ 5620 5629 void TV::GetNextProgram(RemoteEncoder *enc, int direction, 5621 InfoMap &infoMap) 5630 InfoMap &infoMap) const 5622 5631 { 5623 5632 QString title, subtitle, desc, category, endtime, callsign, iconpath; 5624 5633 QDateTime begts, endts; … … 5772 5781 is_tunable_cache_inputs.clear(); 5773 5782 } 5774 5783 5784 uint TV::GetChanIDAnyTuner(const QString &chan) const 5785 { 5786 for (uint i = 0; i < allchannels.size(); ++i) 5787 if (allchannels[i].channum == chan) 5788 return allchannels[i].chanid; 5789 return 0; 5790 } 5791 5792 QString TV::GetChanNumAnyTuner(const uint &chanid) const 5793 { 5794 for (uint i = 0; i < allchannels.size(); ++i) 5795 if (allchannels[i].chanid == chanid) 5796 return allchannels[i].channum; 5797 return ""; 5798 } 5799 5800 void TV::GetNextProgramAnyTuner(int direction, InfoMap &infoMap, 5801 ProgramInfo *prog) const 5802 { 5803 uint chanid = infoMap["chanid"].toUInt(); 5804 if (!chanid) 5805 chanid = GetChanIDAnyTuner(infoMap["channum"]); 5806 5807 int chandir = -1; 5808 switch(direction) 5809 { 5810 case BROWSE_UP: chandir = CHANNEL_DIRECTION_UP; break; 5811 case BROWSE_DOWN: chandir = CHANNEL_DIRECTION_DOWN; break; 5812 case BROWSE_FAVORITE: chandir = CHANNEL_DIRECTION_FAVORITE; break; 5813 }; 5814 if (direction != -1) 5815 chanid = ChannelUtil::GetNextChannel(allchannels, chanid, 0, chandir); 5816 5817 infoMap["chanid"] = QString("%1").arg(chanid); 5818 infoMap["channum"] = GetChanNumAnyTuner(chanid); 5819 5820 QDateTime nowtime = QDateTime::currentDateTime(); 5821 QDateTime latesttime = nowtime.addSecs(6*60*60); 5822 QDateTime browsetime = QDateTime::fromString(infoMap["dbstarttime"], Qt::ISODate); 5823 5824 MSqlBindings bindings; 5825 bindings[":CHANID"] = chanid; 5826 bindings[":NOWTS"] = nowtime.toString("yyyy-MM-ddThh:mm:ss"); 5827 bindings[":LATESTTS"] = latesttime.toString("yyyy-MM-ddThh:mm:ss"); 5828 bindings[":BROWSETS"] = browsetime.toString("yyyy-MM-ddThh:mm:ss"); 5829 5830 QString querystr = " WHERE program.chanid = :CHANID "; 5831 switch(direction) 5832 { 5833 case BROWSE_LEFT: 5834 querystr += " AND program.endtime <= :BROWSETS " 5835 " AND program.endtime > :NOWTS "; 5836 break; 5837 5838 case BROWSE_RIGHT: 5839 querystr += " AND program.starttime > :BROWSETS " 5840 " AND program.starttime < :LATESTTS "; 5841 break; 5842 5843 default: 5844 querystr += " AND program.starttime <= :BROWSETS " 5845 " AND program.endtime > :BROWSETS "; 5846 }; 5847 5848 ProgramList progList; 5849 progList.FromProgram(querystr, bindings); 5850 5851 if (progList.isEmpty()) 5852 { 5853 infoMap["dbstarttime"] = ""; 5854 return; 5855 }; 5856 5857 prog = (direction == BROWSE_LEFT) ? progList.take(progList.count() - 1) 5858 : progList.take(0); 5859 5860 infoMap["dbstarttime"] = prog->startts.toString(Qt::ISODate); 5861 } 5862 5775 5863 void TV::EmbedOutput(WId wid, int x, int y, int w, int h) 5776 5864 { 5777 5865 embedWinID = wid; … … 6602 6690 infoMap["channum"] = browsechannum; 6603 6691 infoMap["chanid"] = browsechanid; 6604 6692 6605 GetNextProgram(activerecorder, direction, infoMap); 6693 ProgramInfo *program_info = NULL; 6694 if (browsealltuners) 6695 GetNextProgramAnyTuner(direction, infoMap, program_info); 6696 else 6697 GetNextProgram(activerecorder, direction, infoMap); 6606 6698 6607 6699 browsechannum = infoMap["channum"]; 6608 6700 browsechanid = infoMap["chanid"]; … … 6613 6705 browsestarttime = infoMap["dbstarttime"]; 6614 6706 } 6615 6707 6616 QDateTime startts = QDateTime::fromString(browsestarttime, Qt::ISODate); 6617 ProgramInfo *program_info = 6618 ProgramInfo::GetProgramAtDateTime(browsechanid, startts); 6708 if (!program_info) 6709 { 6710 QDateTime startts = QDateTime::fromString(browsestarttime, Qt::ISODate); 6711 program_info = 6712 ProgramInfo::GetProgramAtDateTime(browsechanid, startts); 6713 } 6619 6714 6620 6715 if (program_info) 6621 6716 program_info->ToMap(infoMap); 6622 6717 6718 if (browsealltuners && !IsTunable(browsechanid.toUInt())) 6719 infoMap["channum"] = "x" + infoMap["channum"]; 6720 6623 6721 GetOSD()->ClearAllText("browse_info"); 6624 6722 GetOSD()->SetText("browse_info", infoMap, -1); 6625 6723 … … 6717 6815 6718 6816 void TV::BrowseChannel(const QString &chan) 6719 6817 { 6720 if (!activerecorder->CheckChannel(chan)) 6818 if (browsealltuners) 6819 { 6820 if (!GetChanIDAnyTuner(chan)) 6821 return; 6822 } 6823 else if (!activerecorder->CheckChannel(chan)) 6721 6824 return; 6722 6825 6723 6826 browsechannum = chan; -
programs/mythfrontend/globalsettings.cpp
1913 1913 return gc; 1914 1914 } 1915 1915 1916 static HostCheckBox *BrowseAllTuners() 1917 { 1918 HostCheckBox *gc = new HostCheckBox("BrowseAllTuners"); 1919 gc->setLabel(QObject::tr("Browse channels from all tuners")); 1920 gc->setValue(true); 1921 gc->setHelpText(QObject::tr("By default, browse mode only shows channels " 1922 "on the currently active tuner. If enabled, browse mode " 1923 "will shows all channels, no matter what tuner they " 1924 "exist on.")); 1925 return gc; 1926 } 1927 1916 1928 static HostCheckBox *AggressiveBuffer() 1917 1929 { 1918 1930 HostCheckBox *gc = new HostCheckBox("AggressiveSoundcardBuffer"); … … 4701 4713 osd->addChild(OSDThemeFontSizeType()); 4702 4714 osd->addChild(EnableMHEG()); 4703 4715 osd->addChild(PersistentBrowseMode()); 4716 osd->addChild(BrowseAllTuners()); 4704 4717 addChild(osd); 4705 4718 4706 4719 VerticalConfigurationGroup *udp = new VerticalConfigurationGroup(false);