CcaseCommentDlg::CcaseCommentDlg(bool bCheckin) : QDialog(0, "", true) { setCaption( i18n("Clearcase Comment") ); QBoxLayout *layout = new QVBoxLayout(this, 10); QLabel *messagelabel = new QLabel(i18n("Enter log message:"), this); messagelabel->setMinimumSize(messagelabel->sizeHint()); layout->addWidget(messagelabel, 0); _edit = new QMultiLineEdit(this); QFontMetrics fm(_edit->fontMetrics()); _edit->setMinimumSize(fm.width("0")*40, fm.lineSpacing()*3); layout->addWidget(_edit, 10); QBoxLayout *layout2 = new QHBoxLayout(layout); if(bCheckin) { _check = new QCheckBox(i18n("Reserve"), this); layout2->addWidget(_check); } KButtonBox *buttonbox = new KButtonBox(this); buttonbox->addStretch(); QPushButton *ok = buttonbox->addButton(KStdGuiItem::ok()); QPushButton *cancel = buttonbox->addButton(KStdGuiItem::cancel()); connect(ok, SIGNAL(clicked()), SLOT(accept()) ); connect(cancel, SIGNAL(clicked()), SLOT(reject()) ); ok->setDefault(true); buttonbox->layout(); layout2->addWidget(buttonbox, 0); layout->activate(); adjustSize(); }
void KPrMSPresentationCreateDialog::setupGUI() { back = new QVBox( this ); back->setMargin( KDialog::marginHint() ); QFrame *line; step1 = new QLabel( i18n( "Create directory structure" ), back ); step2 = new QLabel( i18n( "Create pictures of the slides" ), back ); step3 = new QLabel( i18n( "Create index file" ), back ); line = new QFrame( back ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMaximumHeight( 20 ); progressBar = new KProgress( back ); line = new QFrame( back ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMaximumHeight( 20 ); KButtonBox *bb = new KButtonBox( back ); bb->addStretch(); bDone = bb->addButton( i18n( "Done" ) ); bDone->setEnabled( false ); connect( bDone, SIGNAL( clicked() ), this, SLOT( accept() ) ); }
//=========================================================== // void ImportWizard::setupImporting() { m_importingPage = new QWidget(this); m_importingPage->hide(); QVBoxLayout *vbox = new QVBoxLayout(m_importingPage, KDialog::marginHint()); m_lblImportingTxt = new QLabel(m_importingPage); m_lblImportingTxt->setAlignment( Qt::AlignTop | Qt::AlignLeft | Qt::WordBreak ); m_lblImportingErrTxt = new QLabel(m_importingPage); m_lblImportingErrTxt->setAlignment( Qt::AlignTop | Qt::AlignLeft | Qt::WordBreak ); m_progressBar = new KProgress(100, m_importingPage); m_progressBar->hide(); vbox->addWidget( m_lblImportingTxt ); vbox->addWidget( m_lblImportingErrTxt ); vbox->addStretch(1); KButtonBox *optionsBox = new KButtonBox(m_importingPage); vbox->addWidget( optionsBox ); m_importOptionsButton = optionsBox->addButton(i18n("Advanced Options"), this, SLOT(slotOptionsButtonClicked())); m_importOptionsButton->setIconSet(SmallIconSet("configure")); optionsBox->addStretch(1); vbox->addWidget( m_progressBar ); vbox->addStretch(2); m_importingPage->show(); addPage(m_importingPage, i18n("Importing")); }
NamePartWidget::NamePartWidget( const QString &title, const QString &label, QWidget *parent, const char *name ) : QWidget( parent, name ), mTitle( title ), mLabel( label ) { QHBoxLayout *layout = new QHBoxLayout( this ); QGroupBox *group = new QGroupBox( 0, Qt::Vertical, title, this ); QGridLayout *groupLayout = new QGridLayout( group->layout(), 2, 2, KDialog::spacingHint() ); mBox = new QListBox( group ); connect( mBox, SIGNAL( selectionChanged( QListBoxItem* ) ), SLOT( selectionChanged( QListBoxItem* ) ) ); groupLayout->addWidget( mBox, 0, 0 ); KButtonBox *bbox = new KButtonBox( group, Qt::Vertical ); mAddButton = bbox->addButton( i18n( "Add..." ), this, SLOT( add() ) ); mEditButton = bbox->addButton( i18n( "Edit..." ), this, SLOT( edit() ) ); mEditButton->setEnabled( false ); mRemoveButton = bbox->addButton( i18n( "Remove" ), this, SLOT( remove() ) ); mRemoveButton->setEnabled( false ); bbox->layout(); groupLayout->addWidget( bbox, 0, 1 ); layout->addWidget( group ); }
SaveScm::SaveScm( QWidget *parent, const char *name ) : QDialog( parent, name, TRUE ) { setFocusPolicy(QWidget::StrongFocus); setCaption( i18n("Add a color scheme")); QBoxLayout *topLayout = new QVBoxLayout( this, 10 ); QBoxLayout *stackLayout = new QVBoxLayout( 3 ); topLayout->addLayout( stackLayout ); nameLine = new QLineEdit( this ); nameLine->setFocus(); nameLine->setMaxLength(18); nameLine->setFixedHeight( nameLine->sizeHint().height() ); QLabel* tmpQLabel; tmpQLabel = new QLabel( nameLine, i18n( "&Enter a name for the new color scheme\n"\ "to be added to your personal list.\n\n"\ "The colors currently used in the preview will\n"\ "be copied into this scheme to begin with." ), this ); tmpQLabel->setAlignment( AlignLeft | AlignBottom | ShowPrefix ); tmpQLabel->setFixedHeight( tmpQLabel->sizeHint().height() ); tmpQLabel->setMinimumWidth( tmpQLabel->sizeHint().width() ); stackLayout->addStretch( 10 ); stackLayout->addWidget( tmpQLabel ); stackLayout->addWidget( nameLine ); QFrame* tmpQFrame; tmpQFrame = new QFrame( this ); tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken ); tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() ); topLayout->addWidget( tmpQFrame ); KButtonBox *bbox = new KButtonBox( this ); bbox->addStretch( 10 ); QPushButton *ok = bbox->addButton( i18n( "&OK" ) ); connect( ok, SIGNAL( clicked() ), SLOT( accept() ) ); QPushButton *cancel = bbox->addButton( i18n( "&Cancel" ) ); connect( cancel, SIGNAL( clicked() ), SLOT( reject() ) ); bbox->layout(); topLayout->addWidget( bbox ); topLayout->activate(); resize( 250, 0 ); }
FieldSelect::FieldSelect(Procview *pv, Proc *proc) : QDialog(0, "select fields"), nbuttons(proc->cats.size()), disp_fields(nbuttons), procview(pv) { QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); updating = FALSE; setCaption("qps: select fields"); buts = new QCheckBox*[nbuttons]; QGridLayout *l1 = new QGridLayout((nbuttons + 1) / 2, 5, 0); tl->addLayout(l1, 1); l1->addColSpacing(2, 15); int half = (nbuttons + 1) / 2; for(int i = 0; i < nbuttons; i++) { QCheckBox *but = new QCheckBox(proc->cats[i]->name, this); QLabel *desc = new QLabel(proc->cats[i]->help, this); but->setMinimumSize(but->sizeHint()); desc->setMinimumSize(desc->sizeHint()); if(i < half) { l1->addWidget(but, i, 0); l1->addWidget(desc, i, 1); } else { l1->addWidget(but, i-half, 3); l1->addWidget(desc, i-half, 4); } buts[i] = but; connect(but, SIGNAL(toggled(bool)), this, SLOT(field_toggled(bool))); } update_boxes(); KButtonBox *bbox = new KButtonBox(this); bbox->addStretch(1); QPushButton *closebut = bbox->addButton(i18n("Close")); closebut->setDefault(TRUE); closebut->setFocus(); closebut->setFixedSize(closebut->sizeHint()); bbox->layout(); tl->addWidget(bbox); connect(closebut, SIGNAL(clicked()), SLOT(closed())); QAccel *acc = new QAccel(this); acc->connectItem(acc->insertItem(CTRL + Key_W), this, SLOT(closed())); tl->freeze(); }
KLineEditDlg::KLineEditDlg( const QString&_text, const QString& _value, QWidget *parent, bool _file_mode ) : QDialog( parent, 0L, true ) { QGridLayout *layout = new QGridLayout(this, 4, 3, 10); QLabel *label = new QLabel(_text, this); layout->addWidget(label, 0, 0, AlignLeft); edit = new KLineEdit( this, 0L ); edit->setMinimumWidth(edit->sizeHint().width() * 3); connect( edit, SIGNAL(returnPressed()), SLOT(accept()) ); if ( _file_mode ) { completion = new KURLCompletion(); edit->setCompletionObject( completion ); edit->setAutoDeleteCompletionObject( true ); } else completion = 0L; layout->addMultiCellWidget(edit, 1, 1, 0, _file_mode ? 1 : 2); layout->setColStretch(1, 1); if (_file_mode) { QPushButton *browse = new QPushButton(i18n("&Browse..."), this); layout->addWidget(browse, 1, 2, AlignCenter); connect(browse, SIGNAL(clicked()), SLOT(slotBrowse())); } QFrame *hLine = new QFrame(this); hLine->setFrameStyle(QFrame::Sunken|QFrame::HLine); layout->addMultiCellWidget(hLine, 2, 2, 0, 2); KButtonBox *bBox = new KButtonBox(this); layout->addMultiCellWidget(bBox, 3, 3, 0, 2); QPushButton *ok = bBox->addButton(KStdGuiItem::ok()); ok->setDefault(true); connect( ok, SIGNAL(clicked()), SLOT(accept())); bBox->addStretch(1); QPushButton *clear = bBox->addButton(KStdGuiItem::clear()); connect( clear, SIGNAL(clicked()), SLOT(slotClear())); bBox->addStretch(1); QPushButton *cancel = bBox->addButton(KStdGuiItem::cancel()); connect( cancel, SIGNAL(clicked()), SLOT(reject())); bBox->layout(); layout->activate(); edit->setText( _value ); edit->setSelection(0, edit->text().length()); edit->setFocus(); }
ResourceSelectDialog::ResourceSelectDialog(AddressBook *ab, QWidget *parent, const char *name) : KDialog(parent, name, true) { setCaption(i18n("Resource Selection")); resize(300, 200); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->setMargin(marginHint()); QGroupBox *groupBox = new QGroupBox(2, Qt::Horizontal, this); groupBox->setTitle(i18n("Resources")); mResourceId = new KListBox(groupBox); mainLayout->addWidget(groupBox); mainLayout->addSpacing(10); KButtonBox *buttonBox = new KButtonBox(this); buttonBox->addStretch(); buttonBox->addButton(KStdGuiItem::ok(), this, SLOT(accept())); buttonBox->addButton(KStdGuiItem::cancel(), this, SLOT(reject())); buttonBox->layout(); mainLayout->addWidget(buttonBox); // setup listbox uint counter = 0; QPtrList< Resource > list = ab->resources(); for(uint i = 0; i < list.count(); ++i) { Resource *resource = list.at(i); if(resource && !resource->readOnly()) { mResourceMap.insert(counter, resource); mResourceId->insertItem(resource->resourceName()); counter++; } } mResourceId->setCurrentItem(0); }
ValueDialog::ValueDialog(const char *caption, const char *msg, const char *ed_txt) : QDialog(kapp->mainWidget(), caption, TRUE) { setCaption(caption); QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); QHBoxLayout *l1 = new QHBoxLayout; tl->addLayout(l1, 1); label = new QLabel(msg, this); label->setMinimumSize(label->sizeHint()); l1->addWidget(label); lined = new QLineEdit(this); lined->setMinimumWidth(lined->sizeHint().width()/2); lined->setFixedHeight(lined->sizeHint().height()); lined->setMaxLength(7); lined->setText(ed_txt); lined->selectAll(); lined->setFocus(); l1->addWidget(lined, 1); tl->addSpacing(10); KButtonBox *bbox = new KButtonBox(this); bbox->addStretch(1); ok = bbox->addButton(i18n("OK")); ok->setDefault(TRUE); connect(ok, SIGNAL(clicked()), SLOT(done_dialog())); cancel = bbox->addButton(i18n("Cancel")); connect(cancel, SIGNAL(clicked()), SLOT(reject())); bbox->layout(); tl->addWidget(bbox); connect(lined, SIGNAL(returnPressed()), SLOT(done_dialog())); QAccel *acc = new QAccel(this); acc->connectItem(acc->insertItem(Key_Escape), this, SLOT(reject())); tl->freeze(); }
void KPrWebPresentationCreateDialog::setupGUI() { back = new QVBox( this ); back->setMargin( KDialog::marginHint() ); QFrame *line; line = new QFrame( back ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMaximumHeight( 20 ); step1 = new QLabel( i18n( "Initialize (create file structure, etc.)" ), back ); step2 = new QLabel( i18n( "Create Pictures of the Slides" ), back ); step3 = new QLabel( i18n( "Create HTML Pages for the Slides" ), back ); step4 = new QLabel( i18n( "Create Main Page (Table of Contents)" ), back ); step5 = new QLabel( i18n( "Options for Unattended Presentations" ), back); line = new QFrame( back ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMaximumHeight( 20 ); progressBar = new KProgress( back ); line = new QFrame( back ); line->setFrameStyle( QFrame::HLine | QFrame::Sunken ); line->setMaximumHeight( 20 ); KButtonBox *bb = new KButtonBox( back ); bSave = bb->addButton( i18n( "Save Configuration..." ) ); bb->addStretch(); bDone = bb->addButton( i18n( "Done" ) ); bSave->setEnabled( false ); bDone->setEnabled( false ); connect( bDone, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( bSave, SIGNAL( clicked() ), this, SLOT( saveConfig() ) ); }
KKeyDialog::KKeyDialog( QDict<KKeyEntry> *aKeyDict, QWidget *parent ) : QDialog( parent, 0, TRUE ) { setCaption(i18n("Configure key bindings")); setFocusPolicy( QWidget::StrongFocus ); QBoxLayout *topLayout = new QVBoxLayout( this, 10 ); KKeyChooser *kc = new KKeyChooser( aKeyDict, this ); topLayout->addWidget( kc, 10 ); // CREATE BUTTONS KButtonBox *bbox = new KButtonBox( this ); bHelp = bbox->addButton( i18n("&Help") ); //connect( bHelp, SIGNAL(clicked()), SLOT(help()) ); bHelp->setEnabled( false ); bDefaults = bbox->addButton( i18n("&Defaults") ); connect( bDefaults, SIGNAL(clicked()), kc, SLOT(allDefault()) ); //bDefaults->setEnabled( false ); bbox->addStretch( 10 ); bOk = bbox->addButton( i18n("&OK") ); connect( bOk, SIGNAL(clicked()), SLOT(accept()) ); bCancel = bbox->addButton( i18n("&Cancel") ); connect( bCancel, SIGNAL(clicked()), SLOT(reject()) ); bbox->layout(); topLayout->addWidget( bbox ); topLayout->activate(); resize( 400, 350 ); }
KCustomMenuEditor::KCustomMenuEditor(QWidget *parent) : KDialogBase(parent, "custommenueditor", true, i18n("Menu Editor"), Ok|Cancel, Ok, true), m_listView(0) { d = new KCustomMenuEditorPrivate; QHBox *page = makeHBoxMainWidget(); m_listView = new KListView(page); m_listView->addColumn(i18n("Menu")); m_listView->setFullWidth(true); m_listView->setSorting(-1); KButtonBox *buttonBox = new KButtonBox(page, Vertical); buttonBox->addButton(i18n("New..."), this, SLOT(slotNewItem())); d->pbRemove=buttonBox->addButton(i18n("Remove"), this, SLOT(slotRemoveItem())); d->pbMoveUp=buttonBox->addButton(i18n("Move Up"), this, SLOT(slotMoveUp())); d->pbMoveDown=buttonBox->addButton(i18n("Move Down"), this, SLOT(slotMoveDown())); buttonBox->layout(); connect( m_listView, SIGNAL( selectionChanged () ), this, SLOT( refreshButton() ) ); refreshButton(); }
KCookiesOptions::KCookiesOptions(QWidget *parent, const char *name) : KConfigWidget(parent, name) { QGridLayout *lay = new QGridLayout(this,ROW_BOTTOM+1,5,10,5); lay->addRowSpacing(0,10); lay->addRowSpacing(2,10); lay->addRowSpacing(4,10); lay->addRowSpacing(5,30); // no idea why 10 isn't enough... David. lay->addColSpacing(0,10); lay->addColSpacing(2,10); lay->addColSpacing(4,10); lay->setRowStretch(0,0); lay->setRowStretch(1,0); // ROW_ENABLE_COOKIES lay->setRowStretch(2,1); lay->setRowStretch(3,1); // ROW_DEFAULT_ACCEPT lay->setRowStretch(4,1); lay->setRowStretch(5,0); lay->setRowStretch(6,1); // ROW_CHANGE_DOMAIN lay->setRowStretch(7,10); // ROW_BOTTOM lay->setColStretch(0,0); lay->setColStretch(1,1); lay->setColStretch(2,0); lay->setColStretch(3,1); lay->setColStretch(4,0); cb_enableCookies = new QCheckBox( i18n("&Enable Cookies"), this ); cb_enableCookies->adjustSize(); cb_enableCookies->setMinimumSize(cb_enableCookies->size()); connect( cb_enableCookies, SIGNAL( clicked() ), this, SLOT( changeCookiesEnabled() ) ); lay->addWidget(cb_enableCookies,ROW_ENABLE_COOKIES,1); { QButtonGroup *bg = new QButtonGroup( i18n("Default accept policy"), this ); bg1 = bg; bg->setExclusive( TRUE ); QGridLayout *bgLay = new QGridLayout(bg,3,3,10,5); bgLay->addRowSpacing(0,10); bgLay->addRowSpacing(2,5); bgLay->setRowStretch(0,0); bgLay->setRowStretch(1,0); rb_gbPolicyAccept = new QRadioButton( i18n("Accept"), bg ); rb_gbPolicyAccept->adjustSize(); rb_gbPolicyAccept->setMinimumSize(rb_gbPolicyAccept->size()); bgLay->addWidget(rb_gbPolicyAccept, 1, 0); rb_gbPolicyAsk = new QRadioButton( i18n("Ask"), bg ); rb_gbPolicyAsk->adjustSize(); rb_gbPolicyAsk->setMinimumSize(rb_gbPolicyAsk->size()); bgLay->addWidget(rb_gbPolicyAsk, 1, 1); rb_gbPolicyReject = new QRadioButton( i18n("Reject"), bg ); rb_gbPolicyReject->adjustSize(); rb_gbPolicyReject->setMinimumSize(rb_gbPolicyReject->size()); bgLay->addWidget(rb_gbPolicyReject, 1, 2); bgLay->activate(); lay->addMultiCellWidget(bg,ROW_DEFAULT_ACCEPT,ROW_DEFAULT_ACCEPT+1,3,3); } // CREATE SPLIT LIST BOX wList = new KSplitList( this ); wList->setMinimumHeight(80); lay->addMultiCellWidget( wList, ROW_DEFAULT_ACCEPT+1, ROW_BOTTOM, 1, 1 ); // associated label (has to be _after_) wListLabel = new QLabel( wList, i18n("Domain specific settings:"), this ); lay->addWidget( wListLabel, ROW_DEFAULT_ACCEPT, 1 ); wListLabel->setFixedHeight( wListLabel->sizeHint().height() ); connect( wList, SIGNAL( highlighted( int ) ), SLOT( updateDomain( int ) ) ); connect( wList, SIGNAL( selected( int ) ), SLOT( updateDomain( int ) ) ); { QButtonGroup *bg = new QButtonGroup( i18n("Change domain accept policy"), this ); bg2 = bg; bg->setExclusive( TRUE ); QGridLayout *bgLay = new QGridLayout(bg,6,3,10,5); bgLay->addRowSpacing(0,10); bgLay->addRowSpacing(2,10); bgLay->setRowStretch(0,0); bgLay->setRowStretch(1,0); bgLay->setRowStretch(2,1); bgLay->setRowStretch(3,0); bgLay->setRowStretch(4,1); bgLay->setRowStretch(5,0); le_domain = new QLineEdit(bg); le_domain->adjustSize(); le_domain->setMinimumSize(le_domain->size()); bgLay->addMultiCellWidget(le_domain,1,1,0,2); rb_domPolicyAccept = new QRadioButton( i18n("Accept"), bg ); rb_domPolicyAccept->adjustSize(); rb_domPolicyAccept->setMinimumSize(rb_domPolicyAccept->size()); bgLay->addWidget(rb_domPolicyAccept, 3, 0); rb_domPolicyAsk = new QRadioButton( i18n("Ask"), bg ); rb_domPolicyAsk->adjustSize(); rb_domPolicyAsk->setMinimumSize(rb_domPolicyAsk->size()); bgLay->addWidget(rb_domPolicyAsk, 3, 1); rb_domPolicyReject = new QRadioButton( i18n("Reject"), bg ); rb_domPolicyReject->adjustSize(); rb_domPolicyReject->setMinimumSize(rb_domPolicyReject->size()); rb_domPolicyAsk->setChecked( true ); bgLay->addWidget(rb_domPolicyReject, 3, 2); KButtonBox *bbox = new KButtonBox( bg ); bbox->addStretch( 20 ); b0 = bbox->addButton( i18n("Change") ); connect( b0, SIGNAL( clicked() ), this, SLOT( changePressed() ) ); bbox->addStretch( 10 ); b1 = bbox->addButton( i18n("Delete") ); connect( b1, SIGNAL( clicked() ), this, SLOT( deletePressed() ) ); bbox->addStretch( 20 ); bbox->layout(); bgLay->addMultiCellWidget( bbox, 5,5,0,2); lay->addWidget(bg,ROW_CHANGE_DOMAIN,3); } lay->activate(); setMinimumSize(480,300); // finally read the options loadSettings(); }
Zoom::Zoom( QWidget *parent, const char *name ) : QDialog( parent, name) { setFocusPolicy(QWidget::StrongFocus); mag = 1; int border = 10; QBoxLayout *topLayout = new QVBoxLayout( this, border ); topLayout->addStretch( 10 ); //sbMag = new KSpinBox( this ); sbMag = new QComboBox (false, this); // (2.0) make this configurable if needed -- at least don't hard code! unsigned int i; mags = new int [21]; for (i = 1; i <= 10; i++) mags [i] = (int) (100*i/(10)); for (i = 1; i <= 10; i++) mags [i+10] = (int)(100+200*i/(10)); for (i = 1; i <= 20; i++) sbMag->insertItem( withPercent (mags[i]) ); // sbMag->adjustSize(); sbMag->setMinimumSize( sbMag->size() ); // connect ( sbMag, SIGNAL (valueIncreased()), SLOT (slotValueIncreased()) ); // connect ( sbMag, SIGNAL (valueDecreased()), SLOT (slotValueDecreased()) ); connect (sbMag, SIGNAL (activated (const char *)), SLOT (slotZoom (const char *)) ); QLabel* tmpQLabel; tmpQLabel = new QLabel( sbMag, i18n("&Zoom factor"), this ); tmpQLabel->setMinimumSize( tmpQLabel->sizeHint() ); topLayout->addWidget( tmpQLabel ); topLayout->addWidget( sbMag ); QFrame* tmpQFrame; tmpQFrame = new QFrame( this ); tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken ); tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() ); topLayout->addWidget( tmpQFrame ); // CREATE BUTTONS KButtonBox *bbox = new KButtonBox( this ); bbox->addStretch( 10 ); /* okButton = bbox->addButton( i18n("&OK") ); connect( okButton, SIGNAL(clicked()), SLOT(slotOk ()) ); okButton->setEnabled (false); apply = bbox->addButton( i18n("&Apply") ); connect( apply, SIGNAL(clicked()), SLOT(applyZoom()) ); apply->setEnabled (false); */ QButton *close = bbox->addButton( i18n("&Close") ); connect( close, SIGNAL(clicked()), SLOT(reject()) ); bbox->layout(); topLayout->addWidget( bbox ); topLayout->activate(); resize( 200,0 ); }
InterfaceDlg::InterfaceDlg(QWidget *parent) :QDialog(parent,"Props", TRUE) { setCaption(i18n("aRts: Structureport View")); QVBoxLayout *mainlayout = new QVBoxLayout(this); //QHBoxLayout *contentslayout = new QHBoxLayout; // object type /* mainlayout->addSpacing(5); QLabel *objectlabel = new QLabel(this); QFont labelfont(objectlabel->font()); labelfont.setPointSize(labelfont.pointSize()*3/2); objectlabel->setFont(labelfont); objectlabel->setText(QString(" ")+i18n("Object type: ")+QString(port->owner->name())+QString(" ")); objectlabel->setAlignment(AlignCenter); min_size(objectlabel); mainlayout->addWidget(objectlabel); */ // port description /* mainlayout->addSpacing(5); QLabel *portlabel = new QLabel(this); labelfont.setPointSize(labelfont.pointSize()*4/5); portlabel->setFont(labelfont); portlabel->setText(i18n("Port description: ")+ port->description); min_size(portlabel); portlabel->setAlignment(AlignCenter); mainlayout->addWidget(portlabel); int labelwidth = imax(portlabel->sizeHint().width(),objectlabel->sizeHint().width()); portlabel->setMinimumWidth(labelwidth); objectlabel->setMinimumWidth(labelwidth); // hruler mainlayout->addSpacing(5); KSeparator *ruler = new KSeparator( KSeparator::HLine, this); mainlayout->addWidget(ruler); mainlayout->addSpacing(5); mainlayout->addLayout(contentslayout); */ // list listbox = new QListBox(this); update(); listbox->setMinimumSize(340,400); mainlayout->addWidget(listbox); connect( listbox, SIGNAL( doubleClicked ( QListBoxItem *)), this, SLOT(accept())); // hruler mainlayout->addSpacing(5); KSeparator *ruler2 = new KSeparator( KSeparator::HLine, this); mainlayout->addWidget(ruler2); // buttons QHBoxLayout *buttonlayout = new QHBoxLayout; mainlayout->addSpacing(5); mainlayout->addLayout(buttonlayout); mainlayout->addSpacing(5); buttonlayout->addSpacing(5); KButtonBox *bbox = new KButtonBox(this); bbox->addButton(KStdGuiItem::help(), this, SLOT( help() )); bbox->addStretch(1); QButton *okbutton = bbox->addButton(KStdGuiItem::ok()); connect( okbutton, SIGNAL( clicked() ), SLOT(accept() ) ); QButton *cancelbutton = bbox->addButton(KStdGuiItem::cancel()); connect( cancelbutton, SIGNAL( clicked() ), SLOT(reject() ) ); bbox->layout(); //min_size(bbox); buttonlayout->addWidget(bbox); buttonlayout->addSpacing(5); //mainlayout->activate(); mainlayout->freeze(); }
PrintDialog::PrintDialog( QWidget *parent, const char *name, int maxPages, bool marked ) : QDialog( parent, name, TRUE ) { setFocusPolicy(QWidget::StrongFocus); pgMode = All; /* printerName.sprintf( "" ); // default printer will be chosen. spoolerCommand.sprintf( "lpr" ); printerVariable.sprintf( "PRINTER" ); */ KConfig *config = KApplication::getKApplication()->getConfig(); /* Read in the default options. */ config->setGroup( "Print" ); printerName=config->readEntry ("Name",""); spoolerCommand=config->readEntry ("Spool","lpr"); printerVariable=config->readEntry ("Variable","PRINTER"); pgMax = maxPages; pgStart=0; pgEnd=0; int border = 10; QBoxLayout *topLayout = new QVBoxLayout( this, border ); cbFile = new QCheckBox( i18n("Print to file"), this ); cbFile->setFixedHeight( cbFile->sizeHint().height() ); topLayout->addWidget( cbFile ); QGroupBox *group = new QGroupBox( i18n( "Pages" ), this ); topLayout->addWidget( group, 10 ); QGridLayout *grid = new QGridLayout( group, 5, 7, 5 ); grid->setRowStretch( 0, 10 ); grid->setRowStretch( 1, 100 ); grid->setRowStretch( 2, 0 ); grid->setRowStretch( 3, 100 ); grid->setRowStretch( 4, 10 ); grid->setColStretch( 0, 0 ); grid->setColStretch( 1, 100 ); grid->setColStretch( 2, 100 ); grid->setColStretch( 3, 100 ); grid->setColStretch( 4, 0 ); grid->setColStretch( 5, 100 ); grid->setColStretch( 6, 0 ); pgGroup = new QButtonGroup( group ); pgGroup->hide(); pgGroup->setExclusive( true ); connect( pgGroup, SIGNAL( clicked( int ) ), SLOT( slotPageMode( int ) ) ); int widest = 0; QRadioButton *arb = new QRadioButton( i18n("&All"), group ); arb->setFixedHeight( arb->sizeHint().height()+6 ); arb->setChecked( true ); pgGroup->insert( arb, All ); grid->addWidget( arb, 1, 1 ); if ( arb->sizeHint().width() > widest ) widest = arb->sizeHint().width(); QRadioButton *rb = new QRadioButton( i18n("&Current"), group ); rb->setFixedHeight( rb->sizeHint().height()+6 ); pgGroup->insert( rb, Current ); grid->addWidget( rb, 1, 2 ); if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width(); rb = new QRadioButton( i18n("&Marked"), group ); rb->setFixedHeight( rb->sizeHint().height()+6 ); if ( !marked ) rb->setEnabled( false ); else { arb->setChecked ( false ); rb->setChecked ( true ); } pgGroup->insert( rb, Marked ); grid->addWidget( rb, 3, 1 ); if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width(); rb = new QRadioButton( i18n("&Range"), group ); rb->setFixedHeight( rb->sizeHint().height()+6 ); pgGroup->insert( rb, Range ); grid->addWidget( rb, 3, 2 ); if ( rb->sizeHint().width() > widest ) widest = rb->sizeHint().width(); leStart = new QLineEdit( group ); leStart->setFixedHeight( rb->sizeHint().height()+6 ); grid->addWidget( leStart, 3, 3 ); lTo = new QLabel( group ); lTo->setText( i18n("to") ); lTo->setAlignment( AlignCenter ); lTo->setMinimumSize( lTo->sizeHint() ); grid->addWidget( lTo, 3, 4 ); leEnd = new QLineEdit( group ); leEnd->setFixedHeight( rb->sizeHint().height()+6 ); grid->addWidget( leEnd, 3, 5 ); group->setMinimumSize( QSize( 4*widest+25, 4*(rb->sizeHint().height()+6) ) ); cbOrder = new QCheckBox( i18n("Print document in re&verse order"), this ); cbOrder->setFixedHeight( cbOrder->sizeHint().height() ); topLayout->addWidget( cbOrder ); QFrame* tmpQFrame; tmpQFrame = new QFrame( this ); tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken ); tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() ); topLayout->addWidget( tmpQFrame ); // CREATE BUTTONS KButtonBox *bbox = new KButtonBox( this ); QPushButton* setup = bbox->addButton( i18n("&Setup ...") ); connect( setup, SIGNAL(clicked()), SLOT( setup()) ); bbox->addStretch( 10 ); QPushButton* ok = bbox->addButton( i18n("&OK") ); connect( ok, SIGNAL(clicked()), SLOT( checkRange() ) ); QPushButton* cancel = bbox->addButton( i18n("&Cancel") ); connect( cancel, SIGNAL(clicked()), SLOT(reject()) ); bbox->layout(); topLayout->addWidget( bbox ); topLayout->activate(); if ( marked ) slotPageMode( Marked ); else slotPageMode( All ); resize( 250, 0 ); }
PPPdArguments::PPPdArguments(QWidget *parent, const char *name) : QDialog(parent, name, TRUE) { setCaption(i18n("Customize pppd Arguments")); KWM::setMiniIcon(winId(), kapp->getMiniIcon()); QVBoxLayout *l = new QVBoxLayout(this, 10, 10); QHBoxLayout *tl = new QHBoxLayout(10); l->addLayout(tl); QVBoxLayout *l1 = new QVBoxLayout(); QVBoxLayout *l2 = new QVBoxLayout(); tl->addLayout(l1, 1); tl->addLayout(l2, 0); QHBoxLayout *l11 = new QHBoxLayout(10); l1->addLayout(l11); argument_label = newLabel(i18n("Argument:"), this); l11->addWidget(argument_label); argument = newLineEdit(0, this); connect(argument, SIGNAL(returnPressed()), SLOT(addbutton())); l11->addWidget(argument); connect(argument, SIGNAL(textChanged(const char *)), this, SLOT(textChanged(const char *))); arguments = new QListBox(this); arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10); connect(arguments, SIGNAL(highlighted(int)), this, SLOT(itemSelected(int))); l1->addWidget(arguments, 1); add = new QPushButton(i18n("Add"), this); FIXED_HEIGHT(add); MIN_WIDTH(add); connect(add, SIGNAL(clicked()), SLOT(addbutton())); l2->addWidget(add); l2->addStretch(1); remove = new QPushButton(i18n("Remove"), this); FIXED_HEIGHT(remove); MIN_WIDTH(remove); connect(remove, SIGNAL(clicked()), SLOT(removebutton())); l2->addWidget(remove); defaults = new QPushButton(i18n("Defaults"), this); FIXED_HEIGHT(defaults); MIN_WIDTH(defaults); connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton())); l2->addWidget(defaults); l->addSpacing(5); KButtonBox *bbox = new KButtonBox(this); bbox->addStretch(1); closebtn = bbox->addButton(i18n("OK")); connect(closebtn, SIGNAL(clicked()), SLOT(closebutton())); QPushButton *cancel = bbox->addButton(i18n("Cancel")); connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); bbox->layout(); l->addWidget(bbox); l->freeze(); //load info from gpppdata init(); add->setEnabled(false); remove->setEnabled(false); argument->setFocus(); }
PrintSetup::PrintSetup( QWidget *parent, const char *name, QString pname, QString spooler, QString variable ) : QDialog( parent, name, TRUE ) { setFocusPolicy(QWidget::StrongFocus); setCaption( i18n( "Printer setup" ) ); int border = 10; QBoxLayout *topLayout = new QVBoxLayout( this, border ); topLayout->addStretch( 10 ); QGridLayout *grid = new QGridLayout( 7, 2, 5 ); topLayout->addLayout( grid ); grid->addRowSpacing(2,5); grid->addRowSpacing(4,5); grid->setColStretch(0,10); grid->setColStretch(1,100); leName = new QLineEdit( this ); leName->setFocus(); leName->setFixedHeight( leName->sizeHint().height() ); leName->setText( pname ); grid->addWidget( leName, 1, 1 ); QLabel* tmpQLabel; tmpQLabel = new QLabel( leName, i18n("&Printer name"), this ); tmpQLabel->setAlignment( AlignRight | AlignVCenter | ShowPrefix ); tmpQLabel->setMinimumSize( tmpQLabel->sizeHint() ); grid->addWidget( tmpQLabel, 1, 0 ); leSpool = new QLineEdit( this ); leSpool->setFixedHeight( leName->sizeHint().height() ); leSpool->setText( spooler ); grid->addWidget( leSpool, 3, 1 ); tmpQLabel = new QLabel( leSpool, i18n("&Spooler command"), this ); tmpQLabel->setAlignment( AlignRight | AlignVCenter | ShowPrefix ); tmpQLabel->setMinimumSize( tmpQLabel->sizeHint() ); grid->addWidget( tmpQLabel, 3, 0 ); leVar = new QLineEdit( this ); leVar->setFixedHeight( leName->sizeHint().height() ); leVar->setText( variable ); grid->addWidget( leVar, 5, 1 ); tmpQLabel = new QLabel( leVar, i18n("&Environment variable"), this ); tmpQLabel->setAlignment( AlignRight | AlignVCenter | ShowPrefix ); tmpQLabel->setMinimumSize( tmpQLabel->sizeHint() ); grid->addWidget( tmpQLabel, 5, 0 ); QFrame* tmpQFrame; tmpQFrame = new QFrame( this ); tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken ); tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() ); topLayout->addWidget( tmpQFrame ); // CREATE BUTTONS KButtonBox *bbox = new KButtonBox( this ); bbox->addStretch( 10 ); QPushButton* ok = bbox->addButton( i18n("&OK") ); connect( ok, SIGNAL(clicked()), SLOT(accept()) ); QPushButton* cancel = bbox->addButton( i18n("&Cancel") ); connect( cancel, SIGNAL(clicked()), SLOT(reject()) ); bbox->layout(); topLayout->addWidget( bbox ); topLayout->activate(); resize( 300,0 ); }
kRockSetup::kRockSetup( QWidget *parent, const char *name ) : QDialog( parent, name, TRUE ) { speed = 50; number = 50; readSettings(); setCaption( glocale->translate("Setup krock") ); QLabel *label; QPushButton *button; KSlider *slider; QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); QHBoxLayout *tl1 = new QHBoxLayout; tl->addLayout(tl1); QVBoxLayout *tl11 = new QVBoxLayout(5); tl1->addLayout(tl11); label = new QLabel( glocale->translate("Speed:"), this ); min_size(label); tl11->addWidget(label); slider = new KSlider( KSlider::Horizontal, this ); slider->setMinimumSize( 90, 20 ); slider->setRange( 0, 100 ); slider->setSteps( 25, 50 ); slider->setValue( speed ); connect( slider, SIGNAL( valueChanged( int ) ), SLOT( slotSpeed( int ) ) ); tl11->addWidget(slider); tl11->addSpacing(5); label = new QLabel( glocale->translate("Number:"), this ); min_size(label); tl11->addWidget(label); slider = new KSlider( KSlider::Horizontal, this ); slider->setMinimumSize( 90, 20 ); slider->setRange( 20, 260 ); slider->setSteps( 20, 80 ); slider->setValue( number ); connect( slider, SIGNAL( valueChanged( int ) ), SLOT( slotNumber( int ) ) ); tl11->addWidget(slider); tl11->addSpacing(5); QCheckBox *cb = new QCheckBox( glocale->translate("Move"), this ); min_size(cb); cb->setChecked( move ); connect( cb, SIGNAL( toggled( bool ) ), SLOT( slotMove( bool ) ) ); tl11->addWidget(cb); cb = new QCheckBox( glocale->translate("Rotate"), this ); min_size(cb); cb->setChecked( rotate ); connect( cb, SIGNAL( toggled( bool ) ), SLOT( slotRotate( bool ) ) ); tl11->addWidget(cb); tl11->addStretch(1); preview = new QWidget( this ); preview->setFixedSize( 220, 170 ); preview->setBackgroundColor( black ); preview->show(); // otherwise saver does not get correct size saver = new kRockSaver( preview->winId() ); tl1->addWidget(preview); KButtonBox *bbox = new KButtonBox(this); button = bbox->addButton( glocale->translate("About")); connect( button, SIGNAL( clicked() ), SLOT(slotAbout() ) ); bbox->addStretch(1); button = bbox->addButton( glocale->translate("OK")); connect( button, SIGNAL( clicked() ), SLOT( slotOkPressed() ) ); button = bbox->addButton(glocale->translate("Cancel")); connect( button, SIGNAL( clicked() ), SLOT( reject() ) ); bbox->layout(); tl->addWidget(bbox); tl->freeze(); }
void UMLOperationDialog::setupDialog() { int margin = fontMetrics().height(); QVBoxLayout * topLayout = new QVBoxLayout( plainPage() ); m_pGenGB = new QGroupBox(i18n("General Properties"), plainPage() ); QGridLayout * genLayout = new QGridLayout(m_pGenGB, 3, 4 ); genLayout -> setColStretch(1, 1); genLayout -> setColStretch(3, 1); genLayout -> addColSpacing(1, 200); genLayout -> addColSpacing(3, 200); genLayout -> setMargin(margin); genLayout -> setSpacing(10); Dialog_Utils::makeLabeledEditField( m_pGenGB, genLayout, 0, m_pNameL, i18n("&Name:"), m_pNameLE, m_pOperation->getName() ); m_pRtypeL = new QLabel(i18n("&Type:"), m_pGenGB ); genLayout -> addWidget(m_pRtypeL, 0, 2); m_pRtypeCB = new KComboBox(true, m_pGenGB ); genLayout -> addWidget(m_pRtypeCB, 0, 3); m_pRtypeL->setBuddy(m_pRtypeCB); m_pStereoTypeL = new QLabel( i18n("Stereotype name:"), m_pGenGB ); genLayout -> addWidget(m_pStereoTypeL, 1, 0); m_pStereoTypeCB = new KComboBox(true, m_pGenGB ); genLayout -> addWidget(m_pStereoTypeCB, 1, 1); m_pAbstractCB = new QCheckBox( i18n("&Abstract operation"), m_pGenGB ); m_pAbstractCB -> setChecked( m_pOperation->getAbstract() ); genLayout -> addWidget( m_pAbstractCB, 2, 0 ); m_pStaticCB = new QCheckBox( i18n("Classifier &scope (\"static\")"), m_pGenGB ); m_pStaticCB -> setChecked( m_pOperation->getStatic() ); genLayout -> addWidget( m_pStaticCB, 2, 1 ); m_pQueryCB = new QCheckBox( i18n("&Query (\"const\")"), m_pGenGB ); m_pQueryCB -> setChecked( m_pOperation->getConst() ); genLayout -> addWidget( m_pQueryCB, 2, 2 ); topLayout -> addWidget( m_pGenGB ); m_pScopeBG = new QButtonGroup(i18n("Visibility"), plainPage() ); QHBoxLayout * scopeLayout = new QHBoxLayout(m_pScopeBG); scopeLayout -> setMargin(margin); m_pPublicRB = new QRadioButton(i18n("P&ublic"), m_pScopeBG); scopeLayout -> addWidget(m_pPublicRB); m_pPrivateRB = new QRadioButton(i18n("P&rivate"), m_pScopeBG); scopeLayout -> addWidget(m_pPrivateRB); m_pProtectedRB = new QRadioButton(i18n("Prot&ected"), m_pScopeBG); scopeLayout -> addWidget(m_pProtectedRB); m_pImplementationRB = new QRadioButton(i18n("I&mplementation"), m_pScopeBG); scopeLayout -> addWidget(m_pImplementationRB); topLayout -> addWidget(m_pScopeBG); m_pParmsGB = new QGroupBox(i18n("Parameters"), plainPage() ); QVBoxLayout* parmsLayout = new QVBoxLayout(m_pParmsGB); parmsLayout->setMargin(margin); parmsLayout->setSpacing(10); //horizontal box contains the list box and the move up/down buttons QHBoxLayout* parmsHBoxLayout = new QHBoxLayout(parmsLayout); m_pParmsLB = new QListBox(m_pParmsGB); parmsHBoxLayout->addWidget(m_pParmsLB); //the move up/down buttons (another vertical box) QVBoxLayout* buttonLayout = new QVBoxLayout( parmsHBoxLayout ); m_pUpButton = new KArrowButton( m_pParmsGB ); m_pUpButton->setEnabled( false ); buttonLayout->addWidget( m_pUpButton ); m_pDownButton = new KArrowButton( m_pParmsGB, Qt::DownArrow ); m_pDownButton->setEnabled( false ); buttonLayout->addWidget( m_pDownButton ); KButtonBox* buttonBox = new KButtonBox(m_pParmsGB); buttonBox->addButton( i18n("Ne&w Parameter..."), this, SLOT(slotNewParameter()) ); m_pDeleteButton = buttonBox->addButton( i18n("&Delete"), this, SLOT(slotDeleteParameter()) ); m_pPropertiesButton = buttonBox->addButton( i18n("&Properties"), this, SLOT(slotParameterProperties()) ); parmsLayout->addWidget(buttonBox); topLayout -> addWidget(m_pParmsGB); m_pDeleteButton->setEnabled(false); m_pPropertiesButton->setEnabled(false); m_pUpButton->setEnabled(false); m_pDownButton->setEnabled(false); // Add "void". We use this for denoting "no return type" independent // of the programming language. // For example, the Ada generator would interpret the return type // "void" as an instruction to generate a procedure instead of a // function. insertType( "void" ); m_pRtypeCB->setDuplicatesEnabled(false);//only allow one of each type in box m_pRtypeCB->setCompletionMode( KGlobalSettings::CompletionPopup ); // add template parameters UMLClassifier *classifier = dynamic_cast<UMLClassifier*>(m_pOperation->parent()); if (classifier) { UMLClassifierListItemList tmplParams( classifier->getFilteredList(Uml::ot_Template) ); for (UMLClassifierListItem *li = tmplParams.first(); li; li = tmplParams.next()) insertType( li->getName() ); } //now add the Classes and Interfaces (both are Concepts) UMLClassifierList namesList( m_doc->getConcepts() ); UMLClassifier* pConcept = 0; for(pConcept=namesList.first(); pConcept!=0 ;pConcept=namesList.next()) { insertType( pConcept->getFullyQualifiedName() ); } //work out which one to select int returnBoxCount = 0; bool foundReturnType = false; while (returnBoxCount < m_pRtypeCB->count() && foundReturnType == false) { QString returnBoxString = m_pRtypeCB->text(returnBoxCount); if ( returnBoxString == m_pOperation->getTypeName() ) { foundReturnType = true; m_pRtypeCB->setCurrentItem(returnBoxCount); break; } returnBoxCount++; } if (!foundReturnType) { insertType( m_pOperation->getTypeName(), 0 ); m_pRtypeCB->setCurrentItem(0); } //fill in parm list box UMLAttributeList list = m_pOperation->getParmList(); UMLAttribute * pAtt = 0; for (pAtt = list.first(); pAtt; pAtt = list.next()) m_pParmsLB->insertItem( pAtt->getName() ); //set scope Uml::Visibility scope = m_pOperation -> getVisibility(); if( scope == Uml::Visibility::Public ) m_pPublicRB -> setChecked( true ); else if( scope == Uml::Visibility::Private ) m_pPrivateRB -> setChecked( true ); else if( scope == Uml::Visibility::Protected ) m_pProtectedRB -> setChecked( true ); else if( scope == Uml::Visibility::Implementation ) m_pImplementationRB -> setChecked( true ); // manage stereotypes m_pStereoTypeCB -> setDuplicatesEnabled(false);//only allow one of each type in box m_pStereoTypeCB->setCompletionMode( KGlobalSettings::CompletionPopup ); insertStereotype (QString("")); // an empty stereotype is the default int defaultStereotype=0; bool foundDefaultStereotype = false; for (UMLStereotypeListIt it(m_doc->getStereotypes()); it.current(); ++it) { if (!foundDefaultStereotype) { if ( m_pOperation->getStereotype() == it.current()->getName()) { foundDefaultStereotype = true; } defaultStereotype++; } insertStereotype (it.current()->getName()); } // lookup for a default stereotype, if the operation doesn't have one if (foundDefaultStereotype) m_pStereoTypeCB->setCurrentItem(defaultStereotype); else m_pStereoTypeCB->setCurrentItem(-1); //setup parm list box signals connect( m_pUpButton, SIGNAL( clicked() ), this, SLOT( slotParameterUp() ) ); connect( m_pDownButton, SIGNAL( clicked() ), this, SLOT( slotParameterDown() ) ); connect(m_pParmsLB, SIGNAL(clicked(QListBoxItem*)), this, SLOT(slotParamsBoxClicked(QListBoxItem*))); connect(m_pParmsLB, SIGNAL(rightButtonPressed(QListBoxItem *, const QPoint &)), this, SLOT(slotParmRightButtonPressed(QListBoxItem *, const QPoint &))); connect(m_pParmsLB, SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), this, SLOT(slotParmRightButtonClicked(QListBoxItem *, const QPoint &))); connect(m_pParmsLB, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(slotParmDoubleClick(QListBoxItem *))); m_pNameLE->setFocus(); connect( m_pNameLE, SIGNAL( textChanged ( const QString & ) ), SLOT( slotNameChanged( const QString & ) ) ); slotNameChanged(m_pNameLE->text() ); }
kSwarmSetup::kSwarmSetup( QWidget *parent, const char *name ) : QDialog( parent, name, TRUE ) { readSettings(); setCaption( glocale->translate("Setup KSwarm") ); QLabel *label; QPushButton *button; KSlider *slider; QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); QHBoxLayout *tl1 = new QHBoxLayout; tl->addLayout(tl1); QVBoxLayout *tl11 = new QVBoxLayout(5); tl1->addLayout(tl11); label = new QLabel( glocale->translate("Speed:"), this ); min_size(label); tl11->addWidget(label); slider = new KSlider( KSlider::Horizontal, this ); slider->setMinimumSize( 90, 20 ); slider->setRange( MINSPEED, MAXSPEED ); slider->setSteps( (MAXSPEED-MINSPEED)/4, (MAXSPEED-MINSPEED)/2 ); slider->setValue( speed ); connect( slider, SIGNAL( valueChanged( int ) ), SLOT( slotSpeed( int ) ) ); tl11->addWidget(slider); tl11->addSpacing(5); label = new QLabel( glocale->translate("Number of Bees:"), this ); min_size(label); tl11->addWidget(label); slider = new KSlider( KSlider::Horizontal, this ); slider->setMinimumSize( 90, 20 ); slider->setRange( MINBATCH, MAXBATCH ); slider->setSteps( (MAXBATCH-MINBATCH)/4, (MAXBATCH-MINBATCH)/2 ); slider->setValue( maxLevels ); connect( slider, SIGNAL( valueChanged( int ) ), SLOT( slotLevels( int ) ) ); tl11->addWidget(slider); tl11->addStretch(1); preview = new QWidget( this ); preview->setFixedSize( 220, 170 ); preview->setBackgroundColor( black ); preview->show(); // otherwise saver does not get correct size saver = new kSwarmSaver( preview->winId() ); tl1->addWidget(preview); KButtonBox *bbox = new KButtonBox(this); button = bbox->addButton( glocale->translate("About")); connect( button, SIGNAL( clicked() ), SLOT(slotAbout() ) ); bbox->addStretch(1); button = bbox->addButton( glocale->translate("OK")); connect( button, SIGNAL( clicked() ), SLOT( slotOkPressed() ) ); button = bbox->addButton(glocale->translate("Cancel")); connect( button, SIGNAL( clicked() ), SLOT( reject() ) ); bbox->layout(); tl->addWidget(bbox); tl->freeze(); }
ChooseBusDlg::ChooseBusDlg(QWidget *parent) : KDialog(parent,"X", TRUE) , _newbusitemindex( -1 ) { setCaption(i18n("Choose Bus")); QVBoxLayout *mainlayout = new QVBoxLayout(this); // caption label: "Synthesis running..." mainlayout->addSpacing(5); QLabel *captionlabel = new QLabel(this); QFont labelfont(captionlabel->font()); labelfont.setPointSize(labelfont.pointSize()*3/2); captionlabel->setFont(labelfont); captionlabel->setText(QString(" ")+i18n("Available busses:")+QString(" ")); captionlabel->setAlignment(AlignCenter); min_size(captionlabel); mainlayout->addWidget(captionlabel); // hruler mainlayout->addSpacing(5); KSeparator *ruler2 = new KSeparator( KSeparator::HLine, this); mainlayout->addWidget(ruler2); mainlayout->addSpacing(5); // listwidget listbox = new QListBox(this); listbox->setMinimumSize(300,200); Arts::AudioManager aman = Arts::Reference("global:Arts_AudioManager"); if(!aman.isNull()) { vector<string> *destinations = aman.destinations(); unsigned long i; for(i=0;i<destinations->size();i++) listbox->insertItem((*destinations)[i].c_str()); delete destinations; } if( listbox->count() > 0 ) listbox->setCurrentItem( 0 ); mainlayout->addWidget(listbox); // hruler mainlayout->addSpacing(5); KSeparator *ruler = new KSeparator( KSeparator::HLine, this); mainlayout->addWidget(ruler); mainlayout->addSpacing(5); // new bus lineedit QBoxLayout * layout2 = new QHBoxLayout( mainlayout ); //mainlayout->addLayout( layout2 ); QLabel * newbuslabel = new QLabel( i18n( "New bus:" ), this ); layout2->addWidget( newbuslabel ); lineedit = new KLineEdit( this ); connect( lineedit, SIGNAL( textChanged( const QString & ) ), SLOT( textChanged( const QString & ) ) ); layout2->addWidget( lineedit ); // hruler mainlayout->addSpacing(5); KSeparator *ruler3 = new KSeparator( KSeparator::HLine, this); mainlayout->addWidget(ruler3); mainlayout->addSpacing(5); // buttons mainlayout->addSpacing(5); QHBoxLayout *buttonlayout = new QHBoxLayout( mainlayout ); //mainlayout->addLayout(buttonlayout); mainlayout->addSpacing(5); buttonlayout->addSpacing(5); KButtonBox *bbox = new KButtonBox(this); bbox->addButton(KStdGuiItem::help(), this, SLOT( help() )); bbox->addStretch(1); QPushButton * okbutton = bbox->addButton(KStdGuiItem::ok()); okbutton->setDefault( true ); connect( okbutton, SIGNAL( clicked() ), SLOT(accept() ) ); QButton *cancelbutton = bbox->addButton(KStdGuiItem::cancel()); connect( cancelbutton, SIGNAL( clicked() ), SLOT(reject() ) ); bbox->layout(); buttonlayout->addWidget(bbox); buttonlayout->addSpacing(5); mainlayout->freeze(); }
SliderDialog::SliderDialog(const char *caption, const char *msg, int defaultval, int minval, int maxval) : QDialog(kapp->mainWidget(), caption, TRUE) { setCaption(caption); QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); QHBoxLayout *l1 = new QHBoxLayout; tl->addLayout(l1, 1); label = new QLabel(msg, this); label->setMinimumSize(label->sizeHint()); l1->addWidget(label); lined = new QLineEdit(this); lined->setMinimumWidth(lined->sizeHint().width()/2); lined->setFixedHeight(lined->sizeHint().height()); lined->setMaxLength(7); QString s; s.setNum(defaultval); lined->setText(s.data()); lined->selectAll(); lined->setFocus(); l1->addWidget(lined, 1); QVBoxLayout *l2 = new QVBoxLayout; tl->addLayout(l2); slider = new KSlider(minval, maxval, 1, defaultval, KSlider::Horizontal, this); slider->setTickInterval(10); slider->setFixedHeight(slider->sizeHint().height()); slider->setMinimumWidth(200); connect(slider, SIGNAL(valueChanged(int)), this, SLOT(slider_change(int))); l2->addWidget(slider); QHBoxLayout *l21 = new QHBoxLayout; l2->addLayout(l21); // decorate slider QLabel *left = new QLabel(this); QLabel *mid = new QLabel(this); QLabel *right = new QLabel(this); left->setNum(minval); mid->setNum((minval + maxval) / 2); right->setNum(maxval); left->setFixedSize(left->sizeHint()); mid->setFixedSize(mid->sizeHint()); right->setFixedSize(right->sizeHint()); l21->addWidget(left); l21->addStretch(1); l21->addWidget(mid); l21->addStretch(1); l21->addWidget(right); tl->addSpacing(10); KButtonBox *bbox = new KButtonBox(this); bbox->addStretch(1); ok = bbox->addButton(i18n("OK")); ok->setDefault(TRUE); connect(ok, SIGNAL(clicked()), SLOT(done_dialog())); cancel = bbox->addButton(i18n("Cancel")); connect(cancel, SIGNAL(clicked()), SLOT(reject())); bbox->layout(); tl->addWidget(bbox); connect(lined, SIGNAL(returnPressed()), SLOT(done_dialog())); QAccel *acc = new QAccel(this); acc->connectItem(acc->insertItem(Key_Escape), this, SLOT(reject())); tl->freeze(); }