Ticket #4501: mythtv_browseall_03-trunk.patch
File mythtv_browseall_03-trunk.patch, 8.4 KB (added by , 15 years ago) |
---|
-
libs/libmythtv/tv_play.cpp
diff -Naur mythtv/libs/libmythtv/tv_play.cpp mythtv-browsepatch/libs/libmythtv/tv_play.cpp
old new 585 585 // channel browsing state variables 586 586 browsemode(false), persistentbrowsemode(false), 587 587 browsechannum(""), browsechanid(""), browsestarttime(""), 588 browsealltuners(false), 588 589 // Program Info for currently playing video 589 590 recorderPlaybackInfo(NULL), 590 591 playbackinfo(NULL), playbackLen(0), … … 673 674 ff_rew_speeds.push_back( 674 675 gContext->GetNumSetting(QString("FFRewSpeed%1").arg(i), def[i])); 675 676 677 browsealltuners = gContext->GetNumSetting("BrowseAllTuners", 0); 678 if (browsealltuners) 679 { 680 QString channelOrdering = gContext->GetSetting("ChannelOrdering", "channum"); 681 allchannels = ChannelUtil::GetChannels(0, true, "channum, callsign"); 682 ChannelUtil::SortChannels(allchannels, channelOrdering, true); 683 }; 684 676 685 vbimode = VBIMode::Parse(gContext->GetSetting("VbiFormat")); 677 686 QString feVBI = gContext->GetSetting("DecodeVBIFormat", ""); 678 687 if (!feVBI.isEmpty()) … … 5645 5654 * \param infoMap InfoMap to fill in with returned data 5646 5655 */ 5647 5656 void TV::GetNextProgram(RemoteEncoder *enc, int direction, 5648 InfoMap &infoMap) 5657 InfoMap &infoMap) const 5649 5658 { 5650 5659 QString title, subtitle, desc, category, endtime, callsign, iconpath; 5651 5660 QDateTime begts, endts; … … 5799 5808 is_tunable_cache_inputs.clear(); 5800 5809 } 5801 5810 5811 uint TV::GetChanIDAnyTuner(const QString &chan) const 5812 { 5813 for (uint i = 0; i < allchannels.size(); ++i) 5814 if (allchannels[i].channum == chan) 5815 return allchannels[i].chanid; 5816 return 0; 5817 } 5818 5819 QString TV::GetChanNumAnyTuner(const uint &chanid) const 5820 { 5821 for (uint i = 0; i < allchannels.size(); ++i) 5822 if (allchannels[i].chanid == chanid) 5823 return allchannels[i].channum; 5824 return ""; 5825 } 5826 5827 void TV::GetNextProgramAnyTuner(int direction, InfoMap &infoMap, 5828 ProgramInfo *prog) const 5829 { 5830 uint chanid = infoMap["chanid"].toUInt(); 5831 if (!chanid) 5832 chanid = GetChanIDAnyTuner(infoMap["channum"]); 5833 5834 int chandir = -1; 5835 switch(direction) 5836 { 5837 case BROWSE_UP: chandir = CHANNEL_DIRECTION_UP; break; 5838 case BROWSE_DOWN: chandir = CHANNEL_DIRECTION_DOWN; break; 5839 case BROWSE_FAVORITE: chandir = CHANNEL_DIRECTION_FAVORITE; break; 5840 }; 5841 if (direction != -1) 5842 chanid = ChannelUtil::GetNextChannel(allchannels, chanid, 0, chandir); 5843 5844 infoMap["chanid"] = QString("%1").arg(chanid); 5845 infoMap["channum"] = GetChanNumAnyTuner(chanid); 5846 5847 QDateTime nowtime = QDateTime::currentDateTime(); 5848 QDateTime latesttime = nowtime.addSecs(6*60*60); 5849 QDateTime browsetime = QDateTime::fromString(infoMap["dbstarttime"], Qt::ISODate); 5850 5851 MSqlBindings bindings; 5852 bindings[":CHANID"] = chanid; 5853 bindings[":NOWTS"] = nowtime.toString("yyyy-MM-ddThh:mm:ss"); 5854 bindings[":LATESTTS"] = latesttime.toString("yyyy-MM-ddThh:mm:ss"); 5855 bindings[":BROWSETS"] = browsetime.toString("yyyy-MM-ddThh:mm:ss"); 5856 bindings[":BROWSETS2"] = browsetime.toString("yyyy-MM-ddThh:mm:ss"); 5857 5858 QString querystr = " WHERE program.chanid = :CHANID "; 5859 switch(direction) 5860 { 5861 case BROWSE_LEFT: 5862 querystr += " AND program.endtime <= :BROWSETS " 5863 " AND program.endtime > :NOWTS "; 5864 break; 5865 5866 case BROWSE_RIGHT: 5867 querystr += " AND program.starttime > :BROWSETS " 5868 " AND program.starttime < :LATESTTS "; 5869 break; 5870 5871 default: 5872 querystr += " AND program.starttime <= :BROWSETS " 5873 " AND program.endtime > :BROWSETS2 "; 5874 }; 5875 5876 ProgramList progList; 5877 progList.FromProgram(querystr, bindings); 5878 5879 if (progList.isEmpty()) 5880 { 5881 infoMap["dbstarttime"] = ""; 5882 return; 5883 }; 5884 5885 prog = (direction == BROWSE_LEFT) ? progList.take(progList.count() - 1) 5886 : progList.take(0); 5887 5888 infoMap["dbstarttime"] = prog->startts.toString(Qt::ISODate); 5889 } 5890 5802 5891 void TV::EmbedOutput(WId wid, int x, int y, int w, int h) 5803 5892 { 5804 5893 embedWinID = wid; … … 6645 6734 infoMap["channum"] = browsechannum; 6646 6735 infoMap["chanid"] = browsechanid; 6647 6736 6648 GetNextProgram(activerecorder, direction, infoMap); 6737 ProgramInfo *program_info = NULL; 6738 if (browsealltuners) 6739 GetNextProgramAnyTuner(direction, infoMap, program_info); 6740 else 6741 GetNextProgram(activerecorder, direction, infoMap); 6649 6742 6650 6743 browsechannum = infoMap["channum"]; 6651 6744 browsechanid = infoMap["chanid"]; … … 6656 6749 browsestarttime = infoMap["dbstarttime"]; 6657 6750 } 6658 6751 6659 QDateTime startts = QDateTime::fromString(browsestarttime, Qt::ISODate); 6660 ProgramInfo *program_info = 6661 ProgramInfo::GetProgramAtDateTime(browsechanid, startts); 6752 if (!program_info) 6753 { 6754 QDateTime startts = QDateTime::fromString(browsestarttime, Qt::ISODate); 6755 program_info = 6756 ProgramInfo::GetProgramAtDateTime(browsechanid, startts); 6757 } 6662 6758 6663 6759 if (program_info) 6664 6760 program_info->ToMap(infoMap); 6665 6761 6762 if (browsealltuners && !IsTunable(browsechanid.toUInt())) 6763 infoMap["channum"] = "x" + infoMap["channum"]; 6764 6666 6765 GetOSD()->ClearAllText("browse_info"); 6667 6766 GetOSD()->SetText("browse_info", infoMap, -1); 6668 6767 … … 6760 6859 6761 6860 void TV::BrowseChannel(const QString &chan) 6762 6861 { 6763 if (!activerecorder->CheckChannel(chan)) 6862 if (browsealltuners) 6863 { 6864 if (!GetChanIDAnyTuner(chan)) 6865 return; 6866 } 6867 else if (!activerecorder->CheckChannel(chan)) 6764 6868 return; 6765 6869 6766 6870 browsechannum = chan; -
libs/libmythtv/tv_play.h
diff -Naur mythtv/libs/libmythtv/tv_play.h mythtv-browsepatch/libs/libmythtv/tv_play.h
old new 226 226 void SetCurrentlyPlaying(ProgramInfo *pginfo); 227 227 228 228 void GetNextProgram(RemoteEncoder *enc, int direction, 229 InfoMap &infoMap) ;229 InfoMap &infoMap) const; 230 230 231 231 // static functions 232 232 static void InitKeys(void); … … 406 406 void ToggleRecord(void); 407 407 void BrowseChannel(const QString &channum); 408 408 409 uint GetChanIDAnyTuner(const QString &chan) const; 410 QString GetChanNumAnyTuner(const uint &chanid) const; 411 void GetNextProgramAnyTuner(int direction, InfoMap &infoMap, 412 ProgramInfo *prog) const; 413 409 414 void DoTogglePictureAttribute(PictureAdjustType type); 410 415 void DoChangePictureAttribute( 411 416 PictureAdjustType type, PictureAttribute attr, bool up); … … 600 605 QString browsechannum; 601 606 QString browsechanid; 602 607 QString browsestarttime; 608 bool browsealltuners; 609 DBChanList allchannels; 603 610 604 611 // Program Info for currently playing video 605 612 // (or next video if InChangeState() is true) -
programs/mythfrontend/globalsettings.cpp
diff -Naur mythtv/programs/mythfrontend/globalsettings.cpp mythtv-browsepatch/programs/mythfrontend/globalsettings.cpp
old new 1981 1981 return gc; 1982 1982 } 1983 1983 1984 static HostCheckBox *BrowseAllTuners() 1985 { 1986 HostCheckBox *gc = new HostCheckBox("BrowseAllTuners"); 1987 gc->setLabel(QObject::tr("Browse channels from all tuners")); 1988 gc->setValue(true); 1989 gc->setHelpText(QObject::tr("By default, browse mode only shows channels " 1990 "on the currently active tuner. If enabled, browse mode " 1991 "will shows all channels, no matter what tuner they " 1992 "exist on.")); 1993 return gc; 1994 } 1995 1984 1996 static HostCheckBox *AggressiveBuffer() 1985 1997 { 1986 1998 HostCheckBox *gc = new HostCheckBox("AggressiveSoundcardBuffer"); … … 4795 4807 osd->addChild(OSDThemeFontSizeType()); 4796 4808 osd->addChild(EnableMHEG()); 4797 4809 osd->addChild(PersistentBrowseMode()); 4810 osd->addChild(BrowseAllTuners()); 4798 4811 addChild(osd); 4799 4812 4800 4813 VerticalConfigurationGroup *udp = new VerticalConfigurationGroup(false);