author | drw <drw> | 2005-06-15 19:44:04 (UTC) |
---|---|---|
committer | drw <drw> | 2005-06-15 19:44:04 (UTC) |
commit | 1cc97c3b70f59b90dc4bf032a14198dc8bd07f2e (patch) (unidiff) | |
tree | cb873e7e3f7330368b857d8fe69826d6a9e4e68a | |
parent | dfad70bb3964d6f7142660ea4349d4af0349b46d (diff) | |
download | opie-1cc97c3b70f59b90dc4bf032a14198dc8bd07f2e.zip opie-1cc97c3b70f59b90dc4bf032a14198dc8bd07f2e.tar.gz opie-1cc97c3b70f59b90dc4bf032a14198dc8bd07f2e.tar.bz2 |
Resource -> OResource and fix doc headers
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 8 | ||||
-rw-r--r-- | core/multimedia/opieplayer/inputDialog.cpp | 9 | ||||
-rw-r--r-- | core/multimedia/opieplayer/om3u.cpp | 43 | ||||
-rw-r--r-- | core/multimedia/opieplayer/om3u.h | 44 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 19 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 9 |
6 files changed, 68 insertions, 64 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index d135647..2918097 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -1,145 +1,145 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | #include "audiowidget.h" | 20 | #include "audiowidget.h" |
21 | #include "mediaplayerstate.h" | 21 | #include "mediaplayerstate.h" |
22 | 22 | ||
23 | /* OPIE */ | 23 | /* OPIE */ |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/resource.h> | ||
26 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
27 | #include <opie2/odebug.h> | 26 | #include <opie2/odebug.h> |
27 | #include <opie2/oresource.h> | ||
28 | 28 | ||
29 | /* QT */ | 29 | /* QT */ |
30 | #include <qdir.h> | 30 | #include <qdir.h> |
31 | 31 | ||
32 | /* STD */ | 32 | /* STD */ |
33 | #include <stdlib.h> | 33 | #include <stdlib.h> |
34 | #include <stdio.h> | 34 | #include <stdio.h> |
35 | 35 | ||
36 | extern MediaPlayerState *mediaPlayerState; | 36 | extern MediaPlayerState *mediaPlayerState; |
37 | 37 | ||
38 | 38 | ||
39 | static const int xo = -2; // movable x offset | 39 | static const int xo = -2; // movable x offset |
40 | static const int yo = 22; // movable y offset | 40 | static const int yo = 22; // movable y offset |
41 | 41 | ||
42 | using namespace Opie::Ui; | 42 | using namespace Opie::Ui; |
43 | struct MediaButton { | 43 | struct MediaButton { |
44 | bool isToggle, isHeld, isDown; | 44 | bool isToggle, isHeld, isDown; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | //Layout information for the audioButtons (and if it is a toggle button or not) | 47 | //Layout information for the audioButtons (and if it is a toggle button or not) |
48 | MediaButton audioButtons[] = { | 48 | MediaButton audioButtons[] = { |
49 | { TRUE, FALSE, FALSE }, // play | 49 | { TRUE, FALSE, FALSE }, // play |
50 | { FALSE, FALSE, FALSE }, // stop | 50 | { FALSE, FALSE, FALSE }, // stop |
51 | { FALSE, FALSE, FALSE }, // next | 51 | { FALSE, FALSE, FALSE }, // next |
52 | { FALSE, FALSE, FALSE }, // previous | 52 | { FALSE, FALSE, FALSE }, // previous |
53 | { FALSE, FALSE, FALSE }, // volume up | 53 | { FALSE, FALSE, FALSE }, // volume up |
54 | { FALSE, FALSE, FALSE }, // volume down | 54 | { FALSE, FALSE, FALSE }, // volume down |
55 | { TRUE, FALSE, FALSE }, // repeat/loop | 55 | { TRUE, FALSE, FALSE }, // repeat/loop |
56 | { FALSE, FALSE, FALSE }, // playlist | 56 | { FALSE, FALSE, FALSE }, // playlist |
57 | { FALSE, FALSE, FALSE }, // forward | 57 | { FALSE, FALSE, FALSE }, // forward |
58 | { FALSE, FALSE, FALSE } // back | 58 | { FALSE, FALSE, FALSE } // back |
59 | }; | 59 | }; |
60 | 60 | ||
61 | const char *skin_mask_file_names[10] = { | 61 | const char *skin_mask_file_names[10] = { |
62 | "play", "stop", "next", "prev", "up", | 62 | "play", "stop", "next", "prev", "up", |
63 | "down", "loop", "playlist", "forward", "back" | 63 | "down", "loop", "playlist", "forward", "back" |
64 | }; | 64 | }; |
65 | 65 | ||
66 | static void changeTextColor( QWidget *w ) { | 66 | static void changeTextColor( QWidget *w ) { |
67 | QPalette p = w->palette(); | 67 | QPalette p = w->palette(); |
68 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 68 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
69 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 69 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
70 | w->setPalette( p ); | 70 | w->setPalette( p ); |
71 | } | 71 | } |
72 | 72 | ||
73 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 73 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
74 | 74 | ||
75 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 75 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
76 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) | 76 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) |
77 | { | 77 | { |
78 | setCaption( tr("OpiePlayer") ); | 78 | setCaption( tr("OpiePlayer") ); |
79 | // odebug << "<<<<<audioWidget" << oendl; | 79 | // odebug << "<<<<<audioWidget" << oendl; |
80 | 80 | ||
81 | Config cfg("OpiePlayer"); | 81 | Config cfg("OpiePlayer"); |
82 | cfg.setGroup("Options"); | 82 | cfg.setGroup("Options"); |
83 | skin = cfg.readEntry("Skin","default"); | 83 | skin = cfg.readEntry("Skin","default"); |
84 | //skin = "scaleTest"; | 84 | //skin = "scaleTest"; |
85 | // color of background, frame, degree of transparency | 85 | // color of background, frame, degree of transparency |
86 | 86 | ||
87 | // QString skinPath = "opieplayer/skins/" + skin; | 87 | // QString skinPath = "opieplayer/skins/" + skin; |
88 | QString skinPath; | 88 | QString skinPath; |
89 | skinPath = "opieplayer2/skins/" + skin; | 89 | skinPath = "opieplayer2/skins/" + skin; |
90 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) | 90 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) |
91 | skinPath = "opieplayer2/skins/default"; | 91 | skinPath = "opieplayer2/skins/default"; |
92 | 92 | ||
93 | // odebug << "skin path " + skinPath << oendl; | 93 | // odebug << "skin path " + skinPath << oendl; |
94 | 94 | ||
95 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 95 | pixBg = new QPixmap( Opie::Core::OResource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
96 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 96 | imgUp = new QImage( Opie::Core::OResource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
97 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 97 | imgDn = new QImage( Opie::Core::OResource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
98 | 98 | ||
99 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 99 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
100 | imgButtonMask->fill( 0 ); | 100 | imgButtonMask->fill( 0 ); |
101 | 101 | ||
102 | for ( int i = 0; i < 10; i++ ) { | 102 | for ( int i = 0; i < 10; i++ ) { |
103 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; | 103 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; |
104 | masks[i] = new QBitmap( filename ); | 104 | masks[i] = new QBitmap( filename ); |
105 | 105 | ||
106 | if ( !masks[i]->isNull() ) { | 106 | if ( !masks[i]->isNull() ) { |
107 | QImage imgMask = masks[i]->convertToImage(); | 107 | QImage imgMask = masks[i]->convertToImage(); |
108 | uchar **dest = imgButtonMask->jumpTable(); | 108 | uchar **dest = imgButtonMask->jumpTable(); |
109 | for ( int y = 0; y < imgUp->height(); y++ ) { | 109 | for ( int y = 0; y < imgUp->height(); y++ ) { |
110 | uchar *line = dest[y]; | 110 | uchar *line = dest[y]; |
111 | for ( int x = 0; x < imgUp->width(); x++ ) | 111 | for ( int x = 0; x < imgUp->width(); x++ ) |
112 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 112 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
113 | line[x] = i + 1; | 113 | line[x] = i + 1; |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | for ( int i = 0; i < 11; i++ ) { | 119 | for ( int i = 0; i < 11; i++ ) { |
120 | buttonPixUp[i] = NULL; | 120 | buttonPixUp[i] = NULL; |
121 | buttonPixDown[i] = NULL; | 121 | buttonPixDown[i] = NULL; |
122 | } | 122 | } |
123 | 123 | ||
124 | QWidget *d = QApplication::desktop(); | 124 | QWidget *d = QApplication::desktop(); |
125 | int width = d->width(); | 125 | int width = d->width(); |
126 | int height = d->height(); | 126 | int height = d->height(); |
127 | 127 | ||
128 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { | 128 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { |
129 | // odebug << "<<<<<<<< scale image >>>>>>>>>>>>" << oendl; | 129 | // odebug << "<<<<<<<< scale image >>>>>>>>>>>>" << oendl; |
130 | QImage img; | 130 | QImage img; |
131 | img = pixBg->convertToImage(); | 131 | img = pixBg->convertToImage(); |
132 | pixBg->convertFromImage( img.smoothScale( width, height)); | 132 | pixBg->convertFromImage( img.smoothScale( width, height)); |
133 | } | 133 | } |
134 | setBackgroundPixmap( *pixBg); | 134 | setBackgroundPixmap( *pixBg); |
135 | 135 | ||
136 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 136 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
137 | 137 | ||
138 | // changeTextColor( &songInfo ); | 138 | // changeTextColor( &songInfo ); |
139 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 139 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
140 | // songInfo.setFrameStyle( QFrame::NoFrame); | 140 | // songInfo.setFrameStyle( QFrame::NoFrame); |
141 | // songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 141 | // songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
142 | //NoFrame | 142 | //NoFrame |
143 | // songInfo.setForegroundColor(Qt::white); | 143 | // songInfo.setForegroundColor(Qt::white); |
144 | 144 | ||
145 | slider.setFixedHeight( 20 ); | 145 | slider.setFixedHeight( 20 ); |
diff --git a/core/multimedia/opieplayer/inputDialog.cpp b/core/multimedia/opieplayer/inputDialog.cpp index 44a1cdd..b76004e 100644 --- a/core/multimedia/opieplayer/inputDialog.cpp +++ b/core/multimedia/opieplayer/inputDialog.cpp | |||
@@ -1,60 +1,61 @@ | |||
1 | #include "inputDialog.h" | 1 | #include "inputDialog.h" |
2 | 2 | ||
3 | #include <qpe/resource.h> | ||
4 | |||
5 | #include <opie2/ofiledialog.h> | 3 | #include <opie2/ofiledialog.h> |
4 | #include <opie2/oresource.h> | ||
5 | |||
6 | #include <qpe/applnk.h> | ||
6 | 7 | ||
7 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
8 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
9 | 10 | ||
10 | using namespace Opie::Ui; | 11 | using namespace Opie::Ui; |
11 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 12 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
12 | : QDialog( parent, name, modal, fl ) { | 13 | : QDialog( parent, name, modal, fl ) { |
13 | if ( !name ) { | 14 | if ( !name ) { |
14 | setName( "InputDialog" ); | 15 | setName( "InputDialog" ); |
15 | } | 16 | } |
16 | resize( 234, 115); | 17 | resize( 234, 115); |
17 | setMaximumSize( QSize( 240, 40)); | 18 | setMaximumSize( QSize( 240, 40)); |
18 | setCaption( tr( name ) ); | 19 | setCaption( tr( name ) ); |
19 | 20 | ||
20 | QPushButton *browserButton; | 21 | QPushButton *browserButton; |
21 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); | 22 | browserButton = new QPushButton( Opie::Core::OResource::loadPixmap("fileopen", Opie::Core::OResource::SmallIcon),"",this,"BrowseButton"); |
22 | browserButton->setGeometry( QRect( 205, 10, 22, 22)); | 23 | browserButton->setGeometry( QRect( 205, 10, AppLnk::smallIconSize(), AppLnk::smallIconSize())); |
23 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); | 24 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); |
24 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 25 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
25 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); | 26 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); |
26 | LineEdit1->setFocus(); | 27 | LineEdit1->setFocus(); |
27 | } | 28 | } |
28 | /* | 29 | /* |
29 | * return the current text(input) | 30 | * return the current text(input) |
30 | */ | 31 | */ |
31 | QString InputDialog::text() const { | 32 | QString InputDialog::text() const { |
32 | return LineEdit1->text(); | 33 | return LineEdit1->text(); |
33 | } | 34 | } |
34 | /* | 35 | /* |
35 | * Destroys the object and frees any allocated resources | 36 | * Destroys the object and frees any allocated resources |
36 | */ | 37 | */ |
37 | InputDialog::~InputDialog() { | 38 | InputDialog::~InputDialog() { |
38 | } | 39 | } |
39 | 40 | ||
40 | void InputDialog::browse() { | 41 | void InputDialog::browse() { |
41 | 42 | ||
42 | MimeTypes types; | 43 | MimeTypes types; |
43 | QStringList audio, video, all; | 44 | QStringList audio, video, all; |
44 | audio << "audio/*"; | 45 | audio << "audio/*"; |
45 | audio << "playlist/plain"; | 46 | audio << "playlist/plain"; |
46 | audio << "audio/x-mpegurl"; | 47 | audio << "audio/x-mpegurl"; |
47 | 48 | ||
48 | video << "video/*"; | 49 | video << "video/*"; |
49 | video << "playlist/plain"; | 50 | video << "playlist/plain"; |
50 | 51 | ||
51 | all += audio; | 52 | all += audio; |
52 | all += video; | 53 | all += video; |
53 | types.insert("All Media Files", all ); | 54 | types.insert("All Media Files", all ); |
54 | types.insert("Audio", audio ); | 55 | types.insert("Audio", audio ); |
55 | types.insert("Video", video ); | 56 | types.insert("Video", video ); |
56 | 57 | ||
57 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); | 58 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); |
58 | LineEdit1->setText(str); | 59 | LineEdit1->setText(str); |
59 | } | 60 | } |
60 | 61 | ||
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp index 7149a8e..48aa47e 100644 --- a/core/multimedia/opieplayer/om3u.cpp +++ b/core/multimedia/opieplayer/om3u.cpp | |||
@@ -1,77 +1,76 @@ | |||
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 L. Potter <ljp@llornkcor.com> | 4 | Copyright (C) 2002 L. Potter <ljp@llornkcor.com> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | Â Â Â Â Â Â .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | Â Â .%`+i> Â Â Â _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. Â Â .:, Â Â . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; General Public License for more | 20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= Â -. Â Â .` Â Â .: details. |
22 | : = ...= . :.=- | 22 | : Â Â = Â ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = General Public License along with | 24 | Â -_. . . Â )=. Â = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | |||
30 | */ | 29 | */ |
31 | 30 | ||
32 | #include "om3u.h" | 31 | #include "om3u.h" |
33 | 32 | ||
34 | /* OPIE */ | 33 | /* OPIE */ |
35 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
36 | 35 | ||
37 | 36 | ||
38 | static inline QString fullBaseName ( const QFileInfo &fi ) | 37 | static inline QString fullBaseName ( const QFileInfo &fi ) |
39 | { | 38 | { |
40 | QString str = fi. fileName ( ); | 39 | QString str = fi. fileName ( ); |
41 | return str. left ( str. findRev ( '.' )); | 40 | return str. left ( str. findRev ( '.' )); |
42 | } | 41 | } |
43 | 42 | ||
44 | 43 | ||
45 | //extern PlayListWidget *playList; | 44 | //extern PlayListWidget *playList; |
46 | 45 | ||
47 | Om3u::Om3u( const QString &filePath, int mode) | 46 | Om3u::Om3u( const QString &filePath, int mode) |
48 | : QStringList (){ | 47 | : QStringList (){ |
49 | //odebug << "<<<<<<<new m3u "+filePath << oendl; | 48 | //odebug << "<<<<<<<new m3u "+filePath << oendl; |
50 | f.setName(filePath); | 49 | f.setName(filePath); |
51 | f.open(mode); | 50 | f.open(mode); |
52 | } | 51 | } |
53 | 52 | ||
54 | Om3u::~Om3u(){} | 53 | Om3u::~Om3u(){} |
55 | 54 | ||
56 | void Om3u::readM3u() { | 55 | void Om3u::readM3u() { |
57 | // odebug << "<<<<<<reading m3u "+f.name() << oendl; | 56 | // odebug << "<<<<<<reading m3u "+f.name() << oendl; |
58 | QTextStream t(&f); | 57 | QTextStream t(&f); |
59 | t.setEncoding(QTextStream::UnicodeUTF8); | 58 | t.setEncoding(QTextStream::UnicodeUTF8); |
60 | QString s; | 59 | QString s; |
61 | while ( !t.atEnd() ) { | 60 | while ( !t.atEnd() ) { |
62 | s=t.readLine(); | 61 | s=t.readLine(); |
63 | // odebug << s << oendl; | 62 | // odebug << s << oendl; |
64 | if( s.find( "#", 0, TRUE) == -1 ) { | 63 | if( s.find( "#", 0, TRUE) == -1 ) { |
65 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 64 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
66 | s = s.right( s.length() -2 ); | 65 | s = s.right( s.length() -2 ); |
67 | QFileInfo f( s ); | 66 | QFileInfo f( s ); |
68 | QString name = fullBaseName ( f ); | 67 | QString name = fullBaseName ( f ); |
69 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 68 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
70 | s=s.replace( QRegExp( "\\" ), "/" ); | 69 | s=s.replace( QRegExp( "\\" ), "/" ); |
71 | append(s); | 70 | append(s); |
72 | // odebug << s << oendl; | 71 | // odebug << s << oendl; |
73 | } else { // is url | 72 | } else { // is url |
74 | s.replace( QRegExp( "%20" )," " ); | 73 | s.replace( QRegExp( "%20" )," " ); |
75 | QString name; | 74 | QString name; |
76 | // if( name.left( 4 ) == "http" ) { | 75 | // if( name.left( 4 ) == "http" ) { |
77 | // name = s.right( s.length() - 7 ); | 76 | // name = s.right( s.length() - 7 ); |
diff --git a/core/multimedia/opieplayer/om3u.h b/core/multimedia/opieplayer/om3u.h index 9c7cf9a..b944d6f 100644 --- a/core/multimedia/opieplayer/om3u.h +++ b/core/multimedia/opieplayer/om3u.h | |||
@@ -1,79 +1,77 @@ | |||
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 L. Potter <ljp@llornkcor.com> | 4 | Copyright (C) 2002 L. Potter <ljp@llornkcor.com> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | Â Â Â Â Â Â .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | Â Â .%`+i> Â Â Â _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. Â Â .:, Â Â . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; General Public License for more | 20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= Â -. Â Â .` Â Â .: details. |
22 | : = ...= . :.=- | 22 | : Â Â = Â ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = General Public License along with | 24 | Â -_. . . Â )=. Â = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | |||
30 | */ | 29 | */ |
31 | 30 | ||
32 | #ifndef OM3U_H | 31 | #ifndef OM3U_H |
33 | #define OM3U_H | 32 | #define OM3U_H |
34 | 33 | ||
35 | #include "playlistwidget.h" | 34 | #include "playlistwidget.h" |
36 | 35 | ||
37 | #include <qpe/applnk.h> | 36 | #include <qpe/applnk.h> |
38 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
39 | #include <qpe/storage.h> | 38 | #include <qpe/storage.h> |
40 | #include <qpe/mimetype.h> | 39 | #include <qpe/mimetype.h> |
41 | #include <qpe/global.h> | 40 | #include <qpe/global.h> |
42 | #include <qpe/resource.h> | ||
43 | 41 | ||
44 | #include <qdir.h> | 42 | #include <qdir.h> |
45 | #include <qregexp.h> | 43 | #include <qregexp.h> |
46 | #include <qstring.h> | 44 | #include <qstring.h> |
47 | #include <qtextstream.h> | 45 | #include <qtextstream.h> |
48 | #include <qstringlist.h> | 46 | #include <qstringlist.h> |
49 | #include <qcstring.h> | 47 | #include <qcstring.h> |
50 | #include <qfile.h> | 48 | #include <qfile.h> |
51 | 49 | ||
52 | 50 | ||
53 | class Om3u : public QStringList { | 51 | class Om3u : public QStringList { |
54 | // Q_OBJECT | 52 | // Q_OBJECT |
55 | public: | 53 | public: |
56 | Om3u( const QString &filePath, int mode); | 54 | Om3u( const QString &filePath, int mode); |
57 | ~Om3u(); | 55 | ~Om3u(); |
58 | void readM3u(); | 56 | void readM3u(); |
59 | void readPls(); | 57 | void readPls(); |
60 | void write(); | 58 | void write(); |
61 | void add(const QString &); | 59 | void add(const QString &); |
62 | void remove(const QString &); | 60 | void remove(const QString &); |
63 | void deleteFile(const QString &); | 61 | void deleteFile(const QString &); |
64 | void close(); | 62 | void close(); |
65 | 63 | ||
66 | public slots: | 64 | public slots: |
67 | 65 | ||
68 | protected: | 66 | protected: |
69 | 67 | ||
70 | private: | 68 | private: |
71 | QFile f; | 69 | QFile f; |
72 | private slots: | 70 | private slots: |
73 | 71 | ||
74 | 72 | ||
75 | }; | 73 | }; |
76 | 74 | ||
77 | #endif// M3U_H | 75 | #endif// M3U_H |
78 | 76 | ||
79 | 77 | ||
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index db2bf1b..c0a0029 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1,230 +1,235 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 | 20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 |
21 | #define QTOPIA_INTERNAL_FSLP | 21 | #define QTOPIA_INTERNAL_FSLP |
22 | 22 | ||
23 | #include "playlistselection.h" | 23 | #include "playlistselection.h" |
24 | #include "playlistwidget.h" | 24 | #include "playlistwidget.h" |
25 | #include "mediaplayerstate.h" | 25 | #include "mediaplayerstate.h" |
26 | #include "inputDialog.h" | 26 | #include "inputDialog.h" |
27 | #include "audiowidget.h" | 27 | #include "audiowidget.h" |
28 | #include "videowidget.h" | 28 | #include "videowidget.h" |
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | #include <qpe/qpeapplication.h> | ||
31 | #include <qpe/qpemenubar.h> | 32 | #include <qpe/qpemenubar.h> |
32 | #include <qpe/lnkproperties.h> | 33 | #include <qpe/lnkproperties.h> |
33 | #include <opie2/odebug.h> | 34 | #include <opie2/odebug.h> |
35 | #include <opie2/oresource.h> | ||
34 | 36 | ||
35 | /* QT */ | 37 | /* QT */ |
36 | #include <qtoolbar.h> | 38 | #include <qtoolbar.h> |
37 | #include <qaction.h> | 39 | #include <qaction.h> |
38 | #include <qlayout.h> | 40 | #include <qlayout.h> |
39 | #include <qmessagebox.h> | 41 | #include <qmessagebox.h> |
40 | //#include <qtimer.h> | 42 | //#include <qtimer.h> |
41 | 43 | ||
42 | /* STD */ | 44 | /* STD */ |
43 | #include <stdlib.h> | 45 | #include <stdlib.h> |
44 | 46 | ||
45 | #include <unistd.h> | 47 | #include <unistd.h> |
46 | #include <sys/file.h> | 48 | #include <sys/file.h> |
47 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
48 | #include <sys/soundcard.h> | 50 | #include <sys/soundcard.h> |
49 | 51 | ||
50 | // for setBacklight() | 52 | // for setBacklight() |
51 | #include <linux/fb.h> | 53 | #include <linux/fb.h> |
52 | #include <sys/types.h> | 54 | #include <sys/types.h> |
53 | #include <sys/stat.h> | 55 | #include <sys/stat.h> |
54 | #include <stdlib.h> | 56 | #include <stdlib.h> |
55 | 57 | ||
56 | #define BUTTONS_ON_TOOLBAR | 58 | #define BUTTONS_ON_TOOLBAR |
57 | #define SIDE_BUTTONS | 59 | #define SIDE_BUTTONS |
58 | #define CAN_SAVE_LOAD_PLAYLISTS | 60 | #define CAN_SAVE_LOAD_PLAYLISTS |
59 | 61 | ||
60 | extern AudioWidget *audioUI; | 62 | extern AudioWidget *audioUI; |
61 | extern VideoWidget *videoUI; | 63 | extern VideoWidget *videoUI; |
62 | extern MediaPlayerState *mediaPlayerState; | 64 | extern MediaPlayerState *mediaPlayerState; |
63 | 65 | ||
64 | static inline QString fullBaseName ( const QFileInfo &fi ) | 66 | static inline QString fullBaseName ( const QFileInfo &fi ) |
65 | { | 67 | { |
66 | QString str = fi. fileName ( ); | 68 | QString str = fi. fileName ( ); |
67 | return str. left ( str. findRev ( '.' )); | 69 | return str. left ( str. findRev ( '.' )); |
68 | } | 70 | } |
69 | 71 | ||
70 | 72 | ||
71 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg;audio/x-mod"; | 73 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg;audio/x-mod"; |
72 | // class myFileSelector { | 74 | // class myFileSelector { |
73 | 75 | ||
74 | // }; | 76 | // }; |
75 | class PlayListWidgetPrivate { | 77 | class PlayListWidgetPrivate { |
76 | public: | 78 | public: |
77 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 79 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
78 | QFrame *playListFrame; | 80 | QFrame *playListFrame; |
79 | FileSelector *files; | 81 | FileSelector *files; |
80 | PlayListSelection *selectedFiles; | 82 | PlayListSelection *selectedFiles; |
81 | bool setDocumentUsed; | 83 | bool setDocumentUsed; |
82 | DocLnk *current; | 84 | DocLnk *current; |
83 | }; | 85 | }; |
84 | 86 | ||
85 | 87 | ||
86 | class ToolButton : public QToolButton { | 88 | class ToolButton : public QToolButton { |
87 | public: | 89 | public: |
88 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 90 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
89 | : QToolButton( parent, name ) { | 91 | : QToolButton( parent, name ) { |
90 | setTextLabel( name ); | 92 | setTextLabel( name ); |
91 | setPixmap( Resource::loadPixmap( icon ) ); | 93 | setPixmap( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ); |
92 | setAutoRaise( TRUE ); | 94 | setAutoRaise( TRUE ); |
95 | setUsesBigPixmap( qApp->desktop()->size().width() > 330 ); | ||
93 | setFocusPolicy( QWidget::NoFocus ); | 96 | setFocusPolicy( QWidget::NoFocus ); |
94 | setToggleButton( t ); | 97 | setToggleButton( t ); |
95 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 98 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
96 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 99 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
97 | } | 100 | } |
98 | }; | 101 | }; |
99 | 102 | ||
100 | 103 | ||
101 | class MenuItem : public QAction { | 104 | class MenuItem : public QAction { |
102 | public: | 105 | public: |
103 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 106 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
104 | : QAction( text, QString::null, 0, 0 ) { | 107 | : QAction( text, QString::null, 0, 0 ) { |
105 | connect( this, SIGNAL( activated() ), handler, slot ); | 108 | connect( this, SIGNAL( activated() ), handler, slot ); |
106 | addTo( parent ); | 109 | addTo( parent ); |
107 | } | 110 | } |
108 | }; | 111 | }; |
109 | 112 | ||
110 | 113 | ||
111 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 114 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
112 | : QMainWindow( parent, name, fl ) { | 115 | : QMainWindow( parent, name, fl ) { |
113 | 116 | ||
114 | d = new PlayListWidgetPrivate; | 117 | d = new PlayListWidgetPrivate; |
115 | d->setDocumentUsed = FALSE; | 118 | d->setDocumentUsed = FALSE; |
116 | d->current = NULL; | 119 | d->current = NULL; |
117 | fromSetDocument = FALSE; | 120 | fromSetDocument = FALSE; |
118 | insanityBool=FALSE; | 121 | insanityBool=FALSE; |
119 | audioScan = FALSE; | 122 | audioScan = FALSE; |
120 | videoScan = FALSE; | 123 | videoScan = FALSE; |
121 | // menuTimer = new QTimer( this ,"menu timer"), | 124 | // menuTimer = new QTimer( this ,"menu timer"), |
122 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 125 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
123 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); | 126 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); |
124 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), | 127 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
125 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); | 128 | this, SLOT( qcopReceive(const QCString&,const QByteArray&)) ); |
126 | 129 | ||
127 | setBackgroundMode( PaletteButton ); | 130 | setBackgroundMode( PaletteButton ); |
128 | 131 | ||
129 | setCaption( tr("OpiePlayer") ); | 132 | setCaption( tr("OpiePlayer") ); |
130 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); | 133 | setIcon( Opie::Core::OResource::loadPixmap( "opieplayer/MPEGPlayer", Opie::Core::OResource::SmallIcon ) ); |
131 | 134 | ||
132 | setToolBarsMovable( FALSE ); | 135 | setToolBarsMovable( FALSE ); |
133 | 136 | ||
134 | // Create Toolbar | 137 | // Create Toolbar |
135 | QToolBar *toolbar = new QToolBar( this ); | 138 | QToolBar *toolbar = new QToolBar( this ); |
136 | toolbar->setHorizontalStretchable( TRUE ); | 139 | toolbar->setHorizontalStretchable( TRUE ); |
137 | 140 | ||
138 | // Create Menubar | 141 | // Create Menubar |
139 | QMenuBar *menu = new QMenuBar( toolbar ); | 142 | QMenuBar *menu = new QMenuBar( toolbar ); |
140 | menu->setMargin( 0 ); | 143 | menu->setMargin( 0 ); |
141 | 144 | ||
142 | QToolBar *bar = new QToolBar( this ); | 145 | QToolBar *bar = new QToolBar( this ); |
143 | bar->setLabel( tr( "Play Operations" ) ); | 146 | bar->setLabel( tr( "Play Operations" ) ); |
144 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", | 147 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", |
145 | // this , SLOT( addSelected()) ); | 148 | // this , SLOT( addSelected()) ); |
146 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 149 | tbDeletePlaylist = new QPushButton( Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon),"",bar,"close"); |
147 | tbDeletePlaylist->setFlat(TRUE); | 150 | tbDeletePlaylist->setFlat(TRUE); |
148 | 151 | ||
149 | tbDeletePlaylist->setFixedSize(20,20); | 152 | tbDeletePlaylist->setFixedSize(20,20); |
150 | 153 | ||
151 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", | 154 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", |
152 | this , SLOT(addSelected()) ); | 155 | this , SLOT(addSelected()) ); |
153 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", | 156 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", |
154 | this , SLOT(removeSelected()) ); | 157 | this , SLOT(removeSelected()) ); |
155 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool)/*btnPlay()*/), TRUE ); | 158 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool)/*btnPlay()*/), TRUE ); |
156 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", | 159 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", |
157 | this , SLOT( btnPlay(bool) ), TRUE ); | 160 | this , SLOT( btnPlay(bool) ), TRUE ); |
158 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", | 161 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", |
159 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 162 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
160 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", | 163 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", |
161 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 164 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
162 | tbDeletePlaylist->hide(); | 165 | tbDeletePlaylist->hide(); |
163 | 166 | ||
164 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 167 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
165 | menu->insertItem( tr( "File" ), pmPlayList ); | 168 | menu->insertItem( tr( "File" ), pmPlayList ); |
166 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 169 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
167 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 170 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
168 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 171 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
169 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 172 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
170 | pmPlayList->insertSeparator(-1); | 173 | pmPlayList->insertSeparator(-1); |
171 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 174 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
172 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 175 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
173 | pmPlayList->insertSeparator(-1); | 176 | pmPlayList->insertSeparator(-1); |
174 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 177 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
175 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 178 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
176 | 179 | ||
177 | QPopupMenu *pmView = new QPopupMenu( this ); | 180 | QPopupMenu *pmView = new QPopupMenu( this ); |
178 | menu->insertItem( tr( "View" ), pmView ); | 181 | menu->insertItem( tr( "View" ), pmView ); |
179 | 182 | ||
180 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 183 | fullScreenButton = new QAction(tr("Full Screen"), Opie::Core::OResource::loadPixmap("fullscreen", Opie::Core::OResource::SmallIcon), |
184 | QString::null, 0, this, 0); | ||
181 | fullScreenButton->addTo(pmView); | 185 | fullScreenButton->addTo(pmView); |
182 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); | 186 | scaleButton = new QAction(tr("Scale"), Opie::Core::OResource::loadPixmap("opieplayer/scale", Opie::Core::OResource::SmallIcon), |
187 | QString::null, 0, this, 0); | ||
183 | scaleButton->addTo(pmView); | 188 | scaleButton->addTo(pmView); |
184 | 189 | ||
185 | 190 | ||
186 | skinsMenu = new QPopupMenu( this ); | 191 | skinsMenu = new QPopupMenu( this ); |
187 | menu->insertItem( tr( "Skins" ), skinsMenu ); | 192 | menu->insertItem( tr( "Skins" ), skinsMenu ); |
188 | skinsMenu->isCheckable(); | 193 | skinsMenu->isCheckable(); |
189 | connect( skinsMenu, SIGNAL( activated(int) ) , | 194 | connect( skinsMenu, SIGNAL( activated(int) ) , |
190 | this, SLOT( skinsMenuActivated(int) ) ); | 195 | this, SLOT( skinsMenuActivated(int) ) ); |
191 | populateSkinsMenu(); | 196 | populateSkinsMenu(); |
192 | 197 | ||
193 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 198 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
194 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 199 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
195 | 200 | ||
196 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 201 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
197 | 202 | ||
198 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 203 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
199 | // tabWidget->setTabShape(QTabWidget::Triangular); | 204 | // tabWidget->setTabShape(QTabWidget::Triangular); |
200 | 205 | ||
201 | QWidget *pTab; | 206 | QWidget *pTab; |
202 | pTab = new QWidget( tabWidget, "pTab" ); | 207 | pTab = new QWidget( tabWidget, "pTab" ); |
203 | // playlistView = new QListView( pTab, "playlistview" ); | 208 | // playlistView = new QListView( pTab, "playlistview" ); |
204 | // playlistView->setMinimumSize(236,260); | 209 | // playlistView->setMinimumSize(236,260); |
205 | tabWidget->insertTab( pTab,"Playlist"); | 210 | tabWidget->insertTab( pTab,"Playlist"); |
206 | 211 | ||
207 | 212 | ||
208 | // Add the playlist area | 213 | // Add the playlist area |
209 | 214 | ||
210 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 215 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
211 | d->playListFrame = vbox3; | 216 | d->playListFrame = vbox3; |
212 | 217 | ||
213 | QGridLayout *layoutF = new QGridLayout( pTab ); | 218 | QGridLayout *layoutF = new QGridLayout( pTab ); |
214 | layoutF->setSpacing( 2); | 219 | layoutF->setSpacing( 2); |
215 | layoutF->setMargin( 2); | 220 | layoutF->setMargin( 2); |
216 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); | 221 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); |
217 | 222 | ||
218 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 223 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
219 | 224 | ||
220 | d->selectedFiles = new PlayListSelection( hbox2); | 225 | d->selectedFiles = new PlayListSelection( hbox2); |
221 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 226 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
222 | 227 | ||
223 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 228 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
224 | 229 | ||
225 | 230 | ||
226 | 231 | ||
227 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 232 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
228 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 233 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
229 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 234 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
230 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 235 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
@@ -956,126 +961,126 @@ void PlayListWidget::scanForAudio() { | |||
956 | // odebug << "scan for audio" << oendl; | 961 | // odebug << "scan for audio" << oendl; |
957 | files.detachChildren(); | 962 | files.detachChildren(); |
958 | QListIterator<DocLnk> sdit( files.children() ); | 963 | QListIterator<DocLnk> sdit( files.children() ); |
959 | for ( ; sdit.current(); ++sdit ) { | 964 | for ( ; sdit.current(); ++sdit ) { |
960 | delete sdit.current(); | 965 | delete sdit.current(); |
961 | } | 966 | } |
962 | Global::findDocuments( &files, audioMimes); | 967 | Global::findDocuments( &files, audioMimes); |
963 | audioScan = true; | 968 | audioScan = true; |
964 | } | 969 | } |
965 | void PlayListWidget::scanForVideo() { | 970 | void PlayListWidget::scanForVideo() { |
966 | // odebug << "scan for video" << oendl; | 971 | // odebug << "scan for video" << oendl; |
967 | vFiles.detachChildren(); | 972 | vFiles.detachChildren(); |
968 | QListIterator<DocLnk> sdit( vFiles.children() ); | 973 | QListIterator<DocLnk> sdit( vFiles.children() ); |
969 | for ( ; sdit.current(); ++sdit ) { | 974 | for ( ; sdit.current(); ++sdit ) { |
970 | delete sdit.current(); | 975 | delete sdit.current(); |
971 | } | 976 | } |
972 | Global::findDocuments(&vFiles, "video/*"); | 977 | Global::findDocuments(&vFiles, "video/*"); |
973 | videoScan = true; | 978 | videoScan = true; |
974 | } | 979 | } |
975 | 980 | ||
976 | void PlayListWidget::populateAudioView() { | 981 | void PlayListWidget::populateAudioView() { |
977 | 982 | ||
978 | audioView->clear(); | 983 | audioView->clear(); |
979 | StorageInfo storageInfo; | 984 | StorageInfo storageInfo; |
980 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 985 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
981 | if(!audioScan) scanForAudio(); | 986 | if(!audioScan) scanForAudio(); |
982 | 987 | ||
983 | QListIterator<DocLnk> dit( files.children() ); | 988 | QListIterator<DocLnk> dit( files.children() ); |
984 | QListIterator<FileSystem> it ( fs ); | 989 | QListIterator<FileSystem> it ( fs ); |
985 | 990 | ||
986 | QString storage; | 991 | QString storage; |
987 | for ( ; dit.current(); ++dit ) { | 992 | for ( ; dit.current(); ++dit ) { |
988 | for( ; it.current(); ++it ){ | 993 | for( ; it.current(); ++it ){ |
989 | const QString name = (*it)->name(); | 994 | const QString name = (*it)->name(); |
990 | const QString path = (*it)->path(); | 995 | const QString path = (*it)->path(); |
991 | if(dit.current()->file().find(path) != -1 ) storage=name; | 996 | if(dit.current()->file().find(path) != -1 ) storage=name; |
992 | } | 997 | } |
993 | 998 | ||
994 | QListViewItem * newItem; | 999 | QListViewItem * newItem; |
995 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { | 1000 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { |
996 | long size; | 1001 | long size; |
997 | if( dit.current()->file().left(4) == "http" ) | 1002 | if( dit.current()->file().left(4) == "http" ) |
998 | size=0; | 1003 | size=0; |
999 | else | 1004 | else |
1000 | size = QFile( dit.current()->file() ).size(); | 1005 | size = QFile( dit.current()->file() ).size(); |
1001 | // odebug << dit.current()->name() << oendl; | 1006 | // odebug << dit.current()->name() << oendl; |
1002 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 1007 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
1003 | QString::number(size ), storage, dit.current()->file()); | 1008 | QString::number(size ), storage, dit.current()->file()); |
1004 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); | 1009 | newItem->setPixmap(0, Opie::Core::OResource::loadPixmap( "opieplayer/musicfile", Opie::Core::OResource::SmallIcon )); |
1005 | } | 1010 | } |
1006 | } | 1011 | } |
1007 | 1012 | ||
1008 | } | 1013 | } |
1009 | 1014 | ||
1010 | void PlayListWidget::populateVideoView() { | 1015 | void PlayListWidget::populateVideoView() { |
1011 | videoView->clear(); | 1016 | videoView->clear(); |
1012 | StorageInfo storageInfo; | 1017 | StorageInfo storageInfo; |
1013 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1018 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1014 | 1019 | ||
1015 | if(!videoScan ) scanForVideo(); | 1020 | if(!videoScan ) scanForVideo(); |
1016 | 1021 | ||
1017 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 1022 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
1018 | QListIterator<FileSystem> it ( fs ); | 1023 | QListIterator<FileSystem> it ( fs ); |
1019 | videoView->clear(); | 1024 | videoView->clear(); |
1020 | QString storage; | 1025 | QString storage; |
1021 | for ( ; Vdit.current(); ++Vdit ) { | 1026 | for ( ; Vdit.current(); ++Vdit ) { |
1022 | for( ; it.current(); ++it ){ | 1027 | for( ; it.current(); ++it ){ |
1023 | const QString name = (*it)->name(); | 1028 | const QString name = (*it)->name(); |
1024 | const QString path = (*it)->path(); | 1029 | const QString path = (*it)->path(); |
1025 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 1030 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
1026 | } | 1031 | } |
1027 | 1032 | ||
1028 | QListViewItem * newItem; | 1033 | QListViewItem * newItem; |
1029 | if ( QFile( Vdit.current()->file()).exists() ) { | 1034 | if ( QFile( Vdit.current()->file()).exists() ) { |
1030 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 1035 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
1031 | QString::number( QFile( Vdit.current()->file() ).size() ), | 1036 | QString::number( QFile( Vdit.current()->file() ).size() ), |
1032 | storage, Vdit.current()->file()); | 1037 | storage, Vdit.current()->file()); |
1033 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); | 1038 | newItem->setPixmap(0, Opie::Core::OResource::loadPixmap( "opieplayer/videofile", Opie::Core::OResource::SmallIcon )); |
1034 | } | 1039 | } |
1035 | } | 1040 | } |
1036 | } | 1041 | } |
1037 | 1042 | ||
1038 | void PlayListWidget::openFile() { | 1043 | void PlayListWidget::openFile() { |
1039 | QString filename, name; | 1044 | QString filename, name; |
1040 | InputDialog *fileDlg; | 1045 | InputDialog *fileDlg; |
1041 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1046 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1042 | fileDlg->exec(); | 1047 | fileDlg->exec(); |
1043 | if( fileDlg->result() == 1 ) { | 1048 | if( fileDlg->result() == 1 ) { |
1044 | filename = fileDlg->text(); | 1049 | filename = fileDlg->text(); |
1045 | // odebug << "Selected filename is " + filename << oendl; | 1050 | // odebug << "Selected filename is " + filename << oendl; |
1046 | DocLnk lnk; | 1051 | DocLnk lnk; |
1047 | Config cfg( "OpiePlayer" ); | 1052 | Config cfg( "OpiePlayer" ); |
1048 | cfg.setGroup("PlayList"); | 1053 | cfg.setGroup("PlayList"); |
1049 | 1054 | ||
1050 | QString m3uFile; | 1055 | QString m3uFile; |
1051 | m3uFile = filename; | 1056 | m3uFile = filename; |
1052 | if(filename.left(4) == "http") { | 1057 | if(filename.left(4) == "http") { |
1053 | if(filename.find(":",8,TRUE) != -1) { //found a port | 1058 | if(filename.find(":",8,TRUE) != -1) { //found a port |
1054 | 1059 | ||
1055 | m3uFile = filename; | 1060 | m3uFile = filename; |
1056 | if( m3uFile.right( 1 ).find( '/' ) == -1) { | 1061 | if( m3uFile.right( 1 ).find( '/' ) == -1) { |
1057 | m3uFile += "/"; | 1062 | m3uFile += "/"; |
1058 | } | 1063 | } |
1059 | filename = m3uFile; | 1064 | filename = m3uFile; |
1060 | } | 1065 | } |
1061 | lnk.setName( m3uFile ); //sets name | 1066 | lnk.setName( m3uFile ); //sets name |
1062 | lnk.setFile( filename ); //sets file name | 1067 | lnk.setFile( filename ); //sets file name |
1063 | lnk.setIcon("opieplayer2/musicfile"); | 1068 | lnk.setIcon("opieplayer2/musicfile"); |
1064 | d->selectedFiles->addToSelection( lnk ); | 1069 | d->selectedFiles->addToSelection( lnk ); |
1065 | writeCurrentM3u(); | 1070 | writeCurrentM3u(); |
1066 | } | 1071 | } |
1067 | else if( filename.right( 3) == "m3u" ) { | 1072 | else if( filename.right( 3) == "m3u" ) { |
1068 | readm3u( filename ); | 1073 | readm3u( filename ); |
1069 | 1074 | ||
1070 | } else if( filename.right(3) == "pls" ) { | 1075 | } else if( filename.right(3) == "pls" ) { |
1071 | readPls( filename ); | 1076 | readPls( filename ); |
1072 | } else { | 1077 | } else { |
1073 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name | 1078 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name |
1074 | lnk.setFile( filename ); //sets file name | 1079 | lnk.setFile( filename ); //sets file name |
1075 | d->selectedFiles->addToSelection( lnk); | 1080 | d->selectedFiles->addToSelection( lnk); |
1076 | lnk.removeLinkFile(); | 1081 | lnk.removeLinkFile(); |
1077 | writeCurrentM3u(); | 1082 | writeCurrentM3u(); |
1078 | } | 1083 | } |
1079 | } | 1084 | } |
1080 | 1085 | ||
1081 | if( fileDlg ) { | 1086 | if( fileDlg ) { |
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index c545511..89dd89e 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -1,143 +1,144 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 "videowidget.h" | 21 | #include "videowidget.h" |
22 | #include "mediaplayerstate.h" | 22 | #include "mediaplayerstate.h" |
23 | 23 | ||
24 | /* OPIE */ | 24 | /* OPIE */ |
25 | #include <qpe/resource.h> | ||
26 | #include <qpe/mediaplayerplugininterface.h> | 25 | #include <qpe/mediaplayerplugininterface.h> |
27 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
28 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
29 | #include <opie2/odebug.h> | 28 | #include <opie2/odebug.h> |
29 | #include <opie2/oresource.h> | ||
30 | 30 | ||
31 | /* QT */ | 31 | /* QT */ |
32 | #include <qbitmap.h> | ||
32 | #include <qdir.h> | 33 | #include <qdir.h> |
33 | #include <qslider.h> | 34 | #include <qslider.h> |
34 | 35 | ||
35 | 36 | ||
36 | #ifdef Q_WS_QWS | 37 | #ifdef Q_WS_QWS |
37 | # define USE_DIRECT_PAINTER | 38 | # define USE_DIRECT_PAINTER |
38 | # include <qdirectpainter_qws.h> | 39 | # include <qdirectpainter_qws.h> |
39 | # include <qgfxraster_qws.h> | 40 | # include <qgfxraster_qws.h> |
40 | #endif | 41 | #endif |
41 | 42 | ||
42 | 43 | ||
43 | extern MediaPlayerState *mediaPlayerState; | 44 | extern MediaPlayerState *mediaPlayerState; |
44 | 45 | ||
45 | 46 | ||
46 | static const int xo = 2; // movable x offset | 47 | static const int xo = 2; // movable x offset |
47 | static const int yo = 0; // movable y offset | 48 | static const int yo = 0; // movable y offset |
48 | 49 | ||
49 | 50 | ||
50 | struct MediaButton { | 51 | struct MediaButton { |
51 | // int xPos, yPos; | 52 | // int xPos, yPos; |
52 | bool isToggle, isHeld, isDown; | 53 | bool isToggle, isHeld, isDown; |
53 | // int controlType; | 54 | // int controlType; |
54 | }; | 55 | }; |
55 | 56 | ||
56 | 57 | ||
57 | // Layout information for the videoButtons (and if it is a toggle button or not) | 58 | // Layout information for the videoButtons (and if it is a toggle button or not) |
58 | MediaButton videoButtons[] = { | 59 | MediaButton videoButtons[] = { |
59 | { FALSE, FALSE, FALSE }, // stop | 60 | { FALSE, FALSE, FALSE }, // stop |
60 | { FALSE, FALSE, FALSE }, // play | 61 | { FALSE, FALSE, FALSE }, // play |
61 | { FALSE, FALSE, FALSE }, // previous | 62 | { FALSE, FALSE, FALSE }, // previous |
62 | { FALSE, FALSE, FALSE }, // next | 63 | { FALSE, FALSE, FALSE }, // next |
63 | { FALSE, FALSE, FALSE }, // volUp | 64 | { FALSE, FALSE, FALSE }, // volUp |
64 | { FALSE, FALSE, FALSE }, // volDown | 65 | { FALSE, FALSE, FALSE }, // volDown |
65 | { TRUE, FALSE, FALSE } // fullscreen | 66 | { TRUE, FALSE, FALSE } // fullscreen |
66 | }; | 67 | }; |
67 | 68 | ||
68 | //static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 69 | //static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
69 | 70 | ||
70 | const char *skinV_mask_file_names[7] = { | 71 | const char *skinV_mask_file_names[7] = { |
71 | "stop","play","back","fwd","up","down","full" | 72 | "stop","play","back","fwd","up","down","full" |
72 | }; | 73 | }; |
73 | 74 | ||
74 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 75 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
75 | 76 | ||
76 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 77 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
77 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) | 78 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) |
78 | { | 79 | { |
79 | setCaption( tr("OpiePlayer") ); | 80 | setCaption( tr("OpiePlayer") ); |
80 | Config cfg("OpiePlayer"); | 81 | Config cfg("OpiePlayer"); |
81 | 82 | ||
82 | cfg.setGroup("Options"); | 83 | cfg.setGroup("Options"); |
83 | skin = cfg.readEntry("Skin","default"); | 84 | skin = cfg.readEntry("Skin","default"); |
84 | 85 | ||
85 | QString skinPath; | 86 | QString skinPath; |
86 | skinPath = "opieplayer2/skins/" + skin; | 87 | skinPath = "opieplayer2/skins/" + skin; |
87 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) | 88 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) |
88 | skinPath = "opieplayer2/skins/default"; | 89 | skinPath = "opieplayer2/skins/default"; |
89 | 90 | ||
90 | 91 | ||
91 | // QString skinPath = "opieplayer2/skins/" + skin; | 92 | // QString skinPath = "opieplayer2/skins/" + skin; |
92 | 93 | ||
93 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 94 | pixBg = new QPixmap( Opie::Core::OResource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
94 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 95 | imgUp = new QImage( Opie::Core::OResource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
95 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 96 | imgDn = new QImage( Opie::Core::OResource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
96 | 97 | ||
97 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 98 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
98 | imgButtonMask->fill( 0 ); | 99 | imgButtonMask->fill( 0 ); |
99 | 100 | ||
100 | for ( int i = 0; i < 7; i++ ) { | 101 | for ( int i = 0; i < 7; i++ ) { |
101 | QString filename = QString( QPEApplication::qpeDir() + "pics/" + skinPath + | 102 | QString filename = QString( QPEApplication::qpeDir() + "pics/" + skinPath + |
102 | "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 103 | "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
103 | // odebug << "loading "+filename << oendl; | 104 | // odebug << "loading "+filename << oendl; |
104 | masks[i] = new QBitmap( filename ); | 105 | masks[i] = new QBitmap( filename ); |
105 | 106 | ||
106 | if ( !masks[i]->isNull() ) { | 107 | if ( !masks[i]->isNull() ) { |
107 | QImage imgMask = masks[i]->convertToImage(); | 108 | QImage imgMask = masks[i]->convertToImage(); |
108 | uchar **dest = imgButtonMask->jumpTable(); | 109 | uchar **dest = imgButtonMask->jumpTable(); |
109 | for ( int y = 0; y < imgUp->height(); y++ ) { | 110 | for ( int y = 0; y < imgUp->height(); y++ ) { |
110 | uchar *line = dest[y]; | 111 | uchar *line = dest[y]; |
111 | for ( int x = 0; x < imgUp->width(); x++ ) { | 112 | for ( int x = 0; x < imgUp->width(); x++ ) { |
112 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 113 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
113 | line[x] = i + 1; | 114 | line[x] = i + 1; |
114 | } | 115 | } |
115 | } | 116 | } |
116 | } | 117 | } |
117 | } | 118 | } |
118 | for ( int i = 0; i < 7; i++ ) { | 119 | for ( int i = 0; i < 7; i++ ) { |
119 | buttonPixUp[i] = NULL; | 120 | buttonPixUp[i] = NULL; |
120 | buttonPixDown[i] = NULL; | 121 | buttonPixDown[i] = NULL; |
121 | } | 122 | } |
122 | 123 | ||
123 | QWidget *d = QApplication::desktop(); | 124 | QWidget *d = QApplication::desktop(); |
124 | int width = d->width(); | 125 | int width = d->width(); |
125 | int height = d->height(); | 126 | int height = d->height(); |
126 | 127 | ||
127 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { | 128 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { |
128 | QImage img; | 129 | QImage img; |
129 | img = pixBg->convertToImage(); | 130 | img = pixBg->convertToImage(); |
130 | pixBg->convertFromImage( img.smoothScale( width, height)); | 131 | pixBg->convertFromImage( img.smoothScale( width, height)); |
131 | } | 132 | } |
132 | 133 | ||
133 | setBackgroundPixmap( *pixBg ); | 134 | setBackgroundPixmap( *pixBg ); |
134 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); | 135 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); |
135 | slider = new QSlider( Qt::Horizontal, this ); | 136 | slider = new QSlider( Qt::Horizontal, this ); |
136 | slider->setMinValue( 0 ); | 137 | slider->setMinValue( 0 ); |
137 | slider->setMaxValue( 1 ); | 138 | slider->setMaxValue( 1 ); |
138 | 139 | ||
139 | slider->setBackgroundPixmap( *pixBg ); | 140 | slider->setBackgroundPixmap( *pixBg ); |
140 | slider->setFocusPolicy( QWidget::NoFocus ); | 141 | slider->setFocusPolicy( QWidget::NoFocus ); |
141 | // slider->setGeometry( QRect( 7, 250, 220, 20 ) ); | 142 | // slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |
142 | 143 | ||
143 | connect(slider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); | 144 | connect(slider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); |