[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/sailfish-qrshare.git</param>
<param name="branch">master</param>
- <param name="revision">e17035d</param>
+ <param name="revision">d54c2b8</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib
^
|
-(directory)
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/LICENSE
^
|
@@ -1,30 +0,0 @@
-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:
-
-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.
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/harbour-lib.pro
^
|
@@ -1,114 +0,0 @@
-TEMPLATE = lib
-CONFIG += static
-TARGET = harbour-lib
-QT += dbus
-QT-= gui
-
-# For HarbourSystemTime
-CONFIG += link_pkgconfig
-PKGCONFIG += libglibutil
-
-VERSION = 1.0
-
-greaterThan(QT_MAJOR_VERSION, 4) {
-QT += qml quick
-} else {
-QT += declarative
-}
-
-QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-unused-result -Wno-psabi
-
-CONFIG(debug, debug|release) {
- DEFINES += HARBOUR_DEBUG=1
-}
-
-SOURCES += \
- src/HarbourBase32.cpp \
- src/HarbourBase45.cpp \
- src/HarbourClipboard.cpp \
- src/HarbourDisplayBlanking.cpp \
- src/HarbourJson.cpp \
- src/HarbourLib.cpp \
- src/HarbourMce.cpp \
- src/HarbourMediaPlugin.cpp \
- src/HarbourObject.cpp \
- src/HarbourOrganizeListModel.cpp \
- src/HarbourPolicyPlugin.cpp \
- src/HarbourProcessState.cpp \
- src/HarbourSelectionListModel.cpp \
- src/HarbourSigChildHandler.cpp \
- src/HarbourSingleImageProvider.cpp \
- src/HarbourSystem.cpp \
- src/HarbourSystemInfo.cpp \
- src/HarbourSystemState.cpp \
- src/HarbourSystemTime.cpp \
- src/HarbourTask.cpp \
- src/HarbourTemporaryFile.cpp \
- src/HarbourTransferMethodInfo.cpp \
- src/HarbourTransferMethodsModel.cpp
-
-greaterThan(QT_MAJOR_VERSION, 4) {
-SOURCES += \
- src/HarbourImageProvider.cpp \
- src/HarbourPluginLoader.cpp \
- src/HarbourTheme.cpp
-}
-
-INCLUDEPATH += include
-PUBLIC_HEADERS += \
- include/HarbourBase32.h \
- include/HarbourBase45.h \
- include/HarbourClipboard.h \
- include/HarbourDebug.h \
- include/HarbourDisplayBlanking.h \
- include/HarbourJson.h \
- include/HarbourLib.h \
- include/HarbourMediaPlugin.h \
- include/HarbourObject.h \
- include/HarbourOrganizeListModel.h \
- include/HarbourPolicyPlugin.h \
- include/HarbourProcessState.h \
- include/HarbourSelectionListModel.h \
- include/HarbourSigChildHandler.h \
- include/HarbourSingleImageProvider.h \
- include/HarbourSystem.h \
- include/HarbourSystemInfo.h \
- include/HarbourSystemState.h \
- include/HarbourSystemTime.h \
- include/HarbourTask.h \
- include/HarbourTemporaryFile.h \
- include/HarbourTransferMethodInfo.h \
- include/HarbourTransferMethodsModel.h
-
-greaterThan(QT_MAJOR_VERSION, 4) {
-PUBLIC_HEADERS += \
- include/HarbourImageProvider.h \
- include/HarbourPluginLoader.h \
- include/HarbourTheme.h
-OTHER_FILES += qml/*.qml
-}
-
-HEADERS += \
- $$PUBLIC_HEADERS \
- src/HarbourMce.h
-
-OTHER_FILES += \
- LICENSE \
- README \
- rpm/harbour-lib-devel.spec
-
-headers.path = $$INSTALL_ROOT$$PREFIX/include/$$TARGET
-headers.files = $$PUBLIC_HEADERS
-INSTALLS += headers
-
-target.path = $$[QT_INSTALL_LIBS]
-INSTALLS += target
-
-pkgconfig.files = $$TARGET.pc
-pkgconfig.path = $$target.path/pkgconfig-qt5
-QMAKE_PKGCONFIG_DESCRIPTION = Utility library for Sailfish harbour apps
-QMAKE_PKGCONFIG_INCDIR = $$headers.path
-QMAKE_PKGCONFIG_LIBDIR = $$target.path
-QMAKE_PKGCONFIG_DESTDIR = pkgconfig
-CONFIG += create_pc create_prl no_install_prl
-INSTALLS += pkgconfig
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/include/HarbourBase32.h
^
|
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2019-2021 Jolla Ltd.
- * Copyright (C) 2019-2021 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_BASE32_H
-#define HARBOUR_BASE32_H
-
-#include <QString>
-#include <QByteArray>
-
-class HarbourBase32 {
- class Private;
- HarbourBase32();
-public:
- static QByteArray fromBase32(QString aBase32);
- static QString toBase32(QByteArray aBinary, bool aLowerCase = true);
- static bool isValidBase32(QString aBase32);
-};
-
-#endif // HARBOUR_BASE32_H
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/include/HarbourBase45.h
^
|
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2021 Jolla Ltd.
- * Copyright (C) 2021 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_BASE45_H
-#define HARBOUR_BASE45_H
-
-#include <QString>
-#include <QByteArray>
-
-class HarbourBase45 {
- class Private;
- HarbourBase45();
-public:
- static bool isValidBase45(QString aBase45);
- static QByteArray fromBase45(QString aBase45);
- static QString toBase45(QByteArray aBinary);
-};
-
-#endif // HARBOUR_BASE45_H
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/include/HarbourProcessState.h
^
|
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2021 Jolla Ltd.
- * Copyright (C) 2021 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_PROCESS_STATE_H
-#define HARBOUR_PROCESS_STATE_H
-
-#include <QObject>
-
-class QQmlEngine;
-class QJSEngine;
-
-class HarbourProcessState: public QObject
-{
- Q_OBJECT
- Q_DISABLE_COPY(HarbourProcessState)
- Q_PROPERTY(bool jailedApp READ isJailedApp CONSTANT)
-
-public:
- explicit HarbourProcessState(QObject* aParent = Q_NULLPTR);
-
- // Callback for qmlRegisterSingletonType<HarbourProcessState>
- static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
-
- static bool isJailedApp();
-};
-
-#endif // HARBOUR_PROCESS_STATE_H
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/include/HarbourSelectionListModel.h
^
|
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 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_SELECTION_LIST_MODEL_H
-#define HARBOUR_SELECTION_LIST_MODEL_H
-
-#include <QtQml>
-#include <QIdentityProxyModel>
-
-class HarbourSelectionListModel : public QIdentityProxyModel {
- Q_OBJECT
- Q_PROPERTY(QObject* sourceModel READ sourceModel WRITE setSourceModelObject NOTIFY sourceModelObjectChanged)
- Q_PROPERTY(QList<int> selectedRows READ selectedRows NOTIFY selectedRowsChanged)
- Q_PROPERTY(int selectionCount READ selectionCount NOTIFY selectedRowsChanged)
- Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
-
-public:
- HarbourSelectionListModel(QObject* aParent = Q_NULLPTR);
-
- void setSourceModelObject(QObject* aModel);
-
- QList<int> selectedRows() const;
- int selectionCount() const;
-
- Q_INVOKABLE void selectAll();
- Q_INVOKABLE void clearSelection();
-
- // QAbstractItemModel
- Qt::ItemFlags flags(const QModelIndex& aIndex) 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;
-
-Q_SIGNALS:
- void sourceModelObjectChanged();
- void selectedRowsChanged();
- void countChanged();
-
-private:
- class Private;
- Private* iPrivate;
-};
-
-QML_DECLARE_TYPE(HarbourSelectionListModel)
-
-#endif // HARBOUR_SELECTION_LIST_MODEL_H
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/include/HarbourTheme.h
^
|
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2018-2020 Jolla Ltd.
- * Copyright (C) 2018-2020 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
- * 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_THEME_H
-#define HARBOUR_THEME_H
-
-#include <QObject>
-#include <QColor>
-
-class QQmlEngine;
-class QJSEngine;
-
-class HarbourTheme : public QObject
-{
- Q_OBJECT
- Q_ENUMS(ColorScheme)
- Q_PROPERTY(ColorScheme colorScheme READ colorScheme NOTIFY colorSchemeChanged)
- Q_PROPERTY(QColor invertedPrimaryColor READ invertedPrimaryColor NOTIFY primaryColorChanged)
- Q_PROPERTY(QColor primaryColor READ primaryColor NOTIFY primaryColorChanged)
- Q_PROPERTY(bool lightOnDark READ lightOnDark NOTIFY colorSchemeChanged)
- Q_PROPERTY(bool darkOnLight READ darkOnLight NOTIFY colorSchemeChanged)
-
- Q_PROPERTY(qreal opacityFaint READ opacityFaint CONSTANT)
- Q_PROPERTY(qreal opacityLow READ opacityLow CONSTANT)
- Q_PROPERTY(qreal opacityHigh READ opacityHigh CONSTANT)
- Q_PROPERTY(qreal opacityOverlay READ opacityOverlay CONSTANT)
-
-public:
- class Private;
-
- enum ColorScheme {
- LightOnDark,
- DarkOnLight
- };
-
- explicit HarbourTheme(QObject* aParent = Q_NULLPTR);
-
- ~HarbourTheme();
-
- // Callback for qmlRegisterSingletonType<HarbourTheme>
- static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
-
- QColor invertedPrimaryColor() const;
- QColor primaryColor() const;
- ColorScheme colorScheme() const;
- bool lightOnDark() const;
- bool darkOnLight() const;
-
- qreal opacityFaint() const;
- qreal opacityLow() const;
- qreal opacityHigh() const;
- qreal opacityOverlay() const;
-
- Q_INVOKABLE static QColor invertedColor(const QColor& aColor);
- Q_INVOKABLE static qreal colorDifference(const QColor& aColor1, const QColor& aColor2);
-
-Q_SIGNALS:
- void colorSchemeChanged();
- void primaryColorChanged();
-
-private:
- QObject* iPrivate;
-};
-
-#endif // HARBOUR_THEME_H
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/include/HarbourTransferMethodsModel.h
^
|
@@ -1,90 +0,0 @@
-/*
- * 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:
- *
- * 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.
- */
-
-#ifndef HARBOUR_TRANSFER_METHODS_MODEL_H
-#define HARBOUR_TRANSFER_METHODS_MODEL_H
-
-#include "HarbourTransferMethodInfo.h"
-
-#include <QLocale>
-
-class QTranslator;
-class QQmlEngine;
-class QJSEngine;
-
-class HarbourTransferMethodsModel: public QAbstractListModel
-{
- Q_OBJECT
- Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
- Q_PROPERTY(bool accountIconSupported READ accountIconSupported NOTIFY accountIconSupportedChanged)
- Q_PROPERTY(bool showAccountsPending READ showAccountsPending NOTIFY showAccountsPendingChanged)
- Q_PROPERTY(bool canShowAccounts READ canShowAccounts NOTIFY canShowAccountsChanged)
-
-public:
- explicit HarbourTransferMethodsModel(QObject* aParent = Q_NULLPTR);
- ~HarbourTransferMethodsModel();
-
- // Callback for qmlRegisterSingletonType<HarbourTransferMethodsModel>
- static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
-
- static bool loadTranslations(QTranslator* aTranslator, QLocale aLocale);
-
- int count() const;
- QString filter() const;
- void setFilter(QString filter);
- bool accountIconSupported() const;
- bool showAccountsPending() const;
- bool canShowAccounts() const;
-
- Q_INVOKABLE void showAccounts();
-
- // 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;
-
-Q_SIGNALS:
- void countChanged();
- void filterChanged();
- void accountIconSupportedChanged();
- void showAccountsPendingChanged();
- void canShowAccountsChanged();
-
-private:
- class Private;
- class TransferEngine;
- Private* iPrivate;
-};
-
-#endif // HARBOUR_TRANSFER_METHODS_MODEL_H
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/qml/HarbourBadge.qml
^
|
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava@monich.com>
- *
- * You may use this file under the terms of 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.
- */
-
-import QtQuick 2.0
-import Sailfish.Silica 1.0
-
-Item {
- id: badge
-
- property real maxWidth: parent.width
- property alias text: label.text
- readonly property real radius: height/2
-
- width: Math.max(label.implicitWidth + radius, height)
- height: Theme.itemSizeSmall/2
- visible: opacity > 0
- opacity: text.length ? 1 : 0
-
- Behavior on opacity { FadeAnimation {} }
-
- Rectangle {
- id: background
-
- anchors.fill: parent
- color: Theme.rgba(Theme.primaryColor, 0.2)
- radius: badge.radius
- }
-
- HarbourFitLabel {
- id: label
-
- font.bold: true
- maxWidth: Math.max(badge.maxWidth - radius, 2 * radius)
- maxHeight: Math.floor(parent.height - radius/2)
- anchors.centerIn: background
- }
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/qml/HarbourShareMethodList.qml
^
|
@@ -1,144 +0,0 @@
-/*
- * 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:
- *
- * 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.
- */
-
-import QtQuick 2.0
-import Sailfish.Silica 1.0
-
-SilicaListView {
- id: view
-
- property url source
- property string subject
- property string emailTo
- property string type
-
- width: parent.width
- height: Theme.itemSizeSmall * model.count
-
- property string addAccountText: "Add account"
- readonly property bool accountIconSupported: model.accountIconSupported
- property var content: []
- // model: HarbourTransferMethodsModel
-
- onTypeChanged: content.type = type
-
- Component.onCompleted: content.type = type
-
- delegate: BackgroundItem {
- id: backgroundItem
- width: view.width
-
- Image {
- id: icon
-
- x: Theme.horizontalPageMargin
- anchors.verticalCenter: parent.verticalCenter
- source: accountIcon ? accountIcon :
- view.accountIconSupported ? "image://theme/icon-m-share" : ""
- visible: view.accountIconSupported
- }
-
- Label {
- id: displayNameLabel
-
- text: displayName
- color: backgroundItem.highlighted ? Theme.highlightColor : Theme.primaryColor
- truncationMode: TruncationMode.Fade
- x: Theme.horizontalPageMargin
- anchors {
- left: icon.visible ? icon.right : parent.left
- leftMargin: icon.visible ? Theme.paddingMedium : Theme.horizontalPageMargin
- verticalCenter: parent.verticalCenter
- }
- width: Math.min(implicitWidth, parent.width - 2*Theme.horizontalPageMargin)
- }
-
- Label {
- text: userName
- font.pixelSize: Theme.fontSizeMedium
- color: backgroundItem.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
- truncationMode: TruncationMode.Fade
- anchors {
- left: displayNameLabel.right
- leftMargin: Theme.paddingSmall
- right: parent.right
- rightMargin: Theme.horizontalPageMargin
- verticalCenter: parent.verticalCenter
- }
- visible: text.length > 0
- }
-
- onClicked: {
- pageStack.push(model.shareUIPath, {
- source: view.source,
- content: content,
- methodId: model.methodId,
- displayName: model.displayName,
- accountId: model.accountId,
- accountName: model.userName,
- emailTo: view.emailTo,
- emailSubject: view.subject
- })
- }
- }
-
- footer: BackgroundItem {
- enabled: model.canShowAccounts && !model.showAccountsPending
- opacity: enabled ? 1.0 : 0.4
-
- Image {
- id: addAccountIcon
-
- x: Theme.horizontalPageMargin
- anchors.verticalCenter: parent.verticalCenter
- source: view.accountIconSupported ?
- ("image://theme/icon-m-add" + (parent.highlighted ? "?" + Theme.highlightColor : "")) : ""
- visible: view.accountIconSupported
- }
-
- Label {
- text: addAccountText
- x: Theme.horizontalPageMargin
- anchors {
- left: addAccountIcon.visible ? addAccountIcon.right : parent.left
- leftMargin: addAccountIcon.visible ? Theme.paddingMedium : Theme.horizontalPageMargin
- verticalCenter: parent.verticalCenter
- }
- color: highlighted ? Theme.highlightColor : Theme.primaryColor
- }
-
- onClicked: model.showAccounts()
- }
-
- VerticalScrollDecorator { }
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/src/HarbourBase32.cpp
^
|
@@ -1,252 +0,0 @@
-/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 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 "HarbourBase32.h"
-
-#include "HarbourDebug.h"
-
-#define BASE32_BITS_PER_NIBBLE (5)
-#define BASE32_BYTES_PER_CHUNK (5)
-#define BASE32_NIBBLES_PER_CHUNK (8)
-#define BASE32_BITS_PER_CHUNK (BASE32_BITS_PER_NIBBLE*BASE32_NIBBLES_PER_CHUNK)
-#define BASE32_NIBBLE_MASK ((1 << BASE32_BITS_PER_NIBBLE) - 1)
-Q_STATIC_ASSERT(BASE32_BITS_PER_CHUNK == BASE32_BYTES_PER_CHUNK * 8);
-
-// ==========================================================================
-// HarbourBase32::Private
-// ==========================================================================
-
-class HarbourBase32::Private {
-public:
- static char nibbleToBase32(int nibble, char a);
- static int base32ToNibble(char a);
-};
-
-inline char HarbourBase32::Private::nibbleToBase32(int nibble, char a)
-{
- return (nibble < 26) ? (a + nibble) : ('2' + (nibble - 26));
-}
-
-inline int HarbourBase32::Private::base32ToNibble(char c)
-{
- 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');
- } else {
- return -1;
- }
-}
-
-// ==========================================================================
-// HarbourBase32
-// ==========================================================================
-
-bool HarbourBase32::isValidBase32(QString aBase32)
-{
- const int n = aBase32.length();
- const QChar* chars = aBase32.constData();
-
- qint64 buf = 0;
- int i, bits = 0;
- bool empty = true;
-
- for (i = 0; i < n; i++) {
- const QChar c = chars[i];
-
- if (!c.isSpace()) {
- const char l = c.toLatin1();
-
- empty = false;
- if (l == '=') {
- i++;
- break;
- } else {
- const int nibble = Private::base32ToNibble(l);
-
- if (nibble < 0) {
- HDEBUG("Invalid BASE32 character" << c);
- return false;
- }
- bits += BASE32_BITS_PER_NIBBLE;
- buf <<= BASE32_BITS_PER_NIBBLE;
- buf += nibble;
- if (bits == BASE32_BITS_PER_CHUNK) {
- bits = 0;
- buf = 0;
- }
- }
- }
- }
-
- // Handle padding per RFC 4648
- if (bits) {
- while (i < n) {
- const QChar c = chars[i++];
-
- if (!c.isSpace()) {
- empty = false;
- if (c != '=') {
- HDEBUG("Invalid BASE32 string" << aBase32);
- return false;
- }
- }
- }
- const int realbits = bits/8*8;
- const int mask = (1 << (bits - realbits)) - 1;
- if (buf & mask) {
- return false;
- }
- }
- return !empty;
-}
-
-QByteArray HarbourBase32::fromBase32(QString aBase32)
-{
- QByteArray out;
-
- const int n = aBase32.length();
- const QChar* chars = aBase32.constData();
-
- qint64 buf = 0;
- int i, bits = 0;
- char bytes[BASE32_BYTES_PER_CHUNK];
-
- out.reserve((n * 5 + 7)/8);
-
- for (i = 0; i < n; i++) {
- const QChar c = chars[i];
-
- if (!c.isSpace()) {
- const char l = c.toLatin1();
-
- if (l == '=') {
- i++;
- break;
- } else {
- const int nibble = Private::base32ToNibble(l);
-
- if (nibble < 0) {
- HDEBUG("Invalid BASE32 character" << c);
- return QByteArray();
- } else {
- bits += BASE32_BITS_PER_NIBBLE;
- buf <<= BASE32_BITS_PER_NIBBLE;
- buf += nibble;
- if (bits == BASE32_BITS_PER_CHUNK) {
- bits = 0;
- for (int k = BASE32_BYTES_PER_CHUNK; k > 0; k--) {
- bytes[k - 1] = (char)buf;
- buf >>= 8;
- }
- out.append(bytes, BASE32_BYTES_PER_CHUNK);
- }
- }
- }
- }
- }
-
- // Handle padding per RFC 4648
- if (bits) {
- while (i < n) {
- const QChar c = chars[i++];
-
- if (!c.isSpace() && c != '=') {
- HDEBUG("Invalid BASE32 string" << aBase32);
- return QByteArray();
- }
- }
- const int realbits = bits/8*8;
- const int mask = (1 << (bits - realbits)) - 1;
- if (buf & mask) {
- HDEBUG("Invalid BASE32 string" << aBase32);
- return QByteArray();
- } else {
- buf >>= (bits - realbits);
- for (int k = realbits / 8; k > 0; k--) {
- bytes[k - 1] = (char)buf;
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/src/HarbourBase45.cpp
^
|
@@ -1,204 +0,0 @@
-/*
- * Copyright (C) 2021 Jolla Ltd.
- * Copyright (C) 2021 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 "HarbourBase45.h"
-
-#include "HarbourDebug.h"
-
-// ==========================================================================
-// HarbourBase45::Private
-// ==========================================================================
-
-class HarbourBase45::Private {
-public:
- enum {
- BASE = 45,
- BASE2 = BASE * BASE,
- REVERSE_MAP_SIZE = 91
- };
- static const char mapBase45[BASE];
- static const int reverseMapBase45[REVERSE_MAP_SIZE];
- static bool isValidChar(uint x);
-};
-
-const char HarbourBase45::Private::mapBase45[HarbourBase45::Private::BASE] = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
- 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
- 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
- 'W', 'X', 'Y', 'Z', ' ', '$', '%', '*',
- '+', '-', '.', '/', ':'
-};
-
-const int HarbourBase45::Private::reverseMapBase45[HarbourBase45::Private::REVERSE_MAP_SIZE] = {
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1,
- 36, -1, -1, -1, 37, 38, -1, -1,
- -1, -1, 39, 40, -1, 41, 42, 43,
- 0, 1, 2, 3, 4, 5, 6, 7,
- 8, 9, 44, -1, -1, -1, -1, -1,
- -1, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35
-};
-
-inline bool HarbourBase45::Private::isValidChar(uint x)
-{
- return (x < Private::REVERSE_MAP_SIZE) && Private::reverseMapBase45[x] >= 0;
-}
-
-// ==========================================================================
-// HarbourBase45::Private
-// ==========================================================================
-
-bool HarbourBase45::isValidBase45(QString aBase45)
-{
- const int len = aBase45.length();
-
- if (!((len % 3) % 2)) {
- const QChar* chars = aBase45.constData();
- int i = 0;
-
- while ((i + 2) < len) {
- const uint c = chars[i++].unicode();
- const uint d = chars[i++].unicode();
- const uint e = chars[i++].unicode();
-
- if (!Private::isValidChar(c) ||
- !Private::isValidChar(d) ||
- !Private::isValidChar(e) ||
- (Private::reverseMapBase45[c] +
- Private::reverseMapBase45[d] * Private::BASE +
- Private::reverseMapBase45[e] * Private::BASE2) > 0xffff) {
- return false;
- }
- }
-
- if (i < len) {
- const uint c = chars[i++].unicode();
- const uint d = chars[i++].unicode();
-
- if (!Private::isValidChar(c) ||
- !Private::isValidChar(d) ||
- (Private::reverseMapBase45[c] +
- Private::reverseMapBase45[d] * Private::BASE) > 0xff) {
- return false;
- }
- }
- return true;
- }
- return false;
-}
-
-QByteArray HarbourBase45::fromBase45(QString aBase45)
-{
- QByteArray out;
- const int len = aBase45.length();
- const int tail = (len % 3);
-
- if (!(tail % 2)) {
- const QChar* chars = aBase45.constData();
- int i = 0;
-
- out.reserve(len/3*2 + tail/2);
- while ((i + 2) < len) {
- const uint c = chars[i++].unicode();
- const uint d = chars[i++].unicode();
- const uint e = chars[i++].unicode();
-
- if (!Private::isValidChar(c) ||
- !Private::isValidChar(d) ||
- !Private::isValidChar(e)) {
- return QByteArray();
- }
- const uint n = Private::reverseMapBase45[c] +
- Private::reverseMapBase45[d] * Private::BASE +
- Private::reverseMapBase45[e] * Private::BASE2;
- if (n > 0xffff) {
- return QByteArray();
- }
- char ab[2];
- ab[0] = (char)(n >> 8);
- ab[1] = (char)n;
- out.append(ab, sizeof(ab));
- }
-
- if (i < len) {
- const uint c = chars[i++].unicode();
- const uint d = chars[i++].unicode();
-
- if (!Private::isValidChar(c) ||
- !Private::isValidChar(d)) {
- return QByteArray();
- }
- const uint a = Private::reverseMapBase45[c] +
- Private::reverseMapBase45[d] * Private::BASE;
- if (a > 0xff) {
- return QByteArray();
- }
- out.append((char)a);
- }
- }
- return out;
-}
-
-QString HarbourBase45::toBase45(QByteArray aBinary)
-{
- const uchar* ptr = (uchar*)aBinary.constData();
- const int n = aBinary.size();
- int i;
-
- QString str;
- str.reserve(3 * (n / 2) + 2 * (n % 2));
- for (i = 0; (i + 1) < n; i += 2) {
- uint e = (uint)(ptr[i]) * 256 + ptr[i+1];
- const uchar c = (uchar)(e % Private::BASE);
- e = (e - c)/Private::BASE;
- const uchar d = (uchar)(e % Private::BASE);
- e = (e - d)/Private::BASE;
- str.append(QChar::fromLatin1(Private::mapBase45[c]));
- str.append(QChar::fromLatin1(Private::mapBase45[d]));
- str.append(QChar::fromLatin1(Private::mapBase45[e]));
- }
- if (i < n) {
- uchar d = ptr[i];
- const uchar c = d % Private::BASE;
- d = (d - c)/Private::BASE;
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/src/HarbourPluginLoader.cpp
^
|
@@ -1,361 +0,0 @@
-/*
- * Copyright (C) 2017-2020 Jolla Ltd.
- * Copyright (C) 2017-2020 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
- * 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.
- */
-
-#include "HarbourPluginLoader.h"
-#include "HarbourSystem.h"
-#include "HarbourDebug.h"
-
-// These are included from qqmlengine.h
-#include <QUrl>
-#include <QObject>
-#include <QMap>
-#include <QJSEngine>
-#include <QQmlError>
-
-#if QT_VERSION >= 0x050000
-
-// Unprotect QQmlEngine::d_func
-#define private public
-#include <QQmlEngine>
-#undef private
-
-#include <qqml.h>
-#include <QQmlEngine>
-#include <QQmlComponent>
-
-#include <dlfcn.h>
-
-// This hack allows (in most cases) to use prohibited QML imports by
-// re-registering them under a different name
-
-// These:
-// QQmlAttachedPropertiesFunc QQmlType::attachedPropertiesFunction() const
-// _ZNK8QQmlType26attachedPropertiesFunctionEv
-//
-// const QMetaObject* QQmlType::attachedPropertiesType() const
-// _ZNK8QQmlType22attachedPropertiesTypeEv
-//
-// have been replaced with these in Qt 5.6:
-//
-// QQmlAttachedPropertiesFunc QQmlType::attachedPropertiesFunction(QQmlEnginePrivate*) const
-// _ZNK8QQmlType26attachedPropertiesFunctionEP17QQmlEnginePrivate
-//
-// const QMetaObject* QQmlType::attachedPropertiesType(QQmlEnginePrivate*) const
-// _ZNK8QQmlType22attachedPropertiesTypeEP17QQmlEnginePrivate
-//
-
-#define LIBQT5QML_SO "libQt5Qml.so.5"
-
-// sym,ret,name,args
-#define QMLTYPE_FUNCTIONS(f) \
- f("_ZNK8QQmlType26attachedPropertiesFunctionEv", \
- QQmlAttachedPropertiesFunc, AttachedPropertiesFunctionProc,(QQmlType*)) \
- f("_ZNK8QQmlType22attachedPropertiesTypeEv", \
- const QMetaObject*, AttachedPropertiesTypeProc,(QQmlType*)) \
- f("_ZNK8QQmlType26attachedPropertiesFunctionEP17QQmlEnginePrivate", \
- QQmlAttachedPropertiesFunc, AttachedPropertiesFunctionProc6, (QQmlType*,QQmlEnginePrivate*)) \
- f("_ZNK8QQmlType22attachedPropertiesTypeEP17QQmlEnginePrivate", \
- const QMetaObject*, AttachedPropertiesTypeProc6, (QQmlType*,QQmlEnginePrivate*))
-
-// PRIVATE QT API!
-class Q_QML_EXPORT QQmlType
-{
-public:
- int typeId() const;
- int qListTypeId() const;
- typedef void (*CreateFunc)(void *);
- CreateFunc createFunction() const;
- int createSize() const;
- const QMetaObject *metaObject() const;
- int parserStatusCast() const;
- int propertyValueSourceCast() const;
- int propertyValueInterceptorCast() const;
- QQmlAttachedPropertiesFunc attachedPropertiesFunction(QQmlEnginePrivate *engine) const;
- const QMetaObject *attachedPropertiesType(QQmlEnginePrivate *engine) const;
-};
-
-// PRIVATE QT API!
-class Q_QML_EXPORT QQmlMetaType
-{
-public:
- static QQmlType* qmlType(const QString &qualifiedName, int, int);
-};
-
-static const char* QmlTypeSymbols[] = {
-#define QMLTYPE_SYMBOL(sym,ret,name,args) sym,
- QMLTYPE_FUNCTIONS(QMLTYPE_SYMBOL)
-};
-
-typedef struct _QmlTypeFunctions {
-#define QMLTYPE_TYPEDEF(sym,ret,name,args) ret (*name) args;
-QMLTYPE_FUNCTIONS(QMLTYPE_TYPEDEF)
-} QmlTypeFunctions;
-
-#define _N(a) (sizeof(a)/sizeof((a)[0]))
-#define NUM_FUNCTIONS _N(QmlTypeSymbols)
-Q_STATIC_ASSERT(sizeof(QmlTypeFunctions) == NUM_FUNCTIONS*sizeof(void*));
-
-// ==========================================================================
-// HarbourPluginLoader::LibQt5Qml
-// ==========================================================================
-
-class HarbourPluginLoader::LibQt5Qml {
-public:
-
- LibQt5Qml();
-
-public:
- void* iHandle;
- union {
- QmlTypeFunctions fn;
- void* ptr[NUM_FUNCTIONS];
- } iSym;
-};
-
-HarbourPluginLoader::LibQt5Qml::LibQt5Qml() :
- iHandle(HarbourDlopen(LIBQT5QML_SO, RTLD_LAZY))
-{
- memset(&iSym, 0, sizeof(iSym));
- if (iHandle) {
- // Resolve unstable symbols
- for (uint i = 0; i < NUM_FUNCTIONS; i++) {
- iSym.ptr[i] = dlsym(iHandle, QmlTypeSymbols[i]);
- HDEBUG(QmlTypeSymbols[i] << (iSym.ptr[i] ? "OK" : "missing"));
- }
- // No need to ever call dlclose(iHandle);
- } else {
- HWARN("Failed to load" << LIBQT5QML_SO);
- }
-}
-
-// ==========================================================================
-// HarbourPluginLoader::Private
-// ==========================================================================
-
-class HarbourPluginLoader::Private {
-public:
- Private(QQmlEngine* aEngine, QString aModule, int aMajor, int aMinor);
-
- QQmlType* qmlType(QString aName);
-
- void reRegisterType(QQmlType* aType, const char* aQmlName,
- const char* aModule, int aMajor, int aMinor);
- void reRegisterType(const char* aOriginalQmlName, const char* aNewQmlName,
- const char* aModule, int aMajor, int aMinor);
- void reRegisterType(const char* aQmlName,
- const char* aModule, int aMajor, int aMinor);
-
-public:
- static const LibQt5Qml gLibQt5Qml;
-
-public:
- QQmlEngine* iEngine;
- QString iModule;
- int iMajor;
- int iMinor;
- bool iLoaded;
-};
-
-const HarbourPluginLoader::LibQt5Qml HarbourPluginLoader::Private::gLibQt5Qml;
-
-HarbourPluginLoader::Private::Private(
- QQmlEngine* aEngine,
- QString aModule,
- int aMajor,
- int aMinor) :
- iEngine(aEngine),
- iModule(aModule),
- iMajor(aMajor),
- iMinor(aMinor),
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/src/HarbourProcessState.cpp
^
|
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2021 Jolla Ltd.
- * Copyright (C) 2021 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 "HarbourProcessState.h"
-#include "HarbourDebug.h"
-
-#include <unistd.h>
-
-HarbourProcessState::HarbourProcessState(QObject* aParent) :
- QObject(aParent)
-{
-}
-
-// Callback for qmlRegisterSingletonType<HarbourProcessState>
-QObject* HarbourProcessState::createSingleton(QQmlEngine*, QJSEngine*)
-{
- return new HarbourProcessState;
-}
-
-bool HarbourProcessState::isJailedApp()
-{
- static int processJailed = -1;
-
- // Apps are not supposed to be started by the root systemd process.
- // Firejail tells us that our parent pid is 1.
- // We could additionally check that /proc contains only our and
- // parent pids, if ppid check becomes not reliable enough.
- if (processJailed < 0) {
- bool simulate = false;
- const char* var = "HARBOUR_JAIL_STATE";
- processJailed = QString(qgetenv(var)).toInt(&simulate);
- if (!simulate || processJailed < 0) {
- if (getppid() == 1) {
- HWARN("We are jailed!");
- processJailed = 1;
- } else{
- HDEBUG("Cool, we are free!");
- processJailed = 0;
- }
- } else {
- HWARN(var << processJailed);
- }
- }
- return processJailed > 0;
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/src/HarbourSelectionListModel.cpp
^
|
@@ -1,312 +0,0 @@
-/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 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 "HarbourSelectionListModel.h"
-
-#include "HarbourDebug.h"
-
-#define ROLE "selected"
-
-// ==========================================================================
-// HarbourSelectionListModel::Private
-// ==========================================================================
-
-class HarbourSelectionListModel::Private : public QObject {
- Q_OBJECT
-
-public:
- Private(HarbourSelectionListModel* aParent);
-
- 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);
- void clearSelection();
- void selectAll();
- void reset();
-
-public Q_SLOTS:
- void onCountChanged();
-
-public:
- QList<int> iSelectedRows;
- QVector<int> iSelectedRole;
- int iLastKnownCount;
-};
-
-HarbourSelectionListModel::Private::Private(HarbourSelectionListModel* aParent) :
- QObject(aParent),
- iLastKnownCount(0)
-{
- connect(aParent, SIGNAL(modelReset()), SLOT(onCountChanged()));
- connect(aParent, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(onCountChanged()));
- 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)
-{
- // It turned out to be significantly easier to copy/paste this code
- // than to fight with qBinaryFind and iterators which behave strangely
- // with empty QList and when you convert them to index. Oh well...
- int low = 0;
- int high = aList.count() - 1;
-
- while (low <= high) {
- int mid = (low + high)/2;
- const int val = aList.at(mid);
- if (val < aValue) {
- low = mid + 1;
- } else if (val > aValue) {
- high = mid - 1;
- } else {
- // Found
- return mid;
- }
- }
-
- // Not found, return -(INSERTION POINT+1)
- return -(low + 1);
-}
-
-int HarbourSelectionListModel::Private::findSelectedRow(int aRow) const
-{
- return binaryFind(iSelectedRows, aRow);
-}
-
-void HarbourSelectionListModel::Private::onCountChanged()
-{
- HarbourSelectionListModel* model = parentModel();
- const int count = model->rowCount();
- if (iLastKnownCount != count) {
- iLastKnownCount = count;
- bool changed = false;
- while (!iSelectedRows.isEmpty() && iSelectedRows.last() >= count) {
- iSelectedRows.removeAt(iSelectedRows.count() - 1);
- changed = true;
- }
- if (changed) {
- Q_EMIT model->selectedRowsChanged();
- }
- Q_EMIT model->countChanged();
- }
-}
-
-void HarbourSelectionListModel::Private::clearSelection()
-{
- if (!iSelectedRows.isEmpty()) {
- HDEBUG("clearing selection");
- HarbourSelectionListModel* model = parentModel();
- if (!iSelectedRole.isEmpty()) {
- const QList<int> rows(iSelectedRows);
- iSelectedRows.clear();
- const int n = rows.count();
- for (int i = 0; i < n; i++) {
- selectionChangedAt(rows.at(i));
- }
- } else {
- iSelectedRows.clear();
- }
- Q_EMIT model->selectedRowsChanged();
- }
-}
-
-void HarbourSelectionListModel::Private::selectAll()
-{
- HarbourSelectionListModel* model = parentModel();
- const int count = model->rowCount();
- if (iSelectedRows.count() < count) {
- const QList<int> prevSelection(iSelectedRows);
- iSelectedRows.reserve(count);
- int i;
- for (i = 0; i < iSelectedRows.count(); i++) iSelectedRows[i] = i;
- while (i < count) iSelectedRows.append(i++);
- for (i = 0; i < count; i++) {
- if (binaryFind(prevSelection, i) < 0) {
- selectionChangedAt(i);
- }
- }
- Q_EMIT model->selectedRowsChanged();
- }
-}
-
-void HarbourSelectionListModel::Private::reset()
-{
- iSelectedRole.clear();
- clearSelection();
-}
-
-void HarbourSelectionListModel::Private::selectionChangedAt(int aRow)
-{
- if (!iSelectedRole.isEmpty()) {
- HarbourSelectionListModel* model = parentModel();
- QModelIndex modelIndex(model->index(aRow, 0));
- Q_EMIT model->dataChanged(modelIndex, modelIndex, iSelectedRole);
- }
-}
-
-void HarbourSelectionListModel::Private::selectRow(int aRow)
-{
- HarbourSelectionListModel* model = parentModel();
- if (aRow >= 0 && aRow < model->rowCount()) {
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/src/HarbourSystemInfo.cpp
^
|
@@ -1,282 +0,0 @@
-/*
- * Copyright (C) 2020-2021 Jolla Ltd.
- * Copyright (C) 2020-2021 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.
- */
-
-#include "HarbourSystemInfo.h"
-#include "HarbourDebug.h"
-
-#include <QHash>
-#include <QVector>
-#include <QStringList>
-#include <QFile>
-#include <QTextStream>
-
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-// ==========================================================================
-// HarbourSystemInfo::Private
-// ==========================================================================
-
-class HarbourSystemInfo::Private
-{
-public:
- static const QString NAME;
- static const QString VERSION_ID;
-
-public:
- Private();
-
- static QHash<QString,QString> parseFile(QString aFileName, const QStringList aKeys);
- static QHash<QString,QString> parseOsRelease(const QStringList aKeys);
- static QVector<uint> parseVersion(QString aVersion);
- static int compareVersions(const QVector<uint> aVersion1, const QVector<uint> aVersion2);
- static int compareVersions(const QVector<uint> aVersion1, const QString aVersion2);
-
- QString getPackageVersion(QString aPackage);
-
-public:
- QString iName;
- QString iVersion;
- QVector<uint> iParsedVersion;
- QMap<QString,QString> iPackageVersions;
-};
-
-const QString HarbourSystemInfo::Private::NAME("NAME");
-const QString HarbourSystemInfo::Private::VERSION_ID("VERSION_ID");
-
-HarbourSystemInfo::Private::Private()
-{
- QStringList keys;
- keys.append(NAME);
- keys.append(VERSION_ID);
-
- QHash<QString,QString> values(parseOsRelease(keys));
- iName = values.value(NAME);
- iVersion = values.value(VERSION_ID);
- iParsedVersion = parseVersion(iVersion);
-}
-
-inline QHash<QString,QString> HarbourSystemInfo::Private::parseOsRelease(const QStringList aKeys)
-{
- return parseFile("/etc/os-release", aKeys);
-}
-
-QHash<QString,QString> HarbourSystemInfo::Private::parseFile(QString aPath, const QStringList aKeys)
-{
- QFile file(aPath);
- QHash<QString,QString> result;
- if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- HDEBUG("Parsing" << qPrintable(aPath));
- QTextStream in(&file);
- while (!in.atEnd() && result.size() < aKeys.size()) {
- const QString line = in.readLine();
- const int sep = line.indexOf('=');
- if (sep > 0 && (sep + 1) < line.length()) {
- const QString key(line.left(sep));
- if (aKeys.contains(key)) {
- QString value(line.mid(sep + 1));
- const int len = value.length();
- if (len > 1 && value.at(0) == '"' && value.at(len - 1) == '"') {
- value = value.mid(1, len - 2);
- }
- value = value.replace("\\\"", "\"");
- HDEBUG(qPrintable(key) << "=" << qPrintable(value));
- result.insert(key, value);
- }
- }
- }
- }
- return result;
-}
-
-QVector<uint> HarbourSystemInfo::Private::parseVersion(QString aVersion)
-{
- QVector<uint> parsed;
- QStringList parts(aVersion.split('.', QString::SkipEmptyParts));
- const int n = qMin(parts.count(),4);
- for (int i = 0; i < n; i++) {
- const QString part(parts.at(i));
- bool ok = false;
- int val = part.toUInt(&ok);
- if (ok) {
- parsed.append(val);
- } else {
- break;
- }
- }
- return parsed;
-}
-
-int HarbourSystemInfo::Private::compareVersions(const QVector<uint> aVersion1,
- const QVector<uint> aVersion2)
-{
- const int n1 = aVersion1.size();
- const int n2 = aVersion2.size();
- const int n = qMin(n1, n2);
- for (int i = 0; i < n; i++) {
- const uint v1 = aVersion1.at(i);
- const uint v2 = aVersion2.at(i);
- if (v1 > v2) {
- return 1;
- } else if (v1 < v2) {
- return -1;
- }
- }
- return (n1 > n2) ? 1 : (n1 < n2) ? -1 : 0;
-}
-
-inline int HarbourSystemInfo::Private::compareVersions(const QVector<uint> aVersion1,
- const QString aVersion2)
-{
- return compareVersions(aVersion1, Private::parseVersion(aVersion2));
-}
-
-QString HarbourSystemInfo::Private::getPackageVersion(QString aPackage)
-{
- QString version;
- if (!aPackage.isEmpty()) {
- version = iPackageVersions.value(aPackage);
- if (version.isEmpty()) {
- version = HarbourSystemInfo::queryPackageVersion(aPackage);
- if (!version.isEmpty()) {
- iPackageVersions.insert(aPackage, version);
- }
- }
- }
- return version;
-}
-
-// ==========================================================================
-// HarbourSystemInfo
-// ==========================================================================
-
-HarbourSystemInfo::HarbourSystemInfo(QObject* aParent) :
- QObject(aParent),
- iPrivate(new Private)
-{
- HDEBUG("created");
-}
-
-HarbourSystemInfo::~HarbourSystemInfo()
-{
- HDEBUG("deleted");
- delete iPrivate;
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/src/HarbourTheme.cpp
^
|
@@ -1,269 +0,0 @@
-/*
- * Copyright (C) 2018-2020 Jolla Ltd.
- * Copyright (C) 2018-2020 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
- * 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 "HarbourTheme.h"
-#include "HarbourSystem.h"
-#include "HarbourDebug.h"
-
-#include <QQmlEngine>
-
-#include <dlfcn.h>
-
-#define SILICA_SO "libsailfishsilica.so.1"
-#define SILICA_FUNCTIONS(f) \
- f("_ZN6Silica5Theme8instanceEv", /* Silica::Theme* Silica::Theme::instance() */ \
- QObject*, instance,()) \
- f("_ZNK6Silica5Theme5styleEv", /* Silica::Style Silica::Theme::style() const */ \
- HarbourTheme::Private::Style, style,(QObject*)) \
- f("_ZNK6Silica5Theme11colorSchemeEv", /* Silica::ColorScheme Silica::Theme::colorScheme() const */ \
- HarbourTheme::ColorScheme, colorScheme,(QObject*)) \
- f("_ZNK6Silica5Theme12primaryColorEv", /* QColor Silica::Theme::primaryColor() const */ \
- QColor, primaryColor,(QObject*)) \
- f("_ZNK6Silica5Theme12opacityFaintEv", /* qreal Silica::Theme::opacityFaint() const */ \
- qreal, opacityFaint,(QObject*)) \
- f("_ZNK6Silica5Theme10opacityLowEv", /* qreal Silica::Theme::opacityLow() const */ \
- qreal, opacityLow,(QObject*)) \
- f("_ZNK6Silica5Theme11opacityHighEv", /* qreal Silica::Theme::opacityHigh() const */ \
- qreal, opacityHigh,(QObject*)) \
- f("_ZNK6Silica5Theme14opacityOverlayEv", /* qreal Silica::Theme::opacityOverlay() const */ \
- qreal, opacityOverlay,(QObject*))
-
-// ==========================================================================
-// HarbourTheme::Private
-// ==========================================================================
-
-class HarbourTheme::Private
-{
-public:
- enum Style {
- StyleLight,
- StyleDark
- };
-
- typedef struct _SilicaFunctions {
- #define SILICA_TYPEDEF(sym,ret,name,args) ret (*name) args;
- SILICA_FUNCTIONS(SILICA_TYPEDEF)
- } SilicaFunctions;
-
- static const qreal DEFAULT_OPACITY_FAINT;
- static const qreal DEFAULT_OPACITY_LOW;
- static const qreal DEFAULT_OPACITY_HIGH;
- static const qreal DEFAULT_OPACITY_OVERLAY;
-
- static void* gHandle;
- static SilicaFunctions gSilica;
-
-public:
- static QObject* instance();
- static ColorScheme colorScheme();
- static QColor primaryColor();
- static qreal opacityFaint();
- static qreal opacityLow();
- static qreal opacityHigh();
- static qreal opacityOverlay();
-};
-
-void* HarbourTheme::Private::gHandle;
-HarbourTheme::Private::SilicaFunctions HarbourTheme::Private::gSilica;
-
-const qreal HarbourTheme::Private::DEFAULT_OPACITY_FAINT = 0.2;
-const qreal HarbourTheme::Private::DEFAULT_OPACITY_LOW = 0.4;
-const qreal HarbourTheme::Private::DEFAULT_OPACITY_HIGH = 0.6;
-const qreal HarbourTheme::Private::DEFAULT_OPACITY_OVERLAY = 0.8;
-
-static const char* SilicaSymbols[] = {
-#define SILICA_SYMBOL(sym,ret,name,args) sym,
- SILICA_FUNCTIONS(SILICA_SYMBOL)
-};
-
-#define _N(a) (sizeof(a)/sizeof((a)[0]))
-#define NUM_FUNCTIONS _N(SilicaSymbols)
-Q_STATIC_ASSERT(sizeof(HarbourTheme::Private::SilicaFunctions) == NUM_FUNCTIONS*sizeof(void*));
-
-QObject* HarbourTheme::Private::instance()
-{
- return gSilica.instance ? gSilica.instance() : Q_NULLPTR;
-}
-
-HarbourTheme::ColorScheme HarbourTheme::Private::colorScheme()
-{
- QObject* silica = instance();
- if (silica) {
- if (gSilica.colorScheme) {
- return gSilica.colorScheme(silica);
- } else if (gSilica.style) {
- gSilica.style(silica);
- }
- }
- return LightOnDark;
-}
-
-QColor HarbourTheme::Private::primaryColor()
-{
- QObject* silica = instance();
- return (silica && gSilica.primaryColor) ? gSilica.primaryColor(silica) : QColor();
-}
-
-qreal HarbourTheme::Private::opacityFaint()
-{
- QObject* silica = instance();
- return (silica && gSilica.opacityFaint) ? gSilica.opacityFaint(silica) :
- DEFAULT_OPACITY_FAINT;
-}
-
-qreal HarbourTheme::Private::opacityLow()
-{
- QObject* silica = instance();
- return (silica && gSilica.opacityLow) ? gSilica.opacityLow(silica) :
- DEFAULT_OPACITY_LOW;
-}
-
-qreal HarbourTheme::Private::opacityHigh()
-{
- QObject* silica = instance();
- return (silica && gSilica.opacityHigh) ? gSilica.opacityHigh(silica) :
- DEFAULT_OPACITY_HIGH;
-}
-
-qreal HarbourTheme::Private::opacityOverlay()
-{
- QObject* silica = instance();
- return (silica && gSilica.opacityOverlay) ? gSilica.opacityOverlay(silica) :
- DEFAULT_OPACITY_OVERLAY;
-}
-
-// ==========================================================================
-// HarbourTheme
-// ==========================================================================
-
-HarbourTheme::HarbourTheme(QObject* aParent) : QObject(aParent)
-{
- if (!Private::gHandle) {
- Private::gHandle = HarbourDlopen(SILICA_SO, RTLD_LAZY);
- if (Private::gHandle) {
- void** ptr = (void**)&Private::gSilica;
- for (uint i = 0; i < NUM_FUNCTIONS; i++) {
- ptr[i] = dlsym(Private::gHandle, SilicaSymbols[i]);
- HDEBUG(SilicaSymbols[i] << (ptr[i] ? "OK" : "missing"));
- }
- }
- }
- QObject* silica = Private::instance();
- if (silica) {
- if (Private::gSilica.colorScheme) {
- // Colors update is delayed, queue this signal
- QObject::connect(silica,
- SIGNAL(colorSchemeChanged()),
- SIGNAL(colorSchemeChanged()),
- Qt::QueuedConnection);
- }
- if (Private::gSilica.primaryColor) {
- QObject::connect(silica,
- SIGNAL(primaryColorChanged()),
- SIGNAL(primaryColorChanged()));
- }
- }
-}
-
-HarbourTheme::~HarbourTheme()
-{
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/src/HarbourTransferMethodsModel.cpp
^
|
@@ -1,444 +0,0 @@
-/*
- * 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:
- *
- * 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.
- */
-
-#include "HarbourTransferMethodsModel.h"
-#include "HarbourDebug.h"
-
-#include <QTranslator>
-#include <QQmlEngine>
-#include <QRegExp>
-
-// ==========================================================================
-// HarbourTransferMethodsModel::TransferEngine
-// ==========================================================================
-
-class HarbourTransferMethodsModel::TransferEngine: public QDBusAbstractInterface
-{
- Q_OBJECT
-
-public:
- TransferEngine(QObject* aParent) :
- QDBusAbstractInterface(QStringLiteral("org.nemo.transferengine"),
- QStringLiteral("/org/nemo/transferengine"), "org.nemo.transferengine",
- QDBusConnection::sessionBus(), aParent) {}
-
-public: // METHODS
- inline QDBusPendingCall transferMethods()
- { return asyncCall(QStringLiteral("transferMethods")); }
- inline QDBusPendingCall transferMethods2()
- { return asyncCall(QStringLiteral("transferMethods2")); }
-
-Q_SIGNALS: // SIGNALS
- void transferMethodListChanged();
-};
-
-// ==========================================================================
-// HarbourTransferMethodsModel::Private
-// ==========================================================================
-
-class HarbourTransferMethodsModel::Private: public QObject
-{
- Q_OBJECT
- typedef QDBusPendingCallWatcher* (Private::*RequestUpdate)();
-
-public:
- enum Role {
- DisplayNameRole = Qt::UserRole + 1,
- UserNameRole,
- MethodIdRole,
- ShareUIPathRole,
- AccountIdRole,
- AccountIconRole
- };
-
- Private(HarbourTransferMethodsModel* aModel);
- ~Private();
-
-public:
- HarbourTransferMethodsModel* parentModel();
- static QRegExp regExp(QString aRegExp);
- void filterModel();
- QDBusPendingCallWatcher* checkTransferMethods();
- QDBusPendingCallWatcher* requestTransferMethods();
- QDBusPendingCallWatcher* requestTransferMethods2();
- void setTransferMethods2(HarbourTransferMethodInfo2List aList);
- bool showAccounts();
-
-private Q_SLOTS:
- void onTransferMethodsCheckFinished(QDBusPendingCallWatcher* aWatch);
- void onTransferMethodsFinished(QDBusPendingCallWatcher* aWatch);
- void onTransferMethods2Finished(QDBusPendingCallWatcher* aWatch);
- void onShowAccountsFinished(QDBusPendingCallWatcher* aWatch);
- void requestUpdate();
-
-public:
- QString iFilter;
- QList<HarbourTransferMethodInfo2> iMethodList;
- QList<int> iFilteredList;
- bool iAccountIconSupported;
- RequestUpdate iRequestUpdate;
- QDBusPendingCallWatcher* iUpdateWatcher;
- QDBusPendingCallWatcher* iShowAccountsWatcher;
- bool iShowAccountsFailed;
- TransferEngine* iTransferEngine;
-};
-
-HarbourTransferMethodsModel::Private::Private(HarbourTransferMethodsModel* aModel) :
- QObject(aModel),
- iAccountIconSupported(false),
- iRequestUpdate(&Private::checkTransferMethods),
- iUpdateWatcher(Q_NULLPTR),
- iShowAccountsWatcher(Q_NULLPTR),
- iShowAccountsFailed(false),
- iTransferEngine(new TransferEngine(this))
-{
- connect(iTransferEngine,
- SIGNAL(transferMethodListChanged()),
- SLOT(requestUpdate()));
- requestUpdate();
-}
-
-HarbourTransferMethodsModel::Private::~Private()
-{
- delete iTransferEngine;
-}
-
-inline HarbourTransferMethodsModel* HarbourTransferMethodsModel::Private::parentModel()
-{
- return qobject_cast<HarbourTransferMethodsModel*>(parent());
-}
-
-void HarbourTransferMethodsModel::Private::requestUpdate()
-{
- if (iUpdateWatcher) {
- HDEBUG("dropping pending method list query");
- iUpdateWatcher->disconnect(this);
- delete iUpdateWatcher;
- }
- iUpdateWatcher = (this->*iRequestUpdate)();
-}
-
-void HarbourTransferMethodsModel::Private::setTransferMethods2(HarbourTransferMethodInfo2List aList)
-{
- iRequestUpdate = &Private::requestTransferMethods2;
- HDEBUG(aList.count() << "methods");
- if (iMethodList != aList) {
- iMethodList = aList;
- filterModel();
- }
- if (!iAccountIconSupported) {
- iAccountIconSupported = true;
- Q_EMIT parentModel()->accountIconSupportedChanged();
- }
-}
-
-QDBusPendingCallWatcher* HarbourTransferMethodsModel::Private::checkTransferMethods()
-{
- // First try transferMethods2() and see if it works
- QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher
- (iTransferEngine->transferMethods2(), this);
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(onTransferMethodsCheckFinished(QDBusPendingCallWatcher*)));
- return watcher;
-}
-
-QDBusPendingCallWatcher* HarbourTransferMethodsModel::Private::requestTransferMethods()
-{
- QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher
- (iTransferEngine->transferMethods(), this);
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(onTransferMethodsFinished(QDBusPendingCallWatcher*)));
- return watcher;
-}
-
-QDBusPendingCallWatcher* HarbourTransferMethodsModel::Private::requestTransferMethods2()
-{
- QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher
- (iTransferEngine->transferMethods2(), this);
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(onTransferMethods2Finished(QDBusPendingCallWatcher*)));
- return watcher;
-}
-
-void HarbourTransferMethodsModel::Private::onTransferMethodsCheckFinished(QDBusPendingCallWatcher* aWatch)
-{
- QDBusPendingReply<HarbourTransferMethodInfo2List> reply(*aWatch);
- HASSERT(aWatch == iUpdateWatcher);
- iUpdateWatcher = Q_NULLPTR;
- if (reply.isError()) {
- QDBusError error(reply.error());
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/test/Makefile
^
|
@@ -1,6 +0,0 @@
-# -*- Mode: makefile-gmake -*-
-
-all:
-%:
- @$(MAKE) -C TestHarbourBase32 $*
- @$(MAKE) -C TestHarbourBase45 $*
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/test/Makefile.common
^
|
@@ -1,200 +0,0 @@
-# -*- Mode: makefile-gmake -*-
-
-.PHONY: clean all debug release coverage
-
-#
-# Real test makefile defines EXE (and possibly SRC) and includes this one.
-#
-
-ifndef EXE
-${error EXE not defined}
-endif
-
-SRC ?= $(EXE).cpp
-
-#
-# Required packages
-#
-
-PKGS += Qt5Core glib-2.0
-
-#
-# Default target
-#
-
-all: debug release
-
-#
-# Directories
-#
-
-SRC_DIR = .
-TOP_DIR = ../..
-HARBOUR_DIR = $(TOP_DIR)
-BUILD_DIR = build
-DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
-RELEASE_BUILD_DIR = $(BUILD_DIR)/release
-COVERAGE_BUILD_DIR = $(BUILD_DIR)/coverage
-
-#
-# Tools and flags
-#
-
-CC = $(CROSS_COMPILE)gcc
-LD = $(CC)
-MOC = qtchooser -run-tool=moc -qt=5
-WARNINGS = -Wall
-INCLUDES = -I$(BUILD_DIR) -I$(HARBOUR_DIR)/include
-BASE_FLAGS = -fPIC
-BASE_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS)
-BASE_CFLAGS = $(BASE_FLAGS) $(CFLAGS)
-FULL_CFLAGS = $(BASE_CFLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) -MMD -MP \
- $(shell pkg-config --cflags $(PKGS))
-FULL_LDFLAGS = $(BASE_LDFLAGS)
-LIBS = $(shell pkg-config --libs $(PKGS)) -lstdc++
-QUIET_MAKE = make --no-print-directory
-DEBUG_FLAGS = -g
-RELEASE_FLAGS =
-COVERAGE_FLAGS = -g
-
-DEBUG_LDFLAGS = $(FULL_LDFLAGS) $(DEBUG_FLAGS)
-RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
-COVERAGE_LDFLAGS = $(FULL_LDFLAGS) $(COVERAGE_FLAGS) --coverage
-
-DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG -DHARBOUR_DEBUG
-RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
-COVERAGE_CFLAGS = $(FULL_CFLAGS) $(COVERAGE_FLAGS) --coverage
-
-#
-# Files
-#
-
-DEBUG_OBJS = \
- $(MOC_H:%.h=$(DEBUG_BUILD_DIR)/moc_h_%.o) \
- $(MOC_CPP:%.cpp=$(DEBUG_BUILD_DIR)/moc_cpp_%.o) \
- $(SRC:%.cpp=$(DEBUG_BUILD_DIR)/%.o) \
- $(HARBOUR_SRC:%.cpp=$(DEBUG_BUILD_DIR)/harbour_%.o)
-RELEASE_OBJS = \
- $(MOC_H:%.h=$(RELEASE_BUILD_DIR)/moc_h_%.o) \
- $(MOC_CPP:%.cpp=$(RELEASE_BUILD_DIR)/moc_cpp_%.o) \
- $(SRC:%.cpp=$(RELEASE_BUILD_DIR)/%.o) \
- $(HARBOUR_SRC:%.cpp=$(RELEASE_BUILD_DIR)/harbour_%.o)
-COVERAGE_OBJS = \
- $(MOC_H:%.h=$(COVERAGE_BUILD_DIR)/moc_h_%.o) \
- $(MOC_CPP:%.cpp=$(COVERAGE_BUILD_DIR)/moc_cpp_%.o) \
- $(SRC:%.cpp=$(COVERAGE_BUILD_DIR)/%.o) \
- $(HARBOUR_SRC:%.cpp=$(COVERAGE_BUILD_DIR)/harbour_%.o)
-
-#
-# Dependencies
-#
-
-DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d) $(COVERAGE_OBJS:%.o=%.d)
-ifneq ($(MAKECMDGOALS),clean)
-ifneq ($(strip $(DEPS)),)
--include $(DEPS)
-endif
-endif
-
-$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
-$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
-$(COVERAGE_OBJS): | $(COVERAGE_BUILD_DIR)
-
-#
-# Rules
-#
-
-DEBUG_EXE = $(DEBUG_BUILD_DIR)/$(EXE)
-RELEASE_EXE = $(RELEASE_BUILD_DIR)/$(EXE)
-COVERAGE_EXE = $(COVERAGE_BUILD_DIR)/$(EXE)
-
-debug: $(DEBUG_EXE)
-
-release: $(RELEASE_EXE)
-
-coverage: $(COVERAGE_EXE)
-
-clean:
- rm -f *~
- rm -fr $(BUILD_DIR)
-
-test_banner:
- @echo "===========" $(EXE) "=========== "
-
-test: test_banner debug
- @$(DEBUG_EXE)
-
-valgrind: test_banner debug
- @G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --leak-check=full --show-possibly-lost=no $(DEBUG_EXE)
-
-$(BUILD_DIR):
- mkdir -p $@
-
-$(DEBUG_BUILD_DIR):
- mkdir -p $@
-
-$(RELEASE_BUILD_DIR):
- mkdir -p $@
-
-$(COVERAGE_BUILD_DIR):
- mkdir -p $@
-
-$(BUILD_DIR)/moc_%.cpp : $(APP_DIR)/%.h
- $(MOC) $< -o $@
-
-$(BUILD_DIR)/%.moc : $(APP_DIR)/%.cpp
- $(MOC) $< -o $@
-
-$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
- $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
- $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(COVERAGE_BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
- $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(DEBUG_BUILD_DIR)/moc_h_%.o : $(BUILD_DIR)/moc_%.cpp $(BUILD_DIR)
- $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(RELEASE_BUILD_DIR)/moc_h_%.o : $(BUILD_DIR)/moc_%.cpp $(BUILD_DIR)
- $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(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
- $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(RELEASE_BUILD_DIR)/moc_cpp_%.o : $(HARBOUR_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
- $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(DEBUG_BUILD_DIR)/app_%.o : $(APP_DIR)/%.cpp
- $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(RELEASE_BUILD_DIR)/app_%.o : $(APP_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
- $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-
-$(DEBUG_EXE): $(DEBUG_OBJS)
- $(LD) $(DEBUG_LDFLAGS) $^ $(LIBS) -o $@
-
-$(RELEASE_EXE): $(RELEASE_OBJS)
- $(LD) $(RELEASE_LDFLAGS) $^ $(LIBS) -o $@
-
-$(COVERAGE_EXE): $(COVERAGE_OBJS)
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/harbour-lib/test/coverage/run
^
|
@@ -1,55 +0,0 @@
-#!/bin/bash
-#
-# This script requires lcov, dirname
-#
-
-TESTS="\
-TestHarbourBase32 \
-TestHarbourBase45"
-
-function err() {
- echo "*** ERROR!" $1
- exit 1
-}
-
-# Check the required tools
-which lcov >> /dev/null || err "Please install lcov"
-which dirname >> /dev/null || err "Please install dirname"
-
-# LCOV 1.10 has branch coverage disabled per default
-# Previous versions didn't have the --rc option
-if [ ! -z "$(lcov --help | grep ' --rc ')" ] ; then
- LCOV_OPT="--rc lcov_branch_coverage=1"
- GENHTML_OPT="--branch-coverage"
-fi
-
-pushd `dirname $0` > /dev/null
-COV_DIR="$PWD"
-pushd .. > /dev/null
-TEST_DIR="$PWD"
-pushd .. > /dev/null
-TOP_DIR="$PWD"
-popd > /dev/null
-popd > /dev/null
-popd > /dev/null
-
-FULL_COV="$COV_DIR/full.gcov"
-APP_COV="$COV_DIR/app.gcov"
-
-make -C "$TEST_DIR" clean
-rm -f "$FULL_COV" "$APP_COV"
-TESTS_COV=
-
-for t in $TESTS ; do
- pushd "$TEST_DIR/$t"
- make -C "$TEST_DIR/$t" clean coverage || exit 1
- build/coverage/$t || exit 1
- TEST_COV="$TEST_DIR/$t/build/coverage/$t.cov"
- lcov $LCOV_OPT -c -d build/coverage -o "$TEST_COV" || exit 1
- TESTS_COV+="-a $TEST_COV "
- popd
-done
-
-lcov $LCOV_OPT $TESTS_COV -o "$FULL_COV" || exit 1
-lcov $LCOV_OPT -e "$FULL_COV" "$TOP_DIR/src/*" -o "$APP_COV" || exit 1
-genhtml $GENHTML_OPT "$APP_COV" -t "HarbourLib" --output-directory "$COV_DIR/report" || exit 1
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/libaztec/debian/libaztec-dev.install
^
|
@@ -1,3 +0,0 @@
-debian/tmp/usr/lib/libaztec.so usr/lib
-include/*.h usr/include/aztec
-build/libaztec.pc usr/lib/pkgconfig
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/libaztec/debian/libaztec.install
^
|
@@ -1 +0,0 @@
-debian/tmp/usr/lib/libaztec.so.* usr/lib
|
[-]
[+]
|
Deleted |
_service:tar_git:sailfish-qrshare-1.1.2.tar.gz/qmlplugin/libaztec/tools/aztec-png/main.c
^
|
@@ -1,294 +0,0 @@
-/*
- * Copyright (C) 2019 by 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
- * 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.
- *
- * 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 "aztec_encode.h"
-
-#include <png.h>
-#include <errno.h>
-#include <setjmp.h>
-#include <string.h>
-
-#define RET_OK 0
-#define RET_ERR 1
-#define RET_CMDLINE 2
-
-static
-void
-errmsg(
- const char* format,
- ...) G_GNUC_PRINTF(1,2);
-
-static
-void
-errmsg(
- const char* format,
- ...)
-{
- va_list va;
- va_start(va, format);
- vfprintf(stderr, format, va);
- va_end(va);
-}
-
-static
-void
-save_error(
- png_structp png,
- png_const_charp msg)
-{
- jmp_buf* jmp = png_get_error_ptr(png);
-
- errmsg("%s", msg);
- longjmp(*jmp, 1);
-}
-
-static
-int
-save_symbol(
- AztecSymbol* symbol,
- int scale,
- int border,
- FILE* out)
-{
- int ret = RET_ERR;
- const int bs = border * scale;
- const int n = symbol->size * scale;
- const int n2 = n + 2 * bs;
- const int rowsize = (n2 + 7) / 8;
- jmp_buf jmp;
- png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, &jmp,
- save_error, NULL);
-
- if (png) {
- png_infop info = png_create_info_struct(png);
-
- if (info) {
- guint8* row = g_malloc(rowsize);
-
- if (!setjmp(jmp)) {
- guint i;
-
- png_init_io(png, out);
- png_set_filter(png, 0, PNG_FILTER_NONE);
- png_set_IHDR(png, info, n2, n2, 1, PNG_COLOR_TYPE_GRAY,
- PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
- PNG_FILTER_TYPE_DEFAULT);
- png_set_invert_mono(png); /* 1 is black */
- png_write_info(png, info);
-
- /* Top border */
- memset(row, 0, rowsize);
- for (i = 0; i < bs; i++) {
- png_write_row(png, (png_bytep)row);
- }
-
- /*
- * Transform the rows (scale and add borders) and at the
- * same time swap the bit order. In PNG most significant
- * bit codes the left-most pixel.
- */
- for (i = 0; i < symbol->size; i++) {
- guint8* dest = row;
- guint8* end = dest + rowsize;
- const guint8* ptr = symbol->rows[i];
- int k, j, d = bs % 8;
-
- memset(row, 0, rowsize);
- dest += bs / 8;
- for (k = 0; k < symbol->size; k += 8) {
- guint8 byte = *ptr++;
- int b;
-
- for (b = 0; b < 8 && dest < end; b++, byte >>= 1) {
- const int bit = (byte & 1);
-
- for (j = 0; j < scale && dest < end; j++) {
- *dest <<= 1;
- *dest |= bit;
- if ((d++) == 7) {
- d = 0;
- dest++;
- }
- }
- }
- }
- for (j = 0; j < scale; j++) {
- png_write_row(png, (png_bytep)row);
- }
- }
-
- /* Bottom border */
- memset(row, 0, rowsize);
- for (i = 0; i < bs; i++) {
- png_write_row(png, (png_bytep)row);
- }
- png_write_end(png, info);
- ret = RET_OK;
- }
- png_destroy_write_struct(&png, &info);
- g_free(row);
- }
- }
- return ret;
-}
-
-int
-main(
- int argc,
- char* argv[])
-{
- int ret = RET_ERR;
- int scale = 1;
- int errcorr = AZTEC_CORRECTION_DEFAULT;
- int border = 1;
- const char* file = NULL;
- gboolean ok;
- GError* error = NULL;
- GOptionContext* options;
- GOptionEntry entries[] = {
- { "scale", 's', 0, G_OPTION_ARG_INT, &scale,
- "Scale factor [1]", "SCALE" },
- { "correction", 'c', 0, G_OPTION_ARG_INT, &errcorr,
- "Error correction [23]", "PERCENT" },
- { "border", 'b', 0, G_OPTION_ARG_INT, &border,
- "Border around the symbol [1]", "PIXELS" },
- { "file", 'f', 0, G_OPTION_ARG_FILENAME, &file,
- "Encode data from FILE", "FILE" },
- { NULL }
- };
-
- options = g_option_context_new("[TEXT] PNG");
- g_option_context_add_main_entries(options, entries, NULL);
- g_option_context_set_summary(options,
- "Generates Aztec symbol as a PNG file.");
- ok = g_option_context_parse(options, &argc, &argv, &error);
-
- if (ok && scale > 0 && border >= 0 &&
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/.gitignore
^
|
@@ -1,2 +1,2 @@
build
-sailfish-qrshare.pro.user
+sailfish-qrshare.pro.user*
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/.gitmodules
^
|
@@ -1,5 +1,5 @@
[submodule "harbour-lib"]
- path = qmlplugin/harbour-lib
+ path = harbour-lib
url = https://github.com/monich/harbour-lib.git
[submodule "libqrencode"]
path = qmlplugin/libqrencode
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib
^
|
+(directory)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/.gitignore
^
|
(renamed from qmlplugin/harbour-lib/.gitignore)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/LICENSE
^
|
@@ -0,0 +1,34 @@
+Copyright (C) 2015-2021 Jolla Ltd.
+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.
+
+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.
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/README
^
|
(renamed from qmlplugin/harbour-lib/README)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/harbour-lib.pro
^
|
@@ -0,0 +1,122 @@
+TEMPLATE = lib
+CONFIG += static
+TARGET = harbour-lib
+QT += dbus
+QT-= gui
+
+# For HarbourSystemTime
+CONFIG += link_pkgconfig
+PKGCONFIG += libglibutil
+
+VERSION = 1.0
+
+greaterThan(QT_MAJOR_VERSION, 4) {
+QT += qml quick
+} else {
+QT += declarative
+}
+
+QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-unused-result -Wno-psabi
+
+CONFIG(debug, debug|release) {
+ DEFINES += HARBOUR_DEBUG=1
+}
+
+SOURCES += \
+ src/HarbourBase32.cpp \
+ src/HarbourBase45.cpp \
+ src/HarbourBattery.cpp \
+ src/HarbourClipboard.cpp \
+ src/HarbourColorEditorModel.cpp \
+ src/HarbourDisplayBlanking.cpp \
+ src/HarbourJson.cpp \
+ src/HarbourLib.cpp \
+ src/HarbourMce.cpp \
+ src/HarbourMediaPlugin.cpp \
+ src/HarbourObject.cpp \
+ src/HarbourOrganizeListModel.cpp \
+ src/HarbourPolicyPlugin.cpp \
+ src/HarbourProcessState.cpp \
+ src/HarbourProtoBuf.cpp \
+ src/HarbourSelectionListModel.cpp \
+ src/HarbourSigChildHandler.cpp \
+ src/HarbourSingleImageProvider.cpp \
+ src/HarbourSystem.cpp \
+ src/HarbourSystemInfo.cpp \
+ src/HarbourSystemState.cpp \
+ src/HarbourSystemTime.cpp \
+ src/HarbourTask.cpp \
+ src/HarbourTemporaryFile.cpp \
+ src/HarbourTransferMethodInfo.cpp \
+ src/HarbourTransferMethodsModel.cpp \
+ src/HarbourUtil.cpp
+
+greaterThan(QT_MAJOR_VERSION, 4) {
+SOURCES += \
+ src/HarbourImageProvider.cpp \
+ src/HarbourPluginLoader.cpp \
+ src/HarbourTheme.cpp
+}
+
+INCLUDEPATH += include
+PUBLIC_HEADERS += \
+ include/HarbourBase32.h \
+ include/HarbourBase45.h \
+ include/HarbourBattery.h \
+ include/HarbourClipboard.h \
+ include/HarbourColorEditorModel.h \
+ include/HarbourDebug.h \
+ include/HarbourDisplayBlanking.h \
+ include/HarbourJson.h \
+ include/HarbourLib.h \
+ include/HarbourMediaPlugin.h \
+ include/HarbourObject.h \
+ include/HarbourOrganizeListModel.h \
+ include/HarbourPolicyPlugin.h \
+ include/HarbourProcessState.h \
+ include/HarbourProtoBuf.h \
+ include/HarbourSelectionListModel.h \
+ include/HarbourSigChildHandler.h \
+ include/HarbourSingleImageProvider.h \
+ include/HarbourSystem.h \
+ include/HarbourSystemInfo.h \
+ include/HarbourSystemState.h \
+ include/HarbourSystemTime.h \
+ include/HarbourTask.h \
+ include/HarbourTemporaryFile.h \
+ include/HarbourTransferMethodInfo.h \
+ include/HarbourTransferMethodsModel.h \
+ include/HarbourUtil.h
+
+greaterThan(QT_MAJOR_VERSION, 4) {
+PUBLIC_HEADERS += \
+ include/HarbourImageProvider.h \
+ include/HarbourPluginLoader.h \
+ include/HarbourTheme.h
+OTHER_FILES += qml/*.qml
+}
+
+HEADERS += \
+ $$PUBLIC_HEADERS \
+ src/HarbourMce.h
+
+OTHER_FILES += \
+ LICENSE \
+ README \
+ rpm/harbour-lib-devel.spec
+
+headers.path = $$INSTALL_ROOT$$PREFIX/include/$$TARGET
+headers.files = $$PUBLIC_HEADERS
+INSTALLS += headers
+
+target.path = $$[QT_INSTALL_LIBS]
+INSTALLS += target
+
+pkgconfig.files = $$TARGET.pc
+pkgconfig.path = $$target.path/pkgconfig-qt5
+QMAKE_PKGCONFIG_DESCRIPTION = Utility library for Sailfish harbour apps
+QMAKE_PKGCONFIG_INCDIR = $$headers.path
+QMAKE_PKGCONFIG_LIBDIR = $$target.path
+QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+CONFIG += create_pc create_prl no_install_prl
+INSTALLS += pkgconfig
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourAztecCodeGenerator.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourAztecCodeGenerator.h)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourBase32.h
^
|
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ *
+ * 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_BASE32_H
+#define HARBOUR_BASE32_H
+
+#include <QString>
+#include <QByteArray>
+
+class HarbourBase32
+{
+ class Private;
+ HarbourBase32() Q_DECL_EQ_DELETE;
+
+public:
+ static bool isValidBase32(const QString);
+ static QString toBase32(const QByteArray, bool aLowerCase = true);
+ static QByteArray fromBase32(const QString);
+};
+
+#endif // HARBOUR_BASE32_H
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourBase45.h
^
|
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ *
+ * 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_BASE45_H
+#define HARBOUR_BASE45_H
+
+#include <QString>
+#include <QByteArray>
+
+class HarbourBase45
+{
+ class Private;
+ HarbourBase45() Q_DECL_EQ_DELETE;
+
+public:
+ static bool isValidBase45(const QString);
+ static QString toBase45(const QByteArray);
+ static QByteArray fromBase45(const QString);
+};
+
+#endif // HARBOUR_BASE45_H
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourBattery.h
^
|
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2022 Jolla Ltd.
+ * Copyright (C) 2022 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HARBOUR_BATTERY_H
+#define HARBOUR_BATTERY_H
+
+#include <QObject>
+
+class QQmlEngine;
+class QJSEngine;
+
+// D-Bus calls used by this object require mce 1.86.0 (Sailfish OS 2.1)
+class HarbourBattery: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(BatteryStatus batteryStatus READ batteryStatus NOTIFY batteryStatusChanged)
+ Q_PROPERTY(BatteryState batteryState READ batteryState NOTIFY batteryStateChanged)
+ Q_PROPERTY(int batteryLevel READ batteryLevel NOTIFY batteryLevelChanged)
+ Q_ENUMS(BatteryStatus)
+ Q_ENUMS(BatteryState)
+
+public:
+ enum BatteryStatus {
+ BatteryStatusUnknown,
+ BatteryStatusEmpty,
+ BatteryStatusLow,
+ BatteryStatusOk,
+ BatteryStatusFull
+ };
+
+ enum BatteryState {
+ BatteryStateUnknown,
+ BatteryStateCharging,
+ BatteryStateDischarging,
+ BatteryStateNotCharging,
+ BatteryStateFull
+ };
+
+ explicit HarbourBattery(QObject* aParent = Q_NULLPTR);
+ ~HarbourBattery();
+
+ // Callback for qmlRegisterSingletonType<HarbourBattery>
+ static QObject* createSingleton(QQmlEngine*, QJSEngine*);
+
+ BatteryStatus batteryStatus() const;
+ BatteryState batteryState() const;
+ int batteryLevel() const;
+
+Q_SIGNALS:
+ void batteryStatusChanged();
+ void batteryStateChanged();
+ void batteryLevelChanged();
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_BATTERY_H
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourClipboard.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourClipboard.h)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourColorEditorModel.h
^
|
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 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_COLOR_EDITOR_MODEL_H
+#define HARBOUR_COLOR_EDITOR_MODEL_H
+
+#include <QList>
+#include <QColor>
+#include <QAbstractListModel>
+
+class HarbourColorEditorModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(QStringList colors READ getColors WRITE setColors NOTIFY colorsChanged)
+ Q_PROPERTY(int dragPos READ getDragPos WRITE setDragPos NOTIFY dragPosChanged)
+ Q_ENUMS(ItemType)
+
+public:
+ enum ItemType {
+ ColorItem,
+ TrashedItem,
+ AddItem
+ };
+
+ HarbourColorEditorModel(QObject* aParent = Q_NULLPTR);
+
+ QStringList getColors() const;
+ void setColors(QStringList aColors);
+
+ int getDragPos() const;
+ void setDragPos(int pos);
+
+ Q_INVOKABLE void addColor(QColor aColor);
+ Q_INVOKABLE int indexOf(QColor aColor) const;
+
+ // 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;
+
+Q_SIGNALS:
+ void colorsChanged();
+ void dragPosChanged();
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_COLOR_EDITOR_MODEL_H
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourDebug.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourDebug.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourDisplayBlanking.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourDisplayBlanking.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourImageProvider.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourImageProvider.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourJson.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourJson.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourLib.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourLib.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourMediaPlugin.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourMediaPlugin.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourObject.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourObject.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourOrganizeListModel.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourOrganizeListModel.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourPluginLoader.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourPluginLoader.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourPolicyPlugin.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourPolicyPlugin.h)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourProcessState.h
^
|
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 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_PROCESS_STATE_H
+#define HARBOUR_PROCESS_STATE_H
+
+#include <QObject>
+
+class QQmlEngine;
+class QJSEngine;
+
+class HarbourProcessState: public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(HarbourProcessState)
+ Q_PROPERTY(bool jailedApp READ isJailedApp CONSTANT)
+ Q_PROPERTY(bool privileged READ isPrivileged CONSTANT)
+
+public:
+ explicit HarbourProcessState(QObject* aParent = Q_NULLPTR);
+
+ // Callback for qmlRegisterSingletonType<HarbourProcessState>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+
+ static bool isJailedApp();
+ static bool isPrivileged();
+};
+
+#endif // HARBOUR_PROCESS_STATE_H
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.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:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourQrCodeGenerator.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourQrCodeGenerator.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourQrCodeImageProvider.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourQrCodeImageProvider.h)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourSelectionListModel.h
^
|
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019-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.
+ */
+
+#ifndef HARBOUR_SELECTION_LIST_MODEL_H
+#define HARBOUR_SELECTION_LIST_MODEL_H
+
+#include <QtQml>
+#include <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 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*);
+
+ 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&) const Q_DECL_OVERRIDE;
+ QHash<int,QByteArray> roleNames() const 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:
+ class Private;
+ Private* iPrivate;
+};
+
+QML_DECLARE_TYPE(HarbourSelectionListModel)
+
+#endif // HARBOUR_SELECTION_LIST_MODEL_H
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourSigChildHandler.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourSigChildHandler.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourSingleImageProvider.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourSingleImageProvider.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourSystem.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourSystem.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourSystemInfo.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourSystemInfo.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourSystemState.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourSystemState.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourSystemTime.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourSystemTime.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourTask.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourTask.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourTemporaryFile.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourTemporaryFile.h)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourTheme.h
^
|
@@ -0,0 +1,95 @@
+/*
+ * 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:
+ *
+ * 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_THEME_H
+#define HARBOUR_THEME_H
+
+#include <QObject>
+#include <QColor>
+
+class QQmlEngine;
+class QJSEngine;
+
+class HarbourTheme : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(ColorScheme)
+ Q_PROPERTY(ColorScheme colorScheme READ colorScheme NOTIFY colorSchemeChanged)
+ Q_PROPERTY(QColor invertedPrimaryColor READ invertedPrimaryColor NOTIFY primaryColorChanged)
+ Q_PROPERTY(QColor primaryColor READ primaryColor NOTIFY primaryColorChanged)
+ Q_PROPERTY(bool lightOnDark READ lightOnDark NOTIFY colorSchemeChanged)
+ Q_PROPERTY(bool darkOnLight READ darkOnLight NOTIFY colorSchemeChanged)
+
+ Q_PROPERTY(qreal opacityFaint READ opacityFaint CONSTANT)
+ Q_PROPERTY(qreal opacityLow READ opacityLow CONSTANT)
+ Q_PROPERTY(qreal opacityHigh READ opacityHigh CONSTANT)
+ Q_PROPERTY(qreal opacityOverlay READ opacityOverlay CONSTANT)
+
+public:
+ class Private;
+
+ enum ColorScheme {
+ LightOnDark,
+ DarkOnLight
+ };
+
+ explicit HarbourTheme(QObject* aParent = Q_NULLPTR);
+
+ ~HarbourTheme();
+
+ // Callback for qmlRegisterSingletonType<HarbourTheme>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+
+ QColor invertedPrimaryColor() const;
+ QColor primaryColor() const;
+ ColorScheme colorScheme() const;
+ bool lightOnDark() const;
+ bool darkOnLight() const;
+
+ qreal opacityFaint() const;
+ qreal opacityLow() const;
+ qreal opacityHigh() const;
+ qreal opacityOverlay() const;
+
+ Q_INVOKABLE static QColor invertedColor(const QColor& aColor);
+ Q_INVOKABLE static qreal colorDifference(const QColor& aColor1, const QColor& aColor2);
+
+Q_SIGNALS:
+ void colorSchemeChanged();
+ void primaryColorChanged();
+
+private:
+ QObject* iPrivate;
+};
+
+#endif // HARBOUR_THEME_H
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourTransferMethodInfo.h
^
|
(renamed from qmlplugin/harbour-lib/include/HarbourTransferMethodInfo.h)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/include/HarbourTransferMethodsModel.h
^
|
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2016-2023 Slava Monich <slava@monich.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ *
+ * 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.
+ */
+
+#ifndef HARBOUR_TRANSFER_METHODS_MODEL_H
+#define HARBOUR_TRANSFER_METHODS_MODEL_H
+
+#include "HarbourTransferMethodInfo.h"
+
+#include <QLocale>
+
+class QTranslator;
+class QQmlEngine;
+class QJSEngine;
+
+// 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)
+ Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
+ 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() Q_DECL_OVERRIDE;
+
+ // Callback for qmlRegisterSingletonType<HarbourTransferMethodsModel>
+ static QObject* createSingleton(QQmlEngine*, QJSEngine*);
+
+ static bool loadTranslations(QTranslator*, QLocale);
+
+ bool isValid() const;
+ int count() const;
+ QString filter() const;
+ void setFilter(QString);
+ bool accountIconSupported() const;
+ bool showAccountsPending() const;
+ bool canShowAccounts() const;
+
+ Q_INVOKABLE void showAccounts();
+
+ // QAbstractListModel
+ QHash<int,QByteArray> roleNames() 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();
+ void showAccountsPendingChanged();
+ void canShowAccountsChanged();
+
+private:
+ class Private;
+ class TransferEngine;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_TRANSFER_METHODS_MODEL_H
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.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
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourBadge.qml
^
|
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2018-2022 Jolla Ltd.
+ * Copyright (C) 2018-2022 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of 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.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Item {
+ id: badge
+
+ property real maxWidth: parent.width
+ property alias text: label.text
+ property alias backgroundColor: background.color
+ property alias textColor: label.color
+
+ readonly property real radius: height/2
+
+ width: Math.max(label.implicitWidth + radius, height)
+ height: Theme.itemSizeSmall/2
+ visible: opacity > 0
+ opacity: text.length ? 1 : 0
+
+ Behavior on opacity { FadeAnimation {} }
+
+ Rectangle {
+ id: background
+
+ anchors.fill: parent
+ color: Theme.rgba(Theme.primaryColor, 0.2)
+ radius: badge.radius
+ }
+
+ HarbourFitLabel {
+ id: label
+
+ font.bold: true
+ maxWidth: Math.max(badge.maxWidth - radius, 2 * radius)
+ maxHeight: Math.floor(parent.height - radius/2)
+ anchors.centerIn: background
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourColorEditorDialog.qml
^
|
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 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.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Dialog {
+ id: thisDialog
+
+ readonly property color selectedColor: sampleItem.color
+ property color initialColor: Theme.highlightColor
+ property string acceptText: "Add color"
+ property alias hueSliderText: hueSlider.label // "Color"
+ property alias brightnessSliderText: brightnessSlider.label // "Brightness"
+ property string hexNotationText: "Hex notation"
+
+ canAccept: hexText.acceptableInput
+ forwardNavigation: !hueItem.pressed
+ backNavigation: !hueItem.pressed
+
+ DialogHeader {
+ id: header
+
+ acceptText: forwardNavigation ?
+ (thisDialog.acceptText ? thisDialog.acceptText : defaultAcceptText) : ""
+ }
+
+ Component.onCompleted: hexText.text = initialColor.toString().substr(1)
+
+ // Otherwise width is changing with a delay, causing visible layout changes
+ onIsLandscapeChanged: width = isLandscape ? Screen.height : Screen.width
+
+ SilicaFlickable {
+ clip: true
+ interactive: !hueItem.pressed
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: header.bottom
+ bottom: parent.bottom
+ }
+
+ HarbourColorHueItem {
+ id: hueItem
+
+ x: Theme.horizontalPageMargin
+ width: parent.width - 2 * x
+ anchors {
+ top: parent.top
+ bottom: toolPanel.top
+ bottomMargin: Theme.paddingSmall
+ }
+ brightness: brightnessSlider.sliderValue
+ onTapped: hueSlider.value = h
+ }
+
+ Column {
+ id: toolPanel
+
+ width: parent.width
+ anchors.bottom: parent.bottom
+
+ Slider {
+ id: hueSlider
+
+ width: parent.width
+ leftMargin: Theme.horizontalPageMargin
+ rightMargin: Theme.horizontalPageMargin
+ minimumValue: 0
+ maximumValue: 1
+ value: 1
+ label: "Color"
+ opacity: (y + parent.y >= 0) ? 1 : 0
+ onSliderValueChanged: hexText.updateText()
+ }
+
+ Slider {
+ id: brightnessSlider
+
+ width: parent.width
+ leftMargin: Theme.horizontalPageMargin
+ rightMargin: Theme.horizontalPageMargin
+ label: "Brightness"
+ minimumValue: 0
+ maximumValue: 1
+ value: 1
+ opacity: (y + parent.y >= 0) ? 1 : 0
+ onSliderValueChanged: hexText.updateText()
+ }
+
+ Item {
+ x: Theme.horizontalPageMargin
+ width: parent.width - 2 * x
+ height: hexText.height
+ Row {
+ spacing: Theme.paddingSmall
+
+ Label {
+ id: hexLabel
+
+ y: hexText.textTopMargin
+ text: "#"
+ font.pixelSize: Theme.fontSizeLarge
+ }
+
+ Item {
+ readonly property int maxWidth: toolPanel.width - 2 * Theme.horizontalPageMargin - hexLabel.width - parent.spacing - Theme.paddingLarge - sample.width
+ width: Math.min(Math.max(textLabelTemplate.implicitWidth, Theme.itemSizeHuge), maxWidth)
+ height: hexText.height
+
+ Label {
+ id: textLabelTemplate
+
+ // Same text as hexText.label
+ text: hexNotationText
+ font.pixelSize: Theme.fontSizeSmall
+ opacity: 0
+ }
+
+ TextField {
+ id: hexText
+
+ property int ignoreTextUpdates // to avoid binding loops
+ property color tmpColor
+
+ font.pixelSize: Theme.fontSizeLarge
+ width: parent.width
+ textLeftMargin: 0
+ textRightMargin: 0
+ label: hexNotationText
+ validator: RegExpValidator { regExp: /^[0-9a-fA-F]{6}$/ }
+ inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
+ EnterKey.iconSource: "image://theme/icon-m-enter-close"
+ EnterKey.onClicked: hexText.focus = false
+
+ onTextChanged: {
+ if (!ignoreTextUpdates) {
+ // acceptableInput hasn't been updated yet
+ syncTimer.restart()
+ }
+ }
+
+ onActiveFocusChanged: {
+ if (!activeFocus && !acceptableInput) {
+ updateText()
+ }
+ }
+
+ function syncColor() {
+ if (acceptableInput) {
+ tmpColor = "#" + text
+ ignoreTextUpdates++
+ brightnessSlider.value = hueItem.getV(tmpColor)
+ hueSlider.value = hueItem.getH(tmpColor)
+ ignoreTextUpdates--
+ }
+ }
+
+ function updateText() {
+ if (!ignoreTextUpdates) {
+ ignoreTextUpdates++
+ var s = hueItem.getColor(hueSlider.sliderValue).toString()
+ text = (s.length > 0 && s.charAt(0) === '#') ? s.substr(1) : s
+ ignoreTextUpdates--
+ }
+ }
+
+ Timer {
+ id: syncTimer
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourColorHueItem.qml
^
|
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 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.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Rectangle {
+ id: thisItem
+
+ color: "black"
+
+ property alias brightness: mouseArea.opacity
+ property alias pressed: mouseArea.pressed
+
+ readonly property color color0: "#ffffff" // 1.0
+ readonly property color color1: "#ff0000" // colorStop7
+ readonly property color color2: "#ff00ff" // colorStop6
+ readonly property color color3: "#0000ff" // colorStop5
+ readonly property color color4: "#00ffff" // colorStop4
+ readonly property color color5: "#00ff00" // colorStop3
+ readonly property color color6: "#ffff00" // colorStop2
+ readonly property color color7: "#ff0000" // colorStop1
+ readonly property color color8: "#ffffff" // 0.0
+
+ readonly property real colorStop1: 0.125
+ readonly property real colorStop2: 0.250
+ readonly property real colorStop3: 0.375
+ readonly property real colorStop4: 0.500
+ readonly property real colorStop5: 0.625
+ readonly property real colorStop6: 0.750
+ readonly property real colorStop7: 0.875
+ readonly property real hueLast: colorStop7
+ readonly property real hueRange: hueLast - colorStop1
+
+ signal tapped(var h)
+
+ function getColor(h) {
+ if (h < colorStop4) {
+ if (h > colorStop3) {
+ // colorStop3..colorStop4
+ return averageColor(color3, color4, (h - colorStop3)/(colorStop4 - colorStop3), brightness)
+ } else if (h > colorStop2) {
+ // colorStop2..colorStop3
+ return averageColor(color2, color3, (h - colorStop2)/(colorStop3 - colorStop2), brightness)
+ } else if (h > colorStop1) {
+ // colorStop1..colorStop2
+ return averageColor(color1, color2, (h - colorStop1)/(colorStop2 - colorStop1), brightness)
+ } else if (h > 0) {
+ // 0..colorStop1
+ return averageColor(color0, color1, h/colorStop1, brightness)
+ } else {
+ return adjustColor(color0, brightness)
+ }
+ } else {
+ if (h < colorStop5) {
+ // colorStop4..colorStop5
+ return averageColor(color4, color5, (h - colorStop4)/(colorStop5 - colorStop4), brightness)
+ } else if (h < colorStop6) {
+ // colorStop5..colorStop6
+ return averageColor(color5, color6, (h - colorStop5)/(colorStop6 - colorStop5), brightness)
+ } else if (h < colorStop7) {
+ // colorStop6..colorStop7
+ return averageColor(color6, color7, (h - colorStop6)/(colorStop7 - colorStop6), brightness)
+ } else if (h < 1) {
+ // colorStop7..1
+ return averageColor(color7, color8, (h - colorStop7)/(1 - colorStop7), brightness)
+ } else {
+ return adjustColor(color8, brightness)
+ }
+ }
+ }
+
+ function averageColor(c1,c2,h,v) {
+ return Qt.rgba((c1.r + (c2.r - c1.r) * h) * v,
+ (c1.g + (c2.g - c1.g) * h) * v,
+ (c1.b + (c2.b - c1.b) * h) * v, 1)
+ }
+
+ function adjustColor(c,v) {
+ return Qt.rgba(c.r * v, c.g * v, c.b * v, 1)
+ }
+
+ function getV(c) {
+ return Math.max(c.r, c.g, c.b)
+ }
+
+ function getH(c) {
+ var max = Math.max(c.r, c.g, c.b)
+ var min = Math.min(c.r, c.g, c.b)
+ var chroma = max - min
+ if (chroma === 0) {
+ return 0
+ } else {
+ if (max === c.r) {
+ return hueLast - (c.g - c.b)/chroma/6 * hueRange
+ } else if (max === c.g) {
+ return hueLast - (2 + (c.b - c.r)/chroma)/6 * hueRange
+ } else {
+ return hueLast - (4 + (c.r - c.g)/chroma)/6 * hueRange
+ }
+ }
+ }
+
+ MouseArea {
+ id: mouseArea
+
+ width: parent.height
+ height: parent.width
+ anchors.centerIn: parent
+ rotation: -90
+
+ ShaderEffectSource {
+ anchors.fill: parent
+ sourceItem: Rectangle {
+ width: mouseArea.width
+ height: mouseArea.height
+ radius: Theme.paddingSmall
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: color0 }
+ GradientStop { position: colorStop1; color: color1 }
+ GradientStop { position: colorStop2; color: color2 }
+ GradientStop { position: colorStop3; color: color3 }
+ GradientStop { position: colorStop4; color: color4 }
+ GradientStop { position: colorStop5; color: color5 }
+ GradientStop { position: colorStop6; color: color6 }
+ GradientStop { position: colorStop7; color: color7 }
+ GradientStop { position: 1.0; color: color8 }
+ }
+ }
+ }
+ // mouseY/height because we are rotated
+ onClicked: thisItem.tapped(mouseY/height)
+ onPositionChanged: thisItem.tapped(mouseY/height)
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourColorPickerDialog.qml
^
|
@@ -0,0 +1,321 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 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.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Dialog {
+ id: thisDialog
+
+ property color color
+ property alias colorModel: grid.model // HarbourColorEditorModel
+
+ // Localizable strings
+ property alias resetColorsMenuText: resetColorsMenuItem.text // "Reset colors"
+ property string acceptText: "Select color"
+ property string addColorAcceptText: "Add color"
+ property string addColorHueSliderText: "Color"
+ property string addColorBrightnessSliderText: "Brightness"
+ property string addColorHexNotationText: "Hex notation"
+
+ forwardNavigation: false
+
+ signal resetColors()
+
+ // Constants used by HarbourColorEditorModel
+ readonly property int itemTypeColor: 0
+ readonly property int itemTypeTrash: 1
+ readonly property int itemTypeAdd: 2
+
+ SilicaGridView {
+ id: grid
+
+ cellWidth: Math.floor(width/cellsPerRow)
+ cellHeight: cellWidth
+ anchors.fill: parent
+
+ VerticalScrollDecorator {}
+
+ PullDownMenu {
+ MenuItem {
+ id: resetColorsMenuItem
+
+ text: "Reset colors"
+ onClicked: thisDialog.resetColors()
+ }
+ }
+
+ property Item dragItem
+ property int pageHeaderHeight
+ readonly property int cellsPerRow: Math.floor(width / Theme.itemSizeHuge)
+
+ header: DialogHeader {
+ dialog: thisDialog
+ acceptText: thisDialog.acceptText
+ spacing: 0
+ Component.onCompleted: grid.pageHeaderHeight = height
+ onHeightChanged: grid.pageHeaderHeight = height
+ }
+
+ delegate: MouseArea {
+ id: colorDelegate
+
+ width: grid.cellWidth
+ height: grid.cellHeight
+
+ drag.target: dragging ? colorItem : null
+ drag.axis: Drag.XandYAxis
+
+ readonly property bool highlighted: (pressed && containsMouse)
+ readonly property bool dragging: grid.dragItem === colorDelegate
+ readonly property int index: model.index
+
+ Rectangle {
+ id: colorItem
+
+ width: grid.cellWidth
+ height: grid.cellHeight
+ color: model.color
+ scale: !colorDelegate.dragging ? 1 : isTrashed ? 0.8 : 1.1
+ opacity: isTrashed ? 0.8 : 1
+ layer.enabled: colorDelegate.highlighted || colorDelegate.dragging || scale > 1
+ layer.effect: HarbourPressEffect { source: colorItem }
+
+ readonly property bool isTrashed: model.itemType === itemTypeTrash
+ property real returnX
+ property real returnY
+ property bool snappingBack
+
+ Behavior on opacity { FadeAnimation { } }
+ Behavior on scale {
+ NumberAnimation {
+ easing.type: Easing.InQuad
+ duration: 150
+ }
+ }
+
+ Image {
+ anchors.centerIn: parent
+ source: opacity ? ("image://theme/graphic-close-app?" + deriveColor(model.color)) : ""
+ sourceSize: Qt.size(Theme.iconSizeLarge, Theme.iconSizeLarge)
+ opacity: (model.itemType === itemTypeTrash) ? 0.8 : 0
+ visible: opacity > 0
+ Behavior on opacity { FadeAnimation { } }
+
+ function deriveColor(color) {
+ var gray = 0.299 * color.r + 0.587 * color.g + 0.114 *color.b
+ var v = (gray > 0.5) ? 0 : 1
+ return Qt.rgba(v, v, v, color.a)
+ }
+ }
+
+ states: [
+ State {
+ name: "dragging"
+ when: colorDelegate.dragging
+ ParentChange {
+ target: colorItem
+ parent: grid
+ x: colorDelegate.mapToItem(grid, 0, 0).x
+ y: colorDelegate.mapToItem(grid, 0, 0).y
+ }
+ },
+ State {
+ name: "snappingBack"
+ when: !colorDelegate.dragging && colorItem.snappingBack
+ ParentChange {
+ target: colorItem
+ parent: grid
+ x: colorItem.returnX
+ y: colorItem.returnY
+ }
+ },
+ State {
+ name: "idle"
+ when: !colorDelegate.dragging && !colorItem.snappingBack
+ ParentChange {
+ target: colorItem
+ parent: colorDelegate
+ x: 0
+ y: 0
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ to: "snappingBack"
+ SequentialAnimation {
+ SmoothedAnimation {
+ properties: "x,y"
+ duration: 150
+ }
+ ScriptAction { script: colorItem.snappingBack = false }
+ }
+ },
+ Transition {
+ to: "idle"
+ ScriptAction { script: colorModel.dragPos = -1 }
+ }
+ ]
+
+ Connections {
+ target: colorDelegate.dragging ? colorItem : null
+ onXChanged: colorItem.updateDragPos()
+ onYChanged: colorItem.scrollAndUpdateDragPos()
+ }
+
+ Connections {
+ target: colorDelegate.dragging ? grid : null
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/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:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourFitLabel.qml
^
|
(renamed from qmlplugin/harbour-lib/qml/HarbourFitLabel.qml)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourGrayscaleEffect.qml
^
|
(renamed from qmlplugin/harbour-lib/qml/HarbourGrayscaleEffect.qml)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourHighlightIcon.qml
^
|
(renamed from qmlplugin/harbour-lib/qml/HarbourHighlightIcon.qml)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourHintIconButton.qml
^
|
(renamed from qmlplugin/harbour-lib/qml/HarbourHintIconButton.qml)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourHorizontalSwipeHint.qml
^
|
(renamed from qmlplugin/harbour-lib/qml/HarbourHorizontalSwipeHint.qml)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourIconTextButton.qml
^
|
(renamed from qmlplugin/harbour-lib/qml/HarbourIconTextButton.qml)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourInvertEffect.qml
^
|
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+ShaderEffect {
+ property variant source
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main(void) {
+ highp vec4 pixelColor = texture2D(source, qt_TexCoord0);
+ gl_FragColor = vec4(vec3(1,1,1) - pixelColor.rgb, pixelColor.a) * qt_Opacity;
+ }"
+}
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourPasswordInputField.qml
^
|
(renamed from qmlplugin/harbour-lib/qml/HarbourPasswordInputField.qml)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourPressEffect.qml
^
|
(renamed from qmlplugin/harbour-lib/qml/HarbourPressEffect.qml)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourShakeAnimation.qml
^
|
(renamed from qmlplugin/harbour-lib/qml/HarbourShakeAnimation.qml)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourShareMethodList.qml
^
|
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2020-2023 Slava Monich <slava@monich.com>
+ * Copyright (C) 2020 Jolla Ltd.
+ *
+ * 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.
+ */
+
+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
+
+ property url source
+ property string subject
+ property string emailTo
+ property string type
+
+ width: parent.width
+ height: Theme.itemSizeSmall * model.count
+
+ property string addAccountText: "Add account"
+ readonly property bool accountIconSupported: model.accountIconSupported
+ property var content: []
+ // model: HarbourTransferMethodsModel
+
+ onTypeChanged: content.type = type
+
+ Component.onCompleted: content.type = type
+
+ delegate: BackgroundItem {
+ id: backgroundItem
+ width: view.width
+
+ Image {
+ id: icon
+
+ x: Theme.horizontalPageMargin
+ anchors.verticalCenter: parent.verticalCenter
+ source: accountIcon ? accountIcon :
+ view.accountIconSupported ? "image://theme/icon-m-share" : ""
+ visible: view.accountIconSupported
+ }
+
+ Label {
+ id: displayNameLabel
+
+ text: displayName
+ color: backgroundItem.highlighted ? Theme.highlightColor : Theme.primaryColor
+ truncationMode: TruncationMode.Fade
+ x: Theme.horizontalPageMargin
+ anchors {
+ left: icon.visible ? icon.right : parent.left
+ leftMargin: icon.visible ? Theme.paddingMedium : Theme.horizontalPageMargin
+ verticalCenter: parent.verticalCenter
+ }
+ width: Math.min(implicitWidth, parent.width - 2*Theme.horizontalPageMargin)
+ }
+
+ Label {
+ text: userName
+ font.pixelSize: Theme.fontSizeMedium
+ color: backgroundItem.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
+ truncationMode: TruncationMode.Fade
+ anchors {
+ left: displayNameLabel.right
+ leftMargin: Theme.paddingSmall
+ right: parent.right
+ rightMargin: Theme.horizontalPageMargin
+ verticalCenter: parent.verticalCenter
+ }
+ visible: text.length > 0
+ }
+
+ onClicked: {
+ pageStack.push(model.shareUIPath, {
+ source: view.source,
+ content: content,
+ methodId: model.methodId,
+ displayName: model.displayName,
+ accountId: model.accountId,
+ accountName: model.userName,
+ emailTo: view.emailTo,
+ emailSubject: view.subject
+ })
+ }
+ }
+
+ footer: BackgroundItem {
+ // 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
+
+ x: Theme.horizontalPageMargin
+ anchors.verticalCenter: parent.verticalCenter
+ source: view.accountIconSupported ?
+ ("image://theme/icon-m-add" + (parent.highlighted ? "?" + Theme.highlightColor : "")) : ""
+ visible: view.accountIconSupported
+ }
+
+ Label {
+ text: addAccountText
+ x: Theme.horizontalPageMargin
+ anchors {
+ left: addAccountIcon.visible ? addAccountIcon.right : parent.left
+ leftMargin: addAccountIcon.visible ? Theme.paddingMedium : Theme.horizontalPageMargin
+ verticalCenter: parent.verticalCenter
+ }
+ color: highlighted ? Theme.highlightColor : Theme.primaryColor
+ }
+
+ onClicked: model.showAccounts()
+ }
+
+ VerticalScrollDecorator { }
+}
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/qml/HarbourTextFlip.qml
^
|
(renamed from qmlplugin/harbour-lib/qml/HarbourTextFlip.qml)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/rpm/harbour-lib-devel.spec
^
|
(renamed from qmlplugin/harbour-lib/rpm/harbour-lib-devel.spec)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourAztecCodeGenerator.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourAztecCodeGenerator.cpp)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourBase32.cpp
^
|
@@ -0,0 +1,267 @@
+/*
+ * 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:
+ *
+ * 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 "HarbourBase32.h"
+
+#include "HarbourDebug.h"
+
+#define BASE32_BITS_PER_NIBBLE (5)
+#define BASE32_BYTES_PER_CHUNK (5)
+#define BASE32_NIBBLES_PER_CHUNK (8)
+#define BASE32_BITS_PER_CHUNK (BASE32_BITS_PER_NIBBLE*BASE32_NIBBLES_PER_CHUNK)
+#define BASE32_NIBBLE_MASK ((1 << BASE32_BITS_PER_NIBBLE) - 1)
+Q_STATIC_ASSERT(BASE32_BITS_PER_CHUNK == BASE32_BYTES_PER_CHUNK * 8);
+
+// ==========================================================================
+// HarbourBase32::Private
+// ==========================================================================
+
+class HarbourBase32::Private
+{
+public:
+ static char nibbleToBase32(int, char);
+ static int base32ToNibble(char);
+};
+
+inline
+char
+HarbourBase32::Private::nibbleToBase32(
+ int aNibble,
+ char aBaseChar)
+{
+ return (aNibble < 26) ? (aBaseChar + aNibble) : ('2' + (aNibble - 26));
+}
+
+inline
+int
+HarbourBase32::Private::base32ToNibble(
+ char aChar)
+{
+ 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;
+ }
+}
+
+// ==========================================================================
+// HarbourBase32
+// ==========================================================================
+
+bool
+HarbourBase32::isValidBase32(
+ QString aBase32)
+{
+ const int n = aBase32.length();
+ const QChar* chars = aBase32.constData();
+
+ qint64 buf = 0;
+ int i, bits = 0;
+ bool empty = true;
+
+ for (i = 0; i < n; i++) {
+ const QChar c = chars[i];
+
+ if (!c.isSpace()) {
+ const char l = c.toLatin1();
+
+ empty = false;
+ if (l == '=') {
+ i++;
+ break;
+ } else {
+ const int nibble = Private::base32ToNibble(l);
+
+ if (nibble < 0) {
+ HDEBUG("Invalid BASE32 character" << c);
+ return false;
+ }
+ bits += BASE32_BITS_PER_NIBBLE;
+ buf <<= BASE32_BITS_PER_NIBBLE;
+ buf += nibble;
+ if (bits == BASE32_BITS_PER_CHUNK) {
+ bits = 0;
+ buf = 0;
+ }
+ }
+ }
+ }
+
+ // Handle padding per RFC 4648
+ if (bits) {
+ while (i < n) {
+ const QChar c = chars[i++];
+
+ if (!c.isSpace()) {
+ empty = false;
+ if (c != '=') {
+ HDEBUG("Invalid BASE32 string" << aBase32);
+ return false;
+ }
+ }
+ }
+ const int realbits = bits/8*8;
+ const int mask = (1 << (bits - realbits)) - 1;
+ if (buf & mask) {
+ return false;
+ }
+ }
+ return !empty;
+}
+
+QByteArray
+HarbourBase32::fromBase32(
+ const QString aBase32)
+{
+ QByteArray out;
+
+ const int n = aBase32.length();
+ const QChar* chars = aBase32.constData();
+
+ qint64 buf = 0;
+ int i, bits = 0;
+ char bytes[BASE32_BYTES_PER_CHUNK];
+
+ out.reserve((n * 5 + 7)/8);
+
+ for (i = 0; i < n; i++) {
+ const QChar c = chars[i];
+
+ if (!c.isSpace()) {
+ const char l = c.toLatin1();
+
+ if (l == '=') {
+ i++;
+ break;
+ } else {
+ const int nibble = Private::base32ToNibble(l);
+
+ if (nibble < 0) {
+ HDEBUG("Invalid BASE32 character" << c);
+ return QByteArray();
+ } else {
+ bits += BASE32_BITS_PER_NIBBLE;
+ buf <<= BASE32_BITS_PER_NIBBLE;
+ buf += nibble;
+ if (bits == BASE32_BITS_PER_CHUNK) {
+ bits = 0;
+ for (int k = BASE32_BYTES_PER_CHUNK; k > 0; k--) {
+ bytes[k - 1] = (char)buf;
+ buf >>= 8;
+ }
+ out.append(bytes, BASE32_BYTES_PER_CHUNK);
+ }
+ }
+ }
+ }
+ }
+
+ // Handle padding per RFC 4648
+ if (bits) {
+ while (i < n) {
+ const QChar c = chars[i++];
+
+ if (!c.isSpace() && c != '=') {
+ HDEBUG("Invalid BASE32 string" << aBase32);
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourBase45.cpp
^
|
@@ -0,0 +1,215 @@
+/*
+ * 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:
+ *
+ * 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 "HarbourBase45.h"
+
+#include "HarbourDebug.h"
+
+// ==========================================================================
+// HarbourBase45::Private
+// ==========================================================================
+
+class HarbourBase45::Private
+{
+public:
+ enum {
+ BASE = 45,
+ BASE2 = BASE * BASE,
+ REVERSE_MAP_SIZE = 91
+ };
+ static const char mapBase45[BASE];
+ static const int reverseMapBase45[REVERSE_MAP_SIZE];
+ static bool isValidChar(uint);
+};
+
+const char HarbourBase45::Private::mapBase45[HarbourBase45::Private::BASE] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
+ 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
+ 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
+ 'W', 'X', 'Y', 'Z', ' ', '$', '%', '*',
+ '+', '-', '.', '/', ':'
+};
+
+const int HarbourBase45::Private::reverseMapBase45[HarbourBase45::Private::REVERSE_MAP_SIZE] = {
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ 36, -1, -1, -1, 37, 38, -1, -1,
+ -1, -1, 39, 40, -1, 41, 42, 43,
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 44, -1, -1, -1, -1, -1,
+ -1, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35
+};
+
+inline
+bool
+HarbourBase45::Private::isValidChar(
+ uint aChar)
+{
+ return (aChar < Private::REVERSE_MAP_SIZE) &&
+ Private::reverseMapBase45[aChar] >= 0;
+}
+
+// ==========================================================================
+// HarbourBase45::Private
+// ==========================================================================
+
+bool
+HarbourBase45::isValidBase45(
+ const QString aBase45)
+{
+ const int len = aBase45.length();
+
+ if (!((len % 3) % 2)) {
+ const QChar* chars = aBase45.constData();
+ int i = 0;
+
+ while ((i + 2) < len) {
+ const uint c = chars[i++].unicode();
+ const uint d = chars[i++].unicode();
+ const uint e = chars[i++].unicode();
+
+ if (!Private::isValidChar(c) ||
+ !Private::isValidChar(d) ||
+ !Private::isValidChar(e) ||
+ (Private::reverseMapBase45[c] +
+ Private::reverseMapBase45[d] * Private::BASE +
+ Private::reverseMapBase45[e] * Private::BASE2) > 0xffff) {
+ return false;
+ }
+ }
+
+ if (i < len) {
+ const uint c = chars[i++].unicode();
+ const uint d = chars[i++].unicode();
+
+ if (!Private::isValidChar(c) ||
+ !Private::isValidChar(d) ||
+ (Private::reverseMapBase45[c] +
+ Private::reverseMapBase45[d] * Private::BASE) > 0xff) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+QByteArray
+HarbourBase45::fromBase45(
+ const QString aBase45)
+{
+ QByteArray out;
+ const int len = aBase45.length();
+ const int tail = (len % 3);
+
+ if (!(tail % 2)) {
+ const QChar* chars = aBase45.constData();
+ int i = 0;
+
+ out.reserve(len/3*2 + tail/2);
+ while ((i + 2) < len) {
+ const uint c = chars[i++].unicode();
+ const uint d = chars[i++].unicode();
+ const uint e = chars[i++].unicode();
+
+ if (!Private::isValidChar(c) ||
+ !Private::isValidChar(d) ||
+ !Private::isValidChar(e)) {
+ return QByteArray();
+ }
+ const uint n = Private::reverseMapBase45[c] +
+ Private::reverseMapBase45[d] * Private::BASE +
+ Private::reverseMapBase45[e] * Private::BASE2;
+ if (n > 0xffff) {
+ return QByteArray();
+ }
+ char ab[2];
+ ab[0] = (char)(n >> 8);
+ ab[1] = (char)n;
+ out.append(ab, sizeof(ab));
+ }
+
+ if (i < len) {
+ const uint c = chars[i++].unicode();
+ const uint d = chars[i++].unicode();
+
+ if (!Private::isValidChar(c) ||
+ !Private::isValidChar(d)) {
+ return QByteArray();
+ }
+ const uint a = Private::reverseMapBase45[c] +
+ Private::reverseMapBase45[d] * Private::BASE;
+ if (a > 0xff) {
+ return QByteArray();
+ }
+ out.append((char)a);
+ }
+ }
+ return out;
+}
+
+QString
+HarbourBase45::toBase45(
+ const QByteArray aBinary)
+{
+ const uchar* ptr = (uchar*)aBinary.constData();
+ const int n = aBinary.size();
+ int i;
+
+ QString str;
+ str.reserve(3 * (n / 2) + 2 * (n % 2));
+ for (i = 0; (i + 1) < n; i += 2) {
+ uint e = (uint)(ptr[i]) * 256 + ptr[i+1];
+ const uchar c = (uchar)(e % Private::BASE);
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourBattery.cpp
^
|
@@ -0,0 +1,266 @@
+/*
+ * Copyright (C) 2022 Jolla Ltd.
+ * Copyright (C) 2022 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourBattery.h"
+#include "HarbourDebug.h"
+#include "HarbourMce.h"
+
+#include <QDBusPendingCallWatcher>
+#include <QDBusPendingReply>
+
+// ==========================================================================
+// HarbourBattery::Private
+// ==========================================================================
+
+class HarbourBattery::Private : public HarbourMce
+{
+ Q_OBJECT
+
+public:
+ static const QString MCE_BATTERY_STATUS_UNKNOWN;
+ static const QString MCE_BATTERY_STATUS_FULL;
+ static const QString MCE_BATTERY_STATUS_OK;
+ static const QString MCE_BATTERY_STATUS_LOW;
+ static const QString MCE_BATTERY_STATUS_EMPTY;
+
+ static const QString MCE_BATTERY_STATE_UNKNOWN;
+ static const QString MCE_BATTERY_STATE_DISCHARGING;
+ static const QString MCE_BATTERY_STATE_CHARGING;
+ static const QString MCE_BATTERY_STATE_NOT_CHARGING;
+ static const QString MCE_BATTERY_STATE_FULL;
+
+ Private(HarbourBattery*);
+
+ HarbourBattery* parentObject() const;
+
+public Q_SLOTS:
+ void updateBatteryStatus(const QString);
+ void updateBatteryState(const QString);
+ void updateBatteryLevel(int);
+ void onBatteryStatusQueryDone(QDBusPendingCallWatcher*);
+ void onBatteryStateQueryDone(QDBusPendingCallWatcher*);
+ void onBatteryLevelQueryDone(QDBusPendingCallWatcher*);
+
+public:
+ BatteryStatus iBatteryStatus;
+ BatteryState iBatteryState;
+ int iBatteryLevel;
+};
+
+const QString HarbourBattery::Private::MCE_BATTERY_STATUS_UNKNOWN("unknown");
+const QString HarbourBattery::Private::MCE_BATTERY_STATUS_FULL("full");
+const QString HarbourBattery::Private::MCE_BATTERY_STATUS_OK("ok");
+const QString HarbourBattery::Private::MCE_BATTERY_STATUS_LOW("low");
+const QString HarbourBattery::Private::MCE_BATTERY_STATUS_EMPTY("empty");
+
+const QString HarbourBattery::Private::MCE_BATTERY_STATE_UNKNOWN("unknown");
+const QString HarbourBattery::Private::MCE_BATTERY_STATE_DISCHARGING("discharging");
+const QString HarbourBattery::Private::MCE_BATTERY_STATE_CHARGING("charging");
+const QString HarbourBattery::Private::MCE_BATTERY_STATE_NOT_CHARGING("not_charging");
+const QString HarbourBattery::Private::MCE_BATTERY_STATE_FULL("full");
+
+HarbourBattery::Private::Private(
+ HarbourBattery* aParent) :
+ HarbourMce(aParent),
+ iBatteryStatus(BatteryStatusUnknown),
+ iBatteryState(BatteryStateUnknown),
+ iBatteryLevel(0)
+{
+ setupProperty("get_battery_status", "battery_status_ind",
+ SLOT(onBatteryStatusQueryDone(QDBusPendingCallWatcher*)),
+ SLOT(updateBatteryStatus(QString)));
+ setupProperty("get_battery_state", "battery_state_ind",
+ SLOT(onBatteryStateQueryDone(QDBusPendingCallWatcher*)),
+ SLOT(updateBatteryState(QString)));
+ setupProperty("get_battery_level", "battery_level_ind",
+ SLOT(onBatteryLevelQueryDone(QDBusPendingCallWatcher*)),
+ SLOT(updateBatteryLevel(int)));
+}
+
+inline
+HarbourBattery*
+HarbourBattery::Private::parentObject() const
+{
+ return qobject_cast<HarbourBattery*>(parent());
+}
+
+void
+HarbourBattery::Private::updateBatteryStatus(
+ const QString aStatus)
+{
+ BatteryStatus status = BatteryStatusUnknown;
+
+ if (aStatus == MCE_BATTERY_STATUS_OK) {
+ status = BatteryStatusOk;
+ } else if (aStatus == MCE_BATTERY_STATUS_FULL) {
+ status = BatteryStatusFull;
+ } else if (aStatus == MCE_BATTERY_STATUS_LOW) {
+ status = BatteryStatusLow;
+ } else if (aStatus == MCE_BATTERY_STATUS_EMPTY) {
+ status = BatteryStatusEmpty;
+ } else if (aStatus != MCE_BATTERY_STATUS_UNKNOWN) {
+ HWARN("Unexpected battery status" << aStatus);
+ return;
+ }
+
+ if (iBatteryStatus != status) {
+ iBatteryStatus = status;
+ HDEBUG(aStatus);
+ Q_EMIT parentObject()->batteryStatusChanged();
+ }
+}
+
+void
+HarbourBattery::Private::updateBatteryState(
+ const QString aState)
+{
+ BatteryState state = BatteryStateUnknown;
+
+ if (aState == MCE_BATTERY_STATE_CHARGING) {
+ state = BatteryStateCharging;
+ } else if (aState == MCE_BATTERY_STATE_DISCHARGING) {
+ state = BatteryStateDischarging;
+ } else if (aState == MCE_BATTERY_STATE_NOT_CHARGING) {
+ state = BatteryStateNotCharging;
+ } else if (aState == MCE_BATTERY_STATE_FULL) {
+ state = BatteryStateFull;
+ } else if (aState != MCE_BATTERY_STATE_UNKNOWN) {
+ HWARN("Unexpected battery state" << aState);
+ return;
+ }
+
+ if (iBatteryState != state) {
+ iBatteryState = state;
+ HDEBUG(aState);
+ Q_EMIT parentObject()->batteryStateChanged();
+ }
+}
+
+void
+HarbourBattery::Private::updateBatteryLevel(
+ int aLevel)
+{
+ if (iBatteryLevel != aLevel) {
+ iBatteryLevel = aLevel;
+ HDEBUG(aLevel);
+ Q_EMIT parentObject()->batteryLevelChanged();
+ }
+}
+
+void
+HarbourBattery::Private::onBatteryStatusQueryDone(
+ QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply<QString> reply(*aWatcher);
+
+ if (reply.isError()) {
+ HWARN(reply.error().message());
+ } else {
+ updateBatteryStatus(reply.value());
+ }
+ aWatcher->deleteLater();
+}
+
+void
+HarbourBattery::Private::onBatteryStateQueryDone(
+ QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply<QString> reply(*aWatcher);
+
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourClipboard.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourClipboard.cpp)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourColorEditorModel.cpp
^
|
@@ -0,0 +1,298 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 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 "HarbourColorEditorModel.h"
+#include "HarbourDebug.h"
+
+// ==========================================================================
+// HarbourColorEditorModel::Private
+// ==========================================================================
+
+class HarbourColorEditorModel::Private
+{
+public:
+ enum ModelRole {
+ ColorRole = Qt::UserRole,
+ ItemTypeRole
+ };
+
+ Private();
+
+ bool resetDragPos();
+ QStringList getColors() const;
+ QList<QColor> makeColors(const QStringList& aColors, bool* aChanged) const;
+ QVariant data(int aRow, ModelRole aRole) const;
+
+public:
+ int iDragPos;
+ int iDragStartPos;
+ QList<QColor> iColors;
+ const QColor iAddColor;
+};
+
+HarbourColorEditorModel::Private::Private() :
+ iDragPos(-1),
+ iDragStartPos(-1),
+ iAddColor(0, 0, 0, 0)
+{
+}
+
+bool HarbourColorEditorModel::Private::resetDragPos()
+{
+ if (iDragPos >= 0) {
+ iDragPos = -1;
+ iDragStartPos = -1;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+QStringList HarbourColorEditorModel::Private::getColors() const
+{
+ const int n = iColors.count();
+ QStringList colors;
+ colors.reserve(n);
+ for (int i = 0; i < n; i++) {
+ colors.append(iColors.at(i).name());
+ }
+ return colors;
+}
+
+QList<QColor> HarbourColorEditorModel::Private::makeColors(const QStringList& aColors, bool* aChanged) const
+{
+ const int n = aColors.count();
+ *aChanged = iColors.count() != n;
+ QList<QColor> newColors;
+ newColors.reserve(n);
+ for (int i = 0; i < n; i++) {
+ const QColor c(aColors.at(i));
+ newColors.append(c);
+ if (!*aChanged && iColors.at(i) != c) {
+ *aChanged = true;
+ }
+ }
+ return newColors;
+}
+
+QVariant HarbourColorEditorModel::Private::data(int aRow, ModelRole aRole) const
+{
+ const int n = iColors.count();
+ if (aRow >= 0 && aRow <= n) {
+ switch (aRole) {
+ case ColorRole:
+ if (iDragPos >= 0) {
+ if (aRow == iDragPos) {
+ // This includes the item dragged outside
+ return iColors.at(iDragStartPos);
+ } else {
+ if (iDragPos == n && aRow == (n - 1)) {
+ // When item is dragged outside, it becomes
+ // the last one and shifts the "add" item.
+ return iAddColor;
+ } else if (aRow >= iDragStartPos && aRow < iDragPos) {
+ return iColors.at(aRow + 1);
+ } else if (aRow > iDragPos && aRow <= iDragStartPos) {
+ return iColors.at(aRow - 1);
+ }
+ }
+ }
+ return (aRow == n) ? iAddColor : iColors.at(aRow);
+ case ItemTypeRole:
+ if (iDragPos == n) {
+ // Item is dragged outside
+ return (aRow == n) ? TrashedItem :
+ (aRow == (n - 1)) ? AddItem : ColorItem;
+ } else {
+ return (aRow == n) ? AddItem : ColorItem;
+ }
+ }
+ }
+ return QVariant();
+}
+
+// ==========================================================================
+// HarbourColorEditorModel::Private
+// ==========================================================================
+
+HarbourColorEditorModel::HarbourColorEditorModel(QObject* aParent) :
+ QAbstractListModel(aParent),
+ iPrivate(new Private)
+{
+}
+
+QHash<int,QByteArray> HarbourColorEditorModel::roleNames() const
+{
+ QHash<int,QByteArray> roles;
+ roles.insert(Private::ColorRole, "color");
+ roles.insert(Private::ItemTypeRole, "itemType");
+ return roles;
+}
+
+int HarbourColorEditorModel::rowCount(const QModelIndex&) const
+{
+ return iPrivate->iColors.count() + 1;
+}
+
+QVariant HarbourColorEditorModel::data(const QModelIndex& aIndex, int aRole) const
+{
+ return iPrivate->data(aIndex.row(), (Private::ModelRole)aRole);
+}
+
+QStringList HarbourColorEditorModel::getColors() const
+{
+ return iPrivate->getColors();
+}
+
+void HarbourColorEditorModel::setColors(QStringList aColors)
+{
+ bool changed;
+ const QList<QColor> prevColors(iPrivate->iColors);
+ const QList<QColor> newColors(iPrivate->makeColors(aColors, &changed));
+ if (changed) {
+ const int prevCount = prevColors.count();
+ const int newCount = newColors.count();
+ const QVector<int> colorRole(1, Private::ColorRole);
+ if (newCount < prevCount) {
+ beginRemoveRows(QModelIndex(), newCount + 1, prevCount);
+ iPrivate->iColors = newColors;
+ endRemoveRows();
+ } else if (newCount > prevCount) {
+ beginInsertRows(QModelIndex(), prevCount + 1, newCount);
+ iPrivate->iColors = newColors;
+ endInsertRows();
+ } else {
+ iPrivate->iColors = newColors;
+ }
+ // Change the colors
+ int rangeStart = -1;
+ const int n = qMin(prevCount, newCount);
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourDisplayBlanking.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourDisplayBlanking.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourImageProvider.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourImageProvider.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourJson.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourJson.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourLib.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourLib.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourMce.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourMce.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourMce.h
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourMce.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourMediaPlugin.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourMediaPlugin.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourObject.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourObject.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourOrganizeListModel.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourOrganizeListModel.cpp)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourPluginLoader.cpp
^
|
@@ -0,0 +1,389 @@
+/*
+ * Copyright (C) 2017-2021 Jolla Ltd.
+ * Copyright (C) 2017-2021 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
+ * 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.
+ */
+
+#include "HarbourPluginLoader.h"
+#include "HarbourSystem.h"
+#include "HarbourDebug.h"
+
+// These are included from qqmlengine.h
+#include <QUrl>
+#include <QObject>
+#include <QMap>
+#include <QJSEngine>
+#include <QQmlError>
+
+#if QT_VERSION >= 0x050000
+
+// Unprotect QQmlEngine::d_func
+#define private public
+#include <QQmlEngine>
+#undef private
+
+#include <qqml.h>
+#include <QQmlEngine>
+#include <QQmlComponent>
+
+#include <dlfcn.h>
+
+// This hack allows (in most cases) to use prohibited QML imports by
+// re-registering them under a different name
+
+// These:
+// QQmlAttachedPropertiesFunc QQmlType::attachedPropertiesFunction() const
+// _ZNK8QQmlType26attachedPropertiesFunctionEv
+//
+// const QMetaObject* QQmlType::attachedPropertiesType() const
+// _ZNK8QQmlType22attachedPropertiesTypeEv
+//
+// have been replaced with these in Qt 5.6:
+//
+// QQmlAttachedPropertiesFunc QQmlType::attachedPropertiesFunction(QQmlEnginePrivate*) const
+// _ZNK8QQmlType26attachedPropertiesFunctionEP17QQmlEnginePrivate
+//
+// const QMetaObject* QQmlType::attachedPropertiesType(QQmlEnginePrivate*) const
+// _ZNK8QQmlType22attachedPropertiesTypeEP17QQmlEnginePrivate
+//
+
+#define LIBQT5QML_SO "libQt5Qml.so.5"
+
+// sym,ret,name,args
+#define QMLTYPE_FUNCTIONS(f) \
+ f("_ZN12QQmlMetaType7qmlTypeERK7QStringii", \
+ QQmlType*, qmlType, (QString const&, int, int)) \
+ f("_ZNK8QQmlType23propertyValueSourceCastEv", \
+ int, propertyValueSourceCast, (QQmlType*)) \
+ f("_ZNK8QQmlType10createSizeEv", \
+ int, createSize, (QQmlType*)) \
+ f("_ZNK8QQmlType10metaObjectEv", \
+ const QMetaObject*, metaObject, (QQmlType*)) \
+ f("_ZNK8QQmlType16parserStatusCastEv", \
+ int, parserStatusCast, (QQmlType*)) \
+ f("_ZNK8QQmlType28propertyValueInterceptorCastEv", \
+ int, propertyValueInterceptorCast, (QQmlType*)) \
+ f("_ZNK8QQmlType6typeIdEv", \
+ int, typeId, (QQmlType*)) \
+ f("_ZNK8QQmlType14createFunctionEv", \
+ QQmlType::CreateFunc, createFunction, (QQmlType*)) \
+ f("_ZNK8QQmlType11qListTypeIdEv", \
+ int, qListTypeId, (QQmlType*)) \
+ f("_ZNK8QQmlType26attachedPropertiesFunctionEv", \
+ QQmlAttachedPropertiesFunc, AttachedPropertiesFunctionProc,(QQmlType*)) \
+ f("_ZNK8QQmlType22attachedPropertiesTypeEv", \
+ const QMetaObject*, AttachedPropertiesTypeProc,(QQmlType*)) \
+ f("_ZNK8QQmlType26attachedPropertiesFunctionEP17QQmlEnginePrivate", \
+ QQmlAttachedPropertiesFunc, AttachedPropertiesFunctionProc6, (QQmlType*,QQmlEnginePrivate*)) \
+ f("_ZNK8QQmlType22attachedPropertiesTypeEP17QQmlEnginePrivate", \
+ const QMetaObject*, AttachedPropertiesTypeProc6, (QQmlType*,QQmlEnginePrivate*))
+
+// PRIVATE QT API!
+class Q_QML_EXPORT QQmlType
+{
+public:
+ int typeId() const;
+ int qListTypeId() const;
+ typedef void (*CreateFunc)(void *);
+ CreateFunc createFunction() const;
+ int createSize() const;
+ const QMetaObject *metaObject() const;
+ int parserStatusCast() const;
+ int propertyValueSourceCast() const;
+ int propertyValueInterceptorCast() const;
+ // attachedPropertiesFunction
+ // attachedPropertiesType
+};
+
+// PRIVATE QT API!
+class Q_QML_EXPORT QQmlMetaType
+{
+public:
+ static QQmlType* qmlType(const QString &qualifiedName, int, int);
+};
+
+static const char* QmlTypeSymbols[] = {
+#define QMLTYPE_SYMBOL(sym,ret,name,args) sym,
+ QMLTYPE_FUNCTIONS(QMLTYPE_SYMBOL)
+};
+
+typedef struct _QmlTypeFunctions {
+#define QMLTYPE_TYPEDEF(sym,ret,name,args) ret (*name) args;
+QMLTYPE_FUNCTIONS(QMLTYPE_TYPEDEF)
+} QmlTypeFunctions;
+
+#define _N(a) (sizeof(a)/sizeof((a)[0]))
+#define NUM_FUNCTIONS _N(QmlTypeSymbols)
+Q_STATIC_ASSERT(sizeof(QmlTypeFunctions) == NUM_FUNCTIONS*sizeof(void*));
+
+// ==========================================================================
+// HarbourPluginLoader::LibQt5Qml
+// ==========================================================================
+
+class HarbourPluginLoader::LibQt5Qml {
+public:
+
+ LibQt5Qml();
+
+public:
+ void* iHandle;
+ union {
+ QmlTypeFunctions fn;
+ void* ptr[NUM_FUNCTIONS];
+ } iSym;
+};
+
+HarbourPluginLoader::LibQt5Qml::LibQt5Qml() :
+ iHandle(HarbourDlopen(LIBQT5QML_SO, RTLD_LAZY))
+{
+ memset(&iSym, 0, sizeof(iSym));
+ if (iHandle) {
+ // Resolve unstable symbols
+ for (uint i = 0; i < NUM_FUNCTIONS; i++) {
+ iSym.ptr[i] = dlsym(iHandle, QmlTypeSymbols[i]);
+ HDEBUG(QmlTypeSymbols[i] << (iSym.ptr[i] ? "OK" : "missing"));
+ }
+ // No need to ever call dlclose(iHandle);
+ } else {
+ HWARN("Failed to load" << LIBQT5QML_SO);
+ }
+}
+
+// ==========================================================================
+// HarbourPluginLoader::Private
+// ==========================================================================
+
+class HarbourPluginLoader::Private {
+public:
+ Private(QQmlEngine* aEngine, QString aModule, int aMajor, int aMinor);
+
+ QQmlType* qmlType(QString aName);
+
+ void reRegisterType(QQmlType* aType, const char* aQmlName,
+ const char* aModule, int aMajor, int aMinor);
+ void reRegisterType(const char* aOriginalQmlName, const char* aNewQmlName,
+ const char* aModule, int aMajor, int aMinor);
+ void reRegisterType(const char* aQmlName,
+ const char* aModule, int aMajor, int aMinor);
+
+public:
+ static const LibQt5Qml gLibQt5Qml;
+
+public:
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourPolicyPlugin.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourPolicyPlugin.cpp)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourProcessState.cpp
^
|
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 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 "HarbourProcessState.h"
+#include "HarbourDebug.h"
+
+#include <unistd.h>
+#include <grp.h>
+#include <sys/types.h>
+
+HarbourProcessState::HarbourProcessState(QObject* aParent) :
+ QObject(aParent)
+{
+}
+
+// Callback for qmlRegisterSingletonType<HarbourProcessState>
+QObject* HarbourProcessState::createSingleton(QQmlEngine*, QJSEngine*)
+{
+ return new HarbourProcessState;
+}
+
+bool HarbourProcessState::isJailedApp()
+{
+ static int processJailed = -1;
+
+ // Apps are not supposed to be started by the root systemd process.
+ // Firejail tells us that our parent pid is 1.
+ // We could additionally check that /proc contains only our and
+ // parent pids, if ppid check becomes not reliable enough.
+ if (processJailed < 0) {
+ bool simulate = false;
+ const char* var = "HARBOUR_JAIL_STATE";
+ processJailed = QString(qgetenv(var)).toInt(&simulate);
+ if (!simulate || processJailed < 0) {
+ if (getppid() == 1) {
+ HWARN("We are jailed!");
+ processJailed = 1;
+ } else{
+ HDEBUG("Cool, we are free!");
+ processJailed = 0;
+ }
+ } else {
+ HWARN(var << processJailed);
+ }
+ }
+ return processJailed > 0;
+}
+
+bool HarbourProcessState::isPrivileged()
+{
+ static gid_t privilegedGid = 0;
+
+ if (!privilegedGid) {
+ const struct group* gr = getgrnam("privileged");
+
+ if (gr) {
+ privilegedGid = gr->gr_gid;
+ HDEBUG("privileged =" << privilegedGid);
+ }
+ }
+ const gid_t egid = getegid();
+ if (egid == privilegedGid) {
+ HDEBUG("Yes, we are privileged :)");
+ return true;
+ } else {
+ HDEBUG("Oops, we are not privileged :(");
+ return false;
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourProtoBuf.cpp
^
|
@@ -0,0 +1,144 @@
+/*
+ * 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)
+{
+ if (aOutput) {
+ 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)
+{
+ if (aOutput) {
+ 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)
+{
+ if (aPos) {
+ 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;
+ if (aResult) {
+ *aResult = value;
+ }
+ return true;
+ }
+ }
+
+ // Premature end of stream or too many bytes
+ if (aResult) {
+ *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)
+{
+ if (aPos) {
+ GUtilRange pos = *aPos;
+ quint64 size;
+
+ if (parseVarInt(&pos, &size) && (pos.ptr + size) <= pos.end) {
+ if (aPayload) {
+ aPayload->bytes = pos.ptr;
+ aPayload->size = size;
+ }
+ aPos->ptr = pos.ptr + size;
+ return true;
+ }
+ }
+ return false;
+}
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourQrCodeGenerator.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourQrCodeGenerator.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourQrCodeImageProvider.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourQrCodeImageProvider.cpp)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourSelectionListModel.cpp
^
|
@@ -0,0 +1,633 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019-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.
+ */
+
+#include "HarbourSelectionListModel.h"
+
+#include "HarbourDebug.h"
+
+#define ROLE "selected"
+
+// ==========================================================================
+// HarbourSelectionListModel::Private
+// ==========================================================================
+
+// 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:
+ typedef void (HarbourSelectionListModel::*SignalEmitter)();
+ typedef uint SignalMask;
+
+ 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();
+
+public Q_SLOTS:
+ void onCountChanged();
+
+public:
+ SignalMask iQueuedSignals;
+ Signal iFirstQueuedSignal;
+ QList<int> iSelectedRows;
+ QList<int> iNonSelectableRows;
+ QList<int> iNormalizedNonSelectableRows;
+ QVector<int> iSelectedRole; // Passed to dataChanged as an argument
+ int iLastKnownSelectableCount;
+ int iLastKnownCount;
+};
+
+HarbourSelectionListModel::Private::Private(
+ HarbourSelectionListModel* aParent) :
+ QObject(aParent),
+ iLastKnownSelectableCount(0),
+ iLastKnownCount(0)
+{
+ connect(aParent, SIGNAL(modelReset()), SLOT(onCountChanged()));
+ connect(aParent, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(onCountChanged()));
+ connect(aParent, SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(onCountChanged()));
+}
+
+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
+ // with empty QList and when you convert them to index. Oh well...
+ int low = 0;
+ int high = aList.count() - 1;
+
+ while (low <= high) {
+ int mid = (low + high)/2;
+ const int val = aList.at(mid);
+ if (val < aValue) {
+ low = mid + 1;
+ } else if (val > aValue) {
+ high = mid - 1;
+ } else {
+ // Found
+ return mid;
+ }
+ }
+
+ // Not found, return -(INSERTION POINT+1)
+ return -(low + 1);
+}
+
+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_
+ };
+ if (iQueuedSignals) {
+ HarbourSelectionListModel* model = parentModel();
+ // Reset first queued signal before emitting the signals.
+ // Signal handlers may emit new signals.
+ uint i = iFirstQueuedSignal;
+ iFirstQueuedSignal = SignalCount;
+ for (; i < SignalCount && iQueuedSignals; i++) {
+ const SignalMask signalBit = (SignalMask(1) << i);
+ if (iQueuedSignals & signalBit) {
+ iQueuedSignals &= ~signalBit;
+ Q_EMIT (model->*(emitSignal[i]))();
+ }
+ }
+ }
+}
+
+inline
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourSigChildHandler.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourSigChildHandler.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourSingleImageProvider.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourSingleImageProvider.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourSystem.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourSystem.cpp)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourSystemInfo.cpp
^
|
@@ -0,0 +1,283 @@
+/*
+ * Copyright (C) 2020-2021 Jolla Ltd.
+ * Copyright (C) 2020-2021 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.
+ */
+
+#include "HarbourSystemInfo.h"
+#include "HarbourDebug.h"
+
+#include <QHash>
+#include <QVector>
+#include <QStringList>
+#include <QFile>
+#include <QTextStream>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+// ==========================================================================
+// HarbourSystemInfo::Private
+// ==========================================================================
+
+class HarbourSystemInfo::Private
+{
+public:
+ static const QString NAME;
+ static const QString VERSION_ID;
+
+public:
+ Private();
+
+ static QHash<QString,QString> parseFile(QString aFileName, const QStringList aKeys);
+ static QHash<QString,QString> parseOsRelease(const QStringList aKeys);
+ static QVector<uint> parseVersion(QString aVersion);
+ static int compareVersions(const QVector<uint> aVersion1, const QVector<uint> aVersion2);
+ static int compareVersions(const QVector<uint> aVersion1, const QString aVersion2);
+
+ QString getPackageVersion(QString aPackage);
+
+public:
+ QString iName;
+ QString iVersion;
+ QVector<uint> iParsedVersion;
+ QMap<QString,QString> iPackageVersions;
+};
+
+const QString HarbourSystemInfo::Private::NAME("NAME");
+const QString HarbourSystemInfo::Private::VERSION_ID("VERSION_ID");
+
+HarbourSystemInfo::Private::Private()
+{
+ QStringList keys;
+ keys.append(NAME);
+ keys.append(VERSION_ID);
+
+ QHash<QString,QString> values(parseOsRelease(keys));
+ iName = values.value(NAME);
+ iVersion = values.value(VERSION_ID);
+ iParsedVersion = parseVersion(iVersion);
+}
+
+inline QHash<QString,QString> HarbourSystemInfo::Private::parseOsRelease(const QStringList aKeys)
+{
+ return parseFile("/etc/os-release", aKeys);
+}
+
+QHash<QString,QString> HarbourSystemInfo::Private::parseFile(QString aPath, const QStringList aKeys)
+{
+ QFile file(aPath);
+ QHash<QString,QString> result;
+ if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ HDEBUG("Parsing" << qPrintable(aPath));
+ QTextStream in(&file);
+ while (!in.atEnd() && result.size() < aKeys.size()) {
+ const QString line = in.readLine();
+ const int sep = line.indexOf('=');
+ if (sep > 0 && (sep + 1) < line.length()) {
+ const QString key(line.left(sep));
+ if (aKeys.contains(key)) {
+ QString value(line.mid(sep + 1));
+ const int len = value.length();
+ if (len > 1 && value.at(0) == '"' && value.at(len - 1) == '"') {
+ value = value.mid(1, len - 2);
+ }
+ value = value.replace("\\\"", "\"");
+ HDEBUG(qPrintable(key) << "=" << qPrintable(value));
+ result.insert(key, value);
+ }
+ }
+ }
+ }
+ return result;
+}
+
+QVector<uint> HarbourSystemInfo::Private::parseVersion(QString aVersion)
+{
+ QVector<uint> parsed;
+ QStringList parts(aVersion.split('.', QString::SkipEmptyParts));
+ const int n = qMin(parts.count(),4);
+ for (int i = 0; i < n; i++) {
+ const QString part(parts.at(i));
+ bool ok = false;
+ int val = part.toUInt(&ok);
+ if (ok) {
+ parsed.append(val);
+ } else {
+ break;
+ }
+ }
+ return parsed;
+}
+
+int HarbourSystemInfo::Private::compareVersions(const QVector<uint> aVersion1,
+ const QVector<uint> aVersion2)
+{
+ const int n1 = aVersion1.size();
+ const int n2 = aVersion2.size();
+ const int n = qMin(n1, n2);
+ for (int i = 0; i < n; i++) {
+ const uint v1 = aVersion1.at(i);
+ const uint v2 = aVersion2.at(i);
+ if (v1 > v2) {
+ return 1;
+ } else if (v1 < v2) {
+ return -1;
+ }
+ }
+ return (n1 > n2) ? 1 : (n1 < n2) ? -1 : 0;
+}
+
+inline int HarbourSystemInfo::Private::compareVersions(const QVector<uint> aVersion1,
+ const QString aVersion2)
+{
+ return compareVersions(aVersion1, Private::parseVersion(aVersion2));
+}
+
+QString HarbourSystemInfo::Private::getPackageVersion(QString aPackage)
+{
+ QString version;
+ if (!aPackage.isEmpty()) {
+ version = iPackageVersions.value(aPackage);
+ if (version.isEmpty()) {
+ version = HarbourSystemInfo::queryPackageVersion(aPackage);
+ if (!version.isEmpty()) {
+ iPackageVersions.insert(aPackage, version);
+ }
+ }
+ }
+ return version;
+}
+
+// ==========================================================================
+// HarbourSystemInfo
+// ==========================================================================
+
+HarbourSystemInfo::HarbourSystemInfo(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private)
+{
+ HDEBUG("created");
+}
+
+HarbourSystemInfo::~HarbourSystemInfo()
+{
+ HDEBUG("deleted");
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourSystemState.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourSystemState.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourSystemTime.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourSystemTime.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourTask.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourTask.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourTemporaryFile.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourTemporaryFile.cpp)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourTheme.cpp
^
|
@@ -0,0 +1,265 @@
+/*
+ * 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:
+ *
+ * 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 "HarbourSystem.h"
+#include "HarbourTheme.h"
+#include "HarbourUtil.h"
+
+#include <QQmlEngine>
+
+#include <dlfcn.h>
+
+#define SILICA_SO "libsailfishsilica.so.1"
+#define SILICA_FUNCTIONS(f) \
+ f("_ZN6Silica5Theme8instanceEv", /* Silica::Theme* Silica::Theme::instance() */ \
+ QObject*, instance,()) \
+ f("_ZNK6Silica5Theme5styleEv", /* Silica::Style Silica::Theme::style() const */ \
+ HarbourTheme::Private::Style, style,(QObject*)) \
+ f("_ZNK6Silica5Theme11colorSchemeEv", /* Silica::ColorScheme Silica::Theme::colorScheme() const */ \
+ HarbourTheme::ColorScheme, colorScheme,(QObject*)) \
+ f("_ZNK6Silica5Theme12primaryColorEv", /* QColor Silica::Theme::primaryColor() const */ \
+ QColor, primaryColor,(QObject*)) \
+ f("_ZNK6Silica5Theme12opacityFaintEv", /* qreal Silica::Theme::opacityFaint() const */ \
+ qreal, opacityFaint,(QObject*)) \
+ f("_ZNK6Silica5Theme10opacityLowEv", /* qreal Silica::Theme::opacityLow() const */ \
+ qreal, opacityLow,(QObject*)) \
+ f("_ZNK6Silica5Theme11opacityHighEv", /* qreal Silica::Theme::opacityHigh() const */ \
+ qreal, opacityHigh,(QObject*)) \
+ f("_ZNK6Silica5Theme14opacityOverlayEv", /* qreal Silica::Theme::opacityOverlay() const */ \
+ qreal, opacityOverlay,(QObject*))
+
+// ==========================================================================
+// HarbourTheme::Private
+// ==========================================================================
+
+class HarbourTheme::Private
+{
+public:
+ enum Style {
+ StyleLight,
+ StyleDark
+ };
+
+ typedef struct _SilicaFunctions {
+ #define SILICA_TYPEDEF(sym,ret,name,args) ret (*name) args;
+ SILICA_FUNCTIONS(SILICA_TYPEDEF)
+ } SilicaFunctions;
+
+ static const qreal DEFAULT_OPACITY_FAINT;
+ static const qreal DEFAULT_OPACITY_LOW;
+ static const qreal DEFAULT_OPACITY_HIGH;
+ static const qreal DEFAULT_OPACITY_OVERLAY;
+
+ static void* gHandle;
+ static SilicaFunctions gSilica;
+
+public:
+ static QObject* instance();
+ static ColorScheme colorScheme();
+ static QColor primaryColor();
+ static qreal opacityFaint();
+ static qreal opacityLow();
+ static qreal opacityHigh();
+ static qreal opacityOverlay();
+};
+
+void* HarbourTheme::Private::gHandle;
+HarbourTheme::Private::SilicaFunctions HarbourTheme::Private::gSilica;
+
+const qreal HarbourTheme::Private::DEFAULT_OPACITY_FAINT = 0.2;
+const qreal HarbourTheme::Private::DEFAULT_OPACITY_LOW = 0.4;
+const qreal HarbourTheme::Private::DEFAULT_OPACITY_HIGH = 0.6;
+const qreal HarbourTheme::Private::DEFAULT_OPACITY_OVERLAY = 0.8;
+
+static const char* SilicaSymbols[] = {
+#define SILICA_SYMBOL(sym,ret,name,args) sym,
+ SILICA_FUNCTIONS(SILICA_SYMBOL)
+};
+
+#define _N(a) (sizeof(a)/sizeof((a)[0]))
+#define NUM_FUNCTIONS _N(SilicaSymbols)
+Q_STATIC_ASSERT(sizeof(HarbourTheme::Private::SilicaFunctions) == NUM_FUNCTIONS*sizeof(void*));
+
+QObject* HarbourTheme::Private::instance()
+{
+ return gSilica.instance ? gSilica.instance() : Q_NULLPTR;
+}
+
+HarbourTheme::ColorScheme HarbourTheme::Private::colorScheme()
+{
+ QObject* silica = instance();
+ if (silica) {
+ if (gSilica.colorScheme) {
+ return gSilica.colorScheme(silica);
+ } else if (gSilica.style) {
+ gSilica.style(silica);
+ }
+ }
+ return LightOnDark;
+}
+
+QColor HarbourTheme::Private::primaryColor()
+{
+ QObject* silica = instance();
+ return (silica && gSilica.primaryColor) ? gSilica.primaryColor(silica) : QColor();
+}
+
+qreal HarbourTheme::Private::opacityFaint()
+{
+ QObject* silica = instance();
+ return (silica && gSilica.opacityFaint) ? gSilica.opacityFaint(silica) :
+ DEFAULT_OPACITY_FAINT;
+}
+
+qreal HarbourTheme::Private::opacityLow()
+{
+ QObject* silica = instance();
+ return (silica && gSilica.opacityLow) ? gSilica.opacityLow(silica) :
+ DEFAULT_OPACITY_LOW;
+}
+
+qreal HarbourTheme::Private::opacityHigh()
+{
+ QObject* silica = instance();
+ return (silica && gSilica.opacityHigh) ? gSilica.opacityHigh(silica) :
+ DEFAULT_OPACITY_HIGH;
+}
+
+qreal HarbourTheme::Private::opacityOverlay()
+{
+ QObject* silica = instance();
+ return (silica && gSilica.opacityOverlay) ? gSilica.opacityOverlay(silica) :
+ DEFAULT_OPACITY_OVERLAY;
+}
+
+// ==========================================================================
+// HarbourTheme
+// ==========================================================================
+
+HarbourTheme::HarbourTheme(QObject* aParent) : QObject(aParent)
+{
+ if (!Private::gHandle) {
+ Private::gHandle = HarbourDlopen(SILICA_SO, RTLD_LAZY);
+ if (Private::gHandle) {
+ void** ptr = (void**)&Private::gSilica;
+ for (uint i = 0; i < NUM_FUNCTIONS; i++) {
+ ptr[i] = dlsym(Private::gHandle, SilicaSymbols[i]);
+ HDEBUG(SilicaSymbols[i] << (ptr[i] ? "OK" : "missing"));
+ }
+ }
+ }
+ QObject* silica = Private::instance();
+ if (silica) {
+ if (Private::gSilica.colorScheme) {
+ // Colors update is delayed, queue this signal
+ QObject::connect(silica,
+ SIGNAL(colorSchemeChanged()),
+ SIGNAL(colorSchemeChanged()),
+ Qt::QueuedConnection);
+ }
+ if (Private::gSilica.primaryColor) {
+ QObject::connect(silica,
+ SIGNAL(primaryColorChanged()),
+ SIGNAL(primaryColorChanged()));
+ }
+ }
+}
+
+HarbourTheme::~HarbourTheme()
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourTransferMethodInfo.cpp
^
|
(renamed from qmlplugin/harbour-lib/src/HarbourTransferMethodInfo.cpp)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/HarbourTransferMethodsModel.cpp
^
|
@@ -0,0 +1,497 @@
+/*
+ * Copyright (C) 2016-2023 Slava Monich <slava@monich.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ *
+ * 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.
+ */
+
+#include "HarbourTransferMethodsModel.h"
+#include "HarbourDebug.h"
+
+#include <QTranslator>
+#include <QRegExp>
+
+// ==========================================================================
+// HarbourTransferMethodsModel::TransferEngine
+// ==========================================================================
+
+class HarbourTransferMethodsModel::TransferEngine : public QDBusAbstractInterface
+{
+ Q_OBJECT
+
+public:
+ TransferEngine(QObject* aParent) :
+ QDBusAbstractInterface(QStringLiteral("org.nemo.transferengine"),
+ QStringLiteral("/org/nemo/transferengine"), "org.nemo.transferengine",
+ QDBusConnection::sessionBus(), aParent) {}
+
+public: // METHODS
+ inline QDBusPendingCall transferMethods()
+ { return asyncCall(QStringLiteral("transferMethods")); }
+ inline QDBusPendingCall transferMethods2()
+ { return asyncCall(QStringLiteral("transferMethods2")); }
+
+Q_SIGNALS: // SIGNALS
+ void transferMethodListChanged();
+};
+
+// ==========================================================================
+// HarbourTransferMethodsModel::Private
+// ==========================================================================
+
+class HarbourTransferMethodsModel::Private : public QObject
+{
+ Q_OBJECT
+ typedef QDBusPendingCallWatcher* (Private::*RequestUpdate)();
+
+public:
+ enum Role {
+ DisplayNameRole = Qt::UserRole + 1,
+ UserNameRole,
+ MethodIdRole,
+ ShareUIPathRole,
+ AccountIdRole,
+ AccountIconRole
+ };
+
+ Private(HarbourTransferMethodsModel*);
+ ~Private() Q_DECL_OVERRIDE;
+
+public:
+ HarbourTransferMethodsModel* parentModel();
+ static QRegExp regExp(QString);
+ void filterModel();
+ QDBusPendingCallWatcher* checkTransferMethods();
+ QDBusPendingCallWatcher* requestTransferMethods();
+ QDBusPendingCallWatcher* requestTransferMethods2();
+ void setTransferMethods2(HarbourTransferMethodInfo2List);
+ bool showAccounts();
+
+private Q_SLOTS:
+ void onTransferMethodsCheckFinished(QDBusPendingCallWatcher*);
+ void onTransferMethodsFinished(QDBusPendingCallWatcher*);
+ void onTransferMethods2Finished(QDBusPendingCallWatcher*);
+ void onShowAccountsFinished(QDBusPendingCallWatcher*);
+ void requestUpdate();
+
+public:
+ QString iFilter;
+ QList<HarbourTransferMethodInfo2> iMethodList;
+ QList<int> iFilteredList;
+ bool iAccountIconSupported;
+ RequestUpdate iRequestUpdate;
+ QDBusPendingCallWatcher* iUpdateWatcher;
+ QDBusPendingCallWatcher* iShowAccountsWatcher;
+ bool iShowAccountsFailed;
+ bool iValid;
+ TransferEngine* iTransferEngine;
+};
+
+HarbourTransferMethodsModel::Private::Private(HarbourTransferMethodsModel* aModel) :
+ QObject(aModel),
+ iAccountIconSupported(false),
+ iRequestUpdate(&Private::checkTransferMethods),
+ iUpdateWatcher(Q_NULLPTR),
+ iShowAccountsWatcher(Q_NULLPTR),
+ iShowAccountsFailed(false),
+ iValid(false),
+ iTransferEngine(new TransferEngine(this))
+{
+ connect(iTransferEngine,
+ SIGNAL(transferMethodListChanged()),
+ SLOT(requestUpdate()));
+ requestUpdate();
+}
+
+HarbourTransferMethodsModel::Private::~Private()
+{
+ delete iTransferEngine;
+}
+
+inline
+HarbourTransferMethodsModel*
+HarbourTransferMethodsModel::Private::parentModel()
+{
+ return qobject_cast<HarbourTransferMethodsModel*>(parent());
+}
+
+void
+HarbourTransferMethodsModel::Private::requestUpdate()
+{
+ if (iUpdateWatcher) {
+ HDEBUG("dropping pending method list query");
+ iUpdateWatcher->disconnect(this);
+ delete iUpdateWatcher;
+ }
+ iUpdateWatcher = (this->*iRequestUpdate)();
+}
+
+void
+HarbourTransferMethodsModel::Private::setTransferMethods2(
+ HarbourTransferMethodInfo2List aList)
+{
+ iRequestUpdate = &Private::requestTransferMethods2;
+ HDEBUG(aList.count() << "methods");
+ if (iMethodList != aList) {
+ iMethodList = aList;
+ filterModel();
+ }
+ if (!iAccountIconSupported) {
+ iAccountIconSupported = true;
+ Q_EMIT parentModel()->accountIconSupportedChanged();
+ }
+}
+
+QDBusPendingCallWatcher*
+HarbourTransferMethodsModel::Private::checkTransferMethods()
+{
+ // First try transferMethods2() and see if it works
+ QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher
+ (iTransferEngine->transferMethods2(), this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(onTransferMethodsCheckFinished(QDBusPendingCallWatcher*)));
+ return watcher;
+}
+
+QDBusPendingCallWatcher*
+HarbourTransferMethodsModel::Private::requestTransferMethods()
+{
+ QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher
+ (iTransferEngine->transferMethods(), this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(onTransferMethodsFinished(QDBusPendingCallWatcher*)));
+ return watcher;
+}
+
+QDBusPendingCallWatcher*
+HarbourTransferMethodsModel::Private::requestTransferMethods2()
+{
+ QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher
+ (iTransferEngine->transferMethods2(), this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(onTransferMethods2Finished(QDBusPendingCallWatcher*)));
+ return watcher;
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.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();
+}
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/src/libcrypto.c
^
|
@@ -0,0 +1,285 @@
+/*
+ * 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:
+ *
+ * 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 ``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"
+
+#include <dlfcn.h>
+#include <stdint.h>
+
+#include <openssl/aes.h>
+#include <openssl/des.h>
+#include <openssl/md5.h>
+#include <openssl/rsa.h>
+#include <openssl/sha.h>
+#include <openssl/modes.h>
+
+/*
+ * What is this code?
+ *
+ * Sailfish OS comes in 3 flavors wrt openssl versions:
+ *
+ * 1. Sailfish OS up to 3.4 had openssl 1.0
+ * 2. Sailfish 4.0..4.2 had both openssl 1.0 and openssl 1.1 libraries
+ * 3. Sailfish 4.3 dropped openssl 1.0 libraries and only has openssl 1.1
+ *
+ * Which means that explicitly linking with any version of openssl
+ * makes your app incompatible with either Sailfish OS <= 3.4 or
+ * Sailfish OS >= 4.3 (nice symmetry).
+ *
+ * If you want to build an app which runs on both Sailfish OS <= 3.4
+ * and Sailfish OS >= 4.3 you have two options:
+ *
+ * 1. Link openssl statically
+ * 2. Load libcrypts.so dynamically with dlopen/dlsym
+ *
+ * This module allows you to implement the second strategy. It works
+ * because openssl 1.0 and 1.1 (luckily!) appear to be binary compatible.
+ * It doesn't load all libcrypto functions, only those referenced by my
+ * apps but the list can be easily expanded.
+ */
+
+#ifndef LIBDIR
+# ifdef __aarch64__
+# define LIBDIR "/usr/lib64"
+# else
+# define LIBDIR "/usr/lib"
+# endif
+#endif
+
+/*
+ * OpenSSL 1.0 headers define ERR_load_crypto_strings as a function:
+ *
+ * void ERR_load_crypto_strings(void);
+ *
+ * and OpenSSL 1.1 as a macro:
+ *
+ * #if OPENSSL_API_COMPAT < 0x10100000L
+ * # define ERR_load_crypto_strings() \
+ * OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
+ * # define ERR_free_strings() while(0) continue
+ * #endif
+ *
+ * We want to try loading both ERR_load_crypto_strings and
+ * OPENSSL_init_crypto, one of which will probably fail.
+ */
+
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+# undef ERR_load_crypto_strings
+#else
+# define OPENSSL_INIT_SETTINGS void
+#endif
+
+/* f(name,params,args) */
+#define LIBCRYPTO_FUNCTIONS1(f) \
+ f(AES_cbc_encrypt, \
+ (const unsigned char* in, unsigned char* out, size_t length, \
+ const AES_KEY* key, unsigned char* ivec, const int enc), \
+ (in, out, length, key, ivec, enc)) \
+ f(AES_cfb128_encrypt, \
+ (const unsigned char* in, unsigned char* out, size_t length, \
+ const AES_KEY* key,unsigned char* ivec, int* num, const int enc), \
+ (in, out, length, key, ivec, num, enc)) \
+ f(AES_ecb_encrypt, \
+ (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(/* 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) \
+ f(int, AES_set_decrypt_key, \
+ (const unsigned char* userKey, const int bits, AES_KEY* key), \
+ (userKey, bits, key), -1) \
+ f(int, AES_set_encrypt_key, \
+ (const unsigned char* userKey, const int bits, AES_KEY* key), \
+ (userKey, bits, key), -1) \
+ f(BIGNUM*, BN_bin2bn, \
+ (const unsigned char* s, int len, BIGNUM* ret), (s, len, ret), NULL) \
+ f(int, BN_bn2bin, \
+ (const BIGNUM* a, unsigned char* to), (a, to), 0) \
+ f(BIGNUM*, BN_new, (void), (), NULL) \
+ f(int, BN_num_bits, (const BIGNUM *a), (a), 0) \
+ f(int, BN_set_word, (BIGNUM* a, BN_ULONG w), (a, w), 0) \
+ f(int, DES_check_key_parity, (const_DES_cblock* key), (key), 0) \
+ f(int, DES_is_weak_key, (const_DES_cblock* key), (key), 0) \
+ f(int, DES_set_key, \
+ (const_DES_cblock* key, DES_key_schedule* schedule), \
+ (key, schedule), -1) \
+ f(char*, ERR_error_string, (unsigned long e, char* buf), (e, buf), NULL) \
+ f(unsigned long, ERR_get_error, (void), (), 0) \
+ f(unsigned char*, MD5, \
+ (const unsigned char* d, size_t n, unsigned char* md), (d, n, md), NULL) \
+ f(int, MD5_Final, (unsigned char* md, MD5_CTX* c), (md, c), 0) \
+ 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, /* 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) \
+ f(int, RAND_poll, (void), (), 0) \
+ f(RSA*, RSAPrivateKey_dup, (RSA* rsa), (rsa), NULL) \
+ f(RSA*, RSAPublicKey_dup, (RSA* rsa), (rsa), NULL) \
+ f(int, RSA_generate_key_ex, \
+ (RSA* rsa, int bits, BIGNUM* e, BN_GENCB* cb), \
+ (rsa, bits, e, cb), 0) \
+ f(RSA*, RSA_new, (void), (), NULL) \
+ f(int, RSA_private_decrypt, \
+ (int flen, const unsigned char* from, unsigned char* to, RSA* rsa, \
+ int padding), (flen, from, to, rsa, padding), 0) \
+ f(int, RSA_private_encrypt, \
+ (int flen, const unsigned char* from, unsigned char* to, RSA* rsa, \
+ int padding), (flen, from, to, rsa, padding), 0) \
+ f(int, RSA_public_decrypt, \
+ (int flen, const unsigned char* from, unsigned char* to, RSA* rsa, \
+ int padding), (flen, from, to, rsa, padding), 0) \
+ f(int, RSA_public_encrypt, \
+ (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, \
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/test/Makefile
^
|
@@ -0,0 +1,8 @@
+# -*- Mode: makefile-gmake -*-
+
+all:
+%:
+ @$(MAKE) -C TestHarbourBase32 $*
+ @$(MAKE) -C TestHarbourBase45 $*
+ @$(MAKE) -C TestHarbourProtoBuf $*
+ @$(MAKE) -C TestHarbourUtil $*
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/test/Makefile.common
^
|
@@ -0,0 +1,197 @@
+# -*- Mode: makefile-gmake -*-
+
+.PHONY: clean all debug release coverage
+
+#
+# Real test makefile defines EXE (and possibly SRC) and includes this one.
+#
+
+ifndef EXE
+${error EXE not defined}
+endif
+
+SRC ?= $(EXE).cpp
+
+#
+# Required packages
+#
+
+PKGS += Qt5Core glib-2.0
+
+#
+# Default target
+#
+
+all: debug release
+
+#
+# Directories
+#
+
+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
+COVERAGE_BUILD_DIR = $(BUILD_DIR)/coverage
+
+#
+# Tools and flags
+#
+
+CC = $(CROSS_COMPILE)gcc
+LD = $(CC)
+MOC = qtchooser -run-tool=moc -qt=5
+WARNINGS = -Wall
+INCLUDES = -I$(BUILD_DIR) -I$(HARBOUR_INCLUDE_DIR)
+BASE_FLAGS = -fPIC
+BASE_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS)
+BASE_CFLAGS = $(BASE_FLAGS) $(CFLAGS)
+FULL_CFLAGS = $(BASE_CFLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) -MMD -MP \
+ $(shell pkg-config --cflags $(PKGS))
+FULL_LDFLAGS = $(BASE_LDFLAGS)
+LIBS = $(shell pkg-config --libs $(PKGS)) -lstdc++
+QUIET_MAKE = make --no-print-directory
+DEBUG_FLAGS = -g
+RELEASE_FLAGS =
+COVERAGE_FLAGS = -g
+
+DEBUG_LDFLAGS = $(FULL_LDFLAGS) $(DEBUG_FLAGS)
+RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
+COVERAGE_LDFLAGS = $(FULL_LDFLAGS) $(COVERAGE_FLAGS) --coverage
+
+DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG -DHARBOUR_DEBUG
+RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
+COVERAGE_CFLAGS = $(FULL_CFLAGS) $(COVERAGE_FLAGS) --coverage
+
+#
+# Files
+#
+
+DEBUG_OBJS = \
+ $(MOC_H:%.h=$(DEBUG_BUILD_DIR)/moc_h_%.o) \
+ $(MOC_CPP:%.cpp=$(DEBUG_BUILD_DIR)/moc_cpp_%.o) \
+ $(SRC:%.cpp=$(DEBUG_BUILD_DIR)/%.o) \
+ $(HARBOUR_SRC:%.cpp=$(DEBUG_BUILD_DIR)/harbour_%.o)
+RELEASE_OBJS = \
+ $(MOC_H:%.h=$(RELEASE_BUILD_DIR)/moc_h_%.o) \
+ $(MOC_CPP:%.cpp=$(RELEASE_BUILD_DIR)/moc_cpp_%.o) \
+ $(SRC:%.cpp=$(RELEASE_BUILD_DIR)/%.o) \
+ $(HARBOUR_SRC:%.cpp=$(RELEASE_BUILD_DIR)/harbour_%.o)
+COVERAGE_OBJS = \
+ $(MOC_H:%.h=$(COVERAGE_BUILD_DIR)/moc_h_%.o) \
+ $(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
+#
+
+DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d) $(COVERAGE_OBJS:%.o=%.d)
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(strip $(DEPS)),)
+-include $(DEPS)
+endif
+endif
+
+$(GEN_FILES): | $(BUILD_DIR)
+$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
+$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
+$(COVERAGE_OBJS): | $(COVERAGE_BUILD_DIR)
+
+#
+# Rules
+#
+
+DEBUG_EXE = $(DEBUG_BUILD_DIR)/$(EXE)
+RELEASE_EXE = $(RELEASE_BUILD_DIR)/$(EXE)
+COVERAGE_EXE = $(COVERAGE_BUILD_DIR)/$(EXE)
+
+debug: $(DEBUG_EXE)
+
+release: $(RELEASE_EXE)
+
+coverage: $(COVERAGE_EXE)
+
+clean:
+ rm -f *~
+ rm -fr $(BUILD_DIR)
+
+test_banner:
+ @echo "===========" $(EXE) "=========== "
+
+test: test_banner debug
+ @$(DEBUG_EXE)
+
+valgrind: test_banner debug
+ @G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --leak-check=full --show-possibly-lost=no $(DEBUG_EXE)
+
+$(BUILD_DIR):
+ mkdir -p $@
+
+$(DEBUG_BUILD_DIR):
+ mkdir -p $@
+
+$(RELEASE_BUILD_DIR):
+ mkdir -p $@
+
+$(COVERAGE_BUILD_DIR):
+ mkdir -p $@
+
+$(BUILD_DIR)/moc_%.cpp : $(HARBOUR_INCLUDE_DIR)/%.h
+ $(MOC) $< -o $@
+
+$(BUILD_DIR)/%.moc : $(HARBOUR_SRC_DIR)/%.cpp
+ $(MOC) $< -o $@
+
+$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
+ $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
+ $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(COVERAGE_BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(DEBUG_BUILD_DIR)/moc_h_%.o : $(BUILD_DIR)/moc_%.cpp $(BUILD_DIR)
+ $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(RELEASE_BUILD_DIR)/moc_h_%.o : $(BUILD_DIR)/moc_%.cpp $(BUILD_DIR)
+ $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(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_SRC_DIR)/%.cpp $(BUILD_DIR)/%.moc
+ $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(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_SRC_DIR)/%.cpp $(BUILD_DIR)/%.moc
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(DEBUG_BUILD_DIR)/harbour_%.o : $(HARBOUR_SRC_DIR)/%.cpp
+ $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(RELEASE_BUILD_DIR)/harbour_%.o : $(HARBOUR_SRC_DIR)/%.cpp
+ $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(COVERAGE_BUILD_DIR)/harbour_%.o : $(HARBOUR_SRC_DIR)/%.cpp
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(DEBUG_EXE): $(DEBUG_OBJS)
+ $(LD) $(DEBUG_LDFLAGS) $^ $(LIBS) -o $@
+
+$(RELEASE_EXE): $(RELEASE_OBJS)
+ $(LD) $(RELEASE_LDFLAGS) $^ $(LIBS) -o $@
+
+$(COVERAGE_EXE): $(COVERAGE_OBJS)
+ $(LD) $(COVERAGE_LDFLAGS) $^ $(LIBS) -o $@
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/test/TestHarbourBase32/Makefile
^
|
(renamed from qmlplugin/harbour-lib/test/TestHarbourBase32/Makefile)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/test/TestHarbourBase32/TestHarbourBase32.cpp
^
|
(renamed from qmlplugin/harbour-lib/test/TestHarbourBase32/TestHarbourBase32.cpp)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/test/TestHarbourBase45/Makefile
^
|
(renamed from qmlplugin/harbour-lib/test/TestHarbourBase45/Makefile)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/test/TestHarbourBase45/TestHarbourBase45.cpp
^
|
(renamed from qmlplugin/harbour-lib/test/TestHarbourBase45/TestHarbourBase45.cpp)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/test/TestHarbourProtoBuf/Makefile
^
|
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake -*-
+
+PKGS = libglibutil
+EXE = TestHarbourProtoBuf
+HARBOUR_SRC = HarbourProtoBuf.cpp
+
+include ../Makefile.common
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/test/TestHarbourProtoBuf/TestHarbourProtoBuf.cpp
^
|
@@ -0,0 +1,168 @@
+/*
+ * 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 "HarbourProtoBuf.h"
+
+#include <glib.h>
+
+/*==========================================================================*
+ * null
+ *==========================================================================*/
+
+static
+void
+test_null(
+ void)
+{
+ g_assert(!HarbourProtoBuf::appendVarInt(NULL, 0));
+ g_assert(!HarbourProtoBuf::appendVarIntKeyValue(NULL, 0, 0));
+ g_assert(!HarbourProtoBuf::appendDelimitedValue(NULL, QByteArray()));
+ g_assert(!HarbourProtoBuf::appendDelimitedKeyValue(NULL,
+ HarbourProtoBuf::TYPE_DELIMITED, QByteArray()));
+ g_assert(!HarbourProtoBuf::parseVarInt(NULL, NULL));
+ g_assert(!HarbourProtoBuf::parseDelimitedValue(NULL, NULL));
+}
+
+/*==========================================================================*
+ * int
+ *==========================================================================*/
+
+static
+void
+test_int(
+ void)
+{
+ QByteArray buf;
+ GUtilRange range;
+ quint64 res;
+
+ static const guint8 enc0[] = { 0 };
+
+ g_assert(HarbourProtoBuf::appendVarInt(&buf, 0) == &buf);
+ g_assert(buf == QByteArray::fromRawData((char*)enc0, sizeof(enc0)));
+
+ range.end = (range.ptr = enc0);
+ g_assert(!HarbourProtoBuf::parseVarInt(&range, NULL));
+ range.end = (range.ptr = enc0);
+
+ res = 42;
+ g_assert(!HarbourProtoBuf::parseVarInt(&range, &res));
+ g_assert_cmpuint(res, == ,0);
+
+ range.end = (range.ptr = enc0) + sizeof(enc0);
+ g_assert(HarbourProtoBuf::parseVarInt(&range, NULL));
+ g_assert(range.ptr == range.end);
+
+ res = 42;
+ range.end = (range.ptr = enc0) + sizeof(enc0);
+ g_assert(HarbourProtoBuf::parseVarInt(&range, &res));
+ g_assert_cmpuint(res, == ,0);
+
+ static const guint8 enc257[] = { 0x82, 0x01 };
+
+ buf.clear();
+ g_assert(HarbourProtoBuf::appendVarInt(&buf, 257) == &buf);
+ g_assert(buf == QByteArray::fromRawData((char*)enc257, sizeof(enc257)));
+
+ res = 42;
+ range.end = (range.ptr = enc257) + 1;
+ g_assert(!HarbourProtoBuf::parseVarInt(&range, &res));
+ g_assert_cmpuint(res, == ,0);
+
+ res = 42;
+ range.end = (range.ptr = enc257) + sizeof(enc257);
+ g_assert(HarbourProtoBuf::parseVarInt(&range, &res));
+ g_assert(range.ptr == range.end);
+ g_assert_cmpuint(res, == ,257);
+}
+
+/*==========================================================================*
+ * delimited
+ *==========================================================================*/
+
+static
+void
+test_delimited(
+ void)
+{
+ QByteArray buf;
+ GUtilRange range;
+ GUtilData payload;
+ static const guint8 value[] = { 0x01, 0x02 };
+ static const guint8 encodedValue[] = { 0x02, 0x01, 0x02 };
+
+ g_assert(HarbourProtoBuf::appendDelimitedValue(&buf,
+ QByteArray::fromRawData((char*)value, sizeof(value))) == &buf);
+ g_assert(buf == QByteArray::fromRawData((char*)encodedValue,
+ sizeof(encodedValue)));
+
+ range.end = (range.ptr = encodedValue);
+ g_assert(!HarbourProtoBuf::parseDelimitedValue(&range, NULL));
+ g_assert(range.ptr == encodedValue);
+
+ range.end = (range.ptr = encodedValue) + sizeof(encodedValue) - 1;
+ g_assert(!HarbourProtoBuf::parseDelimitedValue(&range, NULL));
+ g_assert(range.ptr == encodedValue);
+
+ range.end = (range.ptr = encodedValue) + sizeof(encodedValue);
+ g_assert(HarbourProtoBuf::parseDelimitedValue(&range, NULL));
+
+ memset(&payload, 0, sizeof(payload));
+ range.end = (range.ptr = encodedValue) + sizeof(encodedValue);
+ g_assert(HarbourProtoBuf::parseDelimitedValue(&range, &payload));
+ g_assert_cmpuint(payload.size, == ,sizeof(value));
+ g_assert(!memcmp(payload.bytes, value, sizeof(value)));
+}
+
+/*==========================================================================*
+ * Common
+ *==========================================================================*/
+
+#define TEST_(name) "/HarbourProtoBuf/" name
+
+int main(int argc, char* argv[])
+{
+ g_test_init(&argc, &argv, NULL);
+ g_test_add_func(TEST_("null"), test_null);
+ g_test_add_func(TEST_("int"), test_int);
+ g_test_add_func(TEST_("delimited"), test_delimited);
+ return g_test_run();
+}
+
+/*
+ * Local Variables:
+ * mode: C++
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.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:sailfish-qrshare-1.2.0.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));
+ const QByteArray out(HarbourUtil::toHexBytes(data, sizeof(data)));
+ g_assert_cmpstr(out.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:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/test/coverage/.gitignore
^
|
(renamed from qmlplugin/harbour-lib/test/coverage/.gitignore)
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/harbour-lib/test/coverage/run
^
|
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+# This script requires lcov, dirname
+#
+
+TESTS="\
+TestHarbourBase32 \
+TestHarbourBase45 \
+TestHarbourProtoBuf \
+TestHarbourUtil"
+
+function err() {
+ echo "*** ERROR!" $1
+ exit 1
+}
+
+# Check the required tools
+which lcov >> /dev/null || err "Please install lcov"
+which dirname >> /dev/null || err "Please install dirname"
+
+# LCOV 1.10 has branch coverage disabled per default
+# Previous versions didn't have the --rc option
+if [ ! -z "$(lcov --help | grep ' --rc ')" ] ; then
+ LCOV_OPT="--rc lcov_branch_coverage=1"
+ GENHTML_OPT="--branch-coverage"
+fi
+
+pushd `dirname $0` > /dev/null
+COV_DIR="$PWD"
+pushd .. > /dev/null
+TEST_DIR="$PWD"
+pushd .. > /dev/null
+TOP_DIR="$PWD"
+popd > /dev/null
+popd > /dev/null
+popd > /dev/null
+
+FULL_COV="$COV_DIR/full.gcov"
+APP_COV="$COV_DIR/app.gcov"
+
+make -C "$TEST_DIR" clean
+rm -f "$FULL_COV" "$APP_COV"
+TESTS_COV=
+
+for t in $TESTS ; do
+ pushd "$TEST_DIR/$t"
+ make -C "$TEST_DIR/$t" clean coverage || exit 1
+ build/coverage/$t || exit 1
+ TEST_COV="$TEST_DIR/$t/build/coverage/$t.cov"
+ lcov $LCOV_OPT -c -d build/coverage -o "$TEST_COV" || exit 1
+ TESTS_COV+="-a $TEST_COV "
+ popd
+done
+
+lcov $LCOV_OPT $TESTS_COV -o "$FULL_COV" || exit 1
+lcov $LCOV_OPT -e "$FULL_COV" "$TOP_DIR/src/*" -o "$APP_COV" || exit 1
+genhtml $GENHTML_OPT "$APP_COV" -t "HarbourLib" --output-directory "$COV_DIR/report" || exit 1
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/.gitignore
^
|
@@ -8,5 +8,7 @@
debian/aztec-tools
debian/files
debian/libaztec-dev
+debian/libaztec-dev.install
debian/libaztec
+debian/libaztec.install
debian/tmp
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/LICENSE
^
|
@@ -1,4 +1,4 @@
-Copyright (C) 2019-2020 by Slava Monich <slava@monich.com>
+Copyright (C) 2019-2022 by Slava Monich <slava@monich.com>
You may use this file under the terms of the BSD license as follows:
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/Makefile
^
|
@@ -24,7 +24,7 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
-VERSION_RELEASE = 6
+VERSION_RELEASE = 9
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
@@ -66,7 +66,7 @@
# Tools and flags
#
-CC = $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
LD = $(CC)
WARNINGS = -Wall -Wstrict-aliasing -Wunused-result
INCLUDES = -I$(INCLUDE_DIR)
@@ -74,15 +74,12 @@
FULL_CFLAGS = $(BASE_FLAGS) $(CFLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) \
-MMD -MP $(shell pkg-config --cflags $(PKGS))
FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -Wl,-soname,$(LIB_SONAME) \
- $(shell pkg-config --libs $(PKGS)) -lpthread
+ $(shell pkg-config --libs $(PKGS))
DEBUG_FLAGS = -g
RELEASE_FLAGS =
COVERAGE_FLAGS = -g
-ifndef KEEP_SYMBOLS
-KEEP_SYMBOLS = 0
-endif
-
+KEEP_SYMBOLS ?= 0
ifneq ($(KEEP_SYMBOLS),0)
RELEASE_FLAGS += -g
endif
@@ -140,8 +137,6 @@
coverage_lib: $(COVERAGE_LIB)
-pkgconfig: $(PKGCONFIG)
-
print_debug_so:
@echo $(DEBUG_SO)
@@ -176,6 +171,7 @@
rm -fr debian/libaztec debian/libaztec-dev debian/aztec-tools
rm -f documentation.list debian/files debian/*.substvars
rm -f debian/*.debhelper.log debian/*.debhelper debian/*~
+ rm -f debian/libaztec.install debian/libaztec-dev.install
make -C unit clean
make -C tools clean
@@ -226,22 +222,30 @@
$(AR) rc $@ $?
ranlib $@
-$(PKGCONFIG): $(LIB_NAME).pc.in Makefile
- sed -e 's/\[version\]/'$(PCVERSION)/g $< > $@
+# This one could be substituted with arch specific dir
+LIBDIR ?= /usr/lib
+ABS_LIBDIR := $(shell echo /$(LIBDIR) | sed -r 's|/+|/|g')
+
+pkgconfig: $(PKGCONFIG)
+
+$(PKGCONFIG): $(LIB_NAME).pc.in Makefile
+ sed -e 's|@version@|$(PCVERSION)|g' -e 's|@libdir@|$(ABS_LIBDIR)|g' $< > $@
+
+debian/%.install: debian/%.install.in
+ sed 's|@LIBDIR@|$(LIBDIR)|g' $< > $@
#
# Install
#
-INSTALL_PERM = 644
INSTALL = install
INSTALL_DIRS = $(INSTALL) -d
-INSTALL_FILES = $(INSTALL) -m $(INSTALL_PERM)
+INSTALL_FILES = $(INSTALL) -m 644
-INSTALL_LIB_DIR = $(DESTDIR)/usr/lib
+INSTALL_LIB_DIR = $(DESTDIR)$(ABS_LIBDIR)
INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/$(NAME)
-INSTALL_PKGCONFIG_DIR = $(DESTDIR)/usr/lib/pkgconfig
+INSTALL_PKGCONFIG_DIR = $(DESTDIR)$(ABS_LIBDIR)/pkgconfig
install: $(INSTALL_LIB_DIR)
$(INSTALL_FILES) $(RELEASE_SO) $(INSTALL_LIB_DIR)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/README.md
^
|
@@ -2,7 +2,9 @@
![icon](aztec.png)
-Library and command line tool for generating Aztec codes.
+Library and command line tools for generating Aztec codes.
+
+**aztec-png**
```console
Usage:
@@ -20,7 +22,25 @@
-f, --file=FILE Encode data from FILE
```
+**aztec-svg**
+
+```console
+ aztec-svg [OPTION?] [TEXT] SVG
+
+Generates Aztec symbol as an SVG file.
+
+Help Options:
+ -h, --help Show help options
+
+Application Options:
+ -p, --pixel=SIZE Pixel size [1px]
+ -c, --correction=PERCENT Error correction [23]
+ -b, --border=PIXELS Border around the symbol [1]
+ -f, --file=FILE Encode data from FILE
+
+```
Note that the special filename `-` can be used to specify standard
-input or standard output.
+input or standard output. If no text is provided on the command line,
+it's read from stdin.
-Library API is described [here](include/aztec_encode.h). Enjoy!
+The library API is described [here](include/aztec_encode.h). Enjoy!
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/debian/aztec-tools.install
^
|
@@ -1 +1,2 @@
debian/tmp/usr/bin/aztec-png usr/bin
+debian/tmp/usr/bin/aztec-svg usr/bin
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/debian/changelog
^
|
@@ -1,3 +1,24 @@
+libaztec (1.0.9) unstable; urgency=low
+
+ * Do not export internal symbols from the shared lib
+ * Read stdin if no text provided on the command line
+
+ -- Slava Monich <slava@monich.com> Sun, 27 Mar 2022 02:18:26 +0200
+
+libaztec (1.0.8) unstable; urgency=low
+
+ * Added aztec-svg tool
+
+ -- Slava Monich <slava@monich.com> Tue, 04 Jan 2022 05:15:30 +0200
+
+libaztec (1.0.7) unstable; urgency=low
+
+ * Avoid overlinking
+ * Drop unnecessary linkage
+ * Respect arch specific lib dir
+
+ -- Slava Monich <slava@monich.com> Sat, 23 May 2020 02:28:45 +0300
+
libaztec (1.0.6) unstable; urgency=low
* Yet another fix for SP and LF in PUNCT mode
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/debian/control
^
|
@@ -2,7 +2,7 @@
Section: libs
Priority: optional
Maintainer: Slava Monich <slava@monich.com>
-Build-Depends: debhelper (>= 7), libglib2.0-dev, libpng-dev
+Build-Depends: debhelper (>= 8.1.3), libglib2.0-dev, libpng-dev
Standards-Version: 3.8.4
Package: libaztec
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/debian/copyright
^
|
@@ -1,4 +1,4 @@
-Copyright (C) 2019-2020 by Slava Monich <slava@monich.com>
+Copyright (C) 2019-2022 by Slava Monich <slava@monich.com>
You may use this file under the terms of the BSD license as follows:
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/debian/libaztec-dev.install.in
^
|
@@ -0,0 +1,3 @@
+debian/tmp/@LIBDIR@/libaztec.so @LIBDIR@
+debian/tmp/@LIBDIR@/pkgconfig/libaztec.pc @LIBDIR@/pkgconfig
+debian/tmp/usr/include/* usr/include
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/debian/libaztec.install.in
^
|
@@ -0,0 +1 @@
+debian/tmp/@LIBDIR@/libaztec.so.* @LIBDIR@
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/debian/rules
^
|
@@ -4,12 +4,14 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
+LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+
override_dh_auto_build:
- dh_auto_build -- release pkgconfig
+ dh_auto_build -- LIBDIR=$(LIBDIR) release pkgconfig debian/libaztec.install debian/libaztec-dev.install
dh_auto_build -- -C tools release
override_dh_auto_install:
- dh_auto_install -- install-dev
+ dh_auto_install -- LIBDIR=$(LIBDIR) install-dev
dh_auto_install -- -C tools install
%:
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/libaztec.pc.in
^
|
@@ -1,10 +1,10 @@
name=aztec
-libdir=/usr/lib
+libdir=@libdir@
includedir=/usr/include
Name: libaztec
Description: Aztec encoding library
-Version: [version]
-Requires: glib-2.0
+Version: @version@
+Requires.private: glib-2.0
Libs: -L${libdir} -l${name}
Cflags: -I${includedir} -I${includedir}/aztec
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/rpm/libaztec.spec
^
|
@@ -1,11 +1,14 @@
Name: libaztec
-Version: 1.0.6
+
+Version: 1.0.9
Release: 0
Summary: Aztec encoder
Group: Development/Libraries
License: BSD
URL: https://github.com/monich/libaztec
Source: %{name}-%{version}.tar.bz2
+
+BuildRequires: pkgconfig
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(glib-2.0)
Requires(post): /sbin/ldconfig
@@ -17,7 +20,6 @@
%package devel
Summary: Development library for %{name}
Requires: %{name} = %{version}
-Requires: pkgconfig
%description devel
This package contains the development library for %{name}.
@@ -33,13 +35,13 @@
%setup -q
%build
-make KEEP_SYMBOLS=1 release pkgconfig
-make -C tools KEEP_SYMBOLS=1 release
+make LIBDIR=%{_libdir} KEEP_SYMBOLS=1 release pkgconfig
+make -C tools LIBDIR=%{_libdir} KEEP_SYMBOLS=1 release
%install
rm -rf %{buildroot}
-make install-dev DESTDIR=%{buildroot}
-make -C tools install DESTDIR=%{buildroot}
+make DESTDIR=%{buildroot} LIBDIR=%{_libdir} install-dev
+make DESTDIR=%{buildroot} LIBDIR=%{_libdir} -C tools install
%check
make test
@@ -61,3 +63,4 @@
%files -n aztec-tools
%defattr(-,root,root,-)
%{_bindir}/aztec-png
+%{_bindir}/aztec-svg
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/src/aztec_bits.h
^
|
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 by Slava Monich <slava@monich.com>
+ * Copyright (C) 2019-2022 by Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -45,51 +45,60 @@
AztecBits*
aztec_bits_new(
- void);
+ void)
+ G_GNUC_INTERNAL;
void
aztec_bits_free(
- AztecBits* bits);
+ AztecBits* bits)
+ G_GNUC_INTERNAL;
void
aztec_bits_reserve(
AztecBits* bits,
- guint count);
+ guint count)
+ G_GNUC_INTERNAL;
void
aztec_bits_clear(
- AztecBits* bits);
+ AztecBits* bits)
+ G_GNUC_INTERNAL;
void
aztec_bits_add(
AztecBits* bits,
guint32 value,
- guint nbits);
+ guint nbits)
+ G_GNUC_INTERNAL;
void
aztec_bits_add_inv(
AztecBits* bits,
guint32 value,
- guint nbits);
+ guint nbits)
+ G_GNUC_INTERNAL;
void
aztec_bits_set(
AztecBits* bits,
guint offset,
guint32 value,
- guint nbits);
+ guint nbits)
+ G_GNUC_INTERNAL;
guint
aztec_bits_get(
const AztecBits* bits,
guint offset,
- guint nbits);
+ guint nbits)
+ G_GNUC_INTERNAL;
guint
aztec_bits_get_inv(
const AztecBits* bits,
guint offset,
- guint nbits);
+ guint nbits)
+ G_GNUC_INTERNAL;
#endif /* AZTEC_BITS_H */
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/src/aztec_rs.h
^
|
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 by Slava Monich <slava@monich.com>
+ * Copyright (C) 2019-2022 by Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -46,7 +46,8 @@
const guint16* data,
guint data_count,
guint16* ecc,
- guint ecc_count);
+ guint ecc_count)
+ G_GNUC_INTERNAL;
#endif /* AZTEC_RS_H */
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/tools/Makefile
^
|
@@ -3,3 +3,4 @@
all:
%:
@$(MAKE) -C aztec-png $*
+ @$(MAKE) -C aztec-svg $*
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/tools/aztec-png/Makefile
^
|
@@ -7,13 +7,13 @@
#
EXE = aztec-png
-SRC = main.c
+SRC = $(EXE).c
#
# Required packages
#
-PKGS += libpng gobject-2.0 glib-2.0
+PKGS += libpng glib-2.0
#
# Default target
@@ -38,7 +38,7 @@
CC = $(CROSS_COMPILE)gcc
LD = $(CC)
WARNINGS = -Wall
-INCLUDES = -I$(LIB_DIR)/include -I$(LIB_DIR)/src
+INCLUDES = -I$(LIB_DIR)/include
BASE_FLAGS = -fPIC
BASE_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS)
BASE_CFLAGS = $(BASE_FLAGS) $(CFLAGS)
@@ -137,10 +137,10 @@
endif
debug_lib:
- @make $(SUBMAKE_OPTS) -C $(LIB_DIR) debug_lib
+ @$(MAKE) $(SUBMAKE_OPTS) -C $(LIB_DIR) debug_lib
release_lib:
- @make $(SUBMAKE_OPTS) -C $(LIB_DIR) release_lib
+ @$(MAKE) $(SUBMAKE_OPTS) -C $(LIB_DIR) release_lib
#
# Install
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/tools/aztec-png/aztec-png.c
^
|
@@ -0,0 +1,292 @@
+/*
+ * Copyright (C) 2019-2022 by 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
+ * 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.
+ *
+ * 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 "aztec_encode.h"
+
+#include <png.h>
+#include <errno.h>
+#include <stdio.h>
+#include <setjmp.h>
+#include <string.h>
+
+#define RET_OK 0
+#define RET_ERR 1
+#define RET_CMDLINE 2
+
+static
+G_GNUC_PRINTF(1,2)
+void
+errmsg(
+ const char* format,
+ ...)
+{
+ va_list va;
+
+ va_start(va, format);
+ vfprintf(stderr, format, va);
+ va_end(va);
+}
+
+static
+void
+save_error(
+ png_structp png,
+ png_const_charp msg)
+{
+ jmp_buf* jmp = png_get_error_ptr(png);
+
+ errmsg("%s", msg);
+ longjmp(*jmp, 1);
+}
+
+static
+int
+save_symbol(
+ AztecSymbol* symbol,
+ int scale,
+ int border,
+ FILE* out)
+{
+ int ret = RET_ERR;
+ const int bs = border * scale;
+ const int n = symbol->size * scale;
+ const int n2 = n + 2 * bs;
+ const int rowsize = (n2 + 7) / 8;
+ jmp_buf jmp;
+ png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, &jmp,
+ save_error, NULL);
+
+ if (png) {
+ png_infop info = png_create_info_struct(png);
+
+ if (info) {
+ guint8* row = g_malloc(rowsize);
+
+ if (!setjmp(jmp)) {
+ guint i;
+
+ png_init_io(png, out);
+ png_set_filter(png, 0, PNG_FILTER_NONE);
+ png_set_IHDR(png, info, n2, n2, 1, PNG_COLOR_TYPE_GRAY,
+ PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
+ PNG_FILTER_TYPE_DEFAULT);
+ png_set_invert_mono(png); /* 1 is black */
+ png_write_info(png, info);
+
+ /* Top border */
+ memset(row, 0, rowsize);
+ for (i = 0; i < bs; i++) {
+ png_write_row(png, (png_bytep)row);
+ }
+
+ /*
+ * Transform the rows (scale and add borders) and at the
+ * same time swap the bit order. In PNG most significant
+ * bit codes the left-most pixel.
+ */
+ for (i = 0; i < symbol->size; i++) {
+ guint8* dest = row;
+ guint8* end = dest + rowsize;
+ const guint8* ptr = symbol->rows[i];
+ int k, j, d = bs % 8;
+
+ memset(row, 0, rowsize);
+ dest += bs / 8;
+ for (k = 0; k < symbol->size; k += 8) {
+ guint8 byte = *ptr++;
+ int b;
+
+ for (b = 0; b < 8 && dest < end; b++, byte >>= 1) {
+ const int bit = (byte & 1);
+
+ for (j = 0; j < scale && dest < end; j++) {
+ *dest <<= 1;
+ *dest |= bit;
+ if ((d++) == 7) {
+ d = 0;
+ dest++;
+ }
+ }
+ }
+ }
+ for (j = 0; j < scale; j++) {
+ png_write_row(png, (png_bytep)row);
+ }
+ }
+
+ /* Bottom border */
+ memset(row, 0, rowsize);
+ for (i = 0; i < bs; i++) {
+ png_write_row(png, (png_bytep)row);
+ }
+ png_write_end(png, info);
+ ret = RET_OK;
+ }
+ png_destroy_write_struct(&png, &info);
+ g_free(row);
+ }
+ }
+ return ret;
+}
+
+int
+main(
+ int argc,
+ char* argv[])
+{
+ int ret = RET_ERR;
+ int scale = 1;
+ int errcorr = AZTEC_CORRECTION_DEFAULT;
+ int border = 1;
+ const char* file = NULL;
+ gboolean ok;
+ GError* error = NULL;
+ GOptionContext* options;
+ GOptionEntry entries[] = {
+ { "scale", 's', 0, G_OPTION_ARG_INT, &scale,
+ "Scale factor [1]", "SCALE" },
+ { "correction", 'c', 0, G_OPTION_ARG_INT, &errcorr,
+ "Error correction [23]", "PERCENT" },
+ { "border", 'b', 0, G_OPTION_ARG_INT, &border,
+ "Border around the symbol [1]", "PIXELS" },
+ { "file", 'f', 0, G_OPTION_ARG_FILENAME, &file,
+ "Encode data from FILE", "FILE" },
+ { NULL }
+ };
+
+ options = g_option_context_new("[TEXT] PNG");
+ g_option_context_add_main_entries(options, entries, NULL);
+ g_option_context_set_summary(options,
+ "Generates Aztec symbol as a PNG file.\n\n"
+ "If no text is provided on the command line, "
+ "reads the standard input.");
+ ok = g_option_context_parse(options, &argc, &argv, &error);
+
+ if (ok && scale > 0 && border >= 0 && (argc == 2 || (argc == 3 && !file))) {
+ const char* png = argv[argc - 1];
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/tools/aztec-svg/Makefile
^
|
@@ -0,0 +1,158 @@
+# -*- Mode: makefile-gmake -*-
+
+.PHONY: clean all debug release debug_lib release_lib
+
+#
+# Sources
+#
+
+EXE = aztec-svg
+SRC = $(EXE).c
+
+#
+# Required packages
+#
+
+PKGS += libpng glib-2.0
+
+#
+# Default target
+#
+
+all: debug release
+
+#
+# Directories
+#
+
+SRC_DIR = .
+LIB_DIR = ../..
+BUILD_DIR = build
+DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
+RELEASE_BUILD_DIR = $(BUILD_DIR)/release
+
+#
+# Tools and flags
+#
+
+CC = $(CROSS_COMPILE)gcc
+LD = $(CC)
+WARNINGS = -Wall
+INCLUDES = -I$(LIB_DIR)/include
+BASE_FLAGS = -fPIC
+BASE_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS)
+BASE_CFLAGS = $(BASE_FLAGS) $(CFLAGS)
+FULL_CFLAGS = $(BASE_CFLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) -MMD -MP \
+ $(shell pkg-config --cflags $(PKGS))
+FULL_LDFLAGS = $(BASE_LDFLAGS)
+LIBS = $(shell pkg-config --libs $(PKGS))
+QUIET_MAKE = make --no-print-directory
+DEBUG_FLAGS = -g
+RELEASE_FLAGS =
+
+ifndef KEEP_SYMBOLS
+KEEP_SYMBOLS = 0
+endif
+
+ifneq ($(KEEP_SYMBOLS),0)
+RELEASE_FLAGS += -g
+SUBMAKE_OPTS += KEEP_SYMBOLS=1
+endif
+
+DEBUG_LDFLAGS = $(FULL_LDFLAGS) $(DEBUG_FLAGS)
+RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
+
+DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG
+RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
+
+#
+# Files
+#
+
+DEBUG_OBJS = $(SRC:%.c=$(DEBUG_BUILD_DIR)/%.o)
+RELEASE_OBJS = $(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
+
+DEBUG_LIB_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_debug_lib)
+RELEASE_LIB_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_release_lib)
+
+DEBUG_LIB := $(LIB_DIR)/$(DEBUG_LIB_FILE)
+RELEASE_LIB := $(LIB_DIR)/$(RELEASE_LIB_FILE)
+
+#
+# Dependencies
+#
+
+DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d)
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(strip $(DEPS)),)
+-include $(DEPS)
+endif
+endif
+
+$(DEBUG_LIB): | debug_lib
+$(RELEASE_LIB): | release_lib
+
+$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
+$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
+
+#
+# Rules
+#
+
+DEBUG_EXE = $(DEBUG_BUILD_DIR)/$(EXE)
+RELEASE_EXE = $(RELEASE_BUILD_DIR)/$(EXE)
+
+debug: debug_lib $(DEBUG_EXE)
+
+release: release_lib $(RELEASE_EXE)
+
+unitclean:
+ rm -f *~
+ rm -fr $(BUILD_DIR)
+
+clean: unitclean
+
+cleaner: clean
+ @make -C $(LIB_DIR) clean
+
+$(DEBUG_BUILD_DIR):
+ mkdir -p $@
+
+$(RELEASE_BUILD_DIR):
+ mkdir -p $@
+
+$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
+ $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
+ $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(DEBUG_EXE): $(DEBUG_LIB) $(DEBUG_BUILD_DIR) $(DEBUG_OBJS)
+ $(LD) $(DEBUG_LDFLAGS) $(DEBUG_OBJS) $< $(LIBS) -o $@
+
+$(RELEASE_EXE): $(RELEASE_LIB) $(RELEASE_BUILD_DIR) $(RELEASE_OBJS)
+ $(LD) $(RELEASE_LDFLAGS) $(RELEASE_OBJS) $< $(LIBS) -o $@
+ifeq ($(KEEP_SYMBOLS),0)
+ strip $@
+endif
+
+debug_lib:
+ @$(MAKE) $(SUBMAKE_OPTS) -C $(LIB_DIR) debug_lib
+
+release_lib:
+ @$(MAKE) $(SUBMAKE_OPTS) -C $(LIB_DIR) release_lib
+
+#
+# Install
+#
+
+INSTALL = install
+INSTALL_DIRS = $(INSTALL) -d
+INSTALL_FILES = $(INSTALL) -m 755
+INSTALL_BIN_DIR = $(DESTDIR)/usr/bin
+
+install: $(INSTALL_BIN_DIR)
+ $(INSTALL_FILES) $(RELEASE_EXE) $(INSTALL_BIN_DIR)
+
+$(INSTALL_BIN_DIR):
+ $(INSTALL_DIRS) $@
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/tools/aztec-svg/aztec-svg.c
^
|
@@ -0,0 +1,359 @@
+/*
+ * Copyright (C) 2022 by 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
+ * 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.
+ *
+ * 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 "aztec_encode.h"
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define RET_OK 0
+#define RET_ERR 1
+#define RET_CMDLINE 2
+
+#define SVG_UNITS(u) \
+ u(EM,em) u(EX,ex) u(PX,px) u(PT,pt) u(PC,pc) u(CM,cm) u(MM,mm) u(IN,in)
+
+typedef enum svg_unit {
+ #define SVG_UNIT_(U,u) SVG_UNIT_##U,
+ SVG_UNITS(SVG_UNIT_)
+ #undef SVG_UNIT_
+ SVG_UNIT_COUNT
+} SVG_UNIT;
+
+#define DEFAULT_UNIT_NAME "px"
+#define DEFAULT_UNIT SVG_UNIT_PX
+static const char* svg_units[SVG_UNIT_COUNT] = {
+ #define SVG_UNIT_(U,u) #u,
+ SVG_UNITS(SVG_UNIT_)
+ #undef SVG_UNIT_
+};
+
+typedef struct svg_size {
+ double size;
+ SVG_UNIT unit;
+} SvgSize;
+
+typedef struct app_options {
+ SvgSize pixel;
+ int border;
+} AppOptions;
+
+static
+G_GNUC_PRINTF(1,2)
+void
+errmsg(
+ const char* format,
+ ...)
+{
+ va_list va;
+ va_start(va, format);
+ vfprintf(stderr, format, va);
+ va_end(va);
+}
+
+static
+void
+options_init(
+ AppOptions* opts)
+{
+ memset(opts, 0, sizeof(*opts));
+ opts->pixel.size = 1;
+ opts->pixel.unit = DEFAULT_UNIT;
+ opts->border = 1;
+}
+
+static
+int
+save_symbol(
+ const AztecSymbol* sym,
+ const AppOptions* opts,
+ FILE* out)
+{
+ const double size = (sym->size + 2 * opts->border) * opts->pixel.size;
+ const char* unit = (opts->pixel.unit == SVG_UNIT_PX) ? "" :
+ svg_units[opts->pixel.unit];
+ const char* bgcolor = "#ffffff";
+ const char* fgcolor = "#000000";
+ const char* indent = " ";
+ gboolean** rows = g_new(gboolean*, sym->size);
+ gboolean* pixels = g_new(gboolean, sym->size * sym->size);
+ guint i, j;
+
+ /* Unpack the pixels for convenience */
+ for (i = 0; i < sym->size; i++) {
+ const guint8* ptr = sym->rows[i];
+ gboolean* row = pixels + i * sym->size;
+ guint k = 0;
+
+ rows[i] = row;
+ while (k < sym->size) {
+ guint byte = *ptr++;
+
+ for (j = 0; j < 8 && k < sym->size; k++, j++, byte >>= 1) {
+ row[k] = (byte & 1);
+ }
+ }
+ }
+
+ fputs("<?xml version=\"1.0\" standalone=\"no\"?>\n", out);
+ fprintf(out, "<svg version=\"1.1\" "
+ "width=\"%g%s\" height=\"%g%s\" "
+ "viewBox=\"0 0 %g %g\" "
+ "xmlns=\"http://www.w3.org/2000/svg\">\n",
+ size, unit, size, unit, size, size);
+
+ /* Background */
+ fprintf(out, "%s<rect x=\"0\" y=\"0\" "
+ "width=\"%g\" height=\"%g\" "
+ "style=\"fill:%s;fill-opacity:1\"/>\n",
+ indent, size, size, bgcolor);
+
+ /* Symbol */
+ fprintf(out, "%s<g style=\"fill:%s;fill-opacity:1\">\n", indent, fgcolor);
+ for (i = 0; i < sym->size; i++) {
+ const gboolean* row = rows[i];
+ const double y = opts->pixel.size * (i + opts->border);
+
+ for (j = 0; j < sym->size; j++) {
+ const double x = opts->pixel.size * (j + opts->border);
+
+ if (row[j]) {
+ fprintf(out, "%s%s<rect x=\"%g\" y=\"%g\" "
+ "width=\"%g\" height=\"%g\"/>\n",
+ indent, indent, x, y,
+ opts->pixel.size, opts->pixel.size);
+ }
+ }
+ }
+
+ g_free(rows);
+ g_free(pixels);
+ fprintf(out, "%s</g>\n</svg>\n", indent);
+ return ferror(out) ? RET_ERR : RET_OK;
+}
+
+static
+gboolean
+parse_svg_size(
+ const char* in,
+ SvgSize* out,
+ GError** error)
+{
+ char* str = g_strstrip(g_strdup(in));
+ char* end = NULL;
+ SVG_UNIT u, unit = DEFAULT_UNIT;
+ gsize len = strlen(str);
+ double value;
+ gboolean ok;
+
+ /* Parse the units */
+ for (u = 0; u < SVG_UNIT_COUNT; u++) {
+ const char* uname = svg_units[u];
+ const gsize ulen = strlen(uname);
+
+ if (len >= ulen && !g_ascii_strcasecmp(str + (len - ulen), uname)) {
+ str[len - ulen] = 0;
+ g_strchomp(str);
+ unit = u;
+ break;
+ }
+ }
+
+ /* And the number */
+ value = strtod(str, &end);
+ if (end && !end[0] && value > 0) {
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/libaztec/unit/common/Makefile
^
|
@@ -16,7 +16,7 @@
# Required packages
#
-PKGS += gobject-2.0 glib-2.0
+PKGS += glib-2.0
#
# Default target
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/qmlplugin/qmlplugin.pro
^
|
@@ -19,13 +19,13 @@
QRSHARE_TRANSLATIONS_DIR=\\\"$$QRSHARE_TRANSLATIONS_DIR\\\"
# Directories
-HARBOUR_LIB_DIR = $${_PRO_FILE_PWD_}/harbour-lib
+HARBOUR_LIB_DIR = ../harbour-lib
HARBOUR_LIB_INCLUDE = $${HARBOUR_LIB_DIR}/include
HARBOUR_LIB_SRC = $${HARBOUR_LIB_DIR}/src
-LIBAZTEC_LIB_DIR = $${_PRO_FILE_PWD_}/libaztec
+LIBAZTEC_LIB_DIR = libaztec
LIBAZTEC_LIB_INCLUDE = $${LIBAZTEC_LIB_DIR}/include
LIBAZTEC_LIB_SRC = $${LIBAZTEC_LIB_DIR}/src
-LIBQRENCODE_DIR = $${_PRO_FILE_PWD_}/libqrencode
+LIBQRENCODE_DIR = libqrencode
# Libraries
LIBS += libqrencode.a
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/sailfish-qrshare.pro
^
|
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
-SUBDIRS = qmlplugin shareplugin qrencode mkicon
+SUBDIRS = qmlplugin shareplugin shareplugin2 qrencode mkicon
qmlplugin.depends = qrencode-target
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/shareplugin/qrshare.h
^
|
(renamed from shareplugin/src/qrshare.h)
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/shareplugin/shareplugin.pro
^
|
@@ -1,16 +1,20 @@
TEMPLATE = lib
TARGET = qrshareplugin
CONFIG += plugin link_pkgconfig
-PKGCONFIG += nemotransferengine-qt5
include(../config.pri)
+HARBOUR_LIB_DIR = ../harbour-lib
+HARBOUR_LIB_INCLUDE = $${HARBOUR_LIB_DIR}/include
+HARBOUR_LIB_SRC = $${HARBOUR_LIB_DIR}/src
+
QMAKE_CXXFLAGS += -Wno-unused-parameter -fvisibility=hidden
QMAKE_CFLAGS += -fvisibility=hidden
QMAKE_LFLAGS += -fvisibility=hidden
INCLUDEPATH += \
- transferengine
+ transferengine \
+ $${HARBOUR_LIB_INCLUDE}
DEFINES += \
QRSHARE_UI_DIR=\\\"$$QRSHARE_UI_DIR\\\" \
@@ -28,7 +32,13 @@
transferengine/transferplugininterface.h
HEADERS += \
- src/qrshare.h \
+ $${HARBOUR_LIB_INCLUDE}/HarbourSystemInfo.h
+
+SOURCES += \
+ $${HARBOUR_LIB_SRC}/HarbourSystemInfo.cpp
+
+HEADERS += \
+ qrshare.h \
src/qrshareplugin.h \
src/qrshareplugininfo.h \
src/qrsharetransfer.h
|
[-]
[+]
|
Changed |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/shareplugin/src/qrshareplugin.cpp
^
|
@@ -1,34 +1,40 @@
/*
* Copyright (C) 2019-2021 Jolla Ltd.
- * Copyright (C) 2019-2021 Slava Monich <slava@monich.com>
+ * Copyright (C) 2019-2024 Slava Monich <slava@monich.com>
*
- * You may use this file under the terms of BSD license as follows:
+ * 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.
+ * 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 "qrshare.h"
@@ -36,69 +42,12 @@
#include "qrsharetransfer.h"
#include "qrshareplugininfo.h"
+#include "HarbourSystemInfo.h"
+#include "HarbourDebug.h"
+
#include <QCoreApplication>
#include <QTranslator>
#include <QLocale>
-#include <QDebug>
-
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-static QVector<uint> getPackageVersion(const char* aPackage)
-{
- QVector<uint> version;
- int fds[2];
- if (pipe(fds) == 0) {
- pid_t pid = fork();
- if (!pid) {
- const char* argv[6];
- argv[0] = "rpm";
- argv[1] = "-q";
- argv[2] = "--qf";
- argv[3] = "%{version}";
- argv[4] = aPackage;
- argv[5] = NULL;
- while ((dup2(fds[1], STDOUT_FILENO) == -1) && (errno == EINTR));
- execvp(argv[0], (char**)argv);
- exit(1);
- }
- close(fds[1]);
-
- // There shouldn't be much output
- QByteArray out;
- const int chunk = 16;
- ssize_t n = 0;
- do {
- const int size = out.size();
- out.resize(size + chunk);
- while ((n = read(fds[0], out.data() + size, chunk)) == -1 && (errno == EINTR));
- out.resize(size + qMax(n, (ssize_t)0));
- } while (n > 0);
-
- // Parse the version
- if (out.size() > 0) {
- const char* v = out.constData();
- qDebug() << aPackage << v;
- const QStringList parts(QString(v).split('.', QString::SkipEmptyParts));
- const int n = qMin(parts.count(),3);
- for (int i = 0; i < n; i++) {
- const QString part(parts.at(i));
- bool ok = false;
- int val = part.toUInt(&ok);
- if (ok) {
- version.append(val);
- } else {
- break;
- }
- }
- }
- waitpid(pid, NULL, 0);
- close(fds[0]);
- }
- return version;
-}
QRSharePlugin::QRSharePlugin() :
iCreatePluginInfoFunc(QRShareCreatePluginInfo2OutOfProcess)
@@ -113,22 +62,22 @@
tr->load(QLocale("en"), filename, prefix, directory, suffix)) {
qApp->installTranslator(tr);
} else {
- qWarning() << "Failed to load QR Share translations "
- QRSHARE_TRANSLATIONS_DIR "/" QRSHARE_TRANSLATIONS_FILE "*.qm";
+ HWARN("Failed to load QR Share translations "
+ QRSHARE_TRANSLATIONS_DIR "/" QRSHARE_TRANSLATIONS_FILE "*.qm");
delete tr;
}
// Figure out which version of plugin API is expected from us
// Detect native transferengine plugin API break
- QVector<uint> v = getPackageVersion("nemo-transferengine-qt5");
+ QString v(HarbourSystemInfo::queryPackageVersion("nemo-transferengine-qt5"));
// API break at 0.2.0
- if (v.count() >= 2 && v.at(0) == 0 && v.at(1) < 2) {
+ if (HarbourSystemInfo::compareVersions(v, "0.2.0") < 0) {
iCreatePluginInfoFunc = QRShareCreatePluginInfo1;
} else {
// Detect QML API break
- v = getPackageVersion("declarative-transferengine-qt5");
+ v = HarbourSystemInfo::queryPackageVersion("declarative-transferengine-qt5");
// API break at 0.4.0
- if (v.count() >= 2 && v.at(0) == 0 && v.at(1) < 4) {
+ if (HarbourSystemInfo::compareVersions(v, "0.4.0") < 0) {
iCreatePluginInfoFunc = QRShareCreatePluginInfo2InProcess;
}
}
@@ -138,22 +87,26 @@
{
}
-MediaTransferInterface* QRSharePlugin::transferObject()
+MediaTransferInterface*
+QRSharePlugin::transferObject()
{
return new QRShareTransfer;
}
-TransferPluginInfo* QRSharePlugin::infoObject()
+TransferPluginInfo*
+QRSharePlugin::infoObject()
{
return iCreatePluginInfoFunc();
}
-QString QRSharePlugin::pluginId() const
+QString
+QRSharePlugin::pluginId() const
{
return QRSHARE_PLUGIN_ID;
}
-bool QRSharePlugin::enabled() const
+bool
+QRSharePlugin::enabled() const
{
return true;
}
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/shareplugin2/shareplugin2.pro
^
|
@@ -0,0 +1,38 @@
+TEMPLATE = lib
+TARGET = qrshareplugin2
+CONFIG += plugin link_pkgconfig
+
+include(../config.pri)
+
+HARBOUR_LIB_DIR = ../harbour-lib
+HARBOUR_LIB_INCLUDE = $${HARBOUR_LIB_DIR}/include
+HARBOUR_LIB_SRC = $${HARBOUR_LIB_DIR}/src
+
+QMAKE_CXXFLAGS += -Wno-unused-parameter -fvisibility=hidden
+QMAKE_CFLAGS += -fvisibility=hidden
+QMAKE_LFLAGS += -fvisibility=hidden
+
+INCLUDEPATH += \
+ ../shareplugin \
+ transferengine \
+ $${HARBOUR_LIB_INCLUDE}
+
+DEFINES += \
+ QRSHARE_UI_DIR=\\\"$$QRSHARE_UI_DIR\\\" \
+ QRSHARE_TRANSLATIONS_FILE=\\\"$$QRSHARE_TRANSLATIONS_FILE\\\" \
+ QRSHARE_TRANSLATIONS_DIR=\\\"$$QRSHARE_TRANSLATIONS_DIR\\\"
+
+CONFIG(debug, debug|release) {
+ DEFINES += DEBUG HARBOUR_DEBUG
+}
+
+OTHER_FILES += \
+ transferengine/sharingmethodinfo.h \
+ transferengine/sharingplugininfo.h \
+ transferengine/sharingplugininterface.h
+
+SOURCES += \
+ src/qrshareplugin2.cpp
+
+target.path = $$[QT_INSTALL_LIBS]/nemo-transferengine/plugins/sharing
+INSTALLS += target
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/shareplugin2/src/qrshareplugin2.cpp
^
|
@@ -0,0 +1,140 @@
+/*
+ * 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.
+ */
+
+#include "qrshare.h"
+#include "sharingplugininterface.h"
+
+#include "HarbourDebug.h"
+
+#include <QCoreApplication>
+#include <QTranslator>
+#include <QLocale>
+
+class Q_DECL_EXPORT QRSharePlugin2 :
+ public QObject,
+ public SharingPluginInterface
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "com.monich.qrshare.sharing.plugin")
+ Q_INTERFACES(SharingPluginInterface)
+ class PluginInfo;
+
+public:
+ QRSharePlugin2();
+ SharingPluginInfo* infoObject() Q_DECL_OVERRIDE;
+ QString pluginId() const Q_DECL_OVERRIDE;
+};
+
+//===========================================================================
+// QRSharePlugin2::PluginInfo
+//===========================================================================
+
+class QRSharePlugin2::PluginInfo :
+ public SharingPluginInfo
+{
+public:
+ PluginInfo();
+
+ QList<SharingMethodInfo> info() const Q_DECL_OVERRIDE;
+ void query() Q_DECL_OVERRIDE;
+
+private:
+ QList<SharingMethodInfo> iInfoList;
+};
+
+QRSharePlugin2::PluginInfo::PluginInfo()
+{
+ SharingMethodInfo info;
+
+ //: Plugin display name
+ //% "QR Share"
+ info.setDisplayName(qtTrId("qrshare-display_name"));
+ info.setMethodId(QRSHARE_PLUGIN_ID);
+ info.setMethodIcon(QRSHARE_ICON_SVG);
+ info.setShareUIPath(QRSHARE_ITEM_PATH);
+ info.setCapabilities(QStringList("text/*"));
+ iInfoList.append(info);
+}
+
+QList<SharingMethodInfo>
+QRSharePlugin2::PluginInfo::info() const
+{
+ return iInfoList;
+}
+
+void
+QRSharePlugin2::PluginInfo::query()
+{
+ Q_EMIT infoReady();
+}
+
+//===========================================================================
+// QRSharePlugin2
+//===========================================================================
+
+QRSharePlugin2::QRSharePlugin2()
+{
+ // Load translations
+ QTranslator* tr = new QTranslator(this);
+ const QString filename(QRSHARE_TRANSLATIONS_FILE);
+ const QString directory(QRSHARE_TRANSLATIONS_DIR);
+ const QString prefix("-");
+ const QString suffix(".qm");
+ if (tr->load(QLocale(), filename, prefix, directory, suffix) ||
+ tr->load(QLocale("en"), filename, prefix, directory, suffix)) {
+ qApp->installTranslator(tr);
+ } else {
+ HWARN("Failed to load QR Share translations "
+ QRSHARE_TRANSLATIONS_DIR "/" QRSHARE_TRANSLATIONS_FILE "*.qm");
+ delete tr;
+ }
+}
+
+SharingPluginInfo*
+QRSharePlugin2::infoObject()
+{
+ return new PluginInfo;
+}
+
+QString
+QRSharePlugin2::pluginId() const
+{
+ return QRSHARE_PLUGIN_ID;
+}
+
+#include "qrshareplugin2.moc"
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/shareplugin2/transferengine/sharingmethodinfo.h
^
|
@@ -0,0 +1,26 @@
+#ifndef SHARINGMETHODINFO_H
+#define SHARINGMETHODINFO_H
+
+#include <QStringList>
+
+class SharingMethodInfoPrivate;
+class SharingMethodInfo
+{
+public:
+ SharingMethodInfo();
+ SharingMethodInfo &operator=(const SharingMethodInfo&);
+ SharingMethodInfo(const SharingMethodInfo &other);
+ ~SharingMethodInfo();
+
+ void setDisplayName(const QString&);
+ void setMethodId(const QString&);
+ void setMethodIcon(const QString&);
+ void setShareUIPath(const QString&);
+ void setCapabilities(const QStringList&);
+
+private:
+ SharingMethodInfoPrivate* d_ptr;
+ Q_DECLARE_PRIVATE(SharingMethodInfo);
+};
+
+#endif // SHARINGMETHODINFO_H
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/shareplugin2/transferengine/sharingplugininfo.h
^
|
@@ -0,0 +1,24 @@
+#ifndef SHARINGPLUGININFO_H
+#define SHARINGPLUGININFO_H
+
+#include <QList>
+#include <QObject>
+#include <QString>
+
+#include "sharingmethodinfo.h"
+
+class SharingPluginInfo:
+ public QObject
+{
+ Q_OBJECT
+
+public:
+ virtual QList<SharingMethodInfo> info() const = 0;
+ virtual void query() = 0;
+
+Q_SIGNALS:
+ void infoReady();
+ void infoError(const QString&);
+};
+
+#endif // SHARINGPLUGININFO_H
|
[-]
[+]
|
Added |
_service:tar_git:sailfish-qrshare-1.2.0.tar.gz/shareplugin2/transferengine/sharingplugininterface.h
^
|
@@ -0,0 +1,17 @@
+#ifndef SHARINGPLUGININTERFACE_H
+#define SHARINGPLUGININTERFACE_H
+
+#include <QtPlugin>
+
+#include "sharingplugininfo.h"
+
+class SharingPluginInterface
+{
+public:
+ virtual SharingPluginInfo *infoObject() = 0;
+ virtual QString pluginId() const = 0;
+};
+
+Q_DECLARE_INTERFACE(SharingPluginInterface, "org.sailfishos.SharingPluginInterface/1.0")
+
+#endif // SHARINGPLUGININTERFACE_H
|