/*!
     \internal
 */
void QMediaImageViewer::unbind(QObject *object)
{
    if (object == d_func()->playlist)
        setPlaylist(0);
    else
        QMediaObject::unbind(object);
}
Example #2
0
void MediaPlayer::openUrl( const QString& url )
{
    QExplicitlySharedDataPointer<Playlist> playlist = Playlist::construct_playlist( url );
    playlist->setPlaying( playlist->index( 0 ) );

    setPlaylist( playlist );
}
Example #3
0
void MediaPlayer::setDocument( const QString& doc )
{
    m_closeonback = true;

    QExplicitlySharedDataPointer<Playlist> playlist = Playlist::construct_playlist( doc );
    playlist->setPlaying( playlist->index( 0 ) );

    setPlaylist( playlist );
}
void PlaylistMenuUserInterface::processSelection(U32 index)     
{
   string playlistName = getMenuItem(index)->getPrompt();
   if(playlistName == NO_PLAYLIST)
      playlistName = "";

   setPlaylist(playlistName);             // Different implementations when hosting vs. when playing
   getUIManager()->reactivatePrevUI();    // To hosting menu
}
/*!
    \internal
*/
bool QMediaImageViewer::bind(QObject *object)
{
    if (QMediaPlaylist *playlist = qobject_cast<QMediaPlaylist *>(object)) {
        setPlaylist(playlist);

        return true;
    } else {
        return QMediaObject::bind(object);
    }
}
Example #6
0
void Settings::readSettings()
{
    setLanguage(value(KEY_LANGUAGE, defaultValue(KEY_LANGUAGE)).toString());

    setPlaylist(value(KEY_PLAYLIST, defaultValue(KEY_PLAYLIST)).toString());
    setPlaylistUpdate(value(KEY_PLAYLIST_UPDATE, defaultValue(KEY_PLAYLIST_UPDATE)).toBool());
    setPlaylistUpdateUrl(value(KEY_PLAYLIST_UPDATE_URL, defaultValue(KEY_PLAYLIST_UPDATE_URL)).toString());
    setRadioCategory(value(KEY_RADIO_CATEGORY, defaultValue(KEY_RADIO_CATEGORY)).toString());
    setHdCategory(value(KEY_HD_CATEGORY, defaultValue(KEY_HD_CATEGORY)).toString());
    setUdpxy(value(KEY_UDPXY, defaultValue(KEY_UDPXY)).toBool());
    setUdpxyUrl(value(KEY_UDPXY_URL, defaultValue(KEY_UDPXY_URL)).toString());
    setUdpxyPort(value(KEY_UDPXY_PORT, defaultValue(KEY_UDPXY_PORT)).toInt());

    setWidth(value(KEY_WIDTH, defaultValue(KEY_WIDTH)).toInt());
    setHeight(value(KEY_HEIGHT, defaultValue(KEY_HEIGHT)).toInt());
    setPosX(value(KEY_POS_X, defaultValue(KEY_POS_X)).toInt());
    setPosY(value(KEY_POS_Y, defaultValue(KEY_POS_Y)).toInt());

    setOsd(value(KEY_OSD, defaultValue(KEY_OSD)).toBool());
    setTrayEnabled(value(KEY_TRAY_ENABLED, defaultValue(KEY_TRAY_ENABLED)).toBool());
    setHideToTray(value(KEY_HIDE_TO_TRAY, defaultValue(KEY_HIDE_TO_TRAY)).toBool());
    setMouseWheel(value(KEY_MOUSE_WHEEL, defaultValue(KEY_MOUSE_WHEEL)).toString());
    setRememberGuiSession(value(KEY_REMEMBER_GUI_SESSION, defaultValue(KEY_REMEMBER_GUI_SESSION)).toBool());
    setIcons(value(KEY_ICONS, defaultValue(KEY_ICONS)).toString());

    setVout(value(KEY_VOUT, defaultValue(KEY_VOUT)).toInt());
    setAout(value(KEY_AOUT, defaultValue(KEY_AOUT)).toInt());
    setYuvToRgb(value(KEY_YUV_TO_RGB, defaultValue(KEY_MUTE_ON_MINIMIZE)).toBool());
    setSpdif(value(KEY_SPDIF, defaultValue(KEY_SPDIF)).toBool());

    setRememberVideoSettings(value(KEY_REMEMBER_VIDEO_SETTINGS, defaultValue(KEY_REMEMBER_VIDEO_SETTINGS)).toBool());
    setRememberVideoPerChannel(value(KEY_REMEMBER_VIDEO_PER_CHANNEL, defaultValue(KEY_REMEMBER_VIDEO_PER_CHANNEL)).toBool());
    setAspectRatio(value(KEY_ASPECT_RATIO, defaultValue(KEY_ASPECT_RATIO)).toInt());
    setCropRatio(value(KEY_CROP_RATIO, defaultValue(KEY_CROP_RATIO)).toInt());
    setDeinterlacing(value(KEY_DEINTERLACING, defaultValue(KEY_DEINTERLACING)).toInt());
    setAudioLanguage(value(KEY_AUDIO_LANGUAGE, defaultValue(KEY_AUDIO_LANGUAGE)).toString());
    setSubtitleLanguage(value(KEY_SUBTITLE_LANGUAGE, defaultValue(KEY_SUBTITLE_LANGUAGE)).toString());

    setMuteOnMinimize(value(KEY_MUTE_ON_MINIMIZE, defaultValue(KEY_MUTE_ON_MINIMIZE)).toBool());
    setTeletext(value(KEY_TELETEXT, defaultValue(KEY_TELETEXT)).toBool());

    setRecorderDirectory(value(KEY_RECORDER_DIRECTORY, defaultValue(KEY_RECORDER_DIRECTORY)).toString());
    setSnapshotsDirectory(value(KEY_SNAPSHOTS_DIRECTORY, defaultValue(KEY_SNAPSHOTS_DIRECTORY)).toString());

    setSessionAutoplay(value(KEY_SESSION_AUTOPLAY, defaultValue(KEY_SESSION_AUTOPLAY)).toBool());
    setSessionChannel(value(KEY_SESSION_CHANNEL, defaultValue(KEY_SESSION_CHANNEL)).toInt());
    setSessionRememberVolume(value(KEY_SESSION_REMEMBER_VOLUME, defaultValue(KEY_SESSION_REMEMBER_VOLUME)).toBool());
    setSessionVolume(value(KEY_SESSION_VOLUME, defaultValue(KEY_SESSION_VOLUME)).toInt());

    setXmltvUpdate(value(KEY_XMLTV_UPDATE, defaultValue(KEY_XMLTV_UPDATE)).toBool());
    setXmltvUpdateLocation(value(KEY_XMLTV_UPDATE_LOCATION, defaultValue(KEY_XMLTV_UPDATE_LOCATION)).toString());
    setXmltvUpdateRemote(value(KEY_XMLTV_UPDATE_REMOTE, defaultValue(KEY_XMLTV_UPDATE_REMOTE)).toBool());
}
Example #7
0
bool TPar::parse(QDomElement element)
{
    root_element   = element;
    setTimingAttributes();
    setBaseContainerAttributes();

    if (element.hasChildNodes())
    {
        setPlaylist();
    }
    return false;
}
Example #8
0
QString MpvHandler::LoadPlaylist(QString f)
{
    if(f == QString()) // ignore empty file name
        return QString();

    if(f == "-")
    {
        setPath("");
        setPlaylist({f});
    }
    else if(Util::IsValidUrl(f)) // web url
    {
        setPath("");
        setPlaylist({f});
    }
    else // local file
    {
        QFileInfo fi(f);
        if(!fi.exists()) // file doesn't exist
        {
            ShowText(tr("File does not exist")); // tell the user
            return QString(); // don't do anything more
        }
        else if(fi.isDir()) // if directory
        {
            setPath(QDir::toNativeSeparators(fi.absoluteFilePath()+"/")); // set new path
            return PopulatePlaylist();
        }
        else if(fi.isFile()) // if file
        {
            setPath(QDir::toNativeSeparators(fi.absolutePath()+"/")); // set new path
            PopulatePlaylist();
            return fi.fileName();
        }
    }
    return f;
}
Example #9
0
bool TSeq::parse(QDomElement element)
{
    root_element   = element;
    setTimingAttributes();
    setBaseContainerAttributes();
    if (element.hasChildNodes())
    {
        active_element = element.firstChildElement();
        setPlaylist();
        if (active_element.tagName() == "metadata")
        {
            MyShuffle = new TShuffle(dom_list);
            MyShuffle->parse(active_element);
            shuffle = true;
        }

    }
    return true;
}
Example #10
0
bool TBody::parse(QDomElement element)
{
    bool ret = false;
    root_element   = element;
    active_element = element;
    setTimingAttributes();
    id = "body";  // useful for debug
    if (element.hasChildNodes())
    {
        active_element = element.firstChildElement();
        setPlaylist();
        iterator       = dom_list.begin();
        active_element = *iterator;
        ret = true;
    }
    else
       finishedActiveDuration();
    return ret;
}
Example #11
0
PlaylistWidget::PlaylistWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::PlaylistWidget)
{
    ui->setupUi(this);

    m_delegate = new TrackDelegate(this);
    ui->listView->setItemDelegate(m_delegate);
    ui->listView->setAcceptDrops(true);

    m_model = new PlaylistModel(this);
    m_model->setTrackCycler(Player::instance()->cycler());
    m_model->setMediaLibrary(Player::instance()->media());
    m_model->setFavoritesManager(Player::instance()->favorites());

    m_favFilterModel = new FavoritesFilterModel(this);
    m_favFilterModel->setSourceModel(m_model);
    m_favFilterModel->setDynamicSortFilter(true);
    connect(ui->listView,       SIGNAL(showFavoritesToggled(bool)), this,           SLOT(setFavoritesFilterEnabled(bool)));
    connect(m_favFilterModel,   SIGNAL(enabledChanged(bool)),       ui->listView,   SLOT(toggleFavorites(bool)));

    m_sortModel = new QSortFilterProxyModel(this);
    m_sortModel->setSourceModel(m_favFilterModel);
    m_sortModel->setFilterRole(PlaylistModel::SearchRole);
    m_sortModel->setDynamicSortFilter(true);
    m_sortModel->setFilterCaseSensitivity(Qt::CaseInsensitive);

    ui->listView->setModel(m_sortModel);

    connect(ui->clearButton,    SIGNAL(clicked()),              ui->filterEdit, SLOT(clear()));
    connect(ui->filterEdit,     SIGNAL(textChanged(QString)),   this,           SLOT(setFilter(QString)));

    TrackCycler * cycler = Player::instance()->cycler();
    if (cycler != 0) {
        connect(cycler, SIGNAL(trackChanged(PlayId)), this, SLOT(onTrackChanged(PlayId)));
    }

    PlaylistHistory *history = Player::instance()->history();
    if (history != 0) {
        connect(history,SIGNAL(currentChanged(Playlist*)),  this,   SLOT(setPlaylist(Playlist*)));
        connect(history,SIGNAL(countChanged()),             this,   SLOT(onPlaylistCountChanged()));
        setPlaylist(history->current());
    }
void QMediaPlayerPrivate::setPlaylistMedia()
{
    // This function loads current playlist media into backend.
    // If current media is a playlist, the function recursively
    // loads media from the playlist.
    // It also makes sure the correct playlist signals are connected.
    Q_Q(QMediaPlayer);

    if (playlist) {
        connectPlaylist();
        if (playlist->currentMedia().playlist()) {
            if (nestedPlaylists < MAX_NESTED_PLAYLISTS) {
                emit q->currentMediaChanged(playlist->currentMedia());
                // rewind nested playlist to start
                playlist->currentMedia().playlist()->setCurrentIndex(0);
                nestedPlaylists++;
                setPlaylist(playlist->currentMedia().playlist());
            } else {
                playlist->next();
            }
            return;
        } else if (control != 0) {
            // If we've just switched to a new playlist,
            // then last emited currentMediaChanged was a playlist.
            // Make sure we emit currentMediaChanged if new playlist has
            // the same media as the previous one:
            // sample.m3u
            //      test.wav     -- processed by backend
            //      nested.m3u   -- processed by frontend
            //          test.wav -- processed by backend,
            //                      media is not changed,
            //                      frontend needs to emit currentMediaChanged
            bool isSameMedia = (control->media() == playlist->currentMedia());
            control->setMedia(playlist->currentMedia(), 0);
            if (isSameMedia) {
                emit q->currentMediaChanged(control->media());
            }
        }
    } else {
        q->setMedia(QMediaContent(), 0);
    }
}
Example #13
0
QString MpvHandler::PopulatePlaylist()
{
    if(path != "")
    {
        QStringList playlist;
        QDir root(path);
        QStringList filter = Mpv::media_filetypes;
        if(path != QString() && file != QString())
            filter.append(QString("*.%1").arg(file.split(".").last()));
        QFileInfoList flist;
        flist = root.entryInfoList(filter, QDir::Files);
        for(auto &i : flist)
            playlist.push_back(i.fileName()); // add files to the list
        setPlaylist(playlist);
        if(playlist.empty())
            return QString();
        return playlist.first();
    }
    return QString();
}
Example #14
0
    void SoundManager::playPlaylist(std::string playlist)
    {
        if (playlist == "")
        {
            if(!isMusicPlaying())
            {
                startRandomTitle();
            }
            return;
        }

        if(!setPlaylist(playlist))
        {
            startRandomTitle();
        }
        else if (!isMusicPlaying())
        {
            startRandomTitle();
        }
    }
Example #15
0
 void SoundManager::stopMusic()
 {
     if (music)
         music->stop();
     setPlaylist();
 }
Example #16
0
void PlaylistPlayer::playPlaylist(Playlist *playlist)
{
    setPlaylist(playlist);
    playItemAt(0);
}
Example #17
0
DirBrowser::DirBrowser(QWidget *parent, Playlist *pl)
    : QWidget(parent), ui(new Ui::DirBrowser), m_pl(pl), m_insertactive(false)
{
    QKeySequence seq;
    QShortcut *sc;

    ui->setupUi(this);
    ui->searchFrame->hide();
    ui->tabs->setTabsClosable(true);

    QToolButton *plusbut = new QToolButton(this);
    QString icon_path = Helper::getIconPath();
    QIcon icon = QIcon(icon_path + "/addtab.png");
    plusbut->setIcon(icon);
    ui->tabs->setCornerWidget(plusbut, Qt::TopRightCorner);
    plusbut->setCursor(Qt::ArrowCursor);
    plusbut->setAutoRaise(true);
    plusbut->setToolTip(tr("Add tab"));
    connect(plusbut, SIGNAL(clicked()), this, SLOT(addTab()));
    seq = QKeySequence("Ctrl+t");
    sc = new QShortcut(seq, this);
    connect(sc, SIGNAL (activated()), this, SLOT(addTab()));
    seq = QKeySequence("Ctrl+w");
    sc = new QShortcut(seq, this);
    connect(sc, SIGNAL (activated()), this, SLOT(closeCurrentTab()));

    connect(ui->tabs, SIGNAL(currentChanged(int)), 
            this, SLOT(onCurrentTabChanged(int)));
    connect(ui->tabs, SIGNAL(tabCloseRequested(int)), 
            this, SLOT(closeTab(int)));
            
    icon = QIcon(icon_path + "/cross.png");
    ui->closeSearchTB->setIcon(icon);
    connect(ui->closeSearchTB, SIGNAL(clicked()), 
            this, SLOT(closeSearchPanel()));
    seq = QKeySequence("Ctrl+f");
    sc = new QShortcut(seq, this);
    connect(sc, SIGNAL (activated()), this, SLOT(openSearchPanel()));
    seq = QKeySequence("/");
    sc = new QShortcut(seq, this);
    connect(sc, SIGNAL (activated()), this, SLOT(openSearchPanel()));
    seq = QKeySequence("Esc");
    sc = new QShortcut(seq, this);
    connect(sc, SIGNAL (activated()), this, SLOT(closeSearchPanel()));

    seq = QKeySequence(Qt::Key_F3);
    sc = new QShortcut(seq, this);
    connect(sc, SIGNAL(activated()), this, SLOT(searchNext()));
    seq = QKeySequence(Qt::SHIFT + Qt::Key_F3);
    sc = new QShortcut(seq, this);
    connect(sc, SIGNAL(activated()), this, SLOT(searchPrev()));
    connect(ui->searchCMB->lineEdit(), SIGNAL(textChanged(const QString&)), 
            this, SLOT(onSearchTextChanged(const QString&)));
    connect(ui->nextTB, SIGNAL(clicked()), this, SLOT(searchNext()));
    connect(ui->prevTB, SIGNAL(clicked()), this, SLOT(searchPrev()));
    connect(ui->searchCMB->lineEdit(), SIGNAL(returnPressed()),
            this, SLOT(returnPressedInSearch()));
    seq = QKeySequence("Ctrl+s");
    sc = new QShortcut(seq, this);
    connect(sc, SIGNAL(activated()), this, SLOT(toggleSearchKind()));
    connect(ui->serverSearchCB, SIGNAL(stateChanged(int)), 
            this, SLOT(onSearchKindChanged(int)));
    connect(ui->execSearchPB, SIGNAL(clicked()), this, SLOT(serverSearch()));

    onSearchKindChanged(int(ui->serverSearchCB->checkState()));
    ui->execSearchPB->hide();
    setPlaylist(pl);
}