mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Minor : fix little regression about folio report and displayed information
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include "qetapp.h"
|
#include "qetapp.h"
|
||||||
#include "compositetexteditdialog.h"
|
#include "compositetexteditdialog.h"
|
||||||
#include "alignmenttextdialog.h"
|
#include "alignmenttextdialog.h"
|
||||||
|
#include "qetinformation.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
@@ -40,7 +41,6 @@ DynamicTextFieldEditor::DynamicTextFieldEditor(
|
|||||||
if(text_field) {
|
if(text_field) {
|
||||||
setPart(text_field);
|
setPart(text_field);
|
||||||
}
|
}
|
||||||
fillInfoComboBox();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicTextFieldEditor::~DynamicTextFieldEditor()
|
DynamicTextFieldEditor::~DynamicTextFieldEditor()
|
||||||
@@ -73,6 +73,7 @@ bool DynamicTextFieldEditor::setPart(CustomElementPart *part) {
|
|||||||
m_text_field = static_cast<PartDynamicTextField *>(qgi);
|
m_text_field = static_cast<PartDynamicTextField *>(qgi);
|
||||||
updateForm();
|
updateForm();
|
||||||
setUpConnections();
|
setUpConnections();
|
||||||
|
fillInfoComboBox();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ bool DynamicTextFieldEditor::setParts(QList <CustomElementPart *> parts) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PartDynamicTextField *part= static_cast<PartDynamicTextField *>(parts.first())) {
|
if (PartDynamicTextField *part = static_cast<PartDynamicTextField *>(parts.first())) {
|
||||||
if (m_text_field) {
|
if (m_text_field) {
|
||||||
disconnectConnections();
|
disconnectConnections();
|
||||||
}
|
}
|
||||||
@@ -99,6 +100,7 @@ bool DynamicTextFieldEditor::setParts(QList <CustomElementPart *> parts) {
|
|||||||
|
|
||||||
setUpConnections();
|
setUpConnections();
|
||||||
updateForm();
|
updateForm();
|
||||||
|
fillInfoComboBox();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return(false);
|
return(false);
|
||||||
@@ -204,7 +206,7 @@ void DynamicTextFieldEditor::fillInfoComboBox()
|
|||||||
QString type = elementEditor() -> elementScene() -> elementType();
|
QString type = elementEditor() -> elementScene() -> elementType();
|
||||||
|
|
||||||
if(type.contains("report")) {
|
if(type.contains("report")) {
|
||||||
strl << "function" << "tension_protocol" << "conductor_color" << "conductor_section";
|
strl = QETInformation::folioReportInfoKey();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
strl = QETApp::elementInfoKeys();
|
strl = QETApp::elementInfoKeys();
|
||||||
@@ -213,7 +215,8 @@ void DynamicTextFieldEditor::fillInfoComboBox()
|
|||||||
//the value of the combo box are always alphabetically sorted
|
//the value of the combo box are always alphabetically sorted
|
||||||
QMap <QString, QString> info_map;
|
QMap <QString, QString> info_map;
|
||||||
for(const QString& str : strl)
|
for(const QString& str : strl)
|
||||||
info_map.insert(QETApp::elementTranslatedInfoKey(str), str);
|
info_map.insert(QETInformation::translatedInfoKey(str), str);
|
||||||
|
|
||||||
|
|
||||||
for (const QString& key : info_map.keys())
|
for (const QString& key : info_map.keys())
|
||||||
ui -> m_elmt_info_cb -> addItem(key, info_map.value(key));
|
ui -> m_elmt_info_cb -> addItem(key, info_map.value(key));
|
||||||
|
|||||||
@@ -18,9 +18,22 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
#include "qetinformation.h"
|
#include "qetinformation.h"
|
||||||
|
|
||||||
|
/** Default information related to element **/
|
||||||
|
static QString ELMT_LABEL = "label";
|
||||||
|
static QString ELMT_LABEL_VAR = "%{label}";
|
||||||
|
|
||||||
|
/** Default information related to conductor **/
|
||||||
|
static QString COND_FUNCTION = "function";
|
||||||
|
static QString COND_FUNCTION_VAR = "%{function}";
|
||||||
|
static QString COND_TENSION_PROTOCOL = "tension/protocol";
|
||||||
|
static QString COND_TENSION_PROTOCOL_var = "%{tension/protocol}";
|
||||||
|
static QString COND_COLOR = "conductor_color";
|
||||||
|
static QString COND_COLOR_VAR = "%{conductor_color}";
|
||||||
|
static QString COND_SECTION = "conductor_section";
|
||||||
|
static QString COND_SECTION_var = "%{conductor_section}";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief QETInformation::titleblockInfoKeys
|
@brief QETInformation::titleblockInfoKeys
|
||||||
@return all available key for use with a titleblock
|
@return all available key for use with a titleblock
|
||||||
@@ -60,31 +73,8 @@ QStringList QETInformation::titleblockInfoKeys()
|
|||||||
@return the translated information given by info
|
@return the translated information given by info
|
||||||
If info don't match, return an empty string
|
If info don't match, return an empty string
|
||||||
*/
|
*/
|
||||||
QString QETInformation::titleblockTranslatedInfoKey(const QString &info)
|
QString QETInformation::titleblockTranslatedInfoKey(const QString &info) {
|
||||||
{
|
return translatedInfoKey(info);
|
||||||
if (info == "author") return QObject::tr("Auteur");
|
|
||||||
else if (info == "date") return QObject::tr("Date");
|
|
||||||
else if (info == "title") return QObject::tr("Titre");
|
|
||||||
else if (info == "filename") return QObject::tr("Fichier");
|
|
||||||
else if (info == "plant") return QObject::tr("Installation (=)");
|
|
||||||
else if (info == "locmach") return QObject::tr("Localisation (+)");
|
|
||||||
else if (info == "indexrev") return QObject::tr("Indice de révision");
|
|
||||||
else if (info == "version") return QObject::tr("Version de QElectroTech");
|
|
||||||
else if (info == "folio") return QObject::tr("Numéro de folio");
|
|
||||||
else if (info == "folio-id") return QObject::tr("Position du folio");
|
|
||||||
else if (info == "folio-total") return QObject::tr("Nombre de folio");
|
|
||||||
else if (info == "previous-folio-num") return QObject::tr("Numéro du folio précédent");
|
|
||||||
else if (info == "next-folio-num") return QObject::tr("Numéro du folio suivant");
|
|
||||||
else if (info == "projecttitle") return QObject::tr("Titre du projet");
|
|
||||||
else if (info == "projectpath") return QObject::tr("Chemin du fichier du projet");
|
|
||||||
else if (info == "projectfilename") return QObject::tr("Nom du fichier");
|
|
||||||
else if (info == "saveddate") return QObject::tr("Date d'enregistrement du fichier format local");
|
|
||||||
else if (info == "saveddate-eu") return QObject::tr("Date d'enregistrement du fichier format dd-MM-yyyy");
|
|
||||||
else if (info == "saveddate-us") return QObject::tr("Date d'enregistrement du fichier format yyyy-MM-dd");
|
|
||||||
else if (info == "savedtime") return QObject::tr("Heure d'enregistrement du fichier");
|
|
||||||
else if (info == "savedfilename") return QObject::tr("Nom du fichier enregistré");
|
|
||||||
else if (info == "savedfilepath") return QObject::tr("Chemin du fichier enregistré");
|
|
||||||
else return QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,3 +123,86 @@ QHash<QString, QString> QETInformation::titleblockTranslatedKeyHashVar()
|
|||||||
}
|
}
|
||||||
return hash_;
|
return hash_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETInformation::folioReportInfoKey
|
||||||
|
* @return The info key available for dynamic element text item of a folio report
|
||||||
|
*/
|
||||||
|
QStringList QETInformation::folioReportInfoKey()
|
||||||
|
{
|
||||||
|
QStringList list;
|
||||||
|
list << ELMT_LABEL;
|
||||||
|
list << COND_FUNCTION;
|
||||||
|
list << COND_TENSION_PROTOCOL;
|
||||||
|
list << COND_COLOR;
|
||||||
|
list << COND_SECTION;
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
QHash<QString, QString> QETInformation::folioReportInfoKeyToVar()
|
||||||
|
{
|
||||||
|
QHash <QString, QString> H_;
|
||||||
|
H_.insert(ELMT_LABEL, ELMT_LABEL_VAR);
|
||||||
|
H_.insert(COND_FUNCTION, COND_FUNCTION_VAR);
|
||||||
|
H_.insert(COND_TENSION_PROTOCOL, COND_TENSION_PROTOCOL_var);
|
||||||
|
H_.insert(COND_COLOR, COND_COLOR_VAR);
|
||||||
|
H_.insert(COND_SECTION, COND_SECTION_var);
|
||||||
|
|
||||||
|
return H_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief QETInformation::translatedInfoKey
|
||||||
|
* @param info
|
||||||
|
* @return the information translated to the current local.
|
||||||
|
* This function translate all information : element, conductor, diagram
|
||||||
|
* Return an empty QString if don't match
|
||||||
|
*/
|
||||||
|
QString QETInformation::translatedInfoKey(const QString &info)
|
||||||
|
{
|
||||||
|
if (info == "author") return QObject::tr("Auteur");
|
||||||
|
else if (info == "date") return QObject::tr("Date");
|
||||||
|
else if (info == "title") return QObject::tr("Titre");
|
||||||
|
else if (info == "filename") return QObject::tr("Fichier");
|
||||||
|
else if (info == "plant") return QObject::tr("Installation (=)");
|
||||||
|
else if (info == "locmach") return QObject::tr("Localisation (+)");
|
||||||
|
else if (info == "indexrev") return QObject::tr("Indice de révision");
|
||||||
|
else if (info == "version") return QObject::tr("Version de QElectroTech");
|
||||||
|
else if (info == "folio") return QObject::tr("Numéro de folio");
|
||||||
|
else if (info == "folio-id") return QObject::tr("Position du folio");
|
||||||
|
else if (info == "folio-total") return QObject::tr("Nombre de folio");
|
||||||
|
else if (info == "previous-folio-num") return QObject::tr("Numéro du folio précédent");
|
||||||
|
else if (info == "next-folio-num") return QObject::tr("Numéro du folio suivant");
|
||||||
|
else if (info == "projecttitle") return QObject::tr("Titre du projet");
|
||||||
|
else if (info == "projectpath") return QObject::tr("Chemin du fichier du projet");
|
||||||
|
else if (info == "projectfilename") return QObject::tr("Nom du fichier");
|
||||||
|
else if (info == "saveddate") return QObject::tr("Date d'enregistrement du fichier format local");
|
||||||
|
else if (info == "saveddate-eu") return QObject::tr("Date d'enregistrement du fichier format dd-MM-yyyy");
|
||||||
|
else if (info == "saveddate-us") return QObject::tr("Date d'enregistrement du fichier format yyyy-MM-dd");
|
||||||
|
else if (info == "savedtime") return QObject::tr("Heure d'enregistrement du fichier");
|
||||||
|
else if (info == "savedfilename") return QObject::tr("Nom du fichier enregistré");
|
||||||
|
else if (info == "savedfilepath") return QObject::tr("Chemin du fichier enregistré");
|
||||||
|
else if (info == "formula") return QObject::tr("Formule du label");
|
||||||
|
else if (info == ELMT_LABEL) return QObject::tr("Label");
|
||||||
|
else if (info == "plant") return QObject::tr("Installation");
|
||||||
|
else if (info == "location") return QObject::tr("Localisation");
|
||||||
|
else if (info == "comment") return QObject::tr("Commentaire");
|
||||||
|
else if (info == "function") return QObject::tr("Fonction");
|
||||||
|
else if (info == "auxiliary1") return QObject::tr("Bloc auxiliaire 1");
|
||||||
|
else if (info == "auxiliary2") return QObject::tr("Bloc auxiliaire 2");
|
||||||
|
else if (info == "description") return QObject::tr("Description textuelle");
|
||||||
|
else if (info == "designation") return QObject::tr("Numéro d'article");
|
||||||
|
else if (info == "manufacturer") return QObject::tr("Fabricant");
|
||||||
|
else if (info == "manufacturer_reference") return QObject::tr("Numéro de commande");
|
||||||
|
else if (info == "machine_manufacturer_reference") return QObject::tr("Numéro interne");
|
||||||
|
else if (info == "supplier") return QObject::tr("Fournisseur");
|
||||||
|
else if (info == "quantity") return QObject::tr("Quantité");
|
||||||
|
else if (info == "unity") return QObject::tr("Unité");
|
||||||
|
else if (info == "formula") return QObject::tr("Formule du texte");
|
||||||
|
else if (info == "text") return QObject::tr("Texte");
|
||||||
|
else if (info == COND_FUNCTION) return QObject::tr("Fonction");
|
||||||
|
else if (info == COND_TENSION_PROTOCOL) return QObject::tr("Tension / Protocole");
|
||||||
|
else if (info == COND_COLOR) return QObject::tr("Couleur du fil");
|
||||||
|
else if (info == COND_SECTION) return QObject::tr("Section du fil");
|
||||||
|
else return QString();
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ namespace QETInformation
|
|||||||
QString titleblockTranslatedInfoKey(const QString &info);
|
QString titleblockTranslatedInfoKey(const QString &info);
|
||||||
QString titleblockInfoKeysToVar(const QString &info);
|
QString titleblockInfoKeysToVar(const QString &info);
|
||||||
QHash <QString, QString> titleblockTranslatedKeyHashVar();
|
QHash <QString, QString> titleblockTranslatedKeyHashVar();
|
||||||
|
QStringList folioReportInfoKey();
|
||||||
|
QHash <QString, QString> folioReportInfoKeyToVar();
|
||||||
|
|
||||||
|
QString translatedInfoKey(const QString &info);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // QETINFORMATION_H
|
#endif // QETINFORMATION_H
|
||||||
|
|||||||
@@ -17,14 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "dynamicelementtextmodel.h"
|
#include "dynamicelementtextmodel.h"
|
||||||
#include "dynamicelementtextitem.h"
|
#include "dynamicelementtextitem.h"
|
||||||
#include <QStandardItem>
|
|
||||||
#include <QHash>
|
|
||||||
#include <QColorDialog>
|
|
||||||
#include <QModelIndex>
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QUndoCommand>
|
|
||||||
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
#include "QPropertyUndoCommand/qpropertyundocommand.h"
|
||||||
#include "qetapp.h"
|
|
||||||
#include "element.h"
|
#include "element.h"
|
||||||
#include "compositetexteditdialog.h"
|
#include "compositetexteditdialog.h"
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
@@ -34,6 +27,15 @@
|
|||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
#include "addelementtextcommand.h"
|
#include "addelementtextcommand.h"
|
||||||
#include "alignmenttextdialog.h"
|
#include "alignmenttextdialog.h"
|
||||||
|
#include "qetinformation.h"
|
||||||
|
#include "qetapp.h"
|
||||||
|
|
||||||
|
#include <QStandardItem>
|
||||||
|
#include <QHash>
|
||||||
|
#include <QColorDialog>
|
||||||
|
#include <QModelIndex>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QUndoCommand>
|
||||||
|
|
||||||
static int src_txt_row = 0;
|
static int src_txt_row = 0;
|
||||||
static int usr_txt_row = 1;
|
static int usr_txt_row = 1;
|
||||||
@@ -175,7 +177,7 @@ QList<QStandardItem *> DynamicElementTextModel::itemsForText(
|
|||||||
|
|
||||||
QStandardItem *infoa =
|
QStandardItem *infoa =
|
||||||
new QStandardItem(
|
new QStandardItem(
|
||||||
QETApp::elementTranslatedInfoKey(
|
QETInformation::translatedInfoKey(
|
||||||
deti->infoName()));
|
deti->infoName()));
|
||||||
infoa->setFlags(Qt::ItemIsSelectable
|
infoa->setFlags(Qt::ItemIsSelectable
|
||||||
| Qt::ItemIsEnabled
|
| Qt::ItemIsEnabled
|
||||||
@@ -1446,7 +1448,7 @@ void DynamicElementTextModel::updateDataFromText(DynamicElementTextItem *deti,
|
|||||||
qsi->setData(deti->toPlainText(), Qt::DisplayRole);
|
qsi->setData(deti->toPlainText(), Qt::DisplayRole);
|
||||||
QString info_name = deti->infoName();
|
QString info_name = deti->infoName();
|
||||||
qsi->child(info_txt_row,1)->setData(info_name, Qt::UserRole+2);
|
qsi->child(info_txt_row,1)->setData(info_name, Qt::UserRole+2);
|
||||||
qsi->child(info_txt_row,1)->setData(QETApp::elementTranslatedInfoKey(info_name), Qt::DisplayRole);
|
qsi->child(info_txt_row,1)->setData(QETInformation::translatedInfoKey(info_name), Qt::DisplayRole);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case compositeText:
|
case compositeText:
|
||||||
@@ -1599,7 +1601,7 @@ QWidget *DynamicTextItemDelegate::createEditor(
|
|||||||
//the value of the combo box are always alphabetically sorted
|
//the value of the combo box are always alphabetically sorted
|
||||||
QMap <QString, QString> info_map;
|
QMap <QString, QString> info_map;
|
||||||
for(const QString& str : availableInfo(deti)) {
|
for(const QString& str : availableInfo(deti)) {
|
||||||
info_map.insert(QETApp::elementTranslatedInfoKey(str), str);
|
info_map.insert(QETInformation::translatedInfoKey(str), str);
|
||||||
}
|
}
|
||||||
|
|
||||||
QComboBox *qcb = new QComboBox(parent);
|
QComboBox *qcb = new QComboBox(parent);
|
||||||
@@ -1901,22 +1903,7 @@ QStringList DynamicTextItemDelegate::availableInfo(
|
|||||||
|
|
||||||
if(deti->parentElement()->linkType() & Element::AllReport) //Special treatment for text owned by a folio report
|
if(deti->parentElement()->linkType() & Element::AllReport) //Special treatment for text owned by a folio report
|
||||||
{
|
{
|
||||||
qstrl << "label";
|
return QETInformation::folioReportInfoKey();
|
||||||
|
|
||||||
if(!deti->m_watched_conductor.isNull())
|
|
||||||
{
|
|
||||||
Conductor *cond = deti->m_watched_conductor.data();
|
|
||||||
if (!cond->properties().m_function.isEmpty())
|
|
||||||
qstrl << "function";
|
|
||||||
if(!cond->properties().m_tension_protocol.isEmpty())
|
|
||||||
qstrl << "tension_protocol";
|
|
||||||
if(!cond->properties().m_wire_color.isEmpty())
|
|
||||||
qstrl << "conductor_color";
|
|
||||||
if(!cond->properties().m_wire_section.isEmpty())
|
|
||||||
qstrl << "conductor_section";
|
|
||||||
}
|
|
||||||
|
|
||||||
return qstrl;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user