summaryrefslogtreecommitdiff
authorbipolar <bipolar>2002-03-08 05:26:53 (UTC)
committer bipolar <bipolar>2002-03-08 05:26:53 (UTC)
commitb0222c051d3666a4215c6b7271daec2ea6f783a0 (patch) (unidiff)
tree5f4a081e37d25e8d1dcefe68069a89f7d89de4e7
parent5bb6c01c2a9a40e5bff20a2725f6aacf85d16ef3 (diff)
downloadopie-b0222c051d3666a4215c6b7271daec2ea6f783a0.zip
opie-b0222c051d3666a4215c6b7271daec2ea6f783a0.tar.gz
opie-b0222c051d3666a4215c6b7271daec2ea6f783a0.tar.bz2
ljp: added something I should have not taken out in the first place
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp
index d6aff66..4019d12 100644
--- a/core/multimedia/opieplayer/playlistselection.cpp
+++ b/core/multimedia/opieplayer/playlistselection.cpp
@@ -1,184 +1,184 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
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( "opielogo" ) ); 58// setBackgroundPixmap( Resource::loadPixmap( "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( "mpegplayer/background" ); 76// QImage logo = Resource::loadImage( "mpegplayer/background" );
77// // QImage logo = Resource::loadImage( "opielogo" ); 77// // QImage logo = Resource::loadImage( "opielogo" );
78// if ( !logo.isNull() ) 78// if ( !logo.isNull() )
79// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); 79// p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo );
80} 80}
81// #endif 81// #endif
82 82
83 83
84void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { 84void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) {
85 if ( event->state() == QMouseEvent::LeftButton ) { 85 if ( event->state() == QMouseEvent::LeftButton ) {
86 QListViewItem *currentItem = selectedItem(); 86 QListViewItem *currentItem = selectedItem();
87 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); 87 QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) );
88 if ( currentItem && currentItem->itemAbove() == itemUnder ) 88 if ( currentItem && currentItem->itemAbove() == itemUnder )
89 moveSelectedUp(); 89 moveSelectedUp();
90 else if ( currentItem && currentItem->itemBelow() == itemUnder ) 90 else if ( currentItem && currentItem->itemBelow() == itemUnder )
91 moveSelectedDown(); 91 moveSelectedDown();
92 } 92 }
93} 93}
94 94
95 95
96const DocLnk *PlayListSelection::current() { 96const DocLnk *PlayListSelection::current() {
97 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); 97 PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem();
98 if ( item ) 98 if ( item )
99 return item->file(); 99 return item->file();
100 return NULL; 100 return NULL;
101} 101}
102 102
103 103
104void PlayListSelection::addToSelection( const DocLnk &lnk ) { 104void PlayListSelection::addToSelection( const DocLnk &lnk ) {
105 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); 105 PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) );
106 QListViewItem *current = selectedItem(); 106 QListViewItem *current = selectedItem();
107 if ( current ) 107 if ( current )
108 item->moveItem( current ); 108 item->moveItem( current );
109 setSelected( item, TRUE ); 109 setSelected( item, TRUE );
110 ensureItemVisible( selectedItem() ); 110 ensureItemVisible( selectedItem() );
111} 111}
112 112
113 113
114void PlayListSelection::removeSelected() { 114void PlayListSelection::removeSelected() {
115 QListViewItem *item = selectedItem(); 115 QListViewItem *item = selectedItem();
116 if ( item ) 116 if ( item )
117 delete item; 117 delete item;
118 setSelected( currentItem(), TRUE ); 118 setSelected( currentItem(), TRUE );
119 ensureItemVisible( selectedItem() ); 119 ensureItemVisible( selectedItem() );
120} 120}
121 121
122 122
123void PlayListSelection::moveSelectedUp() { 123void PlayListSelection::moveSelectedUp() {
124 QListViewItem *item = selectedItem(); 124 QListViewItem *item = selectedItem();
125 if ( item && item->itemAbove() ) 125 if ( item && item->itemAbove() )
126 item->itemAbove()->moveItem( item ); 126 item->itemAbove()->moveItem( item );
127 ensureItemVisible( selectedItem() ); 127 ensureItemVisible( selectedItem() );
128} 128}
129 129
130 130
131void PlayListSelection::moveSelectedDown() { 131void PlayListSelection::moveSelectedDown() {
132 QListViewItem *item = selectedItem(); 132 QListViewItem *item = selectedItem();
133 if ( item && item->itemBelow() ) 133 if ( item && item->itemBelow() )
134 item->moveItem( item->itemBelow() ); 134 item->moveItem( item->itemBelow() );
135 ensureItemVisible( selectedItem() ); 135 ensureItemVisible( selectedItem() );
136} 136}
137 137
138 138
139bool PlayListSelection::prev() { 139bool PlayListSelection::prev() {
140 QListViewItem *item = selectedItem(); 140 QListViewItem *item = selectedItem();
141 if ( item && item->itemAbove() ) 141 if ( item && item->itemAbove() )
142 setSelected( item->itemAbove(), TRUE ); 142 setSelected( item->itemAbove(), TRUE );
143 else 143 else
144 return FALSE; 144 return FALSE;
145 ensureItemVisible( selectedItem() ); 145 ensureItemVisible( selectedItem() );
146 return TRUE; 146 return TRUE;
147} 147}
148 148
149 149
150bool PlayListSelection::next() { 150bool PlayListSelection::next() {
151 QListViewItem *item = selectedItem(); 151 QListViewItem *item = selectedItem();
152 if ( item && item->itemBelow() ) 152 if ( item && item->itemBelow() )
153 setSelected( item->itemBelow(), TRUE ); 153 setSelected( item->itemBelow(), TRUE );
154 else 154 else
155 return FALSE; 155 return FALSE;
156 ensureItemVisible( selectedItem() ); 156 ensureItemVisible( selectedItem() );
157 return TRUE; 157 return TRUE;
158} 158}
159 159
160 160
161bool PlayListSelection::first() { 161bool PlayListSelection::first() {
162 QListViewItem *item = firstChild(); 162 QListViewItem *item = firstChild();
163 if ( item ) 163 if ( item )
164 setSelected( item, TRUE ); 164 setSelected( item, TRUE );
165 else 165 else
166 return FALSE; 166 return FALSE;
167 ensureItemVisible( selectedItem() ); 167 ensureItemVisible( selectedItem() );
168 return TRUE; 168 return TRUE;
169} 169}
170 170
171 171
172bool PlayListSelection::last() { 172bool PlayListSelection::last() {
173 QListViewItem *prevItem = NULL; 173 QListViewItem *prevItem = NULL;
174 QListViewItem *item = firstChild(); 174 QListViewItem *item = firstChild();
175 while ( ( item = item->nextSibling() ) ) 175 while ( ( item = item->nextSibling() ) )
176 prevItem = item; 176 prevItem = item;
177 if ( prevItem ) 177 if ( prevItem )
178 setSelected( prevItem, TRUE ); 178 setSelected( prevItem, TRUE );
179 else 179 else
180 return FALSE; 180 return FALSE;
181 ensureItemVisible( selectedItem() ); 181 ensureItemVisible( selectedItem() );
182 return TRUE; 182 return TRUE;
183} 183}
184 184