diff options
Diffstat (limited to 'arts/gui/kde/kpoti.cpp')
-rw-r--r-- | arts/gui/kde/kpoti.cpp | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/arts/gui/kde/kpoti.cpp b/arts/gui/kde/kpoti.cpp index e12c1bf5..462d640b 100644 --- a/arts/gui/kde/kpoti.cpp +++ b/arts/gui/kde/kpoti.cpp @@ -20,15 +20,15 @@ #include "kpoti.h" #include "kpoti.moc" -#include <qbitmap.h> -#include <qpainter.h> -#include <qcolor.h> -#include <qdrawutil.h> -#include <qtimer.h> -#include <qkeycode.h> -#include <qpen.h> -#include <qstring.h> -#include <qstyle.h> +#include <tqbitmap.h> +#include <tqpainter.h> +#include <tqcolor.h> +#include <tqdrawutil.h> +#include <tqtimer.h> +#include <tqkeycode.h> +#include <tqpen.h> +#include <tqstring.h> +#include <tqstyle.h> #include <math.h> @@ -53,18 +53,18 @@ struct KPoti::KPotiPrivate bool bgDirty; KPixmap bgdb; - KPixmap bgPixmap( const QColorGroup & colorGroup ) + KPixmap bgPixmap( const TQColorGroup & colorGroup ) { if( bgDirty || bgdb.isNull() ) { bgdb.resize( buttonRect.size() ); - QPainter dbp( &bgdb ); + TQPainter dbp( &bgdb ); dbp.setPen( Qt::NoPen ); - QRect drawRect = bgdb.rect(); + TQRect drawRect = bgdb.rect(); // create mask - QBitmap mask( bgdb.size(), true ); - QPainter maskpainter( &mask ); + TQBitmap mask( bgdb.size(), true ); + TQPainter maskpainter( &mask ); maskpainter.setPen( Qt::NoPen ); maskpainter.setBrush( Qt::color1 ); maskpainter.drawEllipse( drawRect ); @@ -74,7 +74,7 @@ struct KPoti::KPotiPrivate // inset shadow KPixmap gradient( bgdb.size() ); KPixmapEffect::gradient( gradient, colorGroup.light(), colorGroup.dark(), KPixmapEffect::DiagonalGradient ); - dbp.setBrush( QBrush( colorGroup.button(), gradient ) ); + dbp.setBrush( TQBrush( colorGroup.button(), gradient ) ); dbp.drawEllipse( drawRect ); potiRect.setSize( drawRect.size() * 0.9 ); @@ -90,7 +90,7 @@ struct KPoti::KPotiPrivate return bgdb; } - QColor potiColor; + TQColor potiColor; bool potiDirty; KPixmap potidb; KPixmap potiPixmap() @@ -98,13 +98,13 @@ struct KPoti::KPotiPrivate if( ( potiDirty || potidb.isNull() ) && ! potiRect.size().isEmpty() ) { potidb.resize( potiRect.size() ); - QPainter dbp( &potidb ); + TQPainter dbp( &potidb ); dbp.setPen( Qt::NoPen ); - QRect drawRect( potidb.rect() ); + TQRect drawRect( potidb.rect() ); // create mask - QBitmap mask( potidb.size(), true ); - QPainter maskpainter( &mask ); + TQBitmap mask( potidb.size(), true ); + TQPainter maskpainter( &mask ); maskpainter.setPen( Qt::NoPen ); maskpainter.setBrush( Qt::color1 ); maskpainter.drawEllipse( drawRect ); @@ -113,7 +113,7 @@ struct KPoti::KPotiPrivate KPixmap gradient( potidb.size() ); KPixmapEffect::gradient( gradient, potiColor.dark( 130 ), potiColor.light( 130 ), KPixmapEffect::DiagonalGradient ); - dbp.setBrush( QBrush( potiColor, gradient ) ); + dbp.setBrush( TQBrush( potiColor, gradient ) ); dbp.drawEllipse( drawRect ); potiDirty = false; @@ -121,45 +121,45 @@ struct KPoti::KPotiPrivate return potidb; } - QRect buttonRect; - QRect potiRect; - QRect labelRect; - QString label; - QPoint center; + TQRect buttonRect; + TQRect potiRect; + TQRect labelRect; + TQString label; + TQPoint center; }; -QSizePolicy KPoti::sizePolicy() const +TQSizePolicy KPoti::sizePolicy() const { - return QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); + return TQSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Preferred ); } -QSize KPoti::sizeHint() const +TQSize KPoti::sizeHint() const { return minimumSizeHint(); } -QSize KPoti::minimumSizeHint() const +TQSize KPoti::minimumSizeHint() const { int width = 40; int height = 40; if( m_bLabel ) { - QFontMetrics metrics( font() ); + TQFontMetrics metrics( font() ); d->labelRect = metrics.boundingRect( d->label ); d->labelRect.setHeight( metrics.lineSpacing() ); width = KMAX( width, d->labelRect.width() + frameRect().width() - contentsRect().width() ); height += metrics.lineSpacing(); } //kdDebug() << k_funcinfo << "return " << width << "x" << height << endl; - return QSize( width, height ); + return TQSize( width, height ); } -QString KPoti::text() const +TQString KPoti::text() const { return d->label; } -void KPoti::setText( const QString & text ) +void KPoti::setText( const TQString & text ) { d->label = text; setMinimumSize( minimumSizeHint() ); @@ -169,10 +169,10 @@ void KPoti::setText( const QString & text ) /** Constructs a poti. - The \e parent and \e name arguments are sent to the QWidget constructor. + The \e parent and \e name arguments are sent to the TQWidget constructor. */ -KPoti::KPoti( QWidget *parent, const char *name ) - : QFrame( parent, name, WResizeNoErase | WRepaintNoErase ) +KPoti::KPoti( TQWidget *parent, const char *name ) + : TQFrame( parent, name, WResizeNoErase | WRepaintNoErase ) , d( 0 ) { init(); @@ -188,13 +188,13 @@ KPoti::KPoti( QWidget *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 QWidget constructor. + The \e parent and \e name arguments are sent to the TQWidget constructor. */ KPoti::KPoti( int minValue, int maxValue, int step, - int value, QWidget *parent, const char *name ) - : QFrame( parent, name, WResizeNoErase | WRepaintNoErase ) - , QRangeControl( minValue, maxValue, 1, step, value ) + int value, TQWidget *parent, const char *name ) + : TQFrame( parent, name, WResizeNoErase | WRepaintNoErase ) + , TQRangeControl( minValue, maxValue, 1, step, value ) , d( 0 ) { init(value); @@ -233,7 +233,7 @@ void KPoti::init(int value) void KPoti::initTicks() { - QRect available = contentsRect(); + TQRect available = contentsRect(); if( m_bLabel ) available.rTop() += d->labelRect.height(); d->center = available.center(); @@ -336,7 +336,7 @@ int KPoti::valueFromPosition( float p ) const } /*! - Implements the virtual QRangeControl function. + Implements the virtual TQRangeControl function. */ void KPoti::rangeChange() @@ -347,7 +347,7 @@ void KPoti::rangeChange() } } -void KPoti::paletteChange( const QPalette & ) +void KPoti::paletteChange( const TQPalette & ) { d->bgDirty = true; d->potiDirty = true; @@ -372,7 +372,7 @@ void KPoti::valueChange() Handles resize events for the poti. */ -void KPoti::resizeEvent( QResizeEvent * ) +void KPoti::resizeEvent( TQResizeEvent * ) { rangeChange(); initTicks(); @@ -387,7 +387,7 @@ void KPoti::setLabel(bool s) /** Sets the color of the button */ -void KPoti::setColor( const QColor &c ) +void KPoti::setColor( const TQColor &c ) { d->potiColor = c; d->potiDirty = true; @@ -395,7 +395,7 @@ void KPoti::setColor( const QColor &c ) } -void KPoti::paintPoti( QPainter * p ) +void KPoti::paintPoti( TQPainter * p ) { if( isVisible() ) { @@ -403,11 +403,11 @@ void KPoti::paintPoti( QPainter * p ) if( db.isNull() ) return; - QPainter p2( &db ); + TQPainter p2( &db ); p2.translate( db.rect().center().x(), db.rect().center().y() ); p2.rotate( potiPos * 180.0 / PI ); - QRect pointer( db.width() / -20, db.width() / -2, db.width() / 10, db.width() / 2 ); - QBrush buttonbrush( colorGroup().button() ); + 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 ); p2.end(); @@ -421,7 +421,7 @@ void KPoti::paintPoti( QPainter * p ) void KPoti::reallyMovePoti( float newPos ) { - QPainter p; + TQPainter p; p.begin( this ); p.setPen(NoPen); potiPos = newPos; @@ -436,15 +436,15 @@ void KPoti::reallyMovePoti( float newPos ) Handles paint events for the slider. */ -void KPoti::drawContents( QPainter * p ) +void KPoti::drawContents( TQPainter * p ) { - QPixmap doublebuffer( contentsRect().size() ); + TQPixmap doublebuffer( contentsRect().size() ); doublebuffer.fill( colorGroup().background() ); - QPainter dbp( &doublebuffer ); + TQPainter dbp( &doublebuffer ); if( m_bLabel ) { dbp.setFont( font() ); - QFontMetrics metrics = dbp.fontMetrics(); + TQFontMetrics metrics = dbp.fontMetrics(); dbp.drawText( contentsRect().x() - metrics.leftBearing( d->label[ 0 ] ) + ( contentsRect().width() - d->labelRect.width() ) / 2, metrics.height(), d->label ); } @@ -457,7 +457,7 @@ void KPoti::drawContents( QPainter * p ) dbp.drawPixmap( d->buttonRect, d->bgPixmap( colorGroup() ) ); if( hasFocus() ) - style().drawPrimitive( QStyle::PE_FocusRect, &dbp, d->buttonRect, colorGroup() ); + style().drawPrimitive( TQStyle::PE_FocusRect, &dbp, d->buttonRect, colorGroup() ); paintPoti( &dbp ); dbp.end(); @@ -469,7 +469,7 @@ void KPoti::drawContents( QPainter * p ) Handles mouse press events for the slider. */ -void KPoti::mousePressEvent( QMouseEvent *e ) +void KPoti::mousePressEvent( TQMouseEvent *e ) { resetState(); @@ -493,15 +493,15 @@ void KPoti::mousePressEvent( QMouseEvent *e ) state = TimingDown; subtractPage(); if ( !timer ) - timer = new QTimer( this ); - connect( timer, SIGNAL(timeout()), SLOT(repeatTimeout()) ); + timer = new TQTimer( this ); + connect( timer, TQT_SIGNAL(timeout()), TQT_SLOT(repeatTimeout()) ); timer->start( thresholdTime, TRUE ); } else { state = TimingUp; addPage(); if ( !timer ) - timer = new QTimer( this ); - connect( timer, SIGNAL(timeout()), SLOT(repeatTimeout()) ); + timer = new TQTimer( this ); + connect( timer, TQT_SIGNAL(timeout()), TQT_SLOT(repeatTimeout()) ); timer->start( thresholdTime, TRUE ); } } @@ -509,7 +509,7 @@ void KPoti::mousePressEvent( QMouseEvent *e ) /*! Handles mouse move events for the slider. */ -void KPoti::mouseMoveEvent( QMouseEvent *e ) +void KPoti::mouseMoveEvent( TQMouseEvent *e ) { if ( (e->state() & MidButton) ) { // middle button wins @@ -532,29 +532,29 @@ void KPoti::mouseMoveEvent( QMouseEvent *e ) Handles mouse release events for the slider. */ -void KPoti::mouseReleaseEvent( QMouseEvent *e ) +void KPoti::mouseReleaseEvent( TQMouseEvent *e ) { if ( !(e->button() & LeftButton) ) return; resetState(); } -void KPoti::focusInEvent( QFocusEvent * e ) +void KPoti::focusInEvent( TQFocusEvent * e ) { //setFrameStyle( Raised | Box ); //setLineWidth( 1 ); - QFrame::focusInEvent( e ); + TQFrame::focusInEvent( e ); } -void KPoti::focusOutEvent( QFocusEvent * e ) +void KPoti::focusOutEvent( TQFocusEvent * e ) { //setFrameStyle( NoFrame ); //setLineWidth( 0 ); - QFrame::focusOutEvent( e ); + TQFrame::focusOutEvent( e ); } -void KPoti::enterEvent( QEvent * ) +void KPoti::enterEvent( TQEvent * ) { emit mouseEntered( potiVal ); } @@ -616,7 +616,7 @@ void KPoti::resetState() Handles key press events for the slider. */ -void KPoti::keyPressEvent( QKeyEvent *e ) +void KPoti::keyPressEvent( TQKeyEvent *e ) { switch ( e->key() ) { @@ -656,12 +656,12 @@ void KPoti::keyPressEvent( QKeyEvent *e ) /*! - Makes QRangeControl::setValue() available as a slot. + Makes TQRangeControl::setValue() available as a slot. */ void KPoti::setValue( int value ) { - QRangeControl::setValue( value ); + TQRangeControl::setValue( value ); } @@ -694,9 +694,9 @@ void KPoti::repeatTimeout() Q_ASSERT( timer ); timer->disconnect(); if ( state == TimingDown ) - connect( timer, SIGNAL(timeout()), SLOT(subtractStep()) ); + connect( timer, TQT_SIGNAL(timeout()), TQT_SLOT(subtractStep()) ); else if ( state == TimingUp ) - connect( timer, SIGNAL(timeout()), SLOT(addStep()) ); + connect( timer, TQT_SIGNAL(timeout()), TQT_SLOT(addStep()) ); timer->start( repeatTime, FALSE ); } @@ -708,7 +708,7 @@ void KPoti::repeatTimeout() of the widget, using \a w pixels and \a i intervals. */ -void KPoti::drawTicks( QPainter *p, double dist, double w, int i ) const +void KPoti::drawTicks( TQPainter *p, double dist, double w, int i ) const { p->setPen( colorGroup().foreground() ); double angle,s,c; @@ -725,7 +725,7 @@ void KPoti::drawTicks( QPainter *p, double dist, double w, int i ) const } } -void KPoti::wheelEvent(QWheelEvent *e) +void KPoti::wheelEvent(TQWheelEvent *e) { setValue(value()+e->delta()/120*8); } @@ -760,7 +760,7 @@ void KPoti::setTickmarks( bool s ) not a pixel interval. If \a i is 0, the slider will choose between lineStep() and pageStep(). The initial value of tickInterval() is 0. - \sa tickInterval(), QRangeControl::lineStep(), QRangeControl::pageStep() + \sa tickInterval(), TQRangeControl::lineStep(), TQRangeControl::pageStep() */ void KPoti::setTickInterval( int i ) |