diff options
Diffstat (limited to 'src/knemod/signalplotter.cpp')
-rw-r--r-- | src/knemod/signalplotter.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/src/knemod/signalplotter.cpp b/src/knemod/signalplotter.cpp index 4945a2d..d28b72c 100644 --- a/src/knemod/signalplotter.cpp +++ b/src/knemod/signalplotter.cpp @@ -25,8 +25,8 @@ #include <math.h> #include <string.h> -#include <qpainter.h> -#include <qpixmap.h> +#include <tqpainter.h> +#include <tqpixmap.h> #include <kdebug.h> #include <kconfig.h> @@ -38,8 +38,8 @@ static inline int min( int a, int b ) return ( a < b ? a : b ); } -SignalPlotter::SignalPlotter( QWidget *parent, const char *name ) - : QDialog( parent, name ), +SignalPlotter::SignalPlotter( TQWidget *tqparent, const char *name ) + : TQDialog( tqparent, name ), mPosInitialized( false ), mName( name ) { @@ -56,25 +56,25 @@ SignalPlotter::SignalPlotter( QWidget *parent, const char *name ) // Anything smaller than this does not make sense. setMinimumSize( 16, 16 ); - setSizePolicy( QSizePolicy( QSizePolicy::Expanding, - QSizePolicy::Expanding, false ) ); + tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, + TQSizePolicy::Expanding, false ) ); mShowVerticalLines = true; - mVerticalLinesColor = QColor( 0x04FB1D ); + mVerticalLinesColor = TQColor( 0x04FB1D ); mVerticalLinesDistance = 30; mVerticalLinesScroll = true; mVerticalLinesOffset = 0; mHorizontalScale = 1; mShowHorizontalLines = true; - mHorizontalLinesColor = QColor( 0x04FB1D ); + mHorizontalLinesColor = TQColor( 0x04FB1D ); mHorizontalLinesCount = 5; mShowLabels = true; mShowTopBar = false; mFontSize = 8; - mBackgroundColor = QColor( 0x313031 ); + mBackgroundColor = TQColor( 0x313031 ); // Restore window size and position. KConfig* config = new KConfig( "knemorc", false ); @@ -117,12 +117,12 @@ void SignalPlotter::hide() { mPos = pos(); mPosInitialized = true; - QDialog::hide(); + TQDialog::hide(); } void SignalPlotter::show() { - QDialog::show(); + TQDialog::show(); /** * mPosInitialized should always be true, except when * starting KNemo for the very first time. @@ -131,7 +131,7 @@ void SignalPlotter::show() move( mPos ); } -bool SignalPlotter::addBeam( const QColor &color ) +bool SignalPlotter::addBeam( const TQColor &color ) { double* d = new double[ mSamples ]; memset( d, 0, sizeof(double) * mSamples ); @@ -141,7 +141,7 @@ bool SignalPlotter::addBeam( const QColor &color ) return true; } -void SignalPlotter::addSample( const QValueList<double>& sampleBuf ) +void SignalPlotter::addSample( const TQValueList<double>& sampleBuf ) { if ( mBeamData.count() != sampleBuf.count() ) return; @@ -160,7 +160,7 @@ void SignalPlotter::addSample( const QValueList<double>& sampleBuf ) /* If the vertical lines are scrolling, increment the offset * so they move with the data. The vOffset / hScale confusion - * is because v refers to Vertical Lines, and h to the horizontal + * is because v refers toQt::Vertical Lines, and h to the horizontal * distance between the vertical lines. */ if ( mVerticalLinesScroll ) { mVerticalLinesOffset = ( mVerticalLinesOffset + mHorizontalScale) @@ -168,7 +168,7 @@ void SignalPlotter::addSample( const QValueList<double>& sampleBuf ) } // Shift data buffers one sample down and insert new samples. - QValueList<double>::ConstIterator s; + TQValueList<double>::ConstIterator s; for ( d = mBeamData.first(), s = sampleBuf.begin(); d; d = mBeamData.next(), ++s ) { memmove( d, d + 1, ( mSamples - 1 ) * sizeof( double ) ); d[ mSamples - 1 ] = *s; @@ -187,7 +187,7 @@ void SignalPlotter::changeRange( int beam, double min, double max ) mMaxValue = max; } -QValueList<QColor> &SignalPlotter::beamColors() +TQValueList<TQColor> &SignalPlotter::beamColors() { return mBeamColor; } @@ -198,12 +198,12 @@ void SignalPlotter::removeBeam( uint pos ) mBeamData.remove( pos ); } -void SignalPlotter::setTitle( const QString &title ) +void SignalPlotter::setTitle( const TQString &title ) { mTitle = title; } -QString SignalPlotter::title() const +TQString SignalPlotter::title() const { return mTitle; } @@ -273,12 +273,12 @@ bool SignalPlotter::showVerticalLines() const return mShowVerticalLines; } -void SignalPlotter::setVerticalLinesColor( const QColor &color ) +void SignalPlotter::setVerticalLinesColor( const TQColor &color ) { mVerticalLinesColor = color; } -QColor SignalPlotter::verticalLinesColor() const +TQColor SignalPlotter::verticalLinesColor() const { return mVerticalLinesColor; } @@ -313,12 +313,12 @@ bool SignalPlotter::showHorizontalLines() const return mShowHorizontalLines; } -void SignalPlotter::setHorizontalLinesColor( const QColor &color ) +void SignalPlotter::setHorizontalLinesColor( const TQColor &color ) { mHorizontalLinesColor = color; } -QColor SignalPlotter::horizontalLinesColor() const +TQColor SignalPlotter::horizontalLinesColor() const { return mHorizontalLinesColor; } @@ -363,17 +363,17 @@ int SignalPlotter::fontSize() const return mFontSize; } -void SignalPlotter::setBackgroundColor( const QColor &color ) +void SignalPlotter::setBackgroundColor( const TQColor &color ) { mBackgroundColor = color; } -QColor SignalPlotter::backgroundColor() const +TQColor SignalPlotter::backgroundColor() const { return mBackgroundColor; } -void SignalPlotter::resizeEvent( QResizeEvent* ) +void SignalPlotter::resizeEvent( TQResizeEvent* ) { Q_ASSERT( width() > 2 ); @@ -418,23 +418,23 @@ void SignalPlotter::updateDataBuffers() mSamples = newSampleNum; } -void SignalPlotter::paintEvent( QPaintEvent* ) +void SignalPlotter::paintEvent( TQPaintEvent* ) { uint w = width(); uint h = height(); - /* Do not do repaints when the widget is not yet setup properly. */ + /* Do not do tqrepaints when the widget is not yet setup properly. */ if ( w <= 2 ) return; - QPixmap pm( w, h ); - QPainter p; - p.begin( &pm, this ); + TQPixmap pm( w, h ); + TQPainter p; + p.tqbegin( TQT_TQPAINTDEVICE(&pm), this ); pm.fill( mBackgroundColor ); /* Draw white line along the bottom and the right side of the * widget to create a 3D like look. */ - p.setPen( QColor( colorGroup().light() ) ); + p.setPen( TQColor( tqcolorGroup().light() ) ); p.drawLine( 0, h - 1, w - 1, h - 1 ); p.drawLine( w - 1, 0, w - 1, h - 1 ); @@ -470,7 +470,7 @@ void SignalPlotter::paintEvent( QPaintEvent* ) /* Draw horizontal bar with current sensor values at top of display. */ p.setPen( mHorizontalLinesColor ); int x0 = w / 2; - p.setFont( QFont( p.font().family(), mFontSize ) ); + p.setFont( TQFont( p.font().family(), mFontSize ) ); top = p.fontMetrics().height(); h -= top; int h0 = top - 2; @@ -492,24 +492,24 @@ void SignalPlotter::paintEvent( QPaintEvent* ) // - upload speed (numerically, from the value shown by the bar on the right) // title - p.drawText(0, 0, x0/3, top - 2, Qt::AlignCenter, mTitle ); + p.drawText(0, 0, x0/3, top - 2, TQt::AlignCenter, mTitle ); - QValueList<QColor>::Iterator col_speeds; + TQValueList<TQColor>::Iterator col_speeds; col_speeds = mBeamColor.begin(); - QColor UploadColor = *(col_speeds++); - QColor DownloadColor = *(col_speeds); + TQColor UploadColor = *(col_speeds++); + TQColor DownloadColor = *(col_speeds); // download speed - QString DownloadSpeedText; + TQString DownloadSpeedText; DownloadSpeedText.sprintf("in: %0.2f KB/s", DownloadSpeed); p.setPen( DownloadColor ); - p.drawText(x0/3, 0, x0/3, top - 2, Qt::AlignCenter, DownloadSpeedText ); + p.drawText(x0/3, 0, x0/3, top - 2, TQt::AlignCenter, DownloadSpeedText ); // upload speed - QString UploadSpeedText; + TQString UploadSpeedText; UploadSpeedText.sprintf("out: %0.2f KB/s", UploadSpeed); p.setPen( UploadColor ); - p.drawText(2*x0/3, 0, x0/3, top - 2, Qt::AlignCenter, UploadSpeedText ); + p.drawText(2*x0/3, 0, x0/3, top - 2, TQt::AlignCenter, UploadSpeedText ); // restore correct pen color for the separator lines p.setPen( mHorizontalLinesColor ); @@ -520,7 +520,7 @@ void SignalPlotter::paintEvent( QPaintEvent* ) double bias = -minValue; double scaleFac = ( w - x0 - 2 ) / range; - QValueList<QColor>::Iterator col; + TQValueList<TQColor>::Iterator col; col = mBeamColor.begin(); for ( double* d = mBeamData.first(); d; d = mBeamData.next(), ++col ) { int start = x0 + (int)( bias * scaleFac ); @@ -570,7 +570,7 @@ void SignalPlotter::paintEvent( QPaintEvent* ) int xPos = 0; for ( int i = 0; i < mSamples; i++, xPos += mHorizontalScale ) { double bias = -minValue; - QValueList<QColor>::Iterator col; + TQValueList<TQColor>::Iterator col; col = mBeamColor.begin(); double sum = 0.0; for ( double* d = mBeamData.first(); d; d = mBeamData.next(), ++col ) { @@ -604,7 +604,7 @@ void SignalPlotter::paintEvent( QPaintEvent* ) int x1 = w - ( ( mSamples + 1 ) * mHorizontalScale ); for ( int i = 0; i < mSamples; i++ ) { - QValueList<QColor>::Iterator col; + TQValueList<TQColor>::Iterator col; col = mBeamColor.begin(); double sum = 0.0; int y = top + h - 2; @@ -630,10 +630,10 @@ void SignalPlotter::paintEvent( QPaintEvent* ) /* If the line is longer than 2 pixels we draw only the last * 2 pixels with the bright color. The rest is painted with * a 50% darker color. */ - QPen lastPen = QPen( p.pen() ); + TQPen lastPen = TQPen( p.pen() ); p.setPen( (*col).dark( 150 ) ); p.setBrush( (*col).dark( 150 ) ); - QPointArray pa( 4 ); + TQPointArray pa( 4 ); int prevY = ( i == 0 ) ? y : prevVals[ j ]; pa.putPoints( 0, 1, x1, prevY ); pa.putPoints( 1, 1, x2, y ); @@ -680,21 +680,21 @@ void SignalPlotter::paintEvent( QPaintEvent* ) * when width is greater than 60 */ if ( mShowHorizontalLines && h > ( 10 * ( mHorizontalLinesCount + 1 ) ) ) { p.setPen( mHorizontalLinesColor ); - p.setFont( QFont( p.font().family(), mFontSize ) ); - QString val; + p.setFont( TQFont( p.font().family(), mFontSize ) ); + TQString val; for ( uint y = 1; y < mHorizontalLinesCount; y++ ) { p.drawLine( 0, top + y * ( h / mHorizontalLinesCount ), w - 2, top + y * ( h / mHorizontalLinesCount ) ); if ( mShowLabels && h > ( mFontSize + 1 ) * ( mHorizontalLinesCount + 1 ) && w > 60 ) { - val = QString( "%1" ).arg( maxValue - y * ( range / mHorizontalLinesCount ) ); + val = TQString( "%1" ).tqarg( maxValue - y * ( range / mHorizontalLinesCount ) ); p.drawText( 6, top + y * ( h / mHorizontalLinesCount ) - 1, val ); } } if ( mShowLabels && h > ( mFontSize + 1 ) * ( mHorizontalLinesCount + 1 ) && w > 60 ) { - val = QString( "%1" ).arg( minValue ); + val = TQString( "%1" ).tqarg( minValue ); p.drawText( 6, top + h - 2, val ); } } |