summaryrefslogtreecommitdiffstats
path: root/kscreensaver/kdesavers/banner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kscreensaver/kdesavers/banner.cpp')
-rw-r--r--kscreensaver/kdesavers/banner.cpp156
1 files changed, 78 insertions, 78 deletions
diff --git a/kscreensaver/kdesavers/banner.cpp b/kscreensaver/kdesavers/banner.cpp
index 5309c05a..e3322dc5 100644
--- a/kscreensaver/kdesavers/banner.cpp
+++ b/kscreensaver/kdesavers/banner.cpp
@@ -14,16 +14,16 @@
// 2003/09/06 Converted to use KDialogBase - Nadeem Hasan <nhasan@kde.org>
#include <stdlib.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qcombobox.h>
-#include <qcheckbox.h>
-#include <qgroupbox.h>
-#include <qslider.h>
-#include <qlayout.h>
-#include <qdatetime.h>
-#include <qfontdatabase.h>
-#include <qpainter.h>
+#include <tqlabel.h>
+#include <tqlineedit.h>
+#include <tqcombobox.h>
+#include <tqcheckbox.h>
+#include <tqgroupbox.h>
+#include <tqslider.h>
+#include <tqlayout.h>
+#include <tqdatetime.h>
+#include <tqfontdatabase.h>
+#include <tqpainter.h>
#include <kapplication.h>
#include <krandomsequence.h>
@@ -49,7 +49,7 @@ extern "C"
return new KBannerSaver( id );
}
- KDE_EXPORT QDialog *kss_setup()
+ KDE_EXPORT TQDialog *kss_setup()
{
return new KBannerSetup();
}
@@ -57,71 +57,71 @@ extern "C"
//-----------------------------------------------------------------------------
-KBannerSetup::KBannerSetup( QWidget *parent, const char *name )
+KBannerSetup::KBannerSetup( TQWidget *parent, const char *name )
: KDialogBase( parent, name, true, i18n( "Setup Banner Screen Saver" ),
Ok|Cancel|Help, Ok, true ), saver( 0 ), ed(0), speed( 50 )
{
setButtonText( Help, i18n( "A&bout" ) );
readSettings();
- QWidget *main = makeMainWidget();
+ TQWidget *main = makeMainWidget();
- QLabel *label;
+ TQLabel *label;
- QVBoxLayout *tl = new QVBoxLayout(main, 0, spacingHint());
- QHBoxLayout *tl1 = new QHBoxLayout( 0, 0, spacingHint() );
+ TQVBoxLayout *tl = new TQVBoxLayout(main, 0, spacingHint());
+ TQHBoxLayout *tl1 = new TQHBoxLayout( 0, 0, spacingHint() );
tl->addLayout(tl1);
- QVBoxLayout *tl11 = new QVBoxLayout( 0, 0, spacingHint() );
+ TQVBoxLayout *tl11 = new TQVBoxLayout( 0, 0, spacingHint() );
tl1->addLayout(tl11);
- QGroupBox *group = new QGroupBox( 0, Vertical, i18n("Font"), main );
- QGridLayout *gl = new QGridLayout(group->layout(), 6, 2, spacingHint() );
+ TQGroupBox *group = new TQGroupBox( 0, Vertical, i18n("Font"), main );
+ TQGridLayout *gl = new TQGridLayout(group->layout(), 6, 2, spacingHint() );
- label = new QLabel( i18n("Family:"), group );
+ label = new TQLabel( i18n("Family:"), group );
gl->addWidget(label, 1, 0);
- KFontCombo* comboFonts = new KFontCombo( QFontDatabase().families(), group );
+ KFontCombo* comboFonts = new KFontCombo( TQFontDatabase().families(), group );
comboFonts->setCurrentFont( fontFamily );
gl->addWidget(comboFonts, 1, 1);
- connect( comboFonts, SIGNAL( activated( const QString& ) ),
- SLOT( slotFamily( const QString& ) ) );
+ connect( comboFonts, TQT_SIGNAL( activated( const TQString& ) ),
+ TQT_SLOT( slotFamily( const TQString& ) ) );
- label = new QLabel( i18n("Size:"), group );
+ label = new TQLabel( i18n("Size:"), group );
gl->addWidget(label, 2, 0);
- comboSizes = new QComboBox( TRUE, group );
+ comboSizes = new TQComboBox( TRUE, group );
fillFontSizes();
gl->addWidget(comboSizes, 2, 1);
- connect( comboSizes, SIGNAL( activated( int ) ), SLOT( slotSize( int ) ) );
- connect( comboSizes, SIGNAL( textChanged( const QString & ) ),
- SLOT( slotSizeEdit( const QString & ) ) );
+ connect( comboSizes, TQT_SIGNAL( activated( int ) ), TQT_SLOT( slotSize( int ) ) );
+ connect( comboSizes, TQT_SIGNAL( textChanged( const TQString & ) ),
+ TQT_SLOT( slotSizeEdit( const TQString & ) ) );
- QCheckBox *cb = new QCheckBox( i18n("Bold"),
+ TQCheckBox *cb = new TQCheckBox( i18n("Bold"),
group );
cb->setChecked( bold );
- connect( cb, SIGNAL( toggled( bool ) ), SLOT( slotBold( bool ) ) );
+ connect( cb, TQT_SIGNAL( toggled( bool ) ), TQT_SLOT( slotBold( bool ) ) );
gl->addWidget(cb, 3, 0);
- cb = new QCheckBox( i18n("Italic"), group );
+ cb = new TQCheckBox( i18n("Italic"), group );
cb->setChecked( italic );
gl->addWidget(cb, 3, 1);
- connect( cb, SIGNAL( toggled( bool ) ), SLOT( slotItalic( bool ) ) );
+ connect( cb, TQT_SIGNAL( toggled( bool ) ), TQT_SLOT( slotItalic( bool ) ) );
- label = new QLabel( i18n("Color:"), group );
+ label = new TQLabel( i18n("Color:"), group );
gl->addWidget(label, 4, 0);
colorPush = new KColorButton( fontColor, group );
gl->addWidget(colorPush, 4, 1);
- connect( colorPush, SIGNAL( changed(const QColor &) ),
- SLOT( slotColor(const QColor &) ) );
+ connect( colorPush, TQT_SIGNAL( changed(const TQColor &) ),
+ TQT_SLOT( slotColor(const TQColor &) ) );
- QCheckBox *cyclingColorCb=new QCheckBox(i18n("Cycling color"),group);
+ TQCheckBox *cyclingColorCb=new TQCheckBox(i18n("Cycling color"),group);
cyclingColorCb->setMinimumSize(cyclingColorCb->sizeHint());
gl->addMultiCellWidget(cyclingColorCb,5,5,0,1);
- connect(cyclingColorCb,SIGNAL(toggled(bool)),this,SLOT(slotCyclingColor(bool)));
+ connect(cyclingColorCb,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotCyclingColor(bool)));
cyclingColorCb->setChecked(cyclingColor);
- preview = new QWidget( main );
+ preview = new TQWidget( main );
preview->setFixedSize( 220, 170 );
preview->setBackgroundColor( black );
preview->show(); // otherwise saver does not get correct size
@@ -130,34 +130,34 @@ KBannerSetup::KBannerSetup( QWidget *parent, const char *name )
tl11->addWidget(group);
- label = new QLabel( i18n("Speed:"), main );
+ label = new TQLabel( i18n("Speed:"), main );
tl11->addStretch(1);
tl11->addWidget(label);
- QSlider *sb = new QSlider(0, 100, 10, speed, QSlider::Horizontal, main );
+ TQSlider *sb = new TQSlider(0, 100, 10, speed, TQSlider::Horizontal, main );
sb->setMinimumWidth( 180);
sb->setFixedHeight(20);
- sb->setTickmarks(QSlider::Below);
+ sb->setTickmarks(TQSlider::Below);
sb->setTickInterval(10);
tl11->addWidget(sb);
- connect( sb, SIGNAL( valueChanged( int ) ), SLOT( slotSpeed( int ) ) );
+ connect( sb, TQT_SIGNAL( valueChanged( int ) ), TQT_SLOT( slotSpeed( int ) ) );
- QHBoxLayout *tl2 = new QHBoxLayout;
+ TQHBoxLayout *tl2 = new QHBoxLayout;
tl->addLayout(tl2);
- label = new QLabel( i18n("Message:"), main );
+ label = new TQLabel( i18n("Message:"), main );
tl2->addWidget(label);
- ed = new QLineEdit( main );
+ ed = new TQLineEdit( main );
tl2->addWidget(ed);
ed->setText( message );
- connect( ed, SIGNAL( textChanged( const QString & ) ),
- SLOT( slotMessage( const QString & ) ) );
+ connect( ed, TQT_SIGNAL( textChanged( const TQString & ) ),
+ TQT_SLOT( slotMessage( const TQString & ) ) );
- QCheckBox *timeCb=new QCheckBox( i18n("Show current time"), main);
+ TQCheckBox *timeCb=new TQCheckBox( i18n("Show current time"), main);
timeCb->setFixedSize(timeCb->sizeHint());
tl->addWidget(timeCb,0,Qt::AlignLeft);
- connect(timeCb,SIGNAL(toggled(bool)),this,SLOT(slotTimeToggled(bool)));
+ connect(timeCb,TQT_SIGNAL(toggled(bool)),this,TQT_SLOT(slotTimeToggled(bool)));
timeCb->setChecked(showTime);
tl->addStretch();
@@ -177,7 +177,7 @@ void KBannerSetup::readSettings()
message=config->readEntry("Message","KDE");
showTime=config->readBoolEntry("ShowTime",FALSE);
- fontFamily=config->readEntry("FontFamily",(QApplication::font()).family());
+ fontFamily=config->readEntry("FontFamily",(TQApplication::font()).family());
fontSize=config->readNumEntry("FontSize",48);
fontColor.setNamedColor(config->readEntry("FontColor","red"));
cyclingColor=config->readBoolEntry("CyclingColor",FALSE);
@@ -191,12 +191,12 @@ void KBannerSetup::fillFontSizes()
comboSizes->blockSignals( true );
comboSizes->clear();
int i = 0;
- sizes = QFontDatabase().pointSizes( fontFamily );
+ sizes = TQFontDatabase().pointSizes( fontFamily );
sizes << 96 << 128 << 156 << 0;
int current = 0;
while ( sizes[i] )
{
- QString num;
+ TQString num;
num.setNum( sizes[i] );
comboSizes->insertItem( num, i );
if ( fontSize == sizes[i] ) // fontsize equals one of the defined ones
@@ -209,7 +209,7 @@ void KBannerSetup::fillFontSizes()
}
if ( current == 0 ) // fontsize seems to be entered by hand
{
- QString fsize;
+ TQString fsize;
fsize.setNum( fontSize );
comboSizes->setEditText(fsize);
slotSizeEdit( fsize );
@@ -217,7 +217,7 @@ void KBannerSetup::fillFontSizes()
comboSizes->blockSignals( block );
}
-void KBannerSetup::slotFamily( const QString& fam )
+void KBannerSetup::slotFamily( const TQString& fam )
{
fontFamily = fam;
fillFontSizes(); // different font, different sizes
@@ -232,7 +232,7 @@ void KBannerSetup::slotSize( int indx )
saver->setFont( fontFamily, fontSize, fontColor, bold, italic );
}
-void KBannerSetup::slotSizeEdit( const QString& fs )
+void KBannerSetup::slotSizeEdit( const TQString& fs )
{
bool ok;
fontSize = fs.toInt( &ok, 10 );
@@ -241,7 +241,7 @@ void KBannerSetup::slotSizeEdit( const QString& fs )
saver->setFont( fontFamily, fontSize, fontColor, bold, italic );
}
-void KBannerSetup::slotColor( const QColor &col )
+void KBannerSetup::slotColor( const TQColor &col )
{
fontColor = col;
if ( saver )
@@ -282,7 +282,7 @@ void KBannerSetup::slotSpeed( int num )
saver->setSpeed( speed );
}
-void KBannerSetup::slotMessage( const QString &msg )
+void KBannerSetup::slotMessage( const TQString &msg )
{
message = msg;
if ( saver )
@@ -316,7 +316,7 @@ void KBannerSetup::slotOk()
config->writeEntry( "ShowTime", showTime );
config->writeEntry( "FontFamily", fontFamily );
- QString fsize;
+ TQString fsize;
if (fontSize == 0) // an non-number was entered in the font size combo
{
fontSize = 48;
@@ -324,7 +324,7 @@ void KBannerSetup::slotOk()
fsize.setNum( fontSize );
config->writeEntry( "FontSize", fsize );
- QString colName;
+ TQString colName;
colName.sprintf( "#%02x%02x%02x", fontColor.red(), fontColor.green(),
fontColor.blue() );
config->writeEntry( "FontColor", colName );
@@ -350,17 +350,17 @@ KBannerSaver::KBannerSaver( WId id ) : KScreenSaver( id )
krnd = new KRandomSequence();
readSettings();
initialize();
- colorContext = QColor::enterAllocContext();
+ colorContext = TQColor::enterAllocContext();
needBlank = TRUE;
timer.start( speed );
- connect( &timer, SIGNAL( timeout() ), SLOT( slotTimeout() ) );
+ connect( &timer, TQT_SIGNAL( timeout() ), TQT_SLOT( slotTimeout() ) );
}
KBannerSaver::~KBannerSaver()
{
timer.stop();
- QColor::leaveAllocContext();
- QColor::destroyAllocContext( colorContext );
+ TQColor::leaveAllocContext();
+ TQColor::destroyAllocContext( colorContext );
delete krnd;
}
@@ -372,7 +372,7 @@ void KBannerSaver::setSpeed( int spd )
timer.start( speed );
}
-void KBannerSaver::setFont( const QString& family, int size, const QColor &color,
+void KBannerSaver::setFont( const TQString& family, int size, const TQColor &color,
bool b, bool i )
{
fontFamily = family;
@@ -384,7 +384,7 @@ void KBannerSaver::setFont( const QString& family, int size, const QColor &color
initialize();
}
-void KBannerSaver::setColor(QColor &color)
+void KBannerSaver::setColor(TQColor &color)
{
fontColor = color;
cyclingColor = FALSE;
@@ -397,18 +397,18 @@ void KBannerSaver::setCyclingColor( bool on )
needUpdate = TRUE;
}
-void KBannerSaver::setMessage( const QString &msg )
+void KBannerSaver::setMessage( const TQString &msg )
{
showTime = FALSE;
message = msg;
- pixmapSize = QSize();
+ pixmapSize = TQSize();
needBlank = TRUE;
}
void KBannerSaver::setTimeDisplay()
{
showTime = TRUE;
- pixmapSize = QSize();
+ pixmapSize = TQSize();
needBlank = TRUE;
}
@@ -424,7 +424,7 @@ void KBannerSaver::readSettings()
showTime=config->readBoolEntry("ShowTime",FALSE);
- fontFamily=config->readEntry("FontFamily",(QApplication::font()).family());
+ fontFamily=config->readEntry("FontFamily",(TQApplication::font()).family());
fontSize=config->readNumEntry("FontSize",48);
@@ -445,16 +445,16 @@ void KBannerSaver::readSettings()
// initialize font
void KBannerSaver::initialize()
{
- fsize = fontSize * height() / QApplication::desktop()->height();
+ fsize = fontSize * height() / TQApplication::desktop()->height();
- font = QFont( fontFamily, fsize, bold ? QFont::Bold : QFont::Normal, italic );
+ font = TQFont( fontFamily, fsize, bold ? TQFont::Bold : TQFont::Normal, italic );
- pixmapSize = QSize();
+ pixmapSize = TQSize();
needBlank = TRUE;
xpos = width();
ypos = fsize + (int) ((double)(height()-fsize)*krnd->getDouble());
- step = 2 * width() / QApplication::desktop()->width(); // 6 -> 2 -hhjb-
+ step = 2 * width() / TQApplication::desktop()->width(); // 6 -> 2 -hhjb-
if ( step == 0 )
step = 1;
}
@@ -470,22 +470,22 @@ void KBannerSaver::slotTimeout()
}
if (showTime)
{
- QString new_message = KGlobal::locale()->formatTime(QTime::currentTime(), true);
+ TQString new_message = KGlobal::locale()->formatTime(TQTime::currentTime(), true);
if( new_message != message )
needUpdate = TRUE;
message = new_message;
}
if ( !pixmapSize.isValid() || cyclingColor || needUpdate || needBlank )
{
- QRect rect = QFontMetrics( font ).boundingRect( message );
+ TQRect rect = TQFontMetrics( font ).boundingRect( message );
rect.setWidth( rect.width() + step );
if ( rect.width() > pixmapSize.width() )
pixmapSize.setWidth( rect.width() );
if ( rect.height() > pixmapSize.height() )
pixmapSize.setHeight( rect.height() );
- pixmap = QPixmap( pixmapSize );
+ pixmap = TQPixmap( pixmapSize );
pixmap.fill( black );
- QPainter p( &pixmap );
+ TQPainter p( &pixmap );
p.setFont( font );
p.setPen( fontColor );
p.drawText( -rect.x(), -rect.y(), message );
@@ -493,7 +493,7 @@ void KBannerSaver::slotTimeout()
}
xpos -= step;
if ( xpos < -pixmapSize.width() ) {
- QPainter p( this );
+ TQPainter p( this );
p.fillRect( xpos + step, ypos, pixmapSize.width(), pixmapSize.height(), black );
xpos = width();
ypos = fsize + (int) ((double)(height()-2.0*fsize)*krnd->getDouble());