Changeset 6f5dfe for src/UIElements/QT4


Ignore:
Timestamp:
Oct 22, 2010, 4:13:36 PM (14 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, 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:
bd2390, db7cb0
Parents:
e4decc
Message:

Added boost::filesystem usage for input files.

  • parameters for Action input now have type boost::filesystem.
  • rewritten Actions to use boost::filesystems
  • in the progress of writing FileQtQuery to present a file dialog.
Location:
src/UIElements/QT4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/QT4/QTDialog.cpp

    re4decc r6f5dfe  
    179179  // TODO
    180180  ASSERT(false, "Not implemented yet");
     181}
     182
     183void QTDialog::queryFile(const char* title, std::string){
     184  registerQuery(new FileQTQuery(title,inputLayout,this));
    181185}
    182186
     
    622626}
    623627
     628QTDialog::FileQTQuery::FileQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog) :
     629    Dialog::FileQuery(_title),
     630    parent(_parent)
     631{
     632
     633  filenameLineEdit = new QLineEdit(_dialog);
     634  filenameLineEdit->setText(QString());
     635  filenameLineEdit->setReadOnly(true);
     636
     637  filedialogButton = new QPushButton("&Choose", _dialog);
     638
     639  pipe = new FileQTQueryPipe(tmp,_dialog,filenameLineEdit,filedialogButton);
     640
     641  thisLayout = new QHBoxLayout();
     642  parent->addLayout(thisLayout);
     643  thisLayout->addWidget(filenameLineEdit);
     644  thisLayout->addWidget(filedialogButton);
     645
     646  QObject::connect(filedialogButton,SIGNAL(clicked()),pipe,SLOT(showFileDialog()));
     647}
     648
     649QTDialog::FileQTQuery::~FileQTQuery()
     650{
     651  delete pipe;
     652}
     653
     654bool QTDialog::FileQTQuery::handle(){
     655  return true;
     656}
     657
    624658/*************************** Plumbing *******************************/
    625659
     
    862896}
    863897
    864 
     898FileQTQueryPipe::FileQTQueryPipe(const boost::filesystem::path &_content, QTDialog *_dialog, QLineEdit *_filenameLineEdit, QPushButton *_filedialogButton) :
     899  content(_content),
     900  dialog(_dialog),
     901  filenameLineEdit(_filenameLineEdit),
     902  filedialogButton(_filedialogButton)
     903{}
     904
     905FileQTQueryPipe::~FileQTQueryPipe()
     906{}
     907
     908void FileQTQueryPipe::update() {
     909  QStringList ListOfFilenames = theFileDialog->selectedFiles();
     910  std::cout << "Selected File is " << ListOfFilenames.at(0).toStdString() << std::endl;
     911  content = ListOfFilenames.at(0).toStdString();
     912  dialog->update();
     913}
     914
     915void FileQTQueryPipe::showFileDialog() {
     916  filedialogButton->setFlat(true);
     917  if (theFileDialog == NULL) {
     918    theFileDialog = new QFileDialog(NULL, tr("Open input file"), QString(), tr("ParallelCarParrinello (*.conf);;MassivelyParallelQuantumChemistry (*.mpqc);;ParticleDataBase (*.pdb);;XYZ (*.xyz)"));
     919    theFileDialog->setAcceptMode(QFileDialog::AcceptOpen);
     920    theFileDialog->setFileMode(QFileDialog::ExistingFile);
     921    theFileDialog->setViewMode(QFileDialog::List);
     922  }
     923  theFileDialog->show();
     924
     925  filenameLineEdit->setText(QString());
     926  filedialogButton->setFlat(false);
     927}
     928
     929
     930
  • src/UIElements/QT4/QTDialog.hpp

    re4decc r6f5dfe  
    1111#include "UIElements/Dialog.hpp"
    1212#include <QtGui/QDialog>
     13#include <QtGui/QFileDialog>
     14
     15#include <boost/filesystem.hpp>
    1316
    1417class QBoxLayout;
     
    3740class VectorQTQueryPipe;
    3841class VectorsQTQueryPipe;
     42class FileQTQueryPipe;
    3943
    4044class QTDialog : public QDialog, public Dialog
     
    6266  virtual void queryElement(const char*,std::string = "");
    6367  virtual void queryElements(const char*,std::string = "");
     68  virtual void queryFile(const char*,std::string = "");
    6469
    6570  virtual bool display();
     
    271276
    272277      ElementsQTQueryPipe *pipe;
     278    };
     279
     280    class FileQTQuery : public Dialog::FileQuery {
     281    public:
     282      FileQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog);
     283      virtual ~FileQTQuery();
     284      virtual bool handle();
     285    private:
     286      QBoxLayout *parent;
     287      QBoxLayout *thisLayout;
     288      QLineEdit *filenameLineEdit;
     289      QPushButton *filedialogButton;
     290
     291      FileQTQueryPipe *pipe;
    273292    };
    274293
     
    477496  QComboBox *theBox;
    478497};
     498
     499class FileQTQueryPipe : public QWidget {
     500  Q_OBJECT
     501public:
     502  FileQTQueryPipe(const boost::filesystem::path &_content, QTDialog *_dialog, QLineEdit *_filenameLineEdit, QPushButton *_filedialogButton);
     503  virtual ~FileQTQueryPipe();
     504
     505public slots:
     506  void update();
     507  void showFileDialog();
     508
     509private:
     510  boost::filesystem::path content;
     511  QTDialog *dialog;
     512  QLineEdit *filenameLineEdit;
     513  QPushButton *filedialogButton;
     514  QFileDialog *theFileDialog;
     515};
     516
    479517#endif /* QTDIALOG_HPP_ */
Note: See TracChangeset for help on using the changeset viewer.