Diffstat (limited to 'core/multimedia/opieplayer/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 02c8568..d9a9478 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -76,77 +76,83 @@ 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 | { | ||
102 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + | 101 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + |
103 | "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 102 | "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
104 | // qDebug("loading "+filename); | 103 | // qDebug("loading "+filename); |
105 | masks[i] = new QBitmap( filename ); | 104 | masks[i] = new QBitmap( filename ); |
106 | 105 | ||
107 | if ( !masks[i]->isNull() ) | 106 | if ( !masks[i]->isNull() ) { |
108 | { | ||
109 | QImage imgMask = masks[i]->convertToImage(); | 107 | QImage imgMask = masks[i]->convertToImage(); |
110 | uchar **dest = imgButtonMask->jumpTable(); | 108 | uchar **dest = imgButtonMask->jumpTable(); |
111 | for ( int y = 0; y < imgUp->height(); y++ ) | 109 | for ( int y = 0; y < imgUp->height(); y++ ) { |
112 | { | ||
113 | uchar *line = dest[y]; | 110 | uchar *line = dest[y]; |
114 | for ( int x = 0; x < imgUp->width(); x++ ) | 111 | for ( int x = 0; x < imgUp->width(); x++ ) { |
115 | { | ||
116 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 112 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
117 | line[x] = i + 1; | 113 | line[x] = i + 1; |
118 | } | 114 | } |
119 | } | 115 | } |
120 | } | 116 | } |
121 | } | 117 | } |
122 | // qDebug("finished loading first pics"); | 118 | // qDebug("finished loading first pics"); |
123 | for ( int i = 0; i < 7; i++ ) | 119 | for ( int i = 0; i < 7; i++ ) { |
124 | { | ||
125 | buttonPixUp[i] = NULL; | 120 | buttonPixUp[i] = NULL; |
126 | buttonPixDown[i] = NULL; | 121 | buttonPixDown[i] = NULL; |
127 | } | 122 | } |
128 | 123 | ||
124 | |||
125 | QWidget *d = QApplication::desktop(); | ||
126 | int width = d->width(); | ||
127 | int height = d->height(); | ||
128 | |||
129 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { | ||
130 | // qDebug("<<<<<<<< scale image >>>>>>>>>>>>"); | ||
131 | QImage img; | ||
132 | img = pixBg->convertToImage(); | ||
133 | pixBg->convertFromImage( img.smoothScale( width, height)); | ||
134 | } | ||
129 | setBackgroundPixmap( *pixBg ); | 135 | setBackgroundPixmap( *pixBg ); |
130 | 136 | ||
131 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); | 137 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); |
132 | 138 | ||
133 | slider = new QSlider( Qt::Horizontal, this ); | 139 | slider = new QSlider( Qt::Horizontal, this ); |
134 | slider->setMinValue( 0 ); | 140 | slider->setMinValue( 0 ); |
135 | slider->setMaxValue( 1 ); | 141 | slider->setMaxValue( 1 ); |
136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 142 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
137 | slider->setFocusPolicy( QWidget::NoFocus ); | 143 | slider->setFocusPolicy( QWidget::NoFocus ); |
138 | // slider->setGeometry( QRect( 7, 250, 220, 20 ) ); | 144 | // slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |
139 | 145 | ||
140 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 146 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
141 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 147 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
142 | 148 | ||
143 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 149 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
144 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 150 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
145 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 151 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
146 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 152 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
147 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 153 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
148 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 154 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
149 | 155 | ||
150 | // Intialise state | 156 | // Intialise state |
151 | setLength( mediaPlayerState->length() ); | 157 | setLength( mediaPlayerState->length() ); |
152 | setPosition( mediaPlayerState->position() ); | 158 | setPosition( mediaPlayerState->position() ); |