Ejemplo n.º 1
0
bool Service::updateScientist(Scientist scientistUpdate) {
    string bufferFirstName = scientistUpdate.getF(),
           bufferLastName  = "";

    seperateFirstLast(bufferFirstName, bufferLastName);

    Scientist nameUpdated(scientistUpdate.getId(),
                          bufferFirstName, bufferLastName,
                          scientistUpdate.getGender(),
                          scientistUpdate.getYearBorn(),
                          scientistUpdate.getYearDied(),
                          scientistUpdate.getKnownFor());

    return scientistRepository.updateScientist(nameUpdated);
}
void GenericTimeDataUI::initControlWidget() {
    QWidget * _widget=new QWidget();//Create the widget for these controls
    //setting font base dimension
    QFont f=*(new QFont());
    f.setPointSize(PLOTWIDGET_DEFAULT_PLOT_DIMENSION);

    //Widget  layout
    QVBoxLayout * l=new QVBoxLayout();
    l->setSizeConstraint(QLayout::SetMinimumSize);
    _widget->setLayout(l);
    _widget->setFont(f);

    //Name the curve
    QLabel * _nameLabel=new QLabel("Curve name",this);
    _nameLabel->setFont(f);
    _nameLabel->setAlignment(Qt::AlignCenter);

    m_baseControl.lineName= new QLineEdit("m_genericTimeData->name()",this);
    m_baseControl.lineName->setFont(f);
    connect( m_baseControl.lineName,SIGNAL(editingFinished()), this ,SLOT(nameUpdated()));

    //Show curve
    m_baseControl.checkBoxShowCurve=new QCheckBox("Show curve",this);
    m_baseControl.checkBoxShowCurve->setFont(f);
    connect(m_baseControl.checkBoxShowCurve,SIGNAL(toggled(bool)),this,SIGNAL(showCurveUIChanged(bool)));

    //Enable curve
    m_baseControl.checkBoxEnableCurve=new QCheckBox("Enable curve",this);
    m_baseControl.checkBoxEnableCurve->setFont(f);
    connect(m_baseControl.checkBoxEnableCurve,SIGNAL(toggled(bool)),this,SIGNAL(enableCurveUIChanged(bool)));

    //Curve color
    m_baseControl.comboColor=new ComboBoxWidgetColor();
    m_baseControl.comboColor->setFont(f);
    connect(m_baseControl.comboColor, SIGNAL(colorChanged(QColor)),this,SIGNAL(colorUIChanged(QColor)));

    //XML Button
    m_baseControl.exportXML=new QPushButton("Export");
    m_baseControl.exportXML->setFont(f);
    connect(m_baseControl.exportXML ,SIGNAL(pressed()),this,SIGNAL(buttonExportXMLPressed()));

    m_baseControl.importXML=new QPushButton("Import");
    m_baseControl.importXML->setFont(f);
    connect(m_baseControl.importXML ,SIGNAL(pressed()),this,SIGNAL(buttonImportXMLPressed()));

    m_baseControl.showXML=new QPushButton("Show data");
    m_baseControl.showXML->setFont(f);
  //  connect(m_baseControl.showXML ,SIGNAL(clicked()),this,SLOT(showXML()));

    //C&P Button
    m_baseControl.copy=new QPushButton("Copy");
    m_baseControl.copy->setFont(f);
    connect(m_baseControl.copy ,SIGNAL(pressed()),this,SIGNAL(buttonCopyPressed()));

    m_baseControl.paste=new QPushButton("Paste");
    m_baseControl.paste->setFont(f);
    connect(m_baseControl.paste ,SIGNAL(pressed()),this,SIGNAL(buttonPastePressed()));


    //Layouting XML button & C&P button
    QGridLayout * _lButton=new QGridLayout();
    _lButton->addWidget(m_baseControl.exportXML,0,0,1,1,Qt::AlignLeft);
    _lButton->addWidget(m_baseControl.importXML,0,1,1,1,Qt::AlignLeft);
    _lButton->addWidget(m_baseControl.showXML,0,2,1,1,Qt::AlignLeft);
    _lButton->addWidget(m_baseControl.copy,1,0,1,1,Qt::AlignLeft);
    _lButton->addWidget(m_baseControl.paste,1,1,1,1,Qt::AlignLeft);
    _lButton->setSizeConstraint(QLayout::SetMaximumSize);
    QWidget *_buttonWidget=new QWidget(this);
    _buttonWidget->setLayout((QLayout*)_lButton);

    //Lay out all the controls
    l->addWidget(_nameLabel,1,Qt::AlignLeft);
    l->addWidget(m_baseControl.lineName,1,Qt::AlignLeft);
    l->addWidget(m_baseControl.checkBoxEnableCurve,1,Qt::AlignLeft);
    l->addWidget(m_baseControl.checkBoxShowCurve,1,Qt::AlignLeft);
    l->addWidget(m_baseControl.comboColor,1,Qt::AlignLeft);
    l->addWidget(_buttonWidget,1,Qt::AlignLeft);

    //Add the local widget to the framework widget
    this->addWidget(_widget, "Generic time Controls");
}