当前位置: 首页>>代码示例>>C++>>正文


C++ PlaylistModel类代码示例

本文整理汇总了C++中PlaylistModel的典型用法代码示例。如果您正苦于以下问题:C++ PlaylistModel类的具体用法?C++ PlaylistModel怎么用?C++ PlaylistModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PlaylistModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: g_regex_new

void PlaylistView::selectSongsByRegExp()
{
    // We can't use selectItemsByRegExp here, because it matches ListModelItemData::text,
    // but for PlaylistModel its value doesn't correspond to what actually displyed, as
    // it uses SongDisplayFormatParser for this job.
    auto resultCallback = [this](const std::string& pattern, LineEdit::Result result)
    {
        if (result == LineEdit::Result::Accepted) {
            GRegex *regex = g_regex_new(pattern.c_str(), G_REGEX_OPTIMIZE,
                                        (GRegexMatchFlags)0, nullptr);
            if (!regex)
                return;

            PlaylistModel *plsModel = static_cast<PlaylistModel*>(model());
            PlaylistItemDelegate *delegate = static_cast<PlaylistItemDelegate*>(itemDelegate());

            selectItems([plsModel, delegate, regex](int item){
                return delegate->matchFormattedString(plsModel->song(item), regex);
            });
            g_regex_unref(regex);
            StatusArea::showMessage("%d items selected", selectedItems().size());
        }
    };
    StatusArea::askQuestion("Select items: ", resultCallback, ".*");
}
开发者ID:ccrtnsp,项目名称:ncxmms2,代码行数:25,代码来源:playlistview.cpp

示例2: PlaylistView

bool
PlaylistManager::show( const Tomahawk::album_ptr& album )
{
    PlaylistView* view;
    if ( !m_albumViews.contains( album ) )
    {
        view = new PlaylistView();
        PlaylistModel* model = new PlaylistModel();
        view->setModel( model );
        view->setFrameShape( QFrame::NoFrame );
        view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
        model->append( album );

        m_albumViews.insert( album, view );
    }
    else
    {
        view = m_albumViews.value( album );
    }
    
    setPage( view );
    emit numSourcesChanged( 1 );

    return true;
}
开发者ID:tdfischer,项目名称:tomahawk,代码行数:25,代码来源:playlistmanager.cpp

示例3: index

void FilterPlaylistModel::setCurrentIndex(int presentIndex)
{
    QModelIndex i = index(presentIndex, 0);
    PlaylistModel *playlistmodel = static_cast<PlaylistModel*>(sourceModel());
    playlistmodel->setCurrentIndex(mapToSource(i).row());
    emit currentIndexChanged();
}
开发者ID:KDE,项目名称:plasma-mediacenter,代码行数:7,代码来源:filterplaylistmodel.cpp

示例4: addFile

void PlaylistView::addFile(const std::string& path)
{
    PlaylistModel *plsModel = static_cast<PlaylistModel*>(model());

    const std::string::size_type slashPos = path.rfind('/');
    const std::string fileName = slashPos != std::string::npos
                                 ? path.substr(slashPos + 1)
                                 : path;

    const Utils::FileType fileType = Utils::getFileType(path);
    switch (fileType) {
        case Utils::FileType::Media:
            m_xmmsClient->playlistAddUrl(plsModel->playlist(),
                                         std::string("file://").append(path));
            StatusArea::showMessage("Adding \"%s\" file to \"%s\" playlist",
                                    fileName, plsModel->playlist());
            break;

        case Utils::FileType::Playlist:
            m_xmmsClient->playlistAddPlaylistFile(plsModel->playlist(),
                                                  std::string("file://").append(path));
            StatusArea::showMessage("Adding \"%s\" playlist to \"%s\" playlist",
                                    fileName, plsModel->playlist());
            break;

        case Utils::FileType::Unknown:
            StatusArea::showMessage("Unknown file type!");
            break;
    }
}
开发者ID:ccrtnsp,项目名称:ncxmms2,代码行数:30,代码来源:playlistview.cpp

示例5: AnimatedWidget

QueueView::QueueView( AnimatedSplitter* parent )
    : AnimatedWidget( parent )
    , ui( new Ui::QueueView )
    , m_dragTimer( 0 )
{
    ui->setupUi( this );
    TomahawkUtils::unmarginLayout( layout() );
    setContentsMargins( 0, 0, 0, 0 );

    setHiddenSize( QSize( 0, 22 ) );

    ui->queue->setProxyModel( new QueueProxyModel( ui->queue ) );
    ui->queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored );

    PlaylistModel* queueModel = new PlaylistModel( this );
    queueModel->setStyle( PlaylistModel::Short );
    queueModel->finishLoading();
    ui->queue->setPlaylistModel( queueModel );
    queueModel->setReadOnly( false );

//    ui->queue->setEmptyTip( tr( "The queue is currently empty. Drop something to enqueue it!" ) );
    ui->queue->setEmptyTip( QString() );

    connect( queueModel, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( updateLabel() ) );
    connect( ui->toggleButton, SIGNAL( clicked() ), SLOT( show() ) );
    connect( this, SIGNAL( animationFinished() ), SLOT( onAnimationFinished() ) );

    ui->toggleButton->installEventFilter( this );
    ui->toggleButton->setCursor( Qt::PointingHandCursor );
}
开发者ID:creichert,项目名称:tomahawk,代码行数:30,代码来源:QueueView.cpp

示例6: addUrl

void PlaylistView::addUrl(const std::string& url)
{
    PlaylistModel *plsModel = static_cast<PlaylistModel*>(model());
    m_xmmsClient->playlistAddUrl(plsModel->playlist(), url);

    // FIXME: Url may be too long to display
    StatusArea::showMessage("Adding \"%s\" to \"%s\" playlist", url, plsModel->playlist());
}
开发者ID:ccrtnsp,项目名称:ncxmms2,代码行数:8,代码来源:playlistview.cpp

示例7: PlaylistView

PlaylistView*
ViewManager::createPageForPlaylist( const playlist_ptr& pl )
{
    PlaylistView* view = new PlaylistView();
    PlaylistModel* model = new PlaylistModel();
    view->setPlaylistModel( model );
    model->loadPlaylist( pl );
    pl->resolve();

    m_playlistViews.insert( pl, view );
    return view;
}
开发者ID:nowrep,项目名称:tomahawk,代码行数:12,代码来源:ViewManager.cpp

示例8: PlaylistView

PlaylistView*
ViewManager::createPageForPlaylist( const playlist_ptr& pl )
{
    PlaylistView* view = new PlaylistView();
    PlaylistModel* model = new PlaylistModel();
    view->setPlaylistModel( model );
    model->loadPlaylist( pl );
    view->setFrameShape( QFrame::NoFrame );
    view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
    pl->resolve();

    m_playlistViews.insert( pl, view );
    return view;
}
开发者ID:xevix,项目名称:tomahawk,代码行数:14,代码来源:viewmanager.cpp

示例9: PlaylistViewPage

PlaylistViewPage*
ViewManager::createPageForPlaylist( const playlist_ptr& playlist )
{
    PlaylistViewPage* view = new PlaylistViewPage();
    PlaylistModel* model = new PlaylistModel();

    // We need to set the model on the view before loading the playlist, so spinners & co are connected
    view->view()->trackView()->setPlayableModel( model );

    model->loadPlaylist( playlist );
    playlist->resolve();

    return view;
}
开发者ID:Zopieux,项目名称:tomahawk,代码行数:14,代码来源:ViewManager.cpp

示例10: FlexibleView

FlexibleView*
ViewManager::createPageForPlaylist( const playlist_ptr& playlist )
{
    FlexibleView* view = new FlexibleView();
    PlaylistModel* model = new PlaylistModel();

    PlaylistView* pv = new PlaylistView();
    pv->setPlaylistModel( model );
    view->setDetailedView( pv );
    view->setPixmap( pv->pixmap() );

    model->loadPlaylist( playlist );
    view->setPlayableModel( model );
    playlist->resolve();

    return view;
}
开发者ID:demelziraptor,项目名称:tomahawk,代码行数:17,代码来源:ViewManager.cpp

示例11: openContainingFolder

void PlaylistView::openContainingFolder()
{
    PlaylistModel *playlistModel = dynamic_cast<PlaylistModel *>(this->model());
    if (playlistModel == nullptr)
    {
        return;
    }

    QModelIndex i = this->currentIndex();
    if (i.isValid())
    {
        int row = i.row();
        const Song *s = playlistModel->getPlaylist()->getSong(row);

        QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(::mydirname(s->Filename))));
    }

}
开发者ID:derselbst,项目名称:ANMP,代码行数:18,代码来源:PlaylistView.cpp

示例12: removeSelectedSongs

void PlaylistView::removeSelectedSongs()
{
    PlaylistModel *plsModel = static_cast<PlaylistModel*>(model());
    if (plsModel->itemsCount() && !isCurrentItemHidden()) {
        //   Actually we don't have to make copy of selectedItems, since removeEntry
        // doesn't modify it immediately, but this is not obvious and may lead to
        // problems in the future.
        const std::vector<int> selectedSongs = selectedItems();
        if (!selectedSongs.empty()) {
            assert(std::is_sorted(selectedSongs.begin(), selectedSongs.end()));
            std::for_each(selectedSongs.rbegin(), selectedSongs.rend(), [&](int item){
                m_xmmsClient->playlistRemoveEntry(plsModel->playlist(), item);
            });
        } else {
            m_xmmsClient->playlistRemoveEntry(plsModel->playlist(), currentItem());
        }
        showCurrentItem();
    }
}
开发者ID:ccrtnsp,项目名称:ncxmms2,代码行数:19,代码来源:playlistview.cpp

示例13: FlexibleView

FlexibleView*
ViewManager::createPageForPlaylist( const playlist_ptr& playlist )
{
    FlexibleView* view = new FlexibleView();
    PlaylistModel* model = new PlaylistModel();

    PlaylistView* pv = new PlaylistView();
    view->setDetailedView( pv );
    view->setPixmap( pv->pixmap() );

    // We need to set the model on the view before loading the playlist, so spinners & co are connected
    view->setPlaylistModel( model );
    pv->setPlaylistModel( model );

    model->loadPlaylist( playlist );
    playlist->resolve();

    return view;
}
开发者ID:prodigeni,项目名称:tomahawk,代码行数:19,代码来源:ViewManager.cpp

示例14: showInspector

void PlaylistView::showInspector()
{
    PlaylistModel *playlistModel = dynamic_cast<PlaylistModel *>(this->model());
    if (playlistModel == nullptr)
    {
        return;
    }

    QModelIndex i = this->currentIndex();
    if (i.isValid())
    {
        int row = i.row();
        const Song *s = playlistModel->getPlaylist()->getSong(row);

        SongInspector *insp = new SongInspector(s, this);
        insp->setAttribute(Qt::WA_DeleteOnClose);
        insp->show();
    }
}
开发者ID:derselbst,项目名称:ANMP,代码行数:19,代码来源:PlaylistView.cpp

示例15: if

playlist_ptr
ViewManager::playlistForPage( ViewPage* page ) const
{
    playlist_ptr p;

    PlaylistViewPage* fv = dynamic_cast< PlaylistViewPage* >( page );
    if ( fv && fv->view()->trackView()->model() )
    {
        PlaylistModel* m = dynamic_cast< PlaylistModel* >( fv->view()->trackView()->model() );
        if ( m && m->playlist() )
        {
            p = m->playlist();
        }
    }
    else if ( dynamic_cast< DynamicWidget* >( page ) )
        p = dynamic_cast< DynamicWidget* >( page )->playlist();

    return p;
}
开发者ID:Zopieux,项目名称:tomahawk,代码行数:19,代码来源:ViewManager.cpp


注:本文中的PlaylistModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。