author | llornkcor <llornkcor> | 2002-04-21 17:51:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-21 17:51:24 (UTC) |
commit | 53a4a3f6398640d182a067a8ffef9b402cd35d7a (patch) (unidiff) | |
tree | 3c989e5ebde8cab36d0a089aa6d63e5e017c86d8 /core/multimedia/opieplayer/audiowidget.cpp | |
parent | 746afd0d27f33eed5451b54819773cf055858964 (diff) | |
download | opie-53a4a3f6398640d182a067a8ffef9b402cd35d7a.zip opie-53a4a3f6398640d182a067a8ffef9b402cd35d7a.tar.gz opie-53a4a3f6398640d182a067a8ffef9b402cd35d7a.tar.bz2 |
added f9= hide/show audio widget, f10= hide/show video widget, fixed laylist stuff, and fixed slier for the last time
Diffstat (limited to 'core/multimedia/opieplayer/audiowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index e2e3603..94b979f 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -22,12 +22,13 @@ | |||
22 | 22 | ||
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
25 | #include <qbutton.h> | 25 | #include <qbutton.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | ||
28 | 29 | ||
29 | #include "audiowidget.h" | 30 | #include "audiowidget.h" |
30 | #include "mediaplayerstate.h" | 31 | #include "mediaplayerstate.h" |
31 | 32 | ||
32 | extern MediaPlayerState *mediaPlayerState; | 33 | extern MediaPlayerState *mediaPlayerState; |
33 | 34 | ||
@@ -60,32 +61,38 @@ MediaButton audioButtons[] = { | |||
60 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 61 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
61 | 62 | ||
62 | 63 | ||
63 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 64 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
64 | QWidget( parent, name, f ) | 65 | QWidget( parent, name, f ) |
65 | { | 66 | { |
66 | // QPEApplication::grabKeyboard(); | ||
67 | setCaption( tr("OpiePlayer") ); | 67 | setCaption( tr("OpiePlayer") ); |
68 | |||
69 | // QGridLayout *layout = new QGridLayout( this ); | ||
70 | // layout->setSpacing( 2); | ||
71 | // layout->setMargin( 2); | ||
72 | |||
68 | setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); | 73 | setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); |
69 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsAll" ) ); | 74 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsAll" ) ); |
70 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsBig" ) ); | 75 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsBig" ) ); |
71 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaControls" ) ); | 76 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaControls" ) ); |
72 | pixmaps[3] = new QPixmap( Resource::loadPixmap( "opieplayer/animatedButton" ) ); | 77 | pixmaps[3] = new QPixmap( Resource::loadPixmap( "opieplayer/animatedButton" ) ); |
73 | 78 | ||
74 | songInfo = new Ticker( this ); | 79 | songInfo = new Ticker( this ); |
75 | songInfo->setFocusPolicy( QWidget::NoFocus ); | 80 | songInfo->setFocusPolicy( QWidget::NoFocus ); |
76 | songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); | 81 | songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); |
82 | // layout->addMultiCellWidget( songInfo, 0, 0, 0, 2 ); | ||
77 | 83 | ||
78 | slider = new QSlider( Qt::Horizontal, this ); | 84 | slider = new QSlider( Qt::Horizontal, this ); |
79 | slider->setFixedWidth( 220 ); | 85 | slider->setFixedWidth( 220 ); |
80 | slider->setFixedHeight( 20 ); | 86 | slider->setFixedHeight( 20 ); |
81 | slider->setMinValue( 0 ); | 87 | slider->setMinValue( 0 ); |
82 | slider->setMaxValue( 1 ); | 88 | slider->setMaxValue( 1 ); |
83 | slider->setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); | 89 | slider->setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); |
84 | slider->setFocusPolicy( QWidget::NoFocus ); | 90 | slider->setFocusPolicy( QWidget::NoFocus ); |
85 | slider->setGeometry( QRect( 7, 262, 220, 20 ) ); | 91 | slider->setGeometry( QRect( 7, 262, 220, 20 ) ); |
92 | // layout->addMultiCellWidget( slider, 4, 4, 0, 2 ); | ||
86 | 93 | ||
87 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 94 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
88 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 95 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
89 | 96 | ||
90 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 97 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
91 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 98 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
@@ -101,12 +108,13 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
101 | setPlaying( mediaPlayerState->playing() ); | 108 | setPlaying( mediaPlayerState->playing() ); |
102 | 109 | ||
103 | } | 110 | } |
104 | 111 | ||
105 | 112 | ||
106 | AudioWidget::~AudioWidget() { | 113 | AudioWidget::~AudioWidget() { |
114 | mediaPlayerState->isStreaming = FALSE; | ||
107 | for ( int i = 0; i < 4; i++ ) | 115 | for ( int i = 0; i < 4; i++ ) |
108 | delete pixmaps[i]; | 116 | delete pixmaps[i]; |
109 | } | 117 | } |
110 | 118 | ||
111 | 119 | ||
112 | static bool audioSliderBeingMoved = FALSE; | 120 | static bool audioSliderBeingMoved = FALSE; |
@@ -134,26 +142,28 @@ void AudioWidget::setPosition( long i ) { | |||
134 | void AudioWidget::setLength( long max ) { | 142 | void AudioWidget::setLength( long max ) { |
135 | updateSlider( mediaPlayerState->position(), max ); | 143 | updateSlider( mediaPlayerState->position(), max ); |
136 | } | 144 | } |
137 | 145 | ||
138 | 146 | ||
139 | void AudioWidget::setView( char view ) { | 147 | void AudioWidget::setView( char view ) { |
148 | |||
140 | if (mediaPlayerState->isStreaming) { | 149 | if (mediaPlayerState->isStreaming) { |
141 | if( !slider->isHidden()) slider->hide(); | 150 | if( !slider->isHidden()) slider->hide(); |
142 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 151 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
143 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 152 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
144 | } else { | 153 | } else { |
145 | // this stops the slider from being moved, thus | 154 | // this stops the slider from being moved, thus |
146 | // does not stop stream when it reaches the end | 155 | // does not stop stream when it reaches the end |
147 | if( slider->isHidden()) slider->show(); | 156 | slider->show(); |
148 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 157 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
149 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 158 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
150 | } | 159 | } |
151 | 160 | ||
152 | if ( view == 'a' ) { | 161 | if ( view == 'a' ) { |
153 | startTimer( 150 ); | 162 | startTimer( 150 ); |
163 | // show(); | ||
154 | showMaximized(); | 164 | showMaximized(); |
155 | } else { | 165 | } else { |
156 | killTimers(); | 166 | killTimers(); |
157 | hide(); | 167 | hide(); |
158 | } | 168 | } |
159 | } | 169 | } |
@@ -287,20 +297,24 @@ void AudioWidget::closeEvent( QCloseEvent* ) { | |||
287 | void AudioWidget::paintEvent( QPaintEvent * ) { | 297 | void AudioWidget::paintEvent( QPaintEvent * ) { |
288 | QPainter p( this ); | 298 | QPainter p( this ); |
289 | for ( int i = 0; i < numButtons; i++ ) | 299 | for ( int i = 0; i < numButtons; i++ ) |
290 | paintButton( &p, i ); | 300 | paintButton( &p, i ); |
291 | } | 301 | } |
292 | 302 | ||
293 | 303 | void AudioWidget::showMe() { | |
304 | show(); | ||
305 | } | ||
294 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) | 306 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) |
295 | { | 307 | { |
296 | switch ( e->key() ) { | 308 | switch ( e->key() ) { |
297 | ////////////////////////////// Zaurus keys | 309 | ////////////////////////////// Zaurus keys |
298 | case Key_Home: | 310 | case Key_Home: |
299 | break; | 311 | break; |
300 | case Key_F9: //activity | 312 | case Key_F9: //activity |
313 | hide(); | ||
314 | // qDebug("Audio F9"); | ||
301 | break; | 315 | break; |
302 | case Key_F10: //contacts | 316 | case Key_F10: //contacts |
303 | break; | 317 | break; |
304 | case Key_F11: //menu | 318 | case Key_F11: //menu |
305 | break; | 319 | break; |
306 | case Key_F12: //home | 320 | case Key_F12: //home |