summaryrefslogtreecommitdiffstats
path: root/ksirc/colorpicker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ksirc/colorpicker.cpp')
-rw-r--r--ksirc/colorpicker.cpp140
1 files changed, 70 insertions, 70 deletions
diff --git a/ksirc/colorpicker.cpp b/ksirc/colorpicker.cpp
index 13b2805c..9bb5f03f 100644
--- a/ksirc/colorpicker.cpp
+++ b/ksirc/colorpicker.cpp
@@ -20,49 +20,49 @@
#include "colorpicker.h"
#include "ksopts.h"
-#include <qlayout.h>
-#include <qpainter.h>
-#include <qvbox.h>
-#include <qstyle.h>
-#include <qlineedit.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
+#include <tqlayout.h>
+#include <tqpainter.h>
+#include <tqvbox.h>
+#include <tqstyle.h>
+#include <tqlineedit.h>
+#include <tqlabel.h>
+#include <tqpushbutton.h>
#include <klocale.h>
-ColorPicker::ColorPicker( QWidget *parent, const char *name )
+ColorPicker::ColorPicker( TQWidget *parent, const char *name )
: KDialogBase( parent, name, true /*modal*/, i18n( "Pick Color" ),
KDialogBase::Ok | KDialogBase::Cancel,
KDialogBase::Cancel ),
m_foregroundColor( -1 ), m_backgroundColor( -1 )
{
- QVBox *mainWidget = makeVBoxMainWidget();
+ TQVBox *mainWidget = makeVBoxMainWidget();
- QWidget *sampleBox = new QWidget( mainWidget );
- QHBoxLayout *sampleLayout = new QHBoxLayout( sampleBox );
+ TQWidget *sampleBox = new TQWidget( mainWidget );
+ TQHBoxLayout *sampleLayout = new TQHBoxLayout( sampleBox );
- QLabel *preview = new QLabel( i18n( "Preview:" ), sampleBox );
+ TQLabel *preview = new TQLabel( i18n( "Preview:" ), sampleBox );
sampleLayout->addWidget( preview );
- m_sample = new QLineEdit( i18n( "Sample Text" ), sampleBox );
+ m_sample = new TQLineEdit( i18n( "Sample Text" ), sampleBox );
m_sample->setFocusPolicy( NoFocus );
- m_sample->setSizePolicy( QSizePolicy( QSizePolicy::Minimum,
+ m_sample->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum,
m_sample->sizePolicy().verData() ) );
sampleLayout->addWidget( m_sample );
sampleLayout->addStretch();
- QHBox *box = new QHBox( mainWidget );
- QLabel *description = new QLabel( i18n( "&Foreground:" ), box );
+ TQHBox *box = new TQHBox( mainWidget );
+ TQLabel *description = new TQLabel( i18n( "&Foreground:" ), box );
ColorBar *foregroundColor = new ColorBar( ksopts->ircColors.toValueVector(), box );
description->setBuddy( foregroundColor );
- box = new QHBox( mainWidget );
- description = new QLabel( i18n( "&Background:" ), box );
+ box = new TQHBox( mainWidget );
+ description = new TQLabel( i18n( "&Background:" ), box );
ColorBar *backgroundColor = new ColorBar( ksopts->ircColors.toValueVector(), box );
description->setBuddy( backgroundColor );
- QPushButton *ok = actionButton( KDialogBase::Ok );
- QPushButton *cancel = actionButton( KDialogBase::Cancel );
+ TQPushButton *ok = actionButton( KDialogBase::Ok );
+ TQPushButton *cancel = actionButton( KDialogBase::Cancel );
setTabOrder( foregroundColor, backgroundColor );
setTabOrder( backgroundColor, ok );
@@ -71,31 +71,31 @@ ColorPicker::ColorPicker( QWidget *parent, const char *name )
ok->setAutoDefault( false );
cancel->setAutoDefault( false );
- connect( foregroundColor, SIGNAL( colorPicked( int ) ),
- this, SLOT( setForegroundColor( int ) ) );
- connect( backgroundColor, SIGNAL( colorPicked( int ) ),
- this, SLOT( setBackgroundColor( int ) ) );
+ connect( foregroundColor, TQT_SIGNAL( colorPicked( int ) ),
+ this, TQT_SLOT( setForegroundColor( int ) ) );
+ connect( backgroundColor, TQT_SIGNAL( colorPicked( int ) ),
+ this, TQT_SLOT( setBackgroundColor( int ) ) );
ok->setEnabled( false );
updateSample();
}
-QString ColorPicker::colorString() const
+TQString ColorPicker::colorString() const
{
assert( m_foregroundColor != -1 );
- QString res( QString::number( m_foregroundColor ) );
+ TQString res( TQString::number( m_foregroundColor ) );
if ( m_backgroundColor != -1 )
{
res += ',';
- res += QString::number( m_backgroundColor );
+ res += TQString::number( m_backgroundColor );
}
return res;
}
void ColorPicker::setForegroundColor( int col )
{
- QPushButton * ok =actionButton( KDialogBase::Ok );
+ TQPushButton * ok =actionButton( KDialogBase::Ok );
assert( ok );
ok->setEnabled( true );
@@ -111,28 +111,28 @@ void ColorPicker::setBackgroundColor( int col )
void ColorPicker::updateSample()
{
- QColorGroup cg( colorGroup() );
+ TQColorGroup cg( colorGroup() );
- QColor col = ksopts->textColor;
+ TQColor col = ksopts->textColor;
if ( m_foregroundColor != -1 )
col = ksopts->ircColors[ m_foregroundColor ];
- cg.setColor( QColorGroup::Foreground, col );
- cg.setColor( QColorGroup::Text, col );
+ cg.setColor( TQColorGroup::Foreground, col );
+ cg.setColor( TQColorGroup::Text, col );
if ( m_backgroundColor != -1 )
{
col = ksopts->ircColors[ m_backgroundColor ];
- cg.setColor( QColorGroup::Background, col );
- cg.setColor( QColorGroup::Base, col );
+ cg.setColor( TQColorGroup::Background, col );
+ cg.setColor( TQColorGroup::Base, col );
}
- m_sample->setPalette( QPalette( cg, cg, cg ) );
+ m_sample->setPalette( TQPalette( cg, cg, cg ) );
}
-ColorBar::ColorBar( const QValueVector<QColor> &colors, QWidget *parent,
+ColorBar::ColorBar( const TQValueVector<TQColor> &colors, TQWidget *parent,
const char *name )
- : QFrame( parent, name, WStaticContents | WRepaintNoErase ),
+ : TQFrame( parent, name, WStaticContents | WRepaintNoErase ),
m_currentCell( -1 ), m_focusedCell( - 1 ), m_colors( colors ),
m_cellSize( 0 )
{
@@ -143,7 +143,7 @@ ColorBar::ColorBar( const QValueVector<QColor> &colors, QWidget *parent,
setFocusPolicy( StrongFocus );
}
-void ColorBar::drawContents( QPainter *p )
+void ColorBar::drawContents( TQPainter *p )
{
int x = contentsRect().x();
int y = contentsRect().y();
@@ -153,15 +153,15 @@ void ColorBar::drawContents( QPainter *p )
i == static_cast<uint>( m_currentCell ) );
bool isFocusedCell = ( m_focusedCell != -1 &&
i == static_cast<uint>( m_focusedCell ) );
- drawCell( p, x, y, m_colors[ i ], QString::number( i ),
+ drawCell( p, x, y, m_colors[ i ], TQString::number( i ),
isFocusedCell, isCurrentCell );
}
}
-void ColorBar::keyPressEvent( QKeyEvent *ev )
+void ColorBar::keyPressEvent( TQKeyEvent *ev )
{
if ( m_focusedCell == -1 ) {
- QFrame::keyPressEvent( ev );
+ TQFrame::keyPressEvent( ev );
return;
}
@@ -189,36 +189,36 @@ void ColorBar::keyPressEvent( QKeyEvent *ev )
default: break;
}
- QFrame::keyPressEvent( ev );
+ TQFrame::keyPressEvent( ev );
}
-void ColorBar::focusInEvent( QFocusEvent *ev )
+void ColorBar::focusInEvent( TQFocusEvent *ev )
{
- if ( ev->reason() == QFocusEvent::Tab ||
- ev->reason() == QFocusEvent::Backtab )
+ if ( ev->reason() == TQFocusEvent::Tab ||
+ ev->reason() == TQFocusEvent::Backtab )
m_focusedCell = 0;
- QFrame::focusInEvent( ev );
+ TQFrame::focusInEvent( ev );
}
-void ColorBar::focusOutEvent( QFocusEvent *ev )
+void ColorBar::focusOutEvent( TQFocusEvent *ev )
{
- if ( ev->reason() == QFocusEvent::Tab ||
- ev->reason() == QFocusEvent::Backtab ||
- ev->reason() == QFocusEvent::Mouse )
+ if ( ev->reason() == TQFocusEvent::Tab ||
+ ev->reason() == TQFocusEvent::Backtab ||
+ ev->reason() == TQFocusEvent::Mouse )
m_focusedCell = -1;
- QFrame::focusOutEvent( ev );
+ TQFrame::focusOutEvent( ev );
}
-void ColorBar::fontChange( const QFont &oldFont )
+void ColorBar::fontChange( const TQFont &oldFont )
{
updateCellSize();
- QFrame::fontChange( oldFont );
+ TQFrame::fontChange( oldFont );
}
-void ColorBar::styleChange( QStyle &oldStyle )
+void ColorBar::styleChange( TQStyle &oldStyle )
{
updateCellSize();
- QFrame::styleChange( oldStyle );
+ TQFrame::styleChange( oldStyle );
}
bool ColorBar::focusNextPrevChild( bool next )
@@ -233,7 +233,7 @@ bool ColorBar::focusNextPrevChild( bool next )
update();
return true;
}
- return QFrame::focusNextPrevChild( next );
+ return TQFrame::focusNextPrevChild( next );
}
if ( m_focusedCell > 1 )
@@ -243,43 +243,43 @@ bool ColorBar::focusNextPrevChild( bool next )
return true;
}
- return QFrame::focusNextPrevChild( next );
+ return TQFrame::focusNextPrevChild( next );
}
-void ColorBar::mousePressEvent( QMouseEvent *ev )
+void ColorBar::mousePressEvent( TQMouseEvent *ev )
{
- const QPoint &p = ev->pos();
+ const TQPoint &p = ev->pos();
if ( contentsRect().contains( p ) )
{
m_focusedCell = p.x() / m_cellSize;
update();
}
- QFrame::mousePressEvent( ev );
+ TQFrame::mousePressEvent( ev );
}
-void ColorBar::mouseReleaseEvent( QMouseEvent *ev )
+void ColorBar::mouseReleaseEvent( TQMouseEvent *ev )
{
if ( m_focusedCell != -1 )
{
setCurrentCell( m_focusedCell );
update();
}
- QFrame::mouseReleaseEvent( ev );
+ TQFrame::mouseReleaseEvent( ev );
}
void ColorBar::updateCellSize()
{
- setLineWidth( style().pixelMetric( QStyle::PM_DefaultFrameWidth, this ) );
+ setLineWidth( style().pixelMetric( TQStyle::PM_DefaultFrameWidth, this ) );
- QFontMetrics metrics( font() );
+ TQFontMetrics metrics( font() );
- m_cellSize = metrics.width( QString::number( m_colors.size() ) ) +
+ m_cellSize = metrics.width( TQString::number( m_colors.size() ) ) +
( s_indicatorSize * 2 ) +
( s_focusSize * 2 ) +
( s_innerMargin * 2 );
- setFixedSize( QSize( ( m_colors.size() * m_cellSize ) + ( frameWidth() * 2 ),
+ setFixedSize( TQSize( ( m_colors.size() * m_cellSize ) + ( frameWidth() * 2 ),
m_cellSize + ( frameWidth() * 2 ) ) );
}
@@ -289,13 +289,13 @@ void ColorBar::setCurrentCell( int cell )
emit colorPicked( cell );
}
-void ColorBar::drawCell( QPainter *p, int x, int y, const QColor &color,
- const QString &text, bool isFocusedCell,
+void ColorBar::drawCell( TQPainter *p, int x, int y, const TQColor &color,
+ const TQString &text, bool isFocusedCell,
bool isCurrentCell )
{
p->fillRect( x, y, m_cellSize, m_cellSize, color );
- QColor penColor = black;
+ TQColor penColor = black;
// ### hack
if ( color.red() < 127 && color.green() < 127 && color.blue() < 127 )
penColor = white;
@@ -329,7 +329,7 @@ void ColorBar::drawCell( QPainter *p, int x, int y, const QColor &color,
s_focusSize, focusRectSize - ( 2 * s_focusSize ), penColor );
}
- QFontMetrics metrics( p->font() );
+ TQFontMetrics metrics( p->font() );
int offset = ( m_cellSize / 2 ) - ( metrics.width( text ) / 2 );
p->drawText( x + offset, y + s_focusSize + s_indicatorSize +