Example #1
0
void AdvancedImageWidget::childWheelEvent(QWheelEvent  *event)
{
   // qDebug("AdvancedImageWidget::childWheelEvent() delta=%d\n", event->delta());
    QPointF scrollWidgetPoint = event->pos();
    QPointF scrollImagePoint = widgetToImageF(scrollWidgetPoint);

    if (event->delta() > 0)
    {
        for (int i = 0; i < event->delta() / 60; i++) {
            zoomIn();
        }
    }

    if (event->delta() < 0)
    {
        for (int i = 0; i < -event->delta() / 60; i++) {
            zoomOut();
        }
    }

    QPointF newScrollImagePoint = widgetToImageF(scrollWidgetPoint);

    QPointF shift = newScrollImagePoint - scrollImagePoint;
    mZoomCenter -= QPoint(fround(shift.x()), fround(shift.y()));
    recomputeRects();
    emit notifyCenterPointChanged(mZoomCenter);
    forceUpdate();
}
void TestController::unload() {
    //Inputs
    QLayout* layout = getView().getUi().grx_test_inputs->layout();

    for (int i = layout->count() - 1; i >= 0; --i) {
        QLayoutItem* item = layout->itemAt(i);
        GuiGrapher* g = dynamic_cast<GuiGrapher*> (item->widget());
        if (g) {
            QObject::disconnect(g, SIGNAL(onChangeInputValue()), this,
                                SLOT(onInputValueChanged()));
        }
        layout->removeItem(item);
        delete item->widget();
        delete item;
    }

    //Rules
    getView().getUi().lsw_test_rules->clear();
    getView().getUi().lsw_test_rules_activation->clear();

    //Outputs
    layout = getView().getUi().grx_test_outputs->layout();
    for (int i = layout->count() - 1; i >= 0; --i) {
        QLayoutItem* item = layout->itemAt(i);
        GuiGrapher* g = dynamic_cast<GuiGrapher*> (item->widget());
        if (g) {
            QObject::disconnect(this, SIGNAL(forceUpdate()), g, SLOT(updateUi()));
        }
        layout->removeItem(item);
        delete item->widget();
        delete item;
    }
}
Example #3
0
	GroundFog::GroundFog(
			Ogre::SceneManager *sceneMgr,
			Ogre::SceneNode *caelumRootNode,
			const Ogre::String &domeMaterialName,
			const Ogre::String &domeEntityName):
			mScene(sceneMgr)
	{
        Ogre::String uniqueSuffix = InternalUtilities::pointerToString (this);

		mDomeMaterial.reset(InternalUtilities::checkLoadMaterialClone (domeMaterialName, domeMaterialName + uniqueSuffix));
        mDomeParams.setup(mDomeMaterial->getTechnique(0)->getPass(0)->getFragmentProgramParameters());

		// Create dome entity, using a prefab sphere.
        // The prefab sphere has a radius of 50 units.
        // If this changes in future version of ogre this might break.
        mDomeEntity.reset (mScene->createEntity (domeEntityName, Ogre::SceneManager::PT_SPHERE));
        mDomeEntity->setMaterialName (mDomeMaterial->getName ());
        mDomeEntity->setCastShadows (false);
        mDomeEntity->setRenderQueueGroup (CAELUM_RENDER_QUEUE_GROUND_FOG);
		sceneMgr->getRenderQueue()->getQueueGroup(CAELUM_RENDER_QUEUE_GROUND_FOG)->setShadowsEnabled(false);
		
        // Create dome node
		mDomeNode.reset (caelumRootNode->createChildSceneNode ());
		mDomeNode->attachObject (mDomeEntity.get());
		
		// Initialize default fog parameters
		mDensity = 0.1;
		mVerticalDecay = 0.2;
		mGroundLevel = 5;
		mFogColour = Ogre::ColourValue::Black;

        forceUpdate();
	}
void MainWindow::on_newReservationBtn_clicked()
{
    newReservation * newResWindow = new newReservation( &dataStructs, this);
    connect(newResWindow, SIGNAL(forceUpdate()), this, SLOT(requestForUpdate()));
    newResWindow->setAttribute( Qt::WA_DeleteOnClose, true );
    newResWindow->show();
}
void TestController::onInputValueChanged() {
    //        FL_LOG("-----------------------");
    QColor from_color(Qt::white);
    QColor to_color(0, 200, 0);
    for (int i = 0; i < getModel().numberOfOutputLVars(); ++i) {
        getModel().outputLVar(i)->output().clear();
    }
    for (int i = 0; i < getModel().ruleBlock(0)->numberOfRules(); ++i) {
        fl::FuzzyRule& rule = *getModel().ruleBlock(0)->rule(i);
        fl::flScalar degree = rule.firingStrength();

        int red, green, blue, alpha;
        GuiCanvas::ColorGradient(from_color.red(), from_color.green(),
                                 from_color.blue(), from_color.alpha(), to_color.red(), to_color.green(),
                                 to_color.blue(), to_color.alpha(), (int) (degree * 255), red, green, blue, alpha);

        QColor color = QColor(red, green, blue, alpha);

        getView().getUi().lsw_test_rules->item(i)->setBackground(QBrush(color));
        getView().getUi().lsw_test_rules_activation->item(i)->setBackground(QBrush(
                    color));
        getView().getUi().lsw_test_rules_activation->item(i)->setText(
            QString::number(degree, 'f', 3));
        rule.fire(degree);
    }
    emit forceUpdate();
}
Example #6
0
void SkyMap::mouseReleaseEvent( QMouseEvent * ) {
    if ( ZoomRect.isValid() ) {
        stopTracking();
        SkyPoint newcenter = projector()->fromScreen( ZoomRect.center(), data->lst(), data->geo()->lat() );
        setFocus( &newcenter );
        setDestination( newcenter );

        //Zoom in on center of Zoom Circle, by a factor equal to the ratio
        //of the sky pixmap's width to the Zoom Circle's diameter
        float factor = float(width()) / float(ZoomRect.width());
        setZoomFactor( Options::zoomFactor() * factor );
    }
    setDefaultMouseCursor();
    ZoomRect = QRect(); //invalidate ZoomRect

    if(m_previewLegend) {
        slotCancelLegendPreviewMode();
    }

    //false if double-clicked, because it's unset there.
    if (mouseButtonDown) {
        mouseButtonDown = false;
        if ( slewing ) {
            slewing = false;
            if ( Options::useAltAz() )
                setDestinationAltAz( focus()->alt(), focus()->az() );
            else
                setDestination( *focus() );
        }
        forceUpdate();	// is needed because after moving the sky not all stars are shown
    }
    // if middle button was pressed unset here
    midMouseButtonDown = false;
}
Example #7
0
void SkyMap::decMagLimit( const int modifier ) {
    double limit = 2.222 * log10(static_cast<double>( Options::starDensity() )) + 0.35;
    limit -= magFactor( modifier );
    if ( limit < 1.18778 ) limit = 1.18778;
    Options::setStarDensity( pow( 10, ( limit - 0.35 ) / 2.222) );
    //printf("maglim set to %3.1f\n", limit);
    forceUpdate();
}
Example #8
0
void 
RoamInterruptibleCmd::updateMessage ( 
    char * msg 
)
{
    theDtMailWDM->updateDialog ( msg );
    forceUpdate(theDtMailWDM->baseWidget());
}
Example #9
0
void AdvancedImageWidget::zoomChanged()
{
    mUi->zoomInButton ->setEnabled(mUi->expSpinBox->value() != mUi->expSpinBox->maximum());
    mUi->zoomOutButton->setEnabled(mUi->expSpinBox->value() != mUi->expSpinBox->minimum());
    recomputeRects();
    emit notifyZoomChanged(mUi->expSpinBox->value());
    forceUpdate();
}
Example #10
0
void AbstractScopeWidget::resizeEvent(QResizeEvent *event)
{
    // Update the dimension of the available rect for painting
    m_scopeRect = scopeRect();
    forceUpdate();

    QWidget::resizeEvent(event);
}
Example #11
0
  //Called one time after the fuse interface has booted
void FuseTracker::loadAfterFuseBooted()
{
    //Attempt to load an old sync file from another time
  loadSyncLog( true );

    //Issue an svn update to ensure we are synced
  forceUpdate();
}
 void relayout() {
     int height = std::max(_objectName->getHeight(), _loadingText->getHeight());
     setHeight(height);
     _loadingText->setY(getY() + (height - _loadingText->getHeight()) / 2);
     auto scrollList = dynamic_cast<ScrollableList *>(getParent());
     if (!scrollList) return;
     scrollList->forceUpdate();
 }
QVideoWidget::QVideoWidget(QWidget *parent) :
    QWidget(parent),
    lastSize(0, 0),
    active(this->windowState() & Qt::WindowActive),
    mouseIn( underMouse() )
{
    setMouseTracking(Ui::crosshair);
    connect( this, SIGNAL(forceUpdate()), this, SLOT(receiveUpdate()) );
}
void IsosurfaceRendererConfig::changeInputType(int tabIndex) {
	this->currentInputType = tabIndex;
	if(tabIndex == INPUT_SWEEP) {
		sweepValueChanged(ui->horizontalSlider_sweep_value->value());
	} else {
		readInputIsolevels();
		forceUpdate();
	}
}
Example #15
0
void AdvancedImageWidget::childMouseMoved(QMouseEvent * event)
{
    if (mImage.isNull())
        return;

    QPoint imagePoint = widgetToImage(event->pos());

    if ((mCurrentToolClass == INFO_TOOL) && mImage->valid(imagePoint))
    {
        QColor color = mImage->pixel(imagePoint);

        QString info = QString("[%1 x %2] of [%3 x %4] (R:%5 G:%6 B:%7)")
                .arg(imagePoint.x())
                .arg(imagePoint.y())
                .arg(mImage->width())
                .arg(mImage->height())
                .arg(color.red())
                .arg(color.green())
                .arg(color.blue());
        setInfoValueLabel(info);
    }

    /* Pan */
    if (!mIsMousePressed)
        return;

    QPoint shift = (widgetToImage(mSelectionEnd) - imagePoint);
    mSelectionEnd = event->pos();

    if (mCurrentToolClass == PAN_TOOL)
    {
        mZoomCenter += shift;
        /*
        if (mZoomCenter.x() < mImage->rect().left())   mZoomCenter.setX(mImage->rect().left()  );
        if (mZoomCenter.x() > mImage->rect().right())  mZoomCenter.setX(mImage->rect().right() );
        if (mZoomCenter.y() < mImage->rect().top())    mZoomCenter.setY(mImage->rect().top()   );
        if (mZoomCenter.y() > mImage->rect().bottom()) mZoomCenter.setY(mImage->rect().bottom());
        */
        recomputeRects();
        emit notifyCenterPointChanged(mZoomCenter);
    }

    if (mCurrentToolClass == POINT_SELECTION_TOOLS)
    {
        emit pointToolMoved(mCurrentPointButton, widgetToImage(mSelectionEnd));
    }

    /*if (mCurrentToolClass == LINE_SELECTION_TOOLS)
    {
        QLine line(widgetToImage(mSelectionStart), widgetToImage(mSelectionEnd));

        emit newLineSelected(mCurrentSelectionButton, line);
    }*/

    /* Draw tooling instruments */
    forceUpdate();
}
Example #16
0
void GLWidget::resizeGL(int w, int h)
{
    glViewport(0, 0, w, h);
    m_projection = glm::perspective(0.8f, (float)width()/height(), 0.1f, 100.f);
    
    m_finalFramebuffer->colorTexture->resize(2*w, 2*h);
    m_finalFramebuffer->resizeDepthBuffer(2*w, 2*h);
    
    forceUpdate();
}
bool Transform3D::loadXMLSettings(XMLElement *element)
{
  if (!isSuitable(element))
    return  false;
    
  XMLElement *child;
  
  if (child = element->getChildByName("Row"))
  {
    XMLElement *subChild;
    Tuple4f     xyzw;
    int         offset = 0;
    for (size_t i = 0; i < element->getChildrenCount(); i++)
    {
      if (offset >= 16)
        return true;
        
      if (!(subChild = element->getChild(i)))
        continue;
      xyzw.set(0.0f, 0.0f, 0.0f, 0.0f);
      if (subChild->getName() == "Row")
      {
        XMLElement::loadRX_GY_BZ_AWf(*subChild, xyzw);
        updated = true;
        matrix[offset + 0] = xyzw.x;
        matrix[offset + 1] = xyzw.y;
        matrix[offset + 2] = xyzw.z;
        matrix[offset + 3] = xyzw.w;
        offset += 4;
      }
    }
    return true;
  }
  
  Tuple3f translations,
  rotations,
  scales(1.0f, 1.0f, 1.0f);
  
  if (child = element->getChildByName("Scales"))
    XMLElement::loadRX_GY_BZf(*child, scales);
    
    
  if (child = element->getChildByName("Rotations"))
    XMLElement::loadRX_GY_BZf(*child, rotations);
    
    
  if (child = element->getChildByName("Translations"))
    XMLElement::loadRX_GY_BZf(*child, translations);
    
  this->translations.setTranslations(translations);
  this->rotations.rotateXYZ(rotations);
  this->scales.setScales(scales);
  forceUpdate();
  return true;
}
void QVideoWidget::setImage(QImage image){
    if(image.isNull()) return;
    mutex.lock();
    img = image.copy();
    image = QImage();
    mutex.unlock();
    if(lastSize != img.size())
        resizeEvent();

    emit forceUpdate();
}
void IsosurfaceRendererConfig::sweepValueChanged(int value) {
	isolevels.clear();
	float maxScalar = selectedScalarRModelDef->getPropertyFieldDef()->getMax();
	float minScalar = selectedScalarRModelDef->getPropertyFieldDef()->getMin();
	int maxSliderValue = ui->horizontalSlider_sweep_value->maximum();
	int minSliderValue = ui->horizontalSlider_sweep_value->minimum();
	float isolevel = minScalar + 1.0*value*(maxScalar-minScalar)/(maxSliderValue-minSliderValue);
	ui->label_sweep_value->setText(QString::number(isolevel));
	isolevels.push_back(isolevel);
	forceUpdate();
}
void MainWindow::on_editReservation_clicked()
{
    if ( ui->deliveriesTable->currentRow() >= 0)
    {
        dataStructs.updates.resIndex = ui->deliveriesTable->currentRow();
        editReservation * editResWindow = new editReservation(&dataStructs, this);
        connect(editResWindow, SIGNAL(forceUpdate()), this, SLOT(requestForUpdate()));
        editResWindow->setAttribute( Qt::WA_DeleteOnClose, true );
        editResWindow->show();
    }
}
Example #21
0
void KstApp::showDataWizard() {
  DataWizard *dw = new DataWizard(this, "DataWizard");
  dw->exec();
  if (dw->result() == QDialog::Accepted) {
    delete dw; // leave this here - releases references
    forceUpdate();
    doc->setModified();
    doc->updateDialogs();
  } else {
    delete dw;
  }
}
void MainWindow::on_pickupRetrievedBtn_clicked()
{
    if ( ui->pickupsTable->currentRow() >= 0)
    {
        dataStructs.updates.pickIndex = ui->pickupsTable->currentRow();
        PickupWindow * newPickupWindow = new PickupWindow(&dataStructs, this);
        connect(newPickupWindow, SIGNAL(forceUpdate()), this, SLOT(requestForUpdate()));
        newPickupWindow->setAttribute( Qt::WA_DeleteOnClose, true );
        newPickupWindow->show();

        ui->pickupsTable->selectRow(-1);
    }
}
bool Transform3D::exportXMLSettings(ofstream &xmlFile)
{
  if (!xmlFile.is_open())
    return Logger::writeErrorLog("Cannot export Transform to XML: file not ready.");
  forceUpdate();
  xmlFile << "  <Transform>\n"
  << "    <Row x = \"" << matrix[ 0] << "\" y = \"" << matrix[ 1] << "\" z = \"" << matrix[ 2] << "\" w = \"" << matrix[ 3] << "\" />\n"
  << "    <Row x = \"" << matrix[ 4] << "\" y = \"" << matrix[ 5] << "\" z = \"" << matrix[ 6] << "\" w = \"" << matrix[ 7] << "\" />\n"
  << "    <Row x = \"" << matrix[ 8] << "\" y = \"" << matrix[ 9] << "\" z = \"" << matrix[10] << "\" w = \"" << matrix[11] << "\" />\n"
  << "    <Row x = \"" << matrix[12] << "\" y = \"" << matrix[13] << "\" z = \"" << matrix[14] << "\" w = \"" << matrix[15] << "\" />\n"
  << "  </Transform>\n";
  return true;
}
void MainWindow::on_deliveredButton_clicked()
{
    if ( ui->deliveriesTable->currentRow() >= 0)
    {
        dataStructs.updates.resIndex = ui->deliveriesTable->currentRow();
        DeliveryWindow * newDeliveryWindow = new DeliveryWindow(&dataStructs, this);
        connect(newDeliveryWindow, SIGNAL(forceUpdate()), this, SLOT(requestForUpdate()));
        newDeliveryWindow->setAttribute( Qt::WA_DeleteOnClose, true );
        newDeliveryWindow->show();

        ui->deliveriesTable->selectRow(-1);
    }
}
void PUParticleSystem3D::update(float delta)
{
    if (_isMarkedForEmission) return;
    if (_state != State::RUNNING){
        if (_state == State::PAUSE) 
            return;
        else if (_state == State::STOP && getAliveParticleCount() <= 0){
            forceStopParticleSystem();
            return;
        }
    }

    forceUpdate(delta);
}
Example #26
0
            inline
            std::shared_ptr<math::Matrix4x4>
            modelToWorldMatrix(bool forceUpdate)
            {
                if (forceUpdate)
                {
                    auto node        = targets()[0];
                    auto rootCtrl    = node->root()->component<RootTransform>();

                    rootCtrl->forceUpdate(node, true);
                }

                return _modelToWorld;
            }
Example #27
0
void AdvancedImageWidget::zoomReset()
{
    if (mImage == NULL) {
        mZoomCenter = QPoint(-1,-1);
    }
    else
    {
        mZoomCenter = QPoint(mImage->size().width(), mImage->size().height()) / 2.0;
    }
    mUi->expSpinBox->setValue(1.0);
    recomputeRects();
    emit notifyCenterPointChanged(mZoomCenter);
    forceUpdate();
}
void DeliveryWindow::on_saveButton_clicked()
{
    socketClient socketConn;

    QString update = subroutine_filterText(ui->deliveredByTextBox->text());
    update += QUERY_DELIMETER;
    update += ui->timeDeliveredLabel->text();

    socketConn.SubmitQuery(DELIVERY_QUERY, 9,
                           dataStructs->reservations[currIndex].resId.toInt(),
                           update);
    dataStructs->updates.resIndex = 0;
    emit forceUpdate();
    this->close();
}
Example #29
0
void Animator::setFrames(const Frame *frames, unsigned int framescount)
{
	m_framescount = framescount;
	m_curtime = 0.f;
	m_curframe = 0;
	//Is there at least one frame ?
	if(framescount == 0)
		m_frames = nullptr;
	else
	{
		m_frames = frames;
		//Init the first frame
		if(frames)
			forceUpdate();
	}
}
Example #30
0
void AdvancedImageWidget::childMousePressed(QMouseEvent * event)
{
/*    if (!mIsMousePressed && mCurrentToolClass == LINE_SELECTION_TOOLS){
        mLineSelectionMode = true;
    }*/
    mIsMousePressed = true;
    mSelectionStart = event->pos();
    mSelectionEnd   = event->pos();

    if (mCurrentToolClass == PAN_TOOL)
    {
        mUi->widget->setCursor(Qt::ClosedHandCursor);
    }

    forceUpdate();
}