mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-15 01:13:14 +02:00
Compare commits
5 Commits
af33719995
...
d1c6fb7e3c
| Author | SHA1 | Date | |
|---|---|---|---|
| d1c6fb7e3c | |||
| 9dad6963cb | |||
| 28df44d1ba | |||
| 25a81f24fa | |||
| 7a39e69a32 |
Binary file not shown.
+2
-2
@@ -9101,7 +9101,7 @@ Möchten Sie sie ersetzen?</translation>
|
||||
<message>
|
||||
<location filename="../sources/qetinformation.cpp" line="281"/>
|
||||
<source>Bloc auxiliaire 2</source>
|
||||
<translation>Zusatzinfo 2</translation>
|
||||
<translation>Zusatzinfo Zusatzartikel 2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/qetinformation.cpp" line="282"/>
|
||||
@@ -9642,7 +9642,7 @@ Fehler: Stellen Sie sicher, dass die Datei %1 eine gültige dxf-Datei ist</trans
|
||||
<location filename="../sources/dxf/dxftoelmt.cpp" line="59"/>
|
||||
<location filename="../sources/qet_elementscaler/qet_elementscaler.cpp" line="101"/>
|
||||
<source>See details here:</source>
|
||||
<translation>Fehlermeldung:</translation>
|
||||
<translation>Details:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../sources/dxf/dxftoelmt.cpp" line="112"/>
|
||||
|
||||
@@ -37,7 +37,7 @@ class XmlElementCollection;
|
||||
This class represents the location,
|
||||
the location of an element or of a category,
|
||||
even of a collection ... in a collection.
|
||||
She encapsulates a virtual path.
|
||||
It encapsulates a virtual path.
|
||||
\~French
|
||||
Cette classe represente la localisation, l'emplacement d'un element ou
|
||||
d'une categorie, voire d'une collection... dans une collection.
|
||||
|
||||
@@ -46,7 +46,7 @@ NamesList::~NamesList()
|
||||
void NamesList::addName(const QString &lang, const QString &name) {
|
||||
if ((lang.length() != 2) && (lang.length() != 5)) return;
|
||||
if ((lang.length() == 5) && (lang[2] != '_')) return;
|
||||
hash_names.insert(lang, name);
|
||||
map_names.insert(lang, name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ void NamesList::addName(const QString &lang, const QString &name) {
|
||||
@param lang la langue pour laquelle il faut supprimer le nom
|
||||
*/
|
||||
void NamesList::removeName(const QString &lang) {
|
||||
hash_names.remove(lang);
|
||||
map_names.remove(lang);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ void NamesList::removeName(const QString &lang) {
|
||||
*/
|
||||
void NamesList::clearNames()
|
||||
{
|
||||
hash_names.clear();
|
||||
map_names.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ void NamesList::clearNames()
|
||||
*/
|
||||
QList<QString> NamesList::langs() const
|
||||
{
|
||||
return(hash_names.keys());
|
||||
return(map_names.keys());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ QList<QString> NamesList::langs() const
|
||||
*/
|
||||
bool NamesList::isEmpty() const
|
||||
{
|
||||
return(hash_names.isEmpty());
|
||||
return(map_names.isEmpty());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ bool NamesList::isEmpty() const
|
||||
*/
|
||||
int NamesList::count() const
|
||||
{
|
||||
return(hash_names.count());
|
||||
return(map_names.count());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +95,7 @@ int NamesList::count() const
|
||||
defini
|
||||
*/
|
||||
QString &NamesList::operator[](const QString &lang) {
|
||||
return(hash_names[lang]);
|
||||
return(map_names[lang]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,7 @@ QString &NamesList::operator[](const QString &lang) {
|
||||
*/
|
||||
const QString NamesList::operator[](const QString &lang) const
|
||||
{
|
||||
return(hash_names.value(lang));
|
||||
return(map_names.value(lang));
|
||||
}
|
||||
|
||||
|
||||
@@ -168,8 +168,13 @@ void NamesList::fromXml(const pugi::xml_node &xml_element, const QHash<QString,
|
||||
}
|
||||
|
||||
/**
|
||||
Exports the list of names to an XML element.
|
||||
Make sure that the list of names is not empty before exporting.
|
||||
If list is empty, set name to "en" / "NoName"
|
||||
French:
|
||||
Exporte la liste des noms vers un element XML. Veillez a verifier que la
|
||||
liste de noms n'est pas vide avant de l'exporter.
|
||||
Si la liste est vide, le nom sera "en" / "NoName".
|
||||
@param xml_document Le document XML dans lequel l'element XML sera insere
|
||||
@param xml_options A set of options related to XML parsing.
|
||||
@return L'element XML correspondant a la section "names"
|
||||
@@ -179,12 +184,19 @@ QDomElement NamesList::toXml(QDomDocument &xml_document, const QHash<QString, QS
|
||||
{
|
||||
QHash<QString, QString> xml_opt = getXmlOptions(xml_options);
|
||||
QDomElement names_elmt = xml_document.createElement(xml_opt["ParentTagName"]);
|
||||
QHashIterator<QString, QString> names_iterator(hash_names);
|
||||
if (map_names.isEmpty()) {
|
||||
qInfo() << " NamesList of element is empty - add default: [" << "en" << "] = " << "NoName" << "";
|
||||
QDomElement name_elmt = xml_document.createElement(xml_opt["TagName"]);
|
||||
name_elmt.setAttribute(xml_opt["LanguageAttribute"], "en");
|
||||
name_elmt.appendChild(xml_document.createTextNode("NoName"));
|
||||
names_elmt.appendChild(name_elmt);
|
||||
}
|
||||
QMapIterator<QString, QString> names_iterator(map_names);
|
||||
while (names_iterator.hasNext()) {
|
||||
names_iterator.next();
|
||||
QDomElement name_elmt = xml_document.createElement(xml_opt["TagName"]);
|
||||
name_elmt.setAttribute(xml_opt["LanguageAttribute"], names_iterator.key());
|
||||
name_elmt.appendChild(xml_document.createTextNode(names_iterator.value()));
|
||||
name_elmt.appendChild(xml_document.createTextNode(names_iterator.value().trimmed()));
|
||||
names_elmt.appendChild(name_elmt);
|
||||
}
|
||||
return(names_elmt);
|
||||
@@ -218,7 +230,7 @@ QHash<QString, QString> NamesList::getXmlOptions(const QHash<QString, QString> &
|
||||
*/
|
||||
bool NamesList::operator!=(const NamesList &nl) const
|
||||
{
|
||||
return(hash_names != nl.hash_names);
|
||||
return(map_names != nl.map_names);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,7 +239,7 @@ bool NamesList::operator!=(const NamesList &nl) const
|
||||
*/
|
||||
bool NamesList::operator==(const NamesList &nl) const
|
||||
{
|
||||
return(hash_names == nl.hash_names);
|
||||
return(map_names == nl.map_names);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -246,10 +258,10 @@ bool NamesList::operator==(const NamesList &nl) const
|
||||
QString NamesList::name(const QString &fallback_name) const
|
||||
{
|
||||
QString system_language = QETApp::langFromSetting();
|
||||
if (! hash_names[system_language].isEmpty())
|
||||
return (hash_names[system_language]);
|
||||
if (! hash_names["en"].isEmpty()) return (hash_names["en"]);
|
||||
if (! map_names[system_language].isEmpty())
|
||||
return (map_names[system_language]);
|
||||
if (! map_names["en"].isEmpty()) return (map_names["en"]);
|
||||
if (! fallback_name.isEmpty()) return (fallback_name);
|
||||
if (hash_names.count()) return (hash_names.begin().value());
|
||||
if (map_names.count()) return (map_names.begin().value());
|
||||
return (QString(""));
|
||||
}
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
|
||||
#include <QtXml>
|
||||
/**
|
||||
This class represents a list of names, used by elements and categories
|
||||
to embed the same name in several languages.
|
||||
Languages are represented by two or five letters (typically the first
|
||||
two of the system locale); examples: en for English, fr for French,
|
||||
pt_BR for Brazilian Portuguese.
|
||||
French:
|
||||
Cette classe represente une liste de noms, utilisee
|
||||
par les elements et categories pour embarquer un meme nom en plusieurs
|
||||
langues.
|
||||
@@ -36,7 +42,7 @@ class NamesList {
|
||||
|
||||
// attributes
|
||||
private:
|
||||
QHash<QString, QString> hash_names;
|
||||
QMap<QString, QString> map_names;
|
||||
|
||||
public:
|
||||
static int MetaTypeId;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
@brief DiagramContext::add
|
||||
Add all value of other to this.
|
||||
If a key already exist, the value is replaced.
|
||||
If a key doesn't exist, she will be added.
|
||||
If a key doesn't exist, it will be added.
|
||||
All other keys of this context, which are not present in other, stay unchanged.
|
||||
@param other
|
||||
*/
|
||||
@@ -124,7 +124,7 @@ int DiagramContext::count()
|
||||
|
||||
/**
|
||||
@brief DiagramContext::keyMustShow
|
||||
@return the value pairs with key, if key no found, return false
|
||||
@return the value pairs with key, if key not found, return false
|
||||
*/
|
||||
bool DiagramContext::keyMustShow(const QString &key) const
|
||||
{
|
||||
@@ -135,7 +135,7 @@ bool DiagramContext::keyMustShow(const QString &key) const
|
||||
|
||||
bool DiagramContext::operator==(const DiagramContext &dc) const
|
||||
{
|
||||
return(m_content == dc.m_content &&
|
||||
return(m_content == dc.m_content &&
|
||||
m_content_show == dc.m_content_show);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,15 +26,15 @@ class QETProject;
|
||||
|
||||
/**
|
||||
* @brief The ProjectPropertiesHandler class
|
||||
* A central class who handle, keep and provide all utilities
|
||||
* A central class that handles, keeps and provides all utilities
|
||||
* to easily manage all kind of properties used in a project.
|
||||
*
|
||||
* This is a new class since QElectroTech 0.9
|
||||
* by consequent she is small and you can found a lot of properties (made before qet 0.9)
|
||||
* by consequence it is small and you can find a lot of properties (made before qet 0.9)
|
||||
* everywhere in the code.
|
||||
* All new properties should be managed by this class
|
||||
* (of course if it make sense to be managed by this class).
|
||||
* Older properties who are not managed by this class but should be,
|
||||
* (of course if it makes sense to be managed by this class).
|
||||
* Older properties which are not managed by this class but should be,
|
||||
* will be managed in future.
|
||||
*/
|
||||
class ProjectPropertiesHandler
|
||||
|
||||
@@ -2083,10 +2083,10 @@ void QETDiagramEditor::projectWasClosed(ProjectView *project_view)
|
||||
undo_group.removeStack(project -> undoStack());
|
||||
QETApp::unregisterProject(project);
|
||||
}
|
||||
//When project is closed, a lot of signal are emitted, notably if there is an item selected in a diagram.
|
||||
//In some special case, since signal/slot connection can be direct or queued, some signal are handled after QObject is deleted, and crash qet
|
||||
//notably in the function Diagram::elements when she call items() (I don't know exactly why).
|
||||
//set nullptr to "m_selection_properties_editor->setDiagram()" fix this crash
|
||||
//When project is closed, a lot of signals are emitted, notably if there is an item selected in a diagram.
|
||||
//In some special case, since signal/slot connection can be direct or queued, some signals are handled after QObject is deleted, and crash qet
|
||||
//notably in the function Diagram::elements when it calls items() (I don't know exactly why).
|
||||
//set nullptr to "m_selection_properties_editor->setDiagram()" fixes this crash
|
||||
m_selection_properties_editor->setDiagram(nullptr);
|
||||
project_view -> deleteLater();
|
||||
project -> deleteLater();
|
||||
|
||||
Reference in New Issue
Block a user