Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 83 |
1 files changed, 43 insertions, 40 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index fd18dbb..0516089 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -79,79 +79,40 @@ void changeTextColor( QWidget * w) { | |||
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 | Config cfg("OpiePlayer"); | 91 | loadSkin(); |
92 | cfg.setGroup("Options"); | ||
93 | skin = cfg.readEntry("Skin","default"); | ||
94 | //skin = "scaleTest"; | ||
95 | // color of background, frame, degree of transparency | ||
96 | |||
97 | QString skinPath = "opieplayer2/skins/" + skin; | ||
98 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | ||
99 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | ||
100 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | ||
101 | |||
102 | setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", imgUp.size() ); | ||
103 | |||
104 | setBackgroundPixmap( backgroundPixmap ); | ||
105 | |||
106 | songInfo.setFocusPolicy( QWidget::NoFocus ); | ||
107 | // changeTextColor( &songInfo ); | ||
108 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | ||
109 | // songInfo.setFrameStyle( QFrame::NoFrame); | ||
110 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | ||
111 | // songInfo.setForegroundColor(Qt::white); | ||
112 | |||
113 | slider.setFixedHeight( 20 ); | ||
114 | slider.setMinValue( 0 ); | ||
115 | slider.setMaxValue( 1 ); | ||
116 | slider.setFocusPolicy( QWidget::NoFocus ); | ||
117 | slider.setBackgroundPixmap( backgroundPixmap ); | ||
118 | |||
119 | // Config cofg("qpe"); | ||
120 | // cofg.setGroup("Appearance"); | ||
121 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); | ||
122 | |||
123 | time.setFocusPolicy( QWidget::NoFocus ); | ||
124 | time.setAlignment( Qt::AlignCenter ); | ||
125 | |||
126 | // time.setFrame(FALSE); | ||
127 | // changeTextColor( &time ); | ||
128 | |||
129 | resizeEvent( NULL ); | ||
130 | 92 | ||
131 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 93 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
132 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | 94 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); |
133 | 95 | ||
134 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 96 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
135 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 97 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
136 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 98 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
137 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 99 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
138 | 100 | ||
139 | // Intialise state | 101 | // Intialise state |
140 | setLength( mediaPlayerState.length() ); | 102 | setLength( mediaPlayerState.length() ); |
141 | setPosition( mediaPlayerState.position() ); | 103 | setPosition( mediaPlayerState.position() ); |
142 | setLooping( mediaPlayerState.isFullscreen() ); | 104 | setLooping( mediaPlayerState.isFullscreen() ); |
143 | // setPaused( mediaPlayerState->paused() ); | 105 | // setPaused( mediaPlayerState->paused() ); |
144 | setPlaying( mediaPlayerState.isPlaying() ); | 106 | setPlaying( mediaPlayerState.isPlaying() ); |
145 | |||
146 | } | 107 | } |
147 | 108 | ||
148 | AudioWidget::~AudioWidget() { | 109 | AudioWidget::~AudioWidget() { |
149 | 110 | ||
150 | // mediaPlayerState->setPlaying(false); | 111 | // mediaPlayerState->setPlaying(false); |
151 | } | 112 | } |
152 | 113 | ||
153 | namespace { | 114 | namespace { |
154 | 115 | ||
155 | QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 116 | QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
156 | QPixmap pix( img.width(), img.height() ); | 117 | QPixmap pix( img.width(), img.height() ); |
157 | QPainter p( &pix ); | 118 | QPainter p( &pix ); |
@@ -220,24 +181,66 @@ void AudioWidget::setLength( long max ) { | |||
220 | 181 | ||
221 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { | 182 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { |
222 | if ( mediaType == MediaPlayerState::Audio ) { | 183 | if ( mediaType == MediaPlayerState::Audio ) { |
223 | // startTimer( 150 ); | 184 | // startTimer( 150 ); |
224 | showMaximized(); | 185 | showMaximized(); |
225 | return; | 186 | return; |
226 | } | 187 | } |
227 | 188 | ||
228 | killTimers(); | 189 | killTimers(); |
229 | hide(); | 190 | hide(); |
230 | } | 191 | } |
231 | 192 | ||
193 | void AudioWidget::loadSkin() | ||
194 | { | ||
195 | Config cfg("OpiePlayer"); | ||
196 | cfg.setGroup("Options"); | ||
197 | skin = cfg.readEntry("Skin","default"); | ||
198 | //skin = "scaleTest"; | ||
199 | // color of background, frame, degree of transparency | ||
200 | |||
201 | QString skinPath = "opieplayer2/skins/" + skin; | ||
202 | backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | ||
203 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | ||
204 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | ||
205 | |||
206 | setupButtons( skinInfo, buttonCount, QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_", imgUp.size() ); | ||
207 | |||
208 | setBackgroundPixmap( backgroundPixmap ); | ||
209 | |||
210 | songInfo.setFocusPolicy( QWidget::NoFocus ); | ||
211 | // changeTextColor( &songInfo ); | ||
212 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | ||
213 | // songInfo.setFrameStyle( QFrame::NoFrame); | ||
214 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | ||
215 | // songInfo.setForegroundColor(Qt::white); | ||
216 | |||
217 | slider.setFixedHeight( 20 ); | ||
218 | slider.setMinValue( 0 ); | ||
219 | slider.setMaxValue( 1 ); | ||
220 | slider.setFocusPolicy( QWidget::NoFocus ); | ||
221 | slider.setBackgroundPixmap( backgroundPixmap ); | ||
222 | |||
223 | // Config cofg("qpe"); | ||
224 | // cofg.setGroup("Appearance"); | ||
225 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); | ||
226 | |||
227 | time.setFocusPolicy( QWidget::NoFocus ); | ||
228 | time.setAlignment( Qt::AlignCenter ); | ||
229 | |||
230 | // time.setFrame(FALSE); | ||
231 | // changeTextColor( &time ); | ||
232 | |||
233 | resizeEvent( 0 ); | ||
234 | } | ||
232 | 235 | ||
233 | void AudioWidget::setSeekable( bool isSeekable ) { | 236 | void AudioWidget::setSeekable( bool isSeekable ) { |
234 | 237 | ||
235 | if ( !isSeekable ) { | 238 | if ( !isSeekable ) { |
236 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 239 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
237 | if( !slider.isHidden()) { | 240 | if( !slider.isHidden()) { |
238 | slider.hide(); | 241 | slider.hide(); |
239 | } | 242 | } |
240 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 243 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
241 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 244 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
242 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 245 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
243 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 246 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |