void ClintStmtOccurrence::resetOccurrence(osl_statement_p stmt, const std::vector<int> &betaVector) { bool differentBeta = (m_betaVector == betaVector); bool differentPoints = false; m_betaVector = betaVector; m_oslStatement = stmt; if (stmt == nullptr) { if (m_oslScattering != nullptr) emit pointsChanged(); if (differentBeta) emit betaChanged(); return; } osl_relation_p oslScattering = nullptr; oslListForeach(stmt->scattering, [&oslScattering,&betaVector](osl_relation_p scattering) { if (betaExtract(scattering) == betaVector) { CLINT_ASSERT(oslScattering == nullptr, "Duplicate beta-vector found"); oslScattering = scattering; } }); CLINT_ASSERT(oslScattering != nullptr, "Trying to create an occurrence for the inexistent beta-vector"); differentPoints = !osl_relation_equal(oslScattering, m_oslScattering); m_oslScattering = oslScattering; if (differentPoints) { emit pointsChanged(); } if (differentBeta) { emit betaChanged(); } }
void PathView::setPOI(POI *poi) { if (_poi) disconnect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI())); _poi = poi; if (_poi) connect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI())); updatePOI(); }
void HoverPoints::firePointChange() { if( _sortType != NO_SORT ) { QPointF oldCurrent; if( _currentPointIndex != -1 ) oldCurrent = _tfPoints[_currentPointIndex]; if( _sortType == X_SORT ) std::sort( _tfPoints.begin(), _tfPoints.end(), xLessThan ); else if( _sortType == Y_SORT ) std::sort( _tfPoints.begin(), _tfPoints.end(), yLessThan ); // Compensate for changed order ... if( _currentPointIndex != -1 ) { for( int32_t i = 0; i < _tfPoints.size(); ++i ) { if( _tfPoints[i] == oldCurrent ) { _currentPointIndex = i; break; } } } } // Emit the signal to activate the change. emit pointsChanged( _tfPoints ); }
void HoverPoints::firePointChange() { if (m_sortType != NoSort) { QPointF oldCurrent; if (m_currentIndex != -1) { oldCurrent = m_points[m_currentIndex]; } if (m_sortType == XSort) qSort(m_points.begin(), m_points.end(), x_less_than); else if (m_sortType == YSort) qSort(m_points.begin(), m_points.end(), y_less_than); // Compensate for changed order... if (m_currentIndex != -1) { for (int i=0; i<m_points.size(); ++i) { if (m_points[i] == oldCurrent) { m_currentIndex = i; break; } } } } Q_EMIT pointsChanged(m_points); }
void Round::setPoints(const Player *player, int points) { if(points == this->points(player)) return; function(RoundProperties::PointsFunction)->setValue(player, QVariant::fromValue<int>(points)); emit pointsChanged(player,points); }
HoverPoints::HoverPoints(QWidget *widget, PointShape shape) : QObject(widget) { m_widget = widget; widget->installEventFilter(this); widget->setAttribute(Qt::WA_AcceptTouchEvents); m_oldSize[0] = -1; m_oldSize[1] = -1; m_connectionType = CurveConnection; m_sortType = NoSort; m_shape = shape; m_pointPen = QPen(QColor(255, 255, 255, 191), 1); m_connectionPen = QPen(QColor(255, 255, 255, 127), 2); m_pointBrush = QBrush(QColor(191, 191, 191, 127)); m_pointSize = QSize(11, 11); m_currentIndex = -1; m_editable = true; m_enabled = true; if(shape == HoverPoints::CircleShape){ m_pointPen = QPen(QColor(50, 50, 50, 191), 1); m_connectionPen = QPen(QColor(0, 0, 0, 127), 2); m_enabled = false; } connect(this, SIGNAL(pointsChanged(QPolygonF)), m_widget, SLOT(update())); }
void PolygonItem::setPoints(const QVector<QPointF> & points) { if (_points != points) { _points = points; _center = calculateCenter(points); emit pointsChanged(); } }
void KDiamond::GameState::addPoints(int removedDiamonds) { p->m_points += ++p->m_cascade; p->m_earnedMilliseconds += 500; if (removedDiamonds > 3) //add half an extra second for each extra diamond p->m_earnedMilliseconds += 500 * (removedDiamonds - 3); emit pointsChanged(p->m_points); update(true); //recalculate time }
HoverPoints::HoverPoints( QWidget *widget, lexis::render::ColorMap& colorMap, const lexis::render::ColorMap::Channel channel ) : QObject( widget ) , _colorMapWidget( widget ) , _editable( true ) , _enabled( true ) , _selectedPoint( emptyPoint ) , _colorMap( colorMap ) , _channel( channel ) { widget->installEventFilter( this ); widget->setAttribute( Qt::WA_AcceptTouchEvents ); connect( this, SIGNAL( pointsChanged()), _colorMapWidget, SLOT( update())); }
void TrackRecorder::clearTrack() { m_points.clear(); m_distance = 0; m_isEmpty = true; QString homeDir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); QString subDir = "Rena"; QDir renaDir = QDir(homeDir + "/" + subDir); renaDir.remove("Autosave"); emit distanceChanged(); emit timeChanged(); emit isEmptyChanged(); emit pointsChanged(); }
void KDiamond::GameState::startNewGame() { p->m_gameTime.restart(); //p->m_mode does not need to be reset as it is kept in sync with Settings::untimed() //these should be the same values as in KDiamond::GameStatePrivate constructor p->m_state = KDiamond::Playing; p->m_earnedMilliseconds = 0; p->m_leftMilliseconds = 0; p->m_pausedMilliseconds = 0; p->m_points = 0; p->m_cascade = 0; update(true); //recalculate time emit message(QString()); //flush message emit stateChanged(p->m_state); emit pointsChanged(p->m_points); }
int HoverPoints::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: pointsChanged((*reinterpret_cast< const QPolygonF(*)>(_a[1]))); break; case 1: setEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break; case 2: setDisabled((*reinterpret_cast< bool(*)>(_a[1]))); break; default: ; } _id -= 3; } return _id; }
void TrackRecorder::positionUpdated(const QGeoPositionInfo &newPos) { if(newPos.hasAttribute(QGeoPositionInfo::HorizontalAccuracy)) { m_accuracy = newPos.attribute(QGeoPositionInfo::HorizontalAccuracy); } else { m_accuracy = -1; } emit accuracyChanged(); m_currentPosition = newPos.coordinate(); emit currentPositionChanged(); if(newPos.hasAttribute(QGeoPositionInfo::HorizontalAccuracy) && (newPos.attribute(QGeoPositionInfo::HorizontalAccuracy) > 30.0)) { return; } if(m_tracking) { m_points.append(newPos); emit pointsChanged(); emit timeChanged(); if(m_isEmpty) { m_isEmpty = false; m_minLat = m_maxLat = newPos.coordinate().latitude(); m_minLon = m_maxLon = newPos.coordinate().longitude(); emit isEmptyChanged(); } if(m_points.size() > 1) { // Next line triggers following compiler warning? // \usr\include\qt5\QtCore\qlist.h:452: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow] m_distance += m_points.at(m_points.size()-2).coordinate().distanceTo(m_points.at(m_points.size()-1).coordinate()); emit distanceChanged(); if(newPos.coordinate().latitude() < m_minLat) { m_minLat = newPos.coordinate().latitude(); } else if(newPos.coordinate().latitude() > m_maxLat) { m_maxLat = newPos.coordinate().latitude(); } if(newPos.coordinate().longitude() < m_minLon) { m_minLon = newPos.coordinate().longitude(); } else if(newPos.coordinate().longitude() > m_maxLon) { m_maxLon = newPos.coordinate().longitude(); } } emit newTrackPoint(newPos.coordinate()); } }
void HoverPoints::firePointChange() { // printf("HoverPoints::firePointChange(), current=%d\n", m_currentIndex); if (m_sortType != NoSort) { QPointF oldCurrent; if (m_currentIndex != -1) { oldCurrent = m_points[m_currentIndex]; } if (m_sortType == XSort) { qSort(m_points.begin(), m_points.end(), x_less_than); } else if (m_sortType == YSort) { qSort(m_points.begin(), m_points.end(), y_less_than); } // Compensate for changed order... if (m_currentIndex != -1) { for (int i = 0; i < m_points.size(); ++i) { if (m_points[i] == oldCurrent) { m_currentIndex = i; break; } } } // printf(" - firePointChange(), current=%d\n", m_currentIndex); } // for (int i = 0; i < m_points.size(); ++i) { // printf(" - point(%2d) = [%.2f, %.2f], lock = %d\n", // i, m_points.at(i).x(), m_points.at(i).y(), m_locks.at(i)); // } emit pointsChanged(m_points); }
AudioPlaybackBlock::AudioPlaybackBlock(MainController* controller, QString uid) : BlockBase(controller, uid) , m_playNode(nullptr) , m_pauseNode(nullptr) , m_toggleNode(nullptr) , m_activeNode(nullptr) , m_endNode(nullptr) , m_positionNode(nullptr) , m_filePath("") , m_lastPlayNodeValue(0.0) , m_lastPauseNodeValue(0.0) , m_lastToggleNodeValue(0.0) , m_alwaysStartAtBegin(false) , m_loop(false) , m_toggleMode(true) , m_player(this) { m_widthIsResizable = true; m_playNode = createInputNode("playNode"); m_pauseNode = createInputNode("pauseNode"); m_toggleNode = createInputNode("toggleNode"); connect(m_playNode, SIGNAL(dataChanged()), this, SLOT(onPlayNodeValueChanged())); connect(m_pauseNode, SIGNAL(dataChanged()), this, SLOT(onPauseNodeValueChanged())); connect(m_toggleNode, SIGNAL(dataChanged()), this, SLOT(onToggleNodeValueChanged())); m_activeNode = createOutputNode("activeNode"); m_endNode = createOutputNode("endNode"); m_positionNode = createOutputNode("positionNode"); // setup Timer to be able to send a short pulse when end of file is reached: m_endPulseTimer.setSingleShot(true); m_endPulseTimer.setInterval(100); connect(&m_endPulseTimer, SIGNAL(timeout()), this, SLOT(onEndPulseTimeout())); connect(&m_player, SIGNAL(endOfFile()), this, SLOT(onEndOfFile())); connect(&m_player, SIGNAL(isPlayingChanged()), this, SIGNAL(isPlayingChanged())); connect(&m_player, SIGNAL(isPlayingChanged()), this, SLOT(onIsPlayingChanged())); connect(&m_player, SIGNAL(positionChanged()), this, SIGNAL(playbackPositionChanged())); connect(&m_player, SIGNAL(positionChanged()), this, SLOT(onPlaybackPositionChanged())); connect(&m_player, SIGNAL(lengthChanged()), this, SIGNAL(lengthChanged())); connect(&m_waveform, SIGNAL(pointsChanged()), this, SIGNAL(waveformChanged())); connect(&m_waveform, SIGNAL(availableChanged()), this, SIGNAL(waveformChanged())); }
void RenderArea::updateInputPoints() { int intensity; inputPoints->clear(); for (int i = 0; i < m_points_count; i++) { columnPoints *column = new columnPoints; for (int o = m_points_count - 1; o >= 0; o--) { intensity = QColor(imageInput->pixel(centerX + i,centerY + o)).red(); FPoint *point = new FPoint; if (imageMask) { QRgb bodMasky = imageMask->pixel(centerX + i,centerY + o); if (qAlpha(bodMasky) == 255) { intensity = -1; } } point->intensity = intensity; /* if (i == m_points_count - 1) { qDebug() << "o - intensity" << o << " - " << intensity; // intenzita je v poøádku, test mapy je tøeba! } */ column->append(point); } inputPoints->append(column); } emit pointsChanged(); }
HoverPoints::HoverPoints( QWidget* widget, PointShape shape ) : QObject( widget ) , _tfWidget( widget ) , _connectionType( CURVE_CONNECTION ) , _sortType( NO_SORT ) , _pointShape( shape ) , _pointPen( QPen( QColor( 255, 255, 255, 191 ), 1 )) , _connectionPen( QPen( QColor( 255, 255, 255, 127 ), 2 )) , _pointBrush( QBrush( QColor( 191, 191, 191, 127 ))) , _pointSize( QSize( 11, 11 )) , _currentPointIndex( -1 ) , _editable( true ) , _enabled( true ) { widget->installEventFilter( this ); widget->setAttribute( Qt::WA_AcceptTouchEvents ); connect( this, SIGNAL( pointsChanged( QPolygonF )), _tfWidget, SLOT( update())); }
void MapEditorWidget::firePointChange() { QPointF oldCurrent; if (currentIndex != -1) { oldCurrent = points[currentIndex]; } qSort(points.begin(), points.end(), x_less_than); // Compensate for changed order... if (currentIndex != -1) { for (int i=0; i<points.size(); ++i) { if (points[i] == oldCurrent) { currentIndex = i; break; } } } // update(); emit pointsChanged(points); }
ShadeWidget::ShadeWidget(ShadeType type, QWidget *parent) : QWidget(parent), m_shade_type(type), m_alpha_gradient(QLinearGradient(0, 0, 0, 0)) { // Checkers background if (m_shade_type == ARGBShade) { QPixmap pm(20, 20); QPainter pmp(&pm); pmp.fillRect(0, 0, 10, 10, Qt::lightGray); pmp.fillRect(10, 10, 10, 10, Qt::lightGray); pmp.fillRect(0, 10, 10, 10, Qt::darkGray); pmp.fillRect(10, 0, 10, 10, Qt::darkGray); pmp.end(); QPalette pal = palette(); pal.setBrush(backgroundRole(), QBrush(pm)); setAutoFillBackground(true); setPalette(pal); } else { setAttribute(Qt::WA_NoBackground); } QPolygonF points; points << QPointF(0, sizeHint().height()) << QPointF(sizeHint().width(), 0); m_hoverPoints = new HoverPoints(this, HoverPoints::CircleShape); // m_hoverPoints->setConnectionType(HoverPoints::LineConnection); m_hoverPoints->setPoints(points); m_hoverPoints->setPointLock(0, HoverPoints::LockToLeft); m_hoverPoints->setPointLock(1, HoverPoints::LockToRight); m_hoverPoints->setSortType(HoverPoints::XSort); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); connect(m_hoverPoints, SIGNAL(pointsChanged(QPolygonF)), this, SIGNAL(colorsChanged())); }
ColorMapWidget::ColorMapWidget( QWidget* parent_, lexis::render::ColorMap& colorMap, const lexis::render::ColorMap::Channel channel ) : QWidget( parent_ ) , _colorMap( colorMap ) , _channel( channel ) , _isLogScale( false ) , _gradient( QLinearGradient( 0, 0, 0, 0 )) { setMouseTracking( true ); if( _channel == lexis::render::ColorMap::Channel::alpha ) _createCheckersBackground(); else setAttribute( Qt::WA_NoBackground ); QPolygonF points; points << QPointF( 0, sizeHint().height()) << QPointF( sizeHint().width(), 0 ); _hoverPoints = new HoverPoints( this, colorMap, channel ); connect( _hoverPoints, SIGNAL( pointsChanged( )), this, SIGNAL( colorsChanged())); }
XFormView::XFormView(QWidget *parent) : ArthurFrame(parent) { setAttribute(Qt::WA_MouseTracking); m_type = VectorType; m_rotation = 0.0; m_scale = 1.0; m_shear = 0.0; m_pixmap = QPixmap(":res/affine/bg1.jpg"); pts = new HoverPoints(this, HoverPoints::CircleShape); pts->setConnectionType(HoverPoints::LineConnection); pts->setEditable(false); pts->setPointSize(QSize(15, 15)); pts->setShapeBrush(QBrush(QColor(151, 0, 0, alpha))); pts->setShapePen(QPen(QColor(255, 100, 50, alpha))); pts->setConnectionPen(QPen(QColor(151, 0, 0, 50))); pts->setBoundingRect(QRectF(0, 0, 500, 500)); ctrlPoints << QPointF(250, 250) << QPointF(350, 250); pts->setPoints(ctrlPoints); connect(pts, SIGNAL(pointsChanged(QPolygonF)), this, SLOT(updateCtrlPoints(QPolygonF))); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); }
void KDiamond::GameState::removePoints(int points) { p->m_points = qMax(0, p->m_points - points); emit pointsChanged(p->m_points); }
void Game::setPoints(int newValue){ m_points = newValue; emit pointsChanged(newValue); }
bool HoverPoints::eventFilter( QObject* object, QEvent* hoverEvent ) { // If the selected object is the transfer object and the widget is enabled. if( object != _colorMapWidget || !_enabled || !_editable ) return false; auto& controlPoints = _colorMap.getControlPoints( _channel ); if( controlPoints.empty( )) return false; const float w = _colorMapWidget->width(); const float h = _colorMapWidget->height(); // Detect the event type. switch ( hoverEvent->type()) { case QEvent::MouseButtonPress: { QMouseEvent* mouseEvent = (QMouseEvent*)hoverEvent; QPointF clickPosition = mouseEvent->pos(); QPointF selectedPoint = emptyPoint; for( size_t i = 0; i < controlPoints.size(); ++i ) { // Select the shape of the bounding rectangle of the volume // whether it is circle of rectangle. QPainterPath touchSurface; const auto& cp = controlPoints[ i ]; const QPointF point( cp.getX() / 256.0f * w, ( 1.0f - cp.getY( )) * h ); touchSurface.addEllipse( point, controlPointSize, controlPointSize ); // If the mouse event was applied in this boundary of the point, // set the index to that of the selected point. if( touchSurface.contains( clickPosition )) { selectedPoint = { cp.getX(), cp.getY() }; break; } } // If the Qt::LeftButton is clicked where there are no points, // insert a new point, and if the Qt::LeftButton is clicked where // a point already exists, then move the HoverPoint. if( mouseEvent->button() == Qt::LeftButton ) { // If there is no point where the mouse is clicked, then create // a new point. if( selectedPoint == emptyPoint ) { lexis::render::ControlPoint cp( (float)clickPosition.x() / w * 256.0f, 1.0f - (float)clickPosition.y() / h ); // Insert a new point at this position. _colorMap.addControlPoint( cp, _channel ); _selectedPoint = QPointF( cp.getX(), cp.getY( )); // Select the point // Update the system. emit pointsChanged(); } else // If there is a specific point that is clicked, get it. _selectedPoint = selectedPoint; // We have created or selected a point. return true; } // If the Qt::RightButton is selcted where there is a point, then // delete this point and update the system. else if( mouseEvent->button() == Qt::RightButton ) { // If there is a specified point that is selected based on // the index and the widget is editible. if( selectedPoint != emptyPoint ) { const float selectedX = selectedPoint.x(); // If it is the last point or the first point, do not remove if( selectedX == controlPoints[ 0 ].getX() || selectedX == controlPoints[ controlPoints.size() - 1 ].getX( )) { return true; } _colorMap.removeControlPoint( selectedX, _channel ); // Update the system. emit pointsChanged(); // We have deleted a point. return true; } } } break; case QEvent::MouseButtonRelease: { _selectedPoint = emptyPoint; } break; case QEvent::MouseMove: { // If there is a point selected with a specific index, move it. if( _selectedPoint == emptyPoint ) return false; const auto& pos = ((QMouseEvent*)hoverEvent )->pos(); const float y = std::max( std::min( 1.0f, 1.0f - pos.y() / h ), 0.0f ); const float selectedX = _selectedPoint.x(); // If it is the last point or the first point if( selectedX == controlPoints[ 0 ].getX() || selectedX == controlPoints[ controlPoints.size() - 1 ].getX( )) { // Update the control point only on y direction _colorMap.addControlPoint( { selectedX, y }, _channel ); emit pointsChanged(); return true; } const float x = pos.x() / w * 256.0f; // If position reaches or passes the boundaries if( x <= controlPoints[ 0 ].getX( ) || x >= controlPoints[ controlPoints.size() - 1 ].getX( )) { return true; } // If there is previously a control point in the position for( size_t i = 0; i < controlPoints.size(); ++i ) { if( controlPoints[ i ].getX() == x && _selectedPoint.x() != x ) return true; } _colorMap.removeControlPoint( selectedX, _channel ); _colorMap.addControlPoint( { x, y }, _channel ); _selectedPoint = { x, y }; // Update the system. emit pointsChanged(); return true; } break; case QEvent::Resize: // Resize the points. { // Update the system. emit pointsChanged(); break; } case QEvent::Paint: // Render the points on the widget. { QWidget* tfWidget = _colorMapWidget; _colorMapWidget = 0; QApplication::sendEvent( object, hoverEvent ); _colorMapWidget = tfWidget; // Paing all the points on the widget. paintPoints(); return true; } default: break; } // No event is selected. return false; }
void TrackRecorder::loadAutoSave() { QString homeDir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); QString subDir = "Rena"; QString filename = "Autosave"; QFile file; file.setFileName(homeDir + "/" + subDir + "/" + filename); if(!file.exists()) { qDebug()<<"No autosave found"; return; } qDebug()<<"Loading autosave"; if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug()<<"File opening failed, aborting"; return; } QTextStream stream(&file); while(!stream.atEnd()) { QGeoPositionInfo point; qreal lat, lon, alt, temp; QString timeStr; stream>>lat>>lon>>timeStr>>alt; point.setCoordinate(QGeoCoordinate(lat, lon, alt)); point.setTimestamp(QDateTime::fromString(timeStr,Qt::ISODate)); stream>>temp; if(temp == temp) { // If value is not nan point.setAttribute(QGeoPositionInfo::Direction, temp); } stream>>temp; if(temp == temp) { point.setAttribute(QGeoPositionInfo::GroundSpeed, temp); } stream>>temp; if(temp == temp) { point.setAttribute(QGeoPositionInfo::VerticalSpeed, temp); } stream>>temp; if(temp == temp) { point.setAttribute(QGeoPositionInfo::MagneticVariation, temp); } stream>>temp; if(temp == temp) { point.setAttribute(QGeoPositionInfo::HorizontalAccuracy, temp); } stream>>temp; if(temp == temp) { point.setAttribute(QGeoPositionInfo::VerticalAccuracy, temp); } stream.readLine(); // Read rest of the line, if any m_points.append(point); if(m_points.size() > 1) { if(point.coordinate().latitude() < m_minLat) { m_minLat = point.coordinate().latitude(); } else if(point.coordinate().latitude() > m_maxLat) { m_maxLat = point.coordinate().latitude(); } if(point.coordinate().longitude() < m_minLon) { m_minLon = point.coordinate().longitude(); } else if(point.coordinate().longitude() > m_maxLon) { m_maxLon = point.coordinate().longitude(); } } else { m_minLat = m_maxLat = point.coordinate().latitude(); m_minLon = m_maxLon = point.coordinate().longitude(); } emit newTrackPoint(point.coordinate()); } m_autoSavePosition = m_points.size(); file.close(); qDebug()<<m_autoSavePosition<<"track points loaded"; emit pointsChanged(); emit timeChanged(); if(m_points.size() > 1) { for(int i=1;i<m_points.size();i++) { m_distance += m_points.at(i-1).coordinate().distanceTo(m_points.at(i).coordinate()); } emit distanceChanged(); } if(!m_points.isEmpty()) { m_isEmpty = false; emit isEmptyChanged(); } }