- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ParserAction/SaveXyzAction.cpp
r112b09 r047878 9 9 10 10 #include "Actions/ParserAction/SaveXyzAction.hpp" 11 #include "Actions/ActionRegistry.hpp" 11 12 #include "Parser/XyzParser.hpp" 13 #include "atom.hpp" 14 #include "molecule.hpp" 12 15 13 16 #include <iostream> … … 18 21 #include "UIElements/UIFactory.hpp" 19 22 #include "UIElements/Dialog.hpp" 20 #include " Actions/MapOfActions.hpp"23 #include "UIElements/ValueStorage.hpp" 21 24 22 #include "atom.hpp"23 #include "molecule.hpp"24 25 25 26 /****** ParserSaveXyzAction *****/ … … 46 47 {} 47 48 49 void ParserSaveXyz(std::string &filename) { 50 ValueStorage::getInstance().setCurrentValue(ParserSaveXyzAction::NAME, filename); 51 ActionRegistry::getInstance().getActionByName(ParserSaveXyzAction::NAME)->call(Action::NonInteractive); 52 }; 53 54 Dialog* 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 48 62 Action::state_ptr ParserSaveXyzAction::performCall() { 49 63 string filename; 50 64 XyzParser parser; 51 Dialog *dialog = UIFactory::getInstance().makeDialog();52 65 53 dialog->queryString("filename",&filename, "Filename of the xyz file");66 ValueStorage::getInstance().queryCurrentValue(NAME, filename); 54 67 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(); 64 74 return Action::failure; 65 75 }
Note:
See TracChangeset
for help on using the changeset viewer.