summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/audiowidget.cpp
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/audiowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index ef7c8dc..9a55608 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -39,135 +39,136 @@ extern MediaPlayerState *mediaPlayerState;
static const int xo = -2; // movable x offset
static const int yo = 22; // movable y offset
struct MediaButton {
bool isToggle, isHeld, isDown;
};
//Layout information for the audioButtons (and if it is a toggle button or not)
MediaButton audioButtons[] = {
{ TRUE, FALSE, FALSE }, // play
{ FALSE, FALSE, FALSE }, // stop
{ FALSE, FALSE, FALSE }, // next
{ FALSE, FALSE, FALSE }, // previous
{ FALSE, FALSE, FALSE }, // volume up
{ FALSE, FALSE, FALSE }, // volume down
{ TRUE, FALSE, FALSE }, // repeat/loop
{ FALSE, FALSE, FALSE }, // playlist
{ FALSE, FALSE, FALSE }, // forward
{ FALSE, FALSE, FALSE } // back
};
const char *skin_mask_file_names[10] = {
"play", "stop", "next", "prev", "up",
"down", "loop", "playlist", "forward", "back"
};
static void changeTextColor( QWidget *w ) {
QPalette p = w->palette();
p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
w->setPalette( p );
}
static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this )
{
setCaption( tr("OpiePlayer") );
qDebug("<<<<<audioWidget");
Config cfg("OpiePlayer");
cfg.setGroup("Options");
skin = cfg.readEntry("Skin","default");
//skin = "scaleTest";
// color of background, frame, degree of transparency
+// QString skinPath = "opieplayer/skins/" + skin;
QString skinPath = "opieplayer2/skins/" + skin;
qDebug("skin path "+skinPath);
pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
imgButtonMask->fill( 0 );
for ( int i = 0; i < 10; i++ ) {
QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png";
masks[i] = new QBitmap( filename );
if ( !masks[i]->isNull() ) {
QImage imgMask = masks[i]->convertToImage();
uchar **dest = imgButtonMask->jumpTable();
for ( int y = 0; y < imgUp->height(); y++ ) {
uchar *line = dest[y];
for ( int x = 0; x < imgUp->width(); x++ )
if ( !qRed( imgMask.pixel( x, y ) ) )
line[x] = i + 1;
}
}
}
for ( int i = 0; i < 11; i++ ) {
buttonPixUp[i] = NULL;
buttonPixDown[i] = NULL;
}
setBackgroundPixmap( *pixBg );
songInfo.setFocusPolicy( QWidget::NoFocus );
- changeTextColor( &songInfo );
- songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
- songInfo.setFrameStyle( QFrame::NoFrame);
+// changeTextColor( &songInfo );
+// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
+// songInfo.setFrameStyle( QFrame::NoFrame);
// songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
//NoFrame
// songInfo.setForegroundColor(Qt::white);
slider.setFixedHeight( 20 );
slider.setMinValue( 0 );
slider.setMaxValue( 1 );
slider.setFocusPolicy( QWidget::NoFocus );
slider.setBackgroundPixmap( *pixBg );
time.setFocusPolicy( QWidget::NoFocus );
time.setAlignment( Qt::AlignCenter );
time.setFrame(FALSE);
changeTextColor( &time );
resizeEvent( NULL );
connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
// Intialise state
setLength( mediaPlayerState->length() );
setPosition( mediaPlayerState->position() );
setLooping( mediaPlayerState->fullscreen() );
// setPaused( mediaPlayerState->paused() );
setPlaying( mediaPlayerState->playing() );
}
AudioWidget::~AudioWidget() {
for ( int i = 0; i < 10; i++ ) {
delete buttonPixUp[i];
delete buttonPixDown[i];
}
delete pixBg;
delete imgUp;
delete imgDn;
delete imgButtonMask;
for ( int i = 0; i < 10; i++ ) {
delete masks[i];