diff options
Diffstat (limited to 'noatun/modules/kaiman/style.cpp')
-rw-r--r-- | noatun/modules/kaiman/style.cpp | 190 |
1 files changed, 95 insertions, 95 deletions
diff --git a/noatun/modules/kaiman/style.cpp b/noatun/modules/kaiman/style.cpp index 0cce6b96..6b700230 100644 --- a/noatun/modules/kaiman/style.cpp +++ b/noatun/modules/kaiman/style.cpp @@ -21,14 +21,14 @@ #include <kapplication.h> #include <kstandarddirs.h> #include <kmessagebox.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qpainter.h> -#include <qdropsite.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqpainter.h> +#include <tqdropsite.h> #include <kdebug.h> #include <klocale.h> #include <kurldrag.h> -#include <qtimer.h> +#include <tqtimer.h> #include <stdlib.h> #include <unistd.h> @@ -42,8 +42,8 @@ const bool KaimanStyleSlider::optionVertical = 1; const bool KaimanStyleSlider::optionReversed = 2; const bool KaimanStyleText::optionExtended = 1; -KaimanStyleElement::KaimanStyleElement(QWidget *parent, const char *name) - : QWidget(parent, name) +KaimanStyleElement::KaimanStyleElement(TQWidget *parent, const char *name) + : TQWidget(parent, name) { // Initialize everything to default values filename = ""; @@ -71,9 +71,9 @@ KaimanStyleElement::~KaimanStyleElement() } -void KaimanStyleElement::loadPixmaps(QString &val_s_filename) +void KaimanStyleElement::loadPixmaps(TQString &val_s_filename) { - QPixmap pixmap; + TQPixmap pixmap; bool i_b_ret = pixmap.load(val_s_filename); pixmapNum = pixmapLines*pixmapColumns; @@ -117,14 +117,14 @@ void KaimanStyleElement::loadPixmaps(QString &val_s_filename) { int w = (x==0) ? firstWidth : width; - QPixmap *part = new QPixmap(w,h,pixmap.depth()); + TQPixmap *part = new TQPixmap(w,h,pixmap.depth()); part->fill(Qt::black); bitBlt(part,0,0,&pixmap,sourcex,sourcey,w,h); pixmaps.insert(i,part); if(pixmap.mask()) { - QBitmap maskpart(w,h); + TQBitmap maskpart(w,h); bitBlt(&maskpart,0,0,pixmap.mask(),sourcex,sourcey,w,h); part->setMask(maskpart); } @@ -141,7 +141,7 @@ void KaimanStyleElement::loadPixmaps(QString &val_s_filename) for ( int i=0; i<pixmapNum; i++ ) { - QPixmap *pm = new QPixmap(10, 10); + TQPixmap *pm = new TQPixmap(10, 10); pm->fill(Qt::black); pixmaps.insert( i, pm ); } @@ -149,7 +149,7 @@ void KaimanStyleElement::loadPixmaps(QString &val_s_filename) if ( dimension.width()==0 ) dimension.setWidth( pixmaps[0]->width() ); if ( dimension.height()==0 ) dimension.setHeight( pixmaps[0]->height() ); - setGeometry( QRect(upperLeft, dimension) ); + setGeometry( TQRect(upperLeft, dimension) ); } void KaimanStyleElement::setPixmap( int num ) @@ -164,27 +164,27 @@ void KaimanStyleElement::setPixmap( int num ) } } -void KaimanStyleElement::paintEvent ( QPaintEvent */*qpe*/ ) +void KaimanStyleElement::paintEvent ( TQPaintEvent */*qpe*/ ) { - QPixmap *pm = pixmaps[_currentPixmap]; + TQPixmap *pm = pixmaps[_currentPixmap]; if ( pm ) bitBlt(this, 0, 0, pm ); else kdDebug() << "Invalid pixmap" << endl; -/* QPainter p( this ); +/* TQPainter p( this ); p.setBrush( NoBrush ); - p.setPen( QColor(255,255,255) ); + p.setPen( TQColor(255,255,255) ); p.drawRect( 0, 0, width(), height() ); p.drawText( 2, 16, name() ); */ } -void KaimanStyleElement::dragEnterEvent( QDragEnterEvent *event ) +void KaimanStyleElement::dragEnterEvent( TQDragEnterEvent *event ) { event->accept( KURLDrag::canDecode(event) ); } -void KaimanStyleElement::dropEvent( QDropEvent *event ) +void KaimanStyleElement::dropEvent( TQDropEvent *event ) { ((Kaiman*)(parentWidget()->parentWidget()))->doDropEvent(event); } @@ -192,7 +192,7 @@ void KaimanStyleElement::dropEvent( QDropEvent *event ) /***************************************************************************/ -KaimanStyleButton::KaimanStyleButton(QWidget *parent, const char *name) +KaimanStyleButton::KaimanStyleButton(TQWidget *parent, const char *name) : KaimanStyleMasked(parent, name) { i_b_lit = i_b_prelit = i_b_down = false; @@ -210,7 +210,7 @@ KaimanStyleButton::~KaimanStyleButton() { } -void KaimanStyleButton::mousePressEvent(QMouseEvent *qme) +void KaimanStyleButton::mousePressEvent(TQMouseEvent *qme) { // We deactivate prelight, because the user presses the button. // So it is now down, but there is no PrelitDown icon (BTW: would @@ -222,7 +222,7 @@ void KaimanStyleButton::mousePressEvent(QMouseEvent *qme) KaimanStyleMasked::mousePressEvent( qme ); } -void KaimanStyleButton::mouseReleaseEvent(QMouseEvent *qme) +void KaimanStyleButton::mouseReleaseEvent(TQMouseEvent *qme) { releaseMouse (); @@ -237,7 +237,7 @@ void KaimanStyleButton::mouseReleaseEvent(QMouseEvent *qme) /* paint prelight */ -void KaimanStyleButton::enterEvent ( QEvent * e ) +void KaimanStyleButton::enterEvent ( TQEvent * e ) { if ( !down() ) setPrelight(true); @@ -246,7 +246,7 @@ void KaimanStyleButton::enterEvent ( QEvent * e ) } /* unpaint prelight */ -void KaimanStyleButton::leaveEvent ( QEvent * e ) +void KaimanStyleButton::leaveEvent ( TQEvent * e ) { if (!down()) setPrelight(false); @@ -327,7 +327,7 @@ void KaimanStyleButton::updateButtonState() { /***********************************************************************/ -KaimanStyleSlider::KaimanStyleSlider(int min, int max, QWidget *parent, const char *name) +KaimanStyleSlider::KaimanStyleSlider(int min, int max, TQWidget *parent, const char *name) : KaimanStyleMasked( parent, name ) { _min = min; @@ -380,7 +380,7 @@ int KaimanStyleSlider::pos2value( int x, int y ) } -void KaimanStyleSlider::mouseMoveEvent(QMouseEvent *qme) +void KaimanStyleSlider::mouseMoveEvent(TQMouseEvent *qme) { KaimanStyleMasked::mouseMoveEvent( qme ); @@ -391,7 +391,7 @@ void KaimanStyleSlider::mouseMoveEvent(QMouseEvent *qme) } } -void KaimanStyleSlider::mousePressEvent(QMouseEvent *qme) +void KaimanStyleSlider::mousePressEvent(TQMouseEvent *qme) { if ( !_down ) { @@ -407,7 +407,7 @@ void KaimanStyleSlider::mousePressEvent(QMouseEvent *qme) } -void KaimanStyleSlider::mouseReleaseEvent(QMouseEvent *qme) +void KaimanStyleSlider::mouseReleaseEvent(TQMouseEvent *qme) { if ( _down ) { @@ -424,13 +424,13 @@ void KaimanStyleSlider::mouseReleaseEvent(QMouseEvent *qme) } -void KaimanStyleSlider::paintEvent(QPaintEvent */*qpe*/) +void KaimanStyleSlider::paintEvent(TQPaintEvent */*qpe*/) { // draw background bitBlt( this, 0, 0, pixmaps[0] ); // draw optional handle - QPixmap *handle; + TQPixmap *handle; if ( _down ) handle = pixmaps[2]; else @@ -460,7 +460,7 @@ void KaimanStyleSlider::paintEvent(QPaintEvent */*qpe*/) } } -void KaimanStyleSlider::enterEvent ( QEvent * e ) +void KaimanStyleSlider::enterEvent ( TQEvent * e ) { if ( !_lit && optionPrelight ) { @@ -471,7 +471,7 @@ void KaimanStyleSlider::enterEvent ( QEvent * e ) KaimanStyleMasked::enterEvent( e ); } -void KaimanStyleSlider::leaveEvent ( QEvent * e ) +void KaimanStyleSlider::leaveEvent ( TQEvent * e ) { if ( _lit ) { @@ -486,7 +486,7 @@ void KaimanStyleSlider::leaveEvent ( QEvent * e ) /***********************************************************************/ -KaimanStyleBackground::KaimanStyleBackground(QWidget *parent, const char *name) +KaimanStyleBackground::KaimanStyleBackground(TQWidget *parent, const char *name) : KaimanStyleMasked( parent, name ) { i_b_move = false; @@ -496,22 +496,22 @@ KaimanStyleBackground::~KaimanStyleBackground() { } -void KaimanStyleBackground::mouseReleaseEvent(QMouseEvent *qme) +void KaimanStyleBackground::mouseReleaseEvent(TQMouseEvent *qme) { i_b_move = false; KaimanStyleMasked::mouseReleaseEvent( qme ); } -void KaimanStyleBackground::mouseMoveEvent(QMouseEvent *qme) +void KaimanStyleBackground::mouseMoveEvent(TQMouseEvent *qme) { - QPoint diff = qme->globalPos() - i_point_lastPos; + TQPoint diff = qme->globalPos() - i_point_lastPos; if ( abs(diff.x()) > 10 || abs(diff.y()) > 10) { // Moving starts only, when passing a drag border i_b_move = true; } if ( i_b_move ) { - QWidget *p = parentWidget()->parentWidget(); + TQWidget *p = parentWidget()->parentWidget(); if ( !p ) p = parentWidget(); p->move( qme->globalPos() - i_point_dragStart ); @@ -520,7 +520,7 @@ void KaimanStyleBackground::mouseMoveEvent(QMouseEvent *qme) KaimanStyleMasked::mouseMoveEvent( qme ); } -void KaimanStyleBackground::mousePressEvent(QMouseEvent *qme) +void KaimanStyleBackground::mousePressEvent(TQMouseEvent *qme) { // On the background we move the shaped toplevel around if (!i_b_move) { @@ -533,7 +533,7 @@ void KaimanStyleBackground::mousePressEvent(QMouseEvent *qme) /***********************************************************************/ -KaimanStyleValue::KaimanStyleValue(int min, int max, QWidget *parent, const char *name) +KaimanStyleValue::KaimanStyleValue(int min, int max, TQWidget *parent, const char *name) : KaimanStyleMasked( parent, name ) { _min = min; @@ -571,12 +571,12 @@ void KaimanStyleValue::setValue( int value, int min, int max ) /***********************************************************************/ -KaimanStyleNumber::KaimanStyleNumber(QWidget *parent, const char *name) +KaimanStyleNumber::KaimanStyleNumber(TQWidget *parent, const char *name) : KaimanStyleElement( parent, name ) { //kdDebug(66666) << k_funcinfo << "name = '" << name << "'" << endl; _value = 0; - if (QCString(name) == "In_Rate_Number") + if (TQCString(name) == "In_Rate_Number") digits = 3; else digits = 2; @@ -587,7 +587,7 @@ KaimanStyleNumber::~KaimanStyleNumber() } -void KaimanStyleNumber::loadPixmaps(QString &val_s_filename) +void KaimanStyleNumber::loadPixmaps(TQString &val_s_filename) { KaimanStyleElement::loadPixmaps( val_s_filename ); resize( digits*pixmaps[0]->width(),pixmaps[0]->height() ); @@ -603,7 +603,7 @@ void KaimanStyleNumber::setValue( int value ) } } -void KaimanStyleNumber::paintEvent(QPaintEvent */*qpe*/) +void KaimanStyleNumber::paintEvent(TQPaintEvent */*qpe*/) { // check for overflow int v = _value; @@ -631,22 +631,22 @@ void KaimanStyleNumber::paintEvent(QPaintEvent */*qpe*/) bitBlt(this, x, 0, pixmaps[0] ); } /* - QPainter p( this ); + TQPainter p( this ); p.setBrush( NoBrush ); - p.setPen( QColor(255,255,255) ); + p.setPen( TQColor(255,255,255) ); p.drawRect( 0, 0, width(), height() ); p.drawText( 2, 16, name() );*/ } /***********************************************************************/ -KaimanStyleText::KaimanStyleText(QWidget *parent, const char *name) +KaimanStyleText::KaimanStyleText(TQWidget *parent, const char *name) : KaimanStyleElement( parent, name ) { _pos = 0; - _timer = new QTimer( this ); + _timer = new TQTimer( this ); _delay = 500; - connect( _timer, SIGNAL(timeout()), this, SLOT(timeout()) ); + connect( _timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timeout()) ); } KaimanStyleText::~KaimanStyleText() @@ -654,14 +654,14 @@ KaimanStyleText::~KaimanStyleText() } -void KaimanStyleText::loadPixmaps(QString &val_s_filename) +void KaimanStyleText::loadPixmaps(TQString &val_s_filename) { KaimanStyleElement::loadPixmaps( val_s_filename ); resize( digits*pixmaps[0]->width(), pixmaps[0]->height() ); } -void KaimanStyleText::setValue( QString value ) +void KaimanStyleText::setValue( TQString value ) { if ( value!=_value ) { _pos = 0; @@ -708,7 +708,7 @@ void KaimanStyleText::timeout() } -void KaimanStyleText::paintEvent(QPaintEvent */*qpe*/) +void KaimanStyleText::paintEvent(TQPaintEvent */*qpe*/) { // draw number int p; @@ -718,30 +718,30 @@ void KaimanStyleText::paintEvent(QPaintEvent */*qpe*/) if ( pmNum>=96 ) pmNum = '?' - ' '; if ( pmNum<0 ) pmNum = '?' - ' '; - QPixmap *pm = pixmaps[pmNum]; + TQPixmap *pm = pixmaps[pmNum]; if ( pm ) bitBlt(this, p*pixmaps[0]->width(), 0, pm ); } - QPixmap *pm = pixmaps[0]; + TQPixmap *pm = pixmaps[0]; for ( ; p<digits; p++ ) bitBlt(this, p*pixmaps[0]->width(), 0, pm ); -/* QPainter pnt( this ); +/* TQPainter pnt( this ); pnt.setBrush( NoBrush ); - pnt.setPen( QColor(255,255,255) ); + pnt.setPen( TQColor(255,255,255) ); pnt.drawRect( 0, 0, width(), height() ); pnt.drawText( 2, 16, name() );*/ } /***********************************************************************/ -KaimanStyleAnimation::KaimanStyleAnimation(int delay, QWidget *parent, const char *name) +KaimanStyleAnimation::KaimanStyleAnimation(int delay, TQWidget *parent, const char *name) : KaimanStyleMasked( parent, name ) { _delay = delay; _frame = 0; - _timer = new QTimer( this ); - connect( _timer, SIGNAL(timeout()), this, SLOT(timeout()) ); + _timer = new TQTimer( this ); + connect( _timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(timeout()) ); } KaimanStyleAnimation::~KaimanStyleAnimation() @@ -774,7 +774,7 @@ void KaimanStyleAnimation::timeout() /***********************************************************************/ -KaimanStyleState::KaimanStyleState(QWidget *parent, const char *name) +KaimanStyleState::KaimanStyleState(TQWidget *parent, const char *name) : KaimanStyleMasked( parent, name ) { _value = 0; @@ -790,7 +790,7 @@ void KaimanStyleState::setValue( int value ) setPixmap( _value ); } -void KaimanStyleState::mousePressEvent(QMouseEvent *qme) +void KaimanStyleState::mousePressEvent(TQMouseEvent *qme) { emit clicked(); KaimanStyleMasked::mouseReleaseEvent( qme ); @@ -799,8 +799,8 @@ void KaimanStyleState::mousePressEvent(QMouseEvent *qme) /***********************************************************************/ -KaimanStyle::KaimanStyle( QWidget *parent, const char *name ) - : QWidget( parent, name ) +KaimanStyle::KaimanStyle( TQWidget *parent, const char *name ) + : TQWidget( parent, name ) { i_qw_parent = parent; i_eventSemaphore = false; @@ -812,17 +812,17 @@ KaimanStyle::~KaimanStyle() } -int KaimanStyle::parseStyleFile(QString &l_s_tmpName) +int KaimanStyle::parseStyleFile(TQString &l_s_tmpName) { int l_i_ret = false; - QStringList l_s_tokens; + TQStringList l_s_tokens; - QFile l_fd(l_s_tmpName); + TQFile l_fd(l_s_tmpName); if ( l_fd.open(IO_ReadOnly) ) { // file opened successfully - QTextStream l_ts_line( &l_fd ); - QString l_s_textLine, l_s_token; + TQTextStream l_ts_line( &l_fd ); + TQString l_s_textLine, l_s_token; while ( !l_ts_line.eof() ) { // Clear list of tokens (we are going to fill them now) l_s_tokens.clear(); @@ -865,15 +865,15 @@ int KaimanStyle::parseStyleFile(QString &l_s_tmpName) /* This function gets a list of tokens and inserts a new KaimanStyleElement in I_styleElem. */ -void KaimanStyle::interpretTokens(QStringList& ref_s_tokens) +void KaimanStyle::interpretTokens(TQStringList& ref_s_tokens) { if ( ref_s_tokens.count() < 1 ) { // A list with less than 1 item is useless to us return; } - QString l_s_tokenTypes; - const QString &l_s_elem = ref_s_tokens.first(); + TQString l_s_tokenTypes; + const TQString &l_s_elem = ref_s_tokens.first(); bool l_vertPixmaps = false; int l_i_pmIndex[KaimanStyleButton::StateListEND]; for (int i=0; i<KaimanStyleButton::StateListEND; i++) l_i_pmIndex[i]=0; @@ -1027,7 +1027,7 @@ void KaimanStyle::interpretTokens(QStringList& ref_s_tokens) 1) Create a new KaimanStyle*, that is inserted into I_styleElem. 2) Fill the KaimanStyleElement structure, by interpreting the tokens. */ - QStringList::Iterator li_s_tokens = ref_s_tokens.begin(); + TQStringList::Iterator li_s_tokens = ref_s_tokens.begin(); ++ li_s_tokens; // Skip the name of the element // 1) Create a new KaimanStyleElement, that is inserted into I_styleElem. @@ -1140,7 +1140,7 @@ void KaimanStyle::interpretTokens(QStringList& ref_s_tokens) // Take the first item from the l_s_tokenTypes; char l_c_type = (l_s_tokenTypes[0]).latin1(); l_s_tokenTypes = l_s_tokenTypes.mid(1); - QString l_s_token = *li_s_tokens; + TQString l_s_token = *li_s_tokens; switch(l_c_type) { case 'f': // filename @@ -1326,10 +1326,10 @@ void KaimanStyle::interpretTokens(QStringList& ref_s_tokens) } -QString KaimanStyle::getToken(QString &val_s_string, char val_c_separator) +TQString KaimanStyle::getToken(TQString &val_s_string, char val_c_separator) { int l_i_pos; - QString l_s_token; + TQString l_s_token; // Find the first occurrence of the separator l_i_pos = val_s_string.find(val_c_separator, 0, false); @@ -1351,15 +1351,15 @@ QString KaimanStyle::getToken(QString &val_s_string, char val_c_separator) -bool KaimanStyle::loadStyle(const QString &styleName, const QString &descFile) +bool KaimanStyle::loadStyle(const TQString &styleName, const TQString &descFile) { bool l_b_ret = true; int l_i_ret = 0; - QString l_s_tmpName; + TQString l_s_tmpName; i_skinName = styleName; this->i_s_styleName = styleName; - i_s_styleBase = QString("skins/kaiman/") + i_s_styleName + QString("/"); + i_s_styleBase = TQString("skins/kaiman/") + i_s_styleName + TQString("/"); l_s_tmpName = locate("appdata", i_s_styleBase + descFile ); if ( l_s_tmpName.isNull() ) { @@ -1390,14 +1390,14 @@ bool KaimanStyle::loadStyle(const QString &styleName, const QString &descFile) return l_b_ret; } -bool KaimanStyle::eventFilter( QObject *o, QEvent *e ) +bool KaimanStyle::eventFilter( TQObject *o, TQEvent *e ) { /* HACK! HACK! HACK! */ if ( !i_eventSemaphore ) - if ( e->type()==QEvent::MouseMove || e->type()==QEvent::MouseButtonPress || - e->type()==QEvent::MouseButtonRelease ) + if ( e->type()==TQEvent::MouseMove || e->type()==TQEvent::MouseButtonPress || + e->type()==TQEvent::MouseButtonRelease ) { - QMouseEvent *m = (QMouseEvent*)e; + TQMouseEvent *m = (TQMouseEvent*)e; // handle noatun context menu if (m->button()==RightButton) { @@ -1405,37 +1405,37 @@ bool KaimanStyle::eventFilter( QObject *o, QEvent *e ) return true; } - QPoint mousePos( m->x()+static_cast<QWidget *>(o)->x(), - m->y()+static_cast<QWidget *>(o)->y() ); - QWidget *slider = 0; + TQPoint mousePos( m->x()+static_cast<TQWidget *>(o)->x(), + m->y()+static_cast<TQWidget *>(o)->y() ); + TQWidget *slider = 0; /* find slider that is under the mouse position */ - for ( QWidget *s = i_sliders.first(); s!=0; s=i_sliders.next() ) + for ( TQWidget *s = i_sliders.first(); s!=0; s=i_sliders.next() ) { - QRect sliderRect( s->pos(), s->size() ); + TQRect sliderRect( s->pos(), s->size() ); if ( sliderRect.contains(mousePos) ) slider = s; } /* the slider the mouse events instead of the visible widget */ if ( slider ) { - QMouseEvent newMouseEvent( m->type(), mousePos-slider->pos(), + TQMouseEvent newMouseEvent( m->type(), mousePos-slider->pos(), m->globalPos(), m->button(), m->state() ); i_eventSemaphore = true; - bool ret = QApplication::sendEvent( slider, &newMouseEvent ); + bool ret = TQApplication::sendEvent( slider, &newMouseEvent ); i_eventSemaphore = false; return ret; } } - return QWidget::eventFilter( o, e ); // standard event processing + return TQWidget::eventFilter( o, e ); // standard event processing } bool KaimanStyle::loadPixmaps() { - QString l_s_tmpName; - QPixmap *l_pixmap_Background = 0, *l_pixmap_Mask = 0; + TQString l_s_tmpName; + TQPixmap *l_pixmap_Background = 0, *l_pixmap_Mask = 0; KaimanStyleElement *l_kse_elem; for ( uint l_i_elem = 0; l_i_elem<I_styleElem.count(); l_i_elem++) { @@ -1460,9 +1460,9 @@ bool KaimanStyle::loadPixmaps() int l_i_width_Mask = l_pixmap_Mask->width(); int l_i_height_Mask = l_pixmap_Mask->height(); - QImage l_image_MaskOrig = l_pixmap_Mask->convertToImage(); + TQImage l_image_MaskOrig = l_pixmap_Mask->convertToImage(); - QImage l_image_Mask(l_i_width_Mask,l_i_height_Mask, 1, 2, QImage::LittleEndian); + TQImage l_image_Mask(l_i_width_Mask,l_i_height_Mask, 1, 2, TQImage::LittleEndian); l_image_Mask.setColor( 0, 0x00ffffff ); l_image_Mask.setColor( 1, 0 ); l_image_Mask.fill( 0xff ); @@ -1487,7 +1487,7 @@ bool KaimanStyle::loadPixmaps() } -QBitmap* KaimanStyle::Mask() +TQBitmap* KaimanStyle::Mask() { return &i_bitmap_Mask; } @@ -1495,7 +1495,7 @@ QBitmap* KaimanStyle::Mask() KaimanStyleElement* KaimanStyle::find(const char *val_s_elemName) { for (uint i=0; i< I_styleElem.count(); i++) { - if ( I_styleElem[i]->element == QString(val_s_elemName)) { + if ( I_styleElem[i]->element == TQString(val_s_elemName)) { return I_styleElem[i]; } } |