Пример #1
0
void EWAUserActionsEditorDialog::on_pChangeCoordsButton_clicked()
{
    EWAUserAction *pAction = getCurrentAction();
    if( !pAction || !pAction->isMouseEvent() )
    {
        return;
    }
    
    QDialog *pDlg = new QDialog( this );
    Ui::EWAPointEditorDlgUi dlgUi;
    dlgUi.setupUi( pDlg );
    
    QPoint pnt = pAction->getClickCoords();
    dlgUi.pXCoordSpinBox->setValue( pnt.x() );
    dlgUi.pYCoordSpinBox->setValue( pnt.y() );
    
    if( pDlg->exec() == QDialog::Accepted )
    {
        QModelIndex currModelId = ui.pTableView->currentIndex();
        
        pAction->setClickCoords( QPoint( dlgUi.pXCoordSpinBox->value(), dlgUi.pYCoordSpinBox->value() ) );
        initModel();
        
        enbleItem( currModelId.row() );
    }
    
    delete pDlg;
}
Пример #2
0
void EWAUserActionsEditorDialog::on_pNormalizeDelaysButton_clicked()
{
    bool ok = false;
    double dMinDelay = 0.001*(double)EWAUserActionsProcessor::getMinActDelay();
    double dCurrTime = dMinDelay;
    double dMaxDelay = 3.;
    EWAUserAction *pAction = getCurrentAction();
    if( pAction )
    {
        dCurrTime = 0.001*pAction->getTime();
    }
    
    double dNewPeriod = QInputDialog::getDouble( 
    this, 
    tr( "Common delay" ), 
    tr( "Input new value [%1...%2]:" ).arg( dMinDelay ).arg( dMaxDelay ),
    qMax( dCurrTime, dMinDelay ),
    dMinDelay,
    dMaxDelay, 
    3, 
    &ok );
    if( ok && m_sitePtr )
    {
        m_sitePtr->getEWANetworkManagerPtr()->setCommonDelayForActions( m_pStoredPages, dNewPeriod*1000 );
        
        QModelIndex currModelId = ui.pTableView->currentIndex();
        
        initModel();
        
        enbleItem( currModelId.row() );
    }
}
Пример #3
0
void EWAUserActionsEditorDialog::enbleItem( int iNum )
{
	if( iNum < 0 || iNum >= m_pModel->rowCount() )
		return;

    ui.pChangeCoordsButton->setEnabled( false );
    for( int i = 0; i<m_pModel->rowCount(); i++ )
    {
        for( int j = 0; j<m_pModel->columnCount(); j++ )
        {
            m_pModel->item( i, j )->setEnabled( i == iNum );
        }
    }
    
    for( int j = 0; j<m_pModel->columnCount(); j++ )
    {
        m_pModel->item( iNum, j )->setEnabled( true );
    }
    QModelIndex index = m_pModel->index( iNum, 0 );
    if( index.isValid() && index != ui.pTableView->currentIndex() )
    {
        ui.pTableView->setCurrentIndex( index );
        ui.pTableView->scrollTo( index );
    }
    
    EWAUserAction *pAction = getCurrentAction();
    if( pAction && pAction->isMouseEvent() )
    {
        ui.pChangeCoordsButton->setEnabled( true );
    }
}
Пример #4
0
/**
 * @return Available commands of the application or the current action.
 */
RS_StringList QG_ActionHandler::getAvailableCommands() {
    RS_ActionInterface* currentAction = getCurrentAction();

    if (currentAction!=NULL) {
        return currentAction->getAvailableCommands();
    } else {
        RS_StringList cmd;
        cmd += "line";
        cmd += "rectangle";
        return cmd;
    }
}
Пример #5
0
void EWAUserActionsEditorDialog::execute()
{
    m_bActionExecutionStarted = true;
    
    EWAUserAction *pAction = getCurrentAction();
    if( pAction )
    {
        QSize dstSz = pAction->getWebViewSize();
        if( ui.pWebView->page()->preferredContentsSize() != dstSz )
        {
            ui.pWebView->page()->setPreferredContentsSize( dstSz );
        }
        
        pAction->execute( ui.pWebView );
        enbleItem( ui.pTableView->currentIndex().row() + 1 );
    }
}