Ticket #7423: 7423-2.patch

File 7423-2.patch, 9.1 KB (added by gigem, 16 years ago)

Proposed fix to be committed after more testing

  • libs/libmythtv/tv_play.h

     
    5858typedef void (*EMBEDRETURNVOID) (void *, bool);
    5959typedef void (*EMBEDRETURNVOIDEPG) (uint, const QString &, TV *, bool, bool, int);
    6060typedef void (*EMBEDRETURNVOIDFINDER) (TV *, bool, bool);
    61 typedef void (*EMBEDRETURNVOIDSCHEDIT) (const ProgramInfo *);
     61typedef void (*EMBEDRETURNVOIDSCHEDIT) (const ProgramInfo *, void *);
    6262
    6363// Locking order
    6464//
  • libs/libmythtv/tv_play.cpp

     
    79387938    }
    79397939
    79407940    pause_active |= kScheduledRecording == editType;
     7941    pause_active |= kViewSchedule == editType;
    79417942    pause_active |=
    79427943        !isLiveTV && (!db_continue_embedded || isNearEnd);
    79437944    pause_active |= actx->paused;
     
    79827983        }
    79837984        case kScheduledRecording:
    79847985        {
    7985             RunScheduleEditorPtr(&pginfo);
     7986            RunScheduleEditorPtr(&pginfo, (void *)this);
    79867987            ignoreKeyPresses = true;
    79877988            break;
    79887989        }
     
    87028703        DoEditSchedule(editType);
    87038704    }
    87048705
    8705     if (message.left(11) == "EPG_EXITING" || message.left(18) == "PROGFINDER_EXITING")
     8706    if (message.left(11) == "EPG_EXITING" ||
     8707        message.left(18) == "PROGFINDER_EXITING" ||
     8708        message.left(21) == "VIEWSCHEDULED_EXITING" ||
     8709        message.left(22) == "SCHEDULEEDITOR_EXITING")
    87068710    {
    87078711        GetMythMainWindow()->SetDrawEnabled(false);
    87088712        // Resize the window back to the MythTV Player size
  • libs/libmythtv/recordingrule.cpp

     
    158158    if (proginfo->recordid)
    159159    {
    160160        m_recordID = proginfo->recordid;
    161         if (!Load())
    162             return false;
     161        Load();
    163162    }
    164163
    165164    if (m_searchType == kNoSearch || m_searchType == kManualSearch)
  • programs/mythfrontend/viewscheduled.h

     
    5050    void selected(MythUIButtonListItem *);
    5151    void updateInfo(MythUIButtonListItem *);
    5252    void SwitchList(void);
     53    void Close(void);
    5354
    5455  private:
    5556    void FillList(void);
  • programs/mythfrontend/scheduleeditor.cpp

     
    44// QT
    55#include <QString>
    66#include <QHash>
     7#include <QApplication>
    78
    89// Libmyth
    910#include "mythcontext.h"
     
    1213// Libmythtv
    1314#include "playgroup.h"
    1415#include "viewschdiff.h"
     16#include "tv_play.h"
    1517
    1618// Libmythui
    1719#include "mythmainwindow.h"
     
    3133#define ENUM_TO_QVARIANT(a) qVariantFromValue(static_cast<int>(a))
    3234
    3335
    34 void *ScheduleEditor::RunScheduleEditor(ProgramInfo *proginfo)
     36void *ScheduleEditor::RunScheduleEditor(ProgramInfo *proginfo, void *player)
    3537{
    3638    RecordingRule *rule = new RecordingRule();
    3739    rule->LoadByProgram(proginfo);
    3840   
    3941    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    40     ScheduleEditor *se = new ScheduleEditor(mainStack, rule);
     42    ScheduleEditor *se = new ScheduleEditor(mainStack, rule,
     43                                            static_cast<TV*>(player));
    4144
    4245    if (se->Create())
    43         mainStack->AddScreen(se);
     46        mainStack->AddScreen(se, (player == NULL));
    4447    else
    4548        delete se;
    4649
     
    5356 */
    5457
    5558ScheduleEditor::ScheduleEditor(MythScreenStack *parent,
    56                                RecordingInfo *recInfo)
     59                               RecordingInfo *recInfo, TV *player)
    5760          : ScheduleCommon(parent, "ScheduleEditor"),
    5861            m_recInfo(new RecordingInfo(*recInfo)), m_recordingRule(NULL),
    5962            m_sendSig(false),
    6063            m_saveButton(NULL), m_cancelButton(NULL), m_rulesList(NULL),
    6164            m_schedOptButton(NULL), m_storeOptButton(NULL),
    6265            m_postProcButton(NULL), m_schedInfoButton(NULL),
    63             m_previewButton(NULL)
     66            m_previewButton(NULL), m_player(player)
    6467{
    6568    m_recordingRule = new RecordingRule();
    6669    m_recordingRule->m_recordID = m_recInfo->recordid;
    6770}
    6871
    6972ScheduleEditor::ScheduleEditor(MythScreenStack *parent,
    70                                RecordingRule *recRule)
     73                               RecordingRule *recRule, TV *player)
    7174          : ScheduleCommon(parent, "ScheduleEditor"),
    7275            m_recInfo(NULL), m_recordingRule(recRule),
    7376            m_sendSig(false),
    7477            m_saveButton(NULL), m_cancelButton(NULL), m_rulesList(NULL),
    7578            m_schedOptButton(NULL), m_storeOptButton(NULL),
    7679            m_postProcButton(NULL), m_schedInfoButton(NULL),
    77             m_previewButton(NULL)
     80            m_previewButton(NULL), m_player(player)
    7881{
    7982}
    8083
    8184ScheduleEditor::~ScheduleEditor(void)
    8285{
    8386    delete m_recordingRule;
     87
     88    // if we have a player, we need to tell we are done
     89    if (m_player)
     90    {
     91        QString message = QString("VIEWSCHEDULED_EXITING");
     92        qApp->postEvent(m_player, new MythEvent(message));
     93    }
    8494}
    8595
    8696bool ScheduleEditor::Create()
     
    142152    return true;
    143153}
    144154
     155void ScheduleEditor::Close()
     156{
     157    // don't fade the screen if we are returning to the player
     158    if (m_player)
     159        GetScreenStack()->PopScreen(this, false);
     160    else
     161        GetScreenStack()->PopScreen(this, true);
     162}
     163
    145164void ScheduleEditor::Load()
    146165{
    147166    // Copy this now, it will change briefly after the first item is inserted
  • programs/mythfrontend/main.cpp

     
    2323#include "tv.h"
    2424#include "proglist.h"
    2525#include "progfind.h"
     26#include "scheduleeditor.h"
    2627#include "manualschedule.h"
    2728#include "playbackbox.h"
    2829#include "customedit.h"
     
    915916    TV::SetFuncPtr("viewscheduled", (void *)ViewScheduled::RunViewScheduled);
    916917    TV::SetFuncPtr("programguide", (void *)GuideGrid::RunProgramGuide);
    917918    TV::SetFuncPtr("programfinder", (void *)RunProgramFinder);
    918     TV::SetFuncPtr("scheduleeditor", (void *)RunProgramFinder);
     919    TV::SetFuncPtr("scheduleeditor", (void *)ScheduleEditor::RunScheduleEditor);
    919920}
    920921
    921922
  • programs/mythfrontend/viewscheduled.cpp

     
    2828                                           showTV);
    2929
    3030    if (vsb->Create())
    31         mainStack->AddScreen(vsb);
     31        mainStack->AddScreen(vsb, (player == NULL));
    3232    else
    3333        delete vsb;
    3434
     
    6565{
    6666    gContext->removeListener(this);
    6767    gContext->SaveSetting("ViewSchedShowLevel", !m_showAll);
     68
     69    // if we have a player, we need to tell we are done
     70    if (m_player)
     71    {
     72        QString message = QString("VIEWSCHEDULED_EXITING");
     73        qApp->postEvent(m_player, new MythEvent(message));
     74    }
    6875}
    6976
    7077bool ViewScheduled::Create()
     
    109116    return true;
    110117}
    111118
     119void ViewScheduled::Close()
     120{
     121    // don't fade the screen if we are returning to the player
     122    if (m_player)
     123        GetScreenStack()->PopScreen(this, false);
     124    else
     125        GetScreenStack()->PopScreen(this, true);
     126}
     127
    112128void ViewScheduled::SwitchList()
    113129{
    114130    if (GetFocusWidget() == m_groupList)
  • programs/mythfrontend/scheduleeditor.h

     
    2222class MythUIButtonListItem;
    2323class MythUIStateType;
    2424class MythUISpinBox;
     25class TV;
    2526
    2627class ScheduleEditor : public ScheduleCommon
    2728{
    2829  Q_OBJECT
    2930  public:
    30     ScheduleEditor(MythScreenStack *parent, RecordingInfo* recinfo);
    31     ScheduleEditor(MythScreenStack *parent, RecordingRule* recrule);
     31    ScheduleEditor(MythScreenStack *parent, RecordingInfo* recinfo,
     32                   TV *player = NULL);
     33    ScheduleEditor(MythScreenStack *parent, RecordingRule* recrule,
     34                   TV *player = NULL);
    3235   ~ScheduleEditor();
    3336
    3437    bool Create(void);
    3538    void customEvent(QEvent *event);
    3639
    3740    /// Callback
    38     void *RunScheduleEditor(ProgramInfo *proginfo);
     41    static void *RunScheduleEditor(ProgramInfo *proginfo, void *player = NULL);
    3942   
    4043  signals:
    4144    void ruleSaved(int ruleId);
     
    4851    void ShowSchedInfo(void);
    4952    void ShowPreview(void);
    5053    void Save(void);
     54    void Close(void);
    5155   
    5256  private:
    5357    void Load(void);
     
    7377    MythUIButton    *m_schedInfoButton;
    7478    MythUIButton    *m_previewButton;
    7579   
     80    TV *m_player;
    7681};
    7782
    7883class SchedOptEditor : public MythScreenType