mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-11 22:54:12 +02:00
Merge upstream/master: translation wave plus generic device
Upstream moved 56 commits ahead of the last merge. Six files conflicted,
all of them files where upstream's French -> English tr() translation wave
touched lines we had also touched with the cable feature. Resolution rule
applied everywhere: take upstream's English source strings, keep our cable
additions.
Resolved:
- sources/ui/xrefpropertieswidget.ui : kept our structure (m_labels_gb
pulled out of the display group, m_slave_row, the m_font_pb "Police..."
button of the cable cross-reference) and mechanically applied upstream's
20 English string replacements on top of it.
- sources/ui/xrefpropertieswidget.cpp : our version plus upstream's 7
translated combo entries; the tr("Cable") item we add for the cable
cross-reference type stays.
- sources/autoNum/ui/numparteditorw.cpp : upstream's English part names
("number format 1", "Sheet no.", "Plant", "Location", ...) for the
number-format list, with our comment explaining why type 3 (cable) takes
the conductor kinds of variable.
- sources/ui/configpage/configpages.cpp : upstream's English tab titles
(Conductors / Elements / Sheets) plus our Cables tab.
- sources/ui/configpage/projectconfigpages.cpp : upstream's "Sheets" tab
title plus our Cables tab block (single-rule SelectAutonumW(3)).
- sources/qetdiagrameditor.cpp : union of both sides - upstream's new
"Add a generic device" action (icon, status tip, data id) and its
English menu names ("File"/"Edit"/"Project"/"Display"), together with our
cable action, the Numbering and Lists menus, the cable list actions and
the CSV export in the Project menu.
Kept French: our own cable tr() source strings stay French for now. That
is the smaller change and the translation pass can follow separately.
Verified: full build 1065/1065, ctest 91/92 (only the pre-existing
headless tst_menubarkeyboard fails: no window manager, so Alt+F and F10
cannot open a menu bar), smoke start exit 124, no conflict marker left in
the tree.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "../diagramcontent.h"
|
||||
#include "../diagramview.h"
|
||||
#include "../factory/elementfactory.h"
|
||||
#include "../imagedrop.h"
|
||||
#include "../factory/qetgraphicstablefactory.h"
|
||||
#include "../factory/ui/addtabledialog.h"
|
||||
#include "../qet.h"
|
||||
@@ -765,7 +766,7 @@ QString QetScriptApi::addElement(int folioIndex, const QString &locationPath, do
|
||||
element->setPos(pos);
|
||||
diagram->addItem(element);
|
||||
|
||||
auto *undo_group = new QUndoCommand(QObject::tr("Ajouter %1").arg(element->name()));
|
||||
auto *undo_group = new QUndoCommand(QObject::tr("insert %1").arg(element->name()));
|
||||
new AddGraphicsObjectCommand(element, diagram, pos, undo_group);
|
||||
diagram->undoStack().push(undo_group);
|
||||
|
||||
@@ -786,7 +787,7 @@ bool QetScriptApi::setElementPosition(int folioIndex, const QString &elementUuid
|
||||
if (old_value == new_value) return true; // already there; nothing to push
|
||||
|
||||
auto *cmd = new QPropertyUndoCommand(element, "pos", old_value, new_value);
|
||||
cmd->setText(QObject::tr("Déplacer %1").arg(element->name()));
|
||||
cmd->setText(QObject::tr("Move %1").arg(element->name()));
|
||||
m_project->undoStack()->push(cmd);
|
||||
return true;
|
||||
}
|
||||
@@ -857,7 +858,7 @@ bool QetScriptApi::rotateElement(int folioIndex, const QString &elementUuid, dou
|
||||
auto *cmd = new QPropertyUndoCommand(element, "rotation",
|
||||
QVariant(element->rotation()),
|
||||
QVariant(element->rotation() + angle));
|
||||
cmd->setText(QObject::tr("Pivoter %1").arg(element->name()));
|
||||
cmd->setText(QObject::tr("Rotate %1").arg(element->name()));
|
||||
m_project->undoStack()->push(cmd);
|
||||
return true;
|
||||
}
|
||||
@@ -1217,7 +1218,7 @@ bool QetScriptApi::setConductorProperty(int folioIndex, const QString &elementUu
|
||||
QSet<Conductor *> potential = conductor->relatedPotentialConductors(true);
|
||||
potential << conductor;
|
||||
|
||||
m_project->undoStack()->beginMacro(QObject::tr("Modifier les propriétés du conducteur"));
|
||||
m_project->undoStack()->beginMacro(QObject::tr("Edit the conductor properties"));
|
||||
for (Conductor *c : std::as_const(potential))
|
||||
{
|
||||
QVariant old_value, new_value;
|
||||
@@ -1871,7 +1872,7 @@ bool QetScriptApi::setTextContent(int folioIndex, int textIndex, const QString &
|
||||
|
||||
auto *cmd = new QPropertyUndoCommand(item, "plainText",
|
||||
QVariant(item->toPlainText()), QVariant(text));
|
||||
cmd->setText(QObject::tr("Modifier un texte"));
|
||||
cmd->setText(QObject::tr("Edit a text"));
|
||||
m_project->undoStack()->push(cmd);
|
||||
return true;
|
||||
}
|
||||
@@ -1894,7 +1895,7 @@ bool QetScriptApi::setTextColor(int folioIndex, int textIndex, const QString &co
|
||||
|
||||
auto *cmd = new QPropertyUndoCommand(item, "color",
|
||||
QVariant(item->color()), QVariant(new_color));
|
||||
cmd->setText(QObject::tr("Modifier la couleur d'un texte"));
|
||||
cmd->setText(QObject::tr("Change the color of a text"));
|
||||
m_project->undoStack()->push(cmd);
|
||||
return true;
|
||||
}
|
||||
@@ -1912,7 +1913,7 @@ bool QetScriptApi::setTextRotation(int folioIndex, int textIndex, double angle)
|
||||
auto *cmd = new QPropertyUndoCommand(item, "rotation",
|
||||
QVariant(item->rotation()),
|
||||
QVariant(item->rotation() + angle));
|
||||
cmd->setText(QObject::tr("Pivoter un texte"));
|
||||
cmd->setText(QObject::tr("Rotate a text"));
|
||||
m_project->undoStack()->push(cmd);
|
||||
return true;
|
||||
}
|
||||
@@ -2071,7 +2072,7 @@ bool QetScriptApi::setShapeProperty(int folioIndex, int shapeIndex,
|
||||
else { log(QStringLiteral("qet.%1: unknown line-style '%2'").arg(caller, value)); return false; }
|
||||
}
|
||||
if (pen == shape->pen()) return true;
|
||||
old_value = shape->pen(); new_value = pen; qt_property = "pen"; what = QObject::tr("Modifier le trait d'une forme");
|
||||
old_value = shape->pen(); new_value = pen; qt_property = "pen"; what = QObject::tr("Edit line of a form");
|
||||
}
|
||||
else if (property == QLatin1String("fill"))
|
||||
{
|
||||
@@ -2083,7 +2084,7 @@ bool QetScriptApi::setShapeProperty(int folioIndex, int shapeIndex,
|
||||
brush.setStyle(Qt::SolidPattern); brush.setColor(c);
|
||||
}
|
||||
if (brush == shape->brush()) return true;
|
||||
old_value = shape->brush(); new_value = brush; qt_property = "brush"; what = QObject::tr("Modifier le remplissage d'une forme");
|
||||
old_value = shape->brush(); new_value = brush; qt_property = "brush"; what = QObject::tr("Edit filling a form");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2091,7 +2092,7 @@ bool QetScriptApi::setShapeProperty(int folioIndex, int shapeIndex,
|
||||
const double angle = value.toDouble(&ok);
|
||||
if (!ok) { log(QStringLiteral("qet.%1: '%2' is not an angle").arg(caller, value)); return false; }
|
||||
if (angle == shape->rotation()) return true;
|
||||
old_value = shape->rotation(); new_value = angle; qt_property = "rotation"; what = QObject::tr("Pivoter une forme");
|
||||
old_value = shape->rotation(); new_value = angle; qt_property = "rotation"; what = QObject::tr("Rotate a shape");
|
||||
}
|
||||
|
||||
auto *cmd = new QPropertyUndoCommand(shape, qt_property, old_value, new_value);
|
||||
@@ -2298,7 +2299,7 @@ bool QetScriptApi::setShapePolygon(int folioIndex, int shapeIndex, const QVarian
|
||||
const QVariant new_value = QVariant::fromValue(poly);
|
||||
if (shape->polygon() == poly) return true;
|
||||
auto *cmd = new QPropertyUndoCommand(shape, "polygon", old_value, new_value);
|
||||
cmd->setText(QObject::tr("Modifier la forme d'%1").arg(shape->name()));
|
||||
cmd->setText(QObject::tr("Change the shape of %1").arg(shape->name()));
|
||||
m_project->undoStack()->push(cmd);
|
||||
return true;
|
||||
}
|
||||
@@ -2420,7 +2421,7 @@ bool QetScriptApi::setShapePathNodes(int folioIndex, int shapeIndex, const QVari
|
||||
after_doc.appendChild(after);
|
||||
|
||||
auto *cmd = new PromoteShapeCommand(shape, before, after);
|
||||
cmd->setText(QObject::tr("Modifier la forme d'%1").arg(shape->name()));
|
||||
cmd->setText(QObject::tr("Change the shape of %1").arg(shape->name()));
|
||||
m_project->undoStack()->push(cmd);
|
||||
return true;
|
||||
}
|
||||
@@ -2448,7 +2449,7 @@ bool QetScriptApi::setShapeClosed(int folioIndex, int shapeIndex, bool closed)
|
||||
if (shape->isClosed() == closed) return true;
|
||||
|
||||
auto *cmd = new QPropertyUndoCommand(shape, "close", shape->isClosed(), closed);
|
||||
cmd->setText(QObject::tr("Fermer/Ouvrir %1").arg(shape->name()));
|
||||
cmd->setText(QObject::tr("Close/Open %1").arg(shape->name()));
|
||||
m_project->undoStack()->push(cmd);
|
||||
return true;
|
||||
}
|
||||
@@ -3146,7 +3147,7 @@ bool QetScriptApi::setTablePosition(int folioIndex, int tableIndex, double x, do
|
||||
if (old_value == new_value) return true; // already there; nothing to push
|
||||
|
||||
auto *cmd = new QPropertyUndoCommand(table, "pos", old_value, new_value);
|
||||
cmd->setText(QObject::tr("Déplacer %1").arg(table->tableName()));
|
||||
cmd->setText(QObject::tr("Move %1").arg(table->tableName()));
|
||||
m_project->undoStack()->push(cmd);
|
||||
return true;
|
||||
}
|
||||
@@ -3491,20 +3492,12 @@ int QetScriptApi::addImage(int folioIndex, const QString &filePath, double x, do
|
||||
const QList<Diagram *> diagrams = m_project->diagrams();
|
||||
if (folioIndex < 0 || folioIndex >= diagrams.count()) return -1;
|
||||
|
||||
const QFileInfo info(filePath);
|
||||
if (!info.isFile()) {
|
||||
log(QStringLiteral("qet.addImage: '%1' is not a file").arg(filePath));
|
||||
return -1;
|
||||
}
|
||||
constexpr qint64 max_bytes = 10LL * 1024 * 1024;
|
||||
if (info.size() > max_bytes) {
|
||||
log(QStringLiteral("qet.addImage: '%1' is %2 bytes; images are embedded in the project, "
|
||||
"so files over 10 MB are refused").arg(filePath).arg(info.size()));
|
||||
return -1;
|
||||
}
|
||||
const QImage image(filePath);
|
||||
// Same checks as a picture dropped on a folio: a regular file of at
|
||||
// most 10 MB (it is embedded in the project) and a bounded pixel count.
|
||||
QString error;
|
||||
const QImage image = ImageDrop::load(filePath, &error);
|
||||
if (image.isNull()) {
|
||||
log(QStringLiteral("qet.addImage: '%1' could not be read as an image").arg(filePath));
|
||||
log(QStringLiteral("qet.addImage: '%1': %2").arg(filePath, error));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -3536,7 +3529,7 @@ bool QetScriptApi::setImageScale(int folioIndex, int imageIndex, double factor)
|
||||
|
||||
// Both axes, one undo step: a script that scales an image means the
|
||||
// image, not one axis of it.
|
||||
m_project->undoStack()->beginMacro(QObject::tr("Redimensionner une image"));
|
||||
m_project->undoStack()->beginMacro(QObject::tr("Resize an image"));
|
||||
m_project->undoStack()->push(new QPropertyUndoCommand(item, "scaleFactorX",
|
||||
QVariant(item->scaleFactorX()), QVariant(factor)));
|
||||
m_project->undoStack()->push(new QPropertyUndoCommand(item, "scaleFactorY",
|
||||
@@ -3562,7 +3555,7 @@ bool QetScriptApi::setImageRotation(int folioIndex, int imageIndex, double angle
|
||||
if (item->rotationAngle() == angle) return true;
|
||||
auto *cmd = new QPropertyUndoCommand(item, "rotationAngle",
|
||||
QVariant(item->rotationAngle()), QVariant(angle));
|
||||
cmd->setText(QObject::tr("Pivoter une image"));
|
||||
cmd->setText(QObject::tr("Rotate an image"));
|
||||
m_project->undoStack()->push(cmd);
|
||||
return true;
|
||||
}
|
||||
@@ -3938,7 +3931,7 @@ bool QetScriptApi::setElementTextProperty(int folioIndex, const QString &element
|
||||
|
||||
if (old_value == new_value) return true;
|
||||
auto *cmd = new QPropertyUndoCommand(t, qt_property, old_value, new_value);
|
||||
cmd->setText(QObject::tr("Modifier un texte d'élément"));
|
||||
cmd->setText(QObject::tr("Edit element text"));
|
||||
m_project->undoStack()->push(cmd);
|
||||
return true;
|
||||
}
|
||||
@@ -4020,7 +4013,7 @@ bool QetScriptApi::numberElement(int folioIndex, const QString &elementUuid)
|
||||
// the same macro as the counter, making both one step.
|
||||
const DiagramContext old_info = element->elementInformations();
|
||||
QUndoStack *stack = m_project->undoStack();
|
||||
stack->beginMacro(QObject::tr("Numéroter automatiquement un élément"));
|
||||
stack->beginMacro(QObject::tr("Automatically number an element"));
|
||||
element->setUpFormula(true);
|
||||
const DiagramContext new_info = element->elementInformations();
|
||||
if (new_info.value(QETInformation::ELMT_LABEL) == old_info.value(QETInformation::ELMT_LABEL)
|
||||
@@ -4062,7 +4055,7 @@ int QetScriptApi::renumberElementAutoNum(const QString &name)
|
||||
QVector<Element *> frozen;
|
||||
if (auto *cmd = ElementAutoNumSchemeCommand::renumber(
|
||||
m_project, name, &frozen,
|
||||
QObject::tr("Renuméroter les éléments (%1)").arg(name))) {
|
||||
QObject::tr("Renumber elements (%1)").arg(name))) {
|
||||
m_project->undoStack()->push(cmd);
|
||||
}
|
||||
return static_cast<int>(frozen.size());
|
||||
@@ -5003,7 +4996,7 @@ int QetScriptApi::searchAndReplace(const QString &kind, const QString &field,
|
||||
|
||||
if (apply(/*dryRun=*/true) == 0) return 0;
|
||||
|
||||
m_project->undoStack()->beginMacro(QObject::tr("Rechercher et remplacer"));
|
||||
m_project->undoStack()->beginMacro(QObject::tr("Search and replace"));
|
||||
const int changed = apply(/*dryRun=*/false);
|
||||
m_project->undoStack()->endMacro();
|
||||
return changed;
|
||||
|
||||
Reference in New Issue
Block a user