QElectroTech
0.70
|
#include <nameslist.h>
Public Member Functions | |
NamesList () | |
NamesList (const NamesList &) | |
virtual | ~NamesList () |
void | addName (const QString &, const QString &) |
void | removeName (const QString &) |
void | clearNames () |
QList< QString > | langs () const |
bool | isEmpty () const |
int | count () const |
QString & | operator[] (const QString &) |
const QString | operator[] (const QString &) const |
bool | operator!= (const NamesList &) const |
bool | operator== (const NamesList &) const |
QString | name (const QString &=QString()) const |
void | fromXml (const QDomElement &, const QHash< QString, QString > &=QHash< QString, QString >()) |
QDomElement | toXml (QDomDocument &, const QHash< QString, QString > &=QHash< QString, QString >()) const |
Static Public Attributes | |
static int | MetaTypeId = qRegisterMetaType<NamesList>("NamesList") |
Protected Member Functions | |
QHash< QString, QString > | getXmlOptions (const QHash< QString, QString > &=QHash< QString, QString >()) const |
Private Attributes | |
QHash< QString, QString > | hash_names |
Cette classe represente une liste de noms, utilisee par les elements et categories pour embarquer un meme nom en plusieurs langues. Les langues sont representees par deux lettres (typiquement : les deux premieres de la locale du systeme) ; exemples : en pour l'anglais, fr pour le francais.
Definition at line 29 of file nameslist.h.
NamesList::NamesList | ( | ) |
Constructeur
Definition at line 27 of file nameslist.cpp.
NamesList::NamesList | ( | const NamesList & | other | ) |
Constructeur de copie
other | La NamesList a copier |
Definition at line 34 of file nameslist.cpp.
|
virtual |
Destructeur
Definition at line 40 of file nameslist.cpp.
void NamesList::addName | ( | const QString & | lang, |
const QString & | name | ||
) |
Ajoute un nom a la liste
lang | Sigle de deux lettres representant une langue. Si cela n'est pas respecte, l'insertion n'est pas effectuee. |
name | Nom lui-meme. Ce ne doit pas etre une chaine de caractere vide. Si cela n'est pas respecte, l'insertion n'est pas effectuee. |
Definition at line 50 of file nameslist.cpp.
References hash_names, and name().
Referenced by NewElementWizard::buildStep3(), ElementsCategoryEditor::ElementsCategoryEditor(), fromXml(), NameListWidget::names(), QETProject::namesListForIntegrationCategory(), and XmlElementCollection::XmlElementCollection().
void NamesList::clearNames | ( | ) |
int NamesList::count | ( | ) | const |
Definition at line 87 of file nameslist.cpp.
References hash_names.
void NamesList::fromXml | ( | const QDomElement & | xml_element, |
const QHash< QString, QString > & | xml_options = QHash<QString, QString>() |
||
) |
Charge la liste de noms depuis un element XML. Cet element est sense etre le parent d'un element "names", qui contient lui meme les "name". Les noms precedemment contenus dans la liste ne sont pas effaces mais peuvent etre ecrases.
xml_element | L'element XML a analyser |
xml_options | A set of options related to XML parsing. |
Definition at line 120 of file nameslist.cpp.
References addName(), getXmlOptions(), and name().
Referenced by ElementScene::applyInformations(), Element::buildFromXml(), and TitleBlockCell::loadContentFromXml().
|
protected |
xml_options | A set of options related to XML parsing. Available keys: ParentTagName (falls back to "names") TagName (falls back to "name") LanguageAttribute (falls back to "lang") |
Definition at line 164 of file nameslist.cpp.
bool NamesList::isEmpty | ( | ) | const |
Definition at line 80 of file nameslist.cpp.
References hash_names.
Referenced by TitleBlockTemplate::finalTextForCell(), NameListWidget::isEmpty(), and name().
QList< QString > NamesList::langs | ( | ) | const |
Definition at line 73 of file nameslist.cpp.
References hash_names.
Referenced by NameListWidget::setNames().
QString NamesList::name | ( | const QString & | fallback_name = QString() | ) | const |
Return the adequate name regarding the current system locale. By order of preference, this function chooses:
fallback_name | name to be returned when no adequate name has been found |
Definition at line 205 of file nameslist.cpp.
References hash_names, isEmpty(), and QETApp::langFromSetting().
Referenced by addName(), TitleBlockTemplate::finalTextForCell(), fromXml(), TitleBlockCell::loadContentFromXml(), and Element::name().
bool NamesList::operator!= | ( | const NamesList & | nl | ) | const |
nl | une autre liste de noms |
Definition at line 182 of file nameslist.cpp.
References hash_names, and QET::Icons::nl.
bool NamesList::operator== | ( | const NamesList & | nl | ) | const |
nl | une autre liste de noms |
Definition at line 190 of file nameslist.cpp.
References hash_names, and QET::Icons::nl.
QString & NamesList::operator[] | ( | const QString & | lang | ) |
lang | une langue |
Definition at line 96 of file nameslist.cpp.
References hash_names.
const QString NamesList::operator[] | ( | const QString & | lang | ) | const |
lang | une langue |
Definition at line 105 of file nameslist.cpp.
References hash_names.
void NamesList::removeName | ( | const QString & | lang | ) |
Enleve le nom dont une langue donnee
lang | la langue pour laquelle il faut supprimer le nom |
Definition at line 59 of file nameslist.cpp.
References hash_names.
QDomElement NamesList::toXml | ( | QDomDocument & | xml_document, |
const QHash< QString, QString > & | xml_options = QHash<QString, QString>() |
||
) | const |
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.
xml_document | Le document XML dans lequel l'element XML sera insere |
xml_options | A set of options related to XML parsing. |
Definition at line 143 of file nameslist.cpp.
References getXmlOptions(), and hash_names.
Referenced by XmlElementCollection::addElement(), ECHSXmlToFile::copyDirectory(), XmlElementCollection::createDir(), ElementCollectionHandler::createDir(), TitleBlockCell::saveContentToXml(), ElementCollectionHandler::setNames(), ElementScene::toXml(), and XmlElementCollection::XmlElementCollection().
|
private |
Definition at line 38 of file nameslist.h.
Referenced by addName(), clearNames(), count(), isEmpty(), langs(), name(), operator!=(), operator==(), operator[](), removeName(), and toXml().
|
static |
Definition at line 41 of file nameslist.h.