Ticket #5920: trailerplayback.diff

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

Patch to add trailer playback button/functionality.

  • 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"
     
    13571358        if (node && node->getInt() >= 0)
    13581359        {
    13591360            m_menuPopup->AddButton(tr("Watch This Video"), SLOT(playVideo()));
     1361            m_menuPopup->AddButton(tr("Watch Trailer"), SLOT(playTrailer()));
    13601362            m_menuPopup->AddButton(tr("Video Info"), SLOT(InfoMenu()));
    13611363            m_menuPopup->AddButton(tr("Manage Video"), SLOT(ManageMenu()));
    13621364        }
     
    15541556        gContext->GetMainWindow()->currentWidget()->setFocus();
    15551557}
    15561558
     1559void VideoDialog::playTrailer()
     1560{
     1561    QString trailerFile;
     1562    QString command_string = "Internal";
     1563
     1564    Metadata *metadata = GetMetadata(GetItemCurrent());
     1565
     1566    trailerFile = QString("%1.trailer").arg(metadata->Filename());
     1567
     1568    VERBOSE(VB_IMPORTANT, QString("Playing Trailer '%1'")
     1569                    .arg(trailerFile));
     1570
     1571    gContext->GetMainWindow()->HandleMedia(command_string, trailerFile);
     1572    gContext->GetMainWindow()->raise();
     1573    gContext->GetMainWindow()->activateWindow();
     1574    if (gContext->GetMainWindow()->currentWidget())
     1575        gContext->GetMainWindow()->currentWidget()->setFocus();
     1576}
     1577
    15571578void VideoDialog::setParentalLevel(const ParentalLevel::Level &level)
    15581579{
    15591580    m_private->m_parentalLevel.SetLevel(level);