1 /***************************************************************************
2 * copyright : (C) 2005 Seb Ruiz <me@sebruiz.net> *
3 **************************************************************************/
5 /***************************************************************************
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 ***************************************************************************/
14 #ifndef AMAROK_QUEUEMANAGER_H
15 #define AMAROK_QUEUEMANAGER_H
17 #include "playlistitem.h"
19 #include <KDialog> //baseclass
21 #include <QListWidget> //baseclass
22 #include <QListWidgetItem> //baseclass
26 class QDragEnterEvent
;
32 class QueueItem
: public QListWidgetItem
36 QueueItem( const QString
& s
) : QListWidgetItem( s
) { }
38 void paintCell( QPainter
*p
, const QColorGroup
&cg
, int column
, int width
, int align
);
42 class QueueList
: public QListWidget
46 friend class QueueManager
;
49 explicit QueueList( QWidget
*parent
, const char *name
= 0 );
53 bool isEmpty() { return ( count() == 0 ); }
56 void moveSelectedUp() { moveSelected( -1 ); }
57 void moveSelectedDown() { moveSelected( 1 ); }
58 void removeSelected();
62 void moveSelected( int direction
);
63 void dragEnterEvent( QDragEnterEvent
*e
);
64 void dragMoveEvent( QDragMoveEvent
* e
);
65 void dropEvent( QDropEvent
*e
);
66 void keyPressEvent( QKeyEvent
*e
);
67 void paintEvent( QPaintEvent
* );
73 class QueueManager
: public KDialog
78 explicit QueueManager( QWidget
*parent
= 0, const char *name
= 0 );
81 QList
<PlaylistItem
* > newQueue();
83 static QueueManager
*instance() { return s_instance
; }
87 void addItems( QListWidgetItem
*after
= 0 ); /// For the add button (uses selected playlist tracks)
88 void changeQueuedItems( const QList
<PlaylistItem
*> &in
, const QList
<PlaylistItem
*> &out
); /// For keeping queue/dequeue in sync
92 void removeSelected();
97 void addQueuedItem( PlaylistItem
*item
);
98 void removeQueuedItem( PlaylistItem
*item
);
100 QMap
<QListWidgetItem
*, PlaylistItem
*> m_map
;
101 QueueList
*m_listview
;
104 KPushButton
*m_remove
;
106 KPushButton
*m_clear
;
108 static QueueManager
*s_instance
;
111 #endif /* AMAROK_QUEUEMANAGER_H */