Renamed Mapper to MappingGui (to correspond to Paint -> PaintGui).

This commit is contained in:
Tats
2015-12-11 00:43:47 -05:00
parent cf310dd45c
commit e76bdf1d9f
11 changed files with 82 additions and 82 deletions
+1 -1
View File
@@ -40,6 +40,6 @@ QSharedPointer<ShapeGraphicsItem> DestinationGLCanvas::getShapeGraphicsItemFromM
return QSharedPointer<ShapeGraphicsItem>();
else
{
return MainWindow::instance()->getMapperByMappingId(mappingId)->getGraphicsItem();
return MainWindow::instance()->getMappingGuiByMappingId(mappingId)->getGraphicsItem();
}
}
+1 -1
View File
@@ -24,7 +24,7 @@
#include "MapperGLCanvas.h"
#include "MappingManager.h"
#include "Mapper.h"
#include "MappingGui.h"
class DestinationGLCanvas: public MapperGLCanvas
{
+7 -7
View File
@@ -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
{
+2 -2
View File
@@ -369,7 +369,7 @@ private:
// View.
// The view counterpart of Mappings.
QMap<uid, Mapper::ptr> mappers;
QMap<uid, MappingGui::ptr> mappers;
QMap<uid, PaintGui::ptr> 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; }
+1 -1
View File
@@ -35,7 +35,7 @@
#include "UidAllocator.h"
#include "Shape.h"
#include "Mapper.h"
#include "MappingGui.h"
class MainWindow;
class ShapeGraphicsItem;
+32 -32
View File
@@ -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 <http://www.gnu.org/licenses/>.
*/
#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; i<shape->nVertices(); 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<QtProperty*> pointItems = shapeItem->subProperties();
for (int i=0; i<shape->nVertices(); 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<Color>(_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<int>* selectedVertices)
//void MeshColorMappingGui::drawControls(QPainter* painter, const QList<int>* selectedVertices)
//{
// QSharedPointer<Mesh> outputMesh = qSharedPointerCast<Mesh>(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<TextureMapping> mapping)
: Mapper(mapping),
TextureMappingGui::TextureMappingGui(QSharedPointer<TextureMapping> mapping)
: MappingGui(mapping),
_meshItem(NULL)
{
// Assign members pointers.
@@ -770,7 +770,7 @@ TextureMapper::TextureMapper(QSharedPointer<TextureMapping> 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<TextureMapping> mapping)
// _postDraw(painter);
//}
void TextureMapper::updateShape(MShape* shape)
void TextureMappingGui::updateShape(MShape* shape)
{
QSharedPointer<TextureMapping> textureMapping = qSharedPointerCast<TextureMapping>(_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<int>* selectedVertices)
//void PolygonTextureMappingGui::drawControls(QPainter* painter, const QList<int>* selectedVertices)
//{
// QSharedPointer<Polygon> outputPoly = qSharedPointerCast<Polygon>(outputShape);
// Util::drawControlsPolygon(painter, selectedVertices, *outputPoly);
//}
//
//void PolygonTextureMapper::drawInputControls(QPainter* painter, const QList<int>* selectedVertices)
//void PolygonTextureMappingGui::drawInputControls(QPainter* painter, const QList<int>* selectedVertices)
//{
// QSharedPointer<Polygon> inputPoly = qSharedPointerCast<Polygon>(inputShape);
// Util::drawControlsPolygon(painter, selectedVertices, *inputPoly);
//}
TriangleTextureMapper::TriangleTextureMapper(QSharedPointer<TextureMapping> mapping)
: PolygonTextureMapper(mapping)
TriangleTextureMappingGui::TriangleTextureMappingGui(QSharedPointer<TextureMapping> 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<TextureMapping> mapp
//// glEnd();
//}
MeshTextureMapper::MeshTextureMapper(QSharedPointer<TextureMapping> mapping)
: PolygonTextureMapper(mapping)
MeshTextureMappingGui::MeshTextureMappingGui(QSharedPointer<TextureMapping> mapping)
: PolygonTextureMappingGui(mapping)
{
_graphicsItem.reset(new MeshTextureGraphicsItem(_mapping, true));
_inputGraphicsItem.reset(new MeshTextureGraphicsItem(_mapping, false));
@@ -903,7 +903,7 @@ MeshTextureMapper::MeshTextureMapper(QSharedPointer<TextureMapping> 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<TextureMapping> mapping)
: PolygonTextureMapper(mapping)
EllipseTextureMappingGui::EllipseTextureMappingGui(QSharedPointer<TextureMapping> mapping)
: PolygonTextureMappingGui(mapping)
{
_graphicsItem.reset(new EllipseTextureGraphicsItem(_mapping, true));
_inputGraphicsItem.reset(new EllipseTextureGraphicsItem(_mapping, false));
+31 -31
View File
@@ -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 <QtGlobal>
@@ -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<Mapper> ptr;
typedef QSharedPointer<MappingGui> 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> 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<TextureMapping> mapping);
virtual ~TextureMapper() {}
TextureMappingGui(QSharedPointer<TextureMapping> mapping);
virtual ~TextureMappingGui() {}
public slots:
virtual void updateShape(MShape* shape);
@@ -416,31 +416,31 @@ protected:
QWeakPointer<MShape> inputShape;
};
class PolygonTextureMapper : public TextureMapper
class PolygonTextureMappingGui : public TextureMappingGui
{
Q_OBJECT
public:
PolygonTextureMapper(QSharedPointer<TextureMapping> mapping) : TextureMapper(mapping) {}
virtual ~PolygonTextureMapper() {}
PolygonTextureMappingGui(QSharedPointer<TextureMapping> mapping) : TextureMappingGui(mapping) {}
virtual ~PolygonTextureMappingGui() {}
};
class TriangleTextureMapper : public PolygonTextureMapper
class TriangleTextureMappingGui : public PolygonTextureMappingGui
{
Q_OBJECT
public:
TriangleTextureMapper(QSharedPointer<TextureMapping> mapping);
virtual ~TriangleTextureMapper() {}
TriangleTextureMappingGui(QSharedPointer<TextureMapping> mapping);
virtual ~TriangleTextureMappingGui() {}
};
class MeshTextureMapper : public PolygonTextureMapper
class MeshTextureMappingGui : public PolygonTextureMappingGui
{
Q_OBJECT
public:
MeshTextureMapper(QSharedPointer<TextureMapping> mapping);
virtual ~MeshTextureMapper() {}
MeshTextureMappingGui(QSharedPointer<TextureMapping> 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<TextureMapping> mapping);
virtual ~EllipseTextureMapper() {}
EllipseTextureMappingGui(QSharedPointer<TextureMapping> mapping);
virtual ~EllipseTextureMappingGui() {}
protected:
static void _setPointOfEllipseAtAngle(QPointF& point, const QPointF& center, float hRadius, float vRadius, float rotation, float circularAngle);
+2 -2
View File
@@ -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.
*/
+1 -1
View File
@@ -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
+2 -2
View File
@@ -48,7 +48,7 @@ QSharedPointer<ShapeGraphicsItem> SourceGLCanvas::getShapeGraphicsItemFromMappin
else
{
return MainWindow::instance()->getMapperByMappingId(mappingId)->getInputGraphicsItem();
return MainWindow::instance()->getMappingGuiByMappingId(mappingId)->getInputGraphicsItem();
}
}
@@ -59,7 +59,7 @@ QSharedPointer<ShapeGraphicsItem> 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();
+2 -2
View File
@@ -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 \