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

#include <templatescollection.h>

Public Member Functions

 TitleBlockTemplatesProjectCollection (QETProject *, QObject *parent=nullptr)
 
 ~TitleBlockTemplatesProjectCollection () override
 
QString title () const override
 
QString protocol () const override
 
QETProjectparentProject () override
 
QStringList templates () override
 
TitleBlockTemplategetTemplate (const QString &) override
 
QDomElement getTemplateXmlDescription (const QString &) override
 
bool setTemplateXmlDescription (const QString &, const QDomElement &) override
 
void removeTemplate (const QString &) override
 
TitleBlockTemplateLocation location (const QString &=QString()) override
 
bool hasFilePath () override
 
QString filePath () override
 
bool isReadOnly (const QString &=QString()) const override
 
virtual void fromXml (const QDomElement &)
 
virtual void deleteUnusedTitleBlocKTemplates ()
 
- Public Member Functions inherited from TitleBlockTemplatesCollection
 TitleBlockTemplatesCollection (QObject *parent)
 
 ~TitleBlockTemplatesCollection () override
 
virtual void setTitle (const QString &)
 
virtual void setProtocol (const QString &)
 
virtual QET::QetCollection collection () const
 TitleBlockTemplatesCollection::collection. More...
 
virtual void setCollection (QET::QetCollection)
 TitleBlockTemplatesCollection::setCollection Set the storage of this collection. More...
 
virtual QList< TitleBlockTemplateLocationtemplatesLocations ()
 

Private Member Functions

 TitleBlockTemplatesProjectCollection (const TitleBlockTemplatesProjectCollection &)
 

Private Attributes

QETProjectproject_
 Parent project. More...
 
QDomDocument xml_document_
 Parent QDomDocument for stored QDomElements. More...
 
QHash< QString, QDomElement > titleblock_templates_xml_
 XML descriptions of embedded titleblock templates. More...
 

Additional Inherited Members

- Signals inherited from TitleBlockTemplatesCollection
void changed (TitleBlockTemplatesCollection *, const QString &=QString())
 
void aboutToRemove (TitleBlockTemplatesCollection *, const QString &)
 
- Protected Attributes inherited from TitleBlockTemplatesCollection
QString title_
 Human-readable title for this collection. More...
 
QString protocol_
 Protocol used to designate this collection. More...
 
QET::QetCollection m_collection
 
QHash< QString, TitleBlockTemplate * > titleblock_templates_
 Already parsed embedded titleblock templates. More...
 

Detailed Description

This class represents a simple abastraction layer for a collection of title block templates embedded within a project.

Definition at line 83 of file templatescollection.h.

Constructor & Destructor Documentation

◆ TitleBlockTemplatesProjectCollection() [1/2]

TitleBlockTemplatesProjectCollection::TitleBlockTemplatesProjectCollection ( QETProject project,
QObject *  parent = nullptr 
)

Constructor

Parameters
projectParent project
parentParent QObject

Definition at line 112 of file templatescollection.cpp.

References QET::Embedded, and TitleBlockTemplatesCollection::m_collection.

◆ ~TitleBlockTemplatesProjectCollection()

TitleBlockTemplatesProjectCollection::~TitleBlockTemplatesProjectCollection ( )
override

Destructor

Definition at line 122 of file templatescollection.cpp.

◆ TitleBlockTemplatesProjectCollection() [2/2]

TitleBlockTemplatesProjectCollection::TitleBlockTemplatesProjectCollection ( const TitleBlockTemplatesProjectCollection )
private

Member Function Documentation

◆ deleteUnusedTitleBlocKTemplates()

void TitleBlockTemplatesProjectCollection::deleteUnusedTitleBlocKTemplates ( )
virtual

Delete all title block templates not used within the parent project

Definition at line 340 of file templatescollection.cpp.

References location(), project_, removeTemplate(), and templates().

Referenced by ProjectView::cleanProject().

◆ filePath()

QString TitleBlockTemplatesProjectCollection::filePath ( )
overridevirtual
Returns
always an empty string since a project collection is not stored on any filesystem.

Implements TitleBlockTemplatesCollection.

Definition at line 302 of file templatescollection.cpp.

◆ fromXml()

void TitleBlockTemplatesProjectCollection::fromXml ( const QDomElement &  xml_element)
virtual
Parameters
xml_elementXML element to be parsed to load title block templates

Definition at line 322 of file templatescollection.cpp.

References QET::findInDomElement(), and titleblock_templates_xml_.

Referenced by QETProject::readProjectXml().

◆ getTemplate()

TitleBlockTemplate * TitleBlockTemplatesProjectCollection::getTemplate ( const QString &  template_name)
overridevirtual
Parameters
template_nameName of the requested template
Returns
the requested template, or 0 if there is no valid template of this name within the project

Implements TitleBlockTemplatesCollection.

Definition at line 190 of file templatescollection.cpp.

References TitleBlockTemplatesCollection::titleblock_templates_, titleblock_templates_xml_, and QET::TitleBlockTemplate.

Referenced by QETTitleBlockTemplateEditor::edit(), Diagram::setTitleBlockTemplate(), and Diagram::titleBlockTemplateRemoved().

◆ getTemplateXmlDescription()

QDomElement TitleBlockTemplatesProjectCollection::getTemplateXmlDescription ( const QString &  template_name)
overridevirtual
Parameters
template_nameName of the requested template
Returns
the XML description of the requested template, or a null QDomElement if the project does not have such an titleblock template

Implements TitleBlockTemplatesCollection.

Definition at line 216 of file templatescollection.cpp.

References titleblock_templates_xml_.

Referenced by QETProject::toXml().

◆ hasFilePath()

bool TitleBlockTemplatesProjectCollection::hasFilePath ( )
overridevirtual
Returns
always false since a project collection is not stored on any filesystem.

Implements TitleBlockTemplatesCollection.

Definition at line 294 of file templatescollection.cpp.

◆ isReadOnly()

bool TitleBlockTemplatesProjectCollection::isReadOnly ( const QString &  template_name = QString()) const
overridevirtual
Parameters
template_nameEither an empty QString to know whether the collection itself is read only, or a specific template name.
Returns
true if the specified template is read only, false otherwise

Implements TitleBlockTemplatesCollection.

Definition at line 311 of file templatescollection.cpp.

References project_.

◆ location()

TitleBlockTemplateLocation TitleBlockTemplatesProjectCollection::location ( const QString &  template_name = QString())
overridevirtual
Parameters
template_nameName of the requested template
Returns
the location object for the requested template

Implements TitleBlockTemplatesCollection.

Definition at line 286 of file templatescollection.cpp.

Referenced by deleteUnusedTitleBlocKTemplates().

◆ parentProject()

QETProject * TitleBlockTemplatesProjectCollection::parentProject ( )
overridevirtual
Returns
the parent project of this project collection

Reimplemented from TitleBlockTemplatesCollection.

Definition at line 174 of file templatescollection.cpp.

References project_.

◆ protocol()

QString TitleBlockTemplatesProjectCollection::protocol ( ) const
overridevirtual
Returns
the protocol used to mention this collection

Reimplemented from TitleBlockTemplatesCollection.

Definition at line 160 of file templatescollection.cpp.

References project_, QETApp::projectId(), and TitleBlockTemplatesCollection::protocol().

◆ removeTemplate()

void TitleBlockTemplatesProjectCollection::removeTemplate ( const QString &  template_name)
overridevirtual

This methods allows removing a template embedded within the project. This method emits the signal changed() if necessary.

Parameters
template_nameName of the template to be removed

Implements TitleBlockTemplatesCollection.

Definition at line 271 of file templatescollection.cpp.

References TitleBlockTemplatesCollection::aboutToRemove(), TitleBlockTemplatesCollection::changed(), TitleBlockTemplatesCollection::titleblock_templates_, and titleblock_templates_xml_.

Referenced by deleteUnusedTitleBlocKTemplates().

◆ setTemplateXmlDescription()

bool TitleBlockTemplatesProjectCollection::setTemplateXmlDescription ( const QString &  template_name,
const QDomElement &  xml_elmt 
)
overridevirtual

This methods allows adding or modifying a template embedded within the project. This method emits the signal changed() if necessary.

Parameters
template_nameName / Identifier of the template - will be used to determine whether the given description will be added or will replace an existing one.
xml_elmtAn <titleblocktemplate> XML element describing the template. Its "name" attribute must equal to template_name.
Returns
false if a problem occurred, true otherwise

Implements TitleBlockTemplatesCollection.

Definition at line 234 of file templatescollection.cpp.

References TitleBlockTemplatesCollection::changed(), project_, TitleBlockTemplatesCollection::titleblock_templates_, titleblock_templates_xml_, and xml_document_.

Referenced by QETProject::integrateTitleBlockTemplate().

◆ templates()

QStringList TitleBlockTemplatesProjectCollection::templates ( )
overridevirtual
Returns
the list of title block templates embedded within the project.

Implements TitleBlockTemplatesCollection.

Definition at line 181 of file templatescollection.cpp.

References titleblock_templates_xml_.

Referenced by deleteUnusedTitleBlocKTemplates(), QETProject::integrateTitleBlockTemplate(), QETProject::projectWasModified(), and QETProject::toXml().

◆ title()

QString TitleBlockTemplatesProjectCollection::title ( ) const
overridevirtual
Returns
a human readable title for this collection

Reimplemented from TitleBlockTemplatesCollection.

Definition at line 128 of file templatescollection.cpp.

References project_, QETApp::projectId(), TitleBlockTemplatesCollection::title_, and QET::Icons::tr.

Member Data Documentation

◆ project_

QETProject* TitleBlockTemplatesProjectCollection::project_
private

◆ titleblock_templates_xml_

QHash<QString, QDomElement> TitleBlockTemplatesProjectCollection::titleblock_templates_xml_
private

XML descriptions of embedded titleblock templates.

Definition at line 117 of file templatescollection.h.

Referenced by fromXml(), getTemplate(), getTemplateXmlDescription(), removeTemplate(), setTemplateXmlDescription(), and templates().

◆ xml_document_

QDomDocument TitleBlockTemplatesProjectCollection::xml_document_
private

Parent QDomDocument for stored QDomElements.

Definition at line 115 of file templatescollection.h.

Referenced by setTemplateXmlDescription().


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