Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYActionManager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
28 #ifndef __TY_ACTION_MANAGER__
29 #define __TY_ACTION_MANAGER__
30 
31 #include <qobject.h>
32 #include <qlist.h>
33 #include "TYAction.h"
34 
39 class TYActionManager : public QObject
40 {
41  Q_OBJECT
42 
43 public:
48  TYActionManager(int size);
53  virtual ~TYActionManager();
54 
59  void setModified(bool modified);
64  bool getModified() const
65  {
66  return _modified;
67  }
68 
73  void addAction(TYAction* pAction);
74 
79  void emitUndoRedo();
80 
86  {
87  return _size;
88  }
89 
90 public slots:
95  void undo();
96 
101  void redo();
102 
107  void setHistorySize(int size);
108 
113  void reset();
114 
115 signals:
121  void undoRedoChanged(bool undoAvailable, bool redoAvailable, const QString& undoCmd,
122  const QString& redoCmd);
127  void modificationChanged(bool modified);
128 
129 protected:
131  QList<TYAction*> _history;
132 
134  int _current;
135 
137  int _savedAt;
138 
140  int _size;
141 
143  bool _modified;
144 };
145 
146 #endif // __TY_ACTION_MANAGER__
Definit une action, necessaire pour la gestion de l'undo (fichier header)
Gere les undos.
void reset()
Reinitialise l'historique.
void setModified(bool modified)
Set/Get de l'etat du manager.
void redo()
Effectue a nouveau la derniere action annulee.
bool _modified
Indique l'etat du manager.
int _size
Nombre maximum d'actions pour l'historique.
void modificationChanged(bool modified)
Indique si un undo ou un redo a ete fait.
int _savedAt
Index de l'action a laquelle une sauvegarde a ete effectuee.
void addAction(TYAction *pAction)
Ajoute une nouvelle action a l'historique.
void undo()
Annule la derniere action.
virtual ~TYActionManager()
Destructeur.
void emitUndoRedo()
Envoie un signal informant sur l'etat de ce ActionManager.
TYActionManager(int size)
Constructeur.
int getHistorySize()
Retourne la taille de l'historique.
void setHistorySize(int size)
Definit la taille de l'historique.
QList< TYAction * > _history
L'historique des actions.
void undoRedoChanged(bool undoAvailable, bool redoAvailable, const QString &undoCmd, const QString &redoCmd)
Indique l'etat de ce ActionManager.
int _current
Index de l'action courante.
bool getModified() const
Set/Get de l'etat du manager.
Definit une action, necessaire pour la gestion de l'undo.
Definition: TYAction.h:37