summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-10 17:43:03 (UTC)
committer llornkcor <llornkcor>2002-11-10 17:43:03 (UTC)
commit49e5bbbd35bef879faca0d680f1c4d64a61b7b32 (patch) (side-by-side diff)
tree51feb6d756101caf755e2dabefdc707b133292c2
parentb84ab7a14a0efb50cd425a8614ff465081116420 (diff)
downloadopie-49e5bbbd35bef879faca0d680f1c4d64a61b7b32.zip
opie-49e5bbbd35bef879faca0d680f1c4d64a61b7b32.tar.gz
opie-49e5bbbd35bef879faca0d680f1c4d64a61b7b32.tar.bz2
use users default colors for ticker
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp47
1 files changed, 6 insertions, 41 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index de91a59..e21b0b1 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -13,109 +13,70 @@
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/config.h>
+#include <opie/oticker.h>
#include <qwidget.h>
#include <qpixmap.h>
#include <qbutton.h>
#include <qpainter.h>
#include <qframe.h>
#include <qlayout.h>
#include <qdir.h>
#include <stdlib.h>
#include <stdio.h>
#include "audiowidget.h"
#include "mediaplayerstate.h"
#include "playlistwidget.h"
extern MediaPlayerState *mediaPlayerState;
extern PlayListWidget *playList;
static const int xo = -2; // movable x offset
static const int yo = 22; // movable y offset
-
-Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) {
- setFrameStyle( WinPanel | Sunken );
- //setText( "No Song" );
-}
-
-Ticker::~Ticker() {
-}
-
-void Ticker::setText( const QString& text ) {
- pos = 0; // reset it everytime the text is changed
- scrollText = text;
- pixelLen = fontMetrics().width( scrollText );
- killTimers();
- if ( pixelLen > width() ) {
- startTimer( 50 );
- }
- update();
-}
-
-
-void Ticker::timerEvent( QTimerEvent * ) {
- pos = ( pos + 1 > pixelLen ) ? 0 : pos + 1;
- scroll( -1, 0, contentsRect() );
- repaint( FALSE );
-}
-
-void Ticker::drawContents( QPainter *p ) {
- for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) {
- p->drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
- }
- QPixmap pm( width(), height() );
- pm.fill( colorGroup().base() );
- QPainter pmp( &pm );
- for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) {
- pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
- }
- p->drawPixmap( 0, 0, pm );
-}
-
struct MediaButton {
bool isToggle, isHeld, isDown;
};
//Layout information for the audioButtons (and if it is a toggle button or not)
MediaButton audioButtons[] = {
{ TRUE, FALSE, FALSE }, // play
{ FALSE, FALSE, FALSE }, // stop
{ FALSE, FALSE, FALSE }, // next
{ FALSE, FALSE, FALSE }, // previous
{ FALSE, FALSE, FALSE }, // volume up
{ FALSE, FALSE, FALSE }, // volume down
{ TRUE, FALSE, FALSE }, // repeat/loop
{ FALSE, FALSE, FALSE }, // playlist
{ FALSE, FALSE, FALSE }, // forward
{ FALSE, FALSE, FALSE } // back
};
const char *skin_mask_file_names[10] = {
"play", "stop", "next", "prev", "up",
"down", "loop", "playlist", "forward", "back"
};
@@ -153,49 +114,53 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" );
masks[i] = new QBitmap( filename );
if ( !masks[i]->isNull() ) {
QImage imgMask = masks[i]->convertToImage();
uchar **dest = imgButtonMask->jumpTable();
for ( int y = 0; y < imgUp->height(); y++ ) {
uchar *line = dest[y];
for ( int x = 0; x < imgUp->width(); x++ )
if ( !qRed( imgMask.pixel( x, y ) ) )
line[x] = i + 1;
}
}
}
for ( int i = 0; i < 10; i++ ) {
buttonPixUp[i] = 0l;
buttonPixDown[i] = 0l;
}
setBackgroundPixmap( *pixBg );
songInfo.setFocusPolicy( QWidget::NoFocus );
- changeTextColor( &songInfo );
+// changeTextColor( &songInfo );
+// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
+// songInfo.setFrameStyle( QFrame::NoFrame);
+ songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
+// songInfo.setForegroundColor(Qt::white);
slider.setFixedHeight( 20 );
slider.setMinValue( 0 );
slider.setMaxValue( 1 );
slider.setFocusPolicy( QWidget::NoFocus );
slider.setBackgroundPixmap( *pixBg );
time.setFocusPolicy( QWidget::NoFocus );
time.setAlignment( Qt::AlignCenter );
time.setFrame(FALSE);
changeTextColor( &time );
resizeEvent( NULL );
connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );