]> https://gitweb.dealii.org/ - parameter_gui.git/commitdiff
Remember output format 17/head
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Tue, 23 May 2017 16:56:44 +0000 (10:56 -0600)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Tue, 23 May 2017 16:57:23 +0000 (10:57 -0600)
mainwindow.cpp

index 0001e9de1bd96bcf93019e423f2af4aa8ff50744..24d007765c3f81e0c672f7a71d862b365d0b519f 100644 (file)
@@ -177,11 +177,19 @@ namespace dealii
 
     bool MainWindow::save_as()
     {
+      const QString default_save_format = gui_settings->value("Settings/DefaultSaveFormat").toString();
+
+      QString filters;
+      if (default_save_format == "prm")
+        filters = tr("PRM Files (*.prm);;XML Files (*.xml)");
+      else
+        filters = tr("XML Files (*.xml);;PRM Files (*.prm)");
+
       // open a file dialog
       QString  file_name =
                  QFileDialog::getSaveFileName(this, tr("Save Parameter File"),
                                               QDir::currentPath() + QDir::separator() + current_file,
-                                              tr("XML Files (*.xml);;PRM Files (*.prm)"));
+                                              filters);
 
       // return if a file was saved
       if (file_name.isEmpty())
@@ -530,6 +538,8 @@ namespace dealii
           XMLParameterWriter writer(tree_widget);
           if (!writer.write_xml_file(&file))
             return false;
+
+          gui_settings->setValue("Settings/DefaultSaveFormat", "xml");
         }
       else if (filename.endsWith(".prm",Qt::CaseInsensitive))
         {
@@ -537,6 +547,8 @@ namespace dealii
           PRMParameterWriter writer(tree_widget);
           if (!writer.write_prm_file(&file))
             return false;
+
+          gui_settings->setValue("Settings/DefaultSaveFormat", "prm");
         }
       else
         {

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.