author | simon <simon> | 2002-12-02 22:58:05 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 22:58:05 (UTC) |
commit | 779219b813f0eba82a8d9236fafd28dbafc594d1 (patch) (unidiff) | |
tree | cee0e78617f0e5c56c9ee8eaf44c41337faea977 /noncore/multimedia/opieplayer2 | |
parent | b3bf297da8836a678a21f2ebe83e0f1961f91d97 (diff) | |
download | opie-779219b813f0eba82a8d9236fafd28dbafc594d1.zip opie-779219b813f0eba82a8d9236fafd28dbafc594d1.tar.gz opie-779219b813f0eba82a8d9236fafd28dbafc594d1.tar.bz2 |
- replaced QPixmap and QImage pointer usage with value usage
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 38 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 10 |
2 files changed, 23 insertions, 25 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 41dddb7..c0039b1 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -94,42 +94,42 @@ MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 | |||
94 | 94 | ||
95 | Config cfg("OpiePlayer"); | 95 | Config cfg("OpiePlayer"); |
96 | cfg.setGroup("Options"); | 96 | cfg.setGroup("Options"); |
97 | skin = cfg.readEntry("Skin","default"); | 97 | skin = cfg.readEntry("Skin","default"); |
98 | 98 | ||
99 | QString skinPath = "opieplayer2/skins/" + skin; | 99 | QString skinPath = "opieplayer2/skins/" + skin; |
100 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 100 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
101 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 101 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
102 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 102 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
103 | 103 | ||
104 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 104 | imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
105 | imgButtonMask->fill( 0 ); | 105 | imgButtonMask.fill( 0 ); |
106 | 106 | ||
107 | for ( int i = 0; i < 7; i++ ) { | 107 | for ( int i = 0; i < 7; i++ ) { |
108 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 108 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
109 | masks[i] = new QBitmap( filename ); | 109 | masks[i] = new QBitmap( filename ); |
110 | 110 | ||
111 | if ( !masks[i]->isNull() ) { | 111 | if ( !masks[i]->isNull() ) { |
112 | QImage imgMask = masks[i]->convertToImage(); | 112 | QImage imgMask = masks[i]->convertToImage(); |
113 | uchar **dest = imgButtonMask->jumpTable(); | 113 | uchar **dest = imgButtonMask.jumpTable(); |
114 | for ( int y = 0; y < imgUp->height(); y++ ) { | 114 | for ( int y = 0; y < imgUp.height(); y++ ) { |
115 | uchar *line = dest[y]; | 115 | uchar *line = dest[y]; |
116 | for ( int x = 0; x < imgUp->width(); x++ ) { | 116 | for ( int x = 0; x < imgUp.width(); x++ ) { |
117 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 117 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
118 | line[x] = i + 1; | 118 | line[x] = i + 1; |
119 | } | 119 | } |
120 | } | 120 | } |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | for ( int i = 0; i < 7; i++ ) { | 124 | for ( int i = 0; i < 7; i++ ) { |
125 | buttonPixUp[i] = NULL; | 125 | buttonPixUp[i] = NULL; |
126 | buttonPixDown[i] = NULL; | 126 | buttonPixDown[i] = NULL; |
127 | } | 127 | } |
128 | 128 | ||
129 | setBackgroundPixmap( *pixBg ); | 129 | setBackgroundPixmap( pixBg ); |
130 | 130 | ||
131 | slider = new QSlider( Qt::Horizontal, this ); | 131 | slider = new QSlider( Qt::Horizontal, this ); |
132 | slider->setMinValue( 0 ); | 132 | slider->setMinValue( 0 ); |
133 | slider->setMaxValue( 1 ); | 133 | slider->setMaxValue( 1 ); |
134 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 134 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
135 | //slider->setFocusPolicy( QWidget::NoFocus ); | 135 | //slider->setFocusPolicy( QWidget::NoFocus ); |
@@ -147,16 +147,12 @@ VideoWidget::~VideoWidget() { | |||
147 | 147 | ||
148 | for ( int i = 0; i < 7; i++ ) { | 148 | for ( int i = 0; i < 7; i++ ) { |
149 | delete buttonPixUp[i]; | 149 | delete buttonPixUp[i]; |
150 | delete buttonPixDown[i]; | 150 | delete buttonPixDown[i]; |
151 | } | 151 | } |
152 | 152 | ||
153 | delete pixBg; | ||
154 | delete imgUp; | ||
155 | delete imgDn; | ||
156 | delete imgButtonMask; | ||
157 | for ( int i = 0; i < 7; i++ ) { | 153 | for ( int i = 0; i < 7; i++ ) { |
158 | delete masks[i]; | 154 | delete masks[i]; |
159 | } | 155 | } |
160 | 156 | ||
161 | } | 157 | } |
162 | 158 | ||
@@ -181,23 +177,23 @@ void VideoWidget::resizeEvent( QResizeEvent * ) { | |||
181 | //int Vw = 220; | 177 | //int Vw = 220; |
182 | 178 | ||
183 | slider->setFixedWidth( w - 20 ); | 179 | slider->setFixedWidth( w - 20 ); |
184 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 180 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
185 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 181 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
186 | slider->setFocusPolicy( QWidget::NoFocus ); | 182 | slider->setFocusPolicy( QWidget::NoFocus ); |
187 | slider->setBackgroundPixmap( *pixBg ); | 183 | slider->setBackgroundPixmap( pixBg ); |
188 | 184 | ||
189 | xoff = 0;// ( imgUp->width() ) / 2; | 185 | xoff = 0;// ( imgUp->width() ) / 2; |
190 | if(w>h) | 186 | if(w>h) |
191 | yoff = 0; | 187 | yoff = 0; |
192 | else | 188 | else |
193 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; | 189 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; |
194 | QPoint p( xoff, yoff ); | 190 | QPoint p( xoff, yoff ); |
195 | 191 | ||
196 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); | 192 | QPixmap *pixUp = combineVImageWithBackground( imgUp, pixBg, p ); |
197 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); | 193 | QPixmap *pixDn = combineVImageWithBackground( imgDn, pixBg, p ); |
198 | 194 | ||
199 | for ( int i = 0; i < 7; i++ ) { | 195 | for ( int i = 0; i < 7; i++ ) { |
200 | if ( !masks[i]->isNull() ) { | 196 | if ( !masks[i]->isNull() ) { |
201 | delete buttonPixUp[i]; | 197 | delete buttonPixUp[i]; |
202 | delete buttonPixDown[i]; | 198 | delete buttonPixDown[i]; |
203 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); | 199 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); |
@@ -288,15 +284,15 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
288 | for ( int i = 0; i < numVButtons; i++ ) { | 284 | for ( int i = 0; i < numVButtons; i++ ) { |
289 | if ( event->state() == QMouseEvent::LeftButton ) { | 285 | if ( event->state() == QMouseEvent::LeftButton ) { |
290 | // The test to see if the mouse click is inside the button or not | 286 | // The test to see if the mouse click is inside the button or not |
291 | int x = event->pos().x() - xoff; | 287 | int x = event->pos().x() - xoff; |
292 | int y = event->pos().y() - yoff; | 288 | int y = event->pos().y() - yoff; |
293 | 289 | ||
294 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 290 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() |
295 | && y < imgButtonMask->height() | 291 | && y < imgButtonMask.height() |
296 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 292 | && imgButtonMask.pixelIndex( x, y ) == i + 1 ); |
297 | 293 | ||
298 | if ( isOnButton && !videoButtons[i].isHeld ) { | 294 | if ( isOnButton && !videoButtons[i].isHeld ) { |
299 | videoButtons[i].isHeld = TRUE; | 295 | videoButtons[i].isHeld = TRUE; |
300 | toggleButton(i); | 296 | toggleButton(i); |
301 | 297 | ||
302 | switch (i) { | 298 | switch (i) { |
@@ -383,13 +379,13 @@ void VideoWidget::makeVisible() { | |||
383 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 379 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
384 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 380 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
385 | 381 | ||
386 | } else { | 382 | } else { |
387 | showNormal(); | 383 | showNormal(); |
388 | showMaximized(); | 384 | showMaximized(); |
389 | setBackgroundPixmap( *pixBg ); | 385 | setBackgroundPixmap( pixBg ); |
390 | QWidget *d = QApplication::desktop(); | 386 | QWidget *d = QApplication::desktop(); |
391 | int w = d->width(); | 387 | int w = d->width(); |
392 | int h = d->height(); | 388 | int h = d->height(); |
393 | 389 | ||
394 | if(w>h) { | 390 | if(w>h) { |
395 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 391 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
@@ -428,13 +424,13 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
428 | } else { | 424 | } else { |
429 | if ( !pe->erased() ) { | 425 | if ( !pe->erased() ) { |
430 | // Combine with background and double buffer | 426 | // Combine with background and double buffer |
431 | QPixmap pix( pe->rect().size() ); | 427 | QPixmap pix( pe->rect().size() ); |
432 | QPainter p( &pix ); | 428 | QPainter p( &pix ); |
433 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 429 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
434 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 430 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
435 | for ( int i = 0; i < numVButtons; i++ ) { | 431 | for ( int i = 0; i < numVButtons; i++ ) { |
436 | paintButton( &p, i ); | 432 | paintButton( &p, i ); |
437 | } | 433 | } |
438 | QPainter p2( this ); | 434 | QPainter p2( this ); |
439 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 435 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
440 | } else { | 436 | } else { |
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 149c78e..ae0e687 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -32,12 +32,14 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef VIDEO_WIDGET_H | 34 | #ifndef VIDEO_WIDGET_H |
35 | #define VIDEO_WIDGET_H | 35 | #define VIDEO_WIDGET_H |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qimage.h> | ||
39 | #include <qpixmap.h> | ||
38 | #include "xinevideowidget.h" | 40 | #include "xinevideowidget.h" |
39 | 41 | ||
40 | #include "mediawidget.h" | 42 | #include "mediawidget.h" |
41 | 43 | ||
42 | class QPixmap; | 44 | class QPixmap; |
43 | class QSlider; | 45 | class QSlider; |
@@ -92,16 +94,16 @@ protected: | |||
92 | void mousePressEvent( QMouseEvent *event ); | 94 | void mousePressEvent( QMouseEvent *event ); |
93 | void mouseReleaseEvent( QMouseEvent *event ); | 95 | void mouseReleaseEvent( QMouseEvent *event ); |
94 | void keyReleaseEvent( QKeyEvent *e); | 96 | void keyReleaseEvent( QKeyEvent *e); |
95 | 97 | ||
96 | private: | 98 | private: |
97 | // Ticker songInfo; | 99 | // Ticker songInfo; |
98 | QPixmap *pixBg; | 100 | QPixmap pixBg; |
99 | QImage *imgUp; | 101 | QImage imgUp; |
100 | QImage *imgDn; | 102 | QImage imgDn; |
101 | QImage *imgButtonMask; | 103 | QImage imgButtonMask; |
102 | QBitmap *masks[7]; | 104 | QBitmap *masks[7]; |
103 | QPixmap *buttonPixUp[7]; | 105 | QPixmap *buttonPixUp[7]; |
104 | QPixmap *buttonPixDown[7]; | 106 | QPixmap *buttonPixDown[7]; |
105 | QString skin; | 107 | QString skin; |
106 | // QPixmap *pixmaps[4]; | 108 | // QPixmap *pixmaps[4]; |
107 | int xoff, yoff; | 109 | int xoff, yoff; |