diff --git a/ChangeLog.txt b/ChangeLog.txt index 55a8e3a1d..0539717c8 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -49,6 +49,7 @@ - [#595] GapWidth affecting to the margins. - [#589] Valentina lock up if not enough space for label. - [#606] Mac OS X. Can’t type in measurements due to digit count limitation. +- [#612] Valentina crashes when network is disabled on Linux. # Version 0.4.6 - [#594] Broken export on Mac. diff --git a/common.pri b/common.pri index 7753a3baf..eb6318df4 100644 --- a/common.pri +++ b/common.pri @@ -25,6 +25,21 @@ win32{ VCOPY = $$QMAKE_COPY /D } +# See question on StackOwerflow "QSslSocket error when SSL is NOT used" (http://stackoverflow.com/a/31277055/3045403) +# Copy of answer: +# We occasionally had customers getting very similar warning messages but the software was also crashing. +# We determined it was because, although we weren't using SSL either, the program found a copy of OpenSSL on the +# customer's computer and tried interfacing with it. The version it found was too old though (from Qt 5.2 onwards v1.0.0 +# or later is required). +# +# Our solution was to distribute the OpenSSL DLLs along with our application (~1.65 MB). The alternative is to compile +# Qt from scratch without OpenSSL support. +win32 { + INSTALL_OPENSSL += \ + ../../../dist/win/libeay32.dll \ + ../../../dist/win/ssleay32.dll +} + macx{ # QTBUG-31034 qmake doesn't allow override QMAKE_CXX CONFIG+=no_ccache diff --git a/dist/win/libeay32.dll b/dist/win/libeay32.dll new file mode 100644 index 000000000..db98e5b82 Binary files /dev/null and b/dist/win/libeay32.dll differ diff --git a/dist/win/ssleay32.dll b/dist/win/ssleay32.dll new file mode 100644 index 000000000..965b6091a Binary files /dev/null and b/dist/win/ssleay32.dll differ diff --git a/src/app/tape/dialogs/dialogabouttape.cpp b/src/app/tape/dialogs/dialogabouttape.cpp index dbf3e2340..ad42e2855 100644 --- a/src/app/tape/dialogs/dialogabouttape.cpp +++ b/src/app/tape/dialogs/dialogabouttape.cpp @@ -60,6 +60,8 @@ DialogAboutTape::DialogAboutTape(QWidget *parent) connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &DialogAboutTape::close); connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, []() { + // Set feed URL before doing anything else + FvUpdater::sharedUpdater()->SetFeedURL(defaultFeedURL); FvUpdater::sharedUpdater()->CheckForUpdatesNotSilent(); }); diff --git a/src/app/tape/main.cpp b/src/app/tape/main.cpp index b5ed4d63d..1cccb6535 100644 --- a/src/app/tape/main.cpp +++ b/src/app/tape/main.cpp @@ -56,9 +56,6 @@ int main(int argc, char *argv[]) MApplication app(argc, argv); app.InitOptions(); - // Set feed URL before doing anything else - FvUpdater::sharedUpdater()->SetFeedURL(defaultFeedURL); - QTimer::singleShot(0, &app, SLOT(ProcessCMD())); return app.exec(); diff --git a/src/app/tape/tape.pro b/src/app/tape/tape.pro index 83ca0388d..a33906354 100644 --- a/src/app/tape/tape.pro +++ b/src/app/tape/tape.pro @@ -259,6 +259,15 @@ unix{ } } +win32 { + for(DIR, INSTALL_OPENSSL) { + #add these absolute paths to a variable which + #ends up as 'mkcommands = path1 path2 path3 ...' + openssl_path += $${PWD}/$$DIR + } + copyToDestdir($$openssl_path, $$shell_path($${OUT_PWD}/$$DESTDIR)) +} + # Compilation will fail without this files after we added them to this section. OTHER_FILES += \ share/resources/tapeicon/64x64/logo.ico \ # Tape's logo. diff --git a/src/app/valentina/dialogs/dialogaboutapp.cpp b/src/app/valentina/dialogs/dialogaboutapp.cpp index 8439083c4..4d4fb5f94 100644 --- a/src/app/valentina/dialogs/dialogaboutapp.cpp +++ b/src/app/valentina/dialogs/dialogaboutapp.cpp @@ -69,7 +69,10 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) : } }); - connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, [](){ + connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, []() + { + // Set feed URL before doing anything else + FvUpdater::sharedUpdater()->SetFeedURL(defaultFeedURL); FvUpdater::sharedUpdater()->CheckForUpdatesNotSilent(); }); diff --git a/src/app/valentina/valentina.pro b/src/app/valentina/valentina.pro index af55048c5..0dc74aaf5 100644 --- a/src/app/valentina/valentina.pro +++ b/src/app/valentina/valentina.pro @@ -285,6 +285,8 @@ win32:*-g++ { $$PWD/../../../dist/win/s-measurements.ico \ $$PWD/../../../dist/win/pattern.ico \ $$PWD/../../../dist/win/pdftops.exe \ + $$PWD/../../../dist/win/libeay32.dll \ + $$PWD/../../../dist/win/ssleay32.dll \ $$PWD/../../../AUTHORS.txt \ $$PWD/../../../LICENSE_GPL.txt \ $$PWD/../../../README.txt \ @@ -437,6 +439,13 @@ win32 { pdftops_path += $${PWD}/$$DIR } copyToDestdir($$pdftops_path, $$shell_path($${OUT_PWD}/$$DESTDIR)) + + for(DIR, INSTALL_OPENSSL) { + #add these absolute paths to a variable which + #ends up as 'mkcommands = path1 path2 path3 ...' + openssl_path += $${PWD}/$$DIR + } + copyToDestdir($$openssl_path, $$shell_path($${OUT_PWD}/$$DESTDIR)) } noRunPath{ # For enable run qmake with CONFIG+=noRunPath diff --git a/src/libs/fervor/fvupdater.cpp b/src/libs/fervor/fvupdater.cpp index e245bbbc6..2767e58f5 100644 --- a/src/libs/fervor/fvupdater.cpp +++ b/src/libs/fervor/fvupdater.cpp @@ -61,12 +61,7 @@ FvUpdater* FvUpdater::sharedUpdater() if (m_Instance.isNull()) { mutex.lock(); - - if (m_Instance.isNull()) - { - m_Instance = new FvUpdater; - } - + m_Instance = new FvUpdater; mutex.unlock(); } @@ -92,6 +87,7 @@ FvUpdater::FvUpdater() m_qnam(), m_reply(nullptr), m_httpRequestAborted(false), + m_dropOnFinnish(true), m_xml() { // noop @@ -101,6 +97,7 @@ FvUpdater::FvUpdater() FvUpdater::~FvUpdater() { hideUpdaterWindow(); + delete m_reply; } //--------------------------------------------------------------------------------------------------------------------- @@ -142,6 +139,18 @@ QString FvUpdater::GetFeedURL() const return m_feedURL.toString(); } +//--------------------------------------------------------------------------------------------------------------------- +bool FvUpdater::IsDropOnFinnish() const +{ + return m_dropOnFinnish; +} + +//--------------------------------------------------------------------------------------------------------------------- +void FvUpdater::SetDropOnFinnish(bool value) +{ + m_dropOnFinnish = value; +} + //--------------------------------------------------------------------------------------------------------------------- QPointer FvUpdater::GetProposedUpdate() { @@ -255,10 +264,19 @@ bool FvUpdater::CheckForUpdatesSilent() { if (qApp->Settings()->GetDateOfLastRemind().daysTo(QDate::currentDate()) >= 1) { - return CheckForUpdates(true); + const bool success = CheckForUpdates(true); + if (m_dropOnFinnish && not success) + { + drop(); + } + return success; } else { + if (m_dropOnFinnish) + { + drop(); + } return true; } } @@ -266,7 +284,12 @@ bool FvUpdater::CheckForUpdatesSilent() //--------------------------------------------------------------------------------------------------------------------- bool FvUpdater::CheckForUpdatesNotSilent() { - return CheckForUpdates(false); + const bool success = CheckForUpdates(false); + if (m_dropOnFinnish && not success) + { + drop(); + } + return success; } //--------------------------------------------------------------------------------------------------------------------- @@ -281,7 +304,7 @@ void FvUpdater::startDownloadFeed(const QUrl &url) m_reply = m_qnam.get(request); - connect(m_reply, &QNetworkReply::readyRead, RECEIVER(this)[this]() + connect(m_reply.data(), &QNetworkReply::readyRead, RECEIVER(this)[this]() { // this slot gets called every time the QNetworkReply has new data. // We read all of its new data and write it into the file. @@ -289,7 +312,7 @@ void FvUpdater::startDownloadFeed(const QUrl &url) // signal of the QNetworkReply m_xml.addData(m_reply->readAll()); }); - connect(m_reply, &QNetworkReply::downloadProgress, RECEIVER(this)[this](qint64 bytesRead, qint64 totalBytes) + connect(m_reply.data(), &QNetworkReply::downloadProgress, RECEIVER(this)[this](qint64 bytesRead, qint64 totalBytes) { Q_UNUSED(bytesRead) Q_UNUSED(totalBytes) @@ -299,7 +322,7 @@ void FvUpdater::startDownloadFeed(const QUrl &url) return; } }); - connect(m_reply, &QNetworkReply::finished, this, &FvUpdater::httpFeedDownloadFinished); + connect(m_reply.data(), &QNetworkReply::finished, this, &FvUpdater::httpFeedDownloadFinished); } //--------------------------------------------------------------------------------------------------------------------- @@ -344,7 +367,11 @@ void FvUpdater::httpFeedDownloadFinished() } m_reply->deleteLater(); - m_reply = 0; + + if (m_dropOnFinnish) + { + drop(); + } } //--------------------------------------------------------------------------------------------------------------------- @@ -460,10 +487,7 @@ bool FvUpdater::searchDownloadedFeedForUpdates(const QString &xmlEnclosureUrl, // to the user. // - if (m_proposedUpdate) - { - delete m_proposedUpdate; - } + delete m_proposedUpdate; m_proposedUpdate = new FvAvailableUpdate(this); m_proposedUpdate->SetEnclosureUrl(xmlEnclosureUrl); m_proposedUpdate->SetEnclosureVersion(xmlEnclosureVersion); diff --git a/src/libs/fervor/fvupdater.h b/src/libs/fervor/fvupdater.h index c8a4ae477..c24a09d34 100644 --- a/src/libs/fervor/fvupdater.h +++ b/src/libs/fervor/fvupdater.h @@ -55,6 +55,9 @@ public: void SetFeedURL(const QString &feedURL); QString GetFeedURL() const; + bool IsDropOnFinnish() const; + void SetDropOnFinnish(bool value); + public slots: // Check for updates bool CheckForUpdates(bool silentAsMuchAsItCouldGet = true); @@ -102,10 +105,11 @@ private: // // HTTP feed fetcher infrastructure // - QUrl m_feedURL; // Feed URL that will be fetched - QNetworkAccessManager m_qnam; - QNetworkReply* m_reply; - bool m_httpRequestAborted; + QUrl m_feedURL; // Feed URL that will be fetched + QNetworkAccessManager m_qnam; + QPointer m_reply; + bool m_httpRequestAborted; + bool m_dropOnFinnish; QXmlStreamReader m_xml; // XML data collector and parser diff --git a/src/libs/fervor/fvupdatewindow.cpp b/src/libs/fervor/fvupdatewindow.cpp index d02c43c3c..964369a53 100644 --- a/src/libs/fervor/fvupdatewindow.cpp +++ b/src/libs/fervor/fvupdatewindow.cpp @@ -36,8 +36,7 @@ class QWidget; //--------------------------------------------------------------------------------------------------------------------- FvUpdateWindow::FvUpdateWindow(QWidget *parent) : QDialog(parent), - m_ui(new Ui::FvUpdateWindow), - m_appIconScene(nullptr) + m_ui(new Ui::FvUpdateWindow) { m_ui->setupUi(this); diff --git a/src/libs/fervor/fvupdatewindow.h b/src/libs/fervor/fvupdatewindow.h index 64926f9d3..b27378f54 100644 --- a/src/libs/fervor/fvupdatewindow.h +++ b/src/libs/fervor/fvupdatewindow.h @@ -51,8 +51,6 @@ private: Q_DISABLE_COPY(FvUpdateWindow) Ui::FvUpdateWindow* m_ui; - QGraphicsScene* m_appIconScene; - }; #endif // FVUPDATEWINDOW_H diff --git a/src/libs/vlayout/vbank.cpp b/src/libs/vlayout/vbank.cpp index 17b8eb7cf..9d889a9c7 100644 --- a/src/libs/vlayout/vbank.cpp +++ b/src/libs/vlayout/vbank.cpp @@ -191,7 +191,7 @@ bool VBank::Prepare() for (int i=0; i < details.size(); ++i) { details[i].SetLayoutWidth(layoutWidth); - details[i].SetLayoutAllowencePoints(); + details[i].SetLayoutAllowancePoints(); const qreal d = details.at(i).Diagonal(); if (d > diagonal) diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 1be1f19ff..e8585188e 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -88,7 +88,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern { VLayoutPiece det; det.SetCountourPoints(piece.MainPathPoints(pattern)); - det.SetSeamAllowencePoints(piece.SeamAllowancePoints(pattern), piece.IsSeamAllowance()); + det.SetSeamAllowancePoints(piece.SeamAllowancePoints(pattern), piece.IsSeamAllowance()); det.SetInternlaPathsPoints(piece.GetInternalPathsPoints(pattern)); det.SetName(piece.GetName()); const VPatternPieceData& data = piece.GetPatternPieceData(); @@ -134,34 +134,34 @@ void VLayoutPiece::SetCountourPoints(const QVector &points) //--------------------------------------------------------------------------------------------------------------------- // cppcheck-suppress unusedFunction -QVector VLayoutPiece::GetSeamAllowencePoints() const +QVector VLayoutPiece::GetSeamAllowancePoints() const { - return Map(d->seamAllowence); + return Map(d->seamAllowance); } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::SetSeamAllowencePoints(const QVector &points, bool seamAllowence) +void VLayoutPiece::SetSeamAllowancePoints(const QVector &points, bool seamAllowance) { - if (seamAllowence) + if (seamAllowance) { - SetSeamAllowance(seamAllowence); - d->seamAllowence = points; - if (not d->seamAllowence.isEmpty()) + SetSeamAllowance(seamAllowance); + d->seamAllowance = points; + if (not d->seamAllowance.isEmpty()) { - d->seamAllowence = RemoveDublicates(RoundPoints(d->seamAllowence), false); + d->seamAllowance = RemoveDublicates(RoundPoints(d->seamAllowance), false); } else { - qWarning()<<"Seam allowence is empty."; + qWarning()<<"Seam allowance is empty."; SetSeamAllowance(false); } } } //--------------------------------------------------------------------------------------------------------------------- -QVector VLayoutPiece::GetLayoutAllowencePoints() const +QVector VLayoutPiece::GetLayoutAllowancePoints() const { - return Map(d->layoutAllowence); + return Map(d->layoutAllowance); } //--------------------------------------------------------------------------------------------------------------------- @@ -370,7 +370,7 @@ int VLayoutPiece::DetailEdgesCount() const //--------------------------------------------------------------------------------------------------------------------- int VLayoutPiece::LayoutEdgesCount() const { - return d->layoutAllowence.count(); + return d->layoutAllowance.count(); } //--------------------------------------------------------------------------------------------------------------------- @@ -382,7 +382,7 @@ QLineF VLayoutPiece::DetailEdge(int i) const //--------------------------------------------------------------------------------------------------------------------- QLineF VLayoutPiece::LayoutEdge(int i) const { - return Edge(d->layoutAllowence, i); + return Edge(d->layoutAllowance, i); } //--------------------------------------------------------------------------------------------------------------------- @@ -394,7 +394,7 @@ int VLayoutPiece::DetailEdgeByPoint(const QPointF &p1) const //--------------------------------------------------------------------------------------------------------------------- int VLayoutPiece::LayoutEdgeByPoint(const QPointF &p1) const { - return EdgeByPoint(d->layoutAllowence, p1); + return EdgeByPoint(d->layoutAllowance, p1); } //--------------------------------------------------------------------------------------------------------------------- @@ -403,7 +403,7 @@ QRectF VLayoutPiece::DetailBoundingRect() const QVector points; if (IsSeamAllowance()) { - points = GetSeamAllowencePoints(); + points = GetSeamAllowancePoints(); } else { @@ -417,7 +417,7 @@ QRectF VLayoutPiece::DetailBoundingRect() const //--------------------------------------------------------------------------------------------------------------------- QRectF VLayoutPiece::LayoutBoundingRect() const { - QVector points = GetLayoutAllowencePoints(); + QVector points = GetLayoutAllowancePoints(); points.append(points.first()); return QPolygonF(points).boundingRect(); } @@ -434,7 +434,7 @@ bool VLayoutPiece::isNull() const { if (d->contour.isEmpty() == false && d->layoutWidth > 0) { - if (IsSeamAllowance() && d->seamAllowence.isEmpty() == false) + if (IsSeamAllowance() && d->seamAllowance.isEmpty() == false) { return false; } @@ -452,50 +452,50 @@ bool VLayoutPiece::isNull() const //--------------------------------------------------------------------------------------------------------------------- qint64 VLayoutPiece::Square() const { - if (d->layoutAllowence.isEmpty()) //-V807 + if (d->layoutAllowance.isEmpty()) //-V807 { return 0; } - const qreal res = SumTrapezoids(d->layoutAllowence); + const qreal res = SumTrapezoids(d->layoutAllowance); const qint64 sq = qFloor(qAbs(res/2.0)); return sq; } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::SetLayoutAllowencePoints() +void VLayoutPiece::SetLayoutAllowancePoints() { if (d->layoutWidth > 0) { if (IsSeamAllowance()) { - d->layoutAllowence = Equidistant(PrepareAllowance(GetSeamAllowencePoints()), d->layoutWidth); - if (d->layoutAllowence.isEmpty() == false) + d->layoutAllowance = Equidistant(PrepareAllowance(GetSeamAllowancePoints()), d->layoutWidth); + if (d->layoutAllowance.isEmpty() == false) { #if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) - d->layoutAllowence.remove(d->layoutAllowence.size() - 1); + d->layoutAllowance.remove(d->layoutAllowance.size() - 1); #else - d->layoutAllowence.removeLast(); + d->layoutAllowance.removeLast(); #endif } } else { - d->layoutAllowence = Equidistant(PrepareAllowance(GetContourPoints()), d->layoutWidth); - if (d->layoutAllowence.isEmpty() == false) + d->layoutAllowance = Equidistant(PrepareAllowance(GetContourPoints()), d->layoutWidth); + if (d->layoutAllowance.isEmpty() == false) { #if QT_VERSION < QT_VERSION_CHECK(5, 1, 0) - d->layoutAllowence.remove(d->layoutAllowence.size() - 1); + d->layoutAllowance.remove(d->layoutAllowance.size() - 1); #else - d->layoutAllowence.removeLast(); + d->layoutAllowance.removeLast(); #endif } } } else { - d->layoutAllowence.clear(); + d->layoutAllowance.clear(); } } @@ -557,10 +557,10 @@ QPainterPath VLayoutPiece::ContourPath() const } path.lineTo(points.at(0)); - // seam allowence + // seam allowance if (IsSeamAllowance() == true) { - points = GetSeamAllowencePoints(); + points = GetSeamAllowancePoints(); if (points.last().toPoint() != points.first().toPoint()) { @@ -759,12 +759,12 @@ void VLayoutPiece::CreateTextItem(int i, QGraphicsItem *parent) const } //--------------------------------------------------------------------------------------------------------------------- -QPainterPath VLayoutPiece::LayoutAllowencePath() const +QPainterPath VLayoutPiece::LayoutAllowancePath() const { QPainterPath path; path.setFillRule(Qt::WindingFill); - const QVector points = GetLayoutAllowencePoints(); + const QVector points = GetLayoutAllowancePoints(); path.moveTo(points.at(0)); for (qint32 i = 1; i < points.count(); ++i) { @@ -841,7 +841,7 @@ QVector VLayoutPiece::DetailPath() const { if (IsSeamAllowance()) { - return d->seamAllowence; + return d->seamAllowance; } else { diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index bf7ae6c84..5bd966a0a 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -73,11 +73,11 @@ public: QVector GetContourPoints() const; void SetCountourPoints(const QVector &points); - QVector GetSeamAllowencePoints() const; - void SetSeamAllowencePoints(const QVector &points, bool seamAllowence = true); + QVector GetSeamAllowancePoints() const; + void SetSeamAllowancePoints(const QVector &points, bool seamAllowance = true); - QVector GetLayoutAllowencePoints() const; - void SetLayoutAllowencePoints(); + QVector GetLayoutAllowancePoints() const; + void SetLayoutAllowancePoints(); QVector> GetInternlaPathsPoints() const; void SetInternlaPathsPoints(const QVector> &internalPathsPoints); @@ -119,7 +119,7 @@ public: qint64 Square() const; QPainterPath ContourPath() const; - QPainterPath LayoutAllowencePath() const; + QPainterPath LayoutAllowancePath() const; QGraphicsItem *GetItem() const Q_REQUIRED_RESULT; private: diff --git a/src/libs/vlayout/vlayoutpiece_p.h b/src/libs/vlayout/vlayoutpiece_p.h index dc2e3d821..aab150348 100644 --- a/src/libs/vlayout/vlayoutpiece_p.h +++ b/src/libs/vlayout/vlayoutpiece_p.h @@ -48,8 +48,8 @@ class VLayoutPieceData : public QSharedData public: VLayoutPieceData() : contour(), - seamAllowence(), - layoutAllowence(), + seamAllowance(), + layoutAllowance(), m_internalPaths(), matrix(), layoutWidth(0), @@ -68,8 +68,8 @@ public: VLayoutPieceData(const VLayoutPieceData &detail) : QSharedData(detail), contour(detail.contour), - seamAllowence(detail.seamAllowence), - layoutAllowence(detail.layoutAllowence), + seamAllowance(detail.seamAllowance), + layoutAllowance(detail.layoutAllowance), m_internalPaths(detail.m_internalPaths), matrix(detail.matrix), layoutWidth(detail.layoutWidth), @@ -90,19 +90,19 @@ public: /** @brief contour list of contour points. */ QVector contour; - /** @brief seamAllowence list of seam allowence points. */ - QVector seamAllowence; + /** @brief seamAllowance list of seam allowance points. */ + QVector seamAllowance; - /** @brief layoutAllowence list of layout allowence points. */ - QVector layoutAllowence; + /** @brief layoutAllowance list of layout allowance points. */ + QVector layoutAllowance; - /** @brief m_layoutAllowence list of internal paths points. */ + /** @brief m_internalPaths list of internal paths points. */ QVector> m_internalPaths; /** @brief matrix transformation matrix*/ QTransform matrix; - /** @brief layoutWidth value layout allowence width in pixels. */ + /** @brief layoutWidth value layout allowance width in pixels. */ qreal layoutWidth; bool mirror; diff --git a/src/libs/vlayout/vposition.cpp b/src/libs/vlayout/vposition.cpp index cbe25ef01..6c7345a67 100644 --- a/src/libs/vlayout/vposition.cpp +++ b/src/libs/vlayout/vposition.cpp @@ -178,7 +178,7 @@ void VPosition::DrawDebug(const VContour &contour, const VLayoutPiece &detail, i #ifdef SHOW_CANDIDATE paint.setPen(QPen(Qt::darkGreen, 6, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin)); - p = DrawContour(detail.GetLayoutAllowencePoints()); + p = DrawContour(detail.GetLayoutAllowancePoints()); p.translate(biasWidth/2, biasHeight/2); paint.drawPath(p); #else @@ -386,7 +386,7 @@ VPosition::CrossingType VPosition::Crossing(const VLayoutPiece &detail) const } const QPainterPath gPath = gContour.ContourPath(); - if (not gPath.intersects(detail.LayoutAllowencePath()) && not gPath.contains(detail.ContourPath())) + if (not gPath.intersects(detail.LayoutAllowancePath()) && not gPath.contains(detail.ContourPath())) { return CrossingType::NoIntersection; } diff --git a/src/libs/vlayout/vposter.cpp b/src/libs/vlayout/vposter.cpp index 5f52cb1b5..fbad63ee1 100644 --- a/src/libs/vlayout/vposter.cpp +++ b/src/libs/vlayout/vposter.cpp @@ -44,7 +44,7 @@ //--------------------------------------------------------------------------------------------------------------------- VPoster::VPoster(const QPrinter *printer) - :printer(printer), allowence(static_cast(qRound(10./25.4*PrintDPI)))//1 cm + :printer(printer), allowance(static_cast(qRound(10./25.4*PrintDPI)))//1 cm { } @@ -92,7 +92,7 @@ QVector VPoster::Borders(QGraphicsItem *parent, const PosterDat data.append(line); auto *scissors = new QGraphicsPixmapItem(QPixmap("://scissors_vertical.png"), parent); - scissors->setPos(rec.x(), rec.y() + rec.height()-static_cast(allowence)); + scissors->setPos(rec.x(), rec.y() + rec.height()-static_cast(allowance)); data.append(scissors); } @@ -100,8 +100,8 @@ QVector VPoster::Borders(QGraphicsItem *parent, const PosterDat {// Right border auto *line = new QGraphicsLineItem(parent); line->setPen(pen); - line->setLine(rec.x() + rec.width()-static_cast(allowence), rec.y(), - rec.x() + rec.width()-static_cast(allowence), rec.y() + rec.height()); + line->setLine(rec.x() + rec.width()-static_cast(allowance), rec.y(), + rec.x() + rec.width()-static_cast(allowance), rec.y() + rec.height()); data.append(line); } @@ -113,7 +113,7 @@ QVector VPoster::Borders(QGraphicsItem *parent, const PosterDat data.append(line); auto *scissors = new QGraphicsPixmapItem(QPixmap("://scissors_horizontal.png"), parent); - scissors->setPos(rec.x() + rec.width()-static_cast(allowence), rec.y()); + scissors->setPos(rec.x() + rec.width()-static_cast(allowance), rec.y()); data.append(scissors); } @@ -122,15 +122,15 @@ QVector VPoster::Borders(QGraphicsItem *parent, const PosterDat // Bottom border (mandatory) auto *line = new QGraphicsLineItem(parent); line->setPen(pen); - line->setLine(rec.x(), rec.y() + rec.height()-static_cast(allowence), - rec.x() + rec.width(), rec.y() + rec.height()-static_cast(allowence)); + line->setLine(rec.x(), rec.y() + rec.height()-static_cast(allowance), + rec.x() + rec.width(), rec.y() + rec.height()-static_cast(allowance)); data.append(line); if (img.row == img.rows-1) { auto *scissors = new QGraphicsPixmapItem(QPixmap("://scissors_horizontal.png"), parent); - scissors->setPos(rec.x() + rec.width()-static_cast(allowence), - rec.y() + rec.height()-static_cast(allowence)); + scissors->setPos(rec.x() + rec.width()-static_cast(allowance), + rec.y() + rec.height()-static_cast(allowance)); data.append(scissors); } } @@ -140,8 +140,8 @@ QVector VPoster::Borders(QGraphicsItem *parent, const PosterDat const int layoutX = 15; const int layoutY = 5; - labels->setPos(rec.x() + layoutX, rec.y() + rec.height()-static_cast(allowence)+layoutY); - labels->setTextWidth(rec.width()-(static_cast(allowence)+layoutX)); + labels->setPos(rec.x() + layoutX, rec.y() + rec.height()-static_cast(allowance)+layoutY); + labels->setTextWidth(rec.width()-(static_cast(allowance)+layoutX)); const QString grid = tr("Grid ( %1 , %2 )").arg(img.row+1).arg(img.column+1); const QString page = tr("Page %1 of %2").arg(img.row*(img.columns)+img.column+1).arg(img.rows*img.columns); @@ -198,18 +198,18 @@ int VPoster::CountRows(int height) const // * // ― - const int pCount = qCeil(imgLength/pageLength);// Pages count without allowence (or allowence = 0) (3) + const int pCount = qCeil(imgLength/pageLength);// Pages count without allowance (or allowance = 0) (3) - // Calculate how many pages will be after using allowence. + // Calculate how many pages will be after using allowance. // We know start pages count. This number not enought because - // each n-1 pages add (n-1)*allowence length to page (1). - const qreal addionalLength = (pCount-1)*static_cast(allowence); //-V636 + // each n-1 pages add (n-1)*allowance length to page (1). + const qreal addionalLength = (pCount-1)*static_cast(allowance); //-V636 // Calculate additional length form pages that will cover this length (2). // In the end add page length (3). // Bottom page have mandatory border (4) return qCeil((addionalLength + - qCeil(addionalLength/pageLength)*static_cast(allowence) + static_cast(allowence) + + qCeil(addionalLength/pageLength)*static_cast(allowance) + static_cast(allowance) + imgLength)/pageLength); } @@ -228,16 +228,16 @@ int VPoster::CountColumns(int width) const // |----| // ^ // (2) - const int pCount = qCeil(imgLength/pageLength);// Pages count without allowence (or allowence = 0) (3) + const int pCount = qCeil(imgLength/pageLength);// Pages count without allowance (or allowance = 0) (3) - // Calculate how many pages will be after using allowence. + // Calculate how many pages will be after using allowance. // We know start pages count. This number not enought because - // each n-1 pages add (n-1)*allowence length to page (1). - const qreal addionalLength = (pCount-1)*static_cast(allowence); //-V636 + // each n-1 pages add (n-1)*allowance length to page (1). + const qreal addionalLength = (pCount-1)*static_cast(allowance); //-V636 // Calculate additional length form pages that will cover this length (2). // In the end add page length (3). - return qCeil((addionalLength + qCeil(addionalLength/pageLength)*static_cast(allowence) + + return qCeil((addionalLength + qCeil(addionalLength/pageLength)*static_cast(allowance) + imgLength)/pageLength); } @@ -246,8 +246,8 @@ PosterData VPoster::Cut(int i, int j, const QRect &imageRect) const { Q_UNUSED(imageRect) - const int x = j*PageRect().width() - j*static_cast(allowence); - const int y = i*PageRect().height() - i*static_cast(allowence); + const int x = j*PageRect().width() - j*static_cast(allowance); + const int y = i*PageRect().height() - i*static_cast(allowance); SCASSERT(x <= imageRect.width()) SCASSERT(y <= imageRect.height()) diff --git a/src/libs/vlayout/vposter.h b/src/libs/vlayout/vposter.h index 58047a176..6a4da32e5 100644 --- a/src/libs/vlayout/vposter.h +++ b/src/libs/vlayout/vposter.h @@ -48,7 +48,7 @@ struct PosterData rect(){} quint32 index; // paper index - quint32 row; // positions in the greed + quint32 row; // positions in the grid quint32 column; quint32 rows; quint32 columns; @@ -66,7 +66,7 @@ public: QVector Borders(QGraphicsItem *parent, const PosterData &img, int sheets) const; private: const QPrinter *printer; - quint32 allowence; + quint32 allowance; int CountRows(int height) const; int CountColumns(int width) const;