Ticket #5920: trailerplayback.2.diff

File trailerplayback.2.diff, 2.4 KB (added by robert.mcnamara@…, 15 years ago)

Second version, ask to play trailer only if one exists.

  • mythvideo/mythvideo/videodlg.h

     
    5656    void SetCurrentNode(MythGenericTree *);
    5757
    5858    void playVideo();
     59    void playTrailer();
    5960
    6061    void SwitchTree();
    6162    void SwitchGallery();
  • mythvideo/mythvideo/videodlg.cpp

     
    2121#include <mythtv/libmythui/mythuistatetype.h>
    2222#include <mythtv/libmythui/mythdialogbox.h>
    2323#include <mythtv/libmythui/mythgenerictree.h>
     24#include "mythtv/libmythui/mythmainwindow.h"
    2425
    2526#include "videodlg.h"
    2627#include "videoscan.h"
     
    13421343{
    13431344    QString label = tr("Select action");
    13441345
     1346    Metadata *metadata = GetMetadata(GetItemCurrent());
     1347    QString trailerFile = QString("%1.trailer").arg(metadata->Filename());     
     1348
    13451349    m_menuPopup = new MythDialogBox(label, m_popupStack, "videomenupopup");
    13461350
    13471351    if (m_menuPopup->Create())
     
    13571361        if (node && node->getInt() >= 0)
    13581362        {
    13591363            m_menuPopup->AddButton(tr("Watch This Video"), SLOT(playVideo()));
     1364            if (QFile::exists(trailerFile))
     1365            {
     1366                 m_menuPopup->AddButton(tr("Watch Trailer"), SLOT(playTrailer()));
     1367            }
    13601368            m_menuPopup->AddButton(tr("Video Info"), SLOT(InfoMenu()));
    13611369            m_menuPopup->AddButton(tr("Manage Video"), SLOT(ManageMenu()));
    13621370        }
     
    15541562        gContext->GetMainWindow()->currentWidget()->setFocus();
    15551563}
    15561564
     1565void VideoDialog::playTrailer()
     1566{
     1567    QString trailerFile;
     1568    QString command_string = "Internal";
     1569
     1570    Metadata *metadata = GetMetadata(GetItemCurrent());
     1571
     1572    trailerFile = QString("%1.trailer").arg(metadata->Filename());
     1573
     1574    VERBOSE(VB_IMPORTANT, QString("Playing Trailer '%1'")
     1575                    .arg(trailerFile));
     1576
     1577    gContext->GetMainWindow()->HandleMedia(command_string, trailerFile);
     1578    gContext->GetMainWindow()->raise();
     1579    gContext->GetMainWindow()->activateWindow();
     1580    if (gContext->GetMainWindow()->currentWidget())
     1581        gContext->GetMainWindow()->currentWidget()->setFocus();
     1582}
     1583
    15571584void VideoDialog::setParentalLevel(const ParentalLevel::Level &level)
    15581585{
    15591586    m_private->m_parentalLevel.SetLevel(level);