本文整理汇总了C++中Playlist类的典型用法代码示例。如果您正苦于以下问题:C++ Playlist类的具体用法?C++ Playlist怎么用?C++ Playlist使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Playlist类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _
// _SetItemPosition
void
PickMoveCommand::_SetItemPosition(int64 startFrame, uint32 track)
{
Playlist* list = fItem->Parent();
AutoNotificationSuspender _(list);
fItem->SuspendNotifications(true);
// undo any changes to other items on the (old) track
// (that's the track that our item is currently on)
if (fPushedBackFrames > 0) {
list->MoveItems(fPushedBackStart, -fPushedBackFrames,
fItem->Track(), fItem);
fPushedBackFrames = 0;
// at this point, nothing is pushed around anymore
}
// do the change to our item
fItem->SetTrack(track);
fItem->SetStartFrame(startFrame);
// push other items arround to make room
int64 start = fItem->StartFrame();
int64 end = start + fItem->Duration();
list->MakeRoom(start, end, track, fItem,
&fPushedBackStart, &fPushedBackFrames);
// TODO: not nice that this is done here instead of "automatic"
list->ItemsChanged();
fItem->SuspendNotifications(false);
}
示例2: while
void ApiComponent::getPlaylistFromReply(QNetworkReply *reply)
{
QDomDocument domDocument;
domDocument.setContent(reply->readAll());
QDomElement responseElement = domDocument.firstChildElement(); //! <response list = true>
QDomNode itemNode = responseElement.firstChildElement(); //! <audio>
Playlist playlist;
while(!itemNode.isNull())
{
PlaylistItem data;
QString const artist = itemNode.toElement().elementsByTagName("artist").item(0).toElement().text();
QString const title = itemNode.toElement().elementsByTagName("title").item(0).toElement().text();
QString const duration = itemNode.toElement().elementsByTagName("duration").item(0).toElement().text();
QString const url = itemNode.toElement().elementsByTagName("url").item(0).toElement().text();
if (!artist.isEmpty() && !title.isEmpty() && !duration.isEmpty() && !url.isEmpty())
{
data[Artist] = artist;
data[Title] = title;
data[Duration] = duration;
data[Url] = url;
playlist.push_back(data);
}
itemNode = itemNode.nextSibling();
}
reply->deleteLater();
emit playlistReceived(playlist);
}
示例3: loadPlaylist
void LibSpotifyPlaybackHandler::loadPlaylist( const Playlist& playlist, int startIndex )
{
playQueue_.clear();
currentlyPlayingFromName_ = playlist.getName();
currentlyPlayingFromUri_ = playlist.getLink();
playQueue_.insert(playQueue_.end(), playlist.getTracks().begin(), playlist.getTracks().end());
playQueueIter_ = playQueue_.begin();
if ( startIndex >= 0 )
{
while ( ( playQueueIter_ != playQueue_.end() ) && ( (*playQueueIter_).getIndex() != startIndex ) )
playQueueIter_++;
if ( playQueueIter_ != playQueue_.end() && isShuffle )
{
Track first = *playQueueIter_;
playQueue_.erase(playQueueIter_);
shuffle();
playQueue_.push_front(first);
playQueueIter_ = playQueue_.begin();
}
}
else if ( isShuffle )
{
shuffle();
}
}
示例4: LOGEX
QStringList OverviewPlaylistWidget::LetUserSelectMediaFile(QWidget *pParent, QString pDescription, bool pMultipleFiles)
{
QStringList tResult;
LOGEX(OverviewPlaylistWidget, LOG_VERBOSE, "Current data directory is \"%s\"", CONF.GetDataDirectory().toStdString().c_str());
if (pMultipleFiles)
tResult = QFileDialog::getOpenFileNames(pParent, pDescription,
CONF.GetDataDirectory(),
sLoadMediaFilters,
&sAllLoadMediaFilter,
CONF_NATIVE_DIALOGS);
else
{
tResult = QStringList(QFileDialog::getOpenFileName(pParent, pDescription,
CONF.GetDataDirectory(),
sLoadMediaFilters,
&sAllLoadMediaFilter,
CONF_NATIVE_DIALOGS));
// use the file parser to avoid playlists and resolve them to one single entry
if (!tResult.isEmpty())
{
Playlist tPlaylist = Parse(tResult.first(), "");
if (tPlaylist.size() > 0)
tResult = QStringList(tPlaylist.first().Location);
else
tResult.clear();
}
}
if (!tResult.isEmpty())
CONF.SetDataDirectory(tResult.first().left(tResult.first().lastIndexOf('/')));
return tResult;
}
示例5: main
int
main(int argc, char *argv[])
{
if (argc != PARAMS+1)
usage(argv[0]);
SimilarityStrategy similarity;
SQLiteDatabase database(argv[1]);
OptionList options("",1,3000,0,0,0,0,25);
Generator generator(database, similarity);
if(generator.initialization() == 0)
{
cout << "Erreur d'initialisation" << endl;
exit(EXIT_FAILURE);
}
Playlist playlist = generator.generate(options);
auto first = playlist.begin();
int i = 1;
for(auto it = playlist.begin(); it != playlist.end(); ++it)
cout << "Similarité entre le morceau 1 et " << i++ << " : " << similarity.compute(*first,*it) << endl;
return EXIT_SUCCESS;
}
示例6: str
iwMusicPlayer::~iwMusicPlayer()
{
// Playlist ggf. speichern, die ausgewählt ist, falls eine ausgewählt ist
unsigned short selection = GetCtrl<ctrlComboBox>(2)->GetSelection();
// Entsprechende Datei speichern
if(selection != 0xFFFF)
{
Playlist pl;
pl.ReadMusicPlayer(this);
std::string str(GetCtrl<ctrlComboBox>(2)->GetText(selection));
// RTTR-Playlisten dürfen nicht gelöscht werden
if(str == "S2_Standard")
return;
if(!pl.SaveAs(GetFullPlaylistPath(str), true))
// Fehler, konnte nicht gespeichert werden
WINDOWMANAGER.Show(new iwMsgbox(_("Error"), _("The specified file couldn't be saved!"), this, MSB_OK, MSB_EXCLAMATIONRED));
}
// Entsprechenden Dateipfad speichern
if(selection != 0xFFFF)
SETTINGS.sound.playlist = GetCtrl<ctrlComboBox>(2)->GetText(selection);
// Werte in Musikplayer bringen
if(changed)
{
MUSICPLAYER.GetPlaylist().ReadMusicPlayer(this);
MUSICPLAYER.Play();
}
}
示例7: _ERRORLOG
bool PlaylistDialog::loadListByFileName( QString filename )
{
Playlist* pPlaylist = Playlist::load ( filename );
if ( ! pPlaylist ) {
_ERRORLOG( "Error loading the playlist" );
return 0;
}
Preferences::get_instance()->setLastPlaylistFilename( filename );
Hydrogen* pEngine = Hydrogen::get_instance();
if ( pEngine->m_PlayList.size() > 0 ) {
QTreeWidget* m_pPlaylist = m_pPlaylistTree;
m_pPlaylist->clear();
for ( uint i = 0; i < pEngine->m_PlayList.size(); ++i ){
QTreeWidgetItem* m_pPlaylistItem = new QTreeWidgetItem ( m_pPlaylistTree );
m_pPlaylistItem->setText ( 0, pEngine->m_PlayList[i].m_hFile );
m_pPlaylistItem->setText ( 1, pEngine->m_PlayList[i].m_hScript );
if ( pEngine->m_PlayList[i].m_hScriptEnabled == "Use Script" ) {
m_pPlaylistItem->setCheckState( 2, Qt::Checked );
} else {
m_pPlaylistItem->setCheckState( 2, Qt::Unchecked );
}
}
QTreeWidgetItem* m_pPlaylistItem = m_pPlaylist->topLevelItem ( 0 );
m_pPlaylist->setCurrentItem ( m_pPlaylistItem );
pPlaylist->setSelectedSongNr( 0 );
setWindowTitle ( trUtf8 ( "Playlist Browser" ) + QString(" - ") + pPlaylist->get_filename() );
}
return 1;
}
示例8: switch
void
StopMenu::slotActivated( int index )
{
Playlist* pl = Playlist::instance();
const int mode = pl->stopAfterMode();
switch( index )
{
case NOW:
Amarok::actionCollection()->action( "stop" )->activate();
if( mode == Playlist::StopAfterCurrent || mode == Playlist::StopAfterQueue )
pl->setStopAfterMode( Playlist::DoNotStop );
break;
case AFTER_TRACK:
pl->setStopAfterMode( mode == Playlist::StopAfterCurrent
? Playlist::DoNotStop
: Playlist::StopAfterCurrent );
break;
case AFTER_QUEUE:
pl->setStopAfterMode( mode == Playlist::StopAfterQueue
? Playlist::DoNotStop
: Playlist::StopAfterQueue );
break;
}
}
示例9: Playlist
Playlist* PlaylistManager::AddPlaylist(int id, const QString& name,
const QString& special_type,
const QString& ui_path, bool favorite) {
Playlist* ret = new Playlist(playlist_backend_, app_->task_manager(),
library_backend_, id, special_type, favorite);
ret->set_sequence(sequence_);
ret->set_ui_path(ui_path);
connect(ret, SIGNAL(CurrentSongChanged(Song)),
SIGNAL(CurrentSongChanged(Song)));
connect(ret, SIGNAL(PlaylistChanged()), SLOT(OneOfPlaylistsChanged()));
connect(ret, SIGNAL(PlaylistChanged()), SLOT(UpdateSummaryText()));
connect(ret, SIGNAL(EditingFinished(QModelIndex)),
SIGNAL(EditingFinished(QModelIndex)));
connect(ret, SIGNAL(Error(QString)), SIGNAL(Error(QString)));
connect(ret, SIGNAL(PlayRequested(QModelIndex)),
SIGNAL(PlayRequested(QModelIndex)));
connect(playlist_container_->view(),
SIGNAL(ColumnAlignmentChanged(ColumnAlignmentMap)), ret,
SLOT(SetColumnAlignment(ColumnAlignmentMap)));
playlists_[id] = Data(ret, name);
emit PlaylistAdded(id, name, favorite);
if (current_ == -1) {
SetCurrentPlaylist(id);
}
if (active_ == -1) {
SetActivePlaylist(id);
}
return ret;
}
示例10: Playlist
/* Ensures that the playlist given exists.
* Only used to check for collisions
* when creating a new playlist */
bool PlaylistManager::playlistExists(QString name)
{
Playlist *playlist = new Playlist(name);
bool b = playlist->exists();
return b;
}
示例11: fd
void PlaylistDialog::saveListAs()
{
QString sDirectory = Preferences::get_instance()->getDataDirectory() + "playlists/";
QFileDialog fd(this);
fd.setFileMode ( QFileDialog::AnyFile );
fd.setFilter ( trUtf8 ( "Hydrogen Playlist (*.h2playlist)" ) );
fd.setAcceptMode ( QFileDialog::AcceptSave );
fd.setWindowTitle ( trUtf8 ( "Save Playlist" ) );
fd.setDirectory ( sDirectory );
QString defaultFilename = "untitled.h2playlist";
fd.selectFile ( defaultFilename );
if ( fd.exec() != QDialog::Accepted ){
return;
}
QString filename = fd.selectedFiles().first();
Playlist* pPlaylist = Playlist::get_instance();
if ( ! pPlaylist->save ( filename ) ){
return;
}
Playlist::get_instance()->setIsModified(false);
setWindowTitle ( trUtf8 ( "Playlist Browser" ) + QString(" - ") + filename );
}
示例12: assert
/*
* Remove a song from the queue.
*
* Returns true on success, false on failure.
*/
bool
Control::remove(Songlist * list, Song * song)
{
Playlist * playlist;
assert(song != NULL);
assert(list != NULL);
assert(list != _library);
EXIT_IDLE;
pms->log(MSG_DEBUG, 0, "Removing song with id=%d pos=%d uri=%s from list %s.\n", song->id, song->pos, song->file.c_str(), list->filename.c_str());
/* Remove song from queue */
if (list == _queue) {
// All songs must have ID's
// FIXME: version requirement
assert(song->id != MPD_SONG_NO_ID);
return mpd_run_delete_id(conn->h(), song->id);
}
/* Remove song from stored playlist */
assert(list->filename.size() > 0);
if (mpd_run_playlist_delete(conn->h(), (char *)list->filename.c_str(), song->pos)) {
playlist = static_cast<Playlist *>(list);
playlist->set_synchronized(false);
}
return get_error_bool();
}
示例13: current
void PlaylistHistory::addToCurrent(const QList<QUrl> &filelist)
{
Playlist *playlist = current();
if (playlist != 0)
playlist->append(filelist);
else
replaceCurrent(new Playlist(filelist));
}
示例14: immediateAutoplayStart
void immediateAutoplayStart() {
Playlist *p = Playlists::currentPlaylist();
AutoplayStructure settings;
p->getAutoplaySettings(&settings);
immediateAutoplayCount = min(settings.maxChirps, p->nChirps); // items to play
immediateAutoplayTimeSeconds = 0; // will play immediately
}
示例15: toggleAlternativeBackgroundColor
void CustomizeThemeDialog::toggleAlternativeBackgroundColor(bool b)
{
SettingsPrivate::instance()->setColorsAlternateBG(b);
for (int i = 0; i < _mainWindow->tabPlaylists->count(); i++) {
Playlist *p = _mainWindow->tabPlaylists->playlist(i);
p->setAlternatingRowColors(b);
}
}