From e654398e46e37abf457b2b1122ab898d2c51c49f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:43:15 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1157644 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmix/ksmallslider.cpp | 150 +++++++++++++++++++++++++------------------------- 1 file changed, 75 insertions(+), 75 deletions(-) (limited to 'kmix/ksmallslider.cpp') diff --git a/kmix/ksmallslider.cpp b/kmix/ksmallslider.cpp index e63f2d29..e10c46c8 100644 --- a/kmix/ksmallslider.cpp +++ b/kmix/ksmallslider.cpp @@ -21,38 +21,38 @@ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "kglobalsettings.h" #include "ksmallslider.h" /* -static const QColor mutedHighColor2 = "#FFFFFF"; -static const QColor mutedLowColor2 = "#808080"; -static const QColor backColor2 = "#000000"; +static const TQColor mutedHighColor2 = "#FFFFFF"; +static const TQColor mutedLowColor2 = "#808080"; +static const TQColor backColor2 = "#000000"; */ -KSmallSlider::KSmallSlider( QWidget *parent, const char *name ) - : QWidget( parent, name ), _orientation( Qt::Vertical ) +KSmallSlider::KSmallSlider( TQWidget *parent, const char *name ) + : TQWidget( parent, name ), _orientation( Qt::Vertical ) { init(); } -KSmallSlider::KSmallSlider( Qt::Orientation orientation, QWidget *parent, const char *name ) - : QWidget( parent, name ), _orientation( orientation ) +KSmallSlider::KSmallSlider( Qt::Orientation orientation, TQWidget *parent, const char *name ) + : TQWidget( parent, name ), _orientation( orientation ) { init(); } KSmallSlider::KSmallSlider( int minValue, int maxValue, int pageStep, int value, Qt::Orientation orientation, - QWidget *parent, const char *name ) - : QWidget( parent, name ), - QRangeControl( minValue, maxValue, 1, pageStep, value ), _orientation( orientation) + TQWidget *parent, const char *name ) + : TQWidget( parent, name ), + TQRangeControl( minValue, maxValue, 1, pageStep, value ), _orientation( orientation) { init(); // sliderVal = value; @@ -70,13 +70,13 @@ void KSmallSlider::init() grayed = false; setFocusPolicy( TabFocus ); - colHigh = QColor(0,255,0); - colLow = QColor(255,0,0); - colBack = QColor(0,0,0); + colHigh = TQColor(0,255,0); + colLow = TQColor(255,0,0); + colBack = TQColor(0,0,0); - grayHigh = QColor(255,255,255); - grayLow = QColor(128,128,128); - grayBack = QColor(0,0,0); + grayHigh = TQColor(255,255,255); + grayLow = TQColor(128,128,128); + grayBack = TQColor(0,0,0); } /* void KSmallSlider::setTracking( bool enable ) @@ -86,7 +86,7 @@ void KSmallSlider::setTracking( bool enable ) */ int KSmallSlider::positionFromValue( int v ) const { - return QRangeControl::positionFromValue( v, available() ); + return TQRangeControl::positionFromValue( v, available() ); } int KSmallSlider::valueFromPosition( int p ) const @@ -95,18 +95,18 @@ int KSmallSlider::valueFromPosition( int p ) const // Coordiante System starts at TopLeft, but the slider values increase from Bottom to Top // Thus "revert" the position int avail = available(); - return QRangeControl::valueFromPosition( avail - p, avail ); + return TQRangeControl::valueFromPosition( avail - p, avail ); } else { // Horizontal everything is fine. Slider values match with Coordinate System - return QRangeControl::valueFromPosition( p, available() ); + return TQRangeControl::valueFromPosition( p, available() ); } } void KSmallSlider::rangeChange() { /* - int newPos = positionFromValue( QRangeControl::value() ); + int newPos = positionFromValue( TQRangeControl::value() ); if ( newPos != sliderPos ) { sliderPos = newPos; } @@ -120,20 +120,20 @@ void KSmallSlider::valueChange() update(); emit valueChanged(value()); /* - if ( sliderVal != QRangeControl::value() ) { - //int newPos = positionFromValue( QRangeControl::value() ); + if ( sliderVal != TQRangeControl::value() ) { + //int newPos = positionFromValue( TQRangeControl::value() ); //sliderPos = newPos; - sliderVal = QRangeControl::value(); + sliderVal = TQRangeControl::value(); update(); emit valueChanged(value()); } */ } -void KSmallSlider::resizeEvent( QResizeEvent * ) +void KSmallSlider::resizeEvent( TQResizeEvent * ) { update(); - //QWidget::resizeEvent( ev ); + //TQWidget::resizeEvent( ev ); } // Returns the really available space for the slider. If there is no space, 0 is returned; @@ -160,7 +160,7 @@ int KSmallSlider::available() const namespace { -void gradient( QPainter &p, bool hor, const QRect &rect, const QColor &ca, const QColor &cb, int /*ncols*/) +void gradient( TQPainter &p, bool hor, const TQRect &rect, const TQColor &ca, const TQColor &cb, int /*ncols*/) { int rDiff, gDiff, bDiff; int rca, gca, bca, rcb, gcb, bcb; @@ -190,7 +190,7 @@ void gradient( QPainter &p, bool hor, const QRect &rect, const QColor &ca, const gl += gcdelta; bl += bcdelta; - p.setPen(QColor(rl>>16, gl>>16, bl>>16)); + p.setPen(TQColor(rl>>16, gl>>16, bl>>16)); p.drawLine(rect.left(), y, rect.right(), y); } } else @@ -200,16 +200,16 @@ void gradient( QPainter &p, bool hor, const QRect &rect, const QColor &ca, const gl += gcdelta; bl += bcdelta; - p.setPen(QColor(rl>>16, gl>>16, bl>>16)); + p.setPen(TQColor(rl>>16, gl>>16, bl>>16)); p.drawLine(x, rect.top(), x, rect.bottom()); } } } -QColor interpolate( QColor low, QColor high, int percent ) { +TQColor interpolate( TQColor low, TQColor high, int percent ) { if ( percent<=0 ) return low; else if ( percent>=100 ) return high; else - return QColor( + return TQColor( low.red() + (high.red()-low.red()) * percent/100, low.green() + (high.green()-low.green()) * percent/100, low.blue() + (high.blue()-low.blue()) * percent/100 ); @@ -217,22 +217,22 @@ QColor interpolate( QColor low, QColor high, int percent ) { } -void KSmallSlider::paintEvent( QPaintEvent * ) +void KSmallSlider::paintEvent( TQPaintEvent * ) { // kdDebug(67100) << "KSmallSlider::paintEvent: width() = " << width() << ", height() = " << height() << endl; - QPainter p( this ); + TQPainter p( this ); - int sliderPos = positionFromValue( QRangeControl::value() ); + int sliderPos = positionFromValue( TQRangeControl::value() ); // ------------------------ draw 3d border --------------------------------------------- - style().drawPrimitive ( QStyle::PE_Panel, &p, QRect( 0, 0, width(), height() ), colorGroup(), TRUE ); + style().drawPrimitive ( TQStyle::PE_Panel, &p, TQRect( 0, 0, width(), height() ), colorGroup(), TRUE ); // ------------------------ draw lower/left part ---------------------------------------- if ( width()>2 && height()>2 ) { if ( _orientation == Qt::Horizontal ) { - QRect outer = QRect( 1, 1, sliderPos, height() - 2 ); + TQRect outer = TQRect( 1, 1, sliderPos, height() - 2 ); // kdDebug(67100) << "KSmallSlider::paintEvent: outer = " << outer << endl; if ( grayed ) @@ -245,7 +245,7 @@ void KSmallSlider::paintEvent( QPaintEvent * ) 32 ); } else { - QRect outer = QRect( 1, height()-sliderPos-1, width() - 2, sliderPos-1 ); + TQRect outer = TQRect( 1, height()-sliderPos-1, width() - 2, sliderPos-1 ); /* kdDebug(67100) << "KSmallSlider::paintEvent: sliderPos=" << sliderPos << "height()=" << height() @@ -263,12 +263,12 @@ void KSmallSlider::paintEvent( QPaintEvent * ) } // -------- draw upper/right part -------------------------------------------------- - QRect inner; + TQRect inner; if ( _orientation == Qt::Vertical ) { - inner = QRect( 1, 1, width() - 2, height() - 2 -sliderPos ); + inner = TQRect( 1, 1, width() - 2, height() - 2 -sliderPos ); } else { - inner = QRect( sliderPos + 1, 1, width() - 2 - sliderPos, height() - 2 ); + inner = TQRect( sliderPos + 1, 1, width() - 2 - sliderPos, height() - 2 ); } if ( grayed ) { @@ -282,7 +282,7 @@ void KSmallSlider::paintEvent( QPaintEvent * ) } } -void KSmallSlider::mousePressEvent( QMouseEvent *e ) +void KSmallSlider::mousePressEvent( TQMouseEvent *e ) { //resetState(); @@ -297,7 +297,7 @@ void KSmallSlider::mousePressEvent( QMouseEvent *e ) moveSlider( pos ); } -void KSmallSlider::mouseMoveEvent( QMouseEvent *e ) +void KSmallSlider::mouseMoveEvent( TQMouseEvent *e ) { /* if ( state != Dragging ) @@ -307,7 +307,7 @@ void KSmallSlider::mouseMoveEvent( QMouseEvent *e ) moveSlider( pos ); } -void KSmallSlider::wheelEvent( QWheelEvent * e) +void KSmallSlider::wheelEvent( TQWheelEvent * e) { // kdDebug(67100) << "KSmallslider::wheelEvent()" << endl; /* Unfortunately KSmallSlider is no MixDeviceWidget, so we don't have access to @@ -319,17 +319,17 @@ void KSmallSlider::wheelEvent( QWheelEvent * e) //kdDebug(67100) << "KSmallslider::wheelEvent() inc=" << inc << "delta=" << e->delta() << endl; if ( e->delta() > 0 ) { - QRangeControl::setValue( QRangeControl::value() + inc ); + TQRangeControl::setValue( TQRangeControl::value() + inc ); } else { - QRangeControl::setValue( QRangeControl::value() - inc ); + TQRangeControl::setValue( TQRangeControl::value() - inc ); } e->accept(); // Accept the event // Hint: Qt autmatically triggers a valueChange() when we do setValue() } -void KSmallSlider::mouseReleaseEvent( QMouseEvent * ) +void KSmallSlider::mouseReleaseEvent( TQMouseEvent * ) { //resetState(); } @@ -343,9 +343,9 @@ void KSmallSlider::moveSlider( int pos ) int newPos = QMIN( a, QMAX( 0, pos ) ); // keep it inside the available bounds of the slider int newVal = valueFromPosition( newPos ); - if ( newVal != QRangeControl::value() ) { - //QRangeControl::directSetValue( sliderVal ); - QRangeControl::setValue( newVal ); + if ( newVal != TQRangeControl::value() ) { + //TQRangeControl::directSetValue( sliderVal ); + TQRangeControl::setValue( newVal ); emit valueChanged( value() ); // Only for external use } update(); @@ -356,7 +356,7 @@ void KSmallSlider::resetState() { switch ( state ) { case Dragging: { - QRangeControl::setValue( valueFromPosition( sliderPos ) ); + TQRangeControl::setValue( valueFromPosition( sliderPos ) ); emit sliderReleased(); break; } @@ -372,7 +372,7 @@ void KSmallSlider::resetState() void KSmallSlider::setValue( int value ) { - QRangeControl::setValue( value ); + TQRangeControl::setValue( value ); } void KSmallSlider::addStep() @@ -385,7 +385,7 @@ void KSmallSlider::subtractStep() subtractPage(); } -int KSmallSlider::goodPart( const QPoint &p ) const +int KSmallSlider::goodPart( const TQPoint &p ) const { if ( _orientation == Qt::Vertical ) { return p.y() - 1; @@ -396,36 +396,36 @@ int KSmallSlider::goodPart( const QPoint &p ) const } /***************** SIZE STUFF START ***************/ -QSize KSmallSlider::sizeHint() const +TQSize KSmallSlider::sizeHint() const { //constPolish(); const int length = 25; const int thick = 10; if ( _orientation == Qt::Vertical ) - return QSize( thick, length ); + return TQSize( thick, length ); else - return QSize( length, thick ); + return TQSize( length, thick ); } -QSize KSmallSlider::minimumSizeHint() const +TQSize KSmallSlider::minimumSizeHint() const { - QSize s(10,10); + TQSize s(10,10); return s; } -QSizePolicy KSmallSlider::sizePolicy() const +TQSizePolicy KSmallSlider::sizePolicy() const { if ( _orientation == Qt::Vertical ) { //kdDebug(67100) << "KSmallSlider::sizePolicy() vertical value=(Fixed,MinimumExpanding)\n"; - return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); + return TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Expanding ); } else { //kdDebug(67100) << "KSmallSlider::sizePolicy() horizontal value=(MinimumExpanding,Fixed)\n"; - return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); + return TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ); } } /***************** SIZE STUFF END ***************/ @@ -433,22 +433,22 @@ QSizePolicy KSmallSlider::sizePolicy() const int KSmallSlider::minValue() const { - return QRangeControl::minValue(); + return TQRangeControl::minValue(); } int KSmallSlider::maxValue() const { - return QRangeControl::maxValue(); + return TQRangeControl::maxValue(); } int KSmallSlider::lineStep() const { - return QRangeControl::lineStep(); + return TQRangeControl::lineStep(); } int KSmallSlider::pageStep() const { - return QRangeControl::pageStep(); + return TQRangeControl::pageStep(); } void KSmallSlider::setLineStep( int i ) @@ -461,20 +461,20 @@ void KSmallSlider::setPageStep( int i ) setSteps( lineStep(), i ); } -// Only for external acces. You MUST use QRangeControl::value() internally. +// Only for external acces. You MUST use TQRangeControl::value() internally. int KSmallSlider::value() const { - return QRangeControl::value(); + return TQRangeControl::value(); } /* -void KSmallSlider::paletteChange ( const QPalette &) { +void KSmallSlider::paletteChange ( const TQPalette &) { if ( grayed ) { setColors(mutedLowColor2, mutedHighColor2, backColor2 ); } else { - // ignore the QPalette and use the values from KGlobalSettings instead - //const QColorGroup& qcg = palette().active(); + // ignore the TQPalette and use the values from KGlobalSettings instead + //const TQColorGroup& qcg = palette().active(); setColors(KGlobalSettings::baseColor(), KGlobalSettings::highlightColor(), backColor2 ); } } @@ -495,7 +495,7 @@ bool KSmallSlider::gray() const return grayed; } -void KSmallSlider::setColors( QColor high, QColor low, QColor back ) +void KSmallSlider::setColors( TQColor high, TQColor low, TQColor back ) { colHigh = high; colLow = low; @@ -504,7 +504,7 @@ void KSmallSlider::setColors( QColor high, QColor low, QColor back ) //repaint(); } -void KSmallSlider::setGrayColors( QColor high, QColor low, QColor back ) +void KSmallSlider::setGrayColors( TQColor high, TQColor low, TQColor back ) { grayHigh = high; grayLow = low; -- cgit v1.2.3