本文整理汇总了C++中PlaylistItem::playlist方法的典型用法代码示例。如果您正苦于以下问题:C++ PlaylistItem::playlist方法的具体用法?C++ PlaylistItem::playlist怎么用?C++ PlaylistItem::playlist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlaylistItem
的用法示例。
在下文中一共展示了PlaylistItem::playlist方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
SourceTreeView::addToLocal()
{
QModelIndex idx = m_contextMenuIndex;
if ( !idx.isValid() )
return;
SourcesModel::RowType type = ( SourcesModel::RowType )model()->data( m_contextMenuIndex, SourcesModel::SourceTreeItemTypeRole ).toInt();
if( type == SourcesModel::AutomaticPlaylist || type == SourcesModel::Station )
{
DynamicPlaylistItem* item = itemFromIndex< DynamicPlaylistItem >( m_contextMenuIndex );
dynplaylist_ptr playlist = item->dynPlaylist();
// copy to a link and then generate a new playlist from that
// this way we cheaply regenerate the needed controls
QString link = GlobalActionManager::instance()->copyPlaylistToClipboard( playlist );
GlobalActionManager::instance()->parseTomahawkLink( link );
}
else if ( type == SourcesModel::StaticPlaylist )
{
PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
playlist_ptr playlist = item->playlist();
// just create the new playlist with the same values
QList< query_ptr > queries;
foreach( const plentry_ptr& e, playlist->entries() )
queries << e->query();
playlist_ptr newpl = Playlist::create( SourceList::instance()->getLocal(), uuid(), playlist->title(), playlist->info(), playlist->creator(), playlist->shared(), queries );
}
示例2: processChangeList
bool TagTransactionManager::processChangeList(bool undo)
{
TagAlterationList::ConstIterator it, end;
QStringList errorItems;
it = undo ? m_undoList.constBegin() : m_list.constBegin();
end = undo ? m_undoList.constEnd() : m_list.constEnd();
emit signalAboutToModifyTags();
for(; it != end; ++it) {
PlaylistItem *item = (*it).item();
Tag *tag = (*it).tag();
QFileInfo newFile(tag->fileName());
if(item->file().fileInfo().fileName() != newFile.fileName()) {
if(!renameFile(item->file().fileInfo(), newFile)) {
errorItems.append(item->text(1) + QString(" - ") + item->text(0));
continue;
}
}
if(tag->save()) {
if(!undo)
m_undoList.append(TagTransactionAtom(item, duplicateTag(item->file().tag())));
item->file().setFile(tag->fileName());
item->refreshFromDisk();
item->repaint();
item->playlist()->dataChanged();
item->playlist()->update();
}
else {
Tag *errorTag = item->file().tag();
QString str = errorTag->artist() + " - " + errorTag->title();
if(errorTag->artist().isEmpty())
str = errorTag->title();
errorItems.append(str);
}
kapp->processEvents();
}
undo ? m_undoList.clear() : m_list.clear();
if(!undo && !m_undoList.isEmpty())
action("edit_undo")->setEnabled(true);
else
action("edit_undo")->setEnabled(false);
if(!errorItems.isEmpty())
KMessageBox::errorList(static_cast<QWidget *>(parent()),
i18n("The following files were unable to be changed."),
errorItems,
i18n("Error"));
emit signalDoneModifyingTags();
return errorItems.isEmpty();
}