Ticket #2978: prompt_livetv_exit_r12644-with-new-fns.diff

File prompt_livetv_exit_r12644-with-new-fns.diff, 7.2 KB (added by Neil McBride <neil@…>, 17 years ago)
  • libs/libmythtv/tv_play.h

     
    131131    void PromptStopWatchingRecording(void);
    132132    void PromptDeleteRecording(QString title);
    133133    bool PromptRecGroupPassword(void);
    134    
     134    bool BookmarkAllowed(void);
     135    bool DeleteAllowed(void);
    135136
    136137    // Boolean queries
    137138
  • libs/libmythtv/tv_play.cpp

     
    23622362                {
    23632363                    int result = GetOSD()->GetDialogResponse(dialogname);
    23642364
     2365                    if (result > 1)
     2366                    {
     2367                        if (!BookmarkAllowed())
     2368                            result++;
     2369                        if (result > 2 && !DeleteAllowed())
     2370                            result++;
     2371                    }
     2372
    23652373                    switch (result)
    23662374                    {
    2367                         case 0: case 3:
     2375                        case 0: case 4:
    23682376                            DoPause();
    23692377                            break;
    2370                         case 1:
     2378                        case 2:
    23712379                            nvp->SetBookmark();
    23722380                            exitPlayer = true;
    23732381                            wantsToQuit = true;
    23742382                            break;
    2375                         case 4:
     2383                        case 3:
    23762384                            dialogname = "";
    23772385                            DoPause();
    23782386                            PromptDeleteRecording(
     
    23842392                            break;
    23852393                    }
    23862394                }
    2387                 else if (dialogname == "videoexitplayoptions")
    2388                 {
    2389                     int result = GetOSD()->GetDialogResponse(dialogname);
    2390 
    2391                     switch (result)
    2392                     {
    2393                         case 0: case 1:
    2394                             DoPause();
    2395                             break;
    2396                         default:
    2397                             exitPlayer = true;
    2398                             wantsToQuit = true;
    2399                             break;
    2400                     }
    2401                 }
    24022395                else if (dialogname == "askdeleterecording")
    24032396                {
    24042397                    int result = GetOSD()->GetDialogResponse(dialogname);
     
    27802773
    27812774            if (StateIsLiveTV(GetState()))
    27822775            {
    2783                 if (nvp && gContext->GetNumSetting("PlaybackExitPrompt") == 2)
    2784                     nvp->SetBookmark();
    2785                 if (nvp && gContext->GetNumSetting("AutomaticSetWatched", 0))
    2786                     nvp->SetWatched();
    2787                 exitPlayer = true;
    2788                 wantsToQuit = true;
     2776                if (nvp && 12 & gContext->GetNumSetting("PlaybackExitPrompt"))
     2777                    PromptStopWatchingRecording();
     2778                else
     2779                {
     2780                    exitPlayer = true;
     2781                    wantsToQuit = true;
     2782                }
    27892783            }
    27902784            else
    27912785            {
    2792                 if (nvp && gContext->GetNumSetting("PlaybackExitPrompt") == 1 &&
     2786                if (nvp && 5 & gContext->GetNumSetting("PlaybackExitPrompt") &&
    27932787                    !underNetworkControl && !prbuffer->InDVDMenuOrStillFrame())
    27942788                {
    27952789                    PromptStopWatchingRecording();
     
    74577451    }
    74587452}
    74597453
     7454/* \fn TV::BookmarkAllowed(void)
     7455 * \brief Returns true if bookmarks are allowed for the current player.
     7456 */
     7457bool TV::BookmarkAllowed(void)
     7458{
     7459    if ((prbuffer->isDVD() && (!gContext->GetNumSetting("EnableDVDBookmark", 0)
     7460        || prbuffer->DVD()->GetTotalTimeOfTitle() < 120)) ||
     7461        StateIsLiveTV(GetState()) ||
     7462        (playbackinfo->isVideo && !prbuffer->isDVD()))
     7463        return false;
    74607464
     7465    return true;
     7466}
     7467
     7468/* \fn TV::DeleteAllowed(void)
     7469 * \brief Returns true if the delete menu option should be offered.
     7470 */
     7471bool TV::DeleteAllowed(void)
     7472{
     7473    if (prbuffer->isDVD() || StateIsLiveTV(GetState()))
     7474        return false;
     7475    return true;
     7476}
     7477
    74617478void
    74627479TV::PromptStopWatchingRecording(void)
    74637480{
     
    74687485   
    74697486    dialogboxTimer.restart();
    74707487    QString message;
     7488    QString videotype;
    74717489    QStringList options;
    7472     bool allowbookmark = true;
    7473     bool allowdvdbookmark = gContext->GetNumSetting("EnableDVDBookmark", 0);
    7474     if (prbuffer->isDVD())
    7475     {
    7476         if (!allowdvdbookmark ||
    7477             prbuffer->DVD()->GetTotalTimeOfTitle() < 120)
    7478         {
    7479             allowbookmark = false;
    7480         }
    7481     }
     7490
     7491    if (StateIsLiveTV(GetState()))
     7492        videotype = "Live TV";
     7493    else if (prbuffer->isDVD())
     7494        videotype = "this DVD";
    74827495    else if (playbackinfo->isVideo)
    7483         allowbookmark = false;
     7496        videotype = "this video";
     7497    else
     7498        videotype = "this recording";
     7499
     7500    message = tr("You are exiting %1").arg(videotype);
    74847501   
    7485     if (playbackinfo && allowbookmark)
     7502    options += tr("Exit to the menu");
     7503
     7504    if (playbackinfo && BookmarkAllowed())
    74867505    {
    7487         QString videotype = (prbuffer->isDVD()) ? "DVD":"recording";
    7488         message = tr("You are exiting this %1").arg(videotype);
    7489 
    7490         options += tr("Save this position and go to the menu");
    7491         options += tr("Do not save, just exit to the menu");
    7492         options += tr("Keep watching");
    7493         if (!prbuffer->isDVD())
     7506        if(BookmarkAllowed())
     7507            options += tr("Save this position and go to the menu");
     7508        if(DeleteAllowed())
    74947509            options += tr("Delete this recording");
    7495 
    7496         dialogname = "exitplayoptions";
    74977510    }
    7498     else
    7499     {
    75007511
    7501         message = tr("You are exiting this Video/DVD");
    7502        
    7503         options += tr("Keep Watching");
    7504         options += tr("Exit Video");
    7505        
    7506         dialogname = "videoexitplayoptions";
    7507     }
     7512    options += tr("Keep watching");
     7513    dialogname = "exitplayoptions";
    75087514
    75097515    if (GetOSD())
    75107516        GetOSD()->NewDialogBox(dialogname, message, options, 0);
     
    75617567        return false;
    75627568   
    75637569    return (dialogname == "askdeleterecording" ||
    7564             dialogname == "exitplayoptions"    ||
    7565             dialogname == "videoexitplayoptions");
     7570            dialogname == "exitplayoptions");
    75667571}
    75677572
    75687573void TV::setLastProgram(ProgramInfo *rcinfo)
  • programs/mythfrontend/globalsettings.cpp

     
    12411241    gc->setLabel(QObject::tr("Action on playback exit"));
    12421242    gc->addSelection(QObject::tr("Just exit"), "0");
    12431243    gc->addSelection(QObject::tr("Save position and exit"), "2");
    1244     gc->addSelection(QObject::tr("Always prompt"), "1");
     1244    gc->addSelection(QObject::tr("Always prompt (excluding Live TV)"), "1");
     1245    gc->addSelection(QObject::tr("Always prompt (including Live TV)"), "4");
     1246    gc->addSelection(QObject::tr("Prompt for Live TV only"), "8");
    12451247    gc->setHelpText(QObject::tr("If set to prompt, a menu will be displayed "
    12461248                    "when you exit playback mode.  The options available will "
    12471249                    "allow you to save your position, delete the "