# HG changeset patch # User John W. Eaton # Date 1383330647 14400 # Node ID 86e8dbccf7c7c240905957d879395772e9172909 # Parent eaf5c3ef3e8dba64a9de257d38a52f19bcdbc651 show when variables are complex in workspace view (bug #40445) * octave-qt-link.h, octave-qt-link.cc (octave_qt_link::do_set_workspace, octave_qt_link::set_workspace_signal): Pass complex info in set_workspace_signal. * main-window.cc (main_window::construct_octave_qt_link): Update set_workspace_signal signal to set_workspace slot connection. * workspace-model.h, workspace-model.cc (workspace_model::data): Display whether variables are complex in "Storage Class" column. (workspace_model::_complex_flags): New data member. (workspace_model::set_workspace): Store _complex_flags. (workspace_model::clear_data): Clear _complex_flags. * workspace-element.h (workspace_element::xcomplex_flags): New data member. * symtab.cc (symbol_table::do_workspace_info): Also stash complex flag. diff -r eaf5c3ef3e8d -r 86e8dbccf7c7 libgui/src/main-window.cc --- a/libgui/src/main-window.cc Fri Nov 01 12:20:18 2013 -0400 +++ b/libgui/src/main-window.cc Fri Nov 01 14:30:47 2013 -0400 @@ -987,12 +987,12 @@ SIGNAL (set_workspace_signal (bool, const QString&, const QStringList&, const QStringList&, const QStringList&, - const QStringList&)), + const QStringList&, const QIntList&)), _workspace_model, SLOT (set_workspace (bool, const QString&, const QStringList&, const QStringList&, const QStringList&, - const QStringList&))); + const QStringList&, const QIntList&))); connect (_octave_qt_link, SIGNAL (clear_workspace_signal ()), _workspace_model, SLOT (clear_workspace ())); diff -r eaf5c3ef3e8d -r 86e8dbccf7c7 libgui/src/octave-qt-link.cc --- a/libgui/src/octave-qt-link.cc Fri Nov 01 12:20:18 2013 -0400 +++ b/libgui/src/octave-qt-link.cc Fri Nov 01 14:30:47 2013 -0400 @@ -325,6 +325,7 @@ QStringList class_names; QStringList dimensions; QStringList values; + QIntList complex_flags; for (std::list::const_iterator it = ws.begin (); it != ws.end (); it++) @@ -334,10 +335,11 @@ class_names.append (QString::fromStdString (it->class_name ())); dimensions.append (QString::fromStdString (it->dimension ())); values.append (QString::fromStdString (it->value ())); + complex_flags.append (it->complex_flag ()); } emit set_workspace_signal (top_level, scopes, symbols, class_names, - dimensions, values); + dimensions, values, complex_flags); } void diff -r eaf5c3ef3e8d -r 86e8dbccf7c7 libgui/src/octave-qt-link.h --- a/libgui/src/octave-qt-link.h Fri Nov 01 12:20:18 2013 -0400 +++ b/libgui/src/octave-qt-link.h Fri Nov 01 14:30:47 2013 -0400 @@ -35,6 +35,9 @@ #include "octave-link.h" #include "octave-main-thread.h" +// Defined for purposes of sending QList as part of signal. +typedef QList QIntList; + // \class OctaveLink // \brief Provides threadsafe access to octave. // \author Jacob Dawid @@ -153,7 +156,8 @@ const QStringList& symbols, const QStringList& class_names, const QStringList& dimensions, - const QStringList& values); + const QStringList& values, + const QIntList& complex_flags); void clear_workspace_signal (void); diff -r eaf5c3ef3e8d -r 86e8dbccf7c7 libgui/src/workspace-model.cc --- a/libgui/src/workspace-model.cc Fri Nov 01 12:20:18 2013 -0400 +++ b/libgui/src/workspace-model.cc Fri Nov 01 14:30:47 2013 -0400 @@ -166,16 +166,7 @@ break; case 4: - retval = QVariant (); - QString class_chars = resource_manager::storage_class_chars (); - int actual_class - = class_chars.indexOf (_scopes[idx.row ()].toAscii ()); - if (actual_class >= 0) - { - QStringList class_names - = resource_manager::storage_class_names (); - retval = QVariant (class_names.at (actual_class)); - } + retval = QVariant (_complex_flags[idx.row ()] ? "complex" : ""); break; } @@ -217,7 +208,8 @@ const QStringList& symbols, const QStringList& class_names, const QStringList& dimensions, - const QStringList& values) + const QStringList& values, + const QIntList& complex_flags) { _top_level = top_level; _scopes = scopes; @@ -225,6 +217,7 @@ _class_names = class_names; _dimensions = dimensions; _values = values; + _complex_flags = complex_flags; update_table (); @@ -249,6 +242,7 @@ _class_names = QStringList (); _dimensions = QStringList (); _values = QStringList (); + _complex_flags = QIntList (); } void diff -r eaf5c3ef3e8d -r 86e8dbccf7c7 libgui/src/workspace-model.h --- a/libgui/src/workspace-model.h Fri Nov 01 12:20:18 2013 -0400 +++ b/libgui/src/workspace-model.h Fri Nov 01 14:30:47 2013 -0400 @@ -33,6 +33,9 @@ #include #include +// Defined for purposes of sending QList as part of signal. +typedef QList QIntList; + class workspace_model : public QAbstractTableModel { @@ -74,7 +77,8 @@ const QStringList& symbols, const QStringList& class_names, const QStringList& dimensions, - const QStringList& values); + const QStringList& values, + const QIntList& complex_flags); void clear_workspace (void); @@ -97,6 +101,7 @@ QStringList _class_names; QStringList _dimensions; QStringList _values; + QIntList _complex_flags; QStringList _columnNames; diff -r eaf5c3ef3e8d -r 86e8dbccf7c7 libinterp/corefcn/symtab.cc --- a/libinterp/corefcn/symtab.cc Fri Nov 01 12:20:18 2013 -0400 +++ b/libinterp/corefcn/symtab.cc Fri Nov 01 14:30:47 2013 -0400 @@ -1419,7 +1419,8 @@ storage = 'i'; workspace_element elt (storage, nm, val.class_name (), - val.short_disp (), dv.str ()); + val.short_disp (), dv.str (), + val.is_complex_type ()); retval.push_back (elt); } diff -r eaf5c3ef3e8d -r 86e8dbccf7c7 libinterp/corefcn/workspace-element.h --- a/libinterp/corefcn/workspace-element.h Fri Nov 01 12:20:18 2013 -0400 +++ b/libinterp/corefcn/workspace-element.h Fri Nov 01 14:30:47 2013 -0400 @@ -33,16 +33,17 @@ const std::string& symbol_arg = "", const std::string& class_name_arg = "", const std::string& value_arg = "", - const std::string& dimension_arg = "") + const std::string& dimension_arg = "", + bool complex_flag_arg = false) : xscope (scope_arg), xsymbol (symbol_arg), xclass_name (class_name_arg), xvalue (value_arg), - xdimension (dimension_arg) + xdimension (dimension_arg), xcomplex_flag (complex_flag_arg) { } workspace_element (const workspace_element& ws_elt) : xscope (ws_elt.xscope), xsymbol (ws_elt.xsymbol), xclass_name (ws_elt.xclass_name), xvalue (ws_elt.xvalue), - xdimension (ws_elt.xdimension) + xdimension (ws_elt.xdimension), xcomplex_flag (ws_elt.xcomplex_flag) { } workspace_element operator = (const workspace_element& ws_elt) @@ -54,6 +55,7 @@ xclass_name = ws_elt.xclass_name; xvalue = ws_elt.xvalue; xdimension = ws_elt.xdimension; + xcomplex_flag = ws_elt.xcomplex_flag; } return *this; @@ -71,6 +73,8 @@ std::string dimension (void) const { return xdimension; } + bool complex_flag (void) const { return xcomplex_flag; } + private: // [g]lobal, [p]ersistent, [l]ocal @@ -79,6 +83,7 @@ std::string xclass_name; std::string xvalue; std::string xdimension; + bool xcomplex_flag; }; #endif