26 #if defined (HAVE_CONFIG_H)
37 #include <QPushButton>
38 #include <QStringList>
50 #include "builtin-defun-decls.h"
61 Q_DECLARE_METATYPE (octave::symbol_info_list)
72 for (
const auto& s : lst)
88 for (
const auto& ext_name : lst)
95 name.replace (QRegExp (R
"(\(.*\))"), "");
96 ext.replace (
";",
" ");
101 name = ext.toUpper () +
" Files";
104 retval.append (name +
" (" + ext +
')');
112 m_uiwidget_creator (oct_qobj), m_result (), m_mutex (),
115 qRegisterMetaType<QIntList> (
"QIntList");
116 qRegisterMetaType<QFloatList> (
"QFloatList");
118 qRegisterMetaType<octave_value> (
"octave_value");
119 qRegisterMetaType<symbol_info_list> (
"symbol_info_list");
121 qRegisterMetaType<fcn_callback> (
"fcn_callback");
122 qRegisterMetaType<meth_callback> (
"meth_callback");
146 std::list<std::string>
148 const std::string& title,
149 const std::string& filename,
151 const std::string& multimode)
160 std::list<std::string> retval;
162 for (
const auto& s : lst)
163 retval.push_back (s.toStdString ());
168 std::list<std::string>
170 const std::string& title,
171 const std::list<float>& nr,
172 const std::list<float>& nc,
173 const std::list<std::string>& defaults)
178 std_list_to_qt_list<float> (nr),
179 std_list_to_qt_list<float> (nc),
181 std::list<std::string> retval;
183 for (
const auto& s : lst)
184 retval.push_back (s.toStdString ());
189 std::pair<std::list<int>,
int>
191 const std::string& mode,
192 int width,
int height,
193 const std::list<int>& initial,
194 const std::string& name,
195 const std::list<std::string>& prompt,
196 const std::string& ok_string,
197 const std::string& cancel_string)
199 QPair<QIntList, int> result
203 std_list_to_qt_list<int> (initial),
210 return std::pair<std::list<int>,
int> (std::list<int> (lst.begin (),
217 const std::string& title,
218 const std::string& btn1,
219 const std::string& btn2,
220 const std::string& btn3,
221 const std::string& btndef)
223 QString icon =
"quest";
228 role <<
"ResetRole" <<
"ResetRole" <<
"ResetRole";
244 return answer.toStdString ();
336 role <<
"YesRole" <<
"RejectRole";
337 btn << tr (
"Create") << tr (
"Cancel");
340 (tr (
"File\n%1\ndoes not exist. Do you want to create it?").
342 tr (
"Octave Editor"),
"quest", btn, tr (
"Create"), role);
344 return (answer == tr (
"Create"));
352 const std::string& dir,
361 ? tr (
"The file %1 does not exist in the load path. To run or debug the function you are editing, you must either change to the directory %2 or add that directory to the load path.").arg (qfile).arg (qdir)
362 : tr (
"The file %1 is shadowed by a file with the same name in the load path. To run or debug the function you are editing, change to the directory %2.").arg (qfile).arg (qdir));
364 QString title = tr (
"Change Directory or Add Directory to Load Path");
366 QString cd_txt = tr (
"&Change Directory");
367 QString addpath_txt = tr (
"&Add Directory to Load Path");
368 QString cancel_txt = tr (
"Cancel");
377 role <<
"AcceptRole";
380 role <<
"RejectRole";
386 if (result == cd_txt)
388 else if (result == addpath_txt)
405 QIcon icon =
m_result.value<QIcon> ();
410 QImage img = icon.pixmap (QSize (32, 32)).toImage ();
412 if (img.format () != QImage::Format_ARGB32_Premultiplied)
415 dim_vector dims (img.height (), img.width (), 4);
419 uint8_t *bits = img.bits ();
421 for (
int i = 0; i < img.height (); i++)
423 for (
int j = 0; j < img.width (); j++)
425 retval(i, j, 2) = bits[0];
426 retval(i, j, 1) = bits[1];
427 retval(i, j, 0) = bits[2];
428 retval(i, j, 3) = bits[3];
449 const std::string& value)
462 QString pref =
m_result.toString ();
464 return pref.toStdString ();
480 (
const std::string& command)
514 std::ostringstream buf;
525 ee.display (std::cerr);
530 const std::string& status)
547 const std::string& new_name)
566 bool update_variable_editor)
568 if (! top_level && ! debug)
573 if (update_variable_editor)
614 const std::string& fcn_file_name,
617 if (fcn_file_name.empty ())
640 const std::string& file,
642 const std::string& cond)
683 const QString& value)
695 if (! adjusted_value.isEmpty () && (
read_value != adjusted_value))
698 settings->setValue (key, QVariant (adjusted_value));
710 const QString& value)
714 if (value.isEmpty ())
717 QString adjusted_value = value;
724 adjusted_value = adjusted_value.toUpper ();
730 QRegExp re (
"^CP(\\d+)$");
732 if (adjusted_value ==
"SYSTEM")
734 QString (
"SYSTEM (") +
737 else if (re.indexIn (adjusted_value) > -1)
739 if (codecs.contains (
"IBM" + re.cap (1)))
740 adjusted_value =
"IBM" + re.cap (1);
741 else if (codecs.contains (
"WINDOWS-" + re.cap (1)))
742 adjusted_value =
"WINDOWS-" + re.cap (1);
744 adjusted_value.clear ();
746 else if (! codecs.contains (adjusted_value))
747 adjusted_value.clear ();
750 return adjusted_value;
Base class for Octave interfaces that use Qt.
virtual bool confirm_shutdown(void)
bool experimental_terminal_widget(void) const
resource_manager & get_resource_manager(void)
bool have_terminal_window(void) const
Vector representing the dimensions (size) of an Array.
std::list< std::pair< std::string, std::string > > filter_list
std::list< std::pair< std::string, std::string > > filter_list
void edit_file_signal(const QString &file)
void focus_window_signal(const QString &win_name)
bool edit_file(const std::string &file)
void confirm_shutdown_signal(void)
bool copy_image_to_clipboard(const std::string &file)
void interpreter_output(const std::string &msg)
void gui_status_update(const std::string &feature, const std::string &status)
void enter_debugger_signal(void)
void show_file_browser_signal(void)
void close_gui_signal(void)
void focus_window(const std::string win_name)
uint8NDArray get_named_icon(const std::string &icon_name)
void confirm_shutdown_octave(void)
void update_prompt(const std::string &prompt)
void update_breakpoint(bool insert, const std::string &file, int line, const std::string &cond)
void apply_preferences(void)
void exit_debugger_event(void)
void set_workspace(bool top_level, bool debug, const symbol_info_list &syminfo, bool update_variable_editor)
void unregister_documentation_signal(const QString &file)
void update_breakpoint_marker_signal(bool insert, const QString &file, int line, const QString &cond)
std::pair< std::list< int >, int > list_dialog(const std::list< std::string > &list, const std::string &mode, int width, int height, const std::list< int > &initial_value, const std::string &name, const std::list< std::string > &prompt, const std::string &ok_string, const std::string &cancel_string)
void enter_debugger_event(const std::string &fcn_name, const std::string &fcn_file_name, int line)
std::list< std::string > file_dialog(const filter_list &filter, const std::string &title, const std::string &filename, const std::string &pathname, const std::string &multimode)
void file_remove(const std::string &old_name, const std::string &new_name)
void show_preferences(void)
void insert_debugger_pointer_signal(const QString &, int)
void update_path_dialog(void)
int debug_cd_or_addpath_error(const std::string &file, const std::string &dir, bool addpath_option)
void gui_preference_signal(const QString &key, const QString &value)
void set_workspace_signal(bool top_level, bool debug, const symbol_info_list &syminfo)
bool prompt_new_edit_file(const std::string &file)
void show_file_browser(void)
std::string gui_preference(const std::string &key, const std::string &value)
void append_history(const std::string &hist_entry)
void delete_debugger_pointer(const std::string &file, int line)
qt_interpreter_events(base_qobject &oct_qobj)
void interpreter_output_signal(const QString &msg)
void edit_variable(const std::string &name, const octave_value &val)
void unregister_documentation(const std::string &file)
bool confirm_shutdown(void)
void directory_changed_signal(const QString &dir)
void file_remove_signal(const QString &old_name, const QString &new_name)
void directory_changed(const std::string &dir)
void apply_new_settings(void)
void register_documentation_signal(const QString &file)
void clear_workspace_signal(void)
void set_history_signal(const QStringList &hist)
void show_command_history(void)
void insert_debugger_pointer(const std::string &file, int line)
void copy_image_to_clipboard_signal(const QString &file, bool remove_file)
void clear_workspace(void)
void execute_command_in_terminal_signal(const QString &command)
void new_command_line_signal(const QString &msg=QString())
void register_documentation(const std::string &file)
void append_history_signal(const QString &hist_entry)
void get_named_icon_slot(const QString &name)
void edit_variable_signal(const QString &name, const octave_value &val)
void show_terminal_window_signal(void)
void settings_changed(const gui_settings *, bool)
void file_renamed(bool load_new=true)
void file_renamed_signal(bool load_new)
void get_named_icon_signal(const QString &name)
void update_gui_lexer(void)
void show_command_history_signal(void)
std::list< std::string > input_dialog(const std::list< std::string > &prompt, const std::string &title, const std::list< float > &nr, const std::list< float > &nc, const std::list< std::string > &defaults)
void start_gui(bool gui_app=false)
QString gui_preference_adjust(const QString &key, const QString &value)
void clear_history_signal(void)
void gui_preference_slot(const QString &key, const QString &value)
void show_preferences_signal(void)
void display_exception(const execution_exception &ee, bool beep)
void show_release_notes(void)
void refresh_variable_editor_signal(void)
QUIWidgetCreator m_uiwidget_creator
void update_prompt_signal(const QString &prompt)
bool show_documentation(const std::string &file)
void show_release_notes_signal(void)
void show_community_news_signal(int serial)
void show_workspace_signal(void)
void set_history(const string_vector &hist)
base_qobject & m_octave_qobj
void execute_command_in_terminal(const std::string &command)
void start_gui_signal(bool gui_app)
void post_input_event(void)
void exit_debugger_signal(void)
void show_documentation_signal(const QString &file)
void execute_in_debugger_event(const std::string &file, int line)
void show_terminal_window(void)
void gui_status_update_signal(const QString &feature, const QString &status)
void pre_input_event(void)
void delete_debugger_pointer_signal(const QString &, int)
void update_gui_lexer_signal(bool update_apis_only)
void show_workspace(void)
std::string question_dialog(const std::string &msg, const std::string &title, const std::string &btn1, const std::string &btn2, const std::string &btn3, const std::string &btndef)
void show_community_news(int serial)
void update_path_dialog_signal(void)
gui_settings * get_settings(void) const
void get_codecs(QStringList *codecs)
QIcon icon(const QString &icon_name, bool octave_only=false, const QString &icon_alt_name=QString())
octave_idx_type numel(void) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
std::function< void(void)> fcn_callback
std::function< void(interpreter &)> meth_callback
std::string dirname(const std::string &path)
MArray< T > filter(MArray< T > &b, MArray< T > &a, MArray< T > &x, MArray< T > &si, int dim=0)
const gui_pref ed_create_new_file("editor/create_new_file", QVariant(false))
const gui_pref ed_default_enc("editor/default_encoding", QVariant("UTF-8"))
T read_value(std::istream &is)
const char * octave_locale_charset_wrapper(void)
QString fromStdString(const std::string &s)
static QStringList make_qstring_list(const std::list< std::string > &lst)
static QStringList make_filter_list(const event_manager::filter_list &lst)
static string_vector make_absolute(const string_vector &sv)