Diffstat (limited to 'core/multimedia/opieplayer/playlistselection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistselection.cpp | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index a82b594..2c62e86 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp | |||
@@ -32,10 +32,10 @@ | |||
32 | 32 | ||
33 | class PlayListSelectionItem : public QListViewItem { | 33 | class PlayListSelectionItem : public QListViewItem { |
34 | public: | 34 | public: |
35 | PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { | 35 | PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { |
36 | setText( 0, f->name() ); | 36 | setText( 0, f->name() ); |
37 | setPixmap( 0, f->pixmap() ); | 37 | setPixmap( 0, f->pixmap() ); |
38 | } | 38 | } |
39 | 39 | ||
40 | ~PlayListSelectionItem() { | 40 | ~PlayListSelectionItem() { |
41 | }; | 41 | }; |
@@ -49,12 +49,14 @@ private: | |||
49 | 49 | ||
50 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | 50 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) |
51 | : QListView( parent, name ) | 51 | : QListView( parent, name ) |
52 | { | 52 | { |
53 | #ifdef USE_PLAYLIST_BACKGROUND | 53 | // #ifdef USE_PLAYLIST_BACKGROUND |
54 | setStaticBackground( TRUE ); | 54 | setStaticBackground( TRUE ); |
55 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); | 55 | // setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); |
56 | #endif | 56 | setBackgroundPixmap( Resource::loadPixmap( "opielogo" ) ); |
57 | // #endif | ||
58 | addColumn("Title",236); | ||
57 | setAllColumnsShowFocus( TRUE ); | 59 | setAllColumnsShowFocus( TRUE ); |
58 | addColumn( tr( "Playlist Selection" ) ); | 60 | addColumn( tr( "Playlist Selection" ) ); |
59 | header()->hide(); | 61 | header()->hide(); |
60 | setSorting( -1, FALSE ); | 62 | setSorting( -1, FALSE ); |
@@ -64,34 +66,35 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | |||
64 | PlayListSelection::~PlayListSelection() { | 66 | PlayListSelection::~PlayListSelection() { |
65 | } | 67 | } |
66 | 68 | ||
67 | 69 | ||
68 | #ifdef USE_PLAYLIST_BACKGROUND | 70 | // #ifdef USE_PLAYLIST_BACKGROUND |
69 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { | 71 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { |
70 | p->fillRect( r, QBrush( white ) ); | 72 | p->fillRect( r, QBrush( white ) ); |
71 | QImage logo = Resource::loadImage( "mpegplayer/background" ); | 73 | // QImage logo = Resource::loadImage( "mpegplayer/background" ); |
74 | QImage logo = Resource::loadImage( "opielogo" ); | ||
72 | if ( !logo.isNull() ) | 75 | if ( !logo.isNull() ) |
73 | p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); | 76 | p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); |
74 | } | 77 | } |
75 | #endif | 78 | // #endif |
76 | 79 | ||
77 | 80 | ||
78 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { | 81 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { |
79 | if ( event->state() == QMouseEvent::LeftButton ) { | 82 | if ( event->state() == QMouseEvent::LeftButton ) { |
80 | QListViewItem *currentItem = selectedItem(); | 83 | QListViewItem *currentItem = selectedItem(); |
81 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); | 84 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); |
82 | if ( currentItem && currentItem->itemAbove() == itemUnder ) | 85 | if ( currentItem && currentItem->itemAbove() == itemUnder ) |
83 | moveSelectedUp(); | 86 | moveSelectedUp(); |
84 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) | 87 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) |
85 | moveSelectedDown(); | 88 | moveSelectedDown(); |
86 | } | 89 | } |
87 | } | 90 | } |
88 | 91 | ||
89 | 92 | ||
90 | const DocLnk *PlayListSelection::current() { | 93 | const DocLnk *PlayListSelection::current() { |
91 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); | 94 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); |
92 | if ( item ) | 95 | if ( item ) |
93 | return item->file(); | 96 | return item->file(); |
94 | return NULL; | 97 | return NULL; |
95 | } | 98 | } |
96 | 99 | ||
97 | 100 | ||
@@ -107,18 +110,18 @@ void PlayListSelection::addToSelection( const DocLnk &lnk ) { | |||
107 | 110 | ||
108 | void PlayListSelection::removeSelected() { | 111 | void PlayListSelection::removeSelected() { |
109 | QListViewItem *item = selectedItem(); | 112 | QListViewItem *item = selectedItem(); |
110 | if ( item ) | 113 | if ( item ) |
111 | delete item; | 114 | delete item; |
112 | setSelected( currentItem(), TRUE ); | 115 | setSelected( currentItem(), TRUE ); |
113 | ensureItemVisible( selectedItem() ); | 116 | ensureItemVisible( selectedItem() ); |
114 | } | 117 | } |
115 | 118 | ||
116 | 119 | ||
117 | void PlayListSelection::moveSelectedUp() { | 120 | void PlayListSelection::moveSelectedUp() { |
118 | QListViewItem *item = selectedItem(); | 121 | QListViewItem *item = selectedItem(); |
119 | if ( item && item->itemAbove() ) | 122 | if ( item && item->itemAbove() ) |
120 | item->itemAbove()->moveItem( item ); | 123 | item->itemAbove()->moveItem( item ); |
121 | ensureItemVisible( selectedItem() ); | 124 | ensureItemVisible( selectedItem() ); |
122 | } | 125 | } |
123 | 126 | ||
124 | 127 | ||
@@ -134,9 +137,9 @@ bool PlayListSelection::prev() { | |||
134 | QListViewItem *item = selectedItem(); | 137 | QListViewItem *item = selectedItem(); |
135 | if ( item && item->itemAbove() ) | 138 | if ( item && item->itemAbove() ) |
136 | setSelected( item->itemAbove(), TRUE ); | 139 | setSelected( item->itemAbove(), TRUE ); |
137 | else | 140 | else |
138 | return FALSE; | 141 | return FALSE; |
139 | ensureItemVisible( selectedItem() ); | 142 | ensureItemVisible( selectedItem() ); |
140 | return TRUE; | 143 | return TRUE; |
141 | } | 144 | } |
142 | 145 | ||
@@ -145,9 +148,9 @@ bool PlayListSelection::next() { | |||
145 | QListViewItem *item = selectedItem(); | 148 | QListViewItem *item = selectedItem(); |
146 | if ( item && item->itemBelow() ) | 149 | if ( item && item->itemBelow() ) |
147 | setSelected( item->itemBelow(), TRUE ); | 150 | setSelected( item->itemBelow(), TRUE ); |
148 | else | 151 | else |
149 | return FALSE; | 152 | return FALSE; |
150 | ensureItemVisible( selectedItem() ); | 153 | ensureItemVisible( selectedItem() ); |
151 | return TRUE; | 154 | return TRUE; |
152 | } | 155 | } |
153 | 156 | ||
@@ -156,9 +159,9 @@ bool PlayListSelection::first() { | |||
156 | QListViewItem *item = firstChild(); | 159 | QListViewItem *item = firstChild(); |
157 | if ( item ) | 160 | if ( item ) |
158 | setSelected( item, TRUE ); | 161 | setSelected( item, TRUE ); |
159 | else | 162 | else |
160 | return FALSE; | 163 | return FALSE; |
161 | ensureItemVisible( selectedItem() ); | 164 | ensureItemVisible( selectedItem() ); |
162 | return TRUE; | 165 | return TRUE; |
163 | } | 166 | } |
164 | 167 | ||
@@ -166,13 +169,13 @@ bool PlayListSelection::first() { | |||
166 | bool PlayListSelection::last() { | 169 | bool PlayListSelection::last() { |
167 | QListViewItem *prevItem = NULL; | 170 | QListViewItem *prevItem = NULL; |
168 | QListViewItem *item = firstChild(); | 171 | QListViewItem *item = firstChild(); |
169 | while ( ( item = item->nextSibling() ) ) | 172 | while ( ( item = item->nextSibling() ) ) |
170 | prevItem = item; | 173 | prevItem = item; |
171 | if ( prevItem ) | 174 | if ( prevItem ) |
172 | setSelected( prevItem, TRUE ); | 175 | setSelected( prevItem, TRUE ); |
173 | else | 176 | else |
174 | return FALSE; | 177 | return FALSE; |
175 | ensureItemVisible( selectedItem() ); | 178 | ensureItemVisible( selectedItem() ); |
176 | return TRUE; | 179 | return TRUE; |
177 | } | 180 | } |
178 | 181 | ||