mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-10 14:14:18 +02:00
Make English the source language of the interface text
Every tr() source string in the code and the forms is now the English
text, and French is a translation (qet_fr.ts) like the other languages.
Generated, not hand-edited: master ef795a21e5 converted by
qet-en-source (harness 4c4ddc9).
3144 messages get an English source, 665 already had one, 0 left French; 8 shared-wording pairs disambiguated.
C++: 2904 literals in 233 files. Forms: 809 strings in 65 files. All 34 .ts files re-keyed; qet_fr.ts filled.
lupdate check: PASS. What each of 38 languages shows, old vs new: same 118266, English instead of French 38433, comment fallback 51, differences 0.
This commit is contained in:
@@ -193,22 +193,24 @@ void LiveServer::askAndStart(QWidget *parent)
|
||||
return;
|
||||
}
|
||||
|
||||
QMessageBox box(QMessageBox::Warning, tr("Mode direct"),
|
||||
tr("Le mode direct est activé : un assistant IA connecté "
|
||||
"pourra exécuter des scripts sur le projet ouvert.\n\n"
|
||||
"Chaque action s'annule d'un Ctrl+Z, et le bouton "
|
||||
"« Arrêter » de la barre d'état coupe la connexion.\n\n"
|
||||
"Ce réglage se trouve dans Configurer QElectroTech > Général > "
|
||||
"Projets."),
|
||||
QMessageBox box(QMessageBox::Warning, tr("Live mode"),
|
||||
tr("Live mode is on: a connected AI assistant will be able to run "
|
||||
"scripts on the open project.\n"
|
||||
"\n"
|
||||
"Each action is undone with one Ctrl+Z, and the “Stop” button "
|
||||
"in the status bar closes the connection.\n"
|
||||
"\n"
|
||||
"This setting is in Configure QElectroTech > General > "
|
||||
"Projects."),
|
||||
QMessageBox::NoButton, parent);
|
||||
QPushButton *go = box.addButton(tr("&Continuer"), QMessageBox::AcceptRole);
|
||||
box.addButton(tr("&Pas pour cette session"), QMessageBox::RejectRole);
|
||||
QPushButton *off = box.addButton(tr("&Désactiver"), QMessageBox::DestructiveRole);
|
||||
QPushButton *go = box.addButton(tr("&Continue"), QMessageBox::AcceptRole);
|
||||
box.addButton(tr("&Not this session"), QMessageBox::RejectRole);
|
||||
QPushButton *off = box.addButton(tr("&Turn off"), QMessageBox::DestructiveRole);
|
||||
box.setDefaultButton(go);
|
||||
auto *remember = new QCheckBox(tr("Ne plus demander au démarrage"), &box);
|
||||
remember->setToolTip(tr("Le mode direct s'ouvrira à chaque démarrage. Pour être "
|
||||
"de nouveau averti, désactivez-le puis réactivez-le dans "
|
||||
"Configurer QElectroTech > Général > Projets."));
|
||||
auto *remember = new QCheckBox(tr("Don't ask again at start"), &box);
|
||||
remember->setToolTip(tr("Live mode will open at every start. To be warned again, "
|
||||
"turn it off and back on in Configure QElectroTech > "
|
||||
"General > Projects."));
|
||||
box.setCheckBox(remember);
|
||||
box.exec();
|
||||
|
||||
@@ -845,12 +847,12 @@ QJsonObject LiveServer::print(const QJsonObject &request)
|
||||
? QStringLiteral("this computer has no default printer")
|
||||
: QStringLiteral("no printer called \"%1\" (printers: %2)")
|
||||
.arg(name, QPrinterInfo::availablePrinterNames().join(QStringLiteral(", "))));
|
||||
QMessageBox box(QMessageBox::Question, tr("Impression"),
|
||||
tr("L'assistant veut imprimer %n folio(s) de « %1 » sur « %2 ».", "", int(folios.count()))
|
||||
QMessageBox box(QMessageBox::Question, tr("Print"),
|
||||
tr("The assistant wants to print %n folios of “%1” on “%2”.", "", int(folios.count()))
|
||||
.arg(project->title(), info.printerName()),
|
||||
QMessageBox::NoButton, e);
|
||||
QPushButton *go = box.addButton(tr("&Imprimer"), QMessageBox::AcceptRole);
|
||||
box.addButton(tr("&Annuler"), QMessageBox::RejectRole);
|
||||
QPushButton *go = box.addButton(tr("&Print"), QMessageBox::AcceptRole);
|
||||
box.addButton(tr("&Cancel"), QMessageBox::RejectRole);
|
||||
box.setDefaultButton(go);
|
||||
box.exec();
|
||||
if (box.clickedButton() != go) return failure(QStringLiteral("refused by the user"));
|
||||
@@ -939,7 +941,7 @@ QJsonObject LiveServer::changes(const QJsonObject &request)
|
||||
QETProject *project = e ? e->currentProject() : nullptr;
|
||||
if (!project) return failure(QStringLiteral("no project is open in QElectroTech"));
|
||||
QUndoStack *stack = project->undoStack();
|
||||
const QString prefix = tr("Assistant : %1").arg(QString());
|
||||
const QString prefix = tr("Assistant: %1").arg(QString());
|
||||
const int since = request.value(QStringLiteral("since")).toInt(-1);
|
||||
QJsonArray steps;
|
||||
int assistant = 0, user = 0;
|
||||
@@ -972,7 +974,7 @@ QJsonObject LiveServer::undoLast()
|
||||
if (!project) return failure(QStringLiteral("no project is open in QElectroTech"));
|
||||
QUndoStack *stack = project->undoStack();
|
||||
const QString text = stack->text(stack->index() - 1);
|
||||
const QString prefix = tr("Assistant : %1").arg(QString());
|
||||
const QString prefix = tr("Assistant: %1").arg(QString());
|
||||
if (!stack->canUndo() || !text.startsWith(prefix))
|
||||
return failure(QStringLiteral("the last step is not the assistant's (\"%1\"); "
|
||||
"only the user undoes their own").arg(text));
|
||||
@@ -1020,10 +1022,10 @@ QJsonObject LiveServer::screenshot()
|
||||
bool LiveServer::confirm(const QString &name, const QString &source)
|
||||
{
|
||||
QDialog dialog(editor());
|
||||
dialog.setWindowTitle(tr("L'assistant veut exécuter un script"));
|
||||
dialog.setWindowTitle(tr("The assistant wants to run a script"));
|
||||
auto *layout = new QVBoxLayout(&dialog);
|
||||
layout->addWidget(new QLabel(
|
||||
tr("« %1 » sur le projet ouvert. Une fois exécuté, Ctrl+Z l'annule.")
|
||||
tr("“%1” on the open project. Once it has run, Ctrl+Z undoes it.")
|
||||
.arg(name.isEmpty() ? tr("script") : name), &dialog));
|
||||
auto *text = new QPlainTextEdit(source, &dialog);
|
||||
text->setReadOnly(true);
|
||||
@@ -1031,9 +1033,9 @@ bool LiveServer::confirm(const QString &name, const QString &source)
|
||||
text->setMinimumSize(520, 220);
|
||||
layout->addWidget(text);
|
||||
auto *buttons = new QDialogButtonBox(&dialog);
|
||||
QPushButton *run = buttons->addButton(tr("&Exécuter"), QDialogButtonBox::AcceptRole);
|
||||
buttons->addButton(tr("&Refuser"), QDialogButtonBox::RejectRole);
|
||||
QPushButton *always = buttons->addButton(tr("&Toujours"),
|
||||
QPushButton *run = buttons->addButton(tr("&Run"), QDialogButtonBox::AcceptRole);
|
||||
buttons->addButton(tr("&Decline"), QDialogButtonBox::RejectRole);
|
||||
QPushButton *always = buttons->addButton(tr("&Always"),
|
||||
QDialogButtonBox::AcceptRole);
|
||||
layout->addWidget(buttons);
|
||||
QPushButton *clicked = nullptr;
|
||||
|
||||
@@ -195,7 +195,7 @@ void MacroRecorder::finish(bool project_closed)
|
||||
const QJsonObject recording{
|
||||
{QStringLiteral("format"), 1},
|
||||
{QStringLiteral("id"), m_id},
|
||||
{QStringLiteral("name"), tr("Macro du %1").arg(
|
||||
{QStringLiteral("name"), tr("Macro of %1").arg(
|
||||
QDateTime::fromString(m_started, Qt::ISODate).toString(QStringLiteral("dd/MM/yyyy HH:mm")))},
|
||||
{QStringLiteral("project_title"), m_project_title},
|
||||
{QStringLiteral("project_path"), m_project_path},
|
||||
@@ -203,7 +203,7 @@ void MacroRecorder::finish(bool project_closed)
|
||||
{QStringLiteral("stopped"), QDateTime::currentDateTime().toString(Qt::ISODate)},
|
||||
{QStringLiteral("complete"), complete},
|
||||
{QStringLiteral("note"), complete ? QString()
|
||||
: tr("projet fermé pendant l'enregistrement : pas de after.qet")},
|
||||
: tr("project closed during the recording: no after.qet")},
|
||||
{QStringLiteral("before"), QStringLiteral("before.qet")},
|
||||
{QStringLiteral("after"), complete ? QJsonValue(QStringLiteral("after.qet")) : QJsonValue()},
|
||||
{QStringLiteral("folder"), m_dir},
|
||||
@@ -229,13 +229,12 @@ void MacroRecorder::finish(bool project_closed)
|
||||
QString MacroRecorder::assistantRequest(const QJsonObject &recording)
|
||||
{
|
||||
const int steps = int(recording.value(QStringLiteral("steps")).toArray().size());
|
||||
return tr("J'ai enregistré une macro dans QElectroTech : « %1 », %n étape(s) "
|
||||
"(identifiant %2, dossier %3).\n"
|
||||
"Avec le serveur MCP qet : lis-la avec qet_recording_read, écris un "
|
||||
"script qui fait la même chose de façon générale (par exemple sur les "
|
||||
"éléments sélectionnés plutôt que sur ceux-là précisément), vérifie-le "
|
||||
"avec qet_recording_check jusqu'à ce qu'il corresponde, puis propose-le "
|
||||
"comme bouton avec qet_script_install.", nullptr, steps)
|
||||
return tr("I recorded a macro in QElectroTech: “%1”, %n steps (id %2, folder %3).\n"
|
||||
"With the qet MCP server: read it with qet_recording_read, write a "
|
||||
"script that does the same thing in general (for example on the selected "
|
||||
"elements rather than on those exact ones), check it with "
|
||||
"qet_recording_check until it matches, then offer it as a button with "
|
||||
"qet_script_install.", nullptr, steps)
|
||||
.arg(recording.value(QStringLiteral("name")).toString())
|
||||
.arg(recording.value(QStringLiteral("id")).toString(),
|
||||
QDir::toNativeSeparators(recording.value(QStringLiteral("folder")).toString()));
|
||||
|
||||
@@ -737,7 +737,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);
|
||||
|
||||
@@ -758,7 +758,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;
|
||||
}
|
||||
@@ -829,7 +829,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;
|
||||
}
|
||||
@@ -1189,7 +1189,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;
|
||||
@@ -1843,7 +1843,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;
|
||||
}
|
||||
@@ -1866,7 +1866,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;
|
||||
}
|
||||
@@ -1884,7 +1884,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;
|
||||
}
|
||||
@@ -2043,7 +2043,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"))
|
||||
{
|
||||
@@ -2055,7 +2055,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
|
||||
{
|
||||
@@ -2063,7 +2063,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);
|
||||
@@ -2270,7 +2270,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;
|
||||
}
|
||||
@@ -2392,7 +2392,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;
|
||||
}
|
||||
@@ -2420,7 +2420,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;
|
||||
}
|
||||
@@ -3092,7 +3092,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;
|
||||
}
|
||||
@@ -3482,7 +3482,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",
|
||||
@@ -3508,7 +3508,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;
|
||||
}
|
||||
@@ -3884,7 +3884,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;
|
||||
}
|
||||
@@ -3966,7 +3966,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)
|
||||
@@ -4008,7 +4008,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());
|
||||
@@ -4949,7 +4949,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;
|
||||
|
||||
@@ -61,12 +61,14 @@ namespace {
|
||||
QString refusalMessage()
|
||||
{
|
||||
return QObject::tr(
|
||||
"Les scripts sont désactivés.\n\n"
|
||||
"Un script a accès à l'ensemble du projet et peut écrire des "
|
||||
"fichiers, aussi cette fonction est-elle désactivée par défaut.\n\n"
|
||||
"Pour l'activer : Configurer QElectroTech > Général > Projets, "
|
||||
"ou définir la variable d'environnement QET_ENABLE_SCRIPTING=1 "
|
||||
"pour une exécution sans interface (CI, traitement par lot).");
|
||||
"Scripts are disabled.\n"
|
||||
"\n"
|
||||
"A script has access to the entire project and can write files, "
|
||||
"so this feature is disabled by default.\n"
|
||||
"\n"
|
||||
"To enable it: Configure QElectroTech > General > Projects, or "
|
||||
"set the QET_ENABLE_SCRIPTING=1 environment variable for headless "
|
||||
"execution (CI, batch processing).");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,8 +185,8 @@ bool runSource(const QString &source, const QString &fileName, const QString &ti
|
||||
// has its macro taken off again: an obsolete command is deleted by
|
||||
// QUndoStack::undo() instead of being undone onto the redo side.
|
||||
QUndoStack *stack = (view && project) ? project->undoStack() : nullptr;
|
||||
const QString undo_text = live ? QObject::tr("Assistant : %1").arg(title)
|
||||
: QObject::tr("Script : %1").arg(title);
|
||||
const QString undo_text = live ? QObject::tr("Assistant: %1").arg(title)
|
||||
: QObject::tr("Script: %1").arg(title);
|
||||
if (stack) {
|
||||
stack->beginMacro(undo_text);
|
||||
api->setUndoGrouped(true);
|
||||
|
||||
@@ -45,14 +45,14 @@ ScriptManagerDialog::ScriptManagerDialog(Runner runner, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_runner(std::move(runner))
|
||||
{
|
||||
setWindowTitle(tr("Gérer les scripts"));
|
||||
setWindowTitle(tr("Manage scripts"));
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
m_list = new QListWidget(this);
|
||||
m_list->setIconSize(QSize(24, 24));
|
||||
m_list->setMinimumWidth(220);
|
||||
auto *new_button = new QPushButton(tr("&Nouveau"), this);
|
||||
m_delete = new QPushButton(tr("Supp&rimer"), this);
|
||||
auto *new_button = new QPushButton(tr("&New"), this);
|
||||
m_delete = new QPushButton(tr("&Delete"), this);
|
||||
auto *left_buttons = new QHBoxLayout();
|
||||
left_buttons->addWidget(new_button);
|
||||
left_buttons->addWidget(m_delete);
|
||||
@@ -61,28 +61,28 @@ ScriptManagerDialog::ScriptManagerDialog(Runner runner, QWidget *parent) :
|
||||
left->addLayout(left_buttons);
|
||||
|
||||
m_name = new QLineEdit(this);
|
||||
m_name->setPlaceholderText(tr("Le texte du bouton"));
|
||||
m_name->setPlaceholderText(tr("The button's text"));
|
||||
m_icon = new QLineEdit(this);
|
||||
m_icon->setPlaceholderText(tr("vide : les initiales du nom ; builtin:<nom> : une icône du thème"));
|
||||
m_icon->setPlaceholderText(tr("empty: the name's initials; builtin:<name>: an icon of the theme"));
|
||||
m_icon_preview = new QToolButton(this);
|
||||
m_icon_preview->setIconSize(QSize(24, 24));
|
||||
m_icon_preview->setToolTip(tr("Choisir une image (SVG ou PNG)…"));
|
||||
m_icon_preview->setToolTip(tr("Choose an image (SVG or PNG)…"));
|
||||
auto *icon_row = new QHBoxLayout();
|
||||
icon_row->addWidget(m_icon);
|
||||
icon_row->addWidget(m_icon_preview);
|
||||
m_tooltip = new QLineEdit(this);
|
||||
m_shortcut = new QKeySequenceEdit(this);
|
||||
m_context = new QComboBox(this);
|
||||
m_context->addItem(tr("Toujours"), QStringLiteral("canvas"));
|
||||
m_context->addItem(tr("Avec une sélection"), QStringLiteral("selection"));
|
||||
m_context->addItem(tr("Avec un conducteur sélectionné"), QStringLiteral("conductor"));
|
||||
m_context->addItem(tr("Always"), QStringLiteral("canvas"));
|
||||
m_context->addItem(tr("With a selection"), QStringLiteral("selection"));
|
||||
m_context->addItem(tr("With a conductor selected"), QStringLiteral("conductor"));
|
||||
|
||||
auto *form = new QFormLayout();
|
||||
form->addRow(tr("Nom :"), m_name);
|
||||
form->addRow(tr("Icône :"), icon_row);
|
||||
form->addRow(tr("Info-bulle :"), m_tooltip);
|
||||
form->addRow(tr("Raccourci :"), m_shortcut);
|
||||
form->addRow(tr("Actif :"), m_context);
|
||||
form->addRow(tr("Name:"), m_name);
|
||||
form->addRow(tr("Icon:"), icon_row);
|
||||
form->addRow(tr("Tooltip:"), m_tooltip);
|
||||
form->addRow(tr("Shortcut:"), m_shortcut);
|
||||
form->addRow(tr("Enabled:"), m_context);
|
||||
|
||||
m_body = new QPlainTextEdit(this);
|
||||
m_body->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||
@@ -93,12 +93,12 @@ ScriptManagerDialog::ScriptManagerDialog(Runner runner, QWidget *parent) :
|
||||
m_status->setWordWrap(true);
|
||||
m_status->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||
|
||||
m_test = new QPushButton(tr("&Tester"), this);
|
||||
m_test->setToolTip(tr("Enregistre puis exécute le script sur le projet courant"
|
||||
" (Ctrl+Z annule l'exécution)"));
|
||||
m_save = new QPushButton(tr("&Enregistrer"), this);
|
||||
auto *folder_button = new QPushButton(tr("Ouvrir le &dossier"), this);
|
||||
auto *close_button = new QPushButton(tr("&Fermer"), this);
|
||||
m_test = new QPushButton(tr("&Test"), this);
|
||||
m_test->setToolTip(tr("Saves, then runs the script on the current project "
|
||||
"(Ctrl+Z undoes the run)"));
|
||||
m_save = new QPushButton(tr("&Save"), this);
|
||||
auto *folder_button = new QPushButton(tr("Open the &folder"), this);
|
||||
auto *close_button = new QPushButton(tr("&Close"), this);
|
||||
//Enter in a field saves; in the script it is a new line
|
||||
m_save->setDefault(true);
|
||||
auto *buttons = new QHBoxLayout();
|
||||
@@ -110,7 +110,7 @@ ScriptManagerDialog::ScriptManagerDialog(Runner runner, QWidget *parent) :
|
||||
|
||||
auto *right = new QVBoxLayout();
|
||||
right->addLayout(form);
|
||||
right->addWidget(new QLabel(tr("Script (l'objet qet ; qet.currentFolio() est le folio affiché) :"), this));
|
||||
right->addWidget(new QLabel(tr("Script (the qet object; qet.currentFolio() is the sheet shown):"), this));
|
||||
right->addWidget(m_body, 1);
|
||||
right->addWidget(m_status);
|
||||
right->addLayout(buttons);
|
||||
@@ -183,7 +183,7 @@ void ScriptManagerDialog::reload()
|
||||
auto *item = new QListWidgetItem(file, m_list);
|
||||
item->setData(Qt::UserRole, path);
|
||||
item->setForeground(palette().color(QPalette::PlaceholderText));
|
||||
item->setToolTip(tr("Pas de bouton : %1").arg(error.section(QStringLiteral(": "), 1)));
|
||||
item->setToolTip(tr("No button: %1").arg(error.section(QStringLiteral(": "), 1)));
|
||||
if (path == current) m_list->setCurrentItem(item);
|
||||
}
|
||||
m_loading = false;
|
||||
@@ -213,7 +213,7 @@ void ScriptManagerDialog::showScript(const QString &path)
|
||||
setModified(false);
|
||||
m_status->setText(h.isValid()
|
||||
? QDir::toNativeSeparators(path)
|
||||
: tr("Pas de bouton pour ce fichier : %1").arg(h.error));
|
||||
: tr("No button for this file: %1").arg(h.error));
|
||||
}
|
||||
|
||||
void ScriptManagerDialog::clearForm()
|
||||
@@ -240,15 +240,15 @@ void ScriptManagerDialog::newScript()
|
||||
m_loading = false;
|
||||
clearForm();
|
||||
m_loading = true;
|
||||
m_name->setText(tr("Nouveau script"));
|
||||
m_name->setText(tr("New script"));
|
||||
m_body->setPlainText(tr(
|
||||
"// qet.currentFolio() est le folio affiché ; un clic s'annule\n"
|
||||
"// d'un seul Ctrl+Z. Liste des appels : qet.apiSignatures()\n"
|
||||
"// qet.currentFolio() is the sheet shown; one click is undone\n"
|
||||
"// with a single Ctrl+Z. List of calls: qet.apiSignatures()\n"
|
||||
"var f = qet.currentFolio();\n"
|
||||
"qet.addText(f, \"Texte\", 40, 40);\n"));
|
||||
"qet.addText(f, \"Text\", 40, 40);\n"));
|
||||
m_loading = false;
|
||||
setModified(true);
|
||||
m_status->setText(tr("Pas encore enregistré"));
|
||||
m_status->setText(tr("Not saved yet"));
|
||||
m_name->setFocus();
|
||||
m_name->selectAll();
|
||||
}
|
||||
@@ -262,7 +262,7 @@ bool ScriptManagerDialog::save()
|
||||
{
|
||||
const QString name = m_name->text().simplified();
|
||||
if (name.isEmpty()) {
|
||||
m_status->setText(tr("Le script doit avoir un nom."));
|
||||
m_status->setText(tr("The script needs a name."));
|
||||
m_name->setFocus();
|
||||
return false;
|
||||
}
|
||||
@@ -281,7 +281,7 @@ bool ScriptManagerDialog::save()
|
||||
m_context->currentData().toString(), m_body->toPlainText());
|
||||
const ScriptHeader h = ScriptHeader::parse(text, QFileInfo(path).completeBaseName());
|
||||
if (!h.isValid()) {
|
||||
m_status->setText(tr("Non enregistré : %1").arg(h.error));
|
||||
m_status->setText(tr("Not saved: %1").arg(h.error));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ bool ScriptManagerDialog::save()
|
||||
QSaveFile file(path);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)
|
||||
|| file.write(text.toUtf8()) < 0 || !file.commit()) {
|
||||
m_status->setText(tr("Impossible d'écrire %1").arg(QDir::toNativeSeparators(path)));
|
||||
m_status->setText(tr("Cannot write %1").arg(QDir::toNativeSeparators(path)));
|
||||
return false;
|
||||
}
|
||||
m_path = path;
|
||||
@@ -305,8 +305,8 @@ void ScriptManagerDialog::deleteScript()
|
||||
return;
|
||||
}
|
||||
const auto answer = QET::QetMessageBox::question(
|
||||
this, tr("Supprimer le script"),
|
||||
tr("Supprimer « %1 » et son bouton ?").arg(m_name->text()),
|
||||
this, tr("Delete the script"),
|
||||
tr("Delete “%1” and its button?").arg(m_name->text()),
|
||||
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
|
||||
if (answer != QMessageBox::Yes) return;
|
||||
|
||||
@@ -339,7 +339,7 @@ void ScriptManagerDialog::testScript()
|
||||
void ScriptManagerDialog::chooseIcon()
|
||||
{
|
||||
const QString source = QFileDialog::getOpenFileName(
|
||||
this, tr("Icône du script"), QString(),
|
||||
this, tr("Script icon"), QString(),
|
||||
tr("Images (*.svg *.png)"));
|
||||
if (source.isEmpty()) return;
|
||||
QDir dir(ScriptLibrary::folder());
|
||||
@@ -349,7 +349,7 @@ void ScriptManagerDialog::chooseIcon()
|
||||
if (QFileInfo(source).absoluteFilePath() != QFileInfo(target).absoluteFilePath()) {
|
||||
QFile::remove(target);
|
||||
if (!QFile::copy(source, target)) {
|
||||
m_status->setText(tr("Impossible de copier %1").arg(QDir::toNativeSeparators(source)));
|
||||
m_status->setText(tr("Cannot copy %1").arg(QDir::toNativeSeparators(source)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -372,15 +372,15 @@ void ScriptManagerDialog::setModified(bool modified)
|
||||
m_modified = modified;
|
||||
m_save->setEnabled(modified);
|
||||
m_delete->setEnabled(!m_path.isEmpty() || modified);
|
||||
setWindowTitle(tr("Gérer les scripts") + (modified ? QStringLiteral(" *") : QString()));
|
||||
setWindowTitle(tr("Manage scripts") + (modified ? QStringLiteral(" *") : QString()));
|
||||
}
|
||||
|
||||
bool ScriptManagerDialog::confirmDiscard()
|
||||
{
|
||||
if (!m_modified) return true;
|
||||
const auto answer = QET::QetMessageBox::question(
|
||||
this, tr("Gérer les scripts"),
|
||||
tr("Le script affiché n'est pas enregistré. Enregistrer ?"),
|
||||
this, tr("Manage scripts"),
|
||||
tr("The script shown is not saved. Save it?"),
|
||||
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
|
||||
QMessageBox::Save);
|
||||
if (answer == QMessageBox::Cancel) return false;
|
||||
|
||||
Reference in New Issue
Block a user