~QtCamVideoModePrivate() {}
+ void _d_idleStateChanged(bool isIdle) {
+ if (isIdle && dev->active == dev->video) {
+ QMetaObject::invokeMethod(dev->video, "recordingStateChanged");
+ QMetaObject::invokeMethod(dev->video, "canCaptureChanged");
+ }
+ }
+
QtCamVideoSettings settings;
};
setProfile(profile);
}
}
+
+ QObject::connect(d_ptr->dev->q_ptr, SIGNAL(idleStateChanged(bool)),
+ this, SLOT(_d_idleStateChanged(bool)));
}
QtCamVideoMode::~QtCamVideoMode() {
g_object_set(d_ptr->dev->cameraBin, "location", fileName.toUtf8().data(), NULL);
g_signal_emit_by_name(d_ptr->dev->cameraBin, "start-capture", NULL);
+ emit recordingStateChanged();
+
+ emit canCaptureChanged();
+
return true;
}
-bool QtCamVideoMode::stopRecording() {
+void QtCamVideoMode::stopRecording() {
if (isRecording()) {
g_signal_emit_by_name(d_ptr->dev->cameraBin, "stop-capture", NULL);
}
-
- return true;
}
bool QtCamVideoMode::setSettings(const QtCamVideoSettings& settings) {
return true;
}
-
void QtCamVideoMode::setProfile(GstEncodingProfile *profile) {
if (!d_ptr->dev->cameraBin) {
gst_encoding_profile_unref(profile);
g_object_set(d_ptr->dev->cameraBin, "video-profile", profile, NULL);
}
+
+#include "moc_qtcamvideomode.cpp"
class QtCamVideoMode : public QtCamMode {
Q_OBJECT
+ Q_PROPERTY(bool recording READ isRecording NOTIFY recordingStateChanged);
+
public:
QtCamVideoMode(QtCamDevicePrivate *d, QObject *parent = 0);
~QtCamVideoMode();
virtual void applySettings();
bool isRecording();
- bool startRecording(const QString& fileName);
- bool stopRecording();
+ Q_INVOKABLE bool startRecording(const QString& fileName);
bool setSettings(const QtCamVideoSettings& settings);
void setProfile(GstEncodingProfile *profile);
+public slots:
+ void stopRecording();
+
+signals:
+ void recordingStateChanged();
+
protected:
virtual void start();
virtual void stop();
private:
+ Q_PRIVATE_SLOT(d_ptr, void _d_idleStateChanged(bool));
+
QtCamVideoModePrivate *d_ptr;
};