1 /*! 2 @file 3 @author Albert Semenov 4 @date 07/2012 5 */ 6 #ifndef _897c30fe_12de_4067_91d0_a2a336a18f83_ 7 #define _897c30fe_12de_4067_91d0_a2a336a18f83_ 8 9 #include <list> 10 #include "Action.h" 11 #include "sigslot.h" 12 13 namespace tools 14 { 15 class ActionManager 16 { 17 public: 18 ActionManager(); 19 ~ActionManager(); 20 21 static ActionManager& getInstance(); 22 static ActionManager* getInstancePtr(); 23 24 void initialise(); 25 void shutdown(); 26 27 void doAction(Action* _command); 28 29 void undoAction(); 30 void redoAction(); 31 32 void resetChanges(); 33 bool getChanges(); 34 35 void setMaxActions(size_t _value); 36 size_t getMaxActions() const; 37 38 void reset(); 39 40 sigslot::signal0<> eventChanges; 41 42 private: 43 void clear(); 44 45 bool updateMaxActions(); 46 void removeRedo(); 47 48 void onChangeActions(); 49 50 private: 51 static ActionManager* mInstance; 52 typedef std::list<Action*> ListAction; 53 ListAction mActions; 54 ListAction::iterator mCurrentAction; 55 ListAction::iterator mActionAsSave; 56 size_t mMaxActions; 57 }; 58 } 59 60 #endif 61