Added mute/unmute video recording sound
authorMohammed Sameer <msameer@foolab.org>
Thu, 27 Dec 2012 17:47:39 +0000 (19:47 +0200)
committerMohammed Sameer <msameer@foolab.org>
Thu, 27 Dec 2012 17:47:39 +0000 (19:47 +0200)
qml/RecordingPage.qml
qml/VideoMuteButton.qml [new file with mode: 0644]
qml/VideoPage.qml
qml/main.qml
src/settings.cpp
src/settings.h

index a214840..6d9f8f0 100644 (file)
@@ -275,6 +275,8 @@ CameraPage {
                 VideoColorFilterButton {
                         onClicked: toolBar.push(items);
                 },
+                VideoMuteButton {
+                },
                 ToolIcon {
                         iconSource: "image://theme/icon-m-toolbar-view-menu-white"
                         onClicked: openFile("VideoSettingsPage.qml");
diff --git a/qml/VideoMuteButton.qml b/qml/VideoMuteButton.qml
new file mode 100644 (file)
index 0000000..ce147d3
--- /dev/null
@@ -0,0 +1,29 @@
+// -*- qml -*-
+
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+import QtQuick 1.1
+import com.nokia.meego 1.1
+
+ToolIcon {
+        iconSource: settings.videoMuted ? "image://theme/icon-m-toolbar-volume-off-white-selected" : "image://theme/icon-m-toolbar-volume-white-selected"
+        onClicked: settings.videoMuted = !settings.videoMuted;
+}
index 5b1c96d..58d456b 100644 (file)
@@ -172,6 +172,8 @@ CameraPage {
                 VideoColorFilterButton {
                         onClicked: toolBar.push(items);
                 },
+                VideoMuteButton {
+                },
                 ToolIcon {
                         iconSource: "image://theme/icon-m-toolbar-view-menu-white"
                         onClicked: openFile("VideoSettingsPage.qml");
index abae02a..77154c3 100644 (file)
@@ -36,7 +36,6 @@ import QtMobility.location 1.2
 // TODO: disable debug builds.
 // TODO: a way to get buffers to the application
 // TODO: fcam like functionality (precise control over capture parameters).
-// TODO: mute video sound
 
 PageStackWindow {
         id: root
@@ -373,6 +372,12 @@ PageStackWindow {
                 value: cam.iso.value
         }
 
+        Binding {
+                target: cam.videoMute
+                property: "enabled"
+                value: settings.videoMuted
+        }
+
         TrackerStore {
                 id: trackerStore
                 active: cam.running
index 37aaf15..963a6ff 100644 (file)
@@ -40,6 +40,7 @@
 #define DEFAULT_SOUND_ENABLED      true
 #define DEFAULT_VIDEO_TORCH_ON     false
 #define DEFAULT_SHOW_TOOL_BAR      false
+#define DEFAULT_VIDEO_MUTE         false
 
 Settings::Settings(QObject *parent) :
   QObject(parent),
@@ -309,3 +310,15 @@ void Settings::setToolBarShown(bool shown) {
     emit toolBarShownChanged();
   }
 }
+
+bool Settings::isVideoMuted() const {
+  return m_settings->value("video/mute", DEFAULT_VIDEO_MUTE).toBool();
+}
+
+void Settings::setVideoMuted(bool muted) {
+  if (isVideoMuted() != muted) {
+    m_settings->setValue("video/mute", muted);
+    emit videoMutedChanged();
+  }
+}
+
index defcfe9..b3995e1 100644 (file)
@@ -58,6 +58,7 @@ class Settings : public QObject {
   Q_PROPERTY(bool videoTorchOn READ isVideoTorchOn WRITE setVideoTorchOn NOTIFY videoTorchOnChanged);
 
   Q_PROPERTY(bool showToolBar READ isToolBarShown WRITE setToolBarShown NOTIFY toolBarShownChanged);
+  Q_PROPERTY(bool videoMuted READ isVideoMuted WRITE setVideoMuted NOTIFY videoMutedChanged);
 
 public:
   Settings(QObject *parent = 0);
@@ -129,6 +130,9 @@ public:
   bool isToolBarShown() const;
   void setToolBarShown(bool shown);
 
+  bool isVideoMuted() const;
+  void setVideoMuted(bool muted);
+
 signals:
   void modeChanged();
   void creatorNameChanged();
@@ -152,6 +156,7 @@ signals:
   void soundEnabledChanged();
   void videoTorchOnChanged();
   void toolBarShownChanged();
+  void videoMutedChanged();
 
 private:
   QSettings *m_settings;