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())); }
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); } }
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; }