Ticket #3551: videomanager-browser.patch

File videomanager-browser.patch, 16.5 KB (added by jcharles@…, 19 years ago)
  • mythvideo/mythvideo/theme-wide/video-ui.xml

    diff -Naur ../mythplugins.orig/mythvideo/mythvideo/theme-wide/video-ui.xml mythvideo/mythvideo/theme-wide/video-ui.xml
    old new  
    8181    </font>
    8282
    8383    <container name="info">
    84       <area>64,36,1152,280</area>
     84      <area>264,36,1152,280</area>
    8585      <textarea name="title" draworder="4" align="center">
    8686        <area>0,0,1152,80</area>
    8787        <font>leadfnt</font>
     
    9292        <value>Director:</value>
    9393      </textarea>
    9494      <textarea name="director" draworder="4">
    95         <area>170,75,647,35</area>
     95        <area>140,75,647,35</area>
    9696        <font>moviedata</font>
    9797      </textarea>
    9898      <textarea name="yrlbl" draworder="4" align="right">
     
    185185      </image>
    186186    </container>
    187187
     188    <font name="dirsel_font" face="Arial">
     189      <color>#33ffff</color>
     190      <size>16</size>
     191      <bold>yes</bold>
     192    </font>
     193
     194    <container name="dirselector">
     195      <area>0,285,190,348</area>
     196      <textarea name="curdir" draworder="4">
     197        <area>20,12,190,35</area>
     198        <font>dirsel_font</font>
     199      </textarea>
     200      <listarea name="directories" draworder="4">
     201        <area>20,37,190,212</area>
     202        <fcnfont name="active_font" function="active"></fcnfont>
     203        <fcnfont name="inactive_font" function="inactive"></fcnfont>
     204        <fcnfont name="active_font" function="selected"></fcnfont>
     205        <columnpadding>10</columnpadding>
     206        <column number="1" width="190" context="-1"></column>
     207        <items>8</items>
     208        <image function="selectionbar" filename="cr-selectbar.png" location="-12,-5"></image>
     209        <image function="uparrow" filename="uparrow.png" location="750,22"></image>
     210        <image function="downarrow" filename="downarrow.png" location="750,195"></image>
     211      </listarea>
     212      <image name="dirshowinglines" draworder="5" fleximage="no">
     213        <filename>cr-lines.png</filename>
     214        <position>0,0</position>
     215        <staticsize>190,290</staticsize>
     216      </image>
     217    </container>
     218
    188219    <container name="selector">
    189       <area>0,336,1280,348</area>
     220      <area>200,336,1280,348</area>
    190221      <image name="showinglines" draworder="5" fleximage="no">
    191222        <filename>cr-lines.png</filename>
    192223        <position>0,0</position>
  • mythvideo/mythvideo/videomanager.cpp

    diff -Naur ../mythplugins.orig/mythvideo/mythvideo/videomanager.cpp mythvideo/mythvideo/videomanager.cpp
    old new  
    263263    isbusy(false)
    264264{
    265265    videoDir = gContext->GetSetting("VideoStartupDir");
     266    m_currentDirectory = videoDir;
     267    m_currentDirname = ".";
     268    m_activeList = MOVIE_LIST;
     269
    266270    artDir = gContext->GetSetting("VideoArtworkDir");
    267271
    268272    VideoFilterSettings video_filter(true, "VideoManager");
     273
    269274    m_video_list->setCurrentVideoFilter(video_filter);
    270275
    271276    m_list_behave.reset(new ListBehaviorManager(0,
    272277                    ListBehaviorManager::lbScrollCenter |
    273278                    ListBehaviorManager::lbWrapList));
    274279    m_movie_list_behave.reset(new ListBehaviorManager);
     280   
     281    m_directories_list_behave.reset(new ListBehaviorManager(0,
     282                    ListBehaviorManager::lbScrollCenter |
     283                    ListBehaviorManager::lbWrapList));
    275284
    276285    backup.reset(new QPainter);
    277286    RefreshMovieList(false);
     
    311320        }
    312321    }
    313322
     323    container = m_theme->GetSet("dirselector");
     324    if (container)
     325    {
     326        UIListType *ltype = (UIListType *)container->GetType("directories");
     327        if (ltype)
     328        {
     329            m_directories_list_behave->setWindowSize(ltype->GetItems());
     330        }
     331    }
     332    makeDirectoriesList();
     333
     334
    314335    bgTransBackup.reset(gContext->LoadScalePixmap("trans-backup.png"));
    315336    if (!bgTransBackup.get())
    316337        bgTransBackup.reset(new QPixmap());
     
    344365            else if (m_state == SHOWING_IMDBMANUAL)
    345366                handleIMDBManual();
    346367            else
    347                slotEditMeta();
    348             return;
     368                switch (m_activeList)
     369                {
     370                    case MOVIE_LIST:
     371                    {
     372                        slotEditMeta();
     373                        break;
     374                    }
     375                    case MOVIE_DIRLIST:
     376                    {
     377                        makeDirectoriesList();
     378                        break;
     379                    }
     380                }
     381                return;
    349382        }
    350383        else if ((action == "0" || action == "1" || action == "2" ||
    351384                 action == "3" || action == "4" || action == "5" ||
     
    410443    else
    411444    {
    412445        m_video_list->refreshList(false, 0, true);
    413         m_list_behave->setItemCount(m_video_list->count());
     446        makeVideoSublist ();
     447        m_list_behave->setItemCount(m_videoIndexesList.count());
    414448    }
    415449    curitem = m_video_list->getVideoListMetadata(m_list_behave->getIndex());
    416450    updateML = false;
     
    864898       if (r.intersects(listRect) && noUpdate == false)
    865899       {
    866900           updateList(&p);
     901           updateDirectoriesList (&p);
    867902       }
    868903       if (r.intersects(infoRect) && noUpdate == false)
    869904       {
     
    885920    }
    886921}
    887922
     923void VideoManager::makeDirectoriesList()
     924{
     925    LayerSet *container = m_theme->GetSet("dirselector");
     926    if (container)
     927    {
     928
     929        UIListType *ltype = (UIListType *)container->GetType("directories");
     930        if (ltype) {
     931            QDir dir(m_currentDirectory);
     932
     933            if (ltype->GetCurrentItem() != -1) {
     934                QString dirSelected = ltype->GetItemText(ltype->GetCurrentItem());
     935                dir.cd(dirSelected);
     936            }
     937
     938            m_currentDirectory = dir.path();
     939            m_currentDirname = dir.dirName();
     940
     941            m_directoriesList = dir.entryList (QDir::Dirs);
     942            m_directoriesList.pop_front();  // Get rid of directory  "."
     943
     944            if (m_currentDirectory == gContext->GetSetting("VideoStartupDir"))
     945            {
     946                m_currentDirname = "Videothéque";
     947                m_directoriesList.pop_front(); // Get rid of directory ".."
     948            }
     949
     950            m_directories_list_behave->setItemCount(m_directoriesList.count());
     951
     952            makeVideoSublist();
     953            update(fullRect);
     954        }
     955    }
     956}
     957
     958void VideoManager::makeVideoSublist()
     959{
     960    m_videoIndexesList.clear();
     961    for (unsigned int i = 0; i < m_video_list->count(); i++)
     962    {
     963        Metadata *meta = m_video_list->getVideoListMetadata(i);
     964        QString filename = meta->Filename();
     965
     966        QString videoname = filename.section ('/',-1);
     967        QString path = filename.section ('/', 0, -2);
     968        if ( path == m_currentDirectory ) {
     969            m_videoIndexesList.append (i);
     970        }
     971    }
     972    m_list_behave->setItemCount(m_videoIndexesList.count());
     973}
     974   
    888975void VideoManager::updateList(QPainter *p)
    889976{
    890977    QRect pr = listRect;
     
    901988            ltype->ResetList();
    902989            ltype->SetActive(true);
    903990
     991//tata
    904992            const ListBehaviorManager::lb_data &lbd = m_list_behave->getData();
    905993            for (unsigned int i = lbd.begin; i < lbd.end; ++i)
    906994            {
    907                 Metadata *meta = m_video_list->getVideoListMetadata(i);
     995                Metadata *meta = m_video_list->getVideoListMetadata(m_videoIndexesList[i]);
    908996
    909997                QString title = meta->Title();
    910998                QString filename = meta->Filename();
     
    9311019            ltype->SetDownArrow(lbd.data_below_window);
    9321020            ltype->SetUpArrow(lbd.data_above_window);
    9331021        }
    934 
    9351022        for (int i = 0; i < 9; ++i)
    9361023        {
    9371024            container->Draw(&tmp, i, 0);
     
    10141101    p->drawPixmap(pr.topLeft(), pix);
    10151102}
    10161103
     1104void VideoManager::updateDirectoriesList (QPainter *p)
     1105{
     1106    QRect pr = dirListRect;
     1107    QPixmap pix(pr.size());
     1108    pix.fill(this, pr.topLeft());
     1109    QPainter tmp(&pix);
     1110
     1111    LayerSet *container = m_theme->GetSet("dirselector");
     1112    if (container)
     1113    {
     1114        UITextType *ttype = (UITextType *)container->GetType("curdir");
     1115        UIListType *ltype = (UIListType *)container->GetType("directories");
     1116
     1117        if (ttype) checkedSetText(ttype, m_currentDirname);       
     1118// toto
     1119
     1120        if (ltype) {
     1121            ltype->ResetList();
     1122            ltype->SetActive(true);
     1123
     1124            const ListBehaviorManager::lb_data &lbd = m_directories_list_behave->getData();
     1125            for (unsigned int i = lbd.begin; i < lbd.end; ++i)
     1126            {
     1127                    ltype->SetItemText(i - lbd.begin, 1, m_directoriesList[i]);
     1128            }
     1129            ltype->SetItemCurrent(lbd.index);
     1130
     1131            ltype->SetDownArrow(lbd.data_below_window);
     1132            ltype->SetUpArrow(lbd.data_above_window);
     1133            }
     1134               
     1135        for (int i = 0; i < 9; ++i)
     1136            {
     1137                container->Draw(&tmp, i, 0);
     1138            }
     1139    }
     1140
     1141    tmp.end();
     1142
     1143    p->drawPixmap(pr.topLeft(), pix);
     1144}
     1145
    10171146void VideoManager::updateInfo(QPainter *p)
    10181147{
    10191148    QRect pr = infoRect;
     
    11301259        movieListRect = area;
    11311260    if (container_name == "enterimdb")
    11321261        imdbEnterRect = area;
     1262    if (container_name == "dirselector")
     1263        dirListRect = area;
    11331264}
    11341265
    11351266void VideoManager::exitWin()
     
    11671298
    11681299void VideoManager::cursorLeft()
    11691300{
     1301
     1302    /*
    11701303    if (expectingPopup)
    11711304        cancelPopup();
    11721305    else
    11731306        exitWin();
     1307    */
     1308
     1309    if (m_activeList == MOVIE_LIST) m_activeList = MOVIE_DIRLIST;
     1310
    11741311}
    11751312
    11761313void VideoManager::cursorRight()
    11771314{
     1315/*
    11781316    videoMenu();
     1317*/
     1318   
     1319    if (m_activeList == MOVIE_DIRLIST) m_activeList = MOVIE_LIST;
    11791320}
    11801321
    11811322void VideoManager::cursorDown()
     
    11841325    {
    11851326        case SHOWING_MAINWINDOW:
    11861327        {
    1187             m_list_behave->move_down();
     1328            switch (m_activeList)
     1329            {
     1330                case MOVIE_LIST:
     1331                    m_list_behave->move_down();
     1332                    break;
     1333                case MOVIE_DIRLIST:
     1334                    m_directories_list_behave->move_down();
     1335                    break;
     1336            }
    11881337            break;
    11891338        }
    11901339        case SHOWING_IMDBLIST:
     
    12071356    {
    12081357        case SHOWING_MAINWINDOW:
    12091358        {
    1210             m_list_behave->page_down();
     1359            if (m_activeList == MOVIE_LIST) m_list_behave->page_down();
    12111360            break;
    12121361        }
    12131362        case SHOWING_IMDBLIST:
     
    12301379    {
    12311380        case SHOWING_MAINWINDOW:
    12321381        {
    1233             m_list_behave->move_up();
     1382            switch (m_activeList)
     1383            {
     1384                case MOVIE_LIST:
     1385                {
     1386                    m_list_behave->move_up();
     1387                    break;
     1388                }
     1389                case MOVIE_DIRLIST:
     1390                {
     1391                    m_directories_list_behave->move_up();
     1392                    break;
     1393                }
     1394            }
    12341395            update(fullRect);
    12351396            break;
    12361397        }
     
    12541415    {
    12551416        case SHOWING_MAINWINDOW:
    12561417        {
    1257             m_list_behave->page_up();
    1258             update(fullRect);
     1418            if (m_activeList == MOVIE_LIST) {
     1419                m_list_behave->page_up();
     1420                update(fullRect);
     1421            }
    12591422            break;
    12601423        }
    12611424        case SHOWING_IMDBLIST:
  • mythvideo/mythvideo/videomanager.h

    diff -Naur ../mythplugins.orig/mythvideo/mythvideo/videomanager.h mythvideo/mythvideo/videomanager.h
    old new  
    1616        SHOWING_IMDBLIST,
    1717        SHOWING_IMDBMANUAL
    1818    };
     19    enum ActiveList
     20    {
     21        MOVIE_LIST = 0,
     22        MOVIE_DIRLIST
     23    };
    1924}
    2025
    2126class QPainter;
     
    8590    void updateMovieList(QPainter *);
    8691    void updateInfo(QPainter *);
    8792    void updateIMDBEnter(QPainter *);
     93    void updateDirectoriesList (QPainter *);
    8894
    8995    void grayOut(QPainter *);
     96    void makeDirectoriesList();
     97    void makeVideoSublist();
    9098
    9199  private:
    92100    bool updateML;
    93101    bool noUpdate;
    94 
    95102    VideoList *m_video_list;
    96103
    97104    std::auto_ptr<XMLParse> m_theme;
     
    113120    QRect infoRect;
    114121    QRect fullRect;
    115122    QRect imdbEnterRect;
     123    QRect dirListRect;
    116124
    117125    QString movieNumber;
    118126
     
    126134    bool iscopycomplete;
    127135    bool iscopysuccess;
    128136
     137    unsigned int m_activeList; // are selecting Video or directory
     138    QString m_currentDirectory;      // Path of the current directory
     139    QString m_currentDirname;  // Name of the current directory
     140    QStringList m_directoriesList;  // List of directories in current directory;
     141    QValueList<int> m_videoIndexesList; // List of m_video_list indexes present in current directory
     142
    129143    std::auto_ptr<ListBehaviorManager> m_list_behave;
    130144    std::auto_ptr<ListBehaviorManager> m_movie_list_behave;
     145    std::auto_ptr<ListBehaviorManager> m_directories_list_behave;
    131146};
    132147
    133148#endif
  • mythvideo/mythvideo/video-ui.xml

    diff -Naur ../mythplugins.orig/mythvideo/mythvideo/video-ui.xml mythvideo/mythvideo/video-ui.xml
    old new  
    8383    <container name="background">
    8484      <image name="filler" draworder="0" fleximage="yes">
    8585        <filename>cr-background.png</filename>
    86         <position>0,285</position>
     86        <position>200,285</position>
    8787        <staticsize>800,290</staticsize>
    8888      </image>
    8989    </container>
     
    185185        <font>moviedata</font>
    186186      </textarea>
    187187    </container>
     188
     189    <font name="dirsel_font" face="Arial">
     190      <color>#33ffff</color>
     191      <size>16</size>
     192      <bold>yes</bold>
     193    </font>
     194
     195    <container name="dirselector">
     196      <area>0,285,190,320</area>
     197      <textarea name="curdir" draworder="4">
     198        <area>20,12,190,35</area>
     199        <font>dirsel_font</font>
     200      </textarea>
     201      <listarea name="directories" draworder="4">
     202        <area>20,37,190,212</area>
     203        <fcnfont name="active_font" function="active"></fcnfont>
     204        <fcnfont name="inactive_font" function="inactive"></fcnfont>
     205        <fcnfont name="active_font" function="selected"></fcnfont>
     206        <columnpadding>10</columnpadding>
     207        <column number="1" width="190" context="-1"></column>
     208        <items>8</items>
     209        <image function="selectionbar" filename="cr-selectbar.png" location="-12,-5"></image>
     210        <image function="uparrow" filename="uparrow.png" location="750,22"></image>
     211        <image function="downarrow" filename="downarrow.png" location="750,195"></image>
     212      </listarea>
     213      <image name="dirshowinglines" draworder="5" fleximage="no">
     214        <filename>cr-lines.png</filename>
     215        <position>0,0</position>
     216        <staticsize>190,290</staticsize>
     217      </image>
     218    </container>
    188219 
    189220    <container name="selector">
    190       <area>0,285,800,320</area>
     221      <area>200,285,800,320</area>
    191222      <listarea name="listing" draworder="4">
    192         <area>20,12,760,242</area>
     223        <area>20,12,560,242</area>
    193224        <fcnfont name="active_font" function="active"></fcnfont>
    194225        <fcnfont name="inactive_font" function="inactive"></fcnfont>
    195226        <fcnfont name="active_font" function="selected"></fcnfont>
    196227        <columnpadding>10</columnpadding>
    197         <column number="1" width="400" context="-1"></column>
    198         <column number="2" width="200" context="-1"></column>
    199         <column number="3" width="100" context="-1"></column>
     228        <column number="1" width="300" context="-1"></column>
     229        <column number="2" width="150" context="-1"></column>
     230        <column number="3" width="75" context="-1"></column>
    200231        <items>8</items>
    201232        <image function="selectionbar" filename="cr-selectbar.png" location="-12,-5"></image>
    202233        <image function="uparrow" filename="uparrow.png" location="750,22"></image>
     
    205236      <image name="showinglines" draworder="5" fleximage="no">
    206237        <filename>cr-lines.png</filename>
    207238        <position>0,0</position>
    208         <staticsize>800,290</staticsize>
     239        <staticsize>600,290</staticsize>
    209240      </image>
    210241      <textarea name="keyslbl_one" draworder="4" align="left">
    211242        <area>15,275,200,30</area>
     
    218249        <value></value>
    219250      </textarea>
    220251      <textarea name="keyslbl_three" draworder="4" align="right">
    221         <area>580,275,200,30</area>
     252        <area>350,275,200,30</area>
    222253        <font>keysfont</font>
    223254        <value>INFO - Action Menu</value>       
    224255      </textarea>