[-]
[+]
|
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">4c0df73</param>
+ <param name="revision">254c758</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/.gitignore
^
|
@@ -1,2 +1,2 @@
build
-harbour-barcode.pro.user
+harbour-barcode.pro.user*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/harbour-barcode.pro
^
|
@@ -10,7 +10,7 @@
LIBS += -ldl
isEmpty(VERSION) {
- VERSION = 1.0.49
+ VERSION = 1.0.51
message("VERSION is unset, assuming $$VERSION")
}
@@ -111,6 +111,7 @@
HARBOUR_QML_COMPONENTS = \
$${HARBOUR_LIB_QML}/HarbourBadge.qml \
+ $${HARBOUR_LIB_QML}/HarbourDoubleClickableMouseArea.qml \
$${HARBOUR_LIB_QML}/HarbourFitLabel.qml \
$${HARBOUR_LIB_QML}/HarbourHighlightIcon.qml \
$${HARBOUR_LIB_QML}/HarbourHintIconButton.qml \
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/harbour-lib/LICENSE
^
|
@@ -1,30 +1,34 @@
Copyright (C) 2015-2021 Jolla Ltd.
-Copyright (C) 2015-2021 Slava Monich <slava@monich.com>
-
-You may use this file under the terms of BSD license as follows:
+Copyright (C) 2015-2024 Slava Monich <slava@monich.com>
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.
+ 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,
+HOLDERS 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.
+
+The views and conclusions contained in the software and documentation
+are those of the authors and should not be interpreted as representing
+any official policies, either expressed or implied.
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/harbour-lib/include/HarbourSelectionListModel.h
^
|
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2024 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -8,27 +8,33 @@
* 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.
+ * 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,
+ * HOLDERS 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.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
*/
#ifndef HARBOUR_SELECTION_LIST_MODEL_H
@@ -37,33 +43,45 @@
#include <QtQml>
#include <QIdentityProxyModel>
-class HarbourSelectionListModel : public QIdentityProxyModel {
+class HarbourSelectionListModel : public QIdentityProxyModel
+{
Q_OBJECT
Q_PROPERTY(QObject* sourceModel READ sourceModel WRITE setSourceModelObject NOTIFY sourceModelObjectChanged)
+ Q_PROPERTY(QList<int> nonSelectableRows READ nonSelectableRows WRITE setNonSelectableRows NOTIFY nonSelectableRowsChanged)
Q_PROPERTY(QList<int> selectedRows READ selectedRows NOTIFY selectedRowsChanged)
- Q_PROPERTY(int selectionCount READ selectionCount NOTIFY selectedRowsChanged)
+ Q_PROPERTY(int selectableCount READ selectableCount NOTIFY selectableCountChanged)
+ Q_PROPERTY(int selectionCount READ selectionCount NOTIFY selectionCountChanged)
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
public:
HarbourSelectionListModel(QObject* aParent = Q_NULLPTR);
- void setSourceModelObject(QObject* aModel);
+ void setSourceModelObject(QObject*);
+
+ QList<int> nonSelectableRows() const;
+ void setNonSelectableRows(const QList<int>);
QList<int> selectedRows() const;
+ int selectableCount() const;
int selectionCount() const;
Q_INVOKABLE void selectAll();
Q_INVOKABLE void clearSelection();
+ Q_INVOKABLE void toggleRows(const QList<int>);
+ Q_INVOKABLE QVariantList selectedValues(QString) const;
// QAbstractItemModel
- Qt::ItemFlags flags(const QModelIndex& aIndex) const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex&) const Q_DECL_OVERRIDE;
QHash<int,QByteArray> roleNames() const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex& aIndex, int aRole) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex& aIndex, const QVariant& aValue, int aRole) Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex&, int) const Q_DECL_OVERRIDE;
+ bool setData(const QModelIndex&, const QVariant&, int) Q_DECL_OVERRIDE;
Q_SIGNALS:
void sourceModelObjectChanged();
+ void nonSelectableRowsChanged();
void selectedRowsChanged();
+ void selectableCountChanged();
+ void selectionCountChanged();
void countChanged();
private:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/harbour-lib/include/HarbourTransferMethodsModel.h
^
|
@@ -1,6 +1,6 @@
/*
+ * Copyright (C) 2016-2023 Slava Monich <slava@monich.com>
* Copyright (C) 2016-2020 Jolla Ltd.
- * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -42,7 +42,13 @@
class QQmlEngine;
class QJSEngine;
-class HarbourTransferMethodsModel: public QAbstractListModel
+// N.B. This model (and in-process sharing in general) doesn't
+// work since Sailfish OS 4.2.0 (or more specifically, since
+// declarative-transferengine-qt5 package >= 0.4.0)
+//
+// It can only be of interest to those who want to make their
+// apps compatible with older releases of Sailfish OS.
+class HarbourTransferMethodsModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)
@@ -50,19 +56,21 @@
Q_PROPERTY(bool accountIconSupported READ accountIconSupported NOTIFY accountIconSupportedChanged)
Q_PROPERTY(bool showAccountsPending READ showAccountsPending NOTIFY showAccountsPendingChanged)
Q_PROPERTY(bool canShowAccounts READ canShowAccounts NOTIFY canShowAccountsChanged)
+ Q_PROPERTY(bool valid READ isValid NOTIFY validChanged)
public:
explicit HarbourTransferMethodsModel(QObject* aParent = Q_NULLPTR);
- ~HarbourTransferMethodsModel();
+ ~HarbourTransferMethodsModel() Q_DECL_OVERRIDE;
// Callback for qmlRegisterSingletonType<HarbourTransferMethodsModel>
- static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+ static QObject* createSingleton(QQmlEngine*, QJSEngine*);
- static bool loadTranslations(QTranslator* aTranslator, QLocale aLocale);
+ static bool loadTranslations(QTranslator*, QLocale);
+ bool isValid() const;
int count() const;
QString filter() const;
- void setFilter(QString filter);
+ void setFilter(QString);
bool accountIconSupported() const;
bool showAccountsPending() const;
bool canShowAccounts() const;
@@ -71,10 +79,11 @@
// QAbstractListModel
QHash<int,QByteArray> roleNames() const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex& aParent) const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex& aIndex, int aRole) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex&) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex&, int) const Q_DECL_OVERRIDE;
Q_SIGNALS:
+ void validChanged();
void countChanged();
void filterChanged();
void accountIconSupportedChanged();
|
[-]
[+]
|
Added |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/harbour-lib/qml/HarbourDoubleClickableMouseArea.qml
^
|
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2024 Slava Monich <slava@monich.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
+ * HOLDERS 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.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
+ */
+
+import QtQuick 2.0
+
+MouseArea {
+
+ // doubleClick never arrives on Sailfish OS 2.x
+ onClicked: {
+ if (doubleClickTimer.running) {
+ doubleClicked(mouse)
+ } else {
+ doubleClickTimer.start()
+ }
+ }
+
+ onDoubleClicked: doubleClickTimer.stop()
+
+ Timer {
+ id: doubleClickTimer
+
+ interval: 200
+ }
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/harbour-lib/qml/HarbourShareMethodList.qml
^
|
@@ -1,6 +1,6 @@
/*
+ * Copyright (C) 2020-2023 Slava Monich <slava@monich.com>
* Copyright (C) 2020 Jolla Ltd.
- * Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -34,6 +34,12 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
+// In-process sharing doesn't work since Sailfish OS 4.2.0 (or more
+// specifically, since declarative-transferengine-qt5 package >= 0.4.0)
+//
+// This code can only be of interest to those who want to make their
+// apps compatible with older releases of Sailfish OS.
+
SilicaListView {
id: view
@@ -113,8 +119,9 @@
}
footer: BackgroundItem {
- enabled: model.canShowAccounts && !model.showAccountsPending
- opacity: enabled ? 1.0 : 0.4
+ // Don't show the "Add account" item before the initial query completes
+ enabled: model.valid && model.canShowAccounts && !model.showAccountsPending
+ opacity: model.valid ? (enabled ? 1.0 : 0.4) : 0.0
Image {
id: addAccountIcon
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/harbour-lib/src/HarbourSelectionListModel.cpp
^
|
@@ -1,6 +1,6 @@
-/*
+/*
* Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2024 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -8,27 +8,33 @@
* 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.
+ * 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,
+ * HOLDERS 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.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
*/
#include "HarbourSelectionListModel.h"
@@ -41,20 +47,49 @@
// HarbourSelectionListModel::Private
// ==========================================================================
-class HarbourSelectionListModel::Private : public QObject {
+// s(SignalName,signalName)
+#define QUEUED_SIGNALS(s) \
+ s(NonSelectableRows,nonSelectableRows) \
+ s(SelectedRows,selectedRows) \
+ s(SelectableCount,selectableCount) \
+ s(SelectionCount,selectionCount) \
+ s(Count,count)
+
+class HarbourSelectionListModel::Private : public QObject
+{
Q_OBJECT
public:
- Private(HarbourSelectionListModel* aParent);
+ typedef void (HarbourSelectionListModel::*SignalEmitter)();
+ typedef uint SignalMask;
- HarbourSelectionListModel* parentModel();
- static int binaryFind(const QList<int> aList, int aValue);
- bool isSelectionRole(int aRole) const;
- bool isSelectedRow(int aRow) const;
- int findSelectedRow(int aRow) const;
- void selectRow(int aRow);
- void unselectRow(int aRow);
- void selectionChangedAt(int aRow);
+ enum Signal {
+#define SIGNAL_ENUM_(Name,name) Signal##Name##Changed,
+ QUEUED_SIGNALS(SIGNAL_ENUM_)
+#undef SIGNAL_ENUM_
+ SignalCount
+ };
+
+ Private(HarbourSelectionListModel*);
+
+ static int binaryFind(const QList<int>, int);
+
+ HarbourSelectionListModel* parentModel() const;
+ void queueSignal(Signal aSignal);
+ void emitQueuedSignals();
+ bool isSelectionRole(int) const;
+ bool isSelectedRow(int) const;
+ bool isSelectableRow(int) const;
+ int findSelectedRow(int) const;
+ int findRole(const QString&) const;
+ QVariantList selectedValues(const QString&) const;
+ void updateCounts();
+ void selectRow(int);
+ void unselectRow(int);
+ void toggleRows(const QList<int>);
+ void setNonSelectableRows(const QList<int>);
+ void selectedRowChanged(int);
+ void selectionChangedAt(int);
void clearSelection();
void selectAll();
void reset();
@@ -63,13 +98,20 @@
void onCountChanged();
public:
+ SignalMask iQueuedSignals;
+ Signal iFirstQueuedSignal;
QList<int> iSelectedRows;
- QVector<int> iSelectedRole;
+ QList<int> iNonSelectableRows;
+ QList<int> iNormalizedNonSelectableRows;
+ QVector<int> iSelectedRole; // Passed to dataChanged as an argument
+ int iLastKnownSelectableCount;
int iLastKnownCount;
};
-HarbourSelectionListModel::Private::Private(HarbourSelectionListModel* aParent) :
+HarbourSelectionListModel::Private::Private(
+ HarbourSelectionListModel* aParent) :
QObject(aParent),
+ iLastKnownSelectableCount(0),
iLastKnownCount(0)
{
connect(aParent, SIGNAL(modelReset()), SLOT(onCountChanged()));
@@ -77,22 +119,10 @@
connect(aParent, SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(onCountChanged()));
}
-inline HarbourSelectionListModel* HarbourSelectionListModel::Private::parentModel()
-{
- return qobject_cast<HarbourSelectionListModel*>(parent());
-}
-
-inline bool HarbourSelectionListModel::Private::isSelectionRole(int aRole) const
-{
- return !iSelectedRole.isEmpty() && iSelectedRole.first() == aRole;
-}
-
-inline bool HarbourSelectionListModel::Private::isSelectedRow(int aRow) const
-{
- return findSelectedRow(aRow) >= 0;
-}
-
-int HarbourSelectionListModel::Private::binaryFind(const QList<int> aList, int aValue)
+int
+HarbourSelectionListModel::Private::binaryFind(
+ const QList<int> aList,
+ int aValue)
{
// It turned out to be significantly easier to copy/paste this code
// than to fight with qBinaryFind and iterators which behave strangely
@@ -117,34 +147,169 @@
return -(low + 1);
}
-int HarbourSelectionListModel::Private::findSelectedRow(int aRow) const
+inline
+HarbourSelectionListModel*
+HarbourSelectionListModel::Private::parentModel() const
+{
+ return qobject_cast<HarbourSelectionListModel*>(parent());
+}
+
+void
+HarbourSelectionListModel::Private::queueSignal(
+ Signal aSignal)
+{
+ if (aSignal >= 0 && aSignal < SignalCount) {
+ const SignalMask signalBit = (SignalMask(1) << aSignal);
+ if (iQueuedSignals) {
+ iQueuedSignals |= signalBit;
+ if (iFirstQueuedSignal > aSignal) {
+ iFirstQueuedSignal = aSignal;
+ }
+ } else {
+ iQueuedSignals = signalBit;
+ iFirstQueuedSignal = aSignal;
+ }
+ }
+}
+
+void
+HarbourSelectionListModel::Private::emitQueuedSignals()
+{
+ static const SignalEmitter emitSignal [] = {
+#define SIGNAL_EMITTER_(Name,name) &HarbourSelectionListModel::name##Changed,
+ QUEUED_SIGNALS(SIGNAL_EMITTER_)
+#undef SIGNAL_EMITTER_
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/harbour-lib/src/HarbourTransferMethodsModel.cpp
^
|
@@ -1,6 +1,6 @@
/*
+ * Copyright (C) 2016-2023 Slava Monich <slava@monich.com>
* Copyright (C) 2016-2020 Jolla Ltd.
- * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -35,14 +35,13 @@
#include "HarbourDebug.h"
#include <QTranslator>
-#include <QQmlEngine>
#include <QRegExp>
// ==========================================================================
// HarbourTransferMethodsModel::TransferEngine
// ==========================================================================
-class HarbourTransferMethodsModel::TransferEngine: public QDBusAbstractInterface
+class HarbourTransferMethodsModel::TransferEngine : public QDBusAbstractInterface
{
Q_OBJECT
@@ -66,7 +65,7 @@
// HarbourTransferMethodsModel::Private
// ==========================================================================
-class HarbourTransferMethodsModel::Private: public QObject
+class HarbourTransferMethodsModel::Private : public QObject
{
Q_OBJECT
typedef QDBusPendingCallWatcher* (Private::*RequestUpdate)();
@@ -81,24 +80,24 @@
AccountIconRole
};
- Private(HarbourTransferMethodsModel* aModel);
- ~Private();
+ Private(HarbourTransferMethodsModel*);
+ ~Private() Q_DECL_OVERRIDE;
public:
HarbourTransferMethodsModel* parentModel();
- static QRegExp regExp(QString aRegExp);
+ static QRegExp regExp(QString);
void filterModel();
QDBusPendingCallWatcher* checkTransferMethods();
QDBusPendingCallWatcher* requestTransferMethods();
QDBusPendingCallWatcher* requestTransferMethods2();
- void setTransferMethods2(HarbourTransferMethodInfo2List aList);
+ void setTransferMethods2(HarbourTransferMethodInfo2List);
bool showAccounts();
private Q_SLOTS:
- void onTransferMethodsCheckFinished(QDBusPendingCallWatcher* aWatch);
- void onTransferMethodsFinished(QDBusPendingCallWatcher* aWatch);
- void onTransferMethods2Finished(QDBusPendingCallWatcher* aWatch);
- void onShowAccountsFinished(QDBusPendingCallWatcher* aWatch);
+ void onTransferMethodsCheckFinished(QDBusPendingCallWatcher*);
+ void onTransferMethodsFinished(QDBusPendingCallWatcher*);
+ void onTransferMethods2Finished(QDBusPendingCallWatcher*);
+ void onShowAccountsFinished(QDBusPendingCallWatcher*);
void requestUpdate();
public:
@@ -110,6 +109,7 @@
QDBusPendingCallWatcher* iUpdateWatcher;
QDBusPendingCallWatcher* iShowAccountsWatcher;
bool iShowAccountsFailed;
+ bool iValid;
TransferEngine* iTransferEngine;
};
@@ -120,6 +120,7 @@
iUpdateWatcher(Q_NULLPTR),
iShowAccountsWatcher(Q_NULLPTR),
iShowAccountsFailed(false),
+ iValid(false),
iTransferEngine(new TransferEngine(this))
{
connect(iTransferEngine,
@@ -133,12 +134,15 @@
delete iTransferEngine;
}
-inline HarbourTransferMethodsModel* HarbourTransferMethodsModel::Private::parentModel()
+inline
+HarbourTransferMethodsModel*
+HarbourTransferMethodsModel::Private::parentModel()
{
return qobject_cast<HarbourTransferMethodsModel*>(parent());
}
-void HarbourTransferMethodsModel::Private::requestUpdate()
+void
+HarbourTransferMethodsModel::Private::requestUpdate()
{
if (iUpdateWatcher) {
HDEBUG("dropping pending method list query");
@@ -148,7 +152,9 @@
iUpdateWatcher = (this->*iRequestUpdate)();
}
-void HarbourTransferMethodsModel::Private::setTransferMethods2(HarbourTransferMethodInfo2List aList)
+void
+HarbourTransferMethodsModel::Private::setTransferMethods2(
+ HarbourTransferMethodInfo2List aList)
{
iRequestUpdate = &Private::requestTransferMethods2;
HDEBUG(aList.count() << "methods");
@@ -162,7 +168,8 @@
}
}
-QDBusPendingCallWatcher* HarbourTransferMethodsModel::Private::checkTransferMethods()
+QDBusPendingCallWatcher*
+HarbourTransferMethodsModel::Private::checkTransferMethods()
{
// First try transferMethods2() and see if it works
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher
@@ -172,7 +179,8 @@
return watcher;
}
-QDBusPendingCallWatcher* HarbourTransferMethodsModel::Private::requestTransferMethods()
+QDBusPendingCallWatcher*
+HarbourTransferMethodsModel::Private::requestTransferMethods()
{
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher
(iTransferEngine->transferMethods(), this);
@@ -181,7 +189,8 @@
return watcher;
}
-QDBusPendingCallWatcher* HarbourTransferMethodsModel::Private::requestTransferMethods2()
+QDBusPendingCallWatcher*
+HarbourTransferMethodsModel::Private::requestTransferMethods2()
{
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher
(iTransferEngine->transferMethods2(), this);
@@ -190,7 +199,9 @@
return watcher;
}
-void HarbourTransferMethodsModel::Private::onTransferMethodsCheckFinished(QDBusPendingCallWatcher* aWatch)
+void
+HarbourTransferMethodsModel::Private::onTransferMethodsCheckFinished(
+ QDBusPendingCallWatcher* aWatch)
{
QDBusPendingReply<HarbourTransferMethodInfo2List> reply(*aWatch);
HASSERT(aWatch == iUpdateWatcher);
@@ -204,12 +215,16 @@
requestUpdate();
}
} else {
+ iValid = true; // Mark the model as valid
setTransferMethods2(reply.value());
+ Q_EMIT parentModel()->validChanged();
}
aWatch->deleteLater();
}
-void HarbourTransferMethodsModel::Private::onTransferMethods2Finished(QDBusPendingCallWatcher* aWatch)
+void
+HarbourTransferMethodsModel::Private::onTransferMethods2Finished(
+ QDBusPendingCallWatcher* aWatch)
{
QDBusPendingReply<HarbourTransferMethodInfo2List> reply(*aWatch);
HASSERT(aWatch == iUpdateWatcher);
@@ -222,7 +237,9 @@
aWatch->deleteLater();
}
-void HarbourTransferMethodsModel::Private::onTransferMethodsFinished(QDBusPendingCallWatcher* aWatch)
+void
+HarbourTransferMethodsModel::Private::onTransferMethodsFinished(
+ QDBusPendingCallWatcher* aWatch)
{
QDBusPendingReply<HarbourTransferMethodInfoList> reply(*aWatch);
HASSERT(aWatch == iUpdateWatcher);
@@ -241,16 +258,23 @@
iMethodList = list2;
filterModel();
}
+ if (!iValid) {
+ iValid = true; // Mark the model as valid
+ Q_EMIT parentModel()->validChanged();
+ }
}
aWatch->deleteLater();
}
-QRegExp HarbourTransferMethodsModel::Private::regExp(QString aRegExp)
+QRegExp
+HarbourTransferMethodsModel::Private::regExp(
+ QString aRegExp)
{
return QRegExp(aRegExp, Qt::CaseInsensitive, QRegExp::Wildcard);
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/harbour-lib/src/libcrypto.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2021 Jolla Ltd.
- * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2021-2023 Slava Monich <slava@monich.com>
+ * Copyright (C) 2021-2022 Jolla Ltd.
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -8,27 +8,29 @@
* 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.
+ * 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 ``AS IS'' AND ANY EXPRESSED 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 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) ARISING
+ * IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
*/
#include "gutil_log.h"
@@ -41,6 +43,7 @@
#include <openssl/md5.h>
#include <openssl/rsa.h>
#include <openssl/sha.h>
+#include <openssl/modes.h>
/*
* What is this code?
@@ -112,14 +115,28 @@
(const unsigned char* in, unsigned char* out, const AES_KEY* key, \
const int enc), \
(in, out, key, enc)) \
+ f(AES_encrypt, (const unsigned char *in, unsigned char *out, \
+ const AES_KEY *key), (in, out, key)) \
+ f(BN_clear_free, (BIGNUM *a), (a)) \
f(BN_free, (BIGNUM *a), (a)) \
+ f(CRYPTO_ctr128_encrypt, (const unsigned char *in, unsigned char *out, \
+ size_t len, const void *key, unsigned char ivec[16], \
+ unsigned char ecount_buf[16], unsigned int *num, block128_f block), \
+ (in, out, len, key, ivec, ecount_buf, num, block)) \
f(DES_ede3_cbc_encrypt, \
(const unsigned char* input, unsigned char* output, long length, \
DES_key_schedule* ks1, DES_key_schedule* ks2, DES_key_schedule* ks3, \
DES_cblock* ivec, int enc), \
(input, output, length, ks1, ks2, ks3, ivec, enc)) \
- f(ERR_load_crypto_strings, (void), ()) \
- f(RSA_free, (RSA* r), (r))
+ f(/* libcrypto.so.10 */ ERR_load_crypto_strings, (void), ()) \
+ f(RSA_free, (RSA* r), (r)) \
+ f(/* libcrypto.so.1.1 */ RSA_get0_key, (const RSA* r, const BIGNUM** n, \
+ const BIGNUM** e, const BIGNUM** d), (r, n, e, d)) \
+ f(/* libcrypto.so.1.1 */ RSA_get0_factors, (const RSA* r, \
+ const BIGNUM** p, const BIGNUM** q), (r, p, q)) \
+ f(/* libcrypto.so.1.1 */ RSA_get0_crt_params, (const RSA* r, \
+ const BIGNUM** dmp1, const BIGNUM** dmq1, const BIGNUM** iqmp), \
+ (r, dmp1, dmq1, iqmp))
/* f(ret,name,params,args,def) */
#define LIBCRYPTO_FUNCTIONS2(f) \
@@ -149,7 +166,7 @@
f(int, MD5_Init, (MD5_CTX* c), (c), 0) \
f(int, MD5_Update, (MD5_CTX* c, const void* data, size_t len), \
(c, data, len), 0) \
- f(int, OPENSSL_init_crypto, \
+ f(int, /* libcrypto.so.1.1 */ OPENSSL_init_crypto, \
(uint64_t opts, const OPENSSL_INIT_SETTINGS* settings), \
(opts, settings), 0) \
f(int, RAND_bytes, (unsigned char* buf, int num), (buf, num), 0) \
@@ -173,6 +190,12 @@
(int flen, const unsigned char* from, unsigned char* to, RSA* rsa, \
int padding), (flen, from, to, rsa, padding), 0) \
f(int, RSA_size, (const RSA* rsa), (rsa), 0) \
+ f(int, /* libcrypto.so.1.1 */ RSA_set0_key, (RSA* r, BIGNUM* n, \
+ BIGNUM* e, BIGNUM* d), (r, n, e, d), 0) \
+ f(int, /* libcrypto.so.1.1 */ RSA_set0_factors, (RSA* r, BIGNUM* p, \
+ BIGNUM* q), (r, p, q), 0) \
+ f(int, /* libcrypto.so.1.1 */ RSA_set0_crt_params, (RSA* r, \
+ BIGNUM* dmp1, BIGNUM* dmq1, BIGNUM* iqmp), (r, dmp1, dmq1, iqmp), 0) \
f(unsigned char*, SHA1, (const unsigned char* d, size_t n, \
unsigned char* md), (d, n, md), NULL) \
f(int, SHA1_Final, (unsigned char* md, SHA_CTX* c), (md, c), 0) \
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/libmc/LICENSE
^
|
@@ -1,4 +1,4 @@
-Copyright (C) 2020-2022 by Slava Monich <slava@monich.com>
+Copyright (C) 2020-2023 by Slava Monich <slava@monich.com>
You may use this file under the terms of the BSD license as follows:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/libmc/Makefile
^
|
@@ -22,7 +22,7 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
-VERSION_RELEASE = 4
+VERSION_RELEASE = 5
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/libmc/debian/changelog
^
|
@@ -1,3 +1,9 @@
+libmc (1.0.5) unstable; urgency=low
+
+ * Packaging fixes
+
+ -- Slava Monich <slava@monich.com> Sun, 19 Feb 2023 05:34:42 +0200
+
libmc (1.0.4) unstable; urgency=low
* Handle ORG attribute
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/libmc/debian/compat
^
|
@@ -1 +1 @@
-5
+7
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/libmc/debian/copyright
^
|
@@ -1,4 +1,4 @@
-Copyright (C) 2020-2022 by Slava Monich <slava@monich.com>
+Copyright (C) 2020-2023 by Slava Monich <slava@monich.com>
You may use this file under the terms of the BSD license as follows:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/libmc/rpm/libmc.spec
^
|
@@ -1,5 +1,6 @@
Name: libmc
-Version: 1.0.4
+
+Version: 1.0.5
Release: 0
Summary: Library for parsing mobile codes
@@ -9,6 +10,11 @@
BuildRequires: pkgconfig
BuildRequires: pkgconfig(glib-2.0)
+
+# license macro requires rpm >= 4.11
+BuildRequires: pkgconfig(rpm)
+%define license_support %(pkg-config --exists 'rpm >= 4.11'; echo $?)
+
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
@@ -29,7 +35,6 @@
make %{_smp_mflags} LIBDIR=%{_libdir} KEEP_SYMBOLS=1 release pkgconfig
%install
-rm -rf %{buildroot}
make LIBDIR=%{_libdir} DESTDIR=%{buildroot} install-dev
%check
@@ -42,9 +47,13 @@
%files
%defattr(-,root,root,-)
%{_libdir}/%{name}.so.*
+%if %{license_support} == 0
+%license LICENSE
+%endif
%files devel
%defattr(-,root,root,-)
+%dir %{_includedir}/mc
%{_libdir}/pkgconfig/*.pc
%{_libdir}/%{name}.so
%{_includedir}/mc/*.h
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/libmc/src/mc_types_p.h
^
|
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 by Slava Monich <slava@monich.com>
+ * Copyright (C) 2020-2022 by Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -54,29 +54,28 @@
static inline char mc_block_peek(const McBlock* blk)
{ return mc_block_end(blk) ? 0 : *blk->ptr; }
-G_GNUC_INTERNAL
gboolean
mc_block_equals(
const McBlock* blk,
- const char* str);
+ const char* str)
+ G_GNUC_INTERNAL;
-G_GNUC_INTERNAL
gboolean
mc_block_skip_spaces(
- McBlock* blk);
+ McBlock* blk)
+ G_GNUC_INTERNAL;
-G_GNUC_INTERNAL
gboolean
mc_block_strip_spaces(
- McBlock* blk);
+ McBlock* blk)
+ G_GNUC_INTERNAL;
-G_GNUC_INTERNAL
gboolean
mc_block_skip_until(
McBlock* blk,
- guint8 sep);
+ guint8 sep)
+ G_GNUC_INTERNAL;
-G_GNUC_INTERNAL
gboolean
mc_block_check(
const McBlock* blk,
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/qml/components/GalleryImage.qml
^
|
@@ -1,7 +1,7 @@
/*
The MIT License (MIT)
-Copyright (c) 2020-2022 Slava Monich
+Copyright (c) 2020-2024 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
@@ -37,27 +37,25 @@
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
- readonly property real minZoom: Math.min(minZoomX, minZoomY)
- readonly property real maxZoomX: (implicitWidth && MaxTextureSize) ? MaxTextureSize/implicitWidth : 10.0
- readonly property real maxZoomY: (implicitHeight && MaxTextureSize) ? MaxTextureSize/implicitHeight : 10.0
- readonly property real maxZoom: Math.min(maxZoomX, maxZoomY)
+ readonly property real minZoom: Math.min(1, width/implicitWidth, height/implicitHeight)
+ readonly property real maxZoom: MaxTextureSize ? Math.min(MaxTextureSize/implicitWidth, MaxTextureSize/implicitHeight) : 10.0
readonly property real actualZoom: Math.min(Math.max(zoom, minZoom), maxZoom)
- readonly property bool transpose: (orientation % 180) != 0
- implicitWidth: transpose ? image.implicitHeight : image.implicitWidth
- implicitHeight: transpose ? image.implicitWidth : image.implicitHeight
+ readonly property bool _transpose: (orientation % 180) != 0
+
+ property real _lastContentWidth
+ property real _lastContentHeight
+
+ signal requestZoom(var zoom)
clip: true
anchors.fill: parent
+ quickScrollEnabled: false
flickableDirection: Flickable.HorizontalAndVerticalFlick
- boundsBehavior: Flickable.StopAtBounds
- contentWidth: container.width
- contentHeight: container.height
-
- property real lastContentWidth
- property real lastContentHeight
+ contentWidth: imagePinchArea.width
+ contentHeight: imagePinchArea.height
+ implicitWidth: image.realWidth
+ implicitHeight: image.realHeight
function centerContent() {
contentX = originX + Math.ceil((contentHeight - height)/2.0)
@@ -65,25 +63,10 @@
}
function resetZoom() {
- var w = transpose ? image.height : image.width
- var h = transpose ? image.width : image.height
var viewportWidth = isLandscape ? galleryImage.height : galleryImage.width
var viewportHeight = isLandscape ? galleryImage.width : galleryImage.height
- zoom = Math.min(viewportWidth/w, viewportHeight/h)
- }
-
- onContentWidthChanged: {
- if (visible && !moving) {
- contentX -= (lastContentWidth - contentWidth)/2
- }
- lastContentWidth = contentWidth
- }
-
- onContentHeightChanged: {
- if (visible && !moving) {
- contentY -= (lastContentHeight - contentHeight)/2
- }
- lastContentHeight = contentHeight
+ zoom = Math.max(imagePinchArea.pinch.minimumScale,
+ Math.min(imagePinchArea.pinch.maximumScale, viewportWidth/image.realWidth, viewportHeight/image.realHeight))
}
Behavior on angle {
@@ -93,31 +76,135 @@
}
}
- Item {
- id: container
+ PinchArea {
+ id: imagePinchArea
+
+ width: Math.max(imageContainer.width * imageContainer.scale, galleryImage.width)
+ height: Math.max(imageContainer.height * imageContainer.scale, galleryImage.height)
- width: Math.max(galleryImage.width, (transpose ? image.ySize : image.xSize) * image.scale)
- height: Math.max(galleryImage.height, (transpose ? image.xSize : image.ySize) * image.scale)
+ property int _centerX
+ property int _centerY
+ property real _prevScale: 1
+
+ pinch {
+ target: imageContainer
+ minimumScale: minZoom
+ maximumScale: maxZoom
+ }
- Image {
- id: image
+ onPinchStarted: _prevScale = imageContainer.scale
+ onPinchUpdated: {
+ _centerX = pinch.center.x
+ _centerY = pinch.center.y
+ galleryImage.returnToBounds()
+ }
- readonly property real r: galleryImage.angle * Math.PI / 180
- readonly property real d: Math.sqrt(height * height + width * width)
- readonly property real a: width ? Math.atan(height/width) : 0
- 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
+ Connections {
+ target: imagePinchArea.pinch.active ? imageContainer : null
+ onScaleChanged: {
+ var newWidth = imageContainer.width * imageContainer.scale
+ var newHeight = imageContainer.height * imageContainer.scale
+ var oldWidth = imageContainer.width * imagePinchArea._prevScale
+ var oldHeight = imageContainer.height * imagePinchArea._prevScale
+ var widthDifference = newWidth - oldWidth
+ var heightDifference = newHeight - oldHeight
+
+ if (oldWidth > galleryImage.width || newWidth > galleryImage.width) {
+ galleryImage.contentX += imagePinchArea._centerX / newWidth * widthDifference
+ }
+ if (oldHeight > galleryImage.height || newHeight > galleryImage.height) {
+ galleryImage.contentY += imagePinchArea._centerY / newHeight * heightDifference
+ }
+ imagePinchArea._prevScale = imageContainer.scale
}
+ }
+ Item {
+ id: imageContainer
+
+ width: Math.max(galleryImage.width, _transpose ? image.ySize : image.xSize)
+ height: Math.max(galleryImage.height, _transpose ? image.xSize : image.ySize)
anchors.centerIn: parent
scale: actualZoom
- smooth: true
- rotation: (galleryImage.angle - galleryImage.orientation) % 360
- transformOrigin: Item.Center
+
+ onScaleChanged: galleryImage.requestZoom(scale)
+
+ Image {
+ id: image
+
+ readonly property real realWidth: _transpose ? implicitHeight : implicitWidth
+ readonly property real realHeight: _transpose ? implicitWidth : implicitHeight
+ readonly property real r: galleryImage.angle * Math.PI / 180
+ readonly property real d: Math.sqrt(height * height + width * width)
+ readonly property real a: width ? Math.atan(height/width) : 0
+ 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
+ smooth: true
+ rotation: (galleryImage.angle - galleryImage.orientation) % 360
+ transformOrigin: Item.Center
+ }
+ }
+
+ // Reset the zoom on double click with an animation
+ HarbourDoubleClickableMouseArea {
+ anchors.fill: parent
+ enabled: imageContainer.scale !== 1
+
+ onDoubleClicked: resetScale()
+
+ function resetScale() {
+ if (!resetAnimation.running) {
+ imageScaleAnimation.from = imageContainer.scale
+ flickableContentXAnimation.from = galleryImage.contentX
+ flickableContentYAnimation.from = galleryImage.contentY
+ resetAnimation.start()
+ }
+ }
+
+ ParallelAnimation {
+ id: resetAnimation
+
+ alwaysRunToEnd: true
+
+ readonly property int _duration: 200
+
+ NumberAnimation {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/qml/components/Rotator.qml
^
|
@@ -1,7 +1,7 @@
/*
The MIT License (MIT)
-Copyright (c) 2020 Slava Monich
+Copyright (c) 2020-2024 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
@@ -40,6 +40,7 @@
readonly property bool showPress: highlighted || pressTimer.running || drag.active
readonly property real oneDegree: height / 360.
+ signal reset()
signal rotateUp(var degrees)
signal rotateDown(var degrees)
@@ -107,6 +108,11 @@
anchors.centerIn: parent
rotation: inverted ? -90 : 90
color: drag.active ? Theme.highlightColor : Theme.primaryColor
+
+ HarbourDoubleClickableMouseArea {
+ anchors.fill: parent
+ onDoubleClicked: rotator.reset()
+ }
}
HarbourHighlightIcon {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/qml/js/DGCert.js
^
|
@@ -1,7 +1,7 @@
/*
The MIT License (MIT)
-Copyright (c) 2021 Slava Monich
+Copyright (c) 2021-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,8 +25,8 @@
.pragma library
// Value Sets for Digital Green Certificates
-// Version 1.0
-// 2021-04-21
+// Version 1.11
+// 2022-09-14
var diseaseDisplayNames = {
"840539006" : "COVID-19"
@@ -35,7 +35,10 @@
var vaccineTypeDisplayNames = {
"1119305005": "SARS-CoV-2 antigen vaccine",
"1119349007": "SARS-CoV-2 mRNA vaccine",
- "J07BX03": "COVID-19 vaccine"
+ "J07BX03": "COVID-19 vaccine",
+ "1162643001": "SARS-CoV-2 recombinant spike protein antigen vaccine",
+ "1157024006": "Inactivated whole SARS-CoV-2 antigen vaccine",
+ "29061000087103": "COVID-19 non-replicating viral vector vaccine"
}
var vaccineProductDisplayNames = {
@@ -51,7 +54,16 @@
"BBIBP-CorV": "BBIBP-CorV (Sinopharm)",
"Inactivated-SARS-CoV-2-Vero-Cell": "Inactivated SARS‑CoV‑2 (Sinopharm)",
"CoronaVac": "CoronaVac (Sinovac)",
- "Covaxin": "Covaxin (Bharat Biotech)"
+ "Covaxin": "Covaxin (Bharat Biotech)",
+ "Covid-19-recombinant": "Covid-19 (recombinant)",
+ "Sputnik-Light": "Sputnik Light",
+ "MVC-COV1901": "MVC COVID-19 vaccine",
+ "EU/1/21/1618": "Nuvaxovid",
+ "Sputnik-M": "Sputnik M",
+ "Covid-19-adsorvida-inativada": "Vacina adsorvida covid-19 (inativada)",
+ "Soberana-02": "Soberana 02",
+ "Soberana-Plus": "Soberana Plus",
+ "EU/1/21/1624": "COVID-19 Vaccine Valneva"
}
var vaccineManufacturerDisplayNames = {
@@ -68,7 +80,22 @@
"Gamaleya-Research-Institute": "Gamaleya Research Institute",
"Vector-Institute": "Vector Institute",
"Sinovac-Biotech": "Sinovac Biotech",
- "Bharat-Biotech": "Bharat Biotech"
+ "Bharat-Biotech": "Bharat Biotech",
+ "ORG-100001981": "Serum Institute Of India Private Limited",
+ "ORG-100007893": "R-Pharm CJSC",
+ "Chumakov-Federal-Scientific-Center": "Chumakov Federal Scientific Center for Research and Development of Immune-and-Biological Products",
+ "ORG-100023050": "Gulf Pharmaceutical Industries",
+ "CIGB": "Center for Genetic Engineering and Biotechnology (CIGB)",
+ "Sinopharm-WIBP": "Sinopharm - Wuhan Institute of Biological Products",
+ "ORG-100033914": "Medigen Vaccine Biologics Corporation",
+ "ORG-100000788": "Sanofi Pasteur",
+ "ORG-100036422": "Valneva France",
+ "Instituto-Butantan": "Instituto Butantan",
+ "NVSI": "National Vaccine and Serum Institute, China",
+ "Yisheng-Biopharma": "Yisheng Biopharma",
+ "ORG-100026614": "Sinocelltech Ltd.",
+ "ORG-100008549": "Medicago Inc.",
+ "Finlay-Institute": "Finlay Institute of Vaccines"
}
// Result of the test
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/qml/pages/CodeItem.qml
^
|
@@ -65,7 +65,7 @@
onIsVCardChanged: {
if (isVCard && !vcard) {
- var component = Qt.createComponent("../components/VCard.qml");
+ var component = Qt.createComponent("../components/VCard.qml")
if (component.status === Component.Ready) {
vcard = component.createObject(codeItem, {
content: meCardConverter.vcard ? meCardConverter.vcard : normalizedText
@@ -305,18 +305,150 @@
}
}
- Image {
- id: image
-
- readonly property bool isPortrait: sourceSize.height > sourceSize.width
- readonly property bool rotate: image.isPortrait !== codeItem.isPortrait
+ SilicaFlickable {
+ id: imageFlickable
+ visible: image.status === Image.Ready
+ width: image.implicitWidth
+ height: image.implicitHeight
+ contentWidth: imagePinchArea.width
+ contentHeight: imagePinchArea.height
anchors.horizontalCenter: parent.horizontalCenter
- source: (hasImage && recordId.length && AppSettings.saveImages) ?
- ("image://scanner/saved/" + (codeItem.isPortrait ? "portrait/" : "landscape/") + recordId) : ""
- visible: status === Image.Ready
- asynchronous: true
- cache: false
+ flickableDirection: Flickable.HorizontalAndVerticalFlick
+ quickScrollEnabled: false
+ clip: true
+
+ PinchArea {
+ id: imagePinchArea
+
+ width: Math.max(image.width * image.scale, imageFlickable.width)
+ height: Math.max(image.height * image.scale, imageFlickable.height)
+
+ property int centerX
+ property int centerY
+ property real prevScale: 1
+
+ pinch {
+ target: image
+ minimumScale: 1
+ maximumScale: 4
+ }
+
+ onPinchStarted: prevScale = image.scale
+ onPinchUpdated: {
+ centerX = pinch.center.x
+ centerY = pinch.center.y
+ imageFlickable.returnToBounds()
+ }
+
+ Connections {
+ target: imagePinchArea.pinch.active ? image : null
+ onScaleChanged: {
+ var newWidth = image.width * image.scale
+ var newHeight = image.height * image.scale
+ var oldWidth = image.width * imagePinchArea.prevScale
+ var oldHeight = image.height * imagePinchArea.prevScale
+ var widthDifference = newWidth - oldWidth
+ var heightDifference = newHeight - oldHeight
+
+ if (oldWidth > imageFlickable.width || newWidth > imageFlickable.width) {
+ imageFlickable.contentX += imagePinchArea.centerX / newWidth * widthDifference
+ }
+ if (oldHeight > imageFlickable.height || newHeight > imageFlickable.height) {
+ imageFlickable.contentY += imagePinchArea.centerY / newHeight * heightDifference
+ }
+ imagePinchArea.prevScale = image.scale
+ }
+ }
+
+ Image {
+ id: image
+
+ anchors.centerIn: parent
+ source: (hasImage && recordId.length && AppSettings.saveImages) ?
+ ("image://scanner/saved/" + (codeItem.isPortrait ? "portrait/" : "landscape/") + recordId) : ""
+ fillMode: Image.PreserveAspectFit
+ asynchronous: true
+ cache: false
+ }
+
+
+ // Reset the zoom on double click with an animation
+ MouseArea {
+ anchors.fill: parent
+
+ enabled: image.scale !== 1
+ onClicked: {
+ // doubleClick never arrives on Sailfish OS 2.x
+ if (doubleClickTimer.running) {
+ doubleClickTimer.stop()
+ reset()
+ } else {
+ doubleClickTimer.start()
+ }
+ }
+
+ onDoubleClicked: {
+ doubleClickTimer.stop()
+ reset()
+ }
+
+ Timer {
+ id: doubleClickTimer
+
+ interval: 200
+ }
+
+ function reset() {
+ if (!resetAnimation.running) {
+ imageScaleAnimation.from = image.scale
+ flickableContentXAnimation.from = imageFlickable.contentX
+ flickableContentYAnimation.from = imageFlickable.contentY
+ resetAnimation.start()
+ }
+ }
+
+ ParallelAnimation {
+ id: resetAnimation
+
+ alwaysRunToEnd: true
+
+ readonly property int _duration: 200
+
+ NumberAnimation {
+ id: imageScaleAnimation
+
+ target: image
+ property: "scale"
+ easing.type: Easing.InOutQuad
+ duration: resetAnimation._duration
+ to: 1
+ }
+
+ NumberAnimation {
+ id: flickableContentXAnimation
+
+ target: imageFlickable
+ property: "contentX"
+ easing.type: Easing.InOutQuad
+ duration: resetAnimation._duration
+ to: 0
+ }
+
+ NumberAnimation {
+ id: flickableContentYAnimation
+
+ target: imageFlickable
+ property: "contentY"
+ easing.type: Easing.InOutQuad
+ duration: resetAnimation._duration
+ to: 0
+ }
+ }
+ }
+ }
+
+ ScrollDecorator { flickable: imageFlickable }
}
Item {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/qml/pages/HistoryPage.qml
^
|
@@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2014 Steffen Förster
-Copyright (c) 2018-2020 Slava Monich
+Copyright (c) 2018-2024 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
@@ -29,30 +29,31 @@
import harbour.barcode 1.0
import "../js/Utils.js" as Utils
-import "../harbour"
+import "../components"
Page {
- id: historyPage
+ property int _myStackDepth
allowedOrientations: window.allowedOrientations
- property int myStackDepth
-
- readonly property bool empty: HistoryModel.count === 0
-
onStatusChanged: {
if (status === PageStatus.Active) {
- myStackDepth = pageStack.depth
+ _myStackDepth = pageStack.depth
} else if (status === PageStatus.Inactive) {
// We also end up here after TextPage gets pushed
- if (pageStack.depth < myStackDepth) {
+ if (pageStack.depth < _myStackDepth) {
// It's us getting popped
HistoryModel.commitChanges()
+ header.loseFocus()
}
}
}
- onIsPortraitChanged: historyList.positionViewAtIndex(historyList.currentIndex, ListView.Visible)
+ onIsPortraitChanged: {
+ historyList.positionViewAtIndex(historyList.currentIndex, ListView.Visible)
+ // Otherwise width is changing with a delay, causing visible layout changes:
+ width = isPortrait ? Screen.width : Screen.height
+ }
Notification {
id: clipboardNotification
@@ -65,93 +66,14 @@
}
}
- SilicaListView {
- id: historyList
+ SilicaFlickable {
+ id: flickable
anchors.fill: parent
-
- header: PageHeader {
- id: header
-
- //: History page title
- //% "History"
- title: qsTrId("history-title")
-
- HarbourBadge {
- id: badge
- anchors {
- right: header.extraContent.right
- rightMargin: Theme.paddingLarge
- verticalCenter: header.extraContent.verticalCenter
- }
- maxWidth: header.extraContent.width - anchors.rightMargin
- text: HistoryModel.count ? HistoryModel.count : ""
- }
- }
-
- model: HarbourSelectionListModel { sourceModel: HistoryModel }
-
- delegate: HistoryItem {
- id: delegate
-
- value: model.value
- timestamp: model.timestamp
- format: model.format
- enabled: !model.selected || !remorsePopup.visible
- opacity: enabled ? 1 : 0.2
-
- readonly property int modelIndex: index
-
- function deleteItem() {
- //: Remorse popup text
- //% "Deleting"
- remorseAction(qsTrId("history-menu-delete_remorse"), function() {
- HistoryModel.remove(modelIndex)
- })
- }
-
- onClicked: {
- var list = historyList
- var stack = pageStack
- var codePage = stack.push("CodePage.qml", {
- model: historyList.model,
- currentIndex: model.index
- })
- codePage.deleteItemAt.connect(function(index) {
- list.positionViewAtIndex(index, ListView.Visible)
- list.currentIndex = index
- stack.pop()
- list.currentItem.deleteItem()
- })
- codePage.requestIndex.connect(function(index) {
- list.positionViewAtIndex(index, ListView.Visible)
- })
- }
-
- ListView.onRemove: RemoveAnimation { target: delegate }
-
- menu: Component {
- ContextMenu {
- id: contextMenu
-
- MenuItem {
- //: Context menu item
- //% "Delete"
- text: qsTrId("history-menu-delete")
- onClicked: delegate.deleteItem()
- }
- MenuItem {
- //: Context menu item
- //% "Copy to clipboard"
- text: qsTrId("history-menu-copy")
- onClicked: Clipboard.text = HistoryModel.getValue(delegate.modelIndex)
- }
- }
- }
- }
+ contentHeight: content.height
PullDownMenu {
- visible: !historyPage.empty
+ visible: historyList.model.count > 0
MenuItem {
//: Pulley menu item
//% "Clear"
@@ -159,8 +81,10 @@
onClicked: {
//: Remorse popup text
//% "Deleting all codes"
- remorsePopup.execute(qsTrId("history-remorse-deleting_all"),
- function() { HistoryModel.removeAll() })
+ remorsePopup.execute(qsTrId("history-remorse-deleting_all"), function() {
+ HistoryModel.removeAll()
+ header.searchText = ""
+ })
}
}
MenuItem {
@@ -172,9 +96,15 @@
var page = pageStack.push("SelectPage.qml", { model: historyList.model })
page.copySelected.connect(function() {
pageStack.pop()
- var n = historyList.model.selectionCount
+ var values = historyList.model.selectedValues("value")
+ var n = values.length
if (n > 0) {
- Clipboard.text = HistoryModel.concatenateCodes(historyList.model.selectedRows, '\n')
+ var concat = ""
+ for (var i = 0; i < n; i++) {
+ if (i > 0) concat += "\n"
+ concat += values[i]
+ }
+ Clipboard.text = concat
clipboardNotification.previewBody = (n === 1) ?
//: Notification text (single code selected)
//% "Selected code copied to clipboard"
@@ -196,7 +126,7 @@
//: Remorse popup text (multiple codes selected)
//% "Deleting selected codes"
qsTrId("history-remorse-deleting_selected_codes"), function() {
- HistoryModel.removeMany(historyList.model.selectedRows)
+ HistoryModel.removeMany(historyList.model.selectedValues("id"))
})
}
})
@@ -208,15 +138,113 @@
id: remorsePopup
}
- VerticalScrollDecorator { }
-
ViewPlaceholder {
- id: placeHolder
+ enabled: !HistoryModel.count
+ text: HistoryModel.isEmpty ?
+ //: Placeholder text
+ //% "The history is empty"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/qml/pages/ScanPage.qml
^
|
@@ -2,7 +2,7 @@
The MIT License (MIT)
Copyright (c) 2014 Steffen Förster
-Copyright (c) 2018-2022 Slava Monich
+Copyright (c) 2018-2024 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
@@ -47,6 +47,7 @@
property Item hint
property bool showMarker
+ readonly property real screenHeight: isPortrait ? Screen.height : Screen.width
readonly property bool mustShowViewFinder: (thisPage.status === PageStatus.Active) && Qt.application.active && !scanningGalleryImage && !showMarker
readonly property bool hintActive: hint && hint.visible
readonly property bool landscapeLayout: width > height
@@ -147,6 +148,7 @@
galleryImage.resetZoom()
galleryImage.centerContent()
zoomSlider.value = galleryImage.actualZoom
+ galleryImage.requestZoom.connect(function(zoom) { zoomSlider.value = zoom })
scanner.startScanning(0)
}
}
@@ -350,7 +352,8 @@
SilicaFlickable {
id: scanPageFlickable
- anchors.fill: parent
+ width: parent.width
+ height: screenHeight
interactive: !(invertButton.visible && invertButton.down)
PullDownMenu {
@@ -408,6 +411,7 @@
Behavior on opacity { FadeAnimation { } }
sourceComponent: Component {
Rotator {
+ onReset: galleryImage.angle = 0
onRotateUp: galleryImage.angle += degrees
onRotateDown: galleryImage.angle -= degrees
}
@@ -425,6 +429,7 @@
sourceComponent: Component {
Rotator {
inverted: true
+ onReset: galleryImage.angle = 0
onRotateUp: galleryImage.angle -= degrees
onRotateDown: galleryImage.angle += degrees
}
@@ -603,7 +608,6 @@
minimumValue: scanningGalleryImage ? galleryImage.minZoom : 1.0
maximumValue: scanningGalleryImage ? galleryImage.maxZoom : AppSettings.maxDigitalZoom
value: 1
- stepSize: scanningGalleryImage ? 0.1 : 1
//: Slider label
//% "Zoom"
label: qsTrId("scan-slider-zoom")
@@ -948,7 +952,7 @@
//% "Deleting"
remorse.execute(resultItem, qsTrId("history-menu-delete_remorse"),
function() {
- HistoryModel.remove(0)
+ HistoryModel.remove(clickableResult.recordId)
if (thisPage.status === PageStatus.Active) {
HistoryModel.commitChanges()
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/qml/pages/SelectPage.qml
^
|
@@ -1,7 +1,7 @@
/*
The MIT License (MIT)
-Copyright (c) 2019-2020 Slava Monich
+Copyright (c) 2019-2024 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
@@ -85,8 +85,10 @@
rightMargin: Theme.paddingLarge
verticalCenter: header.extraContent.verticalCenter
}
+ // Show the badge only if nothing has been filtered out
+ visible: model.count === HistoryModel.totalCount
maxWidth: header.extraContent.width - anchors.rightMargin
- text: model.count ? model.count : ""
+ text: model.count
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/src/HistoryModel.cpp
^
|
@@ -1,7 +1,7 @@
/*
The MIT License (MIT)
- Copyright (c) 2018-2020 Slava Monich
+ Copyright (c) 2018-2024 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
@@ -38,17 +38,20 @@
#include <QSqlRecord>
#include <QSqlTableModel>
-#define DEFAULT_MAX_COUNT (100)
+#include <limits.h>
// ==========================================================================
// HistoryModel::CleanupTask
// Removes image files not associated with any rows in the database
// ==========================================================================
-class HistoryModel::CleanupTask : public HarbourTask {
+class HistoryModel::CleanupTask :
+ public HarbourTask
+{
Q_OBJECT
+
public:
- CleanupTask(QThreadPool* aPool, QStringList aList);
+ CleanupTask(QThreadPool*, QStringList);
void performTask() Q_DECL_OVERRIDE;
public:
@@ -56,12 +59,17 @@
bool iHaveImages;
};
-HistoryModel::CleanupTask::CleanupTask(QThreadPool* aPool, QStringList aList) :
- HarbourTask(aPool), iList(aList), iHaveImages(false)
+HistoryModel::CleanupTask::CleanupTask(
+ QThreadPool* aPool,
+ QStringList aList) :
+ HarbourTask(aPool),
+ iList(aList),
+ iHaveImages(false)
{
}
-void HistoryModel::CleanupTask::performTask()
+void
+HistoryModel::CleanupTask::performTask()
{
QDirIterator it(Database::imageDir().path(), QDir::Files);
while (it.hasNext()) {
@@ -90,31 +98,40 @@
// HistoryModel::SaveTask
// ==========================================================================
-class HistoryModel::SaveTask : public HarbourTask {
+class HistoryModel::SaveTask :
+ public HarbourTask
+{
Q_OBJECT
+
public:
- SaveTask(QThreadPool* aPool, QImage aImage, QString aId);
+ SaveTask(QThreadPool*, QImage, QString);
void performTask() Q_DECL_OVERRIDE;
public:
- QImage iImage;
- QString iId;
- QString iName;
+ const QImage iImage;
+ const QString iId;
+ const QString iName;
};
-HistoryModel::SaveTask::SaveTask(QThreadPool* aPool, QImage aImage, QString aId) :
- HarbourTask(aPool), iImage(aImage), iId(aId),
+HistoryModel::SaveTask::SaveTask(
+ QThreadPool* aPool,
+ QImage aImage,
+ QString aId) :
+ HarbourTask(aPool),
+ iImage(aImage),
+ iId(aId),
iName(aId + HistoryImageProvider::IMAGE_EXT)
{
}
-void HistoryModel::SaveTask::performTask()
+void
+HistoryModel::SaveTask::performTask()
{
QDir dir(Database::imageDir());
if (!dir.exists()) {
dir.mkpath(".");
}
- const QString path(dir.path() + QDir::separator() + iName);
+ const QString path(dir.filePath(iName));
HDEBUG(qPrintable(path));
if (!iImage.save(path)) {
HWARN("Fails to save" << qPrintable(path));
@@ -126,12 +143,15 @@
// HistoryModel::PurgeTask
// ==========================================================================
-class HistoryModel::PurgeTask : public QRunnable {
+class HistoryModel::PurgeTask :
+ public QRunnable
+{
public:
void run() Q_DECL_OVERRIDE;
};
-void HistoryModel::PurgeTask::run()
+void
+HistoryModel::PurgeTask::run()
{
QDirIterator it(Database::imageDir().path(), QDir::Files);
while (it.hasNext()) {
@@ -158,8 +178,11 @@
// HistoryModel::Private
// ==========================================================================
-class HistoryModel::Private : public QSqlTableModel {
+class HistoryModel::Private :
+ public QSqlTableModel
+{
Q_OBJECT
+
public:
enum {
FIELD_ID,
@@ -168,6 +191,7 @@
FIELD_FORMAT,
NUM_FIELDS
};
+
// Order of first NUM_FIELDS roles must match the order of fields:
enum {
FirstRole = Qt::UserRole,
@@ -178,6 +202,7 @@
HasImageRole,
LastRole = HasImageRole
};
+
static const int DB_SORT_COLUMN = FIELD_TIMESTAMP;
static const QString DB_TABLE;
static const QString DB_FIELD[NUM_FIELDS];
@@ -190,18 +215,19 @@
enum TriState { No, Maybe, Yes };
- Private(HistoryModel* aModel);
+ Private(HistoryModel*);
~Private();
HistoryModel* historyModel() const;
- QVariant valueAt(int aRow, int aField) const;
- bool imageFileExistsAt(int aRow) const;
+ QVariant valueAt(int, int) const;
+ bool isEmpty() const;
+ bool imageFileExistsAt(int) const;
bool removeExtraRows(int aReserve = 0);
void commitChanges();
void cleanupFiles();
QHash<int,QByteArray> roleNames() const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex& aIndex, int aRole) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex&, int) const Q_DECL_OVERRIDE;
private Q_SLOTS:
void onSaveDone();
@@ -210,9 +236,11 @@
public:
QThreadPool* iThreadPool;
TriState iHaveImages;
+ QString iFilterString;
bool iSaveImages;
int iMaxCount;
int iLastKnownCount;
+ bool iLastKnownEmpty;
int iFieldIndex[NUM_FIELDS];
};
@@ -225,12 +253,13 @@
};
const QString HistoryModel::Private::HAS_IMAGE("hasImage");
-HistoryModel::Private::Private(HistoryModel* aPublicModel) :
+HistoryModel::Private::Private(
+ HistoryModel* aPublicModel) :
QSqlTableModel(aPublicModel, Database::database()),
iThreadPool(new QThreadPool(this)),
iHaveImages(Maybe),
iSaveImages(true),
- iMaxCount(DEFAULT_MAX_COUNT),
+ iMaxCount(INT_MAX),
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/src/HistoryModel.h
^
|
@@ -1,7 +1,7 @@
/*
The MIT License (MIT)
-Copyright (c) 2018-2019 Slava Monich
+Copyright (c) 2018-2024 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
@@ -35,49 +35,62 @@
#define HISTORY_FIELD_TIMESTAMP "timestamp"
#define HISTORY_FIELD_FORMAT "format"
-class HistoryModel: public QSortFilterProxyModel {
+class HistoryModel :
+ public QSortFilterProxyModel
+{
Q_OBJECT
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
+ Q_PROPERTY(int totalCount READ totalCount NOTIFY totalCountChanged)
Q_PROPERTY(int maxCount READ maxCount WRITE setMaxCount NOTIFY maxCountChanged)
Q_PROPERTY(bool saveImages READ saveImages WRITE setSaveImages NOTIFY saveImagesChanged)
Q_PROPERTY(bool hasImages READ hasImages NOTIFY hasImagesChanged)
+ Q_PROPERTY(bool isEmpty READ isEmpty NOTIFY isEmptyChanged)
+ Q_PROPERTY(QString filterString READ filterString WRITE setFilterString NOTIFY filterStringChanged)
public:
- HistoryModel(QObject* aParent = NULL);
+ HistoryModel(QObject* aParent = Q_NULLPTR);
+
+ int totalCount() const;
int maxCount() const;
void setMaxCount(int aValue);
+ bool isEmpty() const;
bool hasImages() const;
bool saveImages() const;
void setSaveImages(bool aValue);
- Q_INVOKABLE QVariantMap get(int row);
- Q_INVOKABLE QString getValue(int row);
- Q_INVOKABLE QString insert(QImage image, QString value, QString format);
- Q_INVOKABLE QString concatenateCodes(QList<int> rows, QString separator);
- Q_INVOKABLE void remove(int row);
+ QString filterString() const;
+ void setFilterString(QString);
+
+ Q_INVOKABLE QString getValue(int);
+ Q_INVOKABLE int insert(QImage, QString, QString);
+ Q_INVOKABLE void remove(int);
+ Q_INVOKABLE void removeAt(int);
Q_INVOKABLE void removeAll();
- Q_INVOKABLE void removeMany(QList<int> rows);
+ Q_INVOKABLE void removeMany(QVariantList);
Q_INVOKABLE void commitChanges();
// Utilities
- Q_INVOKABLE static QString formatTimestamp(QString timestamp);
+ Q_INVOKABLE static QString formatTimestamp(QString);
// Callback for qmlRegisterSingletonType<HistoryModel>
- static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+ static QObject* createSingleton(QQmlEngine*, QJSEngine*);
protected:
- bool filterAcceptsRow(int aRow, const QModelIndex& aParent) const;
+ bool filterAcceptsRow(int, const QModelIndex&) const;
private Q_SLOTS:
- void checkCount();
+ void updateCount();
Q_SIGNALS:
void countChanged();
+ void totalCountChanged();
void maxCountChanged();
- void hasImagesChanged();
void saveImagesChanged();
+ void hasImagesChanged();
+ void isEmptyChanged();
+ void filterStringChanged();
private:
class Private;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-cs.ts
^
|
@@ -247,10 +247,15 @@
<translation type="unfinished">Vybrané kódy zkopírovány do schránky</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>Historie je prázdná</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">Hledaný text nebyl nalezen</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-da.ts
^
|
@@ -245,10 +245,15 @@
<translation type="unfinished">Valgte koder kopieret til udklipsholder</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>Historikken er tom</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">Søgeteksten blev ikke fundet</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-de.ts
^
|
@@ -245,10 +245,15 @@
<translation>Ausgewählte Codes in die Zwischenablage kopiert</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>Verlauf ist leer</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">Der Suchtext nicht gefunden</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-es.ts
^
|
@@ -245,10 +245,15 @@
<translation type="unfinished">Códigos seleccionados copiados al portapapeles</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>El historial está vacío</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">El texto buscado no se encuentra</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-fr.ts
^
|
@@ -245,10 +245,15 @@
<translation type="unfinished">Codes sélectionnés copiés dans le presse-papiers</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>Historique vierge</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">Le texte recherché n'est pas trouvé</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-hu.ts
^
|
@@ -243,10 +243,15 @@
<translation>A vágólapra másolva</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>Nincsenek előzmények</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">A keresett szöveg nem található</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-it.ts
^
|
@@ -245,9 +245,14 @@
<translation type="unfinished">Codici selezionati copiati negli appunti</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">La cronologia è vuota</translation>
+ </message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">Il testo di ricerca non viene trovato</translation>
</message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-pl.ts
^
|
@@ -247,10 +247,15 @@
<translation>Wybrane kody skopiowane do schowka</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>Historia jest pusta</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">Nic nie znaleziono</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-pt.ts
^
|
@@ -245,10 +245,15 @@
<translation>Códigos selecionados copiados para área de transferência</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>Historial está vazio</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">O texto de pesquisa não foi encontrado</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-ru.ts
^
|
@@ -247,10 +247,15 @@
<translation>Выбранные коды скопированы в буфер обмена</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>Тут ничего нет</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation>Ничего не найдено</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-sk.ts
^
|
@@ -247,10 +247,15 @@
<translation>Vybrané kódy boli skopírované do schránky</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>História je prázdná</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">Hľadaný text nebol nájdený</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-sv.ts
^
|
@@ -245,10 +245,15 @@
<translation>Markerade koder kopierade till urklipp</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>Historiken är tom</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">Söktexten hittades inte</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-zh_CN.ts
^
|
@@ -243,10 +243,15 @@
<translation>所选条码已复制到剪贴板</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>历史记录为空</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">找不到搜索文本</translation>
+ </message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
<extracomment>Button text</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode-zh_TW.ts
^
|
@@ -233,10 +233,15 @@
<translation type="unfinished">所選代碼已復製到剪貼板</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
<translation>無歷史紀錄</translation>
</message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation type="unfinished">找不到搜尋文本</translation>
+ </message>
<message id="settings-scan-section">
<source>Scan</source>
<extracomment>Section header</extracomment>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-barcode-1.0.51.tar.bz2/translations/harbour-barcode.ts
^
|
@@ -245,9 +245,14 @@
<translation>Selected codes copied to clipboard</translation>
</message>
<message id="history-empty">
- <source>History is empty</source>
+ <source>The history is empty</source>
<extracomment>Placeholder text</extracomment>
- <translation>History is empty</translation>
+ <translation>The history is empty</translation>
+ </message>
+ <message id="history-nothing_found">
+ <source>The search text is not found</source>
+ <extracomment>Placeholder text</extracomment>
+ <translation>The search text is not found</translation>
</message>
<message id="button-eu_covid_cert">
<source>COVID Certificate</source>
|