QElectroTech  0.70
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
ElementsLocation Class Reference

#include <elementslocation.h>

Public Member Functions

 ElementsLocation ()
 ElementsLocation::ElementsLocation Constructor. More...
 
 ElementsLocation (const QString &path, QETProject *project=nullptr)
 
 ElementsLocation (const ElementsLocation &)
 
 ElementsLocation (const QMimeData *data)
 ElementsLocation::ElementLocation Constructor, build an ElementLocation from a QMimeData, the mime data format must be "application/x-qet-element-uri" or "application/x-qet-category-uri". This location can be null even if format is valid. More...
 
virtual ~ElementsLocation ()
 
ElementsLocationoperator= (const ElementsLocation &)
 
bool operator== (const ElementsLocation &) const
 
bool operator!= (const ElementsLocation &) const
 
QString baseName () const
 ElementsLocation::baseName. More...
 
int projectId () const
 ElementsLocation::projectId This method is used to know if an element belongs to a project or not. More...
 
QString collectionPath (bool protocol=true) const
 
QString projectCollectionPath () const
 ElementsLocation::projectCollectionPath. More...
 
QString fileSystemPath () const
 ElementsLocation::fileSystemPath. More...
 
QString path () const
 ElementsLocation::path. More...
 
void setPath (const QString &path)
 ElementsLocation::setPath Set the path of this item. The path can be relative to a collection (start by common:// , custom:// or embed://) or not. More...
 
bool addToPath (const QString &)
 ElementsLocation::addToPath Add a string to the actual path of this location. More...
 
ElementsLocation parent () const
 
QETProjectproject () const
 
void setProject (QETProject *)
 
bool isNull () const
 
QString toString () const
 
bool isElement () const
 ElementsLocation::isElement. More...
 
bool isDirectory () const
 ElementsLocation::isDirectory. More...
 
bool isFileSystem () const
 ElementsLocation::isFileSystem. More...
 
bool isCommonCollection () const
 ElementsLocation::isCommonCollection. More...
 
bool isCustomCollection () const
 ElementsLocation::isCustomCollection. More...
 
bool isProject () const
 ElementsLocation::isProject. More...
 
bool exist () const
 ElementsLocation::exist. More...
 
bool isWritable () const
 ElementsLocation::isWritable. More...
 
XmlElementCollectionprojectCollection () const
 ElementsLocation::projectCollection. More...
 
NamesList nameList ()
 ElementsLocation::nameList. More...
 
QDomElement xml () const
 ElementsLocation::xml. More...
 
bool setXml (const QDomDocument &xml_document) const
 ElementsLocation::setXml Replace the current xml description by ; The document element of must have tagname "definition" to be written This definition must be writable. More...
 
QUuid uuid () const
 ElementsLocation::uuid. More...
 
QIcon icon () const
 ElementLocation::icon. More...
 
QString name () const
 ElementLocation::name. More...
 
QString fileName () const
 ElementLocation::fileName. More...
 
DiagramContext elementInformations () const
 ElementsLocation::elementInformations. More...
 

Static Public Attributes

static int MetaTypeId = qRegisterMetaType<ElementsLocation>("ElementsLocation")
 Id of the corresponding Qt meta type. More...
 

Private Attributes

QString m_collection_path
 
QString m_file_system_path
 
QETProjectm_project = nullptr
 

Detailed Description

Cette classe represente la localisation, l'emplacement d'un element ou d'une categorie, voire d'une collection... dans une collection. Elle encapsule un chemin virtuel.

Definition at line 34 of file elementslocation.h.

Constructor & Destructor Documentation

◆ ElementsLocation() [1/4]

ElementsLocation::ElementsLocation ( )

ElementsLocation::ElementsLocation Constructor.

Definition at line 35 of file elementslocation.cpp.

◆ ElementsLocation() [2/4]

ElementsLocation::ElementsLocation ( const QString &  path,
QETProject project = nullptr 
)

Constructeur

Parameters
pChemin de l'emplacement de l'element
prProjet de l'emplacement de l'element

Definition at line 43 of file elementslocation.cpp.

References path(), and setPath().

◆ ElementsLocation() [3/4]

ElementsLocation::ElementsLocation ( const ElementsLocation other)

Constructeur de copie

Parameters
otherAutre emplacement d'element a copier

Definition at line 59 of file elementslocation.cpp.

◆ ElementsLocation() [4/4]

ElementsLocation::ElementsLocation ( const QMimeData *  data)

ElementsLocation::ElementLocation Constructor, build an ElementLocation from a QMimeData, the mime data format must be "application/x-qet-element-uri" or "application/x-qet-category-uri". This location can be null even if format is valid.

Parameters
data

Definition at line 72 of file elementslocation.cpp.

References setPath().

◆ ~ElementsLocation()

ElementsLocation::~ElementsLocation ( )
virtual

Destructeur

Definition at line 52 of file elementslocation.cpp.

Member Function Documentation

◆ addToPath()

bool ElementsLocation::addToPath ( const QString &  string)

◆ baseName()

QString ElementsLocation::baseName ( ) const

ElementsLocation::baseName.

Returns
The base name of the element or directory. Unlike ElementsLocation::fileName , this method don't return the extension name. For exemple if this location represent an element they return myElement.
See also
fileName()

Definition at line 120 of file elementslocation.cpp.

References m_collection_path.

Referenced by Element::name().

◆ collectionPath()

QString ElementsLocation::collectionPath ( bool  protocol = true) const

◆ elementInformations()

DiagramContext ElementsLocation::elementInformations ( ) const

ElementsLocation::elementInformations.

Returns
the element information of the element represented by this location. If the location is a directory, the returned diagram context is empty

Definition at line 689 of file elementslocation.cpp.

References DiagramContext::fromXml(), isDirectory(), and xml().

Referenced by XmlProjectElementCollectionItem::setUpData(), and FileElementCollectionItem::setUpData().

◆ exist()

bool ElementsLocation::exist ( ) const

◆ fileName()

QString ElementsLocation::fileName ( ) const

ElementLocation::fileName.

Returns
Return the file name of the represented item, whatever the storage system (file system, xml collection) with is file extension. For example if this location represent an element, they return myElement.elmt. For a directory return myDirectory.
See also
baseName

Definition at line 675 of file elementslocation.cpp.

References m_collection_path.

Referenced by ECHSFileToFile::copy(), ECHSXmlToFile::copy(), ECHSToXml::copy(), ECHSXmlToFile::copyDirectory(), XmlElementCollection::copyDirectory(), ECHSFileToFile::copyElement(), XmlElementCollection::copyElement(), ECHSXmlToFile::copyElement(), autonum::elementPrefixForLocation(), QETProject::importElement(), ElementCollectionHandler::importFromProject(), and name().

◆ fileSystemPath()

QString ElementsLocation::fileSystemPath ( ) const

◆ icon()

QIcon ElementsLocation::icon ( ) const

ElementLocation::icon.

Returns
The icon of the represented element. If icon can't be set, return a null QIcon

Definition at line 640 of file elementslocation.cpp.

References QETApp::collectionCache(), ElementsCollectionCache::fetchElement(), ElementPictureFactory::instance(), m_project, and ElementsCollectionCache::pixmap().

Referenced by XmlProjectElementCollectionItem::setUpIcon(), and FileElementCollectionItem::setUpIcon().

◆ isCommonCollection()

bool ElementsLocation::isCommonCollection ( ) const

ElementsLocation::isCommonCollection.

Returns
True if this location represent an item from the common collection

Definition at line 405 of file elementslocation.cpp.

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

Referenced by ElementsCollectionModel::indexFromLocation().

◆ isCustomCollection()

bool ElementsLocation::isCustomCollection ( ) const

ElementsLocation::isCustomCollection.

Returns
True if this location represent an item from the custom collection

Definition at line 414 of file elementslocation.cpp.

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

Referenced by ElementsCollectionModel::addLocation(), and ElementsCollectionModel::indexFromLocation().

◆ isDirectory()

bool ElementsLocation::isDirectory ( ) const

◆ isElement()

bool ElementsLocation::isElement ( ) const

◆ isFileSystem()

bool ElementsLocation::isFileSystem ( ) const

◆ isNull()

bool ElementsLocation::isNull ( ) const

◆ isProject()

bool ElementsLocation::isProject ( ) const

◆ isWritable()

bool ElementsLocation::isWritable ( ) const

◆ name()

QString ElementsLocation::name ( ) const

ElementLocation::name.

Returns
The name of the represented element in the current local

Definition at line 660 of file elementslocation.cpp.

References fileName(), QET::Icons::nl, and xml().

Referenced by XmlProjectElementCollectionItem::localName(), and FileElementCollectionItem::localName().

◆ nameList()

NamesList ElementsLocation::nameList ( )

◆ operator!=()

bool ElementsLocation::operator!= ( const ElementsLocation other) const

Operateur de comparaison

Parameters
otherAutre emplacement d'element a comparer
Returns
true si other et cet ElementsLocation sont differents, false sinon

Definition at line 106 of file elementslocation.cpp.

References m_collection_path, and m_project.

◆ operator=()

ElementsLocation & ElementsLocation::operator= ( const ElementsLocation other)

Operateur d'affectation

Parameters
otherAutre emplacement d'element a affecter

Definition at line 82 of file elementslocation.cpp.

References m_collection_path, m_file_system_path, and m_project.

◆ operator==()

bool ElementsLocation::operator== ( const ElementsLocation other) const

Operateur de comparaison

Parameters
otherAutre emplacement d'element a comparer
Returns
true si other et cet ElementsLocation sont identiques, false sinon

Definition at line 94 of file elementslocation.cpp.

References m_collection_path, and m_project.

◆ parent()

ElementsLocation ElementsLocation::parent ( ) const
Returns
the location of the parent category, or a copy of this location when it represents a root category.

Definition at line 324 of file elementslocation.cpp.

References m_collection_path, and setPath().

Referenced by autonum::elementPrefixForLocation(), QETProject::importElement(), and ElementCollectionHandler::importFromProject().

◆ path()

QString ElementsLocation::path ( ) const

ElementsLocation::path.

Returns
The path of this location. OBSOLETE, use instead collectionPath(true)

Definition at line 188 of file elementslocation.cpp.

References m_collection_path.

Referenced by collectionPath(), ElementsLocation(), Diagram::fromXml(), setPath(), and Element::toXml().

◆ project()

QETProject * ElementsLocation::project ( ) const
Returns
le projet de cet emplacement ou 0 si celui-ci n'est pas lie a un projet.

Definition at line 340 of file elementslocation.cpp.

References m_project.

Referenced by XmlElementCollection::addElement(), ElementsCollectionModel::addLocation(), QETApp::elementEditors(), QETProject::importElement(), setPath(), setProject(), and setXml().

◆ projectCollection()

XmlElementCollection * ElementsLocation::projectCollection ( ) const

ElementsLocation::projectCollection.

Returns
If this location represente a item in an embedded project collection, return this collection else return nullptr.

Definition at line 480 of file elementslocation.cpp.

References QETProject::embeddedElementCollection(), and m_project.

Referenced by XmlElementCollection::addElement(), XmlElementCollection::copy(), ECHSToXml::copy(), ECHSXmlToFile::copyDirectory(), XmlElementCollection::copyDirectory(), and ElementCollectionHandler::createDir().

◆ projectCollectionPath()

QString ElementsLocation::projectCollectionPath ( ) const

◆ projectId()

int ElementsLocation::projectId ( ) const

ElementsLocation::projectId This method is used to know if an element belongs to a project or not.

Returns
Element Project Id

Definition at line 134 of file elementslocation.cpp.

References m_project, and QETApp::projectId().

◆ setPath()

void ElementsLocation::setPath ( const QString &  path)

ElementsLocation::setPath Set the path of this item. The path can be relative to a collection (start by common:// , custom:// or embed://) or not.

Parameters
path

Definition at line 198 of file elementslocation.cpp.

References QETApp::commonElementsDirN(), QETApp::customElementsDirN(), m_collection_path, m_file_system_path, m_project, path(), project(), and QETApp::project().

Referenced by XmlElementCollection::copyDirectory(), ElementsLocation(), and parent().

◆ setProject()

void ElementsLocation::setProject ( QETProject project)
Parameters
projectle nouveau projet pointe par cet emplacement Indiquer 0 pour que cet emplacement ne soit plus lie a un projet.

Definition at line 348 of file elementslocation.cpp.

References m_project, and project().

◆ setXml()

bool ElementsLocation::setXml ( const QDomDocument &  xml_document) const

ElementsLocation::setXml Replace the current xml description by ; The document element of must have tagname "definition" to be written This definition must be writable.

Parameters
xml_element
Returns
true if success

Definition at line 565 of file elementslocation.cpp.

References XmlElementCollection::addElementDefinition(), collectionPath(), QETProject::embeddedElementCollection(), exist(), fileSystemPath(), isFileSystem(), isProject(), isWritable(), project(), QETXML::writeXmlFile(), and xml().

Referenced by QETElementEditor::toLocation().

◆ toString()

QString ElementsLocation::toString ( ) const

◆ uuid()

QUuid ElementsLocation::uuid ( ) const

◆ xml()

QDomElement ElementsLocation::xml ( ) const

Member Data Documentation

◆ m_collection_path

QString ElementsLocation::m_collection_path
private

◆ m_file_system_path

QString ElementsLocation::m_file_system_path
private

Definition at line 85 of file elementslocation.h.

Referenced by addToPath(), fileSystemPath(), isFileSystem(), operator=(), setPath(), and xml().

◆ m_project

QETProject* ElementsLocation::m_project = nullptr
private

◆ MetaTypeId

int ElementsLocation::MetaTypeId = qRegisterMetaType<ElementsLocation>("ElementsLocation")
static

Id of the corresponding Qt meta type.

Definition at line 89 of file elementslocation.h.


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