From a118c33f80c4466d144e878da20e3e3ef7a6946d Mon Sep 17 00:00:00 2001 From: Laurent Trinques Date: Sun, 6 Oct 2024 14:30:31 +0200 Subject: [PATCH] add messageBox to inform user when dxf2elmt can't convert DXF file --- sources/dxf/dxftoelmt.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sources/dxf/dxftoelmt.cpp b/sources/dxf/dxftoelmt.cpp index 37bec6f91..c326534c7 100644 --- a/sources/dxf/dxftoelmt.cpp +++ b/sources/dxf/dxftoelmt.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include /** @@ -45,11 +44,20 @@ QByteArray dxfToElmt(const QString &file_path) const QStringList arguments{file_path, QStringLiteral("-v")}; process_.start(program, arguments); + // qInfo()<<"\n Start converting DXF file..........\n"<< file_path; + //qInfo()<< process_.readAllStandardError().data(); //Print standard error to log file if (process_.waitForFinished()) { - qInfo()<<"\n Start converting DXF file..........\n"<< file_path; - qInfo()<< process_.readAllStandardError().data(); //Print standard error to log file + bool dxf2elmterr = process_.readAllStandardError().isEmpty(); + QString message=QObject::tr( + "Error: Make sure the file is a valid .dxf file"); + + if (!dxf2elmterr){ + QMessageBox::warning(nullptr, + QObject::tr("Error: to convert this dxf file."), + message); + } const auto byte_array{process_.readAll()}; process_.close();