2 * This file is part of CameraPlus.
4 * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "qtcamnotifications.h"
22 #include "qtcamnotifications_p.h"
23 #include "qtcamdevice.h"
25 QtCamNotifications::QtCamNotifications(QtCamDevice *dev, QObject *parent) :
26 QObject(parent), d_ptr(new QtCamNotificationsPrivate) {
31 d_ptr->listener = dev->listener();
32 d_ptr->imageStart = new QtCamGStreamerMessageHandler("photo-capture-start", this);
33 d_ptr->imageEnd = new QtCamGStreamerMessageHandler("photo-capture-end", this);
34 d_ptr->videoDone = new QtCamGStreamerMessageHandler("video-done", this);
36 d_ptr->af = new QtCamAutoFocus(dev, this);
38 if (d_ptr->listener) {
39 d_ptr->listener->addSyncHandler(d_ptr->imageStart);
40 d_ptr->listener->addHandler(d_ptr->imageEnd);
41 d_ptr->listener->addHandler(d_ptr->videoDone);
44 QObject::connect(d_ptr->imageStart, SIGNAL(messageSent(GstMessage *)),
45 this, SIGNAL(imageCaptureStarted()), Qt::DirectConnection);
47 QObject::connect(d_ptr->imageEnd, SIGNAL(messageSent(GstMessage *)),
48 this, SIGNAL(imageCaptureEnded()), Qt::DirectConnection);
50 QObject::connect(d_ptr->videoDone, SIGNAL(messageSent(GstMessage *)),
51 this, SIGNAL(videoRecordingEnded()), Qt::DirectConnection);
53 QObject::connect(d_ptr->af, SIGNAL(statusChanged()), this, SLOT(autoFocusStatusChanged()));
56 QtCamNotifications::~QtCamNotifications() {
57 if (d_ptr->listener) {
58 d_ptr->listener->removeSyncHandler(d_ptr->imageStart);
59 d_ptr->listener->removeHandler(d_ptr->imageEnd);
60 d_ptr->listener->removeHandler(d_ptr->videoDone);
63 delete d_ptr->imageStart.data();
64 delete d_ptr->imageEnd.data();
68 delete d_ptr; d_ptr = 0;
71 #include "moc_qtcamnotifications.cpp"