contextMenu2 = new Q3PopupMenu( this);
contextMenu2 = new Q3PopupMenu( this);
contextMenu = new Q3PopupMenu( this);
contextMenu2 = new Q3PopupMenu( this);
connect(contextMenu2,
SIGNAL(triggered
(QAction *)),
this,
SLOT(actionTriggered
(QAction *)));
connect(contextMenu,
SIGNAL(triggered
(QAction *)),
this,
SLOT(actionTriggered2
(QAction *)));
void MainWindow
::PlaylistMenu( Q3ListViewItem
*Item,
const QPoint &point,
int) {
contextMenu2->clear();
contextMenu->clear();
if( Item )
contextMenu->popup( point );
Q_CHECK_PTR( contextMenu );
//Die Playlist Funktionen sollen nur angezeigt werden, wenn auch
//eine Playlist gewählt wurde und auch einen song vorhanden ist
if((ui.playlistname_cb->currentText() != "") && (ui.listView->childCount() > 0))
{
contextMenu->insertItem( "&remove from Playlist");
contextMenu
->exec
( QCursor::pos() );
//delete contextMenu;
return;
}
if((ui.playlistname_cb->currentText() == "") && (ui.listView->childCount() > 0))
{
contextMenu2->setTitle("add to Playlist");
int items = ui.playlistname_cb->count();
for(int i = 1; i < items; i++)
{
QString playlistname
= ui.
playlistname_cb->itemText
(i
);
contextMenu2->addAction(playlistname);
contextMenu->addMenu(contextMenu2);
}
contextMenu
->exec
( QCursor::pos() );
//delete contextMenu;
//delete contextMenu2;
return;
}
}
void MainWindow
::actionTriggered(QAction *a
) {
addToPlaylist(&playlistname);
}
void MainWindow
::actionTriggered2(QAction *a
) {
QString songname
= (ui.
listView->currentItem
() )->text
( 0 );
QString artist
= (ui.
listView->currentItem
() )->text
( 1 );
"Remove " + songname + " of " + artist + " from Playlist "
+ ui.playlistname_cb->currentText() + " ?\n\n",
"Yes",
"No", 0, 0, 1 ) )
{
case 1:
break;
case 0:
//Song aus der aktuelle Playlist löschen
removeFromPlaylist();
//Aktualisieren
getPlaylist();
}
}
contextMenu2 = new Q3PopupMenu( this);
contextMenu2 = new Q3PopupMenu( this);
contextMenu = new Q3PopupMenu( this);
contextMenu2 = new Q3PopupMenu( this);
connect(contextMenu2,SIGNAL(triggered(QAction *)),this,SLOT(actionTriggered(QAction *)));
connect(contextMenu,SIGNAL(triggered(QAction *)),this,SLOT(actionTriggered2(QAction *)));
void MainWindow::PlaylistMenu( Q3ListViewItem *Item, const QPoint &point, int)
{
contextMenu2->clear();
contextMenu->clear();
if( Item )
contextMenu->popup( point );
Q_CHECK_PTR( contextMenu );
//Die Playlist Funktionen sollen nur angezeigt werden, wenn auch
//eine Playlist gewählt wurde und auch einen song vorhanden ist
if((ui.playlistname_cb->currentText() != "") && (ui.listView->childCount() > 0))
{
contextMenu->insertItem( "&remove from Playlist");
contextMenu->exec( QCursor::pos() );
//delete contextMenu;
return;
}
if((ui.playlistname_cb->currentText() == "") && (ui.listView->childCount() > 0))
{
contextMenu2->setTitle("add to Playlist");
int items = ui.playlistname_cb->count();
for(int i = 1; i < items; i++)
{
QString playlistname = ui.playlistname_cb->itemText(i);
contextMenu2->addAction(playlistname);
contextMenu->addMenu(contextMenu2);
}
contextMenu->exec( QCursor::pos() );
//delete contextMenu;
//delete contextMenu2;
return;
}
}
void MainWindow::actionTriggered(QAction *a)
{
QString playlistname = a->text();
addToPlaylist(&playlistname);
}
void MainWindow::actionTriggered2(QAction *a)
{
QString songname = (ui.listView->currentItem() )->text( 0 );
QString artist = (ui.listView->currentItem() )->text( 1 );
switch( QMessageBox::warning( this, "DSM",
"Remove " + songname + " of " + artist + " from Playlist "
+ ui.playlistname_cb->currentText() + " ?\n\n",
"Yes",
"No", 0, 0, 1 ) )
{
case 1:
break;
case 0:
//Song aus der aktuelle Playlist löschen
removeFromPlaylist();
//Aktualisieren
getPlaylist();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks