-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 | |||
@@ -1024,436 +1024,436 @@ void PlayListWidget::populateVideoView() { | |||
1024 | const QString path = (*it)->path(); | 1024 | const QString path = (*it)->path(); |
1025 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 1025 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | QListViewItem * newItem; | 1028 | QListViewItem * newItem; |
1029 | if ( QFile( Vdit.current()->file()).exists() ) { | 1029 | if ( QFile( Vdit.current()->file()).exists() ) { |
1030 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 1030 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
1031 | QString::number( QFile( Vdit.current()->file() ).size() ), | 1031 | QString::number( QFile( Vdit.current()->file() ).size() ), |
1032 | storage, Vdit.current()->file()); | 1032 | storage, Vdit.current()->file()); |
1033 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); | 1033 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); |
1034 | } | 1034 | } |
1035 | } | 1035 | } |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | void PlayListWidget::openFile() { | 1038 | void PlayListWidget::openFile() { |
1039 | QString filename, name; | 1039 | QString filename, name; |
1040 | InputDialog *fileDlg; | 1040 | InputDialog *fileDlg; |
1041 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1041 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1042 | fileDlg->exec(); | 1042 | fileDlg->exec(); |
1043 | if( fileDlg->result() == 1 ) { | 1043 | if( fileDlg->result() == 1 ) { |
1044 | filename = fileDlg->text(); | 1044 | filename = fileDlg->text(); |
1045 | // odebug << "Selected filename is " + filename << oendl; | 1045 | // odebug << "Selected filename is " + filename << oendl; |
1046 | DocLnk lnk; | 1046 | DocLnk lnk; |
1047 | Config cfg( "OpiePlayer" ); | 1047 | Config cfg( "OpiePlayer" ); |
1048 | cfg.setGroup("PlayList"); | 1048 | cfg.setGroup("PlayList"); |
1049 | 1049 | ||
1050 | QString m3uFile; | 1050 | QString m3uFile; |
1051 | m3uFile = filename; | 1051 | m3uFile = filename; |
1052 | if(filename.left(4) == "http") { | 1052 | if(filename.left(4) == "http") { |
1053 | if(filename.find(":",8,TRUE) != -1) { //found a port | 1053 | if(filename.find(":",8,TRUE) != -1) { //found a port |
1054 | 1054 | ||
1055 | m3uFile = filename; | 1055 | m3uFile = filename; |
1056 | if( m3uFile.right( 1 ).find( '/' ) == -1) { | 1056 | if( m3uFile.right( 1 ).find( '/' ) == -1) { |
1057 | m3uFile += "/"; | 1057 | m3uFile += "/"; |
1058 | } | 1058 | } |
1059 | filename = m3uFile; | 1059 | filename = m3uFile; |
1060 | } | 1060 | } |
1061 | lnk.setName( m3uFile ); //sets name | 1061 | lnk.setName( m3uFile ); //sets name |
1062 | lnk.setFile( filename ); //sets file name | 1062 | lnk.setFile( filename ); //sets file name |
1063 | lnk.setIcon("opieplayer2/musicfile"); | 1063 | lnk.setIcon("opieplayer2/musicfile"); |
1064 | d->selectedFiles->addToSelection( lnk ); | 1064 | d->selectedFiles->addToSelection( lnk ); |
1065 | writeCurrentM3u(); | 1065 | writeCurrentM3u(); |
1066 | } | 1066 | } |
1067 | else if( filename.right( 3) == "m3u" ) { | 1067 | else if( filename.right( 3) == "m3u" ) { |
1068 | readm3u( filename ); | 1068 | readm3u( filename ); |
1069 | 1069 | ||
1070 | } else if( filename.right(3) == "pls" ) { | 1070 | } else if( filename.right(3) == "pls" ) { |
1071 | readPls( filename ); | 1071 | readPls( filename ); |
1072 | } else { | 1072 | } else { |
1073 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name | 1073 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name |
1074 | lnk.setFile( filename ); //sets file name | 1074 | lnk.setFile( filename ); //sets file name |
1075 | d->selectedFiles->addToSelection( lnk); | 1075 | d->selectedFiles->addToSelection( lnk); |
1076 | lnk.removeLinkFile(); | 1076 | lnk.removeLinkFile(); |
1077 | writeCurrentM3u(); | 1077 | writeCurrentM3u(); |
1078 | } | 1078 | } |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | if( fileDlg ) { | 1081 | if( fileDlg ) { |
1082 | delete fileDlg; | 1082 | delete fileDlg; |
1083 | } | 1083 | } |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | 1086 | ||
1087 | /* | 1087 | /* |
1088 | reads m3u and shows files/urls to playlist widget */ | 1088 | reads m3u and shows files/urls to playlist widget */ |
1089 | void PlayListWidget::readm3u( const QString &filename ) { | 1089 | void PlayListWidget::readm3u( const QString &filename ) { |
1090 | // odebug << "read m3u filename " + filename << oendl; | 1090 | // odebug << "read m3u filename " + filename << oendl; |
1091 | 1091 | ||
1092 | Om3u *m3uList; | 1092 | Om3u *m3uList; |
1093 | QString s, name; | 1093 | QString s, name; |
1094 | m3uList = new Om3u( filename, IO_ReadOnly ); | 1094 | m3uList = new Om3u( filename, IO_ReadOnly ); |
1095 | m3uList->readM3u(); | 1095 | m3uList->readM3u(); |
1096 | DocLnk lnk; | 1096 | DocLnk lnk; |
1097 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 1097 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
1098 | s = *it; | 1098 | s = *it; |
1099 | // odebug << "reading "+ s << oendl; | 1099 | // odebug << "reading "+ s << oendl; |
1100 | if(s.left(4)=="http") { | 1100 | if(s.left(4)=="http") { |
1101 | lnk.setName( s ); //sets file name | 1101 | lnk.setName( s ); //sets file name |
1102 | lnk.setIcon("opieplayer2/musicfile"); | 1102 | lnk.setIcon("opieplayer2/musicfile"); |
1103 | 1103 | ||
1104 | // if(s.right(4) != '.' || s.right(5) != '.') | 1104 | // if(s.right(4) != '.' || s.right(5) != '.') |
1105 | if(s.right(4) != '.' || s.right(5) != '.' ) | 1105 | if(s.right(4) != '.' || s.right(5) != '.' ) |
1106 | if( s.right(1) != "/") | 1106 | if( s.right(1) != "/") |
1107 | lnk.setFile( s+"/"); //if url with no extension | 1107 | lnk.setFile( s+"/"); //if url with no extension |
1108 | else | 1108 | else |
1109 | lnk.setFile( s ); //sets file name | 1109 | lnk.setFile( s ); //sets file name |
1110 | 1110 | ||
1111 | } else { | 1111 | } else { |
1112 | // if( QFileInfo( s ).exists() ) { | 1112 | // if( QFileInfo( s ).exists() ) { |
1113 | lnk.setName( fullBaseName ( QFileInfo(s))); | 1113 | lnk.setName( fullBaseName ( QFileInfo(s))); |
1114 | // if(s.right(4) == '.') {//if regular file | 1114 | // if(s.right(4) == '.') {//if regular file |
1115 | if(s.left(1) != "/") { | 1115 | if(s.left(1) != "/") { |
1116 | // odebug << "set link "+QFileInfo(filename).dirPath()+"/"+s << oendl; | 1116 | // odebug << "set link "+QFileInfo(filename).dirPath()+"/"+s << oendl; |
1117 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 1117 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
1118 | lnk.setIcon("SoundPlayer"); | 1118 | lnk.setIcon("SoundPlayer"); |
1119 | } else { | 1119 | } else { |
1120 | // odebug << "set link2 "+s << oendl; | 1120 | // odebug << "set link2 "+s << oendl; |
1121 | lnk.setFile( s); | 1121 | lnk.setFile( s); |
1122 | lnk.setIcon("SoundPlayer"); | 1122 | lnk.setIcon("SoundPlayer"); |
1123 | } | 1123 | } |
1124 | } | 1124 | } |
1125 | d->selectedFiles->addToSelection( lnk ); | 1125 | d->selectedFiles->addToSelection( lnk ); |
1126 | } | 1126 | } |
1127 | Config config( "OpiePlayer" ); | 1127 | Config config( "OpiePlayer" ); |
1128 | config.setGroup( "PlayList" ); | 1128 | config.setGroup( "PlayList" ); |
1129 | 1129 | ||
1130 | config.writeEntry("CurrentPlaylist",filename); | 1130 | config.writeEntry("CurrentPlaylist",filename); |
1131 | config.write(); | 1131 | config.write(); |
1132 | currentPlayList=filename; | 1132 | currentPlayList=filename; |
1133 | 1133 | ||
1134 | // m3uList->write(); | 1134 | // m3uList->write(); |
1135 | m3uList->close(); | 1135 | m3uList->close(); |
1136 | if(m3uList) delete m3uList; | 1136 | if(m3uList) delete m3uList; |
1137 | 1137 | ||
1138 | d->selectedFiles->setSelectedItem( s); | 1138 | d->selectedFiles->setSelectedItem( s); |
1139 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename))); | 1139 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename))); |
1140 | 1140 | ||
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | /* | 1143 | /* |
1144 | reads pls and adds files/urls to playlist */ | 1144 | reads pls and adds files/urls to playlist */ |
1145 | void PlayListWidget::readPls( const QString &filename ) { | 1145 | void PlayListWidget::readPls( const QString &filename ) { |
1146 | 1146 | ||
1147 | // odebug << "pls filename is " + filename << oendl; | 1147 | // odebug << "pls filename is " + filename << oendl; |
1148 | Om3u *m3uList; | 1148 | Om3u *m3uList; |
1149 | QString s, name; | 1149 | QString s, name; |
1150 | m3uList = new Om3u( filename, IO_ReadOnly ); | 1150 | m3uList = new Om3u( filename, IO_ReadOnly ); |
1151 | m3uList->readPls(); | 1151 | m3uList->readPls(); |
1152 | 1152 | ||
1153 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 1153 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
1154 | s = *it; | 1154 | s = *it; |
1155 | // s.replace( QRegExp( "%20" )," " ); | 1155 | // s.replace( QRegExp( "%20" )," " ); |
1156 | DocLnk lnk( s ); | 1156 | DocLnk lnk( s ); |
1157 | QFileInfo f( s ); | 1157 | QFileInfo f( s ); |
1158 | QString name = fullBaseName ( f); | 1158 | QString name = fullBaseName ( f); |
1159 | 1159 | ||
1160 | if( name.left( 4 ) == "http" ) { | 1160 | if( name.left( 4 ) == "http" ) { |
1161 | name = s.right( s.length() - 7); | 1161 | name = s.right( s.length() - 7); |
1162 | } else { | 1162 | } else { |
1163 | name = s; | 1163 | name = s; |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | 1166 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); |
1167 | 1167 | ||
1168 | lnk.setName( name ); | 1168 | lnk.setName( name ); |
1169 | if( s.at( s.length() - 4) == '.') {// if this is probably a file | 1169 | if( s.at( s.length() - 4) == '.') {// if this is probably a file |
1170 | lnk.setFile( s ); | 1170 | lnk.setFile( s ); |
1171 | } else { //if its a url | 1171 | } else { //if its a url |
1172 | if( name.right( 1 ).find( '/' ) == -1) { | 1172 | if( name.right( 1 ).find( '/' ) == -1) { |
1173 | s += "/"; | 1173 | s += "/"; |
1174 | } | 1174 | } |
1175 | lnk.setFile( s ); | 1175 | lnk.setFile( s ); |
1176 | } | 1176 | } |
1177 | lnk.setType( "audio/x-mpegurl" ); | 1177 | lnk.setType( "audio/x-mpegurl" ); |
1178 | 1178 | ||
1179 | lnk.writeLink(); | 1179 | lnk.writeLink(); |
1180 | d->selectedFiles->addToSelection( lnk ); | 1180 | d->selectedFiles->addToSelection( lnk ); |
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | m3uList->close(); | 1183 | m3uList->close(); |
1184 | if(m3uList) delete m3uList; | 1184 | if(m3uList) delete m3uList; |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | /* | 1187 | /* |
1188 | writes current playlist to current m3u file */ | 1188 | writes current playlist to current m3u file */ |
1189 | void PlayListWidget::writeCurrentM3u() { | 1189 | void PlayListWidget::writeCurrentM3u() { |
1190 | // odebug << "writing to current m3u" << oendl; | 1190 | // odebug << "writing to current m3u" << oendl; |
1191 | Config cfg( "OpiePlayer" ); | 1191 | Config cfg( "OpiePlayer" ); |
1192 | cfg.setGroup("PlayList"); | 1192 | cfg.setGroup("PlayList"); |
1193 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); | 1193 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); |
1194 | Om3u *m3uList; | 1194 | Om3u *m3uList; |
1195 | m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate ); | 1195 | m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate ); |
1196 | 1196 | ||
1197 | if( d->selectedFiles->first()) { | 1197 | if( d->selectedFiles->first()) { |
1198 | do { | 1198 | do { |
1199 | // odebug << "writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; | 1199 | // odebug << "writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; |
1200 | m3uList->add( d->selectedFiles->current()->file() ); | 1200 | m3uList->add( d->selectedFiles->current()->file() ); |
1201 | } | 1201 | } |
1202 | while ( d->selectedFiles->next() ); | 1202 | while ( d->selectedFiles->next() ); |
1203 | // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; | 1203 | // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; |
1204 | m3uList->write(); | 1204 | m3uList->write(); |
1205 | m3uList->close(); | 1205 | m3uList->close(); |
1206 | 1206 | ||
1207 | if(m3uList) delete m3uList; | 1207 | if(m3uList) delete m3uList; |
1208 | } | 1208 | } |
1209 | } | 1209 | } |
1210 | 1210 | ||
1211 | /* | 1211 | /* |
1212 | writes current playlist to m3u file */ | 1212 | writes current playlist to m3u file */ |
1213 | void PlayListWidget::writem3u() { | 1213 | void PlayListWidget::writem3u() { |
1214 | InputDialog *fileDlg; | 1214 | InputDialog *fileDlg; |
1215 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 1215 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
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 | } |