23 #include "GuiCameraList.h"
30 #include <QInputDialog>
32 #include <QProgressDialog>
33 #include <QtConcurrentMap>
34 #include <QXmlStreamWriter>
41 #include "XmlStackedHandlerReader.h"
87 xmlReader->pushContentHandler(
new XmlHandler(
this, project));
158 bool countChanging = count();
363 if (count() != other.count()) {
458 GuiCameraList &GuiCameraList::operator<<(const QList<GuiCameraQsp> &other) {
462 emit countChanged(count());
496 bool countChanging = (rhs.count() != count());
515 bool countChanging = (rhs.count() != count());
897 const QString &qName,
const QXmlAttributes &atts) {
898 if (XmlStackedHandler::startElement(namespaceURI, localName, qName, atts)) {
899 if (localName ==
"GuiCameraList") {
900 QString
name = atts.value(
"name");
901 QString
path = atts.value(
"path");
903 if (!name.isEmpty()) {
904 m_GuiCameraList->setName(name);
907 if (!path.isEmpty()) {
908 m_GuiCameraList->setPath(path);
911 else if (localName ==
"target") {
935 const QString &qName) {
936 if (localName ==
"GuiCameraList") {
937 XmlHandler handler(m_GuiCameraList, m_project);
940 reader.pushContentHandler(&handler);
941 reader.setErrorHandler(&handler);
943 QString GuiCameraListXmlPath = m_project->targetBodyRoot() +
"/" + m_GuiCameraList->path() +
945 QFile file(GuiCameraListXmlPath);
947 if (!file.open(QFile::ReadOnly)) {
949 QString(
"Unable to open [%1] with read access")
950 .arg(GuiCameraListXmlPath),
954 QXmlInputSource xmlInputSource(&file);
955 if (!reader.parse(xmlInputSource))
957 tr(
"Failed to open target body list XML [%1]").arg(GuiCameraListXmlPath),
961 return XmlStackedHandler::endElement(namespaceURI, localName, qName);
void push_front(GuiCameraQsp const &value)
Inserts a GuiCamera at the front of the list.
int removeAll(GuiCameraQsp const &value)
Removes all occurances of a GuiCamera from the list.
~GuiCameraList()
Create a gui camera list from a list of gui camera file names.
The main project for cnetsuite.
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle an XML end element.
File name manipulation and expansion.
iterator erase(iterator pos)
Removes the GuiCamera associated with an iterator.
GuiCameraList & operator=(const QList< GuiCameraQsp > &rhs)
Assigns a list of GuiCameras to the list.
XmlHandler(GuiCameraList *GuiCameraList, Project *project)
Change the visibility of the display name.
void swap(QList< GuiCameraQsp > &other)
Swaps the list with another GuiCameraList.
GuiCameraQsp takeAt(int i)
Removes and returns the GuiCamera at a specific index.
QString path() const
Get the path to these gui camera objects in the list (relative to project root).
void removeFirst()
Removes the first GuiCamera in the list.
A type of error that occurred when performing an actual I/O operation.
QString m_path
This stores the directory name that contains the GuiCamera objects in this list.
QDebug operator<<(QDebug dbg, const Isis::Angle &angleToPrint)
Display an Angle for a debugging statement.
void prepend(GuiCameraQsp const &value)
Inserts a GuiCamera at the beginning of the list.
void clear()
Clears the list.
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Delete all of the contained GuiCamera objects from disk (see GuiCamera::deleteFromDisk()) ...
void push_back(GuiCameraQsp const &value)
Inserts a GuiCamera at the end of the list.
void insert(int i, GuiCameraQsp const &value)
Inserts a GuiCamera into the list at a given index.
XmlHandler used to save to xml files.
GuiCameraQsp takeFirst()
Removes and returns the first GuiCamera in the list.
bool removeOne(GuiCameraQsp const &value)
Removes the first occurance of a GuiCamera from the list.
void removeAt(int i)
Removes the GuiCamera at a specific index.
void setPath(QString newPath)
Set the relative path (from the project root) to this gui camera list's folder.
#define _FILEINFO_
Macro for the filename and line number.
QString m_name
This functor is used for copying the GuiCamera objects between two projects quickly.
GuiCameraList & operator+=(const QList< GuiCameraQsp > &other)
Appends another GuiCameraList to the list and returns a reference to this.
GuiCameraList(QString name, QString path, QObject *parent=NULL)
Create an gui camera list from a gui camera list name and path (does not read GuiCamera objects)...
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
List of GuiCameras saved as QSharedPointers.
QSharedPointer< GuiCamera > GuiCameraQsp
GuiCameraQsp Represents a smart pointer to a GuiCamera object.
void countChanged(int newCount)
Emitted when the number of GuiCameras in the list changes.
void removeLast()
Removes the last GuiCamera in the list.
void append(GuiCameraQsp const &value)
Appends a single GuiCamera to the list.
GuiCameraQsp takeLast()
Removes and returns the last GuiCamera in the list.
GuiCameraList & operator<<(const QList< GuiCameraQsp > &other)
Appends another GuiVameraList to the list and returns a reference to this.
QString name() const
Get the human-readable name of this gui cameray list.
void setName(QString newName)
Gets a list of pre-connected actions that have to do with display, such as color, alpha...
his enables stack-based XML parsing of XML files.