QElectroTech  0.70
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
FileElementCollectionItem Class Reference

The FileElementCollectionItem class This class specialise ElementCollectionItem for manage a collection in a file system. They represente a directory or an element. More...

#include <fileelementcollectionitem.h>

Public Types

enum  { Type = UserType+2 }
 
- Public Types inherited from ElementCollectionItem
enum  { Type = UserType+1 }
 

Public Member Functions

 FileElementCollectionItem ()
 FileElementCollectionItem::FileElementCollectionItem Constructor. More...
 
int type () const override
 
bool setRootPath (const QString &path, bool set_data=true, bool hide_element=false)
 FileElementCollectionItem::setRootPath Set path has root path for this file item. Use this function only to set the beginning of a file collection. More...
 
QString fileSystemPath () const
 FileElementCollectionItem::fileSystemPath. More...
 
QString dirPath () const
 FileElementCollectionItem::dirPath. More...
 
bool isDir () const override
 FileElementCollectionItem::isDir. More...
 
bool isElement () const override
 FileElementCollectionItem::isElement. More...
 
QString localName () override
 FileElementCollectionItem::localName. More...
 
QString name () const override
 FileElementCollectionItem::name. More...
 
QString collectionPath () const override
 FileElementCollectionItem::collectionPath. More...
 
bool isCollectionRoot () const override
 FileElementCollectionItem::isCollectionRoot. More...
 
bool isCommonCollection () const
 FileElementCollectionItem::isCommonCollection. More...
 
bool isCustomCollection () const
 FileElementCollectionItem::isCustomCollection. More...
 
void addChildAtPath (const QString &collection_name) override
 FileElementCollectionItem::addChildAtPath Ask to this item item to add a child with collection name . More...
 
void setUpData () override
 FileElementCollectionItem::setUpData SetUp the data of this item. More...
 
void setUpIcon () override
 FileElementCollectionItem::setUpIcon SetUp the icon of this item. Because icon use several memory, we use this method for setup icon instead setUpData. More...
 
void hire ()
 
- Public Member Functions inherited from ElementCollectionItem
 ElementCollectionItem ()
 ElementCollectionItem::ElementCollectionItem Constructor. More...
 
int type () const override
 
virtual void clearData ()
 ElementCollectionItem::clearData Reset the data. More...
 
ElementCollectionItemlastItemForPath (const QString &path, QString &no_found_path)
 ElementCollectionItem::lastItemForPath Return the last existing item in this ElementCollectionItem hierarchy according to the given path. Next_item is the first non existing item in this hierarchy according to the given path. More...
 
ElementCollectionItemchildWithCollectionName (const QString &name) const
 
QList< QStandardItem * > directChilds () const
 ElementCollectionItem::directChilds Return the direct child of this item. More...
 
int rowForInsertItem (const QString &name)
 ElementCollectionItem::rowForInsertItem Return the row for insert a new child item to this item with name . If row can't be found (collection_name is null, or already exist) return -1;. More...
 
ElementCollectionItemitemAtPath (const QString &path)
 ElementCollectionItem::itemAtPath. More...
 
QList< ElementCollectionItem * > elementsDirectChild () const
 ElementCollectionItem::elementsDirectChild. More...
 
QList< ElementCollectionItem * > directoriesDirectChild () const
 ElementCollectionItem::directoriesDirectChild. More...
 
QList< ElementCollectionItem * > elementsChild () const
 ElementCollectionItem::elementsChild. More...
 
QList< ElementCollectionItem * > directoriesChild () const
 ElementCollectionItem::directoriesChild. More...
 
QList< ElementCollectionItem * > items () const
 ElementCollectionItem::items. More...
 

Private Member Functions

void setPathName (const QString &path_name, bool set_data=true, bool hide_element=false)
 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. More...
 
void populate (bool set_data=true, bool hide_element=false)
 FileElementCollectionItem::populate Create the childs of this item. More...
 

Private Attributes

QString m_path
 

Detailed Description

The FileElementCollectionItem class This class specialise ElementCollectionItem for manage a collection in a file system. They represente a directory or an element.

Definition at line 28 of file fileelementcollectionitem.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Definition at line 33 of file fileelementcollectionitem.h.

Constructor & Destructor Documentation

◆ FileElementCollectionItem()

FileElementCollectionItem::FileElementCollectionItem ( )

Member Function Documentation

◆ addChildAtPath()

void FileElementCollectionItem::addChildAtPath ( const QString &  collection_name)
overridevirtual

FileElementCollectionItem::addChildAtPath Ask to this item item to add a child with collection name .

Parameters
collection_name

Implements ElementCollectionItem.

Definition at line 220 of file fileelementcollectionitem.cpp.

References FileElementCollectionItem(), ElementCollectionItem::rowForInsertItem(), setPathName(), and setUpData().

Referenced by ElementsCollectionModel::dropMimeData().

◆ collectionPath()

QString FileElementCollectionItem::collectionPath ( ) const
overridevirtual

◆ dirPath()

QString FileElementCollectionItem::dirPath ( ) const

FileElementCollectionItem::dirPath.

Returns
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)

Definition at line 73 of file fileelementcollectionitem.cpp.

References fileSystemPath(), isDir(), Type, and type().

◆ fileSystemPath()

QString FileElementCollectionItem::fileSystemPath ( ) const

◆ hire()

void FileElementCollectionItem::hire ( )

◆ isCollectionRoot()

bool FileElementCollectionItem::isCollectionRoot ( ) const
overridevirtual

◆ isCommonCollection()

bool FileElementCollectionItem::isCommonCollection ( ) const

◆ isCustomCollection()

bool FileElementCollectionItem::isCustomCollection ( ) const

FileElementCollectionItem::isCustomCollection.

Returns
True if this item represent the custom collection

Definition at line 210 of file fileelementcollectionitem.cpp.

References QETApp::customElementsDirN(), and fileSystemPath().

Referenced by ElementsCollectionModel::addLocation().

◆ isDir()

bool FileElementCollectionItem::isDir ( ) const
overridevirtual

FileElementCollectionItem::isDir.

Returns
true if this item represent a directory

Implements ElementCollectionItem.

Definition at line 87 of file fileelementcollectionitem.cpp.

References m_path.

Referenced by ElementsCollectionWidget::customContextMenu(), dirPath(), isElement(), localName(), setUpData(), and setUpIcon().

◆ isElement()

bool FileElementCollectionItem::isElement ( ) const
overridevirtual

FileElementCollectionItem::isElement.

Returns
true if this item represent an element

Implements ElementCollectionItem.

Definition at line 100 of file fileelementcollectionitem.cpp.

References isDir().

Referenced by ElementsCollectionModel::dropMimeData(), and localName().

◆ localName()

QString FileElementCollectionItem::localName ( )
overridevirtual

◆ name()

QString FileElementCollectionItem::name ( ) const
overridevirtual

FileElementCollectionItem::name.

Returns
The collection name of this item

Implements ElementCollectionItem.

Definition at line 154 of file fileelementcollectionitem.cpp.

References isCollectionRoot(), and m_path.

◆ populate()

void FileElementCollectionItem::populate ( bool  set_data = true,
bool  hide_element = false 
)
private

FileElementCollectionItem::populate Create the childs of this item.

Parameters
set_data: if true, call setUpData for every child of this item

Definition at line 308 of file fileelementcollectionitem.cpp.

References FileElementCollectionItem(), fileSystemPath(), setPathName(), and setUpData().

Referenced by setPathName(), and setRootPath().

◆ setPathName()

void FileElementCollectionItem::setPathName ( const QString &  path_name,
bool  set_data = true,
bool  hide_element = false 
)
private

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.

Parameters
path_name

Definition at line 294 of file fileelementcollectionitem.cpp.

References m_path, and populate().

Referenced by addChildAtPath(), and populate().

◆ setRootPath()

bool FileElementCollectionItem::setRootPath ( const QString &  path,
bool  set_data = true,
bool  hide_element = false 
)

FileElementCollectionItem::setRootPath Set path has root path for this file item. Use this function only to set the beginning of a file collection.

Parameters
path
Returns
true if path exist.

Definition at line 40 of file fileelementcollectionitem.cpp.

References m_path, and populate().

Referenced by ElementsCollectionModel::addCommonCollection(), and ElementsCollectionModel::addCustomCollection().

◆ setUpData()

void FileElementCollectionItem::setUpData ( )
overridevirtual

◆ setUpIcon()

void FileElementCollectionItem::setUpIcon ( )
overridevirtual

FileElementCollectionItem::setUpIcon SetUp the icon of this item. Because icon use several memory, we use this method for setup icon instead setUpData.

Implements ElementCollectionItem.

Definition at line 266 of file fileelementcollectionitem.cpp.

References collectionPath(), QETApp::commonElementsDirN(), QET::Icons::Folder, ElementsLocation::icon(), isCollectionRoot(), isDir(), and m_path.

◆ type()

int FileElementCollectionItem::type ( ) const
inlineoverride

Definition at line 34 of file fileelementcollectionitem.h.

References Type.

Referenced by collectionPath(), dirPath(), and ElementsCollectionModel::dropMimeData().

Member Data Documentation

◆ m_path

QString FileElementCollectionItem::m_path
private

The documentation for this class was generated from the following files: