Ticket #5920: trailerplayback.5.diff

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

Adds GUI. DB changes coming in seperate patch.

  • mythvideo/theme/default/video-ui.xml

     
    735735        </textarea>
    736736
    737737        <textarea name="browse_text" from="title_text">
    738             <position>50,340</position>
     738            <position>50,337</position>
    739739            <value>Include while Browsing:</value>
    740740        </textarea>
    741741
    742742        <textarea name="coverart_text_label" from="title_text">
    743             <position>50,390</position>
     743            <position>50,375</position>
    744744            <value>Cover Art:</value>
    745745        </textarea>
    746746
     747        <textarea name="trailer_text_label" from="title_text">
     748            <position>50,405</position>
     749            <value>Trailer:</value>
     750        </textarea>
     751
    747752        <textarea name="player_text" from="title_text">
    748753            <position>50,445</position>
    749754            <value>Unique Player Command:</value>
     
    772777        </checkbox>
    773778
    774779        <button name="coverart_button">
    775             <area>310,385,32,32</area>
     780            <area>310,370,32,32</area>
    776781            <statetype name="buttonstate">
    777782                <state name="active">
    778783                    <imagetype name="background">
     
    794799        </button>
    795800
    796801        <textarea name="coverart_text" from="basetextarea">
    797             <area>350,390,250,40</area>
     802            <area>350,375,250,40</area>
    798803            <value>/path/to/the/thing.jpg</value>
    799804        </textarea>
    800805
     806        <button name="trailer_button">
     807            <area>310,400,32,32</area>
     808            <statetype name="buttonstate">
     809                <state name="active">
     810                    <imagetype name="background">
     811                        <filename>blankbutton_off.png</filename>
     812                    </imagetype>
     813                </state>
     814                <state name="selected" from="active">
     815                    <imagetype name="background">
     816                        <filename>blankbutton_on.png</filename>
     817                    </imagetype>
     818                </state>
     819                <state name="disabled" from="active" />
     820                <state name="pushed" from="active">
     821                    <imagetype name="background">
     822                        <filename>blankbutton_pushed.png</filename>
     823                    </imagetype>
     824                </state>
     825            </statetype>
     826        </button>
     827
     828        <textarea name="trailer_text" from="basetextarea">
     829            <area>350,405,250,40</area>
     830            <value>/path/to/the/thing.jpg</value>
     831        </textarea>
     832
     833
    801834        <textedit name="player_edit" from="basetextedit">
    802835            <position>310,435</position>
    803836        </textedit>
  • mythvideo/theme/default-wide/video-ui.xml

     
    727727        </textarea>
    728728
    729729        <textarea name="browse_text" from="title_text">
    730             <position>50,340</position>
     730            <position>50,337</position>
    731731            <value>Include while Browsing:</value>
    732732        </textarea>
    733733
    734734        <textarea name="coverart_text_label" from="title_text">
    735             <position>50,390</position>
     735            <position>50,375</position>
    736736            <value>Cover Art:</value>
    737737        </textarea>
    738738
     739        <textarea name="trailer_text_label" from="title_text">
     740            <position>50,405</position>
     741            <value>Trailer:</value>
     742        </textarea>
     743
    739744        <textarea name="player_text" from="title_text">
    740745            <position>50,445</position>
    741746            <value>Unique Player Command:</value>
     
    764769        </checkbox>
    765770
    766771        <button name="coverart_button">
    767             <area>310,385,32,32</area>
     772            <area>310,370,32,32</area>
    768773            <statetype name="buttonstate">
    769774                <state name="active">
    770775                    <imagetype name="background">
     
    786791        </button>
    787792
    788793        <textarea name="coverart_text" from="basetextarea">
    789             <area>350,390,250,40</area>
     794            <area>350,375,250,40</area>
    790795            <value>/path/to/the/thing.jpg</value>
    791796        </textarea>
    792797
     798        <button name="trailer_button">
     799            <area>310,400,32,32</area>
     800            <statetype name="buttonstate">
     801                <state name="active">
     802                    <imagetype name="background">
     803                        <filename>blankbutton_off.png</filename>
     804                    </imagetype>
     805                </state>
     806                <state name="selected" from="active">
     807                    <imagetype name="background">
     808                        <filename>blankbutton_on.png</filename>
     809                    </imagetype>
     810                </state>
     811                <state name="disabled" from="active" />
     812                <state name="pushed" from="active">
     813                    <imagetype name="background">
     814                        <filename>blankbutton_pushed.png</filename>
     815                    </imagetype>
     816                </state>
     817            </statetype>
     818        </button>
     819
     820        <textarea name="trailer_text" from="basetextarea">
     821            <area>350,405,250,40</area>
     822            <value>/path/to/the/thing.jpg</value>
     823        </textarea>
     824
    793825        <textedit name="player_edit" from="basetextedit">
    794826            <position>310,435</position>
    795827        </textedit>
  • mythvideo/mythvideo/videodlg.h

     
    5858    void SetCurrentNode(MythGenericTree *);
    5959
    6060    void playVideo();
     61    void playTrailer();
    6162
    6263    void SwitchTree();
    6364    void SwitchGallery();
  • mythvideo/mythvideo/metadatalistmanager.cpp

     
    113113    const QString BaseMetadataQuery(
    114114        "SELECT title, director, plot, rating, year, userrating,"
    115115        "length, filename, showlevel, coverfile, inetref, childid,"
    116         "browse, playcommand, category, intid FROM videometadata");
     116        "browse, playcommand, category, intid, trailer FROM videometadata");
    117117
    118118    query.prepare(BaseMetadataQuery);
    119119
  • mythvideo/mythvideo/metadata.cpp

     
    8787    typedef Metadata::cast_list cast_list;
    8888
    8989  public:
    90     MetadataImp(const QString &filename, const QString &coverfile,
     90    MetadataImp(const QString &filename, const QString &trailer, const QString &coverfile,
    9191             const QString &title, int year,
    9292             const QString &inetref, const QString &director,
    9393             const QString &plot, float userrating,
     
    102102        m_inetref(inetref), m_director(director), m_plot(plot),
    103103        m_rating(rating), m_playcommand(playcommand), m_category(category),
    104104        m_genres(genres), m_countries(countries), m_cast(cast),
    105         m_filename(filename), m_coverfile(coverfile),
     105        m_filename(filename), m_trailer(trailer), m_coverfile(coverfile),
    106106        m_categoryID(categoryID), m_childID(childID), m_year(year),
    107107        m_length(length), m_showlevel(showlevel), m_browse(browse), m_id(id),
    108108        m_userrating(userrating)
     
    135135            m_countries = rhs.m_countries;
    136136            m_cast = rhs.m_cast;
    137137            m_filename = rhs.m_filename;
     138            m_trailer = rhs.m_trailer;
    138139            m_coverfile = rhs.m_coverfile;
    139140
    140141            m_categoryID = rhs.m_categoryID;
     
    212213    const QString &getFilename() const { return m_filename; }
    213214    void setFilename(const QString &filename) { m_filename = filename; }
    214215
     216    const QString &getTrailer() const { return m_trailer; }
     217    void setTrailer(const QString &trailer) { m_trailer = trailer; }
     218
    215219    QString getFilenameNoPrefix() const
    216220    {
    217221        QString ret(m_filename);
     
    293297    country_list m_countries;
    294298    cast_list m_cast;
    295299    QString m_filename;
     300    QString m_trailer;
    296301    QString m_coverfile;
    297302
    298303    int m_categoryID;
     
    393398
    394399void MetadataImp::Reset()
    395400{
    396     MetadataImp tmp(m_filename, VIDEO_COVERFILE_DEFAULT,
     401    MetadataImp tmp(m_filename, VIDEO_TRAILER_DEFAULT, VIDEO_COVERFILE_DEFAULT,
    397402                    Metadata::FilenameToTitle(m_filename), VIDEO_YEAR_DEFAULT,
    398403                    VIDEO_INETREF_DEFAULT, VIDEO_DIRECTOR_DEFAULT,
    399404                    VIDEO_PLOT_DEFAULT, 0.0, VIDEO_RATING_DEFAULT, 0, m_id,
     
    485490    m_playcommand = query.value(13).toString();
    486491    m_categoryID = query.value(14).toInt();
    487492    m_id = query.value(15).toInt();
     493    m_trailer = query.value(16).toString();
    488494
    489495    VideoCategory::getCategory().get(m_categoryID, m_category);
    490496
     
    510516        m_rating = VIDEO_RATING_DEFAULT;
    511517    if (m_coverfile.isEmpty())
    512518        m_coverfile = VIDEO_COVERFILE_DEFAULT;
     519    if (m_trailer.isEmpty())
     520        m_trailer = VIDEO_TRAILER_DEFAULT;
    513521    if (m_inetref.isEmpty())
    514522        m_inetref = VIDEO_INETREF_DEFAULT;
    515523    if (isnan(m_userrating))
     
    527535
    528536        query.prepare("INSERT INTO videometadata (title,director,plot,"
    529537                      "rating,year,userrating,length,filename,showlevel,"
    530                       "coverfile,inetref,browse) VALUES (:TITLE, :DIRECTOR, "
     538                      "coverfile,inetref,browse,trailer) VALUES (:TITLE, :DIRECTOR, "
    531539                      ":PLOT, :RATING, :YEAR, :USERRATING, :LENGTH, "
    532                       ":FILENAME, :SHOWLEVEL, :COVERFILE, :INETREF, :BROWSE)");
     540                      ":FILENAME, :SHOWLEVEL, :COVERFILE, :INETREF, :BROWSE, :TRAILER)");
    533541
    534542    }
    535543    else
     
    537545        query.prepare("UPDATE videometadata SET title = :TITLE, "
    538546                      "director = :DIRECTOR, plot = :PLOT, rating= :RATING, "
    539547                      "year = :YEAR, userrating = :USERRATING, "
    540                       "length = :LENGTH, filename = :FILENAME, "
     548                      "length = :LENGTH, filename = :FILENAME, trailer = :TRAILER, "
    541549                      "showlevel = :SHOWLEVEL, coverfile = :COVERFILE, "
    542550                      "inetref = :INETREF, browse = :BROWSE, "
    543551                      "playcommand = :PLAYCOMMAND, childid = :CHILDID, "
     
    557565    query.bindValue(":USERRATING", m_userrating);
    558566    query.bindValue(":LENGTH", m_length);
    559567    query.bindValue(":FILENAME", m_filename);
     568    query.bindValue(":TRAILER", m_trailer);
    560569    query.bindValue(":SHOWLEVEL", m_showlevel);
    561570    query.bindValue(":COVERFILE", m_coverfile);
    562571    query.bindValue(":INETREF", m_inetref);
     
    892901    return false;
    893902}
    894903
    895 Metadata::Metadata(const QString &filename, const QString &coverfile,
     904Metadata::Metadata(const QString &filename, const QString &trailer, const QString &coverfile,
    896905             const QString &title, int year,
    897906             const QString &inetref, const QString &director,
    898907             const QString &plot, float userrating,
     
    904913             const country_list &countries,
    905914             const cast_list &cast)
    906915{
    907     m_imp = new MetadataImp(filename, coverfile, title, year, inetref, director,
     916    m_imp = new MetadataImp(filename, trailer, coverfile, title, year, inetref, director,
    908917                            plot, userrating, rating, length, id, showlevel,
    909918                            categoryID, childID, browse, playcommand, category,
    910919                            genres, countries, cast);
     
    11161125    return m_imp->getFilenameNoPrefix();
    11171126}
    11181127
     1128const QString &Metadata::Trailer() const
     1129{
     1130    return m_imp->getTrailer();
     1131}
     1132
     1133void Metadata::setTrailer(const QString &trailer)
     1134{
     1135    m_imp->setTrailer(trailer);
     1136}
     1137
    11191138const QString &Metadata::CoverFile() const
    11201139{
    11211140    return m_imp->getCoverFile();
  • mythvideo/mythvideo/globals.cpp

     
    1515const QString VIDEO_DIRECTOR_DEFAULT = VIDEO_DIRECTOR_UNKNOWN;
    1616const QString VIDEO_INETREF_DEFAULT = "00000000";
    1717const QString VIDEO_COVERFILE_DEFAULT = QObject::tr("No Cover");
     18const QString VIDEO_TRAILER_DEFAULT = QObject::tr("No Trailer");
    1819const QString VIDEO_RATING_DEFAULT = QObject::tr("NR");
    1920const QString VIDEO_PLOT_DEFAULT = QObject::tr("None");
    2021const QString VIDEO_CAST_DEFAULT = VIDEO_CAST_UNKNOWN;
  • mythvideo/mythvideo/editmetadata.h

     
    6060    MythUICheckBox      *m_browseCheck;
    6161    MythUIButton        *m_coverartButton;
    6262    MythUIText          *m_coverartText;
     63    MythUIButton        *m_trailerButton;
     64    MythUIText          *m_trailerText;
    6365    MythUIButton        *m_doneButton;
    6466
    6567    //
  • mythvideo/mythvideo/videodlg.cpp

     
    2323#include <mythtv/libmythui/mythuistatetype.h>
    2424#include <mythtv/libmythui/mythdialogbox.h>
    2525#include <mythtv/libmythui/mythgenerictree.h>
     26#include "mythtv/libmythui/mythmainwindow.h"
    2627
    2728#include "videodlg.h"
    2829#include "videoscan.h"
     
    13661367        if (node && node->getInt() >= 0)
    13671368        {
    13681369            m_menuPopup->AddButton(tr("Watch This Video"), SLOT(playVideo()));
     1370
     1371            Metadata *metadata = GetMetadata(GetItemCurrent());
     1372//            QString trailerFile = QString("%1.trailer").arg(metadata->Filename());
     1373            QString trailerFile = QString("%1").arg(metadata->Trailer());
     1374            if (QFile::exists(trailerFile))
     1375            {
     1376                 m_menuPopup->AddButton(tr("Watch Trailer"), SLOT(playTrailer()));
     1377            }
     1378
    13691379            m_menuPopup->AddButton(tr("Video Info"), SLOT(InfoMenu()));
    13701380            m_menuPopup->AddButton(tr("Manage Video"), SLOT(ManageMenu()));
    13711381        }
     
    15631573        gContext->GetMainWindow()->currentWidget()->setFocus();
    15641574}
    15651575
     1576void VideoDialog::playTrailer()
     1577{
     1578    Metadata *metadata = GetMetadata(GetItemCurrent());
     1579    QString trailerFile = QString("%1").arg(metadata->Trailer());
     1580    QString command_string = "Internal";
     1581
     1582    gContext->GetMainWindow()->HandleMedia(command_string, trailerFile);
     1583    gContext->GetMainWindow()->raise();
     1584    gContext->GetMainWindow()->activateWindow();
     1585    if (gContext->GetMainWindow()->currentWidget())
     1586        gContext->GetMainWindow()->currentWidget()->setFocus();
     1587}
     1588
    15661589void VideoDialog::setParentalLevel(const ParentalLevel::Level &level)
    15671590{
    15681591    m_private->m_parentalLevel.SetLevel(level);
  • mythvideo/mythvideo/videoscan.cpp

     
    181181        // add files not already in the DB
    182182        if (!p->second)
    183183        {
    184             Metadata newFile(p->first, VIDEO_COVERFILE_DEFAULT,
     184            Metadata newFile(p->first, VIDEO_TRAILER_DEFAULT, VIDEO_COVERFILE_DEFAULT,
    185185                             Metadata::FilenameToTitle(p->first),
    186186                             VIDEO_YEAR_DEFAULT,
    187187                             VIDEO_INETREF_DEFAULT, VIDEO_DIRECTOR_DEFAULT,
  • mythvideo/mythvideo/metadata.h

     
    5353            bool &use_default);
    5454
    5555  public:
    56     Metadata(const QString &filename = "", const QString &coverfile = "",
     56    Metadata(const QString &filename = "", const QString &trailer = "", const QString &coverfile = "",
    5757             const QString &title = "", int year = VIDEO_YEAR_DEFAULT,
    5858             const QString &inetref = "", const QString &director = "",
    5959             const QString &plot = "", float userrating = 0.0,
    6060             const QString &rating = "", int length = 0,
    61              int id = 0,
     61             int id = 0, 
    6262             ParentalLevel::Level showlevel = ParentalLevel::plLowest,
    6363             int categoryID = 0,
    6464             int childID = -1, bool browse = true,
     
    125125    const QString& Filename() const;
    126126    void setFilename(const QString &filename);
    127127
     128    const QString& Trailer() const;
     129    void setTrailer(const QString &trailer);
     130
    128131    QString getFilenameNoPrefix() const;
    129132
    130133    const QString &CoverFile() const;
  • mythvideo/mythvideo/editmetadata.cpp

     
    2222        const MetadataListManager &cache) : MythScreenType(lparent, lname),
    2323    m_origMetadata(source_metadata), m_titleEdit(0), m_playerEdit(0),
    2424    m_categoryList(0), m_levelList(0), m_childList(0), m_browseCheck(0),
    25     m_coverartButton(0), m_coverartText(0), m_doneButton(0),
     25    m_coverartButton(0), m_coverartText(0),
     26    m_trailerButton(0), m_trailerText(0), m_doneButton(0),
    2627    cachedChildSelection(0), m_metaCache(cache)
    2728{
    2829    m_workingMetadata = new Metadata(*m_origMetadata);
     
    4445        UIUtilE::Assign(this, m_playerEdit, "player_edit");
    4546
    4647        UIUtilE::Assign(this, m_coverartText, "coverart_text");
     48        UIUtilE::Assign(this, m_trailerText, "trailer_text");
    4749
    4850        UIUtilE::Assign(this, m_categoryList, "category_select");
    4951        UIUtilE::Assign(this, m_levelList, "level_select");
     
    214216    if (m_workingMetadata->Browse())
    215217        m_browseCheck->SetCheckState(MythUIStateType::Full);
    216218    m_coverartText->SetText(m_workingMetadata->CoverFile());
     219    m_trailerText->SetText(m_workingMetadata->Trailer());
    217220    m_playerEdit->SetText(m_workingMetadata->PlayCommand());
    218221}
    219222
  • mythvideo/mythvideo/globals.h

     
    1313extern const QString VIDEO_DIRECTOR_DEFAULT;
    1414extern const QString VIDEO_INETREF_DEFAULT;
    1515extern const QString VIDEO_COVERFILE_DEFAULT;
     16extern const QString VIDEO_TRAILER_DEFAULT;
    1617extern const QString VIDEO_RATING_DEFAULT;
    1718extern const QString VIDEO_PLOT_DEFAULT;
    1819extern const QString VIDEO_CAST_DEFAULT;