[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/sailfish-barcode.git</param>
<param name="branch">master</param>
- <param name="revision">a6b1c24</param>
+ <param name="revision">4c0df73</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/harbour-barcode.pro
^
|
@@ -10,7 +10,7 @@
LIBS += -ldl
isEmpty(VERSION) {
- VERSION = 1.0.48
+ VERSION = 1.0.49
message("VERSION is unset, assuming $$VERSION")
}
@@ -115,6 +115,7 @@
$${HARBOUR_LIB_QML}/HarbourHighlightIcon.qml \
$${HARBOUR_LIB_QML}/HarbourHintIconButton.qml \
$${HARBOUR_LIB_QML}/HarbourHorizontalSwipeHint.qml \
+ $${HARBOUR_LIB_QML}/HarbourInvertEffect.qml \
$${HARBOUR_LIB_QML}/HarbourPressEffect.qml
OTHER_FILES += $${HARBOUR_QML_COMPONENTS}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/harbour-lib/harbour-lib.pro
^
|
@@ -25,6 +25,7 @@
SOURCES += \
src/HarbourBase32.cpp \
src/HarbourBase45.cpp \
+ src/HarbourBattery.cpp \
src/HarbourClipboard.cpp \
src/HarbourColorEditorModel.cpp \
src/HarbourDisplayBlanking.cpp \
@@ -61,6 +62,7 @@
PUBLIC_HEADERS += \
include/HarbourBase32.h \
include/HarbourBase45.h \
+ include/HarbourBattery.h \
include/HarbourClipboard.h \
include/HarbourColorEditorModel.h \
include/HarbourDebug.h \
|
[-]
[+]
|
Added |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/harbour-lib/include/HarbourBattery.h
^
|
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2022 Jolla Ltd.
+ * Copyright (C) 2022 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HARBOUR_BATTERY_H
+#define HARBOUR_BATTERY_H
+
+#include <QObject>
+
+class QQmlEngine;
+class QJSEngine;
+
+// D-Bus calls used by this object require mce 1.86.0 (Sailfish OS 2.1)
+class HarbourBattery: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(BatteryStatus batteryStatus READ batteryStatus NOTIFY batteryStatusChanged)
+ Q_PROPERTY(BatteryState batteryState READ batteryState NOTIFY batteryStateChanged)
+ Q_PROPERTY(int batteryLevel READ batteryLevel NOTIFY batteryLevelChanged)
+ Q_ENUMS(BatteryStatus)
+ Q_ENUMS(BatteryState)
+
+public:
+ enum BatteryStatus {
+ BatteryStatusUnknown,
+ BatteryStatusEmpty,
+ BatteryStatusLow,
+ BatteryStatusOk,
+ BatteryStatusFull
+ };
+
+ enum BatteryState {
+ BatteryStateUnknown,
+ BatteryStateCharging,
+ BatteryStateDischarging,
+ BatteryStateNotCharging,
+ BatteryStateFull
+ };
+
+ explicit HarbourBattery(QObject* aParent = Q_NULLPTR);
+ ~HarbourBattery();
+
+ // Callback for qmlRegisterSingletonType<HarbourBattery>
+ static QObject* createSingleton(QQmlEngine*, QJSEngine*);
+
+ BatteryStatus batteryStatus() const;
+ BatteryState batteryState() const;
+ int batteryLevel() const;
+
+Q_SIGNALS:
+ void batteryStatusChanged();
+ void batteryStateChanged();
+ void batteryLevelChanged();
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_BATTERY_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/harbour-lib/qml/HarbourInvertEffect.qml
^
|
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+ShaderEffect {
+ property variant source
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main(void) {
+ highp vec4 pixelColor = texture2D(source, qt_TexCoord0);
+ gl_FragColor = vec4(vec3(1,1,1) - pixelColor.rgb, pixelColor.a) * qt_Opacity;
+ }"
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/harbour-lib/src/HarbourBattery.cpp
^
|
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2022 Jolla Ltd.
+ * Copyright (C) 2022 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourBattery.h"
+#include "HarbourDebug.h"
+#include "HarbourMce.h"
+
+#include <QDBusPendingCallWatcher>
+#include <QDBusPendingReply>
+
+// ==========================================================================
+// HarbourBattery::Private
+// ==========================================================================
+
+class HarbourBattery::Private : public HarbourMce
+{
+ Q_OBJECT
+
+public:
+ static const QString MCE_BATTERY_STATUS_UNKNOWN;
+ static const QString MCE_BATTERY_STATUS_FULL;
+ static const QString MCE_BATTERY_STATUS_OK;
+ static const QString MCE_BATTERY_STATUS_LOW;
+ static const QString MCE_BATTERY_STATUS_EMPTY;
+
+ static const QString MCE_BATTERY_STATE_UNKNOWN;
+ static const QString MCE_BATTERY_STATE_DISCHARGING;
+ static const QString MCE_BATTERY_STATE_CHARGING;
+ static const QString MCE_BATTERY_STATE_NOT_CHARGING;
+ static const QString MCE_BATTERY_STATE_FULL;
+
+ Private(HarbourBattery*);
+
+ HarbourBattery* parentObject() const;
+
+public Q_SLOTS:
+ void updateBatteryStatus(const QString);
+ void updateBatteryState(const QString);
+ void updateBatteryLevel(int);
+ void onBatteryStatusQueryDone(QDBusPendingCallWatcher*);
+ void onBatteryStateQueryDone(QDBusPendingCallWatcher*);
+ void onBatteryLevelQueryDone(QDBusPendingCallWatcher*);
+
+public:
+ BatteryStatus iBatteryStatus;
+ BatteryState iBatteryState;
+ int iBatteryLevel;
+};
+
+const QString HarbourBattery::Private::MCE_BATTERY_STATUS_UNKNOWN("unknown");
+const QString HarbourBattery::Private::MCE_BATTERY_STATUS_FULL("full");
+const QString HarbourBattery::Private::MCE_BATTERY_STATUS_OK("ok");
+const QString HarbourBattery::Private::MCE_BATTERY_STATUS_LOW("low");
+const QString HarbourBattery::Private::MCE_BATTERY_STATUS_EMPTY("empty");
+
+const QString HarbourBattery::Private::MCE_BATTERY_STATE_UNKNOWN("unknown");
+const QString HarbourBattery::Private::MCE_BATTERY_STATE_DISCHARGING("discharging");
+const QString HarbourBattery::Private::MCE_BATTERY_STATE_CHARGING("charging");
+const QString HarbourBattery::Private::MCE_BATTERY_STATE_NOT_CHARGING("not_charging");
+const QString HarbourBattery::Private::MCE_BATTERY_STATE_FULL("full");
+
+HarbourBattery::Private::Private(
+ HarbourBattery* aParent) :
+ HarbourMce(aParent),
+ iBatteryStatus(BatteryStatusUnknown),
+ iBatteryState(BatteryStateUnknown),
+ iBatteryLevel(0)
+{
+ setupProperty("get_battery_status", "battery_status_ind",
+ SLOT(onBatteryStatusQueryDone(QDBusPendingCallWatcher*)),
+ SLOT(updateBatteryStatus(QString)));
+ setupProperty("get_battery_state", "battery_state_ind",
+ SLOT(onBatteryStateQueryDone(QDBusPendingCallWatcher*)),
+ SLOT(updateBatteryState(QString)));
+ setupProperty("get_battery_level", "battery_level_ind",
+ SLOT(onBatteryLevelQueryDone(QDBusPendingCallWatcher*)),
+ SLOT(updateBatteryLevel(int)));
+}
+
+inline
+HarbourBattery*
+HarbourBattery::Private::parentObject() const
+{
+ return qobject_cast<HarbourBattery*>(parent());
+}
+
+void
+HarbourBattery::Private::updateBatteryStatus(
+ const QString aStatus)
+{
+ BatteryStatus status = BatteryStatusUnknown;
+
+ if (aStatus == MCE_BATTERY_STATUS_OK) {
+ status = BatteryStatusOk;
+ } else if (aStatus == MCE_BATTERY_STATUS_FULL) {
+ status = BatteryStatusFull;
+ } else if (aStatus == MCE_BATTERY_STATUS_LOW) {
+ status = BatteryStatusLow;
+ } else if (aStatus == MCE_BATTERY_STATUS_EMPTY) {
+ status = BatteryStatusEmpty;
+ } else if (aStatus != MCE_BATTERY_STATUS_UNKNOWN) {
+ HWARN("Unexpected battery status" << aStatus);
+ return;
+ }
+
+ if (iBatteryStatus != status) {
+ iBatteryStatus = status;
+ HDEBUG(aStatus);
+ Q_EMIT parentObject()->batteryStatusChanged();
+ }
+}
+
+void
+HarbourBattery::Private::updateBatteryState(
+ const QString aState)
+{
+ BatteryState state = BatteryStateUnknown;
+
+ if (aState == MCE_BATTERY_STATE_CHARGING) {
+ state = BatteryStateCharging;
+ } else if (aState == MCE_BATTERY_STATE_DISCHARGING) {
+ state = BatteryStateDischarging;
+ } else if (aState == MCE_BATTERY_STATE_NOT_CHARGING) {
+ state = BatteryStateNotCharging;
+ } else if (aState == MCE_BATTERY_STATE_FULL) {
+ state = BatteryStateFull;
+ } else if (aState != MCE_BATTERY_STATE_UNKNOWN) {
+ HWARN("Unexpected battery state" << aState);
+ return;
+ }
+
+ if (iBatteryState != state) {
+ iBatteryState = state;
+ HDEBUG(aState);
+ Q_EMIT parentObject()->batteryStateChanged();
+ }
+}
+
+void
+HarbourBattery::Private::updateBatteryLevel(
+ int aLevel)
+{
+ if (iBatteryLevel != aLevel) {
+ iBatteryLevel = aLevel;
+ HDEBUG(aLevel);
+ Q_EMIT parentObject()->batteryLevelChanged();
+ }
+}
+
+void
+HarbourBattery::Private::onBatteryStatusQueryDone(
+ QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply<QString> reply(*aWatcher);
+
+ if (reply.isError()) {
+ HWARN(reply.error().message());
+ } else {
+ updateBatteryStatus(reply.value());
+ }
+ aWatcher->deleteLater();
+}
+
+void
+HarbourBattery::Private::onBatteryStateQueryDone(
+ QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply<QString> reply(*aWatcher);
+
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/qml/components/GalleryImage.qml
^
|
@@ -1,7 +1,7 @@
/*
The MIT License (MIT)
-Copyright (c) 2020-2021 Slava Monich
+Copyright (c) 2020-2022 Slava Monich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,8 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
+import "../harbour"
+
SilicaFlickable {
id: galleryImage
@@ -33,6 +35,7 @@
property real orientation
property bool isLandscape
property alias source: image.source
+ property bool invert
readonly property real minZoomX: (implicitWidth > width) ? width/implicitWidth : 0.1
readonly property real minZoomY: (implicitHeight > height) ? height/implicitHeight : 0.1
@@ -66,7 +69,6 @@
var h = transpose ? image.width : image.height
var viewportWidth = isLandscape ? galleryImage.height : galleryImage.width
var viewportHeight = isLandscape ? galleryImage.width : galleryImage.height
- console.log(viewportWidth, w, viewportHeight, h, viewportWidth/w, viewportHeight/h)
zoom = Math.min(viewportWidth/w, viewportHeight/h)
}
@@ -106,6 +108,11 @@
readonly property real xSize: d * Math.max(Math.abs(Math.cos(r - a)), Math.abs(Math.cos(r + a)))
readonly property real ySize: d * Math.max(Math.abs(Math.sin(r - a)), Math.abs(Math.sin(r + a)))
+ layer.enabled: invert
+ layer.effect: HarbourInvertEffect {
+ source: image
+ }
+
anchors.centerIn: parent
scale: actualZoom
smooth: true
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/qml/components/ViewFinder.qml
^
|
@@ -2,21 +2,24 @@
import QtMultimedia 5.4
import Sailfish.Silica 1.0
+import "../harbour"
+
VideoOutput {
id: viewFinder
- layer.enabled: true
anchors.fill: parent
fillMode: VideoOutput.Stretch
property alias beepSource: beep.source
property size viewfinderResolution
- property bool completed
property bool showFocusArea: true
property real digitalZoom: 1.0
+ property bool invert
+
+ property size supportedWideResolution: Qt.size(0,0) // 4:3
+ property size supportedNarrowResolution: Qt.size(0,0) // 16:9
readonly property bool cameraActive: camera.cameraState === Camera.ActiveState
- readonly property bool tapFocusActive: focusTimer.running
readonly property bool flashOn: camera.flash.mode !== Camera.FlashOff
// Not sure why not just camera.orientation but this makes the camera
// behave similar to what it does for Jolla Camera
@@ -26,6 +29,17 @@
// Camera.ActiveStatus and doesn't emit maximumDigitalZoomChanged signal
signal maximumDigitalZoom(var value)
+ // Internal properties
+ readonly property bool _tapFocusActive: focusTimer.running
+ readonly property real _ratio_4_3: 4./3.
+ readonly property real _ratio_16_9: 16./9.
+ property bool _completed
+
+ layer.enabled: invert
+ layer.effect: HarbourInvertEffect {
+ source: viewFinder
+ }
+
onOrientationChanged: {
if (camera.cameraState !== Camera.UnloadedState) {
reloadTimer.restart()
@@ -52,7 +66,7 @@
if (viewfinderResolution) {
camera.viewfinder.resolution = viewfinderResolution
}
- completed = true
+ _completed = true
}
function turnFlashOn() {
@@ -131,15 +145,15 @@
imageProcessing.whiteBalanceMode: flashOn ?
CameraImageProcessing.WhiteBalanceFlash :
CameraImageProcessing.WhiteBalanceTungsten
- cameraState: (completed && !reloadTimer.running) ?
+ cameraState: (_completed && !reloadTimer.running) ?
Camera.ActiveState : Camera.UnloadedState
exposure {
exposureCompensation: 1.0
exposureMode: Camera.ExposureAuto
}
focus {
- focusMode: tapFocusActive ? Camera.FocusAuto : Camera.FocusContinuous
- focusPointMode: tapFocusActive ? Camera.FocusPointCustom : Camera.FocusPointAuto
+ focusMode: _tapFocusActive ? Camera.FocusAuto : Camera.FocusContinuous
+ focusPointMode: _tapFocusActive ? Camera.FocusPointCustom : Camera.FocusPointAuto
}
onCameraStatusChanged: {
if (cameraStatus === Camera.ActiveStatus) {
@@ -147,6 +161,7 @@
viewFinder.maximumDigitalZoom(maximumDigitalZoom)
digitalZoom = viewFinder.digitalZoom
}
+ updateSupportedResolutions()
}
onCameraStateChanged: {
if (cameraState === Camera.UnloadedState) {
@@ -156,6 +171,32 @@
}
}
}
+ function updateSupportedResolutions() {
+ var list = camera.supportedViewfinderResolutions()
+ var max_4_3 = Qt.size(0,0)
+ var max_16_9 = Qt.size(0,0)
+ for (var i = 0; i < list.length; i++) {
+ var size = list[i]
+ var ratio = size.width / size.height
+ if (ratio === _ratio_4_3) {
+ if (size.width > max_4_3.width) {
+ max_4_3 = size
+ }
+ } else if (ratio === _ratio_16_9) {
+ if (size.width > max_16_9.width) {
+ max_16_9 = size
+ }
+ }
+ }
+ if (supportedWideResolution.width !== max_4_3.width &&
+ supportedWideResolution.height !== max_4_3.height) {
+ supportedWideResolution = Qt.size(max_4_3.width, max_4_3.height)
+ }
+ if (supportedNarrowResolution.width !== max_16_9.width &&
+ supportedNarrowResolution.height !== max_16_9.height) {
+ supportedNarrowResolution = Qt.size(max_16_9.width, max_16_9.height)
+ }
+ }
}
Timer {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/qml/pages/ScanPage.qml
^
|
@@ -34,27 +34,30 @@
import "../harbour"
Page {
- id: scanPage
+ id: thisPage
allowedOrientations: window.allowedOrientations
+ property bool autoScan
+ readonly property bool cameraActive: viewFinder && viewFinder.cameraActive
+
+ // Internal properties
property Item galleryImage
property Item viewFinder
property Item hint
- property bool showMarker
- property bool autoScan
- property int scanTimeout: 60
+ property bool showMarker
+ readonly property bool mustShowViewFinder: (thisPage.status === PageStatus.Active) && Qt.application.active && !scanningGalleryImage && !showMarker
readonly property bool hintActive: hint && hint.visible
- readonly property bool cameraActive: viewFinder && viewFinder.cameraActive
readonly property bool landscapeLayout: width > height
- readonly property bool mustShowViewFinder: (scanPage.status === PageStatus.Active) && Qt.application.active && !scanningGalleryImage && !showMarker
readonly property bool scanningGalleryImage: galleryImage && galleryImage.visible
- readonly property bool useVolumeKeys: AppSettings.volumeZoom && (scanPage.status === PageStatus.Active) && Qt.application.active
-
- readonly property var volumeUp: Qt.createQmlObject(BarcodeUtils.mediaKeyQml, scanPage, "VolumeKey")
- readonly property var volumeDown: Qt.createQmlObject(BarcodeUtils.mediaKeyQml, scanPage, "VolumeKey")
- readonly property var permissions: Qt.createQmlObject(BarcodeUtils.permissionsQml, scanPage, "Permissions")
+ readonly property bool useVolumeKeys: AppSettings.volumeZoom && (thisPage.status === PageStatus.Active) && Qt.application.active
+ readonly property int toolIconFadeDuration: 64
+ readonly property int scanTimeout: 60
+
+ readonly property var volumeUp: Qt.createQmlObject(BarcodeUtils.mediaKeyQml, thisPage, "VolumeKey")
+ readonly property var volumeDown: Qt.createQmlObject(BarcodeUtils.mediaKeyQml, thisPage, "VolumeKey")
+ readonly property var permissions: Qt.createQmlObject(BarcodeUtils.permissionsQml, thisPage, "Permissions")
Binding { target: permissions; property: "enabled"; value: useVolumeKeys }
Binding { target: volumeUp; property: "enabled"; value: useVolumeKeys }
@@ -173,7 +176,7 @@
function showHint(text) {
if (!hint) {
- hint = hintComponent.createObject(scanPage)
+ hint = hintComponent.createObject(thisPage)
}
hint.text = text
hint.opacity = 1.0
@@ -211,11 +214,13 @@
if (viewFinder.source.availability === Camera.Available) {
viewFinder.source.start()
}
+ viewFinderContainer.updateSupportedResolution_4_3(viewFinder.supportedWideResolution)
+ viewFinderContainer.updateSupportedResolution_16_9(viewFinder.supportedNarrowResolution)
}
}
onStatusChanged: {
- if (scanPage.status === PageStatus.Inactive) {
+ if (thisPage.status === PageStatus.Inactive) {
console.log("Page is INACTIVE")
// stop scanning if page is not active
destroyScanner()
@@ -267,6 +272,7 @@
markerColor: AppSettings.markerColor
rotation: orientationAngle()
canGrab: (!galleryImage || !galleryImage.moving) && !galleryScanTimer.running
+ inverted: invertButton.down
decodingHints: AppSettings.decodingHints
onDecodingFinished: {
@@ -274,7 +280,7 @@
statusText.text = ""
applyResult(image, result)
if (AppSettings.resultViewDuration > 0) {
- scanPage.showMarker = true
+ thisPage.showMarker = true
resultViewTimer.restart()
}
if (buzzLoader.item) {
@@ -318,7 +324,7 @@
id: resultViewTimer
interval: AppSettings.resultViewDuration * 1000
- onTriggered: scanPage.showMarker = false
+ onTriggered: thisPage.showMarker = false
}
Component {
@@ -336,7 +342,7 @@
GalleryImage {
visible: false
- isLandscape: scanPage.isLandscape
+ isLandscape: thisPage.isLandscape
z: 1
}
}
@@ -345,6 +351,7 @@
id: scanPageFlickable
anchors.fill: parent
+ interactive: !(invertButton.visible && invertButton.down)
PullDownMenu {
enabled: scanner.idle && !hintActive
@@ -366,7 +373,7 @@
//: Page header
//% "Select image"
title: qsTrId("gallery-title"),
- allowedOrientations: scanPage.allowedOrientations
+ allowedOrientations: thisPage.allowedOrientations
})
var imageUrl, imageOrientation
picker.imageSelected.connect(function(url, orientation) {
@@ -477,15 +484,17 @@
Rectangle {
id: viewFinderContainer
- readonly property real ratio_4_3: 4./3.
- readonly property real ratio_16_9: 16./9.
- readonly property bool canSwitchResolutions: typeof ViewfinderResolution_4_3 !== "undefined" &&
- typeof ViewfinderResolution_16_9 !== "undefined"
+ readonly property real defaultRatio: AppSettings.narrowRatio
+ readonly property bool canSwitchResolutions:
+ AppSettings.wideResolution.width > 0 && AppSettings.wideResolution.height > 0 &&
+ AppSettings.narrowResolution.width > 0 && AppSettings.narrowResolution.height > 0
readonly property size viewfinderResolution: canSwitchResolutions ?
- (AppSettings.wideMode ? ViewfinderResolution_4_3 : ViewfinderResolution_16_9) :
+ (AppSettings.wideMode ? AppSettings.wideResolution : AppSettings.narrowResolution) :
Qt.size(0,0)
- readonly property real ratio: canSwitchResolutions ? (AppSettings.wideMode ? ratio_4_3 : ratio_16_9) :
- typeof ViewfinderResolution_4_3 !== "undefined" ? ratio_4_3 : ratio_16_9
+ readonly property real ratio: canSwitchResolutions ?
+ (AppSettings.wideMode ? AppSettings.wideRatio : AppSettings.narrowRatio) :
+ (AppSettings.wideResolution.width > 0 && AppSettings.wideResolution.height > 0) ? AppSettings.wideRatio :
+ AppSettings.narrowRatio
readonly property int portraitWidth: Math.floor((parent.height/parent.width > ratio) ? parent.width : parent.height/ratio)
readonly property int portraitHeight: Math.floor((parent.height/parent.width > ratio) ? (parent.width * ratio) : parent.height)
@@ -493,8 +502,8 @@
readonly property int landscapeHeight: Math.floor((parent.width/parent.height > ratio) ? parent.height : (parent.width / ratio))
anchors.centerIn: parent
- width: scanningGalleryImage ? parent.width : (scanPage.isPortrait ? portraitWidth : landscapeWidth)
- height: scanningGalleryImage ? parent.height : (scanPage.isPortrait ? portraitHeight : landscapeHeight)
+ width: scanningGalleryImage ? parent.width : (thisPage.isPortrait ? portraitWidth : landscapeWidth)
+ height: scanningGalleryImage ? parent.height : (thisPage.isPortrait ? portraitHeight : landscapeHeight)
color: "#20000000"
opacity: markerImage.visible ? 0 : 1
Behavior on opacity { FadeAnimation { } }
@@ -513,6 +522,24 @@
function updateViewFinderPosition() {
scanner.viewFinderRect = Qt.rect(x + parent.x, y + parent.y, width, height)
}
+
+ function updateSupportedResolution_4_3(res) {
+ if (res.width > AppSettings.wideResolution.width) {
+ AppSettings.wideResolution = res
+ }
+ }
+
+ function updateSupportedResolution_16_9(res) {
+ if (res.width > AppSettings.narrowResolution.width) {
+ AppSettings.narrowResolution = res
+ }
+ }
+
+ Connections {
+ target: viewFinder
+ onSupportedWideResolutionChanged: viewFinderContainer.updateSupportedResolution_4_3(viewFinder.supportedWideResolution)
+ onSupportedNarrowResolutionChanged: viewFinderContainer.updateSupportedResolution_16_9(viewFinder.supportedNarrowResolution)
+ }
}
Image {
@@ -520,7 +547,7 @@
anchors.centerIn: viewFinderContainer
z: 2
- source: scanPage.showMarker ? markerImageProvider.source : ""
+ source: thisPage.showMarker ? markerImageProvider.source : ""
visible: status === Image.Ready
cache: false
}
@@ -547,7 +574,7 @@
}
opacity: (TorchSupported && !scanningGalleryImage) ? 1.0 : 0.0
visible: TorchSupported && opacity > 0.0
- Behavior on opacity { FadeAnimation { } }
+ Behavior on opacity { FadeAnimation { duration: toolIconFadeDuration } }
icon.source: viewFinder && viewFinder.flashOn ?
Qt.resolvedUrl("img/flash-on.svg") :
Qt.resolvedUrl("img/flash-off.svg")
@@ -555,8 +582,8 @@
//: Hint label
//% "Toggle flashlight"
|
[-]
[+]
|
Added |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/qml/pages/img/invert.svg
^
|
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64"
+ height="64"
+ version="1.1"
+ sodipodi:docname="invert.svg">
+ <rect
+ style="opacity:0;fill:#ffffff"
+ width="64"
+ height="64"/>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#5c5c5c;fill-opacity:1"
+ d="M 53,11.420396 V 51.159424 C 53,53.828113 51.099598,56 48.763358,56 H 13.993985 C 12.826433,56 11.766988,55.457679 11,54.581121 L 51.757342,8 C 52.524331,8.876558 53,10.086052 53,11.420396 Z"/>
+ <rect
+ style="fill:none;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ width="42"
+ height="48"
+ x="11"
+ y="8"
+ rx="4"
+ ry="4"/>
+</svg>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/src/Settings.cpp
^
|
@@ -24,11 +24,13 @@
#include "Settings.h"
+#include "HarbourDebug.h"
+
#include <zxing/DecodeHints.h>
#include <MGConfItem>
-#define DCONF_PATH_(x) "/apps/harbour-barcode/" x
+#define DCONF_PATH_(x) SETTINGS_DCONF_PATH_(x)
// New keys (the ones that have only been in dconf)
#define KEY_BUZZ_ON_SCAN "buzz_on_scan"
@@ -38,6 +40,8 @@
#define KEY_MAX_DIGITAL_ZOOM "max_digital_zoom"
#define KEY_VOLUME_ZOOM "volume_zoom"
#define KEY_DECODING_HINTS "decoding_hints"
+#define KEY_RESOLUTION_4_3 "resolution_4_3" // Width is stored
+#define KEY_RESOLUTION_16_9 "resolution_16_9" // Width is stored
#define DEFAULT_SOUND false
#define DEFAULT_BUZZ_ON_SCAN true
@@ -54,6 +58,11 @@
#define DEFAULT_DECODING_HINTS zxing::DecodeHints::DEFAULT_HINT.getHints()
#define DEFAULT_ORIENTATION Settings::OrientationAny
+// Camera configuration (got removed at some point)
+#define CAMERA_DCONF_PATH_(x) "/apps/jolla-camera/primary/image/" x
+#define CAMERA_DCONF_RESOLUTION_4_3 CAMERA_DCONF_PATH_("viewfinderResolution_4_3")
+#define CAMERA_DCONF_RESOLUTION_16_9 CAMERA_DCONF_PATH_("viewfinderResolution_16_9")
+
// ==========================================================================
// Settings::Private
// ==========================================================================
@@ -64,7 +73,16 @@
static const QString HINTS_ROOT;
+ static QSize toSize(const QVariant);
+ static QSize size_4_3(int);
+ static QSize size_16_9(int);
+
+ QSize resolution_4_3();
+ QSize resolution_16_9();
+
public:
+ const int iDefaultResolution_4_3;
+ const int iDefaultResolution_16_9;
MGConfItem* iSound;
MGConfItem* iBuzzOnScan;
MGConfItem* iDigitalZoom;
@@ -79,11 +97,16 @@
MGConfItem* iWideMode;
MGConfItem* iDecodingHints;
MGConfItem* iOrientation;
+ MGConfItem* iResolution_4_3;
+ MGConfItem* iResolution_16_9;
};
const QString Settings::Private::HINTS_ROOT(DCONF_PATH_("hints/"));
-Settings::Private::Private(Settings* aSettings) :
+Settings::Private::Private(
+ Settings* aSettings) :
+ iDefaultResolution_4_3(toSize(MGConfItem(CAMERA_DCONF_RESOLUTION_4_3).value()).width()),
+ iDefaultResolution_16_9(toSize(MGConfItem(CAMERA_DCONF_RESOLUTION_16_9).value()).width()),
iSound(new MGConfItem(DCONF_PATH_(KEY_SOUND), aSettings)),
iBuzzOnScan(new MGConfItem(DCONF_PATH_(KEY_BUZZ_ON_SCAN), aSettings)),
iDigitalZoom(new MGConfItem(DCONF_PATH_(KEY_DIGITAL_ZOOM), aSettings)),
@@ -97,7 +120,9 @@
iVolumeZoom(new MGConfItem(DCONF_PATH_(KEY_VOLUME_ZOOM), aSettings)),
iWideMode(new MGConfItem(DCONF_PATH_(KEY_WIDE_MODE), aSettings)),
iDecodingHints(new MGConfItem(DCONF_PATH_(KEY_DECODING_HINTS), aSettings)),
- iOrientation(new MGConfItem(DCONF_PATH_(KEY_ORIENTATION), aSettings))
+ iOrientation(new MGConfItem(DCONF_PATH_(KEY_ORIENTATION), aSettings)),
+ iResolution_4_3(new MGConfItem(DCONF_PATH_(KEY_RESOLUTION_4_3), aSettings)),
+ iResolution_16_9(new MGConfItem(DCONF_PATH_(KEY_RESOLUTION_16_9), aSettings))
{
connect(iSound, SIGNAL(valueChanged()), aSettings, SIGNAL(soundChanged()));
connect(iBuzzOnScan, SIGNAL(valueChanged()), aSettings, SIGNAL(buzzOnScanChanged()));
@@ -113,13 +138,65 @@
connect(iWideMode, SIGNAL(valueChanged()), aSettings, SIGNAL(wideModeChanged()));
connect(iDecodingHints, SIGNAL(valueChanged()), aSettings, SIGNAL(decodingHintsChanged()));
connect(iOrientation, SIGNAL(valueChanged()), aSettings, SIGNAL(orientationChanged()));
+ connect(iResolution_4_3, SIGNAL(valueChanged()), aSettings, SIGNAL(wideResolutionChanged()));
+ connect(iResolution_16_9, SIGNAL(valueChanged()), aSettings, SIGNAL(narrowResolutionChanged()));
+ HDEBUG("Default 4:3 resolution" << size_4_3(iDefaultResolution_4_3));
+ HDEBUG("Default 16:9 resolution" << size_16_9(iDefaultResolution_16_9));
+}
+
+QSize
+Settings::Private::toSize(
+ const QVariant aVariant)
+{
+ // e.g. "1920x1080"
+ if (aVariant.isValid()) {
+ const QStringList values(aVariant.toString().split('x'));
+ if (values.count() == 2) {
+ bool ok = false;
+ int width = values.at(0).toInt(&ok);
+ if (ok && width > 0) {
+ int height = values.at(1).toInt(&ok);
+ if (ok && height > 0) {
+ return QSize(width, height);
+ }
+ }
+ }
+ }
+ return QSize(0, 0);
+}
+
+QSize
+Settings::Private::size_4_3(
+ int aWidth)
+{
+ return QSize(aWidth, aWidth * 3 / 4);
+}
+
+QSize
+Settings::Private::size_16_9(
+ int aWidth)
+{
+ return QSize(aWidth, aWidth * 9 / 16);
+}
+
+QSize
+Settings::Private::resolution_4_3()
+{
+ return size_4_3(qMax(iResolution_4_3->value(iDefaultResolution_4_3).toInt(), 0));
+}
+
+QSize
+Settings::Private::resolution_16_9()
+{
+ return size_16_9(qMax(iResolution_16_9->value(iDefaultResolution_16_9).toInt(), 0));
}
// ==========================================================================
// Settings
// ==========================================================================
-Settings::Settings(QObject* aParent) :
+Settings::Settings(
+ QObject* aParent) :
QObject(aParent),
iPrivate(new Private(this))
{
@@ -130,142 +207,185 @@
delete iPrivate;
}
-QString Settings::hintKey(QString aHintName)
+QString
+Settings::hintKey(
+ QString aHintName)
{
return Private::HINTS_ROOT + aHintName;
}
-bool Settings::sound() const
+bool
+Settings::sound() const
{
return iPrivate->iSound->value(DEFAULT_SOUND).toBool();
}
-void Settings::setSound(bool aValue)
+void
+Settings::setSound(
+ bool aValue)
{
iPrivate->iSound->set(aValue);
}
-bool Settings::buzzOnScan() const
+bool
+Settings::buzzOnScan() const
{
return iPrivate->iBuzzOnScan->value(DEFAULT_BUZZ_ON_SCAN).toBool();
}
-void Settings::setBuzzOnScan(bool aValue)
+void
+Settings::setBuzzOnScan(
+ bool aValue)
{
iPrivate->iBuzzOnScan->set(aValue);
}
-int Settings::digitalZoom() const
+int
+Settings::digitalZoom() const
{
return iPrivate->iDigitalZoom->value(DEFAULT_DIGITAL_ZOOM).toInt();
}
-void Settings::setDigitalZoom(int aValue)
+void
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/src/Settings.h
^
|
@@ -25,11 +25,10 @@
#ifndef BARCODE_SETTINGS_H
#define BARCODE_SETTINGS_H
-#include <QObject>
-#include <QString>
-
#include <QtQml>
+#define SETTINGS_DCONF_PATH_(x) "/apps/harbour-barcode/" x
+
// Old keys (the ones that may need to be imported from the database)
#define KEY_SOUND "sound"
@@ -40,7 +39,8 @@
#define KEY_HISTORY_SIZE "history_size"
#define KEY_SCAN_ON_START "scan_on_start"
-class Settings : public QObject {
+class Settings : public QObject
+{
Q_OBJECT
Q_PROPERTY(bool sound READ sound WRITE setSound NOTIFY soundChanged)
Q_PROPERTY(bool buzzOnScan READ buzzOnScan WRITE setBuzzOnScan NOTIFY buzzOnScanChanged)
@@ -54,6 +54,10 @@
Q_PROPERTY(bool saveImages READ saveImages WRITE setSaveImages NOTIFY saveImagesChanged)
Q_PROPERTY(bool volumeZoom READ volumeZoom WRITE setVolumeZoom NOTIFY volumeZoomChanged)
Q_PROPERTY(bool wideMode READ wideMode WRITE setWideMode NOTIFY wideModeChanged)
+ Q_PROPERTY(qreal wideRatio READ wideRatio CONSTANT)
+ Q_PROPERTY(qreal narrowRatio READ narrowRatio CONSTANT)
+ Q_PROPERTY(QSize wideResolution READ wideResolution WRITE setWideResolution NOTIFY wideResolutionChanged)
+ Q_PROPERTY(QSize narrowResolution READ narrowResolution WRITE setNarrowResolution NOTIFY narrowResolutionChanged)
Q_PROPERTY(uint decodingHints READ decodingHints WRITE setDecodingHints NOTIFY decodingHintsChanged)
Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
Q_ENUMS(Orientation)
@@ -76,51 +80,59 @@
explicit Settings(QObject* aParent = Q_NULLPTR);
~Settings();
- Q_INVOKABLE static QString hintKey(QString aHintName);
+ Q_INVOKABLE static QString hintKey(QString);
bool sound() const;
- void setSound(bool aValue);
+ void setSound(bool);
bool buzzOnScan() const;
- void setBuzzOnScan(bool aValue);
+ void setBuzzOnScan(bool);
int digitalZoom() const;
- void setDigitalZoom(int aValue);
+ void setDigitalZoom(int);
int maxDigitalZoom() const;
- void setMaxDigitalZoom(int aValue);
+ void setMaxDigitalZoom(int);
int scanDuration() const;
- void setScanDuration(int aValue);
+ void setScanDuration(int);
int resultViewDuration() const;
- void setResultViewDuration(int aValue);
+ void setResultViewDuration(int);
QString markerColor() const;
- void setMarkerColor(QString aValue);
+ void setMarkerColor(const QString);
int historySize() const;
- void setHistorySize(int aValue);
+ void setHistorySize(int);
bool scanOnStart() const;
- void setScanOnStart(bool aValue);
+ void setScanOnStart(bool);
bool saveImages() const;
- void setSaveImages(bool aValue);
+ void setSaveImages(bool);
bool volumeZoom() const;
- void setVolumeZoom(bool aValue);
+ void setVolumeZoom(bool);
bool wideMode() const;
- void setWideMode(bool aValue);
+ void setWideMode(bool);
+
+ qreal wideRatio() const;
+ QSize wideResolution() const;
+ void setWideResolution(QSize);
+
+ qreal narrowRatio() const;
+ QSize narrowResolution() const;
+ void setNarrowResolution(QSize);
uint decodingHints() const;
- void setDecodingHints(uint aValue);
- Q_INVOKABLE void setDecodingHint(uint aValue);
- Q_INVOKABLE void clearDecodingHint(uint aValue);
+ void setDecodingHints(uint);
+ Q_INVOKABLE void setDecodingHint(uint);
+ Q_INVOKABLE void clearDecodingHint(uint);
Orientation orientation() const;
- void setOrientation(Orientation aValue);
+ void setOrientation(Orientation);
Q_SIGNALS:
void soundChanged();
@@ -135,6 +147,8 @@
void saveImagesChanged();
void volumeZoomChanged();
void wideModeChanged();
+ void wideResolutionChanged();
+ void narrowResolutionChanged();
void decodingHintsChanged();
void orientationChanged();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/src/harbour-barcode.cpp
^
|
@@ -80,34 +80,20 @@
qmlRegisterSingletonType<BarcodeUtils>(uri, v1, v2, "BarcodeUtils", BarcodeUtils::createSingleton);
}
-static QSize toSize(QVariant var)
-{
- // e.g. "1920x1080"
- if (var.isValid()) {
- QStringList values(var.toString().split('x'));
- if (values.count() == 2) {
- bool ok = false;
- int width = values.at(0).toInt(&ok);
- if (ok && width > 0) {
- int height = values.at(1).toInt(&ok);
- if (ok && height > 0) {
- return QSize(width, height);
- }
- }
- }
- }
- return QSize();
-}
-
int main(int argc, char *argv[])
{
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
bool torchSupported = false;
- // Parse Qt version to find out what's supported and what's not
const char* qver = qVersion();
HDEBUG("Qt version" << qver);
- if (qver) {
+
+ if (qgetenv("HARBOUR_BARCODE_ENABLE_TORCH").toInt() > 0 ||
+ MGConfItem(SETTINGS_DCONF_PATH_("enableTorch")).value().toBool()) {
+ torchSupported = true;
+ HDEBUG("Torch support is enabled");
+ } else if (qver) {
+ // Figure out what's supported and what's not
const QStringList s(QString(qver).split('.'));
if (s.size() >= 3) {
int v = QT_VERSION_CHECK(s[0].toInt(), s[1].toInt(), s[2].toInt());
@@ -120,6 +106,11 @@
if (flashValues.size() == 1 &&
flashValues.at(0).toInt() == QCameraExposure::FlashOff) {
HDEBUG("Flash disabled by" << qPrintable(flashValuesKey));
+ } else if (flashValues.isEmpty()) {
+ // If this DConf key is missing, assume that the torch
+ // mode is not supported
+ HDEBUG("DConf entry" << qPrintable(flashValuesKey) <<
+ "is missing, disabling the torch");
} else {
torchSupported = true;
HDEBUG("Torch supported");
@@ -128,13 +119,6 @@
}
}
- // Available 4/3 and 16/9 resolutions
- QString key_4_3(CAMERA_DCONF_KEY("viewfinderResolution_4_3"));
- QString key_16_9(CAMERA_DCONF_KEY("viewfinderResolution_16_9"));
- QSize res_4_3(toSize(MGConfItem(key_4_3).value()));
- QSize res_16_9(toSize(MGConfItem(key_16_9).value()));
- HDEBUG("Resolutions" << res_4_3 << res_16_9);
-
QLocale locale;
QTranslator* translator = new QTranslator(app.data());
QString transDir = SailfishApp::pathTo("translations").toLocalFile();
@@ -160,12 +144,6 @@
root->setContextProperty("AppVersion", APP_VERSION);
root->setContextProperty("AppSettings", settings);
root->setContextProperty("TorchSupported", torchSupported);
- if (res_4_3.isValid()) {
- root->setContextProperty("ViewfinderResolution_4_3", res_4_3);
- }
- if (res_16_9.isValid()) {
- root->setContextProperty("ViewfinderResolution_16_9", res_16_9);
- }
QOpenGLContext ctx;
int maxTextureSize = 0;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/src/scanner/BarcodeScanner.cpp
^
|
@@ -37,12 +37,23 @@
#include <QPainter>
#include <QBrush>
-#if HARBOUR_DEBUG
+#define HARBOUR_BARCODE_DEBUG_IMAGES
+#ifdef HARBOUR_BARCODE_DEBUG_IMAGES
+// In debug build saving debug images is enabled by default, in release
+// if HARBOUR_BARCODE_DEBUG_IMAGES environment is set 1 (or anything
+// non-zero, actually)
+# if HARBOUR_DEBUG
+# define HARBOUR_BARCODE_DEBUG_IMAGES_ENABLED true
+# else
+# define HARBOUR_BARCODE_DEBUG_IMAGES_ENABLED \
+ (qgetenv("HARBOUR_BARCODE_DEBUG_IMAGES").toInt() > 0)
+# endif // HARBOUR_DEBUG
#include <QStandardPaths>
static const QDir debugImageDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + "/codereader");
+static const bool debugImageEnabled = HARBOUR_BARCODE_DEBUG_IMAGES_ENABLED;
static void saveDebugImage(const QImage& aImage, const QString& aFileName)
{
- if (!aImage.isNull()) {
+ if (debugImageEnabled && debugImageDir.exists() && !aImage.isNull()) {
QString path = debugImageDir.filePath(aFileName);
if (aImage.save(path)) {
HDEBUG("image saved:" << qPrintable(path));
@@ -57,7 +68,9 @@
// BarcodeScanner::Private
// ==========================================================================
-class BarcodeScanner::Private : public QObject {
+class BarcodeScanner::Private :
+ public QObject
+{
Q_OBJECT
public:
Private(BarcodeScanner* aParent);
@@ -65,11 +78,11 @@
BarcodeScanner* scanner();
- bool setViewFinderRect(const QRect& aRect);
- bool setViewFinderItem(QObject* aValue);
- bool setMarkerColor(QString aValue);
- bool setRotation(int aDegrees);
- void startScanning(int aTimeout);
+ bool setViewFinderRect(const QRect&);
+ bool setViewFinderItem(QObject*);
+ bool setMarkerColor(QString);
+ bool setRotation(int);
+ void startScanning(int);
void stopScanning();
void grabImage();
void decodingThread();
@@ -77,15 +90,16 @@
Q_SIGNALS:
void needImage();
- void decodingDone(QImage image, Decoder::Result result);
+ void decodingDone(QImage, Decoder::Result);
public Q_SLOTS:
void onScanningTimeout();
- void onDecodingDone(QImage aImage, Decoder::Result aResult);
+ void onDecodingDone(QImage, Decoder::Result);
void onGrabImage();
public:
bool iCanGrab;
+ bool iInverted;
bool iGrabbing;
bool iScanning;
bool iNeedImage;
@@ -95,6 +109,7 @@
ScanState iLastKnownState;
QImage iCaptureImage;
+ bool iCaptureImageInverted;
QQuickItem* iViewFinderItem;
QTimer* iScanTimeout;
@@ -110,6 +125,7 @@
BarcodeScanner::Private::Private(BarcodeScanner* aParent) :
QObject(aParent),
iCanGrab(true),
+ iInverted(false),
iGrabbing(false),
iScanning(false),
iNeedImage(false),
@@ -117,6 +133,7 @@
iTimedOut(false),
iRotation(0),
iLastKnownState(Idle),
+ iCaptureImageInverted(false),
iViewFinderItem(NULL),
iScanTimeout(new QTimer(this)),
iMarkerColor(QColor(0, 255, 0)), // default green
@@ -142,12 +159,16 @@
iDecodingFuture.waitForFinished();
}
-inline BarcodeScanner* BarcodeScanner::Private::scanner()
+inline
+BarcodeScanner*
+BarcodeScanner::Private::scanner()
{
return qobject_cast<BarcodeScanner*>(parent());
}
-bool BarcodeScanner::Private::setViewFinderRect(const QRect& aRect)
+bool
+BarcodeScanner::Private::setViewFinderRect(
+ const QRect& aRect)
{
if (iViewFinderRect != aRect) {
// iViewFinderRect is accessed by decodingThread() thread
@@ -159,7 +180,9 @@
return false;
}
-bool BarcodeScanner::Private::setViewFinderItem(QObject* aItem)
+bool
+BarcodeScanner::Private::setViewFinderItem(
+ QObject* aItem)
{
QQuickItem* item = qobject_cast<QQuickItem*>(aItem);
if (iViewFinderItem != item) {
@@ -169,7 +192,9 @@
return false;
}
-bool BarcodeScanner::Private::setMarkerColor(QString aValue)
+bool
+BarcodeScanner::Private::setMarkerColor(
+ QString aValue)
{
if (QColor::isValidColor(aValue)) {
QColor color(aValue);
@@ -181,7 +206,9 @@
return false;
}
-bool BarcodeScanner::Private::setRotation(int aDegrees)
+bool
+BarcodeScanner::Private::setRotation(
+ int aDegrees)
{
if (iRotation != aDegrees) {
iDecodingMutex.lock();
@@ -192,7 +219,9 @@
return false;
}
-void BarcodeScanner::Private::startScanning(int aTimeout)
+void
+BarcodeScanner::Private::startScanning(
+ int aTimeout)
{
if (!iScanning) {
iScanning = true;
@@ -210,7 +239,8 @@
}
}
-void BarcodeScanner::Private::stopScanning()
+void
+BarcodeScanner::Private::stopScanning()
{
// stopping a running scanning process
iDecodingMutex.lock();
@@ -223,7 +253,8 @@
updateScanState();
}
-void BarcodeScanner::Private::grabImage()
+void
+BarcodeScanner::Private::grabImage()
{
QQuickWindow* window = iViewFinderItem->window();
if (window) {
@@ -239,13 +270,15 @@
HDEBUG(image);
iDecodingMutex.lock();
iCaptureImage = image;
+ iCaptureImageInverted = iInverted;
iDecodingEvent.wakeAll();
iDecodingMutex.unlock();
}
}
}
-void BarcodeScanner::Private::onGrabImage()
+void
+BarcodeScanner::Private::onGrabImage()
{
if (iViewFinderItem && iScanning) {
if (iCanGrab) {
@@ -257,7 +290,8 @@
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/src/scanner/BarcodeScanner.h
^
|
@@ -32,7 +32,8 @@
#include <QRect>
#include <QVariantMap>
-class BarcodeScanner : public QObject {
+class BarcodeScanner : public QObject
+{
Q_OBJECT
Q_PROPERTY(QObject* viewFinderItem READ viewFinderItem WRITE setViewFinderItem NOTIFY viewFinderItemChanged)
Q_PROPERTY(QRect viewFinderRect READ viewFinderRect WRITE setViewFinderRect NOTIFY viewFinderRectChanged)
@@ -41,6 +42,7 @@
Q_PROPERTY(ScanState scanState READ scanState NOTIFY scanStateChanged)
Q_PROPERTY(bool canGrab READ canGrab WRITE setCanGrab NOTIFY canGrabChanged)
Q_PROPERTY(bool grabbing READ grabbing NOTIFY grabbingChanged)
+ Q_PROPERTY(bool inverted READ inverted WRITE setInverted NOTIFY invertedChanged)
Q_PROPERTY(uint decodingHints READ decodingHints WRITE setDecodingHints NOTIFY decodingHintsChanged)
Q_ENUMS(ScanState)
@@ -57,30 +59,33 @@
BarcodeScanner(QObject* aParent = Q_NULLPTR);
virtual ~BarcodeScanner();
- Q_INVOKABLE void startScanning(int aTimeout);
+ Q_INVOKABLE void startScanning(int);
Q_INVOKABLE void stopScanning();
QObject* viewFinderItem() const;
- void setViewFinderItem(QObject* aItem);
+ void setViewFinderItem(QObject*);
const QRect& viewFinderRect() const;
- void setViewFinderRect(const QRect& aRect);
+ void setViewFinderRect(const QRect&);
QString markerColor() const;
- void setMarkerColor(QString aValue);
+ void setMarkerColor(QString);
int rotation() const;
- void setRotation(int aDegrees);
+ void setRotation(int);
ScanState scanState() const;
bool canGrab() const;
- void setCanGrab(bool aValue);
+ void setCanGrab(bool);
bool grabbing() const;
+ bool inverted() const;
+ void setInverted(bool);
+
uint decodingHints() const;
- void setDecodingHints(uint aValue);
+ void setDecodingHints(uint);
Q_SIGNALS:
void decodingFinished(QImage image, QVariantMap result);
@@ -91,6 +96,7 @@
void scanStateChanged();
void canGrabChanged();
void grabbingChanged();
+ void invertedChanged();
void decodingHintsChanged();
private:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/translations/harbour-barcode-pl.ts
^
|
@@ -679,22 +679,22 @@
<message id="contact-title-default">
<source>Contact</source>
<extracomment>Default page title (contact page)</extracomment>
- <translation type="unfinished">Kontakt</translation>
+ <translation>Kontakt</translation>
</message>
<message id="contact-detail-name">
<source>Name</source>
<extracomment>Contact detail label</extracomment>
- <translation type="unfinished">Imię</translation>
+ <translation>Imię</translation>
</message>
<message id="contact-detail-primary_name">
<source>Primary name</source>
<extracomment>Contact detail label</extracomment>
- <translation type="unfinished">Główna imię</translation>
+ <translation>Pierwsze imię</translation>
</message>
<message id="contact-detail-secondary_name">
<source>Secondary name</source>
<extracomment>Contact detail label</extracomment>
- <translation type="unfinished">Drugie imię</translation>
+ <translation>Drugie imię</translation>
</message>
<message id="contact-detail-phone">
<source>Phone</source>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/translations/harbour-barcode-pt.ts
^
|
@@ -11,7 +11,7 @@
<message id="about-description">
<source>This app demonstrates a bar code reader for Sailfish OS. We hope it is useful for other projects. CodeReader is open source and licensed under the MIT License.</source>
<extracomment>About page text</extracomment>
- <translation type="unfinished">Esta aplicação demonstra um leitor de código de barras para o sistema operativo Sailfish. Esperamos que seja útil para outros projetos. CodeReader é de código aberto e está registrado sob a licença MIT.</translation>
+ <translation>Esta aplicação demonstra um leitor de código de barras para o sistema operativo Sailfish. Esperamos que seja útil para outros projetos. CodeReader é de código aberto e está registrado sob a licença MIT.</translation>
</message>
<message id="about-version-label">
<source>Version</source>
@@ -21,7 +21,7 @@
<message id="about-author-labels">
<source>Authors</source>
<extracomment>About page label</extracomment>
- <translation type="unfinished">Autores</translation>
+ <translation>Autores</translation>
</message>
<message id="about-contributors-label">
<source>Contributors</source>
@@ -31,7 +31,7 @@
<message id="about-contributors-text">
<source>%1 and others.</source>
<extracomment>About page text</extracomment>
- <translation type="unfinished">%1 e outros.</translation>
+ <translation>%1 e outros.</translation>
</message>
<message id="about-source_code-label">
<source>Source code</source>
@@ -41,7 +41,7 @@
<message id="about-source_code-description">
<source>You can also file issues and bug reports there.</source>
<extracomment>About page description for source code URL</extracomment>
- <translation type="unfinished">Você também pode enviar problemas e relatórios de bug lá.</translation>
+ <translation>Aí também pode relatar problemas e submeter relatórios de bug lá.</translation>
</message>
<message id="about-references-label">
<source>References</source>
@@ -56,12 +56,12 @@
<message id="about-supported_codes-label">
<source>Supported 1D/2D bar codes</source>
<extracomment>About page label</extracomment>
- <translation>Suporta códigos de barras 1D/2D</translation>
+ <translation>Códigos de barras 1D/2D suportados</translation>
</message>
<message id="scan-slider-zoom">
<source>Zoom</source>
<extracomment>Slider label</extracomment>
- <translation type="unfinished">Zoom</translation>
+ <translation>Ampliação</translation>
</message>
<message id="scan-action-scan">
<source>Scan</source>
@@ -81,7 +81,7 @@
<message id="scan-status-nothing_found">
<source>No code detected! Try again.</source>
<extracomment>Scan status label</extracomment>
- <translation>Nenhum código detetado! Tente novamente.</translation>
+ <translation>Nenhum código detetado! Tenta novamente.</translation>
</message>
<message id="settings-title">
<source>Settings</source>
@@ -91,12 +91,12 @@
<message id="settings-formats-section">
<source>Barcode formats</source>
<extracomment>Section header</extracomment>
- <translation type="unfinished">Formatos de código de barras</translation>
+ <translation>Formatos de código de barras</translation>
</message>
<message id="settings-formats-description">
<source>Disabling the formats that you don't need speeds up the decoding and reduces the risk of incorrect recognition of the barcode type.</source>
<extracomment>Section description</extracomment>
- <translation type="unfinished">Desativar os formatos desnecessários acelera a decodificação e reduz o risco de reconhecimento incorreto do tipo de código de barras.</translation>
+ <translation>Desativar os formatos desnecessários acelera a decodificação e reduz o risco de reconhecimento incorreto do tipo de código de barras.</translation>
</message>
<message id="settings-scan-section">
<source>Scan</source>
@@ -111,7 +111,7 @@
<message id="settings-vibration-label">
<source>Vibrate on detection</source>
<extracomment>Switch button text</extracomment>
- <translation type="unfinished">Vibrar na detecção de código</translation>
+ <translation>Vibrar na deteção de código</translation>
</message>
<message id="settings-autoscan-label">
<source>Scan on start</source>
@@ -121,7 +121,7 @@
<message id="settings-volume_zoom-label">
<source>Zoom with volume keys</source>
<extracomment>Switch button text</extracomment>
- <translation type="unfinished">Zoom com as teclas de volume</translation>
+ <translation>Ampliação com as teclas de volume</translation>
</message>
<message id="settings-save_images-label">
<source>Save barcode images</source>
@@ -252,7 +252,7 @@
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
- <translation type="unfinished">Certificado COVID</translation>
+ <translation>Certificado COVID</translation>
</message>
<message id="button-open_link">
<source>Open link</source>
@@ -307,27 +307,27 @@
<message id="contact-menu-save_contact">
<source>Save contact</source>
<extracomment>Pulley menu item (saves contact)</extracomment>
- <translation type="unfinished">Salvar contato</translation>
+ <translation>Guardar contacto</translation>
</message>
<message id="contact-notification-saved">
<source>Contact saved</source>
<extracomment>Pop-up notification</extracomment>
- <translation type="unfinished">O contato é salvo</translation>
+ <translation>Contacto gravado</translation>
</message>
<message id="contact-notification-maybe_saved">
<source>Contact saved (or at least we tried)</source>
<extracomment>Pop-up notification</extracomment>
- <translation type="unfinished">O contato é salvo (pelo menos tentamos)</translation>
+ <translation>Contacto gravado (pelo menos tentámos)</translation>
</message>
<message id="contact-notification-failed">
<source>Failed to save the contact</source>
<extracomment>Pop-up notification</extracomment>
- <translation type="unfinished">Contato não pôde ser salvo</translation>
+ <translation>Não foi possível gravar o contacto</translation>
</message>
<message id="contact-notification-failed_jailed">
<source>Failed to save the contact (blocked by sandboxing?)</source>
<extracomment>Pop-up notification</extracomment>
- <translation type="unfinished">O contato não pôde ser salvo (bloqueado pela caixa de areia?)</translation>
+ <translation>Não foi possível gravar o contacto (bloqueado pela caixa de areia?)</translation>
</message>
<message id="notification-copied_to_clipboard">
<source>Copied to clipboard</source>
@@ -342,12 +342,12 @@
<message id="hint-aspect-ratio">
<source>Switch the aspect ratio between 9:16 and 3:4</source>
<extracomment>Hint label</extracomment>
- <translation>Mudar proporções de aspecto entre 9:16 e 3:4</translation>
+ <translation>Mudar proporções de aspeto entre 9:16 e 3:4</translation>
</message>
<message id="hint-aspect-ratio_landscape">
<source>Switch the aspect ratio between 16:9 and 4:3</source>
<extracomment>Hint label</extracomment>
- <translation>Mudar proporções de aspecto entre 9:16 e 3:4</translation>
+ <translation>Mudar proporções de aspeto entre 16:9 e 4:3</translation>
</message>
<message id="hint-copy-clipboard">
<source>Copy to clipboard</source>
@@ -372,12 +372,12 @@
<message id="hint-covid_certificate">
<source>Show EU digital COVID certificate</source>
<extracomment>Hint label</extracomment>
- <translation type="unfinished">Mostrar certificado digital COVID da UE</translation>
+ <translation>Mostrar certificado digital COVID da UE</translation>
</message>
<message id="hint-add_to_calendar">
<source>Add event to calendar</source>
<extracomment>Hint label</extracomment>
- <translation type="unfinished">Adicionar evento ao calendário</translation>
+ <translation>Adicionar evento ao calendário</translation>
</message>
<message id="settings-display-section">
<source>Display</source>
@@ -452,27 +452,27 @@
<message id="scan-gallery-menu">
<source>Scan from Gallery</source>
<extracomment>Pulley menu item</extracomment>
- <translation type="unfinished">Digitalizar da galeria</translation>
+ <translation>Digitalizar da galeria</translation>
</message>
<message id="gallery-title">
<source>Select image</source>
<extracomment>Page header</extracomment>
- <translation type="unfinished">Selecione a imagem</translation>
+ <translation>Seleciona a imagem</translation>
</message>
<message id="gallery-empty">
<source>No images found in the gallery</source>
<extracomment>Placeholder text</extracomment>
- <translation type="unfinished">Nenhuma imagem encontrada na galeria</translation>
+ <translation>Nenhuma imagem encontrada na galeria</translation>
</message>
<message id="gallery-thumbnail-error">
<source>Error</source>
<extracomment>Thumbnail image loading failed</extracomment>
- <translation type="unfinished">Erro</translation>
+ <translation>Erro</translation>
</message>
<message id="gallery-rotate">
<source>Rotate</source>
<extracomment>Rotation widget</extracomment>
- <translation type="unfinished">Girar</translation>
+ <translation>Rodar</translation>
</message>
<message id="dgcert-page_header">
<source>EU Digital COVID Certificate</source>
@@ -482,217 +482,217 @@
<message id="dgcert-schema_version">
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.49.tar.bz2/translations/harbour-barcode-sk.ts
^
|
@@ -679,22 +679,22 @@
<message id="contact-title-default">
<source>Contact</source>
<extracomment>Default page title (contact page)</extracomment>
- <translation type="unfinished">Kontakt</translation>
+ <translation>Kontakt</translation>
</message>
<message id="contact-detail-name">
<source>Name</source>
<extracomment>Contact detail label</extracomment>
- <translation type="unfinished">Meno</translation>
+ <translation>Názov</translation>
</message>
<message id="contact-detail-primary_name">
<source>Primary name</source>
<extracomment>Contact detail label</extracomment>
- <translation type="unfinished">Hlavné meno</translation>
+ <translation>Hlavný názov</translation>
</message>
<message id="contact-detail-secondary_name">
<source>Secondary name</source>
<extracomment>Contact detail label</extracomment>
- <translation type="unfinished">Druhé meno</translation>
+ <translation>Vedľajší názov</translation>
</message>
<message id="contact-detail-phone">
<source>Phone</source>
|