onTextChanged: settings.creatorName = text;
}
+ Item {
+ width: parent.width
+ height: Math.max(enableCameraSoundsLabel.height, enableCameraSounds.height);
+
+ Label {
+ id: enableCameraSoundsLabel
+ anchors.left: parent.left
+ text: qsTr("Enable camera sounds");
+ }
+
+ Switch {
+ id: enableCameraSounds
+ anchors.right: parent.right
+ // We have to do it that way because QML complains about a binding
+ // loop for checked if we bind the checked property to the settings value.
+ Component.onCompleted: checked = settings.soundEnabled;
+ onCheckedChanged: settings.soundEnabled = checked;
+ }
+ }
+
Item {
width: parent.width
height: Math.max(useGpsLabel.height, useGps.height);
notifications: Sounds {
id: sounds
+ mute: !settings.soundEnabled
}
}
#define DEFAULT_IMAGE_RESOLUTION "high"
#define DEFAULT_IMAGE_ASPECT_RATIO "16:9"
#define DEFAULT_VIDEO_RESOLUTION "high"
+#define DEFAULT_SOUND_ENABLED true
Settings::Settings(QObject *parent) :
QObject(parent),
emit videoResolutionChanged();
}
}
+
+bool Settings::isSoundEnabled() const {
+ return m_settings->value("camera/soundEnabled", DEFAULT_SOUND_ENABLED).toBool();
+}
+
+void Settings::setSoundEnabled(bool enabled) {
+ if (isSoundEnabled() != enabled) {
+ m_settings->setValue("camera/soundEnabled", enabled);
+ emit soundEnabledChanged();
+ }
+}
Q_PROPERTY(QString videoAspectRatio READ videoAspectRatio WRITE setVideoAspectRatio NOTIFY videoAspectRatioChanged);
Q_PROPERTY(QString videoResolution READ videoResolution WRITE setVideoResolution NOTIFY videoResolutionChanged);
+ Q_PROPERTY(bool soundEnabled READ isSoundEnabled WRITE setSoundEnabled NOTIFY soundEnabledChanged);
+
public:
Settings(QObject *parent = 0);
~Settings();
QString videoResolution() const;
void setVideoResolution(const QString& resolution);
+ bool isSoundEnabled() const;
+ void setSoundEnabled(bool enabled);
+
signals:
void modeChanged();
void creatorNameChanged();
void imageResolutionChanged();
void videoAspectRatioChanged();
void videoResolutionChanged();
+ void soundEnabledChanged();
private:
QSettings *m_settings;