CameraButtonRow {
anchors.horizontalCenter: parent.horizontalCenter
// TODO: test this
- enabled: camera.running && camera.idle
+ enabled: camera != null && camera.running && camera.idle
CameraButton {
text: qsTr("Back (Primary)");
Indicator {
id: resolutionIndicator
- source: "image://theme/" + Data.imageIcon(settings.imageAspectRatio, settings.imageResolution)
+ property string imageAspectRatio: settings.device == 1 ? settings.secondaryImageAspectRatio : settings.primaryImageAspectRatio
+ property string imageResolution: settings.device == 1 ? settings.secondaryImageResolution : settings.primaryImageResolution
+ source: "image://theme/" + Data.imageIcon(imageAspectRatio, imageResolution)
}
Indicator {
spacing: 10
+ property string __aspectRatio: settings.device == 1 ?
+ settings.secondaryImageAspectRatio : settings.primaryImageAspectRatio
+ property string __resolution: settings.device == 1 ?
+ settings.secondaryImageResolution : settings.primaryImageResolution
+
SectionHeader {
text: qsTr("Aspect ratio")
visible: aspectRatioRow.visible
model: imageSettings.aspectRatios
delegate: CameraButton {
text: qsTr(modelData)
- checked: settings.imageAspectRatio == modelData
- onClicked: settings.imageAspectRatio = modelData
+ checked: __aspectRatio == modelData
+ onClicked: {
+ if (settings.device == 1) {
+ settings.secondaryImageAspectRatio = modelData
+ } else {
+ settings.primaryImageAspectRatio = modelData
+ }
+ }
}
}
}
Binding {
target: imageSettings.resolutions
property: "aspectRatio"
- value: settings.imageAspectRatio
+ value: settings.primaryImageAspectRatio
+ when: settings.device == 0
+ }
+
+ Binding {
+ target: imageSettings.resolutions
+ property: "aspectRatio"
+ value: settings.secondaryImageAspectRatio
+ when: settings.device == 1
}
Repeater {
id: resolutions
- model: imageSettings.resolutions.aspectRatio == settings.imageAspectRatio ?
+
+ model: imageSettings.resolutions.aspectRatio == __aspectRatio ?
imageSettings.resolutions : undefined
delegate: CameraButton {
capitalize: true
text: qsTr("%1 %2 Mpx").arg(resolutionName).arg(megaPixels)
- checked: settings.imageResolution == resolutionName
- onClicked: settings.imageResolution = resolutionName
+ checked: __resolution == resolutionName
+ onClicked: {
+ if (settings.device == 1) {
+ settings.secondaryImageResolution = resolutionName
+ } else {
+ settings.primaryImageResolution = resolutionName
+ }
+ }
}
}
}
camera: viewfinder.camera
function setImageResolution() {
- if (!imageSettings.setResolution(settings.imageAspectRatio, settings.imageResolution)) {
+ var aspectRatio = settings.device == 1 ? settings.secondaryImageAspectRatio : settings.primaryImageAspectRatio
+ var resolution = settings.device == 1 ? settings.secondaryImageResolution : settings.primaryImageResolution
+
+ if (!imageSettings.setResolution(aspectRatio, resolution)) {
showError(qsTr("Failed to set required resolution"))
}
}
camera: viewfinder.camera
function setVideoResolution() {
- if (!videoSettings.setResolution(settings.videoAspectRatio, settings.videoResolution)) {
+ var aspectRatio = settings.device == 1 ? settings.secondaryVideoAspectRatio : settings.primaryVideoAspectRatio
+ var resolution = settings.device == 1 ? settings.secondaryVideoResolution : settings.primaryVideoResolution
+
+ if (!videoSettings.setResolution(aspectRatio, resolution)) {
showError(qsTr("Failed to set required resolution"))
}
}
Connections {
target: settings
- onImageAspectRatioChanged: {
- imageSettings.setImageResolution()
- }
-
- onImageResolutionChanged: {
- imageSettings.setImageResolution()
- }
+ onPrimaryImageResolutionChanged: imageSettings.setImageResolution()
+ onPrimaryImageAspectRatioChanged: imageSettings.setImageResolution()
+ onSecondaryImageResolutionChanged: imageSettings.setImageResolution()
+ onSecondaryImageAspectRatioChanged: imageSettings.setImageResolution()
- onVideoResolutionChanged: {
- videoSettings.setVideoResolution()
- }
+ onPrimaryVideoResolutionChanged: videoSettings.setVideoResolution()
+ onPrimaryVideoAspectRatioChanged: videoSettings.setVideoResolution()
+ onSecondaryVideoResolutionChanged: videoSettings.setVideoResolution()
+ onSecondaryVideoAspectRatioChanged: videoSettings.setVideoResolution()
}
ModeController {
Indicator {
id: resolutionIndicator
- source: "image://theme/" + Data.videoIcon(settings.videoResolution)
+ property string videoResolution: settings.device == 1 ? settings.secondaryVideoResolution : settings.primaryVideoResolution
+ source: "image://theme/" + Data.videoIcon(videoResolution)
}
Indicator {
spacing: 10
+ property string __resolution: settings.device == 1 ?
+ settings.secondaryVideoResolution : settings.primaryVideoResolution
+
visible: videoSettings.resolutions.count > 1
SectionHeader {
delegate: CameraButton {
capitalize: true
text: qsTr("%1 %2").arg(resolutionName).arg(resolution)
- checked: settings.videoResolution == resolutionName
- onClicked: settings.videoResolution = resolutionName
+ checked: __resolution == resolutionName
+ onClicked: {
+ if (settings.device == 1) {
+ settings.secondaryVideoResolution = resolutionName
+ } else {
+ settings.primaryVideoResolution = resolutionName
+ }
+ }
}
}
}
#define DEFAULT_EV_COMP 0.0
#define DEFAULT_FLASH_MODE 0
#define DEFAULT_IMAGE_ISO 0
-#define DEFAULT_IMAGE_RESOLUTION "high"
-#define DEFAULT_IMAGE_ASPECT_RATIO "16:9"
-#define DEFAULT_VIDEO_RESOLUTION "high"
#define DEFAULT_SOUND_ENABLED true
#define DEFAULT_VIDEO_TORCH_ON false
#define DEFAULT_SHOW_TOOL_BAR false
#define DEFAULT_ZOOM_AS_SHUTTER false
#define DEFAULT_DEVICE 0
+#define DEFAULT_PRIMARY_IMAGE_RESOLUTION "high"
+#define DEFAULT_PRIMARY_IMAGE_ASPECT_RATIO "16:9"
+#define DEFAULT_PRIMARY_VIDEO_RESOLUTION "high"
+#define DEFAULT_PRIMARY_VIDEO_ASPECT_RATIO "16:9"
+
+#define DEFAULT_SECONDARY_IMAGE_RESOLUTION "low"
+#define DEFAULT_SECONDARY_IMAGE_ASPECT_RATIO "4:3"
+#define DEFAULT_SECONDARY_VIDEO_RESOLUTION "low"
+#define DEFAULT_SECONDARY_VIDEO_ASPECT_RATIO "4:3"
+
Settings::Settings(QObject *parent) :
QObject(parent),
m_settings(new QSettings(PATH, QSettings::IniFormat, this)) {
}
}
-QString Settings::imageAspectRatio() const {
- return m_settings->value("image/aspectRatio", DEFAULT_IMAGE_ASPECT_RATIO).toString();
-}
-
-void Settings::setImageAspectRatio(const QString& aspectRatio) {
- if (aspectRatio != imageAspectRatio()) {
- m_settings->setValue("image/aspectRatio", aspectRatio);
- emit imageAspectRatioChanged();
- }
-}
-
-QString Settings::imageResolution() const {
- return m_settings->value("image/resolution", DEFAULT_IMAGE_RESOLUTION).toString();
-}
-
-void Settings::setImageResolution(const QString& resolution) {
- if (resolution != imageResolution()) {
- m_settings->setValue("image/resolution", resolution);
- emit imageResolutionChanged();
- }
-}
-
-QString Settings::videoAspectRatio() const {
- // This is not used for anything so we will return an empty string for now
- // which will make the backend return all resolutions.
-
- return QString();
-}
-
-void Settings::setVideoAspectRatio(const QString& aspectRatio) {
- Q_UNUSED(aspectRatio);
-
- // This is not used for anything so we will just ignore it.
-}
-
-QString Settings::videoResolution() const {
- return m_settings->value("video/resolution", DEFAULT_VIDEO_RESOLUTION).toString();
-}
-
-void Settings::setVideoResolution(const QString& resolution) {
- if (resolution != videoResolution()) {
- m_settings->setValue("video/resolution", resolution);
- emit videoResolutionChanged();
- }
-}
-
bool Settings::isSoundEnabled() const {
return m_settings->value("camera/soundEnabled", DEFAULT_SOUND_ENABLED).toBool();
}
emit deviceChanged();
}
}
+
+QString Settings::primaryImageAspectRatio() const {
+ return m_settings->value("image/primaryAspectRatio",
+ DEFAULT_PRIMARY_IMAGE_ASPECT_RATIO).toString();
+}
+
+void Settings::setPrimaryImageAspectRatio(const QString& aspectRatio) {
+ if (primaryImageAspectRatio() != aspectRatio) {
+ m_settings->setValue("image/primaryAspectRatio", aspectRatio);
+ emit primaryImageAspectRatioChanged();
+ }
+}
+
+QString Settings::primaryImageResolution() const {
+ return m_settings->value("image/primaryResolution",
+ DEFAULT_PRIMARY_IMAGE_RESOLUTION).toString();
+}
+
+void Settings::setPrimaryImageResolution(const QString& resolution) {
+ if (primaryImageResolution() != resolution) {
+ m_settings->setValue("image/primaryResolution", resolution);
+ emit primaryImageResolutionChanged();
+ }
+}
+
+QString Settings::primaryVideoAspectRatio() const {
+ return m_settings->value("video/primaryAspectRatio",
+ DEFAULT_PRIMARY_VIDEO_ASPECT_RATIO).toString();
+}
+
+void Settings::setPrimaryVideoAspectRatio(const QString& aspectRatio) {
+ if (primaryVideoAspectRatio() != aspectRatio) {
+ m_settings->setValue("video/primaryAspectRatio", aspectRatio);
+ emit primaryVideoAspectRatioChanged();
+ }
+}
+
+QString Settings::primaryVideoResolution() const {
+ return m_settings->value("video/primaryResolution",
+ DEFAULT_PRIMARY_VIDEO_RESOLUTION).toString();
+}
+
+void Settings::setPrimaryVideoResolution(const QString& resolution) {
+ if (primaryVideoResolution() != resolution) {
+ m_settings->setValue("video/primaryResolution", resolution);
+ emit primaryVideoResolutionChanged();
+ }
+}
+
+QString Settings::secondaryImageAspectRatio() const {
+ return m_settings->value("image/secondaryAspectRatio",
+ DEFAULT_SECONDARY_IMAGE_ASPECT_RATIO).toString();
+}
+
+void Settings::setSecondaryImageAspectRatio(const QString& aspectRatio) {
+ if (secondaryImageAspectRatio() != aspectRatio) {
+ m_settings->setValue("image/secondaryAspectRatio", aspectRatio);
+ emit secondaryImageAspectRatioChanged();
+ }
+}
+
+QString Settings::secondaryImageResolution() const {
+ return m_settings->value("image/secondaryResolution",
+ DEFAULT_SECONDARY_IMAGE_RESOLUTION).toString();
+}
+
+void Settings::setSecondaryImageResolution(const QString& resolution) {
+ if (secondaryImageResolution() != resolution) {
+ m_settings->setValue("image/secondaryResolution", resolution);
+ emit secondaryImageResolutionChanged();
+ }
+}
+
+QString Settings::secondaryVideoAspectRatio() const {
+ return m_settings->value("video/secondaryAspectRatio",
+ DEFAULT_SECONDARY_VIDEO_ASPECT_RATIO).toString();
+}
+
+void Settings::setSecondaryVideoAspectRatio(const QString& aspectRatio) {
+ if (secondaryVideoAspectRatio() != aspectRatio) {
+ m_settings->setValue("video/secondaryAspectRatio", aspectRatio);
+ emit secondaryVideoAspectRatioChanged();
+ }
+}
+
+QString Settings::secondaryVideoResolution() const {
+ return m_settings->value("video/secondaryResolution",
+ DEFAULT_SECONDARY_VIDEO_RESOLUTION).toString();
+}
+
+void Settings::setSecondaryVideoResolution(const QString& resolution) {
+ if (secondaryVideoResolution() != resolution) {
+ m_settings->setValue("video/secondaryResolution", resolution);
+ emit secondaryVideoResolutionChanged();
+ }
+}
Q_PROPERTY(int imageFlashMode READ imageFlashMode WRITE setImageFlashMode NOTIFY imageFlashModeChanged);
Q_PROPERTY(int imageIso READ imageIso WRITE setImageIso NOTIFY imageIsoChanged);
- Q_PROPERTY(QString imageAspectRatio READ imageAspectRatio WRITE setImageAspectRatio NOTIFY imageAspectRatioChanged);
- Q_PROPERTY(QString imageResolution READ imageResolution WRITE setImageResolution NOTIFY imageResolutionChanged);
-
- Q_PROPERTY(QString videoAspectRatio READ videoAspectRatio WRITE setVideoAspectRatio NOTIFY videoAspectRatioChanged);
- Q_PROPERTY(QString videoResolution READ videoResolution WRITE setVideoResolution NOTIFY videoResolutionChanged);
+ Q_PROPERTY(QString primaryImageAspectRatio READ primaryImageAspectRatio WRITE setPrimaryImageAspectRatio NOTIFY primaryImageAspectRatioChanged);
+ Q_PROPERTY(QString primaryImageResolution READ primaryImageResolution WRITE setPrimaryImageResolution NOTIFY primaryImageResolutionChanged);
+ Q_PROPERTY(QString primaryVideoAspectRatio READ primaryVideoAspectRatio WRITE setPrimaryVideoAspectRatio NOTIFY primaryVideoAspectRatioChanged);
+ Q_PROPERTY(QString primaryVideoResolution READ primaryVideoResolution WRITE setPrimaryVideoResolution NOTIFY primaryVideoResolutionChanged);
+ Q_PROPERTY(QString secondaryImageAspectRatio READ secondaryImageAspectRatio WRITE setSecondaryImageAspectRatio NOTIFY secondaryImageAspectRatioChanged);
+ Q_PROPERTY(QString secondaryImageResolution READ secondaryImageResolution WRITE setSecondaryImageResolution NOTIFY secondaryImageResolutionChanged);
+ Q_PROPERTY(QString secondaryVideoAspectRatio READ secondaryVideoAspectRatio WRITE setSecondaryVideoAspectRatio NOTIFY secondaryVideoAspectRatioChanged);
+ Q_PROPERTY(QString secondaryVideoResolution READ secondaryVideoResolution WRITE setSecondaryVideoResolution NOTIFY secondaryVideoResolutionChanged);
Q_PROPERTY(bool soundEnabled READ isSoundEnabled WRITE setSoundEnabled NOTIFY soundEnabledChanged);
Q_PROPERTY(bool videoTorchOn READ isVideoTorchOn WRITE setVideoTorchOn NOTIFY videoTorchOnChanged);
int imageIso() const;
void setImageIso(int iso);
- QString imageAspectRatio() const;
- void setImageAspectRatio(const QString& aspectRatio);
-
- QString imageResolution() const;
- void setImageResolution(const QString& resolution);
-
- QString videoAspectRatio() const;
- void setVideoAspectRatio(const QString& aspectRatio);
-
- QString videoResolution() const;
- void setVideoResolution(const QString& resolution);
-
bool isSoundEnabled() const;
void setSoundEnabled(bool enabled);
int device() const;
void setDevice(int device);
+ QString primaryImageAspectRatio() const;
+ void setPrimaryImageAspectRatio(const QString& aspectRatio);
+
+ QString primaryImageResolution() const;
+ void setPrimaryImageResolution(const QString& resolution);
+
+ QString primaryVideoAspectRatio() const;
+ void setPrimaryVideoAspectRatio(const QString& aspectRatio);
+
+ QString primaryVideoResolution() const;
+ void setPrimaryVideoResolution(const QString& resolution);
+
+ QString secondaryImageAspectRatio() const;
+ void setSecondaryImageAspectRatio(const QString& aspectRatio);
+
+ QString secondaryImageResolution() const;
+ void setSecondaryImageResolution(const QString& resolution);
+
+ QString secondaryVideoAspectRatio() const;
+ void setSecondaryVideoAspectRatio(const QString& aspectRatio);
+
+ QString secondaryVideoResolution() const;
+ void setSecondaryVideoResolution(const QString& resolution);
+
signals:
void modeChanged();
void creatorNameChanged();
void videoEvCompChanged();
void imageFlashModeChanged();
void imageIsoChanged();
- void imageAspectRatioChanged();
- void imageResolutionChanged();
- void videoAspectRatioChanged();
- void videoResolutionChanged();
void soundEnabledChanged();
void videoTorchOnChanged();
void toolBarShownChanged();
void faceDetectionEnabledChanged();
void zoomAsShutterChanged();
void deviceChanged();
+ void primaryImageAspectRatioChanged();
+ void primaryImageResolutionChanged();
+ void primaryVideoAspectRatioChanged();
+ void primaryVideoResolutionChanged();
+ void secondaryImageAspectRatioChanged();
+ void secondaryImageResolutionChanged();
+ void secondaryVideoAspectRatioChanged();
+ void secondaryVideoResolutionChanged();
private:
QSettings *m_settings;