Files
qelectrotech-source-mirror/sources/ui/compositetexteditdialog.cpp
T
ispyisail f5962ecd06 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.
2026-10-08 12:50:13 +13:00

97 lines
2.6 KiB
C++

#include "compositetexteditdialog.h"
#include "../qetapp.h"
#include "../qetgraphicsitem/conductor.h"
#include "../qetgraphicsitem/dynamicelementtextitem.h"
#include "../qetgraphicsitem/element.h"
#include "../qetinformation.h"
#include "../qet.h"
#include "ui_compositetexteditdialog.h"
#include <utility>
CompositeTextEditDialog::CompositeTextEditDialog(DynamicElementTextItem *text, QWidget *parent) :
QDialog(parent),
ui(new Ui::CompositeTextEditDialog),
m_text(text)
{
ui->setupUi(this);
QET::trackDialogGeometry(this);
m_default_text = m_text->compositeText();
ui->m_plain_text_edit->setPlainText(m_default_text);
ui->m_plain_text_edit->setPlaceholderText(tr("Enter your composite text here, using the available variables"));
bool report = false;
if ((m_text) &&(m_text->parentElement()->linkType()) & (Element::AllReport))
{
report = true;
}
setUpComboBox(report);
}
CompositeTextEditDialog::CompositeTextEditDialog(QString text, bool report, QWidget *parent) :
QDialog(parent),
ui(new Ui::CompositeTextEditDialog)
{
ui->setupUi(this);
QET::trackDialogGeometry(this);
m_default_text = std::move(text);
ui->m_plain_text_edit->setPlainText(m_default_text);
ui->m_plain_text_edit->setPlaceholderText(tr("Enter your composite text here, using the available variables"));
setUpComboBox(report);
}
CompositeTextEditDialog::~CompositeTextEditDialog()
{
delete ui;
}
/**
@brief CompositeTextEditDialog::plainText
@return The edited text
*/
QString CompositeTextEditDialog::plainText() const
{
return ui->m_plain_text_edit->toPlainText();
}
/**
@brief CompositeTextEditDialog::setUpComboBox
Add the available element information in the combo box
*/
void CompositeTextEditDialog::setUpComboBox(bool is_report)
{
QStringList qstrl;
if(is_report) //Special treatment for text owned by a folio report
{
qstrl = QETInformation::folioReportInfoKeys();
}
else
{
qstrl = QETInformation::elementInfoKeys();
qstrl.removeAll("formula");
}
for (int i=0; i<qstrl.size();++i) {
ui -> m_info_cb -> addItem(QETInformation::translatedInfoKey(qstrl[i]),
is_report ? QETInformation::folioReportInfoToVar(qstrl[i]) : QETInformation::elementInfoToVar(qstrl[i]));
}
}
void CompositeTextEditDialog::on_m_info_cb_activated(int index)
{
Q_UNUSED(index)
ui->m_plain_text_edit->insertPlainText(ui->m_info_cb->currentData().toString());
}
/**
@brief CompositeTextEditDialog::focusInEvent
Reimplemented from QWidget::focusInEvent
@param event
*/
void CompositeTextEditDialog::focusInEvent(QFocusEvent *event)
{
ui->m_plain_text_edit->setFocus();
QDialog::focusInEvent(event);
}