diff libgui/src/variable-editor.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 77ba9dfe5b29
children d8cb0f06ffb1
line wrap: on
line diff
--- a/libgui/src/variable-editor.h	Sat Jan 02 19:30:51 2021 +0100
+++ b/libgui/src/variable-editor.h	Sun Jan 03 20:19:04 2021 +0100
@@ -34,6 +34,7 @@
 #include "dw-main-window.h"
 #include "gui-settings.h"
 #include "octave-dock-widget.h"
+#include "qt-interpreter-events.h"
 #include "tab-bar.h"
 
 class octave_value;
@@ -136,9 +137,12 @@
 
   signals:
 
-    void command_signal (const QString& cmd);
+    void edit_variable_signal (const QString& name, const octave_value& val);
 
-    void edit_variable_signal (const QString& name, const octave_value& val);
+    void do_save_signal (const QString& format, const QString& save_opts);
+
+    void interpreter_event (const fcn_callback& fcn);
+    void interpreter_event (const meth_callback& meth);
 
   public slots:
 
@@ -146,7 +150,9 @@
 
     void levelUp (void);
 
-    void save (void);
+    void save (const QString& format = QString ());
+
+    void do_save (const QString& format, const QString& save_opts);
 
   private:
 
@@ -387,6 +393,7 @@
     QString m_hovered_focus_vname;
 
     QSignalMapper *m_plot_mapper;
+    QSignalMapper *m_save_mapper;
 
     QWidget *m_focus_widget;