]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
put all classes for the parameterGUI in a namespace and add parameterGUI documentatio...
authorsteigemann <steigemann@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 23 Feb 2011 23:32:17 +0000 (23:32 +0000)
committersteigemann <steigemann@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 23 Feb 2011 23:32:17 +0000 (23:32 +0000)
git-svn-id: https://svn.dealii.org/trunk@23441 0785d39b-7218-0410-832d-ea1e28bc413d

15 files changed:
deal.II/contrib/parameter_gui/browse_lineedit.cpp
deal.II/contrib/parameter_gui/browse_lineedit.h
deal.II/contrib/parameter_gui/info_message.cpp
deal.II/contrib/parameter_gui/info_message.h
deal.II/contrib/parameter_gui/main.cpp
deal.II/contrib/parameter_gui/mainwindow.cpp
deal.II/contrib/parameter_gui/mainwindow.h
deal.II/contrib/parameter_gui/parameter_delegate.cpp
deal.II/contrib/parameter_gui/parameter_delegate.h
deal.II/contrib/parameter_gui/parameters.xml
deal.II/contrib/parameter_gui/xml_parameter_reader.cpp
deal.II/contrib/parameter_gui/xml_parameter_reader.h
deal.II/contrib/parameter_gui/xml_parameter_writer.cpp
deal.II/contrib/parameter_gui/xml_parameter_writer.h
deal.II/doc/doxygen/Makefile.in

index f6aaa3c98346495f8c656769019390c4be4ec9e6..33e89864c1fa3cb1af0dfd73125faa3c28c9814a 100644 (file)
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #include <QtGui>
 
 #include "browse_lineedit.h"
 
 
-BrowseLineEdit::BrowseLineEdit(const BrowseType  type, QWidget *parent)
-              : QFrame(parent, 0),
-                browse_type(type)
+namespace dealii
 {
-  line_editor = new QLineEdit;
-  connect(line_editor, SIGNAL(editingFinished()), this, SLOT(editing_finished()));
+  namespace ParameterGui
+  {
+    BrowseLineEdit::BrowseLineEdit(const BrowseType  type, QWidget *parent)
+                  : QFrame(parent, 0),
+                    browse_type(type)
+    {
+      line_editor = new QLineEdit;
+      connect(line_editor, SIGNAL(editingFinished()), this, SLOT(editing_finished()));
 
-  browse_button = new QPushButton("&Browse...");
-  connect(browse_button, SIGNAL(clicked()), this, SLOT(browse()));
+      browse_button = new QPushButton("&Browse...");
+      connect(browse_button, SIGNAL(clicked()), this, SLOT(browse()));
 
-  setFocusPolicy (Qt::StrongFocus);
+      setFocusPolicy (Qt::StrongFocus);
 
-  QHBoxLayout *layout = new QHBoxLayout;
+      QHBoxLayout *layout = new QHBoxLayout;
 
-  layout->addWidget(line_editor);
-  layout->addWidget(browse_button);
-  setLayout(layout);
+      layout->addWidget(line_editor);
+      layout->addWidget(browse_button);
+      setLayout(layout);
 
-  setAutoFillBackground(true);
-  setBackgroundRole(QPalette::Highlight);
-}
+      setAutoFillBackground(true);
+      setBackgroundRole(QPalette::Highlight);
+    }
 
 
 
 
-QSize BrowseLineEdit::sizeHint() const
-{
-  QSize  size_line_editor   = line_editor->sizeHint(),
-         size_browse_button = browse_button->sizeHint();
+    QSize BrowseLineEdit::sizeHint() const
+    {
+      QSize  size_line_editor   = line_editor->sizeHint(),
+             size_browse_button = browse_button->sizeHint();
 
-  int w = size_line_editor.rwidth() + size_browse_button.rwidth(),
-      h = qMax(size_line_editor.rheight(), size_browse_button.rheight());
+      int w = size_line_editor.rwidth() + size_browse_button.rwidth(),
+          h = qMax(size_line_editor.rheight(), size_browse_button.rheight());
 
-  return QSize (w, h);
-}
+      return QSize (w, h);
+    }
 
 
 
-QSize BrowseLineEdit::minimumSizeHint() const
-{
-  QSize  size_line_editor   = line_editor->minimumSizeHint(),
-         size_browse_button = browse_button->minimumSizeHint();
-
-  int w = size_line_editor.rwidth() + size_browse_button.rwidth(),
-      h = qMax(size_line_editor.rheight(), size_browse_button.rheight());
+    QSize BrowseLineEdit::minimumSizeHint() const
+    {
+      QSize  size_line_editor   = line_editor->minimumSizeHint(),
+             size_browse_button = browse_button->minimumSizeHint();
 
-  return QSize (w, h);
-}
+      int w = size_line_editor.rwidth() + size_browse_button.rwidth(),
+          h = qMax(size_line_editor.rheight(), size_browse_button.rheight());
 
+      return QSize (w, h);
+    }
 
 
-QString BrowseLineEdit::text() const
-{
-  return line_editor->text();
-}
 
+    QString BrowseLineEdit::text() const
+    {
+      return line_editor->text();
+    }
 
 
-void BrowseLineEdit::setText(const QString &str)
-{
-  line_editor->setText(str);
-}
 
+    void BrowseLineEdit::setText(const QString &str)
+    {
+      line_editor->setText(str);
+    }
 
 
-void BrowseLineEdit::editing_finished()
-{
-  emit editingFinished();
-}
 
+    void BrowseLineEdit::editing_finished()
+    {
+      emit editingFinished();
+    }
 
 
-void BrowseLineEdit::browse()
-{
-  QString  name = "";
 
-  switch (browse_type)
+    void BrowseLineEdit::browse()
     {
-      case file:
-        {
-          name = QFileDialog::getOpenFileName(this, tr("Open File"),
-                                              QDir::currentPath(),
-                                              tr("All Files (*.*)"));
-          break;
-        };
+      QString  name = "";
 
-      case directory:
+      switch (browse_type)
         {
-          name = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
-                                                   QDir::homePath(),
-                                                   QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
-          break;
+          case file:
+            {
+              name = QFileDialog::getOpenFileName(this, tr("Open File"),
+                                                  QDir::currentPath(),
+                                                  tr("All Files (*.*)"));
+              break;
+            };
+
+          case directory:
+            {
+              name = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
+                                                       QDir::homePath(),
+                                                       QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
+              break;
+            };
         };
-    };
 
-  if (!name.isEmpty() && !name.isNull())
-    line_editor->setText(name);
+      if (!name.isEmpty() && !name.isNull())
+        line_editor->setText(name);
+    }
+  }
 }
 
index 215693192ba64f7175d1a704e39e002033bc7b77..2c0a97fadaed43e98821a351fdd53c4ed4e52dc5 100644 (file)
@@ -1,3 +1,13 @@
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #ifndef BROWSELINEEDIT_H
 #define BROWSELINEEDIT_H
@@ -7,6 +17,14 @@
 #include <QFileDialog>
 #include <QPushButton>
 
+
+namespace dealii
+{
+/*! @addtogroup ParameterGui
+ *@{
+ */
+  namespace ParameterGui
+  {
 /**
  * The BrowseLineEdit class provides a special line editor for the parameterGUI.
  * While editing file- or directory names it is much more easier to have a file-dialog
  * copies the path to the line editor. Depending on the <tt>BrowseType</tt> given in the constructor
  * the browse button opens a <tt>file</tt> or a <tt>directory</tt> dialog.
  *
- * @ingroup gui
- * @author Martin Steigemann, Wolfgang Bangerth, December 2010
+ * @note This class is used in the graphical user interface for the @ref ParameterHandler class.
+ *       It is not compiled into the deal.II libraries and can not be used by applications using deal.II.
+ *
+ * @ingroup ParameterGui
+ * @author Martin Steigemann, Wolfgang Bangerth, 2010
  */
-class BrowseLineEdit : public QFrame
-{
-  Q_OBJECT
+    class BrowseLineEdit : public QFrame
+    {
+      Q_OBJECT
 
-  public:
+      public:
                                     /**
                                      * The browse button opens a <tt>file</tt> or
                                      * a <tt>directory</tt> dialog. This can be specified
                                      * in the constructor by setting this flag <tt>BrowseType</tt>.
                                      */
-    enum BrowseType {file = 0, directory = 1};
+        enum BrowseType {file = 0, directory = 1};
                                     /**
                                      * Constructor. The type of the browse dialog can be specified
                                      * by the flag <tt>BrowseType</tt>, the default is <tt>file</tt>.
                                      */
-    BrowseLineEdit (const BrowseType  type = file,
-                    QWidget          *parent = 0);
+        BrowseLineEdit (const BrowseType  type = file,
+                        QWidget          *parent = 0);
 
                                     /**
                                      * Reimplemented from the QWidget class.
                                      * Returns the size of the editor.
                                      */
-    QSize  sizeHint() const;
+        QSize  sizeHint() const;
                                     /**
                                      * Reimplemented from the QWidget class.
                                      */
-    QSize  minimumSizeHint() const;
+        QSize  minimumSizeHint() const;
                                     /**
                                      * Returns the text of the line editor.
                                      */
-    QString  text() const;
+        QString  text() const;
                                     /**
                                      * This pattern stores the type of the browse dialog.
                                      */
-    BrowseType  browse_type;
+        BrowseType  browse_type;
 
-  public slots:
+      public slots:
                                     /**
-                                     * A <tt>slot</tt> for setting the text of the line editor.
+                                     * A <tt>slot</tt> to set @p str as text of the line editor.
                                      */
-    void setText(const QString &str);
-
-  signals:
+        void setText(const QString &str);
 
+      signals:
                                     /**
                                      * This <tt>signal</tt> will be emitted, if editing is finished.
                                      */
-    void editingFinished();
+        void editingFinished();
 
-  private slots:
+      private slots:
                                     /**
                                      * This <tt>slot</tt> should be always called, if editing is finished.
                                      */
-    void editing_finished();
+        void editing_finished();
                                     /**
                                      * This function opens a file- or a directory dialog as specified in the
                                      * constructor.
                                      */
-    void browse();
+        void browse();
 
-  private:
+      private:
                                     /**
                                      * The line editor.
                                      */
-    QLineEdit * line_editor;
+        QLineEdit * line_editor;
                                     /**
                                      * The browse button.
                                      */
-    QPushButton * browse_button;
-};
+        QPushButton * browse_button;
+    };
+  }
+/**@}*/
+}
+
 
 #endif
index e0af897d37a0b87a2861f767ee74a40d9f7ee7b1..db753bc0b1fe937bc172913bb76091eafbbce108 100644 (file)
@@ -1,83 +1,99 @@
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #include <QtGui>
 
 #include "info_message.h"
 
 
-InfoMessage::InfoMessage(QWidget *parent)
-           : QDialog(parent, 0)
+namespace dealii
 {
-  show_again = true;                                                   // this variable stores, if the
+  namespace ParameterGui
+  {
+    InfoMessage::InfoMessage(QWidget *parent)
+               : QDialog(parent, 0)
+    {
+      show_again = true;                                               // this variable stores, if the
                                                                        // the info message should be shown again
-  QGridLayout * grid = new QGridLayout(this);
+      QGridLayout * grid = new QGridLayout(this);
 
-  icon = new QLabel(this);                                             // set an icon
+      icon = new QLabel(this);                                         // set an icon
 #ifndef QT_NO_MESSAGEBOX
-  icon->setPixmap(QMessageBox::standardIcon(QMessageBox::Information));
-  icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
+      icon->setPixmap(QMessageBox::standardIcon(QMessageBox::Information));
+      icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
 #endif
-  grid->addWidget(icon, 0, 0, Qt::AlignTop);                           // add the icon in the upper left corner
+      grid->addWidget(icon, 0, 0, Qt::AlignTop);                       // add the icon in the upper left corner
 
-  message = new QTextEdit(this);                                       // set the new message
-  message->setReadOnly(true);
-  grid->addWidget(message, 0, 1);                                      // and add the message on the right
+      message = new QTextEdit(this);                                   // set the new message
+      message->setReadOnly(true);
+      grid->addWidget(message, 0, 1);                                  // and add the message on the right
 
-  again = new QCheckBox(this);                                         // add a check box
-  again->setChecked(true);
-  again->setText(QErrorMessage::tr("&Show this message again"));
-  grid->addWidget(again, 1, 1, Qt::AlignTop);
+      again = new QCheckBox(this);                                     // add a check box
+      again->setChecked(true);
+      again->setText(QErrorMessage::tr("&Show this message again"));
+      grid->addWidget(again, 1, 1, Qt::AlignTop);
 
-  ok = new QPushButton(this);                                          // and finally a OK button
-  ok->setText(QErrorMessage::tr("&OK"));
+      ok = new QPushButton(this);                                      // and finally a OK button
+      ok->setText(QErrorMessage::tr("&OK"));
 #ifdef QT_SOFTKEYS_ENABLED
-  ok_action = new QAction(ok);                                         // define the action for the button
-  ok_action->setSoftKeyRole(QAction::PositiveSoftKey);
-  ok_action->setText(ok->text());
-  connect(ok_action, SIGNAL(triggered()), this, SLOT(accept()));
-  addAction(ok_action);
+      ok_action = new QAction(ok);                                     // define the action for the button
+      ok_action->setSoftKeyRole(QAction::PositiveSoftKey);
+      ok_action->setText(ok->text());
+      connect(ok_action, SIGNAL(triggered()), this, SLOT(accept()));
+      addAction(ok_action);
 #endif
-  connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
-  ok->setFocus();                                                      // aand set the focus on the button
-  grid->addWidget(ok, 2, 0, 1, 2, Qt::AlignCenter);
+      connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
+      ok->setFocus();                                                  // aand set the focus on the button
+      grid->addWidget(ok, 2, 0, 1, 2, Qt::AlignCenter);
 
-  grid->setColumnStretch(1, 42);
-  grid->setRowStretch(0, 42);
+      grid->setColumnStretch(1, 42);
+      grid->setRowStretch(0, 42);
                                                                        // load settings from an ini-file
-  QString  settings_file = QDir::currentPath() + "/settings.ini";
+      QString  settings_file = QDir::currentPath() + "/settings.ini";
 
-  settings = new QSettings (settings_file, QSettings::IniFormat);
+      settings = new QSettings (settings_file, QSettings::IniFormat);
 
-  settings->beginGroup("infoMessage");                                 // we store settings of this class in the
-  show_again = settings->value("showInformation", true).toBool();      //group infoMessage
-  settings->endGroup();
-}
+      settings->beginGroup("infoMessage");                             // we store settings of this class in the
+      show_again = settings->value("showInformation", true).toBool();  //group infoMessage
+      settings->endGroup();
+    }
 
 
 
-void InfoMessage::setInfoMessage(const QString &message)
-{
-  this->message->setText(message);                                     // set the message
-}
+    void InfoMessage::setInfoMessage(const QString &message)
+    {
+      this->message->setText(message);                                 // set the message
+    }
 
 
 
-void InfoMessage::showMessage()
-{
-  if (show_again)                                                      // and show the message
-    show();
-}
+    void InfoMessage::showMessage()
+    {
+      if (show_again)                                                  // and show the message
+        show();
+    }
 
 
 
-void InfoMessage::done(int r)
-{
-  if(!again->isChecked())                                              // if the box is not checked,
-    {                                                                  // store this to settings
-      settings->beginGroup("infoMessage");
-      settings->setValue("showInformation", false);
-      settings->endGroup();
-    };
+    void InfoMessage::done(int r)
+    {
+      if(!again->isChecked())                                          // if the box is not checked,
+        {                                                              // store this to settings
+          settings->beginGroup("infoMessage");
+          settings->setValue("showInformation", false);
+          settings->endGroup();
+        };
 
-  QDialog::done(r);
+      QDialog::done(r);
+    }
+  }
 }
 
index 03bf905c2ee61a1f9e91a9ece3798829e150a751..f3ad3711e70a790aa111fef448cc742627254557 100644 (file)
@@ -1,3 +1,13 @@
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #ifndef INFOMESSAGE_H
 #define INFOMESSAGE_H
 #include <QLabel>
 
 
+namespace dealii
+{
+/*! @addtogroup ParameterGui
+ *@{
+ */
+  namespace ParameterGui
+  {
 /**
  * The InfoMessage class implements a special info message for the parameterGUI.
- * Besides showing a info message itself, the dialog shows a checkbox "Show this message again".
- * If the user unchecks this box, this is stored in the "settings.ini" file and will be reloaded
+ * Besides showing a info message itself, the dialog shows a checkbox &quot;Show this message again&quot;.
+ * If the user unchecks this box, this is stored in the &quot;settings.ini&quot; file and will be reloaded
  * the next time the user opens the parameterGUI. The intention of such a info message is the following.
- * The user should have some information on how using the GUI "at hand"
- * such as "how to edit parameter values?" for example. But after reading this message, the user knows it
- * and the message should not appear permanently.
+ * The user should have some information on how using the GUI &quot;at hand&quot;
+ * such as &quot;how to edit parameter values&quot; for example. But after reading this message, the user knows
+ * it and the message should not appear permanently.
+ *
+ * @note This class is used in the graphical user interface for the @ref ParameterHandler class.
+ *       It is not compiled into the deal.II libraries and can not be used by applications using deal.II.
  *
- * @ingroup gui
- * @author Martin Steigemann, Wolfgang Bangerth, December 2010
+ * @ingroup ParameterGui
+ * @author Martin Steigemann, Wolfgang Bangerth, 2010
  */
-class InfoMessage : public QDialog
-{
-  Q_OBJECT
+    class InfoMessage : public QDialog
+    {
+      Q_OBJECT
 
-  public:
+      public:
                                     /**
                                      * Constructor
                                      */
-    InfoMessage (QWidget *parent = 0);
+        InfoMessage (QWidget *parent = 0);
                                     /**
-                                     * With this function the <tt>message</tt> which will be shown in the
+                                     * With this function the @p message which will be shown in the
                                      * dialog can be set.
                                      */
-    void setInfoMessage(const QString &message);
+        void setInfoMessage(const QString &message);
 
-  public slots:
+      public slots:
                                     /**
                                      * Show the dialog with the <tt>message</tt>.
                                      */
-    void showMessage();
+        void showMessage();
 
-  protected:
+      protected:
                                     /**
                                      * Reimplemented from QDialog.
                                      */
-    void done(int r);
+        void done(int r);
 
-  private:
+      private:
                                     /**
                                      * This variable stores, if the <tt>message</tt> should be shown again the next time.
                                      */
-    bool show_again;
+        bool show_again;
                                     /**
                                      * The <tt>Ok</tt> button.
                                      */
-    QPushButton * ok;
+        QPushButton * ok;
                                     /**
                                      * The checkbox<tt>Show this message again</tt>.
                                      */
-    QCheckBox * again;
+        QCheckBox * again;
                                     /**
                                      * The <tt>message</tt> editor.
                                      */
-    QTextEdit * message;
+        QTextEdit * message;
                                     /**
                                      * An <tt>icon</tt> for the dialog.
                                      */
-    QLabel * icon;
+        QLabel * icon;
 #ifdef QT_SOFTKEYS_ENABLED
                                     /**
                                      * A action for pressing the <tt>Ok</tt> button.
                                      */
-    QAction *ok_action;
+        QAction * ok_action;
 #endif
                                     /**
                                      * An object for storing <tt>settings</tt> in a file.
                                      */
-    QSettings * settings;
-};
+        QSettings * settings;
+    };
+  }
+/**@}*/
+}
+
 
 #endif
index 851df5bae54a5ea9381be562f47d2a108fc19b0d..461cd0c0aae657e22e74e268e1ecd49631afc1c4 100644 (file)
@@ -1,3 +1,13 @@
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #include <QApplication>
 #include <QSplashScreen>
 
 #include "mainwindow.h"
 
+/*! @addtogroup ParameterGui
+ *@{
+ */
 
 /**
  * Main function for the parameterGUI.
  * The parameterGUI is a graphical user interface for editing parameter files based on the XML format,
  * created by the ParameterHandler::print_parameters() function with ParameterHandler::XML as second argument.
  *
- *   @image html logo_dealii_gui.png
+ * @image html logo_dealii_gui.png
+ *
+ * @note This class is used in the graphical user interface for the @ref ParameterHandler class.
+ *       It is not compiled into the deal.II libraries and can not be used by applications using deal.II.
+ *
  *
- * @ingroup gui
- * @author Martin Steigemann, Wolfgang Bangerth, December 2010
+ * <p>This program uses Qt version > 4.3. Qt is licensed under the GNU General Public License
+ * version 3.0. Please see http://qt.nokia.com/products/licensing for an overview of Qt licensing.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). Qt is a Nokia product.
+ * See http://qt.nokia.com/ for more information.</p>
+ *
+ *
+ * @ingroup ParameterGui
+ * @author Martin Steigemann, Wolfgang Bangerth, 2010
  */
 int main(int argc, char *argv[])
 {
-  Q_INIT_RESOURCE(application);                                        // init resources such as icons or graphics
+  Q_INIT_RESOURCE(application);                                                // init resources such as icons or graphics
 
   QApplication app(argc, argv);
 
-  QSplashScreen * splash = new QSplashScreen;                  // setup a splash screen
+  QSplashScreen * splash = new QSplashScreen;                          // setup a splash screen
   splash->setPixmap(QPixmap(":/images/logo_dealii_gui.png"));
   splash->show();
 
-  QTimer::singleShot(3000, splash, SLOT(close()));             // and close it after 3000 ms
+  QTimer::singleShot(3000, splash, SLOT(close()));                     // and close it after 3000 ms
 
-  app.setApplicationName("parameterGUI for deal.II");          // setup the application name
+  app.setApplicationName("parameterGUI for deal.II");                  // setup the application name
 
-  MainWindow * main_win = new MainWindow (argv[1]);            // give command line arguments to main_win
-                                                               // if a parameter file is specified at the
-                                                               // command line, give it to the MainWindow.
+  dealii::ParameterGui::MainWindow * main_win =
+    new dealii::ParameterGui::MainWindow (argv[1]);                    // give command line arguments to main_win
+                                                                       // if a parameter file is specified at the
+                                                                       // command line, give it to the MainWindow.
 
-  QTimer::singleShot(1500, main_win, SLOT(show()));            // show the main window with a short delay
-                                                               // so we can see the splash screen
+  QTimer::singleShot(1500, main_win, SLOT(show()));                    // show the main window with a short delay
+                                                                       // so we can see the splash screen
   return app.exec();
 }
+/**@}*/
+
index 1c621a130d7a2bc52b590d5f0559b14dedb7cde6..4cef562f34db210ba31859cc1d25b9b18abd58df 100644 (file)
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #include <QtGui>
 
 #include "mainwindow.h"
+#include "parameter_delegate.h"
+#include "xml_parameter_reader.h"
+#include "xml_parameter_writer.h"
 
 
-MainWindow::MainWindow(const QString  &filename)
+namespace dealii
 {
-  QString  settings_file = QDir::currentPath() + "/settings.ini";      // a file for user settings
-
-  gui_settings = new QSettings (settings_file, QSettings::IniFormat);  // load settings
-                                                                       // Up to now, we do not read any settings,
-                                                                       // but this can be used in the future for customizing the GUI.
-
-  tree_widget = new QTreeWidget;                                       // tree for showing XML tags
-
-                                                                       // Setup the tree and the window first:
-  tree_widget->header()->setResizeMode(QHeaderView::ResizeToContents); // behavior of the header sections:
-                                                                       // "Interactive: User can resize sections"
-                                                                       // "Fixed: User cannot resize sections"
-                                                                       // "Stretch: Qt will automatically resize sections to fill available space"
-                                                                       // "ResizeToContents: Qt will automatically resize sections to optimal size"
-  tree_widget->setHeaderLabels(QStringList() << tr("(Sub)Sections/Parameters")
-                                             << tr("Value"));
-  tree_widget->setMouseTracking(true);                                 // enables mouse events e.g. showing ToolTips
-                                                                       // and documentation in the StatusLine
-  tree_widget->setEditTriggers(QAbstractItemView::DoubleClicked|
-                               QAbstractItemView::SelectedClicked|
-                               QAbstractItemView::EditKeyPressed);
-//                                QAbstractItemView::AnyKeyPressed);
-                                                                       // set which actions will initiate item editing: Editing starts when:
-                                                                       // DoubleClicked: an item is double clicked
-                                                                       // SelectedClicked: clicking on an already selected item
-                                                                       // EditKeyPressed: the platform edit key has been pressed over an item
-                                                                       // AnyKeyPressed: any key is pressed over an item
-
-  tree_widget->setItemDelegate(new ParameterDelegate(1));              // set the delegate for editing items
-  setCentralWidget(tree_widget);
-                                                                       // connect: if the tree changes, the window will know
-  connect(tree_widget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(tree_was_modified()));
-
-  create_actions();                                                    // create window actions as "Open",...
-  create_menus();                                                      // and menus
-  statusBar()->showMessage(tr("Ready, start editing by double-clicking or hitting F2!"));
-  setWindowTitle(tr("[*]parameterGUI"));                               // set window title
-
-  resize(800, 600);                                                    // set window height and width
-
-  if (filename.size() > 3)                                             // if there is a file_name, try to load the file.
-    load_file(filename);                                               // a vliad file has the xml extension, so we require size() > 3
-}
+  namespace ParameterGui
+  {
+    MainWindow::MainWindow(const QString  &filename)
+    {
+      QString  settings_file = QDir::currentPath() + "/settings.ini";          // a file for user settings
+
+      gui_settings = new QSettings (settings_file, QSettings::IniFormat);      // load settings
+                                                                               // Up to now, we do not read any settings,
+                                                                               // but this can be used in the future for customizing the GUI.
+
+      tree_widget = new QTreeWidget;                                           // tree for showing XML tags
+
+                                                                               // Setup the tree and the window first:
+      tree_widget->header()->setResizeMode(QHeaderView::ResizeToContents);     // behavior of the header sections:
+                                                                               // "Interactive: User can resize sections"
+                                                                               // "Fixed: User cannot resize sections"
+                                                                               // "Stretch: Qt will automatically resize sections to fill available space"
+                                                                               // "ResizeToContents: Qt will automatically resize sections to optimal size"
+      tree_widget->setHeaderLabels(QStringList() << tr("(Sub)Sections/Parameters")
+                                                 << tr("Value"));
+      tree_widget->setMouseTracking(true);                                     // enables mouse events e.g. showing ToolTips
+                                                                               // and documentation in the StatusLine
+      tree_widget->setEditTriggers(QAbstractItemView::DoubleClicked|
+                                   QAbstractItemView::SelectedClicked|
+                                   QAbstractItemView::EditKeyPressed);
+                                                                               // set which actions will initiate item editing: Editing starts when:
+                                                                               // DoubleClicked: an item is double clicked
+                                                                               // SelectedClicked: clicking on an already selected item
+                                                                               // EditKeyPressed: the platform edit key has been pressed over an item
+                                                                               // AnyKeyPressed: any key is pressed over an item
+
+      tree_widget->setItemDelegate(new ParameterDelegate(1));                  // set the delegate for editing items
+      setCentralWidget(tree_widget);
+                                                                               // connect: if the tree changes, the window will know
+      connect(tree_widget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(tree_was_modified()));
+
+      create_actions();                                                                // create window actions as "Open",...
+      create_menus();                                                          // and menus
+      statusBar()->showMessage(tr("Ready, start editing by double-clicking or hitting F2!"));
+      setWindowTitle(tr("[*]parameterGUI"));                                   // set window title
+
+      resize(800, 600);                                                                // set window height and width
+
+      if (filename.size() > 3)                                                 // if there is a file_name, try to load the file.
+        load_file(filename);                                                   // a vliad file has the xml extension, so we require size() > 3
+    }
 
 
 
-void MainWindow::open()
-{
-  if (maybe_save())                                            // check, if the content was modified
+    void MainWindow::open()
     {
-      QString  file_name =                                     // open a file dialog
-                 QFileDialog::getOpenFileName(this, tr("Open XML Parameter File"),
-                                              QDir::currentPath(),
-                                              tr("XML Files (*.xml)"));
-      if (!file_name.isEmpty())                                        // if a file was selected,
-        load_file(file_name);                                  // load the content
-    };
-}
+      if (maybe_save())                                                                // check, if the content was modified
+        {
+          QString  file_name =                                                 // open a file dialog
+                     QFileDialog::getOpenFileName(this, tr("Open XML Parameter File"),
+                                                  QDir::currentPath(),
+                                                  tr("XML Files (*.xml)"));
+          if (!file_name.isEmpty())                                            // if a file was selected,
+            load_file(file_name);                                              // load the content
+        };
+    }
 
 
 
-bool MainWindow::save()
-{
-  if (current_file.isEmpty())                                  // if there is no file
-    return save_as();                                          // to save changes, open a dialog
-  else
-    return save_file(current_file);                            // otherwise save
-}
+    bool MainWindow::save()
+    {
+      if (current_file.isEmpty())                                              // if there is no file
+        return save_as();                                                      // to save changes, open a dialog
+      else
+        return save_file(current_file);                                                // otherwise save
+    }
 
 
 
-bool MainWindow::save_as()
-{
-  QString  file_name =                                         // open a file dialog
-             QFileDialog::getSaveFileName(this, tr("Save XML Parameter File"),
-                                          QDir::currentPath(),
-                                          tr("XML Files (*.xml)"));
-
-  if (file_name.isEmpty())                                     // if no file was selected
-    return false;                                              // return false
-  else
-    return save_file(file_name);                               // otherwise save content to file
-}
+    bool MainWindow::save_as()
+    {
+      QString  file_name =                                                     // open a file dialog
+                 QFileDialog::getSaveFileName(this, tr("Save XML Parameter File"),
+                                              QDir::currentPath(),
+                                              tr("XML Files (*.xml)"));
 
+      if (file_name.isEmpty())                                                 // if no file was selected
+        return false;                                                          // return false
+      else
+        return save_file(file_name);                                           // otherwise save content to file
+    }
 
 
-void MainWindow::about()
-{
-#ifdef Q_WS_MAC
-    static QPointer<QMessageBox> old_msg_box;
 
-    if (old_msg_box) {
-        old_msg_box->show();
-        old_msg_box->raise();
-        old_msg_box->activateWindow();
-        return;
-    }
+    void MainWindow::about()
+    {
+#ifdef Q_WS_MAC
+      static QPointer<QMessageBox> old_msg_box;
+
+      if (old_msg_box)
+        {
+          old_msg_box->show();
+          old_msg_box->raise();
+          old_msg_box->activateWindow();
+          return;
+        };
 #endif
 
-  QString title = "About parameterGUI";
+      QString title = "About parameterGUI";
 
-  QString trAboutparameterGUIcaption;
-  trAboutparameterGUIcaption = QMessageBox::tr(
+      QString trAboutparameterGUIcaption;
+      trAboutparameterGUIcaption = QMessageBox::tr(
         "<h3>parameterGUI: A GraphicalUserInterface for parameter handling in deal.II</h3>"
         "<p>This program uses Qt version %1.</p>"
         ).arg(QLatin1String(QT_VERSION_STR));
 
-  QString trAboutparameterGUItext;
-  trAboutparameterGUItext = QMessageBox::tr(
+      QString trAboutparameterGUItext;
+      trAboutparameterGUItext = QMessageBox::tr(
         "<p>The parameterGUI is a graphical user interface for editing XML parameter files "
         "created by the ParameterHandler class of deal.II. Please see "
-        "<a href=\"http://www.dealii.org/6.3.1/doxygen/deal.II/classParameterHandler.html\">dealii.org/doc</a> for more information. "
+        "<a href=\"http://www.dealii.org/7.0.0/doxygen/deal.II/classParameterHandler.html\">dealii.org/doc</a> for more information. "
         "The parameterGUI parses XML files into a tree structure and provides "
         " special editors for different types of parameters.</p>"
 
@@ -141,220 +158,221 @@ void MainWindow::about()
         "Wolfgang Bangerth,  <a href=\"mailto:bangerth@math.tamu.edu\">bangerth@math.tamu.edu</a></p>"
         );
 
-  QMessageBox *msg_box = new QMessageBox;
-  msg_box->setAttribute(Qt::WA_DeleteOnClose);
-  msg_box->setWindowTitle(title);
-  msg_box->setText(trAboutparameterGUIcaption);
-  msg_box->setInformativeText(trAboutparameterGUItext);
+      QMessageBox *msg_box = new QMessageBox;
+      msg_box->setAttribute(Qt::WA_DeleteOnClose);
+      msg_box->setWindowTitle(title);
+      msg_box->setText(trAboutparameterGUIcaption);
+      msg_box->setInformativeText(trAboutparameterGUItext);
 
-  QPixmap pm(QLatin1String(":/images/logo_dealii_gui_128.png"));
+      QPixmap pm(QLatin1String(":/images/logo_dealii_gui_128.png"));
 
-  if (!pm.isNull())
-    msg_box->setIconPixmap(pm);
+      if (!pm.isNull())
+        msg_box->setIconPixmap(pm);
 
 #ifdef Q_WS_MAC
-    old_msg_box = msg_box;
-    msg_box->show();
+      old_msg_box = msg_box;
+      msg_box->show();
 #else
-    msg_box->exec();
+      msg_box->exec();
 #endif
-}
+    }
 
 
 
-void MainWindow::tree_was_modified()
-{
-  setWindowModified(true);             // store, that the window was modified
-                                       // this is a function from the QMainWindow class
-                                       // and we use the windowModified mechanism to show a "*"
-                                       // in the window title, if content was modified
-}
+    void MainWindow::tree_was_modified()
+    {
+      setWindowModified(true);                                                 // store, that the window was modified
+                                                                               // this is a function from the QMainWindow class
+                                                                               // and we use the windowModified mechanism to show a "*"
+                                                                               // in the window title, if content was modified
+    }
 
 
 
-void MainWindow::show_message ()
-{
-  QString title = "parameterGUI";
+    void MainWindow::show_message ()
+    {
+      QString title = "parameterGUI";
 
-  info_message = new InfoMessage(this);
+      info_message = new InfoMessage(this);
 
-  info_message->setWindowTitle(title);
-  info_message->setInfoMessage(tr("Start Editing by double-clicking on the parameter value or"
-                                  " by hitting the platform edit key. For example, on Linux this is the F2-key!"));
-  info_message->showMessage();
-}
+      info_message->setWindowTitle(title);
+      info_message->setInfoMessage(tr("Start Editing by double-clicking on the parameter value or"
+                                      " by hitting the platform edit key. For example, on Linux this is the F2-key!"));
+      info_message->showMessage();
+    }
 
 
 
-void MainWindow::closeEvent(QCloseEvent *event)
-{
-  if (maybe_save())                    // reimplement the closeEvent from the QMainWindow class
-    event->accept();                   // check, if we have to save modified content,
-  else                                 // if content was saved, accept the event,
-    event->ignore();                   // otherwise ignore it
-}
+    void MainWindow::closeEvent(QCloseEvent *event)
+    {
+      if (maybe_save())                                                                // reimplement the closeEvent from the QMainWindow class
+        event->accept();                                                       // check, if we have to save modified content,
+      else                                                                     // if content was saved, accept the event,
+        event->ignore();                                                       // otherwise ignore it
+    }
 
 
 
-void MainWindow::create_actions()
-{
-  open_act = new QAction(tr("&Open..."), this);                        // create actions
-  open_act->setIcon(QIcon(":/icons/fileopen.png"));            // and set icons
-  open_act->setShortcut(Qt::CTRL + Qt::Key_O);                 // set a short cut
-  open_act->setStatusTip(tr("Open a XML file"));               // set a status tip
-  connect(open_act, SIGNAL(triggered()), this, SLOT(open()));  // and connect
-
-  save_act = new QAction(tr("&Save ..."), this);
-  save_act->setIcon(QIcon(":/icons/filesave.png"));
-  save_act->setShortcut(Qt::CTRL + Qt::Key_S);
-  save_act->setStatusTip(tr("Save the current XML file"));
-  connect(save_act, SIGNAL(triggered()), this, SLOT(save()));
-
-  save_as_act = new QAction(tr("&Save As..."), this);
-  save_as_act->setIcon(QIcon(":/icons/filesaveas.png"));
-  save_as_act->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Q);
-  save_as_act->setStatusTip(tr("Save the current XML file as"));
-  connect(save_as_act, SIGNAL(triggered()), this, SLOT(save_as()));
-
-  exit_act = new QAction(tr("E&xit"), this);
-  exit_act->setIcon(QIcon(":/icons/exit.png"));
-  exit_act->setShortcut(Qt::CTRL + Qt::Key_Q);
-  exit_act->setStatusTip(tr("Exit the parameterGUI application"));
-  connect(exit_act, SIGNAL(triggered()), this, SLOT(close()));
-
-  about_act = new QAction(tr("&About"), this);
-  about_act->setIcon(QIcon(":/icons/idea.png"));
-  about_act->setStatusTip(tr("Show the parameterGUI About box"));
-  connect(about_act, SIGNAL(triggered()), this, SLOT(about()));
-
-  about_qt_act = new QAction(tr("About &Qt"), this);
-  about_qt_act->setStatusTip(tr("Show the Qt library's About box"));
-  connect(about_qt_act, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
-}
+    void MainWindow::create_actions()
+    {
+      open_act = new QAction(tr("&Open..."), this);                            // create actions
+      open_act->setIcon(QIcon(":/icons/fileopen.png"));                                // and set icons
+      open_act->setShortcut(Qt::CTRL + Qt::Key_O);                             // set a short cut
+      open_act->setStatusTip(tr("Open a XML file"));                           // set a status tip
+      connect(open_act, SIGNAL(triggered()), this, SLOT(open()));              // and connect
+
+      save_act = new QAction(tr("&Save ..."), this);
+      save_act->setIcon(QIcon(":/icons/filesave.png"));
+      save_act->setShortcut(Qt::CTRL + Qt::Key_S);
+      save_act->setStatusTip(tr("Save the current XML file"));
+      connect(save_act, SIGNAL(triggered()), this, SLOT(save()));
+
+      save_as_act = new QAction(tr("&Save As..."), this);
+      save_as_act->setIcon(QIcon(":/icons/filesaveas.png"));
+      save_as_act->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Q);
+      save_as_act->setStatusTip(tr("Save the current XML file as"));
+      connect(save_as_act, SIGNAL(triggered()), this, SLOT(save_as()));
+
+      exit_act = new QAction(tr("E&xit"), this);
+      exit_act->setIcon(QIcon(":/icons/exit.png"));
+      exit_act->setShortcut(Qt::CTRL + Qt::Key_Q);
+      exit_act->setStatusTip(tr("Exit the parameterGUI application"));
+      connect(exit_act, SIGNAL(triggered()), this, SLOT(close()));
+
+      about_act = new QAction(tr("&About"), this);
+      about_act->setIcon(QIcon(":/icons/idea.png"));
+      about_act->setStatusTip(tr("Show the parameterGUI About box"));
+      connect(about_act, SIGNAL(triggered()), this, SLOT(about()));
+
+      about_qt_act = new QAction(tr("About &Qt"), this);
+      about_qt_act->setStatusTip(tr("Show the Qt library's About box"));
+      connect(about_qt_act, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
+    }
 
 
 
-void MainWindow::create_menus()
-{
-    file_menu = menuBar()->addMenu(tr("&File"));               // create a file menu
-    file_menu->addAction(open_act);                            // and add actions
-    file_menu->addAction(save_act);
-    file_menu->addAction(save_as_act);
-    file_menu->addAction(exit_act);
+    void MainWindow::create_menus()
+    {
+        file_menu = menuBar()->addMenu(tr("&File"));                           // create a file menu
+        file_menu->addAction(open_act);                                                // and add actions
+        file_menu->addAction(save_act);
+        file_menu->addAction(save_as_act);
+        file_menu->addAction(exit_act);
 
-    menuBar()->addSeparator();
+        menuBar()->addSeparator();
 
-    help_menu = menuBar()->addMenu(tr("&Help"));               // create a help menu
-    help_menu->addAction(about_act);
-    help_menu->addAction(about_qt_act);
-}
+        help_menu = menuBar()->addMenu(tr("&Help"));                           // create a help menu
+        help_menu->addAction(about_act);
+        help_menu->addAction(about_qt_act);
+    }
 
 
 
-bool MainWindow::maybe_save()
-{
-  if (isWindowModified())                                      // if content was modified
+    bool MainWindow::maybe_save()
     {
-      QMessageBox::StandardButton ret;                         // ask, if content should be saved
-      ret = QMessageBox::warning(this, tr("parameterGUI"),
-                                 tr("The content has been modified.\n"
-                                    "Do you want to save your changes?"),
-              QMessageBox::Save | QMessageBox::Discard |QMessageBox::Cancel);
-
-      if (ret == QMessageBox::Save)
-        return save();
-      else if (ret == QMessageBox::Cancel)
-        return false;
-    };
-
-  return true;
-}
-
+      if (isWindowModified())                                                  // if content was modified
+        {
+          QMessageBox::StandardButton ret;                                     // ask, if content should be saved
+          ret = QMessageBox::warning(this, tr("parameterGUI"),
+                                     tr("The content has been modified.\n"
+                                        "Do you want to save your changes?"),
+                  QMessageBox::Save | QMessageBox::Discard |QMessageBox::Cancel);
+
+          if (ret == QMessageBox::Save)
+            return save();
+          else if (ret == QMessageBox::Cancel)
+            return false;
+        };
+
+      return true;
+    }
 
 
-bool MainWindow::save_file(const QString &filename)
-{
-  QFile  file(filename);
 
-  if (!file.open(QFile::WriteOnly | QFile::Text))              // open a file dialog
+    bool MainWindow::save_file(const QString &filename)
     {
-      QMessageBox::warning(this, tr("parameterGUI"),
-                                 tr("Cannot write file %1:\n%2.")
-                                 .arg(filename)
-                                 .arg(file.errorString()));
-      return false;
-    };
+      QFile  file(filename);
 
-  XMLParameterWriter  xml_writer(tree_widget);                 // create a xml_writer
+      if (!file.open(QFile::WriteOnly | QFile::Text))                          // open a file dialog
+        {
+          QMessageBox::warning(this, tr("parameterGUI"),
+                                     tr("Cannot write file %1:\n%2.")
+                                     .arg(filename)
+                                     .arg(file.errorString()));
+          return false;
+        };
 
-  if (!xml_writer.write_xml_file(&file))                       // and read the xml file
-    return false;
+      XMLParameterWriter  xml_writer(tree_widget);                             // create a xml_writer
 
-  statusBar()->showMessage(tr("File saved"), 2000);            // if we succeed, show a message
-  set_current_file(filename);                                  // and reset the window
+      if (!xml_writer.write_xml_file(&file))                                   // and read the xml file
+        return false;
 
-  return true;
-}
+      statusBar()->showMessage(tr("File saved"), 2000);                                // if we succeed, show a message
+      set_current_file(filename);                                              // and reset the window
 
+      return true;
+    }
 
 
-void MainWindow::load_file(const QString &filename)
-{
-  QFile  file(filename);
 
-  if (!file.open(QFile::ReadOnly | QFile::Text))               // open the file
+    void MainWindow::load_file(const QString &filename)
     {
-      QMessageBox::warning(this, tr("parameterGUI"),
-                                 tr("Cannot read file %1:\n%2.")
-                                 .arg(filename)
-                                 .arg(file.errorString()));
-      return;
-    };
+      QFile  file(filename);
+
+      if (!file.open(QFile::ReadOnly | QFile::Text))                           // open the file
+        {
+          QMessageBox::warning(this, tr("parameterGUI"),
+                                     tr("Cannot read file %1:\n%2.")
+                                     .arg(filename)
+                                     .arg(file.errorString()));
+          return;
+        };
+
+      tree_widget->clear();                                                    // clear the tree
+
+      XMLParameterReader  xml_reader(tree_widget);                             // and read the xml file
+
+      if (!xml_reader.read_xml_file(&file))
+        {
+          QMessageBox::warning(this, tr("parameterGUI"),
+                                     tr("Parse error in file %1:\n\n%2")
+                                     .arg(filename)
+                                     .arg(xml_reader.error_string()));
+        }
+      else
+        {
+          statusBar()->showMessage(tr("File loaded - Start editing by double-clicking or hitting F2"), 25000);
+          set_current_file(filename);                                          // show a message and set current file
+
+          show_message ();                                                     // show some informations how values can be edited
+        };
+    }
 
-  tree_widget->clear();                                                // clear the tree
 
-  XMLParameterReader  xml_reader(tree_widget);                 // and read the xml file
 
-  if (!xml_reader.read_xml_file(&file))
+    void MainWindow::set_current_file(const QString  &filename)
     {
-      QMessageBox::warning(this, tr("parameterGUI"),
-                                 tr("Parse error in file %1:\n\n%2")
-                                 .arg(filename)
-                                 .arg(xml_reader.error_string()));
+                                                                               // We use the windowModified mechanism from the
+                                                                               // QMainWindow class to indicate in the window title,
+                                                                               // if the content was modified.
+                                                                               // If there is "[*]" in the window title, a * will
+                                                                               // added automatically at this position, if the
+                                                                               // window was modified.
+                                                                               // We set the window title to
+                                                                               // file_name[*] - XMLParameterHandler
+
+      current_file = filename;                                                 // set the (global) current file to file_name
+
+      std::string win_title = (filename.toStdString());                                // and create the window title,
+
+      if (current_file.isEmpty())                                              // if file_name is empty
+        win_title = "[*]parameterGUI";                                         // set the title to our application name,
+      else
+        win_title += "[*] - parameterGUI";                                     // if there is a file_name, add the
+                                                                               // the file_name and a minus to the title
+
+      setWindowTitle(tr(win_title.c_str()));                                   // set the window title
+      setWindowModified(false);                                                        // and reset window modified
     }
-  else
-    {
-      statusBar()->showMessage(tr("File loaded - Start editing by double-clicking or hitting F2"), 25000);
-      set_current_file(filename);                              // show a message and set current file
-
-      show_message ();                                         // show some informations how values can be edited
-    };
-}
-
-
-
-void MainWindow::set_current_file(const QString  &filename)
-{
-                                               // We use the windowModified mechanism from the
-                                               // QMainWindow class to indicate in the window title,
-                                               // if the content was modified.
-                                               // If there is "[*]" in the window title, a * will
-                                               // added automatically at this position, if the
-                                               // window was modified.
-                                               // We set the window title to
-                                               // file_name[*] - XMLParameterHandler
-
-  current_file = filename;                                     // set the (global) current file to file_name
-
-  std::string win_title = (filename.toStdString());            // and create the window title,
-
-  if (current_file.isEmpty())                                  // if file_name is empty
-    win_title = "[*]parameterGUI";                             // set the title to our application name,
-  else
-    win_title += "[*] - parameterGUI";                         // if there is a file_name, add the
-                                                               // the file_name and a minus to the title
-
-  setWindowTitle(tr(win_title.c_str()));                       // set the window title
-  setWindowModified(false);                                    // and reset window modified
+  }
 }
-
index 03dfde0a945b1b6375301dde5d138807ec6cd4ff..54deeae047b3049cbcd516df905aeaf4d008d43e 100644 (file)
@@ -1,3 +1,13 @@
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #ifndef MAINWINDOW_H
 #define MAINWINDOW_H
 #include <QSettings>
 
 #include "info_message.h"
-#include "parameter_delegate.h"
-#include "xml_parameter_reader.h"
-#include "xml_parameter_writer.h"
 
+
+namespace dealii
+{
+/*! @addtogroup ParameterGui
+ *@{
+ */
+  namespace ParameterGui
+  {
 /**
  * The MainWindow class of the the parameterGUI.
  * The parameterGUI is a graphical user interface for editing parameter files based on the XML format,
- * created by the ParameterHandler::print_parameters() function with ParameterHandler::XML as second argument.
- * Please see @ref Representation of Parameters in the documentation of the @ref ParameterHandler class for more details.
+ * created by the @ref ParameterHandler::print_parameters() function with @ref ParameterHandler::XML as second argument.
+ * Please see <tt>Representation of Parameters</tt> in the documentation of the @ref ParameterHandler class for more details.
  * The MainWindow class provides the basic functionality of the GUI as save- and load-file-actions and documentation.
  * The parameterGUI provides special editors for the different types of parameters defined in the ParameterHandler class.
  *
- * @ingroup gui
- * @author Martin Steigemann, Wolfgang Bangerth, December 2010
+ * @note This class is used in the graphical user interface for the @ref ParameterHandler class.
+ *       It is not compiled into the deal.II libraries and can not be used by applications using deal.II.
+ *
+ * @ingroup ParameterGui
+ * @author Martin Steigemann, Wolfgang Bangerth, 2010
  */
-class MainWindow : public QMainWindow
-{
-  Q_OBJECT
+    class MainWindow : public QMainWindow
+    {
+      Q_OBJECT
 
-  public:
+      public:
                                     /**
                                      * Constructor.
-                                     * If a <tt>filename</tt> is given,
+                                     * If a @p filename is given,
                                      * the MainWindow tries to open
                                      * and parse the file.
                                      */
-    MainWindow(const QString  &filename = "");
+        MainWindow(const QString  &filename = "");
 
-  protected:
+      protected:
                                     /**
                                      * Reimplemented from QMainWindow.
                                      * We ask, if changes should be saved.
                                      */
-    void closeEvent(QCloseEvent *event);
+        void closeEvent(QCloseEvent *event);
 
-  private slots:
+      private slots:
 
                                     /**
                                      * Open a parameter file.
                                      */
-    void open();
+        void open();
                                     /**
                                      * Save the parameter file.
                                      */
-    bool save();
+        bool save();
                                     /**
                                      * Open a file dialog to save the parameter file.
                                      */
-    bool save_as();
+        bool save_as();
                                     /**
                                      * Show some information on the parameterGUI
                                      */
-    void about();
+        void about();
 
                                     /**
                                      * A <tt>slot</tt> that should be always called,
                                      * if parameter values were changed.
                                      */
-    void tree_was_modified();
+        void tree_was_modified();
 
-  private:
+      private:
                                     /**
                                      * Show an information dialog, how
                                      * parameters can be edited.
                                      */
-    void show_message ();
+        void show_message ();
                                     /**
                                      * This function creates all actions.
                                      */
-    void create_actions();
+        void create_actions();
                                     /**
                                      * This function creates all menus.
                                      */
-    void create_menus();
+        void create_menus();
                                     /**
                                      * This function checks, if parameters were changed
                                      * and show a dialog, if changes should be saved.
                                      * This function should be always called,
                                      * before open a new parameter file or before closing the GUI
                                      */
-    bool maybe_save ();
+        bool maybe_save ();
                                     /**
-                                     * Save parameters to <tt>filename</tt> in XML format.
+                                     * Save parameters to @p filename in XML format.
                                      */
-    bool save_file (const QString &filename);
+        bool save_file (const QString &filename);
                                     /**
-                                     * Load parameters from <tt>filename</tt> in XML format.
+                                     * Load parameters from @p filename in XML format.
                                      */
-    void load_file (const QString &filename);
+        void load_file (const QString &filename);
                                     /**
-                                     * This functions writes the current <tt>filename</tt> to the window title.
+                                     * This functions writes the current @p filename to the window title.
                                      */
-    void set_current_file (const QString  &filename);
+        void set_current_file (const QString  &filename);
                                     /**
                                      * This is the tree structure in which we store all parameters.
                                      */
-    QTreeWidget * tree_widget;
+        QTreeWidget * tree_widget;
                                     /**
                                      * This menu provides all file actions as <tt>open</tt>, <tt>save</tt>, <tt>save as</tt>
                                      * and <tt>exit</tt>
                                      */
-    QMenu * file_menu;
+        QMenu * file_menu;
                                     /**
                                      * This menu provides some informations <tt>about</tt> the parameterGUI
                                      * and <tt>about Qt</tt>
                                      */
-    QMenu * help_menu;
+        QMenu * help_menu;
                                     /**
                                      * QAction <tt>open</tt> a file.
                                      */
-    QAction * open_act;
+        QAction * open_act;
                                     /**
                                      * QAction <tt>save</tt> a file.
                                      */
-    QAction * save_act;
+        QAction * save_act;
                                     /**
                                      * QAction <tt>save as</tt> a file.
                                      */
-    QAction * save_as_act;
+        QAction * save_as_act;
                                     /**
                                      * QAction <tt>exit</tt> the GUI.
                                      */
-    QAction * exit_act;
+        QAction * exit_act;
                                     /**
                                      * QAction <tt>about</tt> the parameterGUI.
                                      */
-    QAction * about_act;
+        QAction * about_act;
                                     /**
                                      * QAction <tt>about</tt> Qt.
                                      */
-    QAction * about_qt_act;
+        QAction * about_qt_act;
                                     /**
                                      * This value stores the current <tt>filename</tt> we work on.
                                      */
-    QString  current_file;
+        QString  current_file;
                                     /**
                                      * This dialog shows a short information message after loading a file.
                                      */
-    InfoMessage * info_message;
+        InfoMessage * info_message;
                                     /**
                                      * An object for storing user settings.
                                      */
-    QSettings * gui_settings;
-};
+        QSettings * gui_settings;
+    };
+  }
+/**@}*/
+}
 
 
 #endif
index da28c2aa94a9985342c5cbc712baf7bf5e341241..ec7106f526957e275dfc255f8fc8bf41783012e3 100644 (file)
@@ -1,27 +1,43 @@
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #include <QtGui>
 
 #include "parameter_delegate.h"
 
+#include <limits>
 
-ParameterDelegate::ParameterDelegate(const int value_column, QObject *parent)
-                 : QItemDelegate(parent)
+
+namespace dealii
 {
-  this->value_column = value_column;
+  namespace ParameterGui
+  {
+    ParameterDelegate::ParameterDelegate(const int value_column, QObject *parent)
+                     : QItemDelegate(parent)
+    {
+      this->value_column = value_column;
 
-  double_steps    = 0.1;               // any click in the editor will increase or decrease the value about double_steps
-  double_decimals = 14;                        // number of decimals shown in the editor
+      double_steps    = 0.1;                   // any click in the editor will increase or decrease the value about double_steps
+      double_decimals = 14;                    // number of decimals shown in the editor
 
-  int_steps = 1;                       // step value for increasing or decrasing integers
-}
+      int_steps = 1;                           // step value for increasing or decrasing integers
+    }
 
 
 
-QSize ParameterDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
-{
-  if (index.column() == value_column)
+    QSize ParameterDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
     {
-      return QSize(400,30);            // we increase the height of all lines to show editors
+      if (index.column() == value_column)
+        {
+          return QSize(400,30);                // we increase the height of all lines to show editors
 
 /*
       QString pattern_description = index.data(Qt::StatusTipRole).toString();  // load pattern description
@@ -36,271 +52,273 @@ QSize ParameterDelegate::sizeHint(const QStyleOptionViewItem &option, const QMod
         return QItemDelegate::sizeHint(option, index);
 */
 
+        }
+      else
+        return QItemDelegate::sizeHint(option, index);
     }
-  else
-    return QItemDelegate::sizeHint(option, index);
-}
 
 
 
-void ParameterDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
-{
-  if (index.column() == value_column)
+    void ParameterDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
     {
-      QString pattern_description = index.data(Qt::StatusTipRole).toString();          // load pattern description
+      if (index.column() == value_column)
+        {
+          QString pattern_description = index.data(Qt::StatusTipRole).toString();      // load pattern description
                                                                                        // stored in the StatusLine
-      QRegExp  rx_string("\\b(FileName|DirectoryName)\\b");                            // if the type is Filename
+          QRegExp  rx_string("\\b(FileName|DirectoryName)\\b");                                // if the type is Filename
                                                                                        // or DirectoryName
-      if (rx_string.indexIn (pattern_description) != -1)
-        {
-          QString value = index.model()->data(index, Qt::DisplayRole).toString();      // take the value
+          if (rx_string.indexIn (pattern_description) != -1)
+            {
+              QString value = index.model()->data(index, Qt::DisplayRole).toString();  // take the value
 
-          QStyleOptionViewItem my_option = option;                                     // load options
-          my_option.displayAlignment = Qt::AlignLeft | Qt::AlignVCenter;
+              QStyleOptionViewItem my_option = option;                                 // load options
+              my_option.displayAlignment = Qt::AlignLeft | Qt::AlignVCenter;
 
-          drawDisplay(painter, my_option, my_option.rect, value);                      // print the text in the display
-          drawFocus(painter, my_option, my_option.rect);                               // if the line has the
+              drawDisplay(painter, my_option, my_option.rect, value);                  // print the text in the display
+              drawFocus(painter, my_option, my_option.rect);                           // if the line has the
                                                                                        // focus, print a rectangle
+            }
+          else
+            QItemDelegate::paint(painter, option, index);                              // for all other types use
+                                                                                       // the standard delegate
         }
       else
-        QItemDelegate::paint(painter, option, index);                                  // for all other types use
-                                                                                       // the standard delegate
+        QItemDelegate::paint(painter, option, index);
     }
-  else
-    QItemDelegate::paint(painter, option, index);
-}
 
 
 
-QWidget *ParameterDelegate::createEditor(QWidget *parent,
-                                         const QStyleOptionViewItem &option,
-                                         const QModelIndex &index) const
-{
-  if (index.column() == value_column)
+    QWidget *ParameterDelegate::createEditor(QWidget *parent,
+                                             const QStyleOptionViewItem &option,
+                                             const QModelIndex &index) const
     {
-      QString pattern_description = index.data(Qt::StatusTipRole).toString();  // load pattern description
-                                                                               // stored in the StatusLine
-      QRegExp  rx_string("\\b(Anything|MultipleSelection|List)\\b"),
-               rx_filename("\\b(FileName)\\b"),        
-               rx_dirname("\\b(DirectoryName)\\b"),    
-               rx_integer("\\b(Integer)\\b"),
-               rx_double("\\b(Double|Float|Floating)\\b"),
-               rx_selection("\\b(Selection)\\b"),
-               rx_bool("\\b(Bool)\\b");
-
-      if (rx_string.indexIn (pattern_description) != -1)               // if the type "Anything"
+      if (index.column() == value_column)
         {
-          QLineEdit * line_editor = new QLineEdit(parent);             // choose a LineEditor
+          QString pattern_description = index.data(Qt::StatusTipRole).toString();      // load pattern description
+                                                                                       // stored in the StatusLine
+          QRegExp  rx_string("\\b(Anything|MultipleSelection|List)\\b"),
+                   rx_filename("\\b(FileName)\\b"),    
+                   rx_dirname("\\b(DirectoryName)\\b"),        
+                   rx_integer("\\b(Integer)\\b"),
+                   rx_double("\\b(Double|Float|Floating)\\b"),
+                   rx_selection("\\b(Selection)\\b"),
+                   rx_bool("\\b(Bool)\\b");
+
+          if (rx_string.indexIn (pattern_description) != -1)                           // if the type is "Anything"
+            {
+              QLineEdit * line_editor = new QLineEdit(parent);                         // choose a LineEditor
 
-          connect(line_editor, SIGNAL(editingFinished()),              // connect editors signal 
-                  this, SLOT(commit_and_close_editor()));              // to the closer function
+              connect(line_editor, SIGNAL(editingFinished()),                          // and connect editors signal
+                      this, SLOT(commit_and_close_editor()));                          // to the closer function
 
-          return line_editor;
-        }
-      else if (rx_filename.indexIn (pattern_description) != -1)                // if the type "FileName"
-        {
-          BrowseLineEdit * filename_editor                             // choose a BrowseLineEditor
-                             = new BrowseLineEdit(BrowseLineEdit::file, parent);
+              return line_editor;
+            }
+          else if (rx_filename.indexIn (pattern_description) != -1)                    // if the type is "FileName"
+            {
+              BrowseLineEdit * filename_editor =                                       // choose a BrowseLineEditor
+                                 new BrowseLineEdit(BrowseLineEdit::file, parent);
 
-          connect(filename_editor, SIGNAL(editingFinished()),
-                  this, SLOT(commit_and_close_editor()));
+              connect(filename_editor, SIGNAL(editingFinished()),
+                      this, SLOT(commit_and_close_editor()));
 
-          return filename_editor;
-        }
-      else if (rx_dirname.indexIn (pattern_description) != -1)         // if the type "DirectoryName"
-        {
-          BrowseLineEdit * dirname_editor                              // choose a BrowseLineEditor
-                             = new BrowseLineEdit(BrowseLineEdit::directory, parent);
+              return filename_editor;
+            }
+          else if (rx_dirname.indexIn (pattern_description) != -1)                     // if the type is "DirectoryName"
+            {
+              BrowseLineEdit * dirname_editor =                                                // choose a BrowseLineEditor
+                                 new BrowseLineEdit(BrowseLineEdit::directory, parent);
 
-          connect(dirname_editor, SIGNAL(editingFinished()),
-                  this, SLOT(commit_and_close_editor()));
+              connect(dirname_editor, SIGNAL(editingFinished()),
+                      this, SLOT(commit_and_close_editor()));
 
-          return dirname_editor;
-        }
-      else if (rx_integer.indexIn (pattern_description) != -1)         // if the tpye is "Integer"
-        {
-          QSpinBox * spin_box = new QSpinBox(parent);                  // choose a spin box
+              return dirname_editor;
+            }
+          else if (rx_integer.indexIn (pattern_description) != -1)             // if the tpye is "Integer"
+            {
+              QSpinBox * spin_box = new QSpinBox(parent);                      // choose a spin box
 
-          const int min_int_value = std::numeric_limits<int>::min();
-          const int max_int_value = std::numeric_limits<int>::max();
+              const int min_int_value = std::numeric_limits<int>::min();
+              const int max_int_value = std::numeric_limits<int>::max();
 
-          spin_box->setMaximum(max_int_value);                         // set max and min from the limits.h class
-          spin_box->setMinimum(min_int_value);
-          spin_box->setSingleStep(int_steps);                          // and every klick is a SingleStep
+              spin_box->setMaximum(max_int_value);                             // set max and min from the limits.h class
+              spin_box->setMinimum(min_int_value);
+              spin_box->setSingleStep(int_steps);                              // and every klick is a SingleStep
 
-          connect(spin_box, SIGNAL(editingFinished()),                 // connect editors signal to the closer function
-                  this, SLOT(commit_and_close_editor()));
+              connect(spin_box, SIGNAL(editingFinished()),                     // connect editors signal to the closer function
+                      this, SLOT(commit_and_close_editor()));
 
-          return spin_box;
-        }
-      else if (rx_double.indexIn (pattern_description) != -1)          // the same with "Double"
-        {
-          QDoubleSpinBox * double_spin_box = new QDoubleSpinBox(parent);       // choose a spin box
+              return spin_box;
+            }
+          else if (rx_double.indexIn (pattern_description) != -1)              // the same with "Double"
+            {
+              QDoubleSpinBox * double_spin_box = new QDoubleSpinBox(parent);   // choose a spin box
 
-          const double min_double_value = -std::numeric_limits<double>::max();
-          const double max_double_value =  std::numeric_limits<double>::max();
+              const double min_double_value = -std::numeric_limits<double>::max();
+              const double max_double_value = std::numeric_limits<double>::max();
 
-          double_spin_box->setMaximum(max_double_value);               // set max and min from the limits.h class
-          double_spin_box->setMinimum(min_double_value);
-          double_spin_box->setDecimals(double_decimals);               // show "double_decimals" decimals
-          double_spin_box->setSingleStep(double_steps);                        // and every klick is a SingleStep
+              double_spin_box->setMaximum(max_double_value);           // set max and min from the limits.h class
+              double_spin_box->setMinimum(min_double_value);
+              double_spin_box->setDecimals(double_decimals);           // show "double_decimals" decimals
+              double_spin_box->setSingleStep(double_steps);            // and every klick is a SingleStep
 
-          connect(double_spin_box, SIGNAL(editingFinished()),          // connect editors signal to the closer function
-                  this, SLOT(commit_and_close_editor()));
+              connect(double_spin_box, SIGNAL(editingFinished()),              // connect editors signal to the closer function
+                      this, SLOT(commit_and_close_editor()));
 
-          return double_spin_box;
-        }
-      else if (rx_selection.indexIn (pattern_description) != -1)       // and selections
-        {
-          QComboBox * combo_box = new QComboBox(parent);               // we assume, that pattern_desctiption is of the form
-                                                                       // "Type: [Selection item1|item2| ....|item ]    "
-          std::vector<std::string> choices;                            // list with the different items
-          std::string  tmp(pattern_description.toStdString());
+              return double_spin_box;
+            }
+          else if (rx_selection.indexIn (pattern_description) != -1)           // and selections
+            {
+              QComboBox * combo_box = new QComboBox(parent);                   // we assume, that pattern_desctiption is of the form
+                                                                               // "Type: [Selection item1|item2| ....|item ]    "
+              std::vector<std::string> choices;                                        // list with the different items
+              std::string  tmp(pattern_description.toStdString());
 
-          if (tmp.find("[") != std::string::npos)                      // delete all char before [
-            tmp.erase (0, tmp.find("[")+1);
+              if (tmp.find("[") != std::string::npos)                          // delete all char before [
+                tmp.erase (0, tmp.find("[")+1);
 
-          if (tmp.find("]") != std::string::npos)                      // delete all char after ]
-            tmp.erase (tmp.find("]"),tmp.length());
+              if (tmp.find("]") != std::string::npos)                          // delete all char after ]
+                tmp.erase (tmp.find("]"),tmp.length());
 
-          if (tmp.find(" ") != std::string::npos)                      // delete all char before " "
-            tmp.erase (0, tmp.find(" ")+1);
+              if (tmp.find(" ") != std::string::npos)                          // delete all char before " "
+                tmp.erase (0, tmp.find(" ")+1);
 
-          while (tmp.find('|') != std::string::npos)                   // extract items
-            {
-              choices.push_back(std::string(tmp, 0, tmp.find('|')));
-              tmp.erase (0, tmp.find('|')+1);
-            };
+              while (tmp.find('|') != std::string::npos)                       // extract items
+                {
+                  choices.push_back(std::string(tmp, 0, tmp.find('|')));
+                  tmp.erase (0, tmp.find('|')+1);
+                };
 
-          if (tmp.find(" ") != std::string::npos)                      // delete " "
-            tmp.erase (tmp.find(" "));
+              if (tmp.find(" ") != std::string::npos)                          // delete " "
+                tmp.erase (tmp.find(" "));
 
-          choices.push_back(tmp);                                      // add last item
+              choices.push_back(tmp);                                          // add last item
 
-          for (unsigned int i=0; i<choices.size(); ++i)                        // add items to the combo box
-            combo_box->addItem (tr(choices[i].c_str()), tr(choices[i].c_str()));
+              for (unsigned int i=0; i<choices.size(); ++i)                    // add items to the combo box
+                combo_box->addItem (tr(choices[i].c_str()), tr(choices[i].c_str()));
 
-          combo_box->setEditable(false);
+              combo_box->setEditable(false);
 
-          connect(combo_box, SIGNAL(currentIndexChanged(int)),         // connect editors signal to the closer function
-                  this, SLOT(commit_and_close_editor()));
+              connect(combo_box, SIGNAL(currentIndexChanged(int)),             // connect editors signal to the closer function
+                      this, SLOT(commit_and_close_editor()));
 
-          return combo_box;
-        }
-      else if (rx_bool.indexIn (pattern_description) != -1)            // and booleans
-        {
-          QComboBox * combo_box = new QComboBox(parent);
+              return combo_box;
+           }
+          else if (rx_bool.indexIn (pattern_description) != -1)                        // and booleans
+            {
+              QComboBox * combo_box = new QComboBox(parent);
 
-          std::vector<std::string> choices;                            // list with the different items
-          choices.push_back(std::string("true"));                      // add true
-          choices.push_back(std::string("false"));                     // and false
+              std::vector<std::string> choices;                                        // list with the different items
+              choices.push_back(std::string("true"));                          // add true
+              choices.push_back(std::string("false"));                         // and false
 
-          for (unsigned int i=0; i<choices.size(); ++i)                        // add items to the combo box
-            combo_box->addItem (tr(choices[i].c_str()), tr(choices[i].c_str()));
+              for (unsigned int i=0; i<choices.size(); ++i)                    // add items to the combo box
+                combo_box->addItem (tr(choices[i].c_str()), tr(choices[i].c_str()));
 
-          combo_box->setEditable(false);
+              combo_box->setEditable(false);
 
-          connect(combo_box, SIGNAL(currentIndexChanged(int)),         // connect editors signal to the closer function
-                  this, SLOT(commit_and_close_editor()));
+              connect(combo_box, SIGNAL(currentIndexChanged(int)),             // connect editors signal to the closer function
+                      this, SLOT(commit_and_close_editor()));
 
-          return combo_box;
-        }
-      else
-        {
-          return QItemDelegate::createEditor(parent, option, index);
+              return combo_box;
+            }
+          else
+            {
+              return QItemDelegate::createEditor(parent, option, index);
+            };
         };
-    };
 
-  return 0;                    // if it is not the column "parameter values", do nothing
-}
+      return 0;                                // if it is not the column "parameter values", do nothing
+    }
 
 
 
-void ParameterDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
-{
-  if (index.column() == value_column)
+    void ParameterDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
     {
-      QString pattern_description = index.data(Qt::StatusTipRole).toString();          // load pattern description
+      if (index.column() == value_column)
+        {
+          QString pattern_description = index.data(Qt::StatusTipRole).toString();      // load pattern description
                                                                                        // stored in the StatusLine
-      QRegExp  rx_filename("\\b(FileName)\\b"),
-               rx_dirname("\\b(DirectoryName)\\b"),
-               rx_selection("\\b(Selection)\\b");
+          QRegExp  rx_filename("\\b(FileName)\\b"),
+                   rx_dirname("\\b(DirectoryName)\\b"),
+                   rx_selection("\\b(Selection)\\b");
 
-      if (rx_filename.indexIn (pattern_description) != -1)                             // if the type is "FileName"
-        {
-          QString  file_name = index.data(Qt::DisplayRole).toString();
+          if (rx_filename.indexIn (pattern_description) != -1)                         // if the type is "FileName"
+            {
+              QString  file_name = index.data(Qt::DisplayRole).toString();
 
-          BrowseLineEdit *filename_editor = qobject_cast<BrowseLineEdit *>(editor);    // set the text of the editor
-          filename_editor->setText(file_name);
-        }
-      else if (rx_dirname.indexIn (pattern_description) != -1)                         // if the type is "DirectoryName"
-        {
-          QString  dir_name = index.data(Qt::DisplayRole).toString();
+              BrowseLineEdit *filename_editor = qobject_cast<BrowseLineEdit *>(editor);        // set the text of the editor
+              filename_editor->setText(file_name);
+            }
+          else if (rx_dirname.indexIn (pattern_description) != -1)                     // if the type is "DirectoryName"
+            {
+              QString  dir_name = index.data(Qt::DisplayRole).toString();
 
-          BrowseLineEdit *dirname_editor = qobject_cast<BrowseLineEdit *>(editor);     // set the text of the editor
-          dirname_editor->setText(dir_name);
-        }
-      else if (rx_selection.indexIn (pattern_description) != -1)                       // if we have a combo box,
-        {
-          QRegExp  rx(index.data(Qt::DisplayRole).toString());
+              BrowseLineEdit *dirname_editor = qobject_cast<BrowseLineEdit *>(editor); // set the text of the editor
+              dirname_editor->setText(dir_name);
+            }
+          else if (rx_selection.indexIn (pattern_description) != -1)                   // if we have a combo box,
+            {
+              QRegExp  rx(index.data(Qt::DisplayRole).toString());
 
-          QComboBox * combo_box = qobject_cast<QComboBox *>(editor);
+              QComboBox * combo_box = qobject_cast<QComboBox *>(editor);
 
-          for (int i=0; i<combo_box->count(); ++i)             // we look, which index
-            if (rx.exactMatch(combo_box->itemText(i)))                 // the data has and set
-              combo_box->setCurrentIndex(i);                           // it to the combo_box
-        }
-      else
-        QItemDelegate::setEditorData(editor, index);                   // if it is not FileName,
-                                                                       // DirectoryName or Selection
-                                                                       // use the standard delegate
-    };
-}
+              for (int i=0; i<combo_box->count(); ++i)                                 // we look, which index
+                if (rx.exactMatch(combo_box->itemText(i)))                             // the data has and set
+                  combo_box->setCurrentIndex(i);                                       // it to the combo_box
+            }
+          else
+            QItemDelegate::setEditorData(editor, index);                               // if it is not FileName,
+                                                                                       // DirectoryName or Selection
+                                                                                       // use the standard delegate
+        };
+    }
 
 
 
-void ParameterDelegate::commit_and_close_editor()
-{
-  QWidget * editor = qobject_cast<QWidget *>(sender());
-  emit commitData(editor);
-  emit closeEditor(editor);
-}
+    void ParameterDelegate::commit_and_close_editor()
+    {
+      QWidget * editor = qobject_cast<QWidget *>(sender());
+      emit commitData(editor);
+      emit closeEditor(editor);
+    }
 
 
 
-void ParameterDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
-                                     const QModelIndex &index) const
-{
-  if (index.column() == value_column)
+    void ParameterDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
+                                         const QModelIndex &index) const
     {
-      QString pattern_description = index.data(Qt::StatusTipRole).toString();          // load pattern description
+      if (index.column() == value_column)
+        {
+          QString pattern_description = index.data(Qt::StatusTipRole).toString();      // load pattern description
                                                                                        // stored in the StatusLine
 
-      QRegExp  rx_filename("\\b(FileName)\\b"),
-               rx_dirname("\\b(DirectoryName)\\b"),
-               rx_selection("\\b(Selection)\\b");
+          QRegExp  rx_filename("\\b(FileName)\\b"),
+                   rx_dirname("\\b(DirectoryName)\\b"),
+                   rx_selection("\\b(Selection)\\b");
 
-      if (rx_filename.indexIn (pattern_description) != -1)                             // if the type is "FileName"
-        {
-          BrowseLineEdit * filename_editor = qobject_cast<BrowseLineEdit *>(editor);   // set the text from the editor
-          QString value = filename_editor->text();
-          model->setData(index, value);
-        }
-      else if (rx_dirname.indexIn (pattern_description) != -1)                         // if the type is "DirectoryName"
-        {
-          BrowseLineEdit * dirname_editor = qobject_cast<BrowseLineEdit *>(editor);    // set the text from the editor
-          QString value = dirname_editor->text();
-          model->setData(index, value);
-        }
-      else if (rx_selection.indexIn (pattern_description) != -1)                       // if the type is "Selection"
-        {
-          QComboBox * combo_box = qobject_cast<QComboBox *>(editor);                   // set the text from the editor
-          QString value = combo_box->currentText();
-          model->setData(index, value);
-        }
-      else
-        QItemDelegate::setModelData(editor, model, index);                             // if it is not FileName or DirectoryName,
+          if (rx_filename.indexIn (pattern_description) != -1)                         // if the type is "FileName"
+            {
+              BrowseLineEdit * filename_editor = qobject_cast<BrowseLineEdit *>(editor);       // set the text from the editor
+              QString value = filename_editor->text();
+              model->setData(index, value);
+            }
+          else if (rx_dirname.indexIn (pattern_description) != -1)                     // if the type is "DirectoryName"
+            {
+              BrowseLineEdit * dirname_editor = qobject_cast<BrowseLineEdit *>(editor);        // set the text from the editor
+              QString value = dirname_editor->text();
+              model->setData(index, value);
+            }
+          else if (rx_selection.indexIn (pattern_description) != -1)                   // if the type is "Selection"
+            {
+              QComboBox * combo_box = qobject_cast<QComboBox *>(editor);               // set the text from the editor
+              QString value = combo_box->currentText();
+              model->setData(index, value);
+            }
+          else
+            QItemDelegate::setModelData(editor, model, index);                         // if it is not FileName or DirectoryName,
                                                                                        // use the standard delegate
-    };
+        };
+    }
+  }
 }
 
index 654dca4e8263dc30d763c67e0fa8d8e0e51bede5..a4bcb2b98f14dacd35c7fa6c6aa795db2cf7d156 100644 (file)
@@ -1,3 +1,13 @@
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #ifndef PARAMETERDELEGATE_H
 #define PARAMETERDELEGATE_H
 #include <QComboBox>
 #include <QFileDialog>
 
-#include <limits>
-#include <algorithm>
-
 #include "browse_lineedit.h"
 
 
+namespace dealii
+{
+/*! @addtogroup ParameterGui
+ *@{
+ */
+  namespace ParameterGui
+  {
 /**
  * The ParameterDelegate class implements special delegates for the QTreeWidget class used in the parameterGUI.
  * The QTreeWidget class provides some different standard delegates for editing parameters shown in the
  * tree structure. The ParameterDelegate class provides special editors for the different types of parameters defined in
- * the ParameterHandler class. For all parameter types based on strings as "Anything", "MultipleSelection" and
- * "List" a simple line editor will be shown up. In the case of integer and double type parameters the editor is a spin box and for
- * "Selection" type parameters a combo box will be shown up. For parameters of type "FileName" and "DirectoryName"
+ * the ParameterHandler class. For all parameter types based on strings as &quot;Anything&quot;, &quot;MultipleSelection&quot; and
+ * &quot;List&quot; a simple line editor will be shown up. In the case of integer and double type parameters the editor is a spin box and for
+ * &quot;Selection&quot; type parameters a combo box will be shown up. For parameters of type &quot;FileName&quot; and &quot;DirectoryName&quot;
  * the delegate shows a @ref BrowseLineEdit editor. The column of the tree structure with the parameter values has to be set
  * in the constructor.
  *
- * @ingroup gui
- * @author Martin Steigemann, Wolfgang Bangerth, December 2010
+ * @note This class is used in the graphical user interface for the @ref ParameterHandler class.
+ *       It is not compiled into the deal.II libraries and can not be used by applications using deal.II.
+ *
+ * @ingroup ParameterGui
+ * @author Martin Steigemann, Wolfgang Bangerth, 2010
  */
-class ParameterDelegate : public QItemDelegate
-{
-  Q_OBJECT
+    class ParameterDelegate : public QItemDelegate
+    {
+      Q_OBJECT
 
-  public:
+      public:
                                     /**
-                                     * Constructor, the <tt>value_column</tt> specifies the column
+                                     * Constructor, @p value_column specifies the column
                                      * of the parameter tree this delegate will be used on.
                                      */
-    ParameterDelegate (const int value_column, QObject *parent = 0);
+        ParameterDelegate (const int value_column, QObject *parent = 0);
                                     /**
                                      * This function creates the appropriate editor for the parameter
                                      * based on the <tt>index</tt>.
                                      */
-    QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option,
-                           const QModelIndex &index) const;
+        QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option,
+                               const QModelIndex &index) const;
                                     /**
                                      * Reimplemented from QItemDelegate.
                                      */
-    QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+        QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
                                     /**
                                      * Reimplemented from QItemDelegate.
                                      */
-    void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+        void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
                                     /**
                                      * Reimplemented from QItemDelegate.
                                      */
-    void setEditorData(QWidget *editor, const QModelIndex &index) const;
+        void setEditorData(QWidget *editor, const QModelIndex &index) const;
                                     /**
                                      * Reimplemented from QItemDelegate.
                                      */
-    void setModelData(QWidget *editor, QAbstractItemModel *model,
-                      const QModelIndex &index) const;
+        void setModelData(QWidget *editor, QAbstractItemModel *model,
+                          const QModelIndex &index) const;
 
-  private slots:
+      private slots:
                                     /**
                                      * Reimplemented from QItemDelegate.
                                      */
-    void commit_and_close_editor();
+        void commit_and_close_editor();
 
-  private:
+      private:
                                     /**
                                      * The column this delegate will be used on.
                                      */
-    int value_column;
+        int value_column;
                                     /**
                                      * For parameters of type <tt>double</tt> a spin box
                                      * will be shown as editor. Any click on the spin box
                                      * will change the value about <tt>double_steps</tt>.
                                      */
-    double  double_steps;
+        double  double_steps;
                                     /**
                                      * For parameters of type <tt>integer</tt> a spin box
                                      * will be shown as editor. Any click on the spin box
                                      * will change the value about <tt>int_steps</tt>.
                                      */
-    unsigned int  int_steps;
+        unsigned int  int_steps;
                                     /**
                                      * For parameters of type <tt>double</tt> a spin box
                                      * will be shown as editor. The spin box will show
                                      * parameters with a precision of <tt>double_decimals</tt>.
                                      */
-    unsigned int  double_decimals;
-};
+        unsigned int  double_decimals;
+    };
+  }
+/**@}*/
+}
+
 
 #endif
index fa4ff1c22402aca115bac573241ee56b5c853057..bdf3b3d02a425a3468f62ad6fc8750989fc4254b 100644 (file)
@@ -1,502 +1,2 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ParameterHandler>
-    <BasicControl>
-        <Equation>
-            <value>Elasticity</value>
-            <default_value>Elasticity</default_value>
-            <documentation>Basic equation to solve</documentation>
-            <pattern>0</pattern>
-            <pattern_description>[Anything]</pattern_description>
-        </Equation>
-        <Domain>
-            <value>CtsSpecimen</value>
-            <default_value>Specimen</default_value>
-            <documentation>Domain</documentation>
-            <pattern>1</pattern>
-            <pattern_description>[Selection CtSpecimen|CtsSpecimen|SENBeam ]</pattern_description>
-        </Domain>
-        <AsymptoticOrder>
-            <value>2</value>
-            <default_value>2</default_value>
-            <documentation>Use this number of terms in asymptotic decompositions</documentation>
-            <pattern>2</pattern>
-            <pattern_description>[Selection 2|3|5 ]</pattern_description>
-        </AsymptoticOrder>
-        <OutputGrids>
-            <value>false</value>
-            <default_value>false</default_value>
-            <documentation>Output grids in eps format</documentation>
-            <pattern>3</pattern>
-            <pattern_description>[Selection true|false ]</pattern_description>
-        </OutputGrids>
-    </BasicControl>
-    <MaterialProperties>
-        <Material>
-            <value>AluminiumAlloy7075T651</value>
-            <default_value>AluminiumAlloy7075T651</default_value>
-            <documentation>Description of the material: MaterialName|ReadMaterial</documentation>
-            <pattern>4</pattern>
-            <pattern_description>[Selection AluminiumAlloy7075T651|PlexiGlas|SuperAlloyPWA14801493|SihParisIrwinMaterialOne|SihParisIrwinMaterialTwo|CorticalBone|Beton|TestMaterial|ReadMaterial ]</pattern_description>
-        </Material>
-        <MaterialType>
-            <value>Homogeneous</value>
-            <default_value>Homogeneous</default_value>
-            <documentation>Type of material: Homogeneous|Composite|FGM</documentation>
-            <pattern>5</pattern>
-            <pattern_description>[Selection Homogeneous|Composite|FGM ]</pattern_description>
-        </MaterialType>
-        <MaterialAngle>
-            <value>0</value>
-            <default_value>0.</default_value>
-            <documentation>Material angle with respect to the basic coordinate system</documentation>
-            <pattern>6</pattern>
-            <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-        </MaterialAngle>
-        <PlaneState>
-            <value>plane_strain</value>
-            <default_value>plain_strain</default_value>
-            <documentation>Plane state: plane_strain|plane_stress</documentation>
-            <pattern>7</pattern>
-            <pattern_description>[Selection plane_strain|plain_stress ]</pattern_description>
-        </PlaneState>
-        <ScaleElasticModuli>
-            <value>false</value>
-            <default_value>false</default_value>
-            <documentation>Scale elastic moduli to a11 = 1 and a22 = 1</documentation>
-            <pattern>8</pattern>
-            <pattern_description>[Selection true|false ]</pattern_description>
-        </ScaleElasticModuli>
-        <ReadMaterial>
-            <Description>
-                <value>TestMaterialProperties</value>
-                <default_value>ReadedMaterialProperties</default_value>
-                <documentation>Description of ReadMaterial</documentation>
-                <pattern>9</pattern>
-                <pattern_description>[Anything]</pattern_description>
-            </Description>
-            <a11>
-                <value>108752.2388</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>10</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </a11>
-            <a21>
-                <value>56023.8806</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>11</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </a21>
-            <a22>
-                <value>108752.2388</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>12</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </a22>
-            <a31>
-                <value>0</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>13</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </a31>
-            <a32>
-                <value>0</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>14</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </a32>
-            <a33>
-                <value>26364.1791</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>15</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </a33>
-        </ReadMaterial>
-        <InhomogeneousMaterialProperties>
-            <MaterialTwo>
-                <value>AluminiumAlloy7075T651</value>
-                <default_value>AluminiumAlloy7075T651</default_value>
-                <documentation>Description of the material: MaterialName|ReadMaterial</documentation>
-                <pattern>16</pattern>
-                <pattern_description>[Selection AluminiumAlloy7075T651|PlexiGlas|SuperAlloyPWA14801493|SihParisIrwinMaterialOne|SihParisIrwinMaterialTwo|CorticalBone|Beton|TestMaterial|ReadMaterial ]</pattern_description>
-            </MaterialTwo>
-            <b11>
-                <value>108752.2388</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>17</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </b11>
-            <b21>
-                <value>56023.8806</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>18</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </b21>
-            <b22>
-                <value>108752.2388</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>19</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </b22>
-            <b31>
-                <value>0</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>20</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </b31>
-            <b32>
-                <value>0</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>21</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </b32>
-            <b33>
-                <value>26364.1791</value>
-                <default_value>1.</default_value>
-                <documentation>Elastic constant</documentation>
-                <pattern>22</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </b33>
-            <beta>
-                <value>0</value>
-                <default_value>0.</default_value>
-                <documentation>Material angle with respect to the basic coordinate system</documentation>
-                <pattern>23</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </beta>
-            <delta>
-                <value>0.5</value>
-                <default_value>0.</default_value>
-                <documentation>Perturbation parameter</documentation>
-                <pattern>24</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </delta>
-        </InhomogeneousMaterialProperties>
-    </MaterialProperties>
-    <Forces>
-        <F>
-            <value>10000</value>
-            <default_value>4500</default_value>
-            <documentation>Applied force value in Newton</documentation>
-            <pattern>25</pattern>
-            <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-        </F>
-        <angle>
-            <value>0</value>
-            <default_value>0</default_value>
-            <documentation>If the specimen allows different forces, this parameter can be used to control them</documentation>
-            <pattern>26</pattern>
-            <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-        </angle>
-    </Forces>
-    <FractureCriteria>
-        <Criterion>
-            <value>da/dN-curve</value>
-            <default_value>da/dN-curve</default_value>
-            <documentation></documentation>
-            <pattern>27</pattern>
-            <pattern_description>[Selection da/dN-curve|Paris-law|Forman-Mettu-equation ]</pattern_description>
-        </Criterion>
-        <da_2fdN_2dcurve>
-            <K1Th>
-                <value>104.25</value>
-                <default_value>100</default_value>
-                <documentation></documentation>
-                <pattern>28</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </K1Th>
-            <K1C>
-                <value>972</value>
-                <default_value>1000</default_value>
-                <documentation></documentation>
-                <pattern>29</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </K1C>
-            <R>
-                <value>0.1</value>
-                <default_value>0.1</default_value>
-                <documentation></documentation>
-                <pattern>30</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </R>
-            <alpha>
-                <value>3</value>
-                <default_value>1</default_value>
-                <documentation></documentation>
-                <pattern>31</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </alpha>
-        </da_2fdN_2dcurve>
-        <Paris_2dlaw>
-            <C>
-                <value>2.12e-11</value>
-                <default_value>1</default_value>
-                <documentation></documentation>
-                <pattern>32</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </C>
-            <m>
-                <value>2.1</value>
-                <default_value>1</default_value>
-                <documentation></documentation>
-                <pattern>33</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </m>
-        </Paris_2dlaw>
-        <Forman_2dMettu_2dequation>
-            <C>
-                <value>2.12e-11</value>
-                <default_value>1</default_value>
-                <documentation></documentation>
-                <pattern>34</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </C>
-            <n>
-                <value>2.885</value>
-                <default_value>1</default_value>
-                <documentation></documentation>
-                <pattern>35</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </n>
-            <p>
-                <value>0.5</value>
-                <default_value>1</default_value>
-                <documentation></documentation>
-                <pattern>36</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </p>
-            <q>
-                <value>1</value>
-                <default_value>1</default_value>
-                <documentation></documentation>
-                <pattern>37</pattern>
-                <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-            </q>
-        </Forman_2dMettu_2dequation>
-    </FractureCriteria>
-    <MeshRefinement>
-        <MeshSize>
-            <value>2</value>
-            <default_value>1.</default_value>
-            <documentation></documentation>
-            <pattern>38</pattern>
-            <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-        </MeshSize>
-        <RefinementCycles>
-            <value>1</value>
-            <default_value>2</default_value>
-            <documentation></documentation>
-            <pattern>39</pattern>
-            <pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description>
-        </RefinementCycles>
-        <KinkLength>
-            <value>0.5</value>
-            <default_value>1</default_value>
-            <documentation></documentation>
-            <pattern>40</pattern>
-            <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-        </KinkLength>
-        <SupportDiameter>
-            <value>0.25</value>
-            <default_value>0.25</default_value>
-            <documentation></documentation>
-            <pattern>41</pattern>
-            <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-        </SupportDiameter>
-    </MeshRefinement>
-    <MatrixM>
-        <RadiusR>
-            <value>250</value>
-            <default_value>100</default_value>
-            <documentation></documentation>
-            <pattern>42</pattern>
-            <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-        </RadiusR>
-        <KinkAngleMax>
-            <value>110</value>
-            <default_value>110.</default_value>
-            <documentation></documentation>
-            <pattern>43</pattern>
-            <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-        </KinkAngleMax>
-        <KinkAngleMin>
-            <value>-110</value>
-            <default_value>-110.</default_value>
-            <documentation></documentation>
-            <pattern>44</pattern>
-            <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-        </KinkAngleMin>
-        <MaterialAngleMax>
-            <value>180</value>
-            <default_value>180.</default_value>
-            <documentation></documentation>
-            <pattern>45</pattern>
-            <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-        </MaterialAngleMax>
-        <MaterialAngleMin>
-            <value>-180</value>
-            <default_value>-180.</default_value>
-            <documentation></documentation>
-            <pattern>46</pattern>
-            <pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description>
-        </MaterialAngleMin>
-        <StepsKinkAngle>
-            <value>22</value>
-            <default_value>22</default_value>
-            <documentation></documentation>
-            <pattern>47</pattern>
-            <pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description>
-        </StepsKinkAngle>
-        <StepsMaterialAngle>
-            <value>36</value>
-            <default_value>36</default_value>
-            <documentation></documentation>
-            <pattern>48</pattern>
-            <pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description>
-        </StepsMaterialAngle>
-        <ComputeMatrixM>
-            <value>false</value>
-            <default_value>false</default_value>
-            <documentation></documentation>
-            <pattern>49</pattern>
-            <pattern_description>[Selection true|false ]</pattern_description>
-        </ComputeMatrixM>
-        <OutputMatrixM>
-            <value>false</value>
-            <default_value>false</default_value>
-            <documentation></documentation>
-            <pattern>50</pattern>
-            <pattern_description>[Selection true|false ]</pattern_description>
-        </OutputMatrixM>
-        <FEDegree>
-            <value>1</value>
-            <default_value>1</default_value>
-            <documentation></documentation>
-            <pattern>51</pattern>
-            <pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description>
-        </FEDegree>
-        <MaxRefCycles>
-            <value>25</value>
-            <default_value>10</default_value>
-            <documentation></documentation>
-            <pattern>52</pattern>
-            <pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description>
-        </MaxRefCycles>
-        <MultiGrid>
-            <value>true</value>
-            <default_value>true</default_value>
-            <documentation></documentation>
-            <pattern>53</pattern>
-            <pattern_description>[Selection true|false ]</pattern_description>
-        </MultiGrid>
-        <OutputGrids>
-            <value>false</value>
-            <default_value>false</default_value>
-            <documentation></documentation>
-            <pattern>54</pattern>
-            <pattern_description>[Selection true|false ]</pattern_description>
-        </OutputGrids>
-    </MatrixM>
-    <RungeKuttaMethod>
-        <k>
-            <value>250000</value>
-            <default_value>10000</default_value>
-            <documentation></documentation>
-            <pattern>55</pattern>
-            <pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description>
-        </k>
-    </RungeKuttaMethod>
-    <Input>
-        <Files>
-            <Mesh_5fdata_5ffile>
-                <value>/home/masteige/projects/mcrack2d/projects/test/meshes/mesh.ucd</value>
-                <default_value>/home/masteige/mcrack2d/projects/mesh.ucd</default_value>
-                <documentation></documentation>
-                <pattern>56</pattern>
-                <pattern_description>[FileName (Type: input)]</pattern_description>
-            </Mesh_5fdata_5ffile>
-            <Crack_5fpath_5fdata_5ffile>
-                <value>/home/masteige/projects/mcrack2d/projects/test/crack_path.data</value>
-                <default_value>/home/masteige/mcrack2d/projects/crack_path.data</default_value>
-                <documentation></documentation>
-                <pattern>57</pattern>
-                <pattern_description>[FileName (Type: input)]</pattern_description>
-            </Crack_5fpath_5fdata_5ffile>
-            <Matrix_5fM_5fdata_5ffile>
-                <value>/home/masteige/projects/mcrack2d/projects/test/matrix_M.data</value>
-                <default_value>/home/masteige/mcrack2d/projects/Matrix_M.data</default_value>
-                <documentation></documentation>
-                <pattern>58</pattern>
-                <pattern_description>[FileName (Type: input)]</pattern_description>
-            </Matrix_5fM_5fdata_5ffile>
-            <da_5fdN_5fcurve_5fdata_5ffile>
-                <value>/home/masteige/projects/mcrack2d/projects/test/da_dN_curve.data</value>
-                <default_value>/home/masteige/mcrack2d/projects/da_dN_curve.data</default_value>
-                <documentation></documentation>
-                <pattern>59</pattern>
-                <pattern_description>[FileName (Type: input)]</pattern_description>
-            </da_5fdN_5fcurve_5fdata_5ffile>
-            <Results_5ffile>
-                <value>/home/masteige/projects/mcrack2d/projects/test/results.data</value>
-                <default_value>/home/masteige/mcrack2d/projects/results.data</default_value>
-                <documentation></documentation>
-                <pattern>60</pattern>
-                <pattern_description>[FileName (Type: input)]</pattern_description>
-            </Results_5ffile>
-            <Python_5finput_5ffile>
-                <value>/home/masteige/projects/mcrack2d/scripts/extract_mesh.py</value>
-                <default_value>/home/masteige/mcrack2d/scripts/extract_mesh.py</default_value>
-                <documentation></documentation>
-                <pattern>61</pattern>
-                <pattern_description>[FileName (Type: input)]</pattern_description>
-            </Python_5finput_5ffile>
-        </Files>
-        <Directories>
-            <Material_5fdir>
-                <value>/home/masteige/projects/mcrack2d/material/</value>
-                <default_value>/home/masteige/mcrack2d/materials</default_value>
-                <documentation></documentation>
-                <pattern>62</pattern>
-                <pattern_description>[DirectoryName]</pattern_description>
-            </Material_5fdir>
-            <Project_5fdir>
-                <value>/home/masteige/projects/mcrack2d/projects/test/</value>
-                <default_value>/home/masteige/mcrack2d/projects</default_value>
-                <documentation></documentation>
-                <pattern>63</pattern>
-                <pattern_description>[DirectoryName]</pattern_description>
-            </Project_5fdir>
-            <Graphics_5fdir>
-                <value>/home/masteige/projects/mcrack2d/projects/test/graphics/</value>
-                <default_value>/home/masteige/mcrack2d/projects/graphics</default_value>
-                <documentation></documentation>
-                <pattern>64</pattern>
-                <pattern_description>[DirectoryName]</pattern_description>
-            </Graphics_5fdir>
-            <Meshes_5fdir>
-                <value>/home/masteige/projects/mcrack2d/projects/test/meshes/</value>
-                <default_value>/home/masteige/mcrack2d/projects/meshes</default_value>
-                <documentation></documentation>
-                <pattern>65</pattern>
-                <pattern_description>[DirectoryName]</pattern_description>
-            </Meshes_5fdir>
-            <Results_5fdir>
-                <value>/home/masteige/projects/mcrack2d/projects/test/results/</value>
-                <default_value>/home/masteige/mcrack2d/projects/results</default_value>
-                <documentation></documentation>
-                <pattern>66</pattern>
-                <pattern_description>[DirectoryName]</pattern_description>
-            </Results_5fdir>
-        </Directories>
-    </Input>
-</ParameterHandler>
+<?xml version="1.0" encoding="utf-8"?>
+<ParameterHandler><BasicControl><Equation><value>Elasticity</value><default_value>Elasticity</default_value><documentation>Basic equation to solve</documentation><pattern>0</pattern><pattern_description>[Anything]</pattern_description></Equation><Domain><value>CtsSpecimen</value><default_value>Specimen</default_value><documentation>Domain</documentation><pattern>1</pattern><pattern_description>[Selection CtSpecimen|CtsSpecimen|SENBeam ]</pattern_description></Domain><AsymptoticOrder><value>5</value><default_value>2</default_value><documentation>Use this number of terms in asymptotic decompositions</documentation><pattern>2</pattern><pattern_description>[Selection 2|3|5 ]</pattern_description></AsymptoticOrder><OutputGrids><value>false</value><default_value>false</default_value><documentation>Output grids in eps format</documentation><pattern>3</pattern><pattern_description>[Bool]</pattern_description></OutputGrids><OutputSolutions><value>false</value><default_value>false</default_value><documentation>Output solutions in vtk format</documentation><pattern>4</pattern><pattern_description>[Bool]</pattern_description></OutputSolutions><OutputCrackPath><value>false</value><default_value>true</default_value><documentation>Output crack path data</documentation><pattern>5</pattern><pattern_description>[Bool]</pattern_description></OutputCrackPath><OutputFlatQuads><value>false</value><default_value>false</default_value><documentation>Output detailed flat quad data</documentation><pattern>6</pattern><pattern_description>[Bool]</pattern_description></OutputFlatQuads></BasicControl><MaterialProperties><Material><value>AluminiumAlloy7075T651</value><default_value>AluminiumAlloy7075T651</default_value><documentation>Description of the material: MaterialName|ReadMaterial</documentation><pattern>7</pattern><pattern_description>[Selection AluminiumAlloy7075T651|PlexiGlas|SuperAlloyPWA14801493|SihParisIrwinMaterialOne|SihParisIrwinMaterialTwo|CorticalBone|Beton|TestMaterial|ReadMaterial ]</pattern_description></Material><MaterialType><value>Homogeneous</value><default_value>Homogeneous</default_value><documentation>Type of material: Homogeneous|Composite|FGM</documentation><pattern>8</pattern><pattern_description>[Selection Homogeneous|Composite|FGM ]</pattern_description></MaterialType><MaterialAngle><value>0.</value><default_value>0.</default_value><documentation>Material angle with respect to the basic coordinate system</documentation><pattern>9</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></MaterialAngle><PlaneState><value>plane_strain</value><default_value>plain_strain</default_value><documentation>Plane state: plane_strain|plane_stress</documentation><pattern>10</pattern><pattern_description>[Selection plane_strain|plain_stress ]</pattern_description></PlaneState><ScaleElasticModuli><value>false</value><default_value>false</default_value><documentation>Scale elastic moduli to a11 = 1 and a22 = 1</documentation><pattern>11</pattern><pattern_description>[Bool]</pattern_description></ScaleElasticModuli><ReadMaterial><Description><value>TestMaterialProperties</value><default_value>ReadedMaterialProperties</default_value><documentation>Description of ReadMaterial</documentation><pattern>12</pattern><pattern_description>[Anything]</pattern_description></Description><a11><value>108752.2388</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>13</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></a11><a21><value>56023.8806</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>14</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></a21><a22><value>108752.2388</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>15</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></a22><a31><value>0.</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>16</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></a31><a32><value>0.</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>17</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></a32><a33><value>26364.1791</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>18</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></a33></ReadMaterial><InhomogeneousMaterialProperties><MaterialTwo><value>AluminiumAlloy7075T651</value><default_value>AluminiumAlloy7075T651</default_value><documentation>Description of the material: MaterialName|ReadMaterial</documentation><pattern>19</pattern><pattern_description>[Selection AluminiumAlloy7075T651|PlexiGlas|SuperAlloyPWA14801493|SihParisIrwinMaterialOne|SihParisIrwinMaterialTwo|CorticalBone|Beton|TestMaterial|ReadMaterial ]</pattern_description></MaterialTwo><b11><value>108752.2388</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>20</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></b11><b21><value>56023.8806</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>21</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></b21><b22><value>108752.2388</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>22</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></b22><b31><value>0.</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>23</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></b31><b32><value>0.</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>24</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></b32><b33><value>26364.1791</value><default_value>1.</default_value><documentation>Elastic constant</documentation><pattern>25</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></b33><beta><value>0.</value><default_value>0.</default_value><documentation>Material angle with respect to the basic coordinate system</documentation><pattern>26</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></beta><delta><value>0.5</value><default_value>0.</default_value><documentation>Perturbation parameter</documentation><pattern>27</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></delta></InhomogeneousMaterialProperties></MaterialProperties><Forces><F><value>10000</value><default_value>4500</default_value><documentation>Applied force value in Newton</documentation><pattern>28</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></F><angle><value>0.</value><default_value>0</default_value><documentation>If the specimen allows different forces, this parameter can be used to control them</documentation><pattern>29</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></angle></Forces><FractureCriteria><Criterion><value>da/dN-curve</value><default_value>da/dN-curve</default_value><documentation/><pattern>30</pattern><pattern_description>[Selection da/dN-curve|Paris-law|Forman-Mettu-equation ]</pattern_description></Criterion><da_2fdN_2dcurve><K1Th><value>104.25</value><default_value>100</default_value><documentation/><pattern>31</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></K1Th><K1C><value>972.</value><default_value>1000</default_value><documentation/><pattern>32</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></K1C><R><value>0.1</value><default_value>0.1</default_value><documentation/><pattern>33</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></R><alpha><value>3.</value><default_value>1</default_value><documentation/><pattern>34</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></alpha></da_2fdN_2dcurve><Paris_2dlaw><C><value>0.0000000000212</value><default_value>1</default_value><documentation/><pattern>35</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></C><m><value>2.1</value><default_value>1</default_value><documentation/><pattern>36</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></m></Paris_2dlaw><Forman_2dMettu_2dequation><C><value>0.0000000000212</value><default_value>1</default_value><documentation/><pattern>37</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></C><n><value>2.885</value><default_value>1</default_value><documentation/><pattern>38</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></n><p><value>0.5</value><default_value>1</default_value><documentation/><pattern>39</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></p><q><value>1.0</value><default_value>1</default_value><documentation/><pattern>40</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></q></Forman_2dMettu_2dequation></FractureCriteria><MeshRefinement><MeshSize><value>2</value><default_value>1.</default_value><documentation/><pattern>41</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></MeshSize><RefinementCycles><value>1</value><default_value>2</default_value><documentation/><pattern>42</pattern><pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description></RefinementCycles><KinkLength><value>0.5</value><default_value>1</default_value><documentation/><pattern>43</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></KinkLength><InnerSupportDiameter><value>0.25</value><default_value>0.25</default_value><documentation/><pattern>44</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></InnerSupportDiameter></MeshRefinement><MatrixM><RadiusR><value>250</value><default_value>100</default_value><documentation/><pattern>45</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></RadiusR><KinkAngleMax><value>110.</value><default_value>110.</default_value><documentation/><pattern>46</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></KinkAngleMax><KinkAngleMin><value>-110.</value><default_value>-110.</default_value><documentation/><pattern>47</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></KinkAngleMin><MaterialAngleMax><value>180.</value><default_value>180.</default_value><documentation/><pattern>48</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></MaterialAngleMax><MaterialAngleMin><value>-180.</value><default_value>-180.</default_value><documentation/><pattern>49</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></MaterialAngleMin><StepsKinkAngle><value>22</value><default_value>22</default_value><documentation/><pattern>50</pattern><pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description></StepsKinkAngle><StepsMaterialAngle><value>36</value><default_value>36</default_value><documentation/><pattern>51</pattern><pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description></StepsMaterialAngle><FEDegree><value>1</value><default_value>1</default_value><documentation/><pattern>52</pattern><pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description></FEDegree><MaxRefCycles><value>3</value><default_value>10</default_value><documentation/><pattern>53</pattern><pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description></MaxRefCycles><MultiGrid><value>false</value><default_value>true</default_value><documentation/><pattern>54</pattern><pattern_description>[Bool]</pattern_description></MultiGrid><OutputMatrixM><value>true</value><default_value>false</default_value><documentation/><pattern>55</pattern><pattern_description>[Bool]</pattern_description></OutputMatrixM><OutputGrids><value>false</value><default_value>false</default_value><documentation/><pattern>56</pattern><pattern_description>[Bool]</pattern_description></OutputGrids><OutputSolutions><value>false</value><default_value>false</default_value><documentation/><pattern>57</pattern><pattern_description>[Bool]</pattern_description></OutputSolutions></MatrixM><RungeKuttaMethod><k><value>250000</value><default_value>10000</default_value><documentation/><pattern>58</pattern><pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description></k></RungeKuttaMethod><Preconditioner><Type><value>ParaSails</value><default_value>BoomerAMG</default_value><documentation/><pattern>59</pattern><pattern_description>[Selection BoomerAMG|Euclid|ParaSails ]</pattern_description></Type><BoomerAMG><strong_5fthreshold><value>0.2</value><default_value>0.25</default_value><documentation/><pattern>60</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></strong_5fthreshold><max_5frow_5fsum><value>0.9</value><default_value>0.9</default_value><documentation/><pattern>61</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></max_5frow_5fsum><aggressive_5fcoarsening_5fnum_5flevels><value>0</value><default_value>0</default_value><documentation/><pattern>62</pattern><pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description></aggressive_5fcoarsening_5fnum_5flevels></BoomerAMG><Euclid><use_5fblock_5fjacobi><value>false</value><default_value>false</default_value><documentation/><pattern>63</pattern><pattern_description>[Bool]</pattern_description></use_5fblock_5fjacobi><level><value>4</value><default_value>1</default_value><documentation/><pattern>64</pattern><pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description></level></Euclid><ParaSails><symmetric><value>2</value><default_value>0</default_value><documentation/><pattern>65</pattern><pattern_description>[Selection 0|1|2 ]</pattern_description></symmetric><n_5flevels><value>1</value><default_value>1</default_value><documentation/><pattern>66</pattern><pattern_description>[Integer range -2147483648...2147483647 (inclusive)]</pattern_description></n_5flevels><threshold><value>0.1</value><default_value>0.1</default_value><documentation/><pattern>67</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></threshold><filter><value>0.05</value><default_value>0.05</default_value><documentation/><pattern>68</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></filter><load_5fbal><value>0.</value><default_value>0.</default_value><documentation/><pattern>69</pattern><pattern_description>[Double -1.79769e+308...1.79769e+308 (inclusive)]</pattern_description></load_5fbal></ParaSails></Preconditioner><Input><Files><Mesh_5fdata_5ffile><value>/home/masteige/projects/mcrack/mcrack2d/examples/test/meshes/mesh.ucd</value><default_value>/home/masteige/mcrack2d/examples//meshes/mesh.ucd</default_value><documentation/><pattern>70</pattern><pattern_description>[FileName (Type: input)]</pattern_description></Mesh_5fdata_5ffile><Crack_5fpath_5fdata_5ffile_5fin><value>/home/masteige/projects/mcrack/mcrack2d/examples/test/meshes/crack_path_out_T=001_tip=P1.data</value><default_value>/home/masteige/mcrack2d/examples/crack_path_in.data</default_value><documentation/><pattern>71</pattern><pattern_description>[FileName (Type: input)]</pattern_description></Crack_5fpath_5fdata_5ffile_5fin><Crack_5fpath_5fdata_5ffile_5fout><value>/home/masteige/projects/mcrack/mcrack2d/examples/test/meshes/crack_path_out.data</value><default_value>/home/masteige/mcrack2d/examples/crack_path_out.data</default_value><documentation/><pattern>72</pattern><pattern_description>[FileName (Type: input)]</pattern_description></Crack_5fpath_5fdata_5ffile_5fout><Matrix_5fM_5fdata_5ffile_5fin><value>/home/masteige/projects/mcrack/mcrack2d/examples/test/matrix_M.data</value><default_value>/home/masteige/mcrack2d/examples/Matrix_M_in.data</default_value><documentation/><pattern>73</pattern><pattern_description>[FileName (Type: input)]</pattern_description></Matrix_5fM_5fdata_5ffile_5fin><Matrix_5fM_5fdata_5ffile_5fout><value>/home/masteige/projects/mcrack/mcrack2d/examples/test/matrix_M_out.data</value><default_value>/home/masteige/mcrack2d/examples/Matrix_M_out.data</default_value><documentation/><pattern>74</pattern><pattern_description>[FileName (Type: input)]</pattern_description></Matrix_5fM_5fdata_5ffile_5fout><da_5fdN_5fcurve_5fdata_5ffile><value>/home/masteige/projects/mcrack/mcrack2d/examples/test/da_dN_curve.data</value><default_value>/home/masteige/mcrack2d/examples/da_dN_curve.data</default_value><documentation/><pattern>75</pattern><pattern_description>[FileName (Type: input)]</pattern_description></da_5fdN_5fcurve_5fdata_5ffile><Results_5ffile><value>/home/masteige/projects/mcrack/mcrack2d/examples/test/results.data</value><default_value>/home/masteige/mcrack2d/examples/results/results.data</default_value><documentation/><pattern>76</pattern><pattern_description>[FileName (Type: input)]</pattern_description></Results_5ffile><Python_5finput_5ffile><value>/home/masteige/projects/mcrack/mcrack2d/common/scripts/extract_mesh.py</value><default_value>/home/masteige/mcrack2d/common/scripts/extract_mesh.py</default_value><documentation/><pattern>77</pattern><pattern_description>[FileName (Type: input)]</pattern_description></Python_5finput_5ffile></Files><Directories><Material_5fdir><value>/home/masteige/projects/mcrack/mcrack2d/common/material_database/</value><default_value>/home/masteige/mcrack2d/common/material_database</default_value><documentation/><pattern>78</pattern><pattern_description>[DirectoryName]</pattern_description></Material_5fdir><Project_5fdir><value>/home/masteige/projects/mcrack/mcrack2d/examples/test/</value><default_value>/home/masteige/mcrack2d/examples</default_value><documentation/><pattern>79</pattern><pattern_description>[DirectoryName]</pattern_description></Project_5fdir><Graphics_5fdir><value>/home/masteige/projects/mcrack/mcrack2d/examples/test/graphics/</value><default_value>/home/masteige/mcrack2d/examples/graphics</default_value><documentation/><pattern>80</pattern><pattern_description>[DirectoryName]</pattern_description></Graphics_5fdir><Meshes_5fdir><value>/home/masteige/projects/mcrack/mcrack2d/examples/test/meshes/</value><default_value>/home/masteige/mcrack2d/examples/meshes</default_value><documentation/><pattern>81</pattern><pattern_description>[DirectoryName]</pattern_description></Meshes_5fdir><Results_5fdir><value>/home/masteige/projects/mcrack/mcrack2d/examples/test/results</value><default_value>/home/masteige/mcrack2d/examples/results</default_value><documentation/><pattern>82</pattern><pattern_description>[DirectoryName]</pattern_description></Results_5fdir></Directories></Input></ParameterHandler>
\ No newline at end of file
index 7973c7b64e6aea50b6043f38261eae90246d212d..115da80d12383783452d4f7127e3a54cc5a23094 100644 (file)
@@ -1,25 +1,39 @@
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #include <QtGui>
 
 #include "xml_parameter_reader.h"
 
 
-XMLParameterReader::XMLParameterReader(QTreeWidget *tree_widget)
-                  : tree_widget(tree_widget)
+namespace dealii
 {
-  QStyle * style = tree_widget->style();
+  namespace ParameterGui
+  {
+    XMLParameterReader::XMLParameterReader(QTreeWidget *tree_widget)
+                      : tree_widget(tree_widget)
+    {
+      QStyle * style = tree_widget->style();
 
-  subsection_icon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon), QIcon::Normal, QIcon::Off);
-  subsection_icon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon), QIcon::Normal, QIcon::On);
+      subsection_icon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon), QIcon::Normal, QIcon::Off);
+      subsection_icon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon), QIcon::Normal, QIcon::On);
 
-  parameter_icon.addPixmap(style->standardPixmap(QStyle::SP_FileIcon));
-}
+      parameter_icon.addPixmap(style->standardPixmap(QStyle::SP_FileIcon));
+    }
 
 
 
-bool XMLParameterReader::read_xml_file(QIODevice *device)
-{
-  xml.setDevice(device);
+    bool XMLParameterReader::read_xml_file(QIODevice *device)
+    {
+      xml.setDevice(device);
 
                // We look for a StartElement "ParameterHandler"
                // and start parsing after this.
@@ -29,52 +43,52 @@ bool XMLParameterReader::read_xml_file(QIODevice *device)
                //   </subsection>
                //  </ParameterHandler>
 
-  while (xml.readNext() != QXmlStreamReader::Invalid)
-    {
-      if (xml.isStartElement())
-        if (xml.name() == "ParameterHandler")
-          {
-            parse_parameters();
+      while (xml.readNext() != QXmlStreamReader::Invalid)
+        {
+          if (xml.isStartElement())
+            if (xml.name() == "ParameterHandler")
+              {
+                parse_parameters();
 
-            return !xml.error();;
-          };
-    };
+                return !xml.error();;
+              };
+        };
 
-  xml.raiseError(QObject::tr("The file is not an ParameterHandler XML file."));
+      xml.raiseError(QObject::tr("The file is not an ParameterHandler XML file."));
 
-  return !xml.error();
-}
+      return !xml.error();
+    }
 
 
 
-QString XMLParameterReader::error_string() const
-{
-  return QObject::tr("%1\nLine %2, column %3")
-         .arg(xml.errorString())
-         .arg(xml.lineNumber())
-         .arg(xml.columnNumber());
-}
+    QString XMLParameterReader::error_string() const
+    {
+      return QObject::tr("%1\nLine %2, column %3")
+             .arg(xml.errorString())
+             .arg(xml.lineNumber())
+             .arg(xml.columnNumber());
+    }
 
 
 
-void XMLParameterReader::parse_parameters()
-{
-  Q_ASSERT(xml.isStartElement() && xml.name() == "ParameterHandler");
+    void XMLParameterReader::parse_parameters()
+    {
+      Q_ASSERT(xml.isStartElement() && xml.name() == "ParameterHandler");
 
-  while (xml.readNext() != QXmlStreamReader::Invalid)  // go to the next <start_element>
-    {                                                  // if it is the closing element of ParameterHandler,
-      if (xml.isEndElement() && xml.name() == "ParameterHandler")
-        break;                                         // break the loop
+      while (xml.readNext() != QXmlStreamReader::Invalid)      // go to the next <start_element>
+        {                                                      // if it is the closing element of ParameterHandler,
+          if (xml.isEndElement() && xml.name() == "ParameterHandler")
+            break;                                             // break the loop
 
-      if (xml.isStartElement())                                // if it is a start element
-        read_subsection_element(0);                    // it must be a subsection or a parameter
-    };
-}
+          if (xml.isStartElement())                            // if it is a start element
+            read_subsection_element(0);                        // it must be a subsection or a parameter
+        };
+    }
 
 
 
-void XMLParameterReader::read_subsection_element(QTreeWidgetItem *parent)
-{
+    void XMLParameterReader::read_subsection_element(QTreeWidgetItem *parent)
+    {
                // The structure of the parameter file is assumed to be of the form
                //
                //  <subsection>
@@ -104,205 +118,205 @@ void XMLParameterReader::read_subsection_element(QTreeWidgetItem *parent)
                // and a parameter has the entries <value>, <default_value>, <documentation>,
                // <pattern> and <pattern_description>
 
-  Q_ASSERT(xml.isStartElement());                      // the actual element is <subsection>
+      Q_ASSERT(xml.isStartElement());                                  // the actual element is <subsection>
 
-  QTreeWidgetItem * subsection = create_child_item(parent);            // create a new subsection in the tree
+      QTreeWidgetItem * subsection = create_child_item(parent);                // create a new subsection in the tree
 
-  subsection->setIcon(0, subsection_icon);                             // set the icon,
-  subsection->setText(0, demangle(xml.name().toString()));             // the name
+      subsection->setIcon(0, subsection_icon);                         // set the icon,
+      subsection->setText(0, demangle(xml.name().toString()));         // the name
 
-  tree_widget->setItemExpanded(subsection, 0);                         // and the folder is not expanded
+      tree_widget->setItemExpanded(subsection, 0);                     // and the folder is not expanded
 
-  while (xml.readNext() != QXmlStreamReader::Invalid)  // read the next element
-    {
-      if (xml.isEndElement())                          // if the next element is </subsection>, break the loop
-        break;
-
-      if (xml.isStartElement())                                // if it is a start element
+      while (xml.readNext() != QXmlStreamReader::Invalid)              // read the next element
         {
-          if (xml.name() == "value")                   // it can be <value>, then we have found a parameter,
-            {
-              subsection->setFlags(subsection->flags() | Qt::ItemIsEditable);  // values can be edited,
-              read_parameter_element (subsection);
-            }
-          else                                         // or it can be a new <subsection>
+          if (xml.isEndElement())                                      // if the next element is </subsection>, break the loop
+            break;
+
+          if (xml.isStartElement())                                    // if it is a start element
             {
-              subsection->setFlags(subsection->flags() | Qt::NoItemFlags);     // subsections can not be edited,
-              read_subsection_element (subsection);
+              if (xml.name() == "value")                               // it can be <value>, then we have found a parameter,
+                {
+                  subsection->setFlags(subsection->flags() | Qt::ItemIsEditable);      // values can be edited,
+                  read_parameter_element (subsection);
+                }
+              else                                                     // or it can be a new <subsection>
+                {
+                  subsection->setFlags(subsection->flags() | Qt::NoItemFlags);         // subsections can not be edited,
+                  read_subsection_element (subsection);
+                };
             };
         };
-    };
-}
+    }
 
 
 
-void XMLParameterReader::read_parameter_element(QTreeWidgetItem *parent)
-{
-  Q_ASSERT(xml.isStartElement() && xml.name() == "value");     // the actual element is <value>,
-                                                               // then we have found a parameter-item
-  QString value = xml.readElementText();                       // read the element text
-  parent->setText(1, value);                                   // and store as text to the item
-  parent->setIcon(0, parameter_icon);                          // change the icon of parent
-
-  while (xml.readNext() != QXmlStreamReader::Invalid)                          // go to the next <start_element>
+    void XMLParameterReader::read_parameter_element(QTreeWidgetItem *parent)
     {
-      if (xml.isStartElement())
-      {
-      if (xml.isStartElement() && xml.name() == "default_value")               // if it is <default_value>
-        {
-          QString default_value = xml.readElementText();                       // store it
-          parent->setText(2, default_value);
-        }
-      else if (xml.isStartElement() && xml.name() == "documentation")          // if it is <documentation>
-        {
-          QString documentation = xml.readElementText();                       // store it
-          parent->setText(3, documentation);
+      Q_ASSERT(xml.isStartElement() && xml.name() == "value");         // the actual element is <value>,
+                                                                       // then we have found a parameter-item
+      QString value = xml.readElementText();                           // read the element text
+      parent->setText(1, value);                                       // and store as text to the item
+      parent->setIcon(0, parameter_icon);                              // change the icon of parent
 
-          if (!documentation.isEmpty())                                                // if there is a documentation,
-            {
-              parent->setToolTip(0, "Documentation: " + documentation);                // set Documentation as ToolTip for both columns
-              parent->setToolTip(1, "Documentation: " + documentation);
-              parent->setStatusTip(0, "Documentation: " + documentation);      // and as StatusTip for the first column also
-            };
-        }
-      else if (xml.isStartElement() && xml.name() == "pattern")                        // if it is <pattern>
-        {
-          QString pattern = xml.readElementText();                             // store it as text
-          parent->setText(4, pattern);                                         // we only need this value
-                                                                               // for writing back to XML later
-        }
-      else if (xml.isStartElement() &&  xml.name() == "pattern_description")   // if it is <pattern_description>
+      while (xml.readNext() != QXmlStreamReader::Invalid)                              // go to the next <start_element>
         {
-          QString pattern_description = xml.readElementText();                 // store it as text
-          parent->setText(5, pattern_description);
-                                                                               // show the type and default
-                                                                               // in the StatusLine
-          parent->setStatusTip(1, "Type: " + pattern_description + "   Default: " + parent->text(2));
-
-                                               // in order to store values as correct data types,
-                                               // we check the following types in the pattern_description:
-
-          QRegExp  rx_string("\\b(Anything|FileName|DirectoryName|Selection|List|MultipleSelection)\\b"),      
-                   rx_integer("\\b(Integer)\\b"),
-                   rx_double("\\b(Float|Floating|Double)\\b"),
-                   rx_bool("\\b(Selection true|false)\\b");
-
-          if (rx_string.indexIn (pattern_description) != -1)                   // the type "Anything" or "Filename"
-            {
-              QString value = parent->text(1);                                 // store as a QString
-
-              parent->setData(1, Qt::EditRole, value);                         // and set the data in the item
-              parent->setData(1, Qt::DisplayRole, value);
-            }
-          else if (rx_integer.indexIn (pattern_description) != -1)             // if the tpye is "Integer"
+          if (xml.isStartElement())
             {
-              QString text = parent->text(1);
-
-              bool ok = true;
-
-              int value = text.toInt(&ok);                                     // we convert the string to int
-
-              if (ok)                                                          // and store
+              if (xml.isStartElement() && xml.name() == "default_value")               // if it is <default_value>
                 {
-                  parent->setData(1, Qt::EditRole, value);
-                  parent->setData(1, Qt::DisplayRole, value);
+                  QString default_value = xml.readElementText();                       // store it
+                  parent->setText(2, default_value);
                 }
-              else                                                             // otherwise raise an error
-                xml.raiseError(QObject::tr("Cannot convert integer type to integer!"));
-            }
-          else if (rx_double.indexIn (pattern_description) != -1)              // the same with "Float"
-            {
-              QString text = parent->text(1);
-
-              bool ok  = true;
-
-              double value = text.toDouble(&ok);
-
-              if (ok)
+              else if (xml.isStartElement() && xml.name() == "documentation")          // if it is <documentation>
                 {
-                  parent->setData(1, Qt::EditRole, value);
-                  parent->setData(1, Qt::DisplayRole, value);
+                  QString documentation = xml.readElementText();                       // store it
+                  parent->setText(3, documentation);
+
+                  if (!documentation.isEmpty())                                                // if there is a documentation,
+                    {
+                      parent->setToolTip(0, "Documentation: " + documentation);                // set Documentation as ToolTip for both columns
+                      parent->setToolTip(1, "Documentation: " + documentation);
+                      parent->setStatusTip(0, "Documentation: " + documentation);      // and as StatusTip for the first column also
+                    };
                 }
-              else
-                xml.raiseError(QObject::tr("Cannot convert double type to double!"));
-            };
-
-          if (rx_bool.indexIn (pattern_description) != -1)                     // and booleans
-            {
-              QRegExp  test(parent->text(1));
+              else if (xml.isStartElement() && xml.name() == "pattern")                        // if it is <pattern>
+                {
+                  QString pattern = xml.readElementText();                             // store it as text
+                  parent->setText(4, pattern);                                         // we only need this value
+                                                                                       // for writing back to XML later
+                }
+              else if (xml.isStartElement() &&  xml.name() == "pattern_description")   // if it is <pattern_description>
+                {
+                  QString pattern_description = xml.readElementText();                 // store it as text
+                  parent->setText(5, pattern_description);
+                                                                                       // show the type and default
+                                                                                       // in the StatusLine
+                  parent->setStatusTip(1, "Type: " + pattern_description + "   Default: " + parent->text(2));
 
-              bool value = true;
+                                               // in order to store values as correct data types,
+                                               // we check the following types in the pattern_description:
 
-              if (test.exactMatch("true"))
-                value = true;
-              else if (test.exactMatch("false"))
-                value = false;
+                  QRegExp  rx_string("\\b(Anything|FileName|DirectoryName|Selection|List|MultipleSelection)\\b"),      
+                           rx_integer("\\b(Integer)\\b"),
+                           rx_double("\\b(Float|Floating|Double)\\b"),
+                           rx_bool("\\b(Selection true|false)\\b");
+
+                  if (rx_string.indexIn (pattern_description) != -1)                   // the type "Anything" or "Filename"
+                    {
+                      QString value = parent->text(1);                                 // store as a QString
+
+                      parent->setData(1, Qt::EditRole, value);                         // and set the data in the item
+                      parent->setData(1, Qt::DisplayRole, value);
+                    }
+                  else if (rx_integer.indexIn (pattern_description) != -1)             // if the tpye is "Integer"
+                    {
+                      QString text = parent->text(1);
+
+                      bool ok = true;
+
+                      int value = text.toInt(&ok);                                     // we convert the string to int
+
+                      if (ok)                                                          // and store
+                        {
+                          parent->setData(1, Qt::EditRole, value);
+                          parent->setData(1, Qt::DisplayRole, value);
+                        }
+                      else                                                             // otherwise raise an error
+                        xml.raiseError(QObject::tr("Cannot convert integer type to integer!"));
+                    }
+                  else if (rx_double.indexIn (pattern_description) != -1)              // the same with "Float"
+                    {
+                      QString text = parent->text(1);
+
+                      bool ok  = true;
+
+                      double value = text.toDouble(&ok);
+
+                      if (ok)
+                        {
+                          parent->setData(1, Qt::EditRole, value);
+                          parent->setData(1, Qt::DisplayRole, value);
+                        }
+                      else
+                        xml.raiseError(QObject::tr("Cannot convert double type to double!"));
+                    };
+
+                  if (rx_bool.indexIn (pattern_description) != -1)                             // and booleans
+                    {
+                      QRegExp  test(parent->text(1));
+
+                      bool value = true;
+
+                      if (test.exactMatch("true"))
+                        value = true;
+                      else if (test.exactMatch("false"))
+                        value = false;
+                      else
+                        xml.raiseError(QObject::tr("Cannot convert boolen type to boolean!"));
+
+                      parent->setText(1, "");                                          // this is needed because we use
+                      parent->setData(1, Qt::EditRole, value);                         // for booleans the standard
+                      parent->setData(1, Qt::DisplayRole, value);                              // delegate
+                    };
+
+                  break;                                                                       // and break the loop
+                }
               else
-                xml.raiseError(QObject::tr("Cannot convert boolen type to boolean!"));
-
-              parent->setText(1, "");                                          // this is needed because we use
-              parent->setData(1, Qt::EditRole, value);                         // for booleans the standard
-              parent->setData(1, Qt::DisplayRole, value);                      // delegate
-            };
-
-          break;                                               // and break the loop
-        }
-      else
-        {                                                      // if there is any other element, raise an error
-          xml.raiseError(QObject::tr("Incomplete or unknown Parameter!"));
-          break;                                               // and break the loop
-        };                                                     // here we assume the special structure
-      };                                                       // of the parameter-file!
-    };
-}
-
+                {                                                                      // if there is any other element, raise an error
+                  xml.raiseError(QObject::tr("Incomplete or unknown Parameter!"));
+                  break;                                                               // and break the loop, here
+                };                                                                     // we assume the special structure
+            };                                                                         // of the parameter-file!
+        };
+    }
 
 
-QTreeWidgetItem *XMLParameterReader::create_child_item(QTreeWidgetItem *item)
-{
-  QTreeWidgetItem * child_item;                                                // create a new child-item
 
-  if (item)
-    child_item = new QTreeWidgetItem(item);                            // if item is not empty,
-  else                                                                 // append the new item as a child
-    child_item = new QTreeWidgetItem(tree_widget);                     // otherwise create a new item
-                                                                       // in the tree
+    QTreeWidgetItem *XMLParameterReader::create_child_item(QTreeWidgetItem *item)
+    {
+      QTreeWidgetItem * child_item;                                                    // create a new child-item
 
-  child_item->setData(0, Qt::DisplayRole, xml.name().toString());      // set xml.tag_name as data
-  child_item->setText(0, xml.name().toString());                       // set xml.tag_name as data
+      if (item)
+        child_item = new QTreeWidgetItem(item);                                                // if item is not empty,
+      else                                                                             // append the new item as a child
+        child_item = new QTreeWidgetItem(tree_widget);                                 // otherwise create a new item
+                                                                                       // in the tree
 
-  return child_item;
-}
+      child_item->setData(0, Qt::DisplayRole, xml.name().toString());                  // set xml.tag_name as data
+      child_item->setText(0, xml.name().toString());                                   // set xml.tag_name as data
 
+      return child_item;
+    }
 
 
-QString XMLParameterReader::demangle (const QString &s)
-{
-  std::string  s_temp (s.toStdString());               // this function is copied from the ParameterHandler class
 
-  std::string u;
-  u.reserve (s_temp.size());
+    QString XMLParameterReader::demangle (const QString &s)
+    {
+      std::string  s_temp (s.toStdString());           // this function is copied from the ParameterHandler class
 
-  for (unsigned int i=0; i<s_temp.size(); ++i)
-    if (s_temp[i] != '_')
-      u.push_back (s_temp[i]);
-    else
-      {
-       Q_ASSERT (i+2 < s_temp.size());
+      std::string u;
+      u.reserve (s_temp.size());
 
-       unsigned char c = 0;
-       switch (s_temp[i+1])
-         {
-           case '0':  c = 0 * 16;  break;
-           case '1':  c = 1 * 16;  break;
-           case '2':  c = 2 * 16;  break;
-           case '3':  c = 3 * 16;  break;
-           case '4':  c = 4 * 16;  break;
-           case '5':  c = 5 * 16;  break;
-           case '6':  c = 6 * 16;  break;
-           case '7':  c = 7 * 16;  break;
-           case '8':  c = 8 * 16;  break;
-           case '9':  c = 9 * 16;  break;
+      for (unsigned int i=0; i<s_temp.size(); ++i)
+        if (s_temp[i] != '_')
+          u.push_back (s_temp[i]);
+        else
+          {
+            Q_ASSERT (i+2 < s_temp.size());
+
+            unsigned char c = 0;
+            switch (s_temp[i+1])
+              {
+                case '0':  c = 0 * 16;  break;
+                case '1':  c = 1 * 16;  break;
+                case '2':  c = 2 * 16;  break;
+                case '3':  c = 3 * 16;  break;
+                case '4':  c = 4 * 16;  break;
+                case '5':  c = 5 * 16;  break;
+                case '6':  c = 6 * 16;  break;
+                case '7':  c = 7 * 16;  break;
+                case '8':  c = 8 * 16;  break;
+                case '9':  c = 9 * 16;  break;
            case 'a':  c = 10 * 16;  break;
            case 'b':  c = 11 * 16;  break;
            case 'c':  c = 12 * 16;  break;
@@ -334,14 +348,16 @@ QString XMLParameterReader::demangle (const QString &s)
                  Q_ASSERT (false);
          }
 
-       u.push_back (static_cast<char>(c));
+       u.push_back (static_cast<char>(c));
 
                                         // skip the two characters
-       i += 2;
-      }
+           i += 2;
+          }
 
-  QString  v (u.c_str());
+      QString  v (u.c_str());
 
-  return v;
+      return v;
+    }
+  }
 }
 
index 2fe44c6081b439d9a10ae09b5394aee65c2f664a..6d90fd4d759c29b85dd625b404c25c9769bb9a89 100644 (file)
@@ -1,3 +1,13 @@
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #ifndef XMLPARAMETERREADER_H
 #define XMLPARAMETERREADER_H
 #include <QTreeWidgetItem>
 
 
+namespace dealii
+{
+/*! @addtogroup ParameterGui
+ *@{
+ */
+  namespace ParameterGui
+  {
 /**
  * The XMLParameterReader class provides an interface to parse parameters from XML files to a QTreeWidget.
  * This class makes extensive use of the QXmlStreamReader class, which implements the basic functionalities
  * for parsing XML files.
  *
- * @ingroup gui
- * @author Martin Steigemann, Wolfgang Bangerth, December 2010
+ * @note This class is used in the graphical user interface for the @ref ParameterHandler class.
+ *       It is not compiled into the deal.II libraries and can not be used by applications using deal.II.
+ *
+ * @ingroup ParameterGui
+ * @author Martin Steigemann, Wolfgang Bangerth, 2010
  */
-class XMLParameterReader
-{
-  public:
+    class XMLParameterReader
+    {
+      public:
                                     /**
                                      * Constructor.
+                                     * The parameter values will be stored in @p tree_widget.
                                      */
-    XMLParameterReader (QTreeWidget *tree_widget);
+        XMLParameterReader (QTreeWidget *tree_widget);
                                     /**
-                                     * This function reads the parameters from <tt>device</tt> into the <tt>tree_widget</tt>.
+                                     * This function reads the parameters from @p device into the <tt>tree_widget</tt>.
                                      * We use the QXmlStreaReader class for this.
                                      * There must be a start element
-                                     * <code><ParameterHandler></code>
-                                     * and an end element <code></ParameterHandler></code>
+                                     * <code>&lt;ParameterHandler&gt;</code>
+                                     * and an end element <code>&lt;/ParameterHandler&gt;</code>
                                      * otherwise an exception is thrown.
                                      */
-    bool read_xml_file (QIODevice *device);
+        bool read_xml_file (QIODevice *device);
                                     /**
                                      * This function returns an error message.
                                      */
-    QString error_string () const;
+        QString error_string () const;
 
-  private:
+      private:
                                     /**
                                      * This function implements a loop over the XML file
                                      * and parses XML elements. It calls @ref read_subsection_element
-                                     * till the <code></ParameterHandler></code> element is found
+                                     * till the <code>&lt;/ParameterHandler&gt;</code> element is found
                                      * or the end of the file is reached. In this case, an exception is thrown.
                                      */
-    void parse_parameters ();
+        void parse_parameters ();
                                     /**
                                      * This functions parses a <tt>subsection</tt>.
-                                     * If the next element is <code><value></code>,
+                                     * and adds it as a child to @p parent.
+                                     * If the next element is <code>&lt;value&gt;</code>,
                                      * this functions calls @ref read_parameter_element
                                      * otherwise the function itself recursively.
                                      */
-    void read_subsection_element (QTreeWidgetItem *parent);
+        void read_subsection_element (QTreeWidgetItem *parent);
                                     /**
-                                     * This functions parses a <tt>parameter</tt>.
+                                     * This function parses a <tt>parameter</tt> and
+                                     * and adds it as a child to @p parent.
                                      * A <tt>parameter</tt> description consists of five elements:
                                      * @code
                                      *   <value>value</value>
@@ -65,32 +88,36 @@ class XMLParameterReader
                                      * If a <tt>parameter</tt> description is incomplete, an exception
                                      * is thrown.
                                      */
-    void read_parameter_element (QTreeWidgetItem *parent);
+        void read_parameter_element (QTreeWidgetItem *parent);
                                     /**
-                                     * Reimplemented from the ParameterHandler class.
-                                     * Unmangle a string into its original form.
+                                     * Reimplemented from the @ref ParameterHandler class.
+                                     * Unmangle a string @p s into its original form.
                                      */
-    QString  demangle (const QString &s);
+        QString  demangle (const QString &s);
                                     /**
-                                     * This helper function creates a new item in the tree.
+                                     * This helper function creates a new child of @p item in the tree.
                                      */
-    QTreeWidgetItem * create_child_item(QTreeWidgetItem *item);
+        QTreeWidgetItem * create_child_item(QTreeWidgetItem *item);
                                     /**
                                      * The QXmlStreamReader object for reading XML elements.
                                      */
-    QXmlStreamReader  xml;
+        QXmlStreamReader  xml;
                                     /**
                                      * A pointer to the tree structure.
                                      */
-    QTreeWidget * tree_widget;
+        QTreeWidget * tree_widget;
                                     /**
                                      * An icon for subsections in the tree structure.
                                      */
-    QIcon  subsection_icon;
+        QIcon  subsection_icon;
                                     /**
                                      * An icon for parameters in the tree structure.
                                      */
-    QIcon  parameter_icon;
-};
+        QIcon  parameter_icon;
+    };
+  }
+/**@}*/
+}
+
 
 #endif
index 95a1f5a2d1ef0c560e2f67d96a1d4b3cb80fa6cb..553267d87308e3e29c26dd2da76142db05c45a52 100644 (file)
@@ -1,83 +1,98 @@
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #include <QtGui>
 
 #include "xml_parameter_writer.h"
 
 
-XMLParameterWriter::XMLParameterWriter(QTreeWidget *tree_widget)
-                  : tree_widget(tree_widget)
+namespace dealii
 {
-  xml.setAutoFormatting(true);                                 // enable auto-formatting
-}
+  namespace ParameterGui
+  {
+    XMLParameterWriter::XMLParameterWriter(QTreeWidget *tree_widget)
+                      : tree_widget(tree_widget)
+    {
+      xml.setAutoFormatting(true);                                             // enable auto-formatting
+    }
 
 
 
-bool XMLParameterWriter::write_xml_file(QIODevice *device)
-{
-  xml.setDevice(device);                                       // setup the output device
-  xml.writeStartDocument();                                    // write the head <?xml ... ?>
-  xml.writeStartElement("ParameterHandler");                   // write the root element <ParameterHandler>
-                                                               // loop over the elements
-  for (int i = 0; i < tree_widget->topLevelItemCount(); ++i)
-    write_item(tree_widget->topLevelItem(i));                  // and write the items
+    bool XMLParameterWriter::write_xml_file(QIODevice *device)
+    {
+      xml.setDevice(device);                                                   // setup the output device
+      xml.writeStartDocument();                                                        // write the head <?xml ... ?>
+      xml.writeStartElement("ParameterHandler");                               // write the root element <ParameterHandler>
+                                                                               // loop over the elements
+      for (int i = 0; i < tree_widget->topLevelItemCount(); ++i)
+        write_item(tree_widget->topLevelItem(i));                              // and write the items
 
-  xml.writeEndDocument();                                      // close the first element
+      xml.writeEndDocument()           ;                                       // close the first element
 
-  return true;
-}
+      return true;
+    }
 
 
 
-void XMLParameterWriter::write_item(QTreeWidgetItem *item)
-{
-  QString tag_name = mangle(item->text(0));                    // store the element name
+    void XMLParameterWriter::write_item(QTreeWidgetItem *item)
+    {
+      QString tag_name = mangle(item->text(0));                                        // store the element name
 
-  xml.writeStartElement(tag_name);                             // and write <tag_name> to the file
+      xml.writeStartElement(tag_name);                                         // and write <tag_name> to the file
 
-  if (!item->text(1).isEmpty())                                        // if the "value"-entry of this item is not empty
-    {                                                          // we have a parameter
-      xml.writeTextElement("value", item->data(1,Qt::EditRole).toString());
-      xml.writeTextElement("default_value", item->text(2));    // and we write its values
-      xml.writeTextElement("documentation", item->text(3));
-      xml.writeTextElement("pattern", item->text(4));
-      xml.writeTextElement("pattern_description", item->text(5));
-    };
+      if (!item->text(1).isEmpty())                                            // if the "value"-entry of this item is not empty
+        {                                                                      // we have a parameter
+          xml.writeTextElement("value", item->data(1,Qt::EditRole).toString());
+          xml.writeTextElement("default_value", item->text(2));                        // and we write its values
+          xml.writeTextElement("documentation", item->text(3));
+          xml.writeTextElement("pattern", item->text(4));
+          xml.writeTextElement("pattern_description", item->text(5));
+        };
 
-  for (int i = 0; i < item->childCount(); ++i)                 // go over the childrens recursively
-    write_item(item->child(i));
+      for (int i = 0; i < item->childCount(); ++i)                             // go over the childrens recursively
+        write_item(item->child(i));
 
-  xml.writeEndElement();                                       // write closing </tag_name>
-}
+      xml.writeEndElement();                                                   // write closing </tag_name>
+    }
 
 
 
-QString XMLParameterWriter::mangle (const QString &s)
-{
-  std::string  s_temp (s.toStdString());                       // this function is copied from
-                                                               // the ParameterHandler class
-  std::string u;                                               // and adapted to mangle QString
-  u.reserve (s_temp.size());
+    QString XMLParameterWriter::mangle (const QString &s)
+    {
+      std::string  s_temp (s.toStdString());                                   // this function is copied from
+                                                                               // the ParameterHandler class
+      std::string u;                                                           // and adapted to mangle QString
+      u.reserve (s_temp.size());
 
-  static const std::string allowed_characters
-    ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
+      static const std::string allowed_characters
+        ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
 
                                   // for all parts of the string, see
                                   // if it is an allowed character or
                                   // not
-  for (unsigned int i=0; i<s_temp.size(); ++i)
-    if (allowed_characters.find (s_temp[i]) != std::string::npos)
-      u.push_back (s_temp[i]);
-    else
-      {
-       u.push_back ('_');
-       static const char hex[16]
-         = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
-       u.push_back (hex[static_cast<unsigned char>(s_temp[i])/16]);
-       u.push_back (hex[static_cast<unsigned char>(s_temp[i])%16]);
-      }
-
-  QString  v (u.c_str());
-
-  return v;
+      for (unsigned int i=0; i<s_temp.size(); ++i)
+        if (allowed_characters.find (s_temp[i]) != std::string::npos)
+          u.push_back (s_temp[i]);
+        else
+          {
+           u.push_back ('_');
+           static const char hex[16]
+             = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
+           u.push_back (hex[static_cast<unsigned char>(s_temp[i])/16]);
+           u.push_back (hex[static_cast<unsigned char>(s_temp[i])%16]);
+          }
+
+      QString  v (u.c_str());
+
+      return v;
+    }
+  }
 }
-
index f11b8e955fa1e5d8f2aa97cf6b7847a330a8f1bf..814b486b82b69118a24e3eb60e62b160ff521c67 100644 (file)
@@ -1,3 +1,13 @@
+//---------------------------------------------------------------------------
+//
+//    Copyright (C) 2010, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
 
 #ifndef XMLPARAMETERWRITER_H
 #define XMLPARAMETERWRITER_H
 #include <QTreeWidgetItem>
 
 
+namespace dealii
+{
+/*! @addtogroup ParameterGui
+ *@{
+ */
+  namespace ParameterGui
+  {
 /**
  * The XMLParameterWriter class provides an interface to write parameters stored in a QTreeWidget to a file in XML format.
  * This class makes extensive use of the QXmlStreamWriter class, which implements the basic functionalities for writing
  * XML files.
  *
- * @ingroup gui
- * @author Martin Steigemann, Wolfgang Bangerth, December 2010
+ * @note This class is used in the graphical user interface for the @ref ParameterHandler class.
+ *       It is not compiled into the deal.II libraries and can not be used by applications using deal.II.
+ *
+ * @ingroup ParameterGui
+ * @author Martin Steigemann, Wolfgang Bangerth, 2010
  */
-class XMLParameterWriter
-{
-  public:
+    class XMLParameterWriter
+    {
+      public:
                                     /**
                                      * Constructor.
+                                     * Parameter values from @p tree_widget will be written.
                                      */
-    XMLParameterWriter (QTreeWidget *tree_widget);
+        XMLParameterWriter (QTreeWidget *tree_widget);
                                     /**
-                                     * This function writes the parameters stored in the <tt>tree_widget</tt>
-                                     * to <tt>device</tt> in XML format. We use the QXmlStreaWriter class
+                                     * This function writes the parameter values stored in <tt>tree_widget</tt>
+                                     * to @p device in XML format. We use the QXmlStreaWriter class
                                      * for this. The root element is
-                                     * <code><ParameterHandler></code>
+                                     * <code>&lt;ParameterHandler&gt;</code>
                                      */
-    bool write_xml_file (QIODevice *device);
+        bool write_xml_file (QIODevice *device);
 
-  private:
+      private:
                                     /**
-                                     * This function writes an <tt>item</tt> of <tt>tree_widget</tt>
+                                     * This function writes a given @p item of <tt>tree_widget</tt>
                                      * to a file in XML format. For this the QXmlStreamWriter class is used.
-                                     * If the <tt>item</tt> is a parameter, the elements that describes this parameter
+                                     * If the @p item is a parameter, the elements that describes this parameter
                                      * are written:
                                      * @code
                                      *   <value>value</value>
@@ -43,29 +64,32 @@ class XMLParameterWriter
                                      *   <pattern>pattern</pattern>
                                      *   <pattern_description>[pattern_description]</pattern_description>
                                      * @endcode
-                                     * If the <tt>item</tt> is a subsection, a start element <code>this_subsection</code> is written
+                                     * If the @p item is a subsection, a start element <code>this_subsection</code> is written
                                      * and <tt>write_item</tt> is called recursively to write the next <tt>item</tt>.
                                      */
-    void write_item (QTreeWidgetItem *item);
+        void write_item (QTreeWidgetItem *item);
                                     /**
-                                     * Reimplemented from the ParameterHandler class.
-                                     * Mangle a string so that it
+                                     * Reimplemented from the @ref ParameterHandler class.
+                                     * Mangle a string @p s so that it
                                      * doesn't contain any special
                                      * characters or spaces.
                                      */
-    QString  mangle (const QString &s);
+        QString  mangle (const QString &s);
                                     /**
                                      * An QXmlStreamWriter object
                                      * which implements the functionalities
                                      * we need for writing parameters to XML files.
                                      */
-    QXmlStreamWriter  xml;
+        QXmlStreamWriter  xml;
                                     /**
                                      * A pointer to the QTreeWidget structure
                                      * which stores the parameters.
                                      */
-    QTreeWidget * tree_widget;
-};
+        QTreeWidget * tree_widget;
+    };
+  }
+/**@}*/
+}
 
 
 #endif
index a6c11ef20ab6729f298a04bbf466d31653845630..261826a5cda1b891c3b9adb1853a23eebe74f1e4 100644 (file)
@@ -36,6 +36,7 @@ deal.II deal.tag: tutorial \
           deal.dox \
          $D/include/deal.II/*/*.h \
          headers/*.h \
+         $D/contrib/parameter_gui/*.h \
          $(addprefix tutorial/doxygen/, $(shell ls tutorial/doxygen/))
        @echo "=== Generating reference documentation. " \
               "This can take several minutes..."
@@ -55,8 +56,8 @@ tutorial:
 
 deal.dox: Makefile $(shell echo images ../../examples/*/doc ../news/*.h)
        @echo "=== Making $@"
-       @echo "INPUT=`echo headers $D/include/deal.II/* tutorial/doxygen ../news/*.h`" > $@
-       @echo "IMAGE_PATH=`echo images ../../examples/*/doc`" >> $@
+       @echo "INPUT=`echo headers $D/include/deal.II/* tutorial/doxygen ../news/*.h $D/contrib/parameter_gui`" > $@
+       @echo "IMAGE_PATH=`echo images ../../examples/*/doc $D/contrib/parameter_gui/images`" >> $@
 
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.