Tome
A generic data editor for games supporting arbitrary input and output formats.
componentscontroller.h
1 #ifndef COMPONENTSCONTROLLER_H
2 #define COMPONENTSCONTROLLER_H
3 
4 #include <QObject>
5 
6 #include "../Model/component.h"
7 #include "../Model/componentlist.h"
8 #include "../Model/componentsetlist.h"
9 
10 namespace Tome
11 {
15  class ComponentsController : public QObject
16  {
17  Q_OBJECT
18 
19  public:
24 
34  const Component addComponent(const QString& componentName,
35  const QString& componentSetName);
36 
41  void addComponentSet(const ComponentSet& componentSet);
42 
47  const ComponentList getComponents() const;
48 
53  const ComponentSetList& getComponentSets() const;
54 
59  const QStringList getComponentSetNames() const;
60 
69  const QString getSetNameOfComponent(const Component component) const;
70 
79  int indexOf(const Component& component) const;
80 
86  bool removeComponent(const Component component);
87 
93  bool removeComponentSet(const QString& name);
94 
99  void setComponents(ComponentSetList& model);
100 
101  signals:
106  void componentAdded(const Tome::Component& component);
107 
112  void componentRemoved(const Tome::Component& component);
113 
114  private:
115  ComponentSetList* model;
116  };
117 }
118 
119 #endif // COMPONENTSCONTROLLER_H
Definition: commandlineoptions.h:6
Named set of Tome components.
Definition: componentset.h:11
const ComponentSetList & getComponentSets() const
Gets a list of all component sets in the project.
Definition: componentscontroller.cpp:62
bool removeComponent(const Component component)
Removes the specified component from the project.
Definition: componentscontroller.cpp:122
const Component addComponent(const QString &componentName, const QString &componentSetName)
Adds a new component to the specified component set.
Definition: componentscontroller.cpp:14
void setComponents(ComponentSetList &model)
Uses the specified list of component sets as model for this controller.
Definition: componentscontroller.cpp:165
ComponentsController()
Constructs a new controller for adding and removing components.
Definition: componentscontroller.cpp:10
Controller for adding and removing components.
Definition: componentscontroller.h:15
void componentRemoved(const Tome::Component &component)
A component has been removed from the project.
void componentAdded(const Tome::Component &component)
A new component has been added to the project.
int indexOf(const Component &component) const
Gets the index of the specified component within its set.
Definition: componentscontroller.cpp:104
const ComponentList getComponents() const
Gets a list of all components in the project.
Definition: componentscontroller.cpp:45
const QString getSetNameOfComponent(const Component component) const
Gets the name of the component set containing the specified component.
Definition: componentscontroller.cpp:80
bool removeComponentSet(const QString &name)
Removes the component set with the specified name from the project, including all components...
Definition: componentscontroller.cpp:148
void addComponentSet(const ComponentSet &componentSet)
Adds a new component set to the project.
Definition: componentscontroller.cpp:40
const QStringList getComponentSetNames() const
Gets a list of the names of all component sets in the project.
Definition: componentscontroller.cpp:67