summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/main.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp32
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h5
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h2
9 files changed, 36 insertions, 40 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index f6e6086..b573c45 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -26,131 +26,131 @@
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library 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/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <opie/oticker.h> 37#include <opie/oticker.h>
38 38
39#include <qwidget.h> 39#include <qwidget.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qbutton.h> 41#include <qbutton.h>
42#include <qpainter.h> 42#include <qpainter.h>
43#include <qframe.h> 43#include <qframe.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qdir.h> 45#include <qdir.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#include <stdio.h> 47#include <stdio.h>
48 48
49#include "audiowidget.h" 49#include "audiowidget.h"
50#include "mediaplayerstate.h" 50#include "mediaplayerstate.h"
51#include "playlistwidget.h" 51#include "playlistwidget.h"
52 52
53static const int xo = -2; // movable x offset 53static const int xo = -2; // movable x offset
54static const int yo = 22; // movable y offset 54static const int yo = 22; // movable y offset
55 55
56struct MediaButton { 56struct MediaButton {
57 bool isToggle, isHeld, isDown; 57 bool isToggle, isHeld, isDown;
58}; 58};
59 59
60//Layout information for the audioButtons (and if it is a toggle button or not) 60//Layout information for the audioButtons (and if it is a toggle button or not)
61MediaButton audioButtons[] = { 61MediaButton audioButtons[] = {
62 { TRUE, FALSE, FALSE }, // play 62 { TRUE, FALSE, FALSE }, // play
63 { FALSE, FALSE, FALSE }, // stop 63 { FALSE, FALSE, FALSE }, // stop
64 { FALSE, FALSE, FALSE }, // next 64 { FALSE, FALSE, FALSE }, // next
65 { FALSE, FALSE, FALSE }, // previous 65 { FALSE, FALSE, FALSE }, // previous
66 { FALSE, FALSE, FALSE }, // volume up 66 { FALSE, FALSE, FALSE }, // volume up
67 { FALSE, FALSE, FALSE }, // volume down 67 { FALSE, FALSE, FALSE }, // volume down
68 { TRUE, FALSE, FALSE }, // repeat/loop 68 { TRUE, FALSE, FALSE }, // repeat/loop
69 { FALSE, FALSE, FALSE }, // playlist 69 { FALSE, FALSE, FALSE }, // playlist
70 { FALSE, FALSE, FALSE }, // forward 70 { FALSE, FALSE, FALSE }, // forward
71 { FALSE, FALSE, FALSE } // back 71 { FALSE, FALSE, FALSE } // back
72}; 72};
73 73
74const char * const skin_mask_file_names[10] = { 74const char * const skin_mask_file_names[10] = {
75 "play", "stop", "next", "prev", "up", 75 "play", "stop", "next", "prev", "up",
76 "down", "loop", "playlist", "forward", "back" 76 "down", "loop", "playlist", "forward", "back"
77}; 77};
78 78
79 79
80static void changeTextColor( QWidget *w ) { 80static void changeTextColor( QWidget *w ) {
81 QPalette p = w->palette(); 81 QPalette p = w->palette();
82 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 82 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
83 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 83 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
84 w->setPalette( p ); 84 w->setPalette( p );
85} 85}
86 86
87static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 87static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
88 88
89 89
90AudioWidget::AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 90AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
91 91
92 MediaWidget( mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { 92 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) {
93 93
94 setCaption( tr("OpiePlayer") ); 94 setCaption( tr("OpiePlayer") );
95 95
96 Config cfg("OpiePlayer"); 96 Config cfg("OpiePlayer");
97 cfg.setGroup("Options"); 97 cfg.setGroup("Options");
98 skin = cfg.readEntry("Skin","default"); 98 skin = cfg.readEntry("Skin","default");
99 //skin = "scaleTest"; 99 //skin = "scaleTest";
100 // color of background, frame, degree of transparency 100 // color of background, frame, degree of transparency
101 101
102 QString skinPath = "opieplayer2/skins/" + skin; 102 QString skinPath = "opieplayer2/skins/" + skin;
103 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 103 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
104 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 104 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
105 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 105 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
106 106
107 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 107 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
108 imgButtonMask.fill( 0 ); 108 imgButtonMask.fill( 0 );
109 109
110 for ( int i = 0; i < 10; i++ ) { 110 for ( int i = 0; i < 10; i++ ) {
111 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); 111 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" );
112 masks[i] = new QBitmap( filename ); 112 masks[i] = new QBitmap( filename );
113 113
114 if ( !masks[i]->isNull() ) { 114 if ( !masks[i]->isNull() ) {
115 QImage imgMask = masks[i]->convertToImage(); 115 QImage imgMask = masks[i]->convertToImage();
116 uchar **dest = imgButtonMask.jumpTable(); 116 uchar **dest = imgButtonMask.jumpTable();
117 for ( int y = 0; y < imgUp.height(); y++ ) { 117 for ( int y = 0; y < imgUp.height(); y++ ) {
118 uchar *line = dest[y]; 118 uchar *line = dest[y];
119 for ( int x = 0; x < imgUp.width(); x++ ) 119 for ( int x = 0; x < imgUp.width(); x++ )
120 if ( !qRed( imgMask.pixel( x, y ) ) ) 120 if ( !qRed( imgMask.pixel( x, y ) ) )
121 line[x] = i + 1; 121 line[x] = i + 1;
122 } 122 }
123 } 123 }
124 124
125 } 125 }
126 126
127 for ( int i = 0; i < 10; i++ ) { 127 for ( int i = 0; i < 10; i++ ) {
128 buttonPixUp[i] = 0l; 128 buttonPixUp[i] = 0l;
129 buttonPixDown[i] = 0l; 129 buttonPixDown[i] = 0l;
130 } 130 }
131 131
132 setBackgroundPixmap( pixBg ); 132 setBackgroundPixmap( pixBg );
133 133
134 songInfo.setFocusPolicy( QWidget::NoFocus ); 134 songInfo.setFocusPolicy( QWidget::NoFocus );
135// changeTextColor( &songInfo ); 135// changeTextColor( &songInfo );
136// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 136// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
137// songInfo.setFrameStyle( QFrame::NoFrame); 137// songInfo.setFrameStyle( QFrame::NoFrame);
138 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 138 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
139// songInfo.setForegroundColor(Qt::white); 139// songInfo.setForegroundColor(Qt::white);
140 140
141 slider.setFixedHeight( 20 ); 141 slider.setFixedHeight( 20 );
142 slider.setMinValue( 0 ); 142 slider.setMinValue( 0 );
143 slider.setMaxValue( 1 ); 143 slider.setMaxValue( 1 );
144 slider.setFocusPolicy( QWidget::NoFocus ); 144 slider.setFocusPolicy( QWidget::NoFocus );
145 slider.setBackgroundPixmap( pixBg ); 145 slider.setBackgroundPixmap( pixBg );
146 146
147// Config cofg("qpe"); 147// Config cofg("qpe");
148// cofg.setGroup("Appearance"); 148// cofg.setGroup("Appearance");
149// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); 149// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
150 150
151 time.setFocusPolicy( QWidget::NoFocus ); 151 time.setFocusPolicy( QWidget::NoFocus );
152 time.setAlignment( Qt::AlignCenter ); 152 time.setAlignment( Qt::AlignCenter );
153 153
154// time.setFrame(FALSE); 154// time.setFrame(FALSE);
155// changeTextColor( &time ); 155// changeTextColor( &time );
156 156
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index f092699..52a358c 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -1,117 +1,117 @@
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 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
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..}^=.=       =       ; Library 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  -_. . .   )=.  = Library 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#ifndef AUDIO_WIDGET_H 34#ifndef AUDIO_WIDGET_H
35#define AUDIO_WIDGET_H 35#define AUDIO_WIDGET_H
36 36
37#include <qpainter.h> 37#include <qpainter.h>
38#include <qdrawutil.h> 38#include <qdrawutil.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include <qstring.h> 40#include <qstring.h>
41#include <qslider.h> 41#include <qslider.h>
42#include <qframe.h> 42#include <qframe.h>
43#include <qlineedit.h> 43#include <qlineedit.h>
44#include <qimage.h> 44#include <qimage.h>
45 45
46#include <opie/oticker.h> 46#include <opie/oticker.h>
47 47
48#include "mediawidget.h" 48#include "mediawidget.h"
49 49
50class QPixmap; 50class QPixmap;
51 51
52class AudioWidget : public MediaWidget { 52class AudioWidget : public MediaWidget {
53 Q_OBJECT 53 Q_OBJECT
54public: 54public:
55 AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 55 AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
56 ~AudioWidget(); 56 ~AudioWidget();
57 void setTickerText( const QString &text ) { songInfo.setText( text ); } 57 void setTickerText( const QString &text ) { songInfo.setText( text ); }
58public slots: 58public slots:
59 void updateSlider( long, long ); 59 void updateSlider( long, long );
60 void sliderPressed( ); 60 void sliderPressed( );
61 void sliderReleased( ); 61 void sliderReleased( );
62 void setLooping( bool b) { setToggleButton( Loop, b ); } 62 void setLooping( bool b) { setToggleButton( Loop, b ); }
63 void setPosition( long ); 63 void setPosition( long );
64 void setSeekable( bool ); 64 void setSeekable( bool );
65 65
66public: 66public:
67 virtual void setLength( long ); 67 virtual void setLength( long );
68 virtual void setPlaying( bool b) { setToggleButton( Play, b ); } 68 virtual void setPlaying( bool b) { setToggleButton( Play, b ); }
69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 69 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
70 70
71signals: 71signals:
72 void moreClicked(); 72 void moreClicked();
73 void lessClicked(); 73 void lessClicked();
74 void forwardClicked(); 74 void forwardClicked();
75 void backClicked(); 75 void backClicked();
76 void sliderMoved(long); 76 void sliderMoved(long);
77 77
78protected: 78protected:
79 void doBlank(); 79 void doBlank();
80 void doUnblank(); 80 void doUnblank();
81 void paintEvent( QPaintEvent *pe ); 81 void paintEvent( QPaintEvent *pe );
82 void showEvent( QShowEvent *se ); 82 void showEvent( QShowEvent *se );
83 void resizeEvent( QResizeEvent *re ); 83 void resizeEvent( QResizeEvent *re );
84 void mouseMoveEvent( QMouseEvent *event ); 84 void mouseMoveEvent( QMouseEvent *event );
85 void mousePressEvent( QMouseEvent *event ); 85 void mousePressEvent( QMouseEvent *event );
86 void mouseReleaseEvent( QMouseEvent *event ); 86 void mouseReleaseEvent( QMouseEvent *event );
87 void timerEvent( QTimerEvent *event ); 87 void timerEvent( QTimerEvent *event );
88 void keyReleaseEvent( QKeyEvent *e); 88 void keyReleaseEvent( QKeyEvent *e);
89private slots: 89private slots:
90 void skipFor(); 90 void skipFor();
91 void skipBack(); 91 void skipBack();
92 void stopSkip(); 92 void stopSkip();
93private: 93private:
94 void toggleButton( int ); 94 void toggleButton( int );
95 void setToggleButton( int, bool ); 95 void setToggleButton( int, bool );
96 void paintButton( QPainter *p, int i ); 96 void paintButton( QPainter *p, int i );
97 int skipDirection; 97 int skipDirection;
98 QString skin; 98 QString skin;
99 QPixmap pixBg; 99 QPixmap pixBg;
100 QImage imgUp; 100 QImage imgUp;
101 QImage imgDn; 101 QImage imgDn;
102 QImage imgButtonMask; 102 QImage imgButtonMask;
103 QBitmap *masks[10]; 103 QBitmap *masks[10];
104 QPixmap *buttonPixUp[10]; 104 QPixmap *buttonPixUp[10];
105 QPixmap *buttonPixDown[10]; 105 QPixmap *buttonPixDown[10];
106 106
107 QPixmap *pixmaps[4]; 107 QPixmap *pixmaps[4];
108 OTicker songInfo; 108 OTicker songInfo;
109 QSlider slider; 109 QSlider slider;
110 QLineEdit time; 110 QLineEdit time;
111 int xoff, yoff; 111 int xoff, yoff;
112 bool isStreaming : 1; 112 bool isStreaming : 1;
113}; 113};
114 114
115 115
116#endif // AUDIO_WIDGET_H 116#endif // AUDIO_WIDGET_H
117 117
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp
index 7fc7b94..ffc7cb6 100644
--- a/noncore/multimedia/opieplayer2/main.cpp
+++ b/noncore/multimedia/opieplayer2/main.cpp
@@ -1,25 +1,22 @@
1 1
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include "mediaplayerstate.h" 3#include "mediaplayerstate.h"
4#include "playlistwidget.h" 4#include "playlistwidget.h"
5#include "mediaplayer.h" 5#include "mediaplayer.h"
6 6
7PlayListWidget *playList;
8
9int main(int argc, char **argv) { 7int main(int argc, char **argv) {
10 QPEApplication a(argc,argv); 8 QPEApplication a(argc,argv);
11 9
12 MediaPlayerState st( 0, "mediaPlayerState" ); 10 MediaPlayerState st( 0, "mediaPlayerState" );
13 PlayListWidget pl( st, 0, "playList" ); 11 PlayListWidget pl( st, 0, "playList" );
14 playList = &pl;
15 pl.showMaximized(); 12 pl.showMaximized();
16 MediaPlayer mp( st, 0, "mediaPlayer" ); 13 MediaPlayer mp( pl, st, 0, "mediaPlayer" );
17 QObject::connect( &pl, SIGNAL( skinSelected() ), 14 QObject::connect( &pl, SIGNAL( skinSelected() ),
18 &mp, SLOT( recreateAudioAndVideoWidgets() ) ); 15 &mp, SLOT( recreateAudioAndVideoWidgets() ) );
19 16
20 a.showMainDocumentWidget(&pl); 17 a.showMainDocumentWidget(&pl);
21 18
22 return a.exec(); 19 return a.exec();
23} 20}
24 21
25 22
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index a9c74c4..8acc488 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,213 +1,211 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/qlibrary.h> 2#include <qpe/qlibrary.h>
3#include <qpe/resource.h> 3#include <qpe/resource.h>
4#include <qpe/config.h> 4#include <qpe/config.h>
5#include <qpe/qcopenvelope_qws.h> 5#include <qpe/qcopenvelope_qws.h>
6#include <qfileinfo.h> 6#include <qfileinfo.h>
7 7
8#include <qmainwindow.h> 8#include <qmainwindow.h>
9#include <qmessagebox.h> 9#include <qmessagebox.h>
10#include <qwidgetstack.h> 10#include <qwidgetstack.h>
11#include <qfile.h> 11#include <qfile.h>
12 12
13#include "mediaplayer.h" 13#include "mediaplayer.h"
14#include "playlistwidget.h" 14#include "playlistwidget.h"
15#include "audiowidget.h" 15#include "audiowidget.h"
16#include "videowidget.h" 16#include "videowidget.h"
17#include "volumecontrol.h" 17#include "volumecontrol.h"
18 18
19#include "mediaplayerstate.h" 19#include "mediaplayerstate.h"
20 20
21// for setBacklight() 21// for setBacklight()
22#include <linux/fb.h> 22#include <linux/fb.h>
23#include <sys/file.h> 23#include <sys/file.h>
24#include <sys/ioctl.h> 24#include <sys/ioctl.h>
25 25
26 26
27extern VideoWidget *videoUI;
28extern PlayListWidget *playList;
29 27
30 28
31#define FBIOBLANK 0x4611 29#define FBIOBLANK 0x4611
32 30
33MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 31MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
34 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) { 32 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
35 33
36 audioUI = 0; 34 audioUI = 0;
37 videoUI = 0; 35 videoUI = 0;
38 xineControl = 0; 36 xineControl = 0;
39 recreateAudioAndVideoWidgets(); 37 recreateAudioAndVideoWidgets();
40 38
41 fd=-1;fl=-1; 39 fd=-1;fl=-1;
42 playList->setCaption( tr( "OpiePlayer: Initializating" ) ); 40 playList.setCaption( tr( "OpiePlayer: Initializating" ) );
43 41
44 qApp->processEvents(); 42 qApp->processEvents();
45 // QPEApplication::grabKeyboard(); // EVIL 43 // QPEApplication::grabKeyboard(); // EVIL
46 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 44 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
47 45
48 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 46 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
49 47
50 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 48 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
51 49
52 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 50 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
53 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 51 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
54 connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 52 connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
55 53
56 volControl = new VolumeControl; 54 volControl = new VolumeControl;
57 Config cfg( "OpiePlayer" ); 55 Config cfg( "OpiePlayer" );
58 cfg.setGroup("PlayList"); 56 cfg.setGroup("PlayList");
59 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 57 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
60 playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); 58 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
61} 59}
62 60
63MediaPlayer::~MediaPlayer() { 61MediaPlayer::~MediaPlayer() {
64 delete xineControl; 62 delete xineControl;
65 delete volControl; 63 delete volControl;
66} 64}
67 65
68void MediaPlayer::pauseCheck( bool b ) { 66void MediaPlayer::pauseCheck( bool b ) {
69 if ( b && !mediaPlayerState.isPlaying() ) { 67 if ( b && !mediaPlayerState.isPlaying() ) {
70 mediaPlayerState.setPaused( FALSE ); 68 mediaPlayerState.setPaused( FALSE );
71 } 69 }
72} 70}
73 71
74void MediaPlayer::play() { 72void MediaPlayer::play() {
75 mediaPlayerState.setPlaying( FALSE ); 73 mediaPlayerState.setPlaying( FALSE );
76 mediaPlayerState.setPlaying( TRUE ); 74 mediaPlayerState.setPlaying( TRUE );
77} 75}
78 76
79void MediaPlayer::setPlaying( bool play ) { 77void MediaPlayer::setPlaying( bool play ) {
80 if ( !play ) { 78 if ( !play ) {
81 return; 79 return;
82 } 80 }
83 81
84 if ( mediaPlayerState.isPaused() ) { 82 if ( mediaPlayerState.isPaused() ) {
85 mediaPlayerState.setPaused( FALSE ); 83 mediaPlayerState.setPaused( FALSE );
86 return; 84 return;
87 } 85 }
88 86
89 QString tickerText, time, fileName; 87 QString tickerText, time, fileName;
90 if ( playList->currentTab() != PlayListWidget::CurrentPlayList ) { 88 if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) {
91 //if playing in file list.. play in a different way 89 //if playing in file list.. play in a different way
92 // random and looping settings enabled causes problems here, 90 // random and looping settings enabled causes problems here,
93 // since there is no selected file in the playlist, but a selected file in the file list, 91 // since there is no selected file in the playlist, but a selected file in the file list,
94 // so we remember and shutoff 92 // so we remember and shutoff
95 l = mediaPlayerState.isLooping(); 93 l = mediaPlayerState.isLooping();
96 if(l) { 94 if(l) {
97 mediaPlayerState.setLooping( false ); 95 mediaPlayerState.setLooping( false );
98 } 96 }
99 r = mediaPlayerState.isShuffled(); 97 r = mediaPlayerState.isShuffled();
100 mediaPlayerState.setShuffled( false ); 98 mediaPlayerState.setShuffled( false );
101 } 99 }
102 100
103 PlayListWidget::Entry playListEntry = playList->currentEntry(); 101 PlayListWidget::Entry playListEntry = playList.currentEntry();
104 fileName = playListEntry.name; 102 fileName = playListEntry.name;
105 xineControl->play( playListEntry.file ); 103 xineControl->play( playListEntry.file );
106 104
107 long seconds = mediaPlayerState.length(); 105 long seconds = mediaPlayerState.length();
108 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 106 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
109 107
110 if( fileName.left(4) == "http" ) { 108 if( fileName.left(4) == "http" ) {
111 fileName = QFileInfo( fileName ).baseName(); 109 fileName = QFileInfo( fileName ).baseName();
112 if ( xineControl->getMetaInfo().isEmpty() ) { 110 if ( xineControl->getMetaInfo().isEmpty() ) {
113 tickerText = tr( " File: " ) + fileName; 111 tickerText = tr( " File: " ) + fileName;
114 } else { 112 } else {
115 tickerText = xineControl->getMetaInfo(); 113 tickerText = xineControl->getMetaInfo();
116 } 114 }
117 } else { 115 } else {
118 if ( xineControl->getMetaInfo().isEmpty() ) { 116 if ( xineControl->getMetaInfo().isEmpty() ) {
119 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; 117 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " ";
120 } else { 118 } else {
121 tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; 119 tickerText = xineControl->getMetaInfo() + " Length: " + time + " ";
122 } 120 }
123 } 121 }
124 audioUI->setTickerText( tickerText ); 122 audioUI->setTickerText( tickerText );
125} 123}
126 124
127 125
128void MediaPlayer::prev() { 126void MediaPlayer::prev() {
129 if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist 127 if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
130 if ( playList->prev() ) { 128 if ( playList.prev() ) {
131 play(); 129 play();
132 } else if ( mediaPlayerState.isLooping() ) { 130 } else if ( mediaPlayerState.isLooping() ) {
133 if ( playList->last() ) { 131 if ( playList.last() ) {
134 play(); 132 play();
135 } 133 }
136 } else { 134 } else {
137 mediaPlayerState.setList(); 135 mediaPlayerState.setList();
138 } 136 }
139 } 137 }
140} 138}
141 139
142 140
143void MediaPlayer::next() { 141void MediaPlayer::next() {
144 142
145 if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist 143 if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
146 if ( playList->next() ) { 144 if ( playList.next() ) {
147 play(); 145 play();
148 } else if ( mediaPlayerState.isLooping() ) { 146 } else if ( mediaPlayerState.isLooping() ) {
149 if ( playList->first() ) { 147 if ( playList.first() ) {
150 play(); 148 play();
151 } 149 }
152 } else { 150 } else {
153 mediaPlayerState.setList(); 151 mediaPlayerState.setList();
154 } 152 }
155 } else { //if playing from file list, let's just stop 153 } else { //if playing from file list, let's just stop
156 qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); 154 qDebug("<<<<<<<<<<<<<<<<<stop for filelists");
157 mediaPlayerState.setPlaying(false); 155 mediaPlayerState.setPlaying(false);
158 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); 156 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection );
159 if(l) mediaPlayerState.setLooping(l); 157 if(l) mediaPlayerState.setLooping(l);
160 if(r) mediaPlayerState.setShuffled(r); 158 if(r) mediaPlayerState.setShuffled(r);
161 } 159 }
162 qApp->processEvents(); 160 qApp->processEvents();
163} 161}
164 162
165 163
166void MediaPlayer::startDecreasingVolume() { 164void MediaPlayer::startDecreasingVolume() {
167 volumeDirection = -1; 165 volumeDirection = -1;
168 startTimer( 100 ); 166 startTimer( 100 );
169 volControl->decVol(2); 167 volControl->decVol(2);
170} 168}
171 169
172 170
173void MediaPlayer::startIncreasingVolume() { 171void MediaPlayer::startIncreasingVolume() {
174 volumeDirection = +1; 172 volumeDirection = +1;
175 startTimer( 100 ); 173 startTimer( 100 );
176 volControl->incVol(2); 174 volControl->incVol(2);
177} 175}
178 176
179 177
180bool drawnOnScreenDisplay = FALSE; 178bool drawnOnScreenDisplay = FALSE;
181unsigned int onScreenDisplayVolume = 0; 179unsigned int onScreenDisplayVolume = 0;
182const int yoff = 110; 180const int yoff = 110;
183 181
184void MediaPlayer::stopChangingVolume() { 182void MediaPlayer::stopChangingVolume() {
185 killTimers(); 183 killTimers();
186 // Get rid of the on-screen display stuff 184 // Get rid of the on-screen display stuff
187 drawnOnScreenDisplay = FALSE; 185 drawnOnScreenDisplay = FALSE;
188 onScreenDisplayVolume = 0; 186 onScreenDisplayVolume = 0;
189 int w=0; 187 int w=0;
190 int h=0; 188 int h=0;
191 if( !xineControl->hasVideo() ) { 189 if( !xineControl->hasVideo() ) {
192 w = audioUI->width(); 190 w = audioUI->width();
193 h = audioUI->height(); 191 h = audioUI->height();
194 audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 192 audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
195 } else { 193 } else {
196 w = videoUI->width(); 194 w = videoUI->width();
197 h = videoUI->height(); 195 h = videoUI->height();
198 videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 196 videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
199 } 197 }
200} 198}
201 199
202 200
203void MediaPlayer::timerEvent( QTimerEvent * ) { 201void MediaPlayer::timerEvent( QTimerEvent * ) {
204 if ( volumeDirection == +1 ) { 202 if ( volumeDirection == +1 ) {
205 volControl->incVol( 2 ); 203 volControl->incVol( 2 );
206 } else if ( volumeDirection == -1 ) { 204 } else if ( volumeDirection == -1 ) {
207 volControl->decVol( 2 ); 205 volControl->decVol( 2 );
208 } 206 }
209 207
210 208
211 // TODO FIXME 209 // TODO FIXME
212 // huh?? 210 // huh??
213 unsigned int v= 0; 211 unsigned int v= 0;
@@ -278,91 +276,91 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
278 } 276 }
279} 277}
280 278
281 279
282void MediaPlayer::blank( bool b ) { 280void MediaPlayer::blank( bool b ) {
283 fd=open("/dev/fb0",O_RDWR); 281 fd=open("/dev/fb0",O_RDWR);
284#ifdef QT_QWS_EBX 282#ifdef QT_QWS_EBX
285 fl= open( "/dev/fl", O_RDWR ); 283 fl= open( "/dev/fl", O_RDWR );
286#endif 284#endif
287 if (fd != -1) { 285 if (fd != -1) {
288 if ( b ) { 286 if ( b ) {
289 qDebug("do blanking"); 287 qDebug("do blanking");
290#ifdef QT_QWS_EBX 288#ifdef QT_QWS_EBX
291 ioctl( fd, FBIOBLANK, 1 ); 289 ioctl( fd, FBIOBLANK, 1 );
292 if(fl !=-1) { 290 if(fl !=-1) {
293 ioctl( fl, 2 ); 291 ioctl( fl, 2 );
294 ::close(fl); 292 ::close(fl);
295 } 293 }
296#else 294#else
297 ioctl( fd, FBIOBLANK, 3 ); 295 ioctl( fd, FBIOBLANK, 3 );
298#endif 296#endif
299 isBlanked = TRUE; 297 isBlanked = TRUE;
300 } else { 298 } else {
301 qDebug("do unblanking"); 299 qDebug("do unblanking");
302 ioctl( fd, FBIOBLANK, 0); 300 ioctl( fd, FBIOBLANK, 0);
303#ifdef QT_QWS_EBX 301#ifdef QT_QWS_EBX
304 if(fl != -1) { 302 if(fl != -1) {
305 ioctl( fl, 1); 303 ioctl( fl, 1);
306 ::close(fl); 304 ::close(fl);
307 } 305 }
308#endif 306#endif
309 isBlanked = FALSE; 307 isBlanked = FALSE;
310 } 308 }
311 close( fd ); 309 close( fd );
312 } else { 310 } else {
313 qDebug("<< /dev/fb0 could not be opened >>"); 311 qDebug("<< /dev/fb0 could not be opened >>");
314 } 312 }
315} 313}
316 314
317void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 315void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
318 switch ( e->key() ) { 316 switch ( e->key() ) {
319////////////////////////////// Zaurus keys 317////////////////////////////// Zaurus keys
320 case Key_Home: 318 case Key_Home:
321 break; 319 break;
322 case Key_F9: //activity 320 case Key_F9: //activity
323 break; 321 break;
324 case Key_F10: //contacts 322 case Key_F10: //contacts
325 break; 323 break;
326 case Key_F11: //menu 324 case Key_F11: //menu
327 break; 325 break;
328 case Key_F12: //home 326 case Key_F12: //home
329 qDebug("Blank here"); 327 qDebug("Blank here");
330// mediaPlayerState->toggleBlank(); 328// mediaPlayerState->toggleBlank();
331 break; 329 break;
332 case Key_F13: //mail 330 case Key_F13: //mail
333 qDebug("Blank here"); 331 qDebug("Blank here");
334 // mediaPlayerState->toggleBlank(); 332 // mediaPlayerState->toggleBlank();
335 break; 333 break;
336 } 334 }
337} 335}
338 336
339void MediaPlayer::cleanUp() {// this happens on closing 337void MediaPlayer::cleanUp() {// this happens on closing
340 Config cfg( "OpiePlayer" ); 338 Config cfg( "OpiePlayer" );
341 mediaPlayerState.writeConfig( cfg ); 339 mediaPlayerState.writeConfig( cfg );
342 playList->writeDefaultPlaylist( ); 340 playList.writeDefaultPlaylist( );
343 341
344// QPEApplication::grabKeyboard(); 342// QPEApplication::grabKeyboard();
345// QPEApplication::ungrabKeyboard(); 343// QPEApplication::ungrabKeyboard();
346} 344}
347 345
348void MediaPlayer::recreateAudioAndVideoWidgets() 346void MediaPlayer::recreateAudioAndVideoWidgets()
349{ 347{
350 delete xineControl; 348 delete xineControl;
351 delete audioUI; 349 delete audioUI;
352 delete videoUI; 350 delete videoUI;
353 audioUI = new AudioWidget( mediaPlayerState, 0, "audioUI" ); 351 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
354 videoUI = new VideoWidget( mediaPlayerState, 0, "videoUI" ); 352 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
355 353
356 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 354 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
357 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 355 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
358 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 356 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
359 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 357 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
360 358
361 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 359 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
362 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 360 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
363 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 361 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
364 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 362 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
365 363
366 xineControl = new XineControl( videoUI, mediaPlayerState ); 364 xineControl = new XineControl( videoUI, mediaPlayerState );
367} 365}
368 366
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index 0d6f722..dc306c4 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -1,86 +1,89 @@
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 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <> 5 Copyright (c) 2002 LJP <>
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
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..}^=.=       =       ; Library 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  -_. . .   )=.  = Library 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#ifndef MEDIA_PLAYER_H 34#ifndef MEDIA_PLAYER_H
35#define MEDIA_PLAYER_H 35#define MEDIA_PLAYER_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qframe.h> 38#include <qframe.h>
39 39
40#include "xinecontrol.h" 40#include "xinecontrol.h"
41 41
42#include "playlistwidget.h"
43
42class DocLnk; 44class DocLnk;
43class VolumeControl; 45class VolumeControl;
44class MediaPlayerState; 46class MediaPlayerState;
45class AudioWidget; 47class AudioWidget;
46class VideoWidget; 48class VideoWidget;
47 49
48class MediaPlayer : public QObject { 50class MediaPlayer : public QObject {
49 Q_OBJECT 51 Q_OBJECT
50public: 52public:
51 MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); 53 MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name );
52 ~MediaPlayer(); 54 ~MediaPlayer();
53 55
54public slots: 56public slots:
55 void recreateAudioAndVideoWidgets(); 57 void recreateAudioAndVideoWidgets();
56 58
57private slots: 59private slots:
58 void setPlaying( bool ); 60 void setPlaying( bool );
59 void pauseCheck( bool ); 61 void pauseCheck( bool );
60 void play(); 62 void play();
61 void next(); 63 void next();
62 void prev(); 64 void prev();
63 void startIncreasingVolume(); 65 void startIncreasingVolume();
64 void startDecreasingVolume(); 66 void startDecreasingVolume();
65 void stopChangingVolume(); 67 void stopChangingVolume();
66 void cleanUp(); 68 void cleanUp();
67 void blank( bool ); 69 void blank( bool );
68 70
69protected: 71protected:
70 void timerEvent( QTimerEvent *e ); 72 void timerEvent( QTimerEvent *e );
71 void keyReleaseEvent( QKeyEvent *e); 73 void keyReleaseEvent( QKeyEvent *e);
72private: 74private:
73 75
74 bool isBlanked, l, r; 76 bool isBlanked, l, r;
75 int fd, fl; 77 int fd, fl;
76 int volumeDirection; 78 int volumeDirection;
77 XineControl *xineControl; 79 XineControl *xineControl;
78 VolumeControl *volControl; 80 VolumeControl *volControl;
79 MediaPlayerState &mediaPlayerState; 81 MediaPlayerState &mediaPlayerState;
82 PlayListWidget &playList;
80 AudioWidget *audioUI; 83 AudioWidget *audioUI;
81 VideoWidget *videoUI; 84 VideoWidget *videoUI;
82}; 85};
83 86
84 87
85#endif // MEDIA_PLAYER_H 88#endif // MEDIA_PLAYER_H
86 89
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 2992fd6..ed5bc5a 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -1,63 +1,61 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> 2 Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20 20
21#include "mediawidget.h" 21#include "mediawidget.h"
22#include "playlistwidget.h" 22#include "playlistwidget.h"
23 23
24extern PlayListWidget *playList; 24MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
25 25 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
26MediaWidget::MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
27 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState )
28{ 26{
29 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), 27 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
30 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 28 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
31 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), 29 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ),
32 this, SLOT( setLength( long ) ) ); 30 this, SLOT( setLength( long ) ) );
33 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 31 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
34 this, SLOT( setPlaying( bool ) ) ); 32 this, SLOT( setPlaying( bool ) ) );
35} 33}
36 34
37MediaWidget::~MediaWidget() 35MediaWidget::~MediaWidget()
38{ 36{
39} 37}
40 38
41void MediaWidget::closeEvent( QCloseEvent * ) 39void MediaWidget::closeEvent( QCloseEvent * )
42{ 40{
43 mediaPlayerState.setList(); 41 mediaPlayerState.setList();
44} 42}
45 43
46void MediaWidget::handleCommand( Command command, bool buttonDown ) 44void MediaWidget::handleCommand( Command command, bool buttonDown )
47{ 45{
48 switch ( command ) { 46 switch ( command ) {
49 case Play: mediaPlayerState.togglePaused(); 47 case Play: mediaPlayerState.togglePaused();
50 case Stop: mediaPlayerState.setPlaying(FALSE); return; 48 case Stop: mediaPlayerState.setPlaying(FALSE); return;
51 case Next: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; 49 case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
52 case Previous: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; 50 case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
53 case Loop: mediaPlayerState.setLooping( buttonDown ); return; 51 case Loop: mediaPlayerState.setLooping( buttonDown ); return;
54 case VolumeUp: emit moreReleased(); return; 52 case VolumeUp: emit moreReleased(); return;
55 case VolumeDown: emit lessReleased(); return; 53 case VolumeDown: emit lessReleased(); return;
56 case PlayList: mediaPlayerState.setList(); return; 54 case PlayList: mediaPlayerState.setList(); return;
57 case Forward: emit forwardReleased(); return; 55 case Forward: emit forwardReleased(); return;
58 case Back: emit backReleased(); return; 56 case Back: emit backReleased(); return;
59 } 57 }
60} 58}
61 59
62/* vim: et sw=4 ts=4 60/* vim: et sw=4 ts=4
63 */ 61 */
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index e3f09ce..2d92d65 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -1,57 +1,59 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> 2 Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef MEDIAWIDGET_H 20#ifndef MEDIAWIDGET_H
21#define MEDIAWIDGET_H 21#define MEDIAWIDGET_H
22 22
23#include <qwidget.h> 23#include <qwidget.h>
24 24
25#include "mediaplayerstate.h" 25#include "mediaplayerstate.h"
26#include "playlistwidget.h"
26 27
27class MediaWidget : public QWidget 28class MediaWidget : public QWidget
28{ 29{
29 Q_OBJECT 30 Q_OBJECT
30public: 31public:
31 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; 32 enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back };
32 33
33 MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 34 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
34 virtual ~MediaWidget(); 35 virtual ~MediaWidget();
35 36
36public slots: 37public slots:
37 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; 38 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0;
38 virtual void setLength( long length ) = 0; 39 virtual void setLength( long length ) = 0;
39 virtual void setPlaying( bool playing ) = 0; 40 virtual void setPlaying( bool playing ) = 0;
40 41
41signals: 42signals:
42 void moreReleased(); 43 void moreReleased();
43 void lessReleased(); 44 void lessReleased();
44 void forwardReleased(); 45 void forwardReleased();
45 void backReleased(); 46 void backReleased();
46 47
47protected: 48protected:
48 virtual void closeEvent( QCloseEvent * ); 49 virtual void closeEvent( QCloseEvent * );
49 50
50 void handleCommand( Command command, bool buttonDown ); 51 void handleCommand( Command command, bool buttonDown );
51 52
52 MediaPlayerState &mediaPlayerState; 53 MediaPlayerState &mediaPlayerState;
54 PlayListWidget &playList;
53}; 55};
54 56
55#endif // MEDIAWIDGET_H 57#endif // MEDIAWIDGET_H
56/* vim: et sw=4 ts=4 58/* vim: et sw=4 ts=4
57 */ 59 */
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index c0039b1..b7305fe 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,151 +1,149 @@
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 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
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..}^=.=       =       ; Library 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  -_. . .   )=.  = Library 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/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37 37
38 38
39#include <qwidget.h> 39#include <qwidget.h>
40#include <qpainter.h> 40#include <qpainter.h>
41#include <qpixmap.h> 41#include <qpixmap.h>
42#include <qslider.h> 42#include <qslider.h>
43#include <qdrawutil.h> 43#include <qdrawutil.h>
44#include "videowidget.h" 44#include "videowidget.h"
45#include "mediaplayerstate.h" 45#include "mediaplayerstate.h"
46#include "playlistwidget.h" 46#include "playlistwidget.h"
47 47
48 48
49#ifdef Q_WS_QWS 49#ifdef Q_WS_QWS
50# define USE_DIRECT_PAINTER 50# define USE_DIRECT_PAINTER
51# include <qdirectpainter_qws.h> 51# include <qdirectpainter_qws.h>
52# include <qgfxraster_qws.h> 52# include <qgfxraster_qws.h>
53#endif 53#endif
54 54
55 55
56extern PlayListWidget *playList;
57 56
58 57
59static const int xo = 2; // movable x offset 58static const int xo = 2; // movable x offset
60static const int yo = 0; // movable y offset 59static const int yo = 0; // movable y offset
61 60
62 61
63struct MediaButton { 62struct MediaButton {
64 bool isToggle, isHeld, isDown; 63 bool isToggle, isHeld, isDown;
65}; 64};
66 65
67MediaButton videoButtons[] = { 66MediaButton videoButtons[] = {
68 { FALSE, FALSE, FALSE }, // stop 67 { FALSE, FALSE, FALSE }, // stop
69 { TRUE, FALSE, FALSE }, // play 68 { TRUE, FALSE, FALSE }, // play
70 { FALSE, FALSE, FALSE }, // previous 69 { FALSE, FALSE, FALSE }, // previous
71 { FALSE, FALSE, FALSE }, // next 70 { FALSE, FALSE, FALSE }, // next
72 { FALSE, FALSE, FALSE }, // volUp 71 { FALSE, FALSE, FALSE }, // volUp
73 { FALSE, FALSE, FALSE }, // volDown 72 { FALSE, FALSE, FALSE }, // volDown
74 { TRUE, FALSE, FALSE } // fullscreen 73 { TRUE, FALSE, FALSE } // fullscreen
75}; 74};
76 75
77const char *skinV_mask_file_names[7] = { 76const char *skinV_mask_file_names[7] = {
78"stop","play","back","fwd","up","down","full" 77"stop","play","back","fwd","up","down","full"
79}; 78};
80 79
81static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 80static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
82 81
83 82
84VideoWidget::VideoWidget(MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 83VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
85MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { 84 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 )
86 85{
87
88 setCaption( tr("OpiePlayer - Video") ); 86 setCaption( tr("OpiePlayer - Video") );
89 87
90 videoFrame = new XineVideoWidget ( this, "Video frame" ); 88 videoFrame = new XineVideoWidget ( this, "Video frame" );
91 89
92 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 90 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
93 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 91 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
94 92
95 Config cfg("OpiePlayer"); 93 Config cfg("OpiePlayer");
96 cfg.setGroup("Options"); 94 cfg.setGroup("Options");
97 skin = cfg.readEntry("Skin","default"); 95 skin = cfg.readEntry("Skin","default");
98 96
99 QString skinPath = "opieplayer2/skins/" + skin; 97 QString skinPath = "opieplayer2/skins/" + skin;
100 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 98 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
101 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 99 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
102 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 100 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
103 101
104 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 102 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
105 imgButtonMask.fill( 0 ); 103 imgButtonMask.fill( 0 );
106 104
107 for ( int i = 0; i < 7; i++ ) { 105 for ( int i = 0; i < 7; i++ ) {
108 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); 106 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
109 masks[i] = new QBitmap( filename ); 107 masks[i] = new QBitmap( filename );
110 108
111 if ( !masks[i]->isNull() ) { 109 if ( !masks[i]->isNull() ) {
112 QImage imgMask = masks[i]->convertToImage(); 110 QImage imgMask = masks[i]->convertToImage();
113 uchar **dest = imgButtonMask.jumpTable(); 111 uchar **dest = imgButtonMask.jumpTable();
114 for ( int y = 0; y < imgUp.height(); y++ ) { 112 for ( int y = 0; y < imgUp.height(); y++ ) {
115 uchar *line = dest[y]; 113 uchar *line = dest[y];
116 for ( int x = 0; x < imgUp.width(); x++ ) { 114 for ( int x = 0; x < imgUp.width(); x++ ) {
117 if ( !qRed( imgMask.pixel( x, y ) ) ) 115 if ( !qRed( imgMask.pixel( x, y ) ) )
118 line[x] = i + 1; 116 line[x] = i + 1;
119 } 117 }
120 } 118 }
121 } 119 }
122 } 120 }
123 121
124 for ( int i = 0; i < 7; i++ ) { 122 for ( int i = 0; i < 7; i++ ) {
125 buttonPixUp[i] = NULL; 123 buttonPixUp[i] = NULL;
126 buttonPixDown[i] = NULL; 124 buttonPixDown[i] = NULL;
127 } 125 }
128 126
129 setBackgroundPixmap( pixBg ); 127 setBackgroundPixmap( pixBg );
130 128
131 slider = new QSlider( Qt::Horizontal, this ); 129 slider = new QSlider( Qt::Horizontal, this );
132 slider->setMinValue( 0 ); 130 slider->setMinValue( 0 );
133 slider->setMaxValue( 1 ); 131 slider->setMaxValue( 1 );
134 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 132 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
135 //slider->setFocusPolicy( QWidget::NoFocus ); 133 //slider->setFocusPolicy( QWidget::NoFocus );
136 134
137 resizeEvent( NULL ); 135 resizeEvent( NULL );
138 136
139 setLength( mediaPlayerState.length() ); 137 setLength( mediaPlayerState.length() );
140 setPosition( mediaPlayerState.position() ); 138 setPosition( mediaPlayerState.position() );
141 setFullscreen( mediaPlayerState.isFullscreen() ); 139 setFullscreen( mediaPlayerState.isFullscreen() );
142 setPlaying( mediaPlayerState.isPlaying() ); 140 setPlaying( mediaPlayerState.isPlaying() );
143} 141}
144 142
145 143
146VideoWidget::~VideoWidget() { 144VideoWidget::~VideoWidget() {
147 145
148 for ( int i = 0; i < 7; i++ ) { 146 for ( int i = 0; i < 7; i++ ) {
149 delete buttonPixUp[i]; 147 delete buttonPixUp[i];
150 delete buttonPixDown[i]; 148 delete buttonPixDown[i];
151 } 149 }
@@ -271,130 +269,130 @@ void VideoWidget::toggleButton( int i ) {
271 paintButton ( &p, i ); 269 paintButton ( &p, i );
272} 270}
273 271
274void VideoWidget::paintButton( QPainter *p, int i ) { 272void VideoWidget::paintButton( QPainter *p, int i ) {
275 273
276 if ( videoButtons[i].isDown ) { 274 if ( videoButtons[i].isDown ) {
277 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 275 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
278 } else { 276 } else {
279 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 277 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
280 } 278 }
281} 279}
282 280
283void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 281void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
284 for ( int i = 0; i < numVButtons; i++ ) { 282 for ( int i = 0; i < numVButtons; i++ ) {
285 if ( event->state() == QMouseEvent::LeftButton ) { 283 if ( event->state() == QMouseEvent::LeftButton ) {
286 // The test to see if the mouse click is inside the button or not 284 // The test to see if the mouse click is inside the button or not
287 int x = event->pos().x() - xoff; 285 int x = event->pos().x() - xoff;
288 int y = event->pos().y() - yoff; 286 int y = event->pos().y() - yoff;
289 287
290 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() 288 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width()
291 && y < imgButtonMask.height() 289 && y < imgButtonMask.height()
292 && imgButtonMask.pixelIndex( x, y ) == i + 1 ); 290 && imgButtonMask.pixelIndex( x, y ) == i + 1 );
293 291
294 if ( isOnButton && !videoButtons[i].isHeld ) { 292 if ( isOnButton && !videoButtons[i].isHeld ) {
295 videoButtons[i].isHeld = TRUE; 293 videoButtons[i].isHeld = TRUE;
296 toggleButton(i); 294 toggleButton(i);
297 295
298 switch (i) { 296 switch (i) {
299 case VideoVolUp: 297 case VideoVolUp:
300 emit moreClicked(); 298 emit moreClicked();
301 return; 299 return;
302 case VideoVolDown: 300 case VideoVolDown:
303 emit lessClicked(); 301 emit lessClicked();
304 return; 302 return;
305 } 303 }
306 } else if ( !isOnButton && videoButtons[i].isHeld ) { 304 } else if ( !isOnButton && videoButtons[i].isHeld ) {
307 videoButtons[i].isHeld = FALSE; 305 videoButtons[i].isHeld = FALSE;
308 toggleButton(i); 306 toggleButton(i);
309 } 307 }
310 } else { 308 } else {
311 309
312 if ( videoButtons[i].isHeld ) { 310 if ( videoButtons[i].isHeld ) {
313 videoButtons[i].isHeld = FALSE; 311 videoButtons[i].isHeld = FALSE;
314 if ( !videoButtons[i].isToggle ) { 312 if ( !videoButtons[i].isToggle ) {
315 setToggleButton( i, FALSE ); 313 setToggleButton( i, FALSE );
316 } 314 }
317 315
318 switch(i) { 316 switch(i) {
319 317
320 case VideoPlay: { 318 case VideoPlay: {
321 if( mediaPlayerState.isPaused() ) { 319 if( mediaPlayerState.isPaused() ) {
322 setToggleButton( i, FALSE ); 320 setToggleButton( i, FALSE );
323 mediaPlayerState.setPaused( FALSE ); 321 mediaPlayerState.setPaused( FALSE );
324 return; 322 return;
325 } else if( !mediaPlayerState.isPaused() ) { 323 } else if( !mediaPlayerState.isPaused() ) {
326 setToggleButton( i, TRUE ); 324 setToggleButton( i, TRUE );
327 mediaPlayerState.setPaused( TRUE ); 325 mediaPlayerState.setPaused( TRUE );
328 return; 326 return;
329 } else { 327 } else {
330 return; 328 return;
331 } 329 }
332 } 330 }
333 331
334 case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; 332 case VideoStop: mediaPlayerState.setPlaying( FALSE ); return;
335 case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; 333 case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
336 case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; 334 case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
337 case VideoVolUp: emit moreReleased(); return; 335 case VideoVolUp: emit moreReleased(); return;
338 case VideoVolDown: emit lessReleased(); return; 336 case VideoVolDown: emit lessReleased(); return;
339 case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; 337 case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return;
340 } 338 }
341 } 339 }
342 } 340 }
343 } 341 }
344} 342}
345 343
346void VideoWidget::mousePressEvent( QMouseEvent *event ) { 344void VideoWidget::mousePressEvent( QMouseEvent *event ) {
347 mouseMoveEvent( event ); 345 mouseMoveEvent( event );
348} 346}
349 347
350void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 348void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
351 if ( mediaPlayerState.isFullscreen() ) { 349 if ( mediaPlayerState.isFullscreen() ) {
352 mediaPlayerState.setFullscreen( FALSE ); 350 mediaPlayerState.setFullscreen( FALSE );
353 makeVisible(); 351 makeVisible();
354 } 352 }
355 mouseMoveEvent( event ); 353 mouseMoveEvent( event );
356} 354}
357 355
358void VideoWidget::showEvent( QShowEvent* ) { 356void VideoWidget::showEvent( QShowEvent* ) {
359 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 357 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
360 mouseMoveEvent( &event ); 358 mouseMoveEvent( &event );
361} 359}
362 360
363 361
364 void VideoWidget::backToNormal() { 362 void VideoWidget::backToNormal() {
365 mediaPlayerState.setFullscreen( FALSE ); 363 mediaPlayerState.setFullscreen( FALSE );
366 makeVisible(); 364 makeVisible();
367 } 365 }
368 366
369void VideoWidget::makeVisible() { 367void VideoWidget::makeVisible() {
370 if ( mediaPlayerState.isFullscreen() ) { 368 if ( mediaPlayerState.isFullscreen() ) {
371 setBackgroundMode( QWidget::NoBackground ); 369 setBackgroundMode( QWidget::NoBackground );
372 showFullScreen(); 370 showFullScreen();
373 resize( qApp->desktop()->size() ); 371 resize( qApp->desktop()->size() );
374 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 372 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
375 373
376 slider->hide(); 374 slider->hide();
377 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 375 disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
378 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 376 disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
379 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 377 disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
380 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 378 disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
381 379
382 } else { 380 } else {
383 showNormal(); 381 showNormal();
384 showMaximized(); 382 showMaximized();
385 setBackgroundPixmap( pixBg ); 383 setBackgroundPixmap( pixBg );
386 QWidget *d = QApplication::desktop(); 384 QWidget *d = QApplication::desktop();
387 int w = d->width(); 385 int w = d->width();
388 int h = d->height(); 386 int h = d->height();
389 387
390 if(w>h) { 388 if(w>h) {
391 int newW=(w/2)-(246/2); //this will only work with 320x240 389 int newW=(w/2)-(246/2); //this will only work with 320x240
392 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); 390 videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) );
393 } else { 391 } else {
394 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); 392 videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
395 } 393 }
396 394
397 if ( !mediaPlayerState.isSeekable() ) { 395 if ( !mediaPlayerState.isSeekable() ) {
398 if( !slider->isHidden()) { 396 if( !slider->isHidden()) {
399 slider->hide(); 397 slider->hide();
400 } 398 }
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index ae0e687..f996803 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -1,125 +1,125 @@
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 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
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..}^=.=       =       ; Library 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  -_. . .   )=.  = Library 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#ifndef VIDEO_WIDGET_H 34#ifndef VIDEO_WIDGET_H
35#define VIDEO_WIDGET_H 35#define VIDEO_WIDGET_H
36 36
37#include <qwidget.h> 37#include <qwidget.h>
38#include <qimage.h> 38#include <qimage.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include "xinevideowidget.h" 40#include "xinevideowidget.h"
41 41
42#include "mediawidget.h" 42#include "mediawidget.h"
43 43
44class QPixmap; 44class QPixmap;
45class QSlider; 45class QSlider;
46 46
47enum VideoButtons { 47enum VideoButtons {
48 VideoStop = 0, 48 VideoStop = 0,
49 VideoPlay, 49 VideoPlay,
50// VideoPause, 50// VideoPause,
51 VideoPrevious, 51 VideoPrevious,
52 VideoNext, 52 VideoNext,
53 VideoVolUp, 53 VideoVolUp,
54 VideoVolDown, 54 VideoVolDown,
55 VideoFullscreen 55 VideoFullscreen
56}; 56};
57 57
58class VideoWidget : public MediaWidget { 58class VideoWidget : public MediaWidget {
59 Q_OBJECT 59 Q_OBJECT
60public: 60public:
61 VideoWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); 61 VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
62 ~VideoWidget(); 62 ~VideoWidget();
63 63
64 64
65 XineVideoWidget* vidWidget(); 65 XineVideoWidget* vidWidget();
66public slots: 66public slots:
67 void updateSlider( long, long ); 67 void updateSlider( long, long );
68 void sliderPressed( ); 68 void sliderPressed( );
69 void sliderReleased( ); 69 void sliderReleased( );
70 void setFullscreen( bool b ); 70 void setFullscreen( bool b );
71 void makeVisible(); 71 void makeVisible();
72 void backToNormal(); 72 void backToNormal();
73 void setPosition( long ); 73 void setPosition( long );
74 74
75public: 75public:
76 virtual void setPlaying( bool b); 76 virtual void setPlaying( bool b);
77 virtual void setLength( long ); 77 virtual void setLength( long );
78 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); 78 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
79 79
80signals: 80signals:
81 void moreClicked(); 81 void moreClicked();
82 void lessClicked(); 82 void lessClicked();
83 void moreReleased(); 83 void moreReleased();
84 void lessReleased(); 84 void lessReleased();
85 void sliderMoved( long ); 85 void sliderMoved( long );
86 void videoResized ( const QSize &s ); 86 void videoResized ( const QSize &s );
87 87
88protected: 88protected:
89 89
90 void resizeEvent( QResizeEvent * ); 90 void resizeEvent( QResizeEvent * );
91 void paintEvent( QPaintEvent *pe ); 91 void paintEvent( QPaintEvent *pe );
92 void showEvent( QShowEvent *se ); 92 void showEvent( QShowEvent *se );
93 void mouseMoveEvent( QMouseEvent *event ); 93 void mouseMoveEvent( QMouseEvent *event );
94 void mousePressEvent( QMouseEvent *event ); 94 void mousePressEvent( QMouseEvent *event );
95 void mouseReleaseEvent( QMouseEvent *event ); 95 void mouseReleaseEvent( QMouseEvent *event );
96 void keyReleaseEvent( QKeyEvent *e); 96 void keyReleaseEvent( QKeyEvent *e);
97 97
98private: 98private:
99// Ticker songInfo; 99// Ticker songInfo;
100 QPixmap pixBg; 100 QPixmap pixBg;
101 QImage imgUp; 101 QImage imgUp;
102 QImage imgDn; 102 QImage imgDn;
103 QImage imgButtonMask; 103 QImage imgButtonMask;
104 QBitmap *masks[7]; 104 QBitmap *masks[7];
105 QPixmap *buttonPixUp[7]; 105 QPixmap *buttonPixUp[7];
106 QPixmap *buttonPixDown[7]; 106 QPixmap *buttonPixDown[7];
107 QString skin; 107 QString skin;
108// QPixmap *pixmaps[4]; 108// QPixmap *pixmaps[4];
109 int xoff, yoff; 109 int xoff, yoff;
110 110
111 111
112 void paintButton( QPainter *p, int i ); 112 void paintButton( QPainter *p, int i );
113 void toggleButton( int ); 113 void toggleButton( int );
114 void setToggleButton( int, bool ); 114 void setToggleButton( int, bool );
115 115
116 QString backgroundPix; 116 QString backgroundPix;
117 QSlider *slider; 117 QSlider *slider;
118 QPixmap *pixmaps[3]; 118 QPixmap *pixmaps[3];
119 QImage *currentFrame; 119 QImage *currentFrame;
120 int scaledWidth; 120 int scaledWidth;
121 int scaledHeight; 121 int scaledHeight;
122 XineVideoWidget* videoFrame; 122 XineVideoWidget* videoFrame;
123}; 123};
124 124
125#endif // VIDEO_WIDGET_H 125#endif // VIDEO_WIDGET_H