Пример #1
0
void CQFittingWidget::slotCrossValidationData()
{
  CQExperimentData * pDialog = new CQExperimentData(this);
  pDialog->load(mpCrossValidationSet, mpDataModel);

  connect(pDialog, SIGNAL(experimentChanged()), mpParameters, SLOT(slotCrossValidationChanged()));
  connect(pDialog, SIGNAL(experimentChanged()), mpConstraints, SLOT(slotCrossValidationChanged()));

  pDialog->exec();

  pdelete(pDialog);
}
Пример #2
0
void CQExperimentData::slotOK()
{
  mpBtnOK->setFocus();

  // Force the save all current changes.
  slotExperimentChanged(NULL, NULL);

  CExperiment * pExperiment;

  size_t i = mpExperimentSet->getExperimentCount() - 1;

  for (; i != C_INVALID_INDEX; i--)
    {
      pExperiment =
        dynamic_cast<CExperiment *>(CCopasiRootContainer::getKeyFactory()->get(mKeyMap[mpExperimentSet->getExperiment(i)->CCopasiParameter::getKey()]));

      if (pExperiment)
        {
          *mpExperimentSet->getExperiment(i) = *pExperiment;
          mpExperimentSetCopy->removeParameter(pExperiment->getObjectName());
        }
      else
        mpExperimentSet->removeExperiment(i);
    }

  emit experimentChanged();

  for (i = 0; i < mpExperimentSetCopy->getExperimentCount(); i++)
    mpExperimentSet->addExperiment(*mpExperimentSetCopy->getExperiment(i));

#ifdef COPASI_CROSSVALIDATION

  if (mCrossValidation)
    {
      CCrossValidationSet * pSet = static_cast< CCrossValidationSet * >(mpExperimentSet);

      if (QString::number(pSet->getWeight()) != mpEditWeight->text())
        {
          pSet->setWeight(mpEditWeight->text().toDouble());
        }

      if (QString::number(pSet->getThreshold()) != mpEditThreshold->text())
        {
          pSet->setThreshold(mpEditThreshold->text().toUInt());
        }
    }

#endif // COPASI_CROSSVALIDATION

  pdelete(mpExperimentSetCopy);
  accept();
}
Пример #3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    QLocale::setDefault(QLocale::English);
    //setAttribute(Qt::WA_DeleteOnClose,true);
    ui->setupUi(this);
    experimentSettings=new QSettings (QSettings::IniFormat,QSettings::UserScope,QApplication::organizationName(),"experiment",this);
    experiment=new Experiment();

    tcp=new TcpServer(this);
    tcp->setExperiment(experiment);
    udp=new UdpServer(this);
    udp->setExperiment(experiment);

    connect(tcp,SIGNAL(warning(QString)),SLOT(warning(QString)));
    connect(tcp,SIGNAL(notify(QString)),SLOT(notify(QString)));

    //bind tcp socket to local port 25050
    tcp->bind(25050);

    connect(experiment,SIGNAL(statusChanged(bool)),tcp,SLOT(experimentStatusChanged(bool)));
    connect(experiment,SIGNAL(intervalChanged(int)),tcp,SLOT(experimentIntervalChanged(int)));
    connect(experiment,SIGNAL(TcpForbidden(QString)),tcp,SLOT(experimentForbidden(QString)));


    connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close()));
    connect(ui->actionFullscreen,SIGNAL(triggered(bool)),this,SLOT(setFullscreen(bool)));
    connect(ui->actionAbout_Qt,SIGNAL(triggered()),this,SLOT(showAboutQt()));
    connect(ui->actionNew_experiment,SIGNAL(triggered()),this,SLOT(getExperiment()));
    connect(ui->actionSave,SIGNAL(triggered()),experiment,SLOT(saveFile()));
    connect(ui->actionSave_as,SIGNAL(triggered()),this,SLOT(getFile()));
    connect(ui->actionStartMeasure,SIGNAL(toggled(bool)),experiment,SLOT(start(bool)));
    connect(ui->actionMeasuring_interval,SIGNAL(triggered()),this,SLOT(changeMeasureIntervalDialog()));
    connect(ui->actionControls,SIGNAL(triggered()),SLOT(showExperimentControlMangement()));
    connect(ui->actionData,SIGNAL(triggered()),SLOT(showData()));

    connect(experiment,SIGNAL(statusChanged(bool)),ui->actionStartMeasure,SLOT(setChecked(bool)));
    connect(experiment,SIGNAL(statusChanged(bool)),this,SLOT(statusChanged(bool)));
    connect(experiment,SIGNAL(experimentChanged(QString)),this,SLOT(setExperiment(QString)));
    connect(experiment,SIGNAL(measured(QString)),ui->plainTextEdit,SLOT(appendPlainText(QString)));
    connect(experiment,SIGNAL(fileChanged(QString)),this,SLOT(setFile(QString)));
    connect(experiment,SIGNAL(Notify(QString)),SLOT(notify(QString)));
    connect(experiment,SIGNAL(intervalChanged(int)),SLOT(setMeasureInterval(int)));
    connect(experiment,SIGNAL(updateProgress(int)),ui->measureIntervalProgressBar,SLOT(setValue(int)));

    connect(tcp,SIGNAL(clientCountChanged(int)),&tcpClientsLabel,SLOT(setNum(int)));

    experiment->setInterval(2000);

    // Additional ui preparation
    experimentLabel.setToolTip("Experiment configuration");
    statusLabel.setToolTip("Experiment status:\nR - running\nS - stopped");
    QFont font(statusLabel.font());
    font.setBold(true);
    statusLabel.setFont(font);
    //set experiment status to stopped
    statusChanged(false);
    tcpClientsLabel.setToolTip("Number of tcp clients");
    tcpClientsLabel.setNum(0);

    statusBar()->addPermanentWidget(&tcpClientsLabel);
    statusBar()->addPermanentWidget(&fileLabel);
    statusBar()->addPermanentWidget(&experimentLabel);
    statusBar()->addPermanentWidget(&statusLabel);

    // Ask user to select experiment
    getExperiment();
}