Ticket #320: fix320-v1.patch

File fix320-v1.patch, 7.3 KB (added by danielk, 19 years ago)

a rough around the edges fix for this

  • libs/libmythtv/tv_play.cpp

     
    199199      // Channel changing state variables
    200200      channelqueued(false), channelKeys(""), lookForChannel(false),
    201201      lastCC(""), lastCCDir(0), muteTimer(new QTimer(this)),
     202      lockTimerOn(false), lockTimeout(3000),
    202203      // previous channel functionality state variables
    203204      prevChanKeyCnt(0), prevChanTimer(new QTimer(this)),
    204205      // channel browsing state variables
     
    712713        }
    713714        else
    714715        {
     716            lockTimerOn = false;
    715717            prbuffer = new RingBuffer(name, filesize, smudge, recorder);
    716718
    717719            SET_NEXT();
     
    736738
    737739                SET_LAST();
    738740            }
     741            else
     742            {
     743                MSqlQuery query(MSqlQuery::InitCon());
     744                query.prepare("SELECT channel_timeout "
     745                              "FROM capturecard "
     746                              "WHERE cardid = :CARDID");
     747                query.bindValue(":CARDID", recorder->GetRecorderNumber());
     748                if (!query.exec() || !query.isActive() || !query.next())
     749                    MythContext::DBError("Getting timeout", query);
     750
     751                lockTimeout = query.value(0).toInt();
     752                cerr<<"set lockTimeout to: "<<lockTimeout<<endl;
     753                lockTimer.start();
     754                lockTimerOn = true;
     755            }
    739756        }
    740757    }
    741758    else if (TRANSITION(kState_WatchingLiveTV, kState_None))
     
    12691286            lastSignalMsg.clear();
    12701287        }
    12711288
     1289        UpdateOSDTimeoutMessage();
     1290
    12721291        if (IsErrored())
    12731292        {
    12741293            VERBOSE(VB_IMPORTANT, "TVPlay: RunTV encountered "
     
    16991718                    else if (result == 3)
    17001719                        recorder->CancelNextRecording();
    17011720                }
     1721                else if (dialogname == "channel_timed_out")
     1722                {
     1723                    lockTimerOn = false;
     1724                }
    17021725
    17031726                while (GetOSD()->DialogShowing(dialogname))
    17041727                {
     
    32403263    GetOSD()->ClearAllText("program_info");
    32413264    GetOSD()->SetText("program_info", infoMap, osd_display_time);
    32423265    lastSignalMsgTime.start();
     3266
     3267    // Turn of lock timer since we have a signal lock now...
     3268    if (allGood)
     3269        lockTimerOn = false;
    32433270}
    32443271
     3272void TV::UpdateOSDTimeoutMessage(void)
     3273{
     3274    QString dlg_name("channel_timed_out");
     3275    bool timed_out = lockTimerOn && (lockTimer.elapsed() > (int)lockTimeout);
     3276    OSD *osd = GetOSD();
     3277
     3278    if (!osd)
     3279    {
     3280        if (timed_out)
     3281            VERBOSE(VB_IMPORTANT, "Error: You have no OSD, "
     3282                    "but tuning has already taken too long.");
     3283        return;
     3284    }
     3285
     3286    if (!timed_out)
     3287    {
     3288        if (osd->DialogShowing(dlg_name))
     3289            osd->TurnDialogOff(dlg_name);
     3290        return;
     3291    }
     3292
     3293    if (osd->DialogShowing(dlg_name))
     3294        return;
     3295
     3296    // create dialog...
     3297    static QString chan_up   = GET_KEY("TV Playback", "CHANNELUP");
     3298    static QString chan_down = GET_KEY("TV Playback", "CHANNELDOWN");
     3299    static QString tog_in    = GET_KEY("TV Playback", "TOGGLEINPUTS");
     3300    static QString tog_cards = GET_KEY("TV Playback", "SWITCHCARDS");
     3301
     3302    QString message = tr(
     3303        "You should have gotten a channel lock by now. "
     3304        "You can continue to wait for a signal, or you "
     3305        "can change the channels with %1 or %2, change "
     3306        "input's (%3), capture cards (%4), etc.")
     3307        .arg(chan_up).arg(chan_down).arg(tog_in).arg(tog_cards);
     3308
     3309    QStringList options;
     3310    options += tr("OK");
     3311
     3312    dialogname = dlg_name;
     3313    osd->NewDialogBox(dialogname, message, options, 0);
     3314}
     3315
    32453316void TV::UpdateLCD(void)
    32463317{
    32473318    // Make sure the LCD information gets updated shortly
     
    49174988void TV::PauseLiveTV(void)
    49184989{
    49194990    VERBOSE(VB_PLAYBACK, "PauseLiveTV()");
     4991    lockTimerOn = false;
    49204992
    49214993    if (activenvp)
    49224994        activenvp->Pause(false);
     
    49585030        UpdateLCD();
    49595031        AddPreviousChannel();
    49605032    }
     5033
     5034    lockTimer.start();
     5035    lockTimerOn = true;
    49615036}
  • libs/libmythtv/tv_play.h

     
    210210    void UpdateOSD(void);
    211211    void UpdateOSDInput(void);
    212212    void UpdateOSDSignal(const QStringList& strlist);
     213    void UpdateOSDTimeoutMessage(void);
    213214
    214215    void LoadMenu(void);
    215216
     
    327328     *  or decreased to speedup or slowdown playback.
    328329     *  Ignored when doing Fast Forward or Rewind.
    329330     */
    330     float normal_speed; 
     331    float normal_speed;
    331332
    332333    float frameRate;     ///< Estimated framerate from recorder
    333334
     
    340341    int     lastCCDir;      ///< Last channel changing direction
    341342    QTimer *muteTimer;      ///< For temp. audio muting during channel changes
    342343
     344    // Channel changing timeout notification variables
     345    QTime   lockTimer;
     346    bool    lockTimerOn;
     347    uint    lockTimeout;
     348   
     349
    343350    // Previous channel functionality state variables
    344351    str_vec_t prevChan;       ///< Previous channels
    345352    uint      prevChanKeyCnt; ///< Number of repeated channel button presses
  • libs/libmyth/mythdialogs.cpp

     
    538538    BindKey(context, action, keybind);
    539539}
    540540
     541QString MythMainWindow::GetKey(const QString &context,
     542                               const QString &action) const
     543{
     544    MSqlQuery query(MSqlQuery::InitCon());
     545    if (!query.isConnected())
     546        return "?";
     547
     548    query.prepare("SELECT keylist FROM keybindings WHERE "
     549                  "context = :CONTEXT AND action = :ACTION AND "
     550                  "hostname = :HOSTNAME ;");
     551    query.bindValue(":CONTEXT", context);
     552    query.bindValue(":ACTION", action);
     553    query.bindValue(":HOSTNAME", gContext->GetHostName());
     554
     555    if (!query.exec() || !query.isActive() || !query.next())
     556        return "?";
     557
     558    return query.value(0).toString();
     559}
     560
    541561void MythMainWindow::ClearJump(const QString &destination)
    542562{
    543563    /* make sure that the jump point exists (using [] would add it)*/
  • libs/libmyth/mythdialogs.h

     
    5959};
    6060
    6161#define REG_KEY(a, b, c, d) gContext->GetMainWindow()->RegisterKey(a, b, c, d)
     62#define GET_KEY(a, b) gContext->GetMainWindow()->GetKey(a, b)
    6263#define REG_JUMP(a, b, c, d) gContext->GetMainWindow()->RegisterJump(a, b, c, d)
    6364#define REG_MEDIA_HANDLER(a, b, c, d, e) gContext->GetMainWindow()->RegisterMediaHandler(a, b, c, d, e)
    6465#define REG_MEDIAPLAYER(a,b,c) gContext->GetMainWindow()->RegisterMediaPlugin(a, b, c)
     
    9091                 const QString &key);
    9192    void RegisterKey(const QString &context, const QString &action,
    9293                     const QString &description, const QString &key);
     94    QString GetKey(const QString &context, const QString &action) const;
    9395
    9496    void ClearJump(const QString &destination);
    9597    void BindJump(const QString &destination, const QString &key);