summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/videowidget.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/videowidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index 2396ed5..c545511 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -53,97 +53,97 @@ struct MediaButton {
53// int controlType; 53// int controlType;
54}; 54};
55 55
56 56
57// Layout information for the videoButtons (and if it is a toggle button or not) 57// Layout information for the videoButtons (and if it is a toggle button or not)
58MediaButton videoButtons[] = { 58MediaButton videoButtons[] = {
59 { FALSE, FALSE, FALSE }, // stop 59 { FALSE, FALSE, FALSE }, // stop
60 { FALSE, FALSE, FALSE }, // play 60 { FALSE, FALSE, FALSE }, // play
61 { FALSE, FALSE, FALSE }, // previous 61 { FALSE, FALSE, FALSE }, // previous
62 { FALSE, FALSE, FALSE }, // next 62 { FALSE, FALSE, FALSE }, // next
63 { FALSE, FALSE, FALSE }, // volUp 63 { FALSE, FALSE, FALSE }, // volUp
64 { FALSE, FALSE, FALSE }, // volDown 64 { FALSE, FALSE, FALSE }, // volDown
65 { TRUE, FALSE, FALSE } // fullscreen 65 { TRUE, FALSE, FALSE } // fullscreen
66}; 66};
67 67
68//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 68//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton));
69 69
70const char *skinV_mask_file_names[7] = { 70const char *skinV_mask_file_names[7] = {
71 "stop","play","back","fwd","up","down","full" 71 "stop","play","back","fwd","up","down","full"
72}; 72};
73 73
74static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 74static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
75 75
76VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : 76VideoWidget::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 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 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + 101 QString filename = QString( QPEApplication::qpeDir() + "pics/" + skinPath +
102 "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); 102 "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
103 // odebug << "loading "+filename << oendl; 103 // odebug << "loading "+filename << oendl;
104 masks[i] = new QBitmap( filename ); 104 masks[i] = new QBitmap( filename );
105 105
106 if ( !masks[i]->isNull() ) { 106 if ( !masks[i]->isNull() ) {
107 QImage imgMask = masks[i]->convertToImage(); 107 QImage imgMask = masks[i]->convertToImage();
108 uchar **dest = imgButtonMask->jumpTable(); 108 uchar **dest = imgButtonMask->jumpTable();
109 for ( int y = 0; y < imgUp->height(); y++ ) { 109 for ( int y = 0; y < imgUp->height(); y++ ) {
110 uchar *line = dest[y]; 110 uchar *line = dest[y];
111 for ( int x = 0; x < imgUp->width(); x++ ) { 111 for ( int x = 0; x < imgUp->width(); x++ ) {
112 if ( !qRed( imgMask.pixel( x, y ) ) ) 112 if ( !qRed( imgMask.pixel( x, y ) ) )
113 line[x] = i + 1; 113 line[x] = i + 1;
114 } 114 }
115 } 115 }
116 } 116 }
117 } 117 }
118 for ( int i = 0; i < 7; i++ ) { 118 for ( int i = 0; i < 7; i++ ) {
119 buttonPixUp[i] = NULL; 119 buttonPixUp[i] = NULL;
120 buttonPixDown[i] = NULL; 120 buttonPixDown[i] = NULL;
121 } 121 }
122 122
123 QWidget *d = QApplication::desktop(); 123 QWidget *d = QApplication::desktop();
124 int width = d->width(); 124 int width = d->width();
125 int height = d->height(); 125 int height = d->height();
126 126
127 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { 127 if( (width != pixBg->width() ) || (height != pixBg->height() ) ) {
128 QImage img; 128 QImage img;
129 img = pixBg->convertToImage(); 129 img = pixBg->convertToImage();
130 pixBg->convertFromImage( img.smoothScale( width, height)); 130 pixBg->convertFromImage( img.smoothScale( width, height));
131 } 131 }
132 132
133 setBackgroundPixmap( *pixBg ); 133 setBackgroundPixmap( *pixBg );
134 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); 134 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
135 slider = new QSlider( Qt::Horizontal, this ); 135 slider = new QSlider( Qt::Horizontal, this );
136 slider->setMinValue( 0 ); 136 slider->setMinValue( 0 );
137 slider->setMaxValue( 1 ); 137 slider->setMaxValue( 1 );
138 138
139 slider->setBackgroundPixmap( *pixBg ); 139 slider->setBackgroundPixmap( *pixBg );
140 slider->setFocusPolicy( QWidget::NoFocus ); 140 slider->setFocusPolicy( QWidget::NoFocus );
141// slider->setGeometry( QRect( 7, 250, 220, 20 ) ); 141// slider->setGeometry( QRect( 7, 250, 220, 20 ) );
142 142
143 connect(slider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); 143 connect(slider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed()));
144 connect(slider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); 144 connect(slider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased()));
145 145
146 connect(mediaPlayerState,SIGNAL(lengthChanged(long)),this,SLOT(setLength(long))); 146 connect(mediaPlayerState,SIGNAL(lengthChanged(long)),this,SLOT(setLength(long)));
147 connect(mediaPlayerState,SIGNAL(positionChanged(long)),this,SLOT(setPosition(long))); 147 connect(mediaPlayerState,SIGNAL(positionChanged(long)),this,SLOT(setPosition(long)));
148 connect(mediaPlayerState,SIGNAL(positionUpdated(long)),this,SLOT(setPosition(long))); 148 connect(mediaPlayerState,SIGNAL(positionUpdated(long)),this,SLOT(setPosition(long)));
149 connect(mediaPlayerState,SIGNAL(viewChanged(char)),this,SLOT(setView(char))); 149 connect(mediaPlayerState,SIGNAL(viewChanged(char)),this,SLOT(setView(char)));