Index: src/UIElements/CommandLineUI/CommandLineUIFactory.hpp
===================================================================
--- src/UIElements/CommandLineUI/CommandLineUIFactory.hpp	(revision 84c494528bbd3943769972df639fbc01ec0bed4e)
+++ src/UIElements/CommandLineUI/CommandLineUIFactory.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -11,4 +11,28 @@
 #include "UIFactory.hpp"
 
+/** This class is a specialization of the UIFactory.
+ *
+ * <h2> Introduction </h2>
+ *
+ * The UIFactory is a base class for the User Interaction. There are three UI specializations:
+ * Text, GUI and CommandLine.
+ *
+ * The idea of the command line part is as follows:
+ *
+ * All actions that can be called from the command line are instantiated via populater-functions.
+ * In the constructor of an action it is automatically registered with the ActionRegistry and can
+ * henceforth be looked up there.
+ *
+ * There is a CommandLineParser which parses the command line parameters and puts all found values
+ * into a map. Then, MainWindow::Display of the CommandLineUIFactory is called, which goes through
+ * every action (by the ActionRegistry) and looks through the parsed commands whether the action is
+ * desired.
+ *
+ * In the action itself, Query's ask for user input. In the CommandLine case, we don't want direct
+ * user interaction, but the user has to have those values already delivered along with the desired
+ * action. Hence, the Query implementations just look up the desired values in the CommandLineParser
+ * vaults. When they are not found, an exception is thrown. When all are found, the action is performed.
+ *
+ */
 class CommandLineUIFactory : public UIFactory
 {
Index: src/UIElements/Dialog.cpp
===================================================================
--- src/UIElements/Dialog.cpp	(revision 84c494528bbd3943769972df639fbc01ec0bed4e)
+++ src/UIElements/Dialog.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -36,4 +36,14 @@
 
 bool Dialog::display(){
+  if(checkAll()){
+    setAll();
+    return true;
+  }
+  else{
+    return false;
+  }
+}
+
+bool Dialog::checkAll(){
   list<Query*>::iterator iter;
   bool retval = true;
@@ -46,11 +56,12 @@
     }
   }
-  if (retval){
-    // if all queries succeeded we can set the targets to appropriate values
-    for(iter=queries.begin(); iter!=queries.end(); iter++) {
-      (*iter)->setResult();
-    }
-  }
   return retval;
+}
+
+void Dialog::setAll(){
+  list<Query*>::iterator iter;
+  for(iter=queries.begin(); iter!=queries.end(); iter++) {
+    (*iter)->setResult();
+  }
 }
 
Index: src/UIElements/Dialog.hpp
===================================================================
--- src/UIElements/Dialog.hpp	(revision 84c494528bbd3943769972df639fbc01ec0bed4e)
+++ src/UIElements/Dialog.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -19,4 +19,15 @@
 class Vector;
 
+
+/** Dialog is one of the two main classes of the UIFactory base class.
+ *
+ * The Dialog is meant for asking the user for information needed to perform actions he
+ * desires, such as asking for a position in space or a length.
+ *
+ * For this purpose there is the base class Query and numerous specializations for each
+ * of the types to be asked. There are primitives integer, doubles and string, but also
+ * advanced types such as element, molecule or Vector. There is also an empty query for
+ * displaying text.
+ */
 class Dialog
 {
@@ -38,4 +49,7 @@
   virtual bool display();
 
+  virtual bool checkAll();
+  virtual void setAll();
+
 protected:
   // methodology for handling queries
Index: src/UIElements/MainWindow.cpp
===================================================================
--- src/UIElements/MainWindow.cpp	(revision 84c494528bbd3943769972df639fbc01ec0bed4e)
+++ src/UIElements/MainWindow.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -11,11 +11,6 @@
 
 MainWindow::MainWindow()
-{
-  // TODO Auto-generated constructor stub
-
-}
+{}
 
 MainWindow::~MainWindow()
-{
-  // TODO Auto-generated destructor stub
-}
+{}
Index: src/UIElements/Menu/QT4/QTMenu.cpp
===================================================================
--- src/UIElements/Menu/QT4/QTMenu.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/Menu/QT4/QTMenu.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,54 @@
+/*
+ * QTMenu.cpp
+ *
+ *  Created on: Jan 15, 2010
+ *      Author: crueger
+ */
+
+#include "Menu/QT4/QTMenu.hpp"
+
+#include <Qt/qaction.h>
+#include "Menu/MenuItem.hpp"
+
+QTMenu::QTMenu(const char * _title) :
+  QMenu(_title)
+{}
+
+QTMenu::~QTMenu()
+{
+  // yay... Just like Mario Bros.
+  for(list<QTMenuPipe*>::iterator it=plumbing.begin(); it != plumbing.end(); it++)
+    delete (*it);
+}
+
+void QTMenu::addItem(MenuItem* item) {
+  const string description = item->getDescription();
+  QAction *action = addAction(QString(description.c_str()));
+  QTMenuPipe *pipe = new QTMenuPipe(item,action);
+  QObject::connect(action, SIGNAL(triggered()),pipe,SLOT(called()));
+  plumbing.push_back(pipe);
+}
+
+void QTMenu::removeItem(MenuItem* item) {
+  list<QTMenuPipe*>::iterator iter;
+  for(iter=plumbing.begin(); iter!=plumbing.end(); iter++){
+    delete (*iter);
+  }
+}
+
+void QTMenu::display() {
+
+}
+
+QTMenuPipe::QTMenuPipe(MenuItem *_item, QAction *_action) :
+    theItem(_item), theAction(_action)
+{}
+
+QTMenuPipe::~QTMenuPipe() {
+  delete theAction;
+  delete theItem;
+}
+
+void QTMenuPipe::called() {
+  theItem->doTrigger();
+}
Index: src/UIElements/Menu/QT4/QTMenu.hpp
===================================================================
--- src/UIElements/Menu/QT4/QTMenu.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/Menu/QT4/QTMenu.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,50 @@
+/*
+ * QTMenu.hpp
+ *
+ *  Created on: Jan 15, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTMENU_HPP_
+#define QTMENU_HPP_
+
+#include <list>
+
+#include <QtGui/QMenu>
+#include <QtCore/QObject>
+
+#include "Menu/Menu.hpp"
+
+class QTMenuPipe;
+
+class QTMenu : public QMenu, public Menu
+{
+  Q_OBJECT
+
+public:
+  QTMenu(const char *);
+  virtual ~QTMenu();
+
+  virtual void addItem(MenuItem*);
+  virtual void removeItem(MenuItem*);
+  virtual void display();
+private:
+  list<QTMenuPipe*> plumbing;
+};
+
+// This handles the plumbing from QT to internal Items
+// Slots from QT are redirected to internal methods.
+// This way methods can be used where no QT is available
+class QTMenuPipe : public QObject {
+  Q_OBJECT
+public:
+  QTMenuPipe(MenuItem*,QAction*);
+  virtual ~QTMenuPipe();
+public slots:
+  void called();
+private:
+  MenuItem *theItem;
+  QAction *theAction;
+};
+
+#endif /* QTMENU_HPP_ */
Index: src/UIElements/QT4/QTDialog.cpp
===================================================================
--- src/UIElements/QT4/QTDialog.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/QT4/QTDialog.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,396 @@
+/*
+ * QTDialog.cpp
+ *
+ *  Created on: Jan 18, 2010
+ *      Author: crueger
+ */
+
+#include "UIElements/QT4/QTDialog.hpp"
+
+#include <string>
+#include <sstream>
+#include <limits>
+
+#include <Qt/qboxlayout.h>
+#include <Qt/qlabel.h>
+#include <Qt/qspinbox.h>
+#include <QtGui/QDoubleSpinBox>
+#include <Qt/qlineedit.h>
+#include <Qt/qdialogbuttonbox.h>
+#include <Qt/qpushbutton.h>
+#include <Qt/qcombobox.h>
+
+#include "Helpers/MemDebug.hpp"
+
+#include "World.hpp"
+#include "periodentafel.hpp"
+#include "atom.hpp"
+#include "element.hpp"
+#include "molecule.hpp"
+#include "Descriptors/MoleculeIdDescriptor.hpp"
+#include "Matrix.hpp"
+#include "Box.hpp"
+
+
+using namespace std;
+
+QTDialog::QTDialog() :
+    QDialog(0)
+{
+  // creating and filling of the Dialog window
+  mainLayout = new QVBoxLayout();
+  inputLayout = new QVBoxLayout();
+  buttonLayout = new QVBoxLayout();
+  setLayout(mainLayout);
+  mainLayout->addLayout(inputLayout);
+  mainLayout->addLayout(buttonLayout);
+  buttons = new QDialogButtonBox(QDialogButtonBox::Ok| QDialogButtonBox::Cancel);
+  buttonLayout->addWidget(buttons);
+
+  // Disable the ok button until something was entered
+  buttons->button(QDialogButtonBox::Ok)->setEnabled(false);
+
+  // connect the buttons to their appropriate slots
+  connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
+  connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
+}
+
+QTDialog::~QTDialog()
+{
+}
+
+bool QTDialog::display(){
+  // Button state might have changed by some update that
+  // was done during query construction. To make sure
+  // the state is correct, we just call update one more time.
+  update();
+  if(exec()) {
+    setAll();
+    return true;
+  }
+  else {
+    return false;
+  }
+}
+
+void QTDialog::update(){
+  buttons->button(QDialogButtonBox::Ok)->setEnabled(checkAll());
+}
+
+/************************** Query Infrastructure ************************/
+
+void QTDialog::queryEmpty(char const*, string){
+  // TODO
+  ASSERT(false, "Not implemented yet");
+}
+
+void QTDialog::queryBoolean(char const*, bool*,string){
+  // TODO
+  ASSERT(false, "Not implemented yet");
+}
+
+void QTDialog::queryAtom(char const*, atom**, string){
+  // TODO
+  ASSERT(false, "Not implemented yet");
+}
+
+void QTDialog::queryBox(char const*, Box*, string){
+  // TODO
+  ASSERT(false, "Not implemented yet");
+}
+
+
+void QTDialog::queryInt(const char *title, int *target,string)
+{
+  registerQuery(new IntQTQuery(title,target,inputLayout,this));
+}
+
+void QTDialog::queryDouble(const char* title, double* target,string){
+  registerQuery(new DoubleQTQuery(title,target,inputLayout,this));
+}
+
+void QTDialog::queryString(const char* title, std::string *target,string)
+{
+  registerQuery(new StringQTQuery(title,target,inputLayout,this));
+}
+
+void QTDialog::queryMolecule(const char *title,molecule **target,string)
+{
+  registerQuery(new MoleculeQTQuery(title,target,inputLayout,this));
+}
+
+void QTDialog::queryVector(const char* title, Vector *target, bool check,string) {
+  registerQuery(new VectorQTQuery(title,target,check,inputLayout,this));
+}
+
+void QTDialog::queryElement(const char* title, std::vector<element *> *target,string){
+  registerQuery(new ElementQTQuery(title,target,inputLayout,this));
+}
+
+/************************** Query Objects *******************************/
+
+QTDialog::IntQTQuery::IntQTQuery(string _title,int *_target,QBoxLayout *_parent,QTDialog *_dialog) :
+    Dialog::IntQuery(_title,_target),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QSpinBox();
+  inputBox->setValue(0);
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new IntQTQueryPipe(&tmp,_dialog);
+  pipe->update(inputBox->value());
+  connect(inputBox,SIGNAL(valueChanged(int)),pipe,SLOT(update(int)));
+}
+
+QTDialog::IntQTQuery::~IntQTQuery()
+{
+  delete pipe;
+}
+
+// Handling is easy since the GUI makes it impossible to enter invalid values
+bool QTDialog::IntQTQuery::handle()
+{
+  return true;
+}
+
+QTDialog::DoubleQTQuery::DoubleQTQuery(string title,double *_target,QBoxLayout *_parent,QTDialog *_dialog) :
+    Dialog::DoubleQuery(title,_target),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QDoubleSpinBox();
+  inputBox->setValue(0);
+  inputBox->setRange(-numeric_limits<double>::max(),numeric_limits<double>::max());
+  inputBox->setDecimals(3);
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new DoubleQTQueryPipe(&tmp,_dialog);
+  pipe->update(inputBox->value());
+  connect(inputBox,SIGNAL(valueChanged(double)),pipe,SLOT(update(double)));
+}
+
+QTDialog::DoubleQTQuery::~DoubleQTQuery()
+{
+  delete pipe;
+}
+
+bool QTDialog::DoubleQTQuery::handle() {
+  return true;
+}
+
+
+QTDialog::StringQTQuery::StringQTQuery(string _title,string *_target,QBoxLayout *_parent,QTDialog *_dialog) :
+    Dialog::StringQuery(_title,_target),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QLineEdit();
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new StringQTQueryPipe(&tmp,_dialog);
+  pipe->update(inputBox->text());
+  connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(update(const QString&)));
+}
+
+QTDialog::StringQTQuery::~StringQTQuery()
+{
+  delete pipe;
+}
+
+// All values besides the empty string are valid
+bool QTDialog::StringQTQuery::handle()
+{
+  return tmp!="";
+}
+
+QTDialog::MoleculeQTQuery::MoleculeQTQuery(string _title, molecule **_target, QBoxLayout *_parent,QTDialog *_dialog) :
+    Dialog::MoleculeQuery(_title,_target),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QComboBox();
+  // add all molecules to the combo box
+  vector<molecule*> molecules = World::getInstance().getAllMolecules();
+  for(vector<molecule*>::iterator iter  = molecules.begin();
+      iter != molecules.end();
+      ++iter) {
+    stringstream sstr;
+    sstr << (*iter)->IndexNr << "\t" << (*iter)->getName();
+    inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter)->IndexNr));
+  }
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new MoleculeQTQueryPipe(&tmp,_dialog,inputBox);
+  pipe->update(inputBox->currentIndex());
+  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
+}
+
+QTDialog::MoleculeQTQuery::~MoleculeQTQuery()
+{
+  delete pipe;
+}
+
+// Handling is easy, since the GUI makes it impossible to select invalid values
+bool QTDialog::MoleculeQTQuery::handle()
+{
+  return true;
+}
+
+QTDialog::VectorQTQuery::VectorQTQuery(std::string title, Vector *_target, bool _check,QBoxLayout *_parent,QTDialog *_dialog) :
+    Dialog::VectorQuery(title,_target,_check),
+    parent(_parent)
+{
+  const Matrix& M = World::getInstance().getDomain().getM();
+  const char *coords[3] = {"x:","y:","z:"};
+  mainLayout= new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  mainLayout->addWidget(titleLabel);
+  subLayout = new QVBoxLayout();
+  mainLayout->addLayout(subLayout);
+  for(int i=0; i<3; i++) {
+    coordLayout[i] = new QHBoxLayout();
+    subLayout->addLayout(coordLayout[i]);
+    coordLabel[i] = new QLabel(QString(coords[i]));
+    coordLayout[i]->addWidget(coordLabel[i]);
+    coordInput[i] = new QDoubleSpinBox();
+    coordInput[i]->setRange(0,M.at(i,i));
+    coordInput[i]->setDecimals(3);
+    coordLayout[i]->addWidget(coordInput[i]);
+    pipe[i] = new DoubleQTQueryPipe(&((*tmp)[i]),_dialog);
+    pipe[i]->update(coordInput[i]->value());
+    connect(coordInput[i],SIGNAL(valueChanged(double)),pipe[i],SLOT(update(double)));
+
+  }
+  parent->addLayout(mainLayout);
+}
+
+QTDialog::VectorQTQuery::~VectorQTQuery()
+{}
+
+bool QTDialog::VectorQTQuery::handle() {
+  return true;
+}
+
+
+QTDialog::ElementQTQuery::ElementQTQuery(std::string _title, vector<element *> *_target, QBoxLayout *_parent, QTDialog *_dialog) :
+    Dialog::ElementQuery(_title,_target),
+    parent(_parent)
+{
+  periodentafel *periode = World::getInstance().getPeriode();
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QComboBox();
+  for(periodentafel::const_iterator iter = periode->begin();
+      iter!=periode->end();
+      ++iter)
+  {
+    stringstream sstr;
+    sstr << (*iter).first << "\t" << (*iter).second->name;
+    inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
+  }
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new ElementQTQueryPipe(&elements,_dialog,inputBox);
+  pipe->update(inputBox->currentIndex());
+  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
+}
+
+QTDialog::ElementQTQuery::~ElementQTQuery()
+{
+  delete pipe;
+}
+
+bool QTDialog::ElementQTQuery::handle(){
+  return true;
+}
+
+/*************************** Plumbing *******************************/
+
+StringQTQueryPipe::StringQTQueryPipe(string *_content, QTDialog *_dialog) :
+  content(_content),
+  dialog(_dialog)
+{}
+
+StringQTQueryPipe::~StringQTQueryPipe()
+{}
+
+void StringQTQueryPipe::update(const QString& newText) {
+  content->assign(newText.toStdString());
+  dialog->update();
+}
+
+IntQTQueryPipe::IntQTQueryPipe(int *_content, QTDialog *_dialog) :
+  content(_content),
+  dialog(_dialog)
+{}
+
+IntQTQueryPipe::~IntQTQueryPipe()
+{}
+
+void IntQTQueryPipe::update(int newInt) {
+  (*content) = newInt;
+  dialog->update();
+}
+
+DoubleQTQueryPipe::DoubleQTQueryPipe(double *_content, QTDialog *_dialog) :
+  content(_content),
+  dialog(_dialog)
+{}
+
+DoubleQTQueryPipe::~DoubleQTQueryPipe()
+{}
+
+void DoubleQTQueryPipe::update(double newDbl) {
+  (*content) = newDbl;
+  dialog->update();
+}
+
+MoleculeQTQueryPipe::MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+MoleculeQTQueryPipe::~MoleculeQTQueryPipe()
+{}
+
+void MoleculeQTQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  (*content) = World::getInstance().getMolecule(MoleculeById(idx));
+  dialog->update();
+}
+
+ElementQTQueryPipe::ElementQTQueryPipe(std::vector<element *> *_content, QTDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{
+  content->resize(1);
+}
+
+ElementQTQueryPipe::~ElementQTQueryPipe()
+{}
+
+void ElementQTQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  (*content)[0] = World::getInstance().getPeriode()->FindElement(idx);
+  dialog->update();
+}
+
Index: src/UIElements/QT4/QTDialog.hpp
===================================================================
--- src/UIElements/QT4/QTDialog.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/QT4/QTDialog.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,226 @@
+/*
+ * QTDialog.hpp
+ *
+ *  Created on: Jan 18, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTDIALOG_HPP_
+#define QTDIALOG_HPP_
+
+#include "UIElements/Dialog.hpp"
+#include <QtGui/QDialog>
+
+class QBoxLayout;
+class QLabel;
+class QSpinBox;
+class QDoubleSpinBox;
+class QLineEdit;
+class QComboBox;
+class QDialogButtonBox;
+
+
+// Forward declarations for plumbing
+class StringQTQueryPipe;
+class IntQTQueryPipe;
+class DoubleQTQueryPipe;
+class MoleculeQTQueryPipe;
+class ElementQTQueryPipe;
+
+class QTDialog : public QDialog, public Dialog
+{
+  Q_OBJECT
+public:
+  QTDialog();
+  virtual ~QTDialog();
+
+  virtual void queryEmpty(const char*, std::string);
+  virtual void queryBoolean(const char *, bool *, std::string = "");
+  virtual void queryInt(const char *, int *,std::string = "");
+  virtual void queryDouble(const char*,double *,std::string = "");
+  virtual void queryString(const char*, std::string *,std::string = "");
+  virtual void queryAtom(const char*,atom**,std::string = "");
+  virtual void queryMolecule(const char*,molecule**,std::string = "");
+  virtual void queryVector(const char*,Vector *,bool,std::string = "");
+  virtual void queryBox(const char*,Box*, std::string = "");
+  virtual void queryElement(const char*,std::vector<element *> *_target,std::string = "");
+
+  virtual bool display();
+
+  virtual void update();
+
+protected:
+  class IntQTQuery : public Dialog::IntQuery {
+    public:
+      IntQTQuery(std::string _title, int *_target,QBoxLayout *_parent,QTDialog *_dialog);
+      virtual ~IntQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QSpinBox *inputBox;
+
+      IntQTQueryPipe *pipe;
+    };
+
+    class DoubleQTQuery : public Dialog::DoubleQuery {
+    public:
+      DoubleQTQuery(std::string title, double *_target,QBoxLayout *_parent,QTDialog *_dialog);
+      virtual ~DoubleQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QDoubleSpinBox *inputBox;
+
+      DoubleQTQueryPipe *pipe;
+    };
+
+    class StringQTQuery : public Dialog::StringQuery {
+    public:
+      StringQTQuery(std::string _title, std::string *_target, QBoxLayout *_parent,QTDialog *_dialog);
+      virtual ~StringQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QLineEdit *inputBox;
+
+      StringQTQueryPipe *pipe;
+    };
+
+    class MoleculeQTQuery : public Dialog::MoleculeQuery {
+    public:
+      MoleculeQTQuery(std::string _title, molecule **_target, QBoxLayout *_parent,QTDialog *_dialog);
+      virtual ~MoleculeQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      MoleculeQTQueryPipe *pipe;
+    };
+
+    class VectorQTQuery : public Dialog::VectorQuery {
+    public:
+      VectorQTQuery(std::string title,Vector *_target,bool _check,QBoxLayout *,QTDialog *);
+      virtual ~VectorQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *mainLayout;
+      QLabel *titleLabel;
+      QBoxLayout *subLayout;
+      QBoxLayout *coordLayout[3];
+      QLabel *coordLabel[3];
+      QDoubleSpinBox *coordInput[3];
+
+      DoubleQTQueryPipe *pipe[3];
+    };
+
+    class ElementQTQuery : public Dialog::ElementQuery {
+    public:
+      ElementQTQuery(std::string _title, std::vector<element *> *_target, QBoxLayout *_parent, QTDialog *_dialog);
+      virtual ~ElementQTQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      ElementQTQueryPipe *pipe;
+    };
+
+private:
+  QBoxLayout *mainLayout;
+  QBoxLayout *inputLayout;
+  QBoxLayout *buttonLayout;
+  QDialogButtonBox *buttons;
+};
+
+// All kinds of plumbing for Queries
+// Plumbing needs to be outside of the class where it is needed,
+// since MOC doesn't like nested classes
+
+class StringQTQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  StringQTQueryPipe(std::string *_content, QTDialog *_dialog);
+  virtual ~StringQTQueryPipe();
+
+public slots:
+  void update(const QString&);
+
+private:
+  std::string *content;
+  QTDialog *dialog;
+
+};
+
+class IntQTQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  IntQTQueryPipe(int *_content, QTDialog *_dialog);
+  virtual ~IntQTQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  int *content;
+  QTDialog *dialog;
+
+};
+
+class DoubleQTQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  DoubleQTQueryPipe(double *_content, QTDialog *_dialog);
+  virtual ~DoubleQTQueryPipe();
+
+public slots:
+  void update(double);
+
+private:
+  double *content;
+  QTDialog *dialog;
+
+};
+
+class MoleculeQTQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  MoleculeQTQueryPipe(molecule **_content, QTDialog *_dialog, QComboBox *_theBox);
+  virtual ~MoleculeQTQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  molecule **content;
+  QTDialog *dialog;
+  QComboBox *theBox;
+
+};
+
+class ElementQTQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  ElementQTQueryPipe(std::vector<element *> *_content, QTDialog *_dialog, QComboBox *_theBox);
+  virtual ~ElementQTQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  std::vector<element *> *content;
+  QTDialog *dialog;
+  QComboBox *theBox;
+};
+#endif /* QTDIALOG_HPP_ */
Index: src/UIElements/QT4/QTMainWindow.cpp
===================================================================
--- src/UIElements/QT4/QTMainWindow.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/QT4/QTMainWindow.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,120 @@
+/*
+ * QTMainWindow.cpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+#include "QTMainWindow.hpp"
+
+#include<Qt/qapplication.h>
+#include<Qt/qlabel.h>
+#include<Qt/qstring.h>
+#include<Qt/qmenubar.h>
+#include<Qt/qsplitter.h>
+
+#include<iostream>
+#include<map>
+
+#include<boost/bind.hpp>
+
+#include "atom.hpp"
+#include "molecule.hpp"
+#include "Actions/Action.hpp"
+#include "Actions/ActionRegistry.hpp"
+#include "Actions/MapOfActions.hpp"
+#include "Menu/Menu.hpp"
+#include "Menu/QT4/QTMenu.hpp"
+#include "Menu/ActionMenuItem.hpp"
+#include "Views/QT4/QTWorldView.hpp"
+#include "Views/QT4/GLMoleculeView.hpp"
+#include "Views/QT4/QTMoleculeView.hpp"
+#include "Views/QT4/QTStatusBar.hpp"
+#include "Helpers/MemDebug.hpp"
+
+
+using namespace std;
+
+QTMainWindow::QTMainWindow(QApplication *_theApp) :
+    theApp(_theApp)
+{
+  QSplitter *splitter1 = new QSplitter (Qt::Horizontal, this );
+  QSplitter *splitter2 = new QSplitter (Qt::Vertical, splitter1 );
+
+  worldDisplay = new QTWorldView(splitter2);
+
+  moleculeDisplay = new QTMoleculeView();
+  molecule3dDisplay = new GLMoleculeView();
+
+  MenuBar = menuBar();
+
+  std::map <std::string, QTMenu *> NametoTextMenuMap;
+  // go through all menus and create them
+  QTMenu *Menu = NULL;
+  for(std::map<std::string, std::pair<std::string,std::string> >::iterator iter = MapOfActions::getInstance().MenuDescription.begin(); iter != MapOfActions::getInstance().MenuDescription.end(); ++iter) {
+    cout << "Creating menu " << iter->first << endl;
+    Menu = new QTMenu(iter->first.c_str());
+    MenuBar->addMenu(Menu);
+    NametoTextMenuMap.insert( pair <std::string, QTMenu *> (iter->first, Menu) );
+    //new SubMenuItem(getSuitableShortForm(iter->first),iter->second.first,main_menu,Menu);
+  }
+
+  // populate all actions
+  MapOfActions::getInstance().populateActions();
+
+  // go through all actions and add them to its menu
+  for (std::map <std::string, QTMenu *>::iterator MenuRunner = NametoTextMenuMap.begin(); MenuRunner != NametoTextMenuMap.end(); ++MenuRunner) {
+    cout << "Creating Action " << MenuRunner->first << " in menu " << MenuRunner->second << endl;
+    populateMenu(MenuRunner->second, MenuRunner->first);
+  }
+
+  setCentralWidget(splitter1);
+  splitter1->addWidget(splitter2);
+  splitter1->addWidget(moleculeDisplay);
+  splitter2->addWidget(molecule3dDisplay);
+  splitter2->addWidget(worldDisplay);
+
+  statusBar = new QTStatusBar(this);
+  setStatusBar(statusBar);
+
+  connect(worldDisplay,SIGNAL(moleculeSelected(molecule*)),moleculeDisplay,SLOT(moleculeSelected(molecule*)));
+  connect(worldDisplay,SIGNAL(moleculeUnSelected(molecule*)),moleculeDisplay,SLOT(moleculeUnSelected(molecule*)));
+}
+
+QTMainWindow::~QTMainWindow()
+{
+  menuBar()->clear();
+  delete editMoleculesMenu;
+}
+
+void QTMainWindow::display() {
+  this->show();
+  theApp->exec();
+}
+
+char QTMainWindow::getSuitableShortForm(set <char> &ShortcutList, const std::string name) const
+{
+  for (std::string::const_iterator CharRunner = name.begin(); CharRunner != name.end(); ++CharRunner) {
+    if (ShortcutList.find(*CharRunner) == ShortcutList.end())
+      return *CharRunner;
+  }
+  DoeLog(1) && (eLog() << Verbose(1) << "Could not find a suitable shortform for TextWindow::getSuitableShortForm()." << endl);
+  return ((char)(ShortcutList.size() % 10) + '0');
+}
+
+void QTMainWindow::populateMenu(QTMenu* Menu, const  std::string &MenuName)
+{
+  Action *ActionItem = NULL;
+  set <char> ShortcutList;
+  // through all actions for this menu
+  std::pair < std::multimap <std::string, std::string>::iterator, std::multimap <std::string, std::string>::iterator > MenuActions = MapOfActions::getInstance().MenuContainsActionMap.equal_range(MenuName);
+  for (std::multimap <std::string, std::string>::const_iterator MenuRunner = MenuActions.first; MenuRunner != MenuActions.second; ++MenuRunner) {
+    cout << " Adding " << MenuRunner->second << " to submenu " << MenuName << endl;
+    ActionItem = ActionRegistry::getInstance().getActionByName(MenuRunner->second);
+    new ActionMenuItem(getSuitableShortForm(ShortcutList, MenuRunner->second),MapOfActions::getInstance().getDescription(MenuRunner->second).c_str(),Menu,ActionItem);
+  }
+  // finally add default quit item
+  //Action *returnFromAction = new TextMenu::LeaveAction(Menu);
+  //MenuItem *returnFromItem = new ActionMenuItem('q',"return to Main menu",Menu,returnFromAction);
+  //Menu->addDefault(returnFromItem);
+}
Index: src/UIElements/QT4/QTMainWindow.hpp
===================================================================
--- src/UIElements/QT4/QTMainWindow.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/QT4/QTMainWindow.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,48 @@
+/*
+ * QTMainWindow.hpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTMAINWINDOW_HPP_
+#define QTMAINWINDOW_HPP_
+
+#include "UIElements/MainWindow.hpp"
+#include <QtGui/QMainWindow>
+
+#include <set>
+
+class QTWorldView;
+class StringView;
+class QTMenu;
+class GLMoleculeView;
+class QTMoleculeView;
+class QTStatusBar;
+
+class QTMainWindow : public QMainWindow, public MainWindow
+{
+  Q_OBJECT
+
+public:
+  QTMainWindow(QApplication *_theApp);
+  virtual ~QTMainWindow();
+
+  virtual void display();
+
+  char getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const;
+  void populateMenu(QTMenu* Menu, const  std::string &MenuName);
+
+private:
+  // All kinds of QTStuff used in this window
+  QApplication *theApp;
+  QTWorldView *worldDisplay;
+  QTMenu *editMoleculesMenu;
+  GLMoleculeView *molecule3dDisplay;
+  QTMoleculeView *moleculeDisplay;
+  QTStatusBar *statusBar;
+  QMenuBar *MenuBar;
+
+};
+
+#endif /* QTMAINWINDOW_HPP_ */
Index: src/UIElements/QT4/QTUIFactory.cpp
===================================================================
--- src/UIElements/QT4/QTUIFactory.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/QT4/QTUIFactory.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,56 @@
+/*
+ * QTUIFactory.cpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+#include <iostream>
+#include <cassert>
+
+using namespace std;
+
+#include <qapplication.h>
+
+#include "UIElements/QT4/QTUIFactory.hpp"
+#include "UIElements/QT4/QTMainWindow.hpp"
+#include "UIElements/QT4/QTDialog.hpp"
+#include "version.h"
+#include "defs.hpp"
+#include "Helpers/MemDebug.hpp"
+
+QTUIFactory::QTUIFactory()
+{
+  // For now we just fake the command line parameters to make QT happy
+  argc=1;
+  argv = new char*[1];
+  argv[0] = new char[256];
+  strcpy(argv[0],ESPACKVersion);
+  app = new QApplication(argc,argv);
+}
+
+QTUIFactory::~QTUIFactory()
+{
+  delete app;
+  delete [] argv[0];
+  delete [] argv;
+}
+
+Dialog* QTUIFactory::makeDialog() {
+  return new QTDialog();
+}
+
+MainWindow* QTUIFactory::makeMainWindow() {
+  return new QTMainWindow(app);
+}
+
+QTUIFactory::description::description() :
+    UIFactory::factoryDescription("QT4")
+{}
+
+QTUIFactory::description::~description()
+{}
+
+UIFactory* QTUIFactory::description::makeFactory(){
+  return new QTUIFactory();
+}
Index: src/UIElements/QT4/QTUIFactory.hpp
===================================================================
--- src/UIElements/QT4/QTUIFactory.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/QT4/QTUIFactory.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,42 @@
+/*
+ * QTUIFactory.hpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTUIFACTORY_HPP_
+#define QTUIFACTORY_HPP_
+
+#include "UIElements/UIFactory.hpp"
+
+class QApplication;
+
+class QTUIFactory : public UIFactory
+{
+  friend class UIFactory;
+
+public:
+  virtual ~QTUIFactory();
+
+  virtual Dialog* makeDialog();
+  virtual MainWindow* makeMainWindow();
+
+  struct description : public UIFactory::factoryDescription {
+    description();
+    virtual ~description();
+
+    virtual UIFactory* makeFactory();
+  };
+
+protected:
+  QTUIFactory();
+
+private:
+  // faked command line arguments
+  int argc;
+  char **argv;
+  QApplication *app;
+};
+
+#endif /* QTUIFACTORY_HPP_ */
Index: src/UIElements/TextUI/TextUIFactory.cpp
===================================================================
--- src/UIElements/TextUI/TextUIFactory.cpp	(revision 84c494528bbd3943769972df639fbc01ec0bed4e)
+++ src/UIElements/TextUI/TextUIFactory.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -9,5 +9,4 @@
 #include "UIElements/TextUI/TextWindow.hpp"
 #include "UIElements/TextUI/TextDialog.hpp"
-
 
 TextUIFactory::TextUIFactory()
Index: src/UIElements/TextUI/TextUIFactory.hpp
===================================================================
--- src/UIElements/TextUI/TextUIFactory.hpp	(revision 84c494528bbd3943769972df639fbc01ec0bed4e)
+++ src/UIElements/TextUI/TextUIFactory.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -13,5 +13,5 @@
 class TextUIFactory : public UIFactory
 {
-friend class UIFactory;
+  friend class UIFactory;
 
 public:
Index: src/UIElements/TextUI/TextWindow.cpp
===================================================================
--- src/UIElements/TextUI/TextWindow.cpp	(revision 84c494528bbd3943769972df639fbc01ec0bed4e)
+++ src/UIElements/TextUI/TextWindow.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -7,6 +7,4 @@
 
 #include "Helpers/MemDebug.hpp"
-
-#include "TextUI/TextWindow.hpp"
 
 #include <boost/bind.hpp>
@@ -19,4 +17,5 @@
 #include "Menu/SubMenuItem.hpp"
 #include "TextUI/TextStatusIndicator.hpp"
+#include "TextUI/TextWindow.hpp"
 #include "Actions/MapOfActions.hpp"
 #include "Actions/MethodAction.hpp"
@@ -25,4 +24,5 @@
 #include "Views/StreamStringView.hpp"
 #include "Views/MethodStringView.hpp"
+#include "Helpers/MemDebug.hpp"
 
 #include "defs.hpp"
@@ -39,6 +39,4 @@
 #include <iostream>
 #include <map>
-
-using namespace std;
 
 // TODO: see what code can be moved to a base class for Graphic and Text Windows
@@ -70,35 +68,11 @@
   new ActionMenuItem('a',"set molecule (in)active",main_menu,setMoleculeAction);
 
-  TextMenu *AnalysisMenu = new TextMenu(Log() << Verbose(0), "Analysis");
-  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("analysis", AnalysisMenu) );
-  new SubMenuItem('A',"Analysis (pair correlation, volume)",main_menu,AnalysisMenu);
-
-  TextMenu *CommandMenu = new TextMenu(Log() << Verbose(0), "Configuration");
-  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("command", CommandMenu) );
-  new SubMenuItem('c',"configuration",main_menu,CommandMenu);
-
-  TextMenu *AtomMenu = new TextMenu(Log() << Verbose(0), "Atoms");
-  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("atom", AtomMenu) );
-  new SubMenuItem('e',"edit atoms",main_menu,AtomMenu);
-
-  TextMenu *FragmentationMenu = new TextMenu(Log() << Verbose(0), "Fragmentation");
-  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("fragmentation", FragmentationMenu) );
-  new SubMenuItem('f',"fragmentation",main_menu,FragmentationMenu);
-
-  TextMenu *ParserMenu = new TextMenu(Log() << Verbose(0), "Parse files");
-  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("parser", ParserMenu) );
-  new SubMenuItem('p',"parse files into system",main_menu,ParserMenu);
-
-  TextMenu *MoleculesMenu = new TextMenu(Log() << Verbose(0), "Edit Molecules");
-  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("analysis", AnalysisMenu) );
-  new SubMenuItem('m',"edit molecules (load, parse, save)",main_menu,MoleculesMenu);
-
-  TextMenu *TesselationMenu = new TextMenu(Log() << Verbose(0), "Tesselate Molecules");
-  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("tesselation", TesselationMenu) );
-  new SubMenuItem('t',"tesselate molecules",main_menu,TesselationMenu);
-
-  TextMenu *WorldMenu = new TextMenu(Log() << Verbose(0), "World");
-  NametoTextMenuMap.insert( pair <std::string, TextMenu *> ("world", WorldMenu) );
-  new SubMenuItem('w',"edit world",main_menu,WorldMenu);
+  TextMenu *Menu = NULL;
+  std::set <char> ShortcutList;
+  for(map<std::string, pair<std::string,std::string> >::iterator iter = MapOfActions::getInstance().MenuDescription.begin(); iter != MapOfActions::getInstance().MenuDescription.end(); ++iter) {
+    Menu = new TextMenu(Log() << Verbose(0), iter->second.second);
+    NametoTextMenuMap.insert( pair <std::string, TextMenu *> (iter->first, Menu) );
+    new SubMenuItem(getSuitableShortForm(ShortcutList,iter->first),iter->second.first.c_str(),main_menu,Menu);
+  }
 
   new SeperatorItem(main_menu);
@@ -133,5 +107,5 @@
 }
 
-char TextWindow::getSuitableShortForm(set <char> &ShortcutList, const std::string name) const
+char TextWindow::getSuitableShortForm(std::set <char> &ShortcutList, const std::string name) const
 {
   for (std::string::const_iterator CharRunner = name.begin(); CharRunner != name.end(); ++CharRunner) {
Index: src/UIElements/TextUI/TextWindow.hpp
===================================================================
--- src/UIElements/TextUI/TextWindow.hpp	(revision 84c494528bbd3943769972df639fbc01ec0bed4e)
+++ src/UIElements/TextUI/TextWindow.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -27,4 +27,5 @@
 
   virtual void display();
+
 private:
   // populaters
Index: src/UIElements/UIFactory.cpp
===================================================================
--- src/UIElements/UIFactory.cpp	(revision 84c494528bbd3943769972df639fbc01ec0bed4e)
+++ src/UIElements/UIFactory.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -12,4 +12,5 @@
 #include "UIElements/UIFactory.hpp"
 #include "Helpers/Assert.hpp"
+#include "Helpers/MemDebug.hpp"
 
 using namespace std;
Index: src/UIElements/UIFactory.hpp
===================================================================
--- src/UIElements/UIFactory.hpp	(revision 84c494528bbd3943769972df639fbc01ec0bed4e)
+++ src/UIElements/UIFactory.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -25,4 +25,14 @@
  * only create UIelements of that certain type, so that all UIElements match. This way different
  * UIs can be handled in a concise abstract way.
+ *
+ * The main functionality is the MainWindow and the Dialog.
+ *
+ * MainWindow basically is the framework if the UI. The MainWindow has a run function which is
+ * called MainWindow::Display(), which will listen for user input and react to it via actions for
+ * as long as the user desires or tells the MainWindow to quit.
+ *
+ * Within the MainWindow Dialog classes may be instantiated which ask the user for input to
+ * certain actions he wants to perform.
+ *
  */
 class UIFactory : public Singleton<UIFactory,false>
@@ -30,4 +40,5 @@
   friend class Singleton<UIFactory,false>;
 public:
+
   /**
    * Produce some kind of main window, of whichever type was chosen when the factory was created
Index: src/UIElements/Views/QT4/GLMoleculeView.cpp
===================================================================
--- src/UIElements/Views/QT4/GLMoleculeView.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/Views/QT4/GLMoleculeView.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,15 @@
+/*
+ * GLMoleculeView.cpp
+ *
+ *  Created on: Jan 26, 2010
+ *      Author: crueger
+ */
+
+#include "GLMoleculeView.hpp"
+
+GLMoleculeView::GLMoleculeView(QWidget *parent) :
+  QGLWidget(parent)
+{}
+
+GLMoleculeView::~GLMoleculeView()
+{}
Index: src/UIElements/Views/QT4/GLMoleculeView.hpp
===================================================================
--- src/UIElements/Views/QT4/GLMoleculeView.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/Views/QT4/GLMoleculeView.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,21 @@
+/*
+ * GLMoleculeView.hpp
+ *
+ *  Created on: Jan 26, 2010
+ *      Author: crueger
+ */
+
+#ifndef GLMOLECULEVIEW_HPP_
+#define GLMOLECULEVIEW_HPP_
+
+#include <QtOpenGL/QGLWidget>
+
+class GLMoleculeView :  public QGLWidget
+{
+  Q_OBJECT
+public:
+  GLMoleculeView(QWidget *parent=0);
+  virtual ~GLMoleculeView();
+};
+
+#endif /* GLMOLECULEVIEW_HPP_ */
Index: src/UIElements/Views/QT4/QTMoleculeView.cpp
===================================================================
--- src/UIElements/Views/QT4/QTMoleculeView.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/Views/QT4/QTMoleculeView.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,92 @@
+/*
+ * QTMoleculeView.cpp
+ *
+ *  Created on: Mar 4, 2010
+ *      Author: crueger
+ */
+
+#include "Views/QT4/QTMoleculeView.hpp"
+
+#include <iostream>
+#include "molecule.hpp"
+
+
+using namespace std;
+
+/***************** Basic structure for tab layout ***********/
+
+QTMoleculeView::QTMoleculeView() :
+    QTabWidget()
+{
+  allPage = new QTAllMoleculePage();
+  addTab(allPage,QString("All Molecules"));
+
+  connect(this,SIGNAL(addMolecule(molecule*)),allPage,SLOT(addMolecule(molecule*)));
+  connect(this,SIGNAL(removeMolecule(molecule*)),allPage,SLOT(removeMolecule(molecule*)));
+}
+
+QTMoleculeView::~QTMoleculeView()
+{}
+
+void QTMoleculeView::moleculeSelected(molecule *mol){
+  if(!pages.count(mol)){
+    string molName = mol->GetName();
+    QTMoleculePage *molPage = new QTMoleculePage(mol,molName);
+    addTab(molPage,QString(molName.c_str()));
+    pages[mol] = molPage;
+
+    connect(molPage,SIGNAL(nameChanged(QTMoleculePage*,std::string)),this,SLOT(nameChanged(QTMoleculePage*,std::string)));
+
+    emit addMolecule(mol);
+  }
+}
+
+void QTMoleculeView::moleculeUnSelected(molecule *mol){
+  if(pages.count(mol)){
+    QTMoleculePage *molPage = pages[mol];
+    removeTab(indexOf(molPage));
+    pages.erase(mol);
+    delete molPage;
+    emit removeMolecule(mol);
+  }
+}
+
+void QTMoleculeView::nameChanged(QTMoleculePage *page, std::string name){
+  setTabText(indexOf(page),QString(name.c_str()));
+}
+
+/************************ Tab for all Molecules ********************/
+
+QTAllMoleculePage::QTAllMoleculePage() :
+  Observer("QTAllMoleculePage")
+{}
+
+void QTAllMoleculePage::addMolecule(molecule *mol){}
+
+void QTAllMoleculePage::removeMolecule(molecule *mol){}
+
+void QTAllMoleculePage::update(Observable *subject){}
+
+void QTAllMoleculePage::subjectKilled(Observable *subject){}
+
+/************************ Tab for single Molecules *****************/
+
+QTMoleculePage::QTMoleculePage(molecule *_mol, string _name) :
+    Observer("QTMoleculePage"),
+    mol(_mol), name(_name)
+{
+  mol->signOn(this);
+}
+
+QTMoleculePage::~QTMoleculePage(){
+  mol->signOff(this);
+}
+
+void QTMoleculePage::update(Observable *subject){
+  if(name != mol->GetName()){
+    name = mol->GetName();
+    emit nameChanged(this,name);
+  }
+}
+
+void QTMoleculePage::subjectKilled(Observable *subject){}
Index: src/UIElements/Views/QT4/QTMoleculeView.hpp
===================================================================
--- src/UIElements/Views/QT4/QTMoleculeView.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/Views/QT4/QTMoleculeView.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,77 @@
+/*
+ * MoleculeView.hpp
+ *
+ *  Created on: Mar 4, 2010
+ *      Author: crueger
+ */
+
+#ifndef MOLECULEVIEW_HPP_
+#define MOLECULEVIEW_HPP_
+
+#include <string>
+#include <QtGui/QTabWidget>
+#include "Patterns/Observer.hpp"
+
+class molecule;
+
+// Forwarding of the Tab-Pages
+class QTAllMoleculePage;
+class QTMoleculePage;
+
+class QTMoleculeView : public QTabWidget
+{
+  Q_OBJECT
+public:
+  QTMoleculeView();
+  virtual ~QTMoleculeView();
+
+public slots:
+  void moleculeSelected(molecule *);
+  void moleculeUnSelected(molecule *);
+
+  void nameChanged(QTMoleculePage *page, std::string name);
+
+signals:
+  void addMolecule(molecule *);
+  void removeMolecule(molecule *);
+
+
+private:
+  QTAllMoleculePage *allPage; //!< contained widget to cary information of all selected molecules
+  std::map<molecule*,QTMoleculePage *> pages;//!< contained widget to cary information on a specific molecule
+};
+
+/**
+ * Widget to display the tab page for all selected molecules
+ */
+class QTAllMoleculePage : public QWidget, public Observer {
+  Q_OBJECT
+public:
+  QTAllMoleculePage();
+  void update(Observable *subject);
+  void subjectKilled(Observable *subject);
+public slots:
+  void addMolecule(molecule *mol);
+  void removeMolecule(molecule *mol);
+};
+
+/**
+ * Widget to display the tab page for a single molecule
+ */
+class QTMoleculePage : public QWidget,  public Observer {
+  Q_OBJECT
+public:
+  QTMoleculePage(molecule *_mol,std::string _name);
+  virtual ~QTMoleculePage();
+
+  void update(Observable *subject);
+  void subjectKilled(Observable *subject);
+
+signals:
+  void nameChanged(QTMoleculePage*,std::string);
+
+private:
+  molecule *mol;
+  std::string name;
+};
+#endif /* MOLECULEVIEW_HPP_ */
Index: src/UIElements/Views/QT4/QTStatusBar.cpp
===================================================================
--- src/UIElements/Views/QT4/QTStatusBar.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/Views/QT4/QTStatusBar.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,113 @@
+/*
+ * QTStatusBar.cpp
+ *
+ *  Created on: Feb 17, 2010
+ *      Author: crueger
+ */
+
+#include <sstream>
+
+#include <QtGui/QLabel>
+#include <QtGui/QBoxLayout>
+#include <QtGui/QProgressBar>
+
+#include "QTStatusBar.hpp"
+#include "World.hpp"
+#include "helpers.hpp"
+#include "Actions/Process.hpp"
+
+
+QTStatusBar::QTStatusBar(QWidget *_parent) :
+  QStatusBar(_parent),
+  Observer("QTStatusBar"),
+  parent(_parent),
+  atomCount(World::getInstance().numAtoms()),
+  moleculeCount(World::getInstance().numMolecules())
+{
+  World::getInstance().signOn(this);
+  Process::AddObserver(this);
+  statusLabel = new QLabel(this);
+  statusLabel->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
+  addPermanentWidget(statusLabel);
+  redrawStatus();
+}
+
+QTStatusBar::~QTStatusBar()
+{
+  Process::RemoveObserver(this);
+  World::getInstance().signOff(this);
+}
+
+void QTStatusBar::update(Observable *subject){
+  if (subject==World::getPointer()){
+    atomCount = World::getInstance().numAtoms();
+    moleculeCount = World::getInstance().numMolecules();
+    redrawStatus();
+  }
+  else {
+    // we probably have some process
+    Process *proc;
+    if((proc=dynamic_cast<Process*>(subject))){
+      redrawProcess(proc);
+    }
+  }
+}
+
+void QTStatusBar::subjectKilled(Observable *subject){
+  // Processes don't notify when they are killed
+  atomCount = World::getInstance().numAtoms();
+  moleculeCount = World::getInstance().numMolecules();
+  World::getInstance().signOn(this);
+  redrawStatus();
+}
+
+void QTStatusBar::redrawStatus(){
+  stringstream sstr;
+  sstr << "You have " << atomCount << " atom" << PLURAL_S(atomCount)
+       <<" in " << moleculeCount << " molecule" << PLURAL_S(moleculeCount);
+  statusLabel->setText(QString(sstr.str().c_str()));
+}
+
+void QTStatusBar::redrawProcess(Process *proc){
+  progressIndicator *ind=0;
+  // see what we have to do with the process
+  if(proc->doesStart()){
+    ind = new progressIndicator(proc->getName());
+    ind->bar->setMaximum(proc->getMaxSteps());
+    progressBars.insert(pair<Process*,progressIndicator*>(proc,ind));
+  }
+  else {
+    ind = progressBars[proc];
+  }
+  if(activeProcess!=proc){
+    addWidget(ind->container);
+    activeProcess = proc;
+  }
+  ind->bar->setValue(proc->getCurrStep());
+  parent->repaint();
+  if(proc->doesStop()){
+    removeWidget(ind->container);
+    activeProcess = 0;
+    progressBars.erase(proc);
+    delete ind;
+  }
+}
+
+
+
+QTStatusBar::progressIndicator::progressIndicator(string name){
+  stringstream sstr;
+  sstr << "Busy (" << name << ")";
+  container = new QWidget();
+  layout = new QHBoxLayout(container);
+  label = new QLabel(QString(sstr.str().c_str()));
+  bar = new QProgressBar();
+
+  layout->addWidget(label);
+  layout->addWidget(bar);
+  container->setLayout(layout);
+}
+
+QTStatusBar::progressIndicator::~progressIndicator(){
+  delete container;
+}
Index: src/UIElements/Views/QT4/QTStatusBar.hpp
===================================================================
--- src/UIElements/Views/QT4/QTStatusBar.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/Views/QT4/QTStatusBar.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,55 @@
+/*
+ * QTStatusBar.hpp
+ *
+ *  Created on: Feb 17, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTSTATUSBAR_HPP_
+#define QTSTATUSBAR_HPP_
+
+#include <map>
+#include <utility>
+#include <string>
+#include <QtGui/QStatusBar>
+
+#include "Patterns/Observer.hpp"
+
+class QLabel;
+class QProgressBar;
+class Process;
+class QBoxLayout;
+
+class QTStatusBar : public QStatusBar, public Observer
+{
+  Q_OBJECT
+
+  struct progressIndicator{
+    progressIndicator(std::string);
+    ~progressIndicator();
+    QLabel *label;
+    QProgressBar *bar;
+    QBoxLayout *layout;
+    QWidget *container;
+  };
+public:
+  QTStatusBar(QWidget *parent=0);
+  virtual ~QTStatusBar();
+
+  void update(Observable *subject);
+  void subjectKilled(Observable *subject);
+
+private:
+  void redrawStatus();
+  void redrawProcess(Process *proc);
+
+  int atomCount;
+  int moleculeCount;
+
+  QLabel *statusLabel;
+  QWidget *parent;
+  std::map<Process*,progressIndicator*> progressBars;
+  Process* activeProcess;
+};
+
+#endif /* QTSTATUSBAR_HPP_ */
Index: src/UIElements/Views/QT4/QTWorldView.cpp
===================================================================
--- src/UIElements/Views/QT4/QTWorldView.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/Views/QT4/QTWorldView.cpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,131 @@
+/*
+ * QTWorldView.cpp
+ *
+ *  Created on: Jan 21, 2010
+ *      Author: crueger
+ */
+
+#include "Views/QT4/QTWorldView.hpp"
+
+#include <iostream>
+
+#include "atom.hpp"
+#include "molecule.hpp"
+
+using namespace std;
+
+// maybe this should go with the definition of molecules
+
+// some attributes need to be easier to find for molecules
+// these attributes are skiped so far
+const int QTWorldView::COLUMNCOUNT = COLUMNTYPES_MAX;
+const char *QTWorldView::COLUMNNAMES[QTWorldView::COLUMNCOUNT]={"Name","Atoms"/*,"Formula"*/,"Center"/*,"Size"*/};
+
+QTWorldView::QTWorldView(QWidget * _parent) :
+  QTableWidget (_parent),
+  Observer("QTWorldView")
+{
+  setRowCount(0);
+  setColumnCount(COLUMNCOUNT);
+
+  for(int i=0; i<COLUMNCOUNT;++i) {
+    QTableWidgetItem *heading = new QTableWidgetItem();
+    heading->setText(QString(COLUMNNAMES[i]));
+    setHorizontalHeaderItem(i,heading);
+  }
+
+  molecules = World::getInstance().getMolecules();
+  molecules->signOn(this);
+  update(molecules);
+
+  connect(this,SIGNAL(cellChanged(int,int)),this,SLOT(moleculeChanged(int,int)));
+  connect(this,SIGNAL(cellClicked(int,int)),this,SLOT(cellSelected(int,int)));
+
+}
+
+QTWorldView::~QTWorldView()
+{
+  molecules->signOff(this);
+}
+
+void QTWorldView::update(Observable *publisher) {
+  int numMolecules = molecules->ListOfMolecules.size();
+  setRowCount(numMolecules);
+  molSelection.resize(numMolecules);
+  int i;
+  MoleculeList::iterator iter;
+  for(iter = molecules->ListOfMolecules.begin(),i=0;
+      iter != molecules->ListOfMolecules.end();
+      ++i,++iter) {
+
+    const int index = (*iter)->IndexNr;
+    QTableWidgetItem *indexWidget = new QTableWidgetItem();
+    // there probably is an easier method to convert ints to QStrings... but i didn't find it
+    stringstream idxsstr;
+    idxsstr << index;
+    indexWidget->setText(QString(idxsstr.str().c_str()));
+    indexWidget->setData(Qt::UserRole,QVariant(index));
+    setVerticalHeaderItem(i,indexWidget);
+
+    const string name = (*iter)->getName();
+    QTableWidgetItem *nameWidget = new QTableWidgetItem();
+    nameWidget->setText(QString(name.c_str()));
+    setItem(i,NAME,nameWidget);
+
+    const int atomCount = (*iter)->getAtomCount();
+    QTableWidgetItem *countWidget= new QTableWidgetItem();
+    stringstream countsstr;
+    countsstr << atomCount;
+    countWidget->setText(QString(countsstr.str().c_str()));
+    countWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+    setItem(i,ATOMS,countWidget);
+
+    const Vector center = (*iter)->Center;
+    QTableWidgetItem *centerWidget = new QTableWidgetItem();
+    stringstream centersstr;
+    centersstr << center;
+    centerWidget->setText(QString(centersstr.str().c_str()));
+    setItem(i,CENTER,centerWidget);
+    centerWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+
+    molSelection[i]=nameWidget->isSelected();
+  }
+}
+
+void QTWorldView::subjectKilled(Observable *publisher) {
+}
+
+void QTWorldView::moleculeChanged(int row, int column) {
+  int idx = verticalHeaderItem(row)->data(Qt::UserRole).toInt();
+  molecule *mol = molecules->ReturnIndex(idx);
+  string cellValue = item(row,NAME)->text().toStdString();
+  if(mol->getName() != cellValue && cellValue !="") {
+    mol->setName(cellValue);
+  }
+  else if(cellValue==""){
+    item(row,NAME)->setText(QString(mol->getName().c_str()));
+  }
+}
+
+
+void QTWorldView::cellSelected(int row, int column){
+  bool state = item(row,column)->isSelected();
+  for(int i = 0; i<COLUMNCOUNT; i++){
+    item(row,i)->setSelected(state);
+  }
+  // figure out which rows have changed
+  for(int i=0; i<rowCount();++i){
+    state = item(i,0)->isSelected();
+    if(molSelection[i]!=state){
+      int idx = verticalHeaderItem(i)->data(Qt::UserRole).toInt();
+      molecule *mol = molecules->ReturnIndex(idx);
+      if(state){
+        emit moleculeSelected(mol);
+      }
+      else{
+        emit moleculeUnSelected(mol);
+      }
+      molSelection[i]=state;
+    }
+  }
+}
Index: src/UIElements/Views/QT4/QTWorldView.hpp
===================================================================
--- src/UIElements/Views/QT4/QTWorldView.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
+++ src/UIElements/Views/QT4/QTWorldView.hpp	(revision 5ec8e3b251db03ba84a62d656f8f84526948e941)
@@ -0,0 +1,47 @@
+/*
+ * QTWorldView.hpp
+ *
+ *  Created on: Jan 21, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTMOLECULESVIEW_HPP_
+#define QTMOLECULESVIEW_HPP_
+
+#include <QtGui/QTableWidget>
+#include "Patterns/Observer.hpp"
+
+class molecule;
+class MoleculeListClass;
+
+class QTWorldView : public QTableWidget, public Observer
+{
+  Q_OBJECT
+
+public:
+  QTWorldView(QWidget * _parent=0);
+  virtual ~QTWorldView();
+
+protected:
+  virtual void update(Observable *publisher);
+  virtual void subjectKilled(Observable *publisher);
+
+  static const int COLUMNCOUNT;
+  enum {NAME,ATOMS,CENTER,COLUMNTYPES_MAX} COLUMNTYPES;
+  static const char *COLUMNNAMES[];
+
+private slots:
+  void moleculeChanged(int row, int column);
+
+  void cellSelected(int row, int column);
+
+signals:
+  void moleculeSelected(molecule*);
+  void moleculeUnSelected(molecule*);
+
+private:
+  std::vector<bool> molSelection; //!< needed to determine when a selection changes
+  MoleculeListClass *molecules;
+};
+
+#endif /* QTMOLECULESVIEW_HPP_ */
