Sat, 22 Aug 2015 15:58:50 +0300
More sharedpointer removal
--- a/.hgignore Sat Aug 22 15:37:02 2015 +0300 +++ b/.hgignore Sat Aug 22 15:58:50 2015 +0300 @@ -1,19 +1,14 @@ syntax:glob build -build_shared -build_debug -build_release +debug +release *.kdev4 -Makefile -Makefile.* -ldforge -ldforge_debug *.dat -debug_lastOutput -debug_lastInput .kdev_include_paths *.cfg .kdev4 -.*~ +*~ +*.bak +*.rej *.orig CMakeLists.txt.user
--- a/src/actions.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/actions.cc Sat Aug 22 15:58:50 2015 +0300 @@ -130,7 +130,7 @@ // void MainWindow::slot_actionSaveAll() { - for (LDDocumentPtr file : LDDocument::explicitDocuments()) + for (LDDocument* file : LDDocument::explicitDocuments()) save (file, false); } @@ -621,7 +621,7 @@ // these is an immense pain. void MainWindow::slot_actiontestpic() { - LDDocumentPtr file = getFile ("axle.dat"); + LDDocument* file = getFile ("axle.dat"); setlocale (LC_ALL, "C"); if (not file) @@ -725,7 +725,7 @@ QString subtitle; // Comment containing the title of the parent document - LDCommentPtr titleobj = dynamic_cast<LDComment*> (CurrentDocument()->getObject (0)); + LDComment* titleobj = dynamic_cast<LDComment*> (CurrentDocument()->getObject (0)); // License text for the subfile QString license (PreferredLicenseText()); @@ -803,7 +803,7 @@ // Determine the BFC winding type used in the main document - it is to // be carried over to the subfile. - LDIterate<LDBFC> (CurrentDocument()->objects(), [&] (LDBFCPtr const& bfc) + LDIterate<LDBFC> (CurrentDocument()->objects(), [&] (LDBFC* const& bfc) { if (Eq (bfc->statement(), BFCStatement::CertifyCCW, BFCStatement::CertifyCW, BFCStatement::NoCertify)) @@ -818,7 +818,7 @@ code << obj->asText(); // Create the new subfile document - LDDocumentPtr doc = LDDocument::createNew(); + LDDocument* doc = LDDocument::createNew(); doc->setImplicit (false); doc->setFullPath (fullsubname); doc->setName (LDDocument::shortenName (fullsubname)); @@ -854,7 +854,7 @@ obj->destroy(); // Add a reference to the new subfile to where the selection was - LDSubfilePtr ref (LDSpawn<LDSubfile>()); + LDSubfile* ref (LDSpawn<LDSubfile>()); ref->setColor (MainColor()); ref->setFileInfo (doc); ref->setPosition (Origin); @@ -887,7 +887,7 @@ { for (LDObject* obj : Selection()) { - LDSubfilePtr ref = dynamic_cast<LDSubfile*> (obj); + LDSubfile* ref = dynamic_cast<LDSubfile*> (obj); if (ref == null or not ref->fileInfo()->isImplicit()) continue;
--- a/src/actionsEdit.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/actionsEdit.cc Sat Aug 22 15:58:50 2015 +0300 @@ -122,7 +122,7 @@ { LDObjectList sel = Selection(); - LDIterate<LDSubfile> (Selection(), [&](LDSubfilePtr const& ref) + LDIterate<LDSubfile> (Selection(), [&](LDSubfile* const& ref) { // Get the index of the subfile so we know where to insert the // inlined contents. @@ -164,7 +164,7 @@ { int num = 0; - LDIterate<LDQuad> (Selection(), [&](LDQuadPtr const& quad) + LDIterate<LDQuad> (Selection(), [&](LDQuad* const& quad) { // Find the index of this quad long index = quad->lineNumber(); @@ -172,7 +172,7 @@ if (index == -1) return; - QList<LDTrianglePtr> triangles = quad->splitToTriangles(); + QList<LDTriangle*> triangles = quad->splitToTriangles(); // Replace the quad with the first triangle and add the second triangle // after the first one. @@ -257,11 +257,11 @@ if (type != OBJ_Quad and type != OBJ_Triangle) continue; - LDLinePtr lines[4]; + LDLine* lines[4]; if (type == OBJ_Quad) { - LDQuadPtr quad = static_cast<LDQuad*> (obj); + LDQuad* quad = static_cast<LDQuad*> (obj); lines[0] = LDSpawn<LDLine> (quad->vertex (0), quad->vertex (1)); lines[1] = LDSpawn<LDLine> (quad->vertex (1), quad->vertex (2)); lines[2] = LDSpawn<LDLine> (quad->vertex (2), quad->vertex (3)); @@ -269,7 +269,7 @@ } else { - LDTrianglePtr tri = static_cast<LDTriangle*> (obj); + LDTriangle* tri = static_cast<LDTriangle*> (obj); lines[0] = LDSpawn<LDLine> (tri->vertex (0), tri->vertex (1)); lines[1] = LDSpawn<LDLine> (tri->vertex (1), tri->vertex (2)); lines[2] = LDSpawn<LDLine> (tri->vertex (2), tri->vertex (0)); @@ -452,7 +452,7 @@ for (LDObject* obj : Selection()) { - LDMatrixObjectPtr mo = dynamic_cast<LDMatrixObject*> (obj); + LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj); if (mo != null) { @@ -597,7 +597,7 @@ { int num = 0; - LDIterate<LDCondLine> (Selection(), [&](LDCondLinePtr const& cnd) + LDIterate<LDCondLine> (Selection(), [&](LDCondLine* const& cnd) { cnd->toEdgeLine(); ++num; @@ -656,8 +656,8 @@ void MainWindow::slot_actionAddHistoryLine() { LDObject* obj; - bool ishistory = false, - prevIsHistory = false; + bool ishistory = false; + bool prevIsHistory = false; QDialog* dlg = new QDialog; Ui_AddHistoryLine* ui = new Ui_AddHistoryLine; @@ -670,29 +670,23 @@ return; // Create the comment object based on input - QString commentText = format ("!HISTORY %1 [%2] %3", + LDComment* comment = new LDComment (format ("!HISTORY %1 [%2] %3", ui->m_date->date().toString ("yyyy-MM-dd"), ui->m_username->text(), - ui->m_comment->text()); - - LDCommentPtr comm (LDSpawn<LDComment> (commentText)); + ui->m_comment->text())); // Find a spot to place the new comment for (obj = CurrentDocument()->getObject (0); - obj != null and obj->next() != null and not obj->next()->isScemantic(); + obj and obj->next() and not obj->next()->isScemantic(); obj = obj->next()) { - LDCommentPtr comm = dynamic_cast<LDComment*> (obj); + LDComment* comment = dynamic_cast<LDComment*> (obj); - if (comm != null and comm->text().startsWith ("!HISTORY ")) + if (comment and comment->text().startsWith ("!HISTORY ")) ishistory = true; if (prevIsHistory and not ishistory) - { - // Last line was history, this isn't, thus insert the new history - // line here. - break; - } + break; // Last line was history, this isn't, thus insert the new history line here. prevIsHistory = ishistory; } @@ -703,7 +697,7 @@ // If we're adding a history line right before a scemantic object, pad it // an empty line if (obj and obj->next() and obj->next()->isScemantic()) - CurrentDocument()->insertObj (idx, LDEmptyPtr (LDSpawn<LDEmpty>())); + CurrentDocument()->insertObj (idx, new LDEmpty); buildObjList(); delete ui;
--- a/src/addObjectDialog.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/addObjectDialog.cc Sat Aug 22 15:58:50 2015 +0300 @@ -109,7 +109,7 @@ if (obj) { - LDSubfilePtr ref = static_cast<LDSubfile*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); le_subfileName->setText (ref->fileInfo()->name()); } } break; @@ -189,7 +189,7 @@ if (defaults->hasMatrix()) { - LDMatrixObjectPtr mo = dynamic_cast<LDMatrixObject*> (obj); + LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj); QLabel* lb_matrix = new QLabel ("Matrix:"); le_matrix = new QLineEdit; // le_matrix->setValidator (new QDoubleValidator); @@ -276,10 +276,10 @@ // ============================================================================= // ============================================================================= template<typename T> -static QSharedPointer<T> InitObject (LDObject*& obj) +static T* InitObject (LDObject*& obj) { if (obj == null) - obj = LDSpawn<T>(); + obj = new T; return static_cast<T*> (obj); } @@ -326,7 +326,7 @@ { case OBJ_Comment: { - LDCommentPtr comm = InitObject<LDComment> (obj); + LDComment* comm = InitObject<LDComment> (obj); comm->setText (dlg.le_comment->text()); } break; @@ -354,14 +354,14 @@ case OBJ_BFC: { - LDBFCPtr bfc = InitObject<LDBFC> (obj); + LDBFC* bfc = InitObject<LDBFC> (obj); assert (IsWithin (dlg.rb_bfcType->value(), 0, int (BFCStatement::NumValues) - 1)); bfc->setStatement (BFCStatement (dlg.rb_bfcType->value())); } break; case OBJ_Vertex: { - LDVertexPtr vert = InitObject<LDVertex> (obj); + LDVertex* vert = InitObject<LDVertex> (obj); vert->pos.apply ([&](Axis ax, double& value) { value = dlg.dsb_coords[ax]->value(); }); } break; @@ -373,7 +373,7 @@ if (name.length() == 0) return; // no subfile filename - LDDocumentPtr file = GetDocument (name); + LDDocument* file = GetDocument (name); if (not file) { @@ -381,7 +381,7 @@ return; } - LDSubfilePtr ref = InitObject<LDSubfile> (obj); + LDSubfile* ref = InitObject<LDSubfile> (obj); assert (ref); for_axes (ax)
--- a/src/basics.h Sat Aug 22 15:37:02 2015 +0300 +++ b/src/basics.h Sat Aug 22 15:58:50 2015 +0300 @@ -40,12 +40,7 @@ using uint16 = quint16; using uint32 = quint32; using uint64 = quint64; -using LDObject* = QSharedPointer<LDObject>; using LDObjectList = QList<LDObject*>; -using LDObjectWeakPtr = QWeakPointer<LDObject>; -using LDObjectWeakList = QList<LDObjectWeakPtr>; -using LDDocumentPtr = QSharedPointer<LDDocument>; -using LDDocumentWeakPtr = QWeakPointer<LDDocument>; template<typename T, typename R> using Pair = std::pair<T, R>;
--- a/src/colors.h Sat Aug 22 15:37:02 2015 +0300 +++ b/src/colors.h Sat Aug 22 15:58:50 2015 +0300 @@ -29,7 +29,7 @@ T() : Super() {} \ T (DataType* data) : Super (data) {} \ T (Super const& other) : Super (other) {} \ - T (QWeakPointer<DataType> const& other) : Super (other) {} \ + T (QPointer<DataType> const& other) : Super (other) {} \ \ template <typename Deleter> \ T (DataType* data, Deleter dlt) : Super (data, dlt) {} \
--- a/src/editHistory.h Sat Aug 22 15:37:02 2015 +0300 +++ b/src/editHistory.h Sat Aug 22 15:58:50 2015 +0300 @@ -41,7 +41,7 @@ class History { PROPERTY (private, int, position, setPosition, STOCK_WRITE) - PROPERTY (public, LDDocumentWeakPtr, document, setDocument, STOCK_WRITE) + PROPERTY (public, LDDocument*, document, setDocument, STOCK_WRITE) PROPERTY (public, bool, isIgnoring, setIgnoring, STOCK_WRITE) public:
--- a/src/editmodes/circleMode.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/editmodes/circleMode.cc Sat Aug 22 15:58:50 2015 +0300 @@ -77,7 +77,7 @@ const int divisions (g_win->ringToolHiRes() ? HighResolution : LowResolution); double dist0 (getCircleDrawDist (0)); double dist1 (getCircleDrawDist (1)); - LDDocumentPtr refFile; + LDDocument* refFile; Matrix transform; bool circleOrDisc = false; @@ -104,7 +104,7 @@ for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents()) { refFile = GetPrimitive (::Ring, segments, divisions, cmp.num); - LDSubfilePtr ref = LDSpawn<LDSubfile>(); + LDSubfile* ref = LDSpawn<LDSubfile>(); ref->setFileInfo (refFile); ref->setTransform (getCircleDrawMatrix (cmp.scale)); ref->setPosition (m_drawedVerts[0]); @@ -144,7 +144,7 @@ v3.setCoordinate (localx, v3[localx] + c1[i].x1()); v3.setCoordinate (localy, v3[localy] + c1[i].y1()); - LDQuadPtr quad (LDSpawn<LDQuad> (v0, v1, v2, v3)); + LDQuad* quad (LDSpawn<LDQuad> (v0, v1, v2, v3)); quad->setColor (MainColor()); // Ensure the quads always are BFC-front towards the camera @@ -157,7 +157,7 @@ if (circleOrDisc and refFile != null) { - LDSubfilePtr ref = LDSpawn<LDSubfile>(); + LDSubfile* ref = LDSpawn<LDSubfile>(); ref->setFileInfo (refFile); ref->setTransform (transform); ref->setPosition (m_drawedVerts[0]);
--- a/src/editmodes/drawMode.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/editmodes/drawMode.cc Sat Aug 22 15:58:50 2015 +0300 @@ -93,7 +93,7 @@ case 1: { // 1 vertex - add a vertex object - LDVertexPtr obj = LDSpawn<LDVertex>(); + LDVertex* obj = LDSpawn<LDVertex>(); obj->pos = verts[0]; obj->setColor (MainColor()); objs << obj; @@ -103,7 +103,7 @@ case 2: { // 2 verts - make a line - LDLinePtr obj = LDSpawn<LDLine> (verts[0], verts[1]); + LDLine* obj = LDSpawn<LDLine> (verts[0], verts[1]); obj->setColor (EdgeColor()); objs << obj; break;
--- a/src/editmodes/linePathMode.cpp Sat Aug 22 15:37:02 2015 +0300 +++ b/src/editmodes/linePathMode.cpp Sat Aug 22 15:58:50 2015 +0300 @@ -60,7 +60,7 @@ for (int i = 0; i < m_drawedVerts.size() - 1; ++i) { - LDLinePtr line = LDSpawn<LDLine>(); + LDLine* line = LDSpawn<LDLine>(); line->setVertex (0, m_drawedVerts[i]); line->setVertex (1, m_drawedVerts[i + 1]); objs << line;
--- a/src/editmodes/rectangleMode.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/editmodes/rectangleMode.cc Sat Aug 22 15:58:50 2015 +0300 @@ -46,7 +46,7 @@ { if (m_drawedVerts.size() == 2) { - LDQuadPtr quad (LDSpawn<LDQuad>()); + LDQuad* quad (LDSpawn<LDQuad>()); updateRectVerts(); for (int i = 0; i < quad->numVertices(); ++i)
--- a/src/extPrograms.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/extPrograms.cc Sat Aug 22 15:58:50 2015 +0300 @@ -173,7 +173,7 @@ { if (obj->type() == OBJ_Subfile) { - LDSubfilePtr ref = static_cast<LDSubfile*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); LDObjectList objs = ref->inlineContents (true, false); WriteObjects (objs, f);
--- a/src/format.h Sat Aug 22 15:37:02 2015 +0300 +++ b/src/format.h Sat Aug 22 15:58:50 2015 +0300 @@ -52,7 +52,7 @@ } template<typename T> - StringFormatArg (QWeakPointer<T> const& a) + StringFormatArg (QPointer<T> const& a) { m_text.sprintf ("%p", a.data()); }
--- a/src/glCompiler.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/glCompiler.cc Sat Aug 22 15:58:50 2015 +0300 @@ -247,7 +247,7 @@ // ============================================================================= // -void GLCompiler::compileDocument (LDDocumentPtr doc) +void GLCompiler::compileDocument (LDDocument* doc) { if (doc == null) return; @@ -356,7 +356,7 @@ case OBJ_Subfile: { - LDSubfilePtr ref = static_cast<LDSubfile*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); auto data = ref->inlinePolygons(); for (LDPolygon& poly : data)
--- a/src/glCompiler.h Sat Aug 22 15:37:02 2015 +0300 +++ b/src/glCompiler.h Sat Aug 22 15:58:50 2015 +0300 @@ -35,7 +35,7 @@ GLCompiler (GLRenderer* renderer); ~GLCompiler(); - void compileDocument (LDDocumentPtr doc); + void compileDocument (LDDocument* doc); void dropObject (LDObject* obj); void initialize(); QColor getColorForPolygon (LDPolygon& poly, LDObject* topobj, @@ -69,8 +69,8 @@ void compileObject (LDObject* obj); void compilePolygon (LDPolygon& poly, LDObject* topobj, ObjectVBOInfo* objinfo); - QMap<LDObjectWeakPtr, ObjectVBOInfo> m_objectInfo; - LDObjectWeakList m_staged; // Objects that need to be compiled + QMap<LDObject*, ObjectVBOInfo> m_objectInfo; + LDObjectList m_staged; // Objects that need to be compiled GLuint m_vbo[g_numVBOs]; bool m_vboChanged[g_numVBOs]; int m_vboSizes[g_numVBOs];
--- a/src/glRenderer.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/glRenderer.cc Sat Aug 22 15:58:50 2015 +0300 @@ -1048,7 +1048,7 @@ // ============================================================================= // -void GLRenderer::setDocument (LDDocumentPtr const& a) +void GLRenderer::setDocument (LDDocument* const& a) { m_document = a; @@ -1403,11 +1403,11 @@ // ============================================================================= // -LDOverlayPtr GLRenderer::findOverlayObject (ECamera cam) +LDOverlay* GLRenderer::findOverlayObject (ECamera cam) { for (LDObject* obj : document()->objects()) { - LDOverlayPtr overlay = dynamic_cast<LDOverlay*> (obj); + LDOverlay* overlay = dynamic_cast<LDOverlay*> (obj); if (overlay and overlay->camera() == cam) return overlay; @@ -1428,7 +1428,7 @@ continue; LDGLOverlay& meta = currentDocumentData().overlays[cam]; - LDOverlayPtr ovlobj = findOverlayObject (cam); + LDOverlay* ovlobj = findOverlayObject (cam); if (ovlobj == null and meta.img != null) { @@ -1455,7 +1455,7 @@ continue; LDGLOverlay& meta = currentDocumentData().overlays[cam]; - LDOverlayPtr ovlobj = findOverlayObject (cam); + LDOverlay* ovlobj = findOverlayObject (cam); if (meta.img == null and ovlobj != null) { @@ -1531,8 +1531,8 @@ if (not cfg::HighlightObjectBelowCursor and objectAtCursor() == null) return; - LDObjectWeakPtr newObject; - LDObjectWeakPtr oldObject = objectAtCursor(); + LDObject* newObject; + LDObject* oldObject = objectAtCursor(); qint32 newIndex; if (isCameraMoving() or not cfg::HighlightObjectBelowCursor) @@ -1578,7 +1578,7 @@ if (g_win != null and ev->source() == g_win->getPrimitivesTree()) { QString primName = static_cast<SubfileListItem*> (g_win->getPrimitivesTree()->currentItem())->primitive()->name; - LDSubfilePtr ref = LDSpawn<LDSubfile>(); + LDSubfile* ref = LDSpawn<LDSubfile>(); ref->setColor (MainColor()); ref->setFileInfo (GetDocument (primName)); ref->setPosition (Origin);
--- a/src/glRenderer.h Sat Aug 22 15:37:02 2015 +0300 +++ b/src/glRenderer.h Sat Aug 22 15:58:50 2015 +0300 @@ -142,9 +142,9 @@ PROPERTY (public, bool, isDrawOnly, setDrawOnly, STOCK_WRITE) PROPERTY (public, MessageManager*, messageLog, setMessageLog, STOCK_WRITE) PROPERTY (private, bool, isPicking, setPicking, CUSTOM_WRITE) - PROPERTY (public, LDDocumentPtr, document, setDocument, CUSTOM_WRITE) + PROPERTY (public, LDDocument*, document, setDocument, CUSTOM_WRITE) PROPERTY (public, GLCompiler*, compiler, setCompiler, STOCK_WRITE) - PROPERTY (public, LDObjectWeakPtr, objectAtCursor, setObjectAtCursor, STOCK_WRITE) + PROPERTY (public, LDObject*, objectAtCursor, setObjectAtCursor, STOCK_WRITE) PROPERTY (private, bool, isCameraMoving, setCameraMoving, STOCK_WRITE) public: @@ -245,7 +245,7 @@ inline LDGLData& currentDocumentData() const; void drawVBOs (EVBOSurface surface, EVBOComplement colors, GLenum type); void doMakeCurrent(); - LDOverlayPtr findOverlayObject (ECamera cam); + LDOverlay* findOverlayObject (ECamera cam); inline double& pan (Axis ax); inline const double& pan (Axis ax) const; inline double& rot (Axis ax);
--- a/src/ldDocument.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/ldDocument.cc Sat Aug 22 15:58:50 2015 +0300 @@ -42,11 +42,11 @@ static bool g_loadingMainFile = false; static const int g_maxRecentFiles = 10; static bool g_aborted = false; -static LDDocumentPtr g_logoedStud; -static LDDocumentPtr g_logoedStud2; -static QList<LDDocumentWeakPtr> g_allDocuments; -static QList<LDDocumentPtr> g_explicitDocuments; -static LDDocumentPtr g_currentDocument; +static LDDocument* g_logoedStud; +static LDDocument* g_logoedStud2; +static QList<LDDocument*> g_allDocuments; +static QList<LDDocument*> g_explicitDocuments; +static LDDocument* g_currentDocument; static bool g_loadingLogoedStuds = false; const QStringList g_specialSubdirectories ({ "s", "48", "8" }); @@ -126,14 +126,14 @@ // ============================================================================= // -LDDocument::LDDocument (LDDocumentPtr* selfptr) : +LDDocument::LDDocument (LDDocument** selfptr) : m_isImplicit (true), m_flags (0), m_verticesOutdated (true), m_needVertexMerge (true), m_gldata (new LDGLData) { - *selfptr = LDDocumentPtr (this); + *selfptr = LDDocument* (this); setSelf (*selfptr); setSavePosition (-1); setTabIndex (-1); @@ -145,9 +145,9 @@ // ============================================================================= // -LDDocumentPtr LDDocument::createNew() +LDDocument* LDDocument::createNew() { - LDDocumentPtr ptr; + LDDocument* ptr; new LDDocument (&ptr); return ptr; } @@ -207,27 +207,27 @@ // ============================================================================= // -QList<LDDocumentPtr> const& LDDocument::explicitDocuments() +QList<LDDocument*> const& LDDocument::explicitDocuments() { return g_explicitDocuments; } // ============================================================================= // -LDDocumentPtr FindDocument (QString name) +LDDocument* FindDocument (QString name) { - for (LDDocumentWeakPtr weakfile : g_allDocuments) + for (LDDocument* file : g_allDocuments) { - if (weakfile == null) + if (file == null) continue; - LDDocumentPtr file (weakfile); + LDDocument* file (file); if (Eq (name, file->name(), file->defaultName())) return file; } - return LDDocumentPtr(); + return nullptr; } // ============================================================================= @@ -276,7 +276,7 @@ // in the immediate vicinity of a current model to override stock LDraw stuff. QString reltop = Basename (Dirname (relpath)); - for (LDDocumentWeakPtr doc : g_allDocuments) + for (LDDocument* doc : g_allDocuments) { if (doc == null) continue; @@ -512,7 +512,7 @@ // ============================================================================= // -LDDocumentPtr OpenDocument (QString path, bool search, bool implicit, LDDocumentPtr fileToOverride) +LDDocument* OpenDocument (QString path, bool search, bool implicit, LDDocument* fileToOverride) { // Convert the file name to lowercase when searching because some parts contain subfile // subfile references with uppercase file names. I'll assume here that the library will always @@ -532,14 +532,14 @@ if (not fp->open (QIODevice::ReadOnly)) { delete fp; - return LDDocumentPtr(); + return nullptr; } } if (not fp) - return LDDocumentPtr(); + return nullptr; - LDDocumentPtr load = (fileToOverride != null ? fileToOverride : LDDocument::createNew()); + LDDocument* load = (fileToOverride != null ? fileToOverride : LDDocument::createNew()); load->setImplicit (implicit); load->setFullPath (fullpath); load->setName (LDDocument::shortenName (load->fullPath())); @@ -556,7 +556,7 @@ if (not ok) { load->dismiss(); - return LDDocumentPtr(); + return nullptr; } load->addObjects (objs); @@ -633,7 +633,7 @@ // void CloseAllDocuments() { - for (LDDocumentPtr file : g_explicitDocuments) + for (LDDocument* file : g_explicitDocuments) file->dismiss(); } @@ -642,7 +642,7 @@ void newFile() { // Create a new anonymous file and set it to our current - LDDocumentPtr f = LDDocument::createNew(); + LDDocument* f = LDDocument::createNew(); f->setName (""); f->setImplicit (false); LDDocument::setCurrent (f); @@ -685,11 +685,11 @@ void OpenMainModel (QString path) { // If there's already a file with the same name, this file must replace it. - LDDocumentPtr documentToReplace; - LDDocumentPtr file; + LDDocument* documentToReplace; + LDDocument* file; QString shortName = LDDocument::shortenName (path); - for (LDDocumentWeakPtr doc : g_allDocuments) + for (LDDocument* doc : g_allDocuments) { if (doc != null and doc->name() == shortName) { @@ -788,7 +788,7 @@ if (nameObject != null and nameObject->type() == OBJ_Comment) { - LDCommentPtr nameComment = static_cast<LDComment*> (nameObject); + LDComment* nameComment = static_cast<LDComment*> (nameObject); if (nameComment->text().left (6) == "Name: ") { @@ -964,7 +964,7 @@ CheckTokenCount (tokens, 7); CheckTokenNumbers (tokens, 3, 6); - LDVertexPtr obj = LDSpawn<LDVertex>(); + LDVertex* obj = LDSpawn<LDVertex>(); obj->setColor (LDColor::fromIndex (StringToNumber (tokens[3]))); obj->pos.apply ([&](Axis ax, double& value) { value = tokens[4 + ax].toDouble(); }); @@ -975,7 +975,7 @@ CheckTokenCount (tokens, 9); CheckTokenNumbers (tokens, 5, 8); - LDOverlayPtr obj = LDSpawn<LDOverlay>(); + LDOverlay* obj = LDSpawn<LDOverlay>(); obj->setFileName (tokens[3]); obj->setCamera (tokens[4].toLong()); obj->setX (tokens[5].toLong()); @@ -987,7 +987,7 @@ } // Just a regular comment: - LDCommentPtr obj = LDSpawn<LDComment>(); + LDComment* obj = LDSpawn<LDComment>(); obj->setText (commentText); return obj; } @@ -1002,19 +1002,19 @@ // not loading the main file now, but the subfile in question. bool tmp = g_loadingMainFile; g_loadingMainFile = false; - LDDocumentPtr load = GetDocument (tokens[14]); + LDDocument* load = GetDocument (tokens[14]); g_loadingMainFile = tmp; // If we cannot open the file, mark it an error. Note we cannot use LDParseError // here because the error object needs the document reference. if (not load) { - LDErrorPtr obj = LDSpawn<LDError> (line, format ("Could not open %1", tokens[14])); + LDError* obj = LDSpawn<LDError> (line, format ("Could not open %1", tokens[14])); obj->setFileReferenced (tokens[14]); return obj; } - LDSubfilePtr obj = LDSpawn<LDSubfile>(); + LDSubfile* obj = LDSpawn<LDSubfile>(); obj->setColor (LDColor::fromIndex (StringToNumber (tokens[1]))); obj->setPosition (ParseVertex (tokens, 2)); // 2 - 4 @@ -1034,7 +1034,7 @@ CheckTokenNumbers (tokens, 1, 7); // Line - LDLinePtr obj (LDSpawn<LDLine>()); + LDLine* obj (LDSpawn<LDLine>()); obj->setColor (LDColor::fromIndex (StringToNumber (tokens[1]))); for (int i = 0; i < 2; ++i) @@ -1049,7 +1049,7 @@ CheckTokenNumbers (tokens, 1, 10); // Triangle - LDTrianglePtr obj (LDSpawn<LDTriangle>()); + LDTriangle* obj (LDSpawn<LDTriangle>()); obj->setColor (LDColor::fromIndex (StringToNumber (tokens[1]))); for (int i = 0; i < 3; ++i) @@ -1093,10 +1093,10 @@ // ============================================================================= // -LDDocumentPtr GetDocument (QString filename) +LDDocument* GetDocument (QString filename) { // Try find the file in the list of loaded files - LDDocumentPtr doc = FindDocument (filename); + LDDocument* doc = FindDocument (filename); // If it's not loaded, try open it if (not doc) @@ -1116,8 +1116,8 @@ { if (obj->type() == OBJ_Subfile) { - LDSubfilePtr ref = static_cast<LDSubfile*> (obj); - LDDocumentPtr fileInfo = GetDocument (ref->fileInfo()->name()); + LDSubfile* ref = static_cast<LDSubfile*> (obj); + LDDocument* fileInfo = GetDocument (ref->fileInfo()->name()); if (fileInfo != null) { @@ -1211,14 +1211,14 @@ } m_objects.removeAt (idx); - obj->setDocument (LDDocumentPtr()); + obj->setDocument (nullptr); } // ============================================================================= // bool IsSafeToCloseAll() { - for (LDDocumentPtr f : LDDocument::explicitDocuments()) + for (LDDocument* f : LDDocument::explicitDocuments()) { if (not f->isSafeToClose()) return false; @@ -1243,7 +1243,7 @@ m_objectVertices.remove (m_objects[idx]); m_objects[idx]->deselect(); - m_objects[idx]->setDocument (LDDocumentPtr()); + m_objects[idx]->setDocument (nullptr); obj->setDocument (this); addKnownVertices (obj); g_win->R()->compileObject (obj); @@ -1396,7 +1396,7 @@ // ============================================================================= // -LDDocumentPtr LDDocument::current() +LDDocument* LDDocument::current() { return g_currentDocument; } @@ -1407,7 +1407,7 @@ // // TODO: f can be temporarily null. This probably should not be the case. // ============================================================================= -void LDDocument::setCurrent (LDDocumentPtr f) +void LDDocument::setCurrent (LDDocument* f) { // Implicit files were loaded for caching purposes and must never be set // current. @@ -1446,7 +1446,7 @@ not g_explicitDocuments[1]->name().isEmpty() and not g_explicitDocuments[0]->hasUnsavedChanges()) { - LDDocumentPtr filetoclose = g_explicitDocuments.first(); + LDDocument* filetoclose = g_explicitDocuments.first(); filetoclose->dismiss(); } }
--- a/src/ldDocument.h Sat Aug 22 15:37:02 2015 +0300 +++ b/src/ldDocument.h Sat Aug 22 15:58:50 2015 +0300 @@ -74,7 +74,7 @@ PROPERTY (public, int, tabIndex, setTabIndex, STOCK_WRITE) PROPERTY (public, QList<LDPolygon>, polygonData, setPolygonData, STOCK_WRITE) PROPERTY (private, LDDocumentFlags, flags, setFlags, STOCK_WRITE) - PROPERTY (private, LDDocumentWeakPtr, self, setSelf, STOCK_WRITE) + PROPERTY (private, LDDocument*, self, setSelf, STOCK_WRITE) QMap<LDObject*, QVector<Vertex>> m_objectVertices; QVector<Vertex> m_vertices; @@ -82,7 +82,7 @@ bool m_needVertexMerge; public: - LDDocument(LDDocumentPtr* selfptr); + LDDocument(LDDocument** selfptr); ~LDDocument(); int addObject (LDObject* obj); // Adds an object to this file at the end of the file. @@ -146,15 +146,15 @@ setImplicit (true); } - static LDDocumentPtr current(); - static void setCurrent (LDDocumentPtr f); + static LDDocument* current(); + static void setCurrent (LDDocument* f); static void closeInitialFile(); static int countExplicitFiles(); - static LDDocumentPtr createNew(); + static LDDocument* createNew(); // Turns a full path into a relative path static QString shortenName (QString a); - static QList<LDDocumentPtr> const& explicitDocuments(); + static QList<LDDocument*> const& explicitDocuments(); void mergeVertices(); protected: @@ -178,7 +178,7 @@ bool m_needsReCache; }; -inline LDDocumentPtr CurrentDocument() +inline LDDocument* CurrentDocument() { return LDDocument::current(); } @@ -190,11 +190,11 @@ void OpenMainModel (QString path); // Finds an OpenFile by name or null if not open -LDDocumentPtr FindDocument (QString name); +LDDocument* FindDocument (QString name); // Opens the given file and parses the LDraw code within. Returns a pointer // to the opened file or null on error. -LDDocumentPtr OpenDocument (QString path, bool search, bool implicit, LDDocumentPtr fileToOverride = LDDocumentPtr()); +LDDocument* OpenDocument (QString path, bool search, bool implicit, LDDocument* fileToOverride = nullptr); // Opens the given file and returns a pointer to it, potentially looking in /parts and /p QFile* OpenLDrawFile (QString relpath, bool subdirs, QString* pathpointer = null); @@ -207,7 +207,7 @@ // Retrieves the pointer to the given document by file name. Document is loaded // from file if necessary. Can return null if neither succeeds. -LDDocumentPtr GetDocument (QString filename); +LDDocument* GetDocument (QString filename); // Is it safe to close all files? bool IsSafeToCloseAll();
--- a/src/ldObject.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/ldObject.cc Sat Aug 22 15:58:50 2015 +0300 @@ -32,7 +32,7 @@ CFGENTRY (Bool, UseCALicense, true) // List of all LDObjects -QMap<int32, LDObjectWeakPtr> g_allObjects; +QMap<int32, LDObject*> g_allObjects; static int32 g_idcursor = 1; // 0 shalt be null enum { MAX_LDOBJECT_IDS = (1 << 24) }; @@ -229,7 +229,7 @@ // ============================================================================= // -QList<LDTrianglePtr> LDQuad::splitToTriangles() +QList<LDTriangle*> LDQuad::splitToTriangles() { // Create the two triangles based on this quadrilateral: // 0---3 0---3 3 @@ -237,8 +237,8 @@ // | | ==> | / / | // | | |/ / | // 1---2 1 1---2 - LDTrianglePtr tri1 (new LDTriangle (vertex (0), vertex (1), vertex (3))); - LDTrianglePtr tri2 (new LDTriangle (vertex (1), vertex (2), vertex (3))); + LDTriangle* tri1 (new LDTriangle (vertex (0), vertex (1), vertex (3))); + LDTriangle* tri2 (new LDTriangle (vertex (1), vertex (2), vertex (3))); // The triangles also inherit the quad's color tri1->setColor (color()); @@ -249,7 +249,7 @@ // ============================================================================= // -void LDObject::replace (LDObjectPtr other) +void LDObject::replace (LDObject* other) { int idx = lineNumber(); @@ -265,7 +265,7 @@ // ============================================================================= // -void LDObject::swap (LDObjectPtr other) +void LDObject::swap (LDObject* other) { assert (document() == other->document()); document()->swapObjects (self(), other); @@ -335,7 +335,7 @@ // ============================================================================= // -static void TransformObject (LDObjectPtr obj, Matrix transform, Vertex pos, LDColor parentcolor) +static void TransformObject (LDObject* obj, Matrix transform, Vertex pos, LDColor parentcolor) { switch (obj->type()) { @@ -353,7 +353,7 @@ case OBJ_Subfile: { - LDSubfilePtr ref = static_cast<LDSubfile*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); Matrix newMatrix = transform * ref->transform(); Vertex newpos = ref->position(); newpos.transform (transform, pos); @@ -377,7 +377,7 @@ LDObjectList objs = fileInfo()->inlineContents (deep, render); // Transform the objects - for (LDObjectPtr obj : objs) + for (LDObject* obj : objs) { // assert (obj->type() != OBJ_Subfile); // Set the parent now so we know what inlined the object. @@ -455,11 +455,11 @@ long const end = up ? objs.size() : -1; long const incr = up ? 1 : -1; LDObjectList objsToCompile; - LDDocumentPtr file = objs[0]->document(); + LDDocument* file = objs[0]->document(); for (long i = start; i != end; i += incr) { - LDObjectPtr obj = objs[i]; + LDObject* obj = objs[i]; long const idx = obj->lineNumber(); long const target = idx + (up ? -1 : 1); @@ -483,7 +483,7 @@ // The objects need to be recompiled, otherwise their pick lists are left with // the wrong index colors which messes up selection. - for (LDObjectPtr obj : objsToCompile) + for (LDObject* obj : objsToCompile) g_win->R()->compileObject (obj); } @@ -507,7 +507,7 @@ { int count = 0; - for (LDObjectPtr obj : objs) + for (LDObject* obj : objs) { if (obj->type() == objType) count++; @@ -533,7 +533,7 @@ // ============================================================================= // -LDObjectPtr LDObject::topLevelParent() +LDObject* LDObject::topLevelParent() { LDObject* it; @@ -545,7 +545,7 @@ // ============================================================================= // -LDObjectPtr LDObject::next() const +LDObject* LDObject::next() const { int idx = lineNumber(); assert (idx != -1); @@ -558,7 +558,7 @@ // ============================================================================= // -LDObjectPtr LDObject::previous() const +LDObject* LDObject::previous() const { int idx = lineNumber(); assert (idx != -1); @@ -607,7 +607,7 @@ // ============================================================================= // -LDObjectPtr LDObject::getDefault (const LDObjectType type) +LDObject* LDObject::getDefault (const LDObjectType type) { switch (type) { @@ -671,7 +671,7 @@ int axisSet = (1 << X) | (1 << Y) | (1 << Z); LDObjectList objs = fileInfo()->inlineContents (true, false); - for (LDObjectPtr obj : objs) + for (LDObject* obj : objs) { for (int i = 0; i < obj->numVertices(); ++i) { @@ -767,7 +767,7 @@ // ============================================================================= // -LDObjectPtr LDObject::fromID (int id) +LDObject* LDObject::fromID (int id) { auto it = g_allObjects.find (id); @@ -794,7 +794,7 @@ // makes history stuff work out of the box. // template<typename T> -static void changeProperty (LDObjectPtr obj, T* ptr, const T& val) +static void changeProperty (LDObject* obj, T* ptr, const T& val) { int idx; @@ -872,7 +872,7 @@ document()->removeFromSelection (self()); // If this object is inverted with INVERTNEXT, deselect the INVERTNEXT as well. - LDBFCPtr invertnext; + LDBFC* invertnext; if (previousIsInvertnext (invertnext)) invertnext->deselect(); @@ -888,15 +888,15 @@ // ============================================================================= // -LDObjectPtr LDObject::createCopy() const +LDObject* LDObject::createCopy() const { - LDObjectPtr copy = ParseLine (asText()); + LDObject* copy = ParseLine (asText()); return copy; } // ============================================================================= // -void LDSubfile::setFileInfo (const LDDocumentPtr& a) +void LDSubfile::setFileInfo (const LDDocument*& a) { changeProperty (self(), &m_fileInfo, a);
--- a/src/ldObject.h Sat Aug 22 15:37:02 2015 +0300 +++ b/src/ldObject.h Sat Aug 22 15:58:50 2015 +0300 @@ -97,7 +97,7 @@ PROPERTY (private, int32, id, setID, STOCK_WRITE) PROPERTY (public, LDColor, color, setColor, CUSTOM_WRITE) PROPERTY (private, QColor, randomColor, setRandomColor, STOCK_WRITE) - PROPERTY (private, LDObjectWeakPtr, self, setSelf, STOCK_WRITE) + PROPERTY (private, LDObject*, self, setSelf, STOCK_WRITE) public: LDObject (LDDocument* document = nullptr); @@ -148,7 +148,7 @@ LDObject* previous() const; // Is the previous object INVERTNEXT? - bool previousIsInvertnext (LDBFCPtr& ptr); + bool previousIsInvertnext (LDBFC*& ptr); // Replace this LDObject with another LDObject. Object is deleted in the process. void replace (LDObject* other); @@ -220,11 +220,11 @@ } // -// Apparently QWeakPointer doesn't implement operator<. This is a problem when +// Apparently QPointer doesn't implement operator<. This is a problem when // some of the code needs to sort and remove duplicates from LDObject lists. // Adding a specialized version here: // -inline bool operator< (LDObjectWeakPtr a, LDObjectWeakPtr b) +inline bool operator< (LDObject* a, LDObject* b) { return a.data() < b.data(); } @@ -246,11 +246,11 @@ public: LDMatrixObject (LDDocument* document = nullptr) : - LDObject (documemnt), + LDObject (document), m_position (Origin) {} LDMatrixObject (const Matrix& transform, const Vertex& pos, LDDocument* document = nullptr) : - LDObject (documemnt), + LDObject (document), m_transform (transform), m_position (pos) {} @@ -390,7 +390,7 @@ LDOBJ_DEFAULTCOLOR (MainColor()) LDOBJ_SCEMANTIC LDOBJ_HAS_MATRIX - PROPERTY (public, LDDocumentPtr, fileInfo, setFileInfo, CUSTOM_WRITE) + PROPERTY (public, LDDocument*, fileInfo, setFileInfo, CUSTOM_WRITE) public: enum InlineFlag @@ -447,7 +447,7 @@ public: LDCondLine (const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, LDDocument* document = nullptr); - LDLinePtr toEdgeLine(); + LDLine* toEdgeLine(); }; // @@ -491,7 +491,7 @@ LDQuad (const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, LDDocument* document = nullptr); // Split this quad into two triangles - QList<LDTrianglePtr> splitToTriangles(); + QList<LDTriangle*> splitToTriangles(); }; // @@ -552,7 +552,7 @@ QString PreferredLicenseText(); template<typename T> -inline void DynamicExecute (LDObject* obj, std::function<void (QSharedPointer<T> const&)> func) +inline void DynamicExecute (LDObject* obj, std::function<void (T*)> func) { static_assert (std::is_base_of<LDObject, T>::value, "DynamicExecute may only be used with LDObject-derivatives"); @@ -565,7 +565,7 @@ template<typename T> inline void LDIterate (LDObjectList const& objs, - std::function<void (QSharedPointer<T> const&)> func) + std::function<void (T*)> func) { static_assert (std::is_base_of<LDObject, T>::value, "LDIterate may only be used with LDObject-derivatives");
--- a/src/ldObjectMath.cpp Sat Aug 22 15:37:02 2015 +0300 +++ b/src/ldObjectMath.cpp Sat Aug 22 15:58:50 2015 +0300 @@ -68,7 +68,7 @@ } elif (obj->hasMatrix()) { - LDMatrixObjectPtr mo = dynamic_cast<LDMatrixObject*> (obj); + LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj); // Transform the position Vertex v = mo->position(); @@ -80,7 +80,7 @@ } elif (obj->type() == OBJ_Vertex) { - LDVertexPtr vert = static_cast<LDVertex*> (obj); + LDVertex* vert = static_cast<LDVertex*> (obj); Vertex v = vert->pos; RotateVertex (v, rotpoint, transform); vert->pos = v;
--- a/src/mainWindow.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/mainWindow.cc Sat Aug 22 15:58:50 2015 +0300 @@ -278,7 +278,7 @@ CurrentDocument()->getObject (0)->type() == OBJ_Comment) { // Append title - LDCommentPtr comm = static_cast <LDComment*> (CurrentDocument()->getObject (0)); + LDComment* comm = static_cast <LDComment*> (CurrentDocument()->getObject (0)); title += format (": %1", comm->text()); } @@ -381,7 +381,7 @@ case OBJ_Subfile: { - LDSubfilePtr ref = static_cast<LDSubfile*> (obj); + LDSubfile* ref = static_cast<LDSubfile*> (obj); descr = format ("%1 %2, (", ref->fileInfo()->getDisplayName(), ref->position().toString (true)); @@ -400,7 +400,7 @@ case OBJ_Overlay: { - LDOverlayPtr ovl = static_cast<LDOverlay*> (obj); + LDOverlay* ovl = static_cast<LDOverlay*> (obj); descr = format ("[%1] %2 (%3, %4), %5 x %6", g_CameraNames[ovl->camera()], Basename (ovl->fileName()), ovl->x(), ovl->y(), ovl->width(), ovl->height()); @@ -768,7 +768,7 @@ // ============================================================================= // -bool MainWindow::save (LDDocumentPtr doc, bool saveAs) +bool MainWindow::save (LDDocument* doc, bool saveAs) { QString path = doc->fullPath(); int64 savesize; @@ -931,7 +931,7 @@ while (m_tabs->count() > 0) m_tabs->removeTab (0); - for (LDDocumentPtr f : LDDocument::explicitDocuments()) + for (LDDocument* f : LDDocument::explicitDocuments()) { // Add an item to the list for this file and store the tab index // in the document so we can find documents by tab index. @@ -944,7 +944,7 @@ // ============================================================================= // -void MainWindow::updateDocumentListItem (LDDocumentPtr doc) +void MainWindow::updateDocumentListItem (LDDocument* doc) { bool oldUpdatingTabs = m_updatingTabs; m_updatingTabs = true; @@ -980,11 +980,11 @@ if (m_updatingTabs) return; - LDDocumentPtr f; + LDDocument* f; int tabIndex = m_tabs->currentIndex(); // Find the file pointer of the item that was selected. - for (LDDocumentPtr it : LDDocument::explicitDocuments()) + for (LDDocument* it : LDDocument::explicitDocuments()) { if (it->tabIndex() == tabIndex) { @@ -1007,7 +1007,7 @@ { #if 0 ui->objectList->clear(); - LDDocumentPtr f = getCurrentDocument(); + LDDocument* f = getCurrentDocument(); for (LDObject* obj : *f) ui->objectList->addItem (obj->qObjListEntry); @@ -1050,7 +1050,7 @@ // void MainWindow::closeTab (int tabindex) { - LDDocumentPtr doc = FindDocument (m_tabs->tabData (tabindex).toString()); + LDDocument* doc = FindDocument (m_tabs->tabData (tabindex).toString()); if (doc == null) return;
--- a/src/mainWindow.h Sat Aug 22 15:37:02 2015 +0300 +++ b/src/mainWindow.h Sat Aug 22 15:58:50 2015 +0300 @@ -114,7 +114,7 @@ // Updates the document tab for \c doc. If no such tab exists, the // document list is rebuilt instead. - void updateDocumentListItem (LDDocumentPtr doc); + void updateDocumentListItem (LDDocument* doc); // Returns the uniform selected color (i.e. 4 if everything selected is // red), -1 if there is no such consensus. @@ -134,7 +134,7 @@ void deleteByColor (LDColor color); // Tries to save the given document. - bool save (LDDocumentPtr doc, bool saveAs); + bool save (LDDocument* doc, bool saveAs); // Updates various actions, undo/redo are set enabled/disabled where // appropriate, togglable actions are updated based on configuration,
--- a/src/partDownloader.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/partDownloader.cc Sat Aug 22 15:58:50 2015 +0300 @@ -245,7 +245,7 @@ elif (btn == getButton (Download)) { QString dest = form()->fname->text(); - setPrimaryFile (LDDocumentPtr()); + setPrimaryFile (nullptr); setAborted (false); if (getSource() == CustomURL) @@ -328,7 +328,7 @@ g_win->R()->resetAngles(); } - for (LDDocumentPtr f : m_files) + for (LDDocument* f : m_files) f->reloadAllSubfiles(); if (cfg::AutoCloseDownloadDialog and not failed) @@ -492,7 +492,7 @@ } // Try to load this file now. - LDDocumentPtr f = OpenDocument (filePath(), false, not isPrimary()); + LDDocument* f = OpenDocument (filePath(), false, not isPrimary()); if (f == null) return; @@ -503,7 +503,7 @@ // it resolves dependencies. for (LDObject* obj : f->objects()) { - LDErrorPtr err = dynamic_cast<LDError*> (obj); + LDError* err = dynamic_cast<LDError*> (obj); if (err == null or err->fileReferenced().isEmpty()) continue; @@ -525,7 +525,7 @@ // ============================================================================= // -void PartDownloader::addFile (LDDocumentPtr f) +void PartDownloader::addFile (LDDocument* f) { m_files << f; }
--- a/src/partDownloader.h Sat Aug 22 15:37:02 2015 +0300 +++ b/src/partDownloader.h Sat Aug 22 15:58:50 2015 +0300 @@ -58,7 +58,7 @@ using RequestList = QList<PartDownloadRequest*>; Q_OBJECT - PROPERTY (public, LDDocumentPtr, primaryFile, setPrimaryFile, STOCK_WRITE) + PROPERTY (public, LDDocument*, primaryFile, setPrimaryFile, STOCK_WRITE) PROPERTY (public, bool, isAborted, setAborted, STOCK_WRITE) PROPERTY (private, Ui_DownloadFrom*, form, setForm, STOCK_WRITE) PROPERTY (private, QStringList, filesToDownload, setFilesToDownload, STOCK_WRITE) @@ -69,7 +69,7 @@ explicit PartDownloader (QWidget* parent = null); virtual ~PartDownloader(); - void addFile (LDDocumentPtr f); + void addFile (LDDocument* f); bool checkValidPath(); void downloadFile (QString dest, QString url, bool primary); void downloadFromPartsTracker (QString file); @@ -89,7 +89,7 @@ private: Source m_source; - QList<LDDocumentPtr> m_files; + QList<LDDocument*> m_files; }; // =============================================================================
--- a/src/primitives.cc Sat Aug 22 15:37:02 2015 +0300 +++ b/src/primitives.cc Sat Aug 22 15:58:50 2015 +0300 @@ -417,7 +417,7 @@ Vertex v0 (x0, 0.0f, z0), v1 (x1, 0.0f, z1); - LDLinePtr line (LDSpawn<LDLine>()); + LDLine* line (LDSpawn<LDLine>()); line->setVertex (0, v0); line->setVertex (1, v1); line->setColor (EdgeColor()); @@ -467,7 +467,7 @@ v2 (x2, y2, z2), v3 (x3, y3, z3); - LDQuadPtr quad (LDSpawn<LDQuad> (v0, v1, v2, v3)); + LDQuad* quad (LDSpawn<LDQuad> (v0, v1, v2, v3)); quad->setColor (MainColor()); if (type == Cylinder) @@ -498,7 +498,7 @@ // Disc negatives need to go the other way around, otherwise // they'll end up upside-down. - LDTrianglePtr seg (LDSpawn<LDTriangle>()); + LDTriangle* seg (LDSpawn<LDTriangle>()); seg->setColor (MainColor()); seg->setVertex (type == Disc ? 0 : 2, v0); seg->setVertex (1, v1); @@ -532,7 +532,7 @@ v0.setZ (v0.z() * num); } - LDCondLinePtr line = (LDSpawn<LDCondLine>()); + LDCondLine* line = (LDSpawn<LDCondLine>()); line->setColor (EdgeColor()); line->setVertex (0, v0); line->setVertex (1, v1); @@ -590,7 +590,7 @@ // ============================================================================= // -LDDocumentPtr GeneratePrimitive (PrimitiveType type, int segs, int divs, int num) +LDDocument* GeneratePrimitive (PrimitiveType type, int segs, int divs, int num) { // Make the description QString frac = QString::number ((float) segs / divs); @@ -616,7 +616,7 @@ if (divs == HighResolution) descr.insert (0, "Hi-Res "); - LDDocumentPtr f = LDDocument::createNew(); + LDDocument* f = LDDocument::createNew(); f->setDefaultName (name); QString author = APPNAME; @@ -650,10 +650,10 @@ // ============================================================================= // -LDDocumentPtr GetPrimitive (PrimitiveType type, int segs, int divs, int num) +LDDocument* GetPrimitive (PrimitiveType type, int segs, int divs, int num) { QString name = MakeRadialFileName (type, segs, divs, num); - LDDocumentPtr f = GetDocument (name); + LDDocument* f = GetDocument (name); if (f != null) return f; @@ -709,7 +709,7 @@ dlg->ui->rb_ndisc->isChecked() ? DiscNeg : dlg->ui->rb_ring->isChecked() ? Ring : Cone; - LDDocumentPtr f = GeneratePrimitive (type, segs, divs, num); + LDDocument* f = GeneratePrimitive (type, segs, divs, num); f->setImplicit (false); g_win->save (f, false); }
--- a/src/primitives.h Sat Aug 22 15:37:02 2015 +0300 +++ b/src/primitives.h Sat Aug 22 15:58:50 2015 +0300 @@ -118,10 +118,10 @@ }; void MakeCircle (int segs, int divs, double radius, QList<QLineF>& lines); -LDDocumentPtr GeneratePrimitive (PrimitiveType type, int segs, int divs, int num); +LDDocument* GeneratePrimitive (PrimitiveType type, int segs, int divs, int num); // Gets a primitive by the given specs. If the primitive cannot be found, it will // be automatically generated. -LDDocumentPtr GetPrimitive (PrimitiveType type, int segs, int divs, int num); +LDDocument* GetPrimitive (PrimitiveType type, int segs, int divs, int num); QString MakeRadialFileName (PrimitiveType type, int segs, int divs, int num);