Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/Query/FileQtQuery.cpp

    rf8bccc rf130d4  
    4545#include "UIElements/Qt4/Query/QtQuery.hpp"
    4646
    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"
    5547#include "Parser/ParserTypes.hpp"
    5648#include "Parser/FormatParserStorage.hpp"
     
    5951    QtQuery<boost::filesystem::path>(_param, _title, _description),
    6052    parent(_parent),
    61     dialog(_dialog),
    62     mustBePresent(false)
     53    dialog(_dialog)
    6354{
    6455  filenameLineEdit = new QLineEdit();
     
    6657  filenameLineEdit->setReadOnly(true);
    6758
    68   filenameLabel = new QLabel(QString(_title.c_str()));
     59  filenameLabel = new QLabel(QString("Input file:"));
    6960  filenameLabel->setBuddy(filenameLineEdit);
    7061  filenameLabel->setToolTip(QString(getDescription().c_str()));
     
    8071
    8172  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 > &currentvalidator = *iter->first;
    92     if (dynamic_cast<const FileSuffixValidator * const>(&currentvalidator) != NULL)
    93       suffixes.push_back(dynamic_cast<const FileSuffixValidator &>(currentvalidator).getSuffix());
    94     if (dynamic_cast<const ParserFileValidator * const>(&currentvalidator) != 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>(&currentvalidator) != NULL)
    100       mustBePresent = iter->second;
    101   }
    102   std::sort(suffixes.begin(), suffixes.end());
    10373}
    10474
     
    12393    // gather all possible suffixes
    12494    QStringList filters;
    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());
     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);
    133102    }
     103    parsersuffixes << std::string(")");
     104    filters << tr(parsersuffixes.str().c_str());
     105    filters << tr("Data files (*.dat)");
    134106    filters << tr("Any files (*)");
    135107    theFileDialog->setNameFilters(filters);
Note: See TracChangeset for help on using the changeset viewer.