summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorR. van twisk <ries.van.twisk@ing.com>2019-11-30 22:51:33 +0100
committerR. van twisk <ries.van.twisk@ing.com>2019-11-30 22:51:33 +0100
commit9f3a745ba10235fa7aeda3b93703fdcf810e6948 (patch)
tree7dfbb9705dc988cf4c9b4231777e28c7fd597204
parent377dc1af24d5803aac11fa70e369eae9c40e8b7f (diff)
Added camera list support for OSX
-rw-r--r--cmake/opentrack-qt.cmake6
-rw-r--r--compat/camera-names.cpp11
2 files changed, 14 insertions, 3 deletions
diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake
index 8c92483c..a13afc97 100644
--- a/cmake/opentrack-qt.cmake
+++ b/cmake/opentrack-qt.cmake
@@ -3,12 +3,12 @@ if(WIN32)
find_package(Qt5Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin)
endif()
find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui QUIET)
-find_package(Qt5 COMPONENTS SerialPort QUIET)
+find_package(Qt5 COMPONENTS SerialPort Multimedia QUIET)
-set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES})
+set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Multimedia_LIBRARIES})
function(otr_install_qt_libs)
- foreach(i Qt5::Core Qt5::Gui Qt5::Network Qt5::SerialPort Qt5::Widgets)
+ foreach(i Qt5::Core Qt5::Gui Qt5::Network Qt5::SerialPort Qt5::Widgets Qt5::Multimedia)
if(NOT TARGET "${i}")
continue()
endif()
diff --git a/compat/camera-names.cpp b/compat/camera-names.cpp
index 69926e5a..40edba49 100644
--- a/compat/camera-names.cpp
+++ b/compat/camera-names.cpp
@@ -11,6 +11,10 @@
# include <unistd.h>
#endif
+#ifdef __APPLE__
+# include <QCameraInfo>
+#endif
+
#ifdef __linux
# include <fcntl.h>
# include <sys/ioctl.h>
@@ -102,5 +106,12 @@ std::vector<QString> get_camera_names()
}
}
#endif
+#ifdef __APPLE__
+ QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
+ foreach (const QCameraInfo &cameraInfo, cameras) {
+ ret.push_back(cameraInfo.description());
+ }
+#endif
+
return ret;
}