- Timestamp:
- Sep 8, 2014, 9:37:32 PM (11 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 95cfac
- Parents:
- ce4126
- git-author:
- Frederik Heber <heber@…> (09/07/14 17:44:06)
- git-committer:
- Frederik Heber <heber@…> (09/08/14 21:37:32)
- Location:
- src
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parameters/Makefile.am
rce4126 rdae158 39 39 Parameters/Validators/GenericValidators.hpp \ 40 40 Parameters/Validators/GenericValidators_impl.hpp \ 41 Parameters/Validators/getFlatListFromHierarchyOfValidators.hpp \ 41 42 Parameters/Validators/Ops_Validator.hpp \ 42 43 Parameters/Validators/Ops_Validator_impl.hpp \ -
src/Parameters/Validators/Ops_Validator_impl.hpp
rce4126 rdae158 52 52 Validator<T> *getA(){ return a; } 53 53 Validator<T> *getB(){ return b; } 54 const Validator<T> *getA() const { return a; } 55 const Validator<T> *getB() const { return b; } 54 56 55 57 private: … … 90 92 } 91 93 94 Validator<T> *getA(){ return a; } 95 Validator<T> *getB(){ return b; } 96 const Validator<T> *getA() const { return a; } 97 const Validator<T> *getB() const { return b; } 98 92 99 private: 93 100 Validator<T> *a; … … 126 133 } 127 134 135 Validator<T> *getA(){ return a; } 136 const Validator<T> *getA() const { return a; } 137 128 138 private: 129 139 Validator<T> *a; -
src/Parameters/Validators/Specific/FileSuffixValidator.hpp
rce4126 rdae158 33 33 Validator< boost::filesystem::path >* clone() const; 34 34 35 const std::string & getSuffix() const 36 { return suffix; } 37 35 38 private: 36 39 std::string suffix; -
src/Parameters/Validators/Specific/ParserFileValidator.cpp
rce4126 rdae158 72 72 } 73 73 74 std::vector<std::string> ParserFileValidator::getSuffixes() const 75 { 76 std::vector<std::string> suffixes; 77 for (ParserTypes t = ParserTypes_begin; t < ParserTypes_end; ++ t){ 78 suffixes.push_back( 79 FormatParserStorage::getInstance().getSuffixFromType(t)); 80 } 81 return suffixes; 82 } 74 83 75 84 76 -
src/Parameters/Validators/Specific/ParserFileValidator.hpp
rce4126 rdae158 27 27 bool operator==(const Validator<boost::filesystem::path> &_instance) const; 28 28 Validator< boost::filesystem::path >* clone() const; 29 30 public: 31 std::vector<std::string> getSuffixes() const; 29 32 }; 30 33 -
src/Parameters/Validators/Validator.hpp
rce4126 rdae158 35 35 }; 36 36 37 38 37 #endif /* VALIDATOR_HPP_ */ -
src/UIElements/Qt4/Query/FileQtQuery.cpp
rce4126 rdae158 45 45 #include "UIElements/Qt4/Query/QtQuery.hpp" 46 46 47 #include <algorithm> 48 #include <boost/filesystem.hpp> 49 50 #include "Parameters/Validators/getFlatListFromHierarchyOfValidators.hpp" 51 #include "Parameters/Validators/Validator.hpp" 52 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 53 #include "Parameters/Validators/Specific/FileSuffixValidator.hpp" 54 #include "Parameters/Validators/Specific/ParserFileValidator.hpp" 47 55 #include "Parser/ParserTypes.hpp" 48 56 #include "Parser/FormatParserStorage.hpp" … … 51 59 QtQuery<boost::filesystem::path>(_param, _title, _description), 52 60 parent(_parent), 53 dialog(_dialog) 61 dialog(_dialog), 62 mustBePresent(false) 54 63 { 55 64 filenameLineEdit = new QLineEdit(); … … 71 80 72 81 QObject::connect(filedialogButton,SIGNAL(clicked()),this,SLOT(showFileDialog())); 82 83 // fill list of suffixes 84 const Validator<boost::filesystem::path> &validator = 85 _param.getValidator(); 86 typedef std::vector<std::pair<const Validator<boost::filesystem::path> *, bool> > validators_t; 87 const validators_t validators = 88 getFlatListFromHierarchyOfValidators<boost::filesystem::path>(validator); 89 for (validators_t::const_iterator iter = validators.begin(); 90 iter != validators.end(); ++iter) { 91 const Validator< boost::filesystem::path > ¤tvalidator = *iter->first; 92 if (dynamic_cast<const FileSuffixValidator * const>(¤tvalidator) != NULL) 93 suffixes.push_back(dynamic_cast<const FileSuffixValidator &>(currentvalidator).getSuffix()); 94 if (dynamic_cast<const ParserFileValidator * const>(¤tvalidator) != NULL) { 95 const std::vector<std::string> moresuffixes = 96 dynamic_cast<const ParserFileValidator &>(currentvalidator).getSuffixes(); 97 suffixes.insert(suffixes.end(), moresuffixes.begin(), moresuffixes.end()); 98 } 99 if (dynamic_cast<const FilePresentValidator * const>(¤tvalidator) != NULL) 100 mustBePresent = iter->second; 101 } 102 std::sort(suffixes.begin(), suffixes.end()); 73 103 } 74 104 … … 93 123 // gather all possible suffixes 94 124 QStringList filters; 95 std::stringstream parsersuffixes; 96 parsersuffixes << std::string("Config files ("); 97 for (ParserTypes t = ParserTypes_begin; t < ParserTypes_end; ++t){ 98 if (t != ParserTypes_begin) 99 parsersuffixes << std::string(" "); 100 parsersuffixes << std::string("*.") << 101 FormatParserStorage::getInstance().getSuffixFromType(t); 125 std::stringstream filter_string; 126 if (!suffixes.empty()) { 127 filter_string << "Valid files ("; 128 for (std::vector<std::string>::const_iterator iter = suffixes.begin(); 129 iter != suffixes.end(); ++iter) 130 filter_string << (iter == suffixes.begin() ? "*." : " *.") << *iter << " "; 131 filter_string << ")"; 132 filters << tr(filter_string.str().c_str()); 102 133 } 103 parsersuffixes << std::string(")");104 filters << tr(parsersuffixes.str().c_str());105 filters << tr("Data files (*.dat)");106 134 filters << tr("Any files (*)"); 107 135 theFileDialog->setNameFilters(filters); -
src/UIElements/Qt4/Query/QtQuery.hpp
rce4126 rdae158 211 211 QFileDialog *theFileDialog; 212 212 Dialog *dialog; 213 std::vector<std::string> suffixes; 214 bool mustBePresent; 213 215 }; 214 216
Note:
See TracChangeset
for help on using the changeset viewer.