author | llornkcor <llornkcor> | 2004-09-18 11:42:01 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-18 11:42:01 (UTC) |
commit | d4e33108b974aa802f10d30a6a082adf67681224 (patch) (unidiff) | |
tree | 2c172af340d9bd4f7b85d4e42c33f8d190ef63f2 /core/multimedia/opieplayer | |
parent | 35d96e2215c765da2270589c059c717a858333ca (diff) | |
download | opie-d4e33108b974aa802f10d30a6a082adf67681224.zip opie-d4e33108b974aa802f10d30a6a082adf67681224.tar.gz opie-d4e33108b974aa802f10d30a6a082adf67681224.tar.bz2 |
fix crash #1408
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index e851044..2396ed5 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -76,16 +76,15 @@ static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | |||
76 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 76 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
77 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) | 77 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) |
78 | { | 78 | { |
79 | setCaption( tr("OpiePlayer") ); | 79 | setCaption( tr("OpiePlayer") ); |
80 | Config cfg("OpiePlayer"); | 80 | Config cfg("OpiePlayer"); |
81 | 81 | ||
82 | cfg.setGroup("Options"); | 82 | cfg.setGroup("Options"); |
83 | skin = cfg.readEntry("Skin","default"); | 83 | skin = cfg.readEntry("Skin","default"); |
84 | 84 | ||
85 | QString skinPath; | 85 | QString skinPath; |
86 | skinPath = "opieplayer2/skins/" + skin; | 86 | skinPath = "opieplayer2/skins/" + skin; |
87 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) | 87 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) |
88 | skinPath = "opieplayer2/skins/default"; | 88 | skinPath = "opieplayer2/skins/default"; |
89 | 89 | ||
90 | // odebug << "skin path " + skinPath << oendl; | ||
91 | 90 | ||
@@ -93,71 +92,69 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
93 | 92 | ||
94 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 93 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
95 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 94 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
96 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 95 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
97 | 96 | ||
98 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 97 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
99 | imgButtonMask->fill( 0 ); | 98 | imgButtonMask->fill( 0 ); |
100 | 99 | ||
101 | for ( int i = 0; i < 7; i++ ) { | 100 | for ( int i = 0; i < 7; i++ ) { |
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 | // odebug << "loading "+filename << oendl; | 103 | // odebug << "loading "+filename << oendl; |
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 | QImage imgMask = masks[i]->convertToImage(); | 107 | QImage imgMask = masks[i]->convertToImage(); |
109 | uchar **dest = imgButtonMask->jumpTable(); | 108 | uchar **dest = imgButtonMask->jumpTable(); |
110 | for ( int y = 0; y < imgUp->height(); y++ ) { | 109 | for ( int y = 0; y < imgUp->height(); y++ ) { |
111 | uchar *line = dest[y]; | 110 | uchar *line = dest[y]; |
112 | for ( int x = 0; x < imgUp->width(); x++ ) { | 111 | for ( int x = 0; x < imgUp->width(); x++ ) { |
113 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 112 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
114 | line[x] = i + 1; | 113 | line[x] = i + 1; |
115 | } | 114 | } |
116 | } | 115 | } |
117 | } | 116 | } |
118 | } | 117 | } |
119 | // odebug << "finished loading first pics" << oendl; | 118 | for ( int i = 0; i < 7; i++ ) { |
120 | for ( int i = 0; i < 7; i++ ) { | 119 | buttonPixUp[i] = NULL; |
121 | buttonPixUp[i] = NULL; | 120 | buttonPixDown[i] = NULL; |
122 | buttonPixDown[i] = NULL; | 121 | } |
123 | } | 122 | |
124 | 123 | QWidget *d = QApplication::desktop(); | |
125 | 124 | int width = d->width(); | |
126 | QWidget *d = QApplication::desktop(); | 125 | int height = d->height(); |
127 | int width = d->width(); | 126 | |
128 | int height = d->height(); | 127 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { |
129 | 128 | QImage img; | |
130 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { | 129 | img = pixBg->convertToImage(); |
131 | // odebug << "<<<<<<<< scale image >>>>>>>>>>>>" << oendl; | 130 | pixBg->convertFromImage( img.smoothScale( width, height)); |
132 | QImage img; | 131 | } |
133 | img = pixBg->convertToImage(); | 132 | |
134 | pixBg->convertFromImage( img.smoothScale( width, height)); | 133 | setBackgroundPixmap( *pixBg ); |
135 | } | 134 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); |
136 | setBackgroundPixmap( *pixBg ); | 135 | slider = new QSlider( Qt::Horizontal, this ); |
137 | 136 | slider->setMinValue( 0 ); | |
138 | currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); | 137 | slider->setMaxValue( 1 ); |
139 | 138 | ||
140 | slider = new QSlider( Qt::Horizontal, this ); | 139 | slider->setBackgroundPixmap( *pixBg ); |
141 | slider->setMinValue( 0 ); | 140 | slider->setFocusPolicy( QWidget::NoFocus ); |
142 | slider->setMaxValue( 1 ); | ||
143 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | ||
144 | slider->setFocusPolicy( QWidget::NoFocus ); | ||
145 | // slider->setGeometry( QRect( 7, 250, 220, 20 ) ); | 141 | // slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |
146 | 142 | ||
147 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 143 | connect(slider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); |
148 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 144 | connect(slider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); |
149 | 145 | ||
150 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 146 | connect(mediaPlayerState,SIGNAL(lengthChanged(long)),this,SLOT(setLength(long))); |
151 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 147 | connect(mediaPlayerState,SIGNAL(positionChanged(long)),this,SLOT(setPosition(long))); |
152 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 148 | connect(mediaPlayerState,SIGNAL(positionUpdated(long)),this,SLOT(setPosition(long))); |
153 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 149 | connect(mediaPlayerState,SIGNAL(viewChanged(char)),this,SLOT(setView(char))); |
154 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 150 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
155 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 151 | connect(mediaPlayerState,SIGNAL(playingToggled(bool)),this,SLOT(setPlaying(bool))); |
156 | 152 | ||
157 | // Intialise state | 153 | // Intialise state |
158 | setLength( mediaPlayerState->length() ); | 154 | setLength( mediaPlayerState->length() ); |
159 | setPosition( mediaPlayerState->position() ); | 155 | setPosition( mediaPlayerState->position() ); |
160 | setFullscreen( mediaPlayerState->fullscreen() ); | 156 | setFullscreen( mediaPlayerState->fullscreen() ); |
161 | // setPaused( mediaPlayerState->paused() ); | 157 | // setPlaying( mediaPlayerState->playing() ); |
162 | setPlaying( mediaPlayerState->playing() ); | 158 | // if(this->x() < 0 || this->y() < 0) |
159 | // this->move(0,0); | ||
163 | } | 160 | } |
@@ -474,2 +471,6 @@ bool VideoWidget::playVideo() { | |||
474 | 471 | ||
472 | QWidget *d = QApplication::desktop(); | ||
473 | int d_width = d->width(); | ||
474 | int d_height = d->height(); | ||
475 | |||
475 | ColorFormat format = (dd == 16) ? RGB565 : BGRA8888; | 476 | ColorFormat format = (dd == 16) ? RGB565 : BGRA8888; |
@@ -485,4 +486,4 @@ bool VideoWidget::playVideo() { | |||
485 | 486 | ||
486 | w = 320; | 487 | w = d_width; //320; |
487 | h = 240; | 488 | h = d_height; //240; |
488 | 489 | ||
@@ -527,5 +528,4 @@ bool VideoWidget::playVideo() { | |||
527 | QPainter p(this); | 528 | QPainter p(this); |
528 | 529 | w = d_width; //320; | |
529 | w = 320; | 530 | h = d_height; //240; |
530 | h = 240; | ||
531 | 531 | ||