Example #1
0
QString Dvr::RecTypeToDescription(QString recType)
{
    bool ok;
    RecordingType enumType = static_cast<RecordingType>(recType.toInt(&ok, 10));
    if (ok)
        return toDescription(enumType);
    // RecordingType type = static_cast<RecordingType>(recType);
    return toDescription(recTypeFromString(recType));
}
ParamRelationalData JPetParamGetterAscii::getAllRelationalData(
  ParamObjectType type1, ParamObjectType type2, const int runId)
{
  std::string runNumberS = boost::lexical_cast<std::string>(runId);
  std::string objectsName = objectsNames.at(type1);
  std::string fieldName = objectsNames.at(type2) + "_id";
  ParamRelationalData result;
  if (boost::filesystem::exists(filename)) {
    boost::property_tree::ptree dataFromFile;
    boost::property_tree::read_json(filename, dataFromFile);
    if (auto possibleRunContents = dataFromFile.get_child_optional(runNumberS)) {
      auto runContents = *possibleRunContents;
      if (auto possibleInfos = runContents.get_child_optional(objectsName)) {
        auto infos = * possibleInfos;
        for (auto infoRaw : infos) {
          auto info = infoRaw.second;
          ParamObjectDescription description = toDescription(info);
          if (description.count(fieldName)) {
            int id;
            if (type1 == kTOMBChannel) {
              id = boost::lexical_cast<int>(description["channel"]);
            } else {
              id = boost::lexical_cast<int>(description["id"]);
            }
            int otherId = boost::lexical_cast<int>(description[fieldName]);
            result[id] = otherId;
          }
        }
      } else { ERROR(std::string("No ") + objectsName + " in the specified run."); }
    } else { ERROR(std::string("No run with such id:") + runNumberS); }
  } else { ERROR(std::string("Input file does not exist:") + filename); }
  return result;
}
Example #3
0
QString Dvr::RecStatusToDescription(int RecStatus, int recType,
                                    const QDateTime &StartTime)
{
    //if (!StartTime.isValid())
    //    throw QString("StartTime appears invalid.");
    RecStatusType rsType = static_cast<RecStatusType>(RecStatus);
    RecordingType recordingType = static_cast<RecordingType>(recType);
    return toDescription(rsType, recordingType, StartTime);
}
Example #4
0
void ViewScheduleDiff::showStatus(MythUIButtonListItem *item)
{
    ProgramInfo *pi = CurrentProgram();
    if (!pi)
        return;

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

    QString message = pi->toString(ProgramInfo::kTitleSubtitle, " - ");
    message += "\n\n";
    message += toDescription(
        pi->GetRecordingStatus(), pi->GetRecordingStartTime());

    if (pi->GetRecordingStatus() == rsConflict ||
        pi->GetRecordingStatus() == rsLaterShowing)
    {
        message += " " + QObject::tr("The following programs will be recorded "
                                     "instead:") + "\n\n";

        ProgramList::const_iterator it = m_recListAfter.begin();
        for (; it != m_recListAfter.end(); ++it)
        {
            const ProgramInfo *pa = *it;
            if (pa->GetRecordingStartTime() >= pi->GetRecordingEndTime())
                break;
            if (pa->GetRecordingEndTime() > pi->GetRecordingStartTime() &&
                (pa->GetRecordingStatus() == rsWillRecord ||
                 pa->GetRecordingStatus() == rsRecording))
            {
                message += QString("%1 - %2  %3\n")
                    .arg(pa->GetRecordingStartTime().toString(timeFormat))
                    .arg(pa->GetRecordingEndTime().toString(timeFormat))
                    .arg(pa->toString(ProgramInfo::kTitleSubtitle, " - "));
            }
        }
    }

    QString title = QObject::tr("Program Status");
    MythScreenStack *mainStack = GetMythMainWindow()->GetStack("main stack");
    MythDialogBox   *dlg = new MythDialogBox(title, message, mainStack,
                                             "statusdialog", true);

    if (dlg->Create())
    {
        dlg->AddButton(QObject::tr("OK"));
        mainStack->AddScreen(dlg);
    }
    else
        delete dlg;
}
Example #5
0
/**
*  \brief Creates a dialog displaying current recording status and options
*         available
*/
void ScheduleCommon::ShowNotScheduledDialog(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,
                                                 "notSchedOptionPopup", true);

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

        QDateTime now = MythDate::current();

        if (recinfo.GetRecordingEndTime() > now)
            menuPopup->AddButton(tr("Record only this showing"),
                                 qVariantFromValue(recinfo));

        menuPopup->AddButton(tr("Record all showings"),
                             qVariantFromValue(recinfo));

        if (!recinfo.IsGeneric())
            menuPopup->AddButton(tr("Record one showing of this episode"),
                                 qVariantFromValue(recinfo));

        menuPopup->AddButton(tr("Record all showings on this channel"),
                             qVariantFromValue(recinfo));

        menuPopup->AddButton(tr("Record with more options"),
                             qVariantFromValue(recinfo));

        popupStack->AddScreen(menuPopup);
    }
    else
        delete menuPopup;
}
Example #6
0
QString Dvr::DupMethodToDescription(QString DupMethod)
{
    // RecordingDupMethodType method = static_cast<RecordingDupMethodType>(DupMethod);
    return toDescription(dupMethodFromString(DupMethod));
}
Example #7
0
QString Dvr::DupInToDescription(QString DupIn)
{
    // RecordingDupInType type= static_cast<RecordingDupInType>(DupIn);
    //return toDescription(type);
    return toDescription(dupInFromString(DupIn));
}
Example #8
0
QString Dvr::RecTypeToDescription(QString recType)
{
    // RecordingType type = static_cast<RecordingType>(recType);
    return toDescription(recTypeFromString(recType));
}
Example #9
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;
}
Example #10
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;
}