From: Mohammed Sameer Date: Thu, 27 Dec 2012 17:47:39 +0000 (+0200) Subject: Added mute/unmute video recording sound X-Git-Url: https://cgit.sxemacs.org/?a=commitdiff_plain;h=73a1d9deb8ee2b57d449bc71dbe6eec7f414ddeb;p=harmattan%2Fcameraplus Added mute/unmute video recording sound --- diff --git a/qml/RecordingPage.qml b/qml/RecordingPage.qml index a214840..6d9f8f0 100644 --- a/qml/RecordingPage.qml +++ b/qml/RecordingPage.qml @@ -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 index 0000000..ce147d3 --- /dev/null +++ b/qml/VideoMuteButton.qml @@ -0,0 +1,29 @@ +// -*- qml -*- + +/*! + * This file is part of CameraPlus. + * + * Copyright (C) 2012 Mohammed Sameer + * + * 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; +} diff --git a/qml/VideoPage.qml b/qml/VideoPage.qml index 5b1c96d..58d456b 100644 --- a/qml/VideoPage.qml +++ b/qml/VideoPage.qml @@ -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"); diff --git a/qml/main.qml b/qml/main.qml index abae02a..77154c3 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -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 diff --git a/src/settings.cpp b/src/settings.cpp index 37aaf15..963a6ff 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -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(); + } +} + diff --git a/src/settings.h b/src/settings.h index defcfe9..b3995e1 100644 --- a/src/settings.h +++ b/src/settings.h @@ -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;