author | simon <simon> | 2002-12-11 16:10:09 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-11 16:10:09 (UTC) |
commit | ba5eeb8ae2a59c896a9228f48022acf3f34b54a6 (patch) (unidiff) | |
tree | 1656c18449132732a42441c2fa8d789c47776ebf | |
parent | 22f4babbd8ed8f431bbc92ef83cf46dbeabade88 (diff) | |
download | opie-ba5eeb8ae2a59c896a9228f48022acf3f34b54a6.zip opie-ba5eeb8ae2a59c896a9228f48022acf3f34b54a6.tar.gz opie-ba5eeb8ae2a59c896a9228f48022acf3f34b54a6.tar.bz2 |
- ah, forgot to remove this unused code
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index bb07882..78079dd 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -50,147 +50,128 @@ | |||
50 | #include "mediaplayerstate.h" | 50 | #include "mediaplayerstate.h" |
51 | #include "playlistwidget.h" | 51 | #include "playlistwidget.h" |
52 | 52 | ||
53 | namespace | 53 | namespace |
54 | { | 54 | { |
55 | 55 | ||
56 | const int xo = -2; // movable x offset | 56 | const int xo = -2; // movable x offset |
57 | const int yo = 22; // movable y offset | 57 | const int yo = 22; // movable y offset |
58 | 58 | ||
59 | const MediaWidget::SkinButtonInfo skinInfo[] = | 59 | const MediaWidget::SkinButtonInfo skinInfo[] = |
60 | { | 60 | { |
61 | { MediaWidget::Play, "play", MediaWidget::ToggleButton }, | 61 | { MediaWidget::Play, "play", MediaWidget::ToggleButton }, |
62 | { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, | 62 | { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, |
63 | { MediaWidget::Next, "next", MediaWidget::NormalButton }, | 63 | { MediaWidget::Next, "next", MediaWidget::NormalButton }, |
64 | { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, | 64 | { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, |
65 | { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, | 65 | { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, |
66 | { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, | 66 | { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, |
67 | { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, | 67 | { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, |
68 | { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, | 68 | { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, |
69 | { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, | 69 | { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, |
70 | { MediaWidget::Back, "back", MediaWidget::NormalButton } | 70 | { MediaWidget::Back, "back", MediaWidget::NormalButton } |
71 | }; | 71 | }; |
72 | 72 | ||
73 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); | 73 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); |
74 | 74 | ||
75 | void changeTextColor( QWidget * w) { | 75 | void changeTextColor( QWidget * w) { |
76 | QPalette p = w->palette(); | 76 | QPalette p = w->palette(); |
77 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 77 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
78 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 78 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
79 | w->setPalette( p ); | 79 | w->setPalette( p ); |
80 | } | 80 | } |
81 | 81 | ||
82 | } | 82 | } |
83 | 83 | ||
84 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : | 84 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : |
85 | 85 | ||
86 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), | 86 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), |
87 | audioSliderBeingMoved( false ) | 87 | audioSliderBeingMoved( false ) |
88 | { | 88 | { |
89 | setCaption( tr("OpiePlayer") ); | 89 | setCaption( tr("OpiePlayer") ); |
90 | 90 | ||
91 | loadSkin(); | 91 | loadSkin(); |
92 | 92 | ||
93 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 93 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
94 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | 94 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); |
95 | 95 | ||
96 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 96 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
97 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 97 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
98 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 98 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
99 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 99 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
100 | 100 | ||
101 | // Intialise state | 101 | // Intialise state |
102 | setLength( mediaPlayerState.length() ); | 102 | setLength( mediaPlayerState.length() ); |
103 | setPosition( mediaPlayerState.position() ); | 103 | setPosition( mediaPlayerState.position() ); |
104 | setLooping( mediaPlayerState.isFullscreen() ); | 104 | setLooping( mediaPlayerState.isFullscreen() ); |
105 | // setPaused( mediaPlayerState->paused() ); | 105 | // setPaused( mediaPlayerState->paused() ); |
106 | setPlaying( mediaPlayerState.isPlaying() ); | 106 | setPlaying( mediaPlayerState.isPlaying() ); |
107 | } | 107 | } |
108 | 108 | ||
109 | AudioWidget::~AudioWidget() { | 109 | AudioWidget::~AudioWidget() { |
110 | 110 | ||
111 | // mediaPlayerState->setPlaying(false); | 111 | // mediaPlayerState->setPlaying(false); |
112 | } | 112 | } |
113 | 113 | ||
114 | namespace { | ||
115 | |||
116 | QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | ||
117 | QPixmap pix( img.width(), img.height() ); | ||
118 | QPainter p( &pix ); | ||
119 | p.drawTiledPixmap( pix.rect(), bg, offset ); | ||
120 | p.drawImage( 0, 0, img ); | ||
121 | return pix; | ||
122 | } | ||
123 | |||
124 | |||
125 | QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) { | ||
126 | QPixmap pixmap( pix ); | ||
127 | pixmap.setMask( mask ); | ||
128 | return pixmap; | ||
129 | } | ||
130 | |||
131 | }; | ||
132 | |||
133 | void AudioWidget::resizeEvent( QResizeEvent *e ) { | 114 | void AudioWidget::resizeEvent( QResizeEvent *e ) { |
134 | int h = height(); | 115 | int h = height(); |
135 | int w = width(); | 116 | int w = width(); |
136 | 117 | ||
137 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); | 118 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); |
138 | slider.setFixedWidth( w - 110 ); | 119 | slider.setFixedWidth( w - 110 ); |
139 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 120 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
140 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 121 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
141 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 122 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
142 | 123 | ||
143 | upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; | 124 | upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; |
144 | upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; | 125 | upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; |
145 | 126 | ||
146 | MediaWidget::resizeEvent( e ); | 127 | MediaWidget::resizeEvent( e ); |
147 | } | 128 | } |
148 | 129 | ||
149 | void AudioWidget::sliderPressed() { | 130 | void AudioWidget::sliderPressed() { |
150 | audioSliderBeingMoved = TRUE; | 131 | audioSliderBeingMoved = TRUE; |
151 | } | 132 | } |
152 | 133 | ||
153 | 134 | ||
154 | void AudioWidget::sliderReleased() { | 135 | void AudioWidget::sliderReleased() { |
155 | audioSliderBeingMoved = FALSE; | 136 | audioSliderBeingMoved = FALSE; |
156 | if ( slider.width() == 0 ) | 137 | if ( slider.width() == 0 ) |
157 | return; | 138 | return; |
158 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); | 139 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); |
159 | mediaPlayerState.setPosition( val ); | 140 | mediaPlayerState.setPosition( val ); |
160 | } | 141 | } |
161 | 142 | ||
162 | void AudioWidget::setPosition( long i ) { | 143 | void AudioWidget::setPosition( long i ) { |
163 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 144 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
164 | updateSlider( i, mediaPlayerState.length() ); | 145 | updateSlider( i, mediaPlayerState.length() ); |
165 | } | 146 | } |
166 | 147 | ||
167 | 148 | ||
168 | void AudioWidget::setLength( long max ) { | 149 | void AudioWidget::setLength( long max ) { |
169 | updateSlider( mediaPlayerState.position(), max ); | 150 | updateSlider( mediaPlayerState.position(), max ); |
170 | } | 151 | } |
171 | 152 | ||
172 | 153 | ||
173 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { | 154 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { |
174 | if ( mediaType == MediaPlayerState::Audio ) { | 155 | if ( mediaType == MediaPlayerState::Audio ) { |
175 | // startTimer( 150 ); | 156 | // startTimer( 150 ); |
176 | showMaximized(); | 157 | showMaximized(); |
177 | return; | 158 | return; |
178 | } | 159 | } |
179 | 160 | ||
180 | killTimers(); | 161 | killTimers(); |
181 | hide(); | 162 | hide(); |
182 | } | 163 | } |
183 | 164 | ||
184 | void AudioWidget::loadSkin() | 165 | void AudioWidget::loadSkin() |
185 | { | 166 | { |
186 | loadDefaultSkin( skinInfo, buttonCount ); | 167 | loadDefaultSkin( skinInfo, buttonCount ); |
187 | 168 | ||
188 | setBackgroundPixmap( backgroundPixmap ); | 169 | setBackgroundPixmap( backgroundPixmap ); |
189 | 170 | ||
190 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 171 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
191 | // changeTextColor( &songInfo ); | 172 | // changeTextColor( &songInfo ); |
192 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 173 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
193 | // songInfo.setFrameStyle( QFrame::NoFrame); | 174 | // songInfo.setFrameStyle( QFrame::NoFrame); |
194 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 175 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
195 | // songInfo.setForegroundColor(Qt::white); | 176 | // songInfo.setForegroundColor(Qt::white); |
196 | 177 | ||