Ejemplo n.º 1
0
Phonon::MediaSource PlaylistView::getAndRemoveNextSong(){
  const QModelIndex root = model()->index(0,0);
  Phonon::MediaSource toReturn = 
    model()->data(root.sibling(root.row(), 5)).toString();
  removeSong(root);
  return toReturn;
}
Ejemplo n.º 2
0
CollectionDialog::CollectionDialog(SLManager *slm,int selC,QWidget *parent,const char *name) : QDialog(parent,name,TRUE)
{
setCaption(i18n("Collections Manager"));
ok=new KPushButton(KStdGuiItem::ok(),this);
ok->setGeometry(140,200,100,30);
connect(ok,SIGNAL(clicked()),SLOT(accept()) );
cancel=new KPushButton(KStdGuiItem::cancel(),this);
cancel->setGeometry(250,200,100,30);
connect(cancel,SIGNAL(clicked()),SLOT(reject()) );

label=new QLabel(i18n("Available collections:"),this);
label->adjustSize();
label->move(10,10);
collections=new QListBox(this,"collectionlist");
collections->setGeometry(10,20+label->height(),340,90);
connect(collections,SIGNAL(highlighted(int)),SLOT(collectionselected(int)));
connect(collections,SIGNAL(selected(int)),SLOT(changeCollectionName(int)));
slman=slm;
for (int i=0;i<=slman->numberOfCollections();i++)
    {
    collections->insertItem(i18n( slman->getCollectionName(i) ),i);
#ifdef COLLECTDLGDEBUG
    printf("Name : %s\n",slman->getCollectionName(i));
#endif
    };
selectedC=selC;
#ifdef COLLECTDLGDEBUG
printf("selectedC : %d\n",selectedC);
#endif

label2=new QLabel(i18n("Songs in selected collection:"),this);
label2->adjustSize();
label2->move(10,collections->y()+collections->height()+10);

songs=new QListBox(this,"songlist");
songs->setGeometry(10,label2->y()+label2->height()+10,340,120);
connect(songs,SIGNAL(highlighted(int)),SLOT(songselected(int)));
currentsl=slman->getCollection(selectedC);
if (slman->numberOfCollections()>0)
    {
    collections->setCurrentItem(selectedC);
    collections->centerCurrentItem();
    };
//fillInSongList();
newC=new QPushButton(i18n("&New..."),this);
newC->adjustSize();
newC->move(360,collections->y()+5);
connect(newC,SIGNAL(clicked()),SLOT(newCollection()) );
copyC=new QPushButton(i18n("&Copy..."),this);
copyC->adjustSize();
copyC->move(360,newC->y()+newC->height()+5);
connect(copyC,SIGNAL(clicked()),SLOT(copyCollection()) );
deleteC=new QPushButton(i18n("Delete"),this);
deleteC->adjustSize();
deleteC->move(360,copyC->y()+copyC->height()+5);
connect(deleteC,SIGNAL(clicked()),SLOT(deleteCollection()) );

addS=new QPushButton(i18n("&Add..."),this);
addS->adjustSize();
addS->move(360,songs->y()+5);
connect(addS,SIGNAL(clicked()),SLOT(addSong()) );
delS=new QPushButton(i18n("&Remove"),this);
delS->adjustSize();
delS->move(360,addS->y()+addS->height()+5);
connect(delS,SIGNAL(clicked()),SLOT(removeSong()) );

ok->move(ok->x(),songs->y()+songs->height()+10);
cancel->move(ok->x()+ok->width()+5,ok->y());

setMinimumSize(400,ok->y()+ok->height()+5);
//setMaximumSize(360,240);
}
Ejemplo n.º 3
0
int main( int argc, char* argv[ ] ) {
	Playlist *myList = NULL;
	int minutes, seconds;
	char *name, *title, *artist;
	Option opt;

	printf("\n\nWelcome to project 5 - music playlists\n\n");
	opt = getAction();
	while (opt != QUIT) {
		switch (opt) {
			case ADD_LIST:
				printf("Adding a new playlist to start of library\n");
				name = getString("Enter the name of the new playlist");
				printf("\nAdding the playlist '%s' to your library (at front of library) \n", name);
				myList = add(myList, name);
				break;
			case ADD_SONG:
				printf("Add a song to an existing playlist\n");
				name = getString("Enter the name of the playlist");
				title = getString("Enter the title of the song to add");
				artist = getString("Enter the name of the artist");
				getTime(&minutes, &seconds);
				printf("\nAdding the song below to the playlist '%s' (at end of playlist)\n", name);
				printf("\tTitle : %s\n", title);
				printf("\tArtist: %s\n", artist);
				printf("\tLength: %d:%d\n", minutes, seconds);
				addSong(myList, name, title, artist, minutes, seconds);
				break;
			case PRINT_LIST:
				printf("Print the songs in a playlist\n");
				name = getString("Enter the name of the playlist");
				printf("\nPrinting the names of all songs in the playlist '%s'\n", name);
				printSongs(myList, name);
				break;
			case LIST_SIZE:
				printf("Print the size of a playlist\n");
				name = getString("Enter the name of the playlist");
				printf("\nThe playlist '%s' contains N songs and has NN:NN minutes of music\n", name);
				printSize(myList, name);
				break;
			case STATS:
				printf("Print statistics on all your playslists\n");
				printStats(myList);
				break;
			case ADD_LIST_ORDERED:
				printf("Adding a new playlist to library (ordered)\n");
				name = getString("Enter the name of the new playlist");
				printf("\nAdding the playlist '%s' to your library (in alphabetical order)\n", name);
				myList = addOrdered(myList, name);
				break;
			case ADD_SONG_ORDERED:
				printf("Add a song to an existing playlist (ordered)\n");
				name = getString("Enter the name of the playlist");
				title = getString("Enter the title of the song to add");
				artist = getString("Enter the name of the artist");
				getTime(&minutes, &seconds);
				printf("\nAdding the song below to the playlist '%s' (in alphabetical order)\n", name);
				printf("\tTitle : %s\n", title);
				printf("\tArtist: %s\n", artist);
				printf("\tLength: %d:%d\n", minutes, seconds);
				addSongOrdered(myList, name, title, artist, minutes, seconds);
				break;
			case REMOVE_SONG:
				printf("Removing a song from an existing playlist\n");
				name = getString("Enter the name of the playlist");
				title = getString("Enter the title of the song to remove");
				artist = getString("Enter the artist of the song to remove");
				printf("\nRemoving the song '%s' by '%s' from the playlist %s\n", title, artist, name);
				removeSong(myList, name, title, artist);
				break;
			case REMOVE_LIST:
				printf("Removing a playlist\n");
				name = getString("Enter the name of the playlist to remove");
				printf("\nRemoving the the playlist %s from your library\n", name);
				myList = removeList(myList, name);
				break;
			case HELP:
				optionDetails();
				break;
			default: break;
		}
		opt = getAction();
	}
	return 0;
}