Changeset a2ab15 for src


Ignore:
Timestamp:
May 8, 2010, 6:30:53 PM (15 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:
03bb99
Parents:
efc3cb
Message:

Extended UIFactory to a CommandLine derivate.

Signed-off-by: Frederik Heber <heber@…>

Location:
src
Files:
8 added
7 edited

Legend:

Unmodified
Added
Removed
  • src/Makefile.am

    refc3cb ra2ab15  
    124124UISOURCE = \
    125125  ${ACTIONSSOURCE} \
     126  ${COMMANDLINEUISOURCE} \
    126127  ${MENUSOURCE} \
    127128  ${TEXTUISOURCE} \
     
    133134UIHEADER = \
    134135  ${ACTIONSHEADER} \
     136  ${COMMANDLINEUIHEADER} \
    135137  ${MENUHEADER} \
    136138  ${TEXTUIHEADER} \
     
    150152  UIElements/TextUIFactory.hpp \
    151153  UIElements/TextWindow.hpp
     154
     155COMMANDLINEUISOURCE = \
     156  UIElements/CommandLineDialog.cpp \
     157  UIElements/CommandLineStatusIndicator.cpp \
     158  UIElements/CommandLineUIFactory.cpp \
     159  UIElements/CommandLineWindow.cpp
     160COMMANDLINEUIHEADER = \
     161  UIElements/CommandLineDialog.hpp \
     162  UIElements/CommandLineStatusIndicator.hpp \
     163  UIElements/CommandLineUIFactory.hpp \
     164  UIElements/CommandLineWindow.hpp
    152165
    153166# all these files are only used for legacy reasons while the transition is in progress
  • src/UIElements/Dialog.cpp

    refc3cb ra2ab15  
    5151
    5252// Base class
    53 Dialog::Query::Query(string _title) :
    54     title(_title)
     53Dialog::Query::Query(string _title, string _description) :
     54    title(_title),
     55    description(_description)
    5556{}
    5657
     
    6162}
    6263
     64const std::string Dialog::Query::getDescription() const{
     65  return description;
     66}
    6367// Int Queries
    6468
    65 Dialog::IntQuery::IntQuery(string title,int *_target) :
    66     Query(title), target(_target)
     69Dialog::IntQuery::IntQuery(string title,int *_target, std::string description) :
     70    Query(title, description), target(_target)
    6771{}
    6872
     
    7579// String Queries
    7680
    77 Dialog::StringQuery::StringQuery(string title,string *_target) :
    78     Query(title), target(_target)
     81Dialog::StringQuery::StringQuery(string title,string *_target, std::string _description) :
     82    Query(title, _description), target(_target)
    7983{}
    8084
     
    8791// Double Queries
    8892
    89 Dialog::DoubleQuery::DoubleQuery(string title,double *_target) :
    90     Query(title), target(_target)
     93Dialog::DoubleQuery::DoubleQuery(string title,double *_target, std::string _description) :
     94    Query(title, _description), target(_target)
    9195{}
    9296
     
    100104// Molecule Queries
    101105
    102 Dialog::MoleculeQuery::MoleculeQuery(string title, molecule **_target, MoleculeListClass *_molecules) :
    103     Query(title),
     106Dialog::MoleculeQuery::MoleculeQuery(string title, molecule **_target, MoleculeListClass *_molecules, std::string _description) :
     107    Query(title, _description),
    104108    tmp(0),
    105109    molecules(_molecules),
     
    116120// Vector Queries
    117121
    118 Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check) :
    119   Query(title),
     122Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description) :
     123  Query(title, _description),
    120124  cellSize(_cellSize),
    121125  check(_check),
     
    135139
    136140// Element Queries
    137 Dialog::ElementQuery::ElementQuery(std::string title, const element **_target) :
    138   Query(title),
     141Dialog::ElementQuery::ElementQuery(std::string title, const element **_target, std::string _description) :
     142  Query(title, _description),
    139143  tmp(0),
    140144  target(_target)
  • src/UIElements/Dialog.hpp

    refc3cb ra2ab15  
    2323  virtual ~Dialog();
    2424
    25   virtual void queryInt(const char *, int *)=0;
    26   virtual void queryDouble(const char*,double *)=0;
    27   virtual void queryString(const char*, std::string *)=0;
    28   virtual void queryMolecule(const char*,molecule**,MoleculeListClass*)=0;
    29   virtual void queryVector(const char*,Vector *,const double *const,bool)=0;
    30   virtual void queryElement(const char*,const element **)=0;
     25  virtual void queryInt(const char *, int *, std::string = "")=0;
     26  virtual void queryDouble(const char*,double *, std::string = "")=0;
     27  virtual void queryString(const char*, std::string *, std::string = "")=0;
     28  virtual void queryMolecule(const char*,molecule**,MoleculeListClass*, std::string = "")=0;
     29  virtual void queryVector(const char*,Vector *,const double *const,bool, std::string = "")=0;
     30  virtual void queryElement(const char*,const element **, std::string = "")=0;
    3131
    3232  virtual bool display();
     
    4646  class Query {
    4747  public:
    48     Query(std::string _title);
     48    Query(std::string _title, std::string _description = "");
    4949    virtual ~Query();
    5050    virtual bool handle()=0;
     
    5252  protected:
    5353    const std::string getTitle() const;
     54    const std::string getDescription() const;
    5455  private:
    55     std::string title;
     56    std::string title;  //!< short title of the query
     57    std::string description; //!< longer description for tooltips or for help
    5658  };
    5759
     
    5961  class IntQuery : public Query {
    6062  public:
    61     IntQuery(std::string title,int *_target);
     63    IntQuery(std::string title,int *_target, std::string _description = "");
    6264    virtual ~IntQuery();
    6365    virtual bool handle()=0;
     
    7173  class DoubleQuery : public Query {
    7274  public:
    73     DoubleQuery(std::string title,double *_target);
     75    DoubleQuery(std::string title,double *_target, std::string _description = "");
    7476    virtual ~DoubleQuery();
    7577    virtual bool handle()=0;
     
    8385  class StringQuery : public Query {
    8486  public:
    85     StringQuery(std::string title,std::string *_target);
     87    StringQuery(std::string title,std::string *_target, std::string _description = "");
    8688    virtual ~StringQuery();
    8789    virtual bool handle()=0;
     
    9698  class MoleculeQuery : public Query {
    9799  public:
    98     MoleculeQuery(std::string title, molecule **_target, MoleculeListClass *_molecules);
     100    MoleculeQuery(std::string title, molecule **_target, MoleculeListClass *_molecules, std::string _description = "");
    99101    virtual ~MoleculeQuery();
    100102    virtual bool handle()=0;
     
    109111  class VectorQuery : public Query {
    110112  public:
    111       VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check);
     113      VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description = "");
    112114      virtual ~VectorQuery();
    113115      virtual bool handle()=0;
     
    123125  class ElementQuery : public Query {
    124126  public:
    125     ElementQuery(std::string title, const element**_target);
     127    ElementQuery(std::string title, const element**_target, std::string _description = "");
    126128    virtual ~ElementQuery();
    127129    virtual bool handle()=0;
     
    140142};
    141143
     144
    142145#endif /* DIALOG_HPP_ */
  • src/UIElements/TextDialog.cpp

    refc3cb ra2ab15  
    2929
    3030
    31 void TextDialog::queryInt(const char* title, int* target){
    32   registerQuery(new IntTextQuery(title,target));
    33 }
    34 
    35 void TextDialog::queryDouble(const char* title, double* target){
    36   registerQuery(new DoubleTextQuery(title,target));
    37 }
    38 
    39 void TextDialog::queryString(const char* title, string* target){
    40   registerQuery(new StringTextQuery(title,target));
    41 }
    42 
    43 void TextDialog::queryMolecule(const char* title, molecule **target, MoleculeListClass *molecules) {
    44   registerQuery(new MoleculeTextQuery(title,target,molecules));
    45 }
    46 
    47 void TextDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check) {
    48   registerQuery(new VectorTextQuery(title,target,cellSize,check));
    49 }
    50 
    51 void TextDialog::queryElement(const char* title, const element **target){
    52   registerQuery(new ElementTextQuery(title,target));
     31void TextDialog::queryInt(const char* title, int* target, string description){
     32  registerQuery(new IntTextQuery(title,target,description));
     33}
     34
     35void TextDialog::queryDouble(const char* title, double* target, string description){
     36  registerQuery(new DoubleTextQuery(title,target,description));
     37}
     38
     39void TextDialog::queryString(const char* title, string* target, string description){
     40  registerQuery(new StringTextQuery(title,target,description));
     41}
     42
     43void TextDialog::queryMolecule(const char* title, molecule **target, MoleculeListClass *molecules, string description) {
     44  registerQuery(new MoleculeTextQuery(title,target,molecules,description));
     45}
     46
     47void TextDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check, string description) {
     48  registerQuery(new VectorTextQuery(title,target,cellSize,check,description));
     49}
     50
     51void TextDialog::queryElement(const char* title, const element **target, string description){
     52  registerQuery(new ElementTextQuery(title,target,description));
    5353}
    5454
    5555/************************** Query Infrastructure ************************/
    5656
    57 TextDialog::IntTextQuery::IntTextQuery(string title,int *_target) :
    58     Dialog::IntQuery(title,_target)
     57TextDialog::IntTextQuery::IntTextQuery(string title,int *_target, std::string _description) :
     58    Dialog::IntQuery(title,_target,_description)
    5959{}
    6060
     
    7979}
    8080
    81 TextDialog::StringTextQuery::StringTextQuery(string title,string *_target) :
    82     Dialog::StringQuery(title,_target)
     81TextDialog::StringTextQuery::StringTextQuery(string title,string *_target, std::string _description) :
     82    Dialog::StringQuery(title,_target,_description)
    8383{}
    8484
     
    9191}
    9292
    93 TextDialog::DoubleTextQuery::DoubleTextQuery(string title,double *_target) :
    94     Dialog::DoubleQuery(title,_target)
     93TextDialog::DoubleTextQuery::DoubleTextQuery(string title,double *_target, std::string _description) :
     94    Dialog::DoubleQuery(title,_target,_description)
    9595{}
    9696
     
    114114}
    115115
    116 TextDialog::MoleculeTextQuery::MoleculeTextQuery(string title, molecule **_target, MoleculeListClass *_molecules) :
    117     Dialog::MoleculeQuery(title,_target,_molecules)
     116TextDialog::MoleculeTextQuery::MoleculeTextQuery(string title, molecule **_target, MoleculeListClass *_molecules, std::string _description) :
     117    Dialog::MoleculeQuery(title,_target,_molecules,_description)
    118118{}
    119119
     
    146146}
    147147
    148 TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, const double *const _cellSize, bool _check) :
    149     Dialog::VectorQuery(title,_target,_cellSize,_check)
     148TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, const double *const _cellSize, bool _check, std::string _description) :
     149    Dialog::VectorQuery(title,_target,_cellSize,_check,_description)
    150150{}
    151151
     
    169169
    170170
    171 TextDialog::ElementTextQuery::ElementTextQuery(std::string title, const element **target) :
    172     Dialog::ElementQuery(title,target)
     171TextDialog::ElementTextQuery::ElementTextQuery(std::string title, const element **target, std::string _description) :
     172    Dialog::ElementQuery(title,target,_description)
    173173{}
    174174
  • src/UIElements/TextDialog.hpp

    refc3cb ra2ab15  
    1919  virtual ~TextDialog();
    2020
    21   virtual void queryInt(const char *, int *);
    22   virtual void queryString(const char*, std::string *);
    23   virtual void queryDouble(const char*, double*);
    24   virtual void queryMolecule(const char*,molecule**,MoleculeListClass*);
    25   virtual void queryVector(const char*,Vector *,const double * const,bool);
    26   virtual void queryElement(const char*,const element **);
     21  virtual void queryInt(const char *, int *, std::string = "");
     22  virtual void queryString(const char*, std::string *, std::string = "");
     23  virtual void queryDouble(const char*, double*, std::string = "");
     24  virtual void queryMolecule(const char*,molecule**,MoleculeListClass*, std::string = "");
     25  virtual void queryVector(const char*,Vector *,const double * const,bool, std::string = "");
     26  virtual void queryElement(const char*,const element **, std::string = "");
    2727
    2828protected:
     
    3030  class IntTextQuery : public Dialog::IntQuery {
    3131  public:
    32     IntTextQuery(std::string title, int *_target);
     32    IntTextQuery(std::string title, int *_target, std::string _description = NULL);
    3333    virtual ~IntTextQuery();
    3434    virtual bool handle();
     
    3737  class DoubleTextQuery : public Dialog::DoubleQuery {
    3838  public:
    39     DoubleTextQuery(std::string title, double *_target);
     39    DoubleTextQuery(std::string title, double *_target, std::string _description = NULL);
    4040    virtual ~DoubleTextQuery();
    4141    virtual bool handle();
     
    4444  class StringTextQuery : public Dialog::StringQuery {
    4545  public:
    46     StringTextQuery(std::string title, std::string *_target);
     46    StringTextQuery(std::string title, std::string *_target, std::string _description = NULL);
    4747    virtual ~StringTextQuery();
    4848    virtual bool handle();
     
    5151  class MoleculeTextQuery : public Dialog::MoleculeQuery {
    5252  public:
    53     MoleculeTextQuery(std::string title, molecule **_target, MoleculeListClass *_molecules);
     53    MoleculeTextQuery(std::string title, molecule **_target, MoleculeListClass *_molecules, std::string _description = NULL);
    5454    virtual ~MoleculeTextQuery();
    5555    virtual bool handle();
     
    5858  class VectorTextQuery : public Dialog::VectorQuery {
    5959  public:
    60     VectorTextQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check);
     60    VectorTextQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description = NULL);
    6161    virtual ~VectorTextQuery();
    6262    virtual bool handle();
     
    6565  class ElementTextQuery : public Dialog::ElementQuery {
    6666  public:
    67     ElementTextQuery(std::string title, const element **_target);
     67    ElementTextQuery(std::string title, const element **_target, std::string _description = NULL);
    6868    virtual ~ElementTextQuery();
    6969    virtual bool handle();
  • src/UIElements/UIFactory.cpp

    refc3cb ra2ab15  
    1313// all factories that can be used:
    1414#include "UIElements/TextUIFactory.hpp"
     15#include "UIElements/CommandLineUIFactory.hpp"
    1516
    1617UIFactory::UIFactory()
     
    3031      setInstance(new TextUIFactory());
    3132      break;
     33    case CommandLine:
     34      setInstance(new CommandLineUIFactory());
     35      break;
    3236
    3337    default:
  • src/UIElements/UIFactory.hpp

    refc3cb ra2ab15  
    1111class MainWindow;
    1212class Dialog;
     13class DialogDescription;
    1314
    1415class MoleculeListClass;
     
    3132
    3233public:
    33   enum InterfaceTypes {Text};
     34  enum InterfaceTypes {Text, CommandLine};
    3435  virtual ~UIFactory();
    3536
Note: See TracChangeset for help on using the changeset viewer.