changeset 26875:ce972086bfd6

save & run action in editor now also continues in debug mode (bug #44730) * file-editor.cc (handle_enter_debug_mode): run action stays enabled but the tooltip is updated, prevent ambigous shortcuts; (handle_exit_debug_mode): back to normal tooltip; (request_run_file): Check for debug maode and emit new signal for requesting dbcont if it is; (construct): new menu name containing continue, connect new signal to the slot of the dbcont action in main_window * file-editor.h: new signal request_dbcont_signal
author Torsten Lilge <ttl-octave@mailbox.org>
date Sun, 10 Mar 2019 19:51:26 +0100
parents 69722280102c
children 62c1443babd8
files libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h
diffstat 2 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Sun Mar 10 18:25:25 2019 +0100
+++ b/libgui/src/m-editor/file-editor.cc	Sun Mar 10 19:51:26 2019 +0100
@@ -149,14 +149,20 @@
 
   void file_editor::handle_enter_debug_mode (void)
   {
-    m_run_action->setEnabled (false);
-    m_run_action->setShortcut (QKeySequence ());
+    QSettings *settings = resource_manager::get_settings ();
+    QString sc_run = settings->value ("shortcuts/editor_run:run_file").toString ();
+    QString sc_cont = settings->value ("shortcuts/main_debug:continue").toString ();
+
+    if (sc_run == sc_cont)
+      m_run_action->setShortcut (QKeySequence ());  // prevent ambigous shortcuts
+
+    m_run_action->setToolTip (tr ("Continue"));   // update tool tip
   }
 
   void file_editor::handle_exit_debug_mode (void)
   {
-    m_run_action->setEnabled (true);
     shortcut_manager::set_shortcut (m_run_action, "editor_run:run_file");
+    m_run_action->setToolTip (tr ("Save File and Run"));  // update tool tip
   }
 
   void file_editor::check_actions (void)
@@ -541,7 +547,10 @@
 
   void file_editor::request_run_file (bool)
   {
-    emit fetab_run_file (m_tab_widget->currentWidget ());
+    if ((Fisdebugmode ())(0).is_true ())
+      emit request_dbcont_signal ();
+    else
+      emit fetab_run_file (m_tab_widget->currentWidget ());
   }
 
   void file_editor::request_step_into_file ()
@@ -2025,7 +2034,7 @@
     m_run_action
       = add_action (_run_menu,
                     resource_manager::icon ("system-run"),
-                    tr ("Save File and Run"),
+                    tr ("Save File and Run / Continue"),
                     SLOT (request_run_file (bool)));
 
     m_run_selection_action
@@ -2120,6 +2129,9 @@
              main_win (),
              SLOT (process_settings_dialog_request (const QString&)));
 
+    connect (this, SIGNAL (request_dbcont_signal (void)),
+             main_win (), SLOT (debug_continue (void)));
+
     connect (m_mru_file_menu, SIGNAL (triggered (QAction *)),
              this, SLOT (request_mru_open_file (QAction *)));
 
--- a/libgui/src/m-editor/file-editor.h	Sun Mar 10 18:25:25 2019 +0100
+++ b/libgui/src/m-editor/file-editor.h	Sun Mar 10 19:51:26 2019 +0100
@@ -177,6 +177,7 @@
     void file_loaded_signal (void);
 
     void editor_tabs_changed_signal (bool);
+    void request_dbcont_signal (void);
 
   public slots: