Example #1
0
bool
QuanConfigForm::setContents( const adcontrols::QuanMethod& m )
{
    ui_accessor accessor(ui);

    QWidget * w = 0;
    
    if ( auto combo = dynamic_cast<QComboBox *>(accessor( idComboPolynomials )) ) {
        uint32_t order = m.polynomialOrder() - 2;
        switch( m.equation() ) {
        case adcontrols::QuanMethod::idCalibOnePoint:      combo->setCurrentIndex( 0 ); break;
        case adcontrols::QuanMethod::idCalibLinear_origin: combo->setCurrentIndex( 1 ); break;
        case adcontrols::QuanMethod::idCalibLinear:        combo->setCurrentIndex( 2 ); break;
        case adcontrols::QuanMethod::idCalibPolynomials:   combo->setCurrentIndex( 3 + order ); break;
        }
    }

    if ( m.isChromatogram() ) {
        if ( auto radioButton = dynamic_cast< QRadioButton * >( accessor( idRadioChromatogram ) ) )
            radioButton->setChecked( true );
    } else {
        if ( auto radioButton = dynamic_cast< QRadioButton * >( accessor( idRadioInfusion ) ) )
            radioButton->setChecked( true );
    }
    if ( auto gbx = dynamic_cast<QGroupBox *>(accessor( idCbxWeighting )) ) {
        if ( m.isWeighting() )
            gbx->setChecked( true );
        else
            gbx->setChecked( false );
    }
    w = 0;
    switch ( m.weighting() ) {
    case adcontrols::QuanMethod::idWeight_C1: w = accessor( idRadio_C1 ); break;
    case adcontrols::QuanMethod::idWeight_C2: w = accessor( idRadio_C2 ); break;
    case adcontrols::QuanMethod::idWeight_C3: w = accessor( idRadio_C3 ); break;
    case adcontrols::QuanMethod::idWeight_Y1: w = accessor( idRadio_Y1 ); break;
    case adcontrols::QuanMethod::idWeight_Y2: w = accessor( idRadio_Y2 ); break;
    case adcontrols::QuanMethod::idWeight_Y3: w = accessor( idRadio_Y3 ); break;
    }
    if ( auto radioButton = dynamic_cast<QRadioButton *>(w) ) {
        radioButton->setChecked( true );
    }
    if ( m.isInternalStandard() ) {
        if ( auto radioButton = dynamic_cast<QRadioButton *>(accessor( idRadioInternalStandard )) )
            radioButton->setChecked( true );
    } else {
        if ( auto radioButton = dynamic_cast<QRadioButton *>(accessor( idRadioExternalStandard )) )
            radioButton->setChecked( true );
    }
    if ( auto spin = dynamic_cast< QSpinBox *>( accessor(idSpinLevel))) {
        spin->setValue( m.levels());
    }
    if ( auto spin = dynamic_cast< QSpinBox *>( accessor(idSpinReplicates))) {
        spin->setValue( m.replicates() );
    }
    return true;
}
Example #2
0
bool
QuanConfigForm::getContents( adcontrols::QuanMethod& m )
{
    ui_accessor accessor( ui );

    if ( auto combo = dynamic_cast<QComboBox *>(accessor( idComboPolynomials )) ) {
        uint32_t idEq = combo->currentIndex();
        if ( idEq == 0 )
            m.equation( adcontrols::QuanMethod::idCalibOnePoint );
        else if ( idEq == 1 )
            m.equation( adcontrols::QuanMethod::idCalibLinear_origin );
        else if ( idEq == 2 )
            m.equation( adcontrols::QuanMethod::idCalibLinear );
        else if ( idEq >= 3 ) {
            m.equation( adcontrols::QuanMethod::idCalibPolynomials );
            m.polynomialOrder( idEq - 3 + 2 );
        }
    }

    if ( auto radioButton = dynamic_cast<QRadioButton *>(accessor( idRadioChromatogram )) )
        if ( radioButton->isChecked() )
            m.isChromatogram( true );
    if ( auto radioButton = dynamic_cast<QRadioButton *>(accessor( idRadioInfusion )) ) {
        if ( radioButton->isChecked() )
            m.isChromatogram( false );
    }
    if ( auto gbx = dynamic_cast<QGroupBox *>(accessor( idCbxWeighting )) ) {
        m.isWeighting( gbx->isChecked() );
    }

    do {
        static const idItem items[] = { idRadio_C1, idRadio_C2, idRadio_C3, idRadio_Y1, idRadio_Y2, idRadio_Y3 };
        for ( auto& id : items ) {
            if ( auto radio = dynamic_cast<QRadioButton *>(accessor( id )) ) {
                if ( radio->isChecked() ) {
                    m.weighting( static_cast<adcontrols::QuanMethod::CalibWeighting>(id - items[ 0 ]) );
                    break;
                }
            }
        }
    } while ( 0 );

    if ( auto radioButton = dynamic_cast<QRadioButton *>(accessor( idRadioInternalStandard )) ) {
        if ( radioButton->isChecked() )
            m.isInternalStandard( true );
        else
            m.isInternalStandard( false );
    }

    if ( auto spin = dynamic_cast< QSpinBox *>( accessor(idSpinLevel))) {
        int value = spin->value();
        m.levels( value );
    }
    if ( auto spin = dynamic_cast< QSpinBox *>( accessor(idSpinReplicates))) {
        m.replicates( spin->value() );
    }
    return true;
}
Example #3
0
bool
QuanConfigForm::getContents( adcontrols::QuanMethod& m )
{
    ui_accessor accessor( ui );

    if ( auto combo = qobject_cast<QComboBox *>(accessor( idComboPolynomials )) ) {
        uint32_t idEq = combo->currentIndex();
        if ( idEq == 0 )
            m.equation( adcontrols::QuanMethod::idCalibOnePoint );
        else if ( idEq == 1 )
            m.equation( adcontrols::QuanMethod::idCalibLinear_origin );
        else if ( idEq == 2 )
            m.equation( adcontrols::QuanMethod::idCalibLinear );
        else if ( idEq >= 3 ) {
            m.equation( adcontrols::QuanMethod::idCalibPolynomials );
            m.polynomialOrder( idEq - 3 + 2 );
        }
    }
    
    if ( auto combo = qobject_cast<QComboBox *>( accessor( idComboDebugLevel ) ) ) {
        uint32_t debuglevel = combo->currentIndex();
        m.set_debug_level( debuglevel * 2 );  // 0, 2, 4
    }
    if ( auto cbx = qobject_cast<QCheckBox *>(accessor( idCbxSaveOnDataSource )) ) {
        bool save = cbx->isChecked();
        m.set_save_on_datasource( save );
    }

    if ( auto radioButton = qobject_cast<QRadioButton *>(accessor( idRadioCounting )) )
        if ( radioButton->isChecked() )
            m.setIsCounting( true );
    if ( auto radioButton = qobject_cast<QRadioButton *>(accessor( idRadioChromatogram )) )
        if ( radioButton->isChecked() )
            m.setIsChromatogram( true );
    if ( auto radioButton = qobject_cast<QRadioButton *>(accessor( idRadioInfusion )) ) {
        if ( radioButton->isChecked() )
            m.setIsChromatogram( false );
    }
    if ( auto gbx = qobject_cast<QGroupBox *>(accessor( idCbxWeighting )) ) {
        m.setIsWeighting( gbx->isChecked() );
    }

    do {
        static const idItem items[] = { idRadio_C1, idRadio_C2, idRadio_C3, idRadio_Y1, idRadio_Y2, idRadio_Y3 };
        for ( auto& id : items ) {
            if ( auto radio = qobject_cast<QRadioButton *>(accessor( id )) ) {
                if ( radio->isChecked() ) {
                    m.setWeighting( static_cast<adcontrols::QuanMethod::CalibWeighting>(id - items[ 0 ]) );
                    break;
                }
            }
        }
    } while ( 0 );

    if ( auto radioButton = qobject_cast<QRadioButton *>(accessor( idRadioInternalStandard )) ) {
        if ( radioButton->isChecked() )
            m.setIsInternalStandard( true );
        else
            m.setIsInternalStandard( false );
    }

    if ( auto spin = qobject_cast< QSpinBox *>( accessor(idSpinLevel))) {
        int value = spin->value();
        m.setLevels( value );
    }
    if ( auto spin = qobject_cast< QSpinBox *>( accessor(idSpinReplicates))) {
        m.setReplicates( spin->value() );
    }
    return true;
}