コード例 #1
0
/*
    Start updating.
    Implementation of VariableNameManager's virtual funtion to establish a connection to a PV as the variable name has changed.
    This function may also be used to initiate updates when loaded as a plugin.
*/
void QEGenericButton::establishConnection( unsigned int variableIndex ) {

    // Create a connection.
    // If successfull, the QCaObject object that will supply data update signals will be returned
    qcaobject::QCaObject* qca = createConnection( variableIndex );

    // If a QCaObject object is now available to supply data update signals, connect it to the appropriate slots
    if(  qca ) {
        // Get updates if subscribing and if this is the alternate read back, or if this is the primary readback and there is no alternate read back.
        if( subscribe &&
            (
              ( variableIndex == 1 /*1=Alternate readback variable*/ ) ||
              ( variableIndex == 0 /*0=Primary readback variable*/ && getSubstitutedVariableName(1/*1=Alternate readback variable*/ ).isEmpty() )
            )
          )
        {
            if( updateOption == UPDATE_TEXT || updateOption == UPDATE_TEXT_AND_ICON)
            {
                setButtonText( "" );
            }
            connectButtonDataChange( qca );
        }

        // Get conection status changes always (subscribing or not)
        QObject::connect( qca,  SIGNAL( stringConnectionChanged( QCaConnectionInfo&, const unsigned int& ) ),
                          getButtonQObject(), SLOT( connectionChanged( QCaConnectionInfo&, const unsigned int&) ) );
    }
}
コード例 #2
0
ファイル: QEPeriodic.cpp プロジェクト: rorydog1/epics
/*
    Implementation of QEWidget's virtual funtion to create the specific type of QCaObject required.
    For a push button a QCaObject that streams strings is required.
*/
qcaobject::QCaObject* QEPeriodic::createQcaItem( unsigned int variableIndex ) {

    // Reflect the initial disconnected state if there is a write PVs.
    // If there are no write PVs, leave it enabled it as this widget can be used to signal
    // an element selection as well as write element related values.
    if( writeButton && ( variableIndex == WRITE_VARIABLE_1 || variableIndex == WRITE_VARIABLE_2 ))
    {
        writeButton->setEnabled( false );
    }

    // Create the items as a QEFloating
    return new QEFloating( getSubstitutedVariableName( variableIndex ), this, &floatingFormatting, variableIndex );
}
コード例 #3
0
/*
    Act on a connection change.
    Change how the label looks and change the tool tip
    This is the slot used to recieve connection updates from a QCaObject based class.
 */
void QEGenericButton::connectionChanged( QCaConnectionInfo& connectionInfo, const unsigned int& variableIndex )
{
    // Do nothing if no variable name, but there is a program to run or a new gui to open.
    // Most widgets will be dissabled at this point if there is no good connection to a PV,
    // but this widget may be doing other stuff (running a program of starting a GUI)
    if( getSubstitutedVariableName( variableIndex ).isEmpty() )
        return;

    // Note the connected state
    isConnected = connectionInfo.isChannelConnected();

    // Display the connected state
    updateToolTipConnection( isConnected, variableIndex );
    updateConnectionStyle( isConnected );
}
コード例 #4
0
ファイル: QEPeriodic.cpp プロジェクト: rorydog1/epics
//==============================================================================
// Copy / Paste
QString QEPeriodic::copyVariable()
{
    QString text;
    for( int i = 0; i < QEPERIODIC_NUM_VARIABLES; i++ )
    {
        QString pv = getSubstitutedVariableName(i);
        if( !pv.isEmpty() )
        {
            if( !text.isEmpty() )
                text.append( " " );
            text.append( pv );
        }
    }

    return text;
//    return getSubstitutedVariableName(0);
}
コード例 #5
0
/*
  Implement a slot to set the current text of the push button
  This is the slot used to recieve data updates from a QCaObject based class.
*/
void QEGenericButton::setGenericButtonText( const QString& text, QCaAlarmInfo& alarmInfo, QCaDateTime&, const unsigned int& variableIndex )
{
    // If not subscribing, or subscribing but update is not for the readback variable, then do nothing.
    //
    // Note, This will still be called even if not subscribing as there may be an initial sing shot read
    // to ensure we have valid information about the variable when it is time to do a write.
    //
    // Note, variableIndex = 0 = Primary readback variable, variableIndex = 1 = Alternate readback variable,
    // so an update for variable 1 is always OK, an update from variable 0 is OK as long as there is no variable 1
    if( !subscribe || ( variableIndex == 0 && !getSubstitutedVariableName( 1 ).isEmpty() ))
    {
        return;
    }

    // Signal a database value change to any Link widgets
    emitDbValueChanged( text );

    // Update the button state if required
    // Display checked if text matches what is written when checked
    if( updateOption == UPDATE_STATE )
    {
        setButtonState( !text.compare( clickCheckedText ) );
    }

    // Update the text if required
    if( updateOption == UPDATE_TEXT || updateOption == UPDATE_TEXT_AND_ICON )
    {
        setButtonText( text );
    }

    // Update the icon if required
    if( updateOption == UPDATE_ICON || updateOption == UPDATE_TEXT_AND_ICON )
    {
        QIcon icon;
        icon.addPixmap( getDataPixmap( text ) );
        setButtonIcon( icon );
    }

    // Invoke common alarm handling processing.
    processAlarmInfo( alarmInfo, variableIndex );
}
コード例 #6
0
//==============================================================================
// Copy paste
QString QESpinBox::copyVariable()
{
    return getSubstitutedVariableName( 0 );
}
コード例 #7
0
QVariant QESpinBox::getDrop()
{
    return QVariant( getSubstitutedVariableName(0) );
}
コード例 #8
0
/*
    Implementation of QEWidget's virtual funtion to create the specific type of QCaObject required.
    For a spin box a QCaObject that streams integers is required.
*/
qcaobject::QCaObject* QESpinBox::createQcaItem( unsigned int variableIndex ) {

    // Create the item as a QEInteger
    return new QEFloating( getSubstitutedVariableName( variableIndex ), this, &floatingFormatting, variableIndex );
}
コード例 #9
0
ファイル: QCaLineEdit.cpp プロジェクト: emayssat/sandbox
/*!
    Implementation of QCaWidget's virtual funtion to create the specific type of QCaObject required.
    For a line edit a QCaObject that streams strings is required.
*/
qcaobject::QCaObject* QCaLineEdit::createQcaItem( unsigned int variableIndex ) {

    // Create the item as a QCaString
    return new QCaString( getSubstitutedVariableName( variableIndex ), this, &stringFormatting, variableIndex );
}
コード例 #10
0
//==============================================================================
// Copy / Paste
QString QESlider::copyVariable()
{
    return getSubstitutedVariableName(0);
}
コード例 #11
0
ファイル: QEGenericEdit.cpp プロジェクト: rorydog1/epics
//==============================================================================
// Copy / Paste
QString QEGenericEdit::copyVariable()
{
    return getSubstitutedVariableName(0);
}
コード例 #12
0
ファイル: QEGenericEdit.cpp プロジェクト: rorydog1/epics
//------------------------------------------------------------------------------
//
QVariant QEGenericEdit::getDrop()
{
    return QVariant( getSubstitutedVariableName(0) );
}
コード例 #13
0
ファイル: QELabel.cpp プロジェクト: rorydog1/epics
//==============================================================================
// Copy / Paste
QString QELabel::copyVariable()
{
    return getSubstitutedVariableName(0);
}
コード例 #14
0
/*
    Implementation of QEWidget's virtual funtion to create the specific type of QCaObject required.
    For a push button a QCaObject that streams strings is required.
*/
qcaobject::QCaObject* QEGenericButton::createQcaItem( unsigned int variableIndex ) {

    // Create the item as a QEString
    return new QEString( getSubstitutedVariableName( variableIndex ), getButtonQObject(), &stringFormatting, variableIndex );
}