Esempio n. 1
0
void RDGpio::inputTimerData()
{
  unsigned input_mask;
  unsigned output_mask;
  unsigned mask;

  if((input_mask=inputMask())!=gpio_input_mask) {
    for(int i=0;i<inputs();i++) {
      mask=1<<i;
      if((gpio_input_mask&mask)!=(input_mask&mask)) {
	if((input_mask&mask)==0) {
	  emit inputChanged(i,false);
	}
	else {
	  emit inputChanged(i,true);
	}
      }
    }
    gpio_input_mask=input_mask;
  }
  if((output_mask=outputMask())!=gpio_output_mask) {
    for(int i=0;i<outputs();i++) {
      mask=1<<i;
      if((gpio_output_mask&mask)!=(output_mask&mask)) {
	if((output_mask&mask)==0) {
	  emit outputChanged(i,false);
	}
	else {
	  emit outputChanged(i,true);
	}
      }
    }
    gpio_output_mask=output_mask;
  }
}
Esempio n. 2
0
void TestRunner::run_onTestFinished_(int exitCode, QProcess::ExitStatus /*exitStatus*/)
{
    disconnect(process_,
            static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
            this,
            &TestRunner::run_onTestFinished_);

    runOutput_ += process_->readAll();

    if (exitCode == 0)
    {
        QString time = getCurrentTime();
        runOutput_ += time + ": The process \"" + process_->program() + "\" exited normally.\n";

        emit outputChanged();
        setStatus_(Status::Pass);
        emit runFinished(true);
    }
    else
    {
        QString time = getCurrentTime();
        runOutput_ +=
                time + ": The process \"" + process_->program() +
                QString("\" exited with code %1.\n").arg(exitCode);

        emit outputChanged();
        setStatus_(Status::RunError);
        emit runFinished(false);
    }
}
Esempio n. 3
0
void FileReader::setOutPut(const QString &output)
{
    if (mOutput == output)
        return;
    mOutput = output;
    emit outputChanged();
}
Esempio n. 4
0
qtNeuron* qtAnn::addNeuron(QPointF const & position)
{
    qtNeuron* n = new qtNeuron(this, position);
    ann::addNeuron(n);
    id2neuron[n->getId()] = n;

    connect(n,    SIGNAL(activityChanged(idtype, qreal)),
            this, SIGNAL(neuronActivityChanged(idtype, qreal)));
    connect(n,    SIGNAL(colorChanged(idtype, QColor)),
            this, SIGNAL(neuronColorChanged(idtype, QColor)));
    connect(n,    SIGNAL(latexLabelChanged(idtype, QString)),
            this, SIGNAL(neuronLatexLabelChanged(idtype, QString)));
    connect(n,    SIGNAL(nameChanged(idtype, QString)),
            this, SIGNAL(neuronNameChanged(idtype, QString)));
    connect(n,    SIGNAL(neuronRemoved(idtype)),
            this, SIGNAL(neuronRemoved(idtype)));
    connect(n,    SIGNAL(outputChanged(idtype, qreal)),
            this, SIGNAL(neuronOutputChanged(idtype, qreal)));
    connect(n,    SIGNAL(positionChanged(idtype, QPointF)),
            this, SIGNAL(neuronPositionChanged(idtype, QPointF)));
    connect(n,    SIGNAL(selectionChanged(idtype, bool)),
            this, SLOT(onNeuronSelectionChanged(idtype, bool)));

    emit(neuronAdded(n->getId()));
    return n;
}
Esempio n. 5
0
/*!
  \brief Draws an ellipse

  Parameters :
  \a center
  \a axes
  \a angle
  \a startAngle
  \a endAngle
  \a color
  \a thickness
  \a lineType
  \a shift
 */
void QMatDraw::ellipse(
        const QPoint &center,
        const QSize &axes,
        double angle,
        double startAngle,
        double endAngle,
        const QColor &color,
        int thickness,
        int lineType,
        int shift)
{
    cv::ellipse(
                *output()->cvMat(),
                cv::Point(center.x(), center.y()),
                cv::Size(axes.width(), axes.height()),
                angle,
                startAngle,
                endAngle,
                cv::Scalar( color.blue(), color.green(), color.red(), color.alpha() ),
                thickness,
                lineType,
                shift
    );
    emit outputChanged();
    update();
}
Esempio n. 6
0
//Main regulator function. Calculate output.
void Regulator::updatePI()
{
    double error = sv - pv;

    double pTerm = error * ProportionalGain;

    IState += error;

    if( IState >= iMax )  //Make sure that IState stays in between IMin and IMax
        IState = iMax;
    else if( IState <= iMin )
        IState = iMin;

    double iTerm = Integral * IState;

    output = pTerm + iTerm;

    if( output > 100.0f )
        output = 100.0f;
    else if( output < 0.0f )
        output = 0.0f;

    emit outputChanged( output );

    //qDebug() << IState << " " << iTerm << " " << pTerm << " " << output;
}
Esempio n. 7
0
void FileWriter::setOutput( const QString &output)
{
    if (m_Output == output)
        return;
    m_Output = output;
    emit outputChanged();
}
Esempio n. 8
0
/**
 * Sets given model to edit widget.
 */
void OutputGraphWidget::setModel(GraphTestModel* model){
	this->model = model;

    //disables certain parts of GUI
    ui->drawButton->setEnabled(false);
    ui->outputBox->setEnabled(false);
    hideDatasetSelection(true);

    //clears model name label if NULL given
	if(model == NULL){
		ui->itemName->setText(QString());
        hideDatasetSelection(true);
    }
    //fills view with model data
    else{
        bool saved = model->isSaved();
        ui->itemName->setText(model->name());
        if(!model->selectedNetworkName().isEmpty() && model->selectedNetwork() != NULL){
            ui->outputBox->setValue(model->output());
            outputChanged(model->output());
            if(model->plot() == NULL) drawGraph();
            else setPlot();
        }
        genNetworkList();
        connect(model, SIGNAL(changed(ChangeType)), this, SLOT(modelChanged(ChangeType)), Qt::UniqueConnection);
        model->setSaved(saved);
	}
}
void ScreenWindow::notifyOutputChanged()
{
    // move window to the bottom of the screen and update scroll count
    // if this window is currently tracking the bottom of the screen
    if ( _trackOutput )
    {
        _scrollCount -= _screen->scrolledLines();
        _currentLine = qMax(0,_screen->getHistLines() - (windowLines()-_screen->getLines()));
    }
    else
    {
        // if the history is not unlimited then it may
        // have run out of space and dropped the oldest
        // lines of output - in this case the screen
        // window's current line number will need to
        // be adjusted - otherwise the output will scroll
        _currentLine = qMax(0,_currentLine -
                              _screen->droppedLines());

        // ensure that the screen window's current position does
        // not go beyond the bottom of the screen
        _currentLine = qMin( _currentLine , _screen->getHistLines() );
    }

    _bufferNeedsUpdate = true;

    emit outputChanged();
}
Esempio n. 10
0
void TestRunner::run_onCompileFinished_(bool success)
{
    disconnect(this, &TestRunner::compileFinished, this, &TestRunner::run_onCompileFinished_);

    if (success)
    {
        setStatus_(Status::Running);

        // -------- Run test --------

        QString program = testBinPath_;
        QStringList arguments;

        runOutput_ +=
                getCurrentTime() +
                ": Starting: \"" +
                program + "\" " +
                arguments.join(' ') + "\n";

        connect(process_,
                static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
                this,
                &TestRunner::run_onTestFinished_);

        emit outputChanged();

        process_->start(program, arguments);
    }
    else
    {
        emit runFinished(false);
    }
}
Esempio n. 11
0
void TestRunner::compile_onMakeFinished_(int exitCode, QProcess::ExitStatus /*exitStatus*/)
{
    disconnect(process_,
            static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
            this,
            &TestRunner::compile_onMakeFinished_);

    compileOutput_ += process_->readAll();
    if (exitCode == 0)
    {
        QString time = getCurrentTime();
        compileOutput_ += time + ": The process \"" + process_->program() + "\" exited normally.\n";

        testBinPath_ = compileDir_.absoluteFilePath(testName_); // XXX TODO change this on Windows

        emit outputChanged();
        setStatus_(Status::NotRunYet);
        emit compileFinished(true);
    }
    else
    {
        QString time = getCurrentTime();
        compileOutput_ +=
                time + ": The process \"" + process_->program() +
                QString("\" exited with code %1.\n").arg(exitCode);

        failCompilation_("make failed.");
    }
}
Esempio n. 12
0
/*!
 * Sets the output for this QWaylandPointer to \a output.
 */
void QWaylandPointer::setOutput(QWaylandOutput *output)
{
    Q_D(QWaylandPointer);
    if (d->output == output) return;
    d->output = output;
    outputChanged();
}
Esempio n. 13
0
void TextHolder::setOutput(QString out)
{
    if(m_output == out)
        return;

    m_output = out;
    emit outputChanged(out);
}
Esempio n. 14
0
//Stop regulator
void Regulator::stop()
{
    cycleTimer->stop();
    output = 0;
    IState = 0;

    emit outputChanged( 0.0f );
}
Esempio n. 15
0
void TestRunner::failCompilation_(const QString & errorMessage)
{
    QString time = getCurrentTime();
    compileOutput_ += time + ": Compilation failed: " + errorMessage + "\n";

    emit outputChanged();
    setStatus_(Status::CompileError);
    emit compileFinished(false);
}
Esempio n. 16
0
/*!
  \brief Fills an area bounded by one or more polygons.

  Parameters :
  \a points
  \a color
  \a lineType
  \a shift
  \a offset
 */
void QMatDraw::fillPoly(
        const QVariantList &points,
        const QColor &color,
        int lineType,
        int shift,
        const QPoint& offset)
{
    if ( points.size() > 0 ){
        if ( points[0].canConvert<QVariantList>() ){
            cv::Point ** pts = new cv::Point*[points.size()];
            int* npts = new int[points.size()];
            for ( int i = 0; i < points.size(); ++i ){
                QVariantList pointsI = points[i].toList();
                pts[i]  = new cv::Point[pointsI.size()];
                npts[i] = pointsI.size();
                for ( int j = 0; j < pointsI.size(); ++j ){
                    pts[i][j].x = pointsI[j].toPoint().x();
                    pts[i][j].y = pointsI[j].toPoint().y();
                }
            }
            cv::fillPoly(
                        *output()->cvMat(),
                        const_cast<const cv::Point**>(pts),
                        npts,
                        points.size(),
                        cv::Scalar( color.blue(), color.green(), color.red(), color.alpha() ),
                        lineType,
                        shift,
                        cv::Point(offset.x(), offset.y())
            );
            for ( int i = 0; i < points.size(); ++i )
                delete[] pts[i];
            delete[] npts;
            delete[] pts;

        } else {
            cv::Point* pts = new cv::Point[points.size()];
            for ( int i = 0; i < points.size(); ++i ){
                pts[i].x = points[i].toPoint().x();
                pts[i].y = points[i].toPoint().y();
            }
            cv::fillConvexPoly(
                        *output()->cvMat(),
                        pts,
                        points.size(),
                        cv::Scalar( color.blue(), color.green(), color.red(), color.alpha() ),
                        lineType,
                        shift
            );
            delete[] pts;
        }
    }

    emit outputChanged();
    update();
}
Esempio n. 17
0
/*!
*/
void Emulation::showBulk()
{
    _bulkTimer1.stop();
    _bulkTimer2.stop();

    emit outputChanged();

    _currentScreen->resetScrolledLines();
    _currentScreen->resetDroppedLines();
}
Esempio n. 18
0
void RandROutput::loadSettings(bool notify)
{
	int changes = 0;
	XRROutputInfo *info = XRRGetOutputInfo(QX11Info::display(), m_screen->resources(), m_id);
	Q_ASSERT(info);


	if (RandR::timestamp != info->timestamp)
		RandR::timestamp = info->timestamp;

	// this information shouldn't change, so
	m_name = info->name;

	m_possibleCrtcs.clear();
	for (int i = 0; i < info->ncrtc; ++i)
		m_possibleCrtcs.append(info->crtcs[i]);

	//check if the crtc changed
	if (info->crtc != m_currentCrtc)
	{
		setCrtc(info->crtc);
		changes |= RandR::ChangeCrtc;
	}

			

	bool connected = (info->connection == RR_Connected);
	if (connected != m_connected)
	{
		m_connected = connected;
		changes |= RandR::ChangeConnection;
	}

	//CHECK: is it worth notifying changes on mode list changing?
	//get modes
	m_modes.clear();
	for (int i = 0; i < info->nmode; ++i)
		m_modes.append(info->modes[i]);

	//get all possible rotations
	m_rotations = 0;
	for (int i = 0; i < m_possibleCrtcs.count(); ++i)
	{
		RandRCrtc *crtc = m_screen->crtc(m_possibleCrtcs.at(i));
		Q_ASSERT(crtc);
		m_rotations |= crtc->rotations();
	}

	// free the info
	XRRFreeOutputInfo(info);

	if (changes && notify)
		emit outputChanged(m_id, changes);
}
Esempio n. 19
0
void AMScanParametersDictionary::reOperate(){
	if(!canOperate())
		return;
	keywordParser_->setInitialText(input_);
	keywordParser_->replaceAllUsingDictionary(keywordDictionary_);
	QString oldOutput = output_;
	output_ = keywordParser_->getReplacedText();
	operateImplementation(output_);
	if(oldOutput != output_)
		emit outputChanged(output_);
}
Esempio n. 20
0
void BinaryOutputElement::setInputElement(GraphicObject *ge)
{
	switch(ge->type()){
		case GraphicObject::gotMLP:
			MLPObject *gmlpe = dynamic_cast<MLPObject*>(ge);
			gmlpe->setOutputElement(this);
			connect(gmlpe, SIGNAL(outputChanged(QVector<double>)), SLOT(onInputChanged(QVector<double>)));
			break;
	}
	inputElement = ge;
}
Esempio n. 21
0
void QMLOutput::setOutputPtr(const KScreen::OutputPtr &output)
{
    Q_ASSERT(m_output.isNull());

    m_output = output;
    Q_EMIT outputChanged();

    connect(m_output.data(), &KScreen::Output::rotationChanged,
            this, &QMLOutput::updateRootProperties);
    connect(m_output.data(), &KScreen::Output::currentModeIdChanged,
            this, &QMLOutput::currentModeIdChanged);
}
Esempio n. 22
0
void AMScanParametersDictionary::setInput(const QString &input){
	QString oldInput = input_;
	input_ = input;
	keywordParser_->setInitialText(input);
	keywordParser_->replaceAllUsingDictionary(keywordDictionary_);
	QString oldOutput = output_;
	output_ = keywordParser_->getReplacedText();
	operateImplementation(output_);
	if(oldOutput != output_)
		emit outputChanged(output_);
	if(oldInput != input_)
		emit inputChanged(input_);
}
Esempio n. 23
0
ScreenWindow* Emulation::createWindow()
{
    ScreenWindow* window = new ScreenWindow();
    window->setScreen(_currentScreen);
    _windows << window;

    connect(window , SIGNAL(selectionChanged()),
            this , SLOT(bufferedUpdate()));

    connect(this , SIGNAL(outputChanged()),
            window , SLOT(notifyOutputChanged()) );
    return window;
}
Esempio n. 24
0
void RandROutput::handleEvent(XRROutputChangeNotifyEvent *event)
{
	int changed = 0;

	kDebug() << "[OUTPUT] Got event for " << m_name;
	kDebug() << "       crtc: " << event->crtc;
	kDebug() << "       mode: " << event->mode;
	kDebug() << "       rotation: " << event->rotation;
	kDebug() << "       connection: " << event->connection;

	//FIXME: handling these events incorrectly, causing an X11 I/O error...
	// Disable for now.
// 	kWarning() << "FIXME: Output event ignored!";
// 	return;
	
	RRCrtc currentCrtc = m_crtc->id();
	if (event->crtc != currentCrtc)
	{
		changed |= RandR::ChangeCrtc;
		// update crtc settings
		if (currentCrtc != None)
			m_crtc->loadSettings(true);
			//m_screen->crtc(m_currentCrtc)->loadSettings(true);
		setCrtc(m_screen->crtc(event->crtc), false);
		if (currentCrtc != None)
			m_crtc->loadSettings(true);
	}

	if (event->mode != mode().id())
		changed |= RandR::ChangeMode;
	
	if (event->rotation != rotation())
		changed |= RandR::ChangeRotation;
	
	if((event->connection == RR_Connected) != m_connected)
	{
		changed |= RandR::ChangeConnection;
		m_connected = (event->connection == RR_Connected);
		loadSettings(false);
		if (!m_connected && currentCrtc != None)
			setCrtc(m_screen->crtc(None), true);
	}

	// check if we are still connected, if not, release the crtc connection
	if(!m_connected && m_crtc->isValid())
		setCrtc(m_screen->crtc(None), true);

	if(changed)
		emit outputChanged(m_id, changed);
}
Esempio n. 25
0
void TestRunner::compile_onQmakeFinished_(int exitCode, QProcess::ExitStatus /*exitStatus*/)
{
    disconnect(process_,
            static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
            this,
            &TestRunner::compile_onQmakeFinished_);

    compileOutput_ += process_->readAll();
    if (exitCode == 0)
    {
        // -------- Output end of qmake --------

        QString time = getCurrentTime();
        compileOutput_ += time + ": The process \"" + process_->program() + "\" exited normally.\n";


        // -------- Run make --------

        QString program = "make"; // XXX TODO check that this works on Windows too
        QStringList arguments;

        compileOutput_ +=
                getCurrentTime() +
                ": Starting: \"" +
                program + "\" " +
                arguments.join(' ') + "\n";

        connect(process_,
                static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
                this,
                &TestRunner::compile_onMakeFinished_);

        emit outputChanged();

        process_->start(program, arguments);

        // -> go read makeFinished_(int exitCode) now.
    }
    else
    {
        QString time = getCurrentTime();
        compileOutput_ +=
                time + ": The process \"" + process_->program() +
                QString("\" exited with code %1.\n").arg(exitCode);
        failCompilation_("qmake failed.");
    }
}
Esempio n. 26
0
void RandROutput::handleEvent(XRROutputChangeNotifyEvent *event)
{
	int changed = 0;

#if 1
	kDebug() << "[OUTPUT] Got event for " << m_name;
	kDebug() << "       crtc: " << event->crtc;
	kDebug() << "       mode: " << event->mode;
	kDebug() << "       rotation: " << event->rotation;
	kDebug() << "       connection: " << event->connection;
#endif
	if (event->crtc != m_currentCrtc)
	{
		changed |= RandR::ChangeCrtc;
		// update crtc settings
		if (m_currentCrtc != None)
			m_screen->crtc(m_currentCrtc)->loadSettings(true);
		setCrtc(event->crtc);
		if (m_currentCrtc != None)
			m_screen->crtc(m_currentCrtc)->loadSettings(true);
	}

	if (event->mode != mode())
	{
		changed |= RandR::ChangeMode;

	}
	if (event->rotation != rotation())
	{
		changed |= RandR::ChangeRotation;
	}
	if ((event->connection == RR_Connected) != m_connected)
	{
		changed |= RandR::ChangeConnection;
		m_connected = !m_connected;
		if (!m_connected && m_currentCrtc != None)
			setCrtc(None);
	}

	// check if we are still connected, if not, release the crtc connection
	if (!m_connected && m_currentCrtc != None)
		setCrtc(None);

	if (changed)
		emit outputChanged(m_id, changed);
}
Esempio n. 27
0
void TestRunner::onReadyReadStandardOutput_()
{
    switch (status())
    {
    case Status::NotCompiledYet:
    case Status::Compiling:
    case Status::CompileError:
        compileOutput_ += process_->readAll();
        break;

    case Status::NotRunYet:
    case Status::Running:
    case Status::RunError:
    case Status::Pass:
        runOutput_ += process_->readAll();
        break;
    }

    emit outputChanged();
}
Esempio n. 28
0
/*!
  \brief Draws a circle in \a center with \a radius.

  Parameters :
  \a color
  \a thickness
  \a lineType
  \a shift
 */
void QMatDraw::circle(
        const QPoint &center,
        int radius,
        const QColor &color,
        int thickness,
        int lineType,
        int shift)
{
    cv::circle(
                *output()->cvMat(),
                cv::Point(center.x(), center.y()),
                radius,
                cv::Scalar( color.blue(), color.green(), color.red(), color.alpha() ),
                thickness,
                lineType,
                shift
    );
    emit outputChanged();
    update();
}
Esempio n. 29
0
/*!
  \brief Draws a line from point \a p1 to point \a p2.

  Parameters :
  \a color
  \a thickness
  \a lineType
  \a shift
  \sa MatDraw::line
 */
void QMatDraw::line(
        const QPoint& p1,
        const QPoint& p2,
        const QColor& color,
        int thickness,
        int lineType,
        int shift)
{
    cv::line(
                *output()->cvMat(),
                cv::Point(p1.x(), p1.y()),
                cv::Point(p2.x(), p2.y()),
                cv::Scalar( color.blue(), color.green(), color.red(), color.alpha() ),
                thickness,
                lineType,
                shift
    );
    emit outputChanged();
    update();
}
Esempio n. 30
0
void QMatchesToLocalKeypoint::mapValues(){
    if ( !isComponentComplete() )
        return;
    if ( m_matches1to2 == 0 || m_queryKeypointVector == 0 )
        return;
    if ( !m_matches1to2->matches().size() )
        return;

    m_output->resize(m_trainKeypointVectors.size());
    std::vector<cv::DMatch>& matches = m_matches1to2->matches()[0];

    try{
        for ( std::vector<cv::DMatch>::iterator it = matches.begin(); it != matches.end(); ++it ){
            cv::DMatch& match = *it;
            if ( match.imgIdx >= m_trainKeypointVectors.size() )
                return;
            QKeyPointVector* trainVector = qobject_cast<QKeyPointVector*>(m_trainKeypointVectors[match.imgIdx]);
            if ( !trainVector ){
                qWarning("Invalid keypoint vector given at %d", match.imgIdx);
                return;
            }

            m_output->mappingAt(match.imgIdx)->objectPoints.push_back(
                trainVector->keypoints().at(match.trainIdx).pt
            );
            m_output->mappingAt(match.imgIdx)->scenePoints.push_back(
                m_queryKeypointVector->keypoints().at(match.queryIdx).pt
            );

        }

    } catch ( std::out_of_range& ){
        qCritical("Out of range reached when selecting query descriptor id. Is the query image synced with the matches?");
        m_output->resize(0);
    }

    emit outputChanged();
}