Ticket #6814: 6814-v1.diff

File 6814-v1.diff, 9.9 KB (added by paulh, 14 years ago)

Updated patch to current trunk

  • libs/libmythui/mythdialogbox.h

     
    8585
    8686  signals:
    8787    void Selected();
    88     void Closed();
     88    void Closed(QString, int);
    8989
    9090  protected:
    9191    void SendEvent(int res, QString text = "", QVariant data = 0);
  • libs/libmythui/mythdialogbox.cpp

     
    144144        QString action = actions[i];
    145145        handled = true;
    146146
    147         if (action == "ESCAPE" || action == "LEFT" || action == "MENU")
     147        if (action == "ESCAPE" || action == "LEFT")
    148148        {
    149149            SendEvent(-1);
    150150            Close();
    151151        }
     152        else if (action == "MENU")
     153        {
     154            SendEvent(-2);
     155            Close();
     156        }
    152157        else if (action == "RIGHT")
    153158        {
    154159            MythUIButtonListItem *item = m_buttonList->GetItemCurrent();
     
    189194
    190195void MythDialogBox::SendEvent(int res, QString text, QVariant data)
    191196{
     197    emit Closed(m_id, res);
     198
    192199    if (!m_retObject)
    193200        return;
    194201
  • programs/mythfrontend/playbackbox.cpp

     
    361361
    362362      // General m_popupMenu support
    363363      m_popupMenu(NULL),
     364      m_doToggleMenu(true),
    364365      // Main Recording List support
    365366      m_progsInDB(0),
    366367      // Other state
     
    988989
    989990    if (usedProgress)
    990991    {
    991         usedProgress->SetTotal(freeSpaceTotal);
    992         usedProgress->SetUsed(freeSpaceUsed);
     992        usedProgress->SetTotal((int)freeSpaceTotal);
     993        usedProgress->SetUsed((int)freeSpaceUsed);
    993994    }
    994995}
    995996
     
    18561857    }
    18571858}
    18581859
    1859 void PlaybackBox::popupClosed()
     1860void PlaybackBox::popupClosed(QString which, int result)
    18601861{
    18611862    m_popupMenu = NULL;
     1863
     1864    if (result == -2)
     1865    {
     1866        if (!m_doToggleMenu)
     1867        {
     1868            m_doToggleMenu = true;
     1869            return;
     1870        }
     1871
     1872        if (which == "groupmenu")
     1873        {
     1874            ProgramInfo *pginfo = CurrentItem();
     1875            if (pginfo)
     1876            {
     1877                m_helper.CheckAvailability(*pginfo, kCheckForMenuAction);
     1878
     1879                if ((asPendingDelete == pginfo->availableStatus) ||
     1880                    (asPendingDelete == pginfo->availableStatus))
     1881                {
     1882                    ShowAvailabilityPopup(*pginfo);
     1883                }
     1884                else
     1885                {
     1886                    ShowActionPopup(*pginfo);
     1887                    m_doToggleMenu = false;
     1888                }
     1889            }
     1890        }
     1891        else if (which == "actionmenu")
     1892        {
     1893            ShowGroupPopup();
     1894            m_doToggleMenu = false;
     1895        }
     1896    }
    18621897}
    18631898
    1864 void PlaybackBox::ShowMenu()
     1899void PlaybackBox::ShowGroupPopup()
    18651900{
    18661901    if (m_popupMenu)
    18671902        return;
    18681903
    1869     QString label = tr("Recording List Menu");
     1904    QString label = tr("Group List Menu");
    18701905
    18711906    ProgramInfo *pginfo = CurrentItem();
    18721907
    18731908    m_popupMenu = new MythDialogBox(label, m_popupStack, "pbbmainmenupopup");
    18741909
    1875     connect(m_popupMenu, SIGNAL(Exiting()), SLOT(popupClosed()));
     1910    connect(m_popupMenu, SIGNAL(Closed(QString, int)), SLOT(popupClosed(QString, int)));
    18761911
    18771912    if (m_popupMenu->Create())
    18781913        m_popupStack->AddScreen(m_popupMenu);
     
    18801915    {
    18811916        delete m_popupMenu;
    18821917        m_popupMenu = NULL;
     1918        return;
    18831919    }
    18841920
    1885     m_popupMenu->SetReturnEvent(this, "slotmenu");
     1921    m_popupMenu->SetReturnEvent(this, "groupmenu");
    18861922
    18871923    m_popupMenu->AddButton(tr("Change Group Filter"),
    18881924                                 SLOT(showGroupFilter()));
     
    19141950    }
    19151951
    19161952    m_popupMenu->AddButton(tr("Help (Status Icons)"), SLOT(showIconHelp()));
     1953
     1954#if 0
     1955    if (GetFocusWidget() != m_groupList)
     1956    {
     1957        m_popupMenu->AddButton(tr("Recording Options Menu"),
     1958            SLOT(showActionsSelected()));
     1959    }
     1960#endif
    19171961}
    19181962
    19191963bool PlaybackBox::Play(const ProgramInfo &rec, bool inPlaylist)
     
    22332277
    22342278    m_popupMenu = new MythDialogBox(label, m_popupStack, "pbbmainmenupopup");
    22352279
    2236     connect(m_popupMenu, SIGNAL(Exiting()), SLOT(popupClosed()));
     2280    connect(m_popupMenu, SIGNAL(Closed(QString, int)), SLOT(popupClosed(QString, int)));
    22372281
    22382282    if (m_popupMenu->Create())
    22392283        m_popupStack->AddScreen(m_popupMenu);
     
    22412285    {
    22422286        delete m_popupMenu;
    22432287        m_popupMenu = NULL;
     2288        return;
    22442289    }
    22452290
    2246     m_popupMenu->SetReturnEvent(this, "slotmenu");
     2291    m_popupMenu->SetReturnEvent(this, "deletemenu");
    22472292
    22482293    QString tmpmessage;
    22492294    const char *tmpslot = NULL;
     
    25292574    if (!m_popupMenu)
    25302575        return false;
    25312576
    2532     connect(m_popupMenu, SIGNAL(Exiting()), SLOT(popupClosed()));
     2577    connect(m_popupMenu, SIGNAL(Closed(QString, int)), SLOT(popupClosed(QString, int)));
    25332578
    25342579    if (m_popupMenu->Create())
    25352580    {
     
    25432588        return false;
    25442589    }
    25452590
    2546     return m_popupMenu;
     2591    return true;
    25472592}
    25482593
    25492594bool PlaybackBox::CreatePopupMenuPlaylist(void)
     
    27342779    if (!CreatePopupMenu(label, pginfo))
    27352780        return;
    27362781
     2782    m_popupMenu->SetReturnEvent(this, "actionmenu");
     2783
    27372784    if ((asFileNotFound  == pginfo.availableStatus) ||
    27382785        (asZeroByte      == pginfo.availableStatus))
    27392786    {
     
    27782825                                        SLOT(showPlayFromPopup()), true);
    27792826        else
    27802827            m_popupMenu->AddButton(tr("Play"), SLOT(playSelected()));
    2781 
     2828                     
    27822829        if (m_playList.filter(pginfo.MakeUniqueKey()).size())
    27832830            m_popupMenu->AddButton(tr("Remove from Playlist"),
    27842831                                        SLOT(togglePlayListItem()));
    27852832        else
    27862833            m_popupMenu->AddButton(tr("Add to Playlist"),
    27872834                                        SLOT(togglePlayListItem()));
     2835        if (m_playList.size())
     2836        {
     2837            m_popupMenu->AddButton(tr("Playlist options"),
     2838                         SLOT(showPlaylistPopup()), true);
     2839        }
    27882840    }
    27892841
    27902842    if (pginfo.recstatus == rsRecording &&
     
    28212873            m_popupMenu->AddButton(tr("Delete"), SLOT(askDelete()));
    28222874        }
    28232875    }
     2876#if 0
     2877    m_popupMenu->AddButton(tr("Group List Menu"),
     2878                                SLOT(ShowGroupPopup()));
     2879#endif
    28242880}
    28252881
    28262882QString PlaybackBox::CreateProgramInfoString(const ProgramInfo &pginfo) const
     
    34443500
    34453501        if (action == "1" || action == "HELP")
    34463502            showIconHelp();
     3503        else if (action == "MENU")
     3504        {
     3505             if (GetFocusWidget() == m_groupList)
     3506                 ShowGroupPopup();
     3507             else
     3508             {
     3509                 ProgramInfo *pginfo = CurrentItem();
     3510                 if (pginfo)
     3511                 {
     3512                     m_helper.CheckAvailability(
     3513                         *pginfo, kCheckForMenuAction);
     3514
     3515                     if ((asPendingDelete == pginfo->availableStatus) ||
     3516                         (asPendingDelete == pginfo->availableStatus))
     3517                     {
     3518                         ShowAvailabilityPopup(*pginfo);
     3519                     }
     3520                     else
     3521                     {
     3522                         ShowActionPopup(*pginfo);
     3523                     }
     3524                 }
     3525             }
     3526        }
    34473527        else if (action == "NEXTFAV")
    34483528        {
    34493529            if (GetFocusWidget() == m_groupList)
     
    35033583                deleteSelected(m_recordingList->GetItemCurrent());
    35043584            else if (action == "PLAYBACK")
    35053585                playSelected(m_recordingList->GetItemCurrent());
    3506             else if (action == "INFO")
    3507             {
    3508                 if (GetFocusWidget() != m_groupList)
    3509                 {
    3510                     ProgramInfo *pginfo = CurrentItem();
    3511                     if (pginfo)
    3512                     {
    3513                         m_helper.CheckAvailability(
    3514                             *pginfo, kCheckForMenuAction);
    3515 
    3516                         if ((asPendingDelete == pginfo->availableStatus) ||
    3517                             (asPendingDelete == pginfo->availableStatus))
    3518                         {
    3519                             ShowAvailabilityPopup(*pginfo);
    3520                         }
    3521                         else
    3522                         {
    3523                             ShowActionPopup(*pginfo);
    3524                         }
    3525                     }
    3526                 }
    3527             }
    3528             else if (action == "DETAILS")
     3586            else if (action == "DETAILS" || action == "INFO")
    35293587                details();
    35303588            else if (action == "CUSTOMEDIT")
    35313589                customEdit();
  • programs/mythfrontend/playbackbox.h

     
    138138
    139139    void SwitchList(void);
    140140
     141    void ShowGroupPopup(void);
    141142    void customEdit();
    142143    void upcoming();
    143144    void details();
     
    169170    void ShowRecGroupChanger(bool use_playlist = false);
    170171    void ShowPlayGroupChanger(bool use_playlist = false);
    171172
    172     void popupClosed();
     173    void popupClosed(QString which, int reason);
    173174
    174175    void doPlayFromBeg();
    175176    void doPlayListRandom();
     
    316317
    317318    void ScheduleUpdateUIList(void);
    318319
    319     void ShowMenu(void);
    320 
    321320    bool CreatePopupMenu(const QString &title);
    322321    bool CreatePopupMenu(const QString &title, const ProgramInfo &pginfo)
    323322        { return CreatePopupMenu(title + CreateProgramInfoString(pginfo)); }
     
    385384    MythDialogBox      *m_popupMenu;
    386385    MythScreenStack    *m_popupStack;
    387386
    388     bool m_expectingPopup;
     387    bool m_doToggleMenu;
    389388
    390389    // Recording Group popup support
    391390    QMap<QString,QString> m_recGroupType;