bool processMenu(int choice) { string name; switch(choice-1) { case CREATE_NODE: createNode(); break; case DELETE_NODE: deleteNode(); break; case CREATE_RELATION: createRelation(); break; case DELETE_RELATION: deleteRelation(); break; case SAVE_GRAPH: saveGraph(); break; case LOAD_GRAPH: loadGraph(); break; case DISPLAY_GRAPH: displayGraph(); break; case RUN_PRIM: runPrim(); break; case QUIT: return true; break; default: cout << "Invalid input" << endl; cout << endl; break; } return false; }
ChooseTemporalRelationPanel::ChooseTemporalRelationPanel(unsigned int ID1, unsigned int ID2, MaquetteScene *scene, QWidget *parent) : QDialog(parent) { setWindowModality(Qt::WindowModal); _scene = scene; _ent1ID = ID1; _ent2ID = ID2; _layout = new QGridLayout(this); setLayout(_layout); _relationTypeBox = new QGroupBox(tr("Relation type")); _allenRadio = new QRadioButton(tr("Allen relation")); _intervalRadio = new QRadioButton(tr("Interval")); QVBoxLayout *vbox = new QVBoxLayout; vbox->addWidget(_allenRadio); connect(_allenRadio, SIGNAL(toggled(bool)), this, SLOT(allenRadioToggled())); vbox->addWidget(_intervalRadio); connect(_intervalRadio, SIGNAL(toggled(bool)), this, SLOT(intervalRadioToggled())); vbox->addStretch(1); _relationTypeBox->setLayout(vbox); _layout->addWidget(_relationTypeBox, 0, 0, 4, 1); _allenComboBox = new QComboBox(this); _allenComboBox->addItem(tr("before"), ALLEN_BEFORE); _allenComboBox->addItem(tr("after"), ALLEN_AFTER); _allenComboBox->addItem(tr("meets"), ALLEN_MEETS); _allenComboBox->addItem(tr("during"), ALLEN_DURING); _allenComboBox->addItem(tr("equals"), ALLEN_EQUALS); _allenComboBox->addItem(tr("overlaps"), ALLEN_OVERLAPS); _allenComboBox->addItem(tr("starts"), ALLEN_STARTS); _allenComboBox->addItem(tr("finishes"), ALLEN_FINISHES); _allenComboBox->setEnabled(false); _name1 = new QLabel(_scene->getBox(_ent1ID)->name(), this); _name2 = new QLabel(_scene->getBox(_ent2ID)->name(), this); _relationLayout = new QGridLayout(); _relationLayout->addWidget(_name1, 0, 0, 1, 3); _relationLayout->addWidget(_allenComboBox, 0, 3, 1, 3); _relationLayout->addWidget(_name2, 0, 6, 1, 3); _layout->addLayout(_relationLayout, 1, 1, 1, 3); _intervalBox = new QGroupBox(tr("Interval parameters")); _valueBox = new QSpinBox(); _valueBox->setMinimum(0); _valueBox->setMaximum(10000); _valueBox->setValue((_scene->getBox(_ent1ID)->beginPos() + _scene->getBox(_ent2ID)->width() < _scene->getBox(_ent2ID)->beginPos()) ? (_scene->getBox(_ent2ID)->beginPos() - (_scene->getBox(_ent1ID)->beginPos() + _scene->getBox(_ent1ID)->width())) : 0); _toleranceBox = new QSpinBox(); _toleranceBox->setMinimum(0); _toleranceBox->setMaximum(1000); _toleranceBox->setValue(0); QVBoxLayout *vbox2 = new QVBoxLayout; vbox2->addWidget(_valueBox); vbox2->addWidget(_toleranceBox); vbox2->addStretch(1); _intervalBox->setLayout(vbox2); _intervalBox->setEnabled(false); _layout->addWidget(_intervalBox, 2, 1, 1, 3); _okButton = new QPushButton(tr("OK"), this); connect(_okButton, SIGNAL(clicked()), this, SLOT(createRelation())); _layout->addWidget(_okButton, 3, 2, 1, 1); _cancelButton = new QPushButton(tr("Cancel"), this); connect(_cancelButton, SIGNAL(clicked()), this, SLOT(reject())); _layout->addWidget(_cancelButton, 3, 3, 1, 1); }