summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/playlistwidget.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 6c4d07f..3bd04bc 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -10,29 +10,29 @@
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <qpe/qpetoolbar.h> 34#include <qpe/qpetoolbar.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#include <qpe/storage.h> 36#include <qpe/storage.h>
37#include <qpe/mimetype.h> 37#include <qpe/mimetype.h>
38#include <qpe/global.h> 38#include <qpe/global.h>
@@ -109,40 +109,41 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
109 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 109 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
110 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 110 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
111 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 111 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
112 this,SLOT( playIt( QListViewItem *) ) ); 112 this,SLOT( playIt( QListViewItem *) ) );
113 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 113 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
114 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 114 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
115 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), this, SLOT( tabChanged( QWidget* ) ) ); 115 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), this, SLOT( tabChanged( QWidget* ) ) );
116 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 116 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
117 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 117 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
118 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 118 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
119 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 119 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
120 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 120 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
121 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), mediaPlayerState, SLOT( setVideoGamma( int ) ) );
121 122
122 readConfig( cfg ); 123 readConfig( cfg );
123 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" ); 124 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" );
124 loadList(DocLnk( currentPlaylist ) ); 125 loadList(DocLnk( currentPlaylist ) );
125 setCaption( tr( "OpiePlayer: " ) + currentPlaylist ); 126 setCaption( tr( "OpiePlayer: " ) + currentPlaylist );
126 127
127 // see which skins are installed 128 // see which skins are installed
128 videoScan=FALSE; 129 videoScan=FALSE;
129 audioScan=FALSE; 130 audioScan=FALSE;
130 populateSkinsMenu(); 131 populateSkinsMenu();
131 initializeStates(); 132 initializeStates();
132} 133}
133 134
134 135
135PlayListWidget::~PlayListWidget() { 136PlayListWidget::~PlayListWidget() {
136 // WTF?!@?! 137 // WTF?!@?!
137 138
138 if ( d->current ) { 139 if ( d->current ) {
139 delete d->current; 140 delete d->current;
140 } 141 }
141 delete d; 142 delete d;
142} 143}
143 144
144 145
145void PlayListWidget::initializeStates() { 146void PlayListWidget::initializeStates() {
146 d->tbPlay->setOn( mediaPlayerState->playing() ); 147 d->tbPlay->setOn( mediaPlayerState->playing() );
147 d->tbLoop->setOn( mediaPlayerState->looping() ); 148 d->tbLoop->setOn( mediaPlayerState->looping() );
148 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 149 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
@@ -724,25 +725,25 @@ void PlayListWidget::populateAudioView() {
724 const QString name = (*it)->name(); 725 const QString name = (*it)->name();
725 const QString path = (*it)->path(); 726 const QString path = (*it)->path();
726 if(dit.current()->file().find(path) != -1 ) { 727 if(dit.current()->file().find(path) != -1 ) {
727 storage = name; 728 storage = name;
728 } 729 }
729 } 730 }
730 731
731 QListViewItem * newItem; 732 QListViewItem * newItem;
732 if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { 733 if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) {
733 long size; 734 long size;
734 if( dit.current()->file().left(4) == "http" ) 735 if( dit.current()->file().left(4) == "http" )
735 size=0; 736 size=0;
736 else 737 else
737 size = QFile( dit.current()->file() ).size(); 738 size = QFile( dit.current()->file() ).size();
738 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number(size ), storage); 739 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number(size ), storage);
739 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 740 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
740 } 741 }
741 } 742 }
742} 743}
743 744
744 745
745void PlayListWidget::populateVideoView() { 746void PlayListWidget::populateVideoView() {
746 videoView->clear(); 747 videoView->clear();
747 StorageInfo storageInfo; 748 StorageInfo storageInfo;
748 const QList<FileSystem> &fs = storageInfo.fileSystems(); 749 const QList<FileSystem> &fs = storageInfo.fileSystems();
@@ -925,25 +926,25 @@ void PlayListWidget::writem3u() {
925 QString filename, list; 926 QString filename, list;
926 if( fileDlg->result() == 1 ) { 927 if( fileDlg->result() == 1 ) {
927 filename = fileDlg->text(); 928 filename = fileDlg->text();
928 qDebug( filename ); 929 qDebug( filename );
929 int noOfFiles = 0; 930 int noOfFiles = 0;
930 d->selectedFiles->first(); 931 d->selectedFiles->first();
931 do { 932 do {
932 // we dont check for existance because of url's 933 // we dont check for existance because of url's
933 // qDebug(d->selectedFiles->current()->file()); 934 // qDebug(d->selectedFiles->current()->file());
934 935
935 // so maybe we should do some net checking to ,-) 936 // so maybe we should do some net checking to ,-)
936 // no, cause it takes to long... 937 // no, cause it takes to long...
937 938
938 list += d->selectedFiles->current()->file() + "\n"; 939 list += d->selectedFiles->current()->file() + "\n";
939 noOfFiles++; 940 noOfFiles++;
940 } 941 }
941 while ( d->selectedFiles->next() ); 942 while ( d->selectedFiles->next() );
942 qDebug( list ); 943 qDebug( list );
943 if( filename.left( 1) != "/" ) { 944 if( filename.left( 1) != "/" ) {
944 filename=QPEApplication::documentDir() + "/" + filename; 945 filename=QPEApplication::documentDir() + "/" + filename;
945 } 946 }
946 if( filename.right( 3 ) != "m3u" ) { 947 if( filename.right( 3 ) != "m3u" ) {
947 filename=filename+".m3u"; 948 filename=filename+".m3u";
948 } 949 }
949 QFile f( filename ); 950 QFile f( filename );