TOPPASOutputFilesDialog::TOPPASOutputFilesDialog(const QString & dir_name, int num_jobs) { setupUi(this); if (dir_name != "") { line_edit->setText(dir_name); } else { line_edit->setText(QDir::currentPath()); } if (num_jobs >= 1) { num_jobs_box->setValue(num_jobs); } QCompleter * completer = new QCompleter(this); QDirModel * dir_model = new QDirModel(completer); dir_model->setFilter(QDir::AllDirs); completer->setModel(dir_model); line_edit->setCompleter(completer); connect(browse_button, SIGNAL(clicked()), this, SLOT(showFileDialog())); connect(ok_button, SIGNAL(clicked()), this, SLOT(checkValidity_())); connect(cancel_button, SIGNAL(clicked()), this, SLOT(reject())); // make Ok the default (just pressing Enter will run the workflow) ok_button->setFocus(); }
TOPPASIOMappingDialog::TOPPASIOMappingDialog(TOPPASEdge * parent) { edge_ = parent; setupUi(this); connect(ok_button, SIGNAL(clicked()), this, SLOT(checkValidity_())); connect(cancel_button, SIGNAL(clicked()), this, SLOT(reject())); fillComboBoxes_(); }
int TOPPASIOMappingDialog::firstExec() { // check if only 1 parameter, if yes: select it if (source_combo->count() == 2) // <select> + 1 parameter { source_combo->setCurrentIndex(1); } if (target_combo->count() == 2) { target_combo->setCurrentIndex(1); } // is there only 1 possible mapping? -> do not show dialog if ((source_combo->count() == 2 || source_combo->count() == 0) && (target_combo->count() == 2 || target_combo->count() == 0)) { checkValidity_(); return QDialog::Accepted; } else { return QDialog::exec(); } }