Beispiel #1
0
void CQExperimentData::slotExperimentDelete()
{
  // Get info from current selection
  size_t index = mpBoxExperiment->currentRow();

  if (index == C_INVALID_INDEX) return;

  std::string key =
    mpFileInfo->getExperiment(TO_UTF8(mpBoxExperiment->item((int) index)->text()))->CCopasiParameter::getKey();

  // change selection
  if (mpBoxExperiment->count() > 1)
    {
      if (mpBoxExperiment->count() > (int)index + 1)
        mpBoxExperiment->setCurrentRow((int)(index + 1));
      else
        mpBoxExperiment->setCurrentRow((int)(index - 1));
    }
  else
    slotExperimentChanged(NULL, NULL);

  // remove experiment
  mpExperimentSetCopy->removeExperiment(mpExperimentSetCopy->keyToIndex(key));
  syncExperiments();

  size_t First, Last;
  mpBtnExperimentAdd->setEnabled(mpFileInfo->getFirstUnusedSection(First, Last));

  // We need to correct mpCheckFrom and mpCheckTo since the removal of the experiment
  // may have changed their status.
  disconnect(mpCheckTo, SIGNAL(toggled(bool)), this, SLOT(slotCheckTo(bool)));
  disconnect(mpCheckFrom, SIGNAL(toggled(bool)), this, SLOT(slotCheckFrom(bool)));

  mpCheckFrom->setChecked(isLikePreviousExperiment(mpExperiment));
  enableEdit(!mpCheckFrom->isChecked());

  if (mpExperiment)
    {
      size_t Next =
        mpExperimentSetCopy->keyToIndex(mpExperiment->CCopasiParameter::getKey()) + 1;

      if (Next < mpExperimentSetCopy->size())
        mpCheckTo->setChecked(isLikePreviousExperiment(mpExperimentSetCopy->getExperiment(Next)));
      else
        mpCheckTo->setChecked(false);
    }

  connect(mpCheckFrom, SIGNAL(toggled(bool)), this, SLOT(slotCheckFrom(bool)));
  connect(mpCheckTo, SIGNAL(toggled(bool)), this, SLOT(slotCheckTo(bool)));
}
Beispiel #2
0
void CQExperimentData::slotExperimentChanged(QListWidgetItem * pCurrentItem, QListWidgetItem * /* pPreviousItem */)
{
  std::string Name;

  if (pCurrentItem != NULL)
    Name = TO_UTF8(pCurrentItem->text());

  CCopasiMessage::clearDeque();

  bool success = true;

  saveExperiment(mpExperiment, true);

  if (pCurrentItem != NULL)
    {
      mpExperiment = mpFileInfo->getExperiment(Name);
      mShown = mpBoxExperiment->currentRow();

      std::ifstream File;
      File.open(CLocaleString::fromUtf8(mpExperiment->getFileName()).c_str());

      size_t CurrentLine = 1;
      success &= mpExperiment->read(File, CurrentLine);

      if (success)
        success &= mpExperiment->compile();
    }
  else
    {
      mpExperiment = NULL;
      mShown =  -1;
    }

  loadExperiment(mpExperiment);

  if (!success && CCopasiMessage::size() > 0 && mShowError)
    {
      CQMessageBox::information(this, "Specification Error", FROM_UTF8(CCopasiMessage::getAllMessageText()),
                                QMessageBox::Ok, QMessageBox::Ok);
      CCopasiMessage::clearDeque();
    }

  enableEdit(!mpCheckFrom->isChecked());
}
Beispiel #3
0
void CQExperimentData::slotCheckFrom(bool checked)
{
  mpCheckFrom->setFocus();

  size_t Current = this->mpBoxExperiment->currentRow();

  if (checked && Current && Current != C_INVALID_INDEX)
    {
      // Load the information from the previous experiment
      CExperiment * pPrevious =
        mpFileInfo->getExperiment(TO_UTF8(mpBoxExperiment->item((int)(Current - 1))->text()));

      unsigned C_INT32 OldWeightMethod = mOldWeightMethod;
      loadExperiment(pPrevious);
      mOldWeightMethod = OldWeightMethod;

      // Load the experiment individual information.
      mpEditName->setText(FROM_UTF8(mpExperiment->getObjectName()));
      QString Row = (mpExperiment->getFirstRow() == InvalidIndex) ?
                    "" : QString::number(mpExperiment->getFirstRow());
      mpEditFirst->setText(Row);
      Row = (mpExperiment->getLastRow() == InvalidIndex) ?
            "" : QString::number(mpExperiment->getLastRow());
      mpEditLast->setText(Row);

      mpValidatorName->saved();
      mpValidatorFirst->saved();
      mpValidatorLast->saved();
    }
  else
    {
      loadExperiment(mpExperiment);
    }

  // loadExperiment determines the status of mpCheckFrom and may have overwritten
  // the desired setting. We correct that here.
  disconnect(mpCheckFrom, SIGNAL(toggled(bool)), this, SLOT(slotCheckFrom(bool)));
  mpCheckFrom->setChecked(checked);
  connect(mpCheckFrom, SIGNAL(toggled(bool)), this, SLOT(slotCheckFrom(bool)));

  enableEdit(!checked);
}
Beispiel #4
0
int Controller::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QToolBox::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: channelChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: velocityChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: base_octaveChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: transposeChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 4: enableEdit((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 5: durationChanged((*reinterpret_cast< QAction*(*)>(_a[1]))); break;
        case 6: pauseFlag((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: dotEnable((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 8: setCurrentChannel((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 9: setCurrentVelocity((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 10: setCurrentBase_octave((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 11: setCurrentTranspose((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 12: setCurrentSpeed((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 13: setCurrentMeter((*reinterpret_cast< Meter(*)>(_a[1]))); break;
        case 14: setCurrentKey((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 15: on_btn_note_dot_clicked((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 16: on_btn_run_clicked(); break;
        case 17: on_slider_speed_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 18: on_slider_meter_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 19: on_slider_key_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 20: on_slider_transpose_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 21: on_slider_base_octave_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 22: on_slider_channel_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 23: on_slider_velocity_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 24: durationCheck((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 25: pauseCheck((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 26;
    }
    return _id;
}