Ticket #6547: mythvideodefaultplayer-fixes.patch

File mythvideodefaultplayer-fixes.patch, 9.8 KB (added by jyavenard@…, 16 years ago)

patch for 0.21-fixes

  • mythplugins/mythvideo/mythvideo/videodlg.h

     
    2525                const QString &lwinName, const QString &lname,
    2626                VideoList *video_list);
    2727
    28     virtual void playVideo(Metadata *someItem);
     28    virtual void playVideo(Metadata *someItem, bool defaultplayer=false);
    2929
    3030    GenericTree *getVideoTreeRoot(void);
    3131
     
    4545    void exitWin();
    4646    virtual void slotParentalLevelChanged();
    4747    virtual void slotWatchVideo();
     48    virtual void slotWatchVideoDefault();
    4849
    4950  protected:
    5051    virtual ~VideoDialog(); // use deleteLater() instead for thread safety
  • mythplugins/mythvideo/mythvideo/metadata.cpp

     
    797797    return ret;
    798798}
    799799
    800 QString Metadata::getPlayer(const Metadata *item)
     800QString Metadata::getPlayer(const Metadata *item, bool defaultplayer)
    801801{
    802802    QString empty;
    803     return getPlayer(item, empty);
     803    return getPlayer(item, empty, defaultplayer);
    804804}
    805805
    806 QString Metadata::getPlayer(const Metadata *item, QString &internal_mrl)
     806QString Metadata::getPlayer(const Metadata *item, QString &internal_mrl, bool defaultplayer)
    807807{
    808808    if (!item) return "";
    809809
     810    if (defaultplayer)
     811        return gContext->GetSetting("VideoDefaultPlayer");
     812
    810813    internal_mrl = item->Filename();
    811814
    812815    if (item->PlayCommand().length()) return item->PlayCommand();
     
    833836    return gContext->GetSetting("VideoDefaultPlayer");
    834837}
    835838
    836 QString Metadata::getPlayCommand(const Metadata *item)
     839QString Metadata::getPlayCommand(const Metadata *item, bool defaultplayer)
    837840{
    838841    if (!item) return "";
    839842
    840843    QString filename = item->Filename();
    841     QString handler = getPlayer(item);
     844    QString handler = getPlayer(item, defaultplayer);
    842845
    843846    QString arg = QString("\"%1\"").arg(QString(item->Filename())
    844847                                        .replace(QRegExp("\""), "\\\"")
  • mythplugins/mythvideo/mythvideo/videotree.cpp

     
    458458        {
    459459            focusButton = popup->addButton(tr("Watch This Video"), this,
    460460                                           SLOT(slotWatchVideo()));
     461            popup->addButton(tr("Watch This Video (default player)"), this, SLOT(slotWatchVideoDefault()));
    461462            popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot()));
    462463            popup->addButton(tr("View Cast"), this, SLOT(slotViewCast()));
    463464        }
     
    565566        VERBOSE(VB_IMPORTANT, QString("no Item to watch"));
    566567}
    567568
    568 void VideoTree::playVideo(Metadata *someItem)
     569void VideoTree::slotWatchVideoDefault()
    569570{
     571    cancelPopup();
     572
     573    if (curitem)
     574        playVideo(curitem,true);
     575    else
     576        VERBOSE(VB_IMPORTANT, QString("no Item to watch"));
     577}
     578
     579void VideoTree::playVideo(Metadata *someItem, bool defaultplayer)
     580{
    570581    if (!someItem)
    571582        return;
    572583
    573     PlayVideo(someItem->Filename(), m_video_list->getListCache());
     584    PlayVideo(someItem->Filename(), m_video_list->getListCache(), defaultplayer);
    574585
    575586    m_imp->video_tree_list->deactivate();
    576587    gContext->GetMainWindow()->raise();
  • mythplugins/mythvideo/mythvideo/videoutils.cpp

     
    1616    const QString VIDEO_COVERFILE_DEFAULT_OLD = QObject::tr("None");
    1717}
    1818
    19 void PlayVideo(const QString &filename, const MetadataListManager &video_list)
     19void PlayVideo(const QString &filename, const MetadataListManager &video_list, bool defaultplayer)
    2020{
    2121    MetadataListManager::MetadataPtr item = video_list.byFilename(filename);
    2222
     
    2929        playing_time.start();
    3030
    3131        QString internal_mrl;
    32         QString handler = Metadata::getPlayer(item.get(), internal_mrl);
     32        QString handler;
     33
     34        handler = Metadata::getPlayer(item.get(), internal_mrl, defaultplayer);
     35
    3336        // See if this is being handled by a plugin..
    34         if (!gContext->GetMainWindow()->
     37        if (defaultplayer || !gContext->GetMainWindow()->
    3538                HandleMedia(handler, internal_mrl, item->Plot(), item->Title(),
    3639                            item->Director(), item->Length(),
    3740                            QString::number(item->Year())))
    3841        {
    3942            // No internal handler for this, play external
    40             QString command = Metadata::getPlayCommand(item.get());
     43            QString command = Metadata::getPlayCommand(item.get(), defaultplayer);
    4144            if (command.length())
    4245            {
    4346                gContext->sendPlaybackStart();
  • mythplugins/mythvideo/mythvideo/videodlg.cpp

     
    198198        VERBOSE(VB_IMPORTANT, QString("no Item to watch"));
    199199}
    200200
    201 void VideoDialog::playVideo(Metadata *someItem)
     201void VideoDialog::slotWatchVideoDefault()
    202202{
     203    cancelPopup();
     204
     205    if (curitem)
     206      playVideo(curitem, true);
     207    else
     208        VERBOSE(VB_IMPORTANT, QString("no Item to watch"));
     209}
     210
     211void VideoDialog::playVideo(Metadata *someItem, bool defaultplayer)
     212{
    203213    // Show a please wait message
    204214    LayerSet *container = theme->GetSet("playwait");
    205215    if (container)
     
    209219    update(fullRect);
    210220    allowPaint = false;
    211221
    212     PlayVideo(someItem->Filename(), m_video_list->getListCache());
     222    PlayVideo(someItem->Filename(), m_video_list->getListCache(), defaultplayer);
    213223
    214224    gContext->GetMainWindow()->raise();
    215225    gContext->GetMainWindow()->setActiveWindow();
  • mythplugins/mythvideo/mythvideo/videobrowser.cpp

     
    130130        {
    131131            focusButton = popup->addButton(tr("Watch This Video"), this,
    132132                                           SLOT(slotWatchVideo()));
     133            popup->addButton(tr("Watch This Video (default player)"), this, SLOT(slotWatchVideoDefault()));
    133134            popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot()));
    134135            popup->addButton(tr("View Cast"), this, SLOT(slotViewCast()));
    135136        }
  • mythplugins/mythvideo/mythvideo/metadata.h

     
    4646    static SortKey GenerateDefaultSortKey(const Metadata &m, bool ignore_case);
    4747    static QString FilenameToTitle(const QString &file_name);
    4848    static QString trimTitle(const QString &title, bool ignore_case);
    49     static QString getPlayer(const Metadata *item);
    50     static QString getPlayer(const Metadata *item, QString &internal_mrl);
    51     static QString getPlayCommand(const Metadata *item);
     49    static QString getPlayer(const Metadata *item, bool defaultplayer = false);
     50    static QString getPlayer(const Metadata *item, QString &internal_mrl, bool defaultplayer = false);
     51    static QString getPlayCommand(const Metadata *item, bool defaultplayer=false);
    5252    static bool getPlayer(const QString &extension, QString &player,
    5353            bool &use_default);
    5454
  • mythplugins/mythvideo/mythvideo/videogallery.cpp

     
    499499        {
    500500            focusButton = popup->addButton(tr("Watch This Video"), this,
    501501                                           SLOT(slotWatchVideo()));
     502            popup->addButton(tr("Watch This Video (default player)"), this, SLOT(slotWatchVideoDefault()));
    502503            popup->addButton(tr("View Full Plot"), this, SLOT(slotViewPlot()));
    503504            popup->addButton(tr("View Cast"), this, SLOT(slotViewCast()));
    504505            popup->addButton(tr("View Details"), this,
  • mythplugins/mythvideo/mythvideo/videotree.h

     
    2222
    2323    void buildVideoList();
    2424
    25     void playVideo(Metadata *someItem);
     25    void playVideo(Metadata *someItem, bool defaultplayer=false);
    2626    int videoExitType() { return m_exit_type; }
    2727
    2828  public slots:
     
    3333    void slotViewCast();
    3434    void slotDoFilter();
    3535    void slotWatchVideo();
     36    void slotWatchVideoDefault();
    3637
    3738    void handleTreeListSelection(int node_int);
    3839    void handleTreeListEntry(int node_int);
  • mythplugins/mythvideo/mythvideo/videoutils.h

     
    44class Metadata;
    55class MetadataListManager;
    66
    7 void PlayVideo(const QString &filename, const MetadataListManager &video_list);
     7void PlayVideo(const QString &filename, const MetadataListManager &video_list, bool defaultplayer = false);
    88
    99template <typename T>
    1010void checkedSetText(T *item, const QString &text)