Mercurial > octave
changeset 25067:e909207e9ff1
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 30 Mar 2018 17:47:12 -0400 |
parents | 4c2ca91a790f (current diff) b940e457e11f (diff) |
children | 56b26a3376d0 |
files | |
diffstat | 23 files changed, 284 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgsub Fri Mar 30 09:20:24 2018 -0400 +++ b/.hgsub Fri Mar 30 17:47:12 2018 -0400 @@ -1,1 +1,1 @@ -gnulib = http://hg.octave.org/gnulib +gnulib = http://hg-new.octave.org/gnulib
--- a/.hgsubstate Fri Mar 30 09:20:24 2018 -0400 +++ b/.hgsubstate Fri Mar 30 17:47:12 2018 -0400 @@ -1,1 +1,1 @@ -733fbf6b39bc505d2717f25e8b7d114aeaa94098 gnulib +791f51373ba1b80c8ae3b7a9d2509d8a827a3e25 gnulib
--- a/libgui/graphics/ObjectProxy.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/graphics/ObjectProxy.cc Fri Mar 30 17:47:12 2018 -0400 @@ -129,7 +129,23 @@ QMetaObject::invokeMethod (m_object, "slotGetPixels", t, Q_RETURN_ARG (uint8NDArray, retval)); - return retval; - } + // FIXME: The following may fail for obscure reasons, see bug #53328. + // In absence of a solution, we retry twice before calling error(). + if (! QMetaObject::invokeMethod (m_object, "slotGetPixels", t, + Q_RETURN_ARG (uint8NDArray, retval))) + { + QThread::msleep (100); + if (! QMetaObject::invokeMethod (m_object, "slotGetPixels", t, + Q_RETURN_ARG (uint8NDArray, retval))) + { + QThread::msleep (200); + if (! QMetaObject::invokeMethod (m_object, "slotGetPixels", t, + Q_RETURN_ARG (uint8NDArray, retval))) + error ("getframe: unable to retrieve figure pixels"); + } + } + + return retval; + } };
--- a/libgui/src/documentation-dock-widget.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/documentation-dock-widget.cc Fri Mar 30 17:47:12 2018 -0400 @@ -45,6 +45,12 @@ connect (p, SIGNAL (show_doc_signal (const QString&)), this, SLOT (showDoc (const QString&))); + + connect (p, SIGNAL (register_doc_signal (const QString&)), + this, SLOT (registerDoc (const QString&))); + + connect (p, SIGNAL (unregister_doc_signal (const QString&)), + this, SLOT (unregisterDoc (const QString&))); } documentation_dock_widget::~documentation_dock_widget (void) @@ -83,4 +89,14 @@ m_docs->load_ref (name); } + + void documentation_dock_widget::registerDoc (const QString& name) + { + m_docs->registerDoc (name); + } + + void documentation_dock_widget::unregisterDoc (const QString& name) + { + m_docs->unregisterDoc (name); + } }
--- a/libgui/src/documentation-dock-widget.h Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/documentation-dock-widget.h Fri Mar 30 17:47:12 2018 -0400 @@ -48,6 +48,8 @@ void selectAll (void); void showDoc (const QString & name); + void registerDoc (const QString & name); + void unregisterDoc (const QString & name); private:
--- a/libgui/src/documentation.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/documentation.cc Fri Mar 30 17:47:12 2018 -0400 @@ -24,8 +24,15 @@ # include "config.h" #endif +#include "defaults.h" +#include "file-ops.h" +#include "oct-env.h" + #include <QApplication> #include <QCompleter> +#include <QDir> +#include <QFile> +#include <QFileInfo> #include <QHelpContentWidget> #include <QHelpIndexWidget> #include <QHelpSearchEngine> @@ -33,8 +40,8 @@ #include <QHelpSearchResultWidget> #include <QLabel> #include <QLineEdit> +#include <QMessageBox> #include <QTabWidget> -#include <QMessageBox> #include <QVBoxLayout> #include "documentation.h" @@ -46,10 +53,28 @@ documentation::documentation (QWidget *p) : QSplitter (Qt::Horizontal, p) { + // Get original collection QString collection = getenv ("OCTAVE_QTHELP_COLLECTION"); + if (collection.isEmpty ()) + collection = QString::fromStdString (octave::config::oct_doc_dir () + + octave::sys::file_ops::dir_sep_str () + + "octave_interpreter.qhc"); + + // Setup the help engine with the original collection, use a writable copy + // of the original collection and load the help data + m_help_engine = new QHelpEngine (collection, this); - // Setup the help engine and load the help data - m_help_engine = new QHelpEngine (collection, this); + std::string tmpdir (octave::sys::env::getenv ("TMPDIR")); + m_collection + = QString::fromStdString (octave::sys::tempnam (tmpdir, "oct-qhelp-")); + + if (m_help_engine->copyCollectionFile (m_collection)) + m_help_engine->setCollectionFile (m_collection); + else + QMessageBox::warning (this, tr ("Octave Documentation"), + tr ("Could not copy help collection to temporary\n" + "file. Search capabilities may be affected.\n" + "%1").arg (m_help_engine->error ())); connect(m_help_engine, SIGNAL(setupFinished()), m_help_engine->searchEngine(), SLOT(indexDocumentation())); @@ -162,13 +187,37 @@ documentation::~documentation (void) { if (m_help_engine) - delete m_help_engine; + { + delete m_help_engine; + + // Cleanup temporary file and directory + QFile file (m_collection); + QFileInfo finfo (file); + QString bname = finfo.fileName (); + QDir dir = finfo.absoluteDir (); + dir.setFilter (QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden); + QStringList namefilter; + namefilter.append ("*" + bname + "*"); + foreach (QFileInfo fi, dir.entryInfoList (namefilter)) + { + QDir tmpdir (fi.absoluteFilePath ()); + tmpdir.removeRecursively (); + } + + file.remove(); + } } void documentation::global_search (void) { +#if defined (HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT) + QString queries + = m_help_engine->searchEngine ()->queryWidget ()->searchInput (); +#else QList<QHelpSearchQuery> queries = m_help_engine->searchEngine ()->queryWidget ()->query (); +#endif + m_help_engine->searchEngine ()->search (queries); } @@ -225,6 +274,47 @@ m_filter->setCurrentIndex (0); } + void documentation::registerDoc (const QString& qch) + { + if (m_help_engine) + { + QString ns = m_help_engine->namespaceName (qch); + bool do_setup = true; + if (m_help_engine->registeredDocumentations ().contains (ns)) + { + if (m_help_engine->documentationFileName (ns) == qch) + do_setup = false; + else + { + m_help_engine->unregisterDocumentation (ns); + m_help_engine->registerDocumentation (qch); + } + } + else if (! m_help_engine->registerDocumentation (qch)) + { + QMessageBox::warning (this, tr ("Octave Documentation"), + tr ("Unable to register help file %1."). + arg (qch)); + do_setup = false; + return; + } + + if (do_setup) + m_help_engine->setupData(); + } + } + + void documentation::unregisterDoc (const QString& qch) + { + QString ns = m_help_engine->namespaceName (qch); + if (m_help_engine + && m_help_engine->registeredDocumentations ().contains (ns) + && m_help_engine->documentationFileName (ns) == qch) + { + m_help_engine->unregisterDocumentation (ns); + m_help_engine->setupData (); + } + } // The documentation browser
--- a/libgui/src/documentation.h Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/documentation.h Fri Mar 30 17:47:12 2018 -0400 @@ -76,6 +76,8 @@ void selectAll (void); void load_ref (const QString & name); + void registerDoc (const QString & name); + void unregisterDoc (const QString & name); private slots: @@ -90,6 +92,7 @@ QHelpEngine *m_help_engine; documentation_browser *m_doc_browser; QComboBox *m_filter; + QString m_collection; };
--- a/libgui/src/m-editor/file-editor-tab.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/m-editor/file-editor-tab.cc Fri Mar 30 17:47:12 2018 -0400 @@ -2242,7 +2242,7 @@ { QMessageBox::critical (nullptr, tr ("Octave Editor"), - tr ("The current codec %1\n" + tr ("The current encoding %1\n" "can not be applied.\n\n" "Please select another one or cancel saving!").arg (_encoding)); @@ -2254,9 +2254,9 @@ int ans = QMessageBox::warning (nullptr, tr ("Octave Editor"), tr ("The current editor contents can not be encoded\n" - "with the selected codec %1.\n" + "with the selected encoding %1.\n" "Using it will result in data loss!\n\n" - "Do you want to chose another codec?").arg (_encoding), + "Do you want to chose another encoding?").arg (_encoding), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); if (ans == QMessageBox::Yes)
--- a/libgui/src/m-editor/file-editor.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/m-editor/file-editor.cc Fri Mar 30 17:47:12 2018 -0400 @@ -1740,7 +1740,7 @@ m_conv_eol_windows_action = add_action (m_edit_fmt_menu, - tr ("convert line endings to &windows (crlf)"), + tr ("Convert Line Endings to &Windows (CRLF)"), SLOT (request_conv_eol_windows (bool))); m_conv_eol_unix_action @@ -2238,7 +2238,7 @@ // configure and show active actions of mru-menu for (int i = 0; i < num_files; ++i) { - QString text = tr ("&%1 %2"). + QString text = QString ("&%1 %2"). arg ((i+1) % int (MaxMRUFiles)).arg (m_mru_files.at (i)); m_mru_file_actions[i]->setText (text);
--- a/libgui/src/main-window.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/main-window.cc Fri Mar 30 17:47:12 2018 -0400 @@ -1476,6 +1476,16 @@ emit show_doc_signal (file); } + void main_window::handle_register_doc (const QString& file) + { + emit register_doc_signal (file); + } + + void main_window::handle_unregister_doc (const QString& file) + { + emit unregister_doc_signal (file); + } + void main_window::handle_octave_ready (void) { // actions after the startup files are executed @@ -1984,6 +1994,14 @@ connect (m_octave_qt_link, SIGNAL (show_doc_signal (const QString &)), this, SLOT (handle_show_doc (const QString &))); + + connect (m_octave_qt_link, + SIGNAL (register_doc_signal (const QString &)), + this, SLOT (handle_register_doc (const QString &))); + + connect (m_octave_qt_link, + SIGNAL (unregister_doc_signal (const QString &)), + this, SLOT (handle_unregister_doc (const QString &))); } // Defer initializing and executing the interpreter until after the main
--- a/libgui/src/main-window.h Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/main-window.h Fri Mar 30 17:47:12 2018 -0400 @@ -127,6 +127,8 @@ void open_file_signal (const QString& file, const QString& enc, int line); void show_doc_signal (const QString&); + void register_doc_signal (const QString&); + void unregister_doc_signal (const QString&); void insert_debugger_pointer_signal (const QString& file, int line); void delete_debugger_pointer_signal (const QString& file, int line); @@ -243,6 +245,8 @@ const QString& multimode); void handle_show_doc (const QString& file); + void handle_register_doc (const QString& file); + void handle_unregister_doc (const QString& file); void handle_octave_ready (); void handle_octave_finished (int);
--- a/libgui/src/octave-qt-link.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/octave-qt-link.cc Fri Mar 30 17:47:12 2018 -0400 @@ -587,6 +587,16 @@ emit show_doc_signal (QString::fromStdString (file)); } + void octave_qt_link::do_register_doc (const std::string& file) + { + emit register_doc_signal (QString::fromStdString (file)); + } + + void octave_qt_link::do_unregister_doc (const std::string& file) + { + emit unregister_doc_signal (QString::fromStdString (file)); + } + void octave_qt_link::do_edit_variable (const std::string& expr, const octave_value& val) {
--- a/libgui/src/octave-qt-link.h Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/octave-qt-link.h Fri Mar 30 17:47:12 2018 -0400 @@ -142,6 +142,8 @@ void do_show_preferences (void); void do_show_doc (const std::string& file); + void do_register_doc (const std::string& file); + void do_unregister_doc (const std::string& file); void do_edit_variable (const std::string& name, const octave_value& val); @@ -196,6 +198,10 @@ void show_doc_signal (const QString& file); + void register_doc_signal (const QString& file); + + void unregister_doc_signal (const QString& file); + void edit_variable_signal (const QString& name, const octave_value& val); void refresh_variable_editor_signal (void);
--- a/libgui/src/settings-dialog.ui Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/settings-dialog.ui Fri Mar 30 17:47:12 2018 -0400 @@ -1168,7 +1168,7 @@ <string>This works well for monospaced fonts. The line is drawn at a position based on the width of a space character in the default font. It may not work very well if styles use proportional fonts or if varied font sizes or bold, italic and normal texts are used.</string> </property> <property name="text"> - <string>Wrap long lines at curent window border</string> + <string>Wrap long lines at current window border</string> </property> <property name="checked"> <bool>false</bool>
--- a/libgui/src/variable-editor.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libgui/src/variable-editor.cc Fri Mar 30 17:47:12 2018 -0400 @@ -359,8 +359,8 @@ QString file = QFileDialog::getSaveFileName (this, tr ("Save Variable %1 As").arg (name), - /* Should determine extension from save_default_options */ - tr ("./%1.txt").arg (name), + // FIXME: Should determine extension from save_default_options + QString ("./%1.txt").arg (name), 0, 0, QFileDialog::DontUseNativeDialog);
--- a/libinterp/corefcn/__betainc__.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libinterp/corefcn/__betainc__.cc Fri Mar 30 17:47:12 2018 -0400 @@ -5,9 +5,9 @@ This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it +Octave is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or +the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Octave is distributed in the hope that it will be useful, but @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. +<https://www.gnu.org/licenses/>. */
--- a/libinterp/corefcn/__expint__.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libinterp/corefcn/__expint__.cc Fri Mar 30 17:47:12 2018 -0400 @@ -4,9 +4,9 @@ This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it +Octave is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or +the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Octave is distributed in the hope that it will be useful, but @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. +<https://www.gnu.org/licenses/>. */
--- a/libinterp/corefcn/__gammainc__.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libinterp/corefcn/__gammainc__.cc Fri Mar 30 17:47:12 2018 -0400 @@ -6,9 +6,9 @@ This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it +Octave is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or +the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Octave is distributed in the hope that it will be useful, but @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. +<https://www.gnu.org/licenses/>. */
--- a/libinterp/corefcn/gl-render.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libinterp/corefcn/gl-render.cc Fri Mar 30 17:47:12 2018 -0400 @@ -2018,6 +2018,7 @@ // display them in the order they were added to the array. num_lights = 0; + current_light = GL_LIGHT0; draw_all_lights (props, obj_list); // disable other OpenGL lights
--- a/libinterp/corefcn/interpreter.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libinterp/corefcn/interpreter.cc Fri Mar 30 17:47:12 2018 -0400 @@ -478,7 +478,8 @@ if (options.echo_commands ()) m_evaluator.echo - (tree_evaluator::ECHO_SCRIPTS | tree_evaluator::ECHO_FUNCTIONS); + (tree_evaluator::ECHO_SCRIPTS | tree_evaluator::ECHO_FUNCTIONS + | tree_evaluator::ECHO_ALL); std::string docstrings_file = options.docstrings_file (); if (! docstrings_file.empty ())
--- a/libinterp/corefcn/octave-link.cc Fri Mar 30 09:20:24 2018 -0400 +++ b/libinterp/corefcn/octave-link.cc Fri Mar 30 17:47:12 2018 -0400 @@ -432,3 +432,31 @@ return ovl (octave_link::show_doc (file)); } + +DEFUN (__octave_link_register_doc__, args, , + doc: /* -*- texinfo -*- +@deftypefn {} {} __octave_link_register_doc__ (@var{filename}) +Undocumented internal function. +@end deftypefn */) +{ + std::string file; + + if (args.length () >= 1) + file = args(0).string_value(); + + return ovl (octave_link::register_doc (file)); +} + +DEFUN (__octave_link_unregister_doc__, args, , + doc: /* -*- texinfo -*- +@deftypefn {} {} __octave_link_unregister_doc__ (@var{filename}) +Undocumented internal function. +@end deftypefn */) +{ + std::string file; + + if (args.length () >= 1) + file = args(0).string_value(); + + return ovl (octave_link::unregister_doc (file)); +}
--- a/libinterp/corefcn/octave-link.h Fri Mar 30 09:20:24 2018 -0400 +++ b/libinterp/corefcn/octave-link.h Fri Mar 30 17:47:12 2018 -0400 @@ -426,6 +426,30 @@ } else return false; + } + + static bool + register_doc (const std::string & file) + { + if (enabled ()) + { + instance->do_register_doc (file); + return true; + } + else + return false; + } + + static bool + unregister_doc (const std::string & file) + { + if (enabled ()) + { + instance->do_unregister_doc (file); + return true; + } + else + return false; } @@ -602,6 +626,10 @@ virtual void do_show_doc (const std::string& file) = 0; + virtual void do_register_doc (const std::string& file) = 0; + + virtual void do_unregister_doc (const std::string& file) = 0; + virtual void do_edit_variable (const std::string& name, const octave_value& val) = 0; };
--- a/m4/acinclude.m4 Fri Mar 30 09:20:24 2018 -0400 +++ b/m4/acinclude.m4 Fri Mar 30 17:47:12 2018 -0400 @@ -467,6 +467,38 @@ fi ]) dnl +dnl Check whether the Qt QHelpSearchQueryWidget class has the searchInput +dnl member function. This function was introduced in Qt 5.9. +dnl +dnl FIXME: Delete this entirely when we drop support for Qt 5.8 or older. +dnl +AC_DEFUN([OCTAVE_CHECK_FUNC_QHELPSEARCHQUERYWIDGET_SEARCHINPUT], [ + AC_CACHE_CHECK([for QHelpSearchQueryWidget::searchInput], + [octave_cv_func_qhelpsearchquerywidget_searchinput], + [AC_LANG_PUSH(C++) + ac_octave_save_CPPFLAGS="$CPPFLAGS" + ac_octave_save_CXXFLAGS="$CXXFLAGS" + CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS" + CXXFLAGS="$CXXPICFLAG $CPPFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include <QHelpSearchQueryWidget> + #include <QString> + ]], [[ + QHelpSearchQueryWidget *query_widget = new QHelpSearchQueryWidget (); + QString search_input = query_widget->searchInput (); + ]])], + octave_cv_func_qhelpsearchquerywidget_searchinput=yes, + octave_cv_func_qhelpsearchquerywidget_searchinput=no) + CPPFLAGS="$ac_octave_save_CPPFLAGS" + CXXFLAGS="$ac_octave_save_CXXFLAGS" + AC_LANG_POP(C++) + ]) + if test $octave_cv_func_qhelpsearchquerywidget_searchinput = yes; then + AC_DEFINE(HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT, 1, + [Define to 1 if you have the `QHelpSearchQueryWidget::searchInput' member function.]) + fi +]) +dnl dnl Check whether the Qt function qInstallMessageHandler is available. dnl This function was introduced in Qt 5. dnl @@ -1761,7 +1793,7 @@ #if defined (HAVE_QOFFSCREENSURFACE) # include <QOffscreenSurface> #endif - QOpenGLContext ctx; + QOpenGLContext ctx; QOffscreenSurface surf; ]])], octave_cv_qt_opengl_os_ok=yes, @@ -1955,7 +1987,7 @@ else LRELEASE="$LRELEASE_QTVER" fi - + AC_CHECK_TOOLS(QCOLLECTIONGENERATOR_QTVER, [qcollectiongenerator-qt$qt_version]) if test -z "$QCOLLECTIONGENERATOR_QTVER"; then AC_CHECK_TOOLS(QCOLLECTIONGENERATOR, [qcollectiongenerator]) @@ -2064,6 +2096,7 @@ OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONRESIZEMODE OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONSCLICKABLE OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONSMOVABLE + OCTAVE_CHECK_FUNC_QHELPSEARCHQUERYWIDGET_SEARCHINPUT OCTAVE_CHECK_FUNC_QINSTALLMESSAGEHANDLER OCTAVE_CHECK_FUNC_QLINEEDIT_SETPLACEHOLDERTEXT OCTAVE_CHECK_FUNC_QMOUSEEVENT_LOCALPOS