Changeset 257c77 for src/UIElements


Ignore:
Timestamp:
Jun 17, 2010, 2:55:56 PM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
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:
b47bfc
Parents:
992fd7 (diff), 5f5a7b (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 'stable' into QT4Refactoring

Conflicts:

molecuilder/src/Actions/TesselationAction/ConvexEnvelopeAction.hpp
molecuilder/src/Helpers/MemDebug.hpp
molecuilder/src/Makefile.am
molecuilder/src/UIElements/Dialog.cpp
molecuilder/src/UIElements/MainWindow.cpp
molecuilder/src/UIElements/TextUI/TextUIFactory.cpp
molecuilder/src/builder.cpp

Location:
src/UIElements
Files:
11 added
2 deleted
12 edited
28 moved

Legend:

Unmodified
Added
Removed
  • src/UIElements/Dialog.cpp

    r992fd7 r257c77  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
     9
    810#include <cassert>
    911
    10 #include "UIElements/Dialog.hpp"
    11 
     12#include "Dialog.hpp"
     13
     14#include "atom.hpp"
     15#include "element.hpp"
     16#include "molecule.hpp"
    1217#include "vector.hpp"
    1318
     
    4651    retval &= (*iter)->handle();
    4752    // if any query fails (is canceled), we can end the handling process
    48     if(!retval)
     53    if(!retval) {
     54      DoeLog(1) && (eLog() << Verbose(1) << "The following query failed: " << (**iter).getTitle() << "." << endl);
    4955      break;
     56    }
    5057  }
    5158  return retval;
     
    6269
    6370// Base class
    64 Dialog::Query::Query(string _title) :
    65     title(_title)
     71Dialog::Query::Query(string _title, string _description) :
     72    title(_title),
     73    description(_description)
    6674{}
    6775
     
    7280}
    7381
     82const std::string Dialog::Query::getDescription() const{
     83  return description;
     84}
     85// empty Queries
     86
     87Dialog::EmptyQuery::EmptyQuery(string title, std::string description) :
     88    Query(title, description)
     89{}
     90
     91Dialog::EmptyQuery::~EmptyQuery() {}
     92
     93void Dialog::EmptyQuery::setResult() {
     94}
     95
    7496// Int Queries
    7597
    76 Dialog::IntQuery::IntQuery(string title,int *_target) :
    77     Query(title), target(_target)
     98Dialog::IntQuery::IntQuery(string title,int *_target, std::string description) :
     99    Query(title, description), target(_target)
    78100{}
    79101
     
    84106}
    85107
     108// Int Queries
     109
     110Dialog::BooleanQuery::BooleanQuery(string title,bool *_target, std::string description) :
     111    Query(title, description), target(_target)
     112{}
     113
     114Dialog::BooleanQuery::~BooleanQuery() {}
     115
     116void Dialog::BooleanQuery::setResult() {
     117  *target = tmp;
     118}
     119
    86120// String Queries
    87121
    88 Dialog::StringQuery::StringQuery(string title,string *_target) :
    89     Query(title),
    90     target(_target),
    91     tmp("")
     122Dialog::StringQuery::StringQuery(string title,string *_target, std::string _description) :
     123    Query(title, _description), target(_target)
    92124{}
    93125
     
    100132// Double Queries
    101133
    102 Dialog::DoubleQuery::DoubleQuery(string title,double *_target) :
    103     Query(title), target(_target)
     134Dialog::DoubleQuery::DoubleQuery(string title,double *_target, std::string _description) :
     135    Query(title, _description), target(_target)
    104136{}
    105137
     
    111143
    112144
     145// Atom Queries
     146
     147Dialog::AtomQuery::AtomQuery(string title, atom **_target, std::string _description) :
     148    Query(title, _description),
     149    tmp(0),
     150    target(_target)
     151
     152{}
     153
     154Dialog::AtomQuery::~AtomQuery() {}
     155
     156void Dialog::AtomQuery::setResult() {
     157  *target = tmp;
     158}
     159
    113160// Molecule Queries
    114161
    115 Dialog::MoleculeQuery::MoleculeQuery(string title, molecule **_target, MoleculeListClass *_molecules) :
    116     Query(title),
     162Dialog::MoleculeQuery::MoleculeQuery(string title, molecule **_target, std::string _description) :
     163    Query(title, _description),
    117164    tmp(0),
    118     molecules(_molecules),
    119165    target(_target)
    120166
     
    129175// Vector Queries
    130176
    131 Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check) :
    132   Query(title),
     177Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description) :
     178  Query(title, _description),
    133179  cellSize(_cellSize),
    134180  check(_check),
    135181  target(_target)
    136182{
    137 tmp = new Vector();
     183  tmp = new Vector();
    138184}
    139185
     
    147193}
    148194
     195// Box Queries
     196
     197Dialog::BoxQuery::BoxQuery(std::string title, double ** const _cellSize, std::string _description) :
     198  Query(title, _description),
     199  target(_cellSize)
     200{
     201    tmp = new double[6];
     202}
     203
     204Dialog::BoxQuery::~BoxQuery()
     205{
     206  delete[] tmp;
     207}
     208
     209void Dialog::BoxQuery::setResult() {
     210  for (int i=0;i<6;i++) {
     211    (*target)[i] = tmp[i];
     212  }
     213}
     214
    149215// Element Queries
    150 Dialog::ElementQuery::ElementQuery(std::string title, const element **_target) :
    151   Query(title),
    152   tmp(0),
     216Dialog::ElementQuery::ElementQuery(std::string title, std::vector<element *> *_target, std::string _description) :
     217  Query(title, _description),
    153218  target(_target)
    154219  {}
     
    157222
    158223void Dialog::ElementQuery::setResult(){
    159   *target=tmp;
    160 }
     224  *target=elements;
     225}
  • src/UIElements/Dialog.hpp

    r992fd7 r257c77  
    1111#include<string>
    1212#include<list>
     13#include<vector>
    1314
    14 class MoleculeListClass;
     15class atom;
     16class element;
    1517class molecule;
    1618class Vector;
    17 class element;
    1819
    1920class Dialog
     
    2324  virtual ~Dialog();
    2425
    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;
     26  virtual void queryEmpty(const char *, std::string = "")=0;
     27  virtual void queryBoolean(const char *, bool *, std::string = "")=0;
     28  virtual void queryInt(const char *, int *, std::string = "")=0;
     29  virtual void queryDouble(const char*,double *, std::string = "")=0;
     30  virtual void queryString(const char*, std::string *, std::string = "")=0;
     31  virtual void queryAtom(const char*,atom**,std::string = "")=0;
     32  virtual void queryMolecule(const char*,molecule**, std::string = "")=0;
     33  virtual void queryVector(const char*,Vector *,const double *const,bool, std::string = "")=0;
     34  virtual void queryBox(const char*,double ** const, std::string = "")=0;
     35  virtual void queryElement(const char*, std::vector<element *> *, std::string = "")=0;
    3136
    3237  virtual bool display();
     
    4853  //base class for all queries
    4954  class Query {
     55    friend class Dialog;
    5056  public:
    51     Query(std::string _title);
     57    Query(std::string _title, std::string _description = "");
    5258    virtual ~Query();
    5359    virtual bool handle()=0;
     
    5561  protected:
    5662    const std::string getTitle() const;
     63    const std::string getDescription() const;
    5764  private:
    58     std::string title;
     65    std::string title;  //!< short title of the query
     66    std::string description; //!< longer description for tooltips or for help
     67  };
     68
     69  // Empty Query is just meant for showing text, such as version, help, initial message or alike
     70  class EmptyQuery : public Query {
     71  public:
     72    EmptyQuery(std::string title, std::string _description = "");
     73    virtual ~EmptyQuery();
     74    virtual bool handle()=0;
     75    virtual void setResult();
    5976  };
    6077
    6178  //Specialized classes for certain types. GUI-Types are not specialized at this time
     79  class BooleanQuery : public Query {
     80  public:
     81    BooleanQuery(std::string title,bool *_target, std::string _description = "");
     82    virtual ~BooleanQuery();
     83    virtual bool handle()=0;
     84    virtual void setResult();
     85  protected:
     86    bool tmp;
     87  private:
     88    bool *target;
     89  };
     90
    6291  class IntQuery : public Query {
    6392  public:
    64     IntQuery(std::string title,int *_target);
     93    IntQuery(std::string title,int *_target, std::string _description = "");
    6594    virtual ~IntQuery();
    6695    virtual bool handle()=0;
     
    74103  class DoubleQuery : public Query {
    75104  public:
    76     DoubleQuery(std::string title,double *_target);
     105    DoubleQuery(std::string title,double *_target, std::string _description = "");
    77106    virtual ~DoubleQuery();
    78107    virtual bool handle()=0;
     
    86115  class StringQuery : public Query {
    87116  public:
    88     StringQuery(std::string title,std::string *_target);
     117    StringQuery(std::string title,std::string *_target, std::string _description = "");
    89118    virtual ~StringQuery();
    90119    virtual bool handle()=0;
     
    96125  };
    97126
    98 
    99127  class MoleculeQuery : public Query {
    100128  public:
    101     MoleculeQuery(std::string title, molecule **_target, MoleculeListClass *_molecules);
     129    MoleculeQuery(std::string title, molecule **_target, std::string _description = "");
    102130    virtual ~MoleculeQuery();
    103131    virtual bool handle()=0;
     
    105133  protected:
    106134    molecule *tmp;
    107     MoleculeListClass *molecules;
    108135  private:
    109136    molecule **target;
    110137  };
    111138
     139  class AtomQuery : public Query {
     140  public:
     141    AtomQuery(std::string title, atom **_target, std::string _description = "");
     142    virtual ~AtomQuery();
     143    virtual bool handle()=0;
     144    virtual void setResult();
     145  protected:
     146    atom *tmp;
     147  private:
     148    atom **target;
     149  };
     150
    112151  class VectorQuery : public Query {
    113152  public:
    114       VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check);
     153      VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description = "");
    115154      virtual ~VectorQuery();
    116155      virtual bool handle()=0;
     
    124163  };
    125164
     165  class BoxQuery : public Query {
     166  public:
     167      BoxQuery(std::string title,double ** const _cellSize, std::string _description = "");
     168      virtual ~BoxQuery();
     169      virtual bool handle()=0;
     170      virtual void setResult();
     171    protected:
     172      double *tmp;
     173    private:
     174      double **target;
     175  };
     176
    126177  class ElementQuery : public Query {
    127178  public:
    128     ElementQuery(std::string title, const element**_target);
     179    ElementQuery(std::string title, std::vector<element *> *_target, std::string _description = "");
    129180    virtual ~ElementQuery();
    130181    virtual bool handle()=0;
    131182    virtual void setResult();
    132183  protected:
    133     const element *tmp;
     184    std::vector<element *> elements;
    134185  private:
    135     const element **target;
     186    std::vector<element *> * const target;
    136187  };
    137188
     
    143194};
    144195
     196
    145197#endif /* DIALOG_HPP_ */
  • src/UIElements/MainWindow.cpp

    r992fd7 r257c77  
    66 */
    77
    8 #include "UIElements/MainWindow.hpp"
    98#include "Helpers/MemDebug.hpp"
     9
     10#include "MainWindow.hpp"
    1011
    1112MainWindow::MainWindow()
  • src/UIElements/MainWindow.hpp

    r992fd7 r257c77  
    2525};
    2626
    27 /**
    28  * The type of menuPopulators
    29  */
    30 typedef void (*MenuMaker)(Menu*,MoleculeListClass*, config*, periodentafel*);
    31 
    32 /**
    33  * This contains all Functions that are used to create the menus.
    34  * Needs a specific funtion for each menu. All populators will be called
    35  * by the UIFactory upon creation of the main menu. Thus the actuall construction
    36  * of the Menus can be kept independent of the concrete type of UI that is being
    37  * built.
    38  */
    39 struct menuPopulaters{
    40   MenuMaker MakeEditMoleculesMenu;
    41 };
    4227
    4328#endif /* MAINWINDOW_HPP_ */
  • src/UIElements/Menu/ActionMenuItem.cpp

    r992fd7 r257c77  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <iostream>
  • src/UIElements/Menu/DisplayMenuItem.cpp

    r992fd7 r257c77  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <sstream>
  • src/UIElements/Menu/Menu.cpp

    r992fd7 r257c77  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "Menu.hpp"
  • src/UIElements/Menu/MenuItem.cpp

    r992fd7 r257c77  
    66 */
    77
    8 
     8#include "Helpers/MemDebug.hpp"
    99
    1010#include "Menu/MenuItem.hpp"
  • src/UIElements/Menu/SeperatorItem.cpp

    r992fd7 r257c77  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
     9
    710#include <string>
    811#include <sstream>
  • src/UIElements/Menu/SubMenuItem.cpp

    r992fd7 r257c77  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "SubMenuItem.hpp"
  • src/UIElements/Menu/TextMenu.cpp

    r992fd7 r257c77  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <boost/bind.hpp>
  • src/UIElements/QT4/QTDialog.cpp

    r992fd7 r257c77  
    2121#include <Qt/qcombobox.h>
    2222
     23#include "Helpers/MemDebug.hpp"
     24
    2325#include "World.hpp"
    2426#include "periodentafel.hpp"
     
    2628#include "element.hpp"
    2729#include "molecule.hpp"
    28 #include "Helpers/MemDebug.hpp"
     30#include "Descriptors/MoleculeIdDescriptor.hpp"
    2931
    3032
     
    7678/************************** Query Infrastructure ************************/
    7779
    78 void QTDialog::queryInt(const char *title, int *target)
     80void QTDialog::queryEmpty(char const*, string){
     81  // TODO
     82  ASSERT(false, "Not implemented yet");
     83}
     84
     85void QTDialog::queryBoolean(char const*, bool*,string){
     86  // TODO
     87  ASSERT(false, "Not implemented yet");
     88}
     89
     90void QTDialog::queryAtom(char const*, atom**, string){
     91  // TODO
     92  ASSERT(false, "Not implemented yet");
     93}
     94
     95void QTDialog::queryBox(char const*, double**, string){
     96  // TODO
     97  ASSERT(false, "Not implemented yet");
     98}
     99
     100
     101void QTDialog::queryInt(const char *title, int *target,string)
    79102{
    80103  registerQuery(new IntQTQuery(title,target,inputLayout,this));
    81104}
    82105
    83 void QTDialog::queryDouble(const char* title, double* target){
     106void QTDialog::queryDouble(const char* title, double* target,string){
    84107  registerQuery(new DoubleQTQuery(title,target,inputLayout,this));
    85108}
    86109
    87 void QTDialog::queryString(const char* title, std::string *target)
     110void QTDialog::queryString(const char* title, std::string *target,string)
    88111{
    89112  registerQuery(new StringQTQuery(title,target,inputLayout,this));
    90113}
    91114
    92 void QTDialog::queryMolecule(const char *title,molecule **target,MoleculeListClass *molecules)
    93 {
    94   registerQuery(new MoleculeQTQuery(title,target,molecules,inputLayout,this));
    95 }
    96 
    97 void QTDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check) {
     115void QTDialog::queryMolecule(const char *title,molecule **target,string)
     116{
     117  registerQuery(new MoleculeQTQuery(title,target,inputLayout,this));
     118}
     119
     120void QTDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check,string) {
    98121  registerQuery(new VectorQTQuery(title,target,cellSize,check,inputLayout,this));
    99122}
    100123
    101 void QTDialog::queryElement(const char* title, const element **target){
     124void QTDialog::queryElement(const char* title, std::vector<element *> *target,string){
    102125  registerQuery(new ElementQTQuery(title,target,inputLayout,this));
    103126}
     
    189212}
    190213
    191 QTDialog::MoleculeQTQuery::MoleculeQTQuery(string _title, molecule **_target, MoleculeListClass *_molecules, QBoxLayout *_parent,QTDialog *_dialog) :
    192     Dialog::MoleculeQuery(_title,_target,_molecules),
    193     parent(_parent)
    194 {
    195   MoleculeList::iterator iter;
     214QTDialog::MoleculeQTQuery::MoleculeQTQuery(string _title, molecule **_target, QBoxLayout *_parent,QTDialog *_dialog) :
     215    Dialog::MoleculeQuery(_title,_target),
     216    parent(_parent)
     217{
    196218  thisLayout = new QHBoxLayout();
    197219  titleLabel = new QLabel(QString(getTitle().c_str()));
    198220  inputBox = new QComboBox();
    199221  // add all molecules to the combo box
    200   for(iter  = molecules->ListOfMolecules.begin();
    201       iter != molecules->ListOfMolecules.end();
     222  vector<molecule*> molecules = World::getInstance().getAllMolecules();
     223  for(vector<molecule*>::iterator iter  = molecules.begin();
     224      iter != molecules.end();
    202225      ++iter) {
    203226    stringstream sstr;
     
    209232  thisLayout->addWidget(inputBox);
    210233
    211   pipe = new MoleculeQTQueryPipe(&tmp,_dialog,inputBox,_molecules);
     234  pipe = new MoleculeQTQueryPipe(&tmp,_dialog,inputBox);
    212235  pipe->update(inputBox->currentIndex());
    213236  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
     
    263286
    264287
    265 QTDialog::ElementQTQuery::ElementQTQuery(std::string _title, const element **_target, QBoxLayout *_parent, QTDialog *_dialog) :
     288QTDialog::ElementQTQuery::ElementQTQuery(std::string _title, vector<element *> *_target, QBoxLayout *_parent, QTDialog *_dialog) :
    266289    Dialog::ElementQuery(_title,_target),
    267290    parent(_parent)
     
    283306  thisLayout->addWidget(inputBox);
    284307
    285   pipe = new ElementQTQueryPipe(&tmp,_dialog,inputBox);
     308  pipe = new ElementQTQueryPipe(&elements,_dialog,inputBox);
    286309  pipe->update(inputBox->currentIndex());
    287310  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
     
    338361}
    339362
    340 MoleculeQTQueryPipe::MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox, MoleculeListClass *_molecules) :
     363MoleculeQTQueryPipe::MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox) :
    341364  content(_content),
    342365  dialog(_dialog),
    343   theBox(_theBox),
    344   molecules(_molecules)
     366  theBox(_theBox)
    345367{}
    346368
     
    351373  QVariant data = theBox->itemData(newIndex);
    352374  int idx = data.toInt();
    353   (*content) = molecules->ReturnIndex(idx);
    354   dialog->update();
    355 }
    356 
    357 ElementQTQueryPipe::ElementQTQueryPipe(const element **_content, QTDialog *_dialog, QComboBox *_theBox) :
     375  (*content) = World::getInstance().getMolecule(MoleculeById(idx));
     376  dialog->update();
     377}
     378
     379ElementQTQueryPipe::ElementQTQueryPipe(std::vector<element *> *_content, QTDialog *_dialog, QComboBox *_theBox) :
    358380  content(_content),
    359381  dialog(_dialog),
    360382  theBox(_theBox)
    361 {}
     383{
     384  content->resize(1);
     385}
    362386
    363387ElementQTQueryPipe::~ElementQTQueryPipe()
     
    367391  QVariant data = theBox->itemData(newIndex);
    368392  int idx = data.toInt();
    369   (*content) = World::getInstance().getPeriode()->FindElement(idx);
    370   dialog->update();
    371 }
    372 
     393  (*content)[0] = World::getInstance().getPeriode()->FindElement(idx);
     394  dialog->update();
     395}
     396
  • src/UIElements/QT4/QTDialog.hpp

    r992fd7 r257c77  
    3535  virtual ~QTDialog();
    3636
    37   virtual void queryInt(const char *, int *);
    38   virtual void queryString(const char*, std::string *);
    39   virtual void queryDouble(const char*,double *);
    40   virtual void queryMolecule(const char*,molecule**,MoleculeListClass*);
    41   virtual void queryVector(const char*,Vector *,const double *const,bool);
    42   virtual void queryElement(const char*,const element **);
     37  virtual void queryEmpty(const char*, std::string);
     38  virtual void queryBoolean(const char *, bool *, std::string = "");
     39  virtual void queryInt(const char *, int *,std::string = "");
     40  virtual void queryDouble(const char*,double *,std::string = "");
     41  virtual void queryString(const char*, std::string *,std::string = "");
     42  virtual void queryAtom(const char*,atom**,std::string = "");
     43  virtual void queryMolecule(const char*,molecule**,std::string = "");
     44  virtual void queryVector(const char*,Vector *,const double *const,bool,std::string = "");
     45  virtual void queryBox(const char*,double ** const, std::string = "");
     46  virtual void queryElement(const char*,std::vector<element *> *_target,std::string = "");
    4347
    4448  virtual bool display();
     
    9195    class MoleculeQTQuery : public Dialog::MoleculeQuery {
    9296    public:
    93       MoleculeQTQuery(std::string _title, molecule **_target, MoleculeListClass *_molecules, QBoxLayout *_parent,QTDialog *_dialog);
     97      MoleculeQTQuery(std::string _title, molecule **_target, QBoxLayout *_parent,QTDialog *_dialog);
    9498      virtual ~MoleculeQTQuery();
    9599      virtual bool handle();
     
    122126    class ElementQTQuery : public Dialog::ElementQuery {
    123127    public:
    124       ElementQTQuery(std::string _title, const element **_target, QBoxLayout *_parent, QTDialog *_dialog);
     128      ElementQTQuery(std::string _title, std::vector<element *> *_target, QBoxLayout *_parent, QTDialog *_dialog);
    125129      virtual ~ElementQTQuery();
    126130      virtual bool handle();
     
    193197  Q_OBJECT
    194198public:
    195   MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox, MoleculeListClass *_molecules);
     199  MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox);
    196200  virtual ~MoleculeQTQueryPipe();
    197201
     
    201205private:
    202206  molecule **content;
    203   MoleculeListClass *molecules;
    204207  QTDialog *dialog;
    205208  QComboBox *theBox;
     
    210213  Q_OBJECT
    211214public:
    212   ElementQTQueryPipe(const element **_content, QTDialog *_dialog, QComboBox *_theBox);
     215  ElementQTQueryPipe(std::vector<element *> *_content, QTDialog *_dialog, QComboBox *_theBox);
    213216  virtual ~ElementQTQueryPipe();
    214217
     
    217220
    218221private:
    219   const element **content;
     222  std::vector<element *> *content;
    220223  QTDialog *dialog;
    221224  QComboBox *theBox;
  • src/UIElements/QT4/QTMainWindow.cpp

    r992fd7 r257c77  
    2929using namespace std;
    3030
    31 QTMainWindow::QTMainWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName,QApplication *_theApp) :
     31QTMainWindow::QTMainWindow(QApplication *_theApp) :
    3232    theApp(_theApp)
    3333{
     
    3535  QSplitter *splitter2 = new QSplitter (Qt::Vertical, splitter1 );
    3636
    37   worldDisplay = new QTWorldView(molecules,splitter2);
     37  worldDisplay = new QTWorldView(splitter2);
    3838
    3939  moleculeDisplay = new QTMoleculeView();
     
    4848  statusBar = new QTStatusBar(this);
    4949  setStatusBar(statusBar);
    50 
    51   editMoleculesMenu = new QTMenu("Edit Molecules");
    52   populaters.MakeEditMoleculesMenu(editMoleculesMenu,molecules,configuration,periode);
    53   menuBar()->addMenu(editMoleculesMenu);
    5450
    5551  connect(worldDisplay,SIGNAL(moleculeSelected(molecule*)),moleculeDisplay,SLOT(moleculeSelected(molecule*)));
  • src/UIElements/QT4/QTMainWindow.hpp

    r992fd7 r257c77  
    2424
    2525public:
    26   QTMainWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration,
    27                periodentafel *periode, char *ConfigFileName, QApplication *_theApp);
     26  QTMainWindow(QApplication *_theApp);
    2827  virtual ~QTMainWindow();
    2928
  • src/UIElements/QT4/QTUIFactory.cpp

    r992fd7 r257c77  
    4141}
    4242
    43 MainWindow* QTUIFactory::makeMainWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName) {
    44   return new QTMainWindow(populaters,molecules,configuration,periode,ConfigFileName,app);
     43MainWindow* QTUIFactory::makeMainWindow() {
     44  return new QTMainWindow(app);
    4545}
    4646
  • src/UIElements/QT4/QTUIFactory.hpp

    r992fd7 r257c77  
    2121
    2222  virtual Dialog* makeDialog();
    23   virtual MainWindow* makeMainWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *);
     23  virtual MainWindow* makeMainWindow();
    2424
    2525  struct description : public UIFactory::factoryDescription {
  • src/UIElements/TextUI/TextStatusIndicator.cpp

    r992fd7 r257c77  
    66 */
    77
    8 #include "TextStatusIndicator.hpp"
     8#include "Helpers/MemDebug.hpp"
     9
     10#include "TextUI/TextStatusIndicator.hpp"
    911
    1012#include <iostream>
     
    1416using namespace std;
    1517
    16 TextStatusIndicator::TextStatusIndicator()
     18TextStatusIndicator::TextStatusIndicator() :
     19  Observer("TextStatusIndicator")
    1720{
    1821  Process::AddObserver(this);
  • src/UIElements/TextUI/TextUIFactory.cpp

    r992fd7 r257c77  
    66 */
    77
    8 #include "UIElements/TextUIFactory.hpp"
    9 #include "UIElements/TextWindow.hpp"
    10 #include "UIElements/TextDialog.hpp"
    11 #include "Helpers/MemDebug.hpp"
     8#include "UIElements/TextUI/TextUIFactory.hpp"
     9#include "UIElements/TextUI/TextWindow.hpp"
     10#include "UIElements/TextUI/TextDialog.hpp"
    1211
    1312TextUIFactory::TextUIFactory()
     
    2221}
    2322
    24 MainWindow* TextUIFactory::makeMainWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName) {
    25   return new TextWindow(populaters,molecules,configuration,periode,ConfigFileName);
     23MainWindow* TextUIFactory::makeMainWindow() {
     24  return new TextWindow();
    2625}
    2726
  • src/UIElements/TextUI/TextUIFactory.hpp

    r992fd7 r257c77  
    99#define TEXTUIFACTORY_HPP_
    1010
    11 #include "UIElements/UIFactory.hpp"
     11#include "UIFactory.hpp"
    1212
    1313class TextUIFactory : public UIFactory
     
    1919
    2020  virtual Dialog* makeDialog();
    21   virtual MainWindow* makeMainWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *);
     21  virtual MainWindow* makeMainWindow();
    2222
    2323  struct description : public UIFactory::factoryDescription {
  • src/UIElements/TextUI/TextWindow.cpp

    r992fd7 r257c77  
    66 */
    77
    8 #include "UIElements/TextWindow.hpp"
     8#include "Helpers/MemDebug.hpp"
     9
     10#include "TextUI/TextWindow.hpp"
    911
    1012#include <boost/bind.hpp>
     
    2426#include "linkedcell.hpp"
    2527#include "log.hpp"
    26 #include "memoryusageobserverunittest.hpp"
     28#include "memoryusageobserver.hpp"
    2729#include "molecule.hpp"
    2830#include "periodentafel.hpp"
     31#include "World.hpp"
    2932
    3033#include "Legacy/oldmenu.hpp"
     
    3639#include "Menu/DisplayMenuItem.hpp"
    3740#include "Menu/SubMenuItem.hpp"
    38 #include "UIElements/TextStatusIndicator.hpp"
     41#include "TextUI/TextStatusIndicator.hpp"
    3942#include "Actions/MethodAction.hpp"
     43#include "Actions/MoleculeAction/ChangeNameAction.hpp"
    4044#include "Actions/ErrorAction.hpp"
    4145#include "Actions/ActionRegistry.hpp"
     
    4953
    5054// TODO: see what code can be moved to a base class for Graphic and Text Windows
    51 TextWindow::TextWindow(menuPopulaters populaters,MoleculeListClass *molecules, config *configuration, periodentafel *periode, char *ConfigFileName)
     55TextWindow::TextWindow()
    5256{
     57  MoleculeListClass *molecules = World::getInstance().getMolecules();
     58  config *configuration = World::getInstance().getConfig();
     59  periodentafel *periode = World::getInstance().getPeriode();
     60  char *ConfigFileName = NULL;
    5361  old_menu = new oldmenu;
    5462
     
    102110  // call all functions used to build the submenus
    103111
    104   populaters.MakeEditMoleculesMenu(editMoleculesMenu,molecules,configuration,periode);
     112  populateEditMoleculesMenu(editMoleculesMenu);
    105113
    106114  Action *returnFromEditMoleculeAction = new TextMenu::LeaveAction(editMoleculesMenu);
     
    126134  main_menu->display();
    127135}
     136
     137void TextWindow::populateEditMoleculesMenu(Menu* editMoleculesMenu)
     138{
     139  MoleculeListClass *molecules = World::getInstance().getMolecules();
     140  periodentafel *periode = World::getInstance().getPeriode();
     141
     142  // build the EditMoleculesMenu
     143  Action *createMoleculeAction = new MethodAction("createMoleculeAction",boost::bind(&MoleculeListClass::createNewMolecule,molecules,periode));
     144  new ActionMenuItem('c',"create new molecule",editMoleculesMenu,createMoleculeAction);
     145
     146  Action *loadMoleculeAction = new MethodAction("loadMoleculeAction",boost::bind(&MoleculeListClass::loadFromXYZ,molecules,periode));
     147  new ActionMenuItem('l',"load molecule from xyz file",editMoleculesMenu,loadMoleculeAction);
     148
     149  Action *changeFilenameAction = new MoleculeChangeNameAction();
     150  new ActionMenuItem('n',"change molecule's name",editMoleculesMenu,changeFilenameAction);
     151
     152  Action *giveFilenameAction = new MethodAction("giveFilenameAction",boost::bind(&MoleculeListClass::setMoleculeFilename,molecules));
     153  new ActionMenuItem('N',"give molecules filename",editMoleculesMenu,giveFilenameAction);
     154
     155  Action *parseAtomsAction = new MethodAction("parseAtomsAction",boost::bind(&MoleculeListClass::parseXYZIntoMolecule,molecules));
     156  new ActionMenuItem('p',"parse atoms in xyz file into molecule",editMoleculesMenu,parseAtomsAction);
     157
     158  Action *eraseMoleculeAction = new MethodAction("eraseMoleculeAction",boost::bind(&MoleculeListClass::eraseMolecule,molecules));
     159  new ActionMenuItem('r',"remove a molecule",editMoleculesMenu,eraseMoleculeAction);
     160
     161}
  • src/UIElements/TextUI/TextWindow.hpp

    r992fd7 r257c77  
    99#define TEXTWINDOW_HPP_
    1010
    11 #include "UIElements/MainWindow.hpp"
     11#include "MainWindow.hpp"
    1212
    1313class TextMenu;
     
    1717class TextStatusIndicator;
    1818
     19
    1920class TextWindow : public MainWindow
    2021{
    2122public:
    22   TextWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *);
     23  TextWindow();
    2324  virtual ~TextWindow();
    2425
    2526  virtual void display();
    2627private:
     28  // populaters
     29  void populateEditMoleculesMenu(Menu* editMoleculesMenu);
     30
    2731  TextMenu *main_menu;
    2832
  • src/UIElements/UIFactory.cpp

    r992fd7 r257c77  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
    89
    910#include <utility>
  • src/UIElements/UIFactory.hpp

    r992fd7 r257c77  
    1111class MainWindow;
    1212class Dialog;
    13 
    14 class MoleculeListClass;
    15 class config;
    16 class periodentafel;
    17 
    18 struct menuPopulaters;
     13class DialogDescription;
    1914
    2015#include "Patterns/Singleton.hpp"
     
    3934   * Produce some kind of main window, of whichever type was chosen when the factory was created
    4035   */
    41   virtual MainWindow* makeMainWindow(menuPopulaters,MoleculeListClass *, config *, periodentafel *, char *)=0;
     36  virtual MainWindow* makeMainWindow()=0;
    4237
    4338  /**
  • src/UIElements/Views/MethodStringView.cpp

    r992fd7 r257c77  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "MethodStringView.hpp"
  • src/UIElements/Views/StreamStringView.cpp

    r992fd7 r257c77  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include <sstream>
  • src/UIElements/Views/StringView.cpp

    r992fd7 r257c77  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "StringView.hpp"
  • src/UIElements/Views/View.cpp

    r992fd7 r257c77  
    55 *      Author: crueger
    66 */
     7
     8#include "Helpers/MemDebug.hpp"
    79
    810#include "View.hpp"
Note: See TracChangeset for help on using the changeset viewer.