author | kergoth <kergoth> | 2003-08-09 16:24:58 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-08-09 16:24:58 (UTC) |
commit | e16d333ec2e8509fc665921ca106c25325bae9e0 (patch) (unidiff) | |
tree | 9e9068190a15bc9b2a52ab33b40881128f732c0e /noncore/multimedia/opieplayer2/playlistwidget.cpp | |
parent | 1c58d1407f9584fedcdae390a04e2b37e5853361 (diff) | |
download | opie-e16d333ec2e8509fc665921ca106c25325bae9e0.zip opie-e16d333ec2e8509fc665921ca106c25325bae9e0.tar.gz opie-e16d333ec2e8509fc665921ca106c25325bae9e0.tar.bz2 |
Merge from BRANCH_1_0
Diffstat (limited to 'noncore/multimedia/opieplayer2/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 5f750ba..a1a1016 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -28,37 +28,26 @@ | |||
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 <qtoolbar.h> |
35 | #include <qpe/qpeapplication.h> | ||
36 | #include <qpe/storage.h> | ||
37 | #include <qpe/mimetype.h> | ||
38 | #include <qpe/global.h> | ||
39 | #include <qpe/resource.h> | ||
40 | #include <qpe/config.h> | ||
41 | 35 | ||
42 | #include <opie/ofiledialog.h> | 36 | #include <opie/ofiledialog.h> |
43 | 37 | ||
44 | #include <qdatetime.h> | ||
45 | #include <qdir.h> | ||
46 | #include <qmessagebox.h> | 38 | #include <qmessagebox.h> |
47 | #include <qregexp.h> | ||
48 | #include <qtextstream.h> | ||
49 | 39 | ||
50 | #include "playlistselection.h" | 40 | #include "playlistselection.h" |
51 | #include "playlistwidget.h" | 41 | #include "playlistwidget.h" |
52 | #include "mediaplayerstate.h" | 42 | #include "mediaplayerstate.h" |
53 | #include "inputDialog.h" | 43 | #include "inputDialog.h" |
54 | #include "om3u.h" | 44 | #include "om3u.h" |
55 | #include "playlistfileview.h" | 45 | #include "playlistfileview.h" |
56 | 46 | ||
57 | //only needed for the random play | 47 | //only needed for the random play |
58 | #include <stdlib.h> | ||
59 | #include <assert.h> | 48 | #include <assert.h> |
60 | 49 | ||
61 | PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 50 | PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
62 | : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) | 51 | : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) |
63 | { | 52 | { |
64 | 53 | ||
@@ -664,45 +653,47 @@ void PlayListWidget::openFile() { | |||
664 | Config cfg( "OpiePlayer" ); | 653 | Config cfg( "OpiePlayer" ); |
665 | cfg.setGroup("Dialog"); | 654 | cfg.setGroup("Dialog"); |
666 | MimeTypes types; | 655 | MimeTypes types; |
667 | QStringList audio, video, all; | 656 | QStringList audio, video, all; |
668 | audio << "audio/*"; | 657 | audio << "audio/*"; |
669 | audio << "playlist/plain"; | 658 | audio << "playlist/plain"; |
659 | audio << "application/ogg"; | ||
670 | audio << "audio/x-mpegurl"; | 660 | audio << "audio/x-mpegurl"; |
671 | 661 | ||
672 | video << "video/*"; | 662 | video << "video/*"; |
673 | video << "playlist/plain"; | 663 | video << "playlist/plain"; |
674 | 664 | ||
675 | all += audio; | 665 | all += audio; |
676 | all += video; | 666 | all += video; |
677 | types.insert("All Media Files", all ); | 667 | types.insert("All Media Files", all ); |
678 | types.insert("Audio", audio ); | 668 | types.insert("Audio", audio ); |
679 | types.insert("Video", video ); | 669 | types.insert("Video", video ); |
680 | 670 | ||
681 | QString str = OFileDialog::getOpenFileName( 1, | 671 | QString str = OFileDialog::getOpenFileName( 1, |
682 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", | 672 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", |
683 | types, 0 ); | 673 | types, 0 ); |
684 | if(str.left(2) == "//") str=str.right(str.length()-1); | ||
685 | cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); | ||
686 | 674 | ||
675 | if(str.left(2) == "//") { | ||
676 | str=str.right(str.length()-1); | ||
677 | } | ||
678 | cfg.writeEntry( "LastDirectory" ,QFileInfo( str ).dirPath() ); | ||
687 | 679 | ||
688 | if( !str.isEmpty() ) { | 680 | if( !str.isEmpty() ) { |
681 | |||
689 | qDebug( "Selected filename is " + str ); | 682 | qDebug( "Selected filename is " + str ); |
690 | filename = str; | 683 | filename = str; |
691 | DocLnk lnk; | 684 | DocLnk lnk; |
692 | Config cfg( "OpiePlayer" ); | ||
693 | cfg.setGroup("PlayList"); | ||
694 | 685 | ||
695 | if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { | 686 | if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { |
696 | readListFromFile( filename ); | 687 | readListFromFile( filename ); |
697 | } else { | 688 | } else { |
698 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 689 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
699 | lnk.setFile( filename ); //sets file name | 690 | lnk.setFile( filename ); //sets file name |
700 | d->selectedFiles->addToSelection( lnk); | 691 | d->selectedFiles->addToSelection( lnk ); |
701 | writeCurrentM3u(); | 692 | writeCurrentM3u(); |
702 | d->selectedFiles->setSelectedItem( lnk.name()); | 693 | d->selectedFiles->setSelectedItem( lnk.name() ); |
703 | } | 694 | } |
704 | } | 695 | } |
705 | } | 696 | } |
706 | 697 | ||
707 | 698 | ||
708 | void PlayListWidget::readListFromFile( const QString &filename ) { | 699 | void PlayListWidget::readListFromFile( const QString &filename ) { |