summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-18 17:35:58 (UTC)
committer harlekin <harlekin>2002-08-18 17:35:58 (UTC)
commita5c95b42314fe8f7bdcfe2644e980d43c257fee0 (patch) (unidiff)
treedc27b266a5e1e60fa269e2182a9cfd36507b12ca
parent6171a4b58f242c75e9ce02728651ca4fb743e747 (diff)
downloadopie-a5c95b42314fe8f7bdcfe2644e980d43c257fee0.zip
opie-a5c95b42314fe8f7bdcfe2644e980d43c257fee0.tar.gz
opie-a5c95b42314fe8f7bdcfe2644e980d43c257fee0.tar.bz2
hack to make startup faster, still need sanity checks
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/main.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp3
5 files changed, 13 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 604ed3a..6d867e5 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -67,128 +67,131 @@ void Ticker::setText( const QString& text ) {
67 scrollText = text; 67 scrollText = text;
68 pixelLen = fontMetrics().width( scrollText ); 68 pixelLen = fontMetrics().width( scrollText );
69 killTimers(); 69 killTimers();
70 if ( pixelLen > width() ) { 70 if ( pixelLen > width() ) {
71 startTimer( 50 ); 71 startTimer( 50 );
72 } 72 }
73 update(); 73 update();
74} 74}
75 75
76 76
77void Ticker::timerEvent( QTimerEvent * ) { 77void Ticker::timerEvent( QTimerEvent * ) {
78 pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; 78 pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1;
79 scroll( -1, 0, contentsRect() ); 79 scroll( -1, 0, contentsRect() );
80 repaint( FALSE ); 80 repaint( FALSE );
81} 81}
82 82
83void Ticker::drawContents( QPainter *p ) { 83void Ticker::drawContents( QPainter *p ) {
84 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) 84 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen )
85 p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); 85 p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
86 QPixmap pm( width(), height() ); 86 QPixmap pm( width(), height() );
87 pm.fill( colorGroup().base() ); 87 pm.fill( colorGroup().base() );
88 QPainter pmp( &pm ); 88 QPainter pmp( &pm );
89 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { 89 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) {
90 pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); 90 pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
91 } 91 }
92 p->drawPixmap( 0, 0, pm ); 92 p->drawPixmap( 0, 0, pm );
93} 93}
94 94
95struct MediaButton { 95struct MediaButton {
96 bool isToggle, isHeld, isDown; 96 bool isToggle, isHeld, isDown;
97}; 97};
98 98
99//Layout information for the audioButtons (and if it is a toggle button or not) 99//Layout information for the audioButtons (and if it is a toggle button or not)
100MediaButton audioButtons[] = { 100MediaButton audioButtons[] = {
101 { TRUE, FALSE, FALSE }, // play 101 { TRUE, FALSE, FALSE }, // play
102 { FALSE, FALSE, FALSE }, // stop 102 { FALSE, FALSE, FALSE }, // stop
103 { FALSE, FALSE, FALSE }, // next 103 { FALSE, FALSE, FALSE }, // next
104 { FALSE, FALSE, FALSE }, // previous 104 { FALSE, FALSE, FALSE }, // previous
105 { FALSE, FALSE, FALSE }, // volume up 105 { FALSE, FALSE, FALSE }, // volume up
106 { FALSE, FALSE, FALSE }, // volume down 106 { FALSE, FALSE, FALSE }, // volume down
107 { TRUE, FALSE, FALSE }, // repeat/loop 107 { TRUE, FALSE, FALSE }, // repeat/loop
108 { FALSE, FALSE, FALSE }, // playlist 108 { FALSE, FALSE, FALSE }, // playlist
109 { FALSE, FALSE, FALSE }, // forward 109 { FALSE, FALSE, FALSE }, // forward
110 { FALSE, FALSE, FALSE } // back 110 { FALSE, FALSE, FALSE } // back
111}; 111};
112 112
113const char *skin_mask_file_names[10] = { 113const char *skin_mask_file_names[10] = {
114 "play", "stop", "next", "prev", "up", 114 "play", "stop", "next", "prev", "up",
115 "down", "loop", "playlist", "forward", "back" 115 "down", "loop", "playlist", "forward", "back"
116}; 116};
117 117
118 118
119static void changeTextColor( QWidget *w ) { 119static void changeTextColor( QWidget *w ) {
120 QPalette p = w->palette(); 120 QPalette p = w->palette();
121 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 121 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
122 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 122 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
123 w->setPalette( p ); 123 w->setPalette( p );
124} 124}
125 125
126static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 126static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
127 127
128 128
129AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 129AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
130 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { 130 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) {
131
132
133
131 setCaption( tr("OpiePlayer") ); 134 setCaption( tr("OpiePlayer") );
132 135
133 Config cfg("OpiePlayer"); 136 Config cfg("OpiePlayer");
134 cfg.setGroup("Options"); 137 cfg.setGroup("Options");
135 skin = cfg.readEntry("Skin","default"); 138 skin = cfg.readEntry("Skin","default");
136 //skin = "scaleTest"; 139 //skin = "scaleTest";
137// color of background, frame, degree of transparency 140// color of background, frame, degree of transparency
138 141
139 QString skinPath = "opieplayer2/skins/" + skin; 142 QString skinPath = "opieplayer2/skins/" + skin;
140 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 143 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
141 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 144 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
142 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 145 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
143 146
144 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 147 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
145 imgButtonMask->fill( 0 ); 148 imgButtonMask->fill( 0 );
146 149
147 for ( int i = 0; i < 10; i++ ) { 150 for ( int i = 0; i < 10; i++ ) {
148 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; 151 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png";
149 masks[i] = new QBitmap( filename ); 152 masks[i] = new QBitmap( filename );
150 153
151 if ( !masks[i]->isNull() ) { 154 if ( !masks[i]->isNull() ) {
152 QImage imgMask = masks[i]->convertToImage(); 155 QImage imgMask = masks[i]->convertToImage();
153 uchar **dest = imgButtonMask->jumpTable(); 156 uchar **dest = imgButtonMask->jumpTable();
154 for ( int y = 0; y < imgUp->height(); y++ ) { 157 for ( int y = 0; y < imgUp->height(); y++ ) {
155 uchar *line = dest[y]; 158 uchar *line = dest[y];
156 for ( int x = 0; x < imgUp->width(); x++ ) 159 for ( int x = 0; x < imgUp->width(); x++ )
157 if ( !qRed( imgMask.pixel( x, y ) ) ) 160 if ( !qRed( imgMask.pixel( x, y ) ) )
158 line[x] = i + 1; 161 line[x] = i + 1;
159 } 162 }
160 } 163 }
161 164
162 } 165 }
163 166
164 for ( int i = 0; i < 10; i++ ) { 167 for ( int i = 0; i < 10; i++ ) {
165 buttonPixUp[i] = NULL; 168 buttonPixUp[i] = NULL;
166 buttonPixDown[i] = NULL; 169 buttonPixDown[i] = NULL;
167 } 170 }
168 171
169 setBackgroundPixmap( *pixBg ); 172 setBackgroundPixmap( *pixBg );
170 173
171 songInfo.setFocusPolicy( QWidget::NoFocus ); 174 songInfo.setFocusPolicy( QWidget::NoFocus );
172 changeTextColor( &songInfo ); 175 changeTextColor( &songInfo );
173 176
174 slider.setFixedHeight( 20 ); 177 slider.setFixedHeight( 20 );
175 slider.setMinValue( 0 ); 178 slider.setMinValue( 0 );
176 slider.setMaxValue( 1 ); 179 slider.setMaxValue( 1 );
177 slider.setFocusPolicy( QWidget::NoFocus ); 180 slider.setFocusPolicy( QWidget::NoFocus );
178 slider.setBackgroundPixmap( *pixBg ); 181 slider.setBackgroundPixmap( *pixBg );
179 182
180 time.setFocusPolicy( QWidget::NoFocus ); 183 time.setFocusPolicy( QWidget::NoFocus );
181 time.setAlignment( Qt::AlignCenter ); 184 time.setAlignment( Qt::AlignCenter );
182 time.setFrame(FALSE); 185 time.setFrame(FALSE);
183 changeTextColor( &time ); 186 changeTextColor( &time );
184 187
185 resizeEvent( NULL ); 188 resizeEvent( NULL );
186 189
187 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 190 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
188 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 191 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
189 192
190 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 193 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
191 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 194 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
192 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 195 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
193// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 196// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
194 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 197 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp
index 827f773..e951554 100644
--- a/noncore/multimedia/opieplayer2/main.cpp
+++ b/noncore/multimedia/opieplayer2/main.cpp
@@ -1,33 +1,34 @@
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 "audiowidget.h" 5#include "audiowidget.h"
6#include "videowidget.h" 6#include "videowidget.h"
7#include "mediaplayer.h" 7#include "mediaplayer.h"
8 8
9MediaPlayerState *mediaPlayerState; 9MediaPlayerState *mediaPlayerState;
10PlayListWidget *playList; 10PlayListWidget *playList;
11AudioWidget *audioUI; 11AudioWidget *audioUI;
12VideoWidget *videoUI; 12VideoWidget *videoUI;
13 13
14int main(int argc, char **argv) { 14int main(int argc, char **argv) {
15 QPEApplication a(argc,argv); 15 QPEApplication a(argc,argv);
16 16
17 MediaPlayerState st( 0, "mediaPlayerState" ); 17 MediaPlayerState st( 0, "mediaPlayerState" );
18 mediaPlayerState = &st; 18 mediaPlayerState = &st;
19 PlayListWidget pl( 0, "playList" ); 19 PlayListWidget pl( 0, "playList" );
20 playList = &pl; 20 playList = &pl;
21 pl.showMaximized();
21 AudioWidget aw( 0, "audioUI" ); 22 AudioWidget aw( 0, "audioUI" );
22 audioUI = &aw; 23 audioUI = &aw;
23 VideoWidget vw( 0, "videoUI" ); 24 VideoWidget vw( 0, "videoUI" );
24 videoUI = &vw; 25 videoUI = &vw;
25 26 a.processEvents();
26 MediaPlayer mp( 0, "mediaPlayer" ); 27 MediaPlayer mp( 0, "mediaPlayer" );
27 28
28 a.showMainDocumentWidget(&pl); 29 a.showMainDocumentWidget(&pl);
29 30
30 return a.exec(); 31 return a.exec();
31} 32}
32 33
33 34
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 87f4f0c..5531e81 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,103 +1,102 @@
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 6
7#include <qmainwindow.h> 7#include <qmainwindow.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qwidgetstack.h> 9#include <qwidgetstack.h>
10#include <qfile.h> 10#include <qfile.h>
11 11
12#include "mediaplayer.h" 12#include "mediaplayer.h"
13#include "playlistwidget.h" 13#include "playlistwidget.h"
14#include "audiowidget.h" 14#include "audiowidget.h"
15#include "videowidget.h" 15#include "videowidget.h"
16#include "volumecontrol.h" 16#include "volumecontrol.h"
17 17
18#include "mediaplayerstate.h" 18#include "mediaplayerstate.h"
19 19
20// for setBacklight() 20// for setBacklight()
21#include <linux/fb.h> 21#include <linux/fb.h>
22#include <sys/file.h> 22#include <sys/file.h>
23#include <sys/ioctl.h> 23#include <sys/ioctl.h>
24 24
25 25
26extern AudioWidget *audioUI; 26extern AudioWidget *audioUI;
27extern VideoWidget *videoUI; 27extern VideoWidget *videoUI;
28extern PlayListWidget *playList; 28extern PlayListWidget *playList;
29extern MediaPlayerState *mediaPlayerState; 29extern MediaPlayerState *mediaPlayerState;
30 30
31 31
32#define FBIOBLANK 0x4611 32#define FBIOBLANK 0x4611
33 33
34MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 34MediaPlayer::MediaPlayer( QObject *parent, const char *name )
35 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 35 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
36 36
37 37 qApp->processEvents();
38 // xineControl = new XineControl(); 38 // QPEApplication::grabKeyboard(); // EVIL
39// QPEApplication::grabKeyboard(); // EVIL
40 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 39 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
41 40
42 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 41 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
43 42
44 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 43 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
45 44
46 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 45 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
47 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 46 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
48 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 47 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
49 48
50 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 49 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
51 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 50 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
52 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 51 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
53 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 52 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
54 53
55 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 54 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
56 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 55 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
57 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 56 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
58 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 57 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
59 58
60 volControl = new VolumeControl; 59 volControl = new VolumeControl;
61 xineControl = new XineControl(); 60 xineControl = new XineControl();
62} 61}
63 62
64MediaPlayer::~MediaPlayer() { 63MediaPlayer::~MediaPlayer() {
65 delete xineControl; 64 delete xineControl;
66 delete volControl; 65 delete volControl;
67} 66}
68 67
69void MediaPlayer::pauseCheck( bool b ) { 68void MediaPlayer::pauseCheck( bool b ) {
70 if ( b && !mediaPlayerState->playing() ) { 69 if ( b && !mediaPlayerState->playing() ) {
71 mediaPlayerState->setPaused( FALSE ); 70 mediaPlayerState->setPaused( FALSE );
72 } 71 }
73} 72}
74 73
75void MediaPlayer::play() { 74void MediaPlayer::play() {
76 mediaPlayerState->setPlaying( FALSE ); 75 mediaPlayerState->setPlaying( FALSE );
77 mediaPlayerState->setPlaying( TRUE ); 76 mediaPlayerState->setPlaying( TRUE );
78} 77}
79 78
80void MediaPlayer::setPlaying( bool play ) { 79void MediaPlayer::setPlaying( bool play ) {
81 if ( !play ) { 80 if ( !play ) {
82 return; 81 return;
83 } 82 }
84 83
85 if ( mediaPlayerState->paused() ) { 84 if ( mediaPlayerState->paused() ) {
86 mediaPlayerState->setPaused( FALSE ); 85 mediaPlayerState->setPaused( FALSE );
87 return; 86 return;
88 } 87 }
89 88
90 const DocLnk *playListCurrent = playList->current(); 89 const DocLnk *playListCurrent = playList->current();
91 if ( playListCurrent != NULL ) { 90 if ( playListCurrent != NULL ) {
92 currentFile = playListCurrent; 91 currentFile = playListCurrent;
93 } 92 }
94 93
95 xineControl->play( currentFile->file() ); 94 xineControl->play( currentFile->file() );
96 95
97 xineControl->length(); 96 xineControl->length();
98 long seconds = mediaPlayerState->length();// 97 long seconds = mediaPlayerState->length();//
99 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 98 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
100 qDebug(time); 99 qDebug(time);
101 100
102 QString tickerText; 101 QString tickerText;
103 if( currentFile->file().left(4) == "http" ) 102 if( currentFile->file().left(4) == "http" )
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 874800a..39f5090 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -141,173 +141,173 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
141 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 141 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
142 new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); 142 new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) );
143 pmPlayList->insertSeparator(-1); 143 pmPlayList->insertSeparator(-1);
144 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 144 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
145 pmPlayList->insertSeparator(-1); 145 pmPlayList->insertSeparator(-1);
146 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); 146 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
147 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); 147 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
148 148
149 149
150 pmView = new QPopupMenu( this ); 150 pmView = new QPopupMenu( this );
151 menu->insertItem( tr( "View" ), pmView ); 151 menu->insertItem( tr( "View" ), pmView );
152 pmView->isCheckable(); 152 pmView->isCheckable();
153 153
154 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); 154 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) );
155 155
156 Config cfg( "OpiePlayer" ); 156 Config cfg( "OpiePlayer" );
157 bool b= cfg.readBoolEntry("FullScreen", 0); 157 bool b= cfg.readBoolEntry("FullScreen", 0);
158 mediaPlayerState->setFullscreen( b ); 158 mediaPlayerState->setFullscreen( b );
159 pmView->setItemChecked( -16, b ); 159 pmView->setItemChecked( -16, b );
160 160
161 // pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) ); 161 // pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) );
162 162
163 pmView->insertSeparator(-1); 163 pmView->insertSeparator(-1);
164 164
165 skinsMenu = new QPopupMenu( this ); 165 skinsMenu = new QPopupMenu( this );
166 pmView->insertItem( tr( "Skins" ), skinsMenu ); 166 pmView->insertItem( tr( "Skins" ), skinsMenu );
167 skinsMenu->isCheckable(); 167 skinsMenu->isCheckable();
168 populateSkinsMenu(); 168 populateSkinsMenu();
169 169
170 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 170 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
171 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 171 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
172 172
173 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 173 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
174 174
175 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 175 tabWidget = new QTabWidget( hbox6, "tabWidget" );
176 // tabWidget->setTabShape(QTabWidget::Triangular); 176 // tabWidget->setTabShape(QTabWidget::Triangular);
177 177
178 QWidget *pTab; 178 QWidget *pTab;
179 pTab = new QWidget( tabWidget, "pTab" ); 179 pTab = new QWidget( tabWidget, "pTab" );
180 tabWidget->insertTab( pTab,"Playlist"); 180 tabWidget->insertTab( pTab,"Playlist");
181 181
182 182
183 QGridLayout *Playout = new QGridLayout( pTab ); 183 QGridLayout *Playout = new QGridLayout( pTab );
184 Playout->setSpacing( 2); 184 Playout->setSpacing( 2);
185 Playout->setMargin( 2); 185 Playout->setMargin( 2);
186 186
187 // Add the playlist area 187 // Add the playlist area
188 188
189 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 189 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
190 d->playListFrame = vbox3; 190 d->playListFrame = vbox3;
191 191
192 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 192 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
193 193
194 d->selectedFiles = new PlayListSelection( hbox2); 194 d->selectedFiles = new PlayListSelection( hbox2);
195 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 195 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
196 196
197 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 197 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
198 198
199 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 199 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
200 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 200 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp()) );
201 new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected()) ); 201 new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected()) );
202 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 202 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown()) );
203 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 203 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
204 204
205 205
206 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 206 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
207 207
208 QWidget *aTab; 208 QWidget *aTab;
209 aTab = new QWidget( tabWidget, "aTab" ); 209 aTab = new QWidget( tabWidget, "aTab" );
210 210
211 QGridLayout *Alayout = new QGridLayout( aTab ); 211 QGridLayout *Alayout = new QGridLayout( aTab );
212 Alayout->setSpacing( 2); 212 Alayout->setSpacing( 2);
213 Alayout->setMargin( 2); 213 Alayout->setMargin( 2);
214 214
215 audioView = new QListView( aTab, "Audioview" ); 215 audioView = new QListView( aTab, "Audioview" );
216 audioView->addColumn( tr("Title"),140); 216 audioView->addColumn( tr("Title"),140);
217 audioView->addColumn(tr("Size"), -1); 217 audioView->addColumn(tr("Size"), -1);
218 audioView->addColumn(tr("Media"),-1); 218 audioView->addColumn(tr("Media"),-1);
219 audioView->setColumnAlignment(1, Qt::AlignRight); 219 audioView->setColumnAlignment(1, Qt::AlignRight);
220 audioView->setColumnAlignment(2, Qt::AlignRight); 220 audioView->setColumnAlignment(2, Qt::AlignRight);
221 audioView->setAllColumnsShowFocus(TRUE); 221 audioView->setAllColumnsShowFocus(TRUE);
222 audioView->setSorting(0,TRUE); 222 audioView->setSorting(0,TRUE);
223 223
224 audioView->setMultiSelection( TRUE ); 224 audioView->setMultiSelection( TRUE );
225 audioView->setSelectionMode( QListView::Extended); 225 audioView->setSelectionMode( QListView::Extended);
226 226
227 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 227 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
228 228
229 tabWidget->insertTab(aTab,tr("Audio")); 229 tabWidget->insertTab(aTab,tr("Audio"));
230 230
231 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 231 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
232 232
233 QWidget *vTab; 233 QWidget *vTab;
234 vTab = new QWidget( tabWidget, "vTab" ); 234 vTab = new QWidget( tabWidget, "vTab" );
235 235
236 QGridLayout *Vlayout = new QGridLayout( vTab ); 236 QGridLayout *Vlayout = new QGridLayout( vTab );
237 Vlayout->setSpacing( 2); 237 Vlayout->setSpacing( 2);
238 Vlayout->setMargin( 2); 238 Vlayout->setMargin( 2);
239 239
240 videoView = new QListView( vTab, "Videoview" ); 240 videoView = new QListView( vTab, "Videoview" );
241 241
242 videoView->addColumn(tr("Title"),140); 242 videoView->addColumn(tr("Title"),140);
243 videoView->addColumn(tr("Size"),-1); 243 videoView->addColumn(tr("Size"),-1);
244 videoView->addColumn(tr("Media"),-1); 244 videoView->addColumn(tr("Media"),-1);
245 videoView->setColumnAlignment(1, Qt::AlignRight); 245 videoView->setColumnAlignment(1, Qt::AlignRight);
246 videoView->setColumnAlignment(2, Qt::AlignRight); 246 videoView->setColumnAlignment(2, Qt::AlignRight);
247 videoView->setAllColumnsShowFocus(TRUE); 247 videoView->setAllColumnsShowFocus(TRUE);
248 videoView->setSorting(0,TRUE); 248 videoView->setSorting(0,TRUE);
249 249
250 videoView->setMultiSelection( TRUE ); 250 videoView->setMultiSelection( TRUE );
251 videoView->setSelectionMode( QListView::Extended); 251 videoView->setSelectionMode( QListView::Extended);
252 252
253 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 253 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
254 254
255 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 255 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
256 256
257 tabWidget->insertTab( vTab,tr("Video")); 257 tabWidget->insertTab( vTab,tr("Video"));
258 258
259 //playlists list 259 //playlists list
260 QWidget *LTab; 260 QWidget *LTab;
261 LTab = new QWidget( tabWidget, "LTab" ); 261 LTab = new QWidget( tabWidget, "LTab" );
262 QGridLayout *Llayout = new QGridLayout( LTab ); 262 QGridLayout *Llayout = new QGridLayout( LTab );
263 Llayout->setSpacing( 2); 263 Llayout->setSpacing( 2);
264 Llayout->setMargin( 2); 264 Llayout->setMargin( 2);
265 265
266 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 266 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
267 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 267 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
268 268
269 tabWidget->insertTab(LTab,tr("Lists")); 269 tabWidget->insertTab(LTab,tr("Lists"));
270 270
271 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 271 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
272 272
273 connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); 273 connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) );
274 274
275 connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) ); 275 connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) );
276 276
277 // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); 277 // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) );
278 278
279 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 279 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
280 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 280 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
281 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 281 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
282 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 282 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
283 connect( audioView, SIGNAL( returnPressed( QListViewItem *)), 283 connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
284 this,SLOT( playIt( QListViewItem *)) ); 284 this,SLOT( playIt( QListViewItem *)) );
285 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 285 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
286 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 286 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
287 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 287 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
288 connect( videoView, SIGNAL( returnPressed( QListViewItem *)), 288 connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
289 this,SLOT( playIt( QListViewItem *)) ); 289 this,SLOT( playIt( QListViewItem *)) );
290 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 290 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
291 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 291 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
292 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 292 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
293 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 293 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
294 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 294 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
295 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 295 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
296 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 296 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
297 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 297 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
298 298
299 setCentralWidget( vbox5 ); 299 setCentralWidget( vbox5 );
300 300
301 readConfig( cfg ); 301 readConfig( cfg );
302 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 302 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
303 loadList(DocLnk( currentPlaylist)); 303 loadList(DocLnk( currentPlaylist));
304 setCaption(tr("OpiePlayer: ")+ currentPlaylist ); 304 setCaption(tr("OpiePlayer: ")+ currentPlaylist );
305 305
306 initializeStates(); 306 initializeStates();
307} 307}
308 308
309 309
310PlayListWidget::~PlayListWidget() { 310PlayListWidget::~PlayListWidget() {
311 Config cfg( "OpiePlayer" ); 311 Config cfg( "OpiePlayer" );
312 writeConfig( cfg ); 312 writeConfig( cfg );
313 313
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index ddb4d74..60a3563 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,147 +1,150 @@
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/resource.h> 34#include <qpe/resource.h>
35#include <qpe/mediaplayerplugininterface.h> 35#include <qpe/mediaplayerplugininterface.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37 37
38
38#include <qwidget.h> 39#include <qwidget.h>
39#include <qpainter.h> 40#include <qpainter.h>
40#include <qpixmap.h> 41#include <qpixmap.h>
41#include <qslider.h> 42#include <qslider.h>
42#include <qdrawutil.h> 43#include <qdrawutil.h>
43#include "videowidget.h" 44#include "videowidget.h"
44#include "mediaplayerstate.h" 45#include "mediaplayerstate.h"
45 46
46 47
47#ifdef Q_WS_QWS 48#ifdef Q_WS_QWS
48# define USE_DIRECT_PAINTER 49# define USE_DIRECT_PAINTER
49# include <qdirectpainter_qws.h> 50# include <qdirectpainter_qws.h>
50# include <qgfxraster_qws.h> 51# include <qgfxraster_qws.h>
51#endif 52#endif
52 53
53 54
54extern MediaPlayerState *mediaPlayerState; 55extern MediaPlayerState *mediaPlayerState;
55 56
56 57
57static const int xo = 2; // movable x offset 58static const int xo = 2; // movable x offset
58static const int yo = 0; // movable y offset 59static const int yo = 0; // movable y offset
59 60
60 61
61struct MediaButton { 62struct MediaButton {
62 bool isToggle, isHeld, isDown; 63 bool isToggle, isHeld, isDown;
63}; 64};
64 65
65MediaButton videoButtons[] = { 66MediaButton videoButtons[] = {
66 { FALSE, FALSE, FALSE }, // stop 67 { FALSE, FALSE, FALSE }, // stop
67 { TRUE, FALSE, FALSE }, // play 68 { TRUE, FALSE, FALSE }, // play
68 { FALSE, FALSE, FALSE }, // previous 69 { FALSE, FALSE, FALSE }, // previous
69 { FALSE, FALSE, FALSE }, // next 70 { FALSE, FALSE, FALSE }, // next
70 { FALSE, FALSE, FALSE }, // volUp 71 { FALSE, FALSE, FALSE }, // volUp
71 { FALSE, FALSE, FALSE }, // volDown 72 { FALSE, FALSE, FALSE }, // volDown
72 { TRUE, FALSE, FALSE } // fullscreen 73 { TRUE, FALSE, FALSE } // fullscreen
73}; 74};
74 75
75const char *skinV_mask_file_names[7] = { 76const char *skinV_mask_file_names[7] = {
76"stop","play","back","fwd","up","down","full" 77"stop","play","back","fwd","up","down","full"
77}; 78};
78 79
79static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 80static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
80 81
81 82
82VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : 83VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
83QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { 84QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
85
86
84 setCaption( tr("OpiePlayer - Video") ); 87 setCaption( tr("OpiePlayer - Video") );
85 88
86 videoFrame = new XineVideoWidget ( this, "Video frame" ); 89 videoFrame = new XineVideoWidget ( this, "Video frame" );
87 90
88 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 91 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
89 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 92 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
90 93
91 Config cfg("OpiePlayer"); 94 Config cfg("OpiePlayer");
92 cfg.setGroup("Options"); 95 cfg.setGroup("Options");
93 skin = cfg.readEntry("Skin","default"); 96 skin = cfg.readEntry("Skin","default");
94 97
95 QString skinPath = "opieplayer2/skins/" + skin; 98 QString skinPath = "opieplayer2/skins/" + skin;
96 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 99 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
97 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 100 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
98 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 101 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
99 102
100 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 103 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
101 imgButtonMask->fill( 0 ); 104 imgButtonMask->fill( 0 );
102 105
103 for ( int i = 0; i < 7; i++ ) { 106 for ( int i = 0; i < 7; i++ ) {
104 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png"; 107 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png";
105 masks[i] = new QBitmap( filename ); 108 masks[i] = new QBitmap( filename );
106 109
107 if ( !masks[i]->isNull() ) { 110 if ( !masks[i]->isNull() ) {
108 QImage imgMask = masks[i]->convertToImage(); 111 QImage imgMask = masks[i]->convertToImage();
109 uchar **dest = imgButtonMask->jumpTable(); 112 uchar **dest = imgButtonMask->jumpTable();
110 for ( int y = 0; y < imgUp->height(); y++ ) { 113 for ( int y = 0; y < imgUp->height(); y++ ) {
111 uchar *line = dest[y]; 114 uchar *line = dest[y];
112 for ( int x = 0; x < imgUp->width(); x++ ) { 115 for ( int x = 0; x < imgUp->width(); x++ ) {
113 if ( !qRed( imgMask.pixel( x, y ) ) ) 116 if ( !qRed( imgMask.pixel( x, y ) ) )
114 line[x] = i + 1; 117 line[x] = i + 1;
115 } 118 }
116 } 119 }
117 } 120 }
118 } 121 }
119 122
120 for ( int i = 0; i < 7; i++ ) { 123 for ( int i = 0; i < 7; i++ ) {
121 buttonPixUp[i] = NULL; 124 buttonPixUp[i] = NULL;
122 buttonPixDown[i] = NULL; 125 buttonPixDown[i] = NULL;
123 } 126 }
124 127
125 setBackgroundPixmap( *pixBg ); 128 setBackgroundPixmap( *pixBg );
126 129
127 slider = new QSlider( Qt::Horizontal, this ); 130 slider = new QSlider( Qt::Horizontal, this );
128 slider->setMinValue( 0 ); 131 slider->setMinValue( 0 );
129 slider->setMaxValue( 1 ); 132 slider->setMaxValue( 1 );
130 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 133 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
131 slider->setFocusPolicy( QWidget::NoFocus ); 134 slider->setFocusPolicy( QWidget::NoFocus );
132 135
133 resizeEvent( NULL ); 136 resizeEvent( NULL );
134 137
135 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 138 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
136 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 139 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
137 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 140 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
138 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 141 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
139 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 142 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
140 143
141 setLength( mediaPlayerState->length() ); 144 setLength( mediaPlayerState->length() );
142 setPosition( mediaPlayerState->position() ); 145 setPosition( mediaPlayerState->position() );
143 setFullscreen( mediaPlayerState->fullscreen() ); 146 setFullscreen( mediaPlayerState->fullscreen() );
144 setPlaying( mediaPlayerState->playing() ); 147 setPlaying( mediaPlayerState->playing() );
145} 148}
146 149
147 150