Changes in / [a61dbb:d8821e]


Ignore:
Location:
src
Files:
5 added
83 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Action.cpp

    ra61dbb rd8821e  
    177177}
    178178
     179void Action::pushStatus(const std::string& _msg)
     180{
     181  ActionQueue::getInstance().pushStatus(_msg);
     182}
     183
  • src/Actions/Action.hpp

    ra61dbb rd8821e  
    2424 */
    2525#define NOPARAM_DEFAULT BOOST_PP_NIL
     26
     27/** Nicely visible short-hand for push a status message
     28 *
     29 */
     30#ifndef STATUS
     31#define STATUS(msg) pushStatus(msg)
     32#endif
    2633
    2734// forward declaration
     
    270277  static void insertAction(Action *_action, enum Action::QueryOptions state);
    271278
     279  /** Proxy function to grant all derived Actions access to
     280   * ActionQueue::pushStatus().
     281   *
     282   * \param _msg status message to push
     283   */
     284  void pushStatus(const std::string& _msg);
     285
    272286private:
    273287
  • src/Actions/ActionQueue.cpp

    ra61dbb rd8821e  
    162162      try {
    163163        actionqueue[CurrentAction]->call();
     164        pushStatus("SUCCESS: Action "+actionqueue[CurrentAction]->getName()+" successful.");
    164165        lastActionOk = true;
    165166      } catch(ActionFailureException &e) {
    166         std::cerr << "Action " << *boost::get_error_info<ActionNameString>(e) << " has failed." << std::endl;
     167        pushStatus("FAIL: Action "+*boost::get_error_info<ActionNameString>(e)+" has failed.");
    167168        World::getInstance().setExitFlag(5);
    168169        actionqueue.clear();
  • src/Actions/ActionQueue.hpp

    ra61dbb rd8821e  
    2424#include "Actions/Action.hpp"
    2525#include "Actions/ActionState.hpp"
     26#include "Actions/ActionStatusList.hpp"
    2627
    2728#ifdef HAVE_ACTION_THREAD
     
    134135#endif
    135136
     137  /** Getter to ref to list of status messages.
     138   *
     139   * This is meant for UIs to registers as Observables.
     140   *
     141   * \return ref to StatusList variable
     142   */
     143  ActionStatusList& getStatusList()
     144  { return StatusList; }
     145
    136146private:
    137147  //!> grant Action access to internal history functions.
     
    145155  void addElement(Action* _Action, ActionState::ptr _state);
    146156
     157  /** Advocate function to add status message to the list.
     158   *
     159   */
     160  void pushStatus(const std::string &_msg)
     161  { StatusList.pushMessage(_msg); }
     162
    147163  /** Wrapper function to clear ActionHistory.
    148164   *
     
    231247  boost::mutex mtx_idle;
    232248#endif
     249
     250  //!> internal list of status messages from Actions for UIs to display
     251  ActionStatusList StatusList;
    233252};
    234253
  • src/Actions/AnalysisAction/DipoleAngularCorrelationAction.cpp

    ra61dbb rd8821e  
    8383  std::vector<atom *> atoms = World::getInstance().getSelectedAtoms();
    8484  if (atoms.empty()) {
    85     ELOG(2, "Formula "+toString(DipoleFormula)+" selects no atoms.");
     85    STATUS("Formula "+toString(DipoleFormula)+" selects no atoms.");
    8686    return Action::failure;
    8787  }
     
    139139
    140140  // exit
     141  STATUS("Dipole angular correlation calculation successful.");
    141142  return Action::success;
    142143}
  • src/Actions/AnalysisAction/DipoleCorrelationAction.cpp

    ra61dbb rd8821e  
    6767  DipoleCorrelationMap *correlationmap = NULL;
    6868  std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
    69   LOG(0, "STATUS: There are " << molecules.size() << " selected molecules.");
     69  STATUS("There are "+toString(molecules.size())+" selected molecules.");
    7070  ASSERT(!params.periodic.get(), "AnalysisDipoleCorrelationAction() - periodic case not implemented.");
    7171  correlationmap = DipoleCorrelation(molecules);
  • src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp

    ra61dbb rd8821e  
    8484  }
    8585  if ( atoms.size() == 0) {
    86     ELOG(1, "You have not select any atoms.");
     86    STATUS("You have not select any atoms.");
    8787    return Action::failure;
    8888  }
  • src/Actions/AtomAction/AddAction.cpp

    ra61dbb rd8821e  
    9393  }
    9494  if (first->getId() != state->id)
    95     if (!first->changeId(state->id))
     95    if (!first->changeId(state->id)) {
     96      STATUS("Could not change atom id "+toString(first->getId())+"->"+toString(state->id)+".");
    9697      return Action::failure;
     98    }
     99
    97100  return ActionState::ptr(_state);
    98101}
  • src/Actions/AtomAction/RemoveAction.cpp

    ra61dbb rd8821e  
    8181  if (AddAtomsFromAtomicInfo(state->Walkers))
    8282    return ActionState::ptr(_state);
    83   else
     83  else {
     84    STATUS("Failed to re-add removed atoms.");
    8485    return Action::failure;
     86  }
    8587}
    8688
  • src/Actions/AtomAction/RotateAroundOriginByAngleAction.cpp

    ra61dbb rd8821e  
    5959
    6060  // check whether Axis is valid
    61   if (params.Axis.get().IsZero())
     61  if (params.Axis.get().IsZero()) {
     62    STATUS("Specified Rotation axis is zero.");
    6263    return Action::failure;
     64  }
    6365
    6466  // convert from degrees to radian
  • src/Actions/AtomAction/SaveSelectedAtomsAction.cpp

    ra61dbb rd8821e  
    6363      FilenamePrefix = params.filename.get().stem().string();
    6464  } else {
    65     ELOG(1, "Output file does not have a suffix, cannot recognize format.");
     65    STATUS("Output file "+params.filename.get().string()+"does not have a suffix, cannot recognize format.");
    6666    return Action::failure;
    6767  }
     
    7474    FormatParserStorage::getInstance().saveSelectedAtoms(output, FilenameSuffix);
    7575  } else {
    76     ELOG(1, "Could not open file " << params.filename.get() << ".");
     76    STATUS("Could not open file "+params.filename.get().string()+".");
     77    return Action::failure;
    7778  }
    7879  output.close();
     
    8485//  ParserSaveXyzState *state = assert_cast<ParserSaveXyzState*>(_state.get());
    8586
    86   return Action::failure;
     87  return Action::success;
    8788//  string newName = state->mol->getName();
    8889//  state->mol->setName(state->lastName);
     
    9293
    9394ActionState::ptr AtomSaveSelectedAtomsAction::performRedo(ActionState::ptr _state){
    94   return Action::failure;
     95  return Action::success;
    9596//  // Undo and redo have to do the same for this action
    9697//  return performUndo(_state);
  • src/Actions/BondAction/BondAddAction.cpp

    ra61dbb rd8821e  
    5858  // check preconditions
    5959  if (World::getInstance().countSelectedAtoms() != 2) {
    60     ELOG(1, "Exactly two atoms must be selected for BondAction Add.");
     60    STATUS("Exactly two atoms must be selected for BondAction Add.");
    6161    return Action::failure;
    6262  }
    6363  const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms();
    6464  if (selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1])) {
    65     ELOG(2, "There already is a bond in between the two selected atoms.");
     65    STATUS("There already is a bond in between the two selected atoms.");
    6666    return Action::failure;
    6767  }
  • src/Actions/BondAction/BondRemoveAction.cpp

    ra61dbb rd8821e  
    5858  // check preconditions
    5959  if (World::getInstance().countSelectedAtoms() != 2) {
    60     ELOG(1, "Exactly two atoms must be selected for BondAction Remove.");
     60    STATUS("Exactly two atoms must be selected for BondAction Remove.");
    6161    return Action::failure;
    6262  }
    6363  const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms();
    6464  if (!selected_atoms[0]->IsBondedTo(WorldTime::getTime(), selected_atoms[1])) {
    65     ELOG(2, "There is no bond in between the two selected atoms.");
     65    STATUS("There is no bond in between the two selected atoms.");
    6666    return Action::failure;
    6767  }
  • src/Actions/CommandAction/BondLengthTableAction.cpp

    ra61dbb rd8821e  
    7676    std::ifstream input(params.BondGraphFileName.get().string().c_str());
    7777    if ((input.good()) && (BG->LoadBondLengthTable(input))) {
    78       LOG(0, "Bond length table parsed successfully.");
     78      LOG(1, "Bond length table parsed successfully.");
    7979      input.close();
    8080      return ActionState::ptr(UndoState);
    8181    } else {
    82       ELOG(1, "Bond length table parsing failed.");
     82      STATUS("Bond length table "+params.BondGraphFileName.get().string()
     83          +" parsing failed.");
    8384      input.close();
    8485    }
    8586  } else {
    86     ELOG(1, "Bond length table loading failed.");
     87    STATUS("Bond length table "+params.BondGraphFileName.get().string()
     88        +" loading failed.");
    8789  }
    8890  // recover bond graph
  • src/Actions/CommandAction/ElementDbAction.cpp

    ra61dbb rd8821e  
    8181  periode->CleanupPeriodtable();
    8282  if (periode->LoadPeriodentafel(configuration->databasepath)) {
    83     LOG(0, "Element list loaded successfully.");
     83    STATUS("Element list loaded successfully.");
    8484    //periode->Output();
    8585    return ActionState::ptr(UndoState);
    8686  } else {
    87     LOG(0, "Element list loading failed.");
     87    STATUS("Element list loading failed.");
    8888    delete UndoState;
    8989    return Action::failure;
     
    118118  periode->CleanupPeriodtable();
    119119  if (periode->LoadPeriodentafel(configuration->databasepath)) {
    120     LOG(0, "Element list loaded successfully.");
     120    STATUS("Redoing Element list loaded successfully.");
    121121    //periode->Output();
    122122    return ActionState::ptr(_state);
    123123  } else {
    124     LOG(0, "Element list loading failed.");
     124    STATUS("Redoing Element list loading failed.");
    125125    return Action::failure;
    126126  }
  • src/Actions/CommandAction/HelpAction.cpp

    ra61dbb rd8821e  
    9898      std::cout << std::endl;
    9999    } else {
    100       ELOG(1, "No action is known by the name " << params.actionname.get() << ".");
     100      STATUS("No action is known by the name "+params.actionname.get()+".");
    101101      return Action::failure;
    102102    }
  • src/Actions/CommandAction/LoadSessionAction.cpp

    ra61dbb rd8821e  
    6060  if (executePythonScript(params.filename.get().string()))
    6161    return Action::success;
    62   else
     62  else {
     63    STATUS("Failed executing python script.");
    6364    return Action::failure;
     65  }
    6466#else
    65   ELOG(1, "Python capabilities have not been compiled in.");
     67  STATUS("Python capabilities have not been compiled in.");
    6668  return Action::failure;
    6769#endif
  • src/Actions/CommandAction/VersionAction.cpp

    ra61dbb rd8821e  
    4949/** =========== define the function ====================== */
    5050ActionState::ptr CommandVersionAction::performCall() {
    51   LOG(1, "STATUS: Version of the program is " << MOLECUILDERVERSION << ".");
     51  STATUS("Version of the program is "+toString(MOLECUILDERVERSION)+".");
    5252  return Action::success;
    5353}
  • src/Actions/FillAction/FillRegularGridAction.cpp

    ra61dbb rd8821e  
    8484  const std::vector< molecule *> molecules = World::getInstance().getSelectedMolecules();
    8585  if (molecules.size() != 1) {
    86     ELOG(1, "No exactly one molecule selected, aborting,");
     86    STATUS("No exactly one molecule selected, aborting,");
    8787    return Action::failure;
    8888  }
     
    9999  if (params.SphereRadius.get() != 0.) {
    100100    if ( atoms.size() == 0) {
    101       ELOG(1, "You have given a sphere radius " << params.SphereRadius.get()
    102           << " != 0, but have not select any atoms.");
     101      STATUS("You have given a sphere radius "+toString(params.SphereRadius.get())
     102          +" != 0, but have not select any atoms.");
    103103      return Action::failure;
    104104    }
     
    168168
    169169      if (!successflag) {
    170         ELOG(1, "Insertion failed, removing inserted clusters, translating original one back");
     170        STATUS("Insertion failed, removing inserted clusters, translating original one back");
    171171        RemoveAtomsFromAtomicInfo(clonedatominfos);
    172172        clonedatoms.clear();
     
    191191  if (successflag)
    192192    return ActionState::ptr(UndoState);
    193   else
     193  else {
    194194    return Action::failure;
     195  }
    195196}
    196197
     
    220221  if (statusflag)
    221222    return ActionState::ptr(_state);
    222   else
     223  else {
     224    STATUS("Failed re-adding filled in atoms.");
    223225    return Action::failure;
     226  }
    224227}
    225228
  • src/Actions/FillAction/FillSurfaceAction.cpp

    ra61dbb rd8821e  
    7272  std::vector<AtomicInfo> movedatoms;
    7373  if (molecules.size() != 1) {
    74     ELOG(1, "No exactly one molecule selected, aborting,");
     74    STATUS("No exactly one molecule selected, aborting,");
    7575    return Action::failure;
    7676  }
     
    112112    std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes();
    113113    if (selectedShapes.size() != 1){
    114       ELOG(1, "FillSurfaceAction::performCall(): there has to be exactly 1 selected shape.");
     114      STATUS("There has to be exactly 1 selected shape.");
    115115      return Action::failure;
    116116    }
     
    150150
    151151      if (!successflag) {
    152         ELOG(1, "Insertion failed, removing inserted clusters, translating original one back");
     152        STATUS("Insertion failed, removing inserted clusters, translating original one back");
    153153        RemoveAtomsFromAtomicInfo(clonedatominfos);
    154154        clonedatoms.clear();
     
    198198  if (statusflag)
    199199    return ActionState::ptr(_state);
    200   else
     200  else {
     201    STATUS("Failed to re-added filled in atoms.");
    201202    return Action::failure;
     203  }
    202204}
    203205
  • src/Actions/FragmentationAction/AnalyseFragmentationResultsAction.cpp

    ra61dbb rd8821e  
    537537
    538538  if (keysets.KeySets.empty()) {
    539     ELOG(2, "There are no results in the container.");
     539    STATUS("There are no results in the container.");
    540540    return Action::failure;
    541541  }
     
    625625  if (DoLongrange) {
    626626    if ( World::getInstance().getAllAtoms().size() == 0) {
    627       ELOG(1, "Please load the full molecule intostd::map<JobId_t, VMGData> longrangeData the world before starting this action.");
     627      STATUS("Please load the full molecule intostd::map<JobId_t, VMGData> longrangeData the world before starting this action.");
    628628      return Action::failure;
    629629    }
  • src/Actions/FragmentationAction/ClearFragmentationResultsAction.cpp

    ra61dbb rd8821e  
    5656    LOG(1, "STATUS: Fragmentation results cleared.");
    5757    return Action::success;
    58   } else
     58  } else {
     59    STATUS("Failed to clear fragmentation results.");
    5960    return Action::failure;
     61  }
    6062}
    6163
  • src/Actions/FragmentationAction/FragmentationAction.cpp

    ra61dbb rd8821e  
    8787  // check for selected atoms
    8888  if (world.beginAtomSelection() == world.endAtomSelection()) {
    89     ELOG(1, "There are no atoms selected for fragmentation.");
     89    STATUS("There are no atoms selected for fragmentation.");
    9090    return Action::failure;
    9191  }
  • src/Actions/FragmentationAction/FragmentationAutomationAction.cpp

    ra61dbb rd8821e  
    193193  if (params.DoLongrange.get()) {
    194194  if ( World::getInstance().getAllAtoms().size() == 0) {
    195     ELOG(1, "Please load the full molecule into the world before starting this action.");
     195    STATUS("Please load the full molecule into the world before starting this action.");
    196196    return Action::failure;
    197197  }
     
    237237        params.DoValenceOnly.get() ? MPQCData::DoSampleValenceOnly : MPQCData::DontSampleValenceOnly,
    238238        params.DoPrintDebug.get(),
    239         OpenBoundaryConditions))
     239        OpenBoundaryConditions)) {
     240      STATUS("Could not create long-range jobs for electronic charge distribution.");
    240241      return Action::failure;
     242    }
    241243
    242244    // Phase Six a: calculate result
     
    263265          params.DoValenceOnly.get() ? MPQCData::DoSampleValenceOnly : MPQCData::DontSampleValenceOnly,
    264266          params.DoPrintDebug.get(),
    265           OpenBoundaryConditions))
     267          OpenBoundaryConditions)) {
     268        STATUS("Could not create long-range jobs for nuclei charge distribution.");
    266269        return Action::failure;
     270      }
    267271
    268272      // Phase Six b: calculate result
     
    296300        debugcontroller.setPort(params.port.get());
    297301        debugcontroller.requestIds(full_sample.size());
    298         if (!debugcontroller.createDebugJobs(full_sample, OpenBoundaryConditions))
     302        if (!debugcontroller.createDebugJobs(full_sample, OpenBoundaryConditions)) {
     303          STATUS("Could not create debug jobs.");
    299304          return Action::failure;
     305        }
    300306        debugcontroller.waitforResults(full_sample.size());
    301307        debugcontroller.getResults(debugData);
     
    327333  }
    328334
     335  if (Exitflag != 0)
     336    STATUS("Controller has returned failure.");
    329337  return (Exitflag == 0) ? Action::success : Action::failure;
    330338}
  • src/Actions/FragmentationAction/ParseFragmentJobsAction.cpp

    ra61dbb rd8821e  
    5353  // check for present jobs
    5454  if (params.jobfiles.get().empty()) {
    55     ELOG(2, "Given vector of jobfiles is empty!");
     55    STATUS("Given vector of jobfiles is empty!");
    5656    return Action::failure;
    5757  }
     
    6060  if(!FragmentJobQueue::getInstance().addJobsFromFiles(
    6161      params.jobfiles.get(),
    62       params.level.get()))
     62      params.level.get())) {
     63    STATUS("Could not parse all given jobs files.");
    6364    return Action::failure;
     65  }
    6466  size_t FragmentCounter = FragmentJobQueue::getInstance().size();
    6567  LOG(1, "STATUS: I parsed " << FragmentCounter << " fragment files.");
  • src/Actions/FragmentationAction/StoreSaturatedFragmentAction.cpp

    ra61dbb rd8821e  
    6060  // check for selected atoms
    6161  if (world.beginAtomSelection() == world.endAtomSelection()) {
    62     ELOG(1, "There are not atoms selected for storing.");
     62    STATUS("There are not atoms selected for storing.");
    6363    return Action::failure;
    6464  }
  • src/Actions/GraphAction/DestroyAdjacencyAction.cpp

    ra61dbb rd8821e  
    7272  World::AtomComposite Set = World::getInstance().getAllAtoms(AtomsBySelection());
    7373  if (Set.empty()) {
    74     ELOG(2, "No atoms selected.");
     74    STATUS("No atoms selected.");
    7575    return Action::failure;
    7676  }
  • src/Actions/GraphAction/UpdateMoleculesAction.cpp

    ra61dbb rd8821e  
    9292  if (World::getInstance().numMolecules() == 0) {
    9393    //World::getInstance().destroyMolecule(mol);
    94     ELOG(1, "There are no molecules.");
     94    STATUS("There are no molecules.");
    9595    return Action::failure;
    9696  }
  • src/Actions/Makefile.am

    ra61dbb rd8821e  
    88  Actions/ActionRegistry.cpp \
    99  Actions/ActionSequence.cpp \
     10  Actions/ActionStatusList.cpp \
    1011  Actions/ActionTrait.cpp \
    1112  Actions/ErrorAction.cpp \
     
    3334  Actions/ActionSequence.hpp \
    3435  Actions/ActionState.hpp \
     36  Actions/ActionStatusList.hpp \
    3537  Actions/ActionTrait.hpp \
    3638  Actions/ActionTraits.hpp \
  • src/Actions/MoleculeAction/BondFileAction.cpp

    ra61dbb rd8821e  
    6767    mol->getBondCount();
    6868    return Action::success;
    69   } else
     69  } else {
     70    STATUS("There is not exactly one molecule selected.");
    7071    return Action::failure;
     72  }
    7173}
    7274
     
    7779//  state->mol->setName(state->lastName);
    7880
     81  STATUS("Undo for MoleculeBondFileAction not implemented.");
    7982  return Action::failure;
    8083}
    8184
    8285ActionState::ptr MoleculeBondFileAction::performRedo(ActionState::ptr _state){
     86  STATUS("Redo for MoleculeBondFileAction not implemented.");
    8387  return Action::failure;
    8488}
  • src/Actions/MoleculeAction/ChangeBondAngleAction.cpp

    ra61dbb rd8821e  
    120120  const std::vector< atom *> atoms = World::getInstance().getSelectedAtoms();
    121121  if (atoms.size() != 3) {
    122     ELOG(1, "Exactly three atoms must be selected.");
     122    STATUS("Exactly three atoms must be selected.");
    123123    return Action::failure;
    124124  }
    125125  // check precondition: linearly bonded atoms
    126126  const std::vector<size_t> indices = sortIndicesFromCentralAtom(atoms);
    127   if (indices.size() != 3)
     127  if (indices.size() != 3) {
     128    STATUS("Selected atoms must be linearly bonded/form a chain");
    128129    return Action::failure;
     130  }
    129131  const molecule *mol = atoms[0]->getMolecule();
    130132  if ((mol != atoms[1]->getMolecule()) || (mol != atoms[2]->getMolecule())) {
    131     ELOG(1, "The two selected atoms must belong to the same molecule.");
     133    STATUS("The two selected atoms must belong to the same molecule.");
    132134    return Action::failure;
    133135  }
  • src/Actions/MoleculeAction/ChangeNameAction.cpp

    ra61dbb rd8821e  
    5757    mol->setName(params.name.get());
    5858    return ActionState::ptr(new MoleculeChangeNameState(mol,params));
    59   } else
     59  } else {
     60    STATUS("There must be exactly one molecule selected.");
    6061    return Action::failure;
     62  }
    6163}
    6264
  • src/Actions/MoleculeAction/FillVoidWithMoleculeAction.cpp

    ra61dbb rd8821e  
    6262ActionState::ptr MoleculeFillVoidWithMoleculeAction::performCall() {
    6363  if (!boost::filesystem::exists(params.fillername.get())) {
    64     ELOG(1, "File with filler molecule " << params.fillername.get() << " does not exist!");
     64    STATUS("File with filler molecule "+params.fillername.get().string()+" does not exist!");
    6565    return Action::failure;
    6666  }
     
    152152  //MoleculeFillVoidWithMoleculeState *state = assert_cast<MoleculeFillVoidWithMoleculeState*>(_state.get());
    153153
     154  STATUS("Redo for MoleculeFillVoidWithMoleculeAction not implemented.");
    154155  return Action::failure;
    155156  //return ActionState::ptr(_state);
  • src/Actions/MoleculeAction/FillWithMoleculeAction.cpp

    ra61dbb rd8821e  
    156156  //MoleculeFillWithMoleculeState *state = assert_cast<MoleculeFillWithMoleculeState*>(_state.get());
    157157
     158  STATUS("Redo of MoleculeFillWithMoleculeAction not implemented.");
    158159  return Action::failure;
    159160  //return ActionState::ptr(_state);
  • src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp

    ra61dbb rd8821e  
    7474//  state->mol->setName(state->lastName);
    7575
     76  STATUS("Undo of MoleculeLinearInterpolationofTrajectoriesAction not implemented.");
    7677  return Action::failure;
    7778}
  • src/Actions/MoleculeAction/LoadAction.cpp

    ra61dbb rd8821e  
    6060  // parsing file if present
    6161  if (!boost::filesystem::exists(params.filename.get())) {
    62     LOG(1, "Specified input file " << params.filename.get() << " not found.");
     62    STATUS("Specified input file "+params.filename.get().string()+" not found.");
    6363    return Action::failure;
    6464  } else {
     
    7373      FilenamePrefix = params.filename.get().stem().string();
    7474    } else {
    75       ELOG(1, "Input file does not have a suffix, cannot recognize format.");
     75      STATUS("Input file does not have a suffix, cannot recognize format.");
    7676      return Action::failure;
    7777    }
  • src/Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp

    ra61dbb rd8821e  
    5757  // check whether a molecule is selected
    5858  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
    59   if (selectedMolecules.size() == 0)
     59  if (selectedMolecules.size() == 0) {
     60    STATUS("There are need to be some molecules selected.");
    6061    return Action::failure;
     62  }
    6163
    6264  // go through all selected molecules
    6365  BOOST_FOREACH(molecule *mol, selectedMolecules) {
    6466    // check whether Axis is valid
    65     if (params.Axis.get().IsZero())
     67    if (params.Axis.get().IsZero()) {
     68      STATUS("Rotation Axis must not be zero.");
    6669      return Action::failure;
     70    }
    6771
    6872    // convert from degrees to radian
  • src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp

    ra61dbb rd8821e  
    7878//  state->mol->setName(state->lastName);
    7979
     80  STATUS("Undo of MoleculeRotateToPrincipalAxisSystemAction not implemented.");
    8081  return Action::failure;
    8182}
    8283
    8384ActionState::ptr MoleculeRotateToPrincipalAxisSystemAction::performRedo(ActionState::ptr _state){
     85  STATUS("Redo of MoleculeRotateToPrincipalAxisSystemAction not implemented.");
    8486  return Action::failure;
    8587}
  • src/Actions/MoleculeAction/SaveAdjacencyAction.cpp

    ra61dbb rd8821e  
    8282//  state->mol->setName(state->lastName);
    8383
     84  STATUS("Undo of MoleculeSaveAdjacencyAction not implemented.");
    8485  return Action::failure;
    8586}
  • src/Actions/MoleculeAction/SaveBondsAction.cpp

    ra61dbb rd8821e  
    7070//  state->mol->setName(state->lastName);
    7171
     72  STATUS("Undo of MoleculeSaveBondsAction not implemented.");
    7273  return Action::failure;
    7374}
  • src/Actions/MoleculeAction/SaveSelectedMoleculesAction.cpp

    ra61dbb rd8821e  
    6363      FilenamePrefix = params.filename.get().stem().string();
    6464  } else {
    65     ELOG(1, "Output file does not have a suffix, cannot recognize format.");
     65    STATUS("Output file does not have a suffix, cannot recognize format.");
    6666    return Action::failure;
    6767  }
     
    7474    FormatParserStorage::getInstance().saveSelectedMolecules(output, FilenameSuffix);
    7575  } else {
    76     ELOG(1, "Could not open file " << params.filename.get() << ".");
     76    STATUS("Could not open file "+params.filename.get().string()+".");
    7777  }
    7878  output.close();
     
    8484//  ParserSaveXyzState *state = assert_cast<ParserSaveXyzState*>(_state.get());
    8585
    86   return Action::failure;
     86  return Action::success;
    8787//  string newName = state->mol->getName();
    8888//  state->mol->setName(state->lastName);
     
    9292
    9393ActionState::ptr MoleculeSaveSelectedMoleculesAction::performRedo(ActionState::ptr _state){
    94   return Action::failure;
     94  return Action::success;
    9595//  // Undo and redo have to do the same for this action
    9696//  return performUndo(_state);
  • src/Actions/MoleculeAction/SaveTemperatureAction.cpp

    ra61dbb rd8821e  
    6363  const size_t MDSteps = set.getMaxTrajectorySize();
    6464  OutputTemperature<std::vector<atom *> > writer(set);
    65   if (output.fail() || !writer((ofstream * const) &output, 0, MDSteps))
    66     LOG(2, "File could not be written.");
    67   else
     65  if (output.fail() || !writer((ofstream * const) &output, 0, MDSteps)) {
     66    STATUS("File could not be written.");
     67    return Action::failure;
     68  } else
    6869    LOG(2, "File stored.");
    6970  output.close();
     
    7778//  state->mol->setName(state->lastName);
    7879
    79   return Action::failure;
     80  return Action::success;
    8081}
    8182
  • src/Actions/MoleculeAction/StretchBondAction.cpp

    ra61dbb rd8821e  
    5858  const std::vector< atom *> atoms = World::getInstance().getSelectedAtoms();
    5959  if (atoms.size() != 2) {
    60     ELOG(1, "Exactly two atoms must be selected.");
     60    STATUS("Exactly two atoms must be selected.");
    6161    return Action::failure;
    6262  }
    6363  const molecule *mol = atoms[0]->getMolecule();
    6464  if (mol != atoms[1]->getMolecule()) {
    65     ELOG(1, "The two selected atoms must belong to the same molecule.");
     65    STATUS("The two selected atoms must belong to the same molecule.");
    6666    return Action::failure;
    6767  }
  • src/Actions/MoleculeAction/SuspendInWaterAction.cpp

    ra61dbb rd8821e  
    7474//  state->mol->setName(state->lastName);
    7575
     76  STATUS("Undo of MoleculeSuspendInWaterAction not implemented.");
    7677  return Action::failure;
    7778}
  • src/Actions/MoleculeAction/VerletIntegrationAction.cpp

    ra61dbb rd8821e  
    8989//  state->mol->setName(state->lastName);
    9090
     91  STATUS("Undo of MoleculeVerletIntegrationAction not implemented.");
    9192  return Action::failure;
    9293}
    9394
    9495ActionState::ptr MoleculeVerletIntegrationAction::performRedo(ActionState::ptr _state){
     96  STATUS("Rddo of MoleculeVerletIntegrationAction not implemented.");
    9597  return Action::failure;
    9698}
  • src/Actions/ParserAction/ParseTremoloPotentialsAction.cpp

    ra61dbb rd8821e  
    5858  // parsing file if present
    5959  if (!boost::filesystem::exists(params.filename.get())) {
    60     LOG(1, "Specified potentials file " << params.filename.get() << " not found.");
     60    STATUS("Specified potentials file "+params.filename.get().string()+" not found.");
    6161    // DONT FAIL: it's just empty we re-create default id-mapping
    6262    parser.createKnownTypesByIdentity();
    63 
     63    return Action::failure;
    6464  } else {
    6565    LOG(1, "Specified potentials file found, parsing ... ");
     
    7777//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
    7878
     79  STATUS("Undo of ParserParseTremoloPotentialsAction not implemented.");
    7980  return Action::failure;
    8081//  string newName = state->mol->getName();
     
    8586
    8687ActionState::ptr ParserParseTremoloPotentialsAction::performRedo(ActionState::ptr _state){
     88  STATUS("Redo of ParserParseTremoloPotentialsAction not implemented.");
    8789  return Action::failure;
    8890}
  • src/Actions/ParserAction/SaveSelectedAtomsAsExtTypesAction.cpp

    ra61dbb rd8821e  
    5656ActionState::ptr ParserSaveSelectedAtomsAsExtTypesAction::performCall() {
    5757  if (boost::filesystem::exists(params.filename.get())) {
    58     ELOG(1, "Specified exttypes file " << params.filename.get() << " already exists.");
     58    STATUS("Specified exttypes file "+params.filename.get().string()+" already exists.");
    5959
    6060    return Action::failure;
     
    7070    if (status)
    7171      return Action::success;
    72     else
     72    else {
     73      STATUS("Failed to write ext file.");
    7374      return Action::failure;
     75    }
    7476  }
    7577}
  • src/Actions/ParserAction/SetOutputFormatsAction.cpp

    ra61dbb rd8821e  
    5656  for (vector<std::string>::const_iterator iter = params.FormatList.get().begin(); iter != params.FormatList.get().end(); ++iter) {
    5757    if (!FormatParserStorage::getInstance().add(*iter)) {
    58       ELOG(1, "Unknown parser format in ParserSetOutputFormatsAction: '" << *iter << "'");
     58      STATUS("Unknown parser format in ParserSetOutputFormatsAction: '"+*iter+"'");
    5959      return Action::failure;
    6060    } else {
     
    6868//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
    6969
     70  STATUS("Undo of ParserSetOutputFormatsAction not implemented.");
    7071  return Action::failure;
    7172//  string newName = state->mol->getName();
     
    7677
    7778ActionState::ptr ParserSetOutputFormatsAction::performRedo(ActionState::ptr _state){
     79  STATUS("Redo of ParserSetOutputFormatsAction not implemented.");
    7880  return Action::failure;
    7981}
  • src/Actions/PotentialAction/FitParticleChargesAction.cpp

    ra61dbb rd8821e  
    126126  // for the moment just use the very first fragment
    127127  if (range.first == range.second) {
    128     ELOG(1, "HomologyContainer does not contain specified fragment.");
     128    STATUS("HomologyContainer does not contain specified fragment.");
    129129    return Action::failure;
    130130  }
     
    132132  // average partial charges over all fragments
    133133  HomologyContainer::const_iterator iter = range.first;
     134  if (!iter->second.containsGrids) {
     135    STATUS("This HomologyGraph does not contain sampled grids.");
     136    return Action::failure;
     137  }
    134138  PartialNucleiChargeFitter::charges_t averaged_charges;
    135139  averaged_charges.resize(iter->second.fragment.getCharges().size(), 0.);
  • src/Actions/PotentialAction/FitPotentialAction.cpp

    ra61dbb rd8821e  
    137137      } catch (SerializablePotentialMissingValueException &e) {
    138138        if (const std::string *key = boost::get_error_info<SerializablePotentialKey>(e))
    139           ELOG(1, "Missing value when parsing information for potential "
    140               << *key << ".");
     139          STATUS("Missing value when parsing information for potential "+*key+".");
    141140        else
    142           ELOG(1, "Missing value parsing information for potential with unknown key.");
     141          STATUS("Missing value parsing information for potential with unknown key.");
    143142        return Action::failure;
    144143      } catch (SerializablePotentialIllegalKeyException &e) {
    145144        if (const std::string *key = boost::get_error_info<SerializablePotentialKey>(e))
    146           ELOG(1, "Illegal key parsing information for potential "
    147               << *key << ".");
     145          STATUS("Illegal key parsing information for potential "+*key+".");
    148146        else
    149           ELOG(1, "Illegal key parsing information for potential with unknown key.");
     147          STATUS("Illegal key parsing information for potential with unknown key.");
    150148        return Action::failure;
    151149      }
    152150    } else {
    153       ELOG(0, "Failed to parse from " << params.potential_file.get().string() << ".");
     151      STATUS("Failed to parse from "+params.potential_file.get().string()+".");
    154152      return Action::failure;
    155153    }
     
    162160  } else {
    163161    if (params.charges.get().empty()) {
    164       ELOG(1, "Neither charges nor potential file given!");
     162      STATUS("Neither charges nor potential file given!");
    165163      return Action::failure;
    166164    } else {
     
    222220        << fragmentnumbers << " is " << graph << ".");
    223221  } else {
    224     ELOG(1, "Specific fragment " << fragmentnumbers << " not found in homologies!");
     222    STATUS("Specific fragment "+toString(fragmentnumbers)+" not found in homologies!");
    225223    return Action::failure;
    226224  }
     
    305303          << l2error << " are " << model->getParameters() << ".");
    306304    } else {
    307       ELOG(0, "We require parameter derivatives for a box constraint minimization.");
     305      STATUS("No required parameter derivatives for a box constraint minimization known.");
    308306      return Action::failure;
    309307    }
  • src/Actions/PotentialAction/ParseHomologiesAction.cpp

    ra61dbb rd8821e  
    8181  if (!params.homology_file.get().empty()) {
    8282    const boost::filesystem::path &homology_file = params.homology_file.get();
    83     if (homology_file.string() != "") {
    84       LOG(1, "INFO: Parsing HomologyGraphs from file " << homology_file.string() << ".");
    85       parseHomologiesFromFile(homology_file);
    86       return Action::success;
    87     }
     83    LOG(1, "INFO: Parsing HomologyGraphs from file " << homology_file.string() << ".");
     84    parseHomologiesFromFile(homology_file);
     85    return Action::success;
     86  } else {
     87    STATUS("Homology file name is empty.");
     88    return Action::failure;
    8889  }
     90}
    8991
     92ActionState::ptr PotentialParseHomologiesAction::performUndo(ActionState::ptr _state) {
     93  STATUS("Undo of PotentialParseHomologiesAction not implemented.");
    9094  return Action::failure;
    9195}
    9296
    93 ActionState::ptr PotentialParseHomologiesAction::performUndo(ActionState::ptr _state) {
    94   return Action::success;
    95 }
    96 
    9797ActionState::ptr PotentialParseHomologiesAction::performRedo(ActionState::ptr _state){
    98   return Action::success;
     98  STATUS("Redo of PotentialParseHomologiesAction not implemented.");
     99  return Action::failure;
    99100}
    100101
  • src/Actions/PotentialAction/SaveHomologiesAction.cpp

    ra61dbb rd8821e  
    8383  if (!params.homology_file.get().empty()) {
    8484    const boost::filesystem::path &homology_file = params.homology_file.get();
    85     if (homology_file.string() != "") {
    86       LOG(1, "INFO: Appending HomologyGraphs to file " << homology_file.string() << ".");
    87       if (!writeHomologiesToFile(homology_file))
    88         return Action::failure;
     85    LOG(1, "INFO: Appending HomologyGraphs to file " << homology_file.string() << ".");
     86    if (!writeHomologiesToFile(homology_file)) {
     87      STATUS("Failed to write homology file.");
     88      return Action::failure;
    8989    }
     90    return Action::success;
     91  } else {
     92    STATUS("Homology file name empty.");
     93    return Action::failure;
    9094  }
    91 
    92   return Action::success;
    9395}
    9496
  • src/Actions/SelectionAction/Atoms/AllAtomsInsideVolumeAction.cpp

    ra61dbb rd8821e  
    6161  std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes();
    6262  if (selectedShapes.size() != 1){
    63     ELOG(1, "SelectionAllAtomsInsideVolumeAction::performCall(): there has to be exactly 1 selected shape.");
     63    STATUS("There has to be exactly 1 selected shape.");
    6464    return Action::failure;
    6565  }
     
    7474
    7575  std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes();
    76   if (selectedShapes.size() != 1)
    77     return Action::failure;
    7876  World::getInstance().unselectAllAtoms(AtomsByShape(*selectedShapes[0]));
    7977  BOOST_FOREACH(atom *_atom, state->selectedAtoms)
     
    8785
    8886  std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes();
    89   if (selectedShapes.size() != 1)
    90     return Action::failure;
    9187  World::getInstance().selectAllAtoms(AtomsByShape(*selectedShapes[0]));
    9288
  • src/Actions/SelectionAction/Atoms/AtomByIdAction.cpp

    ra61dbb rd8821e  
    8585  switch (status) {
    8686    case AtomMissing:
     87      STATUS("Cannot find all atoms with given ids.");
    8788      return Action::failure;
    8889      break;
  • src/Actions/SelectionAction/Atoms/AtomByOrderAction.cpp

    ra61dbb rd8821e  
    6565    }
    6666  } else {
     67    STATUS("Cannot find atom by given order of "+toString(params.order.get())+".");
    6768    return Action::failure;
    6869  }
  • src/Actions/SelectionAction/Atoms/NotAllAtomsInsideVolumeAction.cpp

    ra61dbb rd8821e  
    6060  std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes();
    6161  if (selectedShapes.size() != 1){
    62     ELOG(1, "SelectionNotAllAtomsInsideVolumeAction::performCall(): there has to be exactly 1 selected shape.");
     62    STATUS("There has to be exactly 1 selected shape.");
    6363    return Action::failure;
    6464  }
     
    7373
    7474  std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes();
    75   if (selectedShapes.size() != 1)
    76     return Action::failure;
    7775  World::getInstance().selectAllAtoms(AtomsByShape(*selectedShapes[0]));
    7876  BOOST_FOREACH(atom *_atom, state->unselectedAtoms)
     
    8684
    8785  std::vector<Shape*> selectedShapes = ShapeRegistry::getInstance().getSelectedShapes();
    88   if (selectedShapes.size() != 1)
    89     return Action::failure;
    9086  World::getInstance().unselectAllAtoms(AtomsByShape(*selectedShapes[0]));
    9187
  • src/Actions/SelectionAction/Atoms/NotAtomByIdAction.cpp

    ra61dbb rd8821e  
    8585  switch (status) {
    8686    case AtomMissing:
     87      STATUS("Cannot find all atoms by given ids.");
    8788      return Action::failure;
    8889      break;
  • src/Actions/SelectionAction/Atoms/NotAtomByOrderAction.cpp

    ra61dbb rd8821e  
    6565    }
    6666  } else {
     67    STATUS("Cannot find atom by given order of "+toString(params.order.get())+".");
    6768    return Action::failure;
    6869  }
  • src/Actions/SelectionAction/Molecules/MoleculeByIdAction.cpp

    ra61dbb rd8821e  
    6464    }
    6565  } else {
     66    STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+".");
    6667    return Action::failure;
    6768  }
  • src/Actions/SelectionAction/Molecules/MoleculeByOrderAction.cpp

    ra61dbb rd8821e  
    6666    }
    6767  } else {
     68    STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+".");
    6869    return Action::failure;
    6970  }
  • src/Actions/SelectionAction/Molecules/NotMoleculeByIdAction.cpp

    ra61dbb rd8821e  
    6464    }
    6565  } else {
     66    STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+".");
    6667    return Action::failure;
    6768  }
  • src/Actions/SelectionAction/Molecules/NotMoleculeByOrderAction.cpp

    ra61dbb rd8821e  
    6666    }
    6767  } else {
     68    STATUS("Cannot find molecule by given index "+toString(params.molindex.get())+".");
    6869    return Action::failure;
    6970  }
  • src/Actions/SelectionAction/Shapes/NotShapeByNameAction.cpp

    ra61dbb rd8821e  
    6262    }
    6363  } else {
     64    STATUS("Cannot find shape by given name "+toString(params.shapeName.get())+".");
    6465    return Action::failure;
    6566  }
  • src/Actions/SelectionAction/Shapes/ShapeByNameAction.cpp

    ra61dbb rd8821e  
    6262    }
    6363  } else {
     64    STATUS("Cannot find shape by given name "+toString(params.shapeName.get())+".");
    6465    return Action::failure;
    6566  }
  • src/Actions/ShapeAction/CombineShapesAction.cpp

    ra61dbb rd8821e  
    6161  if (op == "AND"){
    6262    if (selectedShapes.size() != 2){
    63       ELOG(1, "Operation AND requires exactly 2 selected shapes.");
     63      STATUS("Operation AND requires exactly 2 selected shapes.");
    6464      return Action::failure;
    6565    }
     
    6767  }else if (op == "OR"){
    6868    if (selectedShapes.size() != 2){
    69       ELOG(1, "Operation OR requires exactly 2 selected shapes.");
     69      STATUS("Operation OR requires exactly 2 selected shapes.");
    7070      return Action::failure;
    7171    }
     
    7373  }else if (op == "NOT"){
    7474    if (selectedShapes.size() != 1){
    75       ELOG(1, "Operation NOT requires exactly 1 selected shape.");
     75      STATUS("Operation NOT requires exactly 1 selected shape.");
    7676      return Action::failure;
    7777    }
     
    116116  std::string op = params.shape_op.get();
    117117  if (op == "AND"){
    118     if (selectedShapes.size() != 2){
    119       ELOG(1, "Operation AND requires exactly 2 selected shapes.");
    120       return Action::failure;
    121     }
    122118    s = (*selectedShapes[0]) && (*selectedShapes[1]);
    123119  }else if (op == "OR"){
    124     if (selectedShapes.size() != 2){
    125       ELOG(1, "Operation OR requires exactly 2 selected shapes.");
    126       return Action::failure;
    127     }
    128120    s = (*selectedShapes[0]) || (*selectedShapes[1]);
    129121  }else if (op == "NOT"){
    130     if (selectedShapes.size() != 1){
    131       ELOG(1, "Operation NOT requires exactly 1 selected shape.");
    132       return Action::failure;
    133     }
    134122    s = ! (*selectedShapes[0]);
    135123  }else{
  • src/Actions/TesselationAction/ConvexEnvelopeAction.cpp

    ra61dbb rd8821e  
    7272    //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
    7373    // TODO: Beide Funktionen sollten streams anstelle des Filenamen benutzen, besser fuer unit tests
    74     FindNonConvexBorder(mol, TesselStruct, LCList, 50., params.filenameNonConvex.get().string().c_str());
     74    Success &= FindNonConvexBorder(mol, TesselStruct, LCList, 50., params.filenameNonConvex.get().string().c_str());
    7575    //RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]);
    7676    const double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, params.filenameConvex.get().string().c_str());
     
    8383  if (Success)
    8484    return Action::success;
    85   else
     85  else {
     86    STATUS("Failed to find the non convex border.");
    8687    return Action::failure;
     88  }
    8789}
    8890
     
    9395//  state->mol->setName(state->lastName);
    9496
     97  STATUS("Undo of TesselationConvexEnvelopeAction not implemented.");
    9598  return Action::failure;
    9699}
  • src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp

    ra61dbb rd8821e  
    8888//  state->mol->setName(state->lastName);
    8989
     90  STATUS("Undo of TesselationNonConvexEnvelopeAction not implemented.");
    9091  return Action::failure;
    9192}
  • src/Actions/WorldAction/AddEmptyBoundaryAction.cpp

    ra61dbb rd8821e  
    117117    return ActionState::ptr(UndoState);
    118118  } else {
    119     ELOG(2, "There must be atoms present for AddingEmptyBoundary.");
     119    STATUS("There must be atoms present for AddingEmptyBoundary.");
    120120    return Action::failure;
    121121  }
  • src/Actions/WorldAction/CenterOnEdgeAction.cpp

    ra61dbb rd8821e  
    8080  // get maximum and minimum
    8181  if (AllAtoms.empty()) {
    82     ELOG(2, "For WorldCenterOnEdgeAction atoms must be present.");
     82    STATUS("There are no atoms present.");
    8383    return Action::failure;
    8484  }
  • src/Actions/WorldAction/InputAction.cpp

    ra61dbb rd8821e  
    7272    parsers.SetOutputPrefixForAll(FilenamePrefix);
    7373  } else {
    74     ELOG(1, "Input file does not have a suffix, cannot recognize format.");
     74    STATUS("Input file does not have a suffix, cannot recognize format.");
    7575    return Action::failure;
    7676  }
     
    103103//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
    104104
     105  STATUS("Undo of WorldInputAction not implemented.");
    105106  return Action::failure;
    106107//  string newName = state->mol->getName();
     
    111112
    112113ActionState::ptr WorldInputAction::performRedo(ActionState::ptr _state){
     114  STATUS("Redo of WorldInputAction not implemented.");
    113115  return Action::failure;
    114116}
  • src/Actions/WorldAction/OutputAction.cpp

    ra61dbb rd8821e  
    6060  // Parser configured to save anything?
    6161  if (!FormatParserStorage::getInstance().isAbleToSave()){
    62     ELOG(1, "No parser or file prefix selected.");
     62    STATUS("No parser or file prefix selected.");
    6363    return Action::failure;
    6464  }
     
    7373//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
    7474
     75  STATUS("Undo of WorldOutputAction not implemented.");
    7576  return Action::failure;
    7677//  string newName = state->mol->getName();
     
    8182
    8283ActionState::ptr WorldOutputAction::performRedo(ActionState::ptr _state){
     84  STATUS("Redo of WorldOutputAction not implemented.");
    8385  return Action::failure;
    8486}
  • src/Actions/WorldAction/OutputAsAction.cpp

    ra61dbb rd8821e  
    6464    FilenamePrefix = params.filename.get().stem().string();
    6565  } else {
    66     ELOG(1, "Output file does not have a suffix, cannot recognize format.");
     66    STATUS("Output file does not have a suffix, cannot recognize format.");
    6767    return Action::failure;
    6868  }
     
    7575    FormatParserStorage::getInstance().saveWorld(output, FilenameSuffix);
    7676  } else {
    77     ELOG(1, "Could not open file " << params.filename.get() << ".");
     77    STATUS("Could not open file "+params.filename.get().string()+".");
     78    return Action::failure;
    7879  }
    7980  output.close();
     
    8586//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
    8687
     88  STATUS("Undo of WorldOutputAsAction not implemented.");
    8789  return Action::failure;
    8890//  string newName = state->mol->getName();
     
    9395
    9496ActionState::ptr WorldOutputAsAction::performRedo(ActionState::ptr _state){
     97  STATUS("Redo of WorldOutputAsAction not implemented.");
    9598  return Action::failure;
    9699}
  • src/UIElements/CommandLineUI/CommandLineStatusIndicator.cpp

    ra61dbb rd8821e  
    3434
    3535#include "CodePatterns/MemDebug.hpp"
     36#include "CodePatterns/Observer/Notification.hpp"
     37#include "CodePatterns/Observer/Observable.hpp"
    3638
    3739#include "CommandLineUI/CommandLineStatusIndicator.hpp"
     
    3941#include <iostream>
    4042
     43#include "Actions/ActionQueue.hpp"
     44#include "Actions/ActionStatusList.hpp"
    4145#include "Actions/Process.hpp"
    42 #include "CodePatterns/Observer/Observable.hpp"
    4346
    4447using namespace MoleCuilder;
    4548
    4649CommandLineStatusIndicator::CommandLineStatusIndicator() :
    47     Observer("CommandLineStatusIndicator")
     50    Observer("CommandLineStatusIndicator"),
     51    StatusList(ActionQueue::getInstance().getStatusList()),
     52    StatusList_signedOn(false)
    4853{
    4954  Process::AddObserver(this);
     55
     56  StatusList.signOn(this, ActionStatusList::StatusAdded);
     57  StatusList_signedOn = true;
    5058}
    5159
     
    5361{
    5462  Process::RemoveObserver(this);
     63
     64  if (StatusList_signedOn) {
     65    // print all remaining messages prior to exit
     66    while (StatusList.size() != 0)
     67      displayStatusMessage();
     68    StatusList.signOff(this, ActionStatusList::StatusAdded);
     69  }
    5570}
    5671
    5772void CommandLineStatusIndicator::update(Observable *subject){
    58   Process *proc;
    59   // we are only observing Processes
    60   if((proc=dynamic_cast<Process*>(subject))){
    61     // see what kind of progress we have to display
    62     if(proc->getMaxSteps()>0){
    63       if(!proc->doesStop()){
    64         std::cout << "Busy (" << proc->getName() << ") ";
    65         // we can show a percentage done
    66         std::cout << (int)proc->getDoneRatio() << "% done" << std::endl;
     73  if (subject == &StatusList) {
     74    // we do not react to general updates from StatusList
     75  } else {
     76    Process *proc;
     77    // we are only observing Processes
     78    if((proc=dynamic_cast<Process*>(subject))){
     79      // see what kind of progress we have to display
     80      if(proc->getMaxSteps()>0){
     81        if(!proc->doesStop()){
     82          std::cout << "Busy (" << proc->getName() << ") ";
     83          // we can show a percentage done
     84          std::cout << (int)proc->getDoneRatio() << "% done" << std::endl;
     85        }
    6786      }
    68     }
    69     else{
    70       // we only show some kind of busy animation
    71       if(proc->doesStart()){
    72         std::cout << "Busy (" << proc->getName() << ")";
    73       }
    74       if(!proc->doesStop()){
    75         std::cout << ".";
    76       }
    77       else {
    78         std::cout << std::endl;
     87      else{
     88        // we only show some kind of busy animation
     89        if(proc->doesStart()){
     90          std::cout << "Busy (" << proc->getName() << ")";
     91        }
     92        if(!proc->doesStop()){
     93          std::cout << ".";
     94        }
     95        else {
     96          std::cout << std::endl;
     97        }
    7998      }
    8099    }
     
    82101}
    83102
    84 void CommandLineStatusIndicator::subjectKilled(Observable *subject){
    85 
     103void CommandLineStatusIndicator::subjectKilled(Observable *subject)
     104{
     105  if (subject == &StatusList) {
     106    // print all remaining messages
     107    while (StatusList.size() != 0)
     108      displayStatusMessage();
     109    // don't need to sign off, just note down that we are
     110    StatusList_signedOn = false;
     111  }
    86112}
    87113
     114void CommandLineStatusIndicator::displayStatusMessage() const
     115{
     116  const std::string message = StatusList.popFirstMessage();
     117  std::cout << message << std::endl;
     118}
     119
     120void CommandLineStatusIndicator::recieveNotification(Observable *_publisher, Notification *_notification)
     121{
     122  if (_publisher == &StatusList) {
     123    switch(_notification->getChannelNo()) {
     124      case ActionStatusList::StatusAdded:
     125        displayStatusMessage();
     126        break;
     127    }
     128  }
     129}
     130
  • src/UIElements/CommandLineUI/CommandLineStatusIndicator.hpp

    ra61dbb rd8821e  
    1717#include "CodePatterns/Observer/Observer.hpp"
    1818
     19namespace MoleCuilder {
     20  class ActionStatusList;
     21}
     22
    1923class Observable;
    2024
     
    2731  void update(Observable *subject);
    2832  void subjectKilled(Observable *subject);
     33  void recieveNotification(Observable *_publisher, Notification *_notification);
    2934
    3035private:
     36  void displayStatusMessage() const;
    3137
     38private:
     39  //!> reference to the StatusList we are signed on
     40  MoleCuilder::ActionStatusList& StatusList;
     41  //!> indicates whether we are currently signed on
     42  bool StatusList_signedOn;
    3243};
    3344
  • src/UIElements/CommandLineUI/CommandLineWindow.cpp

    ra61dbb rd8821e  
    4343#include "CodePatterns/Verbose.hpp"
    4444
     45#include "cleanUp.hpp"
    4546#include "Actions/Action.hpp"
    4647#include "Actions/ActionQueue.hpp"
     
    8081    }
    8182  }
     83#ifdef HAVE_ACTION_THREAD
     84  // wait for all Actions to finish before we quit the UI
     85  waitQueue();
     86#endif
    8287}
    8388
  • src/UIElements/Makefile.am

    ra61dbb rd8821e  
    172172  UIElements/Views/Qt4/QtHomologyList.cpp \
    173173  UIElements/Views/Qt4/QtInfoBox.cpp \
     174  UIElements/Views/Qt4/QtLogBox.cpp \
    174175  UIElements/Views/Qt4/QtMoleculeList.cpp \
    175176  UIElements/Views/Qt4/QtShapeController.cpp \
     
    192193  UIElements/Qt4/Query/QtQuery.hpp \
    193194  UIElements/Menu/Qt4/QtMenuPipe.hpp \
     195  UIElements/Views/Qt4/QDebugStream.hpp \
    194196  UIElements/Views/Qt4/QtElementList.hpp \
    195197  UIElements/Views/Qt4/QtFragmentList.hpp \
    196198  UIElements/Views/Qt4/QtHomologyList.hpp \
    197199  UIElements/Views/Qt4/QtInfoBox.hpp \
     200  UIElements/Views/Qt4/QtLogBox.hpp \
    198201  UIElements/Views/Qt4/QtMoleculeList.hpp \
    199202  UIElements/Views/Qt4/QtShapeController.hpp \
  • src/UIElements/Menu/TextMenu/TxMenu.cpp

    ra61dbb rd8821e  
    3939#include <iostream>
    4040#include <cmath>
     41#include "cleanUp.hpp"
    4142#include "Menu/TextMenu/TxMenu.hpp"
    4243#include "Menu/TextMenu/MenuItem.hpp"
     
    149150        outputter << "Invalid Choice!" <<  std::endl;
    150151      }
    151     }
     152    }
     153#ifdef HAVE_ACTION_THREAD
     154    // wait for actions to finish
     155    waitQueue();
     156#endif
    152157  }while (!hasQuit());
    153158}
  • src/UIElements/Qt4/QtMainWindow.cpp

    ra61dbb rd8821e  
    5757#include "Views/Qt4/QtFragmentList.hpp"
    5858#include "Views/Qt4/QtHomologyList.hpp"
     59#include "Views/Qt4/QtLogBox.hpp"
    5960#include "Views/Qt4/QtShapeController.hpp"
    6061#include "Views/Qt4/QtInfoBox.hpp"
     
    9899  homologyList = new QtHomologyList(worldTab);
    99100  fragmentList = new QtFragmentList(worldTab);
     101  logBox = new QtLogBox(worldTab);
    100102  shapeController = new QtShapeController(worldTab);
    101103
     
    130132  worldTab->addTab(fragmentList, "All Fragments");
    131133  worldTab->addTab(homologyList, "All Homologies");
     134  worldTab->addTab(logBox, "Log");
    132135
    133136  statusBar = new QtStatusBar(this);
  • src/UIElements/Qt4/QtMainWindow.hpp

    ra61dbb rd8821e  
    2323#include "Menu/Qt4/QtMenu.hpp"
    2424
     25class QtElementList;
     26class QtFragmentList;
     27class QtHomologyList;
     28class QtLogBox;
    2529class QtMoleculeList;
    26 class QtElementList;
    27 class QtHomologyList;
    28 class QtFragmentList;
    2930class QtShapeController;
    3031class StringView;
     
    6465  QtToolBar *toolbar;
    6566  QSlider *timeline;
     67  QtLogBox *logBox;
    6668
    6769};
  • src/UIElements/TextUI/TextStatusIndicator.cpp

    ra61dbb rd8821e  
    3434
    3535#include "CodePatterns/MemDebug.hpp"
     36#include "CodePatterns/Observer/Notification.hpp"
    3637
    3738#include "TextUI/TextStatusIndicator.hpp"
     
    3940#include <iostream>
    4041
     42#include "Actions/ActionQueue.hpp"
     43#include "Actions/ActionStatusList.hpp"
    4144#include "Actions/Process.hpp"
    4245
     
    4447
    4548TextStatusIndicator::TextStatusIndicator() :
    46   Observer("TextStatusIndicator")
     49  Observer("TextStatusIndicator"),
     50  StatusList(ActionQueue::getInstance().getStatusList()),
     51  StatusList_signedOn(false)
    4752{
    4853  Process::AddObserver(this);
     54
     55  StatusList.signOn(this, ActionStatusList::StatusAdded);
     56  StatusList_signedOn = true;
    4957}
    5058
     
    5260{
    5361  Process::RemoveObserver(this);
     62
     63  if (StatusList_signedOn)
     64    StatusList.signOff(this, ActionStatusList::StatusAdded);
    5465}
    5566
    5667void TextStatusIndicator::update(Observable *subject){
    57   Process *proc;
    58   // we are only observing Processes
    59   if((proc=dynamic_cast<Process*>(subject))){
    60     // see what kind of progress we have to display
    61     if(proc->getMaxSteps()>0){
    62       if(!proc->doesStop()){
    63         std::cout << "Busy (" << proc->getName() << ") ";
    64         // we can show a percentage done
    65         std::cout << (int)proc->getDoneRatio() << "% done" << std::endl;
     68  if (subject == &StatusList) {
     69    // we do not react to general updates from StatusList
     70  } else {
     71    Process *proc;
     72    // we are otherwise only observing Processes
     73    if((proc=dynamic_cast<Process*>(subject))){
     74      // see what kind of progress we have to display
     75      if(proc->getMaxSteps()>0){
     76        if(!proc->doesStop()){
     77          std::cout << "Busy (" << proc->getName() << ") ";
     78          // we can show a percentage done
     79          std::cout << (int)proc->getDoneRatio() << "% done" << std::endl;
     80        }
    6681      }
    67     }
    68     else{
    69       // we only show some kind of busy animation
    70       if(proc->doesStart()){
    71         std::cout << "Busy (" << proc->getName() << ")";
    72       }
    73       if(!proc->doesStop()){
    74         std::cout << ".";
    75       }
    76       else {
    77         std::cout << std::endl;
     82      else{
     83        // we only show some kind of busy animation
     84        if(proc->doesStart()){
     85          std::cout << "Busy (" << proc->getName() << ")";
     86        }
     87        if(!proc->doesStop()){
     88          std::cout << ".";
     89        }
     90        else {
     91          std::cout << std::endl;
     92        }
    7893      }
    7994    }
     
    8196}
    8297
    83 void TextStatusIndicator::subjectKilled(Observable *subject){
    84 
     98void TextStatusIndicator::subjectKilled(Observable *subject)
     99{
     100  if (subject == &StatusList) {
     101    // print all remaining messages
     102    while (StatusList.size() != 0)
     103      displayStatusMessage();
     104    // don't need to sign off, just note down that we are
     105    StatusList_signedOn = false;
     106  }
    85107}
    86108
     109void TextStatusIndicator::displayStatusMessage() const
     110{
     111  const std::string message = StatusList.popFirstMessage();
     112  std::cout << message << std::endl;
     113}
     114
     115void TextStatusIndicator::recieveNotification(Observable *_publisher, Notification *_notification)
     116{
     117  if (_publisher == &StatusList) {
     118    switch(_notification->getChannelNo()) {
     119      case MoleCuilder::ActionStatusList::StatusAdded:
     120        // if timer is not already running
     121        displayStatusMessage();
     122        break;
     123    }
     124  }
     125}
  • src/UIElements/TextUI/TextStatusIndicator.hpp

    ra61dbb rd8821e  
    1717#include "CodePatterns/Observer/Observer.hpp"
    1818
     19namespace MoleCuilder {
     20  class ActionStatusList;
     21}
     22
     23
    1924class TextStatusIndicator : public Observer
    2025{
     
    2530  void update(Observable *subject);
    2631  void subjectKilled(Observable *subject);
     32  void recieveNotification(Observable *_publisher, Notification *_notification);
    2733
    2834private:
     35  void displayStatusMessage() const;
    2936
     37private:
     38  //!> reference to the StatusList we are signed on
     39  MoleCuilder::ActionStatusList& StatusList;
     40  //!> indicates whether we are currently signed on
     41  bool StatusList_signedOn;
    3042};
    3143
  • src/UIElements/Views/Qt4/QtStatusBar.cpp

    ra61dbb rd8821e  
    3939#include <QtCore/QMetaType>
    4040#include <QtGui/QProgressBar>
     41#include <QtCore/QTimer>
    4142
    4243#include "QtStatusBar.hpp"
    4344
    4445#include "CodePatterns/MemDebug.hpp"
     46#include "CodePatterns/Observer/Notification.hpp"
    4547
    4648#include "World.hpp"
     49#include "Actions/ActionQueue.hpp"
     50#include "Actions/ActionStatusList.hpp"
    4751#include "Actions/Process.hpp"
    4852
     
    5761  moleculeCount(World::getInstance().numMolecules()),
    5862  parent(_parent),
    59   activeProcess("")
     63  activeProcess(""),
     64  StatusList(ActionQueue::getInstance().getStatusList()),
     65  StatusList_signedOn(false),
     66  timer(NULL),
     67  timer_interval(1500)
    6068{
    6169  World::getInstance().signOn(this);
    6270  Process::AddObserver(this);
     71  StatusList.signOn(this, ActionStatusList::StatusAdded);
     72  StatusList_signedOn = true;
    6373  statusLabel = new QLabel(this);
    6474  statusLabel->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
     
    6676  redrawStatus();
    6777
     78  // connect the timer
     79  timer = new QTimer(this);
     80  timer->stop();
     81  connect(timer, SIGNAL(timeout()), this, SLOT(updateStatusMessage()));
     82
    6883  qRegisterMetaType<std::string>("std::string");
    6984  connect(
     
    7489QtStatusBar::~QtStatusBar()
    7590{
     91  // stop the timer if it is running
     92  if (timer->isActive())
     93    timer->stop();
     94
    7695  Process::RemoveObserver(this);
    7796  World::getInstance().signOff(this);
     97  if (StatusList_signedOn)
     98    StatusList.signOff(this, ActionStatusList::StatusAdded);
    7899}
    79100
    80101void QtStatusBar::update(Observable *subject){
    81   if (subject==World::getPointer()){
     102  if (subject == World::getPointer()){
    82103    atomCount = World::getInstance().numAtoms();
    83104    moleculeCount = World::getInstance().numMolecules();
    84     redrawStatus();
    85   }
    86   else {
     105    // redraw only if no timer updates messages
     106    if (!timer->isActive())
     107      redrawStatus();
     108  } else if (subject == &StatusList) {
     109    // we do not react to general updates from StatusList
     110  } else {
    87111    // we probably have some process
    88112    // as notify comes from ActionQueue's thread, we have to use signal/slots
     
    97121}
    98122
    99 void QtStatusBar::subjectKilled(Observable *subject){
     123void QtStatusBar::startTimer()
     124{
     125  timer->start(timer_interval);
     126}
     127
     128void QtStatusBar::stopTimer()
     129{
     130  timer->stop();
     131}
     132
     133void QtStatusBar::updateStatusMessage()
     134{
     135  if (StatusList.size() != 0) {
     136    // get oldest message from the StatusList
     137    const std::string message = StatusList.popFirstMessage();
     138    statusLabel->setText(QString(message.c_str()));
     139  } else {
     140    // just send the standard message
     141    redrawStatus();
     142    // and stop the timer
     143    stopTimer();
     144  }
     145}
     146
     147void QtStatusBar::recieveNotification(Observable *_publisher, Notification *_notification)
     148{
     149  if (_publisher == &StatusList) {
     150    switch(_notification->getChannelNo()) {
     151      case MoleCuilder::ActionStatusList::StatusAdded:
     152        if (!timer->isActive()) {
     153          // if timer is not already running
     154          updateStatusMessage();
     155          startTimer();
     156        }
     157        break;
     158    }
     159  }
     160}
     161
     162void QtStatusBar::subjectKilled(Observable *subject)
     163{
    100164  // Processes don't notify when they are killed
    101   atomCount = World::getInstance().numAtoms();
    102   moleculeCount = World::getInstance().numMolecules();
    103   World::getInstance().signOn(this);
    104   redrawStatus();
     165  if (subject == &StatusList) {
     166    // print all remaining messages
     167    while (StatusList.size() != 0)
     168      updateStatusMessage();
     169    // don't need to sign off, just note down that we are
     170    StatusList_signedOn = false;
     171  } else {
     172    atomCount = World::getInstance().numAtoms();
     173    moleculeCount = World::getInstance().numMolecules();
     174    World::getInstance().signOn(this);
     175    redrawStatus();
     176  }
    105177}
    106178
  • src/UIElements/Views/Qt4/QtStatusBar.hpp

    ra61dbb rd8821e  
    2222#include "CodePatterns/Observer/Observer.hpp"
    2323
     24class QBoxLayout;
    2425class QLabel;
    2526class QProgressBar;
    26 class QBoxLayout;
     27class QTimer;
    2728
    2829namespace MoleCuilder {
     30  class ActionStatusList;
    2931  class Process;
    3032}
     
    4850  void update(Observable *subject);
    4951  void subjectKilled(Observable *subject);
     52  void recieveNotification(Observable *_publisher, Notification *_notification);
    5053
    5154private slots:
     
    5558      const unsigned int currentstep,
    5659      const bool StopStatus);
     60  void updateStatusMessage();
    5761
    5862signals:
     
    6670  void redrawStatus();
    6771
     72  void startTimer();
     73  void stopTimer();
     74
    6875  int atomCount;
    6976  int moleculeCount;
     
    7481  progressBars_t progressBars;
    7582  std::string activeProcess;
     83  //!> reference to the StatusList we are signed on
     84  MoleCuilder::ActionStatusList& StatusList;
     85  //!> indicates whether we are currently signed on
     86  bool StatusList_signedOn;
     87  //!> QTimer instance that causes regular updates of status messages
     88  QTimer *timer;
     89  //!> time interval in milliseconds
     90  const int timer_interval;
    7691};
    7792
Note: See TracChangeset for help on using the changeset viewer.