diff libgui/src/resource-manager.cc @ 22250:2fd4f1a3f4a8

allow building with Qt5 (bug #40252) * acinclude.m4 (OCTAVE_CHECK_QT_VERSION): Define HAVE_QT4 or HAVE_QT5. Also check for Qt5PrintSupport when using Qt5. * Canvas.cc, Object.cc, QTerminal.cc, TerminalView.cpp, Vt102Emulation.cpp, konsole_wcwidth.h, find-files-dialog.cc, file-editor-tab.cc, file-editor.cc, find-dialog.cc, octave-gui.cc, resource-manager.cc, shortcut-manager.cc, workspace-model.cc, workspace-view.cc: Adapt to Qt5 API changes.
author John W. Eaton <jwe@octave.org>
date Wed, 10 Aug 2016 03:54:42 -0400
parents 6e9f5408c0db
children bac0d6f07a3e
line wrap: on
line diff
--- a/libgui/src/resource-manager.cc	Wed Aug 10 09:09:41 2016 +0200
+++ b/libgui/src/resource-manager.cc	Wed Aug 10 03:54:42 2016 -0400
@@ -31,6 +31,9 @@
 #include <QNetworkProxy>
 #include <QLibraryInfo>
 #include <QMessageBox>
+#if defined (HAVE_QT5)
+#  include <QStandardPaths>
+#endif
 #include <QTextCodec>
 
 #include "error.h"
@@ -61,10 +64,13 @@
   : settings_directory (), settings_file (), settings (0),
     default_settings (0)
 {
-  QDesktopServices desktopServices;
-
+#if defined (HAVE_QT4)
   QString home_path
-    = desktopServices.storageLocation (QDesktopServices::HomeLocation);
+    = QDesktopServices::storageLocation (QDesktopServices::HomeLocation);
+#else
+  QString home_path
+    = QStandardPaths::writableLocation (QStandardPaths::HomeLocation);
+#endif
 
   settings_directory = home_path + "/.config/octave";