Sun, 06 Sep 2015 03:10:03 +0300
null -> nullptr
--- a/src/addObjectDialog.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/addObjectDialog.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -95,7 +95,7 @@ coordCount = 3; tw_subfileList = new QTreeWidget(); tw_subfileList->setHeaderLabel (tr ("Primitives")); - PopulatePrimitives (tw_subfileList, (obj != null ? static_cast<LDSubfile*> (obj)->fileInfo()->name() : "")); + PopulatePrimitives (tw_subfileList, (obj != nullptr ? static_cast<LDSubfile*> (obj)->fileInfo()->name() : "")); connect (tw_subfileList, SIGNAL (itemSelectionChanged()), this, SLOT (slot_subfileTypeChanged())); lb_subfileName = new QLabel ("File:"); @@ -124,7 +124,7 @@ // Show a color edit dialog for the types that actually use the color if (defaults->isColored()) { - if (obj != null) + if (obj != nullptr) m_color = obj->color(); else m_color = (type == OBJ_CondLine or type == OBJ_Line) ? EdgeColor : MainColor; @@ -152,7 +152,7 @@ case OBJ_Triangle: case OBJ_Quad: // Apply coordinates - if (obj != null) + if (obj != nullptr) { for (int i = 0; i < coordCount / 3; ++i) { @@ -190,7 +190,7 @@ // le_matrix->setValidator (new QDoubleValidator); Matrix defaultMatrix = IdentityMatrix; - if (mo != null) + if (mo != nullptr) { mo->position().apply ([&](Axis ax, double value) { @@ -244,7 +244,7 @@ { SubfileListItem* item = static_cast<SubfileListItem*> (tw_subfileList->currentItem()); - if (item->primitive() == null) + if (item->primitive() == nullptr) return ""; // selected a heading return item->primitive()->name; @@ -273,7 +273,7 @@ template<typename T> static T* InitObject (LDObject*& obj) { - if (obj == null) + if (obj == nullptr) obj = new T; return static_cast<T*> (obj); @@ -292,7 +292,7 @@ if (type == OBJ_Empty) return; // Nothing to edit with empties - const bool newObject = (obj == null); + const bool newObject = (obj == nullptr); Matrix transform = IdentityMatrix; AddObjectDialog dlg (type, obj);
--- a/src/addObjectDialog.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/addObjectDialog.h Sun Sep 06 03:10:03 2015 +0300 @@ -34,7 +34,7 @@ Q_OBJECT public: - AddObjectDialog (const LDObjectType type, LDObject* obj, QWidget* parent = null); + AddObjectDialog (const LDObjectType type, LDObject* obj, QWidget* parent = nullptr); static void staticDialog (const LDObjectType type, LDObject* obj); QLabel* lb_typeIcon;
--- a/src/crashCatcher.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/crashCatcher.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -108,7 +108,7 @@ for (int sig : signalsToCatch) { - if (sigaction (sig, &sighandler, null) == -1) + if (sigaction (sig, &sighandler, nullptr) == -1) fprint (stderr, "Couldn't set signal handler %1: %2", sig, strerror (errno)); }
--- a/src/dialogs.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/dialogs.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -88,7 +88,7 @@ LDGLOverlay& info = g_win->renderer()->getOverlay (newcam); RadioDefault<int> (newcam, m_cameraArgs); - if (info.img != null) + if (info.img != nullptr) { ui->filename->setText (info.fname); ui->originX->setValue (info.ox); @@ -140,7 +140,7 @@ void OverlayDialog::slot_fpath() { - ui->filename->setText (QFileDialog::getOpenFileName (null, "Overlay image")); + ui->filename->setText (QFileDialog::getOpenFileName (nullptr, "Overlay image")); } void OverlayDialog::slot_help() @@ -178,7 +178,7 @@ // ============================================================================= void ExtProgPathPrompt::findPath() { - QString path = QFileDialog::getOpenFileName (null, "", "", g_extProgPathFilter); + QString path = QFileDialog::getOpenFileName (nullptr, "", "", g_extProgPathFilter); if (not path.isEmpty()) ui->m_path->setText (path);
--- a/src/dialogs.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/dialogs.h Sun Sep 06 03:10:03 2015 +0300 @@ -43,7 +43,7 @@ Q_OBJECT public: - explicit OverlayDialog (QWidget* parent = null, Qt::WindowFlags f = 0); + explicit OverlayDialog (QWidget* parent = nullptr, Qt::WindowFlags f = 0); virtual ~OverlayDialog(); QString fpath() const; @@ -87,7 +87,7 @@ Q_OBJECT public: - AboutDialog (QWidget* parent = null, Qt::WindowFlags f = 0); + AboutDialog (QWidget* parent = nullptr, Qt::WindowFlags f = 0); private slots: void slot_mail();
--- a/src/dialogs/colorselector.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/dialogs/colorselector.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -108,7 +108,7 @@ auto it = m_buttonsReversed.find (button); LDColor color; - if (Q_UNLIKELY (button == null or it == m_buttonsReversed.end() + if (Q_UNLIKELY (button == nullptr or it == m_buttonsReversed.end() or not (color = *it).isValid())) { print ("colorButtonClicked() called with invalid sender");
--- a/src/dialogs/configdialog.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/dialogs/configdialog.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -66,27 +66,27 @@ QCheckBox* checkbox; QPushButton* button; - if ((le = qobject_cast<QLineEdit*> (widget)) != null) + if ((le = qobject_cast<QLineEdit*> (widget)) != nullptr) { le->setText (value.toString()); } - else if ((spinbox = qobject_cast<QSpinBox*> (widget)) != null) + else if ((spinbox = qobject_cast<QSpinBox*> (widget)) != nullptr) { spinbox->setValue (value.toInt()); } - else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)) != null) + else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)) != nullptr) { doublespinbox->setValue (value.toDouble()); } - else if ((slider = qobject_cast<QSlider*> (widget)) != null) + else if ((slider = qobject_cast<QSlider*> (widget)) != nullptr) { slider->setValue (value.toInt()); } - else if ((checkbox = qobject_cast<QCheckBox*> (widget)) != null) + else if ((checkbox = qobject_cast<QCheckBox*> (widget)) != nullptr) { checkbox->setChecked (value.toBool()); } - else if ((button = qobject_cast<QPushButton*> (widget)) != null) + else if ((button = qobject_cast<QPushButton*> (widget)) != nullptr) { setButtonBackground (button, value.toString()); connect (button, SIGNAL (clicked()), this, SLOT (setButtonColor())); @@ -230,17 +230,17 @@ QCheckBox* checkbox; QPushButton* button; - if ((le = qobject_cast<QLineEdit*> (widget)) != null) + if ((le = qobject_cast<QLineEdit*> (widget)) != nullptr) value = le->text(); - else if ((spinbox = qobject_cast<QSpinBox*> (widget)) != null) + else if ((spinbox = qobject_cast<QSpinBox*> (widget)) != nullptr) value = spinbox->value(); - else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)) != null) + else if ((doublespinbox = qobject_cast<QDoubleSpinBox*> (widget)) != nullptr) value = doublespinbox->value(); - else if ((slider = qobject_cast<QSlider*> (widget)) != null) + else if ((slider = qobject_cast<QSlider*> (widget)) != nullptr) value = slider->value(); - else if ((checkbox = qobject_cast<QCheckBox*> (widget)) != null) + else if ((checkbox = qobject_cast<QCheckBox*> (widget)) != nullptr) value = checkbox->isChecked(); - else if ((button = qobject_cast<QPushButton*> (widget)) != null) + else if ((button = qobject_cast<QPushButton*> (widget)) != nullptr) value = m_buttonColors[button]; else { @@ -356,8 +356,8 @@ // void ConfigDialog::slot_setColor() { - LDQuickColor* entry = null; - QListWidgetItem* item = null; + LDQuickColor* entry = nullptr; + QListWidgetItem* item = nullptr; const bool isNew = static_cast<QPushButton*> (sender()) == ui.quickColor_add; if (not isNew) @@ -380,13 +380,13 @@ if (not ColorSelector::selectColor (this, value, defaultValue)) return; - if (entry != null) + if (entry != nullptr) { entry->setColor (value); } else { - LDQuickColor newentry (value, null); + LDQuickColor newentry (value, nullptr); item = getSelectedQuickColor(); int idx = (item) ? getItemRow (item, quickColorItems) + 1 : quickColorItems.size(); quickColors.insert (idx, newentry); @@ -456,7 +456,7 @@ { QPushButton* button = qobject_cast<QPushButton*> (sender()); - if (button == null) + if (button == nullptr) { print ("setButtonColor: null sender!\n"); return; @@ -507,7 +507,7 @@ QListWidgetItem* ConfigDialog::getSelectedQuickColor() { if (ui.quickColorList->selectedItems().isEmpty()) - return null; + return nullptr; return ui.quickColorList->selectedItems() [0]; }
--- a/src/dialogs/configdialog.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/dialogs/configdialog.h Sun Sep 06 03:10:03 2015 +0300 @@ -31,7 +31,7 @@ PROPERTY (public, QKeySequence, sequence, setSequence, STOCK_WRITE) public: - explicit ShortcutListItem (QListWidget* view = null, int type = Type) : + explicit ShortcutListItem (QListWidget* view = nullptr, int type = Type) : QListWidgetItem (view, type) {} }; @@ -75,7 +75,7 @@ void applySettings(); void addShortcut (QAction* act); void setButtonBackground (QPushButton* button, QString value); - void updateQuickColorList (LDQuickColor* sel = null); + void updateQuickColorList (LDQuickColor* sel = nullptr); void setShortcutText (ShortcutListItem* item); int getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack); QString quickColorString(); @@ -107,8 +107,8 @@ Q_OBJECT public: - explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = null, Qt::WindowFlags f = 0); - static bool staticDialog (ShortcutListItem* item, QWidget* parent = null); + explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = nullptr, Qt::WindowFlags f = 0); + static bool staticDialog (ShortcutListItem* item, QWidget* parent = nullptr); QLabel* lb_output; QDialogButtonBox* bbx_buttons;
--- a/src/dialogs/ldrawpathdialog.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/dialogs/ldrawpathdialog.h Sun Sep 06 03:10:03 2015 +0300 @@ -25,7 +25,7 @@ Q_OBJECT public: - LDrawPathDialog (const QString& defaultPath, bool validDefault, QWidget* parent = null, Qt::WindowFlags f = 0); + LDrawPathDialog (const QString& defaultPath, bool validDefault, QWidget* parent = nullptr, Qt::WindowFlags f = 0); virtual ~LDrawPathDialog(); QString path() const; void setPath (QString path);
--- a/src/documentation.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/documentation.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -28,7 +28,7 @@ class DocumentViewer : public QDialog { public: - explicit DocumentViewer (QWidget* parent = null, Qt::WindowFlags f = 0) : QDialog (parent, f) + explicit DocumentViewer (QWidget* parent = nullptr, Qt::WindowFlags f = 0) : QDialog (parent, f) { te_text = new QTextEdit (this); te_text->setMinimumSize (QSize (400, 300));
--- a/src/documentloader.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/documentloader.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -87,7 +87,7 @@ connect (m_progressDialog, SIGNAL (rejected()), this, SLOT (abort())); } else - m_progressDialog = null; + m_progressDialog = nullptr; // Begin working work (0);
--- a/src/editmodes/abstractEditMode.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/editmodes/abstractEditMode.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -95,7 +95,7 @@ { // Find the closest vertex to our cursor double minimumDistance = 1024.0; - const Vertex* closest = null; + const Vertex* closest = nullptr; Vertex cursorPosition = renderer()->coordconv2_3 (data.ev->pos(), false); QPoint cursorPosition2D (data.ev->pos()); const Axis relZ = renderer()->getRelativeZ(); @@ -137,7 +137,7 @@ } } - if (closest != null) + if (closest != nullptr) addDrawnVertex (*closest); return true;
--- a/src/editmodes/circleMode.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/editmodes/circleMode.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -159,7 +159,7 @@ } } - if (circleOrDisc and refFile != null) + if (circleOrDisc and refFile != nullptr) { LDSubfile* ref = LDSpawn<LDSubfile>(); ref->setFileInfo (refFile);
--- a/src/editmodes/magicWandMode.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/editmodes/magicWandMode.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -73,7 +73,7 @@ void MagicWandMode::doMagic (LDObject* obj, MagicWandMode::MagicType type) { - if (obj == null) + if (obj == nullptr) { if (type == Set) {
--- a/src/editmodes/selectMode.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/editmodes/selectMode.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -120,7 +120,7 @@ renderer()->document()->clearSelection(); LDObject* obj = renderer()->pickOneObject (ev->x(), ev->y()); - if (obj != null) + if (obj != nullptr) { AddObjectDialog::staticDialog (obj->type(), obj); m_window->endAction();
--- a/src/glCompiler.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/glCompiler.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -101,8 +101,8 @@ glDeleteBuffers (g_numVBOs, &m_vbo[0]); CHECK_GL_ERROR(); - if (m_renderer != null) - m_renderer->setCompiler (null); + if (m_renderer != nullptr) + m_renderer->setCompiler (nullptr); } // ============================================================================= @@ -248,7 +248,7 @@ // void GLCompiler::compileDocument (LDDocument* doc) { - if (doc != null) + if (doc != nullptr) { for (LDObject* obj : doc->objects()) compileObject (obj); @@ -279,7 +279,7 @@ for (auto it = m_objectInfo.begin(); it != m_objectInfo.end();) { - if (it.key() == null) + if (it.key() == nullptr) { it = m_objectInfo.erase (it); continue; @@ -316,7 +316,7 @@ { // print ("Compile %1\n", g_objectOrigins[obj]); - if (obj == null or obj->document() == null or obj->document()->isCache()) + if (obj == nullptr or obj->document() == nullptr or obj->document()->isCache()) return; ObjectVBOInfo info;
--- a/src/glRenderer.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/glRenderer.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -111,7 +111,7 @@ m_compiler = new GLCompiler (this); m_objectAtCursor = nullptr; setDrawOnly (false); - setMessageLog (null); + setMessageLog (nullptr); m_width = m_height = -1; m_position3D = Origin; m_toolTipTimer = new QTimer (this); @@ -145,9 +145,9 @@ delete info.img; if (messageLog()) - messageLog()->setRenderer (null); + messageLog()->setRenderer (nullptr); - m_compiler->setRenderer (null); + m_compiler->setRenderer (nullptr); delete m_compiler; delete m_editmode; @@ -212,7 +212,7 @@ // void GLRenderer::needZoomToFit() { - if (document() != null) + if (document() != nullptr) currentDocumentData().needZoomToFit = true; } @@ -367,7 +367,7 @@ // void GLRenderer::drawGLScene() { - if (document() == null) + if (document() == nullptr) return; if (currentDocumentData().needZoomToFit) @@ -497,10 +497,10 @@ if (count > 0) { glBindBuffer (GL_ARRAY_BUFFER, surfacevbo); - glVertexPointer (3, GL_FLOAT, 0, null); + glVertexPointer (3, GL_FLOAT, 0, nullptr); CHECK_GL_ERROR(); glBindBuffer (GL_ARRAY_BUFFER, colorvbo); - glColorPointer (4, GL_FLOAT, 0, null); + glColorPointer (4, GL_FLOAT, 0, nullptr); CHECK_GL_ERROR(); glDrawArrays (type, 0, count); CHECK_GL_ERROR(); @@ -625,7 +625,7 @@ // Paint the overlay image if we have one const LDGLOverlay& overlay = currentDocumentData().overlays[camera()]; - if (overlay.img != null) + if (overlay.img != nullptr) { QPoint v0 = coordconv3_2 (currentDocumentData().overlays[camera()].v0), v1 = coordconv3_2 (currentDocumentData().overlays[camera()].v1); @@ -969,7 +969,7 @@ { LDObject* obj = LDObject::fromID (idx); - if (obj == null) + if (obj == nullptr) continue; // If this is an additive single pick and the object is currently selected, @@ -1023,7 +1023,7 @@ // void GLRenderer::setEditMode (EditModeType a) { - if (m_editmode != null and m_editmode->type() == a) + if (m_editmode != nullptr and m_editmode->type() == a) return; delete m_editmode; @@ -1050,7 +1050,7 @@ { m_document = a; - if (a != null) + if (a != nullptr) { initOverlaysFromObjects(); @@ -1255,7 +1255,7 @@ LDGLOverlay& info = currentDocumentData().overlays[camera()]; delete info.img; - info.img = null; + info.img = nullptr; updateOverlayObjects(); } @@ -1305,7 +1305,7 @@ { zoom() = 30.0f; - if (document() == null or m_width == -1 or m_height == -1) + if (document() == nullptr or m_width == -1 or m_height == -1) return; bool lastfilled = false; @@ -1433,13 +1433,13 @@ LDGLOverlay& meta = currentDocumentData().overlays[cam]; LDOverlay* ovlobj = findOverlayObject (cam); - if (ovlobj == null and meta.img != null) + if (ovlobj == nullptr and meta.img != nullptr) { delete meta.img; - meta.img = null; + meta.img = nullptr; } - else if (ovlobj != null and - (meta.img == null or meta.fname != ovlobj->fileName()) and + else if (ovlobj != nullptr and + (meta.img == nullptr or meta.fname != ovlobj->fileName()) and not meta.invalid) { setupOverlay (cam, ovlobj->fileName(), ovlobj->x(), @@ -1460,7 +1460,7 @@ LDGLOverlay& meta = currentDocumentData().overlays[cam]; LDOverlay* ovlobj = findOverlayObject (cam); - if (meta.img == null and ovlobj != null) + if (meta.img == nullptr and ovlobj != nullptr) { // If this is the last overlay image, we need to remove the empty space after it as well. LDObject* nextobj = ovlobj->next(); @@ -1472,7 +1472,7 @@ // not, remove the object. ovlobj->destroy(); } - else if (meta.img != null and ovlobj == null) + else if (meta.img != nullptr and ovlobj == nullptr) { // Inverse case: image is there but the overlay object is // not, thus create the object. @@ -1512,7 +1512,7 @@ } } - if (meta.img != null and ovlobj != null) + if (meta.img != nullptr and ovlobj != nullptr) { ovlobj->setCamera (cam); ovlobj->setFileName (meta.fname); @@ -1531,7 +1531,7 @@ // void GLRenderer::highlightCursorObject() { - if (not m_config->highlightObjectBelowCursor() and objectAtCursor() == null) + if (not m_config->highlightObjectBelowCursor() and objectAtCursor() == nullptr) return; LDObject* newObject = nullptr; @@ -1553,17 +1553,17 @@ newIndex = pixel[0] * 0x10000 | pixel[1] * 0x100 | pixel[2]; } - if (newIndex != (oldObject != null ? oldObject->id() : 0)) + if (newIndex != (oldObject != nullptr ? oldObject->id() : 0)) { if (newIndex != 0) newObject = LDObject::fromID (newIndex); setObjectAtCursor (newObject); - if (oldObject != null) + if (oldObject != nullptr) compileObject (oldObject); - if (newObject != null) + if (newObject != nullptr) compileObject (newObject); } @@ -1572,13 +1572,13 @@ void GLRenderer::dragEnterEvent (QDragEnterEvent* ev) { - if (m_window != null and ev->source() == m_window->getPrimitivesTree() and m_window->getPrimitivesTree()->currentItem() != null) + if (m_window != nullptr and ev->source() == m_window->getPrimitivesTree() and m_window->getPrimitivesTree()->currentItem() != nullptr) ev->acceptProposedAction(); } void GLRenderer::dropEvent (QDropEvent* ev) { - if (m_window != null and ev->source() == m_window->getPrimitivesTree()) + if (m_window != nullptr and ev->source() == m_window->getPrimitivesTree()) { QString primName = static_cast<SubfileListItem*> (m_window->getPrimitivesTree()->currentItem())->primitive()->name; LDSubfile* ref = LDSpawn<LDSubfile>();
--- a/src/glRenderer.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/glRenderer.h Sun Sep 06 03:10:03 2015 +0300 @@ -88,7 +88,7 @@ { if (i < 6) { - overlays[i].img = null; + overlays[i].img = nullptr; overlays[i].invalid = false; depthValues[i] = 0.0f; } @@ -148,7 +148,7 @@ PROPERTY (private, bool, isCameraMoving, setCameraMoving, STOCK_WRITE) public: - GLRenderer (QWidget* parent = null); + GLRenderer (QWidget* parent = nullptr); ~GLRenderer(); inline ECamera camera() const;
--- a/src/ldDocument.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/ldDocument.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -311,11 +311,11 @@ print ("Opening %1...\n", relpath); QString path = FindDocumentPath (relpath, subdirs); - if (pathpointer != null) + if (pathpointer != nullptr) *pathpointer = path; if (path.isEmpty()) - return null; + return nullptr; QFile* fp = new QFile (path); @@ -323,7 +323,7 @@ return fp; fp->deleteLater(); - return null; + return nullptr; } // ============================================================================= @@ -384,7 +384,7 @@ if (not fp) return nullptr; - LDDocument* load = (fileToOverride != null ? fileToOverride : g_win->newDocument (implicit)); + LDDocument* load = (fileToOverride != nullptr ? fileToOverride : g_win->newDocument (implicit)); load->setFullPath (fullpath); load->setName (LDDocument::shortenName (load->fullPath())); @@ -533,14 +533,14 @@ // We cannot open this file if the document this would replace is not // safe to close. - if (documentToReplace != null and not documentToReplace->isSafeToClose()) + if (documentToReplace != nullptr and not documentToReplace->isSafeToClose()) return; g_loadingMainFile = true; // If we're replacing an existing document, clear the document and // make it ready for being loaded to. - if (documentToReplace != null) + if (documentToReplace != nullptr) { file = documentToReplace; file->clear(); @@ -549,7 +549,7 @@ bool aborted; file = OpenDocument (path, false, false, file, &aborted); - if (file == null) + if (file == nullptr) { if (not aborted) { @@ -613,7 +613,7 @@ // If the second object in the list holds the file name, update that now. LDObject* nameObject = getObject (1); - if (nameObject != null and nameObject->type() == OBJ_Comment) + if (nameObject != nullptr and nameObject->type() == OBJ_Comment) { LDComment* nameComment = static_cast<LDComment*> (nameObject); @@ -627,7 +627,7 @@ QByteArray data; - if (sizeptr != null) + if (sizeptr != nullptr) *sizeptr = 0; // File is open, now save the model to it. Note that LDraw requires files to have DOS line endings. @@ -636,7 +636,7 @@ QByteArray subdata ((obj->asText() + "\r\n").toUtf8()); data.append (subdata); - if (sizeptr != null) + if (sizeptr != nullptr) *sizeptr += subdata.size(); } @@ -715,7 +715,7 @@ return v; } -static int32 StringToNumber (QString a, bool* ok = null) +static int32 StringToNumber (QString a, bool* ok = nullptr) { int base = 10; @@ -933,7 +933,7 @@ LDSubfile* ref = static_cast<LDSubfile*> (obj); LDDocument* fileInfo = GetDocument (ref->fileInfo()->name()); - if (fileInfo != null) + if (fileInfo != nullptr) { ref->setFileInfo (fileInfo); } @@ -974,7 +974,7 @@ { for (LDObject* obj : objs) { - if (obj != null) + if (obj != nullptr) addObject (obj); } } @@ -1126,7 +1126,7 @@ LDPolygon* data = obj->getPolygon(); - if (data != null) + if (data != nullptr) { m_polygonData << *data; delete data; @@ -1184,9 +1184,9 @@ // Ensure logoed studs are loaded first LoadLogoStuds(); - if (name() == "stud.dat" and g_logoedStud != null) + if (name() == "stud.dat" and g_logoedStud != nullptr) return g_logoedStud->inlineContents (deep, renderinline); - else if (name() == "stud2.dat" and g_logoedStud2 != null) + else if (name() == "stud2.dat" and g_logoedStud2 != nullptr) return g_logoedStud2->inlineContents (deep, renderinline); }
--- a/src/ldDocument.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/ldDocument.h Sun Sep 06 03:10:03 2015 +0300 @@ -83,7 +83,7 @@ void redoVertices(); void reloadAllSubfiles(); void removeFromSelection (LDObject* obj); - bool save (QString path = "", int64* sizeptr = null); + bool save (QString path = "", int64* sizeptr = nullptr); long savePosition() const; void setDefaultName (QString value); void setFullPath (QString value); @@ -130,7 +130,7 @@ LDDocument* OpenDocument (QString path, bool search, bool implicit, LDDocument* fileToOverride = nullptr, bool* aborted = 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); +QFile* OpenLDrawFile (QString relpath, bool subdirs, QString* pathpointer = nullptr); // Close all open files, whether user-opened or subfile caches. void CloseAllDocuments(); @@ -145,7 +145,7 @@ // Is it safe to close all files? bool IsSafeToCloseAll(); -LDObjectList LoadFileContents (QFile* f, int* numWarnings, bool* ok = null); +LDObjectList LoadFileContents (QFile* f, int* numWarnings, bool* ok = nullptr); const LDObjectList& selectedObjects(); void AddRecentFile (QString path);
--- a/src/ldObject.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/ldObject.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -48,7 +48,7 @@ m_isHidden (false), m_isSelected (false), m_document (nullptr), - qObjListEntry (null), + qObjListEntry (nullptr), m_isDestroyed (false) { if (document) @@ -299,11 +299,11 @@ deselect(); // If this object was associated to a file, remove it off it now - if (document() != null) + if (document() != nullptr) document()->forgetObject (this); // Delete the GL lists - if (g_win != null) + if (g_win != nullptr) g_win->renderer()->forgetObject (this); // Remove this object from the list of LDObjects @@ -321,7 +321,7 @@ { m_document = a; - if (a == null) + if (a == nullptr) setSelected (false); } @@ -391,7 +391,7 @@ : 0; if (num == 0) - return null; + return nullptr; LDPolygon* data = new LDPolygon; data->id = id(); @@ -423,7 +423,7 @@ // ----------------------------------------------------------------------------- long LDObject::lineNumber() const { - if (document() != null) + if (document() != nullptr) { for (int i = 0; i < document()->getObjectCount(); ++i) { @@ -835,7 +835,7 @@ // void LDObject::select() { - if (document() != null) + if (document() != nullptr) document()->addToSelection (this); } @@ -843,7 +843,7 @@ // void LDObject::deselect() { - if (isSelected() and document() != null) + if (isSelected() and document() != nullptr) { document()->removeFromSelection (this); @@ -879,7 +879,7 @@ // If it's an immediate subfile reference (i.e. this subfile belongs in an // explicit file), we need to pre-compile the GL polygons for the document // if they don't exist already. - if (a != null and + if (a != nullptr and a->isCache() == false and a->polygonData().isEmpty()) {
--- a/src/main.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/main.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -33,7 +33,7 @@ #include "crashCatcher.h" #include "ldpaths.h" -MainWindow* g_win = null; +MainWindow* g_win = nullptr; static QString g_versionString, g_fullVersionString; static bool g_IsExiting (false);
--- a/src/main.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/main.h Sun Sep 06 03:10:03 2015 +0300 @@ -32,8 +32,5 @@ #include "format.h" #include "hierarchyelement.h" -// Null pointer -static const std::nullptr_t null = nullptr; - bool IsExiting(); void Exit();
--- a/src/mainwindow.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/mainwindow.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -91,7 +91,7 @@ connect (m_tabs, SIGNAL (currentChanged(int)), this, SLOT (tabSelected())); connect (m_tabs, SIGNAL (tabCloseRequested (int)), this, SLOT (closeTab (int))); - if (ActivePrimitiveScanner() != null) + if (ActivePrimitiveScanner() != nullptr) connect (ActivePrimitiveScanner(), SIGNAL (workDone()), this, SLOT (updatePrimitives())); else updatePrimitives(); @@ -164,7 +164,7 @@ { QToolBar* toolbar = findChild<QToolBar*> (toolbarname.toString()); - if (toolbar != null) + if (toolbar != nullptr) toolbar->hide(); } @@ -183,7 +183,7 @@ MainWindow::~MainWindow() { - g_win = null; + g_win = nullptr; } // --------------------------------------------------------------------------------------------------------------------- @@ -235,7 +235,7 @@ m_recentFiles.clear(); - QAction* first = null; + QAction* first = nullptr; for (const QVariant& it : m_configOptions.recentFiles()) { @@ -264,7 +264,7 @@ LDColor color = colorname.toInt(); if (color.isValid()) - colors << LDQuickColor (color, null); + colors << LDQuickColor (color, nullptr); } } @@ -514,7 +514,7 @@ // void MainWindow::selectionChanged() { - if (g_isSelectionLocked == true or m_currentDocument == null) + if (g_isSelectionLocked == true or m_currentDocument == nullptr) return; LDObjectList priorSelection = selectedObjects(); @@ -632,7 +632,7 @@ for (LDObject* obj : selectedObjects()) { - if (obj->qObjListEntry == null) + if (obj->qObjListEntry == nullptr) continue; int row = ui.objectList->row (obj->qObjListEntry); @@ -1031,7 +1031,7 @@ // void MainWindow::updateActions() { - if (m_currentDocument != null and m_currentDocument->history() != null) + if (m_currentDocument != nullptr and m_currentDocument->history() != nullptr) { EditHistory* his = m_currentDocument->history(); int pos = his->position(); @@ -1077,7 +1077,7 @@ { LDDocument* doc = FindDocument (m_tabs->tabData (tabindex).toString()); - if (doc == null) + if (doc == nullptr) return; doc->close(); @@ -1258,7 +1258,7 @@ void MainWindow::changeDocument (LDDocument* document) { // Implicit files were loaded for caching purposes and may never be switched to. - if (document != null and document->isCache()) + if (document != nullptr and document->isCache()) return; m_currentDocument = document; @@ -1348,7 +1348,7 @@ // LDQuickColor LDQuickColor::getSeparator() { - return LDQuickColor (LDColor::nullColor(), null); + return LDQuickColor (LDColor::nullColor(), nullptr); } // --------------------------------------------------------------------------------------------------------------------- @@ -1366,7 +1366,7 @@ for (PrimitiveCategory* cat : g_PrimitiveCategories) { - SubfileListItem* parentItem = new SubfileListItem (tw, null); + SubfileListItem* parentItem = new SubfileListItem (tw, nullptr); parentItem->setText (0, cat->name()); QList<QTreeWidgetItem*> subfileItems;
--- a/src/mainwindow.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/mainwindow.h Sun Sep 06 03:10:03 2015 +0300 @@ -65,7 +65,7 @@ Q_OBJECT public: - explicit MainWindow (QWidget* parent = null, Qt::WindowFlags flags = 0); + explicit MainWindow (QWidget* parent = nullptr, Qt::WindowFlags flags = 0); ~MainWindow(); void addMessage (QString msg);
--- a/src/messageLog.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/messageLog.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -127,7 +127,7 @@ { for (QString& a : msg.split ("\n", QString::SkipEmptyParts)) { - if (g_win != null) + if (g_win != nullptr) g_win->addMessage (a); // Also print it to stdout
--- a/src/messageLog.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/messageLog.h Sun Sep 06 03:10:03 2015 +0300 @@ -63,7 +63,7 @@ }; // Constructs the message manager. - explicit MessageManager (QObject* parent = null); + explicit MessageManager (QObject* parent = nullptr); // Adds a line with the given \c text to the message manager. void addLine (QString line);
--- a/src/partDownloader.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/partDownloader.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -322,7 +322,7 @@ m_requests.clear(); // Update everything now - if (primaryFile() != null) + if (primaryFile() != nullptr) { g_win->changeDocument (primaryFile()); g_win->doFullRefresh(); @@ -361,7 +361,7 @@ return qobject_cast<QPushButton*> (form()->buttonBox->button (QDialogButtonBox::Close)); } - return null; + return nullptr; } // ============================================================================= @@ -376,7 +376,7 @@ m_networkManager (new QNetworkAccessManager), m_isFirstUpdate (true), m_isPrimary (primary), - m_filePointer (null) + m_filePointer (nullptr) { // Make sure that we have a valid destination. QString dirpath = Dirname (filePath()); @@ -480,7 +480,7 @@ { filePointer()->close(); delete filePointer(); - setFilePointer (null); + setFilePointer (nullptr); if (state() == State::Failed) QFile::remove (filePath()); @@ -495,7 +495,7 @@ // Try to load this file now. LDDocument* f = OpenDocument (filePath(), false, not isPrimary()); - if (f == null) + if (f == nullptr) return; // Iterate through this file and check for errors. If there's any that stems @@ -506,7 +506,7 @@ { LDError* err = dynamic_cast<LDError*> (obj); - if (err == null or err->fileReferenced().isEmpty()) + if (err == nullptr or err->fileReferenced().isEmpty()) continue; QString dest = err->fileReferenced(); @@ -548,7 +548,7 @@ if (state() == State::Failed) return; - if (filePointer() == null) + if (filePointer() == nullptr) { m_filePath.replace ("\\", "/");
--- a/src/partDownloader.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/partDownloader.h Sun Sep 06 03:10:03 2015 +0300 @@ -66,7 +66,7 @@ PROPERTY (private, QPushButton*, downloadButton, setDownloadButton, STOCK_WRITE) public: - explicit PartDownloader (QWidget* parent = null); + explicit PartDownloader (QWidget* parent = nullptr); virtual ~PartDownloader(); void addFile (LDDocument* f);
--- a/src/primitives.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/primitives.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -29,8 +29,8 @@ QList<PrimitiveCategory*> g_PrimitiveCategories; QList<Primitive> g_primitives; -static PrimitiveScanner* g_activeScanner = null; -PrimitiveCategory* g_unmatched = null; +static PrimitiveScanner* g_activeScanner = nullptr; +PrimitiveCategory* g_unmatched = nullptr; static const QStringList g_radialNameRoots = { @@ -125,7 +125,7 @@ // PrimitiveScanner::~PrimitiveScanner() { - g_activeScanner = null; + g_activeScanner = nullptr; } // ============================================================================= @@ -145,7 +145,7 @@ Primitive info; info.name = fname.mid (m_baselen + 1); // make full path relative info.name.replace ('/', '\\'); // use DOS backslashes, they're expected - info.category = null; + info.category = nullptr; QByteArray titledata = f.readLine(); if (titledata != QByteArray()) @@ -182,7 +182,7 @@ g_primitives = m_prims; PrimitiveCategory::populateCategories(); print ("%1 primitives scanned", g_primitives.size()); - g_activeScanner = null; + g_activeScanner = nullptr; emit workDone(); deleteLater(); } @@ -224,7 +224,7 @@ for (Primitive& prim : g_primitives) { bool matched = false; - prim.category = null; + prim.category = nullptr; // Go over the categories and their regexes, if and when there's a match, // the primitive's category is set to the category the regex beloings to. @@ -255,13 +255,13 @@ } // Drop out if a category was decided on. - if (prim.category != null) + if (prim.category != nullptr) break; } // If there was a match, add the primitive to the category. // Otherwise, add it to the list of unmatched primitives. - if (prim.category != null) + if (prim.category != nullptr) prim.category->prims << prim; else g_unmatched->prims << prim; @@ -293,7 +293,7 @@ return; } - PrimitiveCategory* cat = null; + PrimitiveCategory* cat = nullptr; while (not f.atEnd()) { @@ -313,7 +313,7 @@ cat = new PrimitiveCategory (line); } - else if (cat != null) + else if (cat != nullptr) { QString cmd = line.left (colon); RegexType type = EFilenameRegex; @@ -365,7 +365,7 @@ // bool IsPrimitiveLoaderBusy() { - return g_activeScanner != null; + return g_activeScanner != nullptr; } // ============================================================================= @@ -652,7 +652,7 @@ QString name = MakeRadialFileName (type, segs, divs, num); LDDocument* f = GetDocument (name); - if (f != null) + if (f != nullptr) return f; return GeneratePrimitive (type, segs, divs, num);
--- a/src/primitives.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/primitives.h Sun Sep 06 03:10:03 2015 +0300 @@ -109,7 +109,7 @@ Q_OBJECT public: - explicit PrimitivePrompt (QWidget* parent = null, Qt::WindowFlags f = 0); + explicit PrimitivePrompt (QWidget* parent = nullptr, Qt::WindowFlags f = 0); virtual ~PrimitivePrompt(); Ui_MakePrimUI* ui;
--- a/src/radioGroup.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/radioGroup.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -57,7 +57,7 @@ m_buttonGroup = new QButtonGroup; m_oldId = m_curId = 0; - m_coreLayout = null; + m_coreLayout = nullptr; m_coreLayout = new QBoxLayout ( (orient == Qt::Vertical) ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom); setLayout (m_coreLayout);
--- a/src/radioGroup.h Sun Sep 06 03:00:28 2015 +0300 +++ b/src/radioGroup.h Sun Sep 06 03:10:03 2015 +0300 @@ -44,14 +44,14 @@ init (Qt::Vertical); } - explicit RadioGroup (QWidget* parent = null) : QGroupBox (parent) + explicit RadioGroup (QWidget* parent = nullptr) : QGroupBox (parent) { init (Qt::Vertical); } - explicit RadioGroup (const QString& title, QWidget* parent = null); + explicit RadioGroup (const QString& title, QWidget* parent = nullptr); explicit RadioGroup (const QString& title, QList<char const*> entries, int const defaultId, - const Qt::Orientation orient = Qt::Vertical, QWidget* parent = null); + const Qt::Orientation orient = Qt::Vertical, QWidget* parent = nullptr); void addButton (const char* entry); void addButton (QRadioButton* button);
--- a/src/ringFinder.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/ringFinder.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -164,15 +164,15 @@ // Compare the solutions and find the best one. The solution class has an operator> // overload to compare two solutions. - m_bestSolution = null; + m_bestSolution = nullptr; for (Solution const& sol : m_solutions) { - if (m_bestSolution == null or sol.isSuperiorTo (m_bestSolution)) + if (m_bestSolution == nullptr or sol.isSuperiorTo (m_bestSolution)) m_bestSolution = / } - return (m_bestSolution != null); + return (m_bestSolution != nullptr); } //
--- a/src/toolsets/algorithmtoolset.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/toolsets/algorithmtoolset.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -132,7 +132,7 @@ for (int i = 0; i < countof (lines); ++i) { - if (lines[i] == null) + if (lines[i] == nullptr) continue; long idx = obj->lineNumber() + i + 1; @@ -153,7 +153,7 @@ { LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj); - if (mo != null) + if (mo != nullptr) { Vertex v = mo->position(); Matrix t = mo->transform(); @@ -460,7 +460,7 @@ int refidx (selectedObjects()[0]->lineNumber()); // Determine title of subfile - if (titleobj != null) + if (titleobj != nullptr) subtitle = "~" + titleobj->text(); else subtitle = "~subfile"; @@ -516,7 +516,7 @@ digits.prepend ("0"); fullsubname = subdirname + "/" + Basename (parentpath) + "s" + digits + ".dat"; - } while (FindDocument ("s\\" + Basename (fullsubname)) != null or QFile (fullsubname).exists()); + } while (FindDocument ("s\\" + Basename (fullsubname)) != nullptr or QFile (fullsubname).exists()); } // Determine the BFC winding type used in the main document - it is to
--- a/src/toolsets/extprogramtoolset.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/toolsets/extprogramtoolset.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -315,7 +315,7 @@ return; } - LDObjectList objs = LoadFileContents (&f, null); + LDObjectList objs = LoadFileContents (&f, nullptr); // If we replace the objects, delete the selection now. if (replace)
--- a/src/toolsets/filetoolset.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/toolsets/filetoolset.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -126,7 +126,7 @@ return; } - LDObjectList objs = LoadFileContents (&f, null); + LDObjectList objs = LoadFileContents (&f, nullptr); currentDocument()->clearSelection();
--- a/src/toolsets/viewtoolset.cpp Sun Sep 06 03:00:28 2015 +0300 +++ b/src/toolsets/viewtoolset.cpp Sun Sep 06 03:10:03 2015 +0300 @@ -260,10 +260,10 @@ if (selectedObjects().size() == 1) defval = selectedObjects()[0]->lineNumber(); - int idx = QInputDialog::getInt (null, "Go to line", "Go to line:", defval, + int idx = QInputDialog::getInt (nullptr, "Go to line", "Go to line:", defval, 1, currentDocument()->getObjectCount(), 1, &ok); - if (not ok or (obj = currentDocument()->getObject (idx - 1)) == null) + if (not ok or (obj = currentDocument()->getObject (idx - 1)) == nullptr) return; currentDocument()->clearSelection();