author | zecke <zecke> | 2004-09-10 11:44:25 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-10 11:44:25 (UTC) |
commit | 5f85bf8c95f2c9f1ca6b784d3adbbcad396a16fa (patch) (unidiff) | |
tree | 61c6d5b6c595bb7d05330c9a367d8f7018e48a3c | |
parent | 6adde94c6ee292de5bc87a0c651fef69e8847d7e (diff) | |
download | opie-5f85bf8c95f2c9f1ca6b784d3adbbcad396a16fa.zip opie-5f85bf8c95f2c9f1ca6b784d3adbbcad396a16fa.tar.gz opie-5f85bf8c95f2c9f1ca6b784d3adbbcad396a16fa.tar.bz2 |
Unused parameter removed, cast uint -> int to avoid warning
-rw-r--r-- | core/multimedia/opieplayer/playlistselection.cpp | 3 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index 58c3966..430aa6b 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp | |||
@@ -1,213 +1,212 @@ | |||
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 | 20 | ||
21 | #include "playlistselection.h" | 21 | #include "playlistselection.h" |
22 | 22 | ||
23 | /* OPIE */ | 23 | /* OPIE */ |
24 | #include <opie2/odebug.h> | 24 | #include <opie2/odebug.h> |
25 | 25 | ||
26 | /* QT */ | 26 | /* QT */ |
27 | #include <qheader.h> | 27 | #include <qheader.h> |
28 | 28 | ||
29 | /* STD */ | 29 | /* STD */ |
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | 31 | ||
32 | class PlayListSelectionItem : public QListViewItem { | 32 | class PlayListSelectionItem : public QListViewItem { |
33 | public: | 33 | public: |
34 | PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { | 34 | PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { |
35 | setText( 0, f->name() ); | 35 | setText( 0, f->name() ); |
36 | setPixmap( 0, f->pixmap() ); | 36 | setPixmap( 0, f->pixmap() ); |
37 | } | 37 | } |
38 | 38 | ||
39 | ~PlayListSelectionItem() { | 39 | ~PlayListSelectionItem() { |
40 | }; | 40 | }; |
41 | 41 | ||
42 | const DocLnk *file() const { return fl; } | 42 | const DocLnk *file() const { return fl; } |
43 | 43 | ||
44 | private: | 44 | private: |
45 | const DocLnk *fl; | 45 | const DocLnk *fl; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | 48 | ||
49 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | 49 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) |
50 | : QListView( parent, name ) | 50 | : QListView( parent, name ) |
51 | { | 51 | { |
52 | // odebug << "starting playlistselector" << oendl; | 52 | // odebug << "starting playlistselector" << oendl; |
53 | // #ifdef USE_PLAYLIST_BACKGROUND | 53 | // #ifdef USE_PLAYLIST_BACKGROUND |
54 | // setStaticBackground( TRUE ); | 54 | // setStaticBackground( TRUE ); |
55 | // setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); | 55 | // setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); |
56 | 56 | ||
57 | // setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); | 57 | // setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); |
58 | // #endif | 58 | // #endif |
59 | // addColumn("Title",236); | 59 | // addColumn("Title",236); |
60 | // setAllColumnsShowFocus( TRUE ); | 60 | // setAllColumnsShowFocus( TRUE ); |
61 | addColumn( tr( "Playlist Selection" ) ); | 61 | addColumn( tr( "Playlist Selection" ) ); |
62 | header()->hide(); | 62 | header()->hide(); |
63 | // setSorting( -1, FALSE ); | 63 | // setSorting( -1, FALSE ); |
64 | // FIXME | 64 | // FIXME |
65 | } | 65 | } |
66 | 66 | ||
67 | 67 | ||
68 | PlayListSelection::~PlayListSelection() { | 68 | PlayListSelection::~PlayListSelection() { |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | // #ifdef USE_PLAYLIST_BACKGROUND | 72 | // #ifdef USE_PLAYLIST_BACKGROUND |
73 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { | 73 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { |
74 | // odebug << "drawBackground" << oendl; | 74 | // odebug << "drawBackground" << oendl; |
75 | p->fillRect( r, QBrush( white ) ); | 75 | p->fillRect( r, QBrush( white ) ); |
76 | // QImage logo = Resource::loadImage( "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 | ||
83 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { | 83 | void 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 | ||
95 | const DocLnk *PlayListSelection::current() { | 95 | const 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 | ||
103 | void PlayListSelection::addToSelection( const DocLnk &lnk ) { | 103 | void 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( item); | 109 | ensureItemVisible( item); |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | void PlayListSelection::removeSelected() { | 113 | void 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 | ||
122 | void PlayListSelection::moveSelectedUp() { | 122 | void PlayListSelection::moveSelectedUp() { |
123 | QListViewItem *item = selectedItem(); | 123 | QListViewItem *item = selectedItem(); |
124 | if ( item && item->itemAbove() ) | 124 | if ( item && item->itemAbove() ) |
125 | item->itemAbove()->moveItem( item ); | 125 | item->itemAbove()->moveItem( item ); |
126 | ensureItemVisible( selectedItem() ); | 126 | ensureItemVisible( selectedItem() ); |
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | void PlayListSelection::moveSelectedDown() { | 130 | void PlayListSelection::moveSelectedDown() { |
131 | QListViewItem *item = selectedItem(); | 131 | QListViewItem *item = selectedItem(); |
132 | if ( item && item->itemBelow() ) | 132 | if ( item && item->itemBelow() ) |
133 | item->moveItem( item->itemBelow() ); | 133 | item->moveItem( item->itemBelow() ); |
134 | ensureItemVisible( selectedItem() ); | 134 | ensureItemVisible( selectedItem() ); |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | bool PlayListSelection::prev() { | 138 | bool PlayListSelection::prev() { |
139 | QListViewItem *item = selectedItem(); | 139 | QListViewItem *item = selectedItem(); |
140 | if ( item && item->itemAbove() ) | 140 | if ( item && item->itemAbove() ) |
141 | setSelected( item->itemAbove(), TRUE ); | 141 | setSelected( item->itemAbove(), TRUE ); |
142 | else | 142 | else |
143 | return FALSE; | 143 | return FALSE; |
144 | ensureItemVisible( selectedItem() ); | 144 | ensureItemVisible( selectedItem() ); |
145 | return TRUE; | 145 | return TRUE; |
146 | } | 146 | } |
147 | 147 | ||
148 | bool PlayListSelection::next() { | 148 | bool PlayListSelection::next() { |
149 | QListViewItem *item = selectedItem(); | 149 | QListViewItem *item = selectedItem(); |
150 | if ( item && item->itemBelow() ) | 150 | if ( item && item->itemBelow() ) |
151 | setSelected( item->itemBelow(), TRUE ); | 151 | setSelected( item->itemBelow(), TRUE ); |
152 | else | 152 | else |
153 | return FALSE; | 153 | return FALSE; |
154 | ensureItemVisible( selectedItem() ); | 154 | ensureItemVisible( selectedItem() ); |
155 | return TRUE; | 155 | return TRUE; |
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
159 | bool PlayListSelection::first() { | 159 | bool PlayListSelection::first() { |
160 | QListViewItem *item = firstChild(); | 160 | QListViewItem *item = firstChild(); |
161 | if ( item ) | 161 | if ( item ) |
162 | setSelected( item, TRUE ); | 162 | setSelected( item, TRUE ); |
163 | else | 163 | else |
164 | return FALSE; | 164 | return FALSE; |
165 | ensureItemVisible( selectedItem() ); | 165 | ensureItemVisible( selectedItem() ); |
166 | return TRUE; | 166 | return TRUE; |
167 | } | 167 | } |
168 | 168 | ||
169 | 169 | ||
170 | bool PlayListSelection::last() { | 170 | bool PlayListSelection::last() { |
171 | QListViewItem *prevItem = NULL; | 171 | QListViewItem *prevItem = NULL; |
172 | QListViewItem *item = firstChild(); | 172 | QListViewItem *item = firstChild(); |
173 | while ( ( item = item->nextSibling() ) ) | 173 | while ( ( item = item->nextSibling() ) ) |
174 | prevItem = item; | 174 | prevItem = item; |
175 | if ( prevItem ) | 175 | if ( prevItem ) |
176 | setSelected( prevItem, TRUE ); | 176 | setSelected( prevItem, TRUE ); |
177 | else | 177 | else |
178 | return FALSE; | 178 | return FALSE; |
179 | ensureItemVisible( selectedItem() ); | 179 | ensureItemVisible( selectedItem() ); |
180 | return TRUE; | 180 | return TRUE; |
181 | } | 181 | } |
182 | 182 | ||
183 | void PlayListSelection::unSelect() | 183 | void PlayListSelection::unSelect() |
184 | { | 184 | { |
185 | QListViewItem *item = selectedItem(); | 185 | setSelected( currentItem() , FALSE); |
186 | setSelected( currentItem(), FALSE); | ||
187 | } | 186 | } |
188 | 187 | ||
189 | void PlayListSelection::writeCurrent( Config& cfg ) { | 188 | void PlayListSelection::writeCurrent( Config& cfg ) { |
190 | cfg.setGroup("PlayList"); | 189 | cfg.setGroup("PlayList"); |
191 | QListViewItem *item = selectedItem(); | 190 | QListViewItem *item = selectedItem(); |
192 | if ( item ) | 191 | if ( item ) |
193 | cfg.writeEntry("current", item->text(0) ); | 192 | cfg.writeEntry("current", item->text(0) ); |
194 | // odebug << item->text(0) << oendl; | 193 | // odebug << item->text(0) << oendl; |
195 | 194 | ||
196 | } | 195 | } |
197 | 196 | ||
198 | void PlayListSelection::setSelectedItem(const QString &strk ) { | 197 | void PlayListSelection::setSelectedItem(const QString &strk ) { |
199 | 198 | ||
200 | unSelect(); | 199 | unSelect(); |
201 | QListViewItemIterator it( this ); | 200 | QListViewItemIterator it( this ); |
202 | for ( ; it.current(); ++it ) { | 201 | for ( ; it.current(); ++it ) { |
203 | // odebug << it.current()->text(0) << oendl; | 202 | // odebug << it.current()->text(0) << oendl; |
204 | if( strk == it.current()->text(0)) { | 203 | if( strk == it.current()->text(0)) { |
205 | // odebug << "We have a match "+strk << oendl; | 204 | // odebug << "We have a match "+strk << oendl; |
206 | setSelected( it.current(), TRUE); | 205 | setSelected( it.current(), TRUE); |
207 | ensureItemVisible( it.current() ); | 206 | ensureItemVisible( it.current() ); |
208 | return; | 207 | return; |
209 | } | 208 | } |
210 | } | 209 | } |
211 | // setSelected( item, TRUE ); | 210 | // setSelected( item, TRUE ); |
212 | // ensureItemVisible( selectedItem() ); | 211 | // ensureItemVisible( selectedItem() ); |
213 | } | 212 | } |
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index d85ce50..46aeff2 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1216,244 +1216,244 @@ void PlayListWidget::writem3u() { | |||
1216 | fileDlg->exec(); | 1216 | fileDlg->exec(); |
1217 | QString name, filename, list; | 1217 | QString name, filename, list; |
1218 | Om3u *m3uList; | 1218 | Om3u *m3uList; |
1219 | 1219 | ||
1220 | if( fileDlg->result() == 1 ) { | 1220 | if( fileDlg->result() == 1 ) { |
1221 | name = fileDlg->text(); | 1221 | name = fileDlg->text(); |
1222 | // odebug << filename << oendl; | 1222 | // odebug << filename << oendl; |
1223 | if( name.find("/",0,true) != -1) {// assume they specify a file path | 1223 | if( name.find("/",0,true) != -1) {// assume they specify a file path |
1224 | filename = name; | 1224 | filename = name; |
1225 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); | 1225 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); |
1226 | } | 1226 | } |
1227 | else //otherwise dump it somewhere noticable | 1227 | else //otherwise dump it somewhere noticable |
1228 | filename = QPEApplication::documentDir() + "/" + name; | 1228 | filename = QPEApplication::documentDir() + "/" + name; |
1229 | 1229 | ||
1230 | if( filename.right( 3 ) != "m3u" ) //needs filename extension | 1230 | if( filename.right( 3 ) != "m3u" ) //needs filename extension |
1231 | filename += ".m3u"; | 1231 | filename += ".m3u"; |
1232 | 1232 | ||
1233 | if( d->selectedFiles->first()) { | 1233 | if( d->selectedFiles->first()) { |
1234 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); | 1234 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); |
1235 | 1235 | ||
1236 | do { | 1236 | do { |
1237 | m3uList->add( d->selectedFiles->current()->file()); | 1237 | m3uList->add( d->selectedFiles->current()->file()); |
1238 | } | 1238 | } |
1239 | while ( d->selectedFiles->next() ); | 1239 | while ( d->selectedFiles->next() ); |
1240 | // odebug << list << oendl; | 1240 | // odebug << list << oendl; |
1241 | m3uList->write(); | 1241 | m3uList->write(); |
1242 | m3uList->close(); | 1242 | m3uList->close(); |
1243 | if(m3uList) delete m3uList; | 1243 | if(m3uList) delete m3uList; |
1244 | 1244 | ||
1245 | if(fileDlg) delete fileDlg; | 1245 | if(fileDlg) delete fileDlg; |
1246 | 1246 | ||
1247 | DocLnk lnk; | 1247 | DocLnk lnk; |
1248 | lnk.setFile( filename); | 1248 | lnk.setFile( filename); |
1249 | lnk.setIcon("opieplayer2/playlist2"); | 1249 | lnk.setIcon("opieplayer2/playlist2"); |
1250 | lnk.setName( name); //sets file name | 1250 | lnk.setName( name); //sets file name |
1251 | 1251 | ||
1252 | // odebug << filename << oendl; | 1252 | // odebug << filename << oendl; |
1253 | Config config( "OpiePlayer" ); | 1253 | Config config( "OpiePlayer" ); |
1254 | config.setGroup( "PlayList" ); | 1254 | config.setGroup( "PlayList" ); |
1255 | 1255 | ||
1256 | config.writeEntry("CurrentPlaylist",filename); | 1256 | config.writeEntry("CurrentPlaylist",filename); |
1257 | currentPlayList=filename; | 1257 | currentPlayList=filename; |
1258 | 1258 | ||
1259 | if(!lnk.writeLink()) { | 1259 | if(!lnk.writeLink()) { |
1260 | // odebug << "Writing doclink did not work" << oendl; | 1260 | // odebug << "Writing doclink did not work" << oendl; |
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | setCaption(tr("OpiePlayer: ") + name); | 1263 | setCaption(tr("OpiePlayer: ") + name); |
1264 | } | 1264 | } |
1265 | } | 1265 | } |
1266 | } | 1266 | } |
1267 | 1267 | ||
1268 | 1268 | ||
1269 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | 1269 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) |
1270 | { | 1270 | { |
1271 | switch ( e->key() ) { | 1271 | switch ( e->key() ) { |
1272 | ////////////////////////////// Zaurus keys | 1272 | ////////////////////////////// Zaurus keys |
1273 | case Key_F9: //activity | 1273 | case Key_F9: //activity |
1274 | // if(audioUI->isHidden()) | 1274 | // if(audioUI->isHidden()) |
1275 | // audioUI->showMaximized(); | 1275 | // audioUI->showMaximized(); |
1276 | break; | 1276 | break; |
1277 | case Key_F10: //contacts | 1277 | case Key_F10: //contacts |
1278 | // if( videoUI->isHidden()) | 1278 | // if( videoUI->isHidden()) |
1279 | // videoUI->showMaximized(); | 1279 | // videoUI->showMaximized(); |
1280 | break; | 1280 | break; |
1281 | case Key_F11: //menu | 1281 | case Key_F11: //menu |
1282 | break; | 1282 | break; |
1283 | case Key_F12: //home | 1283 | case Key_F12: //home |
1284 | // doBlank(); | 1284 | // doBlank(); |
1285 | break; | 1285 | break; |
1286 | case Key_F13: //mail | 1286 | case Key_F13: //mail |
1287 | // doUnblank(); | 1287 | // doUnblank(); |
1288 | break; | 1288 | break; |
1289 | case Key_Q: //add to playlist | 1289 | case Key_Q: //add to playlist |
1290 | addSelected(); | 1290 | addSelected(); |
1291 | break; | 1291 | break; |
1292 | case Key_R: //remove from playlist | 1292 | case Key_R: //remove from playlist |
1293 | removeSelected(); | 1293 | removeSelected(); |
1294 | break; | 1294 | break; |
1295 | // case Key_P: //play | 1295 | // case Key_P: //play |
1296 | // odebug << "Play" << oendl; | 1296 | // odebug << "Play" << oendl; |
1297 | // playSelected(); | 1297 | // playSelected(); |
1298 | // break; | 1298 | // break; |
1299 | case Key_Space: | 1299 | case Key_Space: |
1300 | // playSelected(); puh | 1300 | // playSelected(); puh |
1301 | break; | 1301 | break; |
1302 | case Key_1: | 1302 | case Key_1: |
1303 | tabWidget->setCurrentPage(0); | 1303 | tabWidget->setCurrentPage(0); |
1304 | break; | 1304 | break; |
1305 | case Key_2: | 1305 | case Key_2: |
1306 | tabWidget->setCurrentPage(1); | 1306 | tabWidget->setCurrentPage(1); |
1307 | break; | 1307 | break; |
1308 | case Key_3: | 1308 | case Key_3: |
1309 | tabWidget->setCurrentPage(2); | 1309 | tabWidget->setCurrentPage(2); |
1310 | break; | 1310 | break; |
1311 | case Key_4: | 1311 | case Key_4: |
1312 | tabWidget->setCurrentPage(3); | 1312 | tabWidget->setCurrentPage(3); |
1313 | break; | 1313 | break; |
1314 | case Key_Down: | 1314 | case Key_Down: |
1315 | if ( !d->selectedFiles->next() ) | 1315 | if ( !d->selectedFiles->next() ) |
1316 | d->selectedFiles->first(); | 1316 | d->selectedFiles->first(); |
1317 | 1317 | ||
1318 | break; | 1318 | break; |
1319 | case Key_Up: | 1319 | case Key_Up: |
1320 | if ( !d->selectedFiles->prev() ) | 1320 | if ( !d->selectedFiles->prev() ) |
1321 | // d->selectedFiles->last(); | 1321 | // d->selectedFiles->last(); |
1322 | 1322 | ||
1323 | break; | 1323 | break; |
1324 | 1324 | ||
1325 | } | 1325 | } |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | void PlayListWidget::keyPressEvent( QKeyEvent *) | 1328 | void PlayListWidget::keyPressEvent( QKeyEvent *) |
1329 | { | 1329 | { |
1330 | // odebug << "Key press" << oendl; | 1330 | // odebug << "Key press" << oendl; |
1331 | // switch ( e->key() ) { | 1331 | // switch ( e->key() ) { |
1332 | // ////////////////////////////// Zaurus keys | 1332 | // ////////////////////////////// Zaurus keys |
1333 | // case Key_A: //add to playlist | 1333 | // case Key_A: //add to playlist |
1334 | // odebug << "Add" << oendl; | 1334 | // odebug << "Add" << oendl; |
1335 | // addSelected(); | 1335 | // addSelected(); |
1336 | // break; | 1336 | // break; |
1337 | // case Key_R: //remove from playlist | 1337 | // case Key_R: //remove from playlist |
1338 | // removeSelected(); | 1338 | // removeSelected(); |
1339 | // break; | 1339 | // break; |
1340 | // case Key_P: //play | 1340 | // case Key_P: //play |
1341 | // odebug << "Play" << oendl; | 1341 | // odebug << "Play" << oendl; |
1342 | // playSelected(); | 1342 | // playSelected(); |
1343 | // break; | 1343 | // break; |
1344 | // case Key_Space: | 1344 | // case Key_Space: |
1345 | // odebug << "Play" << oendl; | 1345 | // odebug << "Play" << oendl; |
1346 | // playSelected(); | 1346 | // playSelected(); |
1347 | // break; | 1347 | // break; |
1348 | // } | 1348 | // } |
1349 | } | 1349 | } |
1350 | 1350 | ||
1351 | void PlayListWidget::doBlank() { | 1351 | void PlayListWidget::doBlank() { |
1352 | // odebug << "do blanking" << oendl; | 1352 | // odebug << "do blanking" << oendl; |
1353 | #ifdef QT_QWS_DEVFS | 1353 | #ifdef QT_QWS_DEVFS |
1354 | fd=open("/dev/fb/0",O_RDWR); | 1354 | fd=open("/dev/fb/0",O_RDWR); |
1355 | #else | 1355 | #else |
1356 | fd=open("/dev/fb0",O_RDWR); | 1356 | fd=open("/dev/fb0",O_RDWR); |
1357 | #endif | 1357 | #endif |
1358 | if (fd != -1) { | 1358 | if (fd != -1) { |
1359 | ioctl(fd,FBIOBLANK,1); | 1359 | ioctl(fd,FBIOBLANK,1); |
1360 | // close(fd); | 1360 | // close(fd); |
1361 | } | 1361 | } |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | void PlayListWidget::doUnblank() { | 1364 | void PlayListWidget::doUnblank() { |
1365 | // this crashes opieplayer with a segfault | 1365 | // this crashes opieplayer with a segfault |
1366 | // int fd; | 1366 | // int fd; |
1367 | // fd=open("/dev/fb0",O_RDWR); | 1367 | // fd=open("/dev/fb0",O_RDWR); |
1368 | // odebug << "do unblanking" << oendl; | 1368 | // odebug << "do unblanking" << oendl; |
1369 | if (fd != -1) { | 1369 | if (fd != -1) { |
1370 | ioctl(fd,FBIOBLANK,0); | 1370 | ioctl(fd,FBIOBLANK,0); |
1371 | close(fd); | 1371 | close(fd); |
1372 | } | 1372 | } |
1373 | QCopEnvelope h("QPE/System", "setBacklight(int)"); | 1373 | QCopEnvelope h("QPE/System", "setBacklight(int)"); |
1374 | h <<-3;// v[1]; // -3 Force on | 1374 | h <<-3;// v[1]; // -3 Force on |
1375 | } | 1375 | } |
1376 | 1376 | ||
1377 | void PlayListWidget::populateSkinsMenu() { | 1377 | void PlayListWidget::populateSkinsMenu() { |
1378 | int item = 0; | 1378 | int item = 0; |
1379 | defaultSkinIndex = 0; | 1379 | defaultSkinIndex = 0; |
1380 | QString skinName; | 1380 | QString skinName; |
1381 | Config cfg( "OpiePlayer" ); | 1381 | Config cfg( "OpiePlayer" ); |
1382 | cfg.setGroup("Options" ); | 1382 | cfg.setGroup("Options" ); |
1383 | QString skin = cfg.readEntry( "Skin", "default" ); | 1383 | QString skin = cfg.readEntry( "Skin", "default" ); |
1384 | 1384 | ||
1385 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); | 1385 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); |
1386 | skinsDir.setFilter( QDir::Dirs ); | 1386 | skinsDir.setFilter( QDir::Dirs ); |
1387 | skinsDir.setSorting(QDir::Name ); | 1387 | skinsDir.setSorting(QDir::Name ); |
1388 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 1388 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
1389 | QFileInfoListIterator it( *skinslist ); | 1389 | QFileInfoListIterator it( *skinslist ); |
1390 | QFileInfo *fi; | 1390 | QFileInfo *fi; |
1391 | while ( ( fi = it.current() ) ) { | 1391 | while ( ( fi = it.current() ) ) { |
1392 | skinName = fi->fileName(); | 1392 | skinName = fi->fileName(); |
1393 | // odebug << fi->fileName() << oendl; | 1393 | // odebug << fi->fileName() << oendl; |
1394 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 1394 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
1395 | item = skinsMenu->insertItem( fi->fileName() ) ; | 1395 | item = skinsMenu->insertItem( fi->fileName() ) ; |
1396 | } | 1396 | } |
1397 | if( skinName == "default" ) { | 1397 | if( skinName == "default" ) { |
1398 | defaultSkinIndex = item; | 1398 | defaultSkinIndex = item; |
1399 | } | 1399 | } |
1400 | if( skinName == skin ) { | 1400 | if( skinName == skin ) { |
1401 | skinsMenu->setItemChecked( item, TRUE ); | 1401 | skinsMenu->setItemChecked( item, TRUE ); |
1402 | } | 1402 | } |
1403 | ++it; | 1403 | ++it; |
1404 | } | 1404 | } |
1405 | } | 1405 | } |
1406 | 1406 | ||
1407 | void PlayListWidget::skinsMenuActivated( int item ) { | 1407 | void PlayListWidget::skinsMenuActivated( int item ) { |
1408 | for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1408 | for( int i = defaultSkinIndex; i > defaultSkinIndex - static_cast<int>(skinsMenu->count()); i-- ) { |
1409 | skinsMenu->setItemChecked( i, FALSE ); | 1409 | skinsMenu->setItemChecked( i, FALSE ); |
1410 | } | 1410 | } |
1411 | skinsMenu->setItemChecked( item, TRUE ); | 1411 | skinsMenu->setItemChecked( item, TRUE ); |
1412 | 1412 | ||
1413 | Config cfg( "OpiePlayer" ); | 1413 | Config cfg( "OpiePlayer" ); |
1414 | cfg.setGroup("Options"); | 1414 | cfg.setGroup("Options"); |
1415 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1415 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1416 | } | 1416 | } |
1417 | 1417 | ||
1418 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { | 1418 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { |
1419 | // odebug << "qcop message "+msg << oendl; | 1419 | // odebug << "qcop message "+msg << oendl; |
1420 | QDataStream stream ( data, IO_ReadOnly ); | 1420 | QDataStream stream ( data, IO_ReadOnly ); |
1421 | if ( msg == "play()" ) { //plays current selection | 1421 | if ( msg == "play()" ) { //plays current selection |
1422 | btnPlay( true); | 1422 | btnPlay( true); |
1423 | } else if ( msg == "stop()" ) { | 1423 | } else if ( msg == "stop()" ) { |
1424 | mediaPlayerState->setPlaying( false); | 1424 | mediaPlayerState->setPlaying( false); |
1425 | } else if ( msg == "togglePause()" ) { | 1425 | } else if ( msg == "togglePause()" ) { |
1426 | mediaPlayerState->togglePaused(); | 1426 | mediaPlayerState->togglePaused(); |
1427 | } else if ( msg == "next()" ) { //select next in lis | 1427 | } else if ( msg == "next()" ) { //select next in lis |
1428 | mediaPlayerState->setNext(); | 1428 | mediaPlayerState->setNext(); |
1429 | } else if ( msg == "prev()" ) { //select previous in list | 1429 | } else if ( msg == "prev()" ) { //select previous in list |
1430 | mediaPlayerState->setPrev(); | 1430 | mediaPlayerState->setPrev(); |
1431 | } else if ( msg == "toggleLooping()" ) { //loop or not loop | 1431 | } else if ( msg == "toggleLooping()" ) { //loop or not loop |
1432 | mediaPlayerState->toggleLooping(); | 1432 | mediaPlayerState->toggleLooping(); |
1433 | } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled | 1433 | } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled |
1434 | mediaPlayerState->toggleShuffled(); | 1434 | mediaPlayerState->toggleShuffled(); |
1435 | } else if ( msg == "volUp()" ) { //volume more | 1435 | } else if ( msg == "volUp()" ) { //volume more |
1436 | // emit moreClicked(); | 1436 | // emit moreClicked(); |
1437 | // emit moreReleased(); | 1437 | // emit moreReleased(); |
1438 | } else if ( msg == "volDown()" ) { //volume less | 1438 | } else if ( msg == "volDown()" ) { //volume less |
1439 | // emit lessClicked(); | 1439 | // emit lessClicked(); |
1440 | // emit lessReleased(); | 1440 | // emit lessReleased(); |
1441 | } else if ( msg == "play(QString)" ) { //play this now | 1441 | } else if ( msg == "play(QString)" ) { //play this now |
1442 | QString file; | 1442 | QString file; |
1443 | stream >> file; | 1443 | stream >> file; |
1444 | setDocumentEx( (const QString &) file); | 1444 | setDocumentEx( (const QString &) file); |
1445 | } else if ( msg == "add(QString)" ) { //add to playlist | 1445 | } else if ( msg == "add(QString)" ) { //add to playlist |
1446 | QString file; | 1446 | QString file; |
1447 | stream >> file; | 1447 | stream >> file; |
1448 | QFileInfo fileInfo(file); | 1448 | QFileInfo fileInfo(file); |
1449 | DocLnk lnk; | 1449 | DocLnk lnk; |
1450 | lnk.setName( fileInfo.baseName() ); //sets name | 1450 | lnk.setName( fileInfo.baseName() ); //sets name |
1451 | lnk.setFile( file ); //sets file name | 1451 | lnk.setFile( file ); //sets file name |
1452 | addToSelection( lnk ); | 1452 | addToSelection( lnk ); |
1453 | } else if ( msg == "rem(QString)" ) { //remove from playlist | 1453 | } else if ( msg == "rem(QString)" ) { //remove from playlist |
1454 | QString file; | 1454 | QString file; |
1455 | stream >> file; | 1455 | stream >> file; |
1456 | } else if ( msg == "setDocument(QString)" ) { //loop or not loop | 1456 | } else if ( msg == "setDocument(QString)" ) { //loop or not loop |
1457 | QCopEnvelope h("QPE/Application/opieplayer", "raise()"); | 1457 | QCopEnvelope h("QPE/Application/opieplayer", "raise()"); |
1458 | } | 1458 | } |
1459 | } | 1459 | } |