Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/ParserAction/SaveXyzAction.cpp

    r112b09 r047878  
    99
    1010#include "Actions/ParserAction/SaveXyzAction.hpp"
     11#include "Actions/ActionRegistry.hpp"
    1112#include "Parser/XyzParser.hpp"
     13#include "atom.hpp"
     14#include "molecule.hpp"
    1215
    1316#include <iostream>
     
    1821#include "UIElements/UIFactory.hpp"
    1922#include "UIElements/Dialog.hpp"
    20 #include "Actions/MapOfActions.hpp"
     23#include "UIElements/ValueStorage.hpp"
    2124
    22 #include "atom.hpp"
    23 #include "molecule.hpp"
    2425
    2526/****** ParserSaveXyzAction *****/
     
    4647{}
    4748
     49void ParserSaveXyz(std::string &filename) {
     50  ValueStorage::getInstance().setCurrentValue(ParserSaveXyzAction::NAME, filename);
     51  ActionRegistry::getInstance().getActionByName(ParserSaveXyzAction::NAME)->call(Action::NonInteractive);
     52};
     53
     54Dialog* ParserSaveXyzAction::fillDialog(Dialog *dialog) {
     55  ASSERT(dialog,"No Dialog given when filling action dialog");
     56
     57  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
     58
     59  return dialog;
     60}
     61
    4862Action::state_ptr ParserSaveXyzAction::performCall() {
    4963  string filename;
    5064  XyzParser parser;
    51   Dialog *dialog = UIFactory::getInstance().makeDialog();
    5265
    53   dialog->queryString("filename",&filename, "Filename of the xyz file");
     66  ValueStorage::getInstance().queryCurrentValue(NAME, filename);
    5467
    55   if(dialog->display()) {
    56     // store xyz file
    57     ofstream output;
    58     output.open(filename.c_str());
    59     if (!output.fail())
    60       parser.save(&output);
    61     output.close();
    62   }
    63   delete dialog;
     68  // store xyz file
     69  ofstream output;
     70  output.open(filename.c_str());
     71  if (!output.fail())
     72    parser.save(&output);
     73  output.close();
    6474  return Action::failure;
    6575}
Note: See TracChangeset for help on using the changeset viewer.