Ticket #5920: trailerpatch.2.diff

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

Little whitespace fix

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

     
    788788        </textarea>
    789789
    790790        <textarea name="browse_text" from="title_text">
    791             <position>50,340</position>
     791            <position>50,337</position>
    792792            <value>Include while Browsing:</value>
    793793        </textarea>
    794794
    795795        <textarea name="coverart_text_label" from="title_text">
    796             <position>50,390</position>
     796            <position>50,375</position>
    797797            <value>Cover Art:</value>
    798798        </textarea>
    799799
     800        <textarea name="trailer_text_label" from="title_text">
     801            <position>50,405</position>
     802            <value>Trailer:</value>
     803        </textarea>
     804
    800805        <textarea name="player_text" from="title_text">
    801806            <position>50,445</position>
    802807            <value>Unique Player Command:</value>
     
    825830        </checkbox>
    826831
    827832        <button name="coverart_button">
    828             <area>310,385,32,32</area>
     833            <area>310,370,32,32</area>
    829834            <statetype name="buttonstate">
    830835                <state name="active">
    831836                    <imagetype name="background">
     
    847852        </button>
    848853
    849854        <textarea name="coverart_text" from="basetextarea">
    850             <area>350,390,250,40</area>
     855            <area>350,375,250,40</area>
    851856            <value>/path/to/the/thing.jpg</value>
    852857        </textarea>
    853858
     859        <button name="trailer_button">
     860            <area>310,400,32,32</area>
     861            <statetype name="buttonstate">
     862                <state name="active">
     863                    <imagetype name="background">
     864                        <filename>blankbutton_off.png</filename>
     865                    </imagetype>
     866                </state>
     867                <state name="selected" from="active">
     868                    <imagetype name="background">
     869                        <filename>blankbutton_on.png</filename>
     870                    </imagetype>
     871                </state>
     872                <state name="disabled" from="active" />
     873                <state name="pushed" from="active">
     874                    <imagetype name="background">
     875                        <filename>blankbutton_pushed.png</filename>
     876                    </imagetype>
     877                </state>
     878            </statetype>
     879        </button>
     880
     881        <textarea name="trailer_text" from="basetextarea">
     882            <area>350,405,250,40</area>
     883            <value>/path/to/the/thing.jpg</value>
     884        </textarea>
     885
     886
    854887        <textedit name="player_edit" from="basetextedit">
    855888            <position>310,435</position>
    856889        </textedit>
  • mythvideo/theme/default-wide/video-ui.xml

     
    780780        </textarea>
    781781
    782782        <textarea name="browse_text" from="title_text">
    783             <position>50,340</position>
     783            <position>50,337</position>
    784784            <value>Include while Browsing:</value>
    785785        </textarea>
    786786
    787787        <textarea name="coverart_text_label" from="title_text">
    788             <position>50,390</position>
     788            <position>50,375</position>
    789789            <value>Cover Art:</value>
    790790        </textarea>
    791791
     792        <textarea name="trailer_text_label" from="title_text">
     793            <position>50,405</position>
     794            <value>Trailer:</value>
     795        </textarea>
     796
    792797        <textarea name="player_text" from="title_text">
    793798            <position>50,445</position>
    794799            <value>Unique Player Command:</value>
     
    817822        </checkbox>
    818823
    819824        <button name="coverart_button">
    820             <area>310,385,32,32</area>
     825            <area>310,370,32,32</area>
    821826            <statetype name="buttonstate">
    822827                <state name="active">
    823828                    <imagetype name="background">
     
    839844        </button>
    840845
    841846        <textarea name="coverart_text" from="basetextarea">
    842             <area>350,390,250,40</area>
     847            <area>350,375,250,40</area>
    843848            <value>/path/to/the/thing.jpg</value>
    844849        </textarea>
    845850
     851        <button name="trailer_button">
     852            <area>310,400,32,32</area>
     853            <statetype name="buttonstate">
     854                <state name="active">
     855                    <imagetype name="background">
     856                        <filename>blankbutton_off.png</filename>
     857                    </imagetype>
     858                </state>
     859                <state name="selected" from="active">
     860                    <imagetype name="background">
     861                        <filename>blankbutton_on.png</filename>
     862                    </imagetype>
     863                </state>
     864                <state name="disabled" from="active" />
     865                <state name="pushed" from="active">
     866                    <imagetype name="background">
     867                        <filename>blankbutton_pushed.png</filename>
     868                    </imagetype>
     869                </state>
     870            </statetype>
     871        </button>
     872
     873        <textarea name="trailer_text" from="basetextarea">
     874            <area>350,405,250,40</area>
     875            <value>/path/to/the/thing.jpg</value>
     876        </textarea>
     877
    846878        <textedit name="player_edit" from="basetextedit">
    847879            <position>310,435</position>
    848880        </textedit>
  • mythvideo/mythvideo/videodlg.h

     
    5858    void SetCurrentNode(MythGenericTree *);
    5959
    6060    void playVideo();
     61    void playVideoWithTrailers();
     62    void playTrailer();
    6163
    6264    void SwitchTree();
    6365    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/globalsettings.cpp

     
    247247    return gc;
    248248}
    249249
     250HostLineEdit *TrailerDirectory()
     251{
     252    HostLineEdit *gc = new HostLineEdit("MythVideo.TrailerDir");
     253    gc->setLabel(QObject::tr("Directory that holds movie trailers"));
     254    gc->setValue(GetConfDir() + "/mnt/store/trailers");
     255    gc->setHelpText(QObject::tr("This directory must exist, and the user "
     256                    "running MythVideo needs to have read/write permission "
     257                    "to the directory."));
     258    return gc;
     259}
     260
     261HostCheckBox *TrailersBeforeVideo()
     262{
     263    HostCheckBox *gc = new HostCheckBox("MythVideo.EnableTrailers");
     264    gc->setLabel(QObject::tr("Enable random trailers before videos"));
     265    gc->setValue(false);
     266    gc->setHelpText(QObject::tr("If set, this will enable a button "
     267                    "called \"Watch With Trailers\" which will "
     268                    "play a user-specified number of trailers "
     269                    "before the movie."));
     270    return gc;
     271}
     272
     273HostSpinBox *TrailerNumber()
     274{
     275    HostSpinBox *gc = new HostSpinBox("MythVideo.TrailerNumber", 0, 10, 1);
     276    gc->setLabel(QObject::tr("Number of trailers to play"));
     277    gc->setValue(3);
     278    gc->setHelpText(QObject::tr("The number of trailers to play "
     279                    "before playing the film itself "));
     280    return gc;
     281}
     282
     283
    250284//Player Settings
    251285
    252286HostLineEdit *VideoDefaultPlayer()
     
    686720    VConfigPage page6(pages, false);
    687721    page6->addChild(new RatingsToPL());
    688722
     723    // page 7
     724    VerticalConfigurationGroup *trlr =
     725            new VerticalConfigurationGroup(true, false);
     726    trlr->addChild(TrailerDirectory());
     727    trlr->addChild(TrailersBeforeVideo());
     728    trlr->addChild(TrailerNumber());
     729    VConfigPage page7(pages, false);
     730    page7->addChild(trlr);
     731
     732
    689733    int page_num = 1;
    690734    for (ConfigPage::PageList::const_iterator p = pages.begin();
    691735         p != pages.end(); ++p, ++page_num)
  • 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/dbcheck.cpp

     
    1414    const QString lastMythDVDDBVersion = "1002";
    1515    const QString lastMythVideoVersion = "1010";
    1616
    17     const QString currentDatabaseVersion = "1019";
     17    const QString currentDatabaseVersion = "1020";
    1818
    1919    const QString OldMythVideoVersionName = "VideoDBSchemaVer";
    2020    const QString OldMythDVDVersionName = "DVDDBSchemaVer";
     
    763763            performActualUpdate(updates, "1019", dbver, MythVideoVersionName);
    764764        }
    765765
     766        if (dbver == "1019")
     767        {
     768            const QString updates[] = {
     769"ALTER TABLE `videometadata` ADD `trailer` TEXT NOT NULL ;",
     770""
     771};
     772
     773            performActualUpdate(updates, "1020", dbver, MythVideoVersionName);
     774        }
     775
    766776    }
    767777}
    768778
  • 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            int randTrailers = gContext->GetNumSetting("MythVideo.EnableTrailers",0);
     1372            if (randTrailers != 0)
     1373            {
     1374                 m_menuPopup->AddButton(tr("Watch With Trailers"),
     1375                      SLOT(playVideoWithTrailers()));
     1376            }
     1377
     1378            Metadata *metadata = GetMetadata(GetItemCurrent());
     1379            QString trailerFile = QString("%1").arg(metadata->Trailer());
     1380            if (QFile::exists(trailerFile))
     1381            {
     1382                 m_menuPopup->AddButton(tr("Watch Trailer"), SLOT(playTrailer()));
     1383            }
     1384
    13691385            m_menuPopup->AddButton(tr("Video Info"), SLOT(InfoMenu()));
    13701386            m_menuPopup->AddButton(tr("Manage Video"), SLOT(ManageMenu()));
    13711387        }
     
    15631579        gContext->GetMainWindow()->currentWidget()->setFocus();
    15641580}
    15651581
     1582void VideoDialog::playVideoWithTrailers()
     1583{
     1584    Metadata *metadata = GetMetadata(GetItemCurrent());
     1585
     1586    QString trailerFile;
     1587    QString trailerFolder = gContext->GetSetting("Mythvideo.TrailerDir",
     1588         "/MythMedia/trailers");
     1589    QString command_string = "Internal";
     1590    int trailersPlayed = 0;
     1591    int trailersToPlay = gContext->GetNumSetting("MythVideo.TrailerNumber", 3);
     1592
     1593    QDir trailerDir(trailerFolder);
     1594    QStringList trailerTypes;
     1595
     1596    trailerTypes.append("*");
     1597    trailerDir.setNameFilters(trailerTypes);
     1598
     1599    QStringList trailerAvailList = trailerDir.entryList();
     1600
     1601    QString printTrailers = trailerAvailList.join( ", " );
     1602    VERBOSE(VB_IMPORTANT, QString("Trailers are: %1")
     1603                    .arg(printTrailers));
     1604
     1605    srand ( time(NULL) );
     1606
     1607    if (trailerAvailList.size() < 1) return;
     1608
     1609    while (trailersPlayed < trailersToPlay)
     1610        {
     1611        trailerFile = QString("%1/%2").arg(trailerFolder)
     1612          .arg(trailerAvailList.takeAt(rand() % trailerAvailList.size()));
     1613
     1614          VERBOSE(VB_IMPORTANT, QString("Random trailer to play will be: %1")
     1615                      .arg(trailerFile));
     1616
     1617        gContext->GetMainWindow()->HandleMedia(command_string, trailerFile);
     1618        gContext->GetMainWindow()->raise();
     1619        gContext->GetMainWindow()->activateWindow();
     1620        if (gContext->GetMainWindow()->currentWidget())
     1621            gContext->GetMainWindow()->currentWidget()->setFocus();
     1622        trailersPlayed++;
     1623        }
     1624
     1625    // Finish by playing the Video itself
     1626
     1627    PlayVideo(metadata->Filename(), m_videoList->getListCache());
     1628 
     1629    gContext->GetMainWindow()->raise();
     1630    gContext->GetMainWindow()->activateWindow();
     1631    if (gContext->GetMainWindow()->currentWidget())
     1632        gContext->GetMainWindow()->currentWidget()->setFocus();
     1633}
     1634
     1635void VideoDialog::playTrailer()
     1636{
     1637    Metadata *metadata = GetMetadata(GetItemCurrent());
     1638    QString trailerFile = QString("%1").arg(metadata->Trailer());
     1639    QString command_string = "Internal";
     1640
     1641    gContext->GetMainWindow()->HandleMedia(command_string, trailerFile);
     1642    gContext->GetMainWindow()->raise();
     1643    gContext->GetMainWindow()->activateWindow();
     1644    if (gContext->GetMainWindow()->currentWidget())
     1645        gContext->GetMainWindow()->currentWidget()->setFocus();
     1646}
     1647
    15661648void VideoDialog::setParentalLevel(const ParentalLevel::Level &level)
    15671649{
    15681650    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,
     
    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);
     
    4344    UIUtilE::Assign(this, m_playerEdit, "player_edit", &err);
    4445
    4546    UIUtilE::Assign(this, m_coverartText, "coverart_text", &err);
     47    UIUtilE::Assign(this, m_trailerText, "trailer_text", &err);
    4648
    4749    UIUtilE::Assign(this, m_categoryList, "category_select", &err);
    4850    UIUtilE::Assign(this, m_levelList, "level_select", &err);
     
    213215    if (m_workingMetadata->Browse())
    214216        m_browseCheck->SetCheckState(MythUIStateType::Full);
    215217    m_coverartText->SetText(m_workingMetadata->CoverFile());
     218    m_trailerText->SetText(m_workingMetadata->Trailer());
    216219    m_playerEdit->SetText(m_workingMetadata->PlayCommand());
    217220}
    218221
  • 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;