summaryrefslogtreecommitdiffstats
path: root/src/kbfxbutton.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-05 22:07:15 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-05 22:07:15 +0000
commit421b60af92c83b889f8903c2898f2bd07186fcd8 (patch)
treead873a24c9438baed4942fda795430a4c3dc9a9a /src/kbfxbutton.cpp
parent39e896bddf25bf34cbf8be814d959181e2c1d1dd (diff)
downloadkbfx-421b60af92c83b889f8903c2898f2bd07186fcd8.tar.gz
kbfx-421b60af92c83b889f8903c2898f2bd07186fcd8.zip
TQt4 port kbfx
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kbfx@1230544 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kbfxbutton.cpp')
-rw-r--r--src/kbfxbutton.cpp142
1 files changed, 71 insertions, 71 deletions
diff --git a/src/kbfxbutton.cpp b/src/kbfxbutton.cpp
index 5d3f8fd..0fe018c 100644
--- a/src/kbfxbutton.cpp
+++ b/src/kbfxbutton.cpp
@@ -27,8 +27,8 @@
bool KbfxButton::m_sizeHeight = TRUE;
int KbfxButton::m_size = 0;
-KbfxButton::KbfxButton ( QWidget * parent, const char *name) :
- QLabel ( parent,name,Qt::WStaticContents | Qt::WNoAutoErase |Qt::WPaintDesktop )
+KbfxButton::KbfxButton ( TQWidget * tqparent, const char *name) :
+ TQLabel ( tqparent,name,TQt::WStaticContents | TQt::WNoAutoErase |TQt::WPaintDesktop )
{
setLineWidth ( 0 );
setScaledContents ( false );
@@ -43,12 +43,12 @@ KbfxButton::KbfxButton ( QWidget * parent, const char *name) :
m_kicker_auto_adjust = ConfigInit().m_ToolBarResize;
m_toggle = false;
- QTimer * timer = new QTimer ( this,"Update Timer" );
- connect ( timer,SIGNAL ( timeout() ),this,SLOT ( update() ) );
+ TQTimer * timer = new TQTimer ( this,"Update Timer" );
+ connect ( timer,TQT_SIGNAL ( timeout() ),this,TQT_SLOT ( update() ) );
timer->start ( 25,false );
- fade_timer = new QTimer ( this,"Fade Timer" );
- connect ( fade_timer,SIGNAL ( timeout() ),this,SLOT ( fade() ) );
+ fade_timer = new TQTimer ( this,"Fade Timer" );
+ connect ( fade_timer,TQT_SIGNAL ( timeout() ),this,TQT_SLOT ( fade() ) );
}
KbfxButton::~KbfxButton()
@@ -57,64 +57,64 @@ KbfxButton::~KbfxButton()
void KbfxButton::loadSkins()
{
- QImage _tmpHover, _tmpPressed, _tmpNormal;
+ TQImage _tmpHover, _tmpPressed, _tmpNormal;
_tmpHover = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_KbfxHoverButtonPath ) ) ?
- QImage ( ConfigInit ().m_KbfxHoverButtonPath )
- : QImage ( ConfigInit ().m_KbfxHoverButtonPathDefault );
+ TQImage ( ConfigInit ().m_KbfxHoverButtonPath )
+ : TQImage ( ConfigInit ().m_KbfxHoverButtonPathDefault );
_tmpPressed = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_KbfxPressedButtonPath ) ) ?
- QImage ( ConfigInit ().m_KbfxPressedButtonPath )
- : QImage ( ConfigInit ().m_KbfxPressedButtonPathDefault );
+ TQImage ( ConfigInit ().m_KbfxPressedButtonPath )
+ : TQImage ( ConfigInit ().m_KbfxPressedButtonPathDefault );
_tmpNormal = ( KbfxPlasmaPixmapProvider::PixmapPathCheck ( ConfigInit ().m_KbfxNormalButtonPath ) ) ?
- QImage ( ConfigInit ().m_KbfxNormalButtonPath )
- : QImage ( ConfigInit ().m_KbfxNormalButtonPathDefault );
+ TQImage ( ConfigInit ().m_KbfxNormalButtonPath )
+ : TQImage ( ConfigInit ().m_KbfxNormalButtonPathDefault );
- QSize _sizeNormal = _tmpNormal.size();
- _tmpHover = _tmpHover.smoothScale ( _sizeNormal, QImage::ScaleFree );
- _tmpPressed = _tmpPressed.smoothScale ( _sizeNormal, QImage::ScaleFree );
+ TQSize _sizeNormal = _tmpNormal.size();
+ _tmpHover = _tmpHover.smoothScale ( _sizeNormal, TQ_ScaleFree );
+ _tmpPressed = _tmpPressed.smoothScale ( _sizeNormal, TQ_ScaleFree );
if ( !m_kicker_auto_adjust )
{
if ( m_sizeHeight )
{
- _tmpHover = _tmpHover.smoothScale ( _tmpHover.width(), m_size, QImage::ScaleMin );
- _tmpPressed = _tmpPressed.smoothScale ( _tmpPressed.width(), m_size, QImage::ScaleMin );
- _tmpNormal = _tmpNormal.smoothScale ( _tmpNormal.width(), m_size, QImage::ScaleMin );
+ _tmpHover = _tmpHover.smoothScale ( _tmpHover.width(), m_size, TQ_ScaleMin );
+ _tmpPressed = _tmpPressed.smoothScale ( _tmpPressed.width(), m_size, TQ_ScaleMin );
+ _tmpNormal = _tmpNormal.smoothScale ( _tmpNormal.width(), m_size, TQ_ScaleMin );
}
else
{
- _tmpHover = _tmpHover.smoothScale ( m_size, _tmpHover.height(), QImage::ScaleMin );
- _tmpPressed = _tmpPressed.smoothScale ( m_size, _tmpPressed.height(), QImage::ScaleMin );
- _tmpNormal = _tmpNormal.smoothScale ( m_size, _tmpNormal.height(), QImage::ScaleMin );
+ _tmpHover = _tmpHover.smoothScale ( m_size, _tmpHover.height(), TQ_ScaleMin );
+ _tmpPressed = _tmpPressed.smoothScale ( m_size, _tmpPressed.height(), TQ_ScaleMin );
+ _tmpNormal = _tmpNormal.smoothScale ( m_size, _tmpNormal.height(), TQ_ScaleMin );
}
}
- m_over_skin = QPixmap ( _tmpHover );
- m_normal_skin = QPixmap ( _tmpNormal );
- m_pressed_skin = QPixmap ( _tmpPressed );
+ m_over_skin = TQPixmap ( _tmpHover );
+ m_normal_skin = TQPixmap ( _tmpNormal );
+ m_pressed_skin = TQPixmap ( _tmpPressed );
m_current_skin = m_normal_skin;
this->resize ( m_current_skin.width(),m_current_skin.height() );
- this->repaint();
+ this->tqrepaint();
}
-QCString KbfxButton::findPanel()
+TQCString KbfxButton::findPanel()
{
- QCString m_AppletPanel = QCString ("kicker");
+ TQCString m_AppletPanel = TQCString ("kicker");
QCStringList objects=m_dcopClient->remoteObjects("kicker");
for( QCStringList::ConstIterator it = objects.begin();
it != objects.end();
++it)
{
- if ( (*it).contains ( "Panel" ) > 0 )
+ if ( (*it).tqcontains ( "Panel" ) > 0 )
{
DCOPRef _dcop_obj ( "kicker", (*it) );
- QStringList _dcop_obj_applets =_dcop_obj.call ( "listApplets()" );
+ TQStringList _dcop_obj_applets =_dcop_obj.call ( "listApplets()" );
- for ( QStringList::Iterator _it = _dcop_obj_applets.begin();
+ for ( TQStringList::Iterator _it = _dcop_obj_applets.begin();
_it != _dcop_obj_applets.end();
_it++ )
{
- if ( ( *_it ).contains ( "kbfx" ) )
+ if ( ( *_it ).tqcontains ( "kbfx" ) )
{
m_AppletPanel = (*it);
break;
@@ -129,7 +129,7 @@ QCString KbfxButton::findPanel()
void KbfxButton::readjust( bool _how )
{
/* _how = TRUE is for height, _how = FALSE is for width readjust */
- QCString _panel = findPanel();
+ TQCString _panel = findPanel();
int _tmp_size;
if ( _how )
{
@@ -141,8 +141,8 @@ void KbfxButton::readjust( bool _how )
_tmp_size = this->width ();
kdDebug () << "Readjusting " << _panel << " to width: " << _tmp_size << endl;
}
- QByteArray data;
- QDataStream arg ( data, IO_WriteOnly );
+ TQByteArray data;
+ TQDataStream arg ( data, IO_WriteOnly );
arg << _tmp_size ;
if ( !m_dcopClient->send ( "kicker", _panel, "setPanelSize(int)", data ) )
kdWarning ()
@@ -151,7 +151,7 @@ void KbfxButton::readjust( bool _how )
<< endl;
}
-void KbfxButton::enterEvent ( QEvent * e )
+void KbfxButton::enterEvent ( TQEvent * e )
{
e = e;
if ( m_toggle == true )
@@ -177,8 +177,8 @@ void KbfxButton::fade ( )
}
else
{
- QImage _final = m_fadePix.convertToImage ();
- QImage _current = m_current_skin.convertToImage ();
+ TQImage _final = m_fadePix.convertToImage ();
+ TQImage _current = m_current_skin.convertToImage ();
if ( !fade_timer->isActive ())
{
@@ -190,13 +190,13 @@ void KbfxButton::fade ( )
m_opacity += 0.1;
KImageEffect::blend ( _final, _current, m_opacity);
- m_current_skin = QPixmap ( _current );
+ m_current_skin = TQPixmap ( _current );
}
this->resize ( m_current_skin.size() );
this->update();
}
-void KbfxButton::leaveEvent ( QEvent * e )
+void KbfxButton::leaveEvent ( TQEvent * e )
{
e = e;
@@ -234,10 +234,10 @@ void KbfxButton::toggleKMenu()
m_toggle = false;
}
-void KbfxButton::mousePressEvent ( QMouseEvent * e )
+void KbfxButton::mousePressEvent ( TQMouseEvent * e )
{
e->accept();
- if ( e->button() == QMouseEvent::LeftButton )
+ if ( e->button() == Qt::LeftButton )
{
if ( m_toggle == false )
{
@@ -264,23 +264,23 @@ void KbfxButton::mousePressEvent ( QMouseEvent * e )
emit clicked ();
}
- if ( e->button() == QMouseEvent::RightButton )
+ if ( e->button() == Qt::RightButton )
{
m_fadePix = m_normal_skin;
fade();
m_toggle = false;
- QPopupMenu *popup = new QPopupMenu();
+ TQPopupMenu *popup = new TQPopupMenu();
popup->insertItem ( SmallIcon ( "remove" ), i18n ( "Remove KBFX from Pannel" ),
- this, SLOT ( selfDeleter() ) );
+ this, TQT_SLOT ( selfDeleter() ) );
popup->insertItem ( SmallIcon ( "reload" ),i18n ( "Reload KBFX" ),
- this, SLOT ( reloadConfig() ) );
+ this, TQT_SLOT ( reloadConfig() ) );
popup->insertSeparator();
popup->insertItem ( SmallIcon ( "kbfxconfigapp" ), i18n ( "Configure KBFX" ),
- this, SLOT ( openConfigDialog() ) );
+ this, TQT_SLOT ( openConfigDialog() ) );
popup->insertItem ( SmallIcon ( "kmenuedit" ),i18n ( "Edit Applications Menu" ),
- this, SLOT ( openKmenuEdit() ) );
+ this, TQT_SLOT ( openKmenuEdit() ) );
popup->exec ( e->globalPos() );
delete popup;
}
@@ -301,14 +301,14 @@ void KbfxButton::reloadConfig()
void KbfxButton::selfDeleter()
{
DCOPRef m_kickerPanel ( "kicker", findPanel() );
- QStringList returnQStringList =m_kickerPanel.call ( "listApplets()" );
+ TQStringList returnTQStringList =m_kickerPanel.call ( "listApplets()" );
int _myIndex = 0;
- QStringList::Iterator it;
+ TQStringList::Iterator it;
- for ( it = returnQStringList.begin();it != returnQStringList.end();it++ )
+ for ( it = returnTQStringList.begin();it != returnTQStringList.end();it++ )
{
- if ( ( *it ).contains ( "kbfx" ) )
+ if ( ( *it ).tqcontains ( "kbfx" ) )
{
break;
}
@@ -333,18 +333,18 @@ void KbfxButton::openConfigDialog()
KRun::runCommand ( "kbfxconfigapp" );
}
-void KbfxButton::paintEvent ( QPaintEvent * pe )
+void KbfxButton::paintEvent ( TQPaintEvent * pe )
{
- QPainter p;
+ TQPainter p;
if ( !m_current_skin.isNull () )
{
- QRect r = QRect ( pe->rect().x(),pe->rect().y(),m_current_skin.width(),m_current_skin.height() );
- m_buffer = new QPixmap();
+ TQRect r = TQRect ( pe->rect().x(),pe->rect().y(),m_current_skin.width(),m_current_skin.height() );
+ m_buffer = new TQPixmap();
m_buffer->resize ( r.size() );
m_buffer->fill ( this, r.topLeft() );
- p.begin ( m_buffer,this );
+ p.tqbegin ( m_buffer,this );
p.translate ( -r.x(), -r.y() );
p.drawPixmap ( r,m_current_skin );
p.end ();
@@ -354,37 +354,37 @@ void KbfxButton::paintEvent ( QPaintEvent * pe )
}
-void KbfxButton::dragEnterEvent ( QDragEnterEvent * e )
+void KbfxButton::dragEnterEvent ( TQDragEnterEvent * e )
{
- e->accept ( QUriDrag::canDecode ( e ) );
+ e->accept ( TQUriDrag::canDecode ( e ) );
kdDebug() << "Accepting KBFX button drag..." << endl;
}
-void KbfxButton::dropEvent ( QDropEvent * e )
+void KbfxButton::dropEvent ( TQDropEvent * e )
{
- QStringList filelist;
- QString _hover, _normal, _pressed, _tmp;
- QImage _hover_pix, _normal_pix, _pressed_pix;
- QUriDrag::decodeLocalFiles ( e, filelist );
+ TQStringList filelist;
+ TQString _hover, _normal, _pressed, _tmp;
+ TQImage _hover_pix, _normal_pix, _pressed_pix;
+ TQUriDrag::decodeLocalFiles ( e, filelist );
- for ( QStringList::Iterator it = filelist.begin(); it != filelist.end(); ++it )
+ for ( TQStringList::Iterator it = filelist.begin(); it != filelist.end(); ++it )
{
_tmp = ( *it );
kdDebug() << "KBFX button dropped file: " << _tmp << endl;
- if ( _tmp.contains ( "hover", FALSE ) > 0 )
+ if ( _tmp.tqcontains ( "hover", FALSE ) > 0 )
{
_hover = _tmp;
- _hover_pix = QImage ( _tmp );
+ _hover_pix = TQImage ( _tmp );
}
- if ( _tmp.contains ( "normal", FALSE ) > 0 )
+ if ( _tmp.tqcontains ( "normal", FALSE ) > 0 )
{
_normal = _tmp;
- _normal_pix = QImage ( _tmp );
+ _normal_pix = TQImage ( _tmp );
}
- if ( _tmp.contains ( "pressed", FALSE ) > 0 )
+ if ( _tmp.tqcontains ( "pressed", FALSE ) > 0 )
{
_pressed = _tmp;
- _pressed_pix = QImage ( _tmp );
+ _pressed_pix = TQImage ( _tmp );
}
}