void AABoundingBox::DebugDraw() const
{
    SetUtilsColor(Color::White);
    GetCurrentProgram()->SetUniform("emissive", 1.0f);

    DrawBegin(CL_LINES);
    clVertex3(m_min.x, m_min.y, m_min.z);
    clVertex3(m_min.x, m_min.y, m_max.z);
    clVertex3(m_min.x, m_min.y, m_min.z);
    clVertex3(m_max.x, m_min.y, m_min.z);
    clVertex3(m_min.x, m_min.y, m_max.z);
    clVertex3(m_max.x, m_min.y, m_max.z);
    clVertex3(m_max.x, m_min.y, m_min.z);
    clVertex3(m_max.x, m_min.y, m_max.z);

    clVertex3(m_min.x, m_max.y, m_min.z);
    clVertex3(m_min.x, m_max.y, m_max.z);
    clVertex3(m_min.x, m_max.y, m_min.z);
    clVertex3(m_max.x, m_max.y, m_min.z);
    clVertex3(m_min.x, m_max.y, m_max.z);
    clVertex3(m_max.x, m_max.y, m_max.z);
    clVertex3(m_max.x, m_max.y, m_min.z);
    clVertex3(m_max.x, m_max.y, m_max.z);

    clVertex3(m_min.x, m_min.y, m_min.z);
    clVertex3(m_min.x, m_max.y, m_min.z);
    clVertex3(m_min.x, m_min.y, m_max.z);
    clVertex3(m_min.x, m_max.y, m_max.z);
    clVertex3(m_max.x, m_min.y, m_min.z);
    clVertex3(m_max.x, m_max.y, m_min.z);
    clVertex3(m_max.x, m_min.y, m_max.z);
    clVertex3(m_max.x, m_max.y, m_max.z);
    DrawEnd();
}
/**
*  \brief Show the previous recordings for this recording rule
*/
void ScheduleCommon::ShowPrevious(void) const
{
    ProgramInfo *pginfo = GetCurrentProgram();
    if (!pginfo)
        return;

    ShowPrevious(pginfo->GetRecordingRuleID(), pginfo->GetTitle());
}
/**
*  \brief Show the program guide
*/
void ScheduleCommon::ShowGuide(void) const
{
    ProgramInfo *pginfo = GetCurrentProgram();
    if (!pginfo)
        return;

    QString startchannel = pginfo->GetChanNum();
    uint startchanid = pginfo->GetChanID();
    QDateTime starttime = pginfo->GetScheduledStartTime();
    GuideGrid::RunProgramGuide(startchanid, startchannel, starttime);
}
/**
*  \brief Show the upcoming recordings for this title
*/
void ScheduleCommon::ShowUpcoming(void) const
{
    ProgramInfo *pginfo = GetCurrentProgram();
    if (!pginfo)
        return;

    if (pginfo->GetChanID() == 0 &&
        pginfo->GetRecordingRuleID() > 0)
        return ShowUpcomingScheduled();

    ShowUpcoming(pginfo->GetTitle(), pginfo->GetSeriesID());
}
/**
*  \brief Creates a dialog for creating a custom recording rule
*/
void ScheduleCommon::EditCustom(void)
{
    ProgramInfo *pginfo = GetCurrentProgram();
    if (!pginfo)
        return;

    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    CustomEdit *ce = new CustomEdit(mainStack, pginfo);
    if (ce->Create())
        mainStack->AddScreen(ce);
    else
        delete ce;
}
Beispiel #6
0
/**
*  \brief Show the previous recordings for this recording rule
*/
void ScheduleCommon::ShowPrevious(void) const
{
    ProgramInfo *pginfo = GetCurrentProgram();
    if (!pginfo)
        return;

    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    ProgLister *pl = new ProgLister(mainStack, pginfo->GetRecordingRuleID(),
                                    pginfo->GetTitle());
    if (pl->Create())
        mainStack->AddScreen(pl);
    else
        delete pl;
}
/**
*  \brief Create a kSingleRecord or bring up recording dialog.
*/
void ScheduleCommon::QuickRecord(void)
{
    ProgramInfo *pginfo = GetCurrentProgram();
    if (!pginfo)
        return;

    if (pginfo->GetRecordingRuleID())
        EditRecording();
    else
    {
        RecordingInfo ri(*pginfo);
        ri.QuickRecord();
        *pginfo = ri;
    }
}
/**
*  \brief Show the channel search
*/
void ScheduleCommon::ShowChannelSearch() const
{
    ProgramInfo *pginfo = GetCurrentProgram();
    if (!pginfo)
        return;

    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    ProgLister *pl = new ProgLister(mainStack, plChannel,
                                    QString::number(pginfo->GetChanID()), "",
                                    pginfo->GetScheduledStartTime());
    if (pl->Create())
        mainStack->AddScreen(pl);
    else
        delete pl;
}
/**
*  \brief Show the Program Details screen
*/
void ScheduleCommon::ShowDetails(void) const
{
    ProgramInfo *pginfo = GetCurrentProgram();
    if (!pginfo)
        return;

    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    ProgDetails *details_dialog  = new ProgDetails(mainStack, pginfo);

    if (!details_dialog->Create())
    {
        delete details_dialog;
        return;
    }

    mainStack->AddScreen(details_dialog);
}
/**
*  \brief Show the upcoming recordings for this recording rule
*/
void ScheduleCommon::ShowUpcomingScheduled(void) const
{
    ProgramInfo *pginfo = GetCurrentProgram();
    if (!pginfo)
        return;

    RecordingInfo ri(*pginfo);
    uint id;

    if ((id = ri.GetRecordingRuleID()) == 0)
        return ShowUpcoming(pginfo->GetTitle(), pginfo->GetSeriesID());

    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    ProgLister *pl = new ProgLister(mainStack, plRecordid,
                                    QString::number(id), "");

    if (pl->Create())
        mainStack->AddScreen(pl);
    else
        delete pl;
}
/**
*  \brief Creates a dialog for editing the recording status,
*         blocking until user leaves dialog.
*/
void ScheduleCommon::EditRecording(bool may_watch_now)
{
    ProgramInfo *pginfo = GetCurrentProgram();
    if (!pginfo)
        return;

    RecordingInfo recinfo(*pginfo);

    QString timeFormat = gCoreContext->GetSetting("TimeFormat", "h:mm AP");

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

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

    if (recinfo.GetRecordingStatus() == RecStatus::Conflict ||
        recinfo.GetRecordingStatus() == RecStatus::LaterShowing)
    {
        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,
                                                 "recOptionPopup", true);
    if (!menuPopup->Create())
    {
        delete menuPopup;
        return;
    }
    menuPopup->SetReturnEvent(this, "editrecording");

    QDateTime now = MythDate::current();

    if(may_watch_now)
        menuPopup->AddButton(tr("Watch This Channel"));

    if (recinfo.GetRecordingStatus() == RecStatus::Unknown)
    {
        if (recinfo.GetRecordingEndTime() > now)
            menuPopup->AddButton(tr("Record this showing"),
                                 qVariantFromValue(recinfo));
        menuPopup->AddButton(tr("Record all showings"),
                             qVariantFromValue(recinfo));
        if (!recinfo.IsGeneric())
        {
            if (recinfo.GetCategoryType() == ProgramInfo::kCategoryMovie)
                menuPopup->AddButton(tr("Record one showing"),
                                     qVariantFromValue(recinfo));
            else
                menuPopup->AddButton(tr("Record one showing (this episode)"),
                                     qVariantFromValue(recinfo));

        }
        menuPopup->AddButton(tr("Record all showings (this channel)"),
                             qVariantFromValue(recinfo));
        menuPopup->AddButton(tr("Edit recording rule"),
                             qVariantFromValue(recinfo));
    }
    else if (recinfo.GetRecordingStatus() == RecStatus::Recording ||
             recinfo.GetRecordingStatus() == RecStatus::Tuning    ||
             recinfo.GetRecordingStatus() == RecStatus::Failing   ||
             recinfo.GetRecordingStatus() == RecStatus::Pending)
    {
        if (recinfo.GetRecordingStatus() != RecStatus::Pending)
            menuPopup->AddButton(tr("Stop this recording"),
                                 qVariantFromValue(recinfo));
        menuPopup->AddButton(tr("Modify recording options"),
                             qVariantFromValue(recinfo));
    }
    else
    {
        if (recinfo.GetRecordingStartTime() < now &&
            recinfo.GetRecordingEndTime() > now &&
            recinfo.GetRecordingStatus() != RecStatus::DontRecord &&
            recinfo.GetRecordingStatus() != RecStatus::NotListed)
        {
            menuPopup->AddButton(tr("Restart this recording"),
                                 qVariantFromValue(recinfo));
        }

        if (recinfo.GetRecordingEndTime() > now &&
            recinfo.GetRecordingRuleType() != kSingleRecord &&
            recinfo.GetRecordingRuleType() != kOverrideRecord &&
            (recinfo.GetRecordingStatus() == RecStatus::DontRecord ||
             recinfo.GetRecordingStatus() == RecStatus::PreviousRecording ||
             recinfo.GetRecordingStatus() == RecStatus::CurrentRecording ||
             recinfo.GetRecordingStatus() == RecStatus::EarlierShowing ||
             recinfo.GetRecordingStatus() == RecStatus::TooManyRecordings ||
             recinfo.GetRecordingStatus() == RecStatus::LaterShowing ||
             recinfo.GetRecordingStatus() == RecStatus::Repeat ||
             recinfo.GetRecordingStatus() == RecStatus::Inactive ||
             recinfo.GetRecordingStatus() == RecStatus::NeverRecord))
        {
            menuPopup->AddButton(tr("Record this showing"),
                                 qVariantFromValue(recinfo));
            if (recinfo.GetRecordingStartTime() > now &&
                (recinfo.GetRecordingStatus() == RecStatus::PreviousRecording ||
                 recinfo.GetRecordingStatus() == RecStatus::NeverRecord))
            {
                menuPopup->AddButton(tr("Forget previous recording"),
                                     qVariantFromValue(recinfo));
            }
        }

        if (recinfo.GetRecordingRuleType() != kSingleRecord &&
            recinfo.GetRecordingRuleType() != kDontRecord &&
            (recinfo.GetRecordingStatus() == RecStatus::WillRecord ||
             recinfo.GetRecordingStatus() == RecStatus::CurrentRecording ||
             recinfo.GetRecordingStatus() == RecStatus::EarlierShowing ||
             recinfo.GetRecordingStatus() == RecStatus::TooManyRecordings ||
             recinfo.GetRecordingStatus() == RecStatus::Conflict ||
             recinfo.GetRecordingStatus() == RecStatus::LaterShowing ||
             recinfo.GetRecordingStatus() == RecStatus::Offline))
        {
            if (recinfo.GetRecordingStatus() == RecStatus::WillRecord ||
                recinfo.GetRecordingStatus() == RecStatus::Conflict)
                menuPopup->AddButton(tr("Don't record this showing"),
                                     qVariantFromValue(recinfo));

            const RecordingDupMethodType dupmethod =
                recinfo.GetDuplicateCheckMethod();
            if (recinfo.GetRecordingRuleType() != kOverrideRecord &&
                !((recinfo.GetFindID() == 0 ||
                   !IsFindApplicable(recinfo)) &&
                  recinfo.GetCategoryType() == ProgramInfo::kCategorySeries &&
                  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)
        {
            menuPopup->AddButton(tr("Edit override rule"),
                                 qVariantFromValue(recinfo));
            menuPopup->AddButton(tr("Delete override rule"),
                                 qVariantFromValue(recinfo));
        }
        else
        {
            if (recinfo.GetRecordingRuleType() != kSingleRecord &&
                recinfo.GetRecordingStatus() != RecStatus::NotListed)
                menuPopup->AddButton(tr("Add override rule"),
                                     qVariantFromValue(recinfo));
            menuPopup->AddButton(tr("Edit recording rule"),
                                 qVariantFromValue(recinfo));
            menuPopup->AddButton(tr("Delete recording rule"),
                                 qVariantFromValue(recinfo));
        }
    }

    popupStack->AddScreen(menuPopup);
}
/**
*  \brief Creates a dialog for editing the recording schedule
*/
void ScheduleCommon::EditScheduled(void)
{
    EditScheduled(GetCurrentProgram());
}