diff m4/acinclude.m4 @ 25046:a4c687fec320 stable

gui: set Qt Application and Desktop metadata for desktop integration (bug #53102) * main-window.cc (main_window::main_window): Initialize Qt application and desktop integration metadata. * org.octave.Octave.desktop.in (StartupWMClass): Use new WM_CLASS name set from QCoreApplication::applicationName under XCB/X11. * acinclude.m4 (OCTAVE_CHECK_FUNC_QGUIAPPLICATION_SETDESKTOPFILENAME): New macro. (OCTAVE_CHECK_QT_VERSION): Use it.
author Mike Miller <mtmiller@octave.org>
date Wed, 28 Mar 2018 14:38:43 -0700
parents ba5af45bbfc4
children 1fe6002f68a7
line wrap: on
line diff
--- a/m4/acinclude.m4	Wed Mar 28 17:36:40 2018 -0400
+++ b/m4/acinclude.m4	Wed Mar 28 14:38:43 2018 -0700
@@ -344,6 +344,36 @@
   fi
 ])
 dnl
+dnl Check whether the Qt QGuiApplication class has the setDesktopFileName
+dnl static member function.  This function was introduced in Qt 5.7.
+dnl
+dnl FIXME: Delete this entirely when we drop support for Qt 5.6 or older.
+dnl
+AC_DEFUN([OCTAVE_CHECK_FUNC_QGUIAPPLICATION_SETDESKTOPFILENAME], [
+  AC_CACHE_CHECK([for QGuiApplication::setDesktopFileName],
+    [octave_cv_func_qguiapplication_setdesktopfilename],
+    [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 <QGuiApplication>
+        ]], [[
+        QGuiApplication::setDesktopFileName ("com.example.Example.desktop");
+        ]])],
+      octave_cv_func_qguiapplication_setdesktopfilename=yes,
+      octave_cv_func_qguiapplication_setdesktopfilename=no)
+    CPPFLAGS="$ac_octave_save_CPPFLAGS"
+    CXXFLAGS="$ac_octave_save_CXXFLAGS"
+    AC_LANG_POP(C++)
+  ])
+  if test $octave_cv_func_qguiapplication_setdesktopfilename = yes; then
+    AC_DEFINE(HAVE_QGUIAPPLICATION_SETDESKTOPFILENAME, 1,
+      [Define to 1 if you have the `QGuiApplication::setDesktopFileName' member function.])
+  fi
+])
+dnl
 dnl Check whether the Qt QHeaderView class has the setSectionResizeMode
 dnl function.  This function was introduced in Qt 5.
 dnl
@@ -2026,6 +2056,7 @@
     ## tests if they fail because we have already decided that the Qt
     ## version that we are testing now will be the one used.
 
+    OCTAVE_CHECK_FUNC_QGUIAPPLICATION_SETDESKTOPFILENAME
     OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONRESIZEMODE
     OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONSCLICKABLE
     OCTAVE_CHECK_FUNC_QHEADERVIEW_SETSECTIONSMOVABLE