diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:33:34 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:33:34 +0000 |
commit | c663b6440964f6ac48027143ac9e63298991f9d0 (patch) | |
tree | 6d8b0c5a5f9db1ee16acf98b1397cea9126b281d /ksysguard/gui/SensorDisplayLib/SensorDisplay.cc | |
parent | a061f7191beebb0e4a3b0c0a7c534ec5f22f2dc7 (diff) | |
download | tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.tar.gz tdebase-c663b6440964f6ac48027143ac9e63298991f9d0.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1157639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksysguard/gui/SensorDisplayLib/SensorDisplay.cc')
-rw-r--r-- | ksysguard/gui/SensorDisplayLib/SensorDisplay.cc | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/ksysguard/gui/SensorDisplayLib/SensorDisplay.cc b/ksysguard/gui/SensorDisplayLib/SensorDisplay.cc index 805c9a492..c80ad65ee 100644 --- a/ksysguard/gui/SensorDisplayLib/SensorDisplay.cc +++ b/ksysguard/gui/SensorDisplayLib/SensorDisplay.cc @@ -21,12 +21,12 @@ */ -#include <qcheckbox.h> -#include <qdom.h> -#include <qpopupmenu.h> -#include <qspinbox.h> -#include <qwhatsthis.h> -#include <qbitmap.h> +#include <tqcheckbox.h> +#include <tqdom.h> +#include <tqpopupmenu.h> +#include <tqspinbox.h> +#include <tqwhatsthis.h> +#include <tqbitmap.h> #include <kapplication.h> #include <kdebug.h> @@ -43,9 +43,9 @@ using namespace KSGRD; -SensorDisplay::SensorDisplay( QWidget *parent, const char *name, - const QString &title, bool nf, bool isApplet) - : QWidget( parent, name ) +SensorDisplay::SensorDisplay( TQWidget *parent, const char *name, + const TQString &title, bool nf, bool isApplet) + : TQWidget( parent, name ) { mIsApplet = isApplet; mSensors.setAutoDelete( true ); @@ -61,10 +61,10 @@ SensorDisplay::SensorDisplay( QWidget *parent, const char *name, mPlotterWdg = 0; setTimerOn( true ); - QWhatsThis::add( this, "dummy" ); + TQWhatsThis::add( this, "dummy" ); if(!nf) { - mFrame = new QGroupBox( 2, Qt::Vertical, "", this, "displayFrame"); + mFrame = new TQGroupBox( 2, Qt::Vertical, "", this, "displayFrame"); mFrame->setFlat(true); mFrame->setAlignment(Qt::AlignHCenter); mFrame->setInsideMargin(2); @@ -101,7 +101,7 @@ void SensorDisplay::registerSensor( SensorProperties *sp ) * a case the user can re-enter the connect information and the * connection will be established. */ if ( !SensorMgr->engageHost( sp->hostName() ) ) { - QString msg = i18n( "It is impossible to connect to \'%1\'." ).arg( sp->hostName() ); + TQString msg = i18n( "It is impossible to connect to \'%1\'." ).arg( sp->hostName() ); KMessageBox::error( this, msg ); } @@ -140,24 +140,24 @@ void SensorDisplay::configureUpdateInterval() } } -void SensorDisplay::timerEvent( QTimerEvent* ) +void SensorDisplay::timerEvent( TQTimerEvent* ) { int i = 0; for ( SensorProperties *s = mSensors.first(); s; s = mSensors.next(), ++i ) sendRequest( s->hostName(), s->name(), i ); } -void SensorDisplay::resizeEvent( QResizeEvent* ) +void SensorDisplay::resizeEvent( TQResizeEvent* ) { if(mFrame) mFrame->setGeometry( rect() ); } -bool SensorDisplay::eventFilter( QObject *object, QEvent *event ) +bool SensorDisplay::eventFilter( TQObject *object, TQEvent *event ) { - if ( event->type() == QEvent::MouseButtonPress && - ( (QMouseEvent*)event)->button() == RightButton ) { - QPopupMenu pm; + if ( event->type() == TQEvent::MouseButtonPress && + ( (TQMouseEvent*)event)->button() == RightButton ) { + TQPopupMenu pm; if ( mIsApplet ) { pm.insertItem( i18n( "Launch &System Guard"), 1 ); pm.insertSeparator(); @@ -172,7 +172,7 @@ bool SensorDisplay::eventFilter( QObject *object, QEvent *event ) else pm.insertItem( i18n( "P&ause Update" ), 6 ); - switch ( pm.exec( QCursor::pos() ) ) { + switch ( pm.exec( TQCursor::pos() ) ) { case 1: KRun::run(*KService::serviceByDesktopName("ksysguard"), KURL::List()); break; @@ -180,7 +180,7 @@ bool SensorDisplay::eventFilter( QObject *object, QEvent *event ) configureSettings(); break; case 3: { - QCustomEvent *e = new QCustomEvent( QEvent::User ); + TQCustomEvent *e = new TQCustomEvent( TQEvent::User ); e->setData( this ); kapp->postEvent( parent(), e ); } @@ -199,16 +199,16 @@ bool SensorDisplay::eventFilter( QObject *object, QEvent *event ) } return true; - } else if ( event->type() == QEvent::MouseButtonRelease && - ( ( QMouseEvent*)event)->button() == LeftButton ) { + } else if ( event->type() == TQEvent::MouseButtonRelease && + ( ( TQMouseEvent*)event)->button() == LeftButton ) { setFocus(); } - return QWidget::eventFilter( object, event ); + return TQWidget::eventFilter( object, event ); } -void SensorDisplay::sendRequest( const QString &hostName, - const QString &command, int id ) +void SensorDisplay::sendRequest( const TQString &hostName, + const TQString &command, int id ) { if ( !SensorMgr->sendRequest( hostName, command, (SensorClient*)this, id ) ) sensorError( id, true ); @@ -236,7 +236,7 @@ void SensorDisplay::sensorError( int sensorId, bool err ) void SensorDisplay::updateWhatsThis() { - QWhatsThis::add( this, i18n( + TQWhatsThis::add( this, i18n( "<qt><p>This is a sensor display. To customize a sensor display click " "and hold the right mouse button on either the frame or the " "display box and select the <i>Properties</i> entry from the popup " @@ -244,34 +244,34 @@ void SensorDisplay::updateWhatsThis() "</p>%1</qt>" ).arg( additionalWhatsThis() ) ); } -void SensorDisplay::hosts( QStringList& list ) +void SensorDisplay::hosts( TQStringList& list ) { for ( SensorProperties *s = mSensors.first(); s; s = mSensors.next() ) if ( !list.contains( s->hostName() ) ) list.append( s->hostName() ); } -QColor SensorDisplay::restoreColor( QDomElement &element, const QString &attr, - const QColor& fallback ) +TQColor SensorDisplay::restoreColor( TQDomElement &element, const TQString &attr, + const TQColor& fallback ) { bool ok; uint c = element.attribute( attr ).toUInt( &ok ); if ( !ok ) return fallback; else - return QColor( (c >> 16) & 0xFF, (c >> 8) & 0xFF, c & 0xFF ); + return TQColor( (c >> 16) & 0xFF, (c >> 8) & 0xFF, c & 0xFF ); } -void SensorDisplay::saveColor( QDomElement &element, const QString &attr, - const QColor &color ) +void SensorDisplay::saveColor( TQDomElement &element, const TQString &attr, + const TQColor &color ) { int r, g, b; color.rgb( &r, &g, &b ); element.setAttribute( attr, (r << 16) | (g << 8) | b ); } -bool SensorDisplay::addSensor( const QString &hostName, const QString &name, - const QString &type, const QString &description ) +bool SensorDisplay::addSensor( const TQString &hostName, const TQString &name, + const TQString &type, const TQString &description ) { registerSensor( new SensorProperties( hostName, name, type, description ) ); return true; @@ -315,9 +315,9 @@ bool SensorDisplay::useGlobalUpdateInterval() const return mUseGlobalUpdateInterval; } -QString SensorDisplay::additionalWhatsThis() +TQString SensorDisplay::additionalWhatsThis() { - return QString::null; + return TQString::null; } void SensorDisplay::sensorLost( int reqId ) @@ -325,20 +325,20 @@ void SensorDisplay::sensorLost( int reqId ) sensorError( reqId, true ); } -bool SensorDisplay::restoreSettings( QDomElement &element ) +bool SensorDisplay::restoreSettings( TQDomElement &element ) { - QString str = element.attribute( "showUnit", "X" ); + TQString str = element.attribute( "showUnit", "X" ); if(!str.isEmpty() && str != "X") { mShowUnit = str.toInt(); } - str = element.attribute( "unit", QString::null ); + str = element.attribute( "unit", TQString::null ); if(!str.isEmpty()) setUnit(str); - str = element.attribute( "title", QString::null ); + str = element.attribute( "title", TQString::null ); if(!str.isEmpty()) setTitle(str); - if ( element.attribute( "updateInterval" ) != QString::null ) { + if ( element.attribute( "updateInterval" ) != TQString::null ) { mUseGlobalUpdateInterval = false; setUpdateInterval( element.attribute( "updateInterval", "2" ).toInt() ); } else { @@ -360,7 +360,7 @@ bool SensorDisplay::restoreSettings( QDomElement &element ) return true; } -bool SensorDisplay::saveSettings( QDomDocument&, QDomElement &element, bool ) +bool SensorDisplay::saveSettings( TQDomDocument&, TQDomElement &element, bool ) { element.setAttribute( "title", title() ); element.setAttribute( "unit", unit() ); @@ -404,7 +404,7 @@ bool SensorDisplay::modified() const return mModified; } -QPtrList<SensorProperties> &SensorDisplay::sensors() +TQPtrList<SensorProperties> &SensorDisplay::sensors() { return mSensors; } @@ -439,12 +439,12 @@ void SensorDisplay::setSensorOk( bool ok ) if ( mErrorIndicator ) return; - QPixmap errorIcon = KGlobal::iconLoader()->loadIcon( "connect_creating", KIcon::Desktop, + TQPixmap errorIcon = KGlobal::iconLoader()->loadIcon( "connect_creating", KIcon::Desktop, KIcon::SizeSmall ); if ( !mPlotterWdg ) return; - mErrorIndicator = new QWidget( mPlotterWdg ); + mErrorIndicator = new TQWidget( mPlotterWdg ); mErrorIndicator->setErasePixmap( errorIcon ); mErrorIndicator->resize( errorIcon.size() ); if ( errorIcon.mask() ) @@ -454,7 +454,7 @@ void SensorDisplay::setSensorOk( bool ok ) } } -void SensorDisplay::setTitle( const QString &title ) +void SensorDisplay::setTitle( const TQString &title ) { mTitle = title; @@ -465,7 +465,7 @@ void SensorDisplay::setTitle( const QString &title ) /* Changing the frame title may increase the width of the frame and * hence breaks the layout. To avoid this, we save the original size * and restore it after we have set the frame title. */ - QSize s = mFrame->size(); + TQSize s = mFrame->size(); if ( mShowUnit && !mUnit.isEmpty() ) mFrame->setTitle( mTitle + " [" + mUnit + "]" ); @@ -474,17 +474,17 @@ void SensorDisplay::setTitle( const QString &title ) mFrame->setGeometry( 0, 0, s.width(), s.height() ); } -QString SensorDisplay::title() const +TQString SensorDisplay::title() const { return mTitle; } -void SensorDisplay::setUnit( const QString &unit ) +void SensorDisplay::setUnit( const TQString &unit ) { mUnit = unit; } -QString SensorDisplay::unit() const +TQString SensorDisplay::unit() const { return mUnit; } @@ -499,13 +499,13 @@ bool SensorDisplay::showUnit() const return mShowUnit; } -void SensorDisplay::setPlotterWidget( QWidget *wdg ) +void SensorDisplay::setPlotterWidget( TQWidget *wdg ) { mPlotterWdg = wdg; } -QWidget *SensorDisplay::frame() +TQWidget *SensorDisplay::frame() { return mFrame; } @@ -520,9 +520,9 @@ bool SensorDisplay::noFrame() const return !mFrame; } -void SensorDisplay::reorderSensors(const QValueList<int> &orderOfSensors) +void SensorDisplay::reorderSensors(const TQValueList<int> &orderOfSensors) { - QPtrList<SensorProperties> newSensors; + TQPtrList<SensorProperties> newSensors; for ( uint i = 0; i < orderOfSensors.count(); ++i ) { newSensors.append( mSensors.at(orderOfSensors[i] )); } @@ -537,8 +537,8 @@ SensorProperties::SensorProperties() { } -SensorProperties::SensorProperties( const QString &hostName, const QString &name, - const QString &type, const QString &description ) +SensorProperties::SensorProperties( const TQString &hostName, const TQString &name, + const TQString &type, const TQString &description ) : mHostName( hostName ), mName( name ), mType( type ), mDescription( description ) { mOk = false; @@ -548,52 +548,52 @@ SensorProperties::~SensorProperties() { } -void SensorProperties::setHostName( const QString &hostName ) +void SensorProperties::setHostName( const TQString &hostName ) { mHostName = hostName; } -QString SensorProperties::hostName() const +TQString SensorProperties::hostName() const { return mHostName; } -void SensorProperties::setName( const QString &name ) +void SensorProperties::setName( const TQString &name ) { mName = name; } -QString SensorProperties::name() const +TQString SensorProperties::name() const { return mName; } -void SensorProperties::setType( const QString &type ) +void SensorProperties::setType( const TQString &type ) { mType = type; } -QString SensorProperties::type() const +TQString SensorProperties::type() const { return mType; } -void SensorProperties::setDescription( const QString &description ) +void SensorProperties::setDescription( const TQString &description ) { mDescription = description; } -QString SensorProperties::description() const +TQString SensorProperties::description() const { return mDescription; } -void SensorProperties::setUnit( const QString &unit ) +void SensorProperties::setUnit( const TQString &unit ) { mUnit = unit; } -QString SensorProperties::unit() const +TQString SensorProperties::unit() const { return mUnit; } |