Merged from develop
--HG-- branch : feature
This commit is contained in:
commit
b48ac019d7
|
@ -5,7 +5,7 @@ Valentina Web page: http://www.valentina-project.org/
|
||||||
Wiki: https://wiki.valentinaproject.org
|
Wiki: https://wiki.valentinaproject.org
|
||||||
Valentina user manual https://bitbucket.org/dismine/valentina/wiki/manual/Content
|
Valentina user manual https://bitbucket.org/dismine/valentina/wiki/manual/Content
|
||||||
Valentina main repository: https://bitbucket.org/dismine/valentina/overview
|
Valentina main repository: https://bitbucket.org/dismine/valentina/overview
|
||||||
Valentina mail list (forum) https://groups.google.com/forum/#!forum/valentina-project-list
|
Forum http://forum.valentina-project.org/
|
||||||
PPA for Ubuntu (develop): https://launchpad.net/~dismine/+archive/valentina-dev
|
PPA for Ubuntu (develop): https://launchpad.net/~dismine/+archive/valentina-dev
|
||||||
Help translate https://www.transifex.com/organization/valentina
|
Help translate https://www.transifex.com/organization/valentina
|
||||||
IRC channel: #valentina on irc.freenode.net.
|
IRC channel: #valentina on irc.freenode.net.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
image: gcc
|
image: dismine/docker-valentina
|
||||||
pipelines:
|
pipelines:
|
||||||
default:
|
default:
|
||||||
- step:
|
- step:
|
||||||
|
@ -12,8 +12,6 @@ pipelines:
|
||||||
- uname -a
|
- uname -a
|
||||||
- grep -i processor /proc/cpuinfo | wc -l
|
- grep -i processor /proc/cpuinfo | wc -l
|
||||||
- gcc --version
|
- gcc --version
|
||||||
- apt-get update # required to install qt
|
|
||||||
- apt-get install -y xvfb qtbase5-dev libqt5svg5-dev qt5-default qttools5-dev-tools libqt5xmlpatterns5-dev libqt5core5a libqt5gui5 libqt5printsupport5 libqt5svg5 libqt5widgets5 libqt5xml5 libqt5xmlpatterns5 xpdf
|
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- qmake --version
|
- qmake --version
|
||||||
|
|
|
@ -228,7 +228,6 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress uninitMemberVar
|
|
||||||
MApplication::MApplication(int &argc, char **argv)
|
MApplication::MApplication(int &argc, char **argv)
|
||||||
:VAbstractApplication(argc, argv),
|
:VAbstractApplication(argc, argv),
|
||||||
mainWindows(),
|
mainWindows(),
|
||||||
|
|
|
@ -574,8 +574,7 @@ void TMainWindow::FileSave()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QString error;
|
QString error;
|
||||||
bool result = SaveMeasurements(curFile, error);
|
if (not SaveMeasurements(curFile, error))
|
||||||
if (not result)
|
|
||||||
{
|
{
|
||||||
QMessageBox messageBox;
|
QMessageBox messageBox;
|
||||||
messageBox.setIcon(QMessageBox::Warning);
|
messageBox.setIcon(QMessageBox::Warning);
|
||||||
|
@ -1534,9 +1533,7 @@ void TMainWindow::SaveMValue()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool ok = EvalFormula(text, true, meash->GetData(), ui->labelCalculatedValue);
|
if (not EvalFormula(text, true, meash->GetData(), ui->labelCalculatedValue))
|
||||||
|
|
||||||
if (not ok)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -615,9 +615,7 @@ void DialogIncrements::SaveIncrFormula()
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(nameField->text());
|
QSharedPointer<VIncrement> incr = data->GetVariable<VIncrement>(nameField->text());
|
||||||
const bool ok = EvalIncrementFormula(text, true, incr->GetData(), ui->labelCalculatedValue);
|
if (not EvalIncrementFormula(text, true, incr->GetData(), ui->labelCalculatedValue))
|
||||||
|
|
||||||
if (not ok)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,7 @@ bool DialogSaveLayout::TestPdf()
|
||||||
#else
|
#else
|
||||||
proc.start(PDFTOPS); // Seek pdftops in standard path
|
proc.start(PDFTOPS); // Seek pdftops in standard path
|
||||||
#endif
|
#endif
|
||||||
if (proc.waitForFinished(15000))
|
if (proc.waitForFinished(15000) || proc.state() == QProcess::NotRunning)
|
||||||
{
|
{
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1021,7 +1021,7 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &
|
||||||
SCASSERT(scene != nullptr);
|
SCASSERT(scene != nullptr);
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
VToolBasePoint *spoint = 0;
|
VToolBasePoint *spoint = nullptr;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
quint32 id = 0;
|
quint32 id = 0;
|
||||||
|
@ -1034,7 +1034,7 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &
|
||||||
const qreal y = qApp->toPixel(GetParametrDouble(domElement, AttrY, "10.0"));
|
const qreal y = qApp->toPixel(GetParametrDouble(domElement, AttrY, "10.0"));
|
||||||
|
|
||||||
VPointF *point = new VPointF(x, y, name, mx, my);
|
VPointF *point = new VPointF(x, y, name, mx, my);
|
||||||
VToolBasePoint::Create(id, nameActivPP, point, scene, this, data, parse, Source::FromFile);
|
spoint = VToolBasePoint::Create(id, nameActivPP, point, scene, this, data, parse, Source::FromFile);
|
||||||
}
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -262,7 +262,7 @@ void VAbstractConverter::ValidateInputFile(const QString ¤tSchema) const
|
||||||
{
|
{
|
||||||
if (ver < MinVer())
|
if (ver < MinVer())
|
||||||
{ // Version less than minimally supported version. Can't do anything.
|
{ // Version less than minimally supported version. Can't do anything.
|
||||||
throw e;
|
throw;
|
||||||
}
|
}
|
||||||
else if (ver > MaxVer())
|
else if (ver > MaxVer())
|
||||||
{ // Version bigger than maximum supported version. We still have a chance to open the file.
|
{ // Version bigger than maximum supported version. We still have a chance to open the file.
|
||||||
|
@ -278,7 +278,7 @@ void VAbstractConverter::ValidateInputFile(const QString ¤tSchema) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Unexpected version. Most time mean that we do not catch all versions between min and max.
|
{ // Unexpected version. Most time mean that we do not catch all versions between min and max.
|
||||||
throw e;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return; // All is fine and we can try to convert to current max version.
|
return; // All is fine and we can try to convert to current max version.
|
||||||
|
|
|
@ -1218,30 +1218,19 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
||||||
switch (tags.indexOf(tag))
|
switch (tags.indexOf(tag))
|
||||||
{
|
{
|
||||||
case 0: //TagUnit
|
case 0: //TagUnit
|
||||||
{
|
return QDomElement();// Mandatory tag
|
||||||
return QDomElement();
|
|
||||||
break;// Mandatory tag
|
|
||||||
}
|
|
||||||
case 1: //TagImage
|
case 1: //TagImage
|
||||||
{
|
|
||||||
element = createElement(TagImage);
|
element = createElement(TagImage);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 2: //TagAuthor
|
case 2: //TagAuthor
|
||||||
{
|
|
||||||
element = createElement(TagAuthor);
|
element = createElement(TagAuthor);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 3: //TagDescription
|
case 3: //TagDescription
|
||||||
{
|
|
||||||
element = createElement(TagDescription);
|
element = createElement(TagDescription);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 4: //TagNotes
|
case 4: //TagNotes
|
||||||
{
|
|
||||||
element = createElement(TagNotes);
|
element = createElement(TagNotes);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 5: //TagGradation
|
case 5: //TagGradation
|
||||||
{
|
{
|
||||||
element = createElement(TagGradation);
|
element = createElement(TagGradation);
|
||||||
|
@ -1256,46 +1245,28 @@ QDomElement VAbstractPattern::CheckTagExists(const QString &tag)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6: // TagPatternName
|
case 6: // TagPatternName
|
||||||
{
|
|
||||||
element = createElement(TagPatternName);
|
element = createElement(TagPatternName);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 7: // TagPatternNum
|
case 7: // TagPatternNum
|
||||||
{
|
|
||||||
element = createElement(TagPatternNum);
|
element = createElement(TagPatternNum);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 8: // TagCompanyName
|
case 8: // TagCompanyName
|
||||||
{
|
|
||||||
element = createElement(TagCompanyName);
|
element = createElement(TagCompanyName);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 9: // TagCustomerName
|
case 9: // TagCustomerName
|
||||||
{
|
|
||||||
element = createElement(TagCustomerName);
|
element = createElement(TagCustomerName);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 10: // TagSize
|
case 10: // TagSize
|
||||||
{
|
|
||||||
element = createElement(TagSize);
|
element = createElement(TagSize);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 11: // TagShowDate
|
case 11: // TagShowDate
|
||||||
{
|
|
||||||
element = createElement(TagShowDate);
|
element = createElement(TagShowDate);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 12: // TagShowMeasurements
|
case 12: // TagShowMeasurements
|
||||||
{
|
|
||||||
element = createElement(TagShowMeasurements);
|
element = createElement(TagShowMeasurements);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
|
||||||
return QDomElement();
|
return QDomElement();
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
InsertTag(tags, element);
|
InsertTag(tags, element);
|
||||||
return element;
|
return element;
|
||||||
|
|
|
@ -351,13 +351,13 @@ quint32 VDomDocument::GetParametrId(const QDomElement &domElement) const
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
quint32 id = 0;
|
quint32 id = NULL_ID;
|
||||||
|
|
||||||
QString message = tr("Got wrong parameter id. Need only id > 0.");
|
const QString message = tr("Got wrong parameter id. Need only id > 0.");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
id = GetParametrUInt(domElement, VDomDocument::AttrId, NULL_ID_STR);
|
id = GetParametrUInt(domElement, VDomDocument::AttrId, NULL_ID_STR);
|
||||||
if (id <= 0)
|
if (id == NULL_ID)
|
||||||
{
|
{
|
||||||
throw VExceptionWrongId(message, domElement);
|
throw VExceptionWrongId(message, domElement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ class QMUPARSERSHARED_EXPORT QmuParserTester : public QObject // final
|
||||||
public:
|
public:
|
||||||
typedef int ( QmuParserTester::*testfun_type ) ();
|
typedef int ( QmuParserTester::*testfun_type ) ();
|
||||||
|
|
||||||
QmuParserTester(QObject *parent = nullptr);
|
explicit QmuParserTester(QObject *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void Run();
|
void Run();
|
||||||
|
|
|
@ -172,12 +172,12 @@ bool DL_Dxf::in(std::stringstream& stream,
|
||||||
*/
|
*/
|
||||||
bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface)
|
bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface)
|
||||||
{
|
{
|
||||||
static int line = 1;
|
|
||||||
|
|
||||||
// Read one group of the DXF file and strip the lines:
|
// Read one group of the DXF file and strip the lines:
|
||||||
if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, fp) &&
|
if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, fp) &&
|
||||||
DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, fp, false) )
|
DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, fp, false) )
|
||||||
{
|
{
|
||||||
|
static int line = 1;
|
||||||
|
|
||||||
groupCode = static_cast<quint32>(toInt(groupCodeTmp));
|
groupCode = static_cast<quint32>(toInt(groupCodeTmp));
|
||||||
|
|
||||||
creationInterface->processCodeValuePair(groupCode, groupValue);
|
creationInterface->processCodeValuePair(groupCode, groupValue);
|
||||||
|
@ -196,12 +196,11 @@ bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface)
|
||||||
bool DL_Dxf::readDxfGroups(std::stringstream& stream,
|
bool DL_Dxf::readDxfGroups(std::stringstream& stream,
|
||||||
DL_CreationInterface* creationInterface)
|
DL_CreationInterface* creationInterface)
|
||||||
{
|
{
|
||||||
static int line = 1;
|
|
||||||
|
|
||||||
// Read one group of the DXF file and chop the lines:
|
// Read one group of the DXF file and chop the lines:
|
||||||
if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, stream) &&
|
if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, stream) &&
|
||||||
DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, stream, false) )
|
DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, stream, false) )
|
||||||
{
|
{
|
||||||
|
static int line = 1;
|
||||||
|
|
||||||
groupCode = static_cast<quint32>(toInt(groupCodeTmp));
|
groupCode = static_cast<quint32>(toInt(groupCodeTmp));
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class VArcData : public QSharedData
|
||||||
public:
|
public:
|
||||||
VArcData();
|
VArcData();
|
||||||
VArcData(qreal radius, QString formulaRadius);
|
VArcData(qreal radius, QString formulaRadius);
|
||||||
VArcData(qreal radius);
|
explicit VArcData(qreal radius);
|
||||||
VArcData(const VArcData &arc);
|
VArcData(const VArcData &arc);
|
||||||
virtual ~VArcData();
|
virtual ~VArcData();
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<VEllipticalArcData> d;
|
QSharedDataPointer<VEllipticalArcData> d;
|
||||||
|
|
||||||
|
// cppcheck-suppress unusedPrivateFunction
|
||||||
QVector<qreal> GetAngles () const;
|
QVector<qreal> GetAngles () const;
|
||||||
qreal MaxLength() const;
|
qreal MaxLength() const;
|
||||||
QPointF GetPoint (qreal angle) const;
|
QPointF GetPoint (qreal angle) const;
|
||||||
|
|
|
@ -681,7 +681,7 @@ void VLayoutDetail::SetMirror(bool value)
|
||||||
* @param dAng angle of rotation
|
* @param dAng angle of rotation
|
||||||
* @return position of point pt after rotating it around the center for dAng radians
|
* @return position of point pt after rotating it around the center for dAng radians
|
||||||
*/
|
*/
|
||||||
QPointF VLayoutDetail::RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng) const
|
QPointF VLayoutDetail::RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng)
|
||||||
{
|
{
|
||||||
QPointF ptDest;
|
QPointF ptDest;
|
||||||
QPointF ptRel = pt - ptCenter;
|
QPointF ptRel = pt - ptCenter;
|
||||||
|
@ -723,10 +723,10 @@ QVector<QPointF> VLayoutDetail::Mirror(const QVector<QPointF> &points) const
|
||||||
* @param pt2 second point
|
* @param pt2 second point
|
||||||
* @return Euclidian distance between the two points
|
* @return Euclidian distance between the two points
|
||||||
*/
|
*/
|
||||||
qreal VLayoutDetail::GetDistance(const QPointF &pt1, const QPointF &pt2) const
|
qreal VLayoutDetail::GetDistance(const QPointF &pt1, const QPointF &pt2)
|
||||||
{
|
{
|
||||||
qreal dX = pt1.x() - pt2.x();
|
const qreal dX = pt1.x() - pt2.x();
|
||||||
qreal dY = pt1.y() - pt2.y();
|
const qreal dY = pt1.y() - pt2.y();
|
||||||
|
|
||||||
return qSqrt(dX*dX + dY*dY);
|
return qSqrt(dX*dX + dY*dY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,9 +100,9 @@ private:
|
||||||
QVector<QPointF> Map(const QVector<QPointF> &points) const;
|
QVector<QPointF> Map(const QVector<QPointF> &points) const;
|
||||||
static QVector<QPointF> RoundPoints(const QVector<QPointF> &points);
|
static QVector<QPointF> RoundPoints(const QVector<QPointF> &points);
|
||||||
|
|
||||||
QPointF RotatePoint(const QPointF& ptCenter, const QPointF& pt, qreal dAng) const;
|
static QPointF RotatePoint(const QPointF& ptCenter, const QPointF& pt, qreal dAng);
|
||||||
QVector<QPointF> Mirror(const QVector<QPointF>& points) const;
|
QVector<QPointF> Mirror(const QVector<QPointF>& points) const;
|
||||||
qreal GetDistance(const QPointF& pt1, const QPointF& pt2) const;
|
static qreal GetDistance(const QPointF& pt1, const QPointF& pt2);
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_TYPEINFO(VLayoutDetail, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(VLayoutDetail, Q_MOVABLE_TYPE);
|
||||||
|
|
|
@ -327,7 +327,7 @@ QStringList VTextManager::SplitString(const QString &qs, qreal fW, const QFontMe
|
||||||
{
|
{
|
||||||
if (qsCurrent.length() > 0)
|
if (qsCurrent.length() > 0)
|
||||||
{
|
{
|
||||||
qsCurrent += QLatin1Literal(" ");
|
qsCurrent += QLatin1String(" ");
|
||||||
}
|
}
|
||||||
// check if another word can be added into current line
|
// check if another word can be added into current line
|
||||||
if (fm.width(qsCurrent + qslWords[i]) > fW)
|
if (fm.width(qsCurrent + qslWords[i]) > fW)
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
void Update(const VAbstractPattern* pDoc);
|
void Update(const VAbstractPattern* pDoc);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QStringList SplitString(const QString& qs, qreal fW, const QFontMetrics& fm);
|
static QStringList SplitString(const QString& qs, qreal fW, const QFontMetrics& fm);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QFont m_font;
|
QFont m_font;
|
||||||
|
|
|
@ -88,8 +88,9 @@ QString compilerString()
|
||||||
{
|
{
|
||||||
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
|
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
return QStringLiteral("<unknown compiler>");
|
||||||
#endif
|
#endif
|
||||||
return QLatin1String("<unknown compiler>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -90,7 +90,7 @@ QxtCsvModel::QxtCsvModel(QIODevice *file, QObject *parent, bool withHeader, QCha
|
||||||
|
|
||||||
\sa setSource
|
\sa setSource
|
||||||
*/
|
*/
|
||||||
QxtCsvModel::QxtCsvModel(const QString filename, QObject *parent, bool withHeader, QChar separator)
|
QxtCsvModel::QxtCsvModel(const QString &filename, QObject *parent, bool withHeader, QChar separator)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
{
|
{
|
||||||
QXT_INIT_PRIVATE(QxtCsvModel);
|
QXT_INIT_PRIVATE(QxtCsvModel);
|
||||||
|
@ -176,7 +176,7 @@ QVariant QxtCsvModel::headerData(int section, Qt::Orientation orientation, int r
|
||||||
|
|
||||||
Reads in a CSV file from the provided \a file using \a codec.
|
Reads in a CSV file from the provided \a file using \a codec.
|
||||||
*/
|
*/
|
||||||
void QxtCsvModel::setSource(const QString filename, bool withHeader, QChar separator, QTextCodec* codec)
|
void QxtCsvModel::setSource(const QString &filename, bool withHeader, QChar separator, QTextCodec* codec)
|
||||||
{
|
{
|
||||||
QFile src(filename);
|
QFile src(filename);
|
||||||
setSource(&src, withHeader, separator, codec);
|
setSource(&src, withHeader, separator, codec);
|
||||||
|
@ -194,6 +194,7 @@ void QxtCsvModel::setSource(const QString filename, bool withHeader, QChar separ
|
||||||
void QxtCsvModel::setSource(QIODevice *file, bool withHeader, QChar separator, QTextCodec* codec)
|
void QxtCsvModel::setSource(QIODevice *file, bool withHeader, QChar separator, QTextCodec* codec)
|
||||||
{
|
{
|
||||||
QxtCsvModelPrivate* d_ptr = &qxt_d();
|
QxtCsvModelPrivate* d_ptr = &qxt_d();
|
||||||
|
// cppcheck-suppress unreadVariable
|
||||||
bool headerSet = !withHeader;
|
bool headerSet = !withHeader;
|
||||||
if (not file->isOpen())
|
if (not file->isOpen())
|
||||||
{
|
{
|
||||||
|
@ -653,7 +654,7 @@ void QxtCsvModel::toCSV(QIODevice* dest, bool withHeader, QChar separator, QText
|
||||||
Fields in the output file will be separated by \a separator. Set \a withHeader to true
|
Fields in the output file will be separated by \a separator. Set \a withHeader to true
|
||||||
to output a row of headers at the top of the file.
|
to output a row of headers at the top of the file.
|
||||||
*/
|
*/
|
||||||
void QxtCsvModel::toCSV(const QString filename, bool withHeader, QChar separator, QTextCodec* codec) const
|
void QxtCsvModel::toCSV(const QString &filename, bool withHeader, QChar separator, QTextCodec* codec) const
|
||||||
{
|
{
|
||||||
QFile dest(filename);
|
QFile dest(filename);
|
||||||
toCSV(&dest, withHeader, separator, codec);
|
toCSV(&dest, withHeader, separator, codec);
|
||||||
|
@ -695,6 +696,7 @@ void QxtCsvModel::setQuoteMode(QuoteMode mode)
|
||||||
*/
|
*/
|
||||||
void QxtCsvModel::setText(int row, int column, const QString& value)
|
void QxtCsvModel::setText(int row, int column, const QString& value)
|
||||||
{
|
{
|
||||||
|
// cppcheck-suppress indexCalled
|
||||||
setData(index(row, column), value);
|
setData(index(row, column), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,6 +707,7 @@ void QxtCsvModel::setText(int row, int column, const QString& value)
|
||||||
*/
|
*/
|
||||||
QString QxtCsvModel::text(int row, int column) const
|
QString QxtCsvModel::text(int row, int column) const
|
||||||
{
|
{
|
||||||
|
// cppcheck-suppress indexCalled
|
||||||
return data(index(row, column)).toString();
|
return data(index(row, column)).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,9 @@ class QxtCsvModel : public QAbstractTableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QxtCsvModel(QObject *parent = nullptr);
|
explicit QxtCsvModel(QObject *parent = nullptr);
|
||||||
explicit QxtCsvModel(QIODevice *file, QObject *parent = nullptr, bool withHeader = false, QChar separator = ',');
|
explicit QxtCsvModel(QIODevice *file, QObject *parent = nullptr, bool withHeader = false, QChar separator = ',');
|
||||||
explicit QxtCsvModel(const QString filename, QObject *parent = nullptr, bool withHeader = false,
|
explicit QxtCsvModel(const QString &filename, QObject *parent = nullptr, bool withHeader = false,
|
||||||
QChar separator = ',');
|
QChar separator = ',');
|
||||||
virtual ~QxtCsvModel();
|
virtual ~QxtCsvModel();
|
||||||
|
|
||||||
|
@ -82,10 +82,11 @@ public:
|
||||||
virtual bool removeColumns(int col, int count, const QModelIndex& parent = QModelIndex()) Q_DECL_OVERRIDE;
|
virtual bool removeColumns(int col, int count, const QModelIndex& parent = QModelIndex()) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
void setSource(QIODevice *file, bool withHeader = false, QChar separator = ',', QTextCodec* codec = nullptr);
|
void setSource(QIODevice *file, bool withHeader = false, QChar separator = ',', QTextCodec* codec = nullptr);
|
||||||
void setSource(const QString filename, bool withHeader = false, QChar separator = ',', QTextCodec* codec = nullptr);
|
void setSource(const QString &filename, bool withHeader = false, QChar separator = ',',
|
||||||
|
QTextCodec* codec = nullptr);
|
||||||
|
|
||||||
void toCSV(QIODevice *file, bool withHeader = false, QChar separator = ',', QTextCodec* codec = nullptr) const;
|
void toCSV(QIODevice *file, bool withHeader = false, QChar separator = ',', QTextCodec* codec = nullptr) const;
|
||||||
void toCSV(const QString filename, bool withHeader = false, QChar separator = ',',
|
void toCSV(const QString &filename, bool withHeader = false, QChar separator = ',',
|
||||||
QTextCodec* codec = nullptr) const;
|
QTextCodec* codec = nullptr) const;
|
||||||
|
|
||||||
enum QuoteOption { NoQuotes = 0,
|
enum QuoteOption { NoQuotes = 0,
|
||||||
|
|
|
@ -80,11 +80,13 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
|
||||||
Settings()->sync();
|
Settings()->sync();
|
||||||
});
|
});
|
||||||
|
|
||||||
#if !defined(V_NO_ASSERT)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 1)
|
||||||
|
#if defined(V_NO_ASSERT)
|
||||||
// Ignore SSL-related warnings
|
// Ignore SSL-related warnings
|
||||||
// See issue #528: Error: QSslSocket: cannot resolve SSLv2_client_method.
|
// See issue #528: Error: QSslSocket: cannot resolve SSLv2_client_method.
|
||||||
qputenv("QT_LOGGING_RULES", "qt.network.ssl.warning=false");
|
qputenv("QT_LOGGING_RULES", "qt.network.ssl.warning=false");
|
||||||
#endif //!defined(V_NO_ASSERT)
|
#endif //defined(V_NO_ASSERT)
|
||||||
|
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 4, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -134,6 +134,7 @@ static point2d_t* point_alloc()
|
||||||
|
|
||||||
p = (point2d_t*)malloc(sizeof(point2d_t));
|
p = (point2d_t*)malloc(sizeof(point2d_t));
|
||||||
assert( p != NULL );
|
assert( p != NULL );
|
||||||
|
// cppcheck-suppress memsetClassFloat
|
||||||
memset(p, 0, sizeof(point2d_t));
|
memset(p, 0, sizeof(point2d_t));
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
|
@ -784,7 +784,7 @@ QString VTranslateVars::FormulaFromUser(const QString &formula, bool osSeparator
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VTranslateVars::TryFormulaFromUser(const QString &formula, bool osSeparator) const
|
QString VTranslateVars::TryFormulaFromUser(const QString &formula, bool osSeparator)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
QString PostfixOperator(const QString &name) const;
|
QString PostfixOperator(const QString &name) const;
|
||||||
|
|
||||||
QString FormulaFromUser(const QString &formula, bool osSeparator) const;
|
QString FormulaFromUser(const QString &formula, bool osSeparator) const;
|
||||||
QString TryFormulaFromUser(const QString &formula, bool osSeparator) const;
|
static QString TryFormulaFromUser(const QString &formula, bool osSeparator);
|
||||||
QString FormulaToUser(const QString &formula, bool osSeparator) const;
|
QString FormulaToUser(const QString &formula, bool osSeparator) const;
|
||||||
|
|
||||||
virtual void Retranslate() Q_DECL_OVERRIDE;
|
virtual void Retranslate() Q_DECL_OVERRIDE;
|
||||||
|
|
|
@ -599,6 +599,7 @@ bool VToolSplinePath::IsMovable(int index) const
|
||||||
const auto splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
const auto splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||||
|
|
||||||
//index == -1 - can delete, but decided to left
|
//index == -1 - can delete, but decided to left
|
||||||
|
// cppcheck-suppress redundantCondition
|
||||||
if (index == -1 || index < 1 || index > splPath->CountSubSpl())
|
if (index == -1 || index < 1 || index > splPath->CountSubSpl())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -46,10 +46,9 @@ VToolLinePoint::VToolLinePoint(VAbstractPattern *doc, VContainer *data, const qu
|
||||||
const QString &lineColor, const QString &formula, const quint32 &basePointId,
|
const QString &lineColor, const QString &formula, const quint32 &basePointId,
|
||||||
const qreal &angle, QGraphicsItem *parent)
|
const qreal &angle, QGraphicsItem *parent)
|
||||||
:VToolSinglePoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
|
:VToolSinglePoint(doc, data, id, parent), formulaLength(formula), angle(angle), basePointId(basePointId),
|
||||||
mainLine(nullptr), lineColor(ColorBlack)
|
mainLine(nullptr), lineColor(lineColor)
|
||||||
{
|
{
|
||||||
this->typeLine = typeLine;
|
this->typeLine = typeLine;
|
||||||
this->lineColor = lineColor;
|
|
||||||
Q_ASSERT_X(basePointId != 0, Q_FUNC_INFO, "basePointId == 0"); //-V654 //-V712
|
Q_ASSERT_X(basePointId != 0, Q_FUNC_INFO, "basePointId == 0"); //-V654 //-V712
|
||||||
QPointF point1 = *data->GeometricObject<VPointF>(basePointId);
|
QPointF point1 = *data->GeometricObject<VPointF>(basePointId);
|
||||||
QPointF point2 = *data->GeometricObject<VPointF>(id);
|
QPointF point2 = *data->GeometricObject<VPointF>(id);
|
||||||
|
|
|
@ -49,10 +49,9 @@ VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint3
|
||||||
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
const QString &typeLine, const QString &lineColor, const Source &typeCreation,
|
||||||
QGraphicsItem *parent)
|
QGraphicsItem *parent)
|
||||||
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint),
|
:VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint),
|
||||||
lineColor(ColorBlack)
|
lineColor(lineColor)
|
||||||
{
|
{
|
||||||
this->typeLine = typeLine;
|
this->typeLine = typeLine;
|
||||||
this->lineColor = lineColor;
|
|
||||||
//Line
|
//Line
|
||||||
const QSharedPointer<VPointF> first = data->GeometricObject<VPointF>(firstPoint);
|
const QSharedPointer<VPointF> first = data->GeometricObject<VPointF>(firstPoint);
|
||||||
const QSharedPointer<VPointF> second = data->GeometricObject<VPointF>(secondPoint);
|
const QSharedPointer<VPointF> second = data->GeometricObject<VPointF>(secondPoint);
|
||||||
|
|
|
@ -306,7 +306,7 @@ void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VAbstractP
|
||||||
}
|
}
|
||||||
|
|
||||||
quint32 cursor = doc->getCursor();
|
quint32 cursor = doc->getCursor();
|
||||||
if (cursor <= 0)
|
if (cursor == NULL_ID)
|
||||||
{
|
{
|
||||||
history->append(record);
|
history->append(record);
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,21 +91,19 @@ void VTextGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
||||||
painter->fillRect(option->rect, QColor(251, 251, 175));
|
painter->fillRect(option->rect, QColor(251, 251, 175));
|
||||||
painter->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
painter->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
||||||
|
|
||||||
// draw text lines
|
|
||||||
int iY = 0;
|
|
||||||
int iH = 0;
|
|
||||||
painter->setPen(Qt::black);
|
painter->setPen(Qt::black);
|
||||||
QFont fnt = m_tm.GetFont();
|
QFont fnt = m_tm.GetFont();
|
||||||
|
// draw text lines
|
||||||
|
int iY = 0;
|
||||||
for (int i = 0; i < m_tm.GetCount(); ++i)
|
for (int i = 0; i < m_tm.GetCount(); ++i)
|
||||||
{
|
{
|
||||||
const TextLine& tl = m_tm.GetLine(i);
|
const TextLine& tl = m_tm.GetLine(i);
|
||||||
iH = tl.m_iHeight;
|
|
||||||
fnt.setPixelSize(m_tm.GetFont().pixelSize() + tl.m_iFontSize);
|
fnt.setPixelSize(m_tm.GetFont().pixelSize() + tl.m_iFontSize);
|
||||||
fnt.setWeight(tl.m_eFontWeight);
|
fnt.setWeight(tl.m_eFontWeight);
|
||||||
fnt.setStyle(tl.m_eStyle);
|
fnt.setStyle(tl.m_eStyle);
|
||||||
painter->setFont(fnt);
|
painter->setFont(fnt);
|
||||||
painter->drawText(0, iY, qRound(boundingRect().width()), iH, tl.m_eAlign, tl.m_qsText);
|
painter->drawText(0, iY, qRound(boundingRect().width()), tl.m_iHeight, tl.m_eAlign, tl.m_qsText);
|
||||||
iY += iH + m_tm.GetSpacing();
|
iY += tl.m_iHeight + m_tm.GetSpacing();
|
||||||
}
|
}
|
||||||
|
|
||||||
// now draw the features specific to non-normal modes
|
// now draw the features specific to non-normal modes
|
||||||
|
|
|
@ -52,8 +52,8 @@ class VTextGraphicsItem : public QGraphicsObject
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VTextGraphicsItem(QGraphicsItem* pParent = 0);
|
explicit VTextGraphicsItem(QGraphicsItem* pParent = nullptr);
|
||||||
~VTextGraphicsItem();
|
virtual ~VTextGraphicsItem();
|
||||||
|
|
||||||
void SetFont(const QFont& fnt);
|
void SetFont(const QFont& fnt);
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
|
|
|
@ -525,7 +525,6 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
||||||
VContainer *data, const Document &parse, const Source &typeCreation,
|
VContainer *data, const Document &parse, const Source &typeCreation,
|
||||||
bool retainPieces)
|
bool retainPieces)
|
||||||
{
|
{
|
||||||
VToolUnionDetails *unionDetails = 0;
|
|
||||||
quint32 id = _id;
|
quint32 id = _id;
|
||||||
QString drawName;
|
QString drawName;
|
||||||
if (typeCreation == Source::FromGui)
|
if (typeCreation == Source::FromGui)
|
||||||
|
@ -546,10 +545,12 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
{
|
{
|
||||||
//Scene doesn't show this tool, so doc will destroy this object.
|
//Scene doesn't show this tool, so doc will destroy this object.
|
||||||
unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, drawName, doc);
|
VToolUnionDetails *unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation,
|
||||||
|
drawName, doc);
|
||||||
doc->AddTool(id, unionDetails);
|
doc->AddTool(id, unionDetails);
|
||||||
// Unfortunatelly doc will destroy all objects only in the end, but we should delete them before each FullParse
|
// Unfortunatelly doc will destroy all objects only in the end, but we should delete them before each FullParse
|
||||||
doc->AddToolOnRemove(unionDetails);
|
doc->AddToolOnRemove(unionDetails);
|
||||||
|
return unionDetails;
|
||||||
}
|
}
|
||||||
//Then create new details
|
//Then create new details
|
||||||
VNodeDetail det1p1;
|
VNodeDetail det1p1;
|
||||||
|
|
|
@ -89,7 +89,7 @@ void AddToCalc::redo()
|
||||||
QDomElement calcElement;
|
QDomElement calcElement;
|
||||||
if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement))
|
if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement))
|
||||||
{
|
{
|
||||||
if (cursor <= 0)
|
if (cursor == NULL_ID)
|
||||||
{
|
{
|
||||||
calcElement.appendChild(xml);
|
calcElement.appendChild(xml);
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,15 +93,16 @@ bool AbstractTest::Run(bool showWarn, int exit, int &exitCode, const QString &pr
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QProcess *process = new QProcess(this);
|
QScopedPointer<QProcess> process(new QProcess());
|
||||||
process->setWorkingDirectory(info.absoluteDir().absolutePath());
|
process->setWorkingDirectory(info.absoluteDir().absolutePath());
|
||||||
process->start(program, arguments);
|
process->start(program, arguments);
|
||||||
|
|
||||||
if (not process->waitForFinished(msecs))
|
if (not process->waitForFinished(msecs) && process->state() != QProcess::NotRunning)
|
||||||
{
|
{
|
||||||
const QString msg = QString("The operation timed out or an error occurred.\n%1").arg(parameters);
|
const QString msg = QString("The operation timed out or an error occurred.\n%1").arg(parameters);
|
||||||
QWARN(qUtf8Printable(msg));
|
QWARN(qUtf8Printable(msg));
|
||||||
exitCode = TST_EX_TIME_OUT;
|
exitCode = TST_EX_TIME_OUT;
|
||||||
|
process->kill();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +127,6 @@ bool AbstractTest::Run(bool showWarn, int exit, int &exitCode, const QString &pr
|
||||||
}
|
}
|
||||||
|
|
||||||
exitCode = process->exitCode();
|
exitCode = process->exitCode();
|
||||||
delete process;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user