Skip to content

Commit

Permalink
Merge pull request #303 from plc-user/master
Browse files Browse the repository at this point in the history
QET_ElementScaler: fix error for Qt 5.9 and added mirroring
  • Loading branch information
scorpio810 authored Aug 20, 2024
2 parents a162f15 + 1649e8d commit e4f5e8c
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 7 deletions.
Binary file modified lang/qet_de.qm
Binary file not shown.
32 changes: 31 additions & 1 deletion lang/qet_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9470,7 +9470,37 @@ Möchten Sie sie ersetzen?</translation>
<translation>Faktor Y:</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="122"/>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="60"/>
<source>sans</source>
<translation>ohne</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="61"/>
<source>horizontal</source>
<translation>horizontal</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="62"/>
<source>vertical</source>
<translation>vertikal</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="63"/>
<source>horizontal + vertical</source>
<translation>horizontal + vertikal</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="65"/>
<source>Retourner l&apos;élément :</source>
<translation>Element spiegeln</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="66"/>
<source>direction</source>
<translation>Richtung</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="145"/>
<source>Le logiciel QET_ElementScaler est nécessaire pour mettre les éléments à l&apos;échelle.
Veuillez télécharger celui-ci en suivant le lien ci dessous et le dézipper dans le dossier d&apos;installation</source>
<translation>Die Software QET_ElementScaler wird benötigt, um Elemente zu skalieren.
Expand Down
Binary file modified lang/qet_en.qm
Binary file not shown.
32 changes: 31 additions & 1 deletion lang/qet_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9463,7 +9463,37 @@ Do you want to replace it ?</translation>
<translation>Y Factor:</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="122"/>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="60"/>
<source>sans</source>
<translation>none</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="61"/>
<source>horizontal</source>
<translation>horizontal</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="62"/>
<source>vertical</source>
<translation>vertical</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="63"/>
<source>horizontal + vertical</source>
<translation>horizontal + vertical</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="65"/>
<source>Retourner l&apos;élément :</source>
<translation>Mirror element</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="66"/>
<source>direction</source>
<translation>direction</translation>
</message>
<message>
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="145"/>
<source>Le logiciel QET_ElementScaler est nécessaire pour mettre les éléments à l&apos;échelle.
Veuillez télécharger celui-ci en suivant le lien ci dessous et le dézipper dans le dossier d&apos;installation</source>
<translation>The QET_ElementScaler software is required to scale elements.
Expand Down
33 changes: 28 additions & 5 deletions sources/qet_elementscaler/qet_elementscaler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ QByteArray ElementScaler(const QString &file_path, QWidget *parent)
bool ok;
double fx = QInputDialog::getDouble(parent, QObject::tr("Entrer le facteur d'échelle"),
QObject::tr("Facteur X:"), 1.0, 0.1, 100, 5, &ok,
Qt::WindowFlags(), 1);
Qt::WindowFlags());
QString sFactorX = "1.0";
if (ok)
sFactorX = (QString::number(fx, 'f', 5));
Expand All @@ -50,18 +50,41 @@ QByteArray ElementScaler(const QString &file_path, QWidget *parent)

double fy = QInputDialog::getDouble(parent, QObject::tr("Entrer le facteur d'échelle"),
QObject::tr("Facteur Y:"), fx, 0.1, 100, 5, &ok,
Qt::WindowFlags(), 1);
Qt::WindowFlags());
QString sFactorY = "1.0";
if (ok)
sFactorY = (QString::number(fy, 'f', 5));
else
return QByteArray();

const QStringList items{QObject::tr("sans"),
QObject::tr("horizontal"),
QObject::tr("vertical"),
QObject::tr("horizontal + vertical")};
QString item = QInputDialog::getItem(parent,
QObject::tr("Retourner l'élément :"),
QObject::tr("direction"), items, 0, false, &ok);
int8_t mirrorIndex = 0;
if (ok && !item.isEmpty()) {
mirrorIndex = items.indexOf(item, 0);
}
else
return QByteArray();

QProcess process_;
const QString program{ElementScalerBinaryPath()};
const QStringList arguments{QStringLiteral("-x"), sFactorX,
QStringLiteral("-y"), sFactorY,
QStringLiteral("-o"), QStringLiteral("-f"), file_path};
QStringList arguments{QStringLiteral("-x"), sFactorX,
QStringLiteral("-y"), sFactorY};
switch (mirrorIndex) {
case 1: arguments << QStringLiteral("--FlipHorizontal");
break;
case 2: arguments << QStringLiteral("--FlipVertical");
break;
case 3: arguments << QStringLiteral("--FlipHorizontal")
<< QStringLiteral("--FlipVertical");
break;
}
arguments << QStringLiteral("-o") << QStringLiteral("-f") << file_path;

process_.start(program, arguments);

Expand Down

0 comments on commit e4f5e8c

Please sign in to comment.