diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 06:00:15 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-11 06:00:15 +0000 |
commit | b1057f437bf65300831a0ccb45b920787c6b318d (patch) | |
tree | f8a73db06ca1180d0da0ba6dfbe786197b4f4bc3 /arts/gui/kde/kpoti.cpp | |
parent | 4ddfca384ced9ad654213aef9dc2c3973720b980 (diff) | |
download | tdemultimedia-b1057f437bf65300831a0ccb45b920787c6b318d.tar.gz tdemultimedia-b1057f437bf65300831a0ccb45b920787c6b318d.zip |
TQt4 port kdemultimedia
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1236079 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'arts/gui/kde/kpoti.cpp')
-rw-r--r-- | arts/gui/kde/kpoti.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/arts/gui/kde/kpoti.cpp b/arts/gui/kde/kpoti.cpp index 462d640b..dd4e484b 100644 --- a/arts/gui/kde/kpoti.cpp +++ b/arts/gui/kde/kpoti.cpp @@ -53,28 +53,28 @@ struct KPoti::KPotiPrivate bool bgDirty; KPixmap bgdb; - KPixmap bgPixmap( const TQColorGroup & colorGroup ) + KPixmap bgPixmap( const TQColorGroup & tqcolorGroup ) { if( bgDirty || bgdb.isNull() ) { bgdb.resize( buttonRect.size() ); TQPainter dbp( &bgdb ); - dbp.setPen( Qt::NoPen ); + dbp.setPen( TQt::NoPen ); TQRect drawRect = bgdb.rect(); - // create mask - TQBitmap mask( bgdb.size(), true ); - TQPainter maskpainter( &mask ); - maskpainter.setPen( Qt::NoPen ); - maskpainter.setBrush( Qt::color1 ); - maskpainter.drawEllipse( drawRect ); - maskpainter.end(); - bgdb.setMask( mask ); + // create tqmask + TQBitmap tqmask( bgdb.size(), true ); + TQPainter tqmaskpainter( &tqmask ); + tqmaskpainter.setPen( TQt::NoPen ); + tqmaskpainter.setBrush( TQt::color1 ); + tqmaskpainter.drawEllipse( drawRect ); + tqmaskpainter.end(); + bgdb.setMask( tqmask ); // inset shadow KPixmap gradient( bgdb.size() ); - KPixmapEffect::gradient( gradient, colorGroup.light(), colorGroup.dark(), KPixmapEffect::DiagonalGradient ); - dbp.setBrush( TQBrush( colorGroup.button(), gradient ) ); + KPixmapEffect::gradient( gradient, tqcolorGroup.light(), tqcolorGroup.dark(), KPixmapEffect::DiagonalGradient ); + dbp.setBrush( TQBrush( tqcolorGroup.button(), gradient ) ); dbp.drawEllipse( drawRect ); potiRect.setSize( drawRect.size() * 0.9 ); @@ -99,17 +99,17 @@ struct KPoti::KPotiPrivate { potidb.resize( potiRect.size() ); TQPainter dbp( &potidb ); - dbp.setPen( Qt::NoPen ); + dbp.setPen( TQt::NoPen ); TQRect drawRect( potidb.rect() ); - // create mask - TQBitmap mask( potidb.size(), true ); - TQPainter maskpainter( &mask ); - maskpainter.setPen( Qt::NoPen ); - maskpainter.setBrush( Qt::color1 ); - maskpainter.drawEllipse( drawRect ); - maskpainter.end(); - potidb.setMask( mask ); + // create tqmask + TQBitmap tqmask( potidb.size(), true ); + TQPainter tqmaskpainter( &tqmask ); + tqmaskpainter.setPen( TQt::NoPen ); + tqmaskpainter.setBrush( TQt::color1 ); + tqmaskpainter.drawEllipse( drawRect ); + tqmaskpainter.end(); + potidb.setMask( tqmask ); KPixmap gradient( potidb.size() ); KPixmapEffect::gradient( gradient, potiColor.dark( 130 ), potiColor.light( 130 ), KPixmapEffect::DiagonalGradient ); @@ -133,12 +133,12 @@ TQSizePolicy KPoti::sizePolicy() const return TQSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Preferred ); } -TQSize KPoti::sizeHint() const +TQSize KPoti::tqsizeHint() const { - return minimumSizeHint(); + return tqminimumSizeHint(); } -TQSize KPoti::minimumSizeHint() const +TQSize KPoti::tqminimumSizeHint() const { int width = 40; int height = 40; @@ -162,17 +162,17 @@ TQString KPoti::text() const void KPoti::setText( const TQString & text ) { d->label = text; - setMinimumSize( minimumSizeHint() ); + setMinimumSize( tqminimumSizeHint() ); updateGeometry(); } /** Constructs a poti. - The \e parent and \e name arguments are sent to the TQWidget constructor. + The \e tqparent and \e name arguments are sent to the TQWidget constructor. */ -KPoti::KPoti( TQWidget *parent, const char *name ) - : TQFrame( parent, name, WResizeNoErase | WRepaintNoErase ) +KPoti::KPoti( TQWidget *tqparent, const char *name ) + : TQFrame( tqparent, name, WResizeNoErase | WRepaintNoErase ) , d( 0 ) { init(); @@ -188,12 +188,12 @@ KPoti::KPoti( TQWidget *parent, const char *name ) \arg \e step is the page step value. \arg \e value is the initial value. - The \e parent and \e name arguments are sent to the TQWidget constructor. + The \e tqparent and \e name arguments are sent to the TQWidget constructor. */ KPoti::KPoti( int minValue, int maxValue, int step, - int value, TQWidget *parent, const char *name ) - : TQFrame( parent, name, WResizeNoErase | WRepaintNoErase ) + int value, TQWidget *tqparent, const char *name ) + : TQFrame( tqparent, name, WResizeNoErase | WRepaintNoErase ) , TQRangeControl( minValue, maxValue, 1, step, value ) , d( 0 ) { @@ -209,7 +209,7 @@ KPoti::~KPoti() void KPoti::init(int value) { d = new KPotiPrivate; - font().setPointSize( 8 ); + const_cast<QFont&>(font()).setPointSize( 8 ); d->potiColor.setNamedColor( "red" ); timer = 0; @@ -222,7 +222,7 @@ void KPoti::init(int value) m_bLabel = true; tickInt = 0; - setFocusPolicy( TabFocus ); + setFocusPolicy( TQ_TabFocus ); initTicks(); } @@ -391,7 +391,7 @@ void KPoti::setColor( const TQColor &c ) { d->potiColor = c; d->potiDirty = true; - repaint(); + tqrepaint(); } @@ -407,8 +407,8 @@ void KPoti::paintPoti( TQPainter * p ) p2.translate( db.rect().center().x(), db.rect().center().y() ); p2.rotate( potiPos * 180.0 / PI ); TQRect pointer( db.width() / -20, db.width() / -2, db.width() / 10, db.width() / 2 ); - TQBrush buttonbrush( colorGroup().button() ); - qDrawShadePanel( &p2, pointer, colorGroup(), true, 1, &buttonbrush ); + TQBrush buttonbrush( tqcolorGroup().button() ); + qDrawShadePanel( &p2, pointer, tqcolorGroup(), true, 1, &buttonbrush ); p2.end(); p->drawPixmap( d->potiRect, db ); @@ -439,7 +439,7 @@ void KPoti::reallyMovePoti( float newPos ) void KPoti::drawContents( TQPainter * p ) { TQPixmap doublebuffer( contentsRect().size() ); - doublebuffer.fill( colorGroup().background() ); + doublebuffer.fill( tqcolorGroup().background() ); TQPainter dbp( &doublebuffer ); if( m_bLabel ) { @@ -454,10 +454,10 @@ void KPoti::drawContents( TQPainter * p ) if( ticks ) drawTicks( &dbp, buttonRadius, tickLength, interval ); - dbp.drawPixmap( d->buttonRect, d->bgPixmap( colorGroup() ) ); + dbp.drawPixmap( d->buttonRect, d->bgPixmap( tqcolorGroup() ) ); if( hasFocus() ) - style().drawPrimitive( TQStyle::PE_FocusRect, &dbp, d->buttonRect, colorGroup() ); + tqstyle().tqdrawPrimitive( TQStyle::PE_FocusRect, &dbp, d->buttonRect, tqcolorGroup() ); paintPoti( &dbp ); dbp.end(); @@ -473,13 +473,13 @@ void KPoti::mousePressEvent( TQMouseEvent *e ) { resetState(); - if ( e->button() == MidButton ) { + if ( e->button() == Qt::MidButton ) { double pos = atan2( double(e->pos().x()-d->center.x()), double(- e->pos().y() + d->center.y()) ); movePoti( pos ); return; } - if ( e->button() != LeftButton ) + if ( e->button() != Qt::LeftButton ) return; @@ -512,13 +512,13 @@ void KPoti::mousePressEvent( TQMouseEvent *e ) void KPoti::mouseMoveEvent( TQMouseEvent *e ) { - if ( (e->state() & MidButton) ) { // middle button wins + if ( (e->state() & Qt::MidButton) ) { // middle button wins double pos = atan2( double(e->pos().x()-d->center.x()), double(- e->pos().y()+d->center.y()) ); movePoti( pos ); return; } - if ( !(e->state() & LeftButton) ) + if ( !(e->state() & Qt::LeftButton) ) return; // left mouse button is up if ( state != Dragging ) return; @@ -534,7 +534,7 @@ void KPoti::mouseMoveEvent( TQMouseEvent *e ) void KPoti::mouseReleaseEvent( TQMouseEvent *e ) { - if ( !(e->button() & LeftButton) ) + if ( !(e->button() & Qt::LeftButton) ) return; resetState(); } @@ -567,7 +567,7 @@ void KPoti::enterEvent( TQEvent * ) void KPoti::movePoti( float pos ) { - float newPos = QMIN( maxAngle, QMAX( -maxAngle, pos ) ); + float newPos = TQMIN( maxAngle, TQMAX( -maxAngle, pos ) ); int newVal = valueFromPosition( newPos ); if ( potiVal != newVal ) { potiVal = newVal; @@ -710,7 +710,7 @@ void KPoti::repeatTimeout() void KPoti::drawTicks( TQPainter *p, double dist, double w, int i ) const { - p->setPen( colorGroup().foreground() ); + p->setPen( tqcolorGroup().foreground() ); double angle,s,c; double x, y; for (int v=0; v<=i; v++) @@ -765,7 +765,7 @@ void KPoti::setTickmarks( bool s ) void KPoti::setTickInterval( int i ) { - tickInt = QMAX( 0, i ); + tickInt = TQMAX( 0, i ); update(); } |