author | harlekin <harlekin> | 2003-06-18 20:19:16 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-06-18 20:19:16 (UTC) |
commit | 9bfda722eeba2f5861393e9f5f41170fab502da8 (patch) (unidiff) | |
tree | eb01205e55bfe4f59d48d4c45b60013f1bd434ee /noncore/multimedia/opieplayer2 | |
parent | db7c5730e22188f365eb9d52aed961066fbda026 (diff) | |
download | opie-9bfda722eeba2f5861393e9f5f41170fab502da8.zip opie-9bfda722eeba2f5861393e9f5f41170fab502da8.tar.gz opie-9bfda722eeba2f5861393e9f5f41170fab502da8.tar.bz2 |
separate Add URL from Add file
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/inputDialog.cpp | 67 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/inputDialog.h | 35 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 62 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 3 |
4 files changed, 129 insertions, 38 deletions
diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp index 2c4be1b..ebde9c6 100644 --- a/noncore/multimedia/opieplayer2/inputDialog.cpp +++ b/noncore/multimedia/opieplayer2/inputDialog.cpp | |||
@@ -1,12 +1,43 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> | ||
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | ||
6 | =. | ||
7 | .=l. | ||
8 | .>+-= | ||
9 | _;:, .> :=|. This program is free software; you can | ||
10 | .> <`_, > . <= redistribute it and/or modify it under | ||
11 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
12 | .="- .-=="i, .._ License as published by the Free Software | ||
13 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
14 | ._= =} : or (at your option) any later version. | ||
15 | .%`+i> _;_. | ||
16 | .i_,=:_. -<s. This program is distributed in the hope that | ||
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
18 | : .. .:, . . . without even the implied warranty of | ||
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
21 | ..}^=.= = ; General Public License for more | ||
22 | ++= -. .` .: details. | ||
23 | : = ...= . :.=- | ||
24 | -. .:....=;==+<; You should have received a copy of the GNU | ||
25 | -_. . . )=. = General Public License along with | ||
26 | -- :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
29 | Boston, MA 02111-1307, USA. | ||
30 | |||
31 | */ | ||
32 | |||
33 | |||
1 | #include "inputDialog.h" | 34 | #include "inputDialog.h" |
2 | 35 | ||
3 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
4 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
5 | #include <qpe/config.h> | ||
6 | #include <opie/ofiledialog.h> | ||
7 | 38 | ||
8 | #include <qfileinfo.h> | 39 | #include <qfileinfo.h> |
9 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
10 | #include <qlayout.h> | 41 | #include <qlayout.h> |
11 | #include <qvariant.h> | 42 | #include <qvariant.h> |
12 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
@@ -19,15 +50,15 @@ InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags | |||
19 | } | 50 | } |
20 | resize( 234, 115); | 51 | resize( 234, 115); |
21 | setMaximumSize( QSize( 240, 40)); | 52 | setMaximumSize( QSize( 240, 40)); |
22 | setCaption( tr( name ) ); | 53 | setCaption( tr( name ) ); |
23 | 54 | ||
24 | QPushButton *browserButton; | 55 | QPushButton *browserButton; |
25 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); | 56 | //browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); |
26 | browserButton->setGeometry( QRect( 205, 10, 22, 22)); | 57 | //browserButton->setGeometry( QRect( 205, 10, 22, 22)); |
27 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); | 58 | //connect( browserButton, SIGNAL(released()),this,SLOT(browse())); |
28 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 59 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
29 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); | 60 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); |
30 | LineEdit1->setFocus(); | 61 | LineEdit1->setFocus(); |
31 | } | 62 | } |
32 | /* | 63 | /* |
33 | * return the current text(input) | 64 | * return the current text(input) |
@@ -38,32 +69,6 @@ QString InputDialog::text() const { | |||
38 | /* | 69 | /* |
39 | * Destroys the object and frees any allocated resources | 70 | * Destroys the object and frees any allocated resources |
40 | */ | 71 | */ |
41 | InputDialog::~InputDialog() { | 72 | InputDialog::~InputDialog() { |
42 | } | 73 | } |
43 | 74 | ||
44 | void InputDialog::browse() { | ||
45 | Config cfg( "OpiePlayer" ); | ||
46 | cfg.setGroup("Dialog"); | ||
47 | MimeTypes types; | ||
48 | QStringList audio, video, all; | ||
49 | audio << "audio/*"; | ||
50 | audio << "playlist/plain"; | ||
51 | audio << "audio/x-mpegurl"; | ||
52 | |||
53 | video << "video/*"; | ||
54 | video << "playlist/plain"; | ||
55 | |||
56 | all += audio; | ||
57 | all += video; | ||
58 | types.insert("All Media Files", all ); | ||
59 | types.insert("Audio", audio ); | ||
60 | types.insert("Video", video ); | ||
61 | |||
62 | QString str = OFileDialog::getOpenFileName( 1, | ||
63 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", | ||
64 | types, 0 ); | ||
65 | if(str.left(2) == "//") str=str.right(str.length()-1); | ||
66 | LineEdit1->setText(str); | ||
67 | cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); | ||
68 | } | ||
69 | |||
diff --git a/noncore/multimedia/opieplayer2/inputDialog.h b/noncore/multimedia/opieplayer2/inputDialog.h index 0f36ea4..f64f6d4 100644 --- a/noncore/multimedia/opieplayer2/inputDialog.h +++ b/noncore/multimedia/opieplayer2/inputDialog.h | |||
@@ -1,6 +1,39 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> | ||
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | ||
6 | =. | ||
7 | .=l. | ||
8 | .>+-= | ||
9 | _;:, .> :=|. This program is free software; you can | ||
10 | .> <`_, > . <= redistribute it and/or modify it under | ||
11 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
12 | .="- .-=="i, .._ License as published by the Free Software | ||
13 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
14 | ._= =} : or (at your option) any later version. | ||
15 | .%`+i> _;_. | ||
16 | .i_,=:_. -<s. This program is distributed in the hope that | ||
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
18 | : .. .:, . . . without even the implied warranty of | ||
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
21 | ..}^=.= = ; General Public License for more | ||
22 | ++= -. .` .: details. | ||
23 | : = ...= . :.=- | ||
24 | -. .:....=;==+<; You should have received a copy of the GNU | ||
25 | -_. . . )=. = General Public License along with | ||
26 | -- :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
29 | Boston, MA 02111-1307, USA. | ||
30 | |||
31 | */ | ||
32 | |||
33 | |||
1 | 34 | ||
2 | #ifndef INPUTDIALOG_H | 35 | #ifndef INPUTDIALOG_H |
3 | #define INPUTDIALOG_H | 36 | #define INPUTDIALOG_H |
4 | 37 | ||
5 | #include <qvariant.h> | 38 | #include <qvariant.h> |
6 | #include <qdialog.h> | 39 | #include <qdialog.h> |
@@ -15,11 +48,9 @@ public: | |||
15 | ~InputDialog(); | 48 | ~InputDialog(); |
16 | QString text()const; | 49 | QString text()const; |
17 | 50 | ||
18 | private: | 51 | private: |
19 | QLineEdit* LineEdit1; | 52 | QLineEdit* LineEdit1; |
20 | 53 | ||
21 | protected slots: | ||
22 | void browse(); | ||
23 | }; | 54 | }; |
24 | 55 | ||
25 | #endif // INPUTDIALOG_H | 56 | #endif // INPUTDIALOG_H |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index c91a565..4e31670 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
@@ -34,12 +34,15 @@ | |||
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> |
39 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
40 | #include <qpe/config.h> | ||
41 | |||
42 | #include <opie/ofiledialog.h> | ||
40 | 43 | ||
41 | #include <qdatetime.h> | 44 | #include <qdatetime.h> |
42 | #include <qdir.h> | 45 | #include <qdir.h> |
43 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
44 | #include <qregexp.h> | 47 | #include <qregexp.h> |
45 | #include <qtextstream.h> | 48 | #include <qtextstream.h> |
@@ -82,14 +85,16 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par | |||
82 | pmPlayList->insertSeparator(-1); | 85 | pmPlayList->insertSeparator(-1); |
83 | // (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), | 86 | // (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), |
84 | // this, SLOT( saveList() ) ); | 87 | // this, SLOT( saveList() ) ); |
85 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), | 88 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), |
86 | this, SLOT(writem3u() ) ); | 89 | this, SLOT(writem3u() ) ); |
87 | pmPlayList->insertSeparator(-1); | 90 | pmPlayList->insertSeparator(-1); |
88 | (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), | 91 | (void)new MenuItem( pmPlayList, tr( "Add File" ), |
89 | this,SLOT( openFile() ) ); | 92 | this,SLOT( openFile() ) ); |
93 | (void)new MenuItem( pmPlayList, tr("Add URL"), | ||
94 | this,SLOT( openURL() ) ); | ||
90 | pmPlayList->insertSeparator(-1); | 95 | pmPlayList->insertSeparator(-1); |
91 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), | 96 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), |
92 | audioView, SLOT( scanFiles() ) ); | 97 | audioView, SLOT( scanFiles() ) ); |
93 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), | 98 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), |
94 | videoView, SLOT( scanFiles() ) ); | 99 | videoView, SLOT( scanFiles() ) ); |
95 | 100 | ||
@@ -599,18 +604,18 @@ void PlayListWidget::playSelected() { | |||
599 | bool PlayListWidget::inFileListMode() const | 604 | bool PlayListWidget::inFileListMode() const |
600 | { | 605 | { |
601 | TabType tab = currentTab(); | 606 | TabType tab = currentTab(); |
602 | return tab == AudioFiles || tab == VideoFiles; | 607 | return tab == AudioFiles || tab == VideoFiles; |
603 | } | 608 | } |
604 | 609 | ||
605 | void PlayListWidget::openFile() { | 610 | void PlayListWidget::openURL() { |
606 | // http://66.28.164.33:2080 | 611 | // http://66.28.164.33:2080 |
607 | // http://somafm.com/star0242.m3u | 612 | // http://somafm.com/star0242.m3u |
608 | QString filename, name; | 613 | QString filename, name; |
609 | InputDialog *fileDlg; | 614 | InputDialog *fileDlg; |
610 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 615 | fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); |
611 | fileDlg->exec(); | 616 | fileDlg->exec(); |
612 | if( fileDlg->result() == 1 ) { | 617 | if( fileDlg->result() == 1 ) { |
613 | filename = fileDlg->text(); | 618 | filename = fileDlg->text(); |
614 | qDebug( "Selected filename is " + filename ); | 619 | qDebug( "Selected filename is " + filename ); |
615 | // Om3u *m3uList; | 620 | // Om3u *m3uList; |
616 | DocLnk lnk; | 621 | DocLnk lnk; |
@@ -650,12 +655,61 @@ void PlayListWidget::openFile() { | |||
650 | } | 655 | } |
651 | 656 | ||
652 | 657 | ||
653 | delete fileDlg; | 658 | delete fileDlg; |
654 | } | 659 | } |
655 | 660 | ||
661 | |||
662 | void PlayListWidget::openFile() { | ||
663 | |||
664 | QString filename, name; | ||
665 | |||
666 | Config cfg( "OpiePlayer" ); | ||
667 | cfg.setGroup("Dialog"); | ||
668 | MimeTypes types; | ||
669 | QStringList audio, video, all; | ||
670 | audio << "audio/*"; | ||
671 | audio << "playlist/plain"; | ||
672 | audio << "audio/x-mpegurl"; | ||
673 | |||
674 | video << "video/*"; | ||
675 | video << "playlist/plain"; | ||
676 | |||
677 | all += audio; | ||
678 | all += video; | ||
679 | types.insert("All Media Files", all ); | ||
680 | types.insert("Audio", audio ); | ||
681 | types.insert("Video", video ); | ||
682 | |||
683 | QString str = OFileDialog::getOpenFileName( 1, | ||
684 | cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", | ||
685 | types, 0 ); | ||
686 | if(str.left(2) == "//") str=str.right(str.length()-1); | ||
687 | cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); | ||
688 | |||
689 | |||
690 | if( !str.isEmpty() ) { | ||
691 | qDebug( "Selected filename is " + str ); | ||
692 | filename = str; | ||
693 | DocLnk lnk; | ||
694 | Config cfg( "OpiePlayer" ); | ||
695 | cfg.setGroup("PlayList"); | ||
696 | |||
697 | if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { | ||
698 | readListFromFile( filename ); | ||
699 | } else { | ||
700 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | ||
701 | lnk.setFile( filename ); //sets file name | ||
702 | d->selectedFiles->addToSelection( lnk); | ||
703 | writeCurrentM3u(); | ||
704 | d->selectedFiles->setSelectedItem( lnk.name()); | ||
705 | } | ||
706 | } | ||
707 | } | ||
708 | |||
709 | |||
656 | void PlayListWidget::readListFromFile( const QString &filename ) { | 710 | void PlayListWidget::readListFromFile( const QString &filename ) { |
657 | qDebug( "read list filename " + filename ); | 711 | qDebug( "read list filename " + filename ); |
658 | QFileInfo fi(filename); | 712 | QFileInfo fi(filename); |
659 | Om3u *m3uList; | 713 | Om3u *m3uList; |
660 | QString s, name; | 714 | QString s, name; |
661 | m3uList = new Om3u( filename, IO_ReadOnly ); | 715 | m3uList = new Om3u( filename, IO_ReadOnly ); |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 54e9d16..5230b03 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
@@ -108,12 +108,13 @@ private slots: | |||
108 | void populateSkinsMenu(); | 108 | void populateSkinsMenu(); |
109 | void skinsMenuActivated(int); | 109 | void skinsMenuActivated(int); |
110 | void pmViewActivated(int); | 110 | void pmViewActivated(int); |
111 | void writem3u(); | 111 | void writem3u(); |
112 | void writeCurrentM3u(); | 112 | void writeCurrentM3u(); |
113 | void openFile(); | 113 | void openFile(); |
114 | void openURL(); | ||
114 | void setDocument( const QString& fileref ); | 115 | void setDocument( const QString& fileref ); |
115 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 116 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
116 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 117 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
117 | void clearList(); | 118 | void clearList(); |
118 | void addAllToList(); | 119 | void addAllToList(); |
119 | void addAllMusicToList(); | 120 | void addAllMusicToList(); |