[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/harbour-foilpics.git</param>
<param name="branch">master</param>
- <param name="revision">95f1523</param>
+ <param name="revision">eebaefa</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/foil-ui/FoilUiConfirmPasswordDialog.qml
^
|
@@ -13,8 +13,8 @@
property bool wrongPassword
readonly property bool landscapeLayout: isLandscape && Screen.sizeCategory < Screen.Large
- readonly property bool canCheckPassword: inputField.text.length > 0 &&
- inputField.text.length > 0 && !wrongPassword
+ readonly property bool canCheckPassword: inputField.text.length > 0 && !wrongPassword
+ readonly property int fullHeight: dialog.isPortrait ? Screen.height : Screen.width
signal passwordConfirmed()
@@ -60,8 +60,8 @@
id: panel
width: parent.width
- height: childrenRect.height
- y: (parent.height > height) ? Math.floor((parent.height - height)/2) : (parent.height - height)
+ height: childrenRect.height + (landscapeLayout ? 0 : Theme.paddingLarge)
+ y: Math.min((fullHeight - height)/2, parent.height - panel.height)
Label {
id: warning
@@ -93,10 +93,7 @@
Button {
id: button
- anchors {
- topMargin: Theme.paddingLarge
- bottomMargin: 2 * Theme.paddingSmall
- }
+ anchors.bottomMargin: Theme.paddingLarge
text: foilUi.qsTrConfirmPasswordButton()
enabled: dialog.canCheckPassword
onClicked: dialog.checkPassword()
@@ -120,10 +117,7 @@
},
PropertyChanges {
target: inputField
- anchors {
- rightMargin: 0
- bottomMargin: Theme.paddingLarge
- }
+ anchors.rightMargin: 0
},
AnchorChanges {
target: button
@@ -150,10 +144,7 @@
},
PropertyChanges {
target: inputField
- anchors {
- rightMargin: Theme.horizontalPageMargin
- bottomMargin: Theme.paddingSmall
- }
+ anchors.rightMargin: Theme.horizontalPageMargin
},
AnchorChanges {
target: button
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/foil-ui/FoilUiEnterPasswordView.qml
^
|
@@ -55,7 +55,7 @@
anchors.horizontalCenter: parent.horizontalCenter
y: (panel.y > height) ? Math.floor((panel.y - height)/2) : (panel.y - height)
- // Hide it when it's only partially visible (i.e. in langscape)
+ // Hide it when it's only partially visible (i.e. in landscape)
// or getting too close to the edge of the screen
opacity: (y < Theme.paddingLarge) ? 0 : 1
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/foil-ui/FoilUiGenerateKeyPage.qml
^
|
@@ -10,6 +10,9 @@
allowedOrientations: Orientation.All
+ // Otherwise width is changing with a delay, causing visible layout changes
+ onIsLandscapeChanged: width = isLandscape ? Screen.height : Screen.width
+
Connections {
target: foilModel
onFoilStateChanged: {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/foil-ui/FoilUiGenerateKeyView.qml
^
|
@@ -4,22 +4,23 @@
import "../harbour"
Item {
- id: view
+ id: thisView
property var foilUi
property var foilModel
property Page page
property alias prompt: promptLabel.text
- readonly property int minPassphraseLen: 8
- readonly property bool canGenerate: inputField.text.length >= minPassphraseLen && !generating
- readonly property bool generating: foilUi.isGeneratingKeyState(foilModel.foilState)
- readonly property bool landscapeLayout: page.isLandscape && Screen.sizeCategory < Screen.Large
+ readonly property int _minPassphraseLen: 8
+ readonly property bool _canGenerate: inputField.text.length >= _minPassphraseLen && !_generating
+ readonly property bool _generating: foilUi.isGeneratingKeyState(foilModel.foilState)
+ readonly property bool _landscapeLayout: page.isLandscape && Screen.sizeCategory < Screen.Large
+ readonly property int _fullHeight: page.isPortrait ? Screen.height : Screen.width
function generateKey() {
- if (canGenerate) {
+ if (_canGenerate) {
var dialog = pageStack.push(Qt.resolvedUrl("FoilUiConfirmPasswordDialog.qml"), {
- foilUi: view.foilUi,
+ foilUi: thisView.foilUi,
allowedOrientations: page.allowedOrientations,
password: inputField.text
})
@@ -35,22 +36,22 @@
HarbourHighlightIcon {
source: "images/key.svg"
width: Theme.itemSizeHuge
- sourceSize.width: width
+ sourceSize.width: Theme.itemSizeHuge
anchors.horizontalCenter: parent.horizontalCenter
- property real attachToY: panel.y + keySize.y
+ property real attachToY: panel.y + (promptLabel.visible ? promptLabel.y : keySize.y)
y: (attachToY > height) ? Math.floor((attachToY - height)/2) : (attachToY - height)
visible: opacity > 0
// Hide it when it's getting too close to the top if the view
- // Otherwise show it when the prompt is hidden
- opacity: (y < Theme.paddingLarge) ? 0 : (1 - promptLabel.opacity)
+ opacity: (y < Theme.paddingLarge) ? 0 : 1
+ Behavior on opacity { FadeAnimation { } }
}
Item {
id: panel
width: parent.width
- height: childrenRect.height
- y: (parent.height > height) ? Math.floor((parent.height - height)/2) : (parent.height - height)
+ height: childrenRect.height + (_landscapeLayout ? 0 : Theme.paddingLarge)
+ y: Math.min((_fullHeight - height)/2, parent.height - panel.height)
InfoLabel {
id: promptLabel
@@ -65,8 +66,8 @@
id: keySize
label: foilUi.qsTrGenerateKeySizeLabel()
- enabled: !generating
- width: parent.width
+ enabled: !_generating
+ width: inputField.width
anchors {
top: promptLabel.bottom
topMargin: Theme.paddingLarge
@@ -87,40 +88,30 @@
top: keySize.bottom
topMargin: Theme.paddingLarge
}
- label: text.length < minPassphraseLen ?
- foilUi.qsTrGenerateKeyPasswordDescription(minPassphraseLen) :
+ label: text.length < _minPassphraseLen ?
+ foilUi.qsTrGenerateKeyPasswordDescription(_minPassphraseLen) :
placeholderText
- enabled: !generating
- EnterKey.enabled: canGenerate
+ enabled: !_generating
+ EnterKey.enabled: _canGenerate
EnterKey.onClicked: generateKey()
}
Button {
id: button
- anchors.topMargin: Theme.paddingLarge
- text: generating ?
+ anchors.bottomMargin: Theme.paddingLarge
+ text: _generating ?
foilUi.qsTrGenerateKeyButtonGenerating() :
foilUi.qsTrGenerateKeyButtonGenerate()
- enabled: canGenerate
+ enabled: _canGenerate
onClicked: generateKey()
}
-
- // Theme.paddingLarge pixels below the button in portrait
- Item {
- height: landscapeLayout ? 0 : Theme.paddingLarge
- anchors {
- top: button.bottom
- left: button.left
- right: button.right
- }
- }
}
states: [
State {
name: "portrait"
- when: !landscapeLayout
+ when: !_landscapeLayout
changes: [
AnchorChanges {
target: inputField
@@ -134,7 +125,9 @@
target: button
anchors {
top: inputField.bottom
+ right: undefined
horizontalCenter: parent.horizontalCenter
+ bottom: undefined
}
},
PropertyChanges {
@@ -145,7 +138,7 @@
},
State {
name: "landscape"
- when: landscapeLayout
+ when: _landscapeLayout
changes: [
AnchorChanges {
target: inputField
@@ -158,9 +151,10 @@
AnchorChanges {
target: button
anchors {
- top: keySize.bottom
+ top: undefined
right: panel.right
horizontalCenter: undefined
+ bottom: inputField.bottom
}
},
PropertyChanges {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/harbour-lib.pro
^
|
@@ -36,6 +36,7 @@
src/HarbourOrganizeListModel.cpp \
src/HarbourPolicyPlugin.cpp \
src/HarbourProcessState.cpp \
+ src/HarbourProtoBuf.cpp \
src/HarbourSelectionListModel.cpp \
src/HarbourSigChildHandler.cpp \
src/HarbourSingleImageProvider.cpp \
@@ -46,7 +47,8 @@
src/HarbourTask.cpp \
src/HarbourTemporaryFile.cpp \
src/HarbourTransferMethodInfo.cpp \
- src/HarbourTransferMethodsModel.cpp
+ src/HarbourTransferMethodsModel.cpp \
+ src/HarbourUtil.cpp
greaterThan(QT_MAJOR_VERSION, 4) {
SOURCES += \
@@ -70,6 +72,7 @@
include/HarbourOrganizeListModel.h \
include/HarbourPolicyPlugin.h \
include/HarbourProcessState.h \
+ include/HarbourProtoBuf.h \
include/HarbourSelectionListModel.h \
include/HarbourSigChildHandler.h \
include/HarbourSingleImageProvider.h \
@@ -80,7 +83,8 @@
include/HarbourTask.h \
include/HarbourTemporaryFile.h \
include/HarbourTransferMethodInfo.h \
- include/HarbourTransferMethodsModel.h
+ include/HarbourTransferMethodsModel.h \
+ include/HarbourUtil.h
greaterThan(QT_MAJOR_VERSION, 4) {
PUBLIC_HEADERS += \
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/include/HarbourBase32.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019-2021 Jolla Ltd.
- * Copyright (C) 2019-2021 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2022 Jolla Ltd.
+ * Copyright (C) 2019-2022 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -37,13 +37,15 @@
#include <QString>
#include <QByteArray>
-class HarbourBase32 {
+class HarbourBase32
+{
class Private;
- HarbourBase32();
+ HarbourBase32() Q_DECL_EQ_DELETE;
+
public:
- static QByteArray fromBase32(QString aBase32);
- static QString toBase32(QByteArray aBinary, bool aLowerCase = true);
- static bool isValidBase32(QString aBase32);
+ static bool isValidBase32(const QString);
+ static QString toBase32(const QByteArray, bool aLowerCase = true);
+ static QByteArray fromBase32(const QString);
};
#endif // HARBOUR_BASE32_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/include/HarbourBase45.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2021 Jolla Ltd.
- * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2021-2022 Jolla Ltd.
+ * Copyright (C) 2021-2022 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -37,13 +37,15 @@
#include <QString>
#include <QByteArray>
-class HarbourBase45 {
+class HarbourBase45
+{
class Private;
- HarbourBase45();
+ HarbourBase45() Q_DECL_EQ_DELETE;
+
public:
- static bool isValidBase45(QString aBase45);
- static QByteArray fromBase45(QString aBase45);
- static QString toBase45(QByteArray aBinary);
+ static bool isValidBase45(const QString);
+ static QString toBase45(const QByteArray);
+ static QByteArray fromBase45(const QString);
};
#endif // HARBOUR_BASE45_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/include/HarbourProtoBuf.h
^
|
@@ -0,0 +1,64 @@
+/*
+ * 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_PROTOBUF_H
+#define HARBOUR_PROTOBUF_H
+
+#include <QByteArray>
+
+#include <gutil_types.h>
+
+// https://developers.google.com/protocol-buffers/docs/encoding
+
+class HarbourProtoBuf
+{
+ HarbourProtoBuf() Q_DECL_EQ_DELETE;
+
+public:
+ enum {
+ TYPE_SHIFT = 3,
+ TYPE_MASK = ((1 << TYPE_SHIFT)-1),
+ TYPE_VARINT = 0,
+ TYPE_DELIMITED = 2
+ };
+
+ static QByteArray* appendVarInt(QByteArray*, quint64);
+ static QByteArray* appendVarIntKeyValue(QByteArray*, quint64, quint64);
+ static QByteArray* appendDelimitedValue(QByteArray*, const QByteArray);
+ static QByteArray* appendDelimitedKeyValue(QByteArray*, quint64, const QByteArray);
+
+ static bool parseVarInt(GUtilRange*, quint64*);
+ static bool parseDelimitedValue(GUtilRange*, GUtilData*);
+};
+
+#endif // HARBOUR_PROTOBUF_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/include/HarbourTheme.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2021 Jolla Ltd.
- * Copyright (C) 2018-2021 Slava Monich <slava@monich.com>
+ * Copyright (C) 2018-2022 Jolla Ltd.
+ * Copyright (C) 2018-2022 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -81,8 +81,6 @@
qreal opacityHigh() const;
qreal opacityOverlay() const;
- static QRgb invertedRgb(QRgb aRgb);
-
Q_INVOKABLE static QColor invertedColor(const QColor& aColor);
Q_INVOKABLE static qreal colorDifference(const QColor& aColor1, const QColor& aColor2);
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/include/HarbourUtil.h
^
|
@@ -0,0 +1,69 @@
+/*
+ * 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_UTIL_H
+#define HARBOUR_UTIL_H
+
+#include <QByteArray>
+#include <QColor>
+#include <QObject>
+#include <QRgb>
+#include <QString>
+
+class QQmlEngine;
+class QJSEngine;
+
+class HarbourUtil :
+ public QObject
+{
+ Q_OBJECT
+ class Private;
+
+public:
+ explicit HarbourUtil(QObject* aParent = Q_NULLPTR);
+
+ // Callback for qmlRegisterSingletonType<HarbourUtil>
+ static QObject* createSingleton(QQmlEngine*, QJSEngine*);
+
+ // QML (and possibly native) utilities
+ Q_INVOKABLE static QColor invertedColor(const QColor&);
+
+ // Static utilities
+ static QRgb invertedRgb(QRgb);
+ static QByteArray toHexBytes(const void*, size_t);
+ static QString toHex(const void*, size_t);
+ static inline QString toHex(const QByteArray& aData)
+ { return toHex(aData.constData(), aData.size()); }
+};
+
+#endif // HARBOUR_UTIL_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/src/HarbourBase32.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2022 Jolla Ltd.
+ * Copyright (C) 2019-2022 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -46,25 +46,33 @@
// HarbourBase32::Private
// ==========================================================================
-class HarbourBase32::Private {
+class HarbourBase32::Private
+{
public:
- static char nibbleToBase32(int nibble, char a);
- static int base32ToNibble(char a);
+ static char nibbleToBase32(int, char);
+ static int base32ToNibble(char);
};
-inline char HarbourBase32::Private::nibbleToBase32(int nibble, char a)
+inline
+char
+HarbourBase32::Private::nibbleToBase32(
+ int aNibble,
+ char aBaseChar)
{
- return (nibble < 26) ? (a + nibble) : ('2' + (nibble - 26));
+ return (aNibble < 26) ? (aBaseChar + aNibble) : ('2' + (aNibble - 26));
}
-inline int HarbourBase32::Private::base32ToNibble(char c)
+inline
+int
+HarbourBase32::Private::base32ToNibble(
+ char aChar)
{
- if (c >= 'a' && c <= 'z') {
- return c - 'a';
- } else if (c >= 'A' && c <= 'Z') {
- return c - 'A';
- } else if (c >= '2' && c <= '7') {
- return 26 + (c - '2');
+ if (aChar >= 'a' && aChar <= 'z') {
+ return aChar - 'a';
+ } else if (aChar >= 'A' && aChar <= 'Z') {
+ return aChar - 'A';
+ } else if (aChar >= '2' && aChar <= '7') {
+ return 26 + (aChar - '2');
} else {
return -1;
}
@@ -74,7 +82,9 @@
// HarbourBase32
// ==========================================================================
-bool HarbourBase32::isValidBase32(QString aBase32)
+bool
+HarbourBase32::isValidBase32(
+ QString aBase32)
{
const int n = aBase32.length();
const QChar* chars = aBase32.constData();
@@ -133,7 +143,9 @@
return !empty;
}
-QByteArray HarbourBase32::fromBase32(QString aBase32)
+QByteArray
+HarbourBase32::fromBase32(
+ const QString aBase32)
{
QByteArray out;
@@ -205,7 +217,10 @@
return out;
}
-QString HarbourBase32::toBase32(QByteArray aBinary, bool aLowerCase)
+QString
+HarbourBase32::toBase32(
+ const QByteArray aBinary,
+ bool aLowerCase)
{
QString str;
const int n = aBinary.size();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/src/HarbourBase45.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2021 Jolla Ltd.
- * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2021-2022 Jolla Ltd.
+ * Copyright (C) 2021-2022 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -39,7 +39,8 @@
// HarbourBase45::Private
// ==========================================================================
-class HarbourBase45::Private {
+class HarbourBase45::Private
+{
public:
enum {
BASE = 45,
@@ -48,7 +49,7 @@
};
static const char mapBase45[BASE];
static const int reverseMapBase45[REVERSE_MAP_SIZE];
- static bool isValidChar(uint x);
+ static bool isValidChar(uint);
};
const char HarbourBase45::Private::mapBase45[HarbourBase45::Private::BASE] = {
@@ -75,16 +76,22 @@
33, 34, 35
};
-inline bool HarbourBase45::Private::isValidChar(uint x)
+inline
+bool
+HarbourBase45::Private::isValidChar(
+ uint aChar)
{
- return (x < Private::REVERSE_MAP_SIZE) && Private::reverseMapBase45[x] >= 0;
+ return (aChar < Private::REVERSE_MAP_SIZE) &&
+ Private::reverseMapBase45[aChar] >= 0;
}
// ==========================================================================
// HarbourBase45::Private
// ==========================================================================
-bool HarbourBase45::isValidBase45(QString aBase45)
+bool
+HarbourBase45::isValidBase45(
+ const QString aBase45)
{
const int len = aBase45.length();
@@ -123,7 +130,9 @@
return false;
}
-QByteArray HarbourBase45::fromBase45(QString aBase45)
+QByteArray
+HarbourBase45::fromBase45(
+ const QString aBase45)
{
QByteArray out;
const int len = aBase45.length();
@@ -175,7 +184,9 @@
return out;
}
-QString HarbourBase45::toBase45(QByteArray aBinary)
+QString
+HarbourBase45::toBase45(
+ const QByteArray aBinary)
{
const uchar* ptr = (uchar*)aBinary.constData();
const int n = aBinary.size();
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/src/HarbourProtoBuf.cpp
^
|
@@ -0,0 +1,130 @@
+/*
+ * 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 "HarbourDebug.h"
+#include "HarbourProtoBuf.h"
+
+// https://developers.google.com/protocol-buffers/docs/encoding
+
+QByteArray*
+HarbourProtoBuf::appendVarInt(
+ QByteArray* aOutput,
+ quint64 aValue)
+{
+ uchar out[10];
+ quint64 value = aValue;
+ int i = sizeof(out) - 1;
+
+ out[i] = value & 0x7f;
+ value >>= 7;
+ while (value) {
+ out[--i] = 0x80 | (uchar)value;
+ value >>= 7;
+ }
+
+ const int n = sizeof(out) - i;
+
+ aOutput->reserve(aOutput->size() + n);
+ aOutput->append((char*)(out + i), n);
+ return aOutput;
+}
+
+QByteArray*
+HarbourProtoBuf::appendVarIntKeyValue(
+ QByteArray* aOutput,
+ quint64 aKey,
+ quint64 aValue)
+{
+ HASSERT((aKey & TYPE_MASK) == TYPE_VARINT);
+ return appendVarInt(appendVarInt(aOutput, aKey), aValue);
+}
+
+QByteArray*
+HarbourProtoBuf::appendDelimitedValue(
+ QByteArray* aOutput,
+ const QByteArray aValue)
+{
+ appendVarInt(aOutput, aValue.size())->append(aValue);
+ return aOutput;
+}
+
+QByteArray*
+HarbourProtoBuf::appendDelimitedKeyValue(
+ QByteArray* aOutput,
+ quint64 aKey,
+ const QByteArray aValue)
+{
+ HASSERT((aKey & TYPE_MASK) == TYPE_DELIMITED);
+ return appendDelimitedValue(appendVarInt(aOutput, aKey), aValue);
+}
+
+bool
+HarbourProtoBuf::parseVarInt(
+ GUtilRange* aPos,
+ quint64* aResult)
+{
+ quint64 value = 0;
+ const guint8* ptr = aPos->ptr;
+
+ for (int i = 0; i < 10 && ptr < aPos->end; i++, ptr++) {
+ value = (value << 7) | (*ptr & 0x7f);
+ if (!(*ptr & 0x80)) {
+ aPos->ptr = ptr + 1;
+ *aResult = value;
+ return true;
+ }
+ }
+
+ // Premature end of stream or too many bytes
+ *aResult = 0;
+ return false;
+}
+
+// A delimited value is stored as a size, encoded as a varint, followed
+// by the payload of type (message | string | bytes | packed)
+bool
+HarbourProtoBuf::parseDelimitedValue(
+ GUtilRange* aPos,
+ GUtilData* aPayload)
+{
+ GUtilRange pos = *aPos;
+ quint64 size;
+
+ if (parseVarInt(&pos, &size) && (pos.ptr + size) <= pos.end) {
+ aPayload->bytes = pos.ptr;
+ aPayload->size = size;
+ aPos->ptr = pos.ptr + size;
+ return true;
+ }
+ return false;
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/src/HarbourTheme.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2021 Jolla Ltd.
- * Copyright (C) 2018-2021 Slava Monich <slava@monich.com>
+ * Copyright (C) 2018-2022 Jolla Ltd.
+ * Copyright (C) 2018-2022 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -31,9 +31,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "HarbourTheme.h"
-#include "HarbourSystem.h"
#include "HarbourDebug.h"
+#include "HarbourSystem.h"
+#include "HarbourTheme.h"
+#include "HarbourUtil.h"
#include <QQmlEngine>
@@ -212,21 +213,12 @@
QColor HarbourTheme::invertedPrimaryColor() const
{
- return invertedColor(Private::primaryColor());
-}
-
-QRgb HarbourTheme::invertedRgb(QRgb aRgb)
-{
- return ((~(aRgb & RGB_MASK)) & RGB_MASK) | (aRgb & (~RGB_MASK));
+ return HarbourUtil::invertedColor(Private::primaryColor());
}
QColor HarbourTheme::invertedColor(const QColor& aColor)
{
- if (aColor.isValid()) {
- return QColor(invertedRgb(aColor.rgba()));
- } else {
- return aColor;
- }
+ return HarbourUtil::invertedColor(aColor);
}
qreal HarbourTheme::colorDifference(const QColor& aColor1, const QColor& aColor2)
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/src/HarbourUtil.cpp
^
|
@@ -0,0 +1,116 @@
+/*
+ * 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 "HarbourUtil.h"
+
+// ==========================================================================
+// HarbourUtil::Private
+// ==========================================================================
+
+class HarbourUtil::Private
+{
+public:
+ static const char hex[];
+};
+
+const char HarbourUtil::Private::hex[] = "0123456789abcdef";
+
+// ==========================================================================
+// HarbourUtil
+// ==========================================================================
+
+HarbourUtil::HarbourUtil(
+ QObject* aParent) :
+ QObject(aParent)
+{
+}
+
+// Callback for qmlRegisterSingletonType<HarbourUtil>
+QObject*
+HarbourUtil::createSingleton(
+ QQmlEngine*,
+ QJSEngine*)
+{
+ return new HarbourUtil();
+}
+
+QColor
+HarbourUtil::invertedColor(
+ const QColor& aColor)
+{
+ if (aColor.isValid()) {
+ const QRgb inv = invertedRgb(aColor.rgba());
+
+ return QColor(qRed(inv), qGreen(inv), qBlue(inv), qAlpha(inv));
+ } else {
+ return aColor;
+ }
+}
+
+QRgb
+HarbourUtil::invertedRgb(
+ QRgb aRgb)
+{
+ return ((~(aRgb & RGB_MASK)) & RGB_MASK) | (aRgb & (~RGB_MASK));
+}
+
+QString
+HarbourUtil::toHex(
+ const void* aData,
+ size_t aSize)
+{
+ QString hex;
+
+ if (aSize > 0) {
+ const uchar* bytes = (const uchar*)aData;
+
+ hex.reserve(2 * aSize);
+ for (size_t i = 0; i < aSize; i++) {
+ const uchar b = bytes[i];
+
+ hex.append(QChar(Private::hex[(b & 0xf0) >> 4]));
+ hex.append(QChar(Private::hex[b & 0x0f]));
+ }
+ }
+ return hex;
+}
+
+QByteArray
+HarbourUtil::toHexBytes(
+ const void* aData,
+ size_t aSize)
+{
+ return aSize ?
+ QByteArray::fromRawData((const char*) aData, (int) aSize).toHex() :
+ QByteArray();
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/test/Makefile
^
|
@@ -4,3 +4,4 @@
%:
@$(MAKE) -C TestHarbourBase32 $*
@$(MAKE) -C TestHarbourBase45 $*
+ @$(MAKE) -C TestHarbourUtil $*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/test/Makefile.common
^
|
@@ -31,6 +31,8 @@
SRC_DIR = .
TOP_DIR = ../..
HARBOUR_DIR = $(TOP_DIR)
+HARBOUR_INCLUDE_DIR = $(HARBOUR_DIR)/include
+HARBOUR_SRC_DIR = $(HARBOUR_DIR)/src
BUILD_DIR = build
DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
RELEASE_BUILD_DIR = $(BUILD_DIR)/release
@@ -44,7 +46,7 @@
LD = $(CC)
MOC = qtchooser -run-tool=moc -qt=5
WARNINGS = -Wall
-INCLUDES = -I$(BUILD_DIR) -I$(HARBOUR_DIR)/include
+INCLUDES = -I$(BUILD_DIR) -I$(HARBOUR_INCLUDE_DIR)
BASE_FLAGS = -fPIC
BASE_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS)
BASE_CFLAGS = $(BASE_FLAGS) $(CFLAGS)
@@ -84,6 +86,9 @@
$(MOC_CPP:%.cpp=$(COVERAGE_BUILD_DIR)/moc_cpp_%.o) \
$(SRC:%.cpp=$(COVERAGE_BUILD_DIR)/%.o) \
$(HARBOUR_SRC:%.cpp=$(COVERAGE_BUILD_DIR)/harbour_%.o)
+GEN_FILES = \
+ $(MOC_H:%.h=$(BUILD_DIR)/moc_%.cpp) \
+ $(MOC_CPP:%.cpp=$(BUILD_DIR)/%.moc)
#
# Dependencies
@@ -96,6 +101,7 @@
endif
endif
+$(GEN_FILES): | $(BUILD_DIR)
$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
$(COVERAGE_OBJS): | $(COVERAGE_BUILD_DIR)
@@ -139,10 +145,10 @@
$(COVERAGE_BUILD_DIR):
mkdir -p $@
-$(BUILD_DIR)/moc_%.cpp : $(APP_DIR)/%.h
+$(BUILD_DIR)/moc_%.cpp : $(HARBOUR_INCLUDE_DIR)/%.h
$(MOC) $< -o $@
-$(BUILD_DIR)/%.moc : $(APP_DIR)/%.cpp
+$(BUILD_DIR)/%.moc : $(HARBOUR_SRC_DIR)/%.cpp
$(MOC) $< -o $@
$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
@@ -163,31 +169,22 @@
$(COVERAGE_BUILD_DIR)/moc_h_%.o : $(BUILD_DIR)/moc_%.cpp $(BUILD_DIR)
$(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-$(DEBUG_BUILD_DIR)/moc_cpp_%.o : $(HARBOUR_DIR)/%.cpp $(BUILD_DIR)/%.moc
+$(DEBUG_BUILD_DIR)/moc_cpp_%.o : $(HARBOUR_SRC_DIR)/%.cpp $(BUILD_DIR)/%.moc
$(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-$(RELEASE_BUILD_DIR)/moc_cpp_%.o : $(HARBOUR_DIR)/%.cpp $(BUILD_DIR)/%.moc
+$(RELEASE_BUILD_DIR)/moc_cpp_%.o : $(HARBOUR_SRC_DIR)/%.cpp $(BUILD_DIR)/%.moc
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-$(COVERAGE_BUILD_DIR)/moc_cpp_%.o : $(HARBOUR_DIR)/%.cpp $(BUILD_DIR)/%.moc
+$(COVERAGE_BUILD_DIR)/moc_cpp_%.o : $(HARBOUR_SRC_DIR)/%.cpp $(BUILD_DIR)/%.moc
$(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-$(DEBUG_BUILD_DIR)/app_%.o : $(APP_DIR)/%.cpp
+$(DEBUG_BUILD_DIR)/harbour_%.o : $(HARBOUR_SRC_DIR)/%.cpp
$(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-$(RELEASE_BUILD_DIR)/app_%.o : $(APP_DIR)/%.cpp
+$(RELEASE_BUILD_DIR)/harbour_%.o : $(HARBOUR_SRC_DIR)/%.cpp
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-$(COVERAGE_BUILD_DIR)/app_%.o : $(APP_DIR)/%.cpp
- $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(DEBUG_BUILD_DIR)/harbour_%.o : $(HARBOUR_DIR)/src/%.cpp
- $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(RELEASE_BUILD_DIR)/harbour_%.o : $(HARBOUR_DIR)/src/%.cpp
- $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(COVERAGE_BUILD_DIR)/harbour_%.o : $(HARBOUR_DIR)/src/%.cpp
+$(COVERAGE_BUILD_DIR)/harbour_%.o : $(HARBOUR_SRC_DIR)/%.cpp
$(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(DEBUG_EXE): $(DEBUG_OBJS)
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/test/TestHarbourUtil/Makefile
^
|
@@ -0,0 +1,8 @@
+# -*- Mode: makefile-gmake -*-
+
+PKGS = Qt5Gui
+EXE = TestHarbourUtil
+MOC_H = HarbourUtil.h
+HARBOUR_SRC = HarbourUtil.cpp
+
+include ../Makefile.common
|
[-]
[+]
|
Added |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/test/TestHarbourUtil/TestHarbourUtil.cpp
^
|
@@ -0,0 +1,115 @@
+/*
+ * 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 "HarbourUtil.h"
+
+#include <glib.h>
+
+/*==========================================================================*
+ * object
+ *==========================================================================*/
+
+static
+void
+test_object(
+ void)
+{
+ QObject* obj = HarbourUtil::createSingleton(Q_NULLPTR, Q_NULLPTR);
+
+ g_assert(qobject_cast<HarbourUtil*>(obj));
+ delete obj;
+}
+
+/*==========================================================================*
+ * invertColor
+ *==========================================================================*/
+
+static
+void
+test_invertColor(
+ void)
+{
+ g_assert_cmpuint(HarbourUtil::invertedRgb(0x12345678), == ,0x12cba987);
+ const QColor original(0xcb,0xa9,0x87,0x12);
+ const QColor inverted(0x34,0x56,0x78,0x12);
+ g_assert(HarbourUtil::invertedColor(original) == inverted);
+ g_assert(!HarbourUtil::invertedColor(QColor()).isValid());
+}
+
+/*==========================================================================*
+ * toHex
+ *==========================================================================*/
+
+static
+void
+test_toHex(
+ void)
+{
+ static const char data[] = {
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
+ 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14
+ };
+
+ // Lower case is assumed
+ const QByteArray hex("0102030405060708090a0b0c0d0e0f1011121314");
+
+ g_assert(HarbourUtil::toHex(QByteArray()).isEmpty());
+ g_assert(HarbourUtil::toHex(Q_NULLPTR, 0).isEmpty());
+ g_assert(HarbourUtil::toHexBytes(Q_NULLPTR, 0).isEmpty());
+ g_assert(HarbourUtil::toHex(data, sizeof(data)) == QString::fromLatin1(hex));
+ g_assert_cmpstr(HarbourUtil::toHexBytes(data, sizeof(data)).constData(), == ,
+ hex.constData());
+}
+
+/*==========================================================================*
+ * Common
+ *==========================================================================*/
+
+#define TEST_(name) "/HarbourUtil/" name
+
+int main(int argc, char* argv[])
+{
+ g_test_init(&argc, &argv, NULL);
+ g_test_add_func(TEST_("object"), test_object);
+ g_test_add_func(TEST_("invertColor"), test_invertColor);
+ g_test_add_func(TEST_("toHex"), test_toHex);
+ return g_test_run();
+}
+
+/*
+ * Local Variables:
+ * mode: C++
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/harbour-lib/test/coverage/run
^
|
@@ -5,7 +5,8 @@
TESTS="\
TestHarbourBase32 \
-TestHarbourBase45"
+TestHarbourBase45 \
+TestHarbourUtil"
function err() {
echo "*** ERROR!" $1
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/qml/EncryptedPage.qml
^
|
@@ -36,6 +36,10 @@
id: foilUiComponent
QtObject {
+ readonly property real opacityFaint: 0.2
+ readonly property real opacityLow: 0.4
+ readonly property real opacityHigh: 0.6
+ readonly property real opacityOverlay: 0.8
readonly property var settings: FoilPicsSettings
readonly property bool otherFoilAppsInstalled: FoilPics.otherFoilAppsInstalled
function isLockedState(foilState) {
@@ -176,6 +180,12 @@
Notification {
id: notification
+
+ Component.onCompleted: {
+ if ('icon' in notification) {
+ notification.icon = "icon-s-certificates"
+ }
+ }
}
Timer {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/qml/EncryptedPicsView.qml
^
|
@@ -5,7 +5,7 @@
import "harbour"
Item {
- id: view
+ id: thisView
property Page mainPage
property var hints
@@ -34,7 +34,7 @@
clip: true
anchors.fill: parent
- foilModel: view.foilModel
+ foilModel: thisView.foilModel
model: foilModel.groupModel
busy: foilModel.busy || progressTimer.running
//: Encrypted grid title
@@ -42,22 +42,22 @@
title: qsTrId("foilpics-encrypted_grid-title")
PullDownMenu {
- visible: view.ready
+ visible: thisView.ready
MenuItem {
text: foilUi.qsTrEnterPasswordViewMenuGenerateNewKey()
onClicked: {
- var warning = pageStack.push(Qt.resolvedUrl("foil-ui/FoilUiGenerateKeyWarning.qml"), {
+ pageStack.push(Qt.resolvedUrl("foil-ui/FoilUiGenerateKeyWarning.qml"), {
allowedOrientations: mainPage.allowedOrientations,
- foilUi: view.foilUi
+ foilUi: thisView.foilUi,
+ acceptDestinationProperties: {
+ allowedOrientations: mainPage.allowedOrientations,
+ mainPage: thisView.mainPage,
+ foilUi: thisView.foilUi,
+ foilModel: thisView.foilModel
+ },
+ acceptDestinationAction: PageStackAction.Replace,
+ acceptDestination: Qt.resolvedUrl("foil-ui/FoilUiGenerateKeyPage.qml")
})
- warning.acceptDestinationProperties = {
- allowedOrientations: mainPage.allowedOrientations,
- mainPage: view.mainPage,
- foilUi: view.foilUi,
- foilModel: view.foilModel
- }
- warning.acceptDestinationAction = PageStackAction.Replace
- warning.acceptDestination = Qt.resolvedUrl("foil-ui/FoilUiGenerateKeyPage.qml")
}
}
MenuItem {
@@ -66,9 +66,9 @@
text: qsTrId("foilpics-pulley_menu-change_password")
onClicked: {
pageStack.push(Qt.resolvedUrl("foil-ui/FoilUiChangePasswordPage.qml"), {
- mainPage: view.mainPage,
- foilUi: view.foilUi,
- foilModel: view.foilModel,
+ mainPage: thisView.mainPage,
+ foilUi: thisView.foilUi,
+ foilModel: thisView.foilModel,
//: Password change prompt
//% "Please enter the current and the new password"
promptText: qsTrId("foilpics-change_password_page-label-enter_passwords"),
@@ -102,7 +102,7 @@
//: Placeholder text
//% "You don't have any encrypted pictures"
qsTrId("foilpics-encrypted_grid-placeholder-no_pictures")
- enabled: !view.busy && foilModel && foilModel.count === 0
+ enabled: foilModel && foilModel.count === 0
}
}
@@ -180,8 +180,8 @@
selectionModel = selectionModelComponent.createObject(mainPage)
var selectionPage = pageStack.push(Qt.resolvedUrl("EncryptedSelectionPage.qml"), {
allowedOrientations: mainPage.allowedOrientations,
- selectionModel: view.selectionModel,
- foilModel: view.foilModel
+ selectionModel: thisView.selectionModel,
+ foilModel: thisView.foilModel
})
selectionPage.deletePictures.connect(function(list) {
//: Generic remorse popup text
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/qml/GalleryPage.qml
^
|
@@ -13,6 +13,7 @@
readonly property var galleryModel: Qt.createQmlObject(FoilPics.documentGalleryModelQml, page, "GalleryModel")
readonly property int galleryModelCount: galleryModel ? galleryModel.count : 0
+ readonly property string galleryKeyRole: "url"
// Selection model is fairly expensive, we create and maintain it
// only in selection mode
@@ -21,7 +22,7 @@
FoilPicsSelection {
model: galleryModel
- role: "url"
+ role: galleryKeyRole
}
}
@@ -94,7 +95,7 @@
//: Generic remorse popup text
//% "Deleting %0 selected pictures"
bulkAction(qsTrId("foilpics-remorse-deleting_selected", list.length).arg(list.length), list, function() {
- FoilPics.deleteLocalFilesFromModel(galleryModel, galleryModel.keyRole, list)
+ FoilPics.deleteLocalFilesFromModel(galleryModel, galleryKeyRole, list)
dropSelectionModels()
})
})
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/qml/ThumbnailBase.qml
^
|
@@ -15,12 +15,8 @@
property GridView grid: GridView.view
property var selectionModel
property string selectionKey
-
- property var selectionState
- property var busyState
-
- readonly property bool isBusy: busyState ? busyState.busy : false
- readonly property bool isSelected: selectionState ? selectionState.selected : false
+ property alias isBusy: busyState.busy
+ property alias isSelected: selectionState.selected
width: size
height: size
@@ -33,36 +29,18 @@
onReleased: pressedAndHeld = false
onCanceled: pressedAndHeld = false
- onSelectionModelChanged: selectionStateCheck()
- onSelectionKeyChanged: selectionStateCheck()
-
- function selectionStateCheck() {
- if (selectionState) {
- selectionState.destroy()
- selectionState = null
- busyState.destroy()
- busyState = null
- }
- if (selectionModel && selectionKey) {
- selectionState = selectionStateComponent.createObject(thumbnail, {
- model: selectionModel,
- key: selectionKey})
- busyState = busyStateComponent.createObject(thumbnail, {
- model: selectionModel,
- key: selectionKey})
- }
- }
-
- Component {
- id: selectionStateComponent
+ FoilPicsSelectionState {
+ id: selectionState
- FoilPicsSelectionState { }
+ model: selectionModel ? selectionModel : null
+ key: selectionKey
}
- Component {
- id: busyStateComponent
+ FoilPicsBusyState {
+ id: busyState
- FoilPicsBusyState { }
+ model: selectionModel ? selectionModel : null
+ key: selectionKey
}
Loader {
@@ -91,7 +69,6 @@
Behavior on opacity { FadeAnimation { duration: 100 } }
}
-
Loader {
z: thumbnail.z + 2
anchors.fill: parent
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilpics-1.1.3.tar.gz/settings/settings.qml
^
|
@@ -26,7 +26,7 @@
description: applicationName ?
//: Settings page header description (app version)
//% "Version %1"
- qsTrId("foilpics-settings_page-header-version").arg("1.1.2") : ""
+ qsTrId("foilpics-settings_page-header-version").arg("1.1.3") : ""
Image {
id: appIcon
|