diff libgui/src/gui-preferences-ve.h @ 29250:3ad713d82d18

improve saving a variable in the variable editor (bug #59570) * gui-preferences-ve.h: define lists with possible save formats and with a relation between save format and suggested file extension * variable-editor.cc: include builtin-defun-decls.h and ovl.h (variable_editor_stack::save): format string as new argument, test save_default_options if format is empty, moved the saving into do_save; up in several functions/slots (variable_editor_stack::do_save): select suitable file extension for desired save format, perform the saving with Fsave; (variable_editor::edit_variable): remove connection of obsolete signal variable_editor_stack::command_signal, connect interpreter and signals mapper for saving instead; (construct_tool_bar): add button for saving with pull down menu for different formats, creating a signal mapper for the menu actions * variable-editor.h: inlcude qt-interpreter-events.h, (variable_editor_stack): remove command_signal, add slot do_save, add interpreter_event signals, slot save with format as new argument; (variable_editor): new signal mapper *m_save_mapper
author Torsten Lilge <ttl-octave@mailbox.org>
date Sun, 03 Jan 2021 20:19:04 +0100
parents bd51beb6205e
children 7854d5752dd2
line wrap: on
line diff
--- a/libgui/src/gui-preferences-ve.h	Sat Jan 02 19:30:51 2021 +0100
+++ b/libgui/src/gui-preferences-ve.h	Sun Jan 03 20:19:04 2021 +0100
@@ -70,4 +70,37 @@
     << QT_TRANSLATE_NOOP ("octave::settings_dialog", "Selected Background")
     << QT_TRANSLATE_NOOP ("octave::settings_dialog", "Alternate Background"));
 
+const QStringList ve_save_formats (QStringList ()
+                << "ascii"
+                << "binary"
+                << "float-binary"
+                << "hdf5"
+                << "float-hdf5"
+                << "text"
+                << "mat7-binary"
+                << "mat-binary"
+                << "mat4-binary"
+                << "zip");
+
+// The following list is a relation between save format and fiel extension.
+// The format string are case insensitive.
+const QStringList ve_save_formats_ext (QStringList ()
+                << "-ascii"         << "dat"
+                << "-hdf5"          << "h5"
+                << "-text"          << "txt"
+                << "-v7.3"          << "mat"
+                << "-7.3"           << "mat"
+                << "-v7"            << "mat"
+                << "-7"             << "mat"
+                << "-mat7-binary"   << "mat"
+                << "-v6"            << "mat"
+                << "-6"             << "mat"
+                << "-mat-binary"    << "mat"
+                << "-v4"            << "mat"
+                << "-4"             << "mat"
+                << "-mat4-binary"   << "mat"
+                << "-binary"        << "bin"    // after other fmt incl. "-binary"
+                << "-z"             << "txt.gz" // gzipped -text
+              );
+
 #endif