Ticket #1010: mythlcdserver.diff

File mythlcdserver.diff, 4.3 KB (added by leo@…, 18 years ago)
  • lcdprocclient.cpp

     
    432432    sendToServer("screen_add Music");
    433433    setPriority("Music", LOW);
    434434    sendToServer("widget_add Music topWidget string");
     435    sendToServer("widget_add Music topWidget2 string");
    435436    sendToServer("widget_add Music timeWidget string");
    436437    sendToServer("widget_add Music infoWidget string");
    437438    sendToServer("widget_add Music progressBar hbar");
     
    928929
    929930void LCDProcClient::startMusic(QString artist, QString album, QString track)
    930931{
     932    // Playing music displays:
     933    // For 2-line displays:
     934    //       <ArtistAlbumTitle>
     935    //       <Elapse/Remaining Time>
     936    // For 3-line displays:
     937    //       <ArtistAlbumTitle>
     938    //       <Elapse/Remaining Time>
     939    //       <Info+ProgressBar>
     940    // For displays with more than 3 lines:
     941    //       <ArtistAlbum>
     942    //       <Title>
     943    //       <Elapse/Remaining Time>
     944    //       <Info+ProgressBar>
     945
     946    // Clear the progressBar and timeWidget before activating the Music
     947    // screen. This prevents the display of outdated junk.
     948    sendToServer("widget_set Music progressBar 1 1 0");
     949    sendToServer("widget_set Music timeWidget 1 1 \"\"");
     950
    931951    QString aString;
    932952    music_progress = 0.0f;
    933     if (lcd_showmusic)
    934       setPriority("Music", HIGH);
    935953    aString = artist;
    936954    if (lcd_showmusic_items == "ArtistAlbumTitle") {
    937955        aString += " [";
    938956        aString += album;
    939957        aString += "] ";
    940     } else {
     958    } else if (lcdHeight < 4) {
    941959        aString += " - ";
    942960    }
    943     aString += track;
     961
     962    if (lcdHeight < 4) {
     963        aString += track;
     964    }
     965    else {
     966        assignScrollingText(track, "Music", "topWidget2", 2);
     967    }
     968    assignScrollingText(aString, "Music");
     969
     970
     971    // OK, every this is at least somewhat initialised. Activate
     972    // the music screen.
    944973    activeScreen = "Music";
    945     assignScrollingText(aString, "Music");
     974    if (lcd_showmusic)
     975      setPriority("Music", HIGH);
    946976}
    947977
    948978void LCDProcClient::startChannel(QString channum, QString title, QString subtitle)
     
    17831813
    17841814void LCDProcClient::outputMusic()
    17851815{
    1786     outputCenteredText("Music", music_time, "timeWidget", 2);
     1816    int info_width = 0;
    17871817
     1818    // See startMusic() for a discription of the Music screen contents
     1819
     1820    outputCenteredText("Music", music_time, "timeWidget",
     1821                                lcdHeight < 4 ? 2 : 3);
     1822
    17881823    if (lcdHeight > 2)
    17891824    {
    1790         QString props;
    1791         QString shuffle = "      ";
    1792         QString repeat  = "      ";
     1825        QString aString;
     1826        QString shuffle = "";
     1827        QString repeat  = "";
    17931828
    17941829        if (music_shuffle == 1)
    17951830        {
    1796             shuffle = "Shfl ?";
     1831            shuffle = "S:? ";
    17971832        }
    17981833        else if (music_shuffle == 2)
    17991834        {
    1800             shuffle = "Shfl i";         
     1835            shuffle = "S:i ";
    18011836        }
    18021837
    18031838        if (music_repeat == 1)
    18041839        {
    1805             repeat = "Rpt 1";
     1840            repeat = "R:1 ";
    18061841        }
    18071842        else if (music_repeat == 2)
    18081843        {
    1809             repeat = "Rpt *";         
     1844            repeat = "R:* ";
    18101845        }
    18111846
    1812         props.sprintf("%s  %s", shuffle.ascii(), repeat.ascii());
     1847        if (shuffle.length() != 0 || repeat.length() != 0) {
     1848            aString.sprintf("%s%s", shuffle.ascii(), repeat.ascii());
    18131849
    1814         outputCenteredText("Music", props, "infoWidget", lcdHeight);
    1815     }
     1850            info_width = aString.length();
     1851            outputLeftText("Music", aString, "infoWidget", lcdHeight);
     1852        }
     1853        else
     1854            outputLeftText("Music", "        ", "infoWidget", lcdHeight);
    18161855
    1817     if (lcdHeight > 3)
    1818     {
    1819         QString aString;
    1820         aString = "widget_set Music progressBar 1 3 ";
    1821         aString += QString::number((int)rint(music_progress * lcdWidth *
    1822                                              cellWidth));
     1856        aString = "widget_set Music progressBar ";
     1857        aString += QString::number(info_width + 1);
     1858        aString += " ";
     1859        aString += QString::number(lcdHeight);
     1860        aString += " ";
     1861        aString += QString::number((int)rint(music_progress *
     1862                                        (lcdWidth - info_width) * cellWidth));
    18231863        sendToServer(aString);
     1864
    18241865    }
    18251866}
    18261867