//--------------------------------------------------------------------------- // // Constructor // AmorDialog::AmorDialog() : KDialogBase(0, "amordlg", false, i18n("Options"), Ok|Apply|Cancel, Ok ) { mConfig.read(); QVBox *mainwidget = makeVBoxMainWidget(); QHBox *hb = new QHBox(mainwidget); // Theme list QVBox *themeBox = new QVBox(hb); themeBox->setSpacing(spacingHint()); QLabel *label = new QLabel(i18n("Theme:"), themeBox); mThemeListBox = new QListBox(themeBox); connect(mThemeListBox,SIGNAL(highlighted(int)),SLOT(slotHighlighted(int))); mThemeListBox->setMinimumSize( fontMetrics().maxWidth()*20, fontMetrics().lineSpacing()*6 ); mAboutEdit = new QMultiLineEdit(themeBox); mAboutEdit->setReadOnly(true); mAboutEdit->setMinimumHeight( fontMetrics().lineSpacing()*4 ); themeBox->setStretchFactor(mThemeListBox, 4); themeBox->setStretchFactor(mAboutEdit, 1); // Animation offset QVBox *offsetBox = new QVBox(hb); offsetBox->setSpacing(spacingHint()); label = new QLabel(i18n("Offset:"), offsetBox); QSlider *slider = new QSlider(-40, 40, 5, mConfig.mOffset, QSlider::Vertical, offsetBox); connect(slider, SIGNAL(valueChanged(int)), SLOT(slotOffset(int))); // Always on top QCheckBox *checkBox = new QCheckBox(i18n("Always on top"), mainwidget); connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotOnTop(bool))); checkBox->setChecked(mConfig.mOnTop); checkBox = new QCheckBox(i18n("Show random tips"), mainwidget); connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotRandomTips(bool))); checkBox->setChecked(mConfig.mTips); // always keep this one after the connect, or the QList would not be grayed when it should checkBox = new QCheckBox(i18n("Use a random character"), mainwidget); connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotRandomTheme(bool))); checkBox->setChecked(mConfig.mRandomTheme); checkBox = new QCheckBox(i18n("Allow application tips"), mainwidget); connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotApplicationTips(bool))); checkBox->setChecked(mConfig.mAppTips); readThemes(); }
CompletionOrderEditor::CompletionOrderEditor(KPIM::LdapSearch *ldapSearch, QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Completion Order"), Ok | Cancel, Ok, true), mConfig("kpimcompletionorder"), mDirty(false) { mItems.setAutoDelete(true); // The first step is to gather all the data, creating CompletionItem objects QValueList< LdapClient * > ldapClients = ldapSearch->clients(); for(QValueList<LdapClient *>::const_iterator it = ldapClients.begin(); it != ldapClients.end(); ++it) { //kdDebug(5300) << "LDAP: host " << (*it)->host() << " weight " << (*it)->completionWeight() << endl; mItems.append(new LDAPCompletionItem(*it)); } KABC::AddressBook *addressBook = KABC::StdAddressBook::self(true); QPtrList<KABC::Resource> resources = addressBook->resources(); for(QPtrListIterator<KABC::Resource> resit(resources); *resit; ++resit) { //kdDebug(5300) << "KABC Resource: " << (*resit)->className() << endl; ResourceABC *res = dynamic_cast<ResourceABC *>(*resit); if(res) // IMAP KABC resource { const QStringList subresources = res->subresources(); for(QStringList::const_iterator it = subresources.begin(); it != subresources.end(); ++it) { mItems.append(new KABCImapSubResCompletionItem(res, *it)); } } else // non-IMAP KABC resource { mItems.append(new SimpleCompletionItem(this, (*resit)->resourceName(), (*resit)->identifier())); } } #ifndef KDEPIM_NEW_DISTRLISTS // new distr lists are normal contact, so no separate item if using them // Add an item for distribution lists mItems.append(new SimpleCompletionItem(this, i18n("Distribution Lists"), "DistributionLists")); #endif // Now sort the items, then create the GUI mItems.sort(); QHBox *page = makeHBoxMainWidget(); mListView = new KListView(page); mListView->setSorting(-1); mListView->addColumn(QString::null); mListView->header()->hide(); for(QPtrListIterator<CompletionItem> compit(mItems); *compit; ++compit) { new CompletionViewItem(mListView, *compit); kdDebug(5300) << " " << (*compit)->label() << " " << (*compit)->completionWeight() << endl; } QVBox *upDownBox = new QVBox(page); mUpButton = new KPushButton(upDownBox, "mUpButton"); mUpButton->setIconSet(BarIconSet("up", KIcon::SizeSmall)); mUpButton->setEnabled(false); // b/c no item is selected yet mUpButton->setFocusPolicy(StrongFocus); mDownButton = new KPushButton(upDownBox, "mDownButton"); mDownButton->setIconSet(BarIconSet("down", KIcon::SizeSmall)); mDownButton->setEnabled(false); // b/c no item is selected yet mDownButton->setFocusPolicy(StrongFocus); QWidget *spacer = new QWidget(upDownBox); upDownBox->setStretchFactor(spacer, 100); connect(mListView, SIGNAL(selectionChanged(QListViewItem *)), SLOT(slotSelectionChanged(QListViewItem *))); connect(mUpButton, SIGNAL(clicked()), this, SLOT(slotMoveUp())); connect(mDownButton, SIGNAL(clicked()), this, SLOT(slotMoveDown())); }
QWidget* MyFracWindow::createParamsDock(QWidget* parent) { QVBox* wrapper = new QVBox(parent); wrapper->setSpacing(0); QGrid* propParams = new QGrid(2, wrapper); propParams->setMargin(7); propParams->setSpacing(5); new QLabel(i18n("X coordinate:"), propParams); _editPosX = new QLineEdit(propParams); _editPosX->setValidator(new QDoubleValidator(-4.0, 4.0, 15, _editPosX)); connect(_editPosX, SIGNAL(returnPressed()), SLOT(readPosition())); connect(_editPosX, SIGNAL(lostFocus()), SLOT(readPosition())); QToolTip::add(_editPosX, i18n("X coordinate of the center of the view")); new QLabel(i18n("Y coordinate:"), propParams); _editPosY = new QLineEdit(propParams); _editPosY->setValidator(new QDoubleValidator(-4.0, 4.0, 15, _editPosY)); connect(_editPosY, SIGNAL(returnPressed()), SLOT(readPosition())); connect(_editPosY, SIGNAL(lostFocus()), SLOT(readPosition())); QToolTip::add(_editPosY, i18n("Y coordinate of the center of the view")); new QLabel(i18n("Zoom magnitude:"), propParams); _editZoom = new QLineEdit(propParams); _editZoom->setValidator(new QDoubleValidator(-1.0, 14.0, 15, _editZoom)); connect(_editZoom, SIGNAL(returnPressed()), SLOT(readPosition())); connect(_editZoom, SIGNAL(lostFocus()), SLOT(readPosition())); QToolTip::add(_editZoom, i18n("Zoom order of maginitude")); new QLabel(i18n("Rotation angle:"), propParams); _editAngle = new QLineEdit(propParams); _editAngle->setValidator(new QDoubleValidator(-360.0, 360.0, 15, _editAngle)); connect(_editAngle, SIGNAL(returnPressed()), SLOT(readPosition())); connect(_editAngle, SIGNAL(lostFocus()), SLOT(readPosition())); QToolTip::add(_editAngle, i18n("View rotation angle in degrees")); new QLabel(i18n("Julia X param.:"), propParams); _editJuliaX = new QLineEdit(propParams); connect(_editJuliaX, SIGNAL(returnPressed()), SLOT(readJulia())); connect(_editJuliaX, SIGNAL(lostFocus()), SLOT(readJulia())); QToolTip::add(_editJuliaX, i18n("X coordinate of the Julia parameter")); new QLabel(i18n("Julia Y param.:"), propParams); _editJuliaY = new QLineEdit(propParams); connect(_editJuliaY, SIGNAL(returnPressed()), SLOT(readJulia())); connect(_editJuliaY, SIGNAL(lostFocus()), SLOT(readJulia())); QToolTip::add(_editJuliaY, i18n("Y coordinate of the Julia parameter")); new QLabel(i18n("Iterations limit:"), propParams); _sliderIterations = new QSlider(QSlider::Horizontal, propParams); _sliderIterations->setRange(0, 20); connect(_sliderIterations, SIGNAL(valueChanged(int)), SLOT(setMaxIterations(int))); QToolTip::add(_sliderIterations, i18n("Maximum number of iterations to calculate")); new QLabel(i18n("Detail level:"), propParams); _sliderQuality = new QSlider(QSlider::Horizontal, propParams); _sliderQuality->setRange(0, 10); connect(_sliderQuality, SIGNAL(valueChanged(int)), SLOT(setQuality(int))); QToolTip::add(_sliderQuality, i18n("Amount of details to calculate")); wrapper->setStretchFactor(new QWidget(wrapper), 1); return wrapper; }
QWidget* MyFracWindow::createDisplayDock(QWidget* parent) { QVBox* wrapper = new QVBox(parent); wrapper->setSpacing(0); QGrid* propDisplay = new QGrid(2, wrapper); propDisplay->setMargin(7); propDisplay->setSpacing(5); new QLabel(i18n("Color gradient:"), propDisplay); GradientButton* gradButton = new GradientButton(propDisplay); connect(this, SIGNAL(gradientChanged(const QRgb*, double, double)), gradButton, SLOT(setGradient(const QRgb*, double, double))); connect(gradButton, SIGNAL(clicked()), this, SLOT(onGradientEdit())); QToolTip::add(gradButton, i18n("Gradient used to display the fractal")); new QLabel(i18n("Color scale:"), propDisplay); _sliderScale = new QSlider(QSlider::Horizontal, propDisplay); _sliderScale->setRange(0, 100); connect(_sliderScale, SIGNAL(valueChanged(int)), SLOT(setGradientScale(int))); QToolTip::add(_sliderScale, i18n("Scale of the color gradient")); new QLabel(i18n("Color offset:"), propDisplay); _sliderOffset = new QSlider(QSlider::Horizontal, propDisplay); _sliderOffset->setRange(0, 100); connect(_sliderOffset, SIGNAL(valueChanged(int)), SLOT(setGradientOffset(int))); QToolTip::add(_sliderOffset, i18n("Offset of the color gradient")); new QLabel(i18n("Scroll colors:"), propDisplay); QHBox* box = new QHBox(propDisplay); box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); box->setSpacing(5); QComboBox* combo = new QComboBox(box); combo->insertItem(i18n("scroll direction", "Off")); combo->insertItem(i18n("scroll direction", "Left")); combo->insertItem(i18n("scroll direction", "Right")); connect(combo, SIGNAL(activated(int)), SLOT(setScrollMode(int))); _sliderScroll = new QSlider(QSlider::Horizontal, box); _sliderScroll->setRange(0, 100); _sliderScroll->setEnabled(false); connect(_sliderScroll, SIGNAL(valueChanged(int)), SLOT(setScrollSpeed(int))); QToolTip::add(combo, i18n("Scrolling direction")); QToolTip::add(_sliderScroll, i18n("Scrolling speed")); new QLabel(i18n("Background:"), propDisplay); _colorButton = new KColorButton(_backgroundColor, propDisplay); connect(_colorButton, SIGNAL(changed(const QColor&)), SLOT(selectBackground(const QColor&))); QToolTip::add(_colorButton, i18n("Color of the background area")); new QLabel(i18n("3D grid size:"), propDisplay); _comboGrid = new QComboBox(propDisplay); for (int i = 64; i <= 1024; i *= 2) _comboGrid->insertItem(i18n("%1 x %2").arg(i).arg(i)); _comboGrid->setEnabled(false); connect(_comboGrid, SIGNAL(activated(int)), SLOT(setGridSize(int))); QToolTip::add(_comboGrid, i18n("Resolution of the 3D mesh")); new QLabel(i18n("Height scale:"), propDisplay); _sliderHeight = new QSlider(QSlider::Horizontal, propDisplay); _sliderHeight->setRange(0, 100); _sliderHeight->setEnabled(false); connect(_sliderHeight, SIGNAL(valueChanged(int)), SLOT(setHeightScale(int))); QToolTip::add(_sliderHeight, i18n("Height scale of the 3D mesh")); wrapper->setStretchFactor(new QWidget(wrapper), 1); return wrapper; }
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; }