diff --git a/DestinationGLCanvas.cpp b/DestinationGLCanvas.cpp index 05c507d..8ea036d 100644 --- a/DestinationGLCanvas.cpp +++ b/DestinationGLCanvas.cpp @@ -40,6 +40,6 @@ QSharedPointer DestinationGLCanvas::getShapeGraphicsItemFromM return QSharedPointer(); else { - return MainWindow::instance()->getMapperByMappingId(mappingId)->getGraphicsItem(); + return MainWindow::instance()->getMappingGuiByMappingId(mappingId)->getGraphicsItem(); } } diff --git a/DestinationGLCanvas.h b/DestinationGLCanvas.h index df51cb8..08f686c 100644 --- a/DestinationGLCanvas.h +++ b/DestinationGLCanvas.h @@ -24,7 +24,7 @@ #include "MapperGLCanvas.h" #include "MappingManager.h" -#include "Mapper.h" +#include "MappingGui.h" class DestinationGLCanvas: public MapperGLCanvas { diff --git a/MainWindow.cpp b/MainWindow.cpp index 981fd9c..3688881 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -2144,7 +2144,7 @@ void MainWindow::addMappingItem(uid mappingId) Q_CHECK_PTR(textureMapping); } - Mapper::ptr mapper; + MappingGui::ptr mapper; // XXX Branching on nVertices() is crap @@ -2156,9 +2156,9 @@ void MainWindow::addMappingItem(uid mappingId) icon = QIcon(":/shape-triangle"); if (paintType == "color") - mapper = Mapper::ptr(new PolygonColorMapper(mapping)); + mapper = MappingGui::ptr(new PolygonColorMappingGui(mapping)); else - mapper = Mapper::ptr(new TriangleTextureMapper(textureMapping)); + mapper = MappingGui::ptr(new TriangleTextureMappingGui(textureMapping)); } // Mesh else if (shapeType == "mesh" || shapeType == "quad") @@ -2166,18 +2166,18 @@ void MainWindow::addMappingItem(uid mappingId) label = QString(shapeType == "mesh" ? "Mesh %1" : "Quad %1").arg(mappingId); icon = QIcon(":/shape-mesh"); if (paintType == "color") - mapper = Mapper::ptr(new PolygonColorMapper(mapping)); + mapper = MappingGui::ptr(new PolygonColorMappingGui(mapping)); else - mapper = Mapper::ptr(new MeshTextureMapper(textureMapping)); + mapper = MappingGui::ptr(new MeshTextureMappingGui(textureMapping)); } else if (shapeType == "ellipse") { label = QString("Ellipse %1").arg(mappingId); icon = QIcon(":/shape-ellipse"); if (paintType == "color") - mapper = Mapper::ptr(new EllipseColorMapper(mapping)); + mapper = MappingGui::ptr(new EllipseColorMappingGui(mapping)); else - mapper = Mapper::ptr(new EllipseTextureMapper(textureMapping)); + mapper = MappingGui::ptr(new EllipseTextureMappingGui(textureMapping)); } else { diff --git a/MainWindow.h b/MainWindow.h index af2be9c..5cc6384 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -369,7 +369,7 @@ private: // View. // The view counterpart of Mappings. - QMap mappers; + QMap mappers; QMap paintGuis; // Current selected paint/mapping. @@ -404,7 +404,7 @@ private: public: // Accessor/mutators for the view. /////////////////////////////////////////////////////////////////// MappingManager& getMappingManager() const { return *mappingManager; } - Mapper::ptr getMapperByMappingId(uint id) const { return mappers[id]; } + MappingGui::ptr getMappingGuiByMappingId(uint id) const { return mappers[id]; } uid getCurrentPaintId() const { return currentPaintId; } uid getCurrentMappingId() const { return currentMappingId; } OutputGLWindow* getOutputWindow() const { return outputWindow; } diff --git a/MapperGLCanvas.h b/MapperGLCanvas.h index e25d29e..9829b3b 100644 --- a/MapperGLCanvas.h +++ b/MapperGLCanvas.h @@ -35,7 +35,7 @@ #include "UidAllocator.h" #include "Shape.h" -#include "Mapper.h" +#include "MappingGui.h" class MainWindow; class ShapeGraphicsItem; diff --git a/Mapper.cpp b/MappingGui.cpp similarity index 93% rename from Mapper.cpp rename to MappingGui.cpp index 3f3ea9b..0fa11c5 100644 --- a/Mapper.cpp +++ b/MappingGui.cpp @@ -1,5 +1,5 @@ /* - * Mapper.cpp + * MappingGui.cpp * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -#include "Mapper.h" +#include "MappingGui.h" #include "MainWindow.h" ShapeControlPainter::ShapeControlPainter(ShapeGraphicsItem* shapeItem) @@ -577,7 +577,7 @@ void EllipseTextureGraphicsItem::_setPointOfEllipseAtAngle(QPointF& point, const point.setY( cos(angle + rotation) * distance + center.y() ); } -Mapper::Mapper(Mapping::ptr mapping) +MappingGui::MappingGui(Mapping::ptr mapping) : _mapping(mapping), _graphicsItem(NULL), _inputGraphicsItem(NULL) @@ -621,7 +621,7 @@ Mapper::Mapper(Mapping::ptr mapping) } -void Mapper::setValue(QtProperty* property, const QVariant& value) +void MappingGui::setValue(QtProperty* property, const QVariant& value) { if (property == _opacityItem) { @@ -649,7 +649,7 @@ void Mapper::setValue(QtProperty* property, const QVariant& value) } } -void Mapper::updateShape(MShape* shape) +void MappingGui::updateShape(MShape* shape) { if (shape == _mapping->getShape().data()) { @@ -657,7 +657,7 @@ void Mapper::updateShape(MShape* shape) } } -void Mapper::_buildShapeProperty(QtProperty* shapeItem, MShape* shape) +void MappingGui::_buildShapeProperty(QtProperty* shapeItem, MShape* shape) { for (int i=0; inVertices(); i++) { @@ -674,7 +674,7 @@ void Mapper::_buildShapeProperty(QtProperty* shapeItem, MShape* shape) } -void Mapper::_updateShapeProperty(QtProperty* shapeItem, MShape* shape) +void MappingGui::_updateShapeProperty(QtProperty* shapeItem, MShape* shape) { QList pointItems = shapeItem->subProperties(); for (int i=0; inVertices(); i++) @@ -689,16 +689,16 @@ void Mapper::_updateShapeProperty(QtProperty* shapeItem, MShape* shape) } } -ColorMapper::ColorMapper(Mapping::ptr mapping) - : Mapper(mapping) +ColorMappingGui::ColorMappingGui(Mapping::ptr mapping) + : MappingGui(mapping) { color = qSharedPointerCast(_mapping->getPaint()); Q_CHECK_PTR(color); } -//MeshColorMapper::MeshColorMapper(Mapping::ptr mapping) -// : ColorMapper(mapping) { +//MeshColorMappingGui::MeshColorMappingGui(Mapping::ptr mapping) +// : ColorMappingGui(mapping) { // // Add mesh sub property. // Mesh* mesh = (Mesh*)mapping->getShape().get(); // _meshItem = _variantManager->addProperty(QVariant::Size, QObject::tr("Dimensions")); @@ -706,7 +706,7 @@ ColorMapper::ColorMapper(Mapping::ptr mapping) // _topItem->insertSubProperty(_meshItem, 0); // insert at the beginning //} // -//void MeshColorMapper::draw(QPainter* painter) +//void MeshColorMappingGui::draw(QPainter* painter) //{ // painter->setPen(Qt::NoPen); // painter->setBrush(color->getColor()); @@ -723,13 +723,13 @@ ColorMapper::ColorMapper(Mapping::ptr mapping) // } //} // -//void MeshColorMapper::drawControls(QPainter* painter, const QList* selectedVertices) +//void MeshColorMappingGui::drawControls(QPainter* painter, const QList* selectedVertices) //{ // QSharedPointer outputMesh = qSharedPointerCast(outputShape); // Util::drawControlsMesh(painter, selectedVertices, *outputMesh); //} // -//void MeshColorMapper::setValue(QtProperty* property, const QVariant& value) +//void MeshColorMappingGui::setValue(QtProperty* property, const QVariant& value) //{ // if (property == _meshItem) // { @@ -743,11 +743,11 @@ ColorMapper::ColorMapper(Mapping::ptr mapping) // } // } // else -// ColorMapper::setValue(property, value); +// ColorMappingGui::setValue(property, value); //} -TextureMapper::TextureMapper(QSharedPointer mapping) - : Mapper(mapping), +TextureMappingGui::TextureMappingGui(QSharedPointer mapping) + : MappingGui(mapping), _meshItem(NULL) { // Assign members pointers. @@ -770,7 +770,7 @@ TextureMapper::TextureMapper(QSharedPointer mapping) _propertyBrowser->setExpanded(_propertyBrowser->items(_inputItem).at(0), false); } // -//void TextureMapper::drawInput(QPainter* painter) +//void TextureMappingGui::drawInput(QPainter* painter) //{ // // Prepare drawing. // _preDraw(painter); @@ -796,7 +796,7 @@ TextureMapper::TextureMapper(QSharedPointer mapping) // _postDraw(painter); //} -void TextureMapper::updateShape(MShape* shape) +void TextureMappingGui::updateShape(MShape* shape) { QSharedPointer textureMapping = qSharedPointerCast(_mapping); Q_CHECK_PTR(textureMapping); @@ -818,7 +818,7 @@ void TextureMapper::updateShape(MShape* shape) } // -//void TextureMapper::_preDraw(QPainter* painter) +//void TextureMappingGui::_preDraw(QPainter* painter) //{ // painter->beginNativePainting(); // @@ -849,33 +849,33 @@ void TextureMapper::updateShape(MShape* shape) // glColor4f(1.0f, 1.0f, 1.0f, 1.0f); //} // -//void TextureMapper::_postDraw(QPainter* painter) +//void TextureMappingGui::_postDraw(QPainter* painter) //{ // glDisable(GL_TEXTURE_2D); // // painter->endNativePainting(); //} // -//void PolygonTextureMapper::drawControls(QPainter* painter, const QList* selectedVertices) +//void PolygonTextureMappingGui::drawControls(QPainter* painter, const QList* selectedVertices) //{ // QSharedPointer outputPoly = qSharedPointerCast(outputShape); // Util::drawControlsPolygon(painter, selectedVertices, *outputPoly); //} // -//void PolygonTextureMapper::drawInputControls(QPainter* painter, const QList* selectedVertices) +//void PolygonTextureMappingGui::drawInputControls(QPainter* painter, const QList* selectedVertices) //{ // QSharedPointer inputPoly = qSharedPointerCast(inputShape); // Util::drawControlsPolygon(painter, selectedVertices, *inputPoly); //} -TriangleTextureMapper::TriangleTextureMapper(QSharedPointer mapping) - : PolygonTextureMapper(mapping) +TriangleTextureMappingGui::TriangleTextureMappingGui(QSharedPointer mapping) + : PolygonTextureMappingGui(mapping) { _graphicsItem.reset(new TriangleTextureGraphicsItem(_mapping, true)); _inputGraphicsItem.reset(new TriangleTextureGraphicsItem(_mapping, false)); } // -//void TriangleTextureMapper::_doDraw(QPainter* painter) +//void TriangleTextureMappingGui::_doDraw(QPainter* painter) //{ // qDebug() << "Is this really used!" << endl; //// Q_UNUSED(painter); @@ -889,8 +889,8 @@ TriangleTextureMapper::TriangleTextureMapper(QSharedPointer mapp //// glEnd(); //} -MeshTextureMapper::MeshTextureMapper(QSharedPointer mapping) - : PolygonTextureMapper(mapping) +MeshTextureMappingGui::MeshTextureMappingGui(QSharedPointer mapping) + : PolygonTextureMappingGui(mapping) { _graphicsItem.reset(new MeshTextureGraphicsItem(_mapping, true)); _inputGraphicsItem.reset(new MeshTextureGraphicsItem(_mapping, false)); @@ -903,7 +903,7 @@ MeshTextureMapper::MeshTextureMapper(QSharedPointer mapping) _topItem->insertSubProperty(_meshItem, _opacityItem); // insert at the beginning } -void MeshTextureMapper::setValue(QtProperty* property, const QVariant& value) +void MeshTextureMappingGui::setValue(QtProperty* property, const QVariant& value) { if (property == _meshItem) { @@ -925,11 +925,11 @@ void MeshTextureMapper::setValue(QtProperty* property, const QVariant& value) } } else - TextureMapper::setValue(property, value); + TextureMappingGui::setValue(property, value); } -EllipseTextureMapper::EllipseTextureMapper(QSharedPointer mapping) -: PolygonTextureMapper(mapping) +EllipseTextureMappingGui::EllipseTextureMappingGui(QSharedPointer mapping) +: PolygonTextureMappingGui(mapping) { _graphicsItem.reset(new EllipseTextureGraphicsItem(_mapping, true)); _inputGraphicsItem.reset(new EllipseTextureGraphicsItem(_mapping, false)); diff --git a/Mapper.h b/MappingGui.h similarity index 88% rename from Mapper.h rename to MappingGui.h index c3e4833..dba893c 100644 --- a/Mapper.h +++ b/MappingGui.h @@ -1,5 +1,5 @@ /* - * Mapper.h + * MappingGui.h * * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com * (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net @@ -19,8 +19,8 @@ */ -#ifndef MAPPER_H_ -#define MAPPER_H_ +#ifndef MAPPING_GUI_ +#define MAPPING_GUI_ #include @@ -304,19 +304,19 @@ protected: * This is the "view" side of the Mapping class (model). It contains the graphic items for * both input and output as well as the properties editor. */ -class Mapper : public QObject +class MappingGui : public QObject { Q_OBJECT public: - typedef QSharedPointer ptr; + typedef QSharedPointer ptr; protected: /// Constructor. A mapper applies to a mapping. - Mapper(Mapping::ptr mapping); + MappingGui(Mapping::ptr mapping); public: - virtual ~Mapper() {} + virtual ~MappingGui() {} public: /// Returns a pointer to the properties editor for that mapper. @@ -359,49 +359,49 @@ protected: }; /// Parent class for color -> color mappings. -class ColorMapper : public Mapper +class ColorMappingGui : public MappingGui { Q_OBJECT protected: - ColorMapper(Mapping::ptr mapping); - virtual ~ColorMapper() {} + ColorMappingGui(Mapping::ptr mapping); + virtual ~ColorMappingGui() {} protected: QSharedPointer color; }; -class PolygonColorMapper : public ColorMapper +class PolygonColorMappingGui : public ColorMappingGui { Q_OBJECT public: - PolygonColorMapper(Mapping::ptr mapping) : ColorMapper(mapping) { + PolygonColorMappingGui(Mapping::ptr mapping) : ColorMappingGui(mapping) { _graphicsItem.reset(new PolygonColorGraphicsItem(mapping, true)); } - virtual ~PolygonColorMapper() {} + virtual ~PolygonColorMappingGui() {} }; -class EllipseColorMapper : public ColorMapper +class EllipseColorMappingGui : public ColorMappingGui { Q_OBJECT public: - EllipseColorMapper(Mapping::ptr mapping) : ColorMapper(mapping) { + EllipseColorMappingGui(Mapping::ptr mapping) : ColorMappingGui(mapping) { _graphicsItem.reset(new EllipseColorGraphicsItem(mapping, true)); } - virtual ~EllipseColorMapper() {} + virtual ~EllipseColorMappingGui() {} }; /// Parent class for texture -> texture mapping. -class TextureMapper : public Mapper +class TextureMappingGui : public MappingGui { Q_OBJECT public: - TextureMapper(QSharedPointer mapping); - virtual ~TextureMapper() {} + TextureMappingGui(QSharedPointer mapping); + virtual ~TextureMappingGui() {} public slots: virtual void updateShape(MShape* shape); @@ -416,31 +416,31 @@ protected: QWeakPointer inputShape; }; -class PolygonTextureMapper : public TextureMapper +class PolygonTextureMappingGui : public TextureMappingGui { Q_OBJECT public: - PolygonTextureMapper(QSharedPointer mapping) : TextureMapper(mapping) {} - virtual ~PolygonTextureMapper() {} + PolygonTextureMappingGui(QSharedPointer mapping) : TextureMappingGui(mapping) {} + virtual ~PolygonTextureMappingGui() {} }; -class TriangleTextureMapper : public PolygonTextureMapper +class TriangleTextureMappingGui : public PolygonTextureMappingGui { Q_OBJECT public: - TriangleTextureMapper(QSharedPointer mapping); - virtual ~TriangleTextureMapper() {} + TriangleTextureMappingGui(QSharedPointer mapping); + virtual ~TriangleTextureMappingGui() {} }; -class MeshTextureMapper : public PolygonTextureMapper +class MeshTextureMappingGui : public PolygonTextureMappingGui { Q_OBJECT public: - MeshTextureMapper(QSharedPointer mapping); - virtual ~MeshTextureMapper() {} + MeshTextureMappingGui(QSharedPointer mapping); + virtual ~MeshTextureMappingGui() {} public slots: virtual void setValue(QtProperty* property, const QVariant& value); @@ -449,12 +449,12 @@ private: QtVariantProperty* _meshItem; }; -class EllipseTextureMapper : public PolygonTextureMapper { +class EllipseTextureMappingGui : public PolygonTextureMappingGui { Q_OBJECT public: - EllipseTextureMapper(QSharedPointer mapping); - virtual ~EllipseTextureMapper() {} + EllipseTextureMappingGui(QSharedPointer mapping); + virtual ~EllipseTextureMappingGui() {} protected: static void _setPointOfEllipseAtAngle(QPointF& point, const QPointF& center, float hRadius, float vRadius, float rotation, float circularAngle); diff --git a/Paint.h b/Paint.h index de5b8c3..938673f 100644 --- a/Paint.h +++ b/Paint.h @@ -40,7 +40,7 @@ * A Paint is a style that can be applied when drawing potentially any shape. * * Defines the way to draw any shape. - * There must be a Mapper that implements this paint for every shape + * There must be a MappingGui that implements this paint for every shape * so that this shape might be drawn with it. */ class Paint @@ -113,7 +113,7 @@ public: }; /** - * Paint that uses an OpenGL texture to paint on potentially any Mapper. + * Paint that uses an OpenGL texture to paint on potentially any MappingGui. * * This video texture is actually an OpenGL texture. */ diff --git a/PaintGui.h b/PaintGui.h index c857afe..d44ab98 100644 --- a/PaintGui.h +++ b/PaintGui.h @@ -46,7 +46,7 @@ * The view components corresponding to a Paint (which is the model) in the interface. * Mainly manages the property browser for the Paint. * - * In other words the PaintGui is to Paint what Mapper is to Mapping. + * In other words the PaintGui is to Paint what MappingGui is to Mapping. */ class PaintGui : public QObject { Q_OBJECT diff --git a/SourceGLCanvas.cpp b/SourceGLCanvas.cpp index 5af3f0a..cfddc72 100644 --- a/SourceGLCanvas.cpp +++ b/SourceGLCanvas.cpp @@ -48,7 +48,7 @@ QSharedPointer SourceGLCanvas::getShapeGraphicsItemFromMappin else { - return MainWindow::instance()->getMapperByMappingId(mappingId)->getInputGraphicsItem(); + return MainWindow::instance()->getMappingGuiByMappingId(mappingId)->getInputGraphicsItem(); } } @@ -59,7 +59,7 @@ QSharedPointer SourceGLCanvas::getShapeGraphicsItemFromMappin // if (getMainWindow()->hasCurrentMapping()) // { // uint mappingId = getMainWindow()->getCurrentMappingId(); -// const Mapper::ptr& mapper = getMainWindow()->getMapperByMappingId(mappingId); +// const MappingGui::ptr& mapper = getMainWindow()->getMappingGuiByMappingId(mappingId); // painter->save(); // mapper->drawInput(painter); // painter->restore(); diff --git a/mapmap.pro b/mapmap.pro index 5ecff41..51912a5 100644 --- a/mapmap.pro +++ b/mapmap.pro @@ -12,7 +12,7 @@ HEADERS = \ MM.h \ MainApplication.h \ MainWindow.h \ - Mapper.h \ + MappingGui.h \ MapperGLCanvas.h \ Mapping.h \ MappingManager.h \ @@ -38,7 +38,7 @@ SOURCES = \ MM.cpp \ MainApplication.cpp \ MainWindow.cpp \ - Mapper.cpp \ + MappingGui.cpp \ MapperGLCanvas.cpp \ Mapping.cpp \ MappingManager.cpp \