From 56ac228543b42767da26469c30d263f28c855f00 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 12 Oct 2017 16:01:24 +0200 Subject: [PATCH] add cmake option to use Qt or native file dialogs --- CMakeLists.txt | 5 +++++ src/Gui/CMakeLists.txt | 4 ++++ src/Gui/FileDialog.cpp | 4 ---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a90310e4bd..d2033f0bf4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -170,6 +170,11 @@ OPTION(FREECAD_USE_EXTERNAL_SMESH "Use system installed smesh instead of the bun OPTION(FREECAD_USE_EXTERNAL_KDL "Use system installed orocos-kdl instead of the bundled." OFF) OPTION(FREECAD_USE_FREETYPE "Builds the features using FreeType libs" ON) OPTION(FREECAD_BUILD_DEBIAN "Prepare for a build of a Debian package" OFF) +if (WIN32 OR APPLE) + OPTION(FREECAD_USE_QT_FILEDIALOG "Use Qt's file dialog instead of the native one." OFF) +else() + OPTION(FREECAD_USE_QT_FILEDIALOG "Use Qt's file dialog instead of the native one." ON) +endif() # https://blog.kitware.com/constraining-values-with-comboboxes-in-cmake-cmake-gui/ set(FREECAD_USE_OCC_VARIANT "Community Edition" CACHE STRING "Official OpenCASCADE version or community edition") diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index bc843a6432..02966eb24c 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -1195,6 +1195,10 @@ endif(MSVC) add_library(FreeCADGui SHARED ${FreeCADGui_SRCS}) +if (FREECAD_USE_QT_FILEDIALOG) + set_source_files_properties(FileDialog.cpp PROPERTIES COMPILE_FLAGS -DUSE_QT_FILEDIALOG) +endif() + target_link_libraries(FreeCADGui ${FreeCADGui_LIBS}) SET_BIN_DIR(FreeCADGui FreeCADGui) diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index 98ea4e7601..2545fc9920 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -48,10 +48,6 @@ using namespace Gui; -#if defined(FC_OS_LINUX) -#undef USE_QT_FILEDIALOG -#endif - /* TRANSLATOR Gui::FileDialog */