Uniformise MessageBox

Add QObjet for translate box message
This commit is contained in:
Laurent Trinques
2024-10-10 10:57:09 +02:00
parent 429726f463
commit e6d3121a32
2 changed files with 13 additions and 15 deletions

View File

@@ -22,7 +22,6 @@
#include <QProcess> #include <QProcess>
#include <QMessageBox> #include <QMessageBox>
#include <QDir> #include <QDir>
#include <QDebug>
/** /**
* @brief dxftoElmt * @brief dxftoElmt
@@ -44,23 +43,22 @@ QByteArray dxfToElmt(const QString &file_path)
const QStringList arguments{file_path, QStringLiteral("-v")}; const QStringList arguments{file_path, QStringLiteral("-v")};
process_.start(program, arguments); 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()) if (process_.waitForFinished())
{ {
bool dxf2elmterr = process_.readAllStandardError().isEmpty(); const auto byte_array{process_.readAllStandardOutput()};
QString message=QObject::tr( const auto error_output{process_.readAllStandardError()};
"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(); process_.close();
if (error_output.length() > 0) {
// inform the user about log-output via QMessageBox
QMessageBox msgBox;
msgBox.setText(QObject::tr ("Dxf2elmt: \nError: Make sure the file is a valid .dxf file"));
msgBox.setInformativeText (QObject::tr("See details here:"));
msgBox.setDetailedText(error_output);
msgBox.exec();
}
return byte_array; return byte_array;
} }
else else

View File

@@ -97,8 +97,8 @@ QByteArray ElementScaler(const QString &file_path, QWidget *parent)
if (error_output.length() > 0) { if (error_output.length() > 0) {
// inform the user about log-output via QMessageBox // inform the user about log-output via QMessageBox
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText("QET_ElementScaler: \nadditional information about import / scaling"); msgBox.setText (QObject::tr("QET_ElementScaler: \nadditional information about import / scaling"));
msgBox.setInformativeText("See details here:"); msgBox.setInformativeText(QObject::tr("See details here:"));
msgBox.setDetailedText(error_output); msgBox.setDetailedText(error_output);
msgBox.exec(); msgBox.exec();
} }