summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/playlistselection.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistselection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistselection.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistselection.cpp b/noncore/multimedia/opieplayer2/playlistselection.cpp
index 015896f..3499837 100644
--- a/noncore/multimedia/opieplayer2/playlistselection.cpp
+++ b/noncore/multimedia/opieplayer2/playlistselection.cpp
@@ -23,70 +23,70 @@
23#include "playlistselection.h" 23#include "playlistselection.h"
24 24
25#include <stdlib.h> 25#include <stdlib.h>
26 26
27class PlayListSelectionItem : public QListViewItem { 27class PlayListSelectionItem : public QListViewItem {
28public: 28public:
29 PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { 29 PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) {
30 setText( 0, f->name() ); 30 setText( 0, f->name() );
31 setPixmap( 0, f->pixmap() ); 31 setPixmap( 0, f->pixmap() );
32 } 32 }
33 33
34 ~PlayListSelectionItem() { 34 ~PlayListSelectionItem() {
35 }; 35 };
36 36
37 const DocLnk *file() const { return fl; } 37 const DocLnk *file() const { return fl; }
38 38
39private: 39private:
40 const DocLnk *fl; 40 const DocLnk *fl;
41}; 41};
42 42
43 43
44PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) 44PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
45 : QListView( parent, name ) 45 : QListView( parent, name )
46{ 46{
47// qDebug("starting playlistselector"); 47// odebug << "starting playlistselector" << oendl;
48// #ifdef USE_PLAYLIST_BACKGROUND 48// #ifdef USE_PLAYLIST_BACKGROUND
49// setStaticBackground( TRUE ); 49// setStaticBackground( TRUE );
50// setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); 50// setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) );
51 51
52// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); 52// setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) );
53// #endif 53// #endif
54// addColumn("Title",236); 54// addColumn("Title",236);
55// setAllColumnsShowFocus( TRUE ); 55// setAllColumnsShowFocus( TRUE );
56 addColumn( tr( "Playlist Selection" ) ); 56 addColumn( tr( "Playlist Selection" ) );
57 header()->hide(); 57 header()->hide();
58 setSorting( -1, FALSE ); 58 setSorting( -1, FALSE );
59} 59}
60 60
61 61
62PlayListSelection::~PlayListSelection() { 62PlayListSelection::~PlayListSelection() {
63} 63}
64 64
65 65
66// #ifdef USE_PLAYLIST_BACKGROUND 66// #ifdef USE_PLAYLIST_BACKGROUND
67void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { 67void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) {
68// qDebug("drawBackground"); 68// odebug << "drawBackground" << oendl;
69 p->fillRect( r, QBrush( white ) ); 69 p->fillRect( r, QBrush( white ) );
70// QImage logo = Resource::loadImage( "launcher/opielogo" ); 70// QImage logo = Resource::loadImage( "launcher/opielogo" );
71// if ( !logo.isNull() ) 71// if ( !logo.isNull() )
72// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); 72// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
73} 73}
74// #endif 74// #endif
75 75
76 76
77void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { 77void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
78 if ( event->state() == QMouseEvent::LeftButton ) { 78 if ( event->state() == QMouseEvent::LeftButton ) {
79 QListViewItem *currentItem = selectedItem(); 79 QListViewItem *currentItem = selectedItem();
80 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); 80 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
81 if ( currentItem && currentItem->itemAbove() == itemUnder ) 81 if ( currentItem && currentItem->itemAbove() == itemUnder )
82 moveSelectedUp(); 82 moveSelectedUp();
83 else if ( currentItem && currentItem->itemBelow() == itemUnder ) 83 else if ( currentItem && currentItem->itemBelow() == itemUnder )
84 moveSelectedDown(); 84 moveSelectedDown();
85 } 85 }
86} 86}
87 87
88 88
89const DocLnk *PlayListSelection::current() { 89const DocLnk *PlayListSelection::current() {
90 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); 90 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem();
91 if ( item ) 91 if ( item )
92 return item->file(); 92 return item->file();
@@ -163,44 +163,44 @@ bool PlayListSelection::first() {
163bool PlayListSelection::last() { 163bool PlayListSelection::last() {
164 QListViewItem *prevItem = NULL; 164 QListViewItem *prevItem = NULL;
165 QListViewItem *item = firstChild(); 165 QListViewItem *item = firstChild();
166 while ( ( item = item->nextSibling() ) ) 166 while ( ( item = item->nextSibling() ) )
167 prevItem = item; 167 prevItem = item;
168 if ( prevItem ) 168 if ( prevItem )
169 setSelected( prevItem, TRUE ); 169 setSelected( prevItem, TRUE );
170 else 170 else
171 return FALSE; 171 return FALSE;
172 ensureItemVisible( selectedItem() ); 172 ensureItemVisible( selectedItem() );
173 return TRUE; 173 return TRUE;
174} 174}
175 175
176void PlayListSelection::unSelect() 176void PlayListSelection::unSelect()
177{ 177{
178 //QListViewItem *item = selectedItem(); 178 //QListViewItem *item = selectedItem();
179 setSelected( currentItem(), FALSE); 179 setSelected( currentItem(), FALSE);
180} 180}
181 181
182void PlayListSelection::writeCurrent( Config& cfg ) { 182void PlayListSelection::writeCurrent( Config& cfg ) {
183 cfg.setGroup("PlayList"); 183 cfg.setGroup("PlayList");
184 QListViewItem *item = selectedItem(); 184 QListViewItem *item = selectedItem();
185 if ( item ) 185 if ( item )
186 cfg.writeEntry("current", item->text(0) ); 186 cfg.writeEntry("current", item->text(0) );
187 qDebug(item->text(0)); 187 odebug << item->text(0) << oendl;
188 188
189} 189}
190 190
191void PlayListSelection::setSelectedItem(const QString &strk ) { 191void PlayListSelection::setSelectedItem(const QString &strk ) {
192 192
193 unSelect(); 193 unSelect();
194 QListViewItemIterator it( this ); 194 QListViewItemIterator it( this );
195 for ( ; it.current(); ++it ) { 195 for ( ; it.current(); ++it ) {
196// qDebug( it.current()->text(0)); 196// odebug << it.current()->text(0) << oendl;
197 if( strk == it.current()->text(0)) { 197 if( strk == it.current()->text(0)) {
198// qDebug( "We have a match "+strk); 198// odebug << "We have a match "+strk << oendl;
199 setSelected( it.current(), TRUE); 199 setSelected( it.current(), TRUE);
200 ensureItemVisible( it.current() ); 200 ensureItemVisible( it.current() );
201 return; 201 return;
202 } 202 }
203 } 203 }
204// setSelected( item, TRUE ); 204// setSelected( item, TRUE );
205// ensureItemVisible( selectedItem() ); 205// ensureItemVisible( selectedItem() );
206} 206}