コード例 #1
0
/**
*  \brief Creates a dialog displaying current recording status and options
*         available
*/
void ScheduleCommon::ShowRecordingDialog(const RecordingInfo& recinfo)
{
    QString message = recinfo.toString(ProgramInfo::kTitleSubtitle, " - ");

    message += "\n\n";
    message += toDescription(recinfo.GetRecordingStatus(),
                             recinfo.GetRecordingRuleType(),
                             recinfo.GetRecordingStartTime());

    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
    MythDialogBox *menuPopup = new MythDialogBox(message, popupStack,
                                                 "recOptionPopup", true);

    if (menuPopup->Create())
    {
        menuPopup->SetReturnEvent(this, "schedulerecording");

        QDateTime now = MythDate::current();

        if (recinfo.GetRecordingStartTime() < now &&
            recinfo.GetRecordingEndTime() > now)
        {
            if (recinfo.GetRecordingStatus() != rsRecording &&
                recinfo.GetRecordingStatus() != rsTuning &&
                recinfo.GetRecordingStatus() != rsOtherRecording && 
                recinfo.GetRecordingStatus() != rsOtherTuning)
                menuPopup->AddButton(tr("Restart recording this showing"),
                                     qVariantFromValue(recinfo));
            else
                menuPopup->AddButton(tr("Stop recording this showing"),
                                     qVariantFromValue(recinfo));
        }

        if (recinfo.GetRecordingEndTime() > now)
        {
            if (recinfo.GetRecordingRuleType() != kSingleRecord &&
                recinfo.GetRecordingRuleType() != kOverrideRecord)
            {
                if (recinfo.GetRecordingStartTime() > now)
                {
                    menuPopup->AddButton(tr("Don't record this showing"),
                                         qVariantFromValue(recinfo));
                }

                const RecordingDupMethodType dupmethod =
                    recinfo.GetDuplicateCheckMethod();

                if (recinfo.GetRecordingStatus() != rsRecording &&
                    recinfo.GetRecordingStatus() != rsTuning &&
                    recinfo.GetRecordingStatus() != rsOtherRecording &&
                    recinfo.GetRecordingStatus() != rsOtherTuning &&
                    recinfo.GetRecordingRuleType() != kOneRecord &&
                    !((recinfo.GetFindID() == 0 ||
                       !IsFindApplicable(recinfo)) &&
                      recinfo.GetCategoryType() == "series" &&
                      recinfo.GetProgramID().contains(QRegExp("0000$"))) &&
                    ((!(dupmethod & kDupCheckNone) &&
                      !recinfo.GetProgramID().isEmpty() &&
                      (recinfo.GetFindID() != 0 ||
                       !IsFindApplicable(recinfo))) ||
                     ((dupmethod & kDupCheckSub) &&
                      !recinfo.GetSubtitle().isEmpty()) ||
                     ((dupmethod & kDupCheckDesc) &&
                      !recinfo.GetDescription().isEmpty()) ||
                     ((dupmethod & kDupCheckSubThenDesc) &&
                      (!recinfo.GetSubtitle().isEmpty() ||
                       !recinfo.GetDescription().isEmpty())) ))
                    {
                        menuPopup->AddButton(tr("Never record this episode"),
                                             qVariantFromValue(recinfo));
                    }
            }

            if (recinfo.GetRecordingRuleType() != kOverrideRecord &&
                recinfo.GetRecordingRuleType() != kDontRecord)
            {
                if (recinfo.GetRecordingStatus() == rsRecording ||
                    recinfo.GetRecordingStatus() == rsTuning ||
                    recinfo.GetRecordingStatus() == rsOtherRecording ||
                    recinfo.GetRecordingStatus() == rsOtherTuning)
                {
                    menuPopup->AddButton(tr("Edit options for this showing"),
                                         qVariantFromValue(recinfo));
                }
                else
                {
                    if (recinfo.GetRecordingRuleType() != kSingleRecord)
                    {
                        menuPopup->AddButton(tr("Override this showing with options"),
                                             qVariantFromValue(recinfo));
                    }

                }
            }

            if (recinfo.GetRecordingRuleType() == kOverrideRecord ||
                recinfo.GetRecordingRuleType() == kDontRecord)
            {
                if (recinfo.GetRecordingStatus() == rsRecording ||
                    recinfo.GetRecordingStatus() == rsTuning ||
                    recinfo.GetRecordingStatus() == rsOtherRecording ||
                    recinfo.GetRecordingStatus() == rsOtherTuning)
                {
                    menuPopup->AddButton(tr("Edit options for this showing"),
                                         qVariantFromValue(recinfo));
                }
                else
                {
                    menuPopup->AddButton(tr("Edit override options"),
                                         qVariantFromValue(recinfo));
                    menuPopup->AddButton(tr("Delete override rule"),
                                         qVariantFromValue(recinfo));
                }
            }
        }

        if (recinfo.GetRecordingRuleType() != kOverrideRecord &&
            recinfo.GetRecordingRuleType() != kDontRecord)
        {
            menuPopup->AddButton(tr("Edit recording options"),
                                 qVariantFromValue(recinfo));
            menuPopup->AddButton(tr("Delete recording rule"),
                                 qVariantFromValue(recinfo));
        }

        popupStack->AddScreen(menuPopup);
    }
    else
        delete menuPopup;
}
コード例 #2
0
/**
*  \brief Creates a dialog displaying current recording status and options
*         available
*/
void ScheduleCommon::ShowNotRecordingDialog(const RecordingInfo& recinfo)
{
    QString timeFormat = gCoreContext->GetSetting("TimeFormat", "h:mm AP");

    QString message = recinfo.toString(ProgramInfo::kTitleSubtitle, " - ");

    message += "\n\n";
    message += toDescription(recinfo.GetRecordingStatus(),
                             recinfo.GetRecordingRuleType(),
                             recinfo.GetRecordingStartTime());

    if (recinfo.GetRecordingStatus() == rsConflict ||
        recinfo.GetRecordingStatus() == rsLaterShowing)
    {
        vector<ProgramInfo *> *confList = RemoteGetConflictList(&recinfo);

        if (!confList->empty())
        {
            message += " ";
            message += tr("The following programs will be recorded instead:");
            message += "\n";
        }

        uint maxi = 0;
        for (; confList->begin() != confList->end() && maxi < 4; maxi++)
        {
            ProgramInfo *p = *confList->begin();
            message += QString("%1 - %2  %3\n")
                .arg(p->GetRecordingStartTime()
                     .toLocalTime().toString(timeFormat))
                .arg(p->GetRecordingEndTime()
                     .toLocalTime().toString(timeFormat))
                .arg(p->toString(ProgramInfo::kTitleSubtitle, " - "));
            delete p;
            confList->erase(confList->begin());
        }
        message += "\n";
        while (!confList->empty())
        {
            delete confList->back();
            confList->pop_back();
        }
        delete confList;
    }

    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
    MythDialogBox *menuPopup = new MythDialogBox(message, popupStack,
                                                 "notRecOptionPopup", true);

    if (menuPopup->Create())
    {
        menuPopup->SetReturnEvent(this, "schedulenotrecording");

        QDateTime now = MythDate::current();

        if ((recinfo.GetRecordingStartTime() < now) &&
            (recinfo.GetRecordingEndTime() > now) &&
            (recinfo.GetRecordingStatus() != rsDontRecord) &&
            (recinfo.GetRecordingStatus() != rsNotListed))
        {
            menuPopup->AddButton(tr("Restart recording this showing"),
                                 qVariantFromValue(recinfo));
        }

        if (recinfo.GetRecordingEndTime() > now)
        {
            if ((recinfo.GetRecordingRuleType() != kSingleRecord &&
                recinfo.GetRecordingRuleType() != kOverrideRecord) &&
                (recinfo.GetRecordingStatus() == rsDontRecord ||
                recinfo.GetRecordingStatus() == rsPreviousRecording ||
                recinfo.GetRecordingStatus() == rsCurrentRecording ||
                recinfo.GetRecordingStatus() == rsEarlierShowing ||
                recinfo.GetRecordingStatus() == rsNeverRecord ||
                recinfo.GetRecordingStatus() == rsRepeat ||
                recinfo.GetRecordingStatus() == rsInactive ||
                recinfo.GetRecordingStatus() == rsLaterShowing))
            {
                menuPopup->AddButton(tr("Record this showing anyway"),
                                    qVariantFromValue(recinfo));
                if (recinfo.GetRecordingStatus() == rsPreviousRecording ||
                    recinfo.GetRecordingStatus() == rsNeverRecord)
                {
                    menuPopup->AddButton(tr("Forget previous recording"),
                                        qVariantFromValue(recinfo));
                }
            }

            if (recinfo.GetRecordingRuleType() != kOverrideRecord &&
                recinfo.GetRecordingRuleType() != kDontRecord)
            {
                if (recinfo.GetRecordingRuleType() != kSingleRecord &&
                    recinfo.GetRecordingStatus() != rsPreviousRecording &&
                    recinfo.GetRecordingStatus() != rsCurrentRecording &&
                    recinfo.GetRecordingStatus() != rsNeverRecord &&
                    recinfo.GetRecordingStatus() != rsNotListed)
                {
                    if (recinfo.GetRecordingStartTime() > now)
                    {
                        menuPopup->AddButton(tr("Don't record this showing"),
                                            qVariantFromValue(recinfo));
                    }

                    const RecordingDupMethodType dupmethod =
                        recinfo.GetDuplicateCheckMethod();

                    if (recinfo.GetRecordingRuleType() != kOneRecord &&
                        !((recinfo.GetFindID() == 0 ||
                           !IsFindApplicable(recinfo)) &&
                          recinfo.GetCategoryType() == "series" &&
                          recinfo.GetProgramID().contains(QRegExp("0000$"))) &&
                        ((!(dupmethod & kDupCheckNone) &&
                          !recinfo.GetProgramID().isEmpty() &&
                          (recinfo.GetFindID() != 0 ||
                           !IsFindApplicable(recinfo))) ||
                         ((dupmethod & kDupCheckSub) &&
                          !recinfo.GetSubtitle().isEmpty()) ||
                         ((dupmethod & kDupCheckDesc) &&
                          !recinfo.GetDescription().isEmpty()) ||
                         ((dupmethod & kDupCheckSubThenDesc) &&
                          (!recinfo.GetSubtitle().isEmpty() ||
                           !recinfo.GetDescription().isEmpty())) ))
                        {
                            menuPopup->AddButton(tr("Never record this episode"),
                                                 qVariantFromValue(recinfo));
                        }
                }

                if (recinfo.GetRecordingRuleType() != kSingleRecord &&
                    recinfo.GetRecordingRuleType() != kOneRecord &&
                    recinfo.GetRecordingStatus() != rsNotListed)
                {
                    menuPopup->AddButton(tr("Override this showing with options"),
                                        qVariantFromValue(recinfo));
                }

                menuPopup->AddButton(tr("Edit recording options"),
                                     qVariantFromValue(recinfo));
                menuPopup->AddButton(tr("Delete recording rule"),
                                     qVariantFromValue(recinfo));
            }

            if (recinfo.GetRecordingRuleType() == kOverrideRecord ||
                recinfo.GetRecordingRuleType() == kDontRecord)
            {
                menuPopup->AddButton(tr("Edit override options"),
                                    qVariantFromValue(recinfo));
                menuPopup->AddButton(tr("Delete override rule"),
                                    qVariantFromValue(recinfo));
            }
        }

        popupStack->AddScreen(menuPopup);
    }
    else
        delete menuPopup;
}
コード例 #3
0
ファイル: serviceUtil.cpp プロジェクト: adicarlo/mythtv
void FillProgramInfo( DTC::Program *pProgram,
                      ProgramInfo  *pInfo,
                      bool          bIncChannel /* = true */,
                      bool          bDetails    /* = true */,
                      bool          bIncCast    /* = true */)
{
    if ((pProgram == NULL) || (pInfo == NULL))
        return;

    pProgram->setStartTime (  pInfo->GetScheduledStartTime());
    pProgram->setEndTime   (  pInfo->GetScheduledEndTime  ());
    pProgram->setTitle     (  pInfo->GetTitle()             );
    pProgram->setSubTitle  (  pInfo->GetSubtitle()          );
    pProgram->setCategory  (  pInfo->GetCategory()          );
    pProgram->setCatType   (  pInfo->GetCategoryTypeString());
    pProgram->setRepeat    (  pInfo->IsRepeat()             );
    pProgram->setVideoProps(  pInfo->GetVideoProperties()   );
    pProgram->setAudioProps(  pInfo->GetAudioProperties()   );
    pProgram->setSubProps  (  pInfo->GetSubtitleType()      );

    pProgram->setSerializeDetails( bDetails );

    if (bDetails)
    {
        pProgram->setSeriesId    ( pInfo->GetSeriesID()         );
        pProgram->setProgramId   ( pInfo->GetProgramID()        );
        pProgram->setStars       ( pInfo->GetStars()            );
        pProgram->setLastModified( pInfo->GetLastModifiedTime() );
        pProgram->setProgramFlags( pInfo->GetProgramFlags()     );

        // ----
        // DEPRECATED - See RecordingInfo instead
        pProgram->setFileName    ( pInfo->GetPathname()         );
        pProgram->setFileSize    ( pInfo->GetFilesize()         );
        pProgram->setHostName    ( pInfo->GetHostname()         );
        // ----

        if (pInfo->GetOriginalAirDate().isValid())
            pProgram->setAirdate( pInfo->GetOriginalAirDate() );
        else if (pInfo->GetYearOfInitialRelease() > 0)
        {
            QDate year;
            year.setDate(pInfo->GetYearOfInitialRelease(), 1, 1);
            pProgram->setAirdate( year );
        }

        pProgram->setDescription( pInfo->GetDescription() );
        pProgram->setInetref    ( pInfo->GetInetRef()     );
        pProgram->setSeason     ( pInfo->GetSeason()      );
        pProgram->setEpisode    ( pInfo->GetEpisode()     );
        pProgram->setTotalEpisodes( pInfo->GetEpisodeTotal() );
    }

    pProgram->setSerializeCast(bIncCast);
    if (bIncCast)
    {
        FillCastMemberList( pProgram->Cast(), pInfo );
    }

    pProgram->setSerializeChannel( bIncChannel );

    if ( bIncChannel )
    {
        // Build Channel Child Element
        if (!FillChannelInfo( pProgram->Channel(), pInfo->GetChanID(), bDetails ))
        {
            // The channel associated with a given recording may no longer exist
            // however the ChanID is one half of the unique identifier for the
            // recording and therefore MUST be included in the return data
            pProgram->Channel()->setChanId(pInfo->GetChanID());
        }
    }

    // Build Recording Child Element

    if ( pInfo->GetRecordingStatus() != RecStatus::Unknown )
    {
        pProgram->setSerializeRecording( true );

        DTC::RecordingInfo *pRecording = pProgram->Recording();

        const RecordingInfo pRecInfo(*pInfo);

        pRecording->setRecordedId ( pRecInfo.GetRecordingID()     );
        pRecording->setStatus  ( pRecInfo.GetRecordingStatus()    );
        pRecording->setPriority( pRecInfo.GetRecordingPriority()  );
        pRecording->setStartTs ( pRecInfo.GetRecordingStartTime() );
        pRecording->setEndTs   ( pRecInfo.GetRecordingEndTime()   );

        pRecording->setSerializeDetails( bDetails );

        if (bDetails)
        {
            pRecording->setFileName    ( pRecInfo.GetPathname() );
            pRecording->setFileSize    ( pRecInfo.GetFilesize() );
            pRecording->setHostName    ( pRecInfo.GetHostname() );
            pRecording->setLastModified( pRecInfo.GetLastModifiedTime() );

            pRecording->setRecordId    ( pRecInfo.GetRecordingRuleID()      );
            pRecording->setRecGroup    ( pRecInfo.GetRecordingGroup()       );
            pRecording->setPlayGroup   ( pRecInfo.GetPlaybackGroup()        );
            pRecording->setStorageGroup( pRecInfo.GetStorageGroup()         );
            pRecording->setRecType     ( pRecInfo.GetRecordingRuleType()    );
            pRecording->setDupInType   ( pRecInfo.GetDuplicateCheckSource() );
            pRecording->setDupMethod   ( pRecInfo.GetDuplicateCheckMethod() );
            pRecording->setEncoderId   ( pRecInfo.GetInputID()              );
            if (pProgram->Channel())
            {
                QString encoderName = CardUtil::GetDisplayName(pRecInfo.GetInputID());
                pRecording->setEncoderName( encoderName );
            }

            pRecording->setProfile( pRecInfo.GetProgramRecordingProfile() );
        }
    }

    if (!pInfo->GetInetRef().isEmpty() )
    {
        pProgram->setSerializeArtwork( true );

        FillArtworkInfoList( pProgram->Artwork(), pInfo->GetInetRef(),
                             pInfo->GetSeason());
    }
}