Isis Developer Reference
ControlList.h
Go to the documentation of this file.
1#ifndef ControlList_H
2#define ControlList_H
3
10/* SPDX-License-Identifier: CC0-1.0 */
11
12#include <QDebug>
13#include <QList>
14#include <QMetaType>
15#include <QObject>
16
17#include "Control.h"
19
20class QStringList;
21class QXmlStreamWriter;
22
23namespace Isis {
24 class FileName;
25
42 class ControlList : public QObject, public QList<Control *> {
43 Q_OBJECT
44
45 public:
46
47 ControlList(QString name, QString path, QObject *parent = NULL);
48 explicit ControlList(QObject *parent = NULL);
49 explicit ControlList(QList<Control *>, QObject *parent = NULL);
50 explicit ControlList(QStringList &);
51 ControlList(const ControlList &);
53
54 // These are overridden (-ish) in order to add notifications to the list changing
55 void append(Control * const &value);
56 void append(const QList<Control *> &value);
57
58 void clear();
59
60 iterator erase(iterator pos);
61 iterator erase(iterator begin, iterator end);
62
63 void insert(int i, Control * const &value);
64 iterator insert(iterator before, Control * const &value);
65
66 void prepend(Control * const &value);
67 void push_back(Control * const &value);
68 void push_front(Control * const &value);
69 int removeAll(Control * const &value);
70 void removeAt(int i);
71 void removeFirst();
72 void removeLast();
73 bool removeOne(Control * const &value);
74 void swap(QList<Control *> &other);
75 Control *takeAt(int i);
78
79 ControlList &operator+=(const QList<Control *> &other);
80 ControlList &operator+=(Control * const &other);
81 ControlList &operator<<(const QList<Control *> &other);
82 ControlList &operator<<(Control * const &other);
83 ControlList &operator=(const QList<Control *> &rhs);
84
85 // This is our own assignment, but it needs to notify just like the operator=(QList)
87
88 // Done overriding (-ish)
89
90
91 QList<QAction *> supportedActions(Project *project = NULL);
93
94 void setName(QString newName);
95 void setPath(QString newPath);
96
97 QString name() const;
98 QString path() const;
99
100 void deleteFromDisk(Project *project);
101 void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
102
103
104 signals:
105 void countChanged(int newCount);
107
108 private:
109
110
122 class CopyControlDataFunctor : public std::function<void *(Control * const &)> {
123 public:
124 CopyControlDataFunctor(const Project *project, FileName newProjectRoot);
125 CopyControlDataFunctor(const CopyControlDataFunctor &other);
126 ~CopyControlDataFunctor();
127
128 void *operator()(Control * const &controlToCopy);
129
130 CopyControlDataFunctor &operator=(const CopyControlDataFunctor &rhs);
131
132 private:
133 const Project *m_project;
134 FileName m_newProjectRoot;
135 };
136
137 private:
138 QString m_name;
139
150 QString m_path;
151 };
152}
153
155
156#endif
Q_DECLARE_METATYPE(Isis::ControlList *)
Property
This is a list of properties and actions that are possible.
Definition ControlDisplayProperties.h:63
This represents an ISIS control net in a project-based GUI interface.
Definition Control.h:65
Maintains a list of Controls so that control nets can easily be copied from one Project to another,...
Definition ControlList.h:42
void deleteFromDisk(Project *project)
Delete all of the contained Controls from disk.
Definition ControlList.cpp:547
void removeLast()
Removes the last control pointer from the control list.
Definition ControlList.cpp:294
iterator erase(iterator pos)
Erases a control pointer from the control list at the specified position.
Definition ControlList.cpp:148
void append(Control *const &value)
Appends a control pointer to the control list.
Definition ControlList.cpp:106
~ControlList()
Destructor.
Definition ControlList.cpp:94
void push_back(Control *const &value)
Equivalent to append(value)
Definition ControlList.cpp:225
ControlList & operator+=(const QList< Control * > &other)
Appends control pointers from the other list to this control list.
Definition ControlList.cpp:389
void insert(int i, Control *const &value)
Inserts a control pointer at the specified position in the control list.
Definition ControlList.cpp:180
QString path() const
Get the path to these controls in the control list (relative to project root).
Definition ControlList.cpp:535
QString name() const
Get the human-readable name of this control list.
Definition ControlList.cpp:524
void countChanged(int newCount)
void setName(QString newName)
Set the human-readable name of this control list.
Definition ControlList.cpp:503
void removeAt(int i)
Removes the control pointer at the specified index.
Definition ControlList.cpp:272
void deletingList(ControlList *list)
bool removeOne(Control *const &value)
Removes the first occurence of the control pointer from the control list.
Definition ControlList.cpp:309
void push_front(Control *const &value)
Equivalent to prepend(value)
Definition ControlList.cpp:239
Control * takeAt(int i)
Remove the control pointer at the specified index and returns it.
Definition ControlList.cpp:345
Control * takeFirst()
Removes the first control pointer from the control list and returns it.
Definition ControlList.cpp:359
ControlList & operator=(const QList< Control * > &rhs)
Assigns another list of control pointers to this control list.
Definition ControlList.cpp:461
int removeAll(Control *const &value)
Removes all occurences of the control pointer in the control list.
Definition ControlList.cpp:254
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Convert this control list into XML format for saving/restoring capabilities.
Definition ControlList.cpp:584
void setPath(QString newPath)
Set the relative path (from the project root) to this control list's folder.
Definition ControlList.cpp:514
void prepend(Control *const &value)
Prepends a control pointer to the control list.
Definition ControlList.cpp:211
bool allSupport(ControlDisplayProperties::Property prop)
ControlList & operator<<(const QList< Control * > &other)
Appends a list of other control pointers to this control list.
Definition ControlList.cpp:425
void swap(QList< Control * > &other)
Swaps this control list's control pointers with the other list of control pointers.
Definition ControlList.cpp:327
void clear()
Clears the control list.
Definition ControlList.cpp:130
Control * takeLast()
Removes the last control pointer from the control list and returns it.
Definition ControlList.cpp:373
void removeFirst()
Removes the first control pointer from the control list.
Definition ControlList.cpp:283
ControlList(QString name, QString path, QObject *parent=NULL)
Create an control list from a control list name and path (does not read Controls).
Definition ControlList.cpp:36
QList< QAction * > supportedActions(Project *project=NULL)
File name manipulation and expansion.
Definition FileName.h:100
The main project for ipce.
Definition Project.h:287
This is free and unencumbered software released into the public domain.
Definition BoxcarCachingAlgorithm.h:13
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16