]> https://gitweb.dealii.org/ - parameter_gui.git/commitdiff
Address comments 1/head
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Tue, 28 Mar 2017 20:02:44 +0000 (14:02 -0600)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Tue, 28 Mar 2017 20:02:44 +0000 (14:02 -0600)
mainwindow.cpp
prm_parameter_writer.cpp
prm_parameter_writer.h

index 4e8b9de4f14ff224a29599bf3f83914630455492..6abd2dfa01a76c1760c41b4535ed684b5fd9cd09 100644 (file)
@@ -310,15 +310,15 @@ namespace dealii
           return false;
         };
 
-      if (filename.contains(".xml"))
+      if (filename.endsWith(".xml",Qt::CaseInsensitive))
         {
           XMLParameterWriter writer(tree_widget);                               // create a xml writer
           if (!writer.write_xml_file(&file))                                    // and write the xml file
             return false;
         }
-      else if (filename.contains(".prm"))
+      else if (filename.endsWith(".prm",Qt::CaseInsensitive))
         {
-          PRMParameterWriter  writer(tree_widget);                              // create a prm writer
+          PRMParameterWriter writer(tree_widget);                               // create a prm writer
           if (!writer.write_prm_file(&file))                                    // and write the prm file
             return false;
         }
index 0c613016237186a6e76df8f90f4d84eeffb37d65..cd277a5549cb98978e57a3800f4818a3c81d1f58 100644 (file)
@@ -35,7 +35,7 @@ namespace dealii
                                                                                // loop over the elements
       for (int i = 0; i < tree_widget->topLevelItemCount(); ++i)
         {
-        const QString item_string = write_item(tree_widget->topLevelItem(i),0);
+        const QString item_string = item_to_string(tree_widget->topLevelItem(i),0);
         device->write(item_string.toAscii());
         }
 
@@ -44,8 +44,8 @@ namespace dealii
 
 
 
-    QString PRMParameterWriter::write_item(const QTreeWidgetItem *item,
-                                           const unsigned int indentation_level)
+    QString PRMParameterWriter::item_to_string(const QTreeWidgetItem *item,
+                                               const unsigned int indentation_level)
     {
       QString item_string;
 
@@ -53,7 +53,7 @@ namespace dealii
         {                                                                      // we have a parameter
           bool non_default_value;
 
-          if (item->text(5).contains("Double"))
+          if (item->text(5).startsWith("[Double"))
             non_default_value = item->data(1,Qt::DisplayRole).toReal() != item->data(2,Qt::DisplayRole).toReal();
           else
             non_default_value = item->data(1,Qt::DisplayRole).toString() != item->data(2,Qt::DisplayRole).toString();
@@ -70,7 +70,7 @@ namespace dealii
       else
         {
           for (int i = 0; i < item->childCount(); ++i)
-            item_string.push_back(write_item(item->child(i),indentation_level+1));
+            item_string.push_back(item_to_string(item->child(i),indentation_level+1));
 
           if (!item_string.isEmpty())
             {
index a71f36a83ea47ca16bd495ffc19b93a95fb534d6..190841812295299d4559ca3148e585ab13a4fbca 100644 (file)
@@ -59,21 +59,21 @@ namespace dealii
 
       private:
         /**
-         * This function writes a given @p item of <tt>tree_widget</tt>
-         * to a file in prm format.
-         * If the @p item is a parameter it is written if its value differs
+         * This function creates a string that corresponds to the data written
+         * to a prm file for a given @p item of <tt>tree_widget</tt>.
+         * If the @p item is a parameter it is only written if its value differs
          * from its default value. If the @p item is a subsection, a start element
          * <code>subsection</code> is written and <tt>write_item</tt> is called
          * recursively to write the next <tt>item</tt>.
-         * If not items in this subsection differ from their default value then
+         * If no items in this subsection differ from their default values then
          * the subsection is not written.
          * @p indentation_level describes the level the current item belongs to.
          * 0 describes a top level item and each subsection increases the level
          * by one.
          *
          */
-        QString write_item (const QTreeWidgetItem *item,
-                            const unsigned int indentation_level);
+        QString item_to_string (const QTreeWidgetItem *item,
+                                const unsigned int indentation_level);
 
         /**
          * A pointer to the QTreeWidget structure

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.