summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/playlistselection.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/playlistselection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp
index b5d8b78..991301a 100644
--- a/core/multimedia/opieplayer/playlistselection.cpp
+++ b/core/multimedia/opieplayer/playlistselection.cpp
@@ -10,115 +10,115 @@
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qpe/applnk.h> 20#include <qpe/applnk.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpainter.h> 22#include <qpainter.h>
23#include <qimage.h> 23#include <qimage.h>
24#include <qheader.h> 24#include <qheader.h>
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qlist.h> 26#include <qlist.h>
27#include <qpixmap.h> 27#include <qpixmap.h>
28 28
29#include "playlistselection.h" 29#include "playlistselection.h"
30 30
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33class PlayListSelectionItem : public QListViewItem { 33class PlayListSelectionItem : public QListViewItem {
34public: 34public:
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 };
42 42
43 const DocLnk *file() const { return fl; } 43 const DocLnk *file() const { return fl; }
44 44
45private: 45private:
46 const DocLnk *fl; 46 const DocLnk *fl;
47}; 47};
48 48
49 49
50PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) 50PlayListSelection::PlayListSelection( QWidget *parent, const char *name )
51 : QListView( parent, name ) 51 : QListView( parent, name )
52{ 52{
53 qDebug("starting playlistselector"); 53 qDebug("starting playlistselector");
54// #ifdef USE_PLAYLIST_BACKGROUND 54// #ifdef USE_PLAYLIST_BACKGROUND
55// setStaticBackground( TRUE ); 55// setStaticBackground( TRUE );
56// setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) ); 56// setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/background" ) );
57 57
58 setBackgroundPixmap( Resource::loadPixmap( "launcher/launcher/opielogo" ) ); 58 setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) );
59// #endif 59// #endif
60// addColumn("Title",236); 60// addColumn("Title",236);
61// setAllColumnsShowFocus( TRUE ); 61// setAllColumnsShowFocus( TRUE );
62 addColumn( tr( "Playlist Selection" ) ); 62 addColumn( tr( "Playlist Selection" ) );
63 header()->hide(); 63 header()->hide();
64 setSorting( -1, FALSE ); 64 setSorting( -1, FALSE );
65} 65}
66 66
67 67
68PlayListSelection::~PlayListSelection() { 68PlayListSelection::~PlayListSelection() {
69} 69}
70 70
71 71
72// #ifdef USE_PLAYLIST_BACKGROUND 72// #ifdef USE_PLAYLIST_BACKGROUND
73void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { 73void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) {
74// qDebug("drawBackground"); 74// qDebug("drawBackground");
75 p->fillRect( r, QBrush( white ) ); 75 p->fillRect( r, QBrush( white ) );
76 QImage logo = Resource::loadImage( "launcher/launcher/opielogo" ); 76 QImage logo = Resource::loadImage( "launcher/opielogo" );
77 if ( !logo.isNull() ) 77 if ( !logo.isNull() )
78 p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); 78 p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
79} 79}
80// #endif 80// #endif
81 81
82 82
83void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { 83void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
84 if ( event->state() == QMouseEvent::LeftButton ) { 84 if ( event->state() == QMouseEvent::LeftButton ) {
85 QListViewItem *currentItem = selectedItem(); 85 QListViewItem *currentItem = selectedItem();
86 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); 86 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
87 if ( currentItem && currentItem->itemAbove() == itemUnder ) 87 if ( currentItem && currentItem->itemAbove() == itemUnder )
88 moveSelectedUp(); 88 moveSelectedUp();
89 else if ( currentItem && currentItem->itemBelow() == itemUnder ) 89 else if ( currentItem && currentItem->itemBelow() == itemUnder )
90 moveSelectedDown(); 90 moveSelectedDown();
91 } 91 }
92} 92}
93 93
94 94
95const DocLnk *PlayListSelection::current() { 95const DocLnk *PlayListSelection::current() {
96 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); 96 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem();
97 if ( item ) 97 if ( item )
98 return item->file(); 98 return item->file();
99 return NULL; 99 return NULL;
100} 100}
101 101
102 102
103void PlayListSelection::addToSelection( const DocLnk &lnk ) { 103void PlayListSelection::addToSelection( const DocLnk &lnk ) {
104 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); 104 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) );
105 QListViewItem *current = selectedItem(); 105 QListViewItem *current = selectedItem();
106 if ( current ) 106 if ( current )
107 item->moveItem( current ); 107 item->moveItem( current );
108 setSelected( item, TRUE ); 108 setSelected( item, TRUE );
109 ensureItemVisible( selectedItem() ); 109 ensureItemVisible( selectedItem() );
110} 110}
111 111
112 112
113void PlayListSelection::removeSelected() { 113void PlayListSelection::removeSelected() {
114 QListViewItem *item = selectedItem(); 114 QListViewItem *item = selectedItem();
115 if ( item ) 115 if ( item )
116 delete item; 116 delete item;
117 setSelected( currentItem(), TRUE ); 117 setSelected( currentItem(), TRUE );
118 ensureItemVisible( selectedItem() ); 118 ensureItemVisible( selectedItem() );
119} 119}
120 120
121 121
122void PlayListSelection::moveSelectedUp() { 122void PlayListSelection::moveSelectedUp() {
123 QListViewItem *item = selectedItem(); 123 QListViewItem *item = selectedItem();
124 if ( item && item->itemAbove() ) 124 if ( item && item->itemAbove() )