Kfind::Kfind(QWidget *parent, const char *name) : QWidget(parent, name) { kdDebug() << "Kfind::Kfind " << this << endl; QBoxLayout *mTopLayout = new QBoxLayout(this, QBoxLayout::LeftToRight, KDialog::marginHint(), KDialog::spacingHint()); // create tabwidget tabWidget = new KfindTabWidget(this); mTopLayout->addWidget(tabWidget); /* * This is ugly. Might be a KSeparator bug, but it makes a small black * pixel for me which is visually distracting (GS). // create separator KSeparator * mActionSep = new KSeparator( this ); mActionSep->setFocusPolicy( QWidget::ClickFocus ); mActionSep->setOrientation( QFrame::VLine ); mTopLayout->addWidget(mActionSep); */ // create button box QVBox *mButtonBox = new QVBox(this); QVBoxLayout *lay = (QVBoxLayout *)mButtonBox->layout(); lay->addStretch(1); mTopLayout->addWidget(mButtonBox); mSearch = new KPushButton(KGuiItem(i18n("&Find"), "find"), mButtonBox); mButtonBox->setSpacing((tabWidget->sizeHint().height() - 4 * mSearch->sizeHint().height()) / 4); connect(mSearch, SIGNAL(clicked()), this, SLOT(startSearch())); mStop = new KPushButton(KGuiItem(i18n("Stop"), "stop"), mButtonBox); connect(mStop, SIGNAL(clicked()), this, SLOT(stopSearch())); mSave = new KPushButton(KStdGuiItem::saveAs(), mButtonBox); connect(mSave, SIGNAL(clicked()), this, SLOT(saveResults())); KPushButton *mClose = new KPushButton(KStdGuiItem::close(), mButtonBox); connect(mClose, SIGNAL(clicked()), this, SIGNAL(destroyMe())); // react to search requests from widget connect(tabWidget, SIGNAL(startSearch()), this, SLOT(startSearch())); mSearch->setEnabled(true); // Enable "Search" mStop->setEnabled(false); // Disable "Stop" mSave->setEnabled(false); // Disable "Save..." dirlister = new KDirLister(); }
bool KXSConfigDialog::create() { QVBoxLayout *topLayout = new QVBoxLayout(plainPage(), spacingHint()); QHBoxLayout *layout = new QHBoxLayout(topLayout, spacingHint()); QVBox *controlLayout = new QVBox(plainPage()); controlLayout->setSpacing(spacingHint()); layout->addWidget(controlLayout); ((QBoxLayout*)controlLayout->layout())->addStrut(120); KConfig config(mConfigFile); QString xmlFile = "/doesntexist"; #ifdef XSCREENSAVER_CONFIG_DIR xmlFile = XSCREENSAVER_CONFIG_DIR; #endif xmlFile += "/" + mExeName + ".xml"; if ( QFile::exists( xmlFile ) ) { // We can use the xscreensaver xml config files. KXSXml xmlParser(controlLayout); xmlParser.parse( xmlFile ); mConfigItemList = *xmlParser.items(); QWidget *spacer = new QWidget(controlLayout); controlLayout->setStretchFactor(spacer, 1 ); QString descr = xmlParser.description(); if ( !descr.isEmpty() ) { descr.replace('\n',' '); descr = descr.simplifyWhiteSpace(); QLabel *l = new QLabel( i18n( descr.utf8() ), plainPage() ); l->setAlignment ( WordBreak ); topLayout->addWidget( l ); } } else { // fall back to KDE's old config files. int idx = 0; while (true) { QString group = QString("Arg%1").arg(idx); if (config.hasGroup(group)) { config.setGroup(group); QString type = config.readEntry("Type"); if (type == "Range") { KXSRangeControl *rc = new KXSRangeControl(controlLayout, group, config); mConfigItemList.append(rc); } else if (type == "DoubleRange") { KXSDoubleRangeControl *rc = new KXSDoubleRangeControl(controlLayout, group, config); mConfigItemList.append(rc); } else if (type == "Check") { KXSCheckBoxControl *cc = new KXSCheckBoxControl(controlLayout, group, config); mConfigItemList.append(cc); } else if (type == "DropList") { KXSDropListControl *dl = new KXSDropListControl(controlLayout, group, config); mConfigItemList.append(dl); } } else { break; } idx++; } if ( idx == 0 ) return false; } QPtrListIterator<KXSConfigItem> it( mConfigItemList ); KXSConfigItem *item; while ( (item = it.current()) != 0 ) { ++it; item->read( config ); QWidget *i = dynamic_cast<QWidget*>(item); if (i) { connect( i, SIGNAL(changed()), SLOT(slotChanged()) ); } } mPreviewProc = new KProcess; connect(mPreviewProc, SIGNAL(processExited(KProcess *)), SLOT(slotPreviewExited(KProcess *))); mPreviewTimer = new QTimer(this); connect(mPreviewTimer, SIGNAL(timeout()), SLOT(slotNewPreview())); mPreview = new QWidget(plainPage()); mPreview->setFixedSize(250, 200); // mPreview->setBackgroundMode(QWidget::NoBackground); mPreview->setBackgroundColor(Qt::black); layout->add(mPreview); show(); // So that hacks can XSelectInput ButtonPressMask XSelectInput(qt_xdisplay(), mPreview->winId(), widgetEventMask ); slotPreviewExited(0); return true; }