mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Changed tr1 shared_ptr for QSharedPointers and QWeakPointers.
This commit is contained in:
@@ -31,7 +31,7 @@ MShape* DestinationGLCanvas::getShapeFromMappingId(uid mappingId) const
|
||||
if (mappingId == NULL_UID)
|
||||
return NULL;
|
||||
else
|
||||
return getMainWindow()->getMappingManager().getMappingById(mappingId)->getShape().get();
|
||||
return getMainWindow()->getMappingManager().getMappingById(mappingId)->getShape().data();
|
||||
}
|
||||
|
||||
ShapeGraphicsItem* DestinationGLCanvas::getShapeGraphicsItemFromMappingId(uid mappingId) const
|
||||
|
||||
+30
-30
@@ -233,7 +233,7 @@ void MainWindow::handlePaintChanged(Paint::ptr paint) {
|
||||
uid paintId = mappingManager->getPaintId(paint);
|
||||
|
||||
if (paint->getType() == "media") {
|
||||
std::tr1::shared_ptr<Media> media = std::tr1::static_pointer_cast<Media>(paint);
|
||||
QSharedPointer<Media> media = qSharedPointerCast<Media>(paint);
|
||||
Q_CHECK_PTR(media);
|
||||
updatePaintItem(paintId, createFileIcon(media->getUri()), strippedName(media->getUri()));
|
||||
// QString fileName = QFileDialog::getOpenFileName(this,
|
||||
@@ -243,7 +243,7 @@ void MainWindow::handlePaintChanged(Paint::ptr paint) {
|
||||
// importMediaFile(fileName, paint, false);
|
||||
}
|
||||
if (paint->getType() == "image") {
|
||||
std::tr1::shared_ptr<Image> image = std::tr1::static_pointer_cast<Image>(paint);
|
||||
QSharedPointer<Image> image = qSharedPointerCast<Image>(paint);
|
||||
Q_CHECK_PTR(image);
|
||||
updatePaintItem(paintId, createImageIcon(image->getUri()), strippedName(image->getUri()));
|
||||
// QString fileName = QFileDialog::getOpenFileName(this,
|
||||
@@ -254,7 +254,7 @@ void MainWindow::handlePaintChanged(Paint::ptr paint) {
|
||||
}
|
||||
else if (paint->getType() == "color") {
|
||||
// Pop-up color-choosing dialog to choose color paint.
|
||||
std::tr1::shared_ptr<Color> color = std::tr1::static_pointer_cast<Color>(paint);
|
||||
QSharedPointer<Color> color = qSharedPointerCast<Color>(paint);
|
||||
Q_CHECK_PTR(color);
|
||||
updatePaintItem(paintId, createColorIcon(color->getColor()), strippedName(color->getColor().name()));
|
||||
}
|
||||
@@ -525,11 +525,11 @@ void MainWindow::addMesh()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::tr1::shared_ptr<Texture> texture = std::tr1::static_pointer_cast<Texture>(paint);
|
||||
QSharedPointer<Texture> texture = qSharedPointerCast<Texture>(paint);
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
MShape::ptr outputQuad = MShape::ptr(Util::createMeshForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr inputQuad = MShape::ptr(Util::createMeshForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr outputQuad = MShape::ptr(Util::createMeshForTexture(texture.data(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr inputQuad = MShape::ptr(Util::createMeshForTexture(texture.data(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
mappingPtr = new TextureMapping(paint, outputQuad, inputQuad);
|
||||
}
|
||||
|
||||
@@ -561,11 +561,11 @@ void MainWindow::addTriangle()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::tr1::shared_ptr<Texture> texture = std::tr1::static_pointer_cast<Texture>(paint);
|
||||
QSharedPointer<Texture> texture = qSharedPointerCast<Texture>(paint);
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
MShape::ptr outputTriangle = MShape::ptr(Util::createTriangleForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr inputTriangle = MShape::ptr(Util::createTriangleForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr outputTriangle = MShape::ptr(Util::createTriangleForTexture(texture.data(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr inputTriangle = MShape::ptr(Util::createTriangleForTexture(texture.data(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
mappingPtr = new TextureMapping(paint, inputTriangle, outputTriangle);
|
||||
}
|
||||
|
||||
@@ -597,11 +597,11 @@ void MainWindow::addEllipse()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::tr1::shared_ptr<Texture> texture = std::tr1::static_pointer_cast<Texture>(paint);
|
||||
QSharedPointer<Texture> texture = qSharedPointerCast<Texture>(paint);
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
MShape::ptr outputEllipse = MShape::ptr(Util::createEllipseForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr inputEllipse = MShape::ptr(Util::createEllipseForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr outputEllipse = MShape::ptr(Util::createEllipseForTexture(texture.data(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr inputEllipse = MShape::ptr(Util::createEllipseForTexture(texture.data(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
mappingPtr = new TextureMapping(paint, inputEllipse, outputEllipse);
|
||||
}
|
||||
|
||||
@@ -1925,7 +1925,7 @@ bool MainWindow::importMediaFile(const QString &fileName, bool isImage)
|
||||
uint mediaId = createMediaPaint(NULL_UID, fileName, 0, 0, isImage, live);
|
||||
|
||||
// Initialize position (center).
|
||||
std::tr1::shared_ptr<Media> media = std::tr1::static_pointer_cast<Media>(mappingManager->getPaintById(mediaId));
|
||||
QSharedPointer<Media> media = qSharedPointerCast<Media>(mappingManager->getPaintById(mediaId));
|
||||
Q_CHECK_PTR(media);
|
||||
|
||||
if (_isPlaying)
|
||||
@@ -1961,7 +1961,7 @@ bool MainWindow::addColorPaint(const QColor& color)
|
||||
uint colorId = createColorPaint(NULL_UID, color);
|
||||
|
||||
// Initialize position (center).
|
||||
std::tr1::shared_ptr<Color> colorPaint = std::tr1::static_pointer_cast<Color>(mappingManager->getPaintById(colorId));
|
||||
QSharedPointer<Color> colorPaint = qSharedPointerCast<Color>(mappingManager->getPaintById(colorId));
|
||||
Q_CHECK_PTR(colorPaint);
|
||||
|
||||
// Does not do anything...
|
||||
@@ -2005,8 +2005,8 @@ void MainWindow::addPaintItem(uid paintId, const QIcon& icon, const QString& nam
|
||||
// connect(paintGui.get(), SIGNAL(valueChanged()),
|
||||
// this, SLOT(updateCanvases()));
|
||||
|
||||
connect(paintGui.get(), SIGNAL(valueChanged(Paint::ptr)),
|
||||
this, SLOT(handlePaintChanged(Paint::ptr)));
|
||||
connect(paintGui.data(), SIGNAL(valueChanged(Paint::ptr)),
|
||||
this, SLOT(handlePaintChanged(Paint::ptr)));
|
||||
|
||||
// Add paint item to paintList widget.
|
||||
QListWidgetItem* item = new QListWidgetItem(icon, name);
|
||||
@@ -2051,10 +2051,10 @@ void MainWindow::addMappingItem(uid mappingId)
|
||||
|
||||
// Add mapper.
|
||||
// XXX hardcoded for textures
|
||||
std::tr1::shared_ptr<TextureMapping> textureMapping;
|
||||
QSharedPointer<TextureMapping> textureMapping;
|
||||
if (paintType == "media" || paintType == "image")
|
||||
{
|
||||
textureMapping = std::tr1::static_pointer_cast<TextureMapping>(mapping);
|
||||
textureMapping = qSharedPointerCast<TextureMapping>(mapping);
|
||||
Q_CHECK_PTR(textureMapping);
|
||||
}
|
||||
|
||||
@@ -2107,17 +2107,17 @@ void MainWindow::addMappingItem(uid mappingId)
|
||||
mappingPropertyPanel->setEnabled(true);
|
||||
|
||||
// When mapper value is changed, update canvases.
|
||||
connect(mapper.get(), SIGNAL(valueChanged()),
|
||||
this, SLOT(updateCanvases()));
|
||||
connect(mapper.data(), SIGNAL(valueChanged()),
|
||||
this, SLOT(updateCanvases()));
|
||||
|
||||
connect(sourceCanvas, SIGNAL(shapeChanged(MShape*)),
|
||||
mapper.get(), SLOT(updateShape(MShape*)));
|
||||
connect(sourceCanvas, SIGNAL(shapeChanged(MShape*)),
|
||||
mapper.data(), SLOT(updateShape(MShape*)));
|
||||
|
||||
connect(destinationCanvas, SIGNAL(shapeChanged(MShape*)),
|
||||
mapper.get(), SLOT(updateShape(MShape*)));
|
||||
mapper.data(), SLOT(updateShape(MShape*)));
|
||||
|
||||
connect(this, SIGNAL(paintChanged()),
|
||||
mapper.get(), SLOT(updatePaint()));
|
||||
connect(this, SIGNAL(paintChanged()),
|
||||
mapper.data(), SLOT(updatePaint()));
|
||||
|
||||
// Switch to mapping tab.
|
||||
contentTab->setCurrentWidget(mappingSplitter);
|
||||
@@ -2535,7 +2535,7 @@ bool MainWindow::setTextureUri(int texture_id, const std::string &uri)
|
||||
|
||||
bool success = false;
|
||||
Paint::ptr paint = this->mappingManager->getPaintById(texture_id);
|
||||
if (paint.get() == NULL)
|
||||
if (paint.isNull())
|
||||
{
|
||||
std::cout << "No such texture paint id " << texture_id << std::endl;
|
||||
success = false;
|
||||
@@ -2544,14 +2544,14 @@ bool MainWindow::setTextureUri(int texture_id, const std::string &uri)
|
||||
{
|
||||
if (paint->getType() == "media")
|
||||
{
|
||||
Media *media = (Media *) paint.get(); // FIXME: use sharedptr cast
|
||||
Media *media = static_cast<Media*>(paint.data()); // FIXME: use sharedptr cast
|
||||
videoTimer->stop();
|
||||
success = media->setUri(QString(uri.c_str()));
|
||||
videoTimer->start();
|
||||
}
|
||||
else if (paint->getType() == "image")
|
||||
{
|
||||
Image *media = (Image*) paint.get(); // FIXME: use sharedptr cast
|
||||
Image *media = (Image*) paint.data(); // FIXME: use sharedptr cast
|
||||
videoTimer->stop();
|
||||
success = media->setUri(QString(uri.c_str()));
|
||||
videoTimer->start();
|
||||
@@ -2568,7 +2568,7 @@ bool MainWindow::setTextureUri(int texture_id, const std::string &uri)
|
||||
bool MainWindow::setTextureRate(int texture_id, double rate)
|
||||
{
|
||||
Paint::ptr paint = this->mappingManager->getPaintById(texture_id);
|
||||
if (paint.get() == NULL)
|
||||
if (paint.isNull())
|
||||
{
|
||||
std::cout << "No such texture paint id " << texture_id << std::endl;
|
||||
return false;
|
||||
@@ -2577,7 +2577,7 @@ bool MainWindow::setTextureRate(int texture_id, double rate)
|
||||
{
|
||||
if (paint->getType() == "media")
|
||||
{
|
||||
Media *media = (Media *) paint.get(); // FIXME: use sharedptr cast
|
||||
Media *media = static_cast<Media*>(paint.data()); // FIXME: use sharedptr cast
|
||||
videoTimer->stop();
|
||||
media->setRate(rate);
|
||||
videoTimer->start();
|
||||
|
||||
+45
-56
@@ -45,7 +45,7 @@ void ShapeControlPainter::_paintVertices(QPainter *painter, const QList<int>& se
|
||||
|
||||
void PolygonControlPainter::_paintShape(QPainter *painter)
|
||||
{
|
||||
Polygon* poly = static_cast<Polygon*>(getShape().get());
|
||||
Polygon* poly = static_cast<Polygon*>(getShape().data());
|
||||
Q_ASSERT(poly);
|
||||
|
||||
// Init colors and stroke.
|
||||
@@ -58,7 +58,7 @@ void PolygonControlPainter::_paintShape(QPainter *painter)
|
||||
|
||||
void EllipseControlPainter::_paintShape(QPainter *painter)
|
||||
{
|
||||
Ellipse* ellipse = static_cast<Ellipse*>(getShape().get());
|
||||
Ellipse* ellipse = static_cast<Ellipse*>(getShape().data());
|
||||
Q_ASSERT(ellipse);
|
||||
|
||||
// Init colors and stroke.
|
||||
@@ -76,7 +76,7 @@ void EllipseControlPainter::_paintShape(QPainter *painter)
|
||||
|
||||
void MeshControlPainter::_paintShape(QPainter *painter)
|
||||
{
|
||||
Mesh* mesh = static_cast<Mesh*>(getShape().get());
|
||||
Mesh* mesh = static_cast<Mesh*>(getShape().data());
|
||||
Q_ASSERT(mesh);
|
||||
|
||||
// Init colors and stroke.
|
||||
@@ -207,7 +207,7 @@ QPen ShapeGraphicsItem::_getRescaledShapeStroke(bool innerStroke)
|
||||
void ColorGraphicsItem::_prePaint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option)
|
||||
{
|
||||
Color* color = static_cast<Color*>(_mapping->getPaint().get());
|
||||
Color* color = static_cast<Color*>(_mapping->getPaint().data());
|
||||
Q_ASSERT(color);
|
||||
|
||||
painter->setPen(Qt::NoPen);
|
||||
@@ -221,7 +221,7 @@ void ColorGraphicsItem::_prePaint(QPainter *painter,
|
||||
QPainterPath PolygonColorGraphicsItem::shape() const
|
||||
{
|
||||
QPainterPath path;
|
||||
Polygon* poly = static_cast<Polygon*>(_shape.get());
|
||||
Polygon* poly = static_cast<Polygon*>(_shape.data());
|
||||
Q_ASSERT(poly);
|
||||
path.addPolygon(poly->toPolygon());
|
||||
return mapFromScene(path);
|
||||
@@ -231,7 +231,7 @@ void PolygonColorGraphicsItem::_doPaint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option)
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Polygon* poly = static_cast<Polygon*>(_shape.get());
|
||||
Polygon* poly = static_cast<Polygon*>(_shape.data());
|
||||
Q_ASSERT(poly);
|
||||
painter->drawPolygon(mapFromScene(poly->toPolygon()));
|
||||
}
|
||||
@@ -240,7 +240,7 @@ void PolygonColorGraphicsItem::_doPaintControls(QPainter* painter, const QStyleO
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
painter->setPen(_getRescaledShapeStroke());
|
||||
Polygon* poly = static_cast<Polygon*>(_shape.get());
|
||||
Polygon* poly = static_cast<Polygon*>(_shape.data());
|
||||
Q_ASSERT(poly);
|
||||
painter->drawPolygon(mapFromScene(poly->toPolygon()));
|
||||
}
|
||||
@@ -249,7 +249,7 @@ QPainterPath EllipseColorGraphicsItem::shape() const
|
||||
{
|
||||
// Create path for ellipse.
|
||||
QPainterPath path;
|
||||
Ellipse* ellipse = static_cast<Ellipse*>(_shape.get());
|
||||
Ellipse* ellipse = static_cast<Ellipse*>(_shape.data());
|
||||
Q_ASSERT(ellipse);
|
||||
QTransform transform;
|
||||
transform.translate(ellipse->getCenter().x(), ellipse->getCenter().y());
|
||||
@@ -269,13 +269,13 @@ void EllipseColorGraphicsItem::_doPaint(QPainter* painter,
|
||||
TextureGraphicsItem::TextureGraphicsItem(Mapping::ptr mapping, bool output)
|
||||
: ShapeGraphicsItem(mapping, output)
|
||||
{
|
||||
_textureMapping = std::tr1::static_pointer_cast<TextureMapping>(mapping);
|
||||
_textureMapping = qSharedPointerCast<TextureMapping>(mapping);
|
||||
Q_CHECK_PTR(_textureMapping);
|
||||
|
||||
_texture = std::tr1::static_pointer_cast<Texture>(_textureMapping->getPaint());
|
||||
_texture = qSharedPointerCast<Texture>(_textureMapping->getPaint());
|
||||
Q_CHECK_PTR(_texture);
|
||||
|
||||
_inputShape = std::tr1::static_pointer_cast<MShape>(_textureMapping->getInputShape());
|
||||
_inputShape = qSharedPointerCast<MShape>(_textureMapping->getInputShape());
|
||||
Q_CHECK_PTR(_inputShape);
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ void TextureGraphicsItem::_postPaint(QPainter* painter,
|
||||
QPainterPath PolygonTextureGraphicsItem::shape() const
|
||||
{
|
||||
QPainterPath path;
|
||||
Polygon* poly = static_cast<Polygon*>(_shape.get());
|
||||
Polygon* poly = static_cast<Polygon*>(_shape.data());
|
||||
Q_ASSERT(poly);
|
||||
path.addPolygon(poly->toPolygon());
|
||||
return mapFromScene(path);
|
||||
@@ -399,7 +399,7 @@ void PolygonTextureGraphicsItem::_doPaintControls(QPainter* painter, const QStyl
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
painter->setPen(_getRescaledShapeStroke());
|
||||
Polygon* poly = static_cast<Polygon*>(_shape.get());
|
||||
Polygon* poly = static_cast<Polygon*>(_shape.data());
|
||||
Q_ASSERT(poly);
|
||||
painter->drawPolygon(mapFromScene(poly->toPolygon()));
|
||||
}
|
||||
@@ -409,8 +409,8 @@ void MeshTextureGraphicsItem::_doDrawOutput(QPainter* painter)
|
||||
Q_UNUSED(painter);
|
||||
if (isOutput())
|
||||
{
|
||||
std::tr1::shared_ptr<Mesh> outputMesh = std::tr1::static_pointer_cast<Mesh>(_shape);
|
||||
std::tr1::shared_ptr<Mesh> inputMesh = std::tr1::static_pointer_cast<Mesh>(_inputShape);
|
||||
QSharedPointer<Mesh> outputMesh = qSharedPointerCast<Mesh>(_shape);
|
||||
QSharedPointer<Mesh> inputMesh = qSharedPointerCast<Mesh>(_inputShape);
|
||||
QVector<QVector<Quad> > outputQuads = outputMesh->getQuads2d();
|
||||
QVector<QVector<Quad> > inputQuads = inputMesh->getQuads2d();
|
||||
for (int x = 0; x < outputMesh->nHorizontalQuads(); x++)
|
||||
@@ -430,7 +430,7 @@ void MeshTextureGraphicsItem::_doPaintControls(QPainter* painter, const QStyleOp
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
|
||||
Mesh* mesh = static_cast<Mesh*>(_shape.get());
|
||||
Mesh* mesh = static_cast<Mesh*>(_shape.data());
|
||||
Q_ASSERT(mesh);
|
||||
|
||||
// Init colors and stroke.
|
||||
@@ -526,7 +526,7 @@ QPainterPath EllipseTextureGraphicsItem::shape() const
|
||||
{
|
||||
// Create path for ellipse.
|
||||
QPainterPath path;
|
||||
Ellipse* ellipse = static_cast<Ellipse*>(_shape.get());
|
||||
Ellipse* ellipse = static_cast<Ellipse*>(_shape.data());
|
||||
Q_ASSERT(ellipse);
|
||||
QTransform transform;
|
||||
transform.translate(ellipse->getCenter().x(), ellipse->getCenter().y());
|
||||
@@ -544,8 +544,8 @@ void EllipseTextureGraphicsItem::_doDrawOutput(QPainter* painter)
|
||||
{
|
||||
Q_UNUSED(painter);
|
||||
// Get input and output ellipses.
|
||||
std::tr1::shared_ptr<Ellipse> inputEllipse = std::tr1::static_pointer_cast<Ellipse>(_inputShape);
|
||||
std::tr1::shared_ptr<Ellipse> outputEllipse = std::tr1::static_pointer_cast<Ellipse>(_shape);
|
||||
QSharedPointer<Ellipse> inputEllipse = qSharedPointerCast<Ellipse>(_inputShape);
|
||||
QSharedPointer<Ellipse> outputEllipse = qSharedPointerCast<Ellipse>(_shape);
|
||||
|
||||
// Start / end angle.
|
||||
//const float startAngle = 0;
|
||||
@@ -645,7 +645,7 @@ Mapper::Mapper(Mapping::ptr mapping)
|
||||
_outputItem = _variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),
|
||||
QObject::tr("Output shape"));
|
||||
|
||||
_buildShapeProperty(_outputItem, mapping->getShape().get());
|
||||
_buildShapeProperty(_outputItem, mapping->getShape().data());
|
||||
_topItem->addSubProperty(_outputItem);
|
||||
|
||||
// Collapse output shape.
|
||||
@@ -697,6 +697,11 @@ void Mapper::setValue(QtProperty* property, const QVariant& value)
|
||||
}
|
||||
}
|
||||
|
||||
void Mapper::updatePaint()
|
||||
{
|
||||
_mapping->getPaint()->update();
|
||||
}
|
||||
|
||||
void Mapper::_buildShapeProperty(QtProperty* shapeItem, MShape* shape)
|
||||
{
|
||||
for (int i=0; i<shape->nVertices(); i++)
|
||||
@@ -732,14 +737,7 @@ void Mapper::_updateShapeProperty(QtProperty* shapeItem, MShape* shape)
|
||||
ColorMapper::ColorMapper(Mapping::ptr mapping)
|
||||
: Mapper(mapping)
|
||||
{
|
||||
color = std::tr1::static_pointer_cast<Color>(_mapping->getPaint());
|
||||
Q_CHECK_PTR(color);
|
||||
}
|
||||
|
||||
void ColorMapper::updatePaint()
|
||||
{
|
||||
color.reset();
|
||||
color = std::tr1::static_pointer_cast<Color>(_mapping->getPaint());
|
||||
color = qSharedPointerCast<Color>(_mapping->getPaint());
|
||||
Q_CHECK_PTR(color);
|
||||
}
|
||||
|
||||
@@ -757,7 +755,7 @@ void ColorMapper::updatePaint()
|
||||
// painter->setPen(Qt::NoPen);
|
||||
// painter->setBrush(color->getColor());
|
||||
//
|
||||
// std::tr1::shared_ptr<Mesh> outputMesh = std::tr1::static_pointer_cast<Mesh>(outputShape);
|
||||
// QSharedPointer<Mesh> outputMesh = qSharedPointerCast<Mesh>(outputShape);
|
||||
// QVector<QVector<Quad> > outputQuads = outputMesh->getQuads2d();
|
||||
// for (int x = 0; x < outputMesh->nHorizontalQuads(); x++)
|
||||
// {
|
||||
@@ -771,7 +769,7 @@ void ColorMapper::updatePaint()
|
||||
//
|
||||
//void MeshColorMapper::drawControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
//{
|
||||
// std::tr1::shared_ptr<Mesh> outputMesh = std::tr1::static_pointer_cast<Mesh>(outputShape);
|
||||
// QSharedPointer<Mesh> outputMesh = qSharedPointerCast<Mesh>(outputShape);
|
||||
// Util::drawControlsMesh(painter, selectedVertices, *outputMesh);
|
||||
//}
|
||||
//
|
||||
@@ -792,24 +790,24 @@ void ColorMapper::updatePaint()
|
||||
// ColorMapper::setValue(property, value);
|
||||
//}
|
||||
|
||||
TextureMapper::TextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
|
||||
TextureMapper::TextureMapper(QSharedPointer<TextureMapping> mapping)
|
||||
: Mapper(mapping),
|
||||
_meshItem(NULL)
|
||||
{
|
||||
// Assign members pointers.
|
||||
textureMapping = std::tr1::static_pointer_cast<TextureMapping>(_mapping);
|
||||
textureMapping = qSharedPointerCast<TextureMapping>(_mapping);
|
||||
Q_CHECK_PTR(textureMapping);
|
||||
|
||||
texture = std::tr1::static_pointer_cast<Texture>(textureMapping->getPaint());
|
||||
texture = qSharedPointerCast<Texture>(_mapping->getPaint());
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
inputShape = std::tr1::static_pointer_cast<MShape>(textureMapping->getInputShape());
|
||||
inputShape = textureMapping.toStrongRef()->getInputShape();
|
||||
Q_CHECK_PTR(inputShape);
|
||||
|
||||
// Input shape.
|
||||
_inputItem = _variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),
|
||||
QObject::tr("Input shape"));
|
||||
_buildShapeProperty(_inputItem, textureMapping->getInputShape().get());
|
||||
_buildShapeProperty(_inputItem, inputShape.data());
|
||||
_topItem->insertSubProperty(_inputItem, _opacityItem); // insert
|
||||
|
||||
// Collapse input shape.
|
||||
@@ -844,14 +842,14 @@ TextureMapper::TextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
|
||||
|
||||
void TextureMapper::updateShape(MShape* shape)
|
||||
{
|
||||
std::tr1::shared_ptr<TextureMapping> textureMapping = std::tr1::static_pointer_cast<TextureMapping>(_mapping);
|
||||
QSharedPointer<TextureMapping> textureMapping = qSharedPointerCast<TextureMapping>(_mapping);
|
||||
Q_CHECK_PTR(textureMapping);
|
||||
|
||||
std::tr1::shared_ptr<Texture> texture = std::tr1::static_pointer_cast<Texture>(textureMapping->getPaint());
|
||||
QSharedPointer<Texture> texture = qSharedPointerCast<Texture>(textureMapping->getPaint());
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
MShape* inputShape = textureMapping->getInputShape().get();
|
||||
MShape* outputShape = textureMapping->getShape().get();
|
||||
MShape* inputShape = textureMapping->getInputShape().data();
|
||||
MShape* outputShape = textureMapping->getShape().data();
|
||||
if (shape == inputShape)
|
||||
{
|
||||
_updateShapeProperty(_inputItem, inputShape);
|
||||
@@ -863,12 +861,6 @@ void TextureMapper::updateShape(MShape* shape)
|
||||
|
||||
}
|
||||
|
||||
void TextureMapper::updatePaint()
|
||||
{
|
||||
texture.reset();
|
||||
texture = std::tr1::static_pointer_cast<Texture>(textureMapping->getPaint());
|
||||
Q_CHECK_PTR(texture);
|
||||
}
|
||||
//
|
||||
//void TextureMapper::_preDraw(QPainter* painter)
|
||||
//{
|
||||
@@ -910,17 +902,17 @@ void TextureMapper::updatePaint()
|
||||
//
|
||||
//void PolygonTextureMapper::drawControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
//{
|
||||
// std::tr1::shared_ptr<Polygon> outputPoly = std::tr1::static_pointer_cast<Polygon>(outputShape);
|
||||
// QSharedPointer<Polygon> outputPoly = qSharedPointerCast<Polygon>(outputShape);
|
||||
// Util::drawControlsPolygon(painter, selectedVertices, *outputPoly);
|
||||
//}
|
||||
//
|
||||
//void PolygonTextureMapper::drawInputControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
//{
|
||||
// std::tr1::shared_ptr<Polygon> inputPoly = std::tr1::static_pointer_cast<Polygon>(inputShape);
|
||||
// QSharedPointer<Polygon> inputPoly = qSharedPointerCast<Polygon>(inputShape);
|
||||
// Util::drawControlsPolygon(painter, selectedVertices, *inputPoly);
|
||||
//}
|
||||
|
||||
TriangleTextureMapper::TriangleTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
|
||||
TriangleTextureMapper::TriangleTextureMapper(QSharedPointer<TextureMapping> mapping)
|
||||
: PolygonTextureMapper(mapping)
|
||||
{
|
||||
_graphicsItem = new TriangleTextureGraphicsItem(_mapping, true);
|
||||
@@ -941,14 +933,14 @@ TriangleTextureMapper::TriangleTextureMapper(std::tr1::shared_ptr<TextureMapping
|
||||
//// glEnd();
|
||||
//}
|
||||
|
||||
MeshTextureMapper::MeshTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
|
||||
MeshTextureMapper::MeshTextureMapper(QSharedPointer<TextureMapping> mapping)
|
||||
: PolygonTextureMapper(mapping)
|
||||
{
|
||||
_graphicsItem = new MeshTextureGraphicsItem(_mapping, true);
|
||||
_inputGraphicsItem = new MeshTextureGraphicsItem(_mapping, false);
|
||||
|
||||
// Add mesh sub property.
|
||||
Mesh* mesh = (Mesh*)textureMapping->getShape().get();
|
||||
QSharedPointer<Mesh> mesh = qSharedPointerCast<Mesh>(_mapping->getShape());
|
||||
_meshItem = _variantManager->addProperty(QVariant::Size, QObject::tr("Dimensions"));
|
||||
_meshItem->setValue(QSize(mesh->nColumns(), mesh->nRows()));
|
||||
_meshItem->setAttribute("minimum", QSize(2,2));
|
||||
@@ -959,11 +951,8 @@ void MeshTextureMapper::setValue(QtProperty* property, const QVariant& value)
|
||||
{
|
||||
if (property == _meshItem)
|
||||
{
|
||||
std::tr1::shared_ptr<TextureMapping> textureMapping = std::tr1::static_pointer_cast<TextureMapping>(_mapping);
|
||||
Q_CHECK_PTR(textureMapping);
|
||||
|
||||
Mesh* outputMesh = static_cast<Mesh*>(textureMapping->getShape().get());
|
||||
Mesh* inputMesh = static_cast<Mesh*>(textureMapping->getInputShape().get());
|
||||
QSharedPointer<Mesh> outputMesh = qSharedPointerCast<Mesh>(_mapping->getShape());
|
||||
QSharedPointer<Mesh> inputMesh = qSharedPointerCast<Mesh>(textureMapping.toStrongRef()->getShape());
|
||||
QSize size = (static_cast<QtVariantProperty*>(property))->value().toSize();
|
||||
if (outputMesh->nColumns() != size.width() || outputMesh->nRows() != size.height() ||
|
||||
inputMesh->nColumns() != size.width() || inputMesh->nRows() != size.height())
|
||||
@@ -983,7 +972,7 @@ void MeshTextureMapper::setValue(QtProperty* property, const QVariant& value)
|
||||
TextureMapper::setValue(property, value);
|
||||
}
|
||||
|
||||
EllipseTextureMapper::EllipseTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
|
||||
EllipseTextureMapper::EllipseTextureMapper(QSharedPointer<TextureMapping> mapping)
|
||||
: PolygonTextureMapper(mapping)
|
||||
{
|
||||
_graphicsItem = new EllipseTextureGraphicsItem(_mapping, true);
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#include <tr1/memory>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -58,7 +56,7 @@ class ShapeGraphicsItem;
|
||||
class ShapeControlPainter
|
||||
{
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<ShapeControlPainter> ptr;
|
||||
typedef QSharedPointer<ShapeControlPainter> ptr;
|
||||
|
||||
ShapeControlPainter(ShapeGraphicsItem* shapeItem);
|
||||
virtual ~ShapeControlPainter() {}
|
||||
@@ -224,9 +222,9 @@ protected:
|
||||
virtual void _doDrawInput(QPainter* painter);
|
||||
|
||||
protected:
|
||||
std::tr1::shared_ptr<TextureMapping> _textureMapping;
|
||||
std::tr1::shared_ptr<Texture> _texture;
|
||||
std::tr1::shared_ptr<MShape> _inputShape;
|
||||
QSharedPointer<TextureMapping> _textureMapping;
|
||||
QSharedPointer<Texture> _texture;
|
||||
QSharedPointer<MShape> _inputShape;
|
||||
};
|
||||
|
||||
/// Graphics item for textured polygons (eg. triangles).
|
||||
@@ -306,11 +304,13 @@ class Mapper : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<Mapper> ptr;
|
||||
typedef QSharedPointer<Mapper> ptr;
|
||||
|
||||
protected:
|
||||
/// Constructor. A mapper applies to a mapping.
|
||||
Mapper(Mapping::ptr mapping);
|
||||
|
||||
public:
|
||||
virtual ~Mapper();
|
||||
|
||||
public:
|
||||
@@ -327,7 +327,7 @@ public:
|
||||
public slots:
|
||||
virtual void setValue(QtProperty* property, const QVariant& value);
|
||||
virtual void updateShape(MShape* shape) { Q_UNUSED(shape); }
|
||||
virtual void updatePaint() {}
|
||||
virtual void updatePaint();
|
||||
|
||||
signals:
|
||||
void valueChanged();
|
||||
@@ -362,15 +362,12 @@ class ColorMapper : public Mapper
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public slots:
|
||||
virtual void updatePaint();
|
||||
|
||||
protected:
|
||||
ColorMapper(Mapping::ptr mapping);
|
||||
virtual ~ColorMapper() {}
|
||||
|
||||
protected:
|
||||
std::tr1::shared_ptr<Color> color;
|
||||
QSharedPointer<Color> color;
|
||||
};
|
||||
|
||||
class PolygonColorMapper : public ColorMapper
|
||||
@@ -422,7 +419,7 @@ class TextureMapper : public Mapper
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TextureMapper(std::tr1::shared_ptr<TextureMapping> mapping);
|
||||
TextureMapper(QSharedPointer<TextureMapping> mapping);
|
||||
virtual ~TextureMapper() {}
|
||||
|
||||
// /**
|
||||
@@ -437,7 +434,6 @@ public:
|
||||
|
||||
public slots:
|
||||
virtual void updateShape(MShape* shape);
|
||||
virtual void updatePaint();
|
||||
|
||||
//protected:
|
||||
// virtual void _doDraw(QPainter* painter) = 0;
|
||||
@@ -449,9 +445,9 @@ protected:
|
||||
QtVariantProperty* _meshItem;
|
||||
|
||||
// FIXME: use typedefs, member of the class for type names that are too long to type:
|
||||
std::tr1::shared_ptr<TextureMapping> textureMapping;
|
||||
std::tr1::shared_ptr<Texture> texture;
|
||||
std::tr1::shared_ptr<MShape> inputShape;
|
||||
QWeakPointer<TextureMapping> textureMapping;
|
||||
QWeakPointer<Texture> texture;
|
||||
QWeakPointer<MShape> inputShape;
|
||||
};
|
||||
|
||||
class PolygonTextureMapper : public TextureMapper
|
||||
@@ -459,7 +455,7 @@ class PolygonTextureMapper : public TextureMapper
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PolygonTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping) : TextureMapper(mapping) {}
|
||||
PolygonTextureMapper(QSharedPointer<TextureMapping> mapping) : TextureMapper(mapping) {}
|
||||
virtual ~PolygonTextureMapper() {}
|
||||
};
|
||||
|
||||
@@ -468,7 +464,7 @@ class TriangleTextureMapper : public PolygonTextureMapper
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TriangleTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping);
|
||||
TriangleTextureMapper(QSharedPointer<TextureMapping> mapping);
|
||||
virtual ~TriangleTextureMapper() {}
|
||||
};
|
||||
|
||||
@@ -477,7 +473,7 @@ class MeshTextureMapper : public PolygonTextureMapper
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MeshTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping);
|
||||
MeshTextureMapper(QSharedPointer<TextureMapping> mapping);
|
||||
virtual ~MeshTextureMapper() {}
|
||||
|
||||
public slots:
|
||||
@@ -491,7 +487,7 @@ class EllipseTextureMapper : public PolygonTextureMapper {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EllipseTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping);
|
||||
EllipseTextureMapper(QSharedPointer<TextureMapping> mapping);
|
||||
virtual ~EllipseTextureMapper() {}
|
||||
|
||||
protected:
|
||||
|
||||
+1
-1
@@ -497,7 +497,7 @@ void MapperGLCanvas::_glueVertex(QPointF* p)
|
||||
MappingManager manager = MainWindow::instance()->getMappingManager();
|
||||
for (int i = 0; i < manager.nMappings(); i++)
|
||||
{
|
||||
MShape *shape = manager.getMapping(i)->getShape().get();
|
||||
MShape *shape = manager.getMapping(i)->getShape().data();
|
||||
if (shape && shape != getCurrentShape())
|
||||
{
|
||||
for (int vertex = 0; vertex < shape->nVertices(); vertex++)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define MAPPING_H_
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <tr1/memory>
|
||||
|
||||
#include "Shape.h"
|
||||
#include "Paint.h"
|
||||
#include "UidAllocator.h"
|
||||
@@ -64,7 +64,7 @@ protected:
|
||||
Mapping(Paint::ptr paint, MShape::ptr shape, uid id=NULL_UID);
|
||||
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<Mapping> ptr;
|
||||
typedef QSharedPointer<Mapping> ptr;
|
||||
|
||||
virtual ~Mapping();
|
||||
|
||||
@@ -118,7 +118,6 @@ public:
|
||||
float getOpacity() const { return _opacity * _paint->getOpacity(); }
|
||||
|
||||
void setPaint(Paint::ptr p) { _paint = p; }
|
||||
void removePaint() { if (_paint) delete _paint.get(); }
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include <tr1/memory>
|
||||
|
||||
/**
|
||||
* Private declaration of the video player.
|
||||
|
||||
+3
-3
@@ -24,10 +24,10 @@
|
||||
#define OSC_INTERFACE_H_
|
||||
#ifdef HAVE_OSC
|
||||
|
||||
#include <tr1/memory>
|
||||
#include <QVariant>
|
||||
|
||||
#include "concurrentqueue.h"
|
||||
#include "OscReceiver.h"
|
||||
#include <QVariant>
|
||||
|
||||
class MainWindow; // forward decl
|
||||
|
||||
@@ -37,7 +37,7 @@ class MainWindow; // forward decl
|
||||
class OscInterface
|
||||
{
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<OscInterface> ptr;
|
||||
typedef QSharedPointer<OscInterface> ptr;
|
||||
OscInterface(
|
||||
//MainWindow* owner,
|
||||
const std::string &listen_port);
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#include <tr1/memory>
|
||||
|
||||
#include "UidAllocator.h"
|
||||
|
||||
/**
|
||||
@@ -56,7 +54,7 @@ protected:
|
||||
Paint(uid id=NULL_UID);
|
||||
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<Paint> ptr;
|
||||
typedef QSharedPointer<Paint> ptr;
|
||||
|
||||
virtual ~Paint();
|
||||
|
||||
|
||||
+3
-3
@@ -73,7 +73,7 @@ void PaintGui::setValue(QtProperty* property, const QVariant& value)
|
||||
ColorGui::ColorGui(Paint::ptr paint)
|
||||
: PaintGui(paint)
|
||||
{
|
||||
color = std::tr1::static_pointer_cast<Color>(paint);
|
||||
color = qSharedPointerCast<Color>(paint);
|
||||
Q_CHECK_PTR(color);
|
||||
|
||||
_colorItem = _variantManager->addProperty(QVariant::Color,
|
||||
@@ -99,7 +99,7 @@ TextureGui::TextureGui(Paint::ptr paint) : PaintGui(paint) {
|
||||
ImageGui::ImageGui(Paint::ptr paint)
|
||||
: TextureGui(paint)
|
||||
{
|
||||
image = std::tr1::static_pointer_cast<Image>(paint);
|
||||
image = qSharedPointerCast<Image>(paint);
|
||||
Q_CHECK_PTR(image);
|
||||
|
||||
_imageFileItem = _variantManager->addProperty(VariantManager::filePathTypeId(),
|
||||
@@ -123,7 +123,7 @@ void ImageGui::setValue(QtProperty* property, const QVariant& value) {
|
||||
MediaGui::MediaGui(Paint::ptr paint)
|
||||
: TextureGui(paint)
|
||||
{
|
||||
media = std::tr1::static_pointer_cast<Media>(paint);
|
||||
media = qSharedPointerCast<Media>(paint);
|
||||
Q_CHECK_PTR(media);
|
||||
|
||||
_mediaFileItem = _variantManager->addProperty(VariantManager::filePathTypeId(),
|
||||
|
||||
+4
-6
@@ -29,8 +29,6 @@
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
#include <tr1/memory>
|
||||
|
||||
#include "MM.h"
|
||||
|
||||
#include "Paint.h"
|
||||
@@ -48,7 +46,7 @@ class PaintGui : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<PaintGui> ptr;
|
||||
typedef QSharedPointer<PaintGui> ptr;
|
||||
|
||||
public:
|
||||
// TODO: should be protected
|
||||
@@ -86,7 +84,7 @@ public slots:
|
||||
virtual void setValue(QtProperty* property, const QVariant& value);
|
||||
|
||||
protected:
|
||||
std::tr1::shared_ptr<Color> color;
|
||||
QSharedPointer<Color> color;
|
||||
QtVariantProperty* _colorItem;
|
||||
};
|
||||
|
||||
@@ -112,7 +110,7 @@ public slots:
|
||||
virtual void setValue(QtProperty* property, const QVariant& value);
|
||||
|
||||
protected:
|
||||
std::tr1::shared_ptr<Image> image;
|
||||
QSharedPointer<Image> image;
|
||||
QtVariantProperty* _imageFileItem;
|
||||
};
|
||||
|
||||
@@ -127,7 +125,7 @@ public slots:
|
||||
virtual void setValue(QtProperty* property, const QVariant& value);
|
||||
|
||||
protected:
|
||||
std::tr1::shared_ptr<Media> media;
|
||||
QSharedPointer<Media> media;
|
||||
QtVariantProperty* _mediaFileItem;
|
||||
QtVariantProperty* _mediaRateItem;
|
||||
QtVariantProperty* _mediaVolumeItem;
|
||||
|
||||
+4
-4
@@ -37,12 +37,12 @@ bool ProjectWriter::writeFile(QIODevice *device)
|
||||
|
||||
_xml.writeStartElement("paints");
|
||||
for (int i = 0; i < _manager->nPaints(); i++)
|
||||
writeItem(_manager->getPaint(i).get());
|
||||
writeItem(_manager->getPaint(i).data());
|
||||
_xml.writeEndElement();
|
||||
|
||||
_xml.writeStartElement("mappings");
|
||||
for (int i = 0; i < _manager->nMappings(); i++)
|
||||
writeItem(_manager->getMapping(i).get());
|
||||
writeItem(_manager->getMapping(i).data());
|
||||
_xml.writeEndElement();
|
||||
|
||||
_xml.writeEndElement();
|
||||
@@ -150,7 +150,7 @@ void ProjectWriter::writeItem(Mapping *item)
|
||||
_xml.writeAttribute("solo", QString::number((int) item->isSolo() ? 1 : 0));
|
||||
_xml.writeAttribute("visible", QString::number((int) item->isVisible() ? 1 : 0));
|
||||
|
||||
MShape *shape = item->getShape().get();
|
||||
MShape *shape = item->getShape().data();
|
||||
_xml.writeStartElement("destination");
|
||||
_xml.writeAttribute("shape", shape->getType());
|
||||
writeShapeVertices(shape);
|
||||
@@ -159,7 +159,7 @@ void ProjectWriter::writeItem(Mapping *item)
|
||||
if (item->getType().endsWith("_texture"))
|
||||
{
|
||||
TextureMapping *tex = (TextureMapping *) item;
|
||||
shape = tex->getInputShape().get();
|
||||
shape = tex->getInputShape().data();
|
||||
|
||||
_xml.writeStartElement("source");
|
||||
_xml.writeAttribute("shape", shape->getType());
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#ifndef SHAPE_H_
|
||||
#define SHAPE_H_
|
||||
|
||||
#include <tr1/memory>
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
|
||||
@@ -45,7 +44,7 @@
|
||||
class MShape
|
||||
{
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<MShape> ptr;
|
||||
typedef QSharedPointer<MShape> ptr;
|
||||
|
||||
MShape() {}
|
||||
MShape(QVector<QPointF> vertices_) :
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ MShape* SourceGLCanvas::getShapeFromMappingId(uid mappingId) const
|
||||
{
|
||||
Mapping::ptr mapping = getMainWindow()->getMappingManager().getMappingById(mappingId);
|
||||
Q_CHECK_PTR(mapping);
|
||||
return mapping->getInputShape().get();
|
||||
return mapping->getInputShape().data();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user