Mon, 14 Apr 2014 16:00:36 +0300
- use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
--- a/src/actions.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/actions.cc Mon Apr 14 16:00:36 2014 +0300 @@ -54,7 +54,7 @@ QString authortext = ld_defaultname; - if (!ld_defaultuser.isEmpty()) + if (not ld_defaultuser.isEmpty()) authortext.append (format (" [%1]", ld_defaultuser)); ui.le_author->setText (authortext); @@ -79,7 +79,7 @@ break; } - if (dlg->exec() == false) + if (dlg->exec() == QDialog::Rejected) return; newFile(); @@ -157,7 +157,7 @@ // DEFINE_ACTION (Close, CTRL (W)) { - if (!getCurrentDocument()->isSafeToClose()) + if (not getCurrentDocument()->isSafeToClose()) return; delete getCurrentDocument(); @@ -167,7 +167,7 @@ // DEFINE_ACTION (CloseAll, 0) { - if (!safeToCloseAll()) + if (not safeToCloseAll()) return; closeAll(); @@ -385,12 +385,12 @@ QString fname = QFileDialog::getOpenFileName(); int idx = getInsertionPoint(); - if (!fname.length()) + if (not fname.length()) return; QFile f (fname); - if (!f.open (QIODevice::ReadOnly)) + if (not f.open (QIODevice::ReadOnly)) { critical (format ("Couldn't open %1 (%2)", fname, f.errorString())); return; @@ -427,7 +427,7 @@ QFile file (fname); - if (!file.open (QIODevice::WriteOnly | QIODevice::Text)) + if (not file.open (QIODevice::WriteOnly | QIODevice::Text)) { critical (format ("Unable to open %1 for writing (%2)", fname, file.errorString())); return; @@ -456,11 +456,11 @@ layout->addWidget (te_edit); layout->addWidget (bbx_buttons); dlg->setLayout (layout); - dlg->setWindowTitle (APPNAME ": Insert Raw"); + dlg->setWindowTitle (APPNAME " - Insert Raw"); dlg->connect (bbx_buttons, SIGNAL (accepted()), dlg, SLOT (accept())); dlg->connect (bbx_buttons, SIGNAL (rejected()), dlg, SLOT (reject())); - if (dlg->exec() == false) + if (dlg->exec() == QDialog::Rejected) return; getCurrentDocument()->clearSelection(); @@ -498,7 +498,7 @@ QString fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname, "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)"); - if (fname.length() > 0 && !img.save (fname)) + if (not fname.isEmpty() && not img.save (fname)) critical (format ("Couldn't open %1 for writing to save screencap: %2", fname, strerror (errno))); delete[] imgdata; @@ -509,7 +509,7 @@ extern_cfg (Bool, gl_axes); DEFINE_ACTION (Axes, 0) { - gl_axes = !gl_axes; + gl_axes = not gl_axes; updateActions(); R()->update(); } @@ -519,7 +519,7 @@ DEFINE_ACTION (VisibilityToggle, 0) { for (LDObject* obj : selection()) - obj->setHidden (!obj->isHidden()); + obj->setHidden (not obj->isHidden()); refresh(); } @@ -547,7 +547,7 @@ // DEFINE_ACTION (Wireframe, 0) { - gl_wireframe = !gl_wireframe; + gl_wireframe = not gl_wireframe; R()->refresh(); } @@ -557,7 +557,7 @@ { OverlayDialog dlg; - if (!dlg.exec()) + if (not dlg.exec()) return; R()->setupOverlay ((GL::EFixedCamera) dlg.camera(), dlg.fpath(), dlg.ofsx(), @@ -596,7 +596,7 @@ // DEFINE_ACTION (DrawAngles, 0) { - gl_drawangles = !gl_drawangles; + gl_drawangles = not gl_drawangles; R()->refresh(); } @@ -625,7 +625,7 @@ LDDocument* file = getFile ("axle.dat"); setlocale (LC_ALL, "C"); - if (!file) + if (not file) { critical ("couldn't load axle.dat"); return; @@ -676,7 +676,7 @@ // DEFINE_ACTION (BFCView, SHIFT (B)) { - gl_colorbfc = !gl_colorbfc; + gl_colorbfc = not gl_colorbfc; updateActions(); R()->refresh(); } @@ -695,7 +695,7 @@ int idx = QInputDialog::getInt (null, "Go to line", "Go to line:", defval, 1, getCurrentDocument()->getObjectCount(), 1, &ok); - if (!ok || (obj = getCurrentDocument()->getObject (idx - 1)) == null) + if (not ok || (obj = getCurrentDocument()->getObject (idx - 1)) == null) return; getCurrentDocument()->clearSelection(); @@ -765,7 +765,7 @@ } // Determine the body of the name of the subfile - if (!parentpath.isEmpty()) + if (not parentpath.isEmpty()) { if (parentpath.endsWith (".dat")) parentpath.chop (4); @@ -799,7 +799,7 @@ { LDBFC* bfc = dynamic_cast<LDBFC*> (obj); - if (!bfc) + if (not bfc) continue; LDBFC::Statement a = bfc->statement();
--- a/src/actionsEdit.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/actionsEdit.cc Mon Apr 14 16:00:36 2014 +0300 @@ -224,7 +224,7 @@ ui.errorIcon->hide(); } - if (!dlg->exec()) + if (not dlg->exec()) return; LDObject* oldobj = obj; @@ -259,7 +259,7 @@ { for (LDObject* obj : objs) { - if (obj->isColored() == false) + if (not obj->isColored()) continue; obj->setColor (colnum); @@ -612,7 +612,7 @@ for (LDObject* obj : selection()) { - if (obj->isColored() == false) + if (not obj->isColored()) continue; int col = maincolor; @@ -637,7 +637,7 @@ Ui::ReplaceCoordsUI ui; ui.setupUi (dlg); - if (!dlg->exec()) + if (not dlg->exec()) return; const double search = ui.search->value(), @@ -664,7 +664,7 @@ if (any || coord == search) { - if (!rel) + if (not rel) coord = 0; coord += replacement; @@ -689,7 +689,7 @@ Ui::FlipUI ui; ui.setupUi (dlg); - if (!dlg->exec()) + if (not dlg->exec()) return; QList<Axis> sel; @@ -764,7 +764,7 @@ for (LDObject* obj : selection()) { - if (obj->isColored() == false) + if (not obj->isColored()) continue; obj->setColor (colnum); @@ -790,7 +790,7 @@ ui->m_date->setDate (QDate::currentDate()); ui->m_comment->setFocus(); - if (!dlg->exec()) + if (not dlg->exec()) return; // Create the comment object based on input @@ -802,18 +802,16 @@ LDComment* comm = new LDComment (commentText); // Find a spot to place the new comment - for ( - obj = getCurrentDocument()->getObject (0); - obj && obj->next() && !obj->next()->isScemantic(); - obj = obj->next() - ) + for (obj = getCurrentDocument()->getObject (0); + obj != null && obj->next() != null && not obj->next()->isScemantic(); + obj = obj->next()) { LDComment* comm = dynamic_cast<LDComment*> (obj); if (comm != null && comm->text().startsWith ("!HISTORY ")) ishistory = true; - if (prevIsHistory && !ishistory) + if (prevIsHistory && not ishistory) { // Last line was history, this isn't, thus insert the new history // line here.
--- a/src/addObjectDialog.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/addObjectDialog.cc Mon Apr 14 16:00:36 2014 +0300 @@ -312,7 +312,8 @@ // ============================================================================= // ============================================================================= -template<class T> static T* initObj (LDObject*& obj) +template<typename T> +static T* initObj (LDObject*& obj) { if (obj == null) obj = new T; @@ -339,7 +340,7 @@ assert (obj == null || obj->type() == type); - if (dlg.exec() == false) + if (dlg.exec() == QDialog::Rejected) return; if (type == LDObject::ESubfile) @@ -372,7 +373,7 @@ case LDObject::EQuad: case LDObject::ECondLine: { - if (!obj) + if (not obj) obj = LDObject::getDefault (type); for (int i = 0; i < obj->vertices(); ++i) @@ -410,7 +411,7 @@ LDDocument* file = getDocument (name); - if (!file) + if (not file) { critical (format ("Couldn't open `%1': %2", name, strerror (errno))); return;
--- a/src/basics.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/basics.cc Mon Apr 14 16:00:36 2014 +0300 @@ -102,7 +102,7 @@ // bool Vertex::operator!= (const Vertex& other) const { - return !operator== (other); + return not operator== (other); } // ============================================================================= @@ -291,7 +291,7 @@ { reset(); - if (!getCurrentDocument()) + if (not getCurrentDocument()) return; for (LDObject* obj : getCurrentDocument()->objects())
--- a/src/colorSelector.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/colorSelector.cc Mon Apr 14 16:00:36 2014 +0300 @@ -43,7 +43,7 @@ ColorSelector::ColorSelector (int defval, QWidget* parent) : QDialog (parent) { // Remove the default color if it's invalid - if (!getColor (defval)) + if (not getColor (defval)) defval = -1; m_firstResize = true; @@ -93,7 +93,7 @@ { LDColor* info = ::getColor (i); - if (!info) + if (not info) continue; const double x = (i % numCols) * square; @@ -141,7 +141,7 @@ // ============================================================================= void ColorSelector::drawColorInfo() { - if (!selection()) + if (not selection()) { ui->colorLabel->setText ("---"); return; @@ -186,7 +186,7 @@ LDColor* col = ::getColor (idx); - if (!col) + if (not col) return; setSelection (col);
--- a/src/configDialog.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/configDialog.cc Mon Apr 14 16:00:36 2014 +0300 @@ -444,11 +444,11 @@ QListWidgetItem* item = null; const bool isNew = static_cast<QPushButton*> (sender()) == ui->quickColor_add; - if (isNew == false) + if (not isNew) { item = getSelectedQuickColor(); - if (!item) + if (not item) return; int i = getItemRow (item, quickColorItems); @@ -461,7 +461,7 @@ int defval = entry ? entry->color()->index : -1; int val; - if (ColorSelector::selectColor (val, defval, this) == false) + if (not ColorSelector::selectColor (val, defval, this)) return; if (entry) @@ -774,7 +774,7 @@ { KeySequenceDialog dlg (cfg->getValue(), parent); - if (dlg.exec() == false) + if (dlg.exec() == QDialog::Rejected) return false; cfg->setValue (dlg.seq);
--- a/src/configuration.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/configuration.cc Mon Apr 14 16:00:36 2014 +0300 @@ -65,7 +65,7 @@ for (Config* cfg : g_configPointers) { - if (!cfg) + if (not cfg) break; QVariant val = settings->value (cfg->name(), cfg->getDefaultAsVariant()); @@ -88,7 +88,7 @@ for (Config* cfg : g_configs) { - if (!cfg->isDefault()) + if (not cfg->isDefault()) settings->setValue (cfg->name(), cfg->toVariant()); else settings->remove (cfg->name());
--- a/src/crashCatcher.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/crashCatcher.cc Mon Apr 14 16:00:36 2014 +0300 @@ -94,7 +94,7 @@ "%2" "<p><b>GDB <tt>stdout</tt>:</b></p><pre>%3</pre>\n" "<p><b>GDB <tt>stderr</tt>:</b></p><pre>%4</pre>", - sig, (!g_assertionFailure.isEmpty()) ? g_assertionFailure : "", output, err)); + sig, (not g_assertionFailure.isEmpty()) ? g_assertionFailure : "", output, err)); } // =============================================================================
--- a/src/dialogs.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/dialogs.cc Mon Apr 14 16:00:36 2014 +0300 @@ -240,7 +240,7 @@ // ============================================================================= void LDrawPathDialog::slot_tryConfigure() { - if (LDPaths::tryConfigure (filename()) == false) + if (not LDPaths::tryConfigure (filename())) { ui->status->setText (format ("<span style=\"color:#700; \">%1</span>", LDPaths::getError())); okButton()->setEnabled (false); @@ -328,7 +328,7 @@ { QString path = QFileDialog::getOpenFileName (null, "", "", g_extProgPathFilter); - if (!path.isEmpty()) + if (not path.isEmpty()) ui->m_path->setText (path); }
--- a/src/extPrograms.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/extPrograms.cc Mon Apr 14 16:00:36 2014 +0300 @@ -101,7 +101,7 @@ // static bool mkTempFile (QTemporaryFile& tmp, QString& fname) { - if (!tmp.open()) + if (not tmp.open()) return false; fname = tmp.fileName(); @@ -120,7 +120,7 @@ ExtProgPathPrompt* dlg = new ExtProgPathPrompt (g_extProgNames[prog]); - if (dlg->exec() && !dlg->getPath().isEmpty()) + if (dlg->exec() && not dlg->getPath().isEmpty()) { path = dlg->getPath(); return true; @@ -192,7 +192,7 @@ // Write the input file QFile f (fname); - if (!f.open (QIODevice::WriteOnly | QIODevice::Text)) + if (not f.open (QIODevice::WriteOnly | QIODevice::Text)) { critical (format ("Couldn't open temporary file %1 for writing: %2\n", fname, f.errorString())); return; @@ -221,7 +221,7 @@ for (LDObject* obj : getCurrentDocument()->objects()) { - if (obj->isColored() == false || obj->color() != colnum) + if (not obj->isColored() || obj->color() != colnum) continue; objects << obj; @@ -247,7 +247,7 @@ print ("Running command: %1 %2\n", path, argv.join (" ")); - if (!input.open()) + if (not input.open()) return false; QProcess proc; @@ -256,7 +256,7 @@ proc.setStandardInputFile (input.fileName()); proc.start (path, argv); - if (!proc.waitForStarted()) + if (not proc.waitForStarted()) { critical (format ("Couldn't start %1: %2\n", g_extProgNames[prog], processErrorString (prog, proc))); return false; @@ -277,7 +277,7 @@ if (proc.exitCode() != 0) err = format ("Program exited abnormally (return code %1).", proc.exitCode()); - if (!err.isEmpty()) + if (not err.isEmpty()) { critical (format ("%1 failed: %2\n", g_extProgNames[prog], err)); return false; @@ -297,7 +297,7 @@ // Read the output file QFile f (fname); - if (!f.open (QIODevice::ReadOnly)) + if (not f.open (QIODevice::ReadOnly)) { critical (format ("Couldn't open temporary file %1 for reading.\n", fname)); return; @@ -317,7 +317,7 @@ for (LDObject* obj : objs) { - if (!obj->isScemantic()) + if (not obj->isScemantic()) { obj->destroy(); continue; @@ -337,14 +337,14 @@ { setlocale (LC_ALL, "C"); - if (!checkProgPath (Ytruder)) + if (not checkProgPath (Ytruder)) return; QDialog* dlg = new QDialog; Ui::YtruderUI ui; ui.setupUi (dlg); - if (!dlg->exec()) + if (not dlg->exec()) return; // Read the user's choices @@ -364,7 +364,7 @@ QString inDATName, outDATName; // Make temp files for the input and output files - if (!mkTempFile (indat, inDATName) || !mkTempFile (outdat, outDATName)) + if (not mkTempFile (indat, inDATName) || not mkTempFile (outdat, outDATName)) return; // Compose the command-line arguments @@ -381,7 +381,7 @@ writeSelection (inDATName); - if (!runUtilityProcess (Ytruder, prog_ytruder, argv)) + if (not runUtilityProcess (Ytruder, prog_ytruder, argv)) return; insertOutput (outDATName, false, {}); @@ -394,28 +394,28 @@ { setlocale (LC_ALL, "C"); - if (!checkProgPath (Rectifier)) + if (not checkProgPath (Rectifier)) return; QDialog* dlg = new QDialog; Ui::RectifierUI ui; ui.setupUi (dlg); - if (!dlg->exec()) + if (not dlg->exec()) return; QTemporaryFile indat, outdat; QString inDATName, outDATName; // Make temp files for the input and output files - if (!mkTempFile (indat, inDATName) || !mkTempFile (outdat, outDATName)) + if (not mkTempFile (indat, inDATName) || not mkTempFile (outdat, outDATName)) return; // Compose arguments QString argv = join ( { - (!ui.cb_condense->isChecked()) ? "-q" : "", - (!ui.cb_subst->isChecked()) ? "-r" : "", + (not ui.cb_condense->isChecked()) ? "-q" : "", + (not ui.cb_subst->isChecked()) ? "-r" : "", (ui.cb_condlineCheck->isChecked()) ? "-a" : "", (ui.cb_colorize->isChecked()) ? "-c" : "", "-t", @@ -426,7 +426,7 @@ writeSelection (inDATName); - if (!runUtilityProcess (Rectifier, prog_rectifier, argv)) + if (not runUtilityProcess (Rectifier, prog_rectifier, argv)) return; insertOutput (outDATName, true, {}); @@ -439,7 +439,7 @@ { setlocale (LC_ALL, "C"); - if (!checkProgPath (Intersector)) + if (not checkProgPath (Intersector)) return; QDialog* dlg = new QDialog; @@ -457,7 +457,7 @@ forever { - if (!dlg->exec()) + if (not dlg->exec()) return; inCol = ui.cmb_incol->itemData (ui.cmb_incol->currentIndex()).toInt(); @@ -481,9 +481,11 @@ QTemporaryFile indat, cutdat, outdat, outdat2, edgesdat; QString inDATName, cutDATName, outDATName, outDAT2Name, edgesDATName; - if (!mkTempFile (indat, inDATName) || !mkTempFile (cutdat, cutDATName) || - !mkTempFile (outdat, outDATName) || !mkTempFile (outdat2, outDAT2Name) || - !mkTempFile (edgesdat, edgesDATName)) + if (not mkTempFile (indat, inDATName) || + not mkTempFile (cutdat, cutDATName) || + not mkTempFile (outdat, outDATName) || + not mkTempFile (outdat2, outDAT2Name) || + not mkTempFile (edgesdat, edgesDATName)) { return; } @@ -515,7 +517,7 @@ writeColorGroup (inCol, inDATName); writeColorGroup (cutCol, cutDATName); - if (!runUtilityProcess (Intersector, prog_intersector, argv_normal)) + if (not runUtilityProcess (Intersector, prog_intersector, argv_normal)) return; insertOutput (outDATName, false, {inCol}); @@ -537,7 +539,7 @@ { setlocale (LC_ALL, "C"); - if (!checkProgPath (Coverer)) + if (not checkProgPath (Coverer)) return; QDialog* dlg = new QDialog; @@ -550,7 +552,7 @@ forever { - if (!dlg->exec()) + if (not dlg->exec()) return; in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt(); @@ -568,8 +570,12 @@ QTemporaryFile in1dat, in2dat, outdat; QString in1DATName, in2DATName, outDATName; - if (!mkTempFile (in1dat, in1DATName) || !mkTempFile (in2dat, in2DATName) || !mkTempFile (outdat, outDATName)) + if (not mkTempFile (in1dat, in1DATName) || + not mkTempFile (in2dat, in2DATName) || + not mkTempFile (outdat, outDATName)) + { return; + } QString argv = join ( { @@ -585,7 +591,7 @@ writeColorGroup (in1Col, in1DATName); writeColorGroup (in2Col, in2DATName); - if (!runUtilityProcess (Coverer, prog_coverer, argv)) + if (not runUtilityProcess (Coverer, prog_coverer, argv)) return; insertOutput (outDATName, false, {}); @@ -597,7 +603,7 @@ { setlocale (LC_ALL, "C"); - if (!checkProgPath (Isecalc)) + if (not checkProgPath (Isecalc)) return; Ui::IsecalcUI ui; @@ -612,7 +618,7 @@ // Run the dialog and validate input forever { - if (!dlg->exec()) + if (not dlg->exec()) return; in1Col = ui.cmb_col1->itemData (ui.cmb_col1->currentIndex()).toInt(), @@ -630,8 +636,12 @@ QTemporaryFile in1dat, in2dat, outdat; QString in1DATName, in2DATName, outDATName; - if (!mkTempFile (in1dat, in1DATName) || !mkTempFile (in2dat, in2DATName) || !mkTempFile (outdat, outDATName)) + if (not mkTempFile (in1dat, in1DATName) || + not mkTempFile (in2dat, in2DATName) || + not mkTempFile (outdat, outDATName)) + { return; + } QString argv = join ( { @@ -652,20 +662,20 @@ { setlocale (LC_ALL, "C"); - if (!checkProgPath (Edger2)) + if (not checkProgPath (Edger2)) return; QDialog* dlg = new QDialog; Ui::Edger2Dialog ui; ui.setupUi (dlg); - if (!dlg->exec()) + if (not dlg->exec()) return; QTemporaryFile in, out; QString inName, outName; - if (!mkTempFile (in, inName) || !mkTempFile (out, outName)) + if (not mkTempFile (in, inName) || not mkTempFile (out, outName)) return; int unmatched = ui.unmatched->currentIndex(); @@ -689,7 +699,7 @@ writeSelection (inName); - if (!runUtilityProcess (Edger2, prog_edger2, argv)) + if (not runUtilityProcess (Edger2, prog_edger2, argv)) return; insertOutput (outName, true, {});
--- a/src/glRenderer.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/glRenderer.cc Mon Apr 14 16:00:36 2014 +0300 @@ -257,7 +257,7 @@ { QColor col (gl_maincolor); - if (!col.isValid()) + if (not col.isValid()) return QColor (0, 0, 0); col.setAlpha (gl_maincolor_alpha * 255.f); @@ -270,7 +270,7 @@ { QColor col (gl_bgcolor); - if (!col.isValid()) + if (not col.isValid()) return; col.setAlpha (255); @@ -286,7 +286,7 @@ { QColor qcol; - if (!obj->isColored()) + if (not obj->isColored()) return; if (list == GL::PickList) @@ -333,13 +333,13 @@ { LDColor* col; - if (!gl_blackedges && obj->parent() && (col = ::getColor (obj->parent()->color()))) + if (not gl_blackedges && obj->parent() && (col = ::getColor (obj->parent()->color()))) qcol = col->edgeColor; else - qcol = (m_darkbg == false) ? Qt::black : Qt::white; + qcol = not m_darkbg ? Qt::black : Qt::white; } - if (qcol.isValid() == false) + if (not qcol.isValid()) { // The color was unknown. Use main color to make the object at least // not appear pitch-black. @@ -419,7 +419,7 @@ if (document() == null) return; - if (gl_wireframe && !isPicking()) + if (gl_wireframe && not isPicking()) glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -461,9 +461,9 @@ glRotatef (rot (Z), 0.0f, 0.0f, 1.0f); } - const GL::ListType list = (!isDrawOnly() && isPicking()) ? PickList : NormalList; + const GL::ListType list = (not isDrawOnly() && isPicking()) ? PickList : NormalList; - if (gl_colorbfc && !isPicking() && !isDrawOnly()) + if (gl_colorbfc && not isPicking() && not isDrawOnly()) { glEnable (GL_CULL_FACE); @@ -492,7 +492,7 @@ } } - if (gl_axes && !isPicking() && !isDrawOnly()) + if (gl_axes && not isPicking() && not isDrawOnly()) glCallList (m_axeslist); glPopMatrix(); @@ -628,7 +628,7 @@ int numverts = 4; // Calculate polygon data - if (!m_rectdraw) + if (not m_rectdraw) { numverts = m_drawedVerts.size() + 1; int i = 0; @@ -804,7 +804,7 @@ } // Camera icons - if (!isPicking()) + if (not isPicking()) { // Draw a background for the selected camera paint.setPen (m_thinBorderPen); @@ -836,7 +836,7 @@ // Tool tips if (m_drawToolTip) { - if (m_cameraIcons[m_toolTipCamera].destRect.contains (m_pos) == false) + if (not m_cameraIcons[m_toolTipCamera].destRect.contains (m_pos)) m_drawToolTip = false; else { @@ -863,7 +863,7 @@ } // If we're range-picking, draw a rectangle encompassing the selection area. - if (m_rangepick && !isPicking() && m_totalmove >= 10) + if (m_rangepick && not isPicking() && m_totalmove >= 10) { int x0 = m_rangeStart.x(), y0 = m_rangeStart.y(), @@ -896,7 +896,7 @@ // void GLRenderer::compileAllObjects() { - if (!document()) + if (not document()) return; // Compiling all is a big job, use a busy cursor @@ -934,12 +934,16 @@ const int numverts = (obj->type() != LDObject::ECondLine) ? obj->vertices() : 2; - if (g_glInvert == false) + if (not g_glInvert) + { for (int i = 0; i < numverts; ++i) compileVertex (obj->vertex (i)); + } else + { for (int i = numverts - 1; i >= 0; --i) compileVertex (obj->vertex (i)); + } glEnd(); } @@ -991,12 +995,16 @@ bool oldinvert = g_glInvert; if (ref->transform().getDeterminant() < 0) - g_glInvert = !g_glInvert; + g_glInvert = not g_glInvert; LDObject* prev = ref->previous(); - if (prev && prev->type() == LDObject::EBFC && static_cast<LDBFC*> (prev)->statement() == LDBFC::InvertNext) - g_glInvert = !g_glInvert; + if (prev != null && + prev->type() == LDObject::EBFC && + static_cast<LDBFC*> (prev)->statement() == LDBFC::InvertNext) + { + g_glInvert = not g_glInvert; + } for (LDObject* obj : objs) { @@ -1054,9 +1062,9 @@ // void GLRenderer::mouseReleaseEvent (QMouseEvent* ev) { - const bool wasLeft = (m_lastButtons & Qt::LeftButton) && ! (ev->buttons() & Qt::LeftButton), - wasRight = (m_lastButtons & Qt::RightButton) && ! (ev->buttons() & Qt::RightButton), - wasMid = (m_lastButtons & Qt::MidButton) && ! (ev->buttons() & Qt::MidButton); + const bool wasLeft = (m_lastButtons & Qt::LeftButton) && not (ev->buttons() & Qt::LeftButton), + wasRight = (m_lastButtons & Qt::RightButton) && not (ev->buttons() & Qt::RightButton), + wasMid = (m_lastButtons & Qt::MidButton) && not (ev->buttons() & Qt::MidButton); if (m_panning) m_panning = false; @@ -1064,7 +1072,7 @@ if (wasLeft) { // Check if we selected a camera icon - if (!m_rangepick) + if (not m_rangepick) { for (CameraIcon & info : m_cameraIcons) { @@ -1119,12 +1127,12 @@ case ESelectMode: { - if (!isDrawOnly()) + if (not isDrawOnly()) { if (m_totalmove < 10) m_rangepick = false; - if (!m_rangepick) + if (not m_rangepick) m_addpick = (m_keymods & Qt::ControlModifier); if (m_totalmove < 10 || m_rangepick) @@ -1173,7 +1181,7 @@ addDrawnVertex (closest); } - if (wasRight && !m_drawedVerts.isEmpty()) + if (wasRight && not m_drawedVerts.isEmpty()) { // Remove the last vertex m_drawedVerts.removeLast(); @@ -1223,7 +1231,8 @@ pan (X) += 0.03f * dx * (zoom() / 7.5f); pan (Y) -= 0.03f * dy * (zoom() / 7.5f); m_panning = true; - } elif (left && !m_rangepick && camera() == EFreeCamera) + } + elif (left && not m_rangepick && camera() == EFreeCamera) { rot (X) = rot (X) + dy; rot (Y) = rot (Y) + dx; @@ -1233,7 +1242,7 @@ } // Start the tool tip timer - if (!m_drawToolTip) + if (not m_drawToolTip) m_toolTipTimer->start (500); // Update 2d position @@ -1312,7 +1321,7 @@ glLineWidth (max<double> (gl_linethickness, 6.5f)); // Clear the selection if we do not wish to add to it. - if (!m_addpick) + if (not m_addpick) { LDObjectList oldsel = selection(); getCurrentDocument()->clearSelection(); @@ -1387,7 +1396,7 @@ // If this is an additive single pick and the object is currently selected, // we remove it from selection instead. - if (!m_rangepick && m_addpick) + if (not m_rangepick && m_addpick) { if (obj->isSelected()) { @@ -1477,7 +1486,7 @@ { initOverlaysFromObjects(); - if (currentDocumentData().init == false) + if (not currentDocumentData().init) { resetAllAngles(); currentDocumentData().init = true; @@ -1811,7 +1820,7 @@ void GLRenderer::deleteLists (LDObject* obj) { // Delete the lists but only if they have been initialized - if (!obj->isGLInit()) + if (not obj->isGLInit()) return; for (const GL::ListType listType : g_glListTypes) @@ -2007,14 +2016,14 @@ // If this is the first run, we don't know enough to determine // whether the zoom was to fit, so we mark in our knowledge so // far and start over. - inward = !filled; + inward = not filled; firstrun = false; } else { // If this run filled the screen and the last one did not, the // last run had ideal zoom - zoom a bit back and we should reach it. - if (filled && !lastfilled) + if (filled && not lastfilled) { zoomNotch (false); break; @@ -2022,10 +2031,10 @@ // If this run did not fill the screen and the last one did, we've // now reached ideal zoom so we're done here. - if (!filled && lastfilled) + if (not filled && lastfilled) break; - inward = !filled; + inward = not filled; } lastfilled = filled; @@ -2054,7 +2063,7 @@ // void GLRenderer::updateRectVerts() { - if (!m_rectdraw) + if (not m_rectdraw) return; if (m_drawedVerts.isEmpty()) @@ -2089,7 +2098,7 @@ // void GLRenderer::mouseDoubleClickEvent (QMouseEvent* ev) { - if (!(ev->buttons() & Qt::LeftButton) || editMode() != ESelectMode) + if (not (ev->buttons() & Qt::LeftButton) || editMode() != ESelectMode) return; pick (ev->x(), ev->y()); @@ -2135,7 +2144,7 @@ LDGLOverlay& meta = currentDocumentData().overlays[cam]; LDOverlay* ovlobj = findOverlayObject (cam); - if (!ovlobj && meta.img) + if (not ovlobj && meta.img) { delete meta.img; meta.img = null; @@ -2158,7 +2167,7 @@ LDGLOverlay& meta = currentDocumentData().overlays[cam]; LDOverlay* ovlobj = findOverlayObject (cam); - if (!meta.img && ovlobj) + if (meta.img == null && ovlobj != null) { // If this is the last overlay image, we need to remove the empty space after it as well. LDObject* nextobj = ovlobj->next(); @@ -2169,7 +2178,8 @@ // If the overlay object was there and the overlay itself is // not, remove the object. ovlobj->destroy(); - } elif (meta.img && !ovlobj) + } + elif (meta.img != null && ovlobj == null) { // Inverse case: image is there but the overlay object is // not, thus create the object. @@ -2209,7 +2219,7 @@ } } - if (meta.img && ovlobj) + if (meta.img != null && ovlobj != null) { ovlobj->setCamera (cam); ovlobj->setFileName (meta.fname);
--- a/src/ldConfig.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/ldConfig.cc Mon Apr 14 16:00:36 2014 +0300 @@ -32,7 +32,7 @@ int pos; // Try find the token and get its position - if (!pars.findToken (pos, tag, 1)) + if (not pars.findToken (pos, tag, 1)) return false; // Get the token after it and store it into val @@ -45,14 +45,14 @@ { QFile* fp = openLDrawFile ("LDConfig.ldr", false); - if (!fp) + if (fp == null) { critical (QObject::tr ("Unable to open LDConfig.ldr for parsing.")); return; } // Read in the lines - while (fp->atEnd() == false) + while (not fp->atEnd()) { QString line = QString::fromUtf8 (fp->readLine()); @@ -69,35 +69,39 @@ QString name, facename, edgename, valuestr; // Check 0 !COLOUR, parse the name - if (!pars.tokenCompare (0, "0") || !pars.tokenCompare (1, "!COLOUR") || !pars.getToken (name, 2)) + if (not pars.tokenCompare (0, "0") || + not pars.tokenCompare (1, "!COLOUR") || + not pars.getToken (name, 2)) + { continue; + } // Replace underscores in the name with spaces for readability name.replace ("_", " "); // Get the CODE tag - if (!parseLDConfigTag (pars, "CODE", valuestr)) + if (not parseLDConfigTag (pars, "CODE", valuestr)) continue; - if (!numeric (valuestr)) + if (not numeric (valuestr)) continue; // not a number // Ensure that the code is within [0 - 511] bool ok; code = valuestr.toShort (&ok); - if (!ok || code < 0 || code >= 512) + if (not ok || code < 0 || code >= 512) continue; // VALUE and EDGE tags - if (!parseLDConfigTag (pars, "VALUE", facename) || !parseLDConfigTag (pars, "EDGE", edgename)) + if (not parseLDConfigTag (pars, "VALUE", facename) || not parseLDConfigTag (pars, "EDGE", edgename)) continue; // Ensure that our colors are correct QColor faceColor (facename), edgeColor (edgename); - if (!faceColor.isValid() || !edgeColor.isValid()) + if (not faceColor.isValid() || not edgeColor.isValid()) continue; // Parse alpha if given. @@ -208,7 +212,7 @@ { QString tok; - if (!getToken (tok, inPos)) + if (not getToken (tok, inPos)) return false; return (tok == sOther);
--- a/src/ldDocument.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/ldDocument.cc Mon Apr 14 16:00:36 2014 +0300 @@ -59,11 +59,11 @@ void initPaths() { - if (!tryConfigure (io_ldpath)) + if (not tryConfigure (io_ldpath)) { LDrawPathDialog dlg (false); - if (!dlg.exec()) + if (not dlg.exec()) exit (0); io_ldpath = dlg.filename(); @@ -74,7 +74,7 @@ { QDir dir; - if (!dir.cd (path)) + if (not dir.cd (path)) { pathError = "Directory does not exist."; return false; @@ -161,7 +161,7 @@ // we need to create a new file to switch to. for (LDDocument* file : g_loadedFiles) { - if (!file->isImplicit()) + if (not file->isImplicit()) { LDDocument::setCurrent (file); found = true; @@ -169,7 +169,7 @@ } } - if (!found) + if (not found) newFile(); } @@ -187,7 +187,7 @@ LDDocument* findDocument (QString name) { for (LDDocument * file : g_loadedFiles) - if (!file->name().isEmpty() && file->name() == name) + if (not file->name().isEmpty() && file->name() == name) return file; return null; @@ -263,7 +263,7 @@ } } - if (!bogus) + if (not bogus) return partpath; } } @@ -405,7 +405,7 @@ } // Otherwise, continue, by recursing back. - if (!isDone()) + if (not isDone()) { // If we have a dialog to show progress output to, we cannot just call // work() again immediately as the dialog needs some processor cycles as @@ -445,7 +445,7 @@ *numWarnings = 0; // Read in the lines - while (fp->atEnd() == false) + while (not fp->atEnd()) lines << QString::fromUtf8 (fp->readLine()); LDFileLoader* loader = new LDFileLoader; @@ -458,12 +458,12 @@ // its next iteration through the event loop. We need to catch this here // by telling the event loop to tick, which will tick the file loader again. // We keep doing this until the file loader is ready. - while (loader->isDone() == false) + while (not loader->isDone()) qApp->processEvents(); // If we wanted the success value, supply that now if (ok) - *ok = !loader->isAborted(); + *ok = not loader->isAborted(); objs = loader->objects(); return objs; @@ -486,14 +486,14 @@ fp = new QFile (path); fullpath = path; - if (!fp->open (QIODevice::ReadOnly)) + if (not fp->open (QIODevice::ReadOnly)) { delete fp; return null; } } - if (!fp) + if (not fp) return null; LDDocument* load = new LDDocument; @@ -511,7 +511,7 @@ fp->close(); fp->deleteLater(); - if (!ok) + if (not ok) { g_loadedFiles.removeOne (load); delete load; @@ -563,7 +563,7 @@ setName (newpath); } - if (!save()) + if (not save()) { message = format (tr ("Failed to save %1 (%2)\nDo you still want to close?"), name(), strerror (errno)); @@ -665,7 +665,7 @@ // We cannot open this file if the document this would replace is not // safe to close. - if (documentToReplace != null && documentToReplace->isSafeToClose() == false) + if (documentToReplace != null && not documentToReplace->isSafeToClose()) { g_loadingMainFile = false; return; @@ -673,13 +673,13 @@ LDDocument* file = openDocument (path, false); - if (!file) + if (not file) { // Loading failed, thus drop down to a new file since we // closed everything prior. newFile(); - if (!g_aborted) + if (not g_aborted) { // Tell the user loading failed. setlocale (LC_ALL, "C"); @@ -723,19 +723,19 @@ // bool LDDocument::save (QString savepath) { - if (!savepath.length()) + if (not savepath.length()) savepath = fullPath(); QFile f (savepath); - if (!f.open (QIODevice::WriteOnly)) + if (not f.open (QIODevice::WriteOnly)) return false; // If the second object in the list holds the file name, update that now. // Only do this if the file is explicitly open. LDObject* nameObject = getObject (1); - if (!isImplicit() && nameObject != null && nameObject->type() == LDObject::EComment) + if (not isImplicit() && nameObject != null && nameObject->type() == LDObject::EComment) { LDComment* nameComment = static_cast<LDComment*> (nameObject); @@ -804,8 +804,11 @@ { tokens[i].toDouble (&ok); - if (!ok && !scient.exactMatch (tokens[i])) - throw LDParseError (line, format ("Token #%1 was `%2`, expected a number (matched length: %3)", (i + 1), tokens[i], scient.matchedLength())); + if (not ok && not scient.exactMatch (tokens[i])) + { + throw LDParseError (line, format ("Token #%1 was `%2`, expected a number (matched length: %3)", + (i + 1), tokens[i], scient.matchedLength())); + } } } @@ -838,7 +841,7 @@ return new LDEmpty; } - if (tokens[0].length() != 1 || tokens[0][0].isDigit() == false) + if (tokens[0].length() != 1 || not tokens[0][0].isDigit()) throw LDParseError (line, "Illogical line code"); int num = tokens[0][0].digitValue(); @@ -929,7 +932,7 @@ // 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 (!load) + if (not load) { LDError* obj = new LDError (line, format ("Could not open %1", tokens[14])); obj->setFileReferenced (tokens[14]); @@ -1020,7 +1023,7 @@ LDDocument* doc = findDocument (filename); // If it's not loaded, try open it - if (!doc) + if (not doc) doc = openDocument (filename, true); return doc; @@ -1030,7 +1033,7 @@ // void reloadAllSubfiles() { - if (!getCurrentDocument()) + if (not getCurrentDocument()) return; g_loadedFiles.clear(); @@ -1068,7 +1071,7 @@ m_vertices << obj; #ifdef DEBUG - if (!isImplicit()) + if (not isImplicit()) dprint ("Added object #%1 (%2)\n", obj->id(), obj->typeName()); #endif @@ -1094,7 +1097,7 @@ obj->setDocument (this); #ifdef DEBUG - if (!isImplicit()) + if (not isImplicit()) dprint ("Inserted object #%1 (%2) at %3\n", obj->id(), obj->typeName(), pos); #endif } @@ -1107,7 +1110,7 @@ obj->unselect(); assert (m_objects[idx] == obj); - if (!history()->isIgnoring()) + if (not history()->isIgnoring()) history()->add (new DelHistory (idx, obj)); m_objects.removeAt (idx); @@ -1119,7 +1122,7 @@ bool safeToCloseAll() { for (LDDocument* f : g_loadedFiles) - if (!f->isSafeToClose()) + if (not f->isSafeToClose()) return false; return true; @@ -1132,7 +1135,7 @@ assert (idx >= 0 && idx < m_objects.size()); // Mark this change to history - if (!m_history->isIgnoring()) + if (not m_history->isIgnoring()) { QString oldcode = getObject (idx)->asText(); QString newcode = obj->asText(); @@ -1188,10 +1191,10 @@ // QString LDDocument::getDisplayName() { - if (!name().isEmpty()) + if (not name().isEmpty()) return name(); - if (!defaultName().isEmpty()) + if (not defaultName().isEmpty()) return "[" + defaultName() + "]"; return tr ("<anonymous>"); @@ -1227,20 +1230,20 @@ } // If we have this cached, just create a copy of that - if (deep && cache().isEmpty() == false) + if (deep && not cache().isEmpty()) { for (LDObject* obj : cache()) objs << obj->createCopy(); } else { - if (!deep) + if (not deep) doCache = false; for (LDObject* obj : objects()) { // Skip those without scemantic meaning - if (!obj->isScemantic()) + if (not obj->isScemantic()) continue; // Got another sub-file reference, inline it if we're deep-inlining. If not, @@ -1320,8 +1323,10 @@ int count = 0; for (LDDocument* f : g_loadedFiles) - if (f->isImplicit() == false) - count++; + { + if (not f->isImplicit()) + ++count; + } return count; } @@ -1332,13 +1337,13 @@ // ============================================================================= void LDDocument::closeInitialFile() { - if ( - countExplicitFiles() == 2 && + if (countExplicitFiles() == 2 && g_loadedFiles[0]->name().isEmpty() && - g_loadedFiles[1]->name().isEmpty() == false && - !g_loadedFiles[0]->hasUnsavedChanges() - ) + not g_loadedFiles[1]->name().isEmpty() && + not g_loadedFiles[0]->hasUnsavedChanges()) + { delete g_loadedFiles[0]; + } } // ============================================================================= @@ -1373,7 +1378,7 @@ // void LDDocument::removeFromSelection (LDObject* obj) // [protected] { - if (!obj->isSelected()) + if (not obj->isSelected()) return; assert (obj->document() == this);
--- a/src/ldObject.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/ldObject.cc Mon Apr 14 16:00:36 2014 +0300 @@ -368,7 +368,7 @@ const long idx = obj->lineNumber(), target = idx + (up ? -1 : 1); - if ((up && idx == 0) || (!up && idx == (long) (file->objects().size() - 1))) + if ((up && idx == 0) || (not up && idx == (long) file->objects().size() - 1l)) { // One of the objects hit the extrema. If this happens, this should be the first // object to be iterated on. Thus, nothing has changed yet and it's safe to just @@ -423,7 +423,7 @@ if (count == 0) continue; - if (!firstDetails) + if (not firstDetails) text += ", "; QString noun = format ("%1%2", typeName (objType), plural (count));
--- a/src/main.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/main.cc Mon Apr 14 16:00:36 2014 +0300 @@ -54,7 +54,7 @@ LDDocument::setCurrent (null); // Load or create the configuration - if (!Config::load()) + if (not Config::load()) { print ("Creating configuration file...\n");
--- a/src/mainWindow.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/mainWindow.cc Mon Apr 14 16:00:36 2014 +0300 @@ -108,7 +108,7 @@ // Connect all actions for (QAction* act : findChildren<QAction*>()) - if (!act->objectName().isEmpty()) + if (not act->objectName().isEmpty()) connect (act, SIGNAL (triggered()), this, SLOT (slot_action())); } @@ -309,7 +309,7 @@ // void MainWindow::buildObjList() { - if (!getCurrentDocument()) + if (not getCurrentDocument()) return; // Lock the selection while we do this so that refreshing the object list @@ -523,7 +523,7 @@ for (LDObject* obj : selection()) { - if (obj->isColored() == false) + if (not obj->isColored()) continue; // uncolored object obj->setColor (newColor); @@ -539,7 +539,7 @@ int MainWindow::getInsertionPoint() { // If we have a selection, put the item after it. - if (!selection().isEmpty()) + if (not selection().isEmpty()) return selection().last()->lineNumber() + 1; // Otherwise place the object at the end. @@ -594,7 +594,7 @@ for (LDObject* obj : selection()) { - if (obj->isColored() == false) + if (not obj->isColored()) continue; // doesn't use color if (result != -1 && obj->color() != result) @@ -630,7 +630,7 @@ void MainWindow::closeEvent (QCloseEvent* ev) { // Check whether it's safe to close all files. - if (!safeToCloseAll()) + if (not safeToCloseAll()) { ev->ignore(); return; @@ -698,7 +698,7 @@ for (LDObject* obj : getCurrentDocument()->objects()) { - if (!obj->isColored() || obj->color() != colnum) + if (not obj->isColored() || obj->color() != colnum) continue; objs << obj; @@ -746,9 +746,9 @@ { QString name = doc->defaultName(); - if (!doc->fullPath().isEmpty()) + if (not doc->fullPath().isEmpty()) name = doc->fullPath(); - elif (!doc->name().isEmpty()) + elif (not doc->name().isEmpty()) name = doc->name(); name.replace ("\\", "/"); @@ -868,7 +868,7 @@ for (LDObject* obj : getCurrentDocument()->objects()) { - if (!obj->isColored()) + if (not obj->isColored()) continue; if (counts.find (obj->color()) == counts.end()) @@ -906,7 +906,7 @@ for (LDDocument* f : g_loadedFiles) { // Don't list implicit files unless explicitly desired. - if (f->isImplicit() && !gui_implicitfiles) + if (f->isImplicit() && not gui_implicitfiles) continue; // Add an item to the list for this file and store the tab index
--- a/src/messageLog.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/messageLog.cc Mon Apr 14 16:00:36 2014 +0300 @@ -99,7 +99,7 @@ { bool lineChanged; - if (!m_lines[i].update (lineChanged)) + if (not m_lines[i].update (lineChanged)) m_lines.removeAt (i--); changed |= lineChanged;
--- a/src/miscallenous.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/miscallenous.cc Mon Apr 14 16:00:36 2014 +0300 @@ -160,7 +160,7 @@ continue; // Check for decimal point - if (!gotDot && c == '.') + if (not gotDot && c == '.') { gotDot = true; continue; @@ -269,7 +269,7 @@ ui.customY->setValue (edit_customrotpoint.y()); ui.customZ->setValue (edit_customrotpoint.z()); - if (!dlg->exec()) + if (not dlg->exec()) return; edit_rotpoint =
--- a/src/partDownloader.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/partDownloader.cc Mon Apr 14 16:00:36 2014 +0300 @@ -42,7 +42,7 @@ { QString path = getDownloadPath(); - if (path == "" || QDir (path).exists() == false) + if (path.isEmpty() || not QDir (path).exists()) { critical (PartDownloader::tr ("You need to specify a valid path for " "downloaded files in the configuration to download paths.")); @@ -123,7 +123,7 @@ dest = dest.simplified(); // If the user doesn't want us to guess, stop right here. - if (net_guesspaths == false) + if (not net_guesspaths) return; // Ensure .dat extension @@ -224,7 +224,7 @@ if (QFile::exists (PartDownloader::getDownloadPath() + DIRSLASH + dest)) { const QString overwritemsg = format (tr ("%1 already exists in download directory. Overwrite?"), dest); - if (!confirm (tr ("Overwrite?"), overwritemsg)) + if (not confirm (tr ("Overwrite?"), overwritemsg)) return; } @@ -267,7 +267,7 @@ // If there is some download still working, we're not finished. for (PartDownloadRequest* req : requests()) { - if (!req->isFinished()) + if (not req->isFinished()) return; if (req->state() == PartDownloadRequest::EFailed) @@ -288,7 +288,7 @@ g_win->R()->resetAngles(); } - if (net_autoclose && !failed) + if (net_autoclose && not failed) { // Close automatically if desired. accept(); @@ -339,11 +339,11 @@ QDir dir (dirpath); - if (dir.exists() == false) + if (not dir.exists()) { print ("Creating %1...\n", dirpath); - if (!dir.mkpath (dirpath)) + if (not dir.mkpath (dirpath)) critical (format (tr ("Couldn't create the directory %1!"), dirpath)); } @@ -374,7 +374,7 @@ { prog = qobject_cast<QProgressBar*> (table->cellWidget (tableRow(), progcol)); - if (!prog) + if (not prog) { prog = new QProgressBar; table->setCellWidget (tableRow(), progcol, prog); @@ -418,7 +418,7 @@ { if (networkReply()->error() != QNetworkReply::NoError) { - if (isPrimary() && !prompt()->isAborted()) + if (isPrimary() && not prompt()->isAborted()) critical (networkReply()->errorString()); setState (EFailed); @@ -448,10 +448,10 @@ // Try to load this file now. LDDocument* f = openDocument (filePath(), false); - if (!f) + if (f == null) return; - f->setImplicit (!isPrimary()); + f->setImplicit (not isPrimary()); // Iterate through this file and check for errors. If there's any that stems // from unknown file references, try resolve that by downloading the reference. @@ -503,7 +503,7 @@ // to go here. setFilePointer (new QFile (filePath().toLocal8Bit())); - if (!filePointer()->open (QIODevice::WriteOnly)) + if (not filePointer()->open (QIODevice::WriteOnly)) { critical (format (tr ("Couldn't open %1 for writing: %2"), filePath(), strerror (errno))); setState (EFailed);
--- a/src/primitives.cc Thu Apr 10 13:58:06 2014 +0300 +++ b/src/primitives.cc Mon Apr 14 16:00:36 2014 +0300 @@ -59,14 +59,14 @@ // Try to load prims.cfg QFile conf (Config::filepath ("prims.cfg")); - if (conf.open (QIODevice::ReadOnly) == false) + if (not conf.open (QIODevice::ReadOnly)) { // No prims.cfg, build it PrimitiveScanner::start(); } else { - while (conf.atEnd() == false) + while (not conf.atEnd()) { QString line = conf.readLine(); @@ -137,7 +137,7 @@ QString fname = m_files[m_i]; QFile f (fname); - if (!f.open (QIODevice::ReadOnly)) + if (not f.open (QIODevice::ReadOnly)) continue; Primitive info; @@ -166,7 +166,7 @@ QString path = Config::filepath ("prims.cfg"); QFile conf (path); - if (!conf.open (QIODevice::WriteOnly | QIODevice::Text)) + if (not conf.open (QIODevice::WriteOnly | QIODevice::Text)) critical (format ("Couldn't write primitive list %1: %2", path, conf.errorString())); else @@ -274,12 +274,12 @@ g_PrimitiveCategories.clear(); QString path = Config::dirpath() + "primregexps.cfg"; - if (!QFile::exists (path)) + if (not QFile::exists (path)) path = ":/data/primitive-categories.cfg"; QFile f (path); - if (!f.open (QIODevice::ReadOnly)) + if (not f.open (QIODevice::ReadOnly)) { critical (format (QObject::tr ("Failed to open primitive categories: %1"), f.errorString())); return; @@ -287,7 +287,7 @@ PrimitiveCategory* cat = null; - while (f.atEnd() == false) + while (not f.atEnd()) { QString line = f.readLine(); int colon; @@ -613,7 +613,7 @@ QString author = APPNAME; QString license = ""; - if (ld_defaultname.isEmpty() == false) + if (not ld_defaultname.isEmpty()) { license = getLicenseText (ld_defaultlicense); author = format ("%1 [%2]", ld_defaultname, ld_defaultuser); @@ -683,7 +683,7 @@ { PrimitivePrompt* dlg = new PrimitivePrompt (g_win); - if (!dlg->exec()) + if (not dlg->exec()) return; int segs = dlg->ui->sb_segs->value();