Beispiel #1
0
	void ShapeMaker::close(bool stroke) {
		// diffx/diffy captures rounding errors. they can accumulate a bit! FIXME

		if (diffx || diffy) {
			if (!stroke) {
				doSetup(0, 0, false, -1, -1, 0);
			}

			// closing line
			LineTo *segment = new LineTo;
			segment->setType(1);
			segment->setx((int)-diffx);
			segment->sety((int)-diffy);
			edges->append(segment);

			if (!stroke) {
				doSetup(0, 0, false, -1, -1, lineStyle);
			}

			diffx = diffy = 0;
			if (stroke) {
				lastx = lastsetupx; lasty = lastsetupy;
			}
		}
	}
Beispiel #2
0
void
Connection::checkACL()
{
    Q_D( Connection );
    QReadLocker nodeidLocker( &d->nodeidLock );

    if ( d->nodeid.isEmpty() )
    {
        tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Not checking ACL, nodeid is empty";
        QTimer::singleShot( 0, this, SLOT( doSetup() ) );
        return;
    }

    if ( Servent::isIPWhitelisted( d_func()->peerIpAddress ) )
    {
        QTimer::singleShot( 0, this, SLOT( doSetup() ) );
        return;
    }

    tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking ACL for" << name();
    connect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, Tomahawk::ACLStatus::Type ) ),
             this, SLOT( checkACLResult( QString, QString, Tomahawk::ACLStatus::Type ) ),
             Qt::QueuedConnection );
    QMetaObject::invokeMethod( ACLRegistry::instance(), "isAuthorizedUser", Qt::QueuedConnection, Q_ARG( QString, d->nodeid ), Q_ARG( QString, bareName() ), Q_ARG( Tomahawk::ACLStatus::Type, Tomahawk::ACLStatus::NotFound ) );
}
Beispiel #3
0
void ShapeMaker::close(bool stroke) {
	// diffx/diffy captures rounding errors. they can accumulate a bit! FIXME
	
	if( diffx || diffy ) {
		/*fprintf(stderr,"WARNING: shape not closed; closing (%f/%f).\n", diffx, diffy);
		fprintf(stderr,"DEBUG: accumulated rounding error (%f/%f).\n", roundx, roundy);*/
		
		if(!stroke) {
			doSetup( 0, 0, false, -1, -1, 0 );
		}
		
		// closing line
		LineTo *segment = new LineTo;
		segment->setType(1);
		//segment->setbits( maxBitsNeeded( true, 2, x, y ) );
		segment->setx( (int)-diffx );
		segment->sety( (int)-diffy );
		edges->append( segment );

		if(!stroke) {
			doSetup( 0, 0, false, -1, -1, lineStyle );
		}
		
		diffx = diffy = 0;
		if(stroke) {
			lastx = lastsetupx; lasty = lastsetupy;
		}
	}
}
int main() {
    doSetup();

    while(1) {
        doLoop();
    }
}
void ConsoleApplication::setup(void)
{
    SerialExecutable::setup();
    // do stuff
    doSetup();
    emit (setuped());
}
Beispiel #6
0
void ScriptResolver::handleMsg( const QByteArray& msg )
{
    qDebug() << Q_FUNC_INFO << msg.size() << QString::fromAscii(msg);
    bool ok;
    QVariant v = m_parser.parse( msg, &ok );
    if( !ok || v.type() != QVariant::Map )
    {
        Q_ASSERT(false);
        return;
    }
    QVariantMap m = v.toMap();
    const QString& msgtype = m.value( "_msgtype" ).toString();

    if( msgtype == "settings" )
    {
        doSetup( m );
        return;
    }

    if( msgtype == "results" )
    {
        QList< Tomahawk::result_ptr > results;
        const QString& qid = m.value( "qid" ).toString();
        const QVariantList& reslist = m.value( "results" ).toList();
        Tomahawk::collection_ptr coll = SourceList::instance()->getLocal()->collection();
        foreach( const QVariant& rv, reslist )
        {
            qDebug() << "RES" << rv;
            Tomahawk::result_ptr rp( new Tomahawk::Result() );
            rp->setCollection( coll );
            results << rp;
        }
Beispiel #7
0
void
Connection::checkACLResult( const QString &nodeid, const QString &username, Tomahawk::ACLStatus::Type peerStatus )
{
    Q_D( Connection );
    QReadLocker nodeidLocker( &d->nodeidLock );

    if ( nodeid != d->nodeid )
    {
        tDebug( LOGVERBOSE ) << Q_FUNC_INFO << QString( "nodeid (%1) not ours (%2) for user %3" ).arg( nodeid ).arg( d->nodeid ).arg( username );
        return;
    }
    if ( username != bareName() )
    {
        tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "username not our barename";
        return;
    }

    disconnect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, Tomahawk::ACLStatus::Type ) ) );
    tDebug( LOGVERBOSE ) << Q_FUNC_INFO << QString( "ACL status for user %1 is" ).arg( username ) << peerStatus;
    if ( peerStatus == Tomahawk::ACLStatus::Stream )
    {
        QTimer::singleShot( 0, this, SLOT( doSetup() ) );
        return;
    }

    shutdown();
}
Beispiel #8
0
Camera::Camera(bool _useMJPEG, int _width, int _height, function<void (Mat& image_in)> callback_in)
{
	height	= _height;
	width	= _width;
	useMJPEG = _useMJPEG;
	callback = callback_in;
	doSetup(1);
}
Beispiel #9
0
void MainWindow::connectSim(SimThread *sim)
{
    QObject::connect(ui->startButton,SIGNAL(clicked()),sim,SLOT(simRun()));
    QObject::connect(ui->stopButton,SIGNAL(clicked()),sim,SLOT(simStop()));
    QObject::connect(ui->stepButton,SIGNAL(clicked()),sim,SLOT(simStep()));
    QObject::connect(ui->stepButton,SIGNAL(clicked()),this,SLOT(updateMemory()));
    QObject::connect(ui->setupButton,SIGNAL(clicked()),this,SLOT(doSetup()));
    QObject::connect(this,SIGNAL(kbdKeypress(quint8)),sim,SLOT(keypress(quint8)));
}
Beispiel #10
0
void SORE_Graphics::Pipe::Setup(Renderbuffer_map_t& renderBuffers)
{
    doSetup(renderBuffers);

    pipe_vector::iterator i;
    for(i = children.begin(); i != children.end(); ++i)
    {
        i->Setup(renderBuffers);
    }
}
Beispiel #11
0
void
Connection::checkACL()
{
    if ( !property( "nodeid" ).isValid() )
    {
        tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Not checking ACL, nodeid is empty";
        QTimer::singleShot( 0, this, SLOT( doSetup() ) );
        return;
    }

    if ( Servent::isIPWhitelisted( m_peerIpAddress ) )
    {
        QTimer::singleShot( 0, this, SLOT( doSetup() ) );
        return;
    }

    QString nodeid = property( "nodeid" ).toString();
    QString bareName = name().contains( '/' ) ? name().left( name().indexOf( "/" ) ) : name();
    tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking ACL for" << name();
    connect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, ACLRegistry::ACL ) ), this, SLOT( checkACLResult( QString, QString, ACLRegistry::ACL ) ), Qt::QueuedConnection );
    QMetaObject::invokeMethod( ACLRegistry::instance(), "isAuthorizedUser", Qt::QueuedConnection, Q_ARG( QString, nodeid ), Q_ARG( QString, bareName ), Q_ARG( ACLRegistry::ACL, ACLRegistry::NotFound ) );
}
Beispiel #12
0
void
Connection::checkACL()
{
    if ( !property( "nodeid" ).isValid() )
    {
        QTimer::singleShot( 0, this, SLOT( doSetup() ) );
        return;
    }

    QString nodeid = property( "nodeid" ).toString();
    tDebug( LOGVERBOSE ) << "Checking ACL for" << name();
    connect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, ACLRegistry::ACL ) ), this, SLOT( checkACLResult( QString, QString, ACLRegistry::ACL ) ), Qt::QueuedConnection );
    QMetaObject::invokeMethod( ACLRegistry::instance(), "isAuthorizedUser", Qt::QueuedConnection, Q_ARG( QString, nodeid ), Q_ARG( QString, name() ), Q_ARG( ACLRegistry::ACL, ACLRegistry::NotFound ) );
}
Beispiel #13
0
void
Connection::checkACLResult( const QString &nodeid, const QString &username, ACLRegistry::ACL peerStatus )
{
    if ( nodeid != property( "nodeid" ).toString() || username != name() )
        return;

    disconnect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, ACLRegistry::ACL ) ) );
    tDebug( LOGVERBOSE ) << "ACL status is" << peerStatus;
    if ( peerStatus == ACLRegistry::Stream )
    {
        QTimer::singleShot( 0, this, SLOT( doSetup() ) );
        return;
    }

    shutdown();
}
Beispiel #14
0
void
Connection::checkACLResult( const QString &nodeid, const QString &username, ACLRegistry::ACL peerStatus )
{
    QString bareName = name().contains( '/' ) ? name().left( name().indexOf( "/" ) ) : name();
    if ( nodeid != property( "nodeid" ).toString() || username != bareName )
    {
        tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "nodeid not ours, or username not our barename";
        return;
    }

    disconnect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, ACLRegistry::ACL ) ) );
    tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "ACL status is" << peerStatus;
    if ( peerStatus == ACLRegistry::Stream )
    {
        QTimer::singleShot( 0, this, SLOT( doSetup() ) );
        return;
    }

    shutdown();
}
Beispiel #15
0
void ShapeMaker::setup( double x, double y ) {
	x += offsetx; y += offsety;
	doSetup( x, y, true, fillStyle0, fillStyle1, lineStyle );
}
KryptDevItem::KryptDevItem ( QListView * parent, KryptDevice *kryptDev ) :
    QListViewItem ( parent ), _kryptDev ( kryptDev )
{
  doSetup();
}