mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-20 19:19:58 +01:00
Merge branch 'master' of ssh://git.tuxfamily.org/gitroot/qet/qet into master
This commit is contained in:
@@ -282,9 +282,8 @@ void FileElementCollectionItem::setUpData()
|
|||||||
ElementsLocation loc(collectionPath());
|
ElementsLocation loc(collectionPath());
|
||||||
DiagramContext context = loc.elementInformations();
|
DiagramContext context = loc.elementInformations();
|
||||||
QStringList search_list;
|
QStringList search_list;
|
||||||
for (QString key : context.keys()) {
|
for (QString& key : context.keys())
|
||||||
search_list.append(context.value(key).toString());
|
{ search_list.append(context.value(key).toString()); }
|
||||||
}
|
|
||||||
search_list.append(localName(loc));
|
search_list.append(localName(loc));
|
||||||
setData(search_list.join(" "));
|
setData(search_list.join(" "));
|
||||||
}
|
}
|
||||||
@@ -352,8 +351,8 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
|
|||||||
QDir dir (fileSystemPath());
|
QDir dir (fileSystemPath());
|
||||||
|
|
||||||
//Get all directory in this directory.
|
//Get all directory in this directory.
|
||||||
for(auto str : dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot,
|
for (auto& str :
|
||||||
QDir::Name))
|
dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name))
|
||||||
{
|
{
|
||||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||||
appendRow(feci);
|
appendRow(feci);
|
||||||
@@ -367,8 +366,8 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element)
|
|||||||
|
|
||||||
//Get all elmt file in this directory
|
//Get all elmt file in this directory
|
||||||
dir.setNameFilters(QStringList() << "*.elmt");
|
dir.setNameFilters(QStringList() << "*.elmt");
|
||||||
for(auto str : dir.entryList(QDir::Files | QDir::NoDotAndDotDot,
|
for (auto& str :
|
||||||
QDir::Name))
|
dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name))
|
||||||
{
|
{
|
||||||
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
FileElementCollectionItem *feci = new FileElementCollectionItem();
|
||||||
appendRow(feci);
|
appendRow(feci);
|
||||||
|
|||||||
@@ -229,28 +229,25 @@ bool NamesList::operator==(const NamesList &nl) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the adequate name regarding the current system locale.
|
* @brief NamesList::name
|
||||||
By order of preference, this function chooses:
|
* Return the adequate name regarding the current system locale.
|
||||||
- the name in the system language
|
* By order of preference, this function chooses:
|
||||||
- the English name
|
* - the name in the system language
|
||||||
- the provided fallback name if non-empty
|
* - the English name
|
||||||
- the first language encountered in the list
|
* - the provided fallback name if non-empty
|
||||||
- an empty string
|
* - the first language encountered in the list
|
||||||
@param fallback_name name to be returned when no adequate name has been found
|
* - an empty string
|
||||||
@return The adequate name regarding the current system locale.
|
* @param fallback_name
|
||||||
*/
|
* name to be returned when no adequate name has been found
|
||||||
|
* @return The adequate name regarding the current system locale.
|
||||||
|
*/
|
||||||
QString NamesList::name(const QString &fallback_name) const
|
QString NamesList::name(const QString &fallback_name) const
|
||||||
{
|
{
|
||||||
QString system_language = QETApp::langFromSetting();
|
QString system_language = QETApp::langFromSetting();
|
||||||
QString returned_name;
|
if (! hash_names[system_language].isEmpty())
|
||||||
if (!hash_names[system_language].isEmpty()) {
|
return (hash_names[system_language]);
|
||||||
returned_name = hash_names[system_language];
|
if (! hash_names["en"].isEmpty()) return (hash_names["en"]);
|
||||||
} else if (!hash_names["en"].isEmpty()) {
|
if (! fallback_name.isEmpty()) return (fallback_name);
|
||||||
returned_name = hash_names["en"];
|
if (hash_names.count()) return (hash_names.begin().value());
|
||||||
} else if (!fallback_name.isEmpty()) {
|
return (QString(""));
|
||||||
returned_name = fallback_name;
|
|
||||||
} else if (hash_names.count()) {
|
|
||||||
returned_name = hash_names.value(hash_names.keys().first());
|
|
||||||
}
|
|
||||||
return(returned_name);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user