void FooPlaylistManager::removePlaylist(QString name, QUuid uuid)
	{
		int i = playlistIndex(name, uuid);

		if (i >= 0)
		{
			FooPlaylist* const p = playlists->at(i);

			if (currentPlayingPlaylist == p)
			{
				currentPlayingPlaylist = NULL;
			}

			delete p;

			playlists->removeAt(i);

			emit playlistRemoved(name, uuid);

			if (playlists->size() == 0)
			{
				createPlaylist();
			}
		}
	}
	void FooPlaylistManager::renamePlaylist(QUuid uuid, QString oldName, QString newName)
	{
		qDebug() << "oldName" << oldName;

		int i = playlistIndex(oldName, uuid);

		playlists->at(i)->setName(newName);

		emit playlistRenamed(uuid, oldName, newName);
	}
Beispiel #3
0
QModelIndex KNMusicPlaylistManager::importPlaylists(
        const QStringList &filePaths)
{
    //Generate the first index.
    QModelIndex firstImport=QModelIndex();
    //Import all the files.
    for(auto i=filePaths.constBegin(); i!=filePaths.end(); ++i)
    {
        //Get the model index via import the playlist.
        QModelIndex playlistIndex(importPlaylist(*i));
        //Check whether the index is valid.
        if(playlistIndex.isValid() && (!firstImport.isValid()))
        {
            //Save the current index.
            firstImport=playlistIndex;
        }
    }
    //Give back the first import index.
    return firstImport;
}