- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/CmdAction/VerboseAction.cpp
r952f38 r92c52f 26 26 class CommandLineVerboseState : public ActionState { 27 27 public: 28 CommandLineVerboseState(int _verbosity) : 29 verbosity(_verbosity) 28 CommandLineVerboseState(const int _oldverbosity, const int _newverbosity) : 29 oldverbosity(_oldverbosity), 30 newverbosity(_newverbosity) 30 31 {} 31 int verbosity; 32 int oldverbosity; 33 int newverbosity; 32 34 }; 33 35 … … 56 58 57 59 Action::state_ptr CommandLineVerboseAction::performCall() { 58 int verbosity = 2; 60 int oldverbosity = getVerbosity(); 61 int newverbosity = 2; 59 62 60 ValueStorage::getInstance().queryCurrentValue(NAME, verbosity);63 ValueStorage::getInstance().queryCurrentValue(NAME, newverbosity); 61 64 62 setVerbosity(verbosity); 63 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl); 64 return Action::success; 65 if (oldverbosity != newverbosity) { 66 CommandLineVerboseState *UndoState = new CommandLineVerboseState(oldverbosity, newverbosity); 67 setVerbosity(newverbosity); 68 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << oldverbosity << " to " << newverbosity << "." << endl); 69 return Action::state_ptr(UndoState); 70 } else { 71 DoLog(0) && (Log() << Verbose(0) << "Verbosity remains unchanged at " << oldverbosity << "." << endl); 72 return Action::failure; 73 } 65 74 } 66 75 … … 68 77 CommandLineVerboseState *state = assert_cast<CommandLineVerboseState*>(_state.get()); 69 78 70 int verbosity = 2;71 ValueStorage::getInstance().queryCurrentValue(NAME,verbosity);79 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << state->newverbosity << " to " << state->oldverbosity << "." << endl); 80 setVerbosity(state->oldverbosity); 72 81 73 setVerbosity(state->verbosity); 74 return Action::state_ptr(new CommandLineVerboseState(verbosity)); 82 return Action::state_ptr(_state); 75 83 } 76 84 77 85 Action::state_ptr CommandLineVerboseAction::performRedo(Action::state_ptr _state){ 78 performUndo(_state); 86 CommandLineVerboseState *state = assert_cast<CommandLineVerboseState*>(_state.get()); 87 88 DoLog(0) && (Log() << Verbose(0) << "Setting verbosity from " << state->oldverbosity << " to " << state->newverbosity << "." << endl); 89 setVerbosity(state->newverbosity); 90 91 return Action::state_ptr(_state); 79 92 } 80 93
Note:
See TracChangeset
for help on using the changeset viewer.