Properly handle the case where QtWidgets is not available.
It does use a config test for now, just to make it clearer. The Mac backend currently requires widgets, but most of the others should work without it (just not supporting QVideoWidget/WindowControl). The QVideoDeviceControl interface was modified to remove the QIcon usage - it was never implemented. Unfortunately even the QML examples need widgets for the wrapper application, and will need to be ported to QtGui based wrapper. Change-Id: I8a55ad5cf09ab51749510bf16f49de0bd3f0bcdb Reviewed-by: Ling Hu <ling.hu@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
bc7d964a05
commit
c97f5f8c2e
@@ -13,19 +13,21 @@ HEADERS += \
|
||||
$$PWD/dsvideodevicecontrol.h \
|
||||
$$PWD/dsimagecapturecontrol.h \
|
||||
$$PWD/dscamerasession.h \
|
||||
$$PWD/dsvideowidgetcontrol.h \
|
||||
$$PWD/dscameraservice.h \
|
||||
$$PWD/directshowglobal.h
|
||||
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/dscameraservice.cpp \
|
||||
$$PWD/dscameracontrol.cpp \
|
||||
$$PWD/dsvideorenderer.cpp \
|
||||
$$PWD/dsvideodevicecontrol.cpp \
|
||||
$$PWD/dsimagecapturecontrol.cpp \
|
||||
$$PWD/dscamerasession.cpp \
|
||||
$$PWD/dsvideowidgetcontrol.cpp
|
||||
$$PWD/dscamerasession.cpp
|
||||
|
||||
contains(config_test_widgets, yes) {
|
||||
HEADERS += $$PWD/dsvideowidgetcontrol.h
|
||||
SOURCES += $$PWD/dsvideowidgetcontrol.cpp
|
||||
}
|
||||
|
||||
INCLUDEPATH += $(DXSDK_DIR)/include
|
||||
LIBS += -lstrmiids -ldmoguids -luuid -lmsdmo -lole32 -loleaut32
|
||||
|
||||
@@ -41,9 +41,11 @@
|
||||
|
||||
#include <QtCore/qvariant.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
|
||||
#if defined(HAVE_WIDGETS)
|
||||
#include <QtWidgets/qwidget.h>
|
||||
#include <QVideoWidgetControl.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "dscameraservice.h"
|
||||
#include "dscameracontrol.h"
|
||||
@@ -51,7 +53,10 @@
|
||||
#include "dsvideorenderer.h"
|
||||
#include "dsvideodevicecontrol.h"
|
||||
#include "dsimagecapturecontrol.h"
|
||||
|
||||
#if defined(HAVE_WIDGETS)
|
||||
#include "dsvideowidgetcontrol.h"
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@@ -68,7 +73,9 @@ DSCameraService::DSCameraService(QObject *parent):
|
||||
|
||||
m_imageCapture = new DSImageCaptureControl(m_session);
|
||||
|
||||
#if defined(HAVE_WIDGETS)
|
||||
m_viewFinderWidget = new DSVideoWidgetControl(m_session);
|
||||
#endif
|
||||
|
||||
m_device = QByteArray("default");
|
||||
}
|
||||
@@ -79,7 +86,9 @@ DSCameraService::~DSCameraService()
|
||||
delete m_videoDevice;
|
||||
delete m_videoRenderer;
|
||||
delete m_imageCapture;
|
||||
#if defined(HAVE_WIDGETS)
|
||||
delete m_viewFinderWidget;
|
||||
#endif
|
||||
delete m_session;
|
||||
}
|
||||
|
||||
@@ -91,11 +100,13 @@ QMediaControl* DSCameraService::requestControl(const char *name)
|
||||
if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0)
|
||||
return m_imageCapture;
|
||||
|
||||
#if defined(HAVE_WIDGETS)
|
||||
if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
|
||||
if (m_viewFinderWidget) {
|
||||
return m_viewFinderWidget;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(qstrcmp(name,QVideoRendererControl_iid) == 0)
|
||||
return m_videoRenderer;
|
||||
|
||||
@@ -74,7 +74,9 @@ private:
|
||||
DSCameraControl *m_control;
|
||||
DSCameraSession *m_session;
|
||||
DSVideoOutputControl *m_videoOutput;
|
||||
#if defined(HAVE_WIDGETS)
|
||||
DSVideoWidgetControl *m_viewFinderWidget;
|
||||
#endif
|
||||
DSVideoDeviceControl *m_videoDevice;
|
||||
DSVideoRendererControl *m_videoRenderer;
|
||||
DSImageCaptureControl *m_imageCapture;
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QtWidgets/QIcon>
|
||||
|
||||
#include "dsvideodevicecontrol.h"
|
||||
#include "dscamerasession.h"
|
||||
@@ -135,13 +134,6 @@ QString DSVideoDeviceControl::deviceDescription(int index) const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QIcon DSVideoDeviceControl::deviceIcon(int index) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
int DSVideoDeviceControl::defaultDevice() const
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -60,7 +60,6 @@ public:
|
||||
int deviceCount() const;
|
||||
QString deviceName(int index) const;
|
||||
QString deviceDescription(int index) const;
|
||||
QIcon deviceIcon(int index) const;
|
||||
int defaultDevice() const;
|
||||
int selectedDevice() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user