Isis 3 Programmer Reference
Isis::TemplateList Class Reference

#include <TemplateList.h>

Inheritance diagram for Isis::TemplateList:
Inheritance graph
Collaboration diagram for Isis::TemplateList:
Collaboration graph

Classes

class  XmlHandler
 

Public Member Functions

 TemplateList (QString name, QString type, QString path, QObject *parent=NULL)
 Create a template from a file name, type, and path.
 
 TemplateList (QObject *parent=NULL)
 Creates a blank template list.
 
 TemplateList (Project *project, XmlStackedHandlerReader *xmlReader, QObject *parent=NULL)
 Create an TemplateList from XML.
 
 TemplateList (const TemplateList &)
 Copy constructor.
 
 ~TemplateList ()
 Destructor.
 
QString name () const
 Get the human-readable name of this TemplateList.
 
QString type () const
 Get the type of template in this TemplateList.
 
QString path () const
 Get the path to these Templates in the TemplateList (relative to project root).
 
void setName (QString newName)
 Set the human-readable name of this TemplateList.
 
void setType (QString newType)
 Set the type of template for of this TemplateList.
 
void setPath (QString newPath)
 Set the relative path (from the project root) to this TemplateList's folder.
 
void deleteFromDisk (Project *project)
 Delete all of the contained Templates from disk.
 
void save (QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
 Convert this TemplateList into XML format for saving/restoring capabilities.
 

Private Attributes

QString m_path
 
QString m_name
 
QString m_type
 

Detailed Description

Author
2017-11-01 Christopher Combs
History

2017-11-01 Christopher Combs - Maintains a list of Templates so that templates can easily be copied from one Project to another, saved to disk, or deleted from disk. Adapted from ControlList.

2018-07-07 Summer Stapleton - Fixed a few errors in how the xmlhandling was occuring and added additional handling of separating map templates from registration templates to reflect chagnes in Project.cpp.

Definition at line 35 of file TemplateList.h.

Constructor & Destructor Documentation

◆ TemplateList() [1/4]

Isis::TemplateList::TemplateList ( QString name,
QString type,
QString path,
QObject * parent = NULL )

Create a template from a file name, type, and path.

Parameters
nameThe TemplateList's name (i.e. import1, import2, ...)
typeThe TemplateList's folder name (i.e. maps, registrations, ...)
pathPath to the TemplateList's folder from the template root
parentThe Qt-relationship parent

Definition at line 26 of file TemplateList.cpp.

References name(), path(), and type().

◆ TemplateList() [2/4]

Isis::TemplateList::TemplateList ( QObject * parent = NULL)
explicit

Creates a blank template list.

Parameters
parentThe Qt-relationship parent.

Definition at line 38 of file TemplateList.cpp.

◆ TemplateList() [3/4]

Isis::TemplateList::TemplateList ( Project * project,
XmlStackedHandlerReader * xmlReader,
QObject * parent = NULL )
explicit

Create an TemplateList from XML.

Parameters
projectThe project with the TemplateList
xmlReaderThe XML reader currently at an <templateList > tag.
parentThe Qt-relationship parent

Definition at line 62 of file TemplateList.cpp.

◆ TemplateList() [4/4]

Isis::TemplateList::TemplateList ( const TemplateList & other)

Copy constructor.

Parameters
otherThe TemplateList to copy

Definition at line 47 of file TemplateList.cpp.

◆ ~TemplateList()

Isis::TemplateList::~TemplateList ( )

Destructor.

Definition at line 71 of file TemplateList.cpp.

Member Function Documentation

◆ deleteFromDisk()

void Isis::TemplateList::deleteFromDisk ( Project * project)

Delete all of the contained Templates from disk.

Parameters
projectProject to delete templates from
See also
Template::deleteFromDisk()

Definition at line 143 of file TemplateList.cpp.

References Isis::Project::templateRoot().

Referenced by Isis::ImportMapTemplateWorkOrder::undoExecution(), and Isis::ImportRegistrationTemplateWorkOrder::undoExecution().

◆ name()

QString Isis::TemplateList::name ( ) const

Get the human-readable name of this TemplateList.

Returns
QString The name of the TemplateList.

Definition at line 81 of file TemplateList.cpp.

Referenced by Isis::ProjectItem::setTemplateList(), Isis::TemplateList::XmlHandler::startElement(), and TemplateList().

◆ path()

QString Isis::TemplateList::path ( ) const

Get the path to these Templates in the TemplateList (relative to project root).

Returns
QString The path to the Templates in the TemplateList.

Definition at line 101 of file TemplateList.cpp.

Referenced by Isis::ProjectItem::setTemplateList(), Isis::TemplateList::XmlHandler::startElement(), and TemplateList().

◆ save()

void Isis::TemplateList::save ( QXmlStreamWriter & stream,
const Project * project,
FileName newProjectRoot ) const

Convert this TemplateList into XML format for saving/restoring capabilities.

This writes:

  <templateList name="..." type= "..." path="...">

to the given xml stream, and creates an 'templates.xml' inside the folder with the templates. Inside the templates.xml, this writes:

  <templates>
    ...
  </templates>
Parameters
streamXML stream that contains the TemplateList data
projectProject to save TemplateList from
newProjectRootFilename root to save TemplateList to
Exceptions
IException::Io"Unable Failed to create directory"
IException::Io"Unable to save template information, could not be opened for writing"

Definition at line 180 of file TemplateList.cpp.

References Isis::FileName::dir(), Isis::IException::Io, Isis::FileName::name(), Isis::FileName::original(), Isis::FileName::path(), Isis::Project::templateRoot(), and Isis::FileName::toString().

◆ setName()

void Isis::TemplateList::setName ( QString newName)

Set the human-readable name of this TemplateList.

Parameters
newNameThe name to give this TemplateList

Definition at line 111 of file TemplateList.cpp.

◆ setPath()

void Isis::TemplateList::setPath ( QString newPath)

Set the relative path (from the project root) to this TemplateList's folder.

Parameters
newPathThe path to the templates in this TemplateList

Definition at line 131 of file TemplateList.cpp.

◆ setType()

void Isis::TemplateList::setType ( QString newType)

Set the type of template for of this TemplateList.

Parameters
newTypeThe type to give this TemplateList

Definition at line 121 of file TemplateList.cpp.

◆ type()

QString Isis::TemplateList::type ( ) const

Get the type of template in this TemplateList.

Returns
QString The type of template found in this TemplateList.

Definition at line 91 of file TemplateList.cpp.

Referenced by Isis::Project::addTemplates(), Isis::ControlPointEditWidget::addTemplates(), Isis::ProjectItemModel::onTemplatesAdded(), Isis::TemplateList::XmlHandler::startElement(), and TemplateList().

Member Data Documentation

◆ m_name

QString Isis::TemplateList::m_name
private

Definition at line 59 of file TemplateList.h.

◆ m_path

QString Isis::TemplateList::m_path
private

Definition at line 58 of file TemplateList.h.

◆ m_type

QString Isis::TemplateList::m_type
private

Definition at line 60 of file TemplateList.h.


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