Ticket #4501: 4501-v1.patch
| File 4501-v1.patch, 8.5 KB (added by danielk, 3 years ago) |
|---|
-
libs/libmythtv/tv_play.h
250 250 bool isDVD, bool isDVDStillFrame); 251 251 252 252 void GetNextProgram(RemoteEncoder *enc, int direction, 253 InfoMap &infoMap) ;253 InfoMap &infoMap) const; 254 254 255 255 // static functions 256 256 static void InitKeys(void); … … 494 494 495 495 void ToggleRecord(PlayerContext*); 496 496 497 uint GetChanIDAnyTuner(const QString &chan) const; 498 QString GetChanNumAnyTuner(const uint &chanid) const; 499 void GetNextProgramAnyTuner(int direction, InfoMap &infoMap, 500 ProgramInfo *prog) const; 501 497 502 void DoTogglePictureAttribute(const PlayerContext*, 498 503 PictureAdjustType type); 499 504 void DoChangePictureAttribute( … … 682 687 QString browsechannum; 683 688 QString browsechanid; 684 689 QString browsestarttime; 690 bool browsealltuners; 691 DBChanList allchannels; 685 692 686 693 // Program Info for currently playing video 687 694 // (or next video if InChangeState() is true) -
libs/libmythtv/tv_play.cpp
654 654 // channel browsing state variables 655 655 browsemode(false), persistentbrowsemode(false), 656 656 browsechannum(""), browsechanid(""), browsestarttime(""), 657 browsealltuners(false), 657 658 // Program Info for currently playing video 658 659 lastProgram(NULL), 659 660 inPlaylist(false), underNetworkControl(false), … … 759 760 ff_rew_speeds.push_back( 760 761 gContext->GetNumSetting(QString("FFRewSpeed%1").arg(i), def[i])); 761 762 763 browsealltuners = gContext->GetNumSetting("BrowseAllTuners", 0); 764 if (browsealltuners) 765 { 766 QString channelOrdering = gContext->GetSetting( 767 "ChannelOrdering", "channum"); 768 allchannels = ChannelUtil::GetChannels(0, true, "channum, callsign"); 769 ChannelUtil::SortChannels(allchannels, channelOrdering, true); 770 } 771 762 772 vbimode = VBIMode::Parse(gContext->GetSetting("VbiFormat")); 763 773 QString feVBI = gContext->GetSetting("DecodeVBIFormat", ""); 764 774 if (!feVBI.isEmpty()) … … 7135 7145 * \param infoMap InfoMap to fill in with returned data 7136 7146 */ 7137 7147 void TV::GetNextProgram(RemoteEncoder *enc, int direction, 7138 InfoMap &infoMap) 7148 InfoMap &infoMap) const 7139 7149 { 7140 7150 QString title, subtitle, desc, category, endtime, callsign, iconpath; 7141 7151 QDateTime begts, endts; … … 7146 7156 QString seriesid = infoMap["seriesid"]; 7147 7157 QString programid = infoMap["programid"]; 7148 7158 7149 PlayerContext *actx = NULL;7159 const PlayerContext *actx = NULL; 7150 7160 if (!enc) 7151 7161 { 7152 7162 actx = GetPlayerReadLock(-1, __FILE__, __LINE__); … … 7354 7364 embedCheckTimerId = 0; 7355 7365 } 7356 7366 7367 uint TV::GetChanIDAnyTuner(const QString &chan) const 7368 { 7369 for (uint i = 0; i < allchannels.size(); ++i) 7370 { 7371 if (allchannels[i].channum == chan) 7372 return allchannels[i].chanid; 7373 } 7374 return 0; 7375 } 7376 7377 QString TV::GetChanNumAnyTuner(const uint &chanid) const 7378 { 7379 for (uint i = 0; i < allchannels.size(); ++i) 7380 { 7381 if (allchannels[i].chanid == chanid) 7382 return allchannels[i].channum; 7383 } 7384 return ""; 7385 } 7386 7387 void TV::GetNextProgramAnyTuner(int direction, InfoMap &infoMap, 7388 ProgramInfo *prog) const 7389 { 7390 uint chanid = infoMap["chanid"].toUInt(); 7391 if (!chanid) 7392 chanid = GetChanIDAnyTuner(infoMap["channum"]); 7393 7394 int chandir = -1; 7395 switch (direction) 7396 { 7397 case BROWSE_UP: chandir = CHANNEL_DIRECTION_UP; break; 7398 case BROWSE_DOWN: chandir = CHANNEL_DIRECTION_DOWN; break; 7399 case BROWSE_FAVORITE: chandir = CHANNEL_DIRECTION_FAVORITE; break; 7400 } 7401 if (direction != -1) 7402 chanid = ChannelUtil::GetNextChannel(allchannels, chanid, 0, chandir); 7403 7404 infoMap["chanid"] = QString("%1").arg(chanid); 7405 infoMap["channum"] = GetChanNumAnyTuner(chanid); 7406 7407 QDateTime nowtime = QDateTime::currentDateTime(); 7408 QDateTime latesttime = nowtime.addSecs(6*60*60); 7409 QDateTime browsetime = QDateTime::fromString( 7410 infoMap["dbstarttime"], Qt::ISODate); 7411 7412 MSqlBindings bindings; 7413 bindings[":CHANID"] = chanid; 7414 bindings[":NOWTS"] = nowtime.toString("yyyy-MM-ddThh:mm:ss"); 7415 bindings[":LATESTTS"] = latesttime.toString("yyyy-MM-ddThh:mm:ss"); 7416 bindings[":BROWSETS"] = browsetime.toString("yyyy-MM-ddThh:mm:ss"); 7417 bindings[":BROWSETS2"] = browsetime.toString("yyyy-MM-ddThh:mm:ss"); 7418 7419 QString querystr = " WHERE program.chanid = :CHANID "; 7420 switch (direction) 7421 { 7422 case BROWSE_LEFT: 7423 querystr += " AND program.endtime <= :BROWSETS " 7424 " AND program.endtime > :NOWTS "; 7425 break; 7426 7427 case BROWSE_RIGHT: 7428 querystr += " AND program.starttime > :BROWSETS " 7429 " AND program.starttime < :LATESTTS "; 7430 break; 7431 7432 default: 7433 querystr += " AND program.starttime <= :BROWSETS " 7434 " AND program.endtime > :BROWSETS2 "; 7435 }; 7436 7437 ProgramList progList; 7438 progList.FromProgram(querystr, bindings); 7439 7440 if (progList.isEmpty()) 7441 { 7442 infoMap["dbstarttime"] = ""; 7443 return; 7444 } 7445 7446 prog = (direction == BROWSE_LEFT) ? 7447 progList[progList.size() - 1] : progList[0]; 7448 7449 infoMap["dbstarttime"] = prog->startts.toString(Qt::ISODate); 7450 } 7451 7357 7452 void TV::DrawUnusedRects(bool sync, PlayerContext *ctx) 7358 7453 { 7359 7454 VERBOSE(VB_IMPORTANT, LOC + "DrawUnusedRects() -- begin"); … … 8411 8506 infoMap["channum"] = browsechannum; 8412 8507 infoMap["chanid"] = browsechanid; 8413 8508 8414 if (ctx->recorder) 8509 ProgramInfo *program_info = NULL; 8510 if (ctx->recorder && !browsealltuners) 8415 8511 GetNextProgram(ctx->recorder, direction, infoMap); 8512 else 8513 GetNextProgramAnyTuner(direction, infoMap, program_info); 8416 8514 8417 8515 browsechannum = infoMap["channum"]; 8418 8516 browsechanid = infoMap["chanid"]; … … 8423 8521 browsestarttime = infoMap["dbstarttime"]; 8424 8522 } 8425 8523 8426 QDateTime startts = QDateTime::fromString(browsestarttime, Qt::ISODate); 8427 ProgramInfo *program_info = 8428 ProgramInfo::GetProgramAtDateTime(browsechanid, startts); 8524 if (!program_info) 8525 { 8526 QDateTime startts = QDateTime::fromString( 8527 browsestarttime, Qt::ISODate); 8528 program_info = 8529 ProgramInfo::GetProgramAtDateTime(browsechanid, startts); 8530 } 8429 8531 8430 8532 if (program_info) 8431 8533 program_info->ToMap(infoMap); 8432 8534 8535 if (browsealltuners && !IsTunable(ctx, browsechanid.toUInt())) 8536 infoMap["channum"] = "x" + infoMap["channum"]; 8537 8433 8538 osd->ClearAllText("browse_info"); 8434 8539 osd->SetText("browse_info", infoMap, -1); 8435 8540 … … 8503 8608 8504 8609 void TV::BrowseChannel(PlayerContext *ctx, const QString &chan) 8505 8610 { 8506 if ( !ctx->recorder || !ctx->recorder->CheckChannel(chan))8611 if (browsealltuners && !GetChanIDAnyTuner(chan)) 8507 8612 return; 8613 else if (!ctx->recorder || !ctx->recorder->CheckChannel(chan)) 8614 return; 8508 8615 8509 8616 browsechannum = chan; 8510 8617 browsechanid = QString::null; -
programs/mythfrontend/globalsettings.cpp
1982 1982 return gc; 1983 1983 } 1984 1984 1985 static HostCheckBox *BrowseAllTuners() 1986 { 1987 HostCheckBox *gc = new HostCheckBox("BrowseAllTuners"); 1988 gc->setLabel(QObject::tr("Browse channels from all tuners")); 1989 gc->setValue(true); 1990 gc->setHelpText(QObject::tr("By default, browse mode only shows channels " 1991 "on the currently active tuner. If enabled, browse mode " 1992 "will shows all channels, no matter what tuner they " 1993 "exist on.")); 1994 return gc; 1995 } 1996 1985 1997 static HostCheckBox *AggressiveBuffer() 1986 1998 { 1987 1999 HostCheckBox *gc = new HostCheckBox("AggressiveSoundcardBuffer"); … … 4830 4842 osd->addChild(OSDThemeFontSizeType()); 4831 4843 osd->addChild(EnableMHEG()); 4832 4844 osd->addChild(PersistentBrowseMode()); 4845 osd->addChild(BrowseAllTuners()); 4833 4846 addChild(osd); 4834 4847 4835 4848 VerticalConfigurationGroup *udp = new VerticalConfigurationGroup(false);
