void ApplicationWindow::addTabs() { struct v4l2_queryctrl qctrl; unsigned ctrl_class; unsigned i; int id; memset(&qctrl, 0, sizeof(qctrl)); qctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL; while (::ioctl(fd, VIDIOC_QUERYCTRL, &qctrl) == 0) { if ((qctrl.flags & V4L2_CTRL_FLAG_DISABLED) == 0) { ctrlMap[qctrl.id] = qctrl; if (qctrl.type != V4L2_CTRL_TYPE_CTRL_CLASS) classMap[V4L2_CTRL_ID2CLASS(qctrl.id)].push_back(qctrl.id); } qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL; } if (qctrl.id == V4L2_CTRL_FLAG_NEXT_CTRL) { strcpy((char *)qctrl.name, "User Controls"); qctrl.id = V4L2_CTRL_CLASS_USER | 1; qctrl.type = V4L2_CTRL_TYPE_CTRL_CLASS; ctrlMap[qctrl.id] = qctrl; for (id = V4L2_CID_USER_BASE; id < V4L2_CID_LASTP1; id++) { qctrl.id = id; if (::ioctl(fd, VIDIOC_QUERYCTRL, &qctrl)) continue; if (qctrl.flags & V4L2_CTRL_FLAG_DISABLED) continue; ctrlMap[qctrl.id] = qctrl; classMap[V4L2_CTRL_CLASS_USER].push_back(qctrl.id); } for (qctrl.id = V4L2_CID_PRIVATE_BASE; ::ioctl(fd, VIDIOC_QUERYCTRL, &qctrl) == 0; qctrl.id++) { if (qctrl.flags & V4L2_CTRL_FLAG_DISABLED) continue; ctrlMap[qctrl.id] = qctrl; classMap[V4L2_CTRL_CLASS_USER].push_back(qctrl.id); } } for (ClassMap::iterator iter = classMap.begin(); iter != classMap.end(); ++iter) { ctrl_class = V4L2_CTRL_ID2CLASS(iter->second[0]); id = ctrl_class | 1; const struct v4l2_queryctrl &qctrl = ctrlMap[id]; QVBox *vbox = new QVBox(tabs); QGrid *grid = new QGrid(4, vbox); grid->setSpacing(3); tabs->addTab(vbox, (char *)qctrl.name); for (i = 0; i < iter->second.size(); i++) { if (i & 1) id = iter->second[(1+iter->second.size()) / 2 + i / 2]; else id = iter->second[i / 2]; addCtrl(grid, ctrlMap[id]); } finishGrid(vbox, grid, ctrl_class, i & 1); } }
//-------------------------------------------------------------------------------- RepeatRangeWindow::RepeatRangeWindow( QWidget* parent, const char* name ) : QVBox( parent, name ? name : "RepeatRangeWindow" ) { setSpacing( 6 ); _group = new QVButtonGroup( i18n("Times to Match"), this, "groupbox" ); // Any number of times QRadioButton* radioBut = new QRadioButton(i18n("Any number of times (including zero times)"), _group, "RepeatRangeWindow::choice any times"); _group->insert(radioBut, ANY); QWidget* container = new QWidget( _group ); QHBoxLayout* lay = new QHBoxLayout( container ); QGrid* grid = new QGrid( 3, container ); grid->setSpacing( 5 ); lay->addWidget( grid ); lay->addStretch( 1 ); createLine( grid, i18n( "At least" ), &_leastTimes, ATLEAST ); createLine( grid, i18n( "At most" ), &_mostTimes, ATMOST ); createLine( grid, i18n( "Exactly" ), &_exactlyTimes, EXACTLY ); // from ___ to ___ times radioBut = new QRadioButton(i18n( "From" ), grid, "RepeatRangeWindow::from"); _group->insert( radioBut, MINMAX ); _rangeFrom = new QSpinBox( 1, 999, 1, grid); QHBox* box = new QHBox( grid ); box->setSpacing( 5 ); (void) new QLabel(i18n( "to" ), box); _rangeTo = new QSpinBox( 1, 999, 1, box ); (void) new QLabel( i18n( "time(s)" ), box ); connect( _rangeFrom, SIGNAL( valueChanged( int ) ), this, SLOT( slotUpdateMaxVal( int ) ) ); connect( _rangeTo, SIGNAL( valueChanged( int ) ), this, SLOT( slotUpdateMinVal( int ) ) ); // set a default button. _group->setButton(ANY); slotItemChange( ANY ); connect( _group, SIGNAL( clicked( int ) ), this, SLOT( slotItemChange( int ) ) ); }
ImageTextEditor::ImageTextEditor( QImage& i, QWidget *parent, const char *name, WFlags f ) : QDialog(parent,name,TRUE,f), image(i) { QVBoxLayout* vbox = new QVBoxLayout(this,8); vbox->setAutoAdd(TRUE); QGrid* controls = new QGrid(3,QGrid::Horizontal,this); controls->setSpacing(8); QLabel* l; l=new QLabel("Language",controls); l->setAlignment(AlignCenter); l=new QLabel("Key",controls); l->setAlignment(AlignCenter); (void)new QLabel("",controls); // dummy languages = new QComboBox(controls); keys = new QComboBox(controls); QPushButton* remove = new QPushButton("Remove",controls); newlang = new QLineEdit(controls); newkey = new QLineEdit(controls); QPushButton* add = new QPushButton("Add",controls); text = new QMultiLineEdit(this); QHBox* hbox = new QHBox(this); QPushButton* cancel = new QPushButton("Cancel",hbox); QPushButton* ok = new QPushButton("OK",hbox); connect(add,SIGNAL(clicked()), this,SLOT(addText())); connect(remove,SIGNAL(clicked()), this,SLOT(removeText())); connect(ok,SIGNAL(clicked()), this,SLOT(accept())); connect(cancel,SIGNAL(clicked()), this,SLOT(reject())); connect(languages,SIGNAL(activated(int)), this,SLOT(updateText())); connect(keys,SIGNAL(activated(int)), this,SLOT(updateText())); imageChanged(); }
AppearanceConfig::AppearanceConfig() : QWidget(0, "appearance_config_widget") { QVBoxLayout *top = new QVBoxLayout(this, KDialog::spacingHint()); QHBoxLayout *hbox = new QHBoxLayout(top); QGrid *grid = new QGrid(2, this); grid->setSpacing(KDialog::spacingHint()); hbox->addWidget(grid); for (uint i=0; i<Settings::EnumType::COUNT; i++) { (void)new QLabel(i18n(COLOR_LABELS[i]), grid); KColorButton *cb = new KColorButton(grid, COLOR_CONFIG_NAMES[i]); cb->setFixedWidth(100); } for (uint i=0; i<NB_N_COLORS; i++) { (void)new QLabel(i18n("%n mine color:", "%n mines color:", i+1), grid); KColorButton *cb = new KColorButton(grid, N_COLOR_CONFIG_NAMES[i]); cb->setFixedWidth(100); } hbox->addStretch(1); top->addStretch(1); }
GameConfig::GameConfig() : QWidget(0, "game_config_widget"), _magicDialogEnabled(false) { QVBoxLayout *top = new QVBoxLayout(this, KDialog::spacingHint()); QCheckBox *cb = new QCheckBox(i18n("Enable ? mark"), this, "kcfg_UncertainMark"); top->addWidget(cb); cb = new QCheckBox(i18n("Enable keyboard"), this, "kcfg_KeyboardGame"); top->addWidget(cb); cb = new QCheckBox(i18n("Pause if window loses focus"), this, "kcfg_PauseFocus"); top->addWidget(cb); cb = new QCheckBox(i18n("\"Magic\" reveal"), this, "kcfg_MagicReveal"); QWhatsThis::add(cb, i18n("Set flags and reveal squares where they are trivial.")); connect(cb, SIGNAL(toggled(bool)), SLOT(magicModified(bool))); top->addWidget(cb); top->addSpacing(2 * KDialog::spacingHint()); QHBoxLayout *hbox = new QHBoxLayout(top); QVGroupBox *gb = new QVGroupBox(i18n("Mouse Bindings"), this); hbox->addWidget(gb); QGrid *grid = new QGrid(2, gb); grid->setSpacing(KDialog::spacingHint()); for (uint i=0; i< Settings::EnumButton::COUNT; i++) { (void)new QLabel(i18n(MOUSE_BUTTON_LABELS[i]), grid); QComboBox *cb = new QComboBox(false, grid, MOUSE_CONFIG_NAMES[i]); for (uint k=0; k< (Settings::EnumMouseAction::COUNT-1); k++) cb->insertItem(i18n(MOUSE_ACTION_LABELS[k])); cb->setCurrentItem(i); } hbox->addStretch(1); top->addStretch(1); }
EnvDialog::EnvDialog(bool conv, bool noid) : QDialog(0, "Environment dialog", TRUE), conversion(conv) { setCaption(TR("Environment dialog")); QVBoxLayout * vbox = new QVBoxLayout(this); QHBox * htab; QGrid * grid = new QGrid(2, this); QPushButton * button; QString s; vbox->addWidget(grid); grid->setMargin(5); grid->setSpacing(5); new QLabel(grid); new QLabel(TR("MANDATORY, choose a value between 2 and 127 not used by an other person working at the same time on a project with you.\n" "To be safe, if possible choose a value not used by an other person even not working on a given project with you"), grid); new QLabel(TR("Own identifier "), grid); htab = new QHBox(grid); if (conv) s = getenv("BOUML_ID"); // yes ! else if (! noid) s.setNum(user_id()); ed_id = new QLineEdit(s, htab); if (BrowserView::get_project() != 0) { ed_id->setEnabled(FALSE); new QLabel(TR(" The identifier can't be modified while a project is load"), htab); } // new QLabel(grid); new QLabel(TR("\nOptional, to indicate where are the HTML pages of the reference manual. Used by the help (called by the F1 key) to show the\n" "chapter corresponding to the kind of the element selected in the browser"), grid); new QLabel(TR("Manual path"), grid); htab = new QHBox(grid); ed_doc = new QLineEdit(htab); if (!conv) ed_doc->setText(manual_dir()); new QLabel(" ", htab); button = new QPushButton(TR("Browse"), htab); connect(button, SIGNAL(clicked ()), this, SLOT(doc_browse())); // new QLabel(grid); new QLabel(TR("\nOptional, to indicate a web navigator program. If it is not defined the reference manual will be shown with an internal simple viewer"), grid); new QLabel(TR("Navigator"), grid); htab = new QHBox(grid); ed_navigator = new QLineEdit(htab); if (!conv) ed_navigator->setText(navigator_path()); new QLabel(" ", htab); button = new QPushButton(TR("Browse"), htab); connect(button, SIGNAL(clicked ()), this, SLOT(navigator_browse())); // new QLabel(grid); new QLabel(TR("\nOptional, to indicate a template project. This allows to create new projects getting all the template project settings"), grid); new QLabel("Template project", grid); htab = new QHBox(grid); if (conv) s = getenv("BOUML_TEMPLATE"); // yes ! else s = template_project(); ed_template = new QLineEdit(s, htab); new QLabel(" ", htab); button = new QPushButton(TR("Browse"), htab); connect(button, SIGNAL(clicked ()), this, SLOT(template_browse())); // new QLabel(grid); new QLabel(TR("\nOptional, to indicate a text editor (it must creates an own window). Else Bouml will use an internal editor"), grid); new QLabel(TR("Editor path "), grid); htab = new QHBox(grid); if (conv) s = getenv("BOUML_EDITOR"); // yes ! else s = editor(); ed_editor = new QLineEdit(s, htab); new QLabel(" ", htab); button = new QPushButton(TR("Browse"), htab); connect(button, SIGNAL(clicked ()), this, SLOT(editor_browse())); // new QLabel(grid); new QLabel(TR("\nOptional, to choose a language for menus and dialogs (default is English). You may have to select a corresponding character set"), grid); new QLabel(TR("Translation file path "), grid); htab = new QHBox(grid); ed_lang = new QLineEdit(current_lang(), htab); new QLabel(" ", htab); button = new QPushButton(TR("Browse"), htab); connect(button, SIGNAL(clicked ()), this, SLOT(lang_browse())); // new QLabel(grid); new QLabel(TR("\nOptional, to indicate a character set in case you use non ISO_8859-1/latin1 characters. For instance KOI8-R or KOI8-RU for Cyrillic"), grid); new QLabel(TR("Character set "), grid); cb_charset = new QComboBox(FALSE, grid); cb_charset->setAutoCompletion(completion()); QStringList l; QTextCodec * co; int i = 0; l.append(""); while ((co = QTextCodec::codecForIndex(i++)) != 0) { QString na = co->name(); int pos = 0; while ((pos = na.find(' ', pos)) != -1) na.replace(pos, 1, "_"); if (QTextCodec::codecForName(na) == co) l.append(na); } l.sort(); cb_charset->insertStringList(l); if (conv) s = getenv("BOUML_CHARSET"); // yes ! else s = codec(); if (!s.isEmpty() && ((i = l.findIndex(s)) != -1)) cb_charset->setCurrentItem(i); // new QLabel(grid); new QLabel(TR("\nIn case you have a multiple screens configuration the best for you is to ask Bouml to place by default the dialogs in one of these\n" "screens giving the area, else the dialogs will be shown on the center of the virtual screen."), grid); new QLabel(TR("Default screen "), grid); QString x0, y0, x1, y1; int top, left, bottom, right; if (conv) { const char * limits = getenv("BOUML_LIMIT_DESKTOP"); // yes ! if ((limits != 0) && (sscanf(limits, "%d,%d,%d,%d", &left, &top, &right, &bottom) == 4)) { x0.setNum(left); y0.setNum(top); x1.setNum(right); y1.setNum(bottom); } } else { int top, left, bottom, right; UmlDesktop::limits(left, top, right, bottom); x0.setNum(left); y0.setNum(top); x1.setNum(right); y1.setNum(bottom); } htab = new QHBox(grid); new QLabel(TR("left: "), htab); ed_xmin = new QLineEdit(x0, htab); new QLabel(TR(" top: "), htab); ed_ymin = new QLineEdit(y0, htab); new QLabel(TR(" right: "), htab); ed_xmax = new QLineEdit(x1, htab); new QLabel(TR(" bottom: "), htab); ed_ymax = new QLineEdit(y1, htab); // new QLabel(grid); htab = new QHBox(grid); new QLabel(htab); connect(new QPushButton(TR("OK"), htab), SIGNAL(clicked()), this, SLOT(accept())); new QLabel(htab); if (! conv) { connect(new QPushButton(TR("Cancel"), htab), SIGNAL(clicked()), this, SLOT(reject())); new QLabel(htab); } }
SettingsDialog::SettingsDialog(StateSpecVector * st, ColorSpecVector * co, bool nodefault, bool unchanged, QString title) : QTabDialog(0, title, TRUE), states(st), colors(co), first_visible_page(0), several(unchanged), did_apply(FALSE) { setCaption((title.isEmpty()) ? TR("Diagram Drawing Settings dialog") : title); QString s_diagram = TR("diagram"); QGrid * grid = 0; QString tabname; unsigned i; unsigned n; if (states != 0) { n = states->size(); cbstates = new QVector<ComboStates>(n); for (i = 0; i != n; i += 1) { StateSpec & st = states->at(i); QString s = st.name; int index = s.find('#'); QString tbn; if (index != -1) { tbn = s.left(index); s = s.mid(index + 1); } else tbn = s_diagram; if ((grid == 0) || (tabname != tbn)) { if (grid != 0) { addTab(grid, tabname); grid->setName(tabname); if (tabname == previous_active_tab) first_visible_page = grid; } grid = new QGrid(5, this); grid->setMargin(2); grid->setSpacing(2); tabname = tbn; } new QLabel("", grid); new QLabel(s + " : ", grid); QHBox * hb = new QHBox(grid); switch (st.who) { case StateSpec::is3states: cbstates->insert(i, new ComboStates(hb, *((Uml3States *) st.state), nodefault, unchanged)); break; case StateSpec::isClassDrawingMode: cbstates->insert(i, new ComboStates(hb, *((ClassDrawingMode *) st.state), nodefault, unchanged)); break; case StateSpec::isDrawingLanguage: cbstates->insert(i, new ComboStates(hb, *((DrawingLanguage *) st.state), nodefault, unchanged)); break; case StateSpec::isShowContextMode: cbstates->insert(i, new ComboStates(hb, *((ShowContextMode *) st.state), nodefault, unchanged)); break; default: cbstates->insert(i, new ComboStates(hb, *((char *) st.state), nodefault, unchanged)); } new QLabel("", hb); new QLabel("", grid); new QLabel("", grid); } addTab(grid, tabname); grid->setName(tabname); if (tabname == previous_active_tab) first_visible_page = grid; } if (colors != 0) { QString lbl = TR("color"); QString s_default = TR("default "); n = colors->size(); cbcolors = new QVector<ComboColor>(n); grid = new QGrid(5, this); grid->setMargin(2); grid->setSpacing(2); for (i = 0; i != n; i += 1) { if (i == 11) { lbl = TR("color [1]"); addTab(grid, lbl); grid->setName(lbl); if (previous_active_tab == lbl) first_visible_page = grid; lbl = TR("color [2]"); grid = new QGrid(5, this); grid->setMargin(2); grid->setSpacing(2); } new QLabel("", grid); QString s = colors->at(i).name; s += " : "; new QLabel(s, grid); cbcolors->insert(i, new ComboColor(grid, *(colors->at(i).color), nodefault, unchanged)); new QLabel("", grid); new QLabel("", grid); } addTab(grid, lbl); grid->setName(lbl); if (previous_active_tab == lbl) first_visible_page = grid; } // use help rather than apply because when the OK button is clicked, // the applyButtonPressed() signal is emitted setOkButton(TR("OK")); setHelpButton(TR("Apply")); setCancelButton(TR("Cancel")); connect(this, SIGNAL(helpButtonPressed()), this, SLOT(apply())); }
KURLBarItemDialog::KURLBarItemDialog(bool allowGlobal, const KURL &url, const QString &description, QString icon, bool appLocal, int iconSize, QWidget *parent, const char *name) : KDialogBase(parent, name, true, i18n("Edit Quick Access Entry"), Ok | Cancel, Ok, true) { QVBox *box = new QVBox(this); QString text = i18n("<qt><b>Please provide a description, URL and icon for this Quick Access entry.</b></br></qt>"); QLabel *label = new QLabel(text, box); box->setSpacing(spacingHint()); QGrid *grid = new QGrid(2, box); grid->setSpacing(spacingHint()); QString whatsThisText = i18n( "<qt>This is the text that will appear in the Quick Access panel.<p>" "The description should consist of one or two words " "that will help you remember what this entry refers to.</qt>"); label = new QLabel(i18n("&Description:"), grid); m_edit = new KLineEdit(grid, "description edit"); m_edit->setText(description.isEmpty() ? url.fileName() : description); label->setBuddy(m_edit); QWhatsThis::add(label, whatsThisText); QWhatsThis::add(m_edit, whatsThisText); whatsThisText = i18n( "<qt>This is the location associated with the entry. Any valid URL may be used. For example:<p>" "%1<br>http://www.kde.org<br>ftp://ftp.kde.org/pub/kde/stable<p>" "By clicking on the button next to the text edit box you can browse to an " "appropriate URL.</qt>") .arg(QDir::homeDirPath()); label = new QLabel(i18n("&URL:"), grid); m_urlEdit = new KURLRequester(url.prettyURL(), grid); m_urlEdit->setMode(KFile::Directory); label->setBuddy(m_urlEdit); QWhatsThis::add(label, whatsThisText); QWhatsThis::add(m_urlEdit, whatsThisText); whatsThisText = i18n( "<qt>This is the icon that will appear in the Quick Access panel.<p>" "Click on the button to select a different icon.</qt>"); label = new QLabel(i18n("Choose an &icon:"), grid); m_iconButton = new KIconButton(grid, "icon button"); m_iconButton->setIconSize(iconSize); if(icon.isEmpty()) icon = KMimeType::iconForURL(url); m_iconButton->setIcon(icon); label->setBuddy(m_iconButton); QWhatsThis::add(label, whatsThisText); QWhatsThis::add(m_iconButton, whatsThisText); if(allowGlobal) { QString appName; if(KGlobal::instance()->aboutData()) appName = KGlobal::instance()->aboutData()->programName(); if(appName.isEmpty()) appName = QString::fromLatin1(KGlobal::instance()->instanceName()); m_appLocal = new QCheckBox(i18n("&Only show when using this application (%1)").arg(appName), box); m_appLocal->setChecked(appLocal); QWhatsThis::add(m_appLocal, i18n("<qt>Select this setting if you want this " "entry to show only when using the current application (%1).<p>" "If this setting is not selected, the entry will be available in all " "applications.</qt>") .arg(appName)); } else m_appLocal = 0L; connect(m_urlEdit->lineEdit(), SIGNAL(textChanged(const QString &)), this, SLOT(urlChanged(const QString &))); m_edit->setFocus(); setMainWidget(box); }
MrmlPart::MrmlPart( QWidget *parentWidget, const char * /* widgetName */, QObject *parent, const char *name, const QStringList& /* args */ ) : KParts::ReadOnlyPart( parent, name ), m_job( 0L ), m_status( NeedCollection ) { m_sessionId = QString::number( s_sessionId++ ).prepend("kmrml_"); setName( "MRML Part" ); m_browser = new Browser( this, "mrml browserextension"); setInstance( PartFactory::instance(), true ); // do load plugins :) KConfig *config = PartFactory::instance()->config(); config->setGroup("MRML Settings"); QVBox *box = new QVBox( parentWidget, "main mrml box" ); m_view = new MrmlView( box, "MrmlView" ); connect( m_view, SIGNAL( activated( const KURL&, ButtonState )), this, SLOT( slotActivated( const KURL&, ButtonState ))); connect( m_view, SIGNAL( onItem( const KURL& )), this, SLOT( slotSetStatusBar( const KURL& ))); m_panel = new QHGroupBox( box, "buttons box" ); QGrid *comboGrid = new QGrid( 2, m_panel, "combo grid" ); comboGrid->setSpacing( KDialog::spacingHint() ); (void) new QLabel( i18n("Server to query:"), comboGrid ); m_hostCombo = new KComboBox( false, comboGrid, "host combo" ); initHostCombo(); connect( m_hostCombo, SIGNAL( activated( const QString& ) ), SLOT( slotHostComboActivated( const QString& ))); (void) new QLabel( i18n("Search in collection:"), comboGrid ); m_collectionCombo = new CollectionCombo( comboGrid, "collection-combo" ); // will be re-set in initCollections(), but we need to set it here to // prevent crashes when the connection to the server fails m_collectionCombo->setCollections( &m_collections ); m_algoButton = new QPushButton( QString::null, m_panel ); m_algoButton->setPixmap( SmallIcon("configure") ); m_algoButton->setFixedSize( m_algoButton->sizeHint() ); connect( m_algoButton, SIGNAL( clicked() ), SLOT( slotConfigureAlgorithm() )); QToolTip::add( m_algoButton, i18n("Configure algorithm") ); QWidget *spacer = new QWidget( m_panel ); spacer->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ) ); int resultSize = config->readNumEntry( "Result-size", 20 ); m_resultSizeInput = new KIntNumInput( resultSize, m_panel ); m_resultSizeInput->setRange( 1, 100 ); m_resultSizeInput->setLabel( i18n("Maximum result images:") ); QVBox *tmp = new QVBox( m_panel ); m_random = new QCheckBox( i18n("Random search"), tmp ); m_startButton = new QPushButton( QString::null, tmp ); connect( m_startButton, SIGNAL( clicked() ), SLOT( slotStartClicked() )); setStatus( NeedCollection ); setWidget( box ); // setXMLFile( "mrml_part.rc" ); slotSetStatusBar( QString::null ); enableServerDependentWidgets( false ); }
void KOCRBase::introduceImage( KookaImage* img) { if( ! (img && img->isFileBound()) ) return; KFileMetaInfo info = img->fileMetaInfo(); QStringList groups; if ( info.isValid() ) groups = info.preferredGroups(); delete m_metaBox; m_metaBox = new QVBox( m_imgHBox ); /* Start to create a preview job for the thumb */ KURL::List li(img->url()); KIO::Job *m_job = KIO::filePreview(li, m_previewSize.width(), m_previewSize.height()); if( m_job ) { connect( m_job, SIGNAL( result( KIO::Job * )), this, SLOT( slPreviewResult( KIO::Job * ))); connect( m_job, SIGNAL( gotPreview( const KFileItem*, const QPixmap& )), SLOT( slGotPreview( const KFileItem*, const QPixmap& ) )); /* KIO::Jo result is called in any way: Success, Failed, Error, * thus connecting the failed is not really necessary. */ } for ( QStringList::Iterator it = groups.begin(); it != groups.end(); ++it ) { QString theGroup(*it); kdDebug(29000) << "handling the group " << theGroup << endl; QStringList keys = info.group(theGroup).supportedKeys(); if( keys.count() > 0 ) { // info.groupInfo( theGroup )->translatedName() // FIXME: howto get the translated group name? QLabel *lGroup = new QLabel( theGroup, m_metaBox ); lGroup->setBackgroundColor( QColor(gray)); lGroup->setMargin( KDialog::spacingHint()); QGrid *nGrid = new QGrid( 2, m_metaBox ); nGrid->setSpacing( KDialog::spacingHint()); for ( QStringList::Iterator keyIt = keys.begin(); keyIt != keys.end(); ++keyIt ) { KFileMetaInfoItem item = info.item(*keyIt); QString itKey = item.translatedKey(); if( itKey.isEmpty() ) itKey = item.key(); if( ! itKey.isEmpty() ) { (void) new QLabel( item.translatedKey() + ": ", nGrid ); (void) new QLabel( item.string(), nGrid ); kdDebug(29000) << "hasKey " << *keyIt << endl; } } } } QWidget *spaceEater = new QWidget( m_metaBox ); spaceEater->setSizePolicy( QSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored )); m_metaBox->show(); }
UseCaseDialog::UseCaseDialog(UseCaseData * u) : QTabDialog(0, 0, FALSE, WDestructiveClose), uc(u) { BrowserNode * bn = u->browser_node; bn->edit_start(); if (bn->is_writable()) { setOkButton(TR("OK")); setCancelButton(TR("Cancel")); } else { setOkButton(QString::null); setCancelButton(TR("Close")); } setCaption(TR("Use Case dialog")); bool visit = !hasOkButton(); // general tab QGrid * grid = new QGrid(2, this); grid->setMargin(5); grid->setSpacing(5); new QLabel(TR("name : "), grid); edname = new LineEdit(bn->get_name(), grid); edname->setReadOnly(visit); new QLabel(TR("stereotype : "), grid); edstereotype = new QComboBox(!visit, grid); edstereotype->insertItem(toUnicode(uc->get_stereotype())); if (! visit) { edstereotype->insertStringList(BrowserUseCase::default_stereotypes()); edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlUseCase)); edstereotype->setAutoCompletion(completion()); } edstereotype->setCurrentItem(0); QSizePolicy sp = edstereotype->sizePolicy(); sp.setHorData(QSizePolicy::Expanding); edstereotype->setSizePolicy(sp); new QLabel(TR("extension \npoints : "), grid); extension_points = new MultiLineEdit(grid); extension_points->setReadOnly(visit); extension_points->setText(uc->get_extension_points()); QFont font = extension_points->font(); if (! hasCodec()) font.setFamily("Courier"); font.setFixedPitch(TRUE); extension_points->setFont(font); QVBox * vtab = new QVBox(grid); new QLabel(TR("description :"), vtab); if (! visit) connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()), this, SLOT(edit_description())); comment = new MultiLineEdit(grid); comment->setReadOnly(visit); comment->setText(bn->get_comment()); comment->setFont(font); addTab(grid, "Uml"); // USER : list key - value grid = new QGrid(2, this); grid->setMargin(5); grid->setSpacing(5); kvtable = new KeyValuesTable(bn, grid, visit); addTab(grid, TR("Properties")); open_dialog(this); }
SimpleRelationDialog::SimpleRelationDialog(SimpleRelationData * r) : QTabDialog(0, 0, FALSE, WDestructiveClose), rel(r) { r->browser_node->edit_start(); if (r->browser_node->is_writable()) { setOkButton(TR("OK")); setCancelButton(TR("Cancel")); } else { setOkButton(QString::null); setCancelButton(TR("Close")); } bool visit = !hasOkButton(); // general tab BrowserNode * bn = rel->get_browser_node(); QGrid * grid = new QGrid(2, this); grid->setMargin(5); grid->setSpacing(5); switch (rel->get_type()) { case UmlInherit: setCaption(TR("Generalisation dialog")); break; case UmlDependOn: setCaption(TR("Dependency dialog")); break; default: setCaption(TR("unknown relation dialog")); break; } new QLabel(TR("from : "), grid); new QLabel(rel->get_start_node()->full_name(TRUE), grid); new QLabel(TR("to : "), grid); new QLabel(rel->get_end_node()->full_name(TRUE), grid); new QLabel(TR("stereotype : "), grid); edstereotype = new QComboBox(!visit, grid); edstereotype->insertItem(toUnicode(rel->get_stereotype())); if (! visit) { edstereotype->insertStringList(rel->get_start_node() ->default_stereotypes(rel->get_type(), rel->get_end_node())); edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlRelations)); edstereotype->setAutoCompletion(completion()); } edstereotype->setCurrentItem(0); QSizePolicy sp = edstereotype->sizePolicy(); sp.setHorData(QSizePolicy::Expanding); edstereotype->setSizePolicy(sp); QVBox * vtab = new QVBox(grid); new QLabel(TR("description :"), vtab); if (! visit) connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()), this, SLOT(edit_description())); comment = new MultiLineEdit(grid); comment->setReadOnly(visit); comment->setText(bn->get_comment()); QFont font = comment->font(); if (! hasCodec()) font.setFamily("Courier"); font.setFixedPitch(TRUE); comment->setFont(font); addTab(grid, "Uml"); // USER : list key - value grid = new QGrid(2, this); grid->setMargin(5); grid->setSpacing(5); kvtable = new KeyValuesTable(bn, grid, visit); addTab(grid, TR("Properties")); open_dialog(this); }
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; }
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; }
StateDialog::StateDialog(StateData * d) : QTabDialog(0, 0, FALSE, WDestructiveClose), state(d) { d->browser_node->edit_start(); if (d->browser_node->is_writable()) { setOkButton(TR("OK")); setCancelButton(TR("Cancel")); } else { setOkButton(QString::null); setCancelButton(TR("Close")); } setCaption(TR("State dialog")); visit = !hasOkButton(); BrowserNode * bn = state->browser_node; QGrid * grid; // // general tab // grid = new QGrid(2, this); umltab = grid; grid->setMargin(5); grid->setSpacing(5); new QLabel(TR("name : "), grid); edname = new LineEdit(bn->get_name(), grid); edname->setReadOnly(visit); new QLabel(TR("stereotype : "), grid); edstereotype = new QComboBox(!visit, grid); edstereotype->insertItem(toUnicode(state->get_stereotype())); if (!visit) { edstereotype->insertStringList(BrowserState::default_stereotypes()); edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlState)); edstereotype->setAutoCompletion(completion()); } edstereotype->setCurrentItem(0); QSizePolicy sp = edstereotype->sizePolicy(); sp.setHorData(QSizePolicy::Expanding); edstereotype->setSizePolicy(sp); connect(new SmallPushButton(TR("specification :"), grid), SIGNAL(clicked()), this, SLOT(menu_specification())); edspecification = new QComboBox(FALSE, grid); edspecification->setSizePolicy(sp); if (visit) { if (state->get_specification() == 0) edspecification->insertItem(""); else edspecification->insertItem(state->get_specification()->full_name(TRUE)); } else { edspecification->insertItem(""); edspecification->setAutoCompletion(completion()); BrowserOperation::instances(opers); opers.full_names(speclist); edspecification->insertStringList(speclist); edspecification->setCurrentItem((state->get_specification() == 0) ? 0 : opers.findRef(state->get_specification()) + 1); } switch (((BrowserNode *) bn->parent())->get_type()) { case UmlState: case UmlRegion: if ((state->get_reference() != 0) || (bn->firstChild() == 0)) { connect(new SmallPushButton(TR("reference :"), grid), SIGNAL(clicked()), this, SLOT(menu_reference())); edreference = new QComboBox(FALSE, grid); edreference->setSizePolicy(sp); if (visit) { if (state->get_reference() == 0) edreference->insertItem(""); else edreference->insertItem(state->get_reference()->full_name(TRUE)); } else { edreference->insertItem(""); edreference->setAutoCompletion(completion()); if (((BrowserState *) bn)->can_reference()) { BrowserState::instances(states, TRUE); BrowserNode * st = states.first(); while (st != 0) { if (!((BrowserState *) bn)->can_reference((BrowserState *) st) || ((BrowserState *) st)->is_ref()) { states.remove(); st = states.current(); } else st = states.next(); } } else states.append(state->get_reference()); states.full_names(reflist); edreference->insertStringList(reflist); edreference->setCurrentItem((state->get_reference() == 0) ? 0 : states.findRef(state->get_reference()) + 1); connect(edreference, SIGNAL(activated(int)), this, SLOT(ed_ref_activated(int))); } break; } // no break default: edreference = 0; }