CodChangeMsgDialog::CodChangeMsgDialog(QWidget * parent, ColMsg * m) : QDialog(parent/*, "Communication message dialog", TRUE*/), msg(m) { setWindowTitle(tr("Communicationg message dialog")); QVBoxLayout * vbox = new QVBoxLayout(this); QHBoxLayout * hbox; vbox->setMargin(5); hbox = new QHBoxLayout(); vbox->addLayout(hbox); hbox->setMargin(5); SmallPushButton * b = new SmallPushButton(tr("message :"), this); hbox->addWidget(b); connect(b, SIGNAL(clicked()), this, SLOT(menu_op())); edoper = new QComboBox(this); edoper->setEditable(true); edoper->setAutoCompletion(completion()); if (msg->operation == 0) edoper->addItem(msg->explicit_operation); else edoper->addItem(msg->operation->definition(TRUE, FALSE)); CodObjCanvas * from; CodObjCanvas * to; msg->in->get_from_to(from, to, msg->is_forward); // gets operations cl = to->get_class(); if (cl != 0) { cl->get_opers(opers, list); edoper->addItems(list); if (!cl->is_writable()) cl = 0; } edoper->setCurrentIndex(0); QSizePolicy sp = edoper->sizePolicy(); sp.setHorizontalPolicy(QSizePolicy::Expanding); edoper->setSizePolicy(sp); hbox->addWidget(edoper); // ok & cancel hbox = new QHBoxLayout(); vbox->addLayout(hbox); hbox->setMargin(5); QPushButton * ok = new QPushButton(tr("&OK"), this); QPushButton * cancel = new QPushButton(tr("&Cancel"), this); QSize bs(cancel->sizeHint()); ok->setDefault(TRUE); ok->setFixedSize(bs); cancel->setFixedSize(bs); hbox->addWidget(ok); hbox->addWidget(cancel); connect(ok, SIGNAL(clicked()), this, SLOT(accept())); connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); }
CodAddMsgDialog::CodAddMsgDialog(CodObjCanvas * from, CodObjCanvas * to, CodMsgSupport * i, ColDiagramView * v, bool fo) : QDialog(0, "add msg dialog", TRUE), in(i), view(v), forward(fo) { setCaption(TR("Add message dialog")); QVBoxLayout * vbox = new QVBoxLayout(this); QHBoxLayout * hbox; vbox->setMargin(5); hbox = new QHBoxLayout(vbox); hbox->setMargin(10); QLabel * label1 = new QLabel(TR("Add message to %1", to->get_full_name()), this); label1->setAlignment(AlignCenter); hbox->addWidget(label1); QGrid * grid = new QGrid(2, this); vbox->addWidget(grid); new QLabel(TR("rank : "), grid); cbrank = new QComboBox(FALSE, grid); ColMsgList all_in; ColMsgList all_out; from->get_all_in_all_out(all_in, all_out); ColMsg * m; QStringList new_ones; QListIterator<ColMsg> itout(all_out); for (; (m = itout.current()) != 0; ++itout) { QString s = m->next_hierarchical_rank(); if ((s.find('.') != - 1) && (ColMsg::find(s, all_out) == 0)) { cbrank->insertItem(QString::number(m->get_rank() + 1) + " : " + s); new_ones.append(s); } } QListIterator<ColMsg> itin(all_in); for (; (m = itin.current()) != 0; ++itin) { QString s = m->get_hierarchical_rank() + ".1"; if ((ColMsg::find(s, all_out) == 0) && (new_ones.findIndex(s) == -1)) { cbrank->insertItem(QString::number(m->get_rank() + 1) + " : " + s); new_ones.append(s); } } // add a the rank for a new toplevel link cbrank->insertItem(QString::number(ColMsg::last_rank(view->get_msgs()) + 1) + " : " + QString::number(view->get_msgs().count() + 1)); // the default new one follow the last input or output or view's last msg cbrank->setCurrentItem((cbrank->count() == 1) ? 0 : cbrank->count() - 2); QSizePolicy sp = cbrank->sizePolicy(); sp.setHorData(QSizePolicy::Expanding); cbrank->setSizePolicy(sp); new QLabel("", grid); new QLabel("", grid); // the operations SmallPushButton * b = new SmallPushButton(TR("message :"), grid); connect(b, SIGNAL(clicked()), this, SLOT(menu_op())); edoper = new QComboBox(TRUE, grid); edoper->setAutoCompletion(completion()); // gets operations cl = to->get_class(); if (cl != 0) { cl->get_opers(opers, list); edoper->insertStringList(list); if (!cl->is_writable()) cl = 0; } edoper->setSizePolicy(sp); new QLabel("", grid); new QLabel("", grid); // ok & cancel hbox = new QHBoxLayout(vbox); hbox->setMargin(5); QPushButton * ok = new QPushButton(TR("&OK"), this); QPushButton * cancel = new QPushButton(TR("&Cancel"), this); QSize bs(cancel->sizeHint()); ok->setDefault(TRUE); ok->setFixedSize(bs); cancel->setFixedSize(bs); hbox->addWidget(ok); hbox->addWidget(cancel); connect(ok, SIGNAL(clicked()), this, SLOT(accept())); connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); }