mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Mod doc set style de same
This commit is contained in:
@@ -24,20 +24,22 @@
|
||||
#include <QDir>
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::FileElementCollectionItem
|
||||
* Constructor
|
||||
*/
|
||||
@brief FileElementCollectionItem::FileElementCollectionItem
|
||||
Constructor
|
||||
*/
|
||||
FileElementCollectionItem::FileElementCollectionItem()
|
||||
{}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::setRootPath
|
||||
* Set path has root path for this file item.
|
||||
* Use this function only to set the beginning of a file collection.
|
||||
* @param path
|
||||
* @return true if path exist.
|
||||
*/
|
||||
bool FileElementCollectionItem::setRootPath(const QString& path, bool set_data, bool hide_element)
|
||||
@brief FileElementCollectionItem::setRootPath
|
||||
Set path has root path for this file item.
|
||||
Use this function only to set the beginning of a file collection.
|
||||
@param path
|
||||
@return true if path exist.
|
||||
*/
|
||||
bool FileElementCollectionItem::setRootPath(const QString& path,
|
||||
bool set_data,
|
||||
bool hide_element)
|
||||
{
|
||||
QDir dir(path);
|
||||
if (dir.exists())
|
||||
@@ -51,9 +53,9 @@ bool FileElementCollectionItem::setRootPath(const QString& path, bool set_data,
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::fileSystemPath
|
||||
* @return the file system path of this item
|
||||
*/
|
||||
@brief FileElementCollectionItem::fileSystemPath
|
||||
@return the file system path of this item
|
||||
*/
|
||||
QString FileElementCollectionItem::fileSystemPath() const
|
||||
{
|
||||
if (isCollectionRoot())
|
||||
@@ -63,14 +65,14 @@ QString FileElementCollectionItem::fileSystemPath() const
|
||||
if (feci)
|
||||
return feci->fileSystemPath() + "/" + m_path;
|
||||
else
|
||||
return QString();
|
||||
return QString();//Null string
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::dirPath
|
||||
* @return the dir path of this item (if this item is a dir return the path,
|
||||
* if item is an element return the path of the parent directory)
|
||||
*/
|
||||
@brief FileElementCollectionItem::dirPath
|
||||
@return the dir path of this item (if this item is a dir return the path,
|
||||
if item is an element return the path of the parent directory)
|
||||
*/
|
||||
QString FileElementCollectionItem::dirPath() const
|
||||
{
|
||||
if (isDir())
|
||||
@@ -78,13 +80,13 @@ QString FileElementCollectionItem::dirPath() const
|
||||
else if (parent() && parent()->type() == FileElementCollectionItem::Type)
|
||||
return static_cast<FileElementCollectionItem*>(parent())->fileSystemPath();
|
||||
else
|
||||
return QString();
|
||||
return QString();//Null string
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::isDir
|
||||
* @return true if this item represent a directory
|
||||
*/
|
||||
@brief FileElementCollectionItem::isDir
|
||||
@return true if this item represent a directory
|
||||
*/
|
||||
bool FileElementCollectionItem::isDir() const
|
||||
{
|
||||
if (m_path.endsWith(".elmt"))
|
||||
@@ -95,18 +97,18 @@ bool FileElementCollectionItem::isDir() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::isElement
|
||||
* @return true if this item represent an element
|
||||
*/
|
||||
@brief FileElementCollectionItem::isElement
|
||||
@return true if this item represent an element
|
||||
*/
|
||||
bool FileElementCollectionItem::isElement() const
|
||||
{
|
||||
return (!isDir());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::localName
|
||||
* @return the located name of this item
|
||||
*/
|
||||
@brief FileElementCollectionItem::localName
|
||||
@return the located name of this item
|
||||
*/
|
||||
QString FileElementCollectionItem::localName()
|
||||
{
|
||||
if (!text().isNull())
|
||||
@@ -145,11 +147,12 @@ QString FileElementCollectionItem::localName()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::localName
|
||||
* Surcharged method, unlike the default method, avoid to create an elementLocation and so, gain time.
|
||||
* @param location
|
||||
* @return
|
||||
*/
|
||||
@brief FileElementCollectionItem::localName
|
||||
Surcharged method, unlike the default method,
|
||||
avoid to create an elementLocation and so, gain time.
|
||||
@param location
|
||||
@return
|
||||
*/
|
||||
QString FileElementCollectionItem::localName(const ElementsLocation &location)
|
||||
{
|
||||
if (!text().isNull())
|
||||
@@ -166,9 +169,9 @@ QString FileElementCollectionItem::localName(const ElementsLocation &location)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::name
|
||||
* @return The collection name of this item
|
||||
*/
|
||||
@brief FileElementCollectionItem::name
|
||||
@return The collection name of this item
|
||||
*/
|
||||
QString FileElementCollectionItem::name() const
|
||||
{
|
||||
if (isCollectionRoot())
|
||||
@@ -178,9 +181,9 @@ QString FileElementCollectionItem::name() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::collectionPath
|
||||
* @return The path of this item relative to the collection.
|
||||
*/
|
||||
@brief FileElementCollectionItem::collectionPath
|
||||
@return The path of this item relative to the collection.
|
||||
*/
|
||||
QString FileElementCollectionItem::collectionPath() const
|
||||
{
|
||||
if (isCollectionRoot()) {
|
||||
@@ -201,9 +204,9 @@ QString FileElementCollectionItem::collectionPath() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::isCollectionRoot
|
||||
* @return true if this item represent the root of collection
|
||||
*/
|
||||
@brief FileElementCollectionItem::isCollectionRoot
|
||||
@return true if this item represent the root of collection
|
||||
*/
|
||||
bool FileElementCollectionItem::isCollectionRoot() const
|
||||
{
|
||||
if (m_path == QETApp::commonElementsDirN() || m_path == QETApp::customElementsDirN())
|
||||
@@ -213,28 +216,29 @@ bool FileElementCollectionItem::isCollectionRoot() const
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::isCommonCollection
|
||||
* @return True if this item represent the common collection
|
||||
*/
|
||||
@brief FileElementCollectionItem::isCommonCollection
|
||||
@return True if this item represent the common collection
|
||||
*/
|
||||
bool FileElementCollectionItem::isCommonCollection() const
|
||||
{
|
||||
return fileSystemPath().startsWith(QETApp::commonElementsDirN());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::isCustomCollection
|
||||
* @return True if this item represent the custom collection
|
||||
*/
|
||||
@brief FileElementCollectionItem::isCustomCollection
|
||||
@return True if this item represent the custom collection
|
||||
*/
|
||||
bool FileElementCollectionItem::isCustomCollection() const
|
||||
{
|
||||
return fileSystemPath().startsWith(QETApp::customElementsDirN());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::addChildAtPath
|
||||
* Ask to this item item to add a child with collection name @collection_name
|
||||
* @param collection_name
|
||||
*/
|
||||
@brief FileElementCollectionItem::addChildAtPath
|
||||
Ask to this item item to add a child
|
||||
with collection name @collection_name
|
||||
@param collection_name
|
||||
*/
|
||||
void FileElementCollectionItem::addChildAtPath(const QString &collection_name)
|
||||
{
|
||||
if (collection_name.isEmpty())
|
||||
@@ -247,9 +251,9 @@ void FileElementCollectionItem::addChildAtPath(const QString &collection_name)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::setUpData
|
||||
* SetUp the data of this item
|
||||
*/
|
||||
@brief FileElementCollectionItem::setUpData
|
||||
SetUp the data of this item
|
||||
*/
|
||||
void FileElementCollectionItem::setUpData()
|
||||
{
|
||||
if (isDir())
|
||||
@@ -261,8 +265,8 @@ void FileElementCollectionItem::setUpData()
|
||||
{
|
||||
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
|
||||
|
||||
//Set the local name and all informations of the element
|
||||
//in the data Qt::UserRole+1, these data will be use for search.
|
||||
//Set the local name and all informations of the element
|
||||
//in the data Qt::UserRole+1, these data will be use for search.
|
||||
ElementsLocation loc(collectionPath());
|
||||
DiagramContext context = loc.elementInformations();
|
||||
QStringList search_list;
|
||||
@@ -277,10 +281,11 @@ void FileElementCollectionItem::setUpData()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::setUpIcon
|
||||
* SetUp the icon of this item.
|
||||
* Because icon use several memory, we use this method for setup icon instead setUpData.
|
||||
*/
|
||||
@brief FileElementCollectionItem::setUpIcon
|
||||
SetUp the icon of this item.
|
||||
Because icon use several memory,
|
||||
we use this method for setup icon instead setUpData.
|
||||
*/
|
||||
void FileElementCollectionItem::setUpIcon()
|
||||
{
|
||||
if (!icon().isNull())
|
||||
@@ -304,26 +309,32 @@ void FileElementCollectionItem::setUpIcon()
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::setPathName
|
||||
* Set the name of this item in the file system path.
|
||||
* This item must have a parent, because they should be a child item of another.
|
||||
* For create a new file collection see setRootPath.
|
||||
* @param path_name
|
||||
*/
|
||||
void FileElementCollectionItem::setPathName(const QString& path_name, bool set_data, bool hide_element)
|
||||
@brief FileElementCollectionItem::setPathName
|
||||
Set the name of this item in the file system path.
|
||||
This item must have a parent,
|
||||
because they should be a child item of another.
|
||||
For create a new file collection see setRootPath.
|
||||
@param path_name
|
||||
@param set_data
|
||||
@param hide_element
|
||||
*/
|
||||
void FileElementCollectionItem::setPathName(const QString& path_name,
|
||||
bool set_data,
|
||||
bool hide_element)
|
||||
{
|
||||
m_path = path_name;
|
||||
|
||||
//This isn't an element, we create the childs
|
||||
//This isn't an element, we create the childs
|
||||
if (!path_name.endsWith(".elmt"))
|
||||
populate(set_data, hide_element);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FileElementCollectionItem::populate
|
||||
* Create the childs of this item
|
||||
* @param set_data : if true, call setUpData for every child of this item
|
||||
*/
|
||||
@brief FileElementCollectionItem::populate
|
||||
Create the childs of this item
|
||||
@param set_data : if true, call setUpData for every child of this item
|
||||
@param hide_element
|
||||
*/
|
||||
void FileElementCollectionItem::populate(bool set_data, bool hide_element)
|
||||
{
|
||||
QDir dir (fileSystemPath());
|
||||
|
||||
Reference in New Issue
Block a user