-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 9f384cc..31687b9 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -44,129 +44,129 @@ void Ticker::setText( const QString& text ) { | |||
44 | 44 | ||
45 | void Ticker::timerEvent( QTimerEvent * ) { | 45 | void Ticker::timerEvent( QTimerEvent * ) { |
46 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; | 46 | pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1; |
47 | scroll( -1, 0, contentsRect() ); | 47 | scroll( -1, 0, contentsRect() ); |
48 | repaint( FALSE ); | 48 | repaint( FALSE ); |
49 | } | 49 | } |
50 | 50 | ||
51 | void Ticker::drawContents( QPainter *p ) { | 51 | void Ticker::drawContents( QPainter *p ) { |
52 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) | 52 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) |
53 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | 53 | p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); |
54 | QPixmap pm( width(), height() ); | 54 | QPixmap pm( width(), height() ); |
55 | pm.fill( colorGroup().base() ); | 55 | pm.fill( colorGroup().base() ); |
56 | QPainter pmp( &pm ); | 56 | QPainter pmp( &pm ); |
57 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { | 57 | for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { |
58 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); | 58 | pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); |
59 | } | 59 | } |
60 | p->drawPixmap( 0, 0, pm ); | 60 | p->drawPixmap( 0, 0, pm ); |
61 | } | 61 | } |
62 | 62 | ||
63 | struct MediaButton { | 63 | struct MediaButton { |
64 | bool isToggle, isHeld, isDown; | 64 | bool isToggle, isHeld, isDown; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | //Layout information for the audioButtons (and if it is a toggle button or not) | 67 | //Layout information for the audioButtons (and if it is a toggle button or not) |
68 | MediaButton audioButtons[] = { | 68 | MediaButton audioButtons[] = { |
69 | { TRUE, FALSE, FALSE }, // play | 69 | { TRUE, FALSE, FALSE }, // play |
70 | { FALSE, FALSE, FALSE }, // stop | 70 | { FALSE, FALSE, FALSE }, // stop |
71 | { TRUE, FALSE, FALSE }, // pause | 71 | { TRUE, FALSE, FALSE }, // pause |
72 | { FALSE, FALSE, FALSE }, // next | 72 | { FALSE, FALSE, FALSE }, // next |
73 | { FALSE, FALSE, FALSE }, // previous | 73 | { FALSE, FALSE, FALSE }, // previous |
74 | { FALSE, FALSE, FALSE }, // volume up | 74 | { FALSE, FALSE, FALSE }, // volume up |
75 | { FALSE, FALSE, FALSE }, // volume down | 75 | { FALSE, FALSE, FALSE }, // volume down |
76 | { TRUE, FALSE, FALSE }, // repeat/loop | 76 | { TRUE, FALSE, FALSE }, // repeat/loop |
77 | { FALSE, FALSE, FALSE }, // playlist | 77 | { FALSE, FALSE, FALSE }, // playlist |
78 | { FALSE, FALSE, FALSE }, // forward | 78 | { FALSE, FALSE, FALSE }, // forward |
79 | { FALSE, FALSE, FALSE } // back | 79 | { FALSE, FALSE, FALSE } // back |
80 | }; | 80 | }; |
81 | 81 | ||
82 | const char *skin_mask_file_names[11] = { | 82 | const char *skin_mask_file_names[11] = { |
83 | "play", "stop", "pause", "next", "prev", "up", | 83 | "play", "stop", "pause", "next", "prev", "up", |
84 | "down", "loop", "playlist", "forward", "back" | 84 | "down", "loop", "playlist", "forward", "back" |
85 | }; | 85 | }; |
86 | 86 | ||
87 | 87 | ||
88 | static void changeTextColor( QWidget *w ) { | 88 | static void changeTextColor( QWidget *w ) { |
89 | QPalette p = w->palette(); | 89 | QPalette p = w->palette(); |
90 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 90 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
91 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 91 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
92 | w->setPalette( p ); | 92 | w->setPalette( p ); |
93 | } | 93 | } |
94 | 94 | ||
95 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 95 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
96 | 96 | ||
97 | 97 | ||
98 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 98 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
99 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) | 99 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) |
100 | setCaption( tr("OpiePlayer") ); | 100 | setCaption( tr("OpiePlayer") ); |
101 | 101 | ||
102 | Config cfg("OpiePlayer"); | 102 | Config cfg("OpiePlayer"); |
103 | cfg.setGroup("AudioWidget"); | 103 | cfg.setGroup("AudioWidget"); |
104 | skin = cfg.readEntry("Skin","default"); | 104 | skin = cfg.readEntry("Skin","default"); |
105 | //skin = "scaleTest"; | 105 | //skin = "scaleTest"; |
106 | // color of background, frame, degree of transparency | 106 | // color of background, frame, degree of transparency |
107 | 107 | ||
108 | QString skinPath = "mediaplayer/skins/" + skin; | 108 | QString skinPath = "opieplayer/skins/" + skin; |
109 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 109 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
110 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 110 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
111 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 111 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
112 | 112 | ||
113 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 113 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
114 | imgButtonMask->fill( 0 ); | 114 | imgButtonMask->fill( 0 ); |
115 | 115 | ||
116 | for ( int i = 0; i < 11; i++ ) { | 116 | for ( int i = 0; i < 11; i++ ) { |
117 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; | 117 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; |
118 | masks[i] = new QBitmap( filename ); | 118 | masks[i] = new QBitmap( filename ); |
119 | 119 | ||
120 | if ( !masks[i]->isNull() ) { | 120 | if ( !masks[i]->isNull() ) { |
121 | QImage imgMask = masks[i]->convertToImage(); | 121 | QImage imgMask = masks[i]->convertToImage(); |
122 | uchar **dest = imgButtonMask->jumpTable(); | 122 | uchar **dest = imgButtonMask->jumpTable(); |
123 | for ( int y = 0; y < imgUp->height(); y++ ) { | 123 | for ( int y = 0; y < imgUp->height(); y++ ) { |
124 | uchar *line = dest[y]; | 124 | uchar *line = dest[y]; |
125 | for ( int x = 0; x < imgUp->width(); x++ ) | 125 | for ( int x = 0; x < imgUp->width(); x++ ) |
126 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 126 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
127 | line[x] = i + 1; | 127 | line[x] = i + 1; |
128 | } | 128 | } |
129 | } | 129 | } |
130 | 130 | ||
131 | } | 131 | } |
132 | 132 | ||
133 | for ( int i = 0; i < 11; i++ ) { | 133 | for ( int i = 0; i < 11; i++ ) { |
134 | buttonPixUp[i] = NULL; | 134 | buttonPixUp[i] = NULL; |
135 | buttonPixDown[i] = NULL; | 135 | buttonPixDown[i] = NULL; |
136 | } | 136 | } |
137 | 137 | ||
138 | setBackgroundPixmap( *pixBg ); | 138 | setBackgroundPixmap( *pixBg ); |
139 | 139 | ||
140 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 140 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
141 | changeTextColor( &songInfo ); | 141 | changeTextColor( &songInfo ); |
142 | 142 | ||
143 | slider.setFixedHeight( 20 ); | 143 | slider.setFixedHeight( 20 ); |
144 | slider.setMinValue( 0 ); | 144 | slider.setMinValue( 0 ); |
145 | slider.setMaxValue( 1 ); | 145 | slider.setMaxValue( 1 ); |
146 | slider.setFocusPolicy( QWidget::NoFocus ); | 146 | slider.setFocusPolicy( QWidget::NoFocus ); |
147 | slider.setBackgroundPixmap( *pixBg ); | 147 | slider.setBackgroundPixmap( *pixBg ); |
148 | 148 | ||
149 | time.setFocusPolicy( QWidget::NoFocus ); | 149 | time.setFocusPolicy( QWidget::NoFocus ); |
150 | time.setAlignment( Qt::AlignCenter ); | 150 | time.setAlignment( Qt::AlignCenter ); |
151 | time.setFrame(FALSE); | 151 | time.setFrame(FALSE); |
152 | changeTextColor( &time ); | 152 | changeTextColor( &time ); |
153 | 153 | ||
154 | resizeEvent( NULL ); | 154 | resizeEvent( NULL ); |
155 | 155 | ||
156 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 156 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
157 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 157 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
158 | 158 | ||
159 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 159 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
160 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 160 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
161 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 161 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
162 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 162 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
163 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 163 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
164 | 164 | ||
165 | // Intialise state | 165 | // Intialise state |
166 | setLength( mediaPlayerState->length() ); | 166 | setLength( mediaPlayerState->length() ); |
167 | setPosition( mediaPlayerState->position() ); | 167 | setPosition( mediaPlayerState->position() ); |
168 | setLooping( mediaPlayerState->fullscreen() ); | 168 | setLooping( mediaPlayerState->fullscreen() ); |
169 | setPaused( mediaPlayerState->paused() ); | 169 | setPaused( mediaPlayerState->paused() ); |
170 | setPlaying( mediaPlayerState->playing() ); | 170 | setPlaying( mediaPlayerState->playing() ); |
171 | 171 | ||
172 | } | 172 | } |