mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-24 03:10:52 +01:00
Minor replace function by another one
Replace QETApp::conductorInfoKeys() and QETApp::conductorTranslatedInfoKey(const QString &key) by QETInformation::conductorInfoKeys() and QETInformation::translatedInfoKey
This commit is contained in:
@@ -104,8 +104,8 @@ void replaceAdvancedDialog::fillWhatComboBox(int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (index == 2) {
|
else if (index == 2) {
|
||||||
for (QString str : QETApp::conductorInfoKeys()) {
|
for (auto str : QETInformation::conductorInfoKeys()) {
|
||||||
ui->m_what_cb->addItem(QETApp::conductorTranslatedInfoKey(str), str);
|
ui->m_what_cb->addItem(QETInformation::translatedInfoKey(str), str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,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 = QETInformation::folioReportInfoKey();
|
strl = QETInformation::folioReportInfoKeys();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
strl = QETApp::elementInfoKeys();
|
strl = QETApp::elementInfoKeys();
|
||||||
|
|||||||
@@ -427,40 +427,6 @@ QString QETApp::elementInfoToVar(const QString &info)
|
|||||||
return (QString ("%{void}"));
|
return (QString ("%{void}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
@brief QETApp::conductorInfoKeys
|
|
||||||
@return the conductor information keys
|
|
||||||
*/
|
|
||||||
QStringList QETApp::conductorInfoKeys()
|
|
||||||
{
|
|
||||||
QStringList keys;
|
|
||||||
keys.append("formula");
|
|
||||||
keys.append("text");
|
|
||||||
keys.append("function");
|
|
||||||
keys.append("tension/protocol");
|
|
||||||
keys.append("conductor_color");
|
|
||||||
keys.append("conductor_section");
|
|
||||||
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
@brief QETApp::conductorTranslatedInfoKey
|
|
||||||
@param key
|
|
||||||
@return the translated information key given by key
|
|
||||||
If key don't match, return an empty string
|
|
||||||
*/
|
|
||||||
QString QETApp::conductorTranslatedInfoKey(const QString &key)
|
|
||||||
{
|
|
||||||
if (key == "formula") return tr("Formule du texte");
|
|
||||||
else if (key == "text") return tr("Texte");
|
|
||||||
else if (key == "function") return tr("Fonction");
|
|
||||||
else if (key == "tension/protocol") return tr("Tension / Protocole");
|
|
||||||
else if (key == "conductor_color") return tr("Couleur du fil");
|
|
||||||
else if (key == "conductor_section")return tr("Section du fil");
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief QETApp::diagramInfoKeys
|
@brief QETApp::diagramInfoKeys
|
||||||
@return the diagram default default information keys
|
@return the diagram default default information keys
|
||||||
|
|||||||
@@ -76,9 +76,6 @@ class QETApp : public QObject
|
|||||||
static QStringList elementInfoKeys();
|
static QStringList elementInfoKeys();
|
||||||
static QString elementInfoToVar(const QString &info);
|
static QString elementInfoToVar(const QString &info);
|
||||||
|
|
||||||
static QStringList conductorInfoKeys();
|
|
||||||
static QString conductorTranslatedInfoKey(const QString &key);
|
|
||||||
|
|
||||||
static QStringList diagramInfoKeys();
|
static QStringList diagramInfoKeys();
|
||||||
static QString diagramTranslatedInfoKey(const QString &key);
|
static QString diagramTranslatedInfoKey(const QString &key);
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ static QString COND_COLOR = "conductor_color";
|
|||||||
static QString COND_COLOR_VAR = "%{conductor_color}";
|
static QString COND_COLOR_VAR = "%{conductor_color}";
|
||||||
static QString COND_SECTION = "conductor_section";
|
static QString COND_SECTION = "conductor_section";
|
||||||
static QString COND_SECTION_var = "%{conductor_section}";
|
static QString COND_SECTION_var = "%{conductor_section}";
|
||||||
|
static QString COND_FORMULA = "formula";
|
||||||
|
static QString COND_FORMULA_VAR = "%{formula}";
|
||||||
|
static QString COND_TEXT = "text";
|
||||||
|
static QString COND_TEXT_VAR = "%{text}";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief QETInformation::titleblockInfoKeys
|
@brief QETInformation::titleblockInfoKeys
|
||||||
@@ -67,16 +72,6 @@ QStringList QETInformation::titleblockInfoKeys()
|
|||||||
return info_list;
|
return info_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
@brief QETInformation::titleblockTranslatedInfoKey
|
|
||||||
@param info : info key to be translated
|
|
||||||
@return the translated information given by info
|
|
||||||
If info don't match, return an empty string
|
|
||||||
*/
|
|
||||||
QString QETInformation::titleblockTranslatedInfoKey(const QString &info) {
|
|
||||||
return translatedInfoKey(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief QETInformation::titleblockInfoKeysToVar
|
@brief QETInformation::titleblockInfoKeysToVar
|
||||||
@param info
|
@param info
|
||||||
@@ -119,7 +114,7 @@ QHash<QString, QString> QETInformation::titleblockTranslatedKeyHashVar()
|
|||||||
{
|
{
|
||||||
QHash <QString, QString> hash_;
|
QHash <QString, QString> hash_;
|
||||||
for (QString str : titleblockInfoKeys()) {
|
for (QString str : titleblockInfoKeys()) {
|
||||||
hash_.insert(titleblockTranslatedInfoKey(str), titleblockInfoKeysToVar(str));
|
hash_.insert(translatedInfoKey(str), titleblockInfoKeysToVar(str));
|
||||||
}
|
}
|
||||||
return hash_;
|
return hash_;
|
||||||
}
|
}
|
||||||
@@ -128,14 +123,13 @@ QHash<QString, QString> QETInformation::titleblockTranslatedKeyHashVar()
|
|||||||
* @brief QETInformation::folioReportInfoKey
|
* @brief QETInformation::folioReportInfoKey
|
||||||
* @return The info key available for dynamic element text item of a folio report
|
* @return The info key available for dynamic element text item of a folio report
|
||||||
*/
|
*/
|
||||||
QStringList QETInformation::folioReportInfoKey()
|
QStringList QETInformation::folioReportInfoKeys()
|
||||||
{
|
{
|
||||||
QStringList list;
|
QStringList list = {ELMT_LABEL,
|
||||||
list << ELMT_LABEL;
|
COND_FUNCTION,
|
||||||
list << COND_FUNCTION;
|
COND_TENSION_PROTOCOL,
|
||||||
list << COND_TENSION_PROTOCOL;
|
COND_COLOR,
|
||||||
list << COND_COLOR;
|
COND_SECTION};
|
||||||
list << COND_SECTION;
|
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -151,6 +145,18 @@ QHash<QString, QString> QETInformation::folioReportInfoKeyToVar()
|
|||||||
return H_;
|
return H_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList QETInformation::conductorInfoKeys()
|
||||||
|
{
|
||||||
|
QStringList list = {COND_FORMULA,
|
||||||
|
COND_TEXT,
|
||||||
|
COND_FUNCTION,
|
||||||
|
COND_TENSION_PROTOCOL,
|
||||||
|
COND_COLOR,
|
||||||
|
COND_SECTION};
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief QETInformation::translatedInfoKey
|
* @brief QETInformation::translatedInfoKey
|
||||||
* @param info
|
* @param info
|
||||||
@@ -204,5 +210,7 @@ QString QETInformation::translatedInfoKey(const QString &info)
|
|||||||
else if (info == COND_TENSION_PROTOCOL) return QObject::tr("Tension / Protocole");
|
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_COLOR) return QObject::tr("Couleur du fil");
|
||||||
else if (info == COND_SECTION) return QObject::tr("Section du fil");
|
else if (info == COND_SECTION) return QObject::tr("Section du fil");
|
||||||
|
else if (info == COND_TEXT) return QObject::tr("Texte");
|
||||||
|
else if (info == COND_FORMULA) return QObject::tr("Formule du texte");
|
||||||
else return QString();
|
else return QString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,14 +21,23 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inside this namespace you will fin all information used in QElectrotech for
|
||||||
|
* element, conductor and diagram.
|
||||||
|
* Each information have 3 values :
|
||||||
|
* #1 the info key = the key of an information as a QString used in the code (exemple : label)
|
||||||
|
* #2 the info key to variable = the key in form of a variable.
|
||||||
|
* This is used by the user to replace a variable by the string of this variable (exemple : %{label})
|
||||||
|
* #3 the info key translated to the current local (exemple label in dutch = Betriebsmittelkennzeichen)
|
||||||
|
*/
|
||||||
namespace QETInformation
|
namespace QETInformation
|
||||||
{
|
{
|
||||||
QStringList titleblockInfoKeys();
|
QStringList titleblockInfoKeys();
|
||||||
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();
|
QStringList folioReportInfoKeys();
|
||||||
QHash <QString, QString> folioReportInfoKeyToVar();
|
QHash <QString, QString> folioReportInfoKeyToVar();
|
||||||
|
QStringList conductorInfoKeys();
|
||||||
|
|
||||||
QString translatedInfoKey(const QString &info);
|
QString translatedInfoKey(const QString &info);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1903,7 +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
|
||||||
{
|
{
|
||||||
return QETInformation::folioReportInfoKey();
|
return QETInformation::folioReportInfoKeys();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user