Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/MoleculeAction/SaveTemperatureAction.cpp

    r112b09 r047878  
    99
    1010#include "Actions/MoleculeAction/SaveTemperatureAction.hpp"
     11#include "Actions/ActionRegistry.hpp"
     12#include "log.hpp"
     13#include "molecule.hpp"
     14#include "verbose.hpp"
     15#include "World.hpp"
    1116
    1217#include <iostream>
     
    1823#include "UIElements/UIFactory.hpp"
    1924#include "UIElements/Dialog.hpp"
    20 #include "Actions/MapOfActions.hpp"
    21 
    22 #include "atom.hpp"
    23 #include "log.hpp"
    24 #include "molecule.hpp"
    25 #include "verbose.hpp"
    26 #include "World.hpp"
     25#include "UIElements/ValueStorage.hpp"
    2726
    2827/****** MoleculeSaveTemperatureAction *****/
     
    4948{}
    5049
     50void MoleculeSaveTemperature(std::string &temperaturefile) {
     51  ValueStorage::getInstance().setCurrentValue(MoleculeSaveTemperatureAction::NAME, temperaturefile);
     52  ActionRegistry::getInstance().getActionByName(MoleculeSaveTemperatureAction::NAME)->call(Action::NonInteractive);
     53};
     54
     55Dialog* MoleculeSaveTemperatureAction::fillDialog(Dialog *dialog) {
     56  ASSERT(dialog,"No Dialog given when filling action dialog");
     57
     58  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
     59
     60  return dialog;
     61}
     62
    5163Action::state_ptr MoleculeSaveTemperatureAction::performCall() {
    5264  string filename;
    53   Dialog *dialog = UIFactory::getInstance().makeDialog();
    5465  molecule *mol = NULL;
    5566
    56   dialog->queryString(NAME, &filename, MapOfActions::getInstance().getDescription(NAME));
    57   dialog->queryMolecule("molecule-by-id", &mol, MapOfActions::getInstance().getDescription("molecule-by-id"));
     67  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
    5868
    59   if(dialog->display()) {
     69  for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     70    mol = iter->second;
    6071    DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl);
    6172    ofstream output;
     
    6677      DoLog(2) && (Log() << Verbose(2) << "File stored." << endl);
    6778    output.close();
    68     delete dialog;
    69     return Action::success;
    7079  }
    71   delete dialog;
    72   return Action::failure;
     80  return Action::success;
    7381}
    7482
Note: See TracChangeset for help on using the changeset viewer.