# HG changeset patch # User John W. Eaton # Date 1623993646 14400 # Node ID 02461b0ccc002ff78c0884a825dd755632168096 # Parent 6cbd169e391b13271d41b3ec1778d2de20228180 reduce dependence of files_dock_widget on Octave interpreter * files-dock-widget.h, files-dock-widget.cc: Don't include interpreter.h or load-save.h. (files_dock_widget::modify_path_signal): Use QStringList to pass list of directory names, not octave_value_list. Change all uses. * main-window.h, main-window.cc (main_window::modify_path): Use QStringList to pass list of directory names, not octave_value_list. Change all uses. * set-path-dialog.h, set-path-dialog.cc (set_path_dialog::modify_path_signal): Use QStringList to pass list of directory names, not octave_value_list. Change all uses. diff -r 6cbd169e391b -r 02461b0ccc00 libgui/src/files-dock-widget.cc --- a/libgui/src/files-dock-widget.cc Fri Jun 18 22:50:59 2021 +0200 +++ b/libgui/src/files-dock-widget.cc Fri Jun 18 01:20:46 2021 -0400 @@ -51,8 +51,6 @@ #include "octave-qtutils.h" #include "qt-interpreter-events.h" -#include "interpreter.h" -#include "load-save.h" #include "oct-env.h" namespace octave @@ -861,10 +859,10 @@ { QList infos = get_selected_items_info (true); - octave_value_list dir_list = ovl (); + QStringList dir_list; for (int i = 0; i < infos.length (); i++) - dir_list.append (infos.at (i).absoluteFilePath ().toStdString ()); + dir_list.append (infos.at (i).absoluteFilePath ()); if (infos.length () > 0) emit modify_path_signal (dir_list, rm, subdirs); diff -r 6cbd169e391b -r 02461b0ccc00 libgui/src/files-dock-widget.h --- a/libgui/src/files-dock-widget.h Fri Jun 18 22:50:59 2021 +0200 +++ b/libgui/src/files-dock-widget.h Fri Jun 18 01:20:46 2021 -0400 @@ -44,8 +44,6 @@ #include "octave-dock-widget.h" -class octave_value_list; - namespace octave { class base_qobject; @@ -98,8 +96,8 @@ //! Emitted, when the path has to be modified - void modify_path_signal (const octave_value_list& dir_list, - bool rm, bool subdirs); + void modify_path_signal (const QStringList& dir_list, bool rm, + bool subdirs); public slots: diff -r 6cbd169e391b -r 02461b0ccc00 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Fri Jun 18 22:50:59 2021 +0200 +++ b/libgui/src/main-window.cc Fri Jun 18 01:20:46 2021 -0400 @@ -647,7 +647,7 @@ emit undo_signal (); } - void main_window::modify_path (const octave_value_list& dir_list, + void main_window::modify_path (const QStringList& dir_list, bool rm, bool subdirs) { emit interpreter_event @@ -655,16 +655,18 @@ { // INTERPRETER THREAD - octave_value_list paths = ovl (); - - if (subdirs) + octave_value_list paths; + + // Loop over all directories in order to get all subdirs + for (octave_idx_type i = 0; i < dir_list.length (); i++) { - // Loop over all directories in order to get all subdirs - for (octave_idx_type i = 0; i < dir_list.length (); i++) - paths.append (Fgenpath (dir_list(i))); + std::string dir = dir_list.at(i).toStdString (); + + if (subdirs) + paths.append (Fgenpath (ovl (dir))); + else + paths.append (dir); } - else - paths = dir_list; if (rm) Frmpath (interp, paths); diff -r 6cbd169e391b -r 02461b0ccc00 libgui/src/main-window.h --- a/libgui/src/main-window.h Fri Jun 18 22:50:59 2021 +0200 +++ b/libgui/src/main-window.h Fri Jun 18 01:20:46 2021 -0400 @@ -143,7 +143,7 @@ void handle_clear_command_window_request (void); void handle_clear_history_request (void); void handle_undo_request (void); - void modify_path (const octave_value_list& dir_list, bool rm, bool subdirs); + void modify_path (const QStringList& dir_list, bool rm, bool subdirs); void edit_mfile (const QString&, int); void file_remove_proxy (const QString& o, const QString& n); void open_online_documentation_page (void); diff -r 6cbd169e391b -r 02461b0ccc00 libgui/src/set-path-dialog.cc --- a/libgui/src/set-path-dialog.cc Fri Jun 18 22:50:59 2021 +0200 +++ b/libgui/src/set-path-dialog.cc Fri Jun 18 01:20:46 2021 -0400 @@ -194,9 +194,7 @@ { // Use existing method mofifying load path and updating dialog // instead of adding string and updating load path - octave_value_list dirlist = ovl (); - dirlist.append (dir.toStdString ()); - emit modify_path_signal (dirlist, false, true); + emit modify_path_signal (QStringList (dir), false, true); } else { diff -r 6cbd169e391b -r 02461b0ccc00 libgui/src/set-path-dialog.h --- a/libgui/src/set-path-dialog.h Fri Jun 18 22:50:59 2021 +0200 +++ b/libgui/src/set-path-dialog.h Fri Jun 18 01:20:46 2021 -0400 @@ -63,8 +63,8 @@ //! Emitted, when the path has to be modified - void modify_path_signal (const octave_value_list& dir_list, - bool rm, bool subdirs); + void modify_path_signal (const QStringList& dir_list, bool rm, + bool subdirs); void interpreter_event (const fcn_callback& fcn); void interpreter_event (const meth_callback& meth);