Beispiel #1
0
void ActivityDialog::init_tab(CondDialog & d, InfoData & cd,
                              const char * lbl, bool enabled)
{
    Q3Grid * grid = new Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    new QLabel(TR("Pre\ncondition : "), grid);
    d.edpre = new MultiLineEdit(grid);
    d.edpre->setText(cd.first);

    if (visit)
        d.edpre->setReadOnly(TRUE);

    new QLabel(TR("Post\ncondition : "), grid);
    d.edpost = new MultiLineEdit(grid);
    d.edpost->setText(cd.second);

    if (visit)
        d.edpost->setReadOnly(TRUE);

    addTab(grid, lbl);

    if (! enabled)
        removePage(grid);
}
Beispiel #2
0
void PinDialog::init_tab(QWidget *& tab, MultiLineEdit *& ed, const char * v,
			 const char * lbl, const char * sl, bool enabled) {
  bool visit = !hasOkButton();
  Q3Grid * grid = new Q3Grid(2, this);

  tab = grid;
  grid->setMargin(5);
  grid->setSpacing(5);
  
  Q3VBox * vtab = new Q3VBox(grid);
  
  new QLabel(TR("selection : "), vtab);
  if (! visit)
    connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()), this, sl);
  ed = new MultiLineEdit(grid);

  QFont font = ed->font();

  if (! hasCodec())
    font.setFamily("Courier");
  font.setFixedPitch(TRUE);
  ed->setFont(font);
  ed->setText(v);
  if (visit)
    ed->setReadOnly(TRUE);
  
  addTab(grid, lbl);
  
  if (! enabled)
    removePage(grid);
}
Beispiel #3
0
HCircleView::HCircleView( int viewID_, QWidget *parent )
 : ViewWidget( viewID_, parent)
{
  setCaption("Harmonic Circle");

Q3BoxLayout *mainLayout = new Q3HBoxLayout(this);

  Q3BoxLayout *leftLayout = new Q3VBoxLayout(mainLayout);
  Q3BoxLayout *rightLayout = new Q3VBoxLayout(mainLayout);
 
  Q3Grid *waveFrame = new Q3Grid(1, this);
  waveFrame->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
  leftLayout->addWidget(waveFrame);

  hCircleWidget = new HCircleWidget(waveFrame);

  Q3BoxLayout *bottomLayout = new Q3HBoxLayout(leftLayout);
 
  QwtWheel* ZoomWheel = new QwtWheel(this);
  ZoomWheel->setOrientation(Qt::Vertical);
  ZoomWheel->setWheelWidth(14);
  ZoomWheel->setRange(0.001, 0.1, 0.001, 1);
  ZoomWheel->setValue(0.007);
  hCircleWidget->setZoom(0.007);
  QToolTip::add(ZoomWheel, "Zoom in or out");
  rightLayout->addWidget(ZoomWheel);
  
  QwtWheel* lowestValueWheel = new QwtWheel(this);
  lowestValueWheel->setOrientation(Qt::Vertical);
  lowestValueWheel->setWheelWidth(14);
  lowestValueWheel->setRange(-160, 10, 0.01, 1);
  lowestValueWheel->setValue(-100);
  hCircleWidget->setLowestValue(-100);
  QToolTip::add(lowestValueWheel, "Change the lowest value");
  rightLayout->addWidget(lowestValueWheel);
  rightLayout->addStretch(2);
 
  QwtWheel* thresholdWheel = new QwtWheel(this);
  thresholdWheel->setOrientation(Qt::Horizontal);
  thresholdWheel->setWheelWidth(14);
  thresholdWheel->setRange(-160, 10, 0.01, 1);
  thresholdWheel->setValue(-100);
  hCircleWidget->setThreshold(-100);
  QToolTip::add(thresholdWheel, "Change the harmonic threshold");
  bottomLayout->addWidget(thresholdWheel);
  bottomLayout->addStretch(2);

  connect(ZoomWheel, SIGNAL(valueChanged(double)), hCircleWidget, SLOT(setZoom(double)));
  connect(ZoomWheel, SIGNAL(valueChanged(double)), hCircleWidget, SLOT(update()));

  connect(lowestValueWheel, SIGNAL(valueChanged(double)), hCircleWidget, SLOT(setLowestValue(double)));
  connect(lowestValueWheel, SIGNAL(valueChanged(double)), hCircleWidget, SLOT(update()));

  connect(thresholdWheel, SIGNAL(valueChanged(double)), hCircleWidget, SLOT(setThreshold(double)));
  connect(thresholdWheel, SIGNAL(valueChanged(double)), hCircleWidget, SLOT(update()));

}
void ParameterSetDialog::init_uml_tab()
{
    bool visit = !hasOkButton();

    BrowserParameterSet * bn =
        (BrowserParameterSet *) data->get_browser_node();
    Q3VBox * vbox;
    Q3Grid * grid = new Q3Grid(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 Q3ComboBox(TRUE, grid);
    edstereotype->insertItem(toUnicode(data->get_stereotype()));

    if (! visit) {
        edstereotype->insertStringList(BrowserParameterSet::default_stereotypes());
        edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlParameterSet));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentItem(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorData(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    vbox = new Q3VBox(grid);
    new QLabel(TR("description :"), vbox);

    if (! visit) {
        connect(new SmallPushButton(TR("Editor"), vbox), 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");
}
Beispiel #5
0
ComponentDialog::ComponentDialog(SimpleData * nd)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), data(nd)
{
    nd->get_browser_node()->edit_start();

    if (nd->get_browser_node()->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setCaption(TR("component dialog"));

    BrowserComponent * bn = (BrowserComponent *) nd->get_browser_node();

    init_uml_tab();
    rqs = bn->get_required_classes();
    init_l_tab(rq_page, rq_stereotypefilter, &ComponentDialog::rq_stereotypeFilterActivated,
               SLOT(rq_stereotypeFilterActivated(const QString &)),
               SLOT(require_cls()), SLOT(unrequire_cls()),
               lb_rq_available, lb_rq, rqs, TR("Required classes"));
    prs = bn->get_provided_classes();
    init_l_tab(pr_page, pr_stereotypefilter, &ComponentDialog::pr_stereotypeFilterActivated,
               SLOT(pr_stereotypeFilterActivated(const QString &)),
               SLOT(provide_cls()), SLOT(unprovide_cls()),
               lb_pr_available, lb_pr, prs, TR("Provided classes"));
    rzs = bn->get_realizing_classes();
    init_l_tab(rz_page, rz_stereotypefilter, &ComponentDialog::rz_stereotypeFilterActivated,
               SLOT(rz_stereotypeFilterActivated(const QString &)),
               SLOT(realize_cls()), SLOT(unrealize_cls()),
               lb_rz_available, lb_rz, rzs, TR("Realizing classes"));

    // USER : list key - value

    Q3Grid * grid = new Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable((BrowserComponent *) data->get_browser_node(),
                                 grid, !hasOkButton());
    addTab(grid, TR("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
ParameterSetDialog::ParameterSetDialog(ParameterSetData * nd)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), data(nd)
{
    nd->browser_node->edit_start();

    if (nd->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setCaption(TR("ParameterSet dialog"));

    init_uml_tab();
    init_pins_tab();

    // USER : list key - value

    Q3Grid * grid = new Q3Grid(2, this);

    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable((BrowserParameterSet *) data->get_browser_node(),
                                 grid, !hasOkButton());
    addTab(grid, TR("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Beispiel #7
0
FlowDialog::FlowDialog(FlowData * d)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), flow(d)
{
    d->browser_node->edit_start();

    if (d->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setCaption(TR("Flow dialog"));
    visit = !hasOkButton();

    BrowserNode * bn = flow->browser_node;
    Q3Grid * grid;

    //
    // general tab
    //

    grid = new Q3Grid(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 Q3ComboBox(!visit, grid);
    edstereotype->insertItem(toUnicode(flow->get_stereotype()));

    if (!visit) {
        edstereotype->insertStringList(BrowserFlow::default_stereotypes());
        edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlFlow));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentItem(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorData(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    Q3VBox * vtab = new Q3VBox(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());

    addTab(grid, "Uml");

    // UML / OCL
    init_tab(uml, flow->uml, "Ocl", SLOT(edit_uml_guard()),
             SLOT(edit_uml_selection()), SLOT(edit_uml_transformation()),
             TRUE);

    // CPP
    init_tab(cpp, flow->cpp, "C++", SLOT(edit_cpp_guard()),
             SLOT(edit_cpp_selection()), SLOT(edit_cpp_transformation()),
             GenerationSettings::cpp_get_default_defs());

    // Java
    init_tab(java, flow->java, "Java", SLOT(edit_java_guard()),
             SLOT(edit_java_selection()), SLOT(edit_java_transformation()),
             GenerationSettings::java_get_default_defs());

    // USER : list key - value

    grid = new Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable(bn, grid, visit);
    addTab(grid, TR("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Beispiel #8
0
StateDialog::StateDialog(StateData * d)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), state(d)
{
    d->browser_node->edit_start();

    if (d->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setCaption(TR("State dialog"));
    visit = !hasOkButton();

    BrowserNode * bn = state->browser_node;
    Q3Grid * grid;

    //
    // general tab
    //

    grid = new Q3Grid(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 Q3ComboBox(!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 Q3ComboBox(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 Q3ComboBox(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;
    }
ActivityPartitionDialog::ActivityPartitionDialog(ActivityPartitionData * d)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), data(d)
{
    d->browser_node->edit_start();

    if (d->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setCaption(TR("Activity Partition dialog"));

    bool visit = !hasOkButton();

    // general tab

    BrowserNode * bn = data->get_browser_node();
    Q3Grid * grid = new Q3Grid(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 Q3ComboBox(!visit, grid);
    edstereotype->insertItem(toUnicode(data->get_stereotype()));

    if (! visit) {
        edstereotype->insertStringList(BrowserActivityPartition::default_stereotypes());
        edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlActivityPartition));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentItem(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorData(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    connect(new SmallPushButton(TR("represents :"), grid), SIGNAL(clicked()),
            this, SLOT(menu_represents()));
    edrepresents = new Q3ComboBox(FALSE, grid);

    if ((data->represents != 0) && !data->represents->deletedp()) {
        represented = data->represents;
        edrepresents->insertItem(*(data->represents->pixmap(0)),
                                 data->represents->full_name(TRUE));
    }
    else {
        represented = 0;
        edrepresents->insertItem("");
    }

    if (! visit)
        edrepresents->insertItem("");

    edrepresents->setCurrentItem(0);
    edrepresents->setSizePolicy(sp);

    Q3HBox * htab;

    new QLabel(grid);
    htab = new Q3HBox(grid);
    new QLabel("  ", htab);
    dimension_cb = new QCheckBox(TR("is dimension"), htab);

    if (data->is_dimension)
        dimension_cb->setChecked(TRUE);

    dimension_cb->setDisabled(visit);
    new QLabel("", htab);
    external_cb = new QCheckBox(TR("is external"), htab);

    if (data->is_external)
        external_cb->setChecked(TRUE);

    external_cb->setDisabled(visit);
    new QLabel("", htab);

    Q3VBox * vtab = new Q3VBox(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 Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable(bn, grid, visit);
    addTab(grid, TR("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Beispiel #10
0
ActivityDialog::ActivityDialog(ActivityData * d)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), activity(d)
{
    d->browser_node->edit_start();

    if (d->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setCaption(TR("Activity dialog"));
    visit = !hasOkButton();

    BrowserNode * bn = activity->browser_node;
    Q3Grid * grid;

    //
    // general tab
    //

    grid = new Q3Grid(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 Q3ComboBox(!visit, grid);
    edstereotype->insertItem(toUnicode(activity->get_stereotype()));

    if (!visit) {
        edstereotype->insertStringList(BrowserActivity::default_stereotypes());
        edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlActivity));
        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 Q3ComboBox(FALSE, grid);
    edspecification->setSizePolicy(sp);

    if (visit) {
        if (activity->get_specification() == 0)
            edspecification->insertItem("");
        else
            edspecification->insertItem(activity->get_specification()->full_name(TRUE));
    }
    else {
        edspecification->insertItem("");
        edspecification->setAutoCompletion(completion());
        BrowserOperation::instances(opers);
        opers.full_names(list);
        edspecification->insertStringList(list);
        edspecification->setCurrentItem((activity->get_specification() == 0)
                                        ? 0
                                        : opers.findRef(activity->get_specification()) + 1);
    }

    new QLabel(grid);
    Q3ButtonGroup * bg =
        new Q3ButtonGroup(3, Qt::Horizontal, QString(), grid);

    readonly_cb = new QCheckBox(TR("read only"), bg);

    if (activity->read_only)
        readonly_cb->setChecked(TRUE);

    readonly_cb->setDisabled(visit);

    singlexec_cb = new QCheckBox(TR("single execution"), bg);

    if (activity->single_execution)
        singlexec_cb->setChecked(TRUE);

    singlexec_cb->setDisabled(visit);

    active_cb = new QCheckBox(TR("active"), bg);

    if (activity->is_active)
        active_cb->setChecked(TRUE);

    active_cb->setDisabled(visit);

    Q3VBox * vtab = new Q3VBox(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);

    vtab = new Q3VBox(grid);
    new QLabel(TR("constraint :"), vtab);

    if (! visit) {
        connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
                this, SLOT(edit_constraint()));
    }

    constraint = new MultiLineEdit(grid);
    constraint->setReadOnly(visit);
    constraint->setText(activity->constraint);
    //constraint->setFont(font);

    addTab(grid, "Uml");

    // UML / OCL
    init_tab(uml, activity->uml_condition, "Ocl", TRUE);

    // CPP
    init_tab(cpp, activity->cpp_condition, "C++",
             GenerationSettings::cpp_get_default_defs());

    // Java
    init_tab(java, activity->java_condition, "Java",
             GenerationSettings::java_get_default_defs());

    // USER : list key - value

    grid = new Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable(bn, grid, visit);
    addTab(grid, TR("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}
Beispiel #11
0
EnvDialog::EnvDialog(bool conv, bool noid)
    : QDialog(0, "Environment dialog", TRUE), conversion(conv)
{
    setCaption(TR("Environment dialog"));

    Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
    Q3HBox * htab;
    Q3Grid * grid = new Q3Grid(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 Q3HBox(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 Q3HBox(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 Q3HBox(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 Q3HBox(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 Q3HBox(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 Q3HBox(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 Q3ComboBox(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())
        s = "UTF-8";

    if((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 Q3HBox(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 Q3HBox(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);
    }
}
Beispiel #12
0
UseCaseDialog::UseCaseDialog(UseCaseData * u)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), uc(u)
{
    BrowserNode * bn = u->browser_node;

    bn->edit_start();

    if (bn->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    setCaption(TR("Use Case dialog"));

    bool visit = !hasOkButton();

    // general tab

    Q3Grid * grid = new Q3Grid(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 Q3ComboBox(!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);

    Q3VBox * vtab = new Q3VBox(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 Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable(bn, grid, visit);
    addTab(grid, TR("Properties"));

    open_dialog(this);
}
Beispiel #13
0
AttributeDialog::AttributeDialog(AttributeData * a, bool new_st_attr)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose),
      new_in_st(new_st_attr), att(a) {
  a->browser_node->edit_start();
  
  if (a->browser_node->is_writable()) {
    setOkButton(TR("OK"));
    setCancelButton(TR("Cancel"));
  }
  else {
    setOkButton(QString::null);
    setCancelButton(TR("Close"));
  }
  
  visit = !hasOkButton();
  ClassData * cld = (ClassData *) 
    ((BrowserNode *) a->browser_node->parent())->get_data();
  QString stereotype = cld->get_stereotype();
  QString lang_st;
  
  in_enum = (stereotype == "enum");
  
  lang_st = GenerationSettings::cpp_class_stereotype(stereotype);
  cpp_in_enum = in_enum || (lang_st == "enum");
  cpp_ignored = !cpp_in_enum && ((lang_st == "typedef") || (lang_st == "ignored"));
  
  lang_st = GenerationSettings::java_class_stereotype(stereotype);
  java_in_enum = in_enum || (lang_st == "enum");
  java_in_enum_pattern = !java_in_enum && (lang_st == "enum_pattern");
  java_ignored = (lang_st == "ignored");
  
  lang_st = GenerationSettings::php_class_stereotype(stereotype);
  php_in_enum = in_enum || (lang_st == "enum");
  php_ignored = !php_in_enum && (lang_st == "ignored");
  
  lang_st = GenerationSettings::python_class_stereotype(stereotype);
  python_in_enum = in_enum || (lang_st == "enum");
  python_ignored = !python_in_enum && (lang_st == "ignored");
  
  lang_st = GenerationSettings::idl_class_stereotype(stereotype);
  idl_in_enum = in_enum || (lang_st == "enum");
  idl_in_typedef = !idl_in_enum && (lang_st == "typedef");
  idl_in_struct = !idl_in_enum && ((lang_st == "struct") || (lang_st == "exception"));
  idl_in_union = !idl_in_enum && (lang_st == "union");
  
  setCaption((in_enum || java_in_enum_pattern) ? TR("Enum item dialog") : TR("Attribute dialog"));
  
  Q3Grid * grid;
  Q3HBox * htab;
  QString s;
    
  // general tab
  
  grid = new Q3Grid(2, this);
  umltab = grid;
  grid->setMargin(5);
  grid->setSpacing(5);
  
  new QLabel(TR("class : "), grid);
  new QLabel(((BrowserNode *) a->get_browser_node()->parent())->full_name(TRUE),
	     grid);
  
  new QLabel(TR("name :"), grid);
  edname = new LineEdit(a->name(), grid);
  edname->setReadOnly(visit);

  QFont font = edname->font();
  if (! hasCodec())
    font.setFamily("Courier");
  font.setFixedPitch(TRUE);
  
  if (!java_in_enum_pattern) {
    new QLabel(TR("stereotype :"), grid);
    htab = new Q3HBox(grid);
    edstereotype = new Q3ComboBox(!visit, htab);
    edstereotype->insertItem(toUnicode(a->get_stereotype()));
    if (!visit) {
      edstereotype->insertStringList(BrowserAttribute::default_stereotypes());
      edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlAttribute));
      if (java_in_enum) {
	int n = edstereotype->count();
	
	for (attribute_st_rank = 0; attribute_st_rank != n; attribute_st_rank += 1)
	  if (edstereotype->text(attribute_st_rank) == "attribute")
	    break;
	     
	if (attribute_st_rank == n) {
	  edstereotype->insertItem("attribute");
	  n += 1;
	}
	
	for (empty_st_rank = 0; empty_st_rank != n; empty_st_rank += 1)
	  if (edstereotype->text(empty_st_rank).isEmpty())
	    break;
	     
	if (empty_st_rank == n)
	  edstereotype->insertItem("");
      }
      edstereotype->setAutoCompletion(completion());
    }
    edstereotype->setCurrentItem(0);
    
    QSizePolicy sp = edstereotype->sizePolicy();
    
    sp.setHorData(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);
    
    new QLabel(TR("    multiplicity :  "), htab);
    multiplicity = new Q3ComboBox(!visit, htab);
    multiplicity->setSizePolicy(sp);
    previous_multiplicity = a->get_multiplicity();
    multiplicity->insertItem(previous_multiplicity);
    if (!visit) {
      multiplicity->insertItem("1");
      multiplicity->insertItem("0..1");
      multiplicity->insertItem("*");
      multiplicity->insertItem("1..*");
    }
    
    connect(new SmallPushButton(TR("type :"), grid), SIGNAL(clicked()),
	    this, SLOT(menu_type()));    
    edtype = new Q3ComboBox(!visit, grid);
    edtype->insertItem(a->get_type().get_full_type());
    BrowserClass::instances(nodes);
    nodes.full_names(list);        
    if (!visit) {
      QStringList l = GenerationSettings::basic_types();
      
      cld->addFormals(l);
      edtype->insertStringList(l);
      offset = edtype->count();
      edtype->insertStringList(list);
      edtype->setAutoCompletion(completion());
      view = a->browser_node->container(UmlClass);
    }
    edtype->setCurrentItem(0);
    edtype->setSizePolicy(sp);

    new QLabel(TR("initial value :"), grid);
  }
  else {
    multiplicity = 0;
    new QLabel(TR("value :"), grid);
  }
  
  htab = new Q3HBox(grid);
  edinit = new LineEdit(a->get_init_value(), htab);
  if (visit)
    edinit->setReadOnly(TRUE);
  else
    connect(new SmallPushButton(TR("Editor"), htab), SIGNAL(clicked()),
	    this, SLOT(edit_init()));

  Q3ButtonGroup * bg;
  
  if (!java_in_enum_pattern) {  
    new QLabel(grid);
    
    htab = new Q3HBox(grid);
    bg = uml_visibility.init(htab, a->get_uml_visibility(), TRUE);
    if (visit)
      bg->setEnabled(FALSE);
    
    bg = new Q3ButtonGroup(7, Qt::Horizontal, QString::null, htab);
    bg->setExclusive(FALSE);
    classattribute_cb = new QCheckBox("static", bg);
    if (a->get_isa_class_attribute())
      classattribute_cb->setChecked(TRUE);
    classattribute_cb->setDisabled(visit);
    
    volatile_cb = new QCheckBox("volatile", bg);
    if (a->isa_volatile_attribute)
      volatile_cb->setChecked(TRUE);
    volatile_cb->setDisabled(visit);
    
    constattribute_cb = new QCheckBox(TR("read-only"), bg);
    if (a->get_isa_const_attribute())
      constattribute_cb->setChecked(TRUE);
    constattribute_cb->setDisabled(visit);
    
    derived_cb = new QCheckBox(TR("derived"), bg);
    if (a->get_is_derived())
      derived_cb->setChecked(TRUE);
    derived_cb->setDisabled(visit);
    connect(derived_cb, SIGNAL(toggled(bool)), SLOT(derived_changed(bool)));
    
    derivedunion_cb = new QCheckBox("union", bg);
    if (a->get_is_derivedunion())
      derivedunion_cb->setChecked(TRUE);
    derivedunion_cb->setDisabled(visit || !derived_cb->isChecked());
    
    ordered_cb = new QCheckBox(TR("ordered"), bg);
    if (a->get_is_ordered())
      ordered_cb->setChecked(TRUE);
    ordered_cb->setDisabled(visit);
    
    unique_cb = new QCheckBox("unique", bg);
    if (a->get_is_unique())
      unique_cb->setChecked(TRUE);
    unique_cb->setDisabled(visit);
  }
  
  Q3VBox * vtab = new Q3VBox(grid);
  
  new QLabel(TR("description :"), vtab);
  if (! visit) {
    connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
	    this, SLOT(edit_description()));
    connect(new SmallPushButton(TR("Default"), vtab), SIGNAL(clicked()),
	    this, SLOT(default_description()));
  }
  comment = new MultiLineEdit(grid);
  comment->setReadOnly(visit);
  comment->setText(a->browser_node->get_comment());
  comment->setFont(font);
  
  vtab = new Q3VBox(grid);
  new QLabel(TR("constraint :"), vtab);
  if (! visit) {
    connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()),
	    this, SLOT(edit_constraint()));
  }
  constraint = new MultiLineEdit(grid);
  constraint->setReadOnly(visit);
  constraint->setText(a->constraint);
  constraint->setFont(font);
  
  addTab(grid, "Uml");
  
  // C++
  
  if (! cpp_ignored) {
    grid = new Q3Grid(2, this);
    cpptab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);
    
    if (!cpp_in_enum) {  
      new QLabel(TR("Visibility :"), grid);
      htab = new Q3HBox(grid);
      
      Q3ButtonGroup * bg =
	cpp_visibility.init(htab, a->get_cpp_visibility(), FALSE, 0, TR("follow uml"));
      
      if (visit)
	bg->setEnabled(FALSE);
      
      new QLabel(" ", htab);
      
      mutable_cb = new QCheckBox("mutable", htab);
      if (a->cpp_mutable)
	mutable_cb->setChecked(TRUE);
      if (visit)
	mutable_cb->setDisabled(TRUE);
      else
	connect(mutable_cb, SIGNAL(toggled(bool)), this, SLOT(cpp_update()));
    }
Beispiel #14
0
Dialog::Dialog() : QDialog(0, 0, TRUE)
{
    Q3VBoxLayout * vbox = new Q3VBoxLayout(this);
    Q3VGroupBox * gbox;
    Q3HButtonGroup * bg;
    Q3HBox * htab;

    vbox->setMargin(5);

    gbox = new Q3VGroupBox("Filters" , this);
    vbox->addWidget(gbox);

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    new QLabel("filter 1 : ", htab);
    filter1_le = new LineEdit(htab);

    new QLabel("  ", htab);

    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    with1_rb = new QRadioButton("with", bg);
    new QRadioButton("without", bg);
    with1_rb->setChecked(TRUE);

    //

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    new QLabel("", htab);
    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    and12_rb = new QRadioButton("and", bg);
    new QRadioButton("or", bg);
    and12_rb->setChecked(TRUE);

    new QLabel("", htab);

    //

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    new QLabel("filter 2 : ", htab);
    filter2_le = new LineEdit(htab);

    new QLabel("  ", htab);

    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    with2_rb = new QRadioButton("with", bg);
    new QRadioButton("without", bg);
    with2_rb->setChecked(TRUE);

    //

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    new QLabel("", htab);
    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    and23_rb = new QRadioButton("and", bg);
    new QRadioButton("or", bg);
    and23_rb->setChecked(TRUE);

    new QLabel("", htab);

    //

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    new QLabel("filter 3 : ", htab);
    filter3_le = new LineEdit(htab);

    new QLabel("  ", htab);

    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    with3_rb = new QRadioButton("with", bg);
    new QRadioButton("without", bg);
    with3_rb->setChecked(TRUE);

    //
    //

    gbox = new Q3VGroupBox("Stereotype" , this);
    vbox->addWidget(gbox);

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    bg = new Q3HButtonGroup(htab);
    bg->setRadioButtonExclusive(TRUE);

    any_rb = new QRadioButton("any", bg);
    is_rb = new QRadioButton("is", bg);
    isnot_rb = new QRadioButton("is not", bg);
    any_rb->setChecked(TRUE);
    stereotype_le = new QLineEdit(htab);

    //
    //

    gbox = new Q3VGroupBox("Targets" , this);
    vbox->addWidget(gbox);

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    artifact_cb = new QCheckBox("artifact", htab);
    class_cb = new QCheckBox("class", htab);
    operation_cb = new QCheckBox("operation", htab);
    attribute_cb = new QCheckBox("attribute", htab);
    relation_cb = new QCheckBox("relation", htab);

    //
    //

    gbox = new Q3VGroupBox("Languages" , this);
    vbox->addWidget(gbox);

    htab = new Q3HBox(gbox);
    //htab->setMargin(5);

    cpp_cb = new QCheckBox("C++", htab);
    java_cb = new QCheckBox("Java", htab);
    php_cb = new QCheckBox("Php", htab);
    python_cb = new QCheckBox("Python", htab);
    idl_cb = new QCheckBox("Idl", htab);

    //
    //

    Q3Grid * grid = new Q3Grid(2, this);
    vbox->addWidget(grid);
    grid->setMargin(5);
    grid->setSpacing(5);

    new QLabel("current : ", grid);
    current_le  = new LineEdit(grid);

    new QLabel("new : ", grid);
    new_le  = new LineEdit(grid);

    //
    //

    htab = new Q3HBox(this);
    htab->setMargin(5);
    vbox->addWidget(htab);

    new QLabel(htab);
    QPushButton * replace = new QPushButton("Replace", htab);
    new QLabel(htab);
    QPushButton * quit = new QPushButton("Quit", htab);
    new QLabel(htab);

    QSize bs(replace->sizeHint());

    quit->setFixedSize(bs);

    connect(replace, SIGNAL(clicked()), this, SLOT(do_replace()));
    connect(quit, SIGNAL(clicked()), this, SLOT(reject()));

}
Beispiel #15
0
void FlowDialog::init_tab(FlDialog & d, FlowDef & st, const char * lbl,
                          const char * sl_guard, const char * sl_selection,
                          const char * sl_transformation, bool enabled)
{
    Q3Grid * grid = new Q3Grid(2, this);
    Q3VBox * vtab;

    grid->setMargin(5);
    grid->setSpacing(5);

    new QLabel(TR("weight : "), grid);
    d.edweight = new LineEdit(grid);

    QFont font = d.edweight->font();

    if (! hasCodec())
        font.setFamily("Courier");

    font.setFixedPitch(TRUE);
    d.edweight->setFont(font);
    d.edweight->setText(st.weight);

    if (visit)
        d.edweight->setReadOnly(TRUE);

    vtab = new Q3VBox(grid);
    new QLabel(TR("guard : "), vtab);

    if (! visit)
        connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()), this, sl_guard);

    d.edguard = new MultiLineEdit(grid);
    d.edguard->setFont(font);
    d.edguard->setText(st.guard);

    if (visit)
        d.edguard->setReadOnly(TRUE);

    vtab = new Q3VBox(grid);
    new QLabel(TR("selection : "), vtab);

    if (! visit)
        connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()), this, sl_selection);

    d.edselection = new MultiLineEdit(grid);
    d.edselection->setFont(font);
    d.edselection->setText(st.sel_trans.first);

    if (visit)
        d.edselection->setReadOnly(TRUE);

    vtab = new Q3VBox(grid);
    new QLabel(TR("transformation : "), vtab);

    if (! visit)
        connect(new SmallPushButton(TR("Editor"), vtab), SIGNAL(clicked()), this, sl_transformation);

    d.edtransformation = new MultiLineEdit(grid);
    d.edtransformation->setFont(font);
    d.edtransformation->setText(st.sel_trans.second);

    if (visit)
        d.edtransformation->setReadOnly(TRUE);

    addTab(grid, lbl);

    if (! enabled)
        removePage(grid);
}
Beispiel #16
0
void KasPrefsDialog::addLookPage()
{
   KVBox *lookPage = new KVBox( this );

   KPageWidgetItem *item = addPage( lookPage, i18n("Appearance") );
   item->setIcon( Icon( "appearance" ) );

   //
   // Item size
   //

   Q3Grid *itemSizeBox = new Q3Grid( 2, lookPage );
   itemSizeBox->setSpacing( spacingHint() );

   itemSizeBox->setWhatsThis(
		    i18n( "Specifies the size of the task items." ) );

   QLabel *itemSizeLabel = new QLabel( i18n("Si&ze:"), itemSizeBox );

   itemSizeCombo = new QComboBox( itemSizeBox );
   itemSizeCombo->insertItem( i18n( "Enormous" ) );
   itemSizeCombo->insertItem( i18n( "Huge" ) );
   itemSizeCombo->insertItem( i18n( "Large" ) );
   itemSizeCombo->insertItem( i18n( "Medium" ) );
   itemSizeCombo->insertItem( i18n( "Small" ) );
   itemSizeCombo->insertItem( i18n( "Custom" ) );

   itemSizeLabel->setBuddy( itemSizeCombo );

   connect( itemSizeCombo, SIGNAL( activated( int ) ),
	    kasbar, SLOT( setItemSize( int ) ) );
   connect( itemSizeCombo, SIGNAL( activated( int ) ), SLOT( itemSizeChanged( int ) ) );

   new QWidget( itemSizeBox );

   customSize = new QSpinBox( 5, 1000, 1, itemSizeBox );

   customSize->setValue( kasbar->itemExtent() );

   connect( customSize, SIGNAL( valueChanged( int ) ),
	    kasbar, SLOT( setItemExtent( int ) ) );
   connect( customSize, SIGNAL( valueChanged( int ) ),
	    kasbar, SLOT( customSizeChanged( int ) ) );

   int sz = kasbar->itemSize();
   itemSizeCombo->setCurrentItem( sz );
   customSize->setEnabled( sz == KasBar::Custom );

   //
   // Boxes per line
   //

   KHBox *maxBoxesBox = new KHBox( lookPage );
   maxBoxesBox->setWhatsThis(
		    i18n( "Specifies the maximum number of items that should be placed in a line "
			  "before starting a new row or column. If the value is 0 then all the "
			  "available space will be used." ) );
   QLabel *maxBoxesLabel = new QLabel( i18n("Bo&xes per line: "), maxBoxesBox );

   KConfig *conf = kasbar->config();
   if ( conf )
       conf->setGroup( "Layout" );
   maxBoxesSpin = new KIntSpinBox( 0, 50, 1,
				   conf ? conf->readEntry( "MaxBoxes", 0 ) : 11,
				   maxBoxesBox );
   connect( maxBoxesSpin, SIGNAL( valueChanged( int ) ), kasbar, SLOT( setMaxBoxes( int ) ) );
   maxBoxesLabel->setBuddy( maxBoxesSpin );

   //
   // Mode
   //

   detachedCheck = new QCheckBox( i18n("&Detach from screen edge"), lookPage );
   detachedCheck->setWhatsThis( i18n( "Detaches the bar from the screen edge and makes it draggable." ) );

   detachedCheck->setEnabled( !kasbar->isStandAlone() );
   detachedCheck->setChecked( kasbar->isDetached() );
   connect( detachedCheck, SIGNAL( toggled(bool) ), kasbar, SLOT( setDetached(bool) ) );

   (void) new QWidget( lookPage, "spacer" );
   (void) new QWidget( lookPage, "spacer" );
   (void) new QWidget( lookPage, "spacer" );
}
Beispiel #17
0
HTrackView::HTrackView( int viewID_, QWidget *parent )
 : ViewWidget( viewID_, parent)
{
  //setCaption("HTrack view");
  Q3GridLayout *mainLayout = new Q3GridLayout(this, 2, 2);
  mainLayout->setResizeMode(QLayout::SetNoConstraint);
  //QBoxLayout *topLayout = new QVBoxLayout(mainLayout);
  //QBoxLayout *rightLayout = new QVBoxLayout(mainLayout);
  Q3BoxLayout *rightLayout = new Q3VBoxLayout();
  Q3BoxLayout *bottomLayout = new Q3HBoxLayout();

  Q3Grid *frame = new Q3Grid(1, this);
  frame->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
  //frame->setLineWidth(2);
  //frame->setMidLineWidth(2);
  QWidget *aWidget = new QWidget(frame);
  hTrackWidget = new HTrackWidget(aWidget);
  hTrackWidget->setWhatsThis("Shows a 3D keyboard with the current note coloured. "
    "Vertical columns (or tracks), each representing a harmonic (or component frequency), protrude from the back, and move further away over time. "
    "The height of each track is related to how much energy is at that frequency. "
    "Tracks alternate in colour for better visibility. It can be seen how the hamonics in a note fit into the musical scale.");
  //hTrackWidget->show();

  peakThresholdSlider = new QSlider(0, 100, 10, 5, Qt::Vertical, this);
  QToolTip::add(peakThresholdSlider, "Thresholding of harmonics");
  
  rotateXWheel = new QwtWheel(this);
  rotateXWheel->setWheelWidth(20);
  rotateXWheel->setRange(-180, 180, 0.1, 1);
  QToolTip::add(rotateXWheel, "Rotate piano horizonally");
  
  rotateYWheel = new QwtWheel(this);
  rotateYWheel->setOrientation(Qt::Vertical);
  rotateYWheel->setWheelWidth(20);
  rotateYWheel->setRange(-90, 0, 0.1, 1);
  QToolTip::add(rotateYWheel, "Rotate piano vertically");
  
  distanceWheel = new QwtWheel(this);
  distanceWheel->setOrientation(Qt::Vertical);
  //distanceWheel->setWheelWidth(20);
  distanceWheel->setRange(100, 5000, 10, 20);
  distanceWheel->setTotalAngle(20*360);
  QToolTip::add(distanceWheel, "Move towards/away from piano");
  
  QPushButton *homeButton = new QPushButton("Reset", this, "homebutton");
  QToolTip::add(homeButton, "Return to the original view");
  
  QSizeGrip *sizeGrip = new QSizeGrip(this);
  //sizeGrip->setFixedSize(15, 15);
  
  mainLayout->addWidget(frame, 0, 0);
  mainLayout->addLayout(bottomLayout, 1, 0);
  mainLayout->addLayout(rightLayout, 0, 1);
  rightLayout->addStretch(2);
  rightLayout->addWidget(peakThresholdSlider);
  rightLayout->addStretch(4);
  rightLayout->addWidget(rotateYWheel);
  rightLayout->addSpacing(14);
  rightLayout->addWidget(distanceWheel);
  bottomLayout->addStretch(0);
  bottomLayout->addWidget(homeButton);
  bottomLayout->addSpacing(14);
  bottomLayout->addWidget(rotateXWheel);
  //bottomLayout->addSpacing(20);
  mainLayout->addWidget(sizeGrip, 1, 1);

  //make the widget get updated when the view changes
  connect(gdata->view, SIGNAL(onSlowUpdate(double)), hTrackWidget, SLOT(update()));
  connect(peakThresholdSlider, SIGNAL(valueChanged(int)), this, SLOT(setPeakThreshold(int)));
  connect(rotateYWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(setViewAngleVertical(double)));
  connect(rotateYWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(update()));
  connect(hTrackWidget, SIGNAL(viewAngleVerticalChanged(double)), rotateYWheel, SLOT(setValue(double)));
  connect(distanceWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(setDistanceAway(double)));
  connect(distanceWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(update()));
  connect(hTrackWidget, SIGNAL(distanceAwayChanged(double)), distanceWheel, SLOT(setValue(double)));
  connect(rotateXWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(setViewAngleHorizontal(double)));
  connect(rotateXWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(update()));
  connect(hTrackWidget, SIGNAL(viewAngleHorizontalChanged(double)), rotateXWheel, SLOT(setValue(double)));
  connect(homeButton, SIGNAL(clicked()), hTrackWidget, SLOT(home()));
}
SimpleRelationDialog::SimpleRelationDialog(SimpleRelationData * r)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), rel(r)
{
    r->browser_node->edit_start();

    if (r->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    bool visit = !hasOkButton();

    // general tab

    BrowserNode * bn = rel->get_browser_node();
    Q3Grid * grid = new Q3Grid(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 Q3ComboBox(!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);

    Q3VBox * vtab = new Q3VBox(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 Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable(bn, grid, visit);
    addTab(grid, TR("Properties"));

    open_dialog(this);
}
Beispiel #19
0
void GPConfigDlg::appendWidget(QWidget* parent, CameraWidget* widget)
{
    QWidget* newParent = parent;

    CameraWidgetType widget_type;
    const char* widget_name;
    const char* widget_info;
    const char* widget_label;
    float widget_value_float;
    int widget_value_int;
    const char* widget_value_string;
    gp_widget_get_type(widget, &widget_type);
    gp_widget_get_label(widget, &widget_label);
    gp_widget_get_info(widget, &widget_info);
    gp_widget_get_name(widget, &widget_name);

    // gphoto2 doesn't seem to have any standard for i18n
    QString whats_this = QString::fromLocal8Bit(widget_info);

    // Add this widget to parent
    switch (widget_type)
    {
        case GP_WIDGET_WINDOW:
        {
            setCaption(widget_label);

            break;
        }

        case GP_WIDGET_SECTION:
        {
            if (!d->tabWidget)
            {
                d->tabWidget = new QTabWidget(parent);
                parent->layout()->addWidget(d->tabWidget);
            }

            QWidget* tab = new QWidget(d->tabWidget);
            // widgets are to be aligned vertically in the tab
            QVBoxLayout* tabLayout = new QVBoxLayout(tab, marginHint(),
                                                     spacingHint());
            d->tabWidget->insertTab(tab, widget_label);
            KVBox* tabContainer = new KVBox(tab);
            tabContainer->setSpacing(spacingHint());
            tabLayout->addWidget(tabContainer);
            newParent = tabContainer;

            tabLayout->addStretch();

            break;
        }

        case GP_WIDGET_TEXT:
        {
            gp_widget_get_value(widget, &widget_value_string);

            Q3Grid* grid = new Q3Grid(2, Qt::Horizontal, parent);
            parent->layout()->addWidget(grid);
            grid->setSpacing(spacingHint());
            new QLabel(QString::fromLocal8Bit(widget_label) + ':', grid);
            QLineEdit* lineEdit = new QLineEdit(widget_value_string, grid);
            d->wmap.insert(widget, lineEdit);

            if (!whats_this.isEmpty())
            {
                grid->setWhatsThis(whats_this);
            }

            break;
        }

        case GP_WIDGET_RANGE:
        {
            float widget_low;
            float widget_high;
            float widget_increment;
            gp_widget_get_range(widget, &widget_low, &widget_high, &widget_increment);
            gp_widget_get_value(widget, &widget_value_float);

            Q3GroupBox* groupBox = new Q3GroupBox(1, Qt::Horizontal, widget_label, parent);
            parent->layout()->addWidget(groupBox);
            QSlider* slider = new QSlider(
                (int)widget_low,
                (int)widget_high,
                (int)widget_increment,
                (int)widget_value_float,
                Qt::Horizontal,
                groupBox);
            d->wmap.insert(widget, slider);

            if (!whats_this.isEmpty())
            {
                groupBox->setWhatsThis(whats_this);
            }

            break;
        }

        case GP_WIDGET_TOGGLE:
        {
            gp_widget_get_value(widget, &widget_value_int);

            QCheckBox* checkBox = new QCheckBox(widget_label, parent);
            parent->layout()->addWidget(checkBox);
            checkBox->setChecked(widget_value_int);
            d->wmap.insert(widget, checkBox);

            if (!whats_this.isEmpty())
            {
                checkBox->setWhatsThis(whats_this);
            }

            break;
        }

        case GP_WIDGET_RADIO:
        {
            gp_widget_get_value(widget, &widget_value_string);

            int count = gp_widget_count_choices(widget);

            // for less than 5 options, align them horizontally
            Q3ButtonGroup* buttonGroup;

            if (count > 4)
            {
                buttonGroup = new Q3VButtonGroup(widget_label, parent);
            }
            else
            {
                buttonGroup = new Q3HButtonGroup(widget_label, parent);
            }

            parent->layout()->addWidget(buttonGroup);

            for (int i = 0; i < count; ++i)
            {
                const char* widget_choice;
                gp_widget_get_choice(widget, i, &widget_choice);

                new QRadioButton(widget_choice, buttonGroup);

                if (!strcmp(widget_value_string, widget_choice))
                {
                    buttonGroup->setButton(i);
                }
            }

            d->wmap.insert(widget, buttonGroup);

            if (!whats_this.isEmpty())
            {
                buttonGroup->setWhatsThis(whats_this);
            }

            break;
        }

        case GP_WIDGET_MENU:
        {
            gp_widget_get_value(widget, &widget_value_string);

            QComboBox* comboBox = new KComboBox(parent);
            parent->layout()->addWidget(comboBox);
            comboBox->clear();

            for (int i = 0; i < gp_widget_count_choices(widget); ++i)
            {
                const char* widget_choice;
                gp_widget_get_choice(widget, i, &widget_choice);

                comboBox->insertItem(widget_choice);

                if (!strcmp(widget_value_string, widget_choice))
                {
                    comboBox->setCurrentItem(i);
                }
            }

            d->wmap.insert(widget, comboBox);

            if (!whats_this.isEmpty())
            {
                comboBox->setWhatsThis(whats_this);
            }

            break;
        }

        case GP_WIDGET_BUTTON:
        {
            // TODO
            // I can't see a way of implementing this. Since there is
            // no way of telling which button sent you a signal, we
            // can't map to the appropriate widget->callback
            QLabel* label = new QLabel(i18n("Button (not supported by KControl)"), parent);
            parent->layout()->addWidget(label);

            break;
        }

        case GP_WIDGET_DATE:
        {
            // TODO
            QLabel* label = new QLabel(i18n("Date (not supported by KControl)"), parent);
            parent->layout()->addWidget(label);

            break;
        }

        default:
            return;
    }

    // Append all this widgets children
    for (int i = 0; i < gp_widget_count_children(widget); ++i)
    {
        CameraWidget* widget_child;
        gp_widget_get_child(widget, i, &widget_child);
        appendWidget(newParent, widget_child);
    }

    // Things that must be done after all children were added
    /*
        switch (widget_type) {
        case GP_WIDGET_SECTION:
            {
                tabLayout->addItem( new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding) );
                break;
            }
        }
    */
}
PseudoStateDialog::PseudoStateDialog(PseudoStateData * ps)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), pst(ps)
{
    BrowserPseudoState * bn = (BrowserPseudoState *) pst->browser_node;
    BrowserState * refst;

    switch (bn->get_type()) {
    case EntryPointPS:
    case ExitPointPS:
        if (((BrowserNode *) bn->parent())->get_type() == UmlState) {
            refst = ((StateData *)((BrowserNode *) bn->parent())->get_data())->get_reference();
            break;
        }

        // no break
    default:
        refst = 0;
    }

    bn->edit_start();

    if (bn->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    QString s = stringify(bn->get_type());
    int index = s.find("_");

    if (index != -1)
        s.replace(index, 1, " ");

    setCaption(TR(s + " dialog"));

    visit = !hasOkButton();

    // general tab

    Q3Grid * grid = new Q3Grid(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 Q3ComboBox(!visit, grid);
    edstereotype->insertItem(toUnicode(pst->get_stereotype()));

    if (! visit) {
        edstereotype->insertStringList(BrowserPseudoState::default_stereotypes());
        edstereotype->insertStringList(ProfiledStereotypes::defaults(bn->get_type()));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentItem(0);
    QSizePolicy sp = edstereotype->sizePolicy();
    sp.setHorData(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    if (refst != 0) {
        connect(new SmallPushButton(TR("reference :"), grid), SIGNAL(clicked()),
                this, SLOT(menu_reference()));
        edreference = new Q3ComboBox(FALSE, grid);
        edreference->setSizePolicy(sp);

        BrowserNode * ref = ((pst->get_reference() == 0) ||
                             !bn->can_reference(pst->get_reference()))
                            ? 0 : pst->get_reference();

        if (visit) {
            if (ref == 0)
                edreference->insertItem("");
            else
                edreference->insertItem(ref->full_name(TRUE));
        }
        else {
            edreference->insertItem("");
            edreference->setAutoCompletion(completion());

            Q3ListViewItem * child;
            UmlCode k = bn->get_type();

            for (child = refst->firstChild();
                 child != 0;
                 child = child->nextSibling()) {
                if (!((BrowserNode *) child)->deletedp()) {
                    UmlCode kk = ((BrowserNode *) child)->get_type();

                    if (kk == k)
                        pseudostates.append((BrowserNode *) child);
                    else if (kk == UmlRegion) {
                        for (Q3ListViewItem * schild = child->firstChild();
                             schild != 0;
                             schild = schild->nextSibling()) {
                            if (!((BrowserNode *) schild)->deletedp() &&
                                (((BrowserNode *) schild)->get_type() == k))
                                pseudostates.append((BrowserNode *) schild);
                        }
                    }
                }
            }

            pseudostates.sort();
            pseudostates.full_names(reflist);
            edreference->insertStringList(reflist);
            edreference->setCurrentItem((ref == 0)
                                        ? 0
                                        : pseudostates.indexOf(ref) + 1);
        }
    }
    else
        edreference = 0;

    Q3VBox * vtab = new Q3VBox(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 Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable(bn, grid, visit);
    addTab(grid, TR("Properties"));

    open_dialog(this);
}
Beispiel #21
0
PinDialog::PinDialog(PinData * pi)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), pin(pi) {
  pi->browser_node->edit_start();
  
  if (pi->browser_node->is_writable()) {
    setOkButton(TR("OK"));
    setCancelButton(TR("Cancel"));
  }
  else {
    setOkButton(QString::null);
    setCancelButton(TR("Close"));
  }

  visit = !hasOkButton();
  setCaption(TR("Pin dialog"));
  
  Q3Grid * grid;
  Q3HBox * htab;
  QString s;
    
  // general tab
  
  grid = new Q3Grid(2, this);
  umltab = grid;
  grid->setMargin(5);
  grid->setSpacing(5);
  
  new QLabel(TR("name :"), grid);
  edname = new LineEdit(pi->name(), grid);
  edname->setReadOnly(visit);

  QFont font = edname->font();
  if (! hasCodec())
    font.setFamily("Courier");
  font.setFixedPitch(TRUE);
  
  new QLabel(TR("stereotype : "), grid);
  edstereotype = new Q3ComboBox(!visit, grid);
  edstereotype->insertItem(toUnicode(pi->stereotype));
  if (! visit) {
    edstereotype->insertStringList(BrowserPin::default_stereotypes());
    edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlActivityPin));
    edstereotype->setAutoCompletion(completion());
  }
  edstereotype->setCurrentItem(0);
  
  QSizePolicy sp = edstereotype->sizePolicy();
  
  sp.setHorData(QSizePolicy::Expanding);
  edstereotype->setSizePolicy(sp);
    
  connect(new SmallPushButton(TR("type :"), grid), SIGNAL(clicked()),
	  this, SLOT(menu_type()));
  
  edtype = new Q3ComboBox(!visit, grid);
  edtype->insertItem(pi->get_type().get_full_type());
  if (!visit) {
    BrowserClass::instances(nodes);
    nodes.full_names(list);
    
    edtype->insertStringList(GenerationSettings::basic_types());
    offset = edtype->count();
    edtype->insertStringList(list);
    edtype->setAutoCompletion(completion());
    view = pi->browser_node->container(UmlClass);
  }
  edtype->setCurrentItem(0);
  edtype->setSizePolicy(sp);
  
  new QLabel(TR("direction :"), grid);
  htab = new Q3HBox(grid);
  eddir = new Q3ComboBox(FALSE, htab);
  
  UmlParamDirection dir = pi->get_dir();
  
  eddir->insertItem(stringify(dir));
  if (! visit) {
    // note : inout not allowed
    if (dir != UmlIn)
      eddir->insertItem(stringify(UmlIn));
    if (dir != UmlOut)
      eddir->insertItem(stringify(UmlOut));
    if (dir != UmlReturn)
      eddir->insertItem(stringify(UmlReturn));
  }
  
  new QLabel(TR("   multiplicity : "), htab);
  edmultiplicity = new Q3ComboBox(!visit, htab);
  edmultiplicity->setSizePolicy(sp);
  edmultiplicity->insertItem(pi->get_multiplicity());
  if (!visit) {
    edmultiplicity->insertItem("1");
    edmultiplicity->insertItem("0..1");
    edmultiplicity->insertItem("*");
    edmultiplicity->insertItem("1..*");
  }
  
  new QLabel(TR("   ordering : "), htab);
  edordering = new Q3ComboBox(FALSE, htab);
  
  UmlOrderingKind o = pi->get_ordering();
  
  edordering->insertItem(stringify(o));
  if (!visit) {
    if (o != UmlUnordered)
      edordering->insertItem(stringify(UmlUnordered));
    if (o != UmlOrdered)
      edordering->insertItem(stringify(UmlOrdered));
    if (o != UmlLifo)
      edordering->insertItem(stringify(UmlLifo));
    if (o != UmlFifo)
      edordering->insertItem(stringify(UmlFifo));
  }
    
  new QLabel(TR("   effect : "), htab);
  edeffect = new Q3ComboBox(FALSE, htab);
  
  UmlParamEffect e = pi->get_effect();
  
  edeffect->insertItem(stringify(e));
  if (!visit) {
    if (e != UmlNoEffect)
      edeffect->insertItem(stringify(UmlNoEffect));
    if (e != UmlCreate)
      edeffect->insertItem(stringify(UmlCreate));
    if (e != UmlRead)
      edeffect->insertItem(stringify(UmlRead));
    if (e != UmlUpdate)
      edeffect->insertItem(stringify(UmlUpdate));
    if (e != UmlDelete)
      edeffect->insertItem(stringify(UmlDelete));
  }
    
  new QLabel(TR("in state : "), grid);
  edin_state = new LineEdit(pi->in_state, grid);
  edin_state->setReadOnly(visit);
       
  new QLabel(grid);
  htab = new Q3HBox(grid);
  Q3ButtonGroup * bg = 
    new Q3ButtonGroup(2, Qt::Horizontal, QString::null, htab);
  
  is_control_cb = new QCheckBox(TR("is_control"), bg);
  if (pi->is_control)
    is_control_cb->setChecked(TRUE);
  is_control_cb->setDisabled(visit);
  
  unique_cb = new QCheckBox(TR("unique"), bg);
  if (pi->unique)
    unique_cb->setChecked(TRUE);
  unique_cb->setDisabled(visit);
  
  bg = 
    new Q3ButtonGroup(3, Qt::Horizontal, QString::null, htab);
  bg->setExclusive(TRUE);
  
  standard_rb = new QRadioButton(TR("standard"), bg);
  exception_rb = new QRadioButton(TR("exception"), bg);
  stream_rb = new QRadioButton(TR("stream"), bg);
  
  if (pi->exception)
    exception_rb->setChecked(TRUE);
  else if (pi->stream)
    stream_rb->setChecked(TRUE);
  else
    standard_rb->setChecked(TRUE);
  
  Q3VBox * vtab = new Q3VBox(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(pi->browser_node->get_comment());
  comment->setFont(font);
  
  addTab(grid, "Uml");
  
  init_tab(ocltab, eduml_selection, pin->uml_selection, "Ocl",
	   SLOT(edit_uml_selection()), TRUE);

  // C++
  init_tab(cpptab, edcpp_selection, pin->cpp_selection, "C++",
	   SLOT(edit_cpp_selection()),
	   GenerationSettings::cpp_get_default_defs());

  // Java
  init_tab(javatab, edjava_selection, pin->java_selection, "Java",
	   SLOT(edit_java_selection()),
	   GenerationSettings::java_get_default_defs());
  
  // USER : list key - value
  
  grid = new Q3Grid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);
  
  kvtable = new KeyValuesTable(pi->browser_node, grid, visit);
  addTab(grid, TR("Properties"));
  
  //
    
  connect(this, SIGNAL(currentChanged(QWidget *)),
	  this, SLOT(change_tabs(QWidget *)));
  
  open_dialog(this);
}
Beispiel #22
0
BasicDialog::BasicDialog(BasicData * nd, QString s,
			 const QStringList & default_stereotypes,
			 QSize & sz, bool unnamed)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), data(nd), previous_size(sz) {
  nd->get_browser_node()->edit_start();
  
  if (nd->get_browser_node()->is_writable()) {
    setOkButton(TR("OK"));
    setCancelButton(TR("Cancel"));
  }
  else {
    setOkButton(QString::null);
    setCancelButton(TR("Close"));
  }

  setCaption(TR(s + " dialog"));
  
  bool visit = !hasOkButton();
  
  // general tab
  
  BrowserNode * bn = data->get_browser_node();
  Q3Grid * grid = new Q3Grid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);

  if (unnamed)
    edname = 0;
  else {
    new QLabel(TR("name : "), grid);
    edname = new LineEdit(bn->get_name(), grid);
    edname->setReadOnly(visit);
  }    
  new QLabel(TR("stereotype : "), grid);
  edstereotype = new Q3ComboBox(!visit, grid);
  edstereotype->insertItem(toUnicode(data->get_stereotype()));
  if (! visit) {
    edstereotype->insertStringList(default_stereotypes);
    edstereotype->insertStringList(ProfiledStereotypes::defaults(bn->get_type()));
    edstereotype->setAutoCompletion(completion());
  }
  edstereotype->setCurrentItem(0);
  QSizePolicy sp = edstereotype->sizePolicy();
  sp.setHorData(QSizePolicy::Expanding);
  edstereotype->setSizePolicy(sp);
  
  Q3VBox * vtab = new Q3VBox(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 Q3Grid(2, this);
  grid->setMargin(5);
  grid->setSpacing(5);
  
  kvtable = new KeyValuesTable(bn, grid, visit);
  addTab(grid, TR("Properties"));
  
  open_dialog(this);
}
ActivityObjectDialog::ActivityObjectDialog(ActivityObjectData * d, const char * what,
        QStringList & st)
    : Q3TabDialog(0, 0, FALSE, Qt::WDestructiveClose), data(d)
{
    d->browser_node->edit_start();

    if (d->browser_node->is_writable()) {
        setOkButton(TR("OK"));
        setCancelButton(TR("Cancel"));
    }
    else {
        setOkButton(QString());
        setCancelButton(TR("Close"));
    }

    visit = !hasOkButton();
    setCaption(TR(QString(what) + " dialog"));

    Q3Grid * grid;
    Q3HBox * htab;
    QString s;

    // general tab

    grid = new Q3Grid(2, this);
    umltab = grid;
    grid->setMargin(5);
    grid->setSpacing(5);

    new QLabel(TR("name :"), grid);
    edname = new LineEdit(data->name(), grid);
    edname->setReadOnly(visit);

    QFont font = edname->font();

    if (! hasCodec())
        font.setFamily("Courier");

    font.setFixedPitch(TRUE);

    new QLabel(TR("stereotype : "), grid);
    edstereotype = new Q3ComboBox(!visit, grid);
    edstereotype->insertItem(toUnicode(data->stereotype));

    if (! visit) {
        edstereotype->insertStringList(st);
        edstereotype->insertStringList(ProfiledStereotypes::defaults(UmlActivityObject));
        edstereotype->setAutoCompletion(completion());
    }

    edstereotype->setCurrentItem(0);

    QSizePolicy sp = edstereotype->sizePolicy();

    sp.setHorData(QSizePolicy::Expanding);
    edstereotype->setSizePolicy(sp);

    connect(new SmallPushButton(TR("type :"), grid), SIGNAL(clicked()),
            this, SLOT(menu_type()));

    edtype = new Q3ComboBox(!visit, grid);
    edtype->insertItem(data->get_type().get_full_type());

    if (!visit) {
        BrowserClass::instances(nodes);
        nodes.full_names(list);

        edtype->insertStringList(GenerationSettings::basic_types());
        offset = edtype->count();
        edtype->insertStringList(list);
        edtype->setAutoCompletion(completion());

        // search for the view containing the activity
        view = d->browser_node;

        do {
            view = (BrowserNode *) view->parent();
        }
        while (view->get_type() != UmlActivity);

        view = (BrowserNode *) view->parent();
    }

    edtype->setCurrentItem(0);
    edtype->setSizePolicy(sp);

    new QLabel(TR("multiplicity : "), grid);
    htab = new Q3HBox(grid);
    edmultiplicity = new Q3ComboBox(!visit, htab);
    edmultiplicity->setSizePolicy(sp);
    edmultiplicity->insertItem(data->get_multiplicity());

    if (!visit) {
        edmultiplicity->insertItem("1");
        edmultiplicity->insertItem("0..1");
        edmultiplicity->insertItem("*");
        edmultiplicity->insertItem("1..*");
    }

    new QLabel(TR("   ordering : "), htab);
    edordering = new Q3ComboBox(FALSE, htab);

    UmlOrderingKind o = data->get_ordering();

    edordering->insertItem(stringify(o));

    if (!visit) {
        if (o != UmlUnordered)
            edordering->insertItem(stringify(UmlUnordered));

        if (o != UmlOrdered)
            edordering->insertItem(stringify(UmlOrdered));

        if (o != UmlLifo)
            edordering->insertItem(stringify(UmlLifo));

        if (o != UmlFifo)
            edordering->insertItem(stringify(UmlFifo));
    }

    new QLabel(TR("in state : "), grid);
    htab = new Q3HBox(grid);
    edin_state = new LineEdit(data->in_state, htab);
    edin_state->setReadOnly(visit);

    new QLabel("  ", htab);
    is_control_cb = new QCheckBox(TR("is control"), htab);

    if (data->is_control)
        is_control_cb->setChecked(TRUE);

    is_control_cb->setDisabled(visit);

    Q3VBox * vtab = new Q3VBox(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(data->browser_node->get_comment());
    comment->setFont(font);

    addTab(grid, "Uml");

    // UML / OCL
    init_tab(ocltab, eduml_selection, data->uml_selection, "Ocl",
             SLOT(edit_uml_selection()), TRUE);

    // C++
    init_tab(cppTab, edcpp_selection, data->cpp_selection, "C++",
             SLOT(edit_cpp_selection()),
             GenerationSettings::cpp_get_default_defs());

    // Java
    init_tab(javatab, edjava_selection, data->java_selection, "Java",
             SLOT(edit_java_selection()),
             GenerationSettings::java_get_default_defs());

    // USER : list key - value

    grid = new Q3Grid(2, this);
    grid->setMargin(5);
    grid->setSpacing(5);

    kvtable = new KeyValuesTable(data->browser_node, grid, visit);
    addTab(grid, TR("Properties"));

    //

    connect(this, SIGNAL(currentChanged(QWidget *)),
            this, SLOT(change_tabs(QWidget *)));

    open_dialog(this);
}