Diffstat (limited to 'core/multimedia/opieplayer/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 48104ca..02c8568 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -65,82 +65,82 @@ MediaButton videoButtons[] = { | |||
65 | }; | 65 | }; |
66 | 66 | ||
67 | //static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 67 | //static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
68 | 68 | ||
69 | const char *skinV_mask_file_names[7] = { | 69 | const char *skinV_mask_file_names[7] = { |
70 | "stop","play","back","fwd","up","down","full" | 70 | "stop","play","back","fwd","up","down","full" |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 73 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
74 | 74 | ||
75 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 75 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
76 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) | 76 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) |
77 | { | 77 | { |
78 | setCaption( tr("OpiePlayer") ); | 78 | setCaption( tr("OpiePlayer") ); |
79 | Config cfg("OpiePlayer"); | 79 | Config cfg("OpiePlayer"); |
80 | 80 | ||
81 | cfg.setGroup("Options"); | 81 | cfg.setGroup("Options"); |
82 | skin = cfg.readEntry("Skin","default"); | 82 | skin = cfg.readEntry("Skin","default"); |
83 | 83 | ||
84 | QString skinPath; | 84 | QString skinPath; |
85 | skinPath = "opieplayer2/skins/" + skin; | 85 | skinPath = "opieplayer2/skins/" + skin; |
86 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) | 86 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) |
87 | skinPath = "opieplayer2/skins/default"; | 87 | skinPath = "opieplayer2/skins/default"; |
88 | 88 | ||
89 | qDebug("skin path " + skinPath); | 89 | // qDebug("skin path " + skinPath); |
90 | 90 | ||
91 | // QString skinPath = "opieplayer2/skins/" + skin; | 91 | // QString skinPath = "opieplayer2/skins/" + skin; |
92 | 92 | ||
93 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 93 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
94 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 94 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
95 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 95 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
96 | 96 | ||
97 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 97 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
98 | imgButtonMask->fill( 0 ); | 98 | imgButtonMask->fill( 0 ); |
99 | 99 | ||
100 | for ( int i = 0; i < 7; i++ ) | 100 | for ( int i = 0; i < 7; i++ ) |
101 | { | 101 | { |
102 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + | 102 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + |
103 | "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 103 | "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
104 | qDebug("loading "+filename); | 104 | // qDebug("loading "+filename); |
105 | masks[i] = new QBitmap( filename ); | 105 | masks[i] = new QBitmap( filename ); |
106 | 106 | ||
107 | if ( !masks[i]->isNull() ) | 107 | if ( !masks[i]->isNull() ) |
108 | { | 108 | { |
109 | QImage imgMask = masks[i]->convertToImage(); | 109 | QImage imgMask = masks[i]->convertToImage(); |
110 | uchar **dest = imgButtonMask->jumpTable(); | 110 | uchar **dest = imgButtonMask->jumpTable(); |
111 | for ( int y = 0; y < imgUp->height(); y++ ) | 111 | for ( int y = 0; y < imgUp->height(); y++ ) |
112 | { | 112 | { |
113 | uchar *line = dest[y]; | 113 | uchar *line = dest[y]; |
114 | for ( int x = 0; x < imgUp->width(); x++ ) | 114 | for ( int x = 0; x < imgUp->width(); x++ ) |
115 | { | 115 | { |
116 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 116 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
117 | line[x] = i + 1; | 117 | line[x] = i + 1; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | } | 120 | } |
121 | } | 121 | } |
122 | qDebug("finished loading first pics"); | 122 | // qDebug("finished loading first pics"); |
123 | for ( int i = 0; i < 7; i++ ) | 123 | for ( int i = 0; i < 7; i++ ) |
124 | { | 124 | { |
125 | buttonPixUp[i] = NULL; | 125 | buttonPixUp[i] = NULL; |
126 | buttonPixDown[i] = NULL; | 126 | buttonPixDown[i] = NULL; |
127 | } | 127 | } |
128 | 128 | ||
129 | setBackgroundPixmap( *pixBg ); | 129 | setBackgroundPixmap( *pixBg ); |
130 | 130 | ||
131 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); | 131 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); |
132 | 132 | ||
133 | slider = new QSlider( Qt::Horizontal, this ); | 133 | slider = new QSlider( Qt::Horizontal, this ); |
134 | slider->setMinValue( 0 ); | 134 | slider->setMinValue( 0 ); |
135 | slider->setMaxValue( 1 ); | 135 | slider->setMaxValue( 1 ); |
136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
137 | slider->setFocusPolicy( QWidget::NoFocus ); | 137 | slider->setFocusPolicy( QWidget::NoFocus ); |
138 | // slider->setGeometry( QRect( 7, 250, 220, 20 ) ); | 138 | // slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |
139 | 139 | ||
140 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 140 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
141 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 141 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
142 | 142 | ||
143 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 143 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
144 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 144 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
145 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 145 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
146 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 146 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
@@ -330,72 +330,72 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
330 | 330 | ||
331 | switch (i) { | 331 | switch (i) { |
332 | case VideoVolUp: | 332 | case VideoVolUp: |
333 | emit moreClicked(); | 333 | emit moreClicked(); |
334 | return; | 334 | return; |
335 | case VideoVolDown: | 335 | case VideoVolDown: |
336 | emit lessClicked(); | 336 | emit lessClicked(); |
337 | return; | 337 | return; |
338 | } | 338 | } |
339 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 339 | } else if ( !isOnButton && videoButtons[i].isHeld ) { |
340 | videoButtons[i].isHeld = FALSE; | 340 | videoButtons[i].isHeld = FALSE; |
341 | toggleButton(i); | 341 | toggleButton(i); |
342 | } | 342 | } |
343 | } else { | 343 | } else { |
344 | 344 | ||
345 | if ( videoButtons[i].isHeld ) { | 345 | if ( videoButtons[i].isHeld ) { |
346 | videoButtons[i].isHeld = FALSE; | 346 | videoButtons[i].isHeld = FALSE; |
347 | if ( !videoButtons[i].isToggle ) { | 347 | if ( !videoButtons[i].isToggle ) { |
348 | setToggleButton( i, FALSE ); | 348 | setToggleButton( i, FALSE ); |
349 | } | 349 | } |
350 | 350 | ||
351 | switch(i) { | 351 | switch(i) { |
352 | 352 | ||
353 | case VideoPlay: { | 353 | case VideoPlay: { |
354 | qDebug("play"); | 354 | // qDebug("play"); |
355 | if( !mediaPlayerState->playing()) { | 355 | if( !mediaPlayerState->playing()) { |
356 | mediaPlayerState->setPlaying( true); | 356 | mediaPlayerState->setPlaying( true); |
357 | setToggleButton( i-1, false ); | 357 | setToggleButton( i-1, false ); |
358 | setToggleButton( i, false ); | 358 | setToggleButton( i, false ); |
359 | return; | 359 | return; |
360 | } | 360 | } |
361 | if( mediaPlayerState->isPaused ) { | 361 | if( mediaPlayerState->isPaused ) { |
362 | qDebug("isPaused"); | 362 | // qDebug("isPaused"); |
363 | setToggleButton( i, FALSE ); | 363 | setToggleButton( i, FALSE ); |
364 | mediaPlayerState->setPaused( FALSE ); | 364 | mediaPlayerState->setPaused( FALSE ); |
365 | return; | 365 | return; |
366 | } else if( !mediaPlayerState->isPaused ) { | 366 | } else if( !mediaPlayerState->isPaused ) { |
367 | qDebug("is not paused"); | 367 | // qDebug("is not paused"); |
368 | setToggleButton( i, TRUE ); | 368 | setToggleButton( i, TRUE ); |
369 | mediaPlayerState->setPaused( TRUE ); | 369 | mediaPlayerState->setPaused( TRUE ); |
370 | return; | 370 | return; |
371 | } else { | 371 | } else { |
372 | return; | 372 | return; |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | case VideoStop: qDebug("stop"); mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; | 376 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; |
377 | case VideoNext: mediaPlayerState->setNext(); return; | 377 | case VideoNext: mediaPlayerState->setNext(); return; |
378 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 378 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
379 | case VideoVolUp: emit moreReleased(); return; | 379 | case VideoVolUp: emit moreReleased(); return; |
380 | case VideoVolDown: emit lessReleased(); return; | 380 | case VideoVolDown: emit lessReleased(); return; |
381 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 381 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
382 | } | 382 | } |
383 | } | 383 | } |
384 | } | 384 | } |
385 | } | 385 | } |
386 | } | 386 | } |
387 | 387 | ||
388 | 388 | ||
389 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 389 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
390 | mouseMoveEvent( event ); | 390 | mouseMoveEvent( event ); |
391 | } | 391 | } |
392 | 392 | ||
393 | 393 | ||
394 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 394 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
395 | if ( mediaPlayerState->fullscreen() ) | 395 | if ( mediaPlayerState->fullscreen() ) |
396 | { | 396 | { |
397 | mediaPlayerState->setFullscreen( FALSE ); | 397 | mediaPlayerState->setFullscreen( FALSE ); |
398 | makeVisible(); | 398 | makeVisible(); |
399 | } | 399 | } |
400 | mouseMoveEvent( event ); | 400 | mouseMoveEvent( event ); |
401 | // } | 401 | // } |