void UMLOperationDialog::setupDialog() { int margin = fontMetrics().height(); QVBoxLayout * topLayout = new QVBoxLayout( plainPage() ); m_pGenGB = new QGroupBox(i18n("General Properties"), plainPage() ); QGridLayout * genLayout = new QGridLayout(m_pGenGB, 3, 4 ); genLayout -> setColStretch(1, 1); genLayout -> setColStretch(3, 1); genLayout -> addColSpacing(1, 200); genLayout -> addColSpacing(3, 200); genLayout -> setMargin(margin); genLayout -> setSpacing(10); Dialog_Utils::makeLabeledEditField( m_pGenGB, genLayout, 0, m_pNameL, i18n("&Name:"), m_pNameLE, m_pOperation->getName() ); m_pRtypeL = new QLabel(i18n("&Type:"), m_pGenGB ); genLayout -> addWidget(m_pRtypeL, 0, 2); m_pRtypeCB = new KComboBox(true, m_pGenGB ); genLayout -> addWidget(m_pRtypeCB, 0, 3); m_pRtypeL->setBuddy(m_pRtypeCB); m_pStereoTypeL = new QLabel( i18n("Stereotype name:"), m_pGenGB ); genLayout -> addWidget(m_pStereoTypeL, 1, 0); m_pStereoTypeCB = new KComboBox(true, m_pGenGB ); genLayout -> addWidget(m_pStereoTypeCB, 1, 1); m_pAbstractCB = new QCheckBox( i18n("&Abstract operation"), m_pGenGB ); m_pAbstractCB -> setChecked( m_pOperation->getAbstract() ); genLayout -> addWidget( m_pAbstractCB, 2, 0 ); m_pStaticCB = new QCheckBox( i18n("Classifier &scope (\"static\")"), m_pGenGB ); m_pStaticCB -> setChecked( m_pOperation->getStatic() ); genLayout -> addWidget( m_pStaticCB, 2, 1 ); m_pQueryCB = new QCheckBox( i18n("&Query (\"const\")"), m_pGenGB ); m_pQueryCB -> setChecked( m_pOperation->getConst() ); genLayout -> addWidget( m_pQueryCB, 2, 2 ); topLayout -> addWidget( m_pGenGB ); m_pScopeBG = new QButtonGroup(i18n("Visibility"), plainPage() ); QHBoxLayout * scopeLayout = new QHBoxLayout(m_pScopeBG); scopeLayout -> setMargin(margin); m_pPublicRB = new QRadioButton(i18n("P&ublic"), m_pScopeBG); scopeLayout -> addWidget(m_pPublicRB); m_pPrivateRB = new QRadioButton(i18n("P&rivate"), m_pScopeBG); scopeLayout -> addWidget(m_pPrivateRB); m_pProtectedRB = new QRadioButton(i18n("Prot&ected"), m_pScopeBG); scopeLayout -> addWidget(m_pProtectedRB); m_pImplementationRB = new QRadioButton(i18n("I&mplementation"), m_pScopeBG); scopeLayout -> addWidget(m_pImplementationRB); topLayout -> addWidget(m_pScopeBG); m_pParmsGB = new QGroupBox(i18n("Parameters"), plainPage() ); QVBoxLayout* parmsLayout = new QVBoxLayout(m_pParmsGB); parmsLayout->setMargin(margin); parmsLayout->setSpacing(10); //horizontal box contains the list box and the move up/down buttons QHBoxLayout* parmsHBoxLayout = new QHBoxLayout(parmsLayout); m_pParmsLB = new QListBox(m_pParmsGB); parmsHBoxLayout->addWidget(m_pParmsLB); //the move up/down buttons (another vertical box) QVBoxLayout* buttonLayout = new QVBoxLayout( parmsHBoxLayout ); m_pUpButton = new KArrowButton( m_pParmsGB ); m_pUpButton->setEnabled( false ); buttonLayout->addWidget( m_pUpButton ); m_pDownButton = new KArrowButton( m_pParmsGB, Qt::DownArrow ); m_pDownButton->setEnabled( false ); buttonLayout->addWidget( m_pDownButton ); KButtonBox* buttonBox = new KButtonBox(m_pParmsGB); buttonBox->addButton( i18n("Ne&w Parameter..."), this, SLOT(slotNewParameter()) ); m_pDeleteButton = buttonBox->addButton( i18n("&Delete"), this, SLOT(slotDeleteParameter()) ); m_pPropertiesButton = buttonBox->addButton( i18n("&Properties"), this, SLOT(slotParameterProperties()) ); parmsLayout->addWidget(buttonBox); topLayout -> addWidget(m_pParmsGB); m_pDeleteButton->setEnabled(false); m_pPropertiesButton->setEnabled(false); m_pUpButton->setEnabled(false); m_pDownButton->setEnabled(false); // Add "void". We use this for denoting "no return type" independent // of the programming language. // For example, the Ada generator would interpret the return type // "void" as an instruction to generate a procedure instead of a // function. insertType( "void" ); m_pRtypeCB->setDuplicatesEnabled(false);//only allow one of each type in box m_pRtypeCB->setCompletionMode( KGlobalSettings::CompletionPopup ); // add template parameters UMLClassifier *classifier = dynamic_cast<UMLClassifier*>(m_pOperation->parent()); if (classifier) { UMLClassifierListItemList tmplParams( classifier->getFilteredList(Uml::ot_Template) ); for (UMLClassifierListItem *li = tmplParams.first(); li; li = tmplParams.next()) insertType( li->getName() ); } //now add the Classes and Interfaces (both are Concepts) UMLClassifierList namesList( m_doc->getConcepts() ); UMLClassifier* pConcept = 0; for(pConcept=namesList.first(); pConcept!=0 ;pConcept=namesList.next()) { insertType( pConcept->getFullyQualifiedName() ); } //work out which one to select int returnBoxCount = 0; bool foundReturnType = false; while (returnBoxCount < m_pRtypeCB->count() && foundReturnType == false) { QString returnBoxString = m_pRtypeCB->text(returnBoxCount); if ( returnBoxString == m_pOperation->getTypeName() ) { foundReturnType = true; m_pRtypeCB->setCurrentItem(returnBoxCount); break; } returnBoxCount++; } if (!foundReturnType) { insertType( m_pOperation->getTypeName(), 0 ); m_pRtypeCB->setCurrentItem(0); } //fill in parm list box UMLAttributeList list = m_pOperation->getParmList(); UMLAttribute * pAtt = 0; for (pAtt = list.first(); pAtt; pAtt = list.next()) m_pParmsLB->insertItem( pAtt->getName() ); //set scope Uml::Visibility scope = m_pOperation -> getVisibility(); if( scope == Uml::Visibility::Public ) m_pPublicRB -> setChecked( true ); else if( scope == Uml::Visibility::Private ) m_pPrivateRB -> setChecked( true ); else if( scope == Uml::Visibility::Protected ) m_pProtectedRB -> setChecked( true ); else if( scope == Uml::Visibility::Implementation ) m_pImplementationRB -> setChecked( true ); // manage stereotypes m_pStereoTypeCB -> setDuplicatesEnabled(false);//only allow one of each type in box m_pStereoTypeCB->setCompletionMode( KGlobalSettings::CompletionPopup ); insertStereotype (QString("")); // an empty stereotype is the default int defaultStereotype=0; bool foundDefaultStereotype = false; for (UMLStereotypeListIt it(m_doc->getStereotypes()); it.current(); ++it) { if (!foundDefaultStereotype) { if ( m_pOperation->getStereotype() == it.current()->getName()) { foundDefaultStereotype = true; } defaultStereotype++; } insertStereotype (it.current()->getName()); } // lookup for a default stereotype, if the operation doesn't have one if (foundDefaultStereotype) m_pStereoTypeCB->setCurrentItem(defaultStereotype); else m_pStereoTypeCB->setCurrentItem(-1); //setup parm list box signals connect( m_pUpButton, SIGNAL( clicked() ), this, SLOT( slotParameterUp() ) ); connect( m_pDownButton, SIGNAL( clicked() ), this, SLOT( slotParameterDown() ) ); connect(m_pParmsLB, SIGNAL(clicked(QListBoxItem*)), this, SLOT(slotParamsBoxClicked(QListBoxItem*))); connect(m_pParmsLB, SIGNAL(rightButtonPressed(QListBoxItem *, const QPoint &)), this, SLOT(slotParmRightButtonPressed(QListBoxItem *, const QPoint &))); connect(m_pParmsLB, SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), this, SLOT(slotParmRightButtonClicked(QListBoxItem *, const QPoint &))); connect(m_pParmsLB, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(slotParmDoubleClick(QListBoxItem *))); m_pNameLE->setFocus(); connect( m_pNameLE, SIGNAL( textChanged ( const QString & ) ), SLOT( slotNameChanged( const QString & ) ) ); slotNameChanged(m_pNameLE->text() ); }
/** * Sets up the dialog. */ void UMLEntityAttributeDialog::setupDialog() { int margin = fontMetrics().height(); QFrame *frame = new QFrame(this); setMainWidget(frame); QVBoxLayout * mainLayout = new QVBoxLayout(frame); m_pValuesGB = new QGroupBox(i18n("General Properties"), frame); QGridLayout * valuesLayout = new QGridLayout(m_pValuesGB); valuesLayout->setMargin(margin); valuesLayout->setSpacing(10); m_datatypeWidget = new UMLDatatypeWidget(m_pEntityAttribute); m_datatypeWidget->addToLayout(valuesLayout, 0); Dialog_Utils::makeLabeledEditField(valuesLayout, 1, m_pNameL, i18nc("name of entity attribute", "&Name:"), m_pNameLE, m_pEntityAttribute->name()); Dialog_Utils::makeLabeledEditField(valuesLayout, 2, m_pInitialL, i18n("&Default value:"), m_pInitialLE, m_pEntityAttribute->getInitialValue()); m_stereotypeWidget = new UMLStereotypeWidget(m_pEntityAttribute); m_stereotypeWidget->addToLayout(valuesLayout, 3); Dialog_Utils::makeLabeledEditField(valuesLayout, 4, m_pValuesL, i18n("Length/Values:"), m_pValuesLE, m_pEntityAttribute->getValues()); m_pAutoIncrementCB = new QCheckBox(i18n("&Auto increment"), m_pValuesGB); m_pAutoIncrementCB->setChecked(m_pEntityAttribute->getAutoIncrement()); valuesLayout->addWidget(m_pAutoIncrementCB, 5, 0); m_pNullCB = new QCheckBox(i18n("Allow &null"), m_pValuesGB); m_pNullCB->setChecked(m_pEntityAttribute->getNull()); valuesLayout->addWidget(m_pNullCB, 6, 0); // enable/disable isNull depending on the state of Auto Increment Check Box slotAutoIncrementStateChanged(m_pAutoIncrementCB->isChecked()); m_pAttributesL = new QLabel(i18n("Attributes:"), m_pValuesGB); valuesLayout->addWidget(m_pAttributesL, 7, 0); m_pAttributesCB = new KComboBox(true, m_pValuesGB); #if QT_VERSION < 0x050000 m_pAttributesCB->setCompletionMode(KGlobalSettings::CompletionPopup); #endif valuesLayout->addWidget(m_pAttributesCB, 7, 1); m_pAttributesL->setBuddy(m_pAttributesCB); insertAttribute(m_pEntityAttribute->getAttributes()); insertAttribute(QString::fromLatin1("binary"), m_pAttributesCB->count()); insertAttribute(QString::fromLatin1("unsigned"), m_pAttributesCB->count()); insertAttribute(QString::fromLatin1("unsigned zerofill"), m_pAttributesCB->count()); mainLayout->addWidget(m_pValuesGB); m_pScopeGB = new QGroupBox(i18n("Indexing"), frame); QHBoxLayout* scopeLayout = new QHBoxLayout(m_pScopeGB); scopeLayout->setMargin(margin); m_pNoneRB = new QRadioButton(i18n("&Not Indexed"), m_pScopeGB); scopeLayout->addWidget(m_pNoneRB); /* m_pPublicRB = new QRadioButton(i18n("&Primary"), m_pScopeGB); scopeLayout->addWidget(m_pPublicRB); m_pProtectedRB = new QRadioButton(i18n("&Unique"), m_pScopeGB); scopeLayout->addWidget(m_pProtectedRB); */ m_pPrivateRB = new QRadioButton(i18n("&Indexed"), m_pScopeGB); scopeLayout->addWidget(m_pPrivateRB); mainLayout->addWidget(m_pScopeGB); UMLEntityAttribute::DBIndex_Type scope = m_pEntityAttribute->indexType(); /* if (scope == UMLEntityAttribute::Primary) m_pPublicRB->setChecked(true); else if(scope == UMLEntityAttribute::Unique) m_pProtectedRB->setChecked(true); else */ if (scope == UMLEntityAttribute::Index) m_pPrivateRB->setChecked(true); else { m_pNoneRB->setChecked(true); } m_pNameLE->setFocus(); connect(m_pNameLE, SIGNAL(textChanged(QString)), SLOT(slotNameChanged(QString))); connect(m_pAutoIncrementCB, SIGNAL(clicked(bool)), this, SLOT(slotAutoIncrementStateChanged(bool))); slotNameChanged(m_pNameLE->text()); }
bool CFrmGroupChat::Join(const QString &jid) { if(jid.isEmpty()) return false; QList<QXmppMucRoom*> rooms = CGlobal::Instance()->GetXmppClient()->m_MucManager.rooms(); QXmppMucRoom* r; foreach(r, rooms) { if(r->jid() == jid) { LOG_MODEL_DEBUG("Group chat", "had joined room[%s]", qPrintable(jid)); return false; } } m_pRoom = CGlobal::Instance()->GetXmppClient()->m_MucManager.addRoom(jid); if(m_pRoom) { bool check = connect(m_pRoom, SIGNAL(joined()), SLOT(slotJoined())); Q_ASSERT(check); check = connect(m_pRoom, SIGNAL(left()), SLOT(slotLeft())); Q_ASSERT(check); check = connect(m_pRoom, SIGNAL(nameChanged(QString)), SLOT(slotNameChanged(QString))); Q_ASSERT(check); check = connect(m_pRoom, SIGNAL(error(QXmppStanza::Error)), SLOT(slotError(QXmppStanza::Error))); Q_ASSERT(check); check = connect(m_pRoom, SIGNAL(subjectChanged(QString)), SLOT(slotSubjectChanged(QString))); Q_ASSERT(check); check = connect(m_pRoom, SIGNAL(messageReceived(QXmppMessage)), SLOT(slotMessageReceived(QXmppMessage))); Q_ASSERT(check); check = connect(m_pRoom, SIGNAL(participantAdded(QString)), SLOT(slotParticipantAdded(QString))); Q_ASSERT(check); check = connect(m_pRoom, SIGNAL(participantChanged(QString)), SLOT(slotParticipantChanged(QString))); Q_ASSERT(check); check = connect(m_pRoom, SIGNAL(participantRemoved(QString)), SLOT(slotParticipantRemoved(QString))); Q_ASSERT(check); check = connect(m_pRoom, SIGNAL(permissionsReceived(QList<QXmppMucItem>)), SLOT(slotPermissionsReceived(QList<QXmppMucItem>))); Q_ASSERT(check); check = connect(m_pRoom, SIGNAL(configurationReceived(QXmppDataForm)), SLOT(slotConfigurationReceived(QXmppDataForm))); Q_ASSERT(check); //设置昵称 m_pRoom->setNickName(CGlobal::Instance()->GetRoster()->Name()); //加入房间 return m_pRoom->join(); } return false; }