Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ src/Makefile.am	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -120,23 +120,23 @@
   Thermostats/Woodcock.hpp
 
-QTUIMOC_HEADER = UIElements/QT4/QTDialog.hpp \
-	UIElements/QT4/QTMainWindow.hpp \
-	UIElements/Menu/QT4/QTMenu.hpp \
-	UIElements/Views/QT4/QTWorldView.hpp \
-	UIElements/Views/QT4/GLMoleculeView.hpp \
-	UIElements/Views/QT4/QTMoleculeView.hpp \
-	UIElements/Views/QT4/QTStatusBar.hpp
+QTUIMOC_HEADER = UIElements/Qt4/QtDialog.hpp \
+	UIElements/Qt4/QtMainWindow.hpp \
+	UIElements/Menu/Qt4/QtMenu.hpp \
+	UIElements/Views/Qt4/QtWorldView.hpp \
+	UIElements/Views/Qt4/GLMoleculeView.hpp \
+	UIElements/Views/Qt4/QtMoleculeView.hpp \
+	UIElements/Views/Qt4/QtStatusBar.hpp
 				  
 QTUISOURCE = allmocs.moc.cpp \
-	UIElements/QT4/QTMainWindow.cpp \
-	UIElements/QT4/QTDialog.cpp \
-	UIElements/QT4/QTUIFactory.cpp \
-	UIElements/Menu/QT4/QTMenu.cpp \
-	UIElements/Views/QT4/QTWorldView.cpp \
-	UIElements/Views/QT4/GLMoleculeView.cpp \
-	UIElements/Views/QT4/QTMoleculeView.cpp \
-	UIElements/Views/QT4/QTStatusBar.cpp
+	UIElements/Qt4/QtMainWindow.cpp \
+	UIElements/Qt4/QtDialog.cpp \
+	UIElements/Qt4/QtUIFactory.cpp \
+	UIElements/Menu/Qt4/QtMenu.cpp \
+	UIElements/Views/Qt4/QtWorldView.cpp \
+	UIElements/Views/Qt4/GLMoleculeView.cpp \
+	UIElements/Views/Qt4/QtMoleculeView.cpp \
+	UIElements/Views/Qt4/QtStatusBar.cpp
              
-QTUIHEADER = ${QTUIMOC_HEADER} UIElements/QT4/QTUIFactory.hpp
+QTUIHEADER = ${QTUIMOC_HEADER} UIElements/Qt4/QtUIFactory.hpp
 
 QTUI_DEFS =
@@ -317,7 +317,7 @@
 	$(BOOST_LIB)
 
-#Stuff for building the GUI using QT
+#Stuff for building the GUI using Qt
 molecuildergui_SOURCES = ${QTUISOURCE} builder.cpp
-molecuildergui_CXXFLAGS = ${QT_CXXFLAGS} ${GLU_CXXFLAGS} -DUSE_GUI_QT
+molecuildergui_CXXFLAGS = ${QT_CXXFLAGS} ${GLU_CXXFLAGS} -DUSE_GUI_Qt
 molecuildergui_LDFLAGS = $(BOOST_LIB) ${QT_LDFLAGS} ${GLU_LDFLAGS}
 
@@ -358,5 +358,5 @@
 	$(BOOST_LIB)
 
-#Rules needed for QT4
+#Rules needed for Qt4
 # UI-Files are scattered throughout several subdirectories
 # Therfore `%'-rules do not seem to work
Index: src/UIElements/Dialog.hpp
===================================================================
--- src/UIElements/Dialog.hpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ src/UIElements/Dialog.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -95,8 +95,8 @@
    *  -# now, for each of the GUIs we basically have to repeat the above, i.e.
    *     add the class and the function that implement the virtual ones above.
-   *    -# QT: an extra class called ValueQTQueryPipe that actually handles
+   *    -# QT: an extra class called ValueQtQueryPipe that actually handles
    *       showing dialogs to obtain the value and placing it into the \a tmp
    *       variable (via a given pointer to it as reference). handle() will
-   *       simply return true. This is needed because of a restriction of QT4:
+   *       simply return true. This is needed because of a restriction of Qt4:
    *       its meta-object-compiler does not like nested classes.
    *    -# CommandLine: nothing special, handle() imports value from \a
Index: c/UIElements/Menu/QT4/QTMenu.cpp
===================================================================
--- src/UIElements/Menu/QT4/QTMenu.cpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,69 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * QTMenu.cpp
- *
- *  Created on: Jan 15, 2010
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Menu/QT4/QTMenu.hpp"
-
-#include <Qt/qaction.h>
-
-#include "Helpers/MemDebug.hpp"
-
-#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: c/UIElements/Menu/QT4/QTMenu.hpp
===================================================================
--- src/UIElements/Menu/QT4/QTMenu.hpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- * 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/Menu/Qt4/QtMenu.cpp
===================================================================
--- src/UIElements/Menu/Qt4/QtMenu.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Menu/Qt4/QtMenu.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,69 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * QtMenu.cpp
+ *
+ *  Created on: Jan 15, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Menu/Qt4/QtMenu.hpp"
+
+#include <Qt/qaction.h>
+
+#include "Helpers/MemDebug.hpp"
+
+#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 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Menu/Qt4/QtMenu.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -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: c/UIElements/QT4/IntQTQuery.ui
===================================================================
--- src/UIElements/QT4/IntQTQuery.ui	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,68 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Form</class>
- <widget class="QWidget" name="Form">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>400</width>
-    <height>300</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <widget class="QLabel" name="label">
-   <property name="geometry">
-    <rect>
-     <x>20</x>
-     <y>30</y>
-     <width>59</width>
-     <height>17</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>TextLabel</string>
-   </property>
-  </widget>
-  <widget class="QLineEdit" name="lineEdit">
-   <property name="geometry">
-    <rect>
-     <x>100</x>
-     <y>20</y>
-     <width>113</width>
-     <height>27</height>
-    </rect>
-   </property>
-  </widget>
-  <widget class="QPushButton" name="pushButton">
-   <property name="geometry">
-    <rect>
-     <x>20</x>
-     <y>70</y>
-     <width>92</width>
-     <height>27</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>OK</string>
-   </property>
-  </widget>
-  <widget class="QPushButton" name="pushButton_2">
-   <property name="geometry">
-    <rect>
-     <x>140</x>
-     <y>70</y>
-     <width>92</width>
-     <height>27</height>
-    </rect>
-   </property>
-   <property name="text">
-    <string>Cancel</string>
-   </property>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>
Index: c/UIElements/QT4/IntsQTQuery.ui
===================================================================
--- src/UIElements/QT4/IntsQTQuery.ui	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,151 +1,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Form</class>
- <widget class="QWidget" name="Form">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>740</width>
-    <height>444</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <widget class="QWidget" name="horizontalLayoutWidget">
-   <property name="geometry">
-    <rect>
-     <x>10</x>
-     <y>240</y>
-     <width>421</width>
-     <height>51</height>
-    </rect>
-   </property>
-   <layout class="QHBoxLayout" name="horizontalLayout">
-    <item>
-     <spacer name="horizontalSpacer">
-      <property name="orientation">
-       <enum>Qt::Horizontal</enum>
-      </property>
-      <property name="sizeHint" stdset="0">
-       <size>
-        <width>40</width>
-        <height>20</height>
-       </size>
-      </property>
-     </spacer>
-    </item>
-    <item>
-     <widget class="QPushButton" name="pushButton">
-      <property name="text">
-       <string>OK</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QPushButton" name="pushButton_2">
-      <property name="text">
-       <string>Cancel</string>
-      </property>
-     </widget>
-    </item>
-   </layout>
-  </widget>
-  <widget class="QWidget" name="verticalLayoutWidget">
-   <property name="geometry">
-    <rect>
-     <x>280</x>
-     <y>0</y>
-     <width>160</width>
-     <height>221</height>
-    </rect>
-   </property>
-   <layout class="QVBoxLayout" name="verticalLayout">
-    <item>
-     <widget class="QLabel" name="label">
-      <property name="text">
-       <string>Enter Integer:</string>
-      </property>
-      <property name="buddy">
-       <cstring>lineEdit</cstring>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QLineEdit" name="lineEdit">
-      <property name="minimumSize">
-       <size>
-        <width>100</width>
-        <height>20</height>
-       </size>
-      </property>
-      <property name="toolTip">
-       <string>Enter an integer and press Add.</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QPushButton" name="pushButton_3">
-      <property name="enabled">
-       <bool>false</bool>
-      </property>
-      <property name="text">
-       <string>Add</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QPushButton" name="pushButton_4">
-      <property name="enabled">
-       <bool>false</bool>
-      </property>
-      <property name="text">
-       <string>Remove</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <spacer name="verticalSpacer">
-      <property name="orientation">
-       <enum>Qt::Vertical</enum>
-      </property>
-      <property name="sizeHint" stdset="0">
-       <size>
-        <width>20</width>
-        <height>40</height>
-       </size>
-      </property>
-     </spacer>
-    </item>
-   </layout>
-  </widget>
-  <widget class="QWidget" name="verticalLayoutWidget_2">
-   <property name="geometry">
-    <rect>
-     <x>10</x>
-     <y>0</y>
-     <width>261</width>
-     <height>221</height>
-    </rect>
-   </property>
-   <layout class="QVBoxLayout" name="verticalLayout_2">
-    <item>
-     <widget class="QLabel" name="label_2">
-      <property name="text">
-       <string>Current List of Integers:</string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <widget class="QListWidget" name="listWidget"/>
-    </item>
-   </layout>
-  </widget>
- </widget>
- <tabstops>
-  <tabstop>pushButton</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
Index: c/UIElements/QT4/QTDialog.cpp
===================================================================
--- src/UIElements/QT4/QTDialog.cpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,1188 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * QTDialog.cpp
- *
- *  Created on: Jan 18, 2010
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "UIElements/QT4/QTDialog.hpp"
-
-#include <boost/lexical_cast.hpp>
-
-#include <string>
-#include <sstream>
-#include <limits>
-
-#include <QtGui/QDoubleSpinBox>
-#include <Qt/qboxlayout.h>
-#include <Qt/qcombobox.h>
-#include <Qt/qdialogbuttonbox.h>
-#include <Qt/qlabel.h>
-#include <Qt/qlineedit.h>
-#include <Qt/qlistwidget.h>
-#include <Qt/qpushbutton.h>
-#include <Qt/qspinbox.h>
-#include <Qt/qtablewidget.h>
-
-#include <boost/lexical_cast.hpp>
-
-#include "Helpers/MemDebug.hpp"
-
-#include "World.hpp"
-#include "periodentafel.hpp"
-#include "atom.hpp"
-#include "element.hpp"
-#include "molecule.hpp"
-#include "Descriptors/AtomIdDescriptor.hpp"
-#include "Descriptors/MoleculeIdDescriptor.hpp"
-#include "LinearAlgebra/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(const char* title, std::string)
-{
-  registerQuery(new EmptyQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryBoolean(const char* title,string)
-{
-  registerQuery(new BooleanQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryAtom(const char* title, std::string)
-{
-  registerQuery(new AtomQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryAtoms(const char* title, std::string)
-{
-  registerQuery(new AtomsQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryBox(const char* title, std::string)
-{
-  registerQuery(new BoxQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryInt(const char *title,string)
-{
-  registerQuery(new IntQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryInts(const char *title,string)
-{
-  registerQuery(new IntsQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryDouble(const char* title,string)
-{
-  registerQuery(new DoubleQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryDoubles(const char* title,string)
-{
-  registerQuery(new DoublesQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryString(const char* title,string)
-{
-  registerQuery(new StringQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryStrings(const char* title,string)
-{
-  registerQuery(new StringsQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryMolecule(const char *title,string)
-{
-  registerQuery(new MoleculeQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryMolecules(const char *title,string)
-{
-  registerQuery(new MoleculesQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryVector(const char* title, bool check,string)
-{
-  registerQuery(new VectorQTQuery(title,check,inputLayout,this));
-}
-
-void QTDialog::queryVectors(const char* title, bool check,string)
-{
-  registerQuery(new VectorsQTQuery(title,check,inputLayout,this));
-}
-
-void QTDialog::queryElement(const char* title, std::string)
-{
-  registerQuery(new ElementQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryElements(const char* title, std::string)
-{
-  registerQuery(new ElementsQTQuery(title,inputLayout,this));
-}
-
-void QTDialog::queryFile(const char* title, std::string)
-{
-  registerQuery(new FileQTQuery(title,inputLayout,this));
-}
-
-/************************** Query Objects *******************************/
-
-QTDialog::BoxQTQuery::BoxQTQuery(string _title,QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::BoxQuery(_title),
-    parent(_parent)
-{
-  thisLayout = new QHBoxLayout();
-  titleLabel = new QLabel(QString(getTitle().c_str()));
-
-  // init input table
-  inputTable = new QTableWidget(3,3, _dialog);
-  QStringList CoordinateList;
-  CoordinateList << "x" << "y" << "z";
-  inputTable->setHorizontalHeaderLabels(CoordinateList);
-  inputTable->setVerticalHeaderLabels(CoordinateList);
-
-  pipe = new BoxQTQueryPipe(tmp,_dialog, inputTable);
-
-  // fill the box with current matrix
-  const Matrix &domain = World::getInstance().getDomain().getM();
-  for (int i=0;i<3;i++)
-    for (int j=0;j<3;j++) {
-      QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(domain.at(i,j)));
-      inputTable->setItem(i,j,newItem);
-      pipe->update(i,j);
-    }
-
-  parent->addLayout(thisLayout);
-  thisLayout->addWidget(titleLabel);
-  thisLayout->addWidget(inputTable);
-
-  connect(inputTable,SIGNAL(cellChanged(int,int)),pipe,SLOT(update(int,int)));
-}
-
-QTDialog::BoxQTQuery::~BoxQTQuery()
-{
-  delete pipe;
-}
-
-bool QTDialog::BoxQTQuery::handle() {
-  return true;
-}
-
-
-QTDialog::AtomQTQuery::AtomQTQuery(string _title,QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::AtomQuery(_title),
-    parent(_parent)
-{
-  thisLayout = new QHBoxLayout();
-  titleLabel = new QLabel(QString(getTitle().c_str()));
-  inputBox = new QComboBox();
-  inputBox->insertItem(-1, QString("no atom"));
-  std::vector<atom *> atoms = World::getInstance().getAllAtoms();
-  for (std::vector<atom *>::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter)
-    inputBox->insertItem((*iter)->getNr(),QString::fromStdString((*iter)->getName()));
-
-  parent->addLayout(thisLayout);
-  thisLayout->addWidget(titleLabel);
-  thisLayout->addWidget(inputBox);
-
-  pipe = new AtomQTQueryPipe(&tmp,_dialog, inputBox);
-  pipe->update(inputBox->currentIndex());
-  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
-}
-
-QTDialog::AtomQTQuery::~AtomQTQuery()
-{
-  delete pipe;
-}
-
-bool QTDialog::AtomQTQuery::handle() {
-  return true;
-}
-
-
-QTDialog::AtomsQTQuery::AtomsQTQuery(string _title,QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::AtomsQuery(_title),
-    parent(_parent)
-{
-  QHBoxLayout * thisHLayout = new QHBoxLayout();
-  QVBoxLayout * thisV1Layout = new QVBoxLayout();
-  QVBoxLayout * thisV2Layout = new QVBoxLayout();
-
-  QLabel *titleLabel = new QLabel(QString(getTitle().c_str()));
-  QLabel *inputLabel = new QLabel("Enter to add");
-  QListWidget* inputList = new QListWidget();
-  inputList->setSelectionMode(QAbstractItemView::ExtendedSelection);
-  std::vector<atom *> atoms = World::getInstance().getAllAtoms();
-  for (std::vector<atom *>::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter)
-    inputBox->insertItem((*iter)->getNr(),QString((*iter)->getNr()));
-
-  QLineEdit* inputBox = new QLineEdit();
-  inputLabel->setBuddy(inputBox);
-  titleLabel->setBuddy(inputList);
-  QPushButton* AddButton = new QPushButton("Add");
-  AddButton->setEnabled(false);
-  QPushButton* RemoveButton = new QPushButton("Remove");
-  RemoveButton->setEnabled(false);
-
-  thisV1Layout->addWidget(titleLabel);
-  thisV1Layout->addWidget(inputList);
-  thisV2Layout->addWidget(inputLabel);
-  thisV2Layout->addWidget(inputBox);
-  thisV2Layout->addWidget(AddButton);
-  thisV2Layout->addWidget(RemoveButton);
-  parent->addLayout(thisHLayout);
-  thisHLayout->addLayout(thisV1Layout);
-  thisHLayout->addLayout(thisV2Layout);
-
-  pipe = new AtomsQTQueryPipe(&tmp,_dialog,inputList);
-  connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected()));
-  connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(add()));
-  connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(remove()));
-}
-
-QTDialog::AtomsQTQuery::~AtomsQTQuery()
-{
-  delete pipe;
-}
-
-bool QTDialog::AtomsQTQuery::handle() {
-  return true;
-}
-
-QTDialog::IntQTQuery::IntQTQuery(string _title,QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::IntQuery(_title),
-    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;
-}
-
-bool QTDialog::IntQTQuery::handle() {
-  return true;
-}
-
-
-QTDialog::IntsQTQuery::IntsQTQuery(string _title,QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::IntsQuery(_title),
-    parent(_parent)
-{
-  QHBoxLayout * thisHLayout = new QHBoxLayout();
-  QVBoxLayout * thisV1Layout = new QVBoxLayout();
-  QVBoxLayout * thisV2Layout = new QVBoxLayout();
-
-  QLabel *titleLabel = new QLabel(QString(getTitle().c_str()));
-  QLabel *inputLabel = new QLabel("Enter to add");
-  QListWidget* inputList = new QListWidget();
-  inputList->setSelectionMode(QAbstractItemView::ExtendedSelection);
-  QLineEdit* inputBox = new QLineEdit();
-  inputLabel->setBuddy(inputBox);
-  titleLabel->setBuddy(inputList);
-  QPushButton* AddButton = new QPushButton("Add");
-  AddButton->setEnabled(false);
-  QPushButton* RemoveButton = new QPushButton("Remove");
-  RemoveButton->setEnabled(false);
-
-  thisV1Layout->addWidget(titleLabel);
-  thisV1Layout->addWidget(inputList);
-  thisV2Layout->addWidget(inputLabel);
-  thisV2Layout->addWidget(inputBox);
-  thisV2Layout->addWidget(AddButton);
-  thisV2Layout->addWidget(RemoveButton);
-  parent->addLayout(thisHLayout);
-  thisHLayout->addLayout(thisV1Layout);
-  thisHLayout->addLayout(thisV2Layout);
-
-  pipe = new QTQueryListPipe<int>(&tmp,_dialog,inputBox,inputList,AddButton,RemoveButton);
-  connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(IntegerEntered(const QString&)));
-  connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected()));
-  connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(AddValue()));
-  connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(RemoveRow()));
-}
-
-QTDialog::IntsQTQuery::~IntsQTQuery()
-{
-  delete pipe;
-}
-
-bool QTDialog::IntsQTQuery::handle() {
-  return true;
-}
-
-
-QTDialog::DoubleQTQuery::DoubleQTQuery(string title,QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::DoubleQuery(title),
-    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::DoublesQTQuery::DoublesQTQuery(string title,QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::DoublesQuery(title),
-    parent(_parent)
-{
-  QHBoxLayout * thisHLayout = new QHBoxLayout();
-  QVBoxLayout * thisV1Layout = new QVBoxLayout();
-  QVBoxLayout * thisV2Layout = new QVBoxLayout();
-
-  QLabel *titleLabel = new QLabel(QString(getTitle().c_str()));
-  QLabel *inputLabel = new QLabel("Enter to add");
-  QListWidget* inputList = new QListWidget();
-  inputList->setSelectionMode(QAbstractItemView::ExtendedSelection);
-  QLineEdit* inputBox = new QLineEdit();
-  inputLabel->setBuddy(inputBox);
-  titleLabel->setBuddy(inputList);
-  QPushButton* AddButton = new QPushButton("Add");
-  AddButton->setEnabled(false);
-  QPushButton* RemoveButton = new QPushButton("Remove");
-  RemoveButton->setEnabled(false);
-
-  thisV1Layout->addWidget(titleLabel);
-  thisV1Layout->addWidget(inputList);
-  thisV2Layout->addWidget(inputLabel);
-  thisV2Layout->addWidget(inputBox);
-  thisV2Layout->addWidget(AddButton);
-  thisV2Layout->addWidget(RemoveButton);
-  parent->addLayout(thisHLayout);
-  thisHLayout->addLayout(thisV1Layout);
-  thisHLayout->addLayout(thisV2Layout);
-
-  pipe = new QTQueryListPipe<double>(&tmp,_dialog,inputBox,inputList,AddButton,RemoveButton);
-  connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(IntegerEntered(const QString&)));
-  connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected()));
-  connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(AddValue()));
-  connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(RemoveRow()));}
-
-QTDialog::DoublesQTQuery::~DoublesQTQuery()
-{
-  delete pipe;
-}
-
-bool QTDialog::DoublesQTQuery::handle() {
-  return true;
-}
-
-
-QTDialog::StringQTQuery::StringQTQuery(string _title,QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::StringQuery(_title),
-    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 std::string are valid
-bool QTDialog::StringQTQuery::handle()
-{
-  return tmp!="";
-}
-
-QTDialog::StringsQTQuery::StringsQTQuery(string _title,QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::StringsQuery(_title),
-    parent(_parent)
-{
-  QHBoxLayout * thisHLayout = new QHBoxLayout();
-  QVBoxLayout * thisV1Layout = new QVBoxLayout();
-  QVBoxLayout * thisV2Layout = new QVBoxLayout();
-
-  QLabel *titleLabel = new QLabel(QString(getTitle().c_str()));
-  QLabel *inputLabel = new QLabel("Enter to add");
-  QListWidget* inputList = new QListWidget();
-  inputList->setSelectionMode(QAbstractItemView::ExtendedSelection);
-  QLineEdit* inputBox = new QLineEdit();
-  inputLabel->setBuddy(inputBox);
-  titleLabel->setBuddy(inputList);
-  QPushButton* AddButton = new QPushButton("Add");
-  AddButton->setEnabled(false);
-  QPushButton* RemoveButton = new QPushButton("Remove");
-  RemoveButton->setEnabled(false);
-
-  thisV1Layout->addWidget(titleLabel);
-  thisV1Layout->addWidget(inputList);
-  thisV2Layout->addWidget(inputLabel);
-  thisV2Layout->addWidget(inputBox);
-  thisV2Layout->addWidget(AddButton);
-  thisV2Layout->addWidget(RemoveButton);
-  parent->addLayout(thisHLayout);
-  thisHLayout->addLayout(thisV1Layout);
-  thisHLayout->addLayout(thisV2Layout);
-
-  pipe = new QTQueryListPipe<std::string>(&tmp,_dialog,inputBox,inputList,AddButton,RemoveButton);
-  connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(IntegerEntered(const QString&)));
-  connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected()));
-  connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(AddValue()));
-  connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(RemoveRow()));}
-
-QTDialog::StringsQTQuery::~StringsQTQuery()
-{
-  delete pipe;
-}
-
-// All values besides the empty std::string are valid
-bool QTDialog::StringsQTQuery::handle()
-{
-  // dissect by ","
-  std::string::iterator olditer = temp.begin();
-  for(string::iterator iter = temp.begin(); iter != temp.end(); ++iter) {
-    if (*iter == ' ') {
-      tmp.push_back(string(iter, olditer));
-      olditer = iter;
-    }
-  }
-  if (olditer != temp.begin())  // insert last part also
-    tmp.push_back(string(olditer, temp.end()));
-
-  return temp!="";
-}
-
-QTDialog::MoleculeQTQuery::MoleculeQTQuery(string _title, QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::MoleculeQuery(_title),
-    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) {
-    std::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::MoleculesQTQuery::MoleculesQTQuery(string _title, QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::MoleculesQuery(_title),
-    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) {
-    std::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 MoleculesQTQueryPipe(&tmp,_dialog,inputBox);
-  pipe->update(inputBox->currentIndex());
-  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
-}
-
-QTDialog::MoleculesQTQuery::~MoleculesQTQuery()
-{
-  delete pipe;
-}
-
-// Handling is easy, since the GUI makes it impossible to select invalid values
-bool QTDialog::MoleculesQTQuery::handle()
-{
-  return true;
-}
-
-QTDialog::VectorQTQuery::VectorQTQuery(std::string title, bool _check,QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::VectorQuery(title,_check),
-    parent(_parent)
-{
-  mainLayout= new QHBoxLayout();
-  titleLabel = new QLabel(QString(getTitle().c_str()));
-  mainLayout->addWidget(titleLabel);
-  subLayout = new QVBoxLayout();
-  mainLayout->addLayout(subLayout);
-  QComboBox* inputBox = new QComboBox();
-  coordLayout = new QHBoxLayout();
-  subLayout->addLayout(coordLayout);
-  coordLabel = new QLabel(QString("x,y,z"));
-  coordLayout->addWidget(coordLabel);
-  coordInput = new QDoubleSpinBox();
-//  coordInput->setRange(0,M.at(i,i));
-  coordInput->setDecimals(3);
-  coordLayout->addWidget(coordInput);
-  pipe = new VectorQTQueryPipe(&(tmp),_dialog,inputBox);
-  //pipe->update(coordInput->value());
-  connect(coordInput,SIGNAL(valueChanged(double)),pipe,SLOT(update(double)));
-  parent->addLayout(mainLayout);
-}
-
-QTDialog::VectorQTQuery::~VectorQTQuery()
-{}
-
-bool QTDialog::VectorQTQuery::handle() {
-  return true;
-}
-
-
-QTDialog::VectorsQTQuery::VectorsQTQuery(std::string title, bool _check,QBoxLayout *_parent,QTDialog *_dialog) :
-    Dialog::VectorsQuery(title,_check),
-    parent(_parent)
-{
-  mainLayout= new QHBoxLayout();
-  titleLabel = new QLabel(QString(getTitle().c_str()));
-  mainLayout->addWidget(titleLabel);
-  subLayout = new QVBoxLayout();
-  mainLayout->addLayout(subLayout);
-  QComboBox* inputBox = new QComboBox();
-  coordLayout = new QHBoxLayout();
-  subLayout->addLayout(coordLayout);
-  coordLabel = new QLabel(QString("x,y,z"));
-  coordLayout->addWidget(coordLabel);
-  coordInput = new QDoubleSpinBox();
-//  coordInput->setRange(0,M.at(i,i));
-  coordInput->setDecimals(3);
-  coordLayout->addWidget(coordInput);
-  pipe = new VectorsQTQueryPipe(&(tmp),_dialog,inputBox);
-  //pipe->update(coordInput->value());
-  connect(coordInput,SIGNAL(valueChanged(double)),pipe,SLOT(update(double)));
-  parent->addLayout(mainLayout);
-}
-
-QTDialog::VectorsQTQuery::~VectorsQTQuery()
-{}
-
-bool QTDialog::VectorsQTQuery::handle() {
-  return true;
-}
-
-
-QTDialog::ElementQTQuery::ElementQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog) :
-    Dialog::ElementQuery(_title),
-    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)
-  {
-    std::stringstream sstr;
-    sstr << (*iter).first << "\t" << (*iter).second->getName();
-    inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
-  }
-  parent->addLayout(thisLayout);
-  thisLayout->addWidget(titleLabel);
-  thisLayout->addWidget(inputBox);
-
-  pipe = new ElementQTQueryPipe(&tmp,_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;
-}
-
-
-QTDialog::ElementsQTQuery::ElementsQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog) :
-    Dialog::ElementsQuery(_title),
-    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)
-  {
-    std::stringstream sstr;
-    sstr << (*iter).first << "\t" << (*iter).second->getName();
-    inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
-  }
-  parent->addLayout(thisLayout);
-  thisLayout->addWidget(titleLabel);
-  thisLayout->addWidget(inputBox);
-
-  pipe = new ElementsQTQueryPipe(&tmp,_dialog,inputBox);
-  pipe->update(inputBox->currentIndex());
-  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
-}
-
-QTDialog::ElementsQTQuery::~ElementsQTQuery()
-{
-  delete pipe;
-}
-
-bool QTDialog::ElementsQTQuery::handle(){
-  return true;
-}
-
-QTDialog::EmptyQTQuery::EmptyQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog) :
-    Dialog::EmptyQuery(_title),
-    parent(_parent)
-{
-  titleLabel = new QLabel(QString(getTitle().c_str()));
-
-  parent->addLayout(thisLayout);
-  thisLayout->addWidget(titleLabel);
-
-  pipe = new EmptyQTQueryPipe(_dialog,titleLabel);
-}
-
-QTDialog::EmptyQTQuery::~EmptyQTQuery()
-{
-  delete pipe;
-}
-
-bool QTDialog::EmptyQTQuery::handle(){
-  return true;
-}
-
-
-QTDialog::BooleanQTQuery::BooleanQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog) :
-    Dialog::BooleanQuery(_title),
-    parent(_parent)
-{
-  titleLabel = new QLabel(QString(getTitle().c_str()),_dialog);
-  booleanComboBox = new QComboBox(_dialog);
-  booleanComboBox->insertItem(1, QString("true"));
-  booleanComboBox->insertItem(0, QString("false"));
-
-  parent->addLayout(thisLayout);
-  thisLayout->addWidget(titleLabel);
-  thisLayout->addWidget(booleanComboBox);
-
-  pipe = new BooleanQTQueryPipe(&tmp,_dialog,booleanComboBox);
-  connect(booleanComboBox, SIGNAL(currentIndexChanged()), pipe, SLOT(update()));
-}
-
-QTDialog::BooleanQTQuery::~BooleanQTQuery()
-{
-  delete pipe;
-}
-
-bool QTDialog::BooleanQTQuery::handle(){
-  return true;
-}
-
-
-QTDialog::FileQTQuery::FileQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog) :
-    Dialog::FileQuery(_title),
-    parent(_parent)
-{
-
-  filenameLineEdit = new QLineEdit(_dialog);
-  filenameLineEdit->setText(QString());
-  filenameLineEdit->setReadOnly(true);
-
-  filenameLabel = new QLabel(QString("Input file:"));
-  filenameLabel->setBuddy(filenameLineEdit);
-
-  filedialogButton = new QPushButton("&Choose", _dialog);
-
-  pipe = new FileQTQueryPipe(&tmp,_dialog,filenameLineEdit,filedialogButton);
-
-  thisLayout = new QHBoxLayout();
-  parent->addLayout(thisLayout);
-  thisLayout->addWidget(filenameLabel);
-  thisLayout->addWidget(filenameLineEdit);
-  thisLayout->addWidget(filedialogButton);
-
-  QObject::connect(filedialogButton,SIGNAL(clicked()),pipe,SLOT(showFileDialog()));
-}
-
-QTDialog::FileQTQuery::~FileQTQuery()
-{
-  delete pipe;
-}
-
-bool QTDialog::FileQTQuery::handle(){
-  return true;
-}
-
-/*************************** Plumbing *******************************/
-
-
-template<typename T> QTQueryListPipe<T>::QTQueryListPipe(std::vector<T> *_content, QTDialog *_dialog, QLineEdit *_inputBox, QListWidget *_inputList, QPushButton *_AddButton, QPushButton *_RemoveButton) :
-  content(_content),
-  dialog(_dialog),
-  inputBox(_inputBox),
-  inputList(_inputList),
-  AddButton(_AddButton),
-  RemoveButton(_RemoveButton)
-{}
-
-template<typename T> QTQueryListPipe<T>::~QTQueryListPipe()
-{}
-
-template<typename T> void QTQueryListPipe<T>::IntegerEntered(const QString&)
-{
-  AddButton->setEnabled(true);
-}
-
-template<typename T> void QTQueryListPipe<T>::IntegerSelected()
-{
-  if (inputList->selectedItems().empty())
-    RemoveButton->setEnabled(false);
-  else
-    RemoveButton->setEnabled(true);
-}
-
-template<typename T> void QTQueryListPipe<T>::AddInteger() {
-  // type-check
-  std::string text = inputBox->text().toStdString();
-  int number = 0;
-  try {
-    number = boost::lexical_cast<int>(text);
-  } catch (boost::bad_lexical_cast&) {
-    return;
-  };
-  // add item to both
-  inputList->addItem(QString(number));
-  AddValue(number);
-}
-
-template<typename T> void QTQueryListPipe<T>::AddValue(T item) {
-  content->push_back(item);
-
-  dialog->update();
-}
-
-template<typename T> void QTQueryListPipe<T>::RemoveInteger() {
-  QList<QListWidgetItem *> items = inputList->selectedItems();
-  for (QList<QListWidgetItem *>::iterator iter = items.begin(); !items.empty(); iter = items.begin()) {
-    // obtain which position item has (by making it current item)
-    inputList->setCurrentItem(*iter);
-    // remove
-    QTQueryListPipe<T>::RemoteRow(inputList->currentRow()); // template parameters needs to be known, such that compiler knows which to call
-    inputList->removeItemWidget(*iter);
-  }
-}
-
-template<typename T> void QTQueryListPipe<T>::RemoveRow(int row) {
-  int counter = 0;
-  typename std::vector<T>::iterator iter = content->begin();
-  for (; iter != content->end(); ++iter)
-    if (counter++ == row)
-      break;
-  if (iter != content->end())
-      content->erase(iter);
-}
-
-
-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();
-}
-
-VectorQTQueryPipe::VectorQTQueryPipe(Vector *_content, QTDialog *_dialog, QComboBox *_theBox) :
-  content(_content),
-  dialog(_dialog),
-  theBox(_theBox)
-{}
-
-VectorQTQueryPipe::~VectorQTQueryPipe()
-{}
-
-void VectorQTQueryPipe::update() {
-  dialog->update();
-}
-
-VectorsQTQueryPipe::VectorsQTQueryPipe(std::vector<Vector> *_content, QTDialog *_dialog, QComboBox *_theBox) :
-  content(_content),
-  dialog(_dialog),
-  theBox(_theBox)
-{}
-
-VectorsQTQueryPipe::~VectorsQTQueryPipe()
-{}
-
-void VectorsQTQueryPipe::update() {
-  dialog->update();
-}
-
-BoxQTQueryPipe::BoxQTQueryPipe(Box &_content, QTDialog *_dialog, QTableWidget *_inputTable) :
-  content(_content),
-  dialog(_dialog),
-  inputTable(_inputTable)
-{
-  tmpM = new Matrix();
-  tmpM->zero();
-}
-
-BoxQTQueryPipe::~BoxQTQueryPipe()
-{
-  delete tmpM;
-}
-
-void BoxQTQueryPipe::update(int row, int column)
-{
-  tmpM->at(row, column) = inputTable->item(row, column)->text().toDouble();
-  content.setM(*tmpM);
-  dialog->update();
-}
-
-
-AtomQTQueryPipe::AtomQTQueryPipe(atom **_content, QTDialog *_dialog, QComboBox *_theBox) :
-  content(_content),
-  dialog(_dialog),
-  theBox(_theBox)
-{}
-
-AtomQTQueryPipe::~AtomQTQueryPipe()
-{}
-
-void AtomQTQueryPipe::update(int newIndex) {
-  QVariant data = theBox->itemData(newIndex);
-  int idx = data.toInt();
-  (*content) = World::getInstance().getAtom(AtomById(idx));
-  dialog->update();
-}
-
-
-AtomsQTQueryPipe::AtomsQTQueryPipe(std::vector<atom *>*_content, QTDialog *_dialog, QListWidget *_theList) :
-  content(_content),
-  dialog(_dialog),
-  theList(_theList)
-{}
-
-AtomsQTQueryPipe::~AtomsQTQueryPipe()
-{}
-
-void AtomsQTQueryPipe::update() {
-  // clear target and put all atoms therein
-  (*content).clear();
-  for (std::set<atom *>::iterator iter = currentList.begin(); iter != currentList.end(); ++iter)
-    (*content).push_back(*iter);
-  dialog->update();
-}
-
-void AtomsQTQueryPipe::add() {
-  QList<QListWidgetItem *> items = theList->selectedItems();
-  for (QList<QListWidgetItem *>::iterator iter = items.begin();iter != items.end();++iter) {
-    const int index = (*iter)->text().toInt();
-    atom *Walker = World::getInstance().getAtom(AtomById(index));
-    if (Walker) {
-      (*content).push_back(Walker);
-      currentList.insert(Walker);
-      if (lookup.find(index) != lookup.end())
-        lookup.insert(pair<int, atom*>(index, Walker));
-    }
-  }
-  update();
-}
-
-void AtomsQTQueryPipe::remove() {
-  QList<QListWidgetItem *> items = theList->selectedItems();
-  for (QList<QListWidgetItem *>::iterator iter = items.begin();iter != items.end();++iter) {
-    const int index = (*iter)->text().toInt();
-    atom *Walker = World::getInstance().getAtom(AtomById(index));
-    if (Walker) {
-      currentList.erase(Walker);
-    }
-  }
-  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();
-}
-
-
-MoleculesQTQueryPipe::MoleculesQTQueryPipe(std::vector<molecule *>*_content, QTDialog *_dialog, QComboBox *_theBox) :
-  content(_content),
-  dialog(_dialog),
-  theBox(_theBox)
-{}
-
-MoleculesQTQueryPipe::~MoleculesQTQueryPipe()
-{}
-
-void MoleculesQTQueryPipe::update(int newIndex) {
-  QVariant data = theBox->itemData(newIndex);
-  int idx = data.toInt();
-  molecule *mol = World::getInstance().getMolecule(MoleculeById(idx));
-  if (mol)
-    (*content).push_back(mol);
-  dialog->update();
-}
-
-ElementQTQueryPipe::ElementQTQueryPipe(const element **_content, QTDialog *_dialog, QComboBox *_theBox) :
-  content(_content),
-  dialog(_dialog),
-  theBox(_theBox)
-{}
-
-ElementQTQueryPipe::~ElementQTQueryPipe()
-{}
-
-void ElementQTQueryPipe::update(int newIndex) {
-  QVariant data = theBox->itemData(newIndex);
-  int idx = data.toInt();
-  *content = World::getInstance().getPeriode()->FindElement(idx);
-  dialog->update();
-}
-
-ElementsQTQueryPipe::ElementsQTQueryPipe(std::vector<const element *>*_content, QTDialog *_dialog, QComboBox *_theBox) :
-  content(_content),
-  dialog(_dialog),
-  theBox(_theBox)
-{}
-
-ElementsQTQueryPipe::~ElementsQTQueryPipe()
-{}
-
-void ElementsQTQueryPipe::update(int newIndex) {
-  QVariant data = theBox->itemData(newIndex);
-  int idx = data.toInt();
-  const element *elemental = World::getInstance().getPeriode()->FindElement(idx);
-  if(elemental)
-    (*content).push_back(elemental);
-  dialog->update();
-}
-
-EmptyQTQueryPipe::EmptyQTQueryPipe(QTDialog *_dialog, QLabel *_textLabel) :
-  dialog(_dialog),
-  textLabel(_textLabel)
-{}
-
-EmptyQTQueryPipe::~EmptyQTQueryPipe()
-{}
-
-void EmptyQTQueryPipe::update() {
-  dialog->update();
-}
-
-BooleanQTQueryPipe::BooleanQTQueryPipe(const bool *_content, QTDialog *_dialog, QComboBox *_booleanComboBox) :
-  content(_content),
-  dialog(_dialog),
-  booleanComboBox(_booleanComboBox)
-{}
-
-BooleanQTQueryPipe::~BooleanQTQueryPipe()
-{}
-
-void BooleanQTQueryPipe::update() {
-  dialog->update();
-}
-
-FileQTQueryPipe::FileQTQueryPipe(boost::filesystem::path *_content, QTDialog *_dialog, QLineEdit *_filenameLineEdit, QPushButton *_filedialogButton) :
-  content(_content),
-  dialog(_dialog),
-  filenameLineEdit(_filenameLineEdit),
-  filedialogButton(_filedialogButton)
-{
-  theFileDialog = NULL;
-}
-
-FileQTQueryPipe::~FileQTQueryPipe()
-{
-  if (theFileDialog != NULL)
-    delete theFileDialog;
-}
-
-void FileQTQueryPipe::update() {
-  QStringList ListOfFilenames = theFileDialog->selectedFiles();
-  std::cout << "Selected File is " << ListOfFilenames.at(0).toStdString() << std::endl;
-  (*content) = ListOfFilenames.at(0).toStdString();
-  filenameLineEdit->setText(QString::fromStdString((*content).string()));
-  dialog->update();
-}
-
-void FileQTQueryPipe::showFileDialog() {
-  filedialogButton->setFlat(true);
-  if (theFileDialog == NULL) {
-    theFileDialog = new QFileDialog(NULL, tr("Open input file"), QString(), tr("ParallelCarParrinello (*.conf);;MassivelyParallelQuantumChemistry (*.mpqc);;ParticleDataBase (*.pdb);;XYZ (*.xyz)"));
-    theFileDialog->setAcceptMode(QFileDialog::AcceptOpen);
-    theFileDialog->setFileMode(QFileDialog::ExistingFile);
-    theFileDialog->setViewMode(QFileDialog::List);
-  }
-  theFileDialog->exec();
-
-  update();
-  filedialogButton->setFlat(false);
-}
-
-
-
Index: c/UIElements/QT4/QTDialog.hpp
===================================================================
--- src/UIElements/QT4/QTDialog.hpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,619 +1,0 @@
-/*
- * QTDialog.hpp
- *
- *  Created on: Jan 18, 2010
- *      Author: crueger
- */
-
-#ifndef QTDIALOG_HPP_
-#define QTDIALOG_HPP_
-
-#include "UIElements/Dialog.hpp"
-#include <QtGui/QDialog>
-#include <QtGui/QFileDialog>
-
-#include <boost/filesystem.hpp>
-
-#include <map>
-#include <set>
-#include <vector>
-
-class QBoxLayout;
-class QLabel;
-class QSpinBox;
-class QDoubleSpinBox;
-class QLineEdit;
-class QListWidget;
-class QTableWidget;
-class QComboBox;
-class QDialogButtonBox;
-
-class Matrix;
-
-// Forward declarations for plumbing
-template<typename T> class QTQueryListPipe;
-class BooleanQTQueryPipe;
-class BoxQTQueryPipe;
-class StringQTQueryPipe;
-class StringsQTQueryPipe;
-class IntQTQueryPipe;
-class DoubleQTQueryPipe;
-class DoublesQTQueryPipe;
-class AtomQTQueryPipe;
-class AtomsQTQueryPipe;
-class MoleculeQTQueryPipe;
-class MoleculesQTQueryPipe;
-class EmptyQTQueryPipe;
-class ElementQTQueryPipe;
-class ElementsQTQueryPipe;
-class VectorQTQueryPipe;
-class VectorsQTQueryPipe;
-class FileQTQueryPipe;
-
-class QTDialog : public QDialog, public Dialog
-{
-  Q_OBJECT
-public:
-  QTDialog();
-  virtual ~QTDialog();
-
-  virtual void queryEmpty(const char*, std::string);
-  virtual void queryBoolean(const char *, std::string = "");
-  virtual void queryInt(const char *,std::string = "");
-  virtual void queryInts(const char *,std::string = "");
-  virtual void queryDouble(const char*,std::string = "");
-  virtual void queryDoubles(const char*,std::string = "");
-  virtual void queryString(const char*,std::string = "");
-  virtual void queryStrings(const char*,std::string = "");
-  virtual void queryAtom(const char*,std::string = "");
-  virtual void queryAtoms(const char*,std::string = "");
-  virtual void queryMolecule(const char*,std::string = "");
-  virtual void queryMolecules(const char*,std::string = "");
-  virtual void queryVector(const char*,bool,std::string = "");
-  virtual void queryVectors(const char*,bool,std::string = "");
-  virtual void queryBox(const char*, std::string = "");
-  virtual void queryElement(const char*,std::string = "");
-  virtual void queryElements(const char*,std::string = "");
-  virtual void queryFile(const char*,std::string = "");
-
-  virtual bool display();
-
-  virtual void update();
-
-protected:
-  class IntQTQuery : public Dialog::IntQuery {
-    public:
-      IntQTQuery(std::string _title,QBoxLayout *_parent,QTDialog *_dialog);
-      virtual ~IntQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QSpinBox *inputBox;
-
-      IntQTQueryPipe *pipe;
-    };
-
-  class IntsQTQuery : public Dialog::IntsQuery {
-    public:
-      IntsQTQuery(std::string _title,QBoxLayout *_parent,QTDialog *_dialog);
-      virtual ~IntsQTQuery();
-      virtual bool handle();
-      void IntegerEntered(const QString&);
-      void IntegerSelected();
-      void AddInteger();
-      void RemoveInteger();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-
-      QTQueryListPipe<int> *pipe;
-    };
-
-    class DoubleQTQuery : public Dialog::DoubleQuery {
-    public:
-      DoubleQTQuery(std::string title,QBoxLayout *_parent,QTDialog *_dialog);
-      virtual ~DoubleQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QDoubleSpinBox *inputBox;
-
-      DoubleQTQueryPipe *pipe;
-    };
-
-    class DoublesQTQuery : public Dialog::DoublesQuery {
-    public:
-      DoublesQTQuery(std::string title,QBoxLayout *_parent,QTDialog *_dialog);
-      virtual ~DoublesQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QDoubleSpinBox *inputBox;
-
-      QTQueryListPipe<double> *pipe;
-    };
-
-    class StringQTQuery : public Dialog::StringQuery {
-    public:
-      StringQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
-      virtual ~StringQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QLineEdit *inputBox;
-
-      StringQTQueryPipe *pipe;
-    };
-
-    class StringsQTQuery : public Dialog::StringsQuery {
-    public:
-      StringsQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
-      virtual ~StringsQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QLineEdit *inputBox;
-
-      QTQueryListPipe<std::string> *pipe;
-    };
-
-    class BoxQTQuery : public Dialog::BoxQuery {
-    public:
-      BoxQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
-      virtual ~BoxQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QTableWidget *inputTable;
-
-      BoxQTQueryPipe *pipe;
-    };
-
-    class AtomQTQuery : public Dialog::AtomQuery {
-    public:
-      AtomQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
-      virtual ~AtomQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QComboBox *inputBox;
-
-      AtomQTQueryPipe *pipe;
-    };
-
-    class AtomsQTQuery : public Dialog::AtomsQuery {
-    public:
-      AtomsQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
-      virtual ~AtomsQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QComboBox *inputBox;
-
-      AtomsQTQueryPipe *pipe;
-    };
-
-    class MoleculeQTQuery : public Dialog::MoleculeQuery {
-    public:
-      MoleculeQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
-      virtual ~MoleculeQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QComboBox *inputBox;
-
-      MoleculeQTQueryPipe *pipe;
-    };
-
-    class MoleculesQTQuery : public Dialog::MoleculesQuery {
-    public:
-      MoleculesQTQuery(std::string _title, QBoxLayout *_parent,QTDialog *_dialog);
-      virtual ~MoleculesQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QComboBox *inputBox;
-
-      MoleculesQTQueryPipe *pipe;
-    };
-
-    class VectorQTQuery : public Dialog::VectorQuery {
-    public:
-      VectorQTQuery(std::string title,bool _check,QBoxLayout *,QTDialog *);
-      virtual ~VectorQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *mainLayout;
-      QLabel *titleLabel;
-      QBoxLayout *subLayout;
-      QBoxLayout *coordLayout;
-      QLabel *coordLabel;
-      QDoubleSpinBox *coordInput;
-
-      VectorQTQueryPipe *pipe;
-    };
-
-    class VectorsQTQuery : public Dialog::VectorsQuery {
-    public:
-      VectorsQTQuery(std::string title,bool _check,QBoxLayout *,QTDialog *);
-      virtual ~VectorsQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *mainLayout;
-      QLabel *titleLabel;
-      QBoxLayout *subLayout;
-      QBoxLayout *coordLayout;
-      QLabel *coordLabel;
-      QDoubleSpinBox *coordInput;
-
-      VectorsQTQueryPipe *pipe;
-    };
-
-    class EmptyQTQuery : public Dialog::EmptyQuery {
-    public:
-      EmptyQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog);
-      virtual ~EmptyQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-
-      EmptyQTQueryPipe *pipe;
-    };
-
-    class BooleanQTQuery : public Dialog::BooleanQuery {
-    public:
-      BooleanQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog);
-      virtual ~BooleanQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QComboBox *booleanComboBox;
-
-      BooleanQTQueryPipe *pipe;
-    };
-
-    class ElementQTQuery : public Dialog::ElementQuery {
-    public:
-      ElementQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog);
-      virtual ~ElementQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QComboBox *inputBox;
-
-      ElementQTQueryPipe *pipe;
-    };
-
-    class ElementsQTQuery : public Dialog::ElementsQuery {
-    public:
-      ElementsQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog);
-      virtual ~ElementsQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *titleLabel;
-      QComboBox *inputBox;
-
-      ElementsQTQueryPipe *pipe;
-    };
-
-    class FileQTQuery : public Dialog::FileQuery {
-    public:
-      FileQTQuery(std::string _title, QBoxLayout *_parent, QTDialog *_dialog);
-      virtual ~FileQTQuery();
-      virtual bool handle();
-    private:
-      QBoxLayout *parent;
-      QBoxLayout *thisLayout;
-      QLabel *filenameLabel;
-      QLineEdit *filenameLineEdit;
-      QPushButton *filedialogButton;
-
-      FileQTQueryPipe *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
-
-
-template<typename T> class QTQueryListPipe : public QWidget {
-  public:
-    QTQueryListPipe(std::vector<T> *_content, QTDialog *_dialog, QLineEdit *_inputBox, QListWidget *_inputList, QPushButton *_AddButton, QPushButton *_RemoveButton);
-    virtual ~QTQueryListPipe();
-    void AddInteger();
-    void RemoveInteger();
-    void IntegerSelected();
-    void IntegerEntered(const QString&);
-
-  private:
-    void AddValue(T item);
-    void RemoveRow(int row);
-
-    std::vector<T> *content;
-    QTDialog *dialog;
-    QLineEdit *inputBox;
-    QListWidget *inputList;
-    QPushButton *AddButton;
-    QPushButton *RemoveButton;
-};
-
-
-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 BoxQTQueryPipe : public QWidget {
-  Q_OBJECT
-public:
-  BoxQTQueryPipe(Box &_content, QTDialog *_dialog, QTableWidget *_inputTable);
-  virtual ~BoxQTQueryPipe();
-
-public slots:
-  void update(int,int);
-
-private:
-  Box &content;
-  QTDialog *dialog;
-  QTableWidget *inputTable;
-
-  Matrix *tmpM;
-};
-
-
-class AtomQTQueryPipe : public QWidget {
-  Q_OBJECT
-public:
-  AtomQTQueryPipe(atom **_content, QTDialog *_dialog, QComboBox *_theBox);
-  virtual ~AtomQTQueryPipe();
-
-public slots:
-  void update(int);
-
-private:
-  atom **content;
-  QTDialog *dialog;
-  QComboBox *theBox;
-
-};
-
-
-class AtomsQTQueryPipe : public QWidget {
-  Q_OBJECT
-public:
-  AtomsQTQueryPipe(std::vector<atom *>*_content, QTDialog *_dialog, QListWidget *_theList);
-  virtual ~AtomsQTQueryPipe();
-
-public slots:
-  void update();
-  void add();
-  void remove();
-
-private:
-  std::vector<atom *>*content;
-  std::map<int, atom *> lookup;
-  std::set<atom *> currentList;
-  QTDialog *dialog;
-  QListWidget *theList;
-
-};
-
-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 MoleculesQTQueryPipe : public QWidget {
-  Q_OBJECT
-public:
-  MoleculesQTQueryPipe(std::vector<molecule *>*_content, QTDialog *_dialog, QComboBox *_theBox);
-  virtual ~MoleculesQTQueryPipe();
-
-public slots:
-  void update(int);
-
-private:
-  std::vector<molecule *>*content;
-  QTDialog *dialog;
-  QComboBox *theBox;
-
-};
-
-class VectorQTQueryPipe : public QWidget {
-  Q_OBJECT
-public:
-  VectorQTQueryPipe(Vector *_content, QTDialog *_dialog, QComboBox *_theBox);
-  virtual ~VectorQTQueryPipe();
-
-public slots:
-  void update();
-
-private:
-  Vector *content;
-  QTDialog *dialog;
-  QComboBox *theBox;
-};
-
-class VectorsQTQueryPipe : public QWidget {
-  Q_OBJECT
-public:
-  VectorsQTQueryPipe(std::vector<Vector>*_content, QTDialog *_dialog, QComboBox *_theBox);
-  virtual ~VectorsQTQueryPipe();
-
-public slots:
-  void update();
-
-private:
-  std::vector<Vector> *content;
-  QTDialog *dialog;
-  QComboBox *theBox;
-};
-
-class EmptyQTQueryPipe : public QWidget {
-  Q_OBJECT
-public:
-  EmptyQTQueryPipe(QTDialog *_dialog, QLabel *_textLabel);
-  virtual ~EmptyQTQueryPipe();
-
-public slots:
-  void update();
-
-private:
-  QTDialog *dialog;
-  QLabel *textLabel;
-};
-
-class BooleanQTQueryPipe : public QWidget {
-  Q_OBJECT
-public:
-  BooleanQTQueryPipe(const bool *_content, QTDialog *_dialog, QComboBox *_booleanComboBox);
-  virtual ~BooleanQTQueryPipe();
-
-public slots:
-  void update();
-
-private:
-  const bool *content;
-  QTDialog *dialog;
-  QComboBox *booleanComboBox;
-};
-
-class ElementQTQueryPipe : public QWidget {
-  Q_OBJECT
-public:
-  ElementQTQueryPipe(const element **_content, QTDialog *_dialog, QComboBox *_theBox);
-  virtual ~ElementQTQueryPipe();
-
-public slots:
-  void update(int);
-
-private:
-  const element **content;
-  QTDialog *dialog;
-  QComboBox *theBox;
-};
-
-class ElementsQTQueryPipe : public QWidget {
-  Q_OBJECT
-public:
-  ElementsQTQueryPipe(std::vector<const element *>*_content, QTDialog *_dialog, QComboBox *_theBox);
-  virtual ~ElementsQTQueryPipe();
-
-public slots:
-  void update(int);
-
-private:
-  std::vector<const element *>*content;
-  QTDialog *dialog;
-  QComboBox *theBox;
-};
-
-class FileQTQueryPipe : public QWidget {
-  Q_OBJECT
-public:
-  FileQTQueryPipe(boost::filesystem::path *_content, QTDialog *_dialog, QLineEdit *_filenameLineEdit, QPushButton *_filedialogButton);
-  virtual ~FileQTQueryPipe();
-
-public slots:
-  void update();
-  void showFileDialog();
-
-private:
-  boost::filesystem::path *content;
-  QTDialog *dialog;
-  QLineEdit *filenameLineEdit;
-  QPushButton *filedialogButton;
-  QFileDialog *theFileDialog;
-};
-
-#endif /* QTDIALOG_HPP_ */
Index: c/UIElements/QT4/QTMainWindow.cpp
===================================================================
--- src/UIElements/QT4/QTMainWindow.cpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * QTMainWindow.cpp
- *
- *  Created on: Jan 14, 2010
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#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 "Helpers/MemDebug.hpp"
-
-#include "atom.hpp"
-#include "molecule.hpp"
-#include "Helpers/Verbose.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"
-
-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: c/UIElements/QT4/QTMainWindow.hpp
===================================================================
--- src/UIElements/QT4/QTMainWindow.hpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/*
- * 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: c/UIElements/QT4/QTUIFactory.cpp
===================================================================
--- src/UIElements/QT4/QTUIFactory.cpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * QTUIFactory.cpp
- *
- *  Created on: Jan 14, 2010
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <iostream>
-#include <cassert>
-
-#include <qapplication.h>
-
-
-#include "UIElements/QT4/QTUIFactory.hpp"
-#include "UIElements/QT4/QTMainWindow.hpp"
-#include "UIElements/QT4/QTDialog.hpp"
-
-#include "Helpers/MemDebug.hpp"
-
-#include "version.h"
-#include "defs.hpp"
-
-using namespace std;
-
-QTUIFactory::QTUIFactory() :
-  argc(1)
-{
-  // For now we just fake the command line parameters to make QT happy
-  argv = new char*[1];
-  argv[0] = new char[256];
-  strcpy(argv[0],MOLECUILDERVERSION);
-  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: c/UIElements/QT4/QTUIFactory.hpp
===================================================================
--- src/UIElements/QT4/QTUIFactory.hpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * 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/Qt4/IntQtQuery.ui
===================================================================
--- src/UIElements/Qt4/IntQtQuery.ui	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/IntQtQuery.ui	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>30</y>
+     <width>59</width>
+     <height>17</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>TextLabel</string>
+   </property>
+  </widget>
+  <widget class="QLineEdit" name="lineEdit">
+   <property name="geometry">
+    <rect>
+     <x>100</x>
+     <y>20</y>
+     <width>113</width>
+     <height>27</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>20</x>
+     <y>70</y>
+     <width>92</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>OK</string>
+   </property>
+  </widget>
+  <widget class="QPushButton" name="pushButton_2">
+   <property name="geometry">
+    <rect>
+     <x>140</x>
+     <y>70</y>
+     <width>92</width>
+     <height>27</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Cancel</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: src/UIElements/Qt4/IntsQtQuery.ui
===================================================================
--- src/UIElements/Qt4/IntsQtQuery.ui	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/IntsQtQuery.ui	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>740</width>
+    <height>444</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QWidget" name="horizontalLayoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>240</y>
+     <width>421</width>
+     <height>51</height>
+    </rect>
+   </property>
+   <layout class="QHBoxLayout" name="horizontalLayout">
+    <item>
+     <spacer name="horizontalSpacer">
+      <property name="orientation">
+       <enum>Qt::Horizontal</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>40</width>
+        <height>20</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton">
+      <property name="text">
+       <string>OK</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton_2">
+      <property name="text">
+       <string>Cancel</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QWidget" name="verticalLayoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>280</x>
+     <y>0</y>
+     <width>160</width>
+     <height>221</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QLabel" name="label">
+      <property name="text">
+       <string>Enter Integer:</string>
+      </property>
+      <property name="buddy">
+       <cstring>lineEdit</cstring>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QLineEdit" name="lineEdit">
+      <property name="minimumSize">
+       <size>
+        <width>100</width>
+        <height>20</height>
+       </size>
+      </property>
+      <property name="toolTip">
+       <string>Enter an integer and press Add.</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton_3">
+      <property name="enabled">
+       <bool>false</bool>
+      </property>
+      <property name="text">
+       <string>Add</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QPushButton" name="pushButton_4">
+      <property name="enabled">
+       <bool>false</bool>
+      </property>
+      <property name="text">
+       <string>Remove</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <spacer name="verticalSpacer">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>20</width>
+        <height>40</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QWidget" name="verticalLayoutWidget_2">
+   <property name="geometry">
+    <rect>
+     <x>10</x>
+     <y>0</y>
+     <width>261</width>
+     <height>221</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout_2">
+    <item>
+     <widget class="QLabel" name="label_2">
+      <property name="text">
+       <string>Current List of Integers:</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <widget class="QListWidget" name="listWidget"/>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <tabstops>
+  <tabstop>pushButton</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
Index: src/UIElements/Qt4/QtDialog.cpp
===================================================================
--- src/UIElements/Qt4/QtDialog.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtDialog.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,1188 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * QtDialog.cpp
+ *
+ *  Created on: Jan 18, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "UIElements/Qt4/QtDialog.hpp"
+
+#include <boost/lexical_cast.hpp>
+
+#include <string>
+#include <sstream>
+#include <limits>
+
+#include <QtGui/QDoubleSpinBox>
+#include <Qt/qboxlayout.h>
+#include <Qt/qcombobox.h>
+#include <Qt/qdialogbuttonbox.h>
+#include <Qt/qlabel.h>
+#include <Qt/qlineedit.h>
+#include <Qt/qlistwidget.h>
+#include <Qt/qpushbutton.h>
+#include <Qt/qspinbox.h>
+#include <Qt/qtablewidget.h>
+
+#include <boost/lexical_cast.hpp>
+
+#include "Helpers/MemDebug.hpp"
+
+#include "World.hpp"
+#include "periodentafel.hpp"
+#include "atom.hpp"
+#include "element.hpp"
+#include "molecule.hpp"
+#include "Descriptors/AtomIdDescriptor.hpp"
+#include "Descriptors/MoleculeIdDescriptor.hpp"
+#include "LinearAlgebra/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(const char* title, std::string)
+{
+  registerQuery(new EmptyQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryBoolean(const char* title,string)
+{
+  registerQuery(new BooleanQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryAtom(const char* title, std::string)
+{
+  registerQuery(new AtomQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryAtoms(const char* title, std::string)
+{
+  registerQuery(new AtomsQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryBox(const char* title, std::string)
+{
+  registerQuery(new BoxQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryInt(const char *title,string)
+{
+  registerQuery(new IntQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryInts(const char *title,string)
+{
+  registerQuery(new IntsQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryDouble(const char* title,string)
+{
+  registerQuery(new DoubleQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryDoubles(const char* title,string)
+{
+  registerQuery(new DoublesQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryString(const char* title,string)
+{
+  registerQuery(new StringQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryStrings(const char* title,string)
+{
+  registerQuery(new StringsQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryMolecule(const char *title,string)
+{
+  registerQuery(new MoleculeQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryMolecules(const char *title,string)
+{
+  registerQuery(new MoleculesQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryVector(const char* title, bool check,string)
+{
+  registerQuery(new VectorQtQuery(title,check,inputLayout,this));
+}
+
+void QtDialog::queryVectors(const char* title, bool check,string)
+{
+  registerQuery(new VectorsQtQuery(title,check,inputLayout,this));
+}
+
+void QtDialog::queryElement(const char* title, std::string)
+{
+  registerQuery(new ElementQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryElements(const char* title, std::string)
+{
+  registerQuery(new ElementsQtQuery(title,inputLayout,this));
+}
+
+void QtDialog::queryFile(const char* title, std::string)
+{
+  registerQuery(new FileQtQuery(title,inputLayout,this));
+}
+
+/************************** Query Objects *******************************/
+
+QtDialog::BoxQtQuery::BoxQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::BoxQuery(_title),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+
+  // init input table
+  inputTable = new QTableWidget(3,3, _dialog);
+  QStringList CoordinateList;
+  CoordinateList << "x" << "y" << "z";
+  inputTable->setHorizontalHeaderLabels(CoordinateList);
+  inputTable->setVerticalHeaderLabels(CoordinateList);
+
+  pipe = new BoxQtQueryPipe(tmp,_dialog, inputTable);
+
+  // fill the box with current matrix
+  const Matrix &domain = World::getInstance().getDomain().getM();
+  for (int i=0;i<3;i++)
+    for (int j=0;j<3;j++) {
+      QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(domain.at(i,j)));
+      inputTable->setItem(i,j,newItem);
+      pipe->update(i,j);
+    }
+
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputTable);
+
+  connect(inputTable,SIGNAL(cellChanged(int,int)),pipe,SLOT(update(int,int)));
+}
+
+QtDialog::BoxQtQuery::~BoxQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::BoxQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::AtomQtQuery::AtomQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::AtomQuery(_title),
+    parent(_parent)
+{
+  thisLayout = new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  inputBox = new QComboBox();
+  inputBox->insertItem(-1, QString("no atom"));
+  std::vector<atom *> atoms = World::getInstance().getAllAtoms();
+  for (std::vector<atom *>::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter)
+    inputBox->insertItem((*iter)->getNr(),QString::fromStdString((*iter)->getName()));
+
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new AtomQtQueryPipe(&tmp,_dialog, inputBox);
+  pipe->update(inputBox->currentIndex());
+  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
+}
+
+QtDialog::AtomQtQuery::~AtomQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::AtomQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::AtomsQtQuery::AtomsQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::AtomsQuery(_title),
+    parent(_parent)
+{
+  QHBoxLayout * thisHLayout = new QHBoxLayout();
+  QVBoxLayout * thisV1Layout = new QVBoxLayout();
+  QVBoxLayout * thisV2Layout = new QVBoxLayout();
+
+  QLabel *titleLabel = new QLabel(QString(getTitle().c_str()));
+  QLabel *inputLabel = new QLabel("Enter to add");
+  QListWidget* inputList = new QListWidget();
+  inputList->setSelectionMode(QAbstractItemView::ExtendedSelection);
+  std::vector<atom *> atoms = World::getInstance().getAllAtoms();
+  for (std::vector<atom *>::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter)
+    inputBox->insertItem((*iter)->getNr(),QString((*iter)->getNr()));
+
+  QLineEdit* inputBox = new QLineEdit();
+  inputLabel->setBuddy(inputBox);
+  titleLabel->setBuddy(inputList);
+  QPushButton* AddButton = new QPushButton("Add");
+  AddButton->setEnabled(false);
+  QPushButton* RemoveButton = new QPushButton("Remove");
+  RemoveButton->setEnabled(false);
+
+  thisV1Layout->addWidget(titleLabel);
+  thisV1Layout->addWidget(inputList);
+  thisV2Layout->addWidget(inputLabel);
+  thisV2Layout->addWidget(inputBox);
+  thisV2Layout->addWidget(AddButton);
+  thisV2Layout->addWidget(RemoveButton);
+  parent->addLayout(thisHLayout);
+  thisHLayout->addLayout(thisV1Layout);
+  thisHLayout->addLayout(thisV2Layout);
+
+  pipe = new AtomsQtQueryPipe(&tmp,_dialog,inputList);
+  connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected()));
+  connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(add()));
+  connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(remove()));
+}
+
+QtDialog::AtomsQtQuery::~AtomsQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::AtomsQtQuery::handle() {
+  return true;
+}
+
+QtDialog::IntQtQuery::IntQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::IntQuery(_title),
+    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;
+}
+
+bool QtDialog::IntQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::IntsQtQuery::IntsQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::IntsQuery(_title),
+    parent(_parent)
+{
+  QHBoxLayout * thisHLayout = new QHBoxLayout();
+  QVBoxLayout * thisV1Layout = new QVBoxLayout();
+  QVBoxLayout * thisV2Layout = new QVBoxLayout();
+
+  QLabel *titleLabel = new QLabel(QString(getTitle().c_str()));
+  QLabel *inputLabel = new QLabel("Enter to add");
+  QListWidget* inputList = new QListWidget();
+  inputList->setSelectionMode(QAbstractItemView::ExtendedSelection);
+  QLineEdit* inputBox = new QLineEdit();
+  inputLabel->setBuddy(inputBox);
+  titleLabel->setBuddy(inputList);
+  QPushButton* AddButton = new QPushButton("Add");
+  AddButton->setEnabled(false);
+  QPushButton* RemoveButton = new QPushButton("Remove");
+  RemoveButton->setEnabled(false);
+
+  thisV1Layout->addWidget(titleLabel);
+  thisV1Layout->addWidget(inputList);
+  thisV2Layout->addWidget(inputLabel);
+  thisV2Layout->addWidget(inputBox);
+  thisV2Layout->addWidget(AddButton);
+  thisV2Layout->addWidget(RemoveButton);
+  parent->addLayout(thisHLayout);
+  thisHLayout->addLayout(thisV1Layout);
+  thisHLayout->addLayout(thisV2Layout);
+
+  pipe = new QtQueryListPipe<int>(&tmp,_dialog,inputBox,inputList,AddButton,RemoveButton);
+  connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(IntegerEntered(const QString&)));
+  connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected()));
+  connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(AddValue()));
+  connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(RemoveRow()));
+}
+
+QtDialog::IntsQtQuery::~IntsQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::IntsQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::DoubleQtQuery::DoubleQtQuery(string title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::DoubleQuery(title),
+    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::DoublesQtQuery::DoublesQtQuery(string title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::DoublesQuery(title),
+    parent(_parent)
+{
+  QHBoxLayout * thisHLayout = new QHBoxLayout();
+  QVBoxLayout * thisV1Layout = new QVBoxLayout();
+  QVBoxLayout * thisV2Layout = new QVBoxLayout();
+
+  QLabel *titleLabel = new QLabel(QString(getTitle().c_str()));
+  QLabel *inputLabel = new QLabel("Enter to add");
+  QListWidget* inputList = new QListWidget();
+  inputList->setSelectionMode(QAbstractItemView::ExtendedSelection);
+  QLineEdit* inputBox = new QLineEdit();
+  inputLabel->setBuddy(inputBox);
+  titleLabel->setBuddy(inputList);
+  QPushButton* AddButton = new QPushButton("Add");
+  AddButton->setEnabled(false);
+  QPushButton* RemoveButton = new QPushButton("Remove");
+  RemoveButton->setEnabled(false);
+
+  thisV1Layout->addWidget(titleLabel);
+  thisV1Layout->addWidget(inputList);
+  thisV2Layout->addWidget(inputLabel);
+  thisV2Layout->addWidget(inputBox);
+  thisV2Layout->addWidget(AddButton);
+  thisV2Layout->addWidget(RemoveButton);
+  parent->addLayout(thisHLayout);
+  thisHLayout->addLayout(thisV1Layout);
+  thisHLayout->addLayout(thisV2Layout);
+
+  pipe = new QtQueryListPipe<double>(&tmp,_dialog,inputBox,inputList,AddButton,RemoveButton);
+  connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(IntegerEntered(const QString&)));
+  connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected()));
+  connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(AddValue()));
+  connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(RemoveRow()));}
+
+QtDialog::DoublesQtQuery::~DoublesQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::DoublesQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::StringQtQuery::StringQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::StringQuery(_title),
+    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 std::string are valid
+bool QtDialog::StringQtQuery::handle()
+{
+  return tmp!="";
+}
+
+QtDialog::StringsQtQuery::StringsQtQuery(string _title,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::StringsQuery(_title),
+    parent(_parent)
+{
+  QHBoxLayout * thisHLayout = new QHBoxLayout();
+  QVBoxLayout * thisV1Layout = new QVBoxLayout();
+  QVBoxLayout * thisV2Layout = new QVBoxLayout();
+
+  QLabel *titleLabel = new QLabel(QString(getTitle().c_str()));
+  QLabel *inputLabel = new QLabel("Enter to add");
+  QListWidget* inputList = new QListWidget();
+  inputList->setSelectionMode(QAbstractItemView::ExtendedSelection);
+  QLineEdit* inputBox = new QLineEdit();
+  inputLabel->setBuddy(inputBox);
+  titleLabel->setBuddy(inputList);
+  QPushButton* AddButton = new QPushButton("Add");
+  AddButton->setEnabled(false);
+  QPushButton* RemoveButton = new QPushButton("Remove");
+  RemoveButton->setEnabled(false);
+
+  thisV1Layout->addWidget(titleLabel);
+  thisV1Layout->addWidget(inputList);
+  thisV2Layout->addWidget(inputLabel);
+  thisV2Layout->addWidget(inputBox);
+  thisV2Layout->addWidget(AddButton);
+  thisV2Layout->addWidget(RemoveButton);
+  parent->addLayout(thisHLayout);
+  thisHLayout->addLayout(thisV1Layout);
+  thisHLayout->addLayout(thisV2Layout);
+
+  pipe = new QtQueryListPipe<std::string>(&tmp,_dialog,inputBox,inputList,AddButton,RemoveButton);
+  connect(inputBox,SIGNAL(textChanged(const QString&)),pipe,SLOT(IntegerEntered(const QString&)));
+  connect(inputList,SIGNAL(itemSelectionChanged()),pipe,SLOT(IntegerSelected()));
+  connect(AddButton,SIGNAL(Clicked()),pipe,SLOT(AddValue()));
+  connect(RemoveButton,SIGNAL(Clicked()),pipe,SLOT(RemoveRow()));}
+
+QtDialog::StringsQtQuery::~StringsQtQuery()
+{
+  delete pipe;
+}
+
+// All values besides the empty std::string are valid
+bool QtDialog::StringsQtQuery::handle()
+{
+  // dissect by ","
+  std::string::iterator olditer = temp.begin();
+  for(string::iterator iter = temp.begin(); iter != temp.end(); ++iter) {
+    if (*iter == ' ') {
+      tmp.push_back(string(iter, olditer));
+      olditer = iter;
+    }
+  }
+  if (olditer != temp.begin())  // insert last part also
+    tmp.push_back(string(olditer, temp.end()));
+
+  return temp!="";
+}
+
+QtDialog::MoleculeQtQuery::MoleculeQtQuery(string _title, QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::MoleculeQuery(_title),
+    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) {
+    std::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::MoleculesQtQuery::MoleculesQtQuery(string _title, QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::MoleculesQuery(_title),
+    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) {
+    std::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 MoleculesQtQueryPipe(&tmp,_dialog,inputBox);
+  pipe->update(inputBox->currentIndex());
+  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
+}
+
+QtDialog::MoleculesQtQuery::~MoleculesQtQuery()
+{
+  delete pipe;
+}
+
+// Handling is easy, since the GUI makes it impossible to select invalid values
+bool QtDialog::MoleculesQtQuery::handle()
+{
+  return true;
+}
+
+QtDialog::VectorQtQuery::VectorQtQuery(std::string title, bool _check,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::VectorQuery(title,_check),
+    parent(_parent)
+{
+  mainLayout= new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  mainLayout->addWidget(titleLabel);
+  subLayout = new QVBoxLayout();
+  mainLayout->addLayout(subLayout);
+  QComboBox* inputBox = new QComboBox();
+  coordLayout = new QHBoxLayout();
+  subLayout->addLayout(coordLayout);
+  coordLabel = new QLabel(QString("x,y,z"));
+  coordLayout->addWidget(coordLabel);
+  coordInput = new QDoubleSpinBox();
+//  coordInput->setRange(0,M.at(i,i));
+  coordInput->setDecimals(3);
+  coordLayout->addWidget(coordInput);
+  pipe = new VectorQtQueryPipe(&(tmp),_dialog,inputBox);
+  //pipe->update(coordInput->value());
+  connect(coordInput,SIGNAL(valueChanged(double)),pipe,SLOT(update(double)));
+  parent->addLayout(mainLayout);
+}
+
+QtDialog::VectorQtQuery::~VectorQtQuery()
+{}
+
+bool QtDialog::VectorQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::VectorsQtQuery::VectorsQtQuery(std::string title, bool _check,QBoxLayout *_parent,QtDialog *_dialog) :
+    Dialog::VectorsQuery(title,_check),
+    parent(_parent)
+{
+  mainLayout= new QHBoxLayout();
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+  mainLayout->addWidget(titleLabel);
+  subLayout = new QVBoxLayout();
+  mainLayout->addLayout(subLayout);
+  QComboBox* inputBox = new QComboBox();
+  coordLayout = new QHBoxLayout();
+  subLayout->addLayout(coordLayout);
+  coordLabel = new QLabel(QString("x,y,z"));
+  coordLayout->addWidget(coordLabel);
+  coordInput = new QDoubleSpinBox();
+//  coordInput->setRange(0,M.at(i,i));
+  coordInput->setDecimals(3);
+  coordLayout->addWidget(coordInput);
+  pipe = new VectorsQtQueryPipe(&(tmp),_dialog,inputBox);
+  //pipe->update(coordInput->value());
+  connect(coordInput,SIGNAL(valueChanged(double)),pipe,SLOT(update(double)));
+  parent->addLayout(mainLayout);
+}
+
+QtDialog::VectorsQtQuery::~VectorsQtQuery()
+{}
+
+bool QtDialog::VectorsQtQuery::handle() {
+  return true;
+}
+
+
+QtDialog::ElementQtQuery::ElementQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) :
+    Dialog::ElementQuery(_title),
+    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)
+  {
+    std::stringstream sstr;
+    sstr << (*iter).first << "\t" << (*iter).second->getName();
+    inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
+  }
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new ElementQtQueryPipe(&tmp,_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;
+}
+
+
+QtDialog::ElementsQtQuery::ElementsQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) :
+    Dialog::ElementsQuery(_title),
+    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)
+  {
+    std::stringstream sstr;
+    sstr << (*iter).first << "\t" << (*iter).second->getName();
+    inputBox->addItem(QString(sstr.str().c_str()),QVariant((*iter).first));
+  }
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(inputBox);
+
+  pipe = new ElementsQtQueryPipe(&tmp,_dialog,inputBox);
+  pipe->update(inputBox->currentIndex());
+  connect(inputBox,SIGNAL(currentIndexChanged(int)),pipe,SLOT(update(int)));
+}
+
+QtDialog::ElementsQtQuery::~ElementsQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::ElementsQtQuery::handle(){
+  return true;
+}
+
+QtDialog::EmptyQtQuery::EmptyQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) :
+    Dialog::EmptyQuery(_title),
+    parent(_parent)
+{
+  titleLabel = new QLabel(QString(getTitle().c_str()));
+
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+
+  pipe = new EmptyQtQueryPipe(_dialog,titleLabel);
+}
+
+QtDialog::EmptyQtQuery::~EmptyQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::EmptyQtQuery::handle(){
+  return true;
+}
+
+
+QtDialog::BooleanQtQuery::BooleanQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) :
+    Dialog::BooleanQuery(_title),
+    parent(_parent)
+{
+  titleLabel = new QLabel(QString(getTitle().c_str()),_dialog);
+  booleanComboBox = new QComboBox(_dialog);
+  booleanComboBox->insertItem(1, QString("true"));
+  booleanComboBox->insertItem(0, QString("false"));
+
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(titleLabel);
+  thisLayout->addWidget(booleanComboBox);
+
+  pipe = new BooleanQtQueryPipe(&tmp,_dialog,booleanComboBox);
+  connect(booleanComboBox, SIGNAL(currentIndexChanged()), pipe, SLOT(update()));
+}
+
+QtDialog::BooleanQtQuery::~BooleanQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::BooleanQtQuery::handle(){
+  return true;
+}
+
+
+QtDialog::FileQtQuery::FileQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog) :
+    Dialog::FileQuery(_title),
+    parent(_parent)
+{
+
+  filenameLineEdit = new QLineEdit(_dialog);
+  filenameLineEdit->setText(QString());
+  filenameLineEdit->setReadOnly(true);
+
+  filenameLabel = new QLabel(QString("Input file:"));
+  filenameLabel->setBuddy(filenameLineEdit);
+
+  filedialogButton = new QPushButton("&Choose", _dialog);
+
+  pipe = new FileQtQueryPipe(&tmp,_dialog,filenameLineEdit,filedialogButton);
+
+  thisLayout = new QHBoxLayout();
+  parent->addLayout(thisLayout);
+  thisLayout->addWidget(filenameLabel);
+  thisLayout->addWidget(filenameLineEdit);
+  thisLayout->addWidget(filedialogButton);
+
+  QObject::connect(filedialogButton,SIGNAL(clicked()),pipe,SLOT(showFileDialog()));
+}
+
+QtDialog::FileQtQuery::~FileQtQuery()
+{
+  delete pipe;
+}
+
+bool QtDialog::FileQtQuery::handle(){
+  return true;
+}
+
+/*************************** Plumbing *******************************/
+
+
+template<typename T> QtQueryListPipe<T>::QtQueryListPipe(std::vector<T> *_content, QtDialog *_dialog, QLineEdit *_inputBox, QListWidget *_inputList, QPushButton *_AddButton, QPushButton *_RemoveButton) :
+  content(_content),
+  dialog(_dialog),
+  inputBox(_inputBox),
+  inputList(_inputList),
+  AddButton(_AddButton),
+  RemoveButton(_RemoveButton)
+{}
+
+template<typename T> QtQueryListPipe<T>::~QtQueryListPipe()
+{}
+
+template<typename T> void QtQueryListPipe<T>::IntegerEntered(const QString&)
+{
+  AddButton->setEnabled(true);
+}
+
+template<typename T> void QtQueryListPipe<T>::IntegerSelected()
+{
+  if (inputList->selectedItems().empty())
+    RemoveButton->setEnabled(false);
+  else
+    RemoveButton->setEnabled(true);
+}
+
+template<typename T> void QtQueryListPipe<T>::AddInteger() {
+  // type-check
+  std::string text = inputBox->text().toStdString();
+  int number = 0;
+  try {
+    number = boost::lexical_cast<int>(text);
+  } catch (boost::bad_lexical_cast&) {
+    return;
+  };
+  // add item to both
+  inputList->addItem(QString(number));
+  AddValue(number);
+}
+
+template<typename T> void QtQueryListPipe<T>::AddValue(T item) {
+  content->push_back(item);
+
+  dialog->update();
+}
+
+template<typename T> void QtQueryListPipe<T>::RemoveInteger() {
+  QList<QListWidgetItem *> items = inputList->selectedItems();
+  for (QList<QListWidgetItem *>::iterator iter = items.begin(); !items.empty(); iter = items.begin()) {
+    // obtain which position item has (by making it current item)
+    inputList->setCurrentItem(*iter);
+    // remove
+    QtQueryListPipe<T>::RemoteRow(inputList->currentRow()); // template parameters needs to be known, such that compiler knows which to call
+    inputList->removeItemWidget(*iter);
+  }
+}
+
+template<typename T> void QtQueryListPipe<T>::RemoveRow(int row) {
+  int counter = 0;
+  typename std::vector<T>::iterator iter = content->begin();
+  for (; iter != content->end(); ++iter)
+    if (counter++ == row)
+      break;
+  if (iter != content->end())
+      content->erase(iter);
+}
+
+
+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();
+}
+
+VectorQtQueryPipe::VectorQtQueryPipe(Vector *_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+VectorQtQueryPipe::~VectorQtQueryPipe()
+{}
+
+void VectorQtQueryPipe::update() {
+  dialog->update();
+}
+
+VectorsQtQueryPipe::VectorsQtQueryPipe(std::vector<Vector> *_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+VectorsQtQueryPipe::~VectorsQtQueryPipe()
+{}
+
+void VectorsQtQueryPipe::update() {
+  dialog->update();
+}
+
+BoxQtQueryPipe::BoxQtQueryPipe(Box &_content, QtDialog *_dialog, QTableWidget *_inputTable) :
+  content(_content),
+  dialog(_dialog),
+  inputTable(_inputTable)
+{
+  tmpM = new Matrix();
+  tmpM->zero();
+}
+
+BoxQtQueryPipe::~BoxQtQueryPipe()
+{
+  delete tmpM;
+}
+
+void BoxQtQueryPipe::update(int row, int column)
+{
+  tmpM->at(row, column) = inputTable->item(row, column)->text().toDouble();
+  content.setM(*tmpM);
+  dialog->update();
+}
+
+
+AtomQtQueryPipe::AtomQtQueryPipe(atom **_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+AtomQtQueryPipe::~AtomQtQueryPipe()
+{}
+
+void AtomQtQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  (*content) = World::getInstance().getAtom(AtomById(idx));
+  dialog->update();
+}
+
+
+AtomsQtQueryPipe::AtomsQtQueryPipe(std::vector<atom *>*_content, QtDialog *_dialog, QListWidget *_theList) :
+  content(_content),
+  dialog(_dialog),
+  theList(_theList)
+{}
+
+AtomsQtQueryPipe::~AtomsQtQueryPipe()
+{}
+
+void AtomsQtQueryPipe::update() {
+  // clear target and put all atoms therein
+  (*content).clear();
+  for (std::set<atom *>::iterator iter = currentList.begin(); iter != currentList.end(); ++iter)
+    (*content).push_back(*iter);
+  dialog->update();
+}
+
+void AtomsQtQueryPipe::add() {
+  QList<QListWidgetItem *> items = theList->selectedItems();
+  for (QList<QListWidgetItem *>::iterator iter = items.begin();iter != items.end();++iter) {
+    const int index = (*iter)->text().toInt();
+    atom *Walker = World::getInstance().getAtom(AtomById(index));
+    if (Walker) {
+      (*content).push_back(Walker);
+      currentList.insert(Walker);
+      if (lookup.find(index) != lookup.end())
+        lookup.insert(pair<int, atom*>(index, Walker));
+    }
+  }
+  update();
+}
+
+void AtomsQtQueryPipe::remove() {
+  QList<QListWidgetItem *> items = theList->selectedItems();
+  for (QList<QListWidgetItem *>::iterator iter = items.begin();iter != items.end();++iter) {
+    const int index = (*iter)->text().toInt();
+    atom *Walker = World::getInstance().getAtom(AtomById(index));
+    if (Walker) {
+      currentList.erase(Walker);
+    }
+  }
+  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();
+}
+
+
+MoleculesQtQueryPipe::MoleculesQtQueryPipe(std::vector<molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+MoleculesQtQueryPipe::~MoleculesQtQueryPipe()
+{}
+
+void MoleculesQtQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  molecule *mol = World::getInstance().getMolecule(MoleculeById(idx));
+  if (mol)
+    (*content).push_back(mol);
+  dialog->update();
+}
+
+ElementQtQueryPipe::ElementQtQueryPipe(const element **_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+ElementQtQueryPipe::~ElementQtQueryPipe()
+{}
+
+void ElementQtQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  *content = World::getInstance().getPeriode()->FindElement(idx);
+  dialog->update();
+}
+
+ElementsQtQueryPipe::ElementsQtQueryPipe(std::vector<const element *>*_content, QtDialog *_dialog, QComboBox *_theBox) :
+  content(_content),
+  dialog(_dialog),
+  theBox(_theBox)
+{}
+
+ElementsQtQueryPipe::~ElementsQtQueryPipe()
+{}
+
+void ElementsQtQueryPipe::update(int newIndex) {
+  QVariant data = theBox->itemData(newIndex);
+  int idx = data.toInt();
+  const element *elemental = World::getInstance().getPeriode()->FindElement(idx);
+  if(elemental)
+    (*content).push_back(elemental);
+  dialog->update();
+}
+
+EmptyQtQueryPipe::EmptyQtQueryPipe(QtDialog *_dialog, QLabel *_textLabel) :
+  dialog(_dialog),
+  textLabel(_textLabel)
+{}
+
+EmptyQtQueryPipe::~EmptyQtQueryPipe()
+{}
+
+void EmptyQtQueryPipe::update() {
+  dialog->update();
+}
+
+BooleanQtQueryPipe::BooleanQtQueryPipe(const bool *_content, QtDialog *_dialog, QComboBox *_booleanComboBox) :
+  content(_content),
+  dialog(_dialog),
+  booleanComboBox(_booleanComboBox)
+{}
+
+BooleanQtQueryPipe::~BooleanQtQueryPipe()
+{}
+
+void BooleanQtQueryPipe::update() {
+  dialog->update();
+}
+
+FileQtQueryPipe::FileQtQueryPipe(boost::filesystem::path *_content, QtDialog *_dialog, QLineEdit *_filenameLineEdit, QPushButton *_filedialogButton) :
+  content(_content),
+  dialog(_dialog),
+  filenameLineEdit(_filenameLineEdit),
+  filedialogButton(_filedialogButton)
+{
+  theFileDialog = NULL;
+}
+
+FileQtQueryPipe::~FileQtQueryPipe()
+{
+  if (theFileDialog != NULL)
+    delete theFileDialog;
+}
+
+void FileQtQueryPipe::update() {
+  QStringList ListOfFilenames = theFileDialog->selectedFiles();
+  std::cout << "Selected File is " << ListOfFilenames.at(0).toStdString() << std::endl;
+  (*content) = ListOfFilenames.at(0).toStdString();
+  filenameLineEdit->setText(QString::fromStdString((*content).string()));
+  dialog->update();
+}
+
+void FileQtQueryPipe::showFileDialog() {
+  filedialogButton->setFlat(true);
+  if (theFileDialog == NULL) {
+    theFileDialog = new QFileDialog(NULL, tr("Open input file"), QString(), tr("ParallelCarParrinello (*.conf);;MassivelyParallelQuantumChemistry (*.mpqc);;ParticleDataBase (*.pdb);;XYZ (*.xyz)"));
+    theFileDialog->setAcceptMode(QFileDialog::AcceptOpen);
+    theFileDialog->setFileMode(QFileDialog::ExistingFile);
+    theFileDialog->setViewMode(QFileDialog::List);
+  }
+  theFileDialog->exec();
+
+  update();
+  filedialogButton->setFlat(false);
+}
+
+
+
Index: src/UIElements/Qt4/QtDialog.hpp
===================================================================
--- src/UIElements/Qt4/QtDialog.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtDialog.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,619 @@
+/*
+ * QtDialog.hpp
+ *
+ *  Created on: Jan 18, 2010
+ *      Author: crueger
+ */
+
+#ifndef QTDIALOG_HPP_
+#define QTDIALOG_HPP_
+
+#include "UIElements/Dialog.hpp"
+#include <QtGui/QDialog>
+#include <QtGui/QFileDialog>
+
+#include <boost/filesystem.hpp>
+
+#include <map>
+#include <set>
+#include <vector>
+
+class QBoxLayout;
+class QLabel;
+class QSpinBox;
+class QDoubleSpinBox;
+class QLineEdit;
+class QListWidget;
+class QTableWidget;
+class QComboBox;
+class QDialogButtonBox;
+
+class Matrix;
+
+// Forward declarations for plumbing
+template<typename T> class QtQueryListPipe;
+class BooleanQtQueryPipe;
+class BoxQtQueryPipe;
+class StringQtQueryPipe;
+class StringsQtQueryPipe;
+class IntQtQueryPipe;
+class DoubleQtQueryPipe;
+class DoublesQtQueryPipe;
+class AtomQtQueryPipe;
+class AtomsQtQueryPipe;
+class MoleculeQtQueryPipe;
+class MoleculesQtQueryPipe;
+class EmptyQtQueryPipe;
+class ElementQtQueryPipe;
+class ElementsQtQueryPipe;
+class VectorQtQueryPipe;
+class VectorsQtQueryPipe;
+class FileQtQueryPipe;
+
+class QtDialog : public QDialog, public Dialog
+{
+  Q_OBJECT
+public:
+  QtDialog();
+  virtual ~QtDialog();
+
+  virtual void queryEmpty(const char*, std::string);
+  virtual void queryBoolean(const char *, std::string = "");
+  virtual void queryInt(const char *,std::string = "");
+  virtual void queryInts(const char *,std::string = "");
+  virtual void queryDouble(const char*,std::string = "");
+  virtual void queryDoubles(const char*,std::string = "");
+  virtual void queryString(const char*,std::string = "");
+  virtual void queryStrings(const char*,std::string = "");
+  virtual void queryAtom(const char*,std::string = "");
+  virtual void queryAtoms(const char*,std::string = "");
+  virtual void queryMolecule(const char*,std::string = "");
+  virtual void queryMolecules(const char*,std::string = "");
+  virtual void queryVector(const char*,bool,std::string = "");
+  virtual void queryVectors(const char*,bool,std::string = "");
+  virtual void queryBox(const char*, std::string = "");
+  virtual void queryElement(const char*,std::string = "");
+  virtual void queryElements(const char*,std::string = "");
+  virtual void queryFile(const char*,std::string = "");
+
+  virtual bool display();
+
+  virtual void update();
+
+protected:
+  class IntQtQuery : public Dialog::IntQuery {
+    public:
+      IntQtQuery(std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~IntQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QSpinBox *inputBox;
+
+      IntQtQueryPipe *pipe;
+    };
+
+  class IntsQtQuery : public Dialog::IntsQuery {
+    public:
+      IntsQtQuery(std::string _title,QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~IntsQtQuery();
+      virtual bool handle();
+      void IntegerEntered(const QString&);
+      void IntegerSelected();
+      void AddInteger();
+      void RemoveInteger();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+
+      QtQueryListPipe<int> *pipe;
+    };
+
+    class DoubleQtQuery : public Dialog::DoubleQuery {
+    public:
+      DoubleQtQuery(std::string title,QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~DoubleQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QDoubleSpinBox *inputBox;
+
+      DoubleQtQueryPipe *pipe;
+    };
+
+    class DoublesQtQuery : public Dialog::DoublesQuery {
+    public:
+      DoublesQtQuery(std::string title,QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~DoublesQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QDoubleSpinBox *inputBox;
+
+      QtQueryListPipe<double> *pipe;
+    };
+
+    class StringQtQuery : public Dialog::StringQuery {
+    public:
+      StringQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~StringQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QLineEdit *inputBox;
+
+      StringQtQueryPipe *pipe;
+    };
+
+    class StringsQtQuery : public Dialog::StringsQuery {
+    public:
+      StringsQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~StringsQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QLineEdit *inputBox;
+
+      QtQueryListPipe<std::string> *pipe;
+    };
+
+    class BoxQtQuery : public Dialog::BoxQuery {
+    public:
+      BoxQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~BoxQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QTableWidget *inputTable;
+
+      BoxQtQueryPipe *pipe;
+    };
+
+    class AtomQtQuery : public Dialog::AtomQuery {
+    public:
+      AtomQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~AtomQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      AtomQtQueryPipe *pipe;
+    };
+
+    class AtomsQtQuery : public Dialog::AtomsQuery {
+    public:
+      AtomsQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~AtomsQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      AtomsQtQueryPipe *pipe;
+    };
+
+    class MoleculeQtQuery : public Dialog::MoleculeQuery {
+    public:
+      MoleculeQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~MoleculeQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      MoleculeQtQueryPipe *pipe;
+    };
+
+    class MoleculesQtQuery : public Dialog::MoleculesQuery {
+    public:
+      MoleculesQtQuery(std::string _title, QBoxLayout *_parent,QtDialog *_dialog);
+      virtual ~MoleculesQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      MoleculesQtQueryPipe *pipe;
+    };
+
+    class VectorQtQuery : public Dialog::VectorQuery {
+    public:
+      VectorQtQuery(std::string title,bool _check,QBoxLayout *,QtDialog *);
+      virtual ~VectorQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *mainLayout;
+      QLabel *titleLabel;
+      QBoxLayout *subLayout;
+      QBoxLayout *coordLayout;
+      QLabel *coordLabel;
+      QDoubleSpinBox *coordInput;
+
+      VectorQtQueryPipe *pipe;
+    };
+
+    class VectorsQtQuery : public Dialog::VectorsQuery {
+    public:
+      VectorsQtQuery(std::string title,bool _check,QBoxLayout *,QtDialog *);
+      virtual ~VectorsQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *mainLayout;
+      QLabel *titleLabel;
+      QBoxLayout *subLayout;
+      QBoxLayout *coordLayout;
+      QLabel *coordLabel;
+      QDoubleSpinBox *coordInput;
+
+      VectorsQtQueryPipe *pipe;
+    };
+
+    class EmptyQtQuery : public Dialog::EmptyQuery {
+    public:
+      EmptyQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
+      virtual ~EmptyQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+
+      EmptyQtQueryPipe *pipe;
+    };
+
+    class BooleanQtQuery : public Dialog::BooleanQuery {
+    public:
+      BooleanQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
+      virtual ~BooleanQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *booleanComboBox;
+
+      BooleanQtQueryPipe *pipe;
+    };
+
+    class ElementQtQuery : public Dialog::ElementQuery {
+    public:
+      ElementQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
+      virtual ~ElementQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      ElementQtQueryPipe *pipe;
+    };
+
+    class ElementsQtQuery : public Dialog::ElementsQuery {
+    public:
+      ElementsQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
+      virtual ~ElementsQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *titleLabel;
+      QComboBox *inputBox;
+
+      ElementsQtQueryPipe *pipe;
+    };
+
+    class FileQtQuery : public Dialog::FileQuery {
+    public:
+      FileQtQuery(std::string _title, QBoxLayout *_parent, QtDialog *_dialog);
+      virtual ~FileQtQuery();
+      virtual bool handle();
+    private:
+      QBoxLayout *parent;
+      QBoxLayout *thisLayout;
+      QLabel *filenameLabel;
+      QLineEdit *filenameLineEdit;
+      QPushButton *filedialogButton;
+
+      FileQtQueryPipe *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
+
+
+template<typename T> class QtQueryListPipe : public QWidget {
+  public:
+    QtQueryListPipe(std::vector<T> *_content, QtDialog *_dialog, QLineEdit *_inputBox, QListWidget *_inputList, QPushButton *_AddButton, QPushButton *_RemoveButton);
+    virtual ~QtQueryListPipe();
+    void AddInteger();
+    void RemoveInteger();
+    void IntegerSelected();
+    void IntegerEntered(const QString&);
+
+  private:
+    void AddValue(T item);
+    void RemoveRow(int row);
+
+    std::vector<T> *content;
+    QtDialog *dialog;
+    QLineEdit *inputBox;
+    QListWidget *inputList;
+    QPushButton *AddButton;
+    QPushButton *RemoveButton;
+};
+
+
+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 BoxQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  BoxQtQueryPipe(Box &_content, QtDialog *_dialog, QTableWidget *_inputTable);
+  virtual ~BoxQtQueryPipe();
+
+public slots:
+  void update(int,int);
+
+private:
+  Box &content;
+  QtDialog *dialog;
+  QTableWidget *inputTable;
+
+  Matrix *tmpM;
+};
+
+
+class AtomQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  AtomQtQueryPipe(atom **_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~AtomQtQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  atom **content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+
+};
+
+
+class AtomsQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  AtomsQtQueryPipe(std::vector<atom *>*_content, QtDialog *_dialog, QListWidget *_theList);
+  virtual ~AtomsQtQueryPipe();
+
+public slots:
+  void update();
+  void add();
+  void remove();
+
+private:
+  std::vector<atom *>*content;
+  std::map<int, atom *> lookup;
+  std::set<atom *> currentList;
+  QtDialog *dialog;
+  QListWidget *theList;
+
+};
+
+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 MoleculesQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  MoleculesQtQueryPipe(std::vector<molecule *>*_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~MoleculesQtQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  std::vector<molecule *>*content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+
+};
+
+class VectorQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  VectorQtQueryPipe(Vector *_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~VectorQtQueryPipe();
+
+public slots:
+  void update();
+
+private:
+  Vector *content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+};
+
+class VectorsQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  VectorsQtQueryPipe(std::vector<Vector>*_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~VectorsQtQueryPipe();
+
+public slots:
+  void update();
+
+private:
+  std::vector<Vector> *content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+};
+
+class EmptyQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  EmptyQtQueryPipe(QtDialog *_dialog, QLabel *_textLabel);
+  virtual ~EmptyQtQueryPipe();
+
+public slots:
+  void update();
+
+private:
+  QtDialog *dialog;
+  QLabel *textLabel;
+};
+
+class BooleanQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  BooleanQtQueryPipe(const bool *_content, QtDialog *_dialog, QComboBox *_booleanComboBox);
+  virtual ~BooleanQtQueryPipe();
+
+public slots:
+  void update();
+
+private:
+  const bool *content;
+  QtDialog *dialog;
+  QComboBox *booleanComboBox;
+};
+
+class ElementQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  ElementQtQueryPipe(const element **_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~ElementQtQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  const element **content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+};
+
+class ElementsQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  ElementsQtQueryPipe(std::vector<const element *>*_content, QtDialog *_dialog, QComboBox *_theBox);
+  virtual ~ElementsQtQueryPipe();
+
+public slots:
+  void update(int);
+
+private:
+  std::vector<const element *>*content;
+  QtDialog *dialog;
+  QComboBox *theBox;
+};
+
+class FileQtQueryPipe : public QWidget {
+  Q_OBJECT
+public:
+  FileQtQueryPipe(boost::filesystem::path *_content, QtDialog *_dialog, QLineEdit *_filenameLineEdit, QPushButton *_filedialogButton);
+  virtual ~FileQtQueryPipe();
+
+public slots:
+  void update();
+  void showFileDialog();
+
+private:
+  boost::filesystem::path *content;
+  QtDialog *dialog;
+  QLineEdit *filenameLineEdit;
+  QPushButton *filedialogButton;
+  QFileDialog *theFileDialog;
+};
+
+#endif /* QTDIALOG_HPP_ */
Index: src/UIElements/Qt4/QtMainWindow.cpp
===================================================================
--- src/UIElements/Qt4/QtMainWindow.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtMainWindow.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,133 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * QtMainWindow.cpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#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 "Helpers/MemDebug.hpp"
+
+#include "atom.hpp"
+#include "molecule.hpp"
+#include "Helpers/Verbose.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"
+
+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 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtMainWindow.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -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 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtUIFactory.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,71 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * QtUIFactory.cpp
+ *
+ *  Created on: Jan 14, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iostream>
+#include <cassert>
+
+#include <qapplication.h>
+
+
+#include "UIElements/Qt4/QtUIFactory.hpp"
+#include "UIElements/Qt4/QtMainWindow.hpp"
+#include "UIElements/Qt4/QtDialog.hpp"
+
+#include "Helpers/MemDebug.hpp"
+
+#include "version.h"
+#include "defs.hpp"
+
+using namespace std;
+
+QtUIFactory::QtUIFactory() :
+  argc(1)
+{
+  // For now we just fake the command line parameters to make QT happy
+  argv = new char*[1];
+  argv[0] = new char[256];
+  strcpy(argv[0],MOLECUILDERVERSION);
+  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 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Qt4/QtUIFactory.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -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: c/UIElements/Views/QT4/GLMoleculeView.cpp
===================================================================
--- src/UIElements/Views/QT4/GLMoleculeView.cpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,29 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * GLMoleculeView.cpp
- *
- *  Created on: Jan 26, 2010
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "GLMoleculeView.hpp"
-
-#include "Helpers/MemDebug.hpp"
-
-GLMoleculeView::GLMoleculeView(QWidget *parent) :
-  QGLWidget(parent)
-{}
-
-GLMoleculeView::~GLMoleculeView()
-{}
Index: c/UIElements/Views/QT4/GLMoleculeView.hpp
===================================================================
--- src/UIElements/Views/QT4/GLMoleculeView.hpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,21 +1,0 @@
-/*
- * 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: c/UIElements/Views/QT4/QTMoleculeView.cpp
===================================================================
--- src/UIElements/Views/QT4/QTMoleculeView.cpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * QTMoleculeView.cpp
- *
- *  Created on: Mar 4, 2010
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Views/QT4/QTMoleculeView.hpp"
-
-#include <iostream>
-
-#include "Helpers/MemDebug.hpp"
-
-#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: c/UIElements/Views/QT4/QTMoleculeView.hpp
===================================================================
--- src/UIElements/Views/QT4/QTMoleculeView.hpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,77 +1,0 @@
-/*
- * 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: c/UIElements/Views/QT4/QTStatusBar.cpp
===================================================================
--- src/UIElements/Views/QT4/QTStatusBar.cpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,128 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * QTStatusBar.cpp
- *
- *  Created on: Feb 17, 2010
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sstream>
-
-#include <QtGui/QLabel>
-#include <QtGui/QBoxLayout>
-#include <QtGui/QProgressBar>
-
-#include "QTStatusBar.hpp"
-
-#include "Helpers/MemDebug.hpp"
-
-#include "World.hpp"
-#include "Helpers/helpers.hpp"
-#include "Actions/Process.hpp"
-
-
-QTStatusBar::QTStatusBar(QWidget *_parent) :
-  QStatusBar(_parent),
-  Observer("QTStatusBar"),
-  atomCount(World::getInstance().numAtoms()),
-  moleculeCount(World::getInstance().numMolecules()),
-  parent(_parent)
-{
-  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: c/UIElements/Views/QT4/QTStatusBar.hpp
===================================================================
--- src/UIElements/Views/QT4/QTStatusBar.hpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,55 +1,0 @@
-/*
- * 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: c/UIElements/Views/QT4/QTWorldView.cpp
===================================================================
--- src/UIElements/Views/QT4/QTWorldView.cpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,139 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2010 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * QTWorldView.cpp
- *
- *  Created on: Jan 21, 2010
- *      Author: crueger
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "Views/QT4/QTWorldView.hpp"
-
-#include <iostream>
-
-#include "Helpers/MemDebug.hpp"
-
-#include "atom.hpp"
-#include "Formula.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"/*,"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();
-    indexWidget->setText(QString::number(index));
-    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();
-    countWidget->setText(QString::number(atomCount));
-    countWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-    setItem(i,ATOMS,countWidget);
-
-    const Formula formula = (*iter)->getFormula();
-    QTableWidgetItem *formulaWidget= new QTableWidgetItem();
-    formulaWidget->setText(QString(formula.toString().c_str()));
-    formulaWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
-    setItem(i,ATOMS,formulaWidget);
-
-    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: c/UIElements/Views/QT4/QTWorldView.hpp
===================================================================
--- src/UIElements/Views/QT4/QTWorldView.hpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ 	(revision )
@@ -1,47 +1,0 @@
-/*
- * 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,FORMULA,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_ */
Index: src/UIElements/Views/Qt4/GLMoleculeView.cpp
===================================================================
--- src/UIElements/Views/Qt4/GLMoleculeView.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Views/Qt4/GLMoleculeView.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,29 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * GLMoleculeView.cpp
+ *
+ *  Created on: Jan 26, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "GLMoleculeView.hpp"
+
+#include "Helpers/MemDebug.hpp"
+
+GLMoleculeView::GLMoleculeView(QWidget *parent) :
+  QGLWidget(parent)
+{}
+
+GLMoleculeView::~GLMoleculeView()
+{}
Index: src/UIElements/Views/Qt4/GLMoleculeView.hpp
===================================================================
--- src/UIElements/Views/Qt4/GLMoleculeView.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Views/Qt4/GLMoleculeView.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -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 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Views/Qt4/QtMoleculeView.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,106 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * QtMoleculeView.cpp
+ *
+ *  Created on: Mar 4, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Views/Qt4/QtMoleculeView.hpp"
+
+#include <iostream>
+
+#include "Helpers/MemDebug.hpp"
+
+#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 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Views/Qt4/QtMoleculeView.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -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 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Views/Qt4/QtStatusBar.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,128 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * QtStatusBar.cpp
+ *
+ *  Created on: Feb 17, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sstream>
+
+#include <QtGui/QLabel>
+#include <QtGui/QBoxLayout>
+#include <QtGui/QProgressBar>
+
+#include "QtStatusBar.hpp"
+
+#include "Helpers/MemDebug.hpp"
+
+#include "World.hpp"
+#include "Helpers/helpers.hpp"
+#include "Actions/Process.hpp"
+
+
+QtStatusBar::QtStatusBar(QWidget *_parent) :
+  QStatusBar(_parent),
+  Observer("QtStatusBar"),
+  atomCount(World::getInstance().numAtoms()),
+  moleculeCount(World::getInstance().numMolecules()),
+  parent(_parent)
+{
+  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 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Views/Qt4/QtStatusBar.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -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 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Views/Qt4/QtWorldView.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -0,0 +1,139 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * QtWorldView.cpp
+ *
+ *  Created on: Jan 21, 2010
+ *      Author: crueger
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Views/Qt4/QtWorldView.hpp"
+
+#include <iostream>
+
+#include "Helpers/MemDebug.hpp"
+
+#include "atom.hpp"
+#include "Formula.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"/*,"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();
+    indexWidget->setText(QString::number(index));
+    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();
+    countWidget->setText(QString::number(atomCount));
+    countWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+    setItem(i,ATOMS,countWidget);
+
+    const Formula formula = (*iter)->getFormula();
+    QTableWidgetItem *formulaWidget= new QTableWidgetItem();
+    formulaWidget->setText(QString(formula.toString().c_str()));
+    formulaWidget->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+    setItem(i,ATOMS,formulaWidget);
+
+    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 4cf323d81658274e55e522306030678b93d2c779)
+++ src/UIElements/Views/Qt4/QtWorldView.hpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -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,FORMULA,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_ */
Index: src/builder.cpp
===================================================================
--- src/builder.cpp	(revision 81126aaa1c532d13341be518be2f6758858a3902)
+++ src/builder.cpp	(revision 4cf323d81658274e55e522306030678b93d2c779)
@@ -86,5 +86,5 @@
 #include "UIElements/CommandLineUI/CommandLineUIFactory.hpp"
 #ifdef USE_GUI_QT
-#include "UIElements/QT4/QTUIFactory.hpp"
+#include "UIElements/Qt4/QtUIFactory.hpp"
 #endif
 #include "UIElements/MainWindow.hpp"
@@ -184,7 +184,7 @@
       ASSERT_DO(Assert::Ask);
       #ifdef USE_GUI_QT
-        DoLog(0) && (Log() << Verbose(0) << "Setting UI to QT4." << endl);
-        UIFactory::registerFactory(new QTUIFactory::description());
-        UIFactory::makeUserInterface("QT4");
+        DoLog(0) && (Log() << Verbose(0) << "Setting UI to Qt4." << endl);
+        UIFactory::registerFactory(new QtUIFactory::description());
+        UIFactory::makeUserInterface("Qt4");
       #else
         DoLog(0) && (Log() << Verbose(0) << "Setting UI to Text." << endl);
