X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lib%2Fqtcamimagemode.cpp;h=09af7f7813dea3b271a0869d58db22f0b9ad8b6b;hb=023e23986b9d4fd85d0c191660a286f010571a74;hp=05a6d104e43db350b8155ff4063ec6735c94b59a;hpb=9289ae82be24afc06797d75d2fcf5502d776555a;p=harmattan%2Fcameraplus diff --git a/lib/qtcamimagemode.cpp b/lib/qtcamimagemode.cpp index 05a6d10..09af7f7 100644 --- a/lib/qtcamimagemode.cpp +++ b/lib/qtcamimagemode.cpp @@ -1,7 +1,7 @@ /*! * This file is part of CameraPlus. * - * Copyright (C) 2012 Mohammed Sameer + * Copyright (C) 2012-2013 Mohammed Sameer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,9 @@ public: }; QtCamImageMode::QtCamImageMode(QtCamDevicePrivate *dev, QObject *parent) : - QtCamMode(new QtCamImageModePrivate(dev), "mode-image", "image-done", parent) { + QtCamMode(new QtCamImageModePrivate(dev), "mode-image", parent) { + + d_ptr->init(new DoneHandler(d_ptr, "image-done", this)); d = (QtCamImageModePrivate *)d_ptr; @@ -62,7 +64,7 @@ QtCamImageMode::~QtCamImageMode() { } bool QtCamImageMode::canCapture() { - return QtCamMode::canCapture() && d_ptr->dev->isWrapperReady(); + return QtCamMode::canCapture() && d_ptr->dev->isReadyForCapture(); } void QtCamImageMode::applySettings() { @@ -78,14 +80,15 @@ void QtCamImageMode::applySettings() { // we use. For now we will not set any FPS. d_ptr->setCaps("image-capture-caps", d->resolution.captureResolution(), -1); - setPreviewSize(d->resolution.previewResolution()); + d_ptr->setPreviewSize(d->resolution.previewResolution()); - // TODO: ? - // d_ptr->resetCaps("video-capture-caps"); + // If we don't reset the caps then: if we switch from video to image then we fail + // the next time we restart the pipeline. + d_ptr->resetCaps("video-capture-caps"); } void QtCamImageMode::start() { - // Nothing + d_ptr->enableViewfinderFilters(); } void QtCamImageMode::stop() { @@ -101,7 +104,7 @@ bool QtCamImageMode::capture(const QString& fileName) { return false; } - setFileName(fileName); + d_ptr->setFileName(fileName); g_object_set(d_ptr->dev->cameraBin, "location", fileName.toUtf8().data(), NULL); g_signal_emit_by_name(d_ptr->dev->cameraBin, "start-capture", NULL); @@ -112,7 +115,14 @@ bool QtCamImageMode::capture(const QString& fileName) { bool QtCamImageMode::setResolution(const QtCamImageResolution& resolution) { d->resolution = resolution; - if (!d_ptr->dev->q_ptr->isRunning() || !d_ptr->dev->q_ptr->isIdle()) { + if (!d_ptr->dev->q_ptr->isRunning()) { + // We will return true here because setting the resolution on a non-running pipeline + // doesn't make much sense (Probably the only use case is as a kind of optimization only). + // We will set it anyway when the pipeline gets started. + return true; + } + + if (!d_ptr->dev->q_ptr->isIdle()) { return false; }