Ticket #7985: jump_to_rec_watch_recordings_screen_version.diff

File jump_to_rec_watch_recordings_screen_version.diff, 11.2 KB (added by skamithi, 10 years ago)
  • libs/libmythtv/tv_play.h

     
    5959
    6060typedef QMap<QString,InfoMap>    DDValueMap;
    6161typedef QMap<QString,DDValueMap> DDKeyMap;
    62 typedef ProgramInfo * (*EMBEDRETURNPROGRAM)(void *, bool);
    6362typedef void (*EMBEDRETURNVOID) (void *, bool);
    6463typedef void (*EMBEDRETURNVOIDEPG) (uint, const QString &, TV *, bool, bool, int);
    6564typedef void (*EMBEDRETURNVOIDFINDER) (TV *, bool, bool);
     
    311310
    312311    bool eventFilter(QObject *o, QEvent *e);
    313312    static QStringList lastProgramStringList;
    314     static EMBEDRETURNPROGRAM RunPlaybackBoxPtr;
     313    static EMBEDRETURNVOID RunPlaybackBoxPtr;
    315314    static EMBEDRETURNVOID RunViewScheduledPtr;
    316315    static EMBEDRETURNVOIDEPG RunProgramGuidePtr;
    317316    static EMBEDRETURNVOIDFINDER RunProgramFinderPtr;
     
    342341    void ForceNextStateNone(PlayerContext*);
    343342    void ScheduleStateChange(PlayerContext*);
    344343    void SetErrored(PlayerContext*);
     344    void PrepToSwitchToRecordedProgram(PlayerContext*,
     345                                        ProgramInfo*);
    345346    void PrepareToExitPlayer(PlayerContext*, int line,
    346347                             bool bookmark = true) const;
    347348    void SetExitPlayer(bool set_it, bool wants_to) const;
  • libs/libmythtv/tv_play.cpp

     
    113113/**
    114114 * \brief function pointer for RunPlaybackBox in playbackbox.cpp
    115115 */
    116 EMBEDRETURNPROGRAM TV::RunPlaybackBoxPtr = NULL;
     116EMBEDRETURNVOID TV::RunPlaybackBoxPtr = NULL;
    117117
    118118/**
    119119 * \brief function pointer for RunViewScheduled in viewscheduled.cpp
     
    440440{
    441441    QString name(string);
    442442    if (name == "playbackbox")
    443         RunPlaybackBoxPtr = (EMBEDRETURNPROGRAM)lptr;
     443        RunPlaybackBoxPtr = (EMBEDRETURNVOID)lptr;
    444444    else if (name == "viewscheduled")
    445445        RunViewScheduledPtr = (EMBEDRETURNVOID)lptr;
    446446    else if (name == "programguide")
     
    30873087    errorRecoveryTimerId = StartTimer(1, __LINE__);
    30883088}
    30893089
     3090void TV::PrepToSwitchToRecordedProgram(PlayerContext *ctx,
     3091                                        ProgramInfo *p)
     3092{
     3093    VERBOSE(VB_GENERAL, LOC +
     3094                    QString("Switchin to program: %1: %2")
     3095                            .arg(p->title).arg(p->subtitle));
     3096    SetLastProgram(p);
     3097    PrepareToExitPlayer(ctx,__LINE__);
     3098    jumpToProgram = true;
     3099    SetExitPlayer(true, true);
     3100}
     3101
    30903102void TV::PrepareToExitPlayer(PlayerContext *ctx, int line, bool bookmark) const
    30913103{
    30923104    bool bookmark_it = bookmark && IsBookmarkAllowed(ctx);
     
    81138125    }
    81148126
    81158127    // Actually show the pop-up UI
    8116     ProgramInfo *nextProgram = NULL;
    81178128    switch (editType)
    81188129    {
    81198130        case kScheduleProgramGuide:
     
    81448155        }
    81458156        case kPlaybackBox:
    81468157        {
    8147             nextProgram = RunPlaybackBoxPtr((void *)this, !pause_active);
     8158            RunPlaybackBoxPtr((void *)this, !pause_active);
    81488159            ignoreKeyPresses = true;
    81498160            break;
    81508161        }
     
    88558866    if (message.left(11) == "EPG_EXITING" ||
    88568867        message.left(18) == "PROGFINDER_EXITING" ||
    88578868        message.left(21) == "VIEWSCHEDULED_EXITING" ||
     8869        message.left(19)   == "PLAYBACKBOX_EXITING" ||
    88588870        message.left(22) == "SCHEDULEEDITOR_EXITING")
    88598871    {
    88608872        GetMythMainWindow()->SetDrawEnabled(false);
     
    88888900        qApp->processEvents();
    88898901        DrawUnusedRects();
    88908902
     8903        isEmbedded = false;
     8904        ignoreKeyPresses = false;
     8905
     8906        if (message.left(19)   == "PLAYBACKBOX_EXITING")
     8907        {
     8908            ProgramInfo *p = new ProgramInfo;
     8909            QStringList nextProgStringList = me->ExtraDataList();
     8910            if (!nextProgStringList.isEmpty() &&
     8911                p->FromStringList(nextProgStringList, 0))
     8912            {
     8913                PrepToSwitchToRecordedProgram(actx, p);
     8914            }
     8915            else
     8916               delete p;
     8917        }
     8918       
    88918919        ReturnPlayerLock(actx);
    88928920
    8893         isEmbedded = false;
    8894         ignoreKeyPresses = false;
    88958921    }
    88968922
    88978923    if (message.left(14) == "COMMFLAG_START")
     
    1099711023        {
    1099811024            if (mctx == ctx)
    1099911025            {
    11000                 VERBOSE(VB_GENERAL, LOC +
    11001                         QString("Switching to program: %1: %2")
    11002                         .arg(p->title).arg(p->subtitle));
    11003 
    11004                 SetLastProgram(p);
    11005                 PrepareToExitPlayer(ctx, __LINE__);
    11006                 jumpToProgram = true;
    11007                 SetExitPlayer(true, true);
     11026                PrepToSwitchToRecordedProgram(ctx, p);
    1100811027            }
    1100911028            else
    1101011029            {
     
    1104211061            (wants_pbp ? kPBPLeft : kPIPOff);
    1104311062    }
    1104411063
    11045     if (db_jump_prefer_osd && (StateIsPlaying(s) || StateIsLiveTV(s)))
     11064    if ((wants_pbp || wants_pip || db_jump_prefer_osd) &&
     11065        (StateIsPlaying(s) || StateIsLiveTV(s)))
    1104611066    {
    1104711067        QMutexLocker locker(&timerIdLock);
    1104811068        if (jumpMenuTimerId)
  • programs/mythfrontend/playbackbox.cpp

     
    319319    return chanid && recstartts.isValid();
    320320}
    321321
    322 ProgramInfo *PlaybackBox::RunPlaybackBox(void * player, bool showTV)
     322void * PlaybackBox::RunPlaybackBox(void * player, bool showTV)
    323323{
    324324    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    325325
     
    331331    else
    332332        delete pbb;
    333333
    334     ProgramInfo *nextProgram = NULL;
    335     if (pbb->CurrentItem())
    336         nextProgram = new ProgramInfo(*pbb->CurrentItem());
    337 
    338     return nextProgram;
     334    return NULL;
    339335}
    340336
    341337PlaybackBox::PlaybackBox(MythScreenStack *parent, QString name, BoxType ltype,
     
    373369      m_underNetworkControl(false),
    374370      // Other
    375371      m_player(NULL),
     372      m_player_selected_new_show(false),
    376373      m_helper(this)
    377374{
    378375    m_formatShortDate    = gContext->GetSetting("ShortDateFormat", "M/d");
     
    468465        m_coverartTimer->disconnect(this);
    469466        m_coverartTimer = NULL;
    470467    }
     468
     469    if (m_player)
     470    {
     471        QStringList nextProgram;
     472        ProgramInfo *pginfo = CurrentItem();
     473
     474        if (pginfo && m_player_selected_new_show)
     475            pginfo->ToStringList(nextProgram);
     476
     477        QString message = QString("PLAYBACKBOX_EXITING");
     478        qApp->postEvent(m_player, new MythEvent(message, nextProgram));
     479    }
    471480}
    472481
    473482bool PlaybackBox::Create()
     
    764773    QString rating = QString::number((int)((pginfo->stars * 10.0) + 0.5));
    765774
    766775    item->DisplayState(rating, "ratingstate");
    767    
     776
    768777    QString oldimgfile = item->GetImage("preview");
    769778    if (oldimgfile.isEmpty() || force_preview_reload)
    770779        m_helper.GetPreviewImage(*pginfo);
     
    11511160    subtitleFlags[SUB_ONSCREEN] = "onscreensub";
    11521161    subtitleFlags[SUB_NORMAL] = "subtitles";
    11531162    subtitleFlags[SUB_HARDHEAR] = "cc";
    1154    
     1163
    11551164    ProgramList::iterator it = progList.begin();
    11561165    for (; it != progList.end(); ++it)
    11571166    {
     
    11931202        disp_flag_stat[7] = (*it)->programflags & FL_INUSEPLAYING;
    11941203        disp_flag_stat[8] = (*it)->programflags & FL_COMMFLAG;
    11951204        disp_flag_stat[9] = (*it)->programflags & FL_TRANSCODED;
    1196        
     1205
    11971206        for (uint i = 0; i < sizeof(disp_flags) / sizeof(char*); ++i)
    11981207            item->DisplayState(disp_flag_stat[i]?"yes":"no", disp_flags[i]);
    1199        
     1208
    12001209        QMap<AudioProps, QString>::iterator ait;
    12011210        for (ait = audioFlags.begin(); ait != audioFlags.end(); ++ait)
    12021211        {
     
    12101219            if ((*it)->videoproperties & vit.key())
    12111220                item->DisplayState(vit.value(), "videoprops");
    12121221        }
    1213          
     1222
    12141223        QMap<SubtitleTypes, QString>::iterator sit;
    12151224        for (sit = subtitleFlags.begin(); sit != subtitleFlags.end(); ++sit)
    12161225        {
     
    19031912    if (!pginfo)
    19041913        return;
    19051914
    1906     if (m_player && m_player->IsSameProgram(0, pginfo))
     1915    if (m_player)
    19071916    {
     1917        if (!m_player->IsSameProgram(0, pginfo))
     1918            m_player_selected_new_show = true;
    19081919        Close();
    19091920        return;
    19101921    }
     
    22742285    QStringList sgEntries;
    22752286
    22762287    // TODO do this in another thread
    2277     RemoteGetFileList(host, "", &sgEntries, sgroup, true); 
     2288    RemoteGetFileList(host, "", &sgEntries, sgroup, true);
    22782289
    22792290    int regIndex = 0;
    22802291    titleIn.replace(' ', "(?:\\s|-|_|\\.)?");
     
    23482359        return QString();
    23492360}
    23502361
    2351 void PlaybackBox::doPIPPlay(void)
    2352 {
    2353     doPIPPlay(kPIPonTV);
    2354 }
    2355 
    2356 void PlaybackBox::doPBPPlay(void)
    2357 {
    2358     doPIPPlay(kPBPLeft);
    2359 }
    2360 
    2361 void PlaybackBox::doPIPPlay(PIPState state)
    2362 {
    2363     if (m_player)
    2364     {
    2365         ProgramInfo *pginfo = CurrentItem();
    2366         m_player->SetNextProgPIPState(state);
    2367         if (pginfo)
    2368             pginfo->setIgnoreBookmark(true);
    2369         Close();
    2370     }
    2371 }
    2372 
    23732362void PlaybackBox::ShowDeletePopup(DeletePopupType type)
    23742363{
    23752364    if (m_popupMenu)
     
    29442933        sameProgram = m_player->IsSameProgram(0, &pginfo);
    29452934
    29462935    TVState tvstate = kState_None;
    2947     if (m_player)
    2948     {
    2949         if (!sameProgram && m_player->IsPIPSupported())
    2950             m_popupMenu->AddButton(tr("Start As PIP"), SLOT(doPIPPlay()));
    2951         if (!sameProgram && m_player->IsPBPSupported())
    2952             m_popupMenu->AddButton(tr("Start As PBP"), SLOT(doPBPPlay()));
    29532936
    2954         tvstate = m_player->GetState(0);
    2955     }
    2956     else
     2937    if (!sameProgram)
    29572938    {
    29582939        if (pginfo.programflags & FL_BOOKMARK)
    29592940            m_popupMenu->AddButton(tr("Play from..."),
    2960                                         SLOT(showPlayFromPopup()), true);
     2941                                        SLOT(showPlayFromPopup()), true);
    29612942        else
    29622943            m_popupMenu->AddButton(tr("Play"), SLOT(playSelected()));
     2944    }
    29632945
     2946    if (!m_player)
     2947    {
    29642948        if (m_playList.filter(pginfo.MakeUniqueKey()).size())
    29652949            m_popupMenu->AddButton(tr("Remove from Playlist"),
    29662950                                        SLOT(togglePlayListItem()));
     
    44284412            tmpItem->SetWatchedFlag(turnOn);
    44294413        }
    44304414    }
    4431    
     4415
    44324416    doClearPlaylist();
    4433     UpdateUILists();   
     4417    UpdateUILists();
    44344418}
    44354419
    44364420void PlaybackBox::showMetadataEditor()
  • programs/mythfrontend/playbackbox.h

     
    123123    void customEvent(QEvent *event);
    124124
    125125    void setInitialRecGroup(QString initialGroup) { m_recGroup = initialGroup; }
    126     static ProgramInfo *RunPlaybackBox(void *player, bool);
     126    static void * RunPlaybackBox(void *player, bool);
    127127
    128128  public slots:
    129129    void displayRecGroup(const QString &newRecGroup = "");
     
    174174
    175175    void doPlayFromBeg();
    176176    void doPlayListRandom();
    177     void doPIPPlay(void);
    178     void doPIPPlay(PIPState state);
    179     void doPBPPlay(void);
    180177
    181178    void askStop();
    182179
     
    432429
    433430    // Other
    434431    TV                 *m_player;
     432    bool                m_player_selected_new_show;
    435433    /// Main helper thread
    436434    PlaybackBoxHelper   m_helper;
    437435};