diff --git a/Commands.cpp b/Commands.cpp index b1e0146..c3867db 100644 --- a/Commands.cpp +++ b/Commands.cpp @@ -24,6 +24,8 @@ #include "Commands.h" +MM_BEGIN_NAMESPACE + AddShapesCommand::AddShapesCommand(MainWindow *mainWindow, uid mappingId, QUndoCommand *parent): QUndoCommand(parent), _mainWindow(mainWindow), @@ -186,3 +188,4 @@ void DeleteMappingCommand::redo() _mainWindow->deleteMapping(_mappingId); } +MM_END_NAMESPACE diff --git a/Commands.h b/Commands.h index 4d53faf..baae96d 100644 --- a/Commands.h +++ b/Commands.h @@ -23,6 +23,9 @@ #define COMMANDS_H_ #include +#include "MM.h" + +MM_BEGIN_NAMESPACE enum CommandId { CMD_KEY_MOVE_VERTEX, @@ -124,4 +127,6 @@ private: uid _mappingId; }; +MM_END_NAMESPACE + #endif /* COMMANDS_H_ */ diff --git a/ConcurrentQueue.h b/ConcurrentQueue.h index 4f5dfc7..56095e9 100644 --- a/ConcurrentQueue.h +++ b/ConcurrentQueue.h @@ -31,6 +31,9 @@ #include #include #include +#include "MM.h" + +MM_BEGIN_NAMESPACE template class ConcurrentQueue @@ -82,4 +85,6 @@ class ConcurrentQueue } }; +MM_END_NAMESPACE + #endif // _CONCURRENT_QUEUE_H_ diff --git a/ConsoleWindow.cpp b/ConsoleWindow.cpp index e53d256..bf601a3 100644 --- a/ConsoleWindow.cpp +++ b/ConsoleWindow.cpp @@ -20,6 +20,8 @@ #include "ConsoleWindow.h" #include +MM_BEGIN_NAMESPACE + ConsoleWindow* ConsoleWindow::instance = NULL; ConsoleWindow::ConsoleWindow(QWidget *parent) : QMainWindow(parent) @@ -137,5 +139,4 @@ ConsoleWindow::~ConsoleWindow() kill(); } - - +MM_END_NAMESPACE diff --git a/ConsoleWindow.h b/ConsoleWindow.h index 0ccfa7f..8c30666 100644 --- a/ConsoleWindow.h +++ b/ConsoleWindow.h @@ -22,11 +22,10 @@ #include #include -#include +#include "MM.h" #include -class QAction; -class QMenu; +MM_BEGIN_NAMESPACE class ConsoleWindow : public QMainWindow { @@ -74,4 +73,6 @@ private: static const int CONSOLE_WINDOW_DEFAULT_HEIGHT = 480; }; +MM_END_NAMESPACE + #endif // CONSOLE_H diff --git a/Element.cpp b/Element.cpp index 25c68b9..e380156 100644 --- a/Element.cpp +++ b/Element.cpp @@ -21,6 +21,8 @@ #include +MM_BEGIN_NAMESPACE + Element::Element(uid id, UidAllocator* allocator) : _name(""), _isLocked(false), _opacity(1.0f), _allocator(allocator) { if (id == NULL_UID) @@ -86,3 +88,4 @@ void Element::_emitPropertyChanged(const QString& propertyName) emit propertyChanged(getId(), propertyName, property(propertyName.toAscii())); } +MM_END_NAMESPACE diff --git a/Element.h b/Element.h index 3e9605a..7c37cd7 100644 --- a/Element.h +++ b/Element.h @@ -30,6 +30,8 @@ #include Q_DECLARE_METATYPE(uid) +MM_BEGIN_NAMESPACE + class Element : public Serializable { Q_OBJECT @@ -82,4 +84,6 @@ private: UidAllocator* _allocator; }; +MM_END_NAMESPACE + #endif /* MOBJECT_H_ */ diff --git a/Ellipse.cpp b/Ellipse.cpp index 5014aa7..35e5eee 100644 --- a/Ellipse.cpp +++ b/Ellipse.cpp @@ -19,6 +19,8 @@ #include "Ellipse.h" +MM_BEGIN_NAMESPACE + void Ellipse::sanitize() { // Get horizontal axis rotated 90 degrees CW @@ -147,6 +149,4 @@ void Ellipse::setVertex(int i, const QPointF& v) sanitize(); } - - - +MM_END_NAMESPACE diff --git a/Ellipse.h b/Ellipse.h index 23fbcb3..08ece09 100644 --- a/Ellipse.h +++ b/Ellipse.h @@ -23,6 +23,7 @@ #include "Shape.h" +MM_BEGIN_NAMESPACE class Ellipse : public MShape { @@ -143,4 +144,6 @@ protected: // } }; +MM_END_NAMESPACE + #endif /* ELLIPSE_H_ */ diff --git a/MM.cpp b/MM.cpp index 8462e57..9881fdd 100644 --- a/MM.cpp +++ b/MM.cpp @@ -19,6 +19,8 @@ #include "MM.h" +MM_BEGIN_NAMESPACE + const QString MM::APPLICATION_NAME = "MapMap"; const QString MM::VERSION = "0.3.2"; const QString MM::COPYRIGHT_OWNERS = "Sofian Audry, Alexandre Quessy, Dame Diongue, Mike Latona, Vasilis Liaskovitis"; @@ -58,3 +60,4 @@ const qreal MM::ZOOM_FACTOR = 1.4f; const qreal MM::ZOOM_MIN = 0.1f; const qreal MM::ZOOM_MAX = 5.0f; +MM_END_NAMESPACE diff --git a/MM.h b/MM.h index 6d768da..0579b4d 100644 --- a/MM.h +++ b/MM.h @@ -25,6 +25,19 @@ #include #include +#ifndef MM_NAMESPACE +#define MM_NAMESPACE mmp +#endif +#define MM_PREPEND_NAMESPACE(name) MM_NAMESPACE::name +#define MM_USE_NAMESPACE using namespace MM_NAMESPACE; +#define MM_BEGIN_NAMESPACE namespace MM_NAMESPACE { +#define MM_END_NAMESPACE } +#define MM_FORWARD_DECLARE_CLASS(name) \ + MM_BEGIN_NAMESPACE class name; MM_END_NAMESPACE \ + using MM_PREPEND_NAMESPACE(name); + +MM_BEGIN_NAMESPACE + /** * This class is a placeholder for predefined static variables that can be used * accross the software. @@ -97,6 +110,8 @@ public: }; }; +MM_END_NAMESPACE + #endif diff --git a/MainApplication.cpp b/MainApplication.cpp index ed17f8c..4da3e29 100644 --- a/MainApplication.cpp +++ b/MainApplication.cpp @@ -20,6 +20,8 @@ #include "MainApplication.h" +MM_BEGIN_NAMESPACE + MainApplication::MainApplication(int &argc, char *argv[]) : QApplication(argc, argv) { @@ -53,3 +55,5 @@ bool MainApplication::notify(QObject *receiver, QEvent *event) return false; } + +MM_END_NAMESPACE diff --git a/MainApplication.h b/MainApplication.h index 0b42138..52d5645 100644 --- a/MainApplication.h +++ b/MainApplication.h @@ -27,6 +27,8 @@ #include "MM.h" #include "PreferencesDialog.h" +MM_BEGIN_NAMESPACE + class MainApplication : public QApplication { public: @@ -36,4 +38,6 @@ public: bool notify(QObject *receiver, QEvent *event); }; +MM_END_NAMESPACE + #endif /* MAINAPPLICATION_H_ */ diff --git a/MainWindow.cpp b/MainWindow.cpp index 85cc981..2223f92 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -25,6 +25,8 @@ #include #include +MM_BEGIN_NAMESPACE + MainWindow::MainWindow() { // Create model. @@ -3219,3 +3221,5 @@ void MainWindow::quitMapMap() { close(); } + +MM_END_NAMESPACE diff --git a/MainWindow.h b/MainWindow.h index fec4b4d..3236c6a 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -53,6 +53,8 @@ #include "PaintGui.h" +MM_BEGIN_NAMESPACE + /** * This is the main window of MapMap. It acts as both a view and a controller interface. */ @@ -513,4 +515,6 @@ public: static const int OUTPUT_WINDOW_MINIMUM_HEIGHT = 270; }; +MM_END_NAMESPACE + #endif /* MAIN_WINDOW_H_ */ diff --git a/MapperGLCanvas.cpp b/MapperGLCanvas.cpp index db57a40..aa231cc 100644 --- a/MapperGLCanvas.cpp +++ b/MapperGLCanvas.cpp @@ -24,6 +24,8 @@ #include "MainWindow.h" #include "Commands.h" +MM_BEGIN_NAMESPACE + MapperGLCanvas::MapperGLCanvas(MainWindow* mainWindow, bool isOutput, QWidget* parent, const QGLWidget * shareWidget, QGraphicsScene* scene) : QGraphicsView(parent), _mainWindow(mainWindow), @@ -621,3 +623,5 @@ void MapperGLCanvas::_glueVertex(QPointF* p) } } } + +MM_END_NAMESPACE diff --git a/MapperGLCanvas.h b/MapperGLCanvas.h index 632f676..ba38857 100644 --- a/MapperGLCanvas.h +++ b/MapperGLCanvas.h @@ -37,6 +37,8 @@ #include "MappingGui.h" +MM_BEGIN_NAMESPACE + class MainWindow; class ShapeGraphicsItem; @@ -199,4 +201,6 @@ public: static const int NO_VERTEX = -1; }; +MM_END_NAMESPACE + #endif /* MAPPERGLCANVAS_H_ */ diff --git a/MapperGLCanvasToolbar.cpp b/MapperGLCanvasToolbar.cpp index 60bd9a9..11f3271 100644 --- a/MapperGLCanvasToolbar.cpp +++ b/MapperGLCanvasToolbar.cpp @@ -19,6 +19,8 @@ #include "MapperGLCanvasToolbar.h" +MM_BEGIN_NAMESPACE + MapperGLCanvasToolbar::MapperGLCanvasToolbar(MapperGLCanvas* canvas, QWidget* parent) : QWidget(parent), _canvas(canvas) @@ -31,8 +33,6 @@ MapperGLCanvasToolbar::MapperGLCanvasToolbar(MapperGLCanvas* canvas, QWidget* pa // Disable zoom tool buttons enableZoomToolBar(false); - - } MapperGLCanvasToolbar::~MapperGLCanvasToolbar() { @@ -146,3 +146,4 @@ void MapperGLCanvasToolbar::updateDropdownMenu() _dropdownMenu->setCurrentText(zoomFactor); } +MM_END_NAMESPACE diff --git a/MapperGLCanvasToolbar.h b/MapperGLCanvasToolbar.h index 76f5102..61ba160 100644 --- a/MapperGLCanvasToolbar.h +++ b/MapperGLCanvasToolbar.h @@ -23,6 +23,8 @@ #include "MM.h" #include "MapperGLCanvas.h" +MM_BEGIN_NAMESPACE + class MapperGLCanvasToolbar : public QWidget { Q_OBJECT public: @@ -53,4 +55,6 @@ protected: }; +MM_END_NAMESPACE + #endif /* MAPPERGLCANVASTOOLBAR_H_ */ diff --git a/Mapping.cpp b/Mapping.cpp index e3c3fe9..a58ec83 100644 --- a/Mapping.cpp +++ b/Mapping.cpp @@ -21,6 +21,8 @@ #include "Mapping.h" #include "MainWindow.h" +MM_BEGIN_NAMESPACE + UidAllocator Mapping::allocator; Mapping::Mapping(uid id) @@ -164,3 +166,5 @@ void Mapping::_writeShape(QDomElement& obj, bool isOutput) shape->write(shapeObj); obj.appendChild(shapeObj); } + +MM_END_NAMESPACE diff --git a/Mapping.h b/Mapping.h index 6cc9256..b8978d4 100644 --- a/Mapping.h +++ b/Mapping.h @@ -32,6 +32,8 @@ #include "MetaObjectRegistry.h" +MM_BEGIN_NAMESPACE + // TODO: replace by ProjectAttribute //#include "ProjectWriter.h" @@ -198,4 +200,6 @@ public: } }; +MM_END_NAMESPACE + #endif /* MAPPING_H_ */ diff --git a/MappingGui.cpp b/MappingGui.cpp index eeeb214..06a3e34 100644 --- a/MappingGui.cpp +++ b/MappingGui.cpp @@ -20,6 +20,8 @@ #include "MappingGui.h" +MM_BEGIN_NAMESPACE + MappingGui::MappingGui(Mapping::ptr mapping) : _mapping(mapping), _graphicsItem(NULL), @@ -391,3 +393,4 @@ EllipseTextureMappingGui::EllipseTextureMappingGui(QSharedPointer mappingList; }; +MM_END_NAMESPACE + #endif // MAPPINGLISTMODEL_H diff --git a/MappingManager.cpp b/MappingManager.cpp index bed9b30..7503bb6 100644 --- a/MappingManager.cpp +++ b/MappingManager.cpp @@ -21,6 +21,8 @@ #include "MappingManager.h" #include +MM_BEGIN_NAMESPACE + MappingManager::MappingManager() { // TODO Auto-generated constructor stub @@ -202,3 +204,5 @@ void MappingManager::clearAll() paintMap.clear(); mappingMap.clear(); } + +MM_END_NAMESPACE diff --git a/MappingManager.h b/MappingManager.h index f81158f..411de45 100644 --- a/MappingManager.h +++ b/MappingManager.h @@ -27,6 +27,8 @@ #include "Paint.h" #include "Mapping.h" +MM_BEGIN_NAMESPACE + /** * This is a container class for all the paints and mappings ie. the main model object that allows * CRUD over paints and mappings. @@ -109,4 +111,6 @@ public: void clearAll(); }; +MM_END_NAMESPACE + #endif /* MAPPINGMANAGER_H_ */ diff --git a/Maths.h b/Maths.h index 0d28f6e..bbc6e77 100644 --- a/Maths.h +++ b/Maths.h @@ -22,9 +22,11 @@ #ifndef MATH_H_ #define MATH_H_ -#include +#include "MM.h" #include +MM_BEGIN_NAMESPACE + /// Converts from degrees to radians. inline qreal degreesToRadians(qreal degrees) { return degrees / 180.0f * M_PI; } @@ -60,4 +62,6 @@ inline bool xOr(bool a, bool b) { return (a && !b) || (!a && b); } +MM_END_NAMESPACE + #endif /* MATH_H_ */ diff --git a/Mesh.cpp b/Mesh.cpp index 990c980..47c78e2 100644 --- a/Mesh.cpp +++ b/Mesh.cpp @@ -19,6 +19,8 @@ #include "Mesh.h" +MM_BEGIN_NAMESPACE + Mesh::Mesh() : Quad() { // Create dummy points (will be all overwritten later on by load/save). QVector points(4); @@ -467,3 +469,4 @@ void Mesh::_reorderVertices() vertices = newVertices; } +MM_END_NAMESPACE diff --git a/Mesh.h b/Mesh.h index 9ef841e..65529fd 100644 --- a/Mesh.h +++ b/Mesh.h @@ -23,6 +23,8 @@ #include "Quad.h" +MM_BEGIN_NAMESPACE + class Mesh : public Quad { Q_OBJECT @@ -121,6 +123,6 @@ protected: virtual MShape* _create() const { return new Mesh(); } }; - +MM_END_NAMESPACE #endif /* MESH_H_ */ diff --git a/MetaObjectRegistry.cpp b/MetaObjectRegistry.cpp index 01f7b0e..3aebb63 100644 --- a/MetaObjectRegistry.cpp +++ b/MetaObjectRegistry.cpp @@ -19,6 +19,8 @@ #include "MetaObjectRegistry.h" +MM_BEGIN_NAMESPACE + MetaObjectRegistry& MetaObjectRegistry::instance() { static MetaObjectRegistry inst; @@ -30,3 +32,5 @@ const QMetaObject* MetaObjectRegistry::getMetaObject(QString className) const QMap::const_iterator it = metaObjectLookup.find(className); return (it == metaObjectLookup.constEnd() ? 0 : *it); } + +MM_END_NAMESPACE diff --git a/MetaObjectRegistry.h b/MetaObjectRegistry.h index 47d6c8c..1be2a9d 100644 --- a/MetaObjectRegistry.h +++ b/MetaObjectRegistry.h @@ -23,6 +23,9 @@ #include #include #include +#include "MM.h" + +MM_BEGIN_NAMESPACE class MetaObjectRegistry { private: @@ -50,4 +53,6 @@ public: }; +MM_END_NAMESPACE + #endif /* METAOBJECTREGISTRY_H_ */ diff --git a/OscInterface.cpp b/OscInterface.cpp index 13ff9b1..c23c69f 100644 --- a/OscInterface.cpp +++ b/OscInterface.cpp @@ -25,6 +25,8 @@ #include "MainWindow.h" #include +MM_BEGIN_NAMESPACE + const QString OscInterface::OSC_ROOT("mapmap"); const QString OscInterface::OSC_PAINT("paint"); const QString OscInterface::OSC_MAPPING("mapping"); @@ -231,5 +233,6 @@ bool OscInterface::setElementProperty(const QSharedPointer& elem, const return elem->setProperty(property.toUtf8().data(), value); } +MM_END_NAMESPACE #endif // HAVE_OSC diff --git a/OscInterface.h b/OscInterface.h index 61415aa..48698c6 100644 --- a/OscInterface.h +++ b/OscInterface.h @@ -32,6 +32,8 @@ #include "ConcurrentQueue.h" #include "OscReceiver.h" +MM_BEGIN_NAMESPACE + class MainWindow; class Element; @@ -93,5 +95,8 @@ private: bool setElementProperty(const QSharedPointer& elem, const QString& property, const QVariant& value); }; +MM_END_NAMESPACE + #endif // HAVE_OSC + #endif /* include guard */ diff --git a/OscReceiver.cpp b/OscReceiver.cpp index 603ab72..b845325 100644 --- a/OscReceiver.cpp +++ b/OscReceiver.cpp @@ -3,6 +3,8 @@ #include #include +MM_BEGIN_NAMESPACE + bool OscReceiver::server_is_ok_ = true; OscReceiver::OscReceiver(const std::string &port) : port_(port), server_(0) { @@ -74,4 +76,6 @@ std::string OscReceiver::toString() const { return "port:" + port_; } +MM_END_NAMESPACE + #endif // HAVE_OSC diff --git a/OscReceiver.h b/OscReceiver.h index e0ed60c..d8342e4 100644 --- a/OscReceiver.h +++ b/OscReceiver.h @@ -4,8 +4,11 @@ #include "lo/lo.h" #include +#include "MM.h" #define CONFIG_DEBUG +MM_BEGIN_NAMESPACE + /** * General-purpose wrapper around liblo to receive OSC messages. */ @@ -38,5 +41,8 @@ private: static void error(int num, const char *msg, const char *path); }; +MM_END_NAMESPACE + #endif // HAVE_OSC + #endif // _OSC_RECEIVER_H_ diff --git a/OutputGLCanvas.cpp b/OutputGLCanvas.cpp index ad803a8..86dc8be 100644 --- a/OutputGLCanvas.cpp +++ b/OutputGLCanvas.cpp @@ -21,6 +21,8 @@ #include "OutputGLCanvas.h" #include "MainWindow.h" +MM_BEGIN_NAMESPACE + OutputGLCanvas::OutputGLCanvas(MainWindow* mainWindow, QWidget* parent, const QGLWidget* shareWidget, QGraphicsScene* scene) : MapperGLCanvas(mainWindow, true, parent, shareWidget, scene), _displayCrosshair(false), @@ -130,3 +132,5 @@ void OutputGLCanvas::mouseMoveEvent(QMouseEvent *event) MapperGLCanvas::mouseMoveEvent(event); } } + +MM_END_NAMESPACE diff --git a/OutputGLCanvas.h b/OutputGLCanvas.h index e121c55..a2fde93 100644 --- a/OutputGLCanvas.h +++ b/OutputGLCanvas.h @@ -23,6 +23,8 @@ #include "MapperGLCanvas.h" +MM_BEGIN_NAMESPACE + class OutputGLCanvas: public MapperGLCanvas { Q_OBJECT @@ -53,4 +55,6 @@ protected: void mouseMoveEvent(QMouseEvent *event); }; +MM_END_NAMESPACE + #endif /* OutputGLCanvas_H_ */ diff --git a/OutputGLWindow.cpp b/OutputGLWindow.cpp index 3bd6cb0..c99eeb8 100644 --- a/OutputGLWindow.cpp +++ b/OutputGLWindow.cpp @@ -23,6 +23,8 @@ #include "MainWindow.h" +MM_BEGIN_NAMESPACE + OutputGLWindow:: OutputGLWindow(QWidget* parent, const MapperGLCanvas* canvas_) : QDialog(parent) { resize(MainWindow::OUTPUT_WINDOW_MINIMUM_WIDTH, MainWindow::OUTPUT_WINDOW_MINIMUM_HEIGHT); @@ -127,3 +129,5 @@ void OutputGLWindow::setFullScreen(bool fullscreen) } } } + +MM_END_NAMESPACE diff --git a/OutputGLWindow.h b/OutputGLWindow.h index 4290c96..2d6c3e6 100644 --- a/OutputGLWindow.h +++ b/OutputGLWindow.h @@ -26,6 +26,8 @@ #include #include "OutputGLCanvas.h" +MM_BEGIN_NAMESPACE + // TODO: add SLOT for mySetVisible // TODO: Maybe improve support for Ubuntu: http://stackoverflow.com/questions/12645880/fullscreen-for-qdialog-from-within-mainwindow-only-working-sometimes @@ -62,4 +64,6 @@ private: bool _pointerIsVisible; }; +MM_END_NAMESPACE + #endif /* OutputGLWINDOW_H_ */ diff --git a/Paint.cpp b/Paint.cpp index 4611b57..b4e6f52 100644 --- a/Paint.cpp +++ b/Paint.cpp @@ -22,6 +22,8 @@ #include "VideoImpl.h" #include +MM_BEGIN_NAMESPACE + UidAllocator Paint::allocator; void Texture::read(const QDomElement& obj) @@ -254,3 +256,5 @@ bool Video::_generateThumbnail() return true; } + +MM_END_NAMESPACE diff --git a/Paint.h b/Paint.h index 5fd0ed9..9dfaabc 100644 --- a/Paint.h +++ b/Paint.h @@ -37,6 +37,8 @@ #include "Element.h" +MM_BEGIN_NAMESPACE + /** * A Paint is a style that can be applied when drawing potentially any shape. * @@ -313,4 +315,6 @@ protected: VideoImpl *_impl; }; +MM_END_NAMESPACE + #endif /* PAINT_H_ */ diff --git a/PaintGui.cpp b/PaintGui.cpp index 7d4e5b7..3b82eee 100644 --- a/PaintGui.cpp +++ b/PaintGui.cpp @@ -19,6 +19,8 @@ #include +MM_BEGIN_NAMESPACE + PaintGui::PaintGui(Paint::ptr paint) : _paint(paint) { @@ -217,3 +219,5 @@ void VideoGui::setValue(QString propertyName, QVariant value) else TextureGui::setValue(propertyName, value); } + +MM_END_NAMESPACE diff --git a/PaintGui.h b/PaintGui.h index 873e9d8..41dbb43 100644 --- a/PaintGui.h +++ b/PaintGui.h @@ -42,6 +42,8 @@ #include "variantmanager.h" #include "variantfactory.h" +MM_BEGIN_NAMESPACE + /** * The view components corresponding to a Paint (which is the model) in the interface. * Mainly manages the property browser for the Paint. @@ -139,4 +141,6 @@ protected: // QtVariantProperty* _mediaReverseItem; }; +MM_END_NAMESPACE + #endif /* PAINTGUI_H_ */ diff --git a/Polygon.cpp b/Polygon.cpp index 6b4882e..0c12d55 100644 --- a/Polygon.cpp +++ b/Polygon.cpp @@ -19,6 +19,8 @@ #include "Polygon.h" +MM_BEGIN_NAMESPACE + void Polygon::setVertex(int i, const QPointF& v) { // Constrain vertex. @@ -104,5 +106,4 @@ QPolygonF Polygon::toPolygon() const return polygon; } - - +MM_END_NAMESPACE diff --git a/Polygon.h b/Polygon.h index 0a2bc5c..e8e14f6 100644 --- a/Polygon.h +++ b/Polygon.h @@ -21,6 +21,8 @@ #include "Shape.h" +MM_BEGIN_NAMESPACE + /** * This class represents a simple polygon (ie. the control points are vertices). */ @@ -52,5 +54,6 @@ protected: static void _constrainVertex(const QPolygonF& polygon, int i, QPointF& v); }; +MM_END_NAMESPACE #endif /* POLYGON_H_ */ diff --git a/PreferencesDialog.cpp b/PreferencesDialog.cpp index 1c6d566..e7289c3 100644 --- a/PreferencesDialog.cpp +++ b/PreferencesDialog.cpp @@ -22,6 +22,8 @@ #include "MainWindow.h" #include +MM_BEGIN_NAMESPACE + PreferencesDialog::PreferencesDialog(MainWindow* mainWindow, QWidget* parent) : QDialog(parent) { @@ -85,3 +87,5 @@ void PreferencesDialog::accept_cb() this->close(); } + +MM_END_NAMESPACE diff --git a/PreferencesDialog.h b/PreferencesDialog.h index 2b34566..62867ac 100644 --- a/PreferencesDialog.h +++ b/PreferencesDialog.h @@ -22,11 +22,13 @@ #define PREFERENCESDIALOG_H_ #include -#include +#include "MM.h" #include #include #include +MM_BEGIN_NAMESPACE + class MainWindow; class PreferencesDialog : public QDialog @@ -53,4 +55,6 @@ private: void resetValues(); }; +MM_END_NAMESPACE + #endif /* PREFERENCESDIALOG_H_ */ diff --git a/ProjectLabels.cpp b/ProjectLabels.cpp index 36f798b..8f52035 100644 --- a/ProjectLabels.cpp +++ b/ProjectLabels.cpp @@ -19,6 +19,8 @@ #include "ProjectLabels.h" +MM_BEGIN_NAMESPACE + const char* ProjectLabels::CLASS_NAME = "className"; const char* ProjectLabels::PAINTS = "paints"; const char* ProjectLabels::MAPPINGS = "mappings"; @@ -28,4 +30,4 @@ const char* ProjectLabels::NAME = "name"; const char* ProjectLabels::SOURCE = "source"; const char* ProjectLabels::DESTINATION = "destination"; - +MM_END_NAMESPACE \ No newline at end of file diff --git a/ProjectLabels.h b/ProjectLabels.h index 2b92212..8b0dcba 100644 --- a/ProjectLabels.h +++ b/ProjectLabels.h @@ -20,6 +20,10 @@ #ifndef PROJECTLABELS_H_ #define PROJECTLABELS_H_ +#include "MM.h" + +MM_BEGIN_NAMESPACE + class ProjectLabels { public: static const char* CLASS_NAME; @@ -34,4 +38,6 @@ public: static const char* SOURCE; }; +MM_END_NAMESPACE + #endif /* PROJECTLABELS_H_ */ diff --git a/ProjectReader.cpp b/ProjectReader.cpp index 06315a6..8c20180 100644 --- a/ProjectReader.cpp +++ b/ProjectReader.cpp @@ -22,6 +22,8 @@ #include #include +MM_BEGIN_NAMESPACE + ProjectReader::ProjectReader(MainWindow *window) : _window(window) { } @@ -169,4 +171,4 @@ Mapping::ptr ProjectReader::parseMapping(const QDomElement& mappingElem) } } - +MM_END_NAMESPACE diff --git a/ProjectReader.h b/ProjectReader.h index d848818..35495a3 100644 --- a/ProjectReader.h +++ b/ProjectReader.h @@ -27,6 +27,8 @@ #include "MetaObjectRegistry.h" #include "ProjectLabels.h" +MM_BEGIN_NAMESPACE + class ProjectReader { public: @@ -43,3 +45,5 @@ private: QXmlStreamReader _xml; MainWindow *_window; }; + +MM_END_NAMESPACE diff --git a/ProjectWriter.cpp b/ProjectWriter.cpp index f82bc5b..1988f77 100644 --- a/ProjectWriter.cpp +++ b/ProjectWriter.cpp @@ -20,6 +20,8 @@ #include "ProjectWriter.h" #include +MM_BEGIN_NAMESPACE + ProjectWriter::ProjectWriter(MainWindow *window) : _window(window) { @@ -62,3 +64,5 @@ bool ProjectWriter::writeFile(QIODevice *device) return true; } + +MM_END_NAMESPACE \ No newline at end of file diff --git a/ProjectWriter.h b/ProjectWriter.h index fc80a6f..2938c3e 100644 --- a/ProjectWriter.h +++ b/ProjectWriter.h @@ -30,6 +30,8 @@ #include "Shapes.h" +MM_BEGIN_NAMESPACE + class ProjectWriter { public: @@ -41,4 +43,5 @@ public: MainWindow *_window; }; +MM_END_NAMESPACE #endif diff --git a/Quad.h b/Quad.h index d983013..06e64e3 100644 --- a/Quad.h +++ b/Quad.h @@ -23,6 +23,8 @@ #include "Polygon.h" +MM_BEGIN_NAMESPACE + /** * Four-vertex shape. */ @@ -51,4 +53,6 @@ protected: }; +MM_END_NAMESPACE + #endif /* QUAD_H_ */ diff --git a/Serializable.cpp b/Serializable.cpp index 325daf9..e6e139c 100644 --- a/Serializable.cpp +++ b/Serializable.cpp @@ -19,6 +19,8 @@ #include "Serializable.h" +MM_BEGIN_NAMESPACE + void Serializable::read(const QDomElement& obj) { QList attributeNames = _propertiesAttributes(); @@ -126,3 +128,5 @@ void Serializable::_writeNode(QDomElement& obj, const QString& nodeName, const Q } + +MM_END_NAMESPACE diff --git a/Serializable.h b/Serializable.h index 7cadb59..351d5d5 100644 --- a/Serializable.h +++ b/Serializable.h @@ -27,6 +27,8 @@ #include "ProjectLabels.h" +MM_BEGIN_NAMESPACE + class Serializable : public QObject { Q_OBJECT @@ -49,4 +51,6 @@ protected: void _writeNode(QDomElement& obj, const QString& nodeName, const QString& nodeValue); }; +MM_END_NAMESPACE + #endif /* SERIALIZABLE_H_ */ diff --git a/Shape.cpp b/Shape.cpp index 23d3647..08a302a 100644 --- a/Shape.cpp +++ b/Shape.cpp @@ -19,6 +19,8 @@ #include "Shape.h" +MM_BEGIN_NAMESPACE + MShape::MShape(const QVector& vertices_) : _isLocked(false) { setVertices(vertices_); build(); @@ -87,3 +89,4 @@ void MShape::write(QDomElement& obj) obj.appendChild(verticesObj); } +MM_END_NAMESPACE diff --git a/Shape.h b/Shape.h index ece450e..5583f37 100644 --- a/Shape.h +++ b/Shape.h @@ -40,6 +40,8 @@ #include "Maths.h" #include "Serializable.h" +MM_BEGIN_NAMESPACE + /** * Shape represented by a series of control points. */ @@ -135,4 +137,6 @@ protected: }; +MM_END_NAMESPACE + #endif /* SHAPE_H_ */ diff --git a/ShapeControlPainter.cpp b/ShapeControlPainter.cpp index 6c50f41..fb4a6c1 100644 --- a/ShapeControlPainter.cpp +++ b/ShapeControlPainter.cpp @@ -20,6 +20,8 @@ #include "ShapeControlPainter.h" +MM_BEGIN_NAMESPACE + ShapeControlPainter::ShapeControlPainter(ShapeGraphicsItem* shapeItem) : _shapeItem(shapeItem) @@ -100,3 +102,4 @@ void MeshControlPainter::_paintShape(QPainter *painter, MapperGLCanvas* canvas) painter->drawPolygon(_shapeItem->mapFromScene(mesh->toPolygon())); } +MM_END_NAMESPACE diff --git a/ShapeControlPainter.h b/ShapeControlPainter.h index 577d06c..5dfd438 100644 --- a/ShapeControlPainter.h +++ b/ShapeControlPainter.h @@ -27,6 +27,8 @@ #include "MapperGLCanvas.h" #include "ShapeGraphicsItem.h" +MM_BEGIN_NAMESPACE + class ShapeGraphicsItem; class MapperGLCanvas; @@ -87,4 +89,6 @@ protected: virtual void _paintShape(QPainter *painter, MapperGLCanvas* canvas); }; +MM_END_NAMESPACE + #endif diff --git a/ShapeGraphicsItem.cpp b/ShapeGraphicsItem.cpp index 678ffd0..6736f2a 100644 --- a/ShapeGraphicsItem.cpp +++ b/ShapeGraphicsItem.cpp @@ -22,6 +22,8 @@ #include "MainWindow.h" +MM_BEGIN_NAMESPACE + ShapeGraphicsItem::ShapeGraphicsItem(Mapping::ptr mapping, bool output) : _mapping(mapping), _output(output) { @@ -597,3 +599,4 @@ void EllipseTextureGraphicsItem::_doDrawOutput(QPainter* painter) } } +MM_END_NAMESPACE diff --git a/ShapeGraphicsItem.h b/ShapeGraphicsItem.h index 4c0ce53..2592c1f 100644 --- a/ShapeGraphicsItem.h +++ b/ShapeGraphicsItem.h @@ -37,6 +37,8 @@ #include "Mapping.h" #include "MapperGLCanvas.h" +MM_BEGIN_NAMESPACE + class MapperGLCanvas; class ShapeControlPainter; @@ -272,4 +274,6 @@ public: static void _setPointOfEllipseAtAngle(QPointF& point, const QPointF& center, float hRadius, float vRadius, float rotation, float circularAngle); }; +MM_END_NAMESPACE + #endif diff --git a/Triangle.h b/Triangle.h index e010d4f..05f67f0 100644 --- a/Triangle.h +++ b/Triangle.h @@ -23,6 +23,8 @@ #include "Polygon.h" +MM_BEGIN_NAMESPACE + /** * Triangle shape. */ @@ -47,4 +49,6 @@ protected: }; +MM_END_NAMESPACE + #endif /* TRIANGLE_H_ */ diff --git a/UidAllocator.cpp b/UidAllocator.cpp index 55a7cc4..22f01a3 100644 --- a/UidAllocator.cpp +++ b/UidAllocator.cpp @@ -23,6 +23,8 @@ #include #include +MM_BEGIN_NAMESPACE + uid UidAllocator::allocate() { // Iterate until we find an id that has not been taken. @@ -65,4 +67,4 @@ bool UidAllocator::exists(uid id) const return ( std::find(_ids.begin(), _ids.end(), id) != _ids.end() ); } - +MM_END_NAMESPACE diff --git a/UidAllocator.h b/UidAllocator.h index d8f59d5..d52691a 100644 --- a/UidAllocator.h +++ b/UidAllocator.h @@ -28,6 +28,7 @@ #include #include +#include "MM.h" /// A UID in Libremapping is represented as a integer. typedef int uid; @@ -35,6 +36,8 @@ typedef int uid; /// Represents a UID that does not refer to any entity. #define NULL_UID (0) +MM_BEGIN_NAMESPACE + /** * Allocates uids for instances by appending an incremental number to a given string. * Manages a pool of unique names. @@ -52,4 +55,6 @@ private: std::vector _ids; }; +MM_END_NAMESPACE + #endif // ifndef diff --git a/Util.cpp b/Util.cpp index a0e25d3..5e717dd 100644 --- a/Util.cpp +++ b/Util.cpp @@ -26,6 +26,8 @@ #include #include +MM_BEGIN_NAMESPACE + namespace Util { void correctGlTexCoord(GLfloat x, GLfloat y) @@ -217,3 +219,4 @@ bool isNumeric(const QString& text) } // end of namespace +MM_END_NAMESPACE diff --git a/Util.h b/Util.h index 1d87e58..9db84a7 100644 --- a/Util.h +++ b/Util.h @@ -32,6 +32,8 @@ #include "Paint.h" #include +MM_BEGIN_NAMESPACE + /** * @namespace Util Useful functions. */ @@ -71,4 +73,6 @@ bool isNumeric(const QString& text); } // end of namespace +MM_END_NAMESPACE + #endif /* UTIL_H_ */ diff --git a/VideoImpl.cpp b/VideoImpl.cpp index d70095b..39381db 100644 --- a/VideoImpl.cpp +++ b/VideoImpl.cpp @@ -25,6 +25,8 @@ #include #include +MM_BEGIN_NAMESPACE + // #define VIDEO_IMPL_VERBOSE // -------- private implementation of VideoImpl ------- @@ -1046,4 +1048,4 @@ bool VideoImpl::waitForNextBits(int timeout, const uchar** bits) return false; } - +MM_END_NAMESPACE diff --git a/VideoImpl.h b/VideoImpl.h index b30ed3d..664eb9f 100644 --- a/VideoImpl.h +++ b/VideoImpl.h @@ -31,7 +31,7 @@ #include // Other includes. -#include +#include "MM.h" #include #include #include @@ -43,6 +43,8 @@ #include #endif +MM_BEGIN_NAMESPACE + /** * Private declaration of the video player. * This is to prevent the GStreamer header to be included in the whole project. @@ -276,4 +278,6 @@ private: static const int MAX_SAMPLES_IN_BUFFER_QUEUES = 30; }; +MM_END_NAMESPACE + #endif /* ifndef */ diff --git a/main.cpp b/main.cpp index 9a58424..ce222e0 100644 --- a/main.cpp +++ b/main.cpp @@ -18,6 +18,8 @@ #include #include +MM_USE_NAMESPACE + static void set_env_vars_if_needed() { #ifdef __MACOSX_CORE__