diff options
Diffstat (limited to 'src/kbfxtooltip.cpp')
-rw-r--r-- | src/kbfxtooltip.cpp | 158 |
1 files changed, 81 insertions, 77 deletions
diff --git a/src/kbfxtooltip.cpp b/src/kbfxtooltip.cpp index bce755c..28a4167 100644 --- a/src/kbfxtooltip.cpp +++ b/src/kbfxtooltip.cpp @@ -23,51 +23,51 @@ #include "kbfxtooltip.h" -KbfxToolTip::KbfxToolTip ( QWidget * parent, const char *name, WFlags fl ) : - QWidget ( parent, name, +KbfxToolTip::KbfxToolTip ( TQWidget * tqparent, const char *name, WFlags fl ) : + TQWidget ( tqparent, name, fl | WStyle_Customize | WRepaintNoErase | WStyle_NoBorder | - WDestructiveClose | Qt::WPaintDesktop | Qt::WType_Popup | Qt:: - WPaintClever | Qt::WNoAutoErase | Qt::WResizeNoErase | Qt:: - WStaticContents | Qt::WNoAutoErase ) + WDestructiveClose | TQt::WPaintDesktop | TQt::WType_Popup | TQt:: + WPaintClever | TQt::WNoAutoErase | TQt::WResizeNoErase | TQt:: + WStaticContents | TQt::WNoAutoErase ) { _animate = ConfigInit ().m_ToolTipAnimation; m_fontTooltipFont = ConfigInit ().m_fontTooltipFont; logo = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit().m_SpinxTooltipLogo ) ) ? - QImage ( ConfigInit().m_SpinxTooltipLogo ) - : QImage ( ConfigInit().m_SpinxTooltipLogoDefault ); + TQImage ( ConfigInit().m_SpinxTooltipLogo ) + : TQImage ( ConfigInit().m_SpinxTooltipLogoDefault ); tooltip_win = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_SpinxTooltipWindow ) ) ? - QImage ( ConfigInit ().m_SpinxTooltipWindow ) - : QImage ( ConfigInit ().m_SpinxTooltipWindowDefault ); + TQImage ( ConfigInit ().m_SpinxTooltipWindow ) + : TQImage ( ConfigInit ().m_SpinxTooltipWindowDefault ); - tooltip_mask = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit().m_SpinxTooltipMask ) ) ? - QImage ( ConfigInit().m_SpinxTooltipMask ) - : QImage ( ConfigInit().m_SpinxTooltipMaskDefault ); + tooltip_tqmask = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit().m_SpinxTooltipMask ) ) ? + TQImage ( ConfigInit().m_SpinxTooltipMask ) + : TQImage ( ConfigInit().m_SpinxTooltipMaskDefault ); dude_img = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_SpinxDudeImage ) ) ? - QImage ( ConfigInit ().m_SpinxDudeImage ) - : QImage ( ConfigInit ().m_SpinxDudeImageDefault ); + TQImage ( ConfigInit ().m_SpinxDudeImage ) + : TQImage ( ConfigInit ().m_SpinxDudeImageDefault ); setUserImage (); setBoundBox (); - setBackground ( QPixmap () ); - setWindow ( QPixmap () ); + setBackground ( TQPixmap () ); + setWindow ( TQPixmap () ); KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_ToolTipAvatar ) ? setAnimationImage ( ConfigInit ().m_ToolTipAvatar ) : setAnimationImage ( ConfigInit ().m_ToolTipAvatarDefault ); - _hide_timer = new QTimer ( this ); - _update_timer = new QTimer ( this ); - _move_timer = new QTimer ( this ); + _hide_timer = new TQTimer ( this ); + _update_timer = new TQTimer ( this ); + _move_timer = new TQTimer ( this ); - connect ( _hide_timer, SIGNAL ( timeout () ), this, SLOT ( hide () ) ); - connect ( _hide_timer, SIGNAL ( timeout () ), _agent, SLOT ( hide () ) ); - connect ( _update_timer, SIGNAL ( timeout () ), this, SLOT ( logoMove () ) ); + connect ( _hide_timer, TQT_SIGNAL ( timeout () ), this, TQT_SLOT ( hide () ) ); + connect ( _hide_timer, TQT_SIGNAL ( timeout () ), _agent, TQT_SLOT ( hide () ) ); + connect ( _update_timer, TQT_SIGNAL ( timeout () ), this, TQT_SLOT ( logoMove () ) ); - QCursor kbfxCursor; + TQCursor kbfxCursor; kbfxCursor.setShape ( Qt::PointingHandCursor ); - this->setCursor ( ( const QCursor ) kbfxCursor ); + this->setCursor ( ( const TQCursor ) kbfxCursor ); } KbfxToolTip::~KbfxToolTip () @@ -81,19 +81,21 @@ KbfxToolTip::~KbfxToolTip () } void -KbfxToolTip::setWindow ( QPixmap win ) +KbfxToolTip::setWindow ( TQPixmap win ) { - QImage m_win_img; + TQImage m_win_img; ( win.isNull () ) ? m_win_img = tooltip_win : m_win_img = win.convertToImage (); m_win_img = m_win_img.smoothScale ( _bg.width (), 13 ); -// _window = new QLabel (this, "", Qt::WStaticContents | Qt::WNoAutoErase); - _window = new QLabel ( this, "" ); +// _window = new TQLabel (this, "", TQt::WStaticContents | TQt::WNoAutoErase); + _window = new TQLabel ( this, "" ); _window->resize ( _bg.width (), 13 ); - _window->setBackgroundPixmap ( m_win_img ); + TQPixmap pm; + pm.convertFromImage(m_win_img); + _window->setBackgroundPixmap ( pm ); if ( _animate ) _window->show (); else @@ -101,22 +103,22 @@ KbfxToolTip::setWindow ( QPixmap win ) } void -KbfxToolTip::setAnimationImage ( QString path ) +KbfxToolTip::setAnimationImage ( TQString path ) { /* - _agent = new QLabel (this, "", - Qt::WStaticContents | - Qt::WNoAutoErase | Qt::WPaintDesktop); + _agent = new TQLabel (this, "", + TQt::WStaticContents | + TQt::WNoAutoErase | TQt::WPaintDesktop); */ - _agent = new QLabel ( this,"" ); + _agent = new TQLabel ( this,"" ); _agent->resize ( 100, 100 ); - _agent_anim = new QMovie ( path ); - QPixmap agent_mask = _agent_anim->framePixmap (); - _agent->setBackgroundPixmap ( agent_mask ); - if ( agent_mask.mask () ) - _agent->setMask ( *agent_mask.mask () ); - _agent->repaint (); + _agent_anim = new TQMovie ( path ); + TQPixmap agent_tqmask = _agent_anim->framePixmap (); + _agent->setBackgroundPixmap ( agent_tqmask ); + if ( agent_tqmask.tqmask () ) + _agent->setMask ( *agent_tqmask.tqmask () ); + _agent->tqrepaint (); /*FIXME:Need to remove Hard Coded Values */ _agent->move ( 200, 0 ); @@ -129,25 +131,27 @@ KbfxToolTip::setAnimationImage ( QString path ) void -KbfxToolTip::setBackground ( QPixmap bg ) +KbfxToolTip::setBackground ( TQPixmap bg ) { ( bg.isNull () ) ? - _bg = tooltip_mask + _bg = tooltip_tqmask : _bg = bg.convertToImage (); /* animation check : Auto streatch */ if ( _animate ) { - QImage m_tmp = _bg; + TQImage m_tmp = _bg; _bg = m_tmp.smoothScale ( _bg.width () + 100, _bg.height () ); } - this->setBackgroundPixmap ( _bg ); + TQPixmap pm; + pm.convertFromImage(_bg); + this->setBackgroundPixmap ( pm ); - QPixmap m_tmp ( _bg ); - if ( m_tmp.mask () ) - this->setMask ( ( *m_tmp.mask () ) ); + TQPixmap m_tmp ( _bg ); + if ( m_tmp.tqmask () ) + this->setMask ( ( *m_tmp.tqmask () ) ); this->resize ( _bg.width (), _bg.height () ); _maxW = _bg.width (); } @@ -172,31 +176,31 @@ KbfxToolTip::setStartPos ( int _x_, int _y_ ) void KbfxToolTip::logoMove () { - QPainter p; + TQPainter p; if ( _logo_move_x < _bg.width () - 68 ) { _logo_move_x += 1; - _window->repaint (); + _window->tqrepaint (); p.begin ( _window ); - p.drawPixmap ( QRect ( _logo_move_x, 0, logo.width (), logo.height () ), - QPixmap ( logo ) ); + p.drawPixmap ( TQRect ( _logo_move_x, 0, logo.width (), logo.height () ), + TQPixmap ( logo ) ); p.end (); } else { p.begin ( _window ); - p.drawPixmap ( QRect ( _bg.width () - 68, 0, logo.width (), logo.height () ), - QPixmap ( logo ) ); + p.drawPixmap ( TQRect ( _bg.width () - 68, 0, logo.width (), logo.height () ), + TQPixmap ( logo ) ); p.end (); } - QPixmap agent_mask = _agent_anim->framePixmap (); - _agent->setBackgroundPixmap ( agent_mask ); - if ( agent_mask.mask () ) - _agent->setMask ( *agent_mask.mask () ); - _agent->repaint (); + TQPixmap agent_tqmask = _agent_anim->framePixmap (); + _agent->setBackgroundPixmap ( agent_tqmask ); + if ( agent_tqmask.tqmask () ) + _agent->setMask ( *agent_tqmask.tqmask () ); + _agent->tqrepaint (); } void @@ -207,19 +211,19 @@ KbfxToolTip::setAnimated ( bool b ) void -KbfxToolTip::setLabelText ( QString str ) +KbfxToolTip::setLabelText ( TQString str ) { _label_text = str; } void -KbfxToolTip::setHeadingText ( QString str ) +KbfxToolTip::setHeadingText ( TQString str ) { _heading_text = str; } void -KbfxToolTip::setVersionText ( QString str ) +KbfxToolTip::setVersionText ( TQString str ) { _version_text = str; } @@ -239,34 +243,34 @@ KbfxToolTip::hideToolTip () void KbfxToolTip::setUserImage () { - QImage userimage = dude_img; + TQImage userimage = dude_img; userimage = userimage.smoothScale ( 48, 48 ); - _dude = QPixmap ( userimage ); + _dude = TQPixmap ( userimage ); } void KbfxToolTip::setBoundBox () { _dude_box = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_SpinxTooltipDudebox ) ) ? - QPixmap ( ConfigInit ().m_SpinxTooltipDudebox ) - : QPixmap ( ConfigInit ().m_SpinxTooltipDudeboxDefault ); + TQPixmap ( ConfigInit ().m_SpinxTooltipDudebox ) + : TQPixmap ( ConfigInit ().m_SpinxTooltipDudeboxDefault ); } void -KbfxToolTip::paintEvent ( QPaintEvent * pe ) +KbfxToolTip::paintEvent ( TQPaintEvent * pe ) { - const QRect r = pe->rect (); - QFont *let = new QFont (m_fontTooltipFont); + const TQRect r = pe->rect (); + TQFont *let = new TQFont (m_fontTooltipFont); - QPainter p; + TQPainter p; p.begin ( this ); p.setBackgroundMode ( Qt::TransparentMode ); - p.drawPixmap ( QRect ( 7, 16, _dude_box.width (), _dude_box.height () ), + p.drawPixmap ( TQRect ( 7, 16, _dude_box.width (), _dude_box.height () ), _dude_box ); int _paddingX = ( ( _dude_box.height () - _dude.height () ) / 2 ) + 16; - p.drawPixmap ( QRect + p.drawPixmap ( TQRect ( _paddingX - ( 55 - 48 ), _paddingX, _dude.width (), _dude.height () ), _dude ); @@ -275,22 +279,22 @@ KbfxToolTip::paintEvent ( QPaintEvent * pe ) else { - p.drawPixmap ( QRect ( 126, 0, logo.width (), logo.height () ), - QPixmap ( QImage (ConfigInit ().m_SpinxTooltipLogo ) ) ); + p.drawPixmap ( TQRect ( 126, 0, logo.width (), logo.height () ), + TQPixmap ( TQImage (ConfigInit ().m_SpinxTooltipLogo ) ) ); } let->setBold ( TRUE ); let->setPointSize ( 10 ); p.setFont ( *let ); - p.setPen ( QColor ( 61, 94, 129 ) ); - p.drawText ( _dude_box.width () + 15, 30, "KBFX" ); + p.setPen ( TQColor ( 61, 94, 129 ) ); + p.drawText ( _dude_box.width () + 15, 30, TQString("KBFX") ); - p.setPen ( QColor ( 0, 0, 0 ) ); + p.setPen ( TQColor ( 0, 0, 0 ) ); let->setBold ( FALSE ); let->setPointSize ( 8 ); p.setFont ( *let ); p.drawText ( ( _animate ) ? _dude_box.width () + 50 : _dude_box.width () + 4, - _dude_box.height () + 30, QString ( "Version " ).append ( APPLICATION_VERSION ) ); + _dude_box.height () + 30, TQString ( "Version " ).append ( APPLICATION_VERSION ) ); p.setPen ( ConfigInit ().m_fontTooltipColor ); let->setBold ( TRUE ); |