KBannerSetup::KBannerSetup( QWidget *parent ) : KDialog( parent) , saver( 0 ), ed(0), speed( 50 ) { setButtons(Ok|Cancel|Help); setDefaultButton(Ok); setCaption(i18n( "Setup Banner Screen Saver" )); setModal(true); setButtonText( Help, i18n( "A&bout" ) ); readSettings(); QWidget *main = new QWidget(this); setMainWidget(main); QLabel *label; QVBoxLayout *tl = new QVBoxLayout( main ); QHBoxLayout *tl1 = new QHBoxLayout(); tl->addLayout(tl1); QVBoxLayout *tl11 = new QVBoxLayout(); tl1->addLayout(tl11); QGroupBox *group = new QGroupBox( i18n("Font"), main ); QVBoxLayout *vbox = new QVBoxLayout; group->setLayout(vbox); QGridLayout *gl = new QGridLayout(); vbox->addLayout(gl); gl->setSpacing(spacingHint()); label = new QLabel( i18n("Family:"), group ); gl->addWidget(label, 1, 0); KFontComboBox* comboFonts = new KFontComboBox( group ); comboFonts->setCurrentFont( fontFamily ); gl->addWidget(comboFonts, 1, 1); connect( comboFonts, SIGNAL(currentFontChanged(QFont)), SLOT(slotFamily(QFont)) ); label = new QLabel( i18n("Size:"), group ); gl->addWidget(label, 2, 0); comboSizes = new QComboBox( group ); comboSizes->setEditable( true ); fillFontSizes(); gl->addWidget(comboSizes, 2, 1); connect( comboSizes, SIGNAL(activated(int)), SLOT(slotSize(int)) ); connect( comboSizes, SIGNAL(editTextChanged(QString)), SLOT(slotSizeEdit(QString)) ); QCheckBox *cb = new QCheckBox( i18n("Bold"), group ); cb->setChecked( bold ); connect( cb, SIGNAL(toggled(bool)), SLOT(slotBold(bool)) ); gl->addWidget(cb, 3, 0); cb = new QCheckBox( i18n("Italic"), group ); cb->setChecked( italic ); gl->addWidget(cb, 3, 1); connect( cb, SIGNAL(toggled(bool)), SLOT(slotItalic(bool)) ); label = new QLabel( i18n("Color:"), group ); gl->addWidget(label, 4, 0); colorPush = new KColorButton( fontColor, group ); gl->addWidget(colorPush, 4, 1); connect( colorPush, SIGNAL(changed(QColor)), SLOT(slotColor(QColor)) ); QCheckBox *cyclingColorCb=new QCheckBox(i18n("Cycling color"),group); cyclingColorCb->setMinimumSize(cyclingColorCb->sizeHint()); gl->addWidget(cyclingColorCb, 5, 0,5,1); connect(cyclingColorCb,SIGNAL(toggled(bool)),this,SLOT(slotCyclingColor(bool))); cyclingColorCb->setChecked(cyclingColor); preview = new QWidget( main ); preview->setFixedSize( 220, 170 ); { QPalette palette; palette.setColor( preview->backgroundRole(), Qt::black ); preview->setPalette( palette ); preview->setAutoFillBackground(true); } preview->show(); // otherwise saver does not get correct size saver = new KBannerSaver( preview->winId() ); tl1->addWidget(preview); tl11->addWidget(group); label = new QLabel( i18n("Speed:"), main ); tl11->addStretch(1); tl11->addWidget(label); QSlider *sb = new QSlider( Qt::Horizontal, main ); sb->setMinimum(0); sb->setMaximum(100); sb->setPageStep(10); sb->setValue(speed); sb->setMinimumWidth( 180); sb->setFixedHeight(20); sb->setTickPosition(QSlider::TicksBelow); sb->setTickInterval(10); tl11->addWidget(sb); connect( sb, SIGNAL(valueChanged(int)), SLOT(slotSpeed(int)) ); QHBoxLayout *tl2 = new QHBoxLayout; tl->addLayout(tl2); label = new QLabel( i18n("Message:"), main ); tl2->addWidget(label); ed = new QLineEdit( main ); tl2->addWidget(ed); ed->setText( message ); connect( ed, SIGNAL(textChanged(QString)), SLOT(slotMessage(QString)) ); QCheckBox *timeCb=new QCheckBox( i18n("Show current time"), main); timeCb->setFixedSize(timeCb->sizeHint()); tl->addWidget(timeCb,0,Qt::AlignLeft); connect(timeCb,SIGNAL(toggled(bool)),this,SLOT(slotTimeToggled(bool))); timeCb->setChecked(showTime); connect(this,SIGNAL(okClicked()),this,SLOT(slotOk())); connect(this,SIGNAL(helpClicked()),this,SLOT(slotHelp())); tl->addStretch(); }