Diffstat (limited to 'core/multimedia/opieplayer/playlistselection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistselection.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index 85228a9..67187f8 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp | |||
@@ -42,94 +42,95 @@ public: | |||
42 | ~PlayListSelectionItem() { | 42 | ~PlayListSelectionItem() { |
43 | }; | 43 | }; |
44 | 44 | ||
45 | const DocLnk *file() const { return fl; } | 45 | const DocLnk *file() const { return fl; } |
46 | 46 | ||
47 | private: | 47 | private: |
48 | const DocLnk *fl; | 48 | const DocLnk *fl; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | 51 | ||
52 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | 52 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) |
53 | : QListView( parent, name ) | 53 | : QListView( parent, name ) |
54 | { | 54 | { |
55 | // qDebug("starting playlistselector"); | 55 | // qDebug("starting playlistselector"); |
56 | // #ifdef USE_PLAYLIST_BACKGROUND | 56 | // #ifdef USE_PLAYLIST_BACKGROUND |
57 | // setStaticBackground( TRUE ); | 57 | // setStaticBackground( TRUE ); |
58 | // setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); | 58 | // setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); |
59 | 59 | ||
60 | // setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); | 60 | // setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); |
61 | // #endif | 61 | // #endif |
62 | // addColumn("Title",236); | 62 | // addColumn("Title",236); |
63 | // setAllColumnsShowFocus( TRUE ); | 63 | // setAllColumnsShowFocus( TRUE ); |
64 | addColumn( tr( "Playlist Selection" ) ); | 64 | addColumn( tr( "Playlist Selection" ) ); |
65 | header()->hide(); | 65 | header()->hide(); |
66 | setSorting( -1, FALSE ); | 66 | // setSorting( -1, FALSE ); |
67 | // FIXME | ||
67 | } | 68 | } |
68 | 69 | ||
69 | 70 | ||
70 | PlayListSelection::~PlayListSelection() { | 71 | PlayListSelection::~PlayListSelection() { |
71 | } | 72 | } |
72 | 73 | ||
73 | 74 | ||
74 | // #ifdef USE_PLAYLIST_BACKGROUND | 75 | // #ifdef USE_PLAYLIST_BACKGROUND |
75 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { | 76 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { |
76 | // qDebug("drawBackground"); | 77 | // qDebug("drawBackground"); |
77 | p->fillRect( r, QBrush( white ) ); | 78 | p->fillRect( r, QBrush( white ) ); |
78 | // QImage logo = Resource::loadImage( "launcher/opielogo" ); | 79 | // QImage logo = Resource::loadImage( "launcher/opielogo" ); |
79 | // if ( !logo.isNull() ) | 80 | // if ( !logo.isNull() ) |
80 | // p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); | 81 | // p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); |
81 | } | 82 | } |
82 | // #endif | 83 | // #endif |
83 | 84 | ||
84 | 85 | ||
85 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { | 86 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { |
86 | if ( event->state() == QMouseEvent::LeftButton ) { | 87 | if ( event->state() == QMouseEvent::LeftButton ) { |
87 | QListViewItem *currentItem = selectedItem(); | 88 | QListViewItem *currentItem = selectedItem(); |
88 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); | 89 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); |
89 | if ( currentItem && currentItem->itemAbove() == itemUnder ) | 90 | if ( currentItem && currentItem->itemAbove() == itemUnder ) |
90 | moveSelectedUp(); | 91 | moveSelectedUp(); |
91 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) | 92 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) |
92 | moveSelectedDown(); | 93 | moveSelectedDown(); |
93 | } | 94 | } |
94 | } | 95 | } |
95 | 96 | ||
96 | 97 | ||
97 | const DocLnk *PlayListSelection::current() { | 98 | const DocLnk *PlayListSelection::current() { |
98 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); | 99 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); |
99 | if ( item ) | 100 | if ( item ) |
100 | return item->file(); | 101 | return item->file(); |
101 | return NULL; | 102 | return NULL; |
102 | } | 103 | } |
103 | 104 | ||
104 | 105 | ||
105 | void PlayListSelection::addToSelection( const DocLnk &lnk ) { | 106 | void PlayListSelection::addToSelection( const DocLnk &lnk ) { |
106 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); | 107 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); |
107 | QListViewItem *current = selectedItem(); | 108 | QListViewItem *current = selectedItem(); |
108 | if ( current ) | 109 | if ( current ) |
109 | item->moveItem( current ); | 110 | item->moveItem( current ); |
110 | setSelected( item, TRUE ); | 111 | setSelected( item, TRUE ); |
111 | ensureItemVisible( selectedItem() ); | 112 | ensureItemVisible( item); |
112 | } | 113 | } |
113 | 114 | ||
114 | 115 | ||
115 | void PlayListSelection::removeSelected() { | 116 | void PlayListSelection::removeSelected() { |
116 | QListViewItem *item = selectedItem(); | 117 | QListViewItem *item = selectedItem(); |
117 | if ( item ) | 118 | if ( item ) |
118 | delete item; | 119 | delete item; |
119 | setSelected( currentItem(), TRUE ); | 120 | setSelected( currentItem(), TRUE ); |
120 | ensureItemVisible( selectedItem() ); | 121 | ensureItemVisible( selectedItem() ); |
121 | } | 122 | } |
122 | 123 | ||
123 | 124 | ||
124 | void PlayListSelection::moveSelectedUp() { | 125 | void PlayListSelection::moveSelectedUp() { |
125 | QListViewItem *item = selectedItem(); | 126 | QListViewItem *item = selectedItem(); |
126 | if ( item && item->itemAbove() ) | 127 | if ( item && item->itemAbove() ) |
127 | item->itemAbove()->moveItem( item ); | 128 | item->itemAbove()->moveItem( item ); |
128 | ensureItemVisible( selectedItem() ); | 129 | ensureItemVisible( selectedItem() ); |
129 | } | 130 | } |
130 | 131 | ||
131 | 132 | ||
132 | void PlayListSelection::moveSelectedDown() { | 133 | void PlayListSelection::moveSelectedDown() { |
133 | QListViewItem *item = selectedItem(); | 134 | QListViewItem *item = selectedItem(); |
134 | if ( item && item->itemBelow() ) | 135 | if ( item && item->itemBelow() ) |
135 | item->moveItem( item->itemBelow() ); | 136 | item->moveItem( item->itemBelow() ); |