changeset 17737:d3bb7f1e3971

prevent the editor's file watcher from signaling fasle alarms (bug #40312) * file-editor-tab.cc(constructor): use polling engine for the file watcher * octave-gui.cc(message_handler): new message handler for suppressing debug- messages from QFileSystemWatcher; (octave_start_gui): install new message handler
author Torsten <ttl@justmail.de>
date Wed, 23 Oct 2013 20:50:58 +0200
parents 6a2e483125dd
children 0cfdb818ccb8
files libgui/src/m-editor/file-editor-tab.cc libgui/src/octave-gui.cc
diffstat 2 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Wed Oct 23 19:14:12 2013 +0200
+++ b/libgui/src/m-editor/file-editor-tab.cc	Wed Oct 23 20:50:58 2013 +0200
@@ -69,6 +69,7 @@
     directory.append ("/");
 
   _file_name = directory;
+  _file_system_watcher.setObjectName ("_qt_autotest_force_engine_poller");
 
   _edit_area = new octave_qscintilla (this);
   // Connect signal for command execution to a slot of this tab which in turn
--- a/libgui/src/octave-gui.cc	Wed Oct 23 19:14:12 2013 +0200
+++ b/libgui/src/octave-gui.cc	Wed Oct 23 20:50:58 2013 +0200
@@ -49,6 +49,29 @@
 #include "main-window.h"
 #include "octave-gui.h"
 
+
+// custom message handler for filtering some messages from qt
+void message_handler (QtMsgType type, const char *msg)
+ {
+     switch (type) {
+     case QtDebugMsg:
+         if (strcmp(msg,"QFileSystemWatcher: skipping native engine") > 0)
+           break;
+         fprintf(stderr, "Debug: %s\n", msg);
+         break;
+     case QtWarningMsg:
+         fprintf(stderr, "Warning: %s\n", msg);
+         break;
+     case QtCriticalMsg:
+         fprintf(stderr, "Critical: %s\n", msg);
+         break;
+     case QtFatalMsg:
+         fprintf(stderr, "Fatal: %s\n", msg);
+         abort();
+     }
+ }
+
+
 // Dissociate from the controlling terminal, if any.
 
 static void
@@ -96,6 +119,8 @@
   if (fork)
     dissociate_terminal ();
 
+  qInstallMsgHandler(message_handler);
+
   QApplication application (argc, argv);
 
   // Set the codec for all strings