Mod doc set style de same

This commit is contained in:
Simon De Backer
2020-07-24 22:44:10 +02:00
parent d087a8be66
commit c0df06c2ee
2 changed files with 88 additions and 75 deletions

View File

@@ -24,20 +24,22 @@
#include <QDir> #include <QDir>
/** /**
* @brief FileElementCollectionItem::FileElementCollectionItem @brief FileElementCollectionItem::FileElementCollectionItem
* Constructor Constructor
*/ */
FileElementCollectionItem::FileElementCollectionItem() FileElementCollectionItem::FileElementCollectionItem()
{} {}
/** /**
* @brief FileElementCollectionItem::setRootPath @brief FileElementCollectionItem::setRootPath
* Set path has root path for this file item. Set path has root path for this file item.
* Use this function only to set the beginning of a file collection. Use this function only to set the beginning of a file collection.
* @param path @param path
* @return true if path exist. @return true if path exist.
*/ */
bool FileElementCollectionItem::setRootPath(const QString& path, bool set_data, bool hide_element) bool FileElementCollectionItem::setRootPath(const QString& path,
bool set_data,
bool hide_element)
{ {
QDir dir(path); QDir dir(path);
if (dir.exists()) if (dir.exists())
@@ -51,9 +53,9 @@ bool FileElementCollectionItem::setRootPath(const QString& path, bool set_data,
} }
/** /**
* @brief FileElementCollectionItem::fileSystemPath @brief FileElementCollectionItem::fileSystemPath
* @return the file system path of this item @return the file system path of this item
*/ */
QString FileElementCollectionItem::fileSystemPath() const QString FileElementCollectionItem::fileSystemPath() const
{ {
if (isCollectionRoot()) if (isCollectionRoot())
@@ -63,14 +65,14 @@ QString FileElementCollectionItem::fileSystemPath() const
if (feci) if (feci)
return feci->fileSystemPath() + "/" + m_path; return feci->fileSystemPath() + "/" + m_path;
else else
return QString(); return QString();//Null string
} }
/** /**
* @brief FileElementCollectionItem::dirPath @brief FileElementCollectionItem::dirPath
* @return the dir path of this item (if this item is a dir return the path, @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) if item is an element return the path of the parent directory)
*/ */
QString FileElementCollectionItem::dirPath() const QString FileElementCollectionItem::dirPath() const
{ {
if (isDir()) if (isDir())
@@ -78,13 +80,13 @@ QString FileElementCollectionItem::dirPath() const
else if (parent() && parent()->type() == FileElementCollectionItem::Type) else if (parent() && parent()->type() == FileElementCollectionItem::Type)
return static_cast<FileElementCollectionItem*>(parent())->fileSystemPath(); return static_cast<FileElementCollectionItem*>(parent())->fileSystemPath();
else else
return QString(); return QString();//Null string
} }
/** /**
* @brief FileElementCollectionItem::isDir @brief FileElementCollectionItem::isDir
* @return true if this item represent a directory @return true if this item represent a directory
*/ */
bool FileElementCollectionItem::isDir() const bool FileElementCollectionItem::isDir() const
{ {
if (m_path.endsWith(".elmt")) if (m_path.endsWith(".elmt"))
@@ -95,18 +97,18 @@ bool FileElementCollectionItem::isDir() const
} }
/** /**
* @brief FileElementCollectionItem::isElement @brief FileElementCollectionItem::isElement
* @return true if this item represent an element @return true if this item represent an element
*/ */
bool FileElementCollectionItem::isElement() const bool FileElementCollectionItem::isElement() const
{ {
return (!isDir()); return (!isDir());
} }
/** /**
* @brief FileElementCollectionItem::localName @brief FileElementCollectionItem::localName
* @return the located name of this item @return the located name of this item
*/ */
QString FileElementCollectionItem::localName() QString FileElementCollectionItem::localName()
{ {
if (!text().isNull()) if (!text().isNull())
@@ -145,11 +147,12 @@ QString FileElementCollectionItem::localName()
} }
/** /**
* @brief FileElementCollectionItem::localName @brief FileElementCollectionItem::localName
* Surcharged method, unlike the default method, avoid to create an elementLocation and so, gain time. Surcharged method, unlike the default method,
* @param location avoid to create an elementLocation and so, gain time.
* @return @param location
*/ @return
*/
QString FileElementCollectionItem::localName(const ElementsLocation &location) QString FileElementCollectionItem::localName(const ElementsLocation &location)
{ {
if (!text().isNull()) if (!text().isNull())
@@ -166,9 +169,9 @@ QString FileElementCollectionItem::localName(const ElementsLocation &location)
} }
/** /**
* @brief FileElementCollectionItem::name @brief FileElementCollectionItem::name
* @return The collection name of this item @return The collection name of this item
*/ */
QString FileElementCollectionItem::name() const QString FileElementCollectionItem::name() const
{ {
if (isCollectionRoot()) if (isCollectionRoot())
@@ -178,9 +181,9 @@ QString FileElementCollectionItem::name() const
} }
/** /**
* @brief FileElementCollectionItem::collectionPath @brief FileElementCollectionItem::collectionPath
* @return The path of this item relative to the collection. @return The path of this item relative to the collection.
*/ */
QString FileElementCollectionItem::collectionPath() const QString FileElementCollectionItem::collectionPath() const
{ {
if (isCollectionRoot()) { if (isCollectionRoot()) {
@@ -201,9 +204,9 @@ QString FileElementCollectionItem::collectionPath() const
} }
/** /**
* @brief FileElementCollectionItem::isCollectionRoot @brief FileElementCollectionItem::isCollectionRoot
* @return true if this item represent the root of collection @return true if this item represent the root of collection
*/ */
bool FileElementCollectionItem::isCollectionRoot() const bool FileElementCollectionItem::isCollectionRoot() const
{ {
if (m_path == QETApp::commonElementsDirN() || m_path == QETApp::customElementsDirN()) if (m_path == QETApp::commonElementsDirN() || m_path == QETApp::customElementsDirN())
@@ -213,28 +216,29 @@ bool FileElementCollectionItem::isCollectionRoot() const
} }
/** /**
* @brief FileElementCollectionItem::isCommonCollection @brief FileElementCollectionItem::isCommonCollection
* @return True if this item represent the common collection @return True if this item represent the common collection
*/ */
bool FileElementCollectionItem::isCommonCollection() const bool FileElementCollectionItem::isCommonCollection() const
{ {
return fileSystemPath().startsWith(QETApp::commonElementsDirN()); return fileSystemPath().startsWith(QETApp::commonElementsDirN());
} }
/** /**
* @brief FileElementCollectionItem::isCustomCollection @brief FileElementCollectionItem::isCustomCollection
* @return True if this item represent the custom collection @return True if this item represent the custom collection
*/ */
bool FileElementCollectionItem::isCustomCollection() const bool FileElementCollectionItem::isCustomCollection() const
{ {
return fileSystemPath().startsWith(QETApp::customElementsDirN()); return fileSystemPath().startsWith(QETApp::customElementsDirN());
} }
/** /**
* @brief FileElementCollectionItem::addChildAtPath @brief FileElementCollectionItem::addChildAtPath
* Ask to this item item to add a child with collection name @collection_name Ask to this item item to add a child
* @param collection_name with collection name @collection_name
*/ @param collection_name
*/
void FileElementCollectionItem::addChildAtPath(const QString &collection_name) void FileElementCollectionItem::addChildAtPath(const QString &collection_name)
{ {
if (collection_name.isEmpty()) if (collection_name.isEmpty())
@@ -247,9 +251,9 @@ void FileElementCollectionItem::addChildAtPath(const QString &collection_name)
} }
/** /**
* @brief FileElementCollectionItem::setUpData @brief FileElementCollectionItem::setUpData
* SetUp the data of this item SetUp the data of this item
*/ */
void FileElementCollectionItem::setUpData() void FileElementCollectionItem::setUpData()
{ {
if (isDir()) if (isDir())
@@ -277,10 +281,11 @@ void FileElementCollectionItem::setUpData()
} }
/** /**
* @brief FileElementCollectionItem::setUpIcon @brief FileElementCollectionItem::setUpIcon
* SetUp the icon of this item. SetUp the icon of this item.
* Because icon use several memory, we use this method for setup icon instead setUpData. Because icon use several memory,
*/ we use this method for setup icon instead setUpData.
*/
void FileElementCollectionItem::setUpIcon() void FileElementCollectionItem::setUpIcon()
{ {
if (!icon().isNull()) if (!icon().isNull())
@@ -304,13 +309,18 @@ void FileElementCollectionItem::setUpIcon()
} }
/** /**
* @brief FileElementCollectionItem::setPathName @brief FileElementCollectionItem::setPathName
* Set the name of this item in the file system path. 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. This item must have a parent,
* For create a new file collection see setRootPath. because they should be a child item of another.
* @param path_name For create a new file collection see setRootPath.
*/ @param path_name
void FileElementCollectionItem::setPathName(const QString& path_name, bool set_data, bool hide_element) @param set_data
@param hide_element
*/
void FileElementCollectionItem::setPathName(const QString& path_name,
bool set_data,
bool hide_element)
{ {
m_path = path_name; m_path = path_name;
@@ -320,10 +330,11 @@ void FileElementCollectionItem::setPathName(const QString& path_name, bool set_d
} }
/** /**
* @brief FileElementCollectionItem::populate @brief FileElementCollectionItem::populate
* Create the childs of this item Create the childs of this item
* @param set_data : if true, call setUpData for every child 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) void FileElementCollectionItem::populate(bool set_data, bool hide_element)
{ {
QDir dir (fileSystemPath()); QDir dir (fileSystemPath());

View File

@@ -21,8 +21,9 @@
#include "elementspanel.h" #include "elementspanel.h"
/** /**
This class embeds an elements panel under a toolbar providing various actions @brief The ElementsPanelWidget class
to manage elements. This class embeds an elements panel under a toolbar
providing various actions to manage elements.
@see ElementsPanel @see ElementsPanel
*/ */
class ElementsPanelWidget : public QWidget { class ElementsPanelWidget : public QWidget {
@@ -93,6 +94,7 @@ class ElementsPanelWidget : public QWidget {
}; };
/** /**
@brief ElementsPanelWidget::elementsPanel
@return The elements panel embedded within this widget. @return The elements panel embedded within this widget.
*/ */
inline ElementsPanel &ElementsPanelWidget::elementsPanel() const { inline ElementsPanel &ElementsPanelWidget::elementsPanel() const {