summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-04-19 15:14:55 (UTC)
committer llornkcor <llornkcor>2003-04-19 15:14:55 (UTC)
commit89ced5d0c4f4ce89a11333d80aac2f8b81d97233 (patch) (unidiff)
treec6cc7903731bd8a40db43a9d4fc0488daee46d9a
parentb8ac94f049b5a2de9a3567ee60dd98139321a0cf (diff)
downloadopie-89ced5d0c4f4ce89a11333d80aac2f8b81d97233.zip
opie-89ced5d0c4f4ce89a11333d80aac2f8b81d97233.tar.gz
opie-89ced5d0c4f4ce89a11333d80aac2f8b81d97233.tar.bz2
fix skin handling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index 3dfe182..a1973e9 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -26,129 +26,129 @@
26#include <qbutton.h> 26#include <qbutton.h>
27#include <qpainter.h> 27#include <qpainter.h>
28#include <qframe.h> 28#include <qframe.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qdir.h> 30#include <qdir.h>
31#include "audiowidget.h" 31#include "audiowidget.h"
32#include "mediaplayerstate.h" 32#include "mediaplayerstate.h"
33 33
34#include <stdlib.h> 34#include <stdlib.h>
35#include <stdio.h> 35#include <stdio.h>
36 36
37extern MediaPlayerState *mediaPlayerState; 37extern MediaPlayerState *mediaPlayerState;
38 38
39 39
40static const int xo = -2; // movable x offset 40static const int xo = -2; // movable x offset
41static const int yo = 22; // movable y offset 41static const int yo = 22; // movable y offset
42 42
43struct MediaButton { 43struct MediaButton {
44 bool isToggle, isHeld, isDown; 44 bool isToggle, isHeld, isDown;
45}; 45};
46 46
47//Layout information for the audioButtons (and if it is a toggle button or not) 47//Layout information for the audioButtons (and if it is a toggle button or not)
48MediaButton audioButtons[] = { 48MediaButton audioButtons[] = {
49 { TRUE, FALSE, FALSE }, // play 49 { TRUE, FALSE, FALSE }, // play
50 { FALSE, FALSE, FALSE }, // stop 50 { FALSE, FALSE, FALSE }, // stop
51 { FALSE, FALSE, FALSE }, // next 51 { FALSE, FALSE, FALSE }, // next
52 { FALSE, FALSE, FALSE }, // previous 52 { FALSE, FALSE, FALSE }, // previous
53 { FALSE, FALSE, FALSE }, // volume up 53 { FALSE, FALSE, FALSE }, // volume up
54 { FALSE, FALSE, FALSE }, // volume down 54 { FALSE, FALSE, FALSE }, // volume down
55 { TRUE, FALSE, FALSE }, // repeat/loop 55 { TRUE, FALSE, FALSE }, // repeat/loop
56 { FALSE, FALSE, FALSE }, // playlist 56 { FALSE, FALSE, FALSE }, // playlist
57 { FALSE, FALSE, FALSE }, // forward 57 { FALSE, FALSE, FALSE }, // forward
58 { FALSE, FALSE, FALSE } // back 58 { FALSE, FALSE, FALSE } // back
59}; 59};
60 60
61const char *skin_mask_file_names[10] = { 61const char *skin_mask_file_names[10] = {
62 "play", "stop", "next", "prev", "up", 62 "play", "stop", "next", "prev", "up",
63 "down", "loop", "playlist", "forward", "back" 63 "down", "loop", "playlist", "forward", "back"
64}; 64};
65 65
66static void changeTextColor( QWidget *w ) { 66static void changeTextColor( QWidget *w ) {
67 QPalette p = w->palette(); 67 QPalette p = w->palette();
68 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 68 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
69 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 69 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
70 w->setPalette( p ); 70 w->setPalette( p );
71} 71}
72 72
73static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 73static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
74 74
75AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 75AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
76 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) 76 QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this )
77{ 77{
78 setCaption( tr("OpiePlayer") ); 78 setCaption( tr("OpiePlayer") );
79 qDebug("<<<<<audioWidget"); 79 qDebug("<<<<<audioWidget");
80 80
81 Config cfg("OpiePlayer"); 81 Config cfg("OpiePlayer");
82 cfg.setGroup("Options"); 82 cfg.setGroup("Options");
83 skin = cfg.readEntry("Skin","default"); 83 skin = cfg.readEntry("Skin","default");
84 //skin = "scaleTest"; 84 //skin = "scaleTest";
85// color of background, frame, degree of transparency 85// color of background, frame, degree of transparency
86 86
87// QString skinPath = "opieplayer/skins/" + skin; 87// QString skinPath = "opieplayer/skins/" + skin;
88 QString skinPath; 88 QString skinPath;
89 skinPath = "opieplayer2/skins/" + skin; 89 skinPath = "opieplayer2/skins/" + skin;
90 if(!QDir(skinPath).exists()) 90 if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists())
91 skinPath = "opieplayer2/skins/default"; 91 skinPath = "opieplayer2/skins/default";
92 92
93 qDebug("skin path " + skinPath); 93 qDebug("skin path " + skinPath);
94 94
95 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 95 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
96 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 96 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
97 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 97 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
98 98
99 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 99 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
100 imgButtonMask->fill( 0 ); 100 imgButtonMask->fill( 0 );
101 101
102 for ( int i = 0; i < 10; i++ ) { 102 for ( int i = 0; i < 10; i++ ) {
103 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; 103 QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png";
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 118
119 for ( int i = 0; i < 11; i++ ) { 119 for ( int i = 0; i < 11; i++ ) {
120 buttonPixUp[i] = NULL; 120 buttonPixUp[i] = NULL;
121 buttonPixDown[i] = NULL; 121 buttonPixDown[i] = NULL;
122 } 122 }
123 123
124 setBackgroundPixmap( *pixBg ); 124 setBackgroundPixmap( *pixBg );
125 125
126 songInfo.setFocusPolicy( QWidget::NoFocus ); 126 songInfo.setFocusPolicy( QWidget::NoFocus );
127 127
128// changeTextColor( &songInfo ); 128// changeTextColor( &songInfo );
129// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 129// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
130// songInfo.setFrameStyle( QFrame::NoFrame); 130// songInfo.setFrameStyle( QFrame::NoFrame);
131// songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 131// songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
132 //NoFrame 132 //NoFrame
133// songInfo.setForegroundColor(Qt::white); 133// songInfo.setForegroundColor(Qt::white);
134 134
135 slider.setFixedHeight( 20 ); 135 slider.setFixedHeight( 20 );
136 slider.setMinValue( 0 ); 136 slider.setMinValue( 0 );
137 slider.setMaxValue( 1 ); 137 slider.setMaxValue( 1 );
138 slider.setFocusPolicy( QWidget::NoFocus ); 138 slider.setFocusPolicy( QWidget::NoFocus );
139 slider.setBackgroundPixmap( *pixBg ); 139 slider.setBackgroundPixmap( *pixBg );
140 140
141 time.setFocusPolicy( QWidget::NoFocus ); 141 time.setFocusPolicy( QWidget::NoFocus );
142 time.setAlignment( Qt::AlignCenter ); 142 time.setAlignment( Qt::AlignCenter );
143 time.setFrame(FALSE); 143 time.setFrame(FALSE);
144 changeTextColor( &time ); 144 changeTextColor( &time );
145 145
146 resizeEvent( NULL ); 146 resizeEvent( NULL );
147 147
148 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 148 connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
149 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 149 connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
150 150
151 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 151 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
152 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 152 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
153 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 153 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
154// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 154// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );