Isis 3 Programmer Reference
GuiCameraList.h
1 #ifndef GuiCameraList_H
2 #define GuiCameraList_H
3 
4 #include <QDebug>
5 #include <QList>
6 #include <QMetaType>
7 #include <QObject>
8 
9 #include "GuiCamera.h"
11 //#include "GuiCameraListActionWorkOrder.h" TODO - will we need this?
12 #include "WorkOrder.h"
13 #include "XmlStackedHandler.h"
14 
15 class QStringList;
16 class QXmlStreamWriter;
17 
18 namespace Isis {
19  class FileName;
20  class XmlStackedHandlerReader;
21 
35  class GuiCameraList : public QObject, public QList<GuiCameraQsp> {
36  Q_OBJECT
37 
38  public:
39 // friend class GuiCameraListActionWorkOrder;
40 
41  GuiCameraList(QString name, QString path, QObject *parent = NULL);
42  explicit GuiCameraList(QObject *parent = NULL);
43  explicit GuiCameraList(QList<GuiCameraQsp>, QObject *parent = NULL);
44  explicit GuiCameraList(Project *project,
45  XmlStackedHandlerReader *xmlReader, QObject *parent = NULL);
46 // explicit GuiCameraList(QStringList &);
49 
50  // These are overridden (-ish) in order to add notifications to the list changing
51  void append(GuiCameraQsp const & value);
52  void append(const QList<GuiCameraQsp> &value);
53 
54  void clear();
55 
56  iterator erase(iterator pos);
57  iterator erase(iterator begin, iterator end);
58 
59  void insert(int i, GuiCameraQsp const & value);
60  iterator insert(iterator before, GuiCameraQsp const & value);
61 
62  void prepend(GuiCameraQsp const & value);
63  void push_back(GuiCameraQsp const & value);
64  void push_front(GuiCameraQsp const & value);
65  int removeAll(GuiCameraQsp const & value);
66  void removeAt(int i);
67  void removeFirst();
68  void removeLast();
69  bool removeOne(GuiCameraQsp const & value);
70  void swap(QList<GuiCameraQsp> &other);
71  GuiCameraQsp takeAt(int i);
74 
76  GuiCameraList &operator+=(GuiCameraQsp const &other);
78  GuiCameraList &operator<<(GuiCameraQsp const &other);
80 
81  // This is our own assignment, but it needs to notify just like the operator=(QList)
83 
84  // Done overriding (-ish)
85 
86 
87  QList<QAction *> supportedActions(Project *project = NULL);
88  bool allSupport(GuiCameraDisplayProperties::Property prop);
89 
90  void setName(QString newName);
91  void setPath(QString newPath);
92 
93  QString name() const;
94  QString path() const;
95 
96 // void deleteFromDisk(Project *project);
97  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
98 
99 
100  signals:
105  void countChanged(int newCount);
106 
107  private:
117  class XmlHandler : public XmlStackedHandler {
118  public:
120 
121  virtual bool startElement(const QString &namespaceURI, const QString &localName,
122  const QString &qName, const QXmlAttributes &atts);
123  virtual bool endElement(const QString &namespaceURI, const QString &localName,
124  const QString &qName);
125 
126  private:
127  Q_DISABLE_COPY(XmlHandler);
128 
129  GuiCameraList *m_GuiCameraList;
130  Project *m_project;
131  };
132 
133 
146 // class CopyTargetBodyDataFunctor : public std::unary_function<TargetBodyQsp const &, void *> {
147 // public:
148 // CopyTargetBodyDataFunctor(const Project *project, FileName newProjectRoot);
149 // CopyTargetBodyDataFunctor(const CopyTargetBodyDataFunctor &other);
150 // ~CopyTargetBodyDataFunctor();
151 
152 // void *operator()(TargetBodyQsp const &imageToCopy);
153 
154 // CopyTargetBodyDataFunctor &operator=(const CopyTargetBodyDataFunctor &rhs);
155 
156 // private:
157 // const Project *m_project;
158 // FileName m_newProjectRoot;
159 // };
160 
161  private:
162 // QAction *createWorkOrder(Project *project, GuiCameraListActionWorkOrder::Action action) {
163 // QAction *result = NULL;
164 
165 // if (project) {
166 // result = new GuiCameraListActionWorkOrder(action, project);
167 // ((GuiCameraListActionWorkOrder *)result)->setData(this);
168 // }
169 // else {
170 // result = new QAction(
171 // GuiCameraListActionWorkOrder::qualifyString(GuiCameraListActionWorkOrder::toString(action),
172 // this),
173 // this);
174 // }
175 
176 // return result;
177 // }
178 
179 // void applyAlphas(QStringList alphaValues);
180 // void applyColors(QStringList colorValues, int column = 0);
181 // void applyShowLabel(QStringList showLabelValues);
182 // void applyShowFill(QStringList showFillValues);
183 // void applyShowDNs(QStringList showDNsValues);
184 // void applyShowOutline(QStringList showOutlineValues);
185 // bool askAlpha(int *alphaResult) const;
186 // bool askNewColor(QColor *colorResult) const;
187 // QStringList saveAndApplyAlpha(int newAlpha);
188 // QStringList saveAndApplyColor(QColor newColor);
189 // QStringList saveAndApplyRandomColor();
190 
191  private slots:
192 // void askAndUpdateAlpha();
193 // void askAndUpdateColor();
194 // void showRandomColor();
195 // QStringList saveAndToggleShowDNs();
196 // QStringList saveAndToggleShowFill();
197 // QStringList saveAndToggleShowLabel();
198 // QStringList saveAndToggleShowOutline();
199 
200  private:
201  QString m_name;
202 
213  QString m_path;
214  };
215  // TODO: add QDataStream >> and << ???
216 }
217 
219 
220 #endif
Isis::GuiCameraList::removeOne
bool removeOne(GuiCameraQsp const &value)
Removes the first occurance of a GuiCamera from the list.
Definition: GuiCameraList.cpp:342
Isis::GuiCameraList::XmlHandler::endElement
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
Handle an XML end element.
Definition: GuiCameraList.cpp:934
Isis::GuiCameraList::XmlHandler::XmlHandler
XmlHandler(GuiCameraList *GuiCameraList, Project *project)
Change the visibility of the display name.
Definition: GuiCameraList.cpp:879
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::GuiCameraList::removeAll
int removeAll(GuiCameraQsp const &value)
Removes all occurances of a GuiCamera from the list.
Definition: GuiCameraList.cpp:286
Isis::GuiCameraList::swap
void swap(QList< GuiCameraQsp > &other)
Swaps the list with another GuiCameraList.
Definition: GuiCameraList.cpp:360
Isis::GuiCameraList::erase
iterator erase(iterator pos)
Removes the GuiCamera associated with an iterator.
Definition: GuiCameraList.cpp:176
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::GuiCameraList::setPath
void setPath(QString newPath)
Set the relative path (from the project root) to this gui camera list's folder.
Definition: GuiCameraList.cpp:683
Isis::GuiCameraList::clear
void clear()
Clears the list.
Definition: GuiCameraList.cpp:157
Isis::GuiCameraList::takeAt
GuiCameraQsp takeAt(int i)
Removes and returns the GuiCamera at a specific index.
Definition: GuiCameraList.cpp:378
Isis::GuiCameraDisplayProperties::Property
Property
This is a list of properties and actions that are possible.
Definition: GuiCameraDisplayProperties.h:82
QSharedPointer< GuiCamera >
QStringList
Isis::XmlStackedHandlerReader
Manage a stack of content handlers for reading XML files.
Definition: XmlStackedHandlerReader.h:30
Isis::GuiCameraList::prepend
void prepend(GuiCameraQsp const &value)
Inserts a GuiCamera at the beginning of the list.
Definition: GuiCameraList.cpp:242
Isis::Project
The main project for ipce.
Definition: Project.h:289
Isis::GuiCameraList::push_front
void push_front(GuiCameraQsp const &value)
Inserts a GuiCamera at the front of the list.
Definition: GuiCameraList.cpp:270
Isis::GuiCameraList::takeFirst
GuiCameraQsp takeFirst()
Removes and returns the first GuiCamera in the list.
Definition: GuiCameraList.cpp:392
Isis::GuiCameraList::operator<<
GuiCameraList & operator<<(const QList< GuiCameraQsp > &other)
Appends another GuiVameraList to the list and returns a reference to this.
Definition: GuiCameraList.cpp:458
Isis::GuiCameraList::m_name
QString m_name
This functor is used for copying the GuiCamera objects between two projects quickly.
Definition: GuiCameraList.h:201
Isis::GuiCameraList::operator=
GuiCameraList & operator=(const QList< GuiCameraQsp > &rhs)
Assigns a list of GuiCameras to the list.
Definition: GuiCameraList.cpp:495
Isis::GuiCameraList::GuiCameraList
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).
Definition: GuiCameraList.cpp:52
Isis::GuiCameraList::takeLast
GuiCameraQsp takeLast()
Removes and returns the last GuiCamera in the list.
Definition: GuiCameraList.cpp:406
Isis::GuiCameraList::XmlHandler::startElement
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Handle an XML start element.
Definition: GuiCameraList.cpp:896
Isis::GuiCameraList::path
QString path() const
Get the path to these gui camera objects in the list (relative to project root).
Definition: GuiCameraList.cpp:704
GuiCamera.h
Isis::GuiCameraList::operator+=
GuiCameraList & operator+=(const QList< GuiCameraQsp > &other)
Appends another GuiCameraList to the list and returns a reference to this.
Definition: GuiCameraList.cpp:422
GuiCameraDisplayProperties.h
Isis::GuiCameraList::~GuiCameraList
~GuiCameraList()
Create a gui camera list from a list of gui camera file names.
Definition: GuiCameraList.cpp:122
Isis::GuiCameraList::setName
void setName(QString newName)
Gets a list of pre-connected actions that have to do with display, such as color, alpha,...
Definition: GuiCameraList.cpp:672
Isis::GuiCameraList::removeFirst
void removeFirst()
Removes the first GuiCamera in the list.
Definition: GuiCameraList.cpp:315
Isis::GuiCameraList::removeLast
void removeLast()
Removes the last GuiCamera in the list.
Definition: GuiCameraList.cpp:326
Isis::GuiCameraList::save
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Delete all of the contained GuiCamera objects from disk (see GuiCamera::deleteFromDisk())
Definition: GuiCameraList.cpp:744
Isis::GuiCameraList::removeAt
void removeAt(int i)
Removes the GuiCamera at a specific index.
Definition: GuiCameraList.cpp:304
Isis::XmlStackedHandler
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:118
Isis::GuiCameraList::countChanged
void countChanged(int newCount)
Emitted when the number of GuiCameras in the list changes.
Isis::GuiCameraList::name
QString name() const
Get the human-readable name of this gui cameray list.
Definition: GuiCameraList.cpp:693
Isis::GuiCameraList::push_back
void push_back(GuiCameraQsp const &value)
Inserts a GuiCamera at the end of the list.
Definition: GuiCameraList.cpp:256
Isis::GuiCameraList::XmlHandler
XmlHandler used to save to xml files.
Definition: GuiCameraList.h:117
Isis::GuiCameraList::append
void append(GuiCameraQsp const &value)
Appends a single GuiCamera to the list.
Definition: GuiCameraList.cpp:133
QObject
Isis::GuiCameraList
List of GuiCameras saved as QSharedPointers.
Definition: GuiCameraList.h:35
Isis::GuiCameraList::insert
void insert(int i, GuiCameraQsp const &value)
Inserts a GuiCamera into the list at a given index.
Definition: GuiCameraList.cpp:210
Isis::GuiCameraList::m_path
QString m_path
This stores the directory name that contains the GuiCamera objects in this list.
Definition: GuiCameraList.h:213
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(Isis::PlotWindow *)
We have plot windows as QVariant data types, so here it's enabled.