Ticket #9391: mythtv-0-24-lcd-progress-time.diff

File mythtv-0-24-lcd-progress-time.diff, 6.5 KB (added by Michael Zanetti <michael_zanetti@…>, 7 years ago)

Path that adds time information on the LCD display during playback.

  • mythtv/libs/libmythdb/lcddevice.cpp

    diff --git a/mythtv/libs/libmythdb/lcddevice.cpp b/mythtv/libs/libmythdb/lcddevice.cpp
    index 9fbe7d2..ad7d705 100644
    a b void LCD::setTunerLEDs(enum LCDTunerSet tuner, bool on) 
    498498    sendToServer(QString("UPDATE_LEDS %1").arg(lcd_ledmask));
    499499}
    500500
    501 void LCD::setChannelProgress(float value)
     501void LCD::setChannelProgress(QString time, float value)
    502502{
    503503    if (!lcd_ready || !lcd_showchannel)
    504504        return;
    505505
    506506    value = std::min(std::max(0.0f, value), 1.0f);
    507     sendToServer(QString("SET_CHANNEL_PROGRESS %1").arg(value));
     507    sendToServer(QString("SET_CHANNEL_PROGRESS %1 %2").arg(quotedString(time)).arg(value));
    508508}
    509509
    510510void LCD::setGenericProgress(float value)
  • mythtv/libs/libmythdb/lcddevice.h

    diff --git a/mythtv/libs/libmythdb/lcddevice.h b/mythtv/libs/libmythdb/lcddevice.h
    index c5e4002..e576817 100644
    a b class MPUBLIC LCD : public QObject, public MythSocketCBs 
    236236    // While watching Live/Recording/Pause Buffer, occasionaly describe how
    237237    // much of the program has been seen (between 0.0 and 1.0)
    238238    // (e.g. [current time - start time] / [end time - start time]  )
    239     void setChannelProgress(float percentViewed);
     239    void setChannelProgress(QString time, float percentViewed);
    240240
    241241    // Show the Menu
    242242    // QPtrList is a pointer to a bunch of menu items
  • mythtv/libs/libmythtv/tv_play.cpp

    diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
    index 5f57074..6e8d3fd 100644
    a b bool TV::HandleLCDTimerEvent(void) 
    30003000    if (lcd)
    30013001    {
    30023002        float progress = 0.0f;
     3003        QString lcd_time_string;
    30033004        bool showProgress = true;
    30043005
    30053006        if (StateIsLiveTV(GetState(actx)))
    bool TV::HandleLCDTimerEvent(void) 
    30143015        if (showProgress)
    30153016        {
    30163017            osdInfo info;
    3017             if (actx->CalcPlayerSliderPosition(info))
     3018            if (actx->CalcPlayerSliderPosition(info)) {
    30183019                progress = info.values["position"] * 0.001f;
     3020
     3021                lcd_time_string = info.text["playedtime"] + " / " + info.text["totaltime"];
     3022                // if the string is longer than the LCD width, remove all spaces
     3023                if (lcd_time_string.length() > (int)lcd->getLCDWidth())
     3024                    lcd_time_string.remove(' ');
     3025            }
    30193026        }
    3020         lcd->setChannelProgress(progress);
     3027        lcd->setChannelProgress(lcd_time_string, progress);
    30213028    }
    30223029    ReturnPlayerLock(actx);
    30233030
  • mythtv/programs/mythlcdserver/lcdprocclient.cpp

    diff --git a/mythtv/programs/mythlcdserver/lcdprocclient.cpp b/mythtv/programs/mythlcdserver/lcdprocclient.cpp
    index 301a269..7df20f4 100644
    a b void LCDProcClient::init() 
    473473    setPriority("Channel", LOW);
    474474    sendToServer("widget_add Channel topWidget string");
    475475    sendToServer("widget_add Channel botWidget string");
     476    sendToServer("widget_add Channel timeWidget string");
    476477    sendToServer("widget_add Channel progressBar hbar");
    477478
    478479    // The Generic Screen
    void LCDProcClient::startChannel(QString channum, QString title, QString subtitl 
    11241125        formatScrollingWidgets();
    11251126    }
    11261127
     1128    channel_time = "";
    11271129    progress = 0.0;
    11281130    outputChannel();
    11291131}
    void LCDProcClient::setLevels(int numbLevels, float *values) 
    16791681    }
    16801682}
    16811683
    1682 void LCDProcClient::setChannelProgress(float value)
     1684void LCDProcClient::setChannelProgress(const QString &time, float value)
    16831685{
    16841686    if (!lcd_ready)
    16851687        return;
    16861688
    16871689    progress = value;
     1690    channel_time = time;
    16881691
    16891692    if (progress < 0.0)
    16901693        progress = 0.0;
    void LCDProcClient::outputChannel() 
    21602163        aString += " ";
    21612164        aString += QString::number((int)rint(progress * lcdWidth * cellWidth));
    21622165        sendToServer(aString);
     2166
     2167        if (lcdHeight >= 4)
     2168            outputCenteredText("Channel", channel_time, "timeWidget", 3);
    21632169    }
    21642170    else
    21652171        sendToServer("widget_set Channel progressBar 1 1 0");
    void LCDProcClient::removeWidgets() 
    23132319{
    23142320    sendToServer("widget_del Channel progressBar");
    23152321    sendToServer("widget_del Channel topWidget");
     2322    sendToServer("widget_del Channel timeWidget");
    23162323    sendToServer("screen_del Channel");
    23172324
    23182325    sendToServer("widget_del Generic progressBar");
  • mythtv/programs/mythlcdserver/lcdprocclient.h

    diff --git a/mythtv/programs/mythlcdserver/lcdprocclient.h b/mythtv/programs/mythlcdserver/lcdprocclient.h
    index 5a31200..a87339d 100644
    a b class LCDProcClient : public QObject 
    4343    void setLevels(int numbLevels, float *values);
    4444    void switchToChannel(QString channum = "", QString title = "",
    4545                         QString subtitle = "");
    46     void setChannelProgress(float percentViewed);
     46    void setChannelProgress(const QString &time, float percentViewed);
    4747    void switchToMenu(QList<LCDMenuItem> *menuItems, QString app_name = "",
    4848                      bool popMenu = true);
    4949    void switchToGeneric(QList<LCDTextItem> *textItems);
    class LCDProcClient : public QObject 
    169169
    170170    float EQlevels[10];
    171171    float progress;
     172    QString channel_time;
    172173    /** true if the generic progress indicator is a busy
    173174        (ie. doesn't have a known total steps */
    174175    bool busy_progress;
  • mythtv/programs/mythlcdserver/lcdserver.cpp

    diff --git a/mythtv/programs/mythlcdserver/lcdserver.cpp b/mythtv/programs/mythlcdserver/lcdserver.cpp
    index fce6036..7ffb2b0 100644
    a b void LCDServer::setChannelProgress(const QStringList &tokens, QTcpSocket *socket 
    579579
    580580    QString flat = tokens.join(" ");
    581581
    582     if (tokens.count() != 2)
     582    if (tokens.count() != 3)
    583583    {
    584584        VERBOSE(VB_IMPORTANT, "LCDServer: bad SET_CHANNEL_PROGRESS command: "
    585585                << flat);
    void LCDServer::setChannelProgress(const QStringList &tokens, QTcpSocket *socket 
    588588    }
    589589
    590590    bool bOK;
    591     float progress = tokens[1].toFloat(&bOK);
     591    float progress = tokens[2].toFloat(&bOK);
    592592    if (!bOK)
    593593    {
    594594        VERBOSE(VB_IMPORTANT, "LCDServer: bad float value in "
    void LCDServer::setChannelProgress(const QStringList &tokens, QTcpSocket *socket 
    598598    }
    599599
    600600    if (m_lcd)
    601         m_lcd->setChannelProgress(progress);
     601        m_lcd->setChannelProgress(tokens[1], progress);
    602602
    603603    sendMessage(socket, "OK");
    604604}