Changeset 7f1b51 for src/UIElements/Qt4


Ignore:
Timestamp:
Sep 15, 2014, 3:05:28 PM (11 years ago)
Author:
Frederik Heber <heber@…>
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, Candidate_v1.7.0, Candidate_v1.7.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:
7e1a88
Parents:
b73545 (diff), 8859b5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'GUI_Fixes' into stable

Location:
src/UIElements/Qt4
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/QtDialog.cpp

    rb73545 r7f1b51  
    4545using namespace std;
    4646
    47 QtDialog::QtDialog() :
    48     QDialog(0)
    49 {
     47QtDialog::QtDialog(const std::string &_title) :
     48    QDialog(0),
     49    Dialog(_title)
     50{
     51  setWindowTitle(QString(_title.c_str()));
    5052  // creating and filling of the Dialog window
    5153  mainLayout = new QVBoxLayout();
  • src/UIElements/Qt4/QtDialog.hpp

    rb73545 r7f1b51  
    3030  Q_OBJECT
    3131public:
    32   QtDialog();
     32  QtDialog(const std::string &_title);
    3333  virtual ~QtDialog();
    3434
  • src/UIElements/Qt4/QtMainWindow.cpp

    rb73545 r7f1b51  
    116116  toolbar = new QtToolBar(this);
    117117  glWorldView->addToolBarActions(toolbar);
     118  toolbar->addFavoriteActionItems(20);
    118119  addToolBar(toolbar);
    119120
  • src/UIElements/Qt4/QtUIFactory.cpp

    rb73545 r7f1b51  
    6767}
    6868
    69 Dialog* QtUIFactory::makeDialog() {
    70   return new QtDialog();
     69Dialog* QtUIFactory::makeDialog(const std::string &_title) {
     70  return new QtDialog(_title);
    7171}
    7272
  • src/UIElements/Qt4/QtUIFactory.hpp

    rb73545 r7f1b51  
    2626  virtual ~QtUIFactory();
    2727
    28   virtual Dialog* makeDialog();
     28  virtual Dialog* makeDialog(const std::string &_title);
    2929  virtual MainWindow* makeMainWindow();
    3030
  • src/UIElements/Qt4/Query/AtomsQtQuery.cpp

    rb73545 r7f1b51  
    4747    QtQueryList<const atom *>(_param, _parent, _dialog, temp)
    4848{
    49   ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     49  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this, _title);
    5050  subQuery = new AtomQtQuery(*subParam, _title, _description, thisVLayout, subDialog);
    5151  subDialog->setSubQuery(subQuery);
  • src/UIElements/Qt4/Query/DoublesQtQuery.cpp

    rb73545 r7f1b51  
    4747    QtQueryList<double>(_param, _parent, _dialog, temp)
    4848{
    49   ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     49  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this, _title);
    5050  subQuery = new DoubleQtQuery(*subParam, _title, _description, thisVLayout, subDialog);
    5151  subDialog->setSubQuery(subQuery);
  • src/UIElements/Qt4/Query/ElementsQtQuery.cpp

    rb73545 r7f1b51  
    4848    QtQueryList<const element *>(_param, _parent, _dialog, temp)
    4949{
    50   ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     50  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this, _title);
    5151  subQuery = new ElementQtQuery(*subParam, _title, _description, thisVLayout, subDialog);
    5252  subDialog->setSubQuery(subQuery);
  • src/UIElements/Qt4/Query/FileQtQuery.cpp

    rb73545 r7f1b51  
    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"
    4755#include "Parser/ParserTypes.hpp"
    4856#include "Parser/FormatParserStorage.hpp"
     
    5159    QtQuery<boost::filesystem::path>(_param, _title, _description),
    5260    parent(_parent),
    53     dialog(_dialog)
     61    dialog(_dialog),
     62    mustBePresent(false)
    5463{
    5564  filenameLineEdit = new QLineEdit();
     
    5766  filenameLineEdit->setReadOnly(true);
    5867
    59   filenameLabel = new QLabel(QString("Input file:"));
     68  filenameLabel = new QLabel(QString(_title.c_str()));
    6069  filenameLabel->setBuddy(filenameLineEdit);
    6170  filenameLabel->setToolTip(QString(getDescription().c_str()));
     
    7180
    7281  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());
    73103}
    74104
     
    93123    // gather all possible suffixes
    94124    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());
    102133    }
    103     parsersuffixes << std::string(")");
    104     filters << tr(parsersuffixes.str().c_str());
    105     filters << tr("Data files (*.dat)");
    106134    filters << tr("Any files (*)");
    107135    theFileDialog->setNameFilters(filters);
  • src/UIElements/Qt4/Query/FilesQtQuery.cpp

    rb73545 r7f1b51  
    4848    QtQueryList<boost::filesystem::path>(_param, _parent, _dialog, temp)
    4949{
    50   ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     50  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this, _title);
    5151  subQuery = new FileQtQuery(*subParam, _title, _description, thisVLayout, subDialog);
    5252  subDialog->setSubQuery(subQuery);
  • src/UIElements/Qt4/Query/IntsQtQuery.cpp

    rb73545 r7f1b51  
    4747    QtQueryList<int>(_param, _parent, _dialog, temp)
    4848{
    49   ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     49  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this, _title);
    5050  subQuery = new IntQtQuery(*subParam, _title, _description, thisVLayout, subDialog);
    5151  subDialog->setSubQuery(subQuery);
  • src/UIElements/Qt4/Query/MoleculesQtQuery.cpp

    rb73545 r7f1b51  
    4747    QtQueryList<const molecule *>(_param, _parent, _dialog, temp)
    4848{
    49   ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     49  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this, _title);
    5050  subQuery = new MoleculeQtQuery(*subParam, _title, _description, thisVLayout, subDialog);
    5151  subDialog->setSubQuery(subQuery);
  • src/UIElements/Qt4/Query/QtQuery.hpp

    rb73545 r7f1b51  
    211211  QFileDialog *theFileDialog;
    212212  Dialog *dialog;
     213  std::vector<std::string> suffixes;
     214  bool mustBePresent;
    213215};
    214216
  • src/UIElements/Qt4/Query/QtQueryList.hpp

    rb73545 r7f1b51  
    107107{
    108108public:
    109   ListQuerySubDialog(QtQueryListUntyped *_parent) : parent(_parent), sub(NULL){}
     109  ListQuerySubDialog(QtQueryListUntyped *_parent, const std::string &_title) :
     110    Dialog(_title),
     111    parent(_parent),
     112    sub(NULL)
     113  {}
    110114  virtual void update()
    111115  {
  • src/UIElements/Qt4/Query/StringsQtQuery.cpp

    rb73545 r7f1b51  
    4747    QtQueryList<std::string>(_param, _parent, _dialog, temp)
    4848{
    49   ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     49  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this, _title);
    5050  subQuery = new StringQtQuery(*subParam, _title, _description, thisVLayout, subDialog);
    5151  subDialog->setSubQuery(subQuery);
  • src/UIElements/Qt4/Query/UnsignedIntsQtQuery.cpp

    rb73545 r7f1b51  
    4747    QtQueryList<unsigned int>(_param, _parent, _dialog, temp)
    4848{
    49   ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     49  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this, _title);
    5050  subQuery = new UnsignedIntQtQuery(*subParam, _title, _description, thisVLayout, subDialog);
    5151  subDialog->setSubQuery(subQuery);
  • src/UIElements/Qt4/Query/VectorsQtQuery.cpp

    rb73545 r7f1b51  
    4848    QtQueryList<Vector>(_param, _parent, _dialog, temp)
    4949{
    50   ListQuerySubDialog *subDialog = new ListQuerySubDialog(this);
     50  ListQuerySubDialog *subDialog = new ListQuerySubDialog(this, _title);
    5151  subQuery = new VectorQtQuery(*subParam, _title, _description, thisVLayout, subDialog);
    5252  subDialog->setSubQuery(subQuery);
Note: See TracChangeset for help on using the changeset viewer.