[-]
[+]
|
Changed |
_service:tar_git:harbour-aenigma.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-aenigma.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/black-sheep-dev/harbour-aenigma.git</param>
<param name="branch"></param>
- <param name="revision">72f8b66</param>
+ <param name="revision">76e0076</param>
<param name="debian">N</param>
<param name="dumb">N</param>
</service>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/.gitmodules
^
|
@@ -1,3 +1,6 @@
[submodule "extern/libaenigma"]
path = extern/libaenigma
url = https://github.com/black-sheep-dev/libaenigma.git
+[submodule "extern/harbour-lib"]
+ path = extern/harbour-lib
+ url = https://github.com/black-sheep-dev/harbour-lib.git
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib
^
|
+(directory)
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib.pri
^
|
@@ -0,0 +1,11 @@
+INCLUDEPATH += $$PWD/harbour-lib/include
+DEPENDPATH += $$PWD/harbour-lib
+
+SOURCES += \
+ $$PWD/harbour-lib/src/HarbourDisplayBlanking.cpp \
+ $$PWD/harbour-lib/src/HarbourMce.cpp
+
+HEADERS += \
+ $$PWD/harbour-lib/include/HarbourDisplayBlanking.h \
+ $$PWD/harbour-lib/src/HarbourMce.h
+
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/.gitignore
^
|
@@ -0,0 +1,2 @@
+harbour-lib.pro.user*
+build
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/LICENSE
^
|
@@ -0,0 +1,30 @@
+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.
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/README
^
|
@@ -0,0 +1,14 @@
+Reusable components for Jolla harbour apps
+==========================================
+
+Some of them allow to access undocumented Sailfish OS features, some
+provide compatibility with older releases of Sailfish OS. This code
+has been tested against Sailfish OS 2.0 meaning that most of it is
+probably incompatible with older versions.
+
+The easiest way to use this code in your project is to add this repo
+as a git submodule to your project and add the files you need to your
+.pro file.
+
+This repository is always work in progress, don't expect any tags,
+formal releases or anything like that.
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/harbour-lib.pro
^
|
@@ -0,0 +1,116 @@
+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/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/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/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/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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourAztecCodeGenerator.h
^
|
@@ -0,0 +1,89 @@
+/*
+ * 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_AZTEC_CODE_GENERATOR_H
+#define HARBOUR_AZTEC_CODE_GENERATOR_H
+
+#include <QtQml>
+
+class HarbourAztecCodeGenerator : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+ Q_PROPERTY(int ecLevel READ ecLevel WRITE setEcLevel NOTIFY ecLevelChanged)
+ Q_PROPERTY(QString code READ code NOTIFY codeChanged)
+ Q_PROPERTY(bool running READ running NOTIFY runningChanged)
+ Q_ENUMS(ECLevel)
+
+public:
+ enum ECLevel {
+ ECLevelDefault = -1,
+ ECLevelLowest = 5,
+ ECLevelLow = 10,
+ ECLevelMedium = 23,
+ ECLevelHigh = 36,
+ ECLevelVeryHigh = 50,
+ ECLevelHighest = 95,
+ ECLevelCount
+ };
+
+ HarbourAztecCodeGenerator(QObject* aParent = Q_NULLPTR);
+
+ QString text() const;
+ void setText(QString aValue);
+
+ int ecLevel() const;
+ void setEcLevel(int aValue);
+
+ QString code() const;
+ bool running() const;
+
+ static QByteArray generate(QString aText, int aEcLevel = ECLevelDefault);
+
+ // Callback for qmlRegisterSingletonType<HarbourAztecCodeGenerator>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+
+Q_SIGNALS:
+ void textChanged();
+ void ecLevelChanged();
+ void codeChanged();
+ void runningChanged();
+
+private:
+ class Task;
+ class Private;
+ Private* iPrivate;
+};
+
+QML_DECLARE_TYPE(HarbourAztecCodeGenerator)
+
+#endif // HARBOUR_AZTEC_CODE_GENERATOR_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourBase32.h
^
|
@@ -0,0 +1,49 @@
+/*
+ * 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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourBase45.h
^
|
@@ -0,0 +1,49 @@
+/*
+ * 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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourClipboard.h
^
|
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019 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_CLIPBOARD_H
+#define HARBOUR_CLIPBOARD_H
+
+#include <QtQml>
+
+class HarbourClipboard : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+ Q_PROPERTY(bool cacheText READ cacheText WRITE setCacheText NOTIFY cacheTextChanged)
+
+public:
+ HarbourClipboard(QObject* aParent = Q_NULLPTR);
+
+ QString text() const;
+ void setText(QString aValue);
+
+ bool cacheText() const;
+ void setCacheText(bool aValue);
+
+ // Callback for qmlRegisterSingletonType<HarbourClipboard>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+
+Q_SIGNALS:
+ void textChanged();
+ void cacheTextChanged();
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+QML_DECLARE_TYPE(HarbourClipboard)
+
+#endif // HARBOUR_CLIPBOARD_H
+
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourDebug.h
^
|
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2015-2019 Jolla Ltd.
+ * Copyright (C) 2015-2019 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_DEBUG_H
+#define HARBOUR_DEBUG_H
+
+#ifndef HARBOUR_DEBUG
+# define HARBOUR_DEBUG 0
+#endif // HARBOUR_DEBUG
+
+#ifndef HARBOUR_VERBOSE
+# define HARBOUR_VERBOSE 0
+#endif // HARBOUR_VERBOSE
+
+#include <QDebug>
+
+#if HARBOUR_VERBOSE
+#if QT_VERSION >= 0x050000
+# define HVERBOSE(x) qDebug() << x
+#else
+# define HVERBOSE(x) qDebug() << Q_FUNC_INFO << x
+#endif
+#else
+# define HVERBOSE(expr) ((void)0)
+#endif // HARBOUR_VERBOSE
+
+#if HARBOUR_DEBUG
+#if QT_VERSION >= 0x050000
+# define HDEBUG(x) qDebug() << x
+#else
+# define HDEBUG(x) qDebug() << Q_FUNC_INFO << x
+#endif
+# define HASSERT(x) ((x) ? ((void)0) : qt_assert(#x,__FILE__,__LINE__))
+# define HVERIFY(x) HASSERT(x)
+#else
+# define HDEBUG(expr) ((void)0)
+# define HASSERT(expr) ((void)0)
+# define HVERIFY(x) (x)
+#endif // HARBOUR_DEBUG
+
+#if QT_VERSION >= 0x050000
+# define HWARN(x) qWarning() << x
+#else
+# define HWARN(x) qWarning() << Q_FUNC_INFO << x
+#endif
+
+// Usage: TODO("Remember to fix this")
+#ifndef TODO
+# define HARBOUR_PRAGMA(x) _Pragma(#x)
+# define TODO(x) HARBOUR_PRAGMA(message("TODO - " x))
+#endif
+
+#endif // HARBOUR_DEBUG_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourDisplayBlanking.h
^
|
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2015-2019 Jolla Ltd.
+ * Copyright (C) 2015-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_DISPLAY_BLANKING_H
+#define HARBOUR_DISPLAY_BLANKING_H
+
+#include <QObject>
+#include <QString>
+#include <QSharedPointer>
+
+class QQmlEngine;
+class QJSEngine;
+
+class HarbourDisplayBlanking: public QObject {
+ Q_OBJECT
+ Q_PROPERTY(bool paused READ paused NOTIFY pausedChanged)
+ Q_PROPERTY(bool pauseAllowed READ pauseAllowed NOTIFY pauseAllowedChanged)
+ Q_PROPERTY(bool pauseRequested READ pauseRequested WRITE setPauseRequested NOTIFY pauseRequestedChanged)
+
+public:
+ explicit HarbourDisplayBlanking(QObject* aParent = Q_NULLPTR);
+ ~HarbourDisplayBlanking();
+
+ // Callback for qmlRegisterSingletonType<HarbourDisplayBlanking>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+ static QSharedPointer<HarbourDisplayBlanking> sharedInstance();
+
+ bool paused() const;
+ bool pauseAllowed() const;
+ bool pauseRequested() const;
+ void setPauseRequested(bool value);
+
+Q_SIGNALS:
+ void pausedChanged();
+ void pauseAllowedChanged();
+ void pauseRequestedChanged();
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_DISPLAY_BLANKING_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourImageProvider.h
^
|
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2018 Jolla Ltd.
+ * Copyright (C) 2018 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 name of Jolla Ltd 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_IMAGE_PROVIDER_H
+#define HARBOUR_IMAGE_PROVIDER_H
+
+#include <QQuickImageProvider>
+
+class HarbourImageProvider : public QQuickImageProvider
+{
+public:
+ class TextureFactory;
+ class Theme;
+
+ HarbourImageProvider();
+ QQuickTextureFactory* requestTexture(const QString& aId, QSize* aSize,
+ const QSize &requestedSize) Q_DECL_OVERRIDE;
+};
+
+#endif // HARBOUR_IMAGE_PROVIDER_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourJson.h
^
|
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2015-2020 Jolla Ltd.
+ * Copyright (C) 2015-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
+ * 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_JSON_H
+#define HARBOUR_JSON_H
+
+#include <QString>
+#include <QVariant>
+
+namespace HarbourJson {
+ bool save(const QString& aPath, const QVariantMap& aMap);
+ bool load(const QString& aPath, QVariantMap& aRoot);
+}
+
+#endif // HARBOUR_JSON_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourLib.h
^
|
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 Jolla Ltd.
+ * Contact: 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Nemo Mobile 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_LIB_H
+#define HARBOUR_LIB_H
+
+namespace HarbourLib {
+ void registerTypes(const char* aUri, int aMajor = 1, int aMinor = 0);
+}
+
+#endif // HARBOUR_LIB_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourMediaPlugin.h
^
|
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2017-2020 Jolla Ltd.
+ * Copyright (C) 2017-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
+ * 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_MEDIA_PLUGIN_H
+#define HARBOUR_MEDIA_PLUGIN_H
+
+#include "HarbourPluginLoader.h"
+
+// Workaround for org.nemomobile.policy (or Sailfish.Media) not being
+// allowed in harbour apps
+
+class HarbourMediaPlugin : public HarbourPluginLoader
+{
+ static HarbourMediaPlugin* gInstance;
+ static const char MEDIAKEY_QML_TYPE[];
+
+public:
+ static void registerTypes(QQmlEngine* aEngine, const char* aModule,
+ int aMajor, int aMinor);
+
+private:
+ HarbourMediaPlugin(QQmlEngine* aEngine);
+ ~HarbourMediaPlugin();
+ void registerTypes(const char* aModule, int aMajor, int aMinor);
+};
+
+#endif // HARBOUR_MEDIA_PLUGIN_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourObject.h
^
|
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 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.
+ */
+
+#ifndef HARBOUR_OBJECT_H
+#define HARBOUR_OBJECT_H
+
+#include <QObject>
+#include <QList>
+#include <QQmlListProperty>
+
+// Fixes the "Cannot assign to non-existent default property" problem
+// with QtObject in QML.
+class HarbourObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<QObject> children READ children)
+ Q_CLASSINFO("DefaultProperty", "children")
+
+public:
+ HarbourObject(QObject* aParent = Q_NULLPTR);
+
+ QQmlListProperty<QObject> children();
+
+private:
+ QList<QObject*> iChidren;
+};
+
+#endif // HARBOUR_OBJECT_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourOrganizeListModel.h
^
|
@@ -0,0 +1,80 @@
+/*
+ * 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_ORGANIZE_LIST_MODEL_H
+#define HARBOUR_ORGANIZE_LIST_MODEL_H
+
+#include <QtQml>
+#include <QSortFilterProxyModel>
+
+// This model helps to implement rearranging list items by dragging.
+// When drag starts, QML sets dragIndex property and then updates
+// dragPos when with the position of the dragged list item. When
+// drag is finished, QML sets dragIndex to -1 and the model calls
+// moveRow() on the underlying (source) model, to finish the move.
+
+class HarbourOrganizeListModel : public QSortFilterProxyModel {
+ Q_OBJECT
+ Q_PROPERTY(QObject* sourceModel READ sourceModel WRITE setSourceModelObject NOTIFY sourceModelObjectChanged)
+ Q_PROPERTY(int dragIndex READ dragIndex WRITE setDragIndex NOTIFY dragIndexChanged)
+ Q_PROPERTY(int dragPos READ dragPos WRITE setDragPos NOTIFY dragPosChanged)
+
+public:
+ HarbourOrganizeListModel(QObject* aParent = Q_NULLPTR);
+ ~HarbourOrganizeListModel();
+
+ void setSourceModelObject(QObject* aModel);
+
+ int dragIndex() const;
+ void setDragIndex(int aIndex);
+
+ int dragPos() const;
+ void setDragPos(int aPos);
+
+ // QAbstractProxyModel
+ QModelIndex mapToSource(const QModelIndex& aIndex) const Q_DECL_OVERRIDE;
+ QModelIndex mapFromSource(const QModelIndex& aIndex) const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void sourceModelObjectChanged();
+ void dragIndexChanged();
+ void dragPosChanged();
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+QML_DECLARE_TYPE(HarbourOrganizeListModel)
+
+#endif // HARBOUR_ORGANIZE_LIST_MODEL_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourPluginLoader.h
^
|
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+#ifndef HARBOUR_PLUGIN_LOADER_H
+#define HARBOUR_PLUGIN_LOADER_H
+
+#include <QString>
+
+class QQmlEngine;
+class QPluginLoader;
+
+//
+// This object has its most useful methods protected because it's supposed
+// to be subclassed line this:
+//
+// class DocGalleryPlugin : public HarbourPluginLoader {
+// public:
+// DocGalleryPlugin(QQmlEngine* engine);
+// void registerTypes(const char* module, int v1, int v2);
+// };
+//
+// DocGalleryPlugin::DocGalleryPlugin(QQmlEngine* engine) :
+// HarbourPluginLoader(engine, "QtDocGallery", 5, 0)
+// {
+// }
+//
+// void DocGalleryPlugin::registerTypes(const char* module, int v1, int v2)
+// {
+// reRegisterType("DocumentGallery", module, v1, v2);
+// reRegisterType("DocumentGalleryModel", module, v1, v2);
+// reRegisterType("GalleryStartsWithFilter", module, v1, v2);
+// }
+//
+// And it's generally a hack, it's best to avoid using this class at all.
+//
+
+class HarbourPluginLoader
+{
+public:
+ bool isValid() const;
+
+protected:
+ HarbourPluginLoader(QQmlEngine* aEngine, QString aModule,
+ int aMajor, int aMinor);
+ ~HarbourPluginLoader();
+
+ void reRegisterType(const char* aOrigQmlName, const char* aNewQmlName,
+ const char* aModule, int aMajor, int aMinor);
+ void reRegisterType(const char* aQmlName,
+ const char* aModule, int aMajor, int aMinor);
+
+private:
+ class LibQt5Qml;
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_PLUGIN_LOADER_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourPolicyPlugin.h
^
|
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2017-2020 Jolla Ltd.
+ * Copyright (C) 2017-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
+ * 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_POLICY_PLUGIN_H
+#define HARBOUR_POLICY_PLUGIN_H
+
+#include "HarbourPluginLoader.h"
+
+// Workaround for org.nemomobile.policy (or Nemo.Policy) not being
+// allowed in harbour apps
+
+class HarbourPolicyPlugin : public HarbourPluginLoader
+{
+ static HarbourPolicyPlugin* gInstance;
+ static const char RESOURCE_QML_TYPE[];
+ static const char PERMISSIONS_QML_TYPE[];
+
+public:
+ static void registerTypes(QQmlEngine* aEngine, const char* aModule,
+ int aMajor, int aMinor);
+
+private:
+ HarbourPolicyPlugin(QQmlEngine* aEngine);
+ ~HarbourPolicyPlugin();
+ void registerTypes(const char* aModule, int aMajor, int aMinor);
+};
+
+#endif // HARBOUR_POLICY_PLUGIN_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/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:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourQrCodeGenerator.h
^
|
@@ -0,0 +1,90 @@
+/*
+ * 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_QRCODE_GENERATOR_H
+#define HARBOUR_QRCODE_GENERATOR_H
+
+#include <QtQml>
+
+class HarbourQrCodeGenerator : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+ Q_PROPERTY(int ecLevel READ ecLevel WRITE setEcLevel NOTIFY ecLevelChanged)
+ Q_PROPERTY(QString code READ code NOTIFY codeChanged)
+ Q_PROPERTY(QString qrcode READ code NOTIFY codeChanged)
+ Q_PROPERTY(bool running READ running NOTIFY runningChanged)
+ Q_ENUMS(ECLevel)
+
+public:
+ enum ECLevel {
+ ECLevelDefault = -1,
+ ECLevelLowest = 0,
+ ECLevel_L = ECLevelLowest,
+ ECLevel_M,
+ ECLevel_Q,
+ ECLevel_H,
+ ECLevelHighest = ECLevel_H,
+ ECLevelCount
+ };
+
+ HarbourQrCodeGenerator(QObject* aParent = Q_NULLPTR);
+
+ QString text() const;
+ void setText(QString aValue);
+
+ ECLevel ecLevel() const;
+ void setEcLevel(int aValue);
+
+ QString code() const;
+ bool running() const;
+
+ static QByteArray generate(QString aText, ECLevel aEcLevel = ECLevelDefault);
+
+ // Callback for qmlRegisterSingletonType<HarbourQrCodeGenerator>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+
+Q_SIGNALS:
+ void textChanged();
+ void ecLevelChanged();
+ void codeChanged();
+ void runningChanged();
+
+private:
+ class Task;
+ class Private;
+ Private* iPrivate;
+};
+
+QML_DECLARE_TYPE(HarbourQrCodeGenerator)
+
+#endif // HARBOUR_QRCODE_GENERATOR_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourQrCodeImageProvider.h
^
|
@@ -0,0 +1,54 @@
+/*
+ * 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_QRCODE_IMAGEPROVIDER_H
+#define HARBOUR_QRCODE_IMAGEPROVIDER_H
+
+#include <QImage>
+#include <QQuickImageProvider>
+
+class HarbourQrCodeImageProvider : public QQuickImageProvider {
+public:
+ HarbourQrCodeImageProvider() : QQuickImageProvider(Image) {}
+
+ static const QColor DEFAULT_COLOR; // Qt::black
+ static const QColor DEFAULT_BACKGROUND; // Qt::transparent
+
+ static QImage createImage(QByteArray aBits, QColor aColor = DEFAULT_COLOR,
+ QColor aBackground = DEFAULT_BACKGROUND);
+
+ QImage requestImage(const QString& aId, QSize* aSize,
+ const QSize& aRequested) Q_DECL_OVERRIDE;
+};
+
+#endif // HARBOUR_QRCODE_IMAGEPROVIDER_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourSelectionListModel.h
^
|
@@ -0,0 +1,76 @@
+/*
+ * 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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourSigChildHandler.h
^
|
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2016 Jolla Ltd.
+ * Contact: Slava Monich <slava.monich@jolla.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 name of Jolla Ltd 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_SIGCHLD_HANDLER_H
+#define HARBOUR_SIGCHLD_HANDLER_H
+
+#include <QObject>
+
+class HarbourSigChildHandler : public QObject
+{
+ Q_OBJECT
+ class Private;
+
+public:
+ static HarbourSigChildHandler* install(QObject* aParent = NULL);
+ ~HarbourSigChildHandler();
+
+private:
+ HarbourSigChildHandler(Private* aPrivate, QObject* aParent);
+
+Q_SIGNALS:
+ void processDied(int aPid, int aStatus);
+
+private:
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_SIGCHLD_HANDLER_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourSingleImageProvider.h
^
|
@@ -0,0 +1,71 @@
+/*
+ * 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_SINGLE_IMAGE_PROVIDER_H
+#define HARBOUR_SINGLE_IMAGE_PROVIDER_H
+
+#include <QImage>
+#include <QObject>
+#include <QQmlParserStatus>
+
+class HarbourSingleImageProvider : public QObject, public QQmlParserStatus {
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QImage image READ image WRITE setImage NOTIFY imageChanged)
+ Q_PROPERTY(QString source READ source NOTIFY sourceChanged)
+
+public:
+ HarbourSingleImageProvider(QObject* aParent = Q_NULLPTR);
+
+ QImage image() const;
+ void setImage(QImage aImage);
+
+ QString source() const;
+
+ Q_INVOKABLE void clear();
+
+ // QQmlParserStatus
+ void classBegin() Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void imageChanged();
+ void sourceChanged();
+
+private:
+ class Private;
+ class ImageProvider;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_SINGLE_IMAGE_PROVIDER_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourSystem.h
^
|
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 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_SYSTEM_H
+#define HARBOUR_SYSTEM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void* HarbourDlopen(const char* aLibFile, int aFlags);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // HARBOUR_SYSTEM_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourSystemInfo.h
^
|
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+#ifndef HARBOUR_SYSTEM_INFO_H
+#define HARBOUR_SYSTEM_INFO_H
+
+#include <QObject>
+#include <QVector>
+
+class QQmlEngine;
+class QJSEngine;
+
+class HarbourSystemInfo: public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(HarbourSystemInfo)
+ Q_PROPERTY(QString osName READ osName CONSTANT)
+ Q_PROPERTY(QString osVersion READ osVersion CONSTANT)
+
+public:
+ explicit HarbourSystemInfo(QObject* aParent = NULL);
+ ~HarbourSystemInfo();
+
+ // Callback for qmlRegisterSingletonType<HarbourSystemInfo>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+
+ QString osName() const;
+ QString osVersion() const;
+
+ Q_INVOKABLE QString packageVersion(QString aPackage);
+ Q_INVOKABLE int osVersionCompare(QString aVersion);
+ Q_INVOKABLE static int compareVersions(QString aVersion1, QString aVersion2);
+
+ static QString queryPackageVersion(QString aVersion);
+ static int osVersionCompareWith(QString aVersion);
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_SYSTEM_INFO_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourSystemState.h
^
|
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2015-2019 Jolla Ltd.
+ * Copyright (C) 2015-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_SYSTEM_STATE_H
+#define HARBOUR_SYSTEM_STATE_H
+
+#include <QObject>
+#include <QString>
+#include <QSharedPointer>
+
+class QQmlEngine;
+class QJSEngine;
+
+class HarbourSystemState: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString displayStatus READ displayStatus NOTIFY displayStatusChanged)
+ Q_PROPERTY(QString lockMode READ lockMode NOTIFY lockModeChanged)
+ Q_PROPERTY(bool displayOff READ displayOff NOTIFY displayOffChanged)
+ Q_PROPERTY(bool locked READ locked NOTIFY lockedChanged)
+
+ Q_PROPERTY(QString MCE_DISPLAY_ON READ _MCE_DISPLAY_ON CONSTANT)
+ Q_PROPERTY(QString MCE_DISPLAY_DIM READ _MCE_DISPLAY_DIM CONSTANT)
+ Q_PROPERTY(QString MCE_DISPLAY_OFF READ _MCE_DISPLAY_OFF CONSTANT)
+ Q_PROPERTY(QString MCE_TK_LOCKED READ _MCE_TK_LOCKED CONSTANT)
+ Q_PROPERTY(QString MCE_TK_UNLOCKED READ _MCE_TK_UNLOCKED CONSTANT)
+
+public:
+ static const QString MCE_DISPLAY_ON;
+ static const QString MCE_DISPLAY_DIM;
+ static const QString MCE_DISPLAY_OFF;
+ static const QString MCE_TK_LOCKED;
+ static const QString MCE_TK_UNLOCKED;
+
+public:
+ explicit HarbourSystemState(QObject* aParent = Q_NULLPTR);
+ ~HarbourSystemState();
+
+ // Callback for qmlRegisterSingletonType<HarbourSystemState>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+ static QSharedPointer<HarbourSystemState> sharedInstance();
+
+ QString displayStatus() const;
+ QString lockMode() const;
+
+ bool displayOff() const;
+ bool locked() const;
+
+Q_SIGNALS:
+ void displayStatusChanged();
+ void displayOffChanged();
+ void lockModeChanged();
+ void lockedChanged();
+
+private:
+ // Getters for QML constants
+ QString _MCE_DISPLAY_ON() const { return MCE_DISPLAY_ON; }
+ QString _MCE_DISPLAY_DIM() const { return MCE_DISPLAY_DIM; }
+ QString _MCE_DISPLAY_OFF() const { return MCE_DISPLAY_OFF; }
+ QString _MCE_TK_LOCKED() const { return MCE_TK_LOCKED; }
+ QString _MCE_TK_UNLOCKED() const { return MCE_TK_UNLOCKED; }
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_SYSTEM_STATE_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourSystemTime.h
^
|
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 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_SYSTEM_TIME_H
+#define HARBOUR_SYSTEM_TIME_H
+
+#include <QObject>
+#include <QSharedPointer>
+
+class QQmlEngine;
+class QJSEngine;
+
+class HarbourSystemTime: public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(HarbourSystemTime)
+ Q_PROPERTY(QString notification READ emptyString NOTIFY notify)
+
+public:
+ explicit HarbourSystemTime(QObject* aParent = NULL);
+ ~HarbourSystemTime();
+
+ // Dummy getter for notification property which can be used to
+ // force re-evaluation of a JavaScript expression. As its name
+ // suggests, always returns empty string.
+ static QString emptyString();
+
+ // Callback for qmlRegisterSingletonType<HarbourSystemTime>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+
+ // Shared instance for use by native code
+ static QSharedPointer<HarbourSystemTime> sharedInstance();
+
+Q_SIGNALS:
+ // Recipient must be ready to receive multiple notifications for
+ // a single time or timezone change.
+ void preNotify(); // For Date.timeZoneUpdated()
+ void notify(); // For everything else
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_SYSTEM_TIME_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourTask.h
^
|
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-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.
+ *
+ * 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_TASK_H
+#define HARBOUR_TASK_H
+
+#include <QObject>
+#include <QRunnable>
+
+class QThread;
+class QThreadPool;
+
+/**
+ * A Runnable that queues done() signal to the target thread when it's done.
+ */
+class HarbourTask : public QObject, public QRunnable {
+ Q_OBJECT
+
+protected:
+ HarbourTask(QThreadPool* aPool, QThread* aTargetThread = Q_NULLPTR);
+
+public:
+ virtual ~HarbourTask();
+
+ bool isStarted() const;
+ bool isCanceled() const;
+
+ void submit();
+ void submit(QObject* aTarget, const char* aSlot);
+ void release(QObject* aHandler);
+ void release();
+
+private:
+ void released();
+
+protected:
+ void run() Q_DECL_OVERRIDE;
+ virtual void performTask() = 0;
+
+Q_SIGNALS:
+ void runFinished();
+ void done();
+
+private Q_SLOTS:
+ void onAboutToQuit();
+ void onRunFinished();
+ void onTargetDestroyed(QObject* aObject);
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_TASK_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourTemporaryFile.h
^
|
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2018-2021 Jolla Ltd.
+ * Copyright (C) 2018-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.
+ *
+ * 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_TEMPORARY_FILE_H
+#define HARBOUR_TEMPORARY_FILE_H
+
+#include <QObject>
+#include <QString>
+#include <QUrl>
+
+class HarbourTemporaryFile: public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString fileTemplate READ fileTemplate WRITE setFileTemplate NOTIFY fileTemplateChanged)
+ Q_PROPERTY(QString content READ content WRITE setContent NOTIFY contentChanged)
+ Q_PROPERTY(QString fileName READ fileName NOTIFY fileNameChanged)
+ Q_PROPERTY(Location location READ location WRITE setLocation NOTIFY locationChanged)
+ Q_PROPERTY(QUrl url READ url NOTIFY urlChanged)
+ Q_ENUMS(Location)
+
+public:
+ enum Location {
+ Tmp,
+ Downloads
+ };
+
+ explicit HarbourTemporaryFile(QObject* aParent = NULL);
+ ~HarbourTemporaryFile();
+
+ QString content() const;
+ void setContent(QString aValue);
+
+ QString fileTemplate() const;
+ void setFileTemplate(QString aValue);
+
+ Location location() const;
+ void setLocation(Location aValue);
+
+ QString fileName() const;
+ QUrl url() const;
+
+Q_SIGNALS:
+ void fileTemplateChanged();
+ void contentChanged();
+ void fileNameChanged();
+ void locationChanged();
+ void urlChanged();
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_TEMPORARY_FILE_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourTheme.h
^
|
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2018-2021 Jolla Ltd.
+ * Copyright (C) 2018-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
+ * 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;
+
+ static QRgb invertedRgb(QRgb aRgb);
+
+ 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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourTransferMethodInfo.h
^
|
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2016-2018 Jolla Ltd.
+ * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.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 name of Jolla Ltd 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_METHOD_INFO_H
+#define HARBOUR_TRANSFER_METHOD_INFO_H
+
+#include <QStringList>
+#include <QtDBus/QtDBus>
+#include <QVariantHash>
+
+class HarbourTransferMethodInfo
+{
+public:
+ HarbourTransferMethodInfo();
+ HarbourTransferMethodInfo& operator=(const HarbourTransferMethodInfo& aInfo);
+ HarbourTransferMethodInfo(const HarbourTransferMethodInfo& aInfo);
+ bool operator==(const HarbourTransferMethodInfo& Info) const;
+ bool operator!=(const HarbourTransferMethodInfo& Info) const;
+ bool equals(const HarbourTransferMethodInfo& Info) const;
+
+ static void registerTypes();
+
+ QString displayName;
+ QString userName;
+ QString methodId;
+ QString shareUIPath;
+ QStringList capabilitities;
+ quint32 accountId;
+};
+
+inline bool HarbourTransferMethodInfo::operator==(const HarbourTransferMethodInfo& aInfo) const
+ { return equals(aInfo); }
+inline bool HarbourTransferMethodInfo::operator!=(const HarbourTransferMethodInfo& aInfo) const
+ { return !equals(aInfo); }
+
+typedef QList<HarbourTransferMethodInfo> HarbourTransferMethodInfoList;
+QDBusArgument& operator<<(QDBusArgument& aArg, const HarbourTransferMethodInfo& aInfo);
+const QDBusArgument& operator>>(const QDBusArgument& aArg, HarbourTransferMethodInfo& aInfo);
+
+Q_DECLARE_METATYPE(HarbourTransferMethodInfo)
+Q_DECLARE_METATYPE(QList<HarbourTransferMethodInfo>)
+
+// Extended transfer method info (available since Sailfish OS 2.2.0)
+class HarbourTransferMethodInfo2
+{
+public:
+ HarbourTransferMethodInfo2();
+ HarbourTransferMethodInfo2(const HarbourTransferMethodInfo& aInfo);
+ HarbourTransferMethodInfo2(const HarbourTransferMethodInfo2& aInfo);
+ HarbourTransferMethodInfo2& operator=(const HarbourTransferMethodInfo2& aInfo);
+ bool operator==(const HarbourTransferMethodInfo2& Info) const;
+ bool operator!=(const HarbourTransferMethodInfo2& Info) const;
+ bool equals(const HarbourTransferMethodInfo2& Info) const;
+
+ static void registerTypes();
+
+ QString displayName;
+ QString userName;
+ QString methodId;
+ QString shareUIPath;
+ QStringList capabilitities;
+ quint32 accountId;
+ QString accountIcon;
+ QVariantHash hints;
+};
+
+inline bool HarbourTransferMethodInfo2::operator==(const HarbourTransferMethodInfo2& aInfo) const
+ { return equals(aInfo); }
+inline bool HarbourTransferMethodInfo2::operator!=(const HarbourTransferMethodInfo2& aInfo) const
+ { return !equals(aInfo); }
+
+typedef QList<HarbourTransferMethodInfo2> HarbourTransferMethodInfo2List;
+QDBusArgument& operator<<(QDBusArgument& aArg, const HarbourTransferMethodInfo2& aInfo);
+const QDBusArgument& operator>>(const QDBusArgument& aArg, HarbourTransferMethodInfo2& aInfo);
+
+Q_DECLARE_METATYPE(HarbourTransferMethodInfo2)
+Q_DECLARE_METATYPE(QList<HarbourTransferMethodInfo2>)
+
+#endif // HARBOUR_TRANSFER_METHOD_INFO_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/include/HarbourTransferMethodsModel.h
^
|
@@ -0,0 +1,90 @@
+/*
+ * 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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourBadge.qml
^
|
@@ -0,0 +1,67 @@
+/*
+ * 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
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/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:harbour-aenigma-0.3.7.tar.bz2/extern/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:harbour-aenigma-0.3.7.tar.bz2/extern/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:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourFitLabel.qml
^
|
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 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
+
+Label {
+ property int minFontSize: Theme.fontSizeTiny
+ property int maxFontSize: Theme.fontSizeMedium
+ property real maxWidth: width
+ property real maxHeight: height
+ property bool refitting
+
+ smooth: true
+ visible: opacity > 0
+ color: Theme.highlightColor
+ anchors.margins: Theme.paddingMedium
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+
+ Behavior on opacity { FadeAnimation {} }
+
+ Component.onCompleted: {
+ refitting = true
+ font.pixelSize = maxFontSize
+ refitTextRun()
+ refitting = false
+ }
+
+ onMaxWidthChanged: refitText()
+ onMaxHeightChanged: refitText()
+ onTextChanged: refitText()
+ onMaxFontSizeChanged: refitText()
+ onMinFontSizeChanged: refitText()
+
+ function refitText() {
+ if (!refitting) {
+ refitting = true
+ refitTextRun()
+ refitting = false
+ }
+ }
+
+ function refitTextRun() {
+ if (implicitHeight > 0 && implicitWidth > 0) {
+ if (font.pixelSize % 2) font.pixelSize++
+ while ((implicitWidth > maxWidth || implicitHeight > maxHeight || font.pixelSize > maxFontSize) && (font.pixelSize - 2) >= minFontSize) {
+ font.pixelSize -= 2
+ }
+ while (implicitWidth < maxWidth && implicitHeight < maxHeight && (font.pixelSize + 2) <= maxFontSize) {
+ font.pixelSize += 2
+ }
+ if (implicitWidth > maxWidth || implicitHeight > maxHeight) {
+ font.pixelSize -= 2
+ }
+ }
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourGrayscaleEffect.qml
^
|
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 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
+
+ShaderEffect {
+ property variant source
+
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 coord;
+ void main() {
+ coord = qt_MultiTexCoord0;
+ gl_Position = qt_Matrix * qt_Vertex;
+ }"
+ fragmentShader: "
+ varying highp vec2 coord;
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ void main() {
+ lowp vec4 tex = texture2D(source, coord);
+ gl_FragColor = vec4(vec3(dot(tex.rgb,
+ vec3(0.344, 0.5, 0.156))),
+ tex.a) * qt_Opacity;
+ }"
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourHighlightIcon.qml
^
|
@@ -0,0 +1,38 @@
+// This is basically a Qt example slightly adapted for Sailfish OS
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Image {
+ id: icon
+
+ property bool highlightEnabled: true
+ property color highlightColor: Theme.highlightColor
+
+ layer.enabled: highlightEnabled
+ layer.effect: ShaderEffect {
+ property variant src: icon
+ property color highlight: highlightColor
+
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 coord;
+ void main() {
+ coord = qt_MultiTexCoord0;
+ gl_Position = qt_Matrix * qt_Vertex;
+ }"
+ fragmentShader: "
+ varying highp vec2 coord;
+ uniform sampler2D src;
+ uniform lowp vec4 highlight;
+ uniform lowp float qt_Opacity;
+ void main() {
+ lowp vec4 tex = texture2D(src, coord);
+ gl_FragColor = vec4(vec3(dot(tex.rgb,
+ vec3(0.344, 0.5, 0.156))),
+ tex.a) * qt_Opacity * highlight;
+ }"
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourHintIconButton.qml
^
|
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 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
+
+MouseArea {
+ property alias icon: image
+ property bool down: pressed && containsMouse
+ property bool highlighted: down
+ property string hint
+
+ signal showHint(var text)
+ signal hideHint()
+
+ width: Theme.itemSizeSmall
+ height: Theme.itemSizeSmall
+
+ readonly property bool _showPress: highlighted || pressTimer.running
+
+ onPressedChanged: {
+ if (pressed) {
+ pressTimer.start()
+ }
+ }
+
+ onClicked: hideHint()
+
+ onReleased: hideHint()
+
+ onPressAndHold: if (hint !== "") showHint(hint)
+
+ onCanceled: {
+ pressTimer.stop()
+ hideHint()
+ }
+
+ Timer {
+ id: pressTimer
+
+ interval: 50
+ }
+
+ HarbourHighlightIcon {
+ id: image
+
+ highlightColor: _showPress ? Theme.highlightColor : Theme.primaryColor
+ sourceSize: Qt.size(Theme.iconSizeMedium, Theme.iconSizeMedium)
+ anchors.centerIn: parent
+ opacity: parent.enabled ? 1.0 : 0.4
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourHorizontalSwipeHint.qml
^
|
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2019-2020 Jolla Ltd.
+ * Copyright (C) 2019-2020 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: hint
+
+ anchors.fill: parent
+
+ property bool swipeRight
+ property bool bothWays
+ property bool hintEnabled
+ property alias text: label.text
+ property alias hintDelay: hintDelayTimer.interval
+ property alias loops: touchInteractionHint.loops
+ readonly property bool hintRunning: hintDelayTimer.running || touchInteractionHint.running || label.opacity > 0
+
+ signal hintShown()
+
+ function showHint() {
+ if (!touchInteractionHint.running) {
+ touchInteractionHint.direction = touchInteractionHint.defaultDirection
+ touchInteractionHint.start()
+ }
+ }
+
+ onHintEnabledChanged: {
+ if (hint.hintEnabled) {
+ hintDelayTimer.restart()
+ } else {
+ hintDelayTimer.stop()
+ }
+ }
+
+ Component.onCompleted: if (hint.hintEnabled) hintDelayTimer.start()
+
+ InteractionHintLabel {
+ id: label
+
+ anchors.bottom: parent.bottom
+ opacity: touchInteractionHint.running ? 1.0 : 0.0
+ Behavior on opacity { FadeAnimation { duration: 1000 } }
+ }
+
+ TouchInteractionHint {
+ id: touchInteractionHint
+
+ readonly property int defaultDirection: swipeRight ? TouchInteraction.Right : TouchInteraction.Left
+ readonly property int otherDirection: swipeRight ? TouchInteraction.Left : TouchInteraction.Right
+ anchors.verticalCenter: parent.verticalCenter
+ onRunningChanged: {
+ if (!running) {
+ if (bothWays && direction === defaultDirection) {
+ direction = otherDirection
+ start()
+ } else {
+ hint.hintShown()
+ }
+ }
+ }
+ }
+
+ Timer {
+ id: hintDelayTimer
+
+ interval: 1000
+ onTriggered: showHint()
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourIconTextButton.qml
^
|
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 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
+
+MouseArea {
+ property alias icon: image
+ property bool down: pressed && containsMouse
+ property bool highlighted: down
+ property alias iconSource: image.source
+ property alias text: label.text
+
+ readonly property bool _showPress: highlighted || pressTimer.running
+
+ onPressedChanged: {
+ if (pressed) {
+ pressTimer.start()
+ }
+ }
+
+ onCanceled: pressTimer.stop()
+
+ width: Math.max(image.width, label.width)
+ height: image.height + label.height
+
+ HarbourHighlightIcon {
+ id: image
+
+ highlightColor: _showPress ? Theme.highlightColor : Theme.primaryColor
+ sourceSize: Qt.size(Theme.itemSizeSmall, Theme.itemSizeSmall)
+ opacity: parent.enabled ? 1.0 : 0.4
+ anchors {
+ top: parent.top
+ horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ Label {
+ id: label
+
+ height: text.length ? (implicitHeight + Theme.paddingMedium) : 0
+ opacity: parent.enabled ? 1.0 : 0.4
+ anchors {
+ top: image.bottom
+ horizontalCenter: parent.horizontalCenter
+ }
+ wrapMode: Text.Wrap
+ font.pixelSize: Theme.fontSizeExtraSmall
+ color: _showPress ? Theme.secondaryHighlightColor : Theme.secondaryColor
+ }
+
+ Timer {
+ id: pressTimer
+
+ interval: ('minimumPressHighlightTime' in Theme) ? Theme.minimumPressHighlightTime : 64
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourPasswordInputField.qml
^
|
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2018-2021 Jolla Ltd.
+ * Copyright (C) 2018-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.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+TextField {
+ id: field
+
+ property bool showEchoModeToggle: activeFocus
+ property int passwordEchoMode: TextInput.Password
+
+ property bool _usePasswordEchoMode: true
+ property int _buttonLeftMargin: Theme.paddingLarge
+
+ width: (parent ? parent.width : Screen.width) - 2*x
+ textRightMargin: textMargin
+ echoMode: _usePasswordEchoMode ? passwordEchoMode : TextInput.Normal
+ inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
+ placeholderText: label
+
+ //: Default label for password field
+ //% "Password"
+ label: qsTrId("components-la-password")
+
+ function requestFocus() {
+ focusOutBehavior = FocusBehavior.KeepFocus
+ forceActiveFocus()
+ keepFocusTimer.start()
+ }
+
+ Connections {
+ target: Qt.application
+ onActiveChanged: {
+ if (!Qt.application.active) {
+ _usePasswordEchoMode = true
+ if (!readOnly) text = "" // Reset whatever has been typed
+ }
+ }
+ }
+
+ Timer {
+ id: keepFocusTimer
+
+ interval: 500
+ onTriggered: field.focusOutBehavior = FocusBehavior.ClearItemFocus
+ }
+
+ states: State {
+ name: "showToggle"
+ when: field.showEchoModeToggle
+ PropertyChanges {
+ target: field
+ textRightMargin: field._buttonLeftMargin/2 + passwordVisibilityButton.width + field.textMargin
+ }
+ PropertyChanges {
+ target: passwordVisibilityButton
+ opacity: 1
+ enabled: true
+ }
+ }
+
+ transitions: Transition {
+ from: ""
+ to: "showToggle"
+ reversible: true
+ NumberAnimation {
+ property: "textRightMargin"
+ duration: 50
+ }
+ FadeAnimation {
+ target: passwordVisibilityButton
+ }
+ }
+
+ MouseArea {
+ id: passwordVisibilityButton
+
+ parent: field // ensure the field is visible, avoid auto-parenting to TextBase contentItem
+ x: field.width - width - field.textMargin
+ width: Math.max(textAbc.implicitWidth, textDots.implicitWidth) + field._buttonLeftMargin/2
+ height: field.height - Theme.paddingLarge
+ opacity: 0
+ enabled: false
+
+ onClicked: {
+ field._usePasswordEchoMode = !field._usePasswordEchoMode
+ }
+
+ Text {
+ id: textAbc
+
+ anchors {
+ top: parent.top
+ topMargin: field.textTopMargin
+ horizontalCenter: parent.horizontalCenter
+ }
+ visible: field.echoMode == TextInput.Password
+ font.pixelSize: Theme.fontSizeMedium
+ text: "abc"
+ textFormat: Text.PlainText
+ color: parent.pressed && parent.containsMouse ? Theme.highlightColor : Theme.primaryColor
+ }
+
+ Text {
+ id: textDots
+
+ anchors {
+ top: parent.top
+ topMargin: field.textTopMargin
+ horizontalCenter: parent.horizontalCenter
+ }
+ visible: field.echoMode == TextInput.Normal
+ font.pixelSize: Theme.fontSizeMedium
+ text: "\u2022\u2022\u2022"
+ textFormat: Text.PlainText
+ color: parent.pressed && parent.containsMouse ? Theme.highlightColor : Theme.primaryColor
+ }
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourPressEffect.qml
^
|
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+ShaderEffect {
+ property variant source
+ property color color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform highp vec4 color;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main(void) {
+ highp vec4 pixelColor = texture2D(source, qt_TexCoord0);
+ gl_FragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625),
+ color.rgb/max(color.a, 0.00390625), color.a) *
+ pixelColor.a, pixelColor.a) * qt_Opacity;
+ }"
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourShakeAnimation.qml
^
|
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2018 Jolla Ltd.
+ * Copyright (C) 2018 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
+
+SequentialAnimation {
+ id: animation
+
+ property var target
+ property real amplitude: Theme.horizontalPageMargin * 4 / 5
+ property real x: 0
+
+ alwaysRunToEnd: true
+
+ NumberAnimation {
+ target: animation.target
+ property: "x"
+ to: animation.x + animation.amplitude
+ duration: 25
+ easing.type: Easing.InOutSine
+ }
+
+ NumberAnimation {
+ target: animation.target
+ property: "x"
+ from: animation.x + animation.amplitude
+ to: animation.x
+ duration: 500
+ easing.type: Easing.OutElastic
+ easing.amplitude: 2
+ easing.period: 0.2
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourShareMethodList.qml
^
|
@@ -0,0 +1,144 @@
+/*
+ * 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 { }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/qml/HarbourTextFlip.qml
^
|
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-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.
+ */
+
+import QtQuick 2.0
+
+Rotation {
+ id: rotation
+
+ property string text
+ property Item target
+ property real duration: 500
+ property bool enabled: true
+ property string property: "text"
+ readonly property bool running: animation.running
+
+ property var animation: SequentialAnimation {
+ alwaysRunToEnd: true
+
+ onRunningChanged: {
+ if (!running && target[property] != rotation.text) {
+ start()
+ }
+ }
+
+ NumberAnimation {
+ easing.type: Easing.InOutSine
+ target: rotation
+ property: "angle"
+ from: 0
+ to: 90
+ duration: rotation.duration/2
+ }
+ ScriptAction { script: target[property] = rotation.text; }
+ NumberAnimation {
+ easing.type: Easing.InOutSine
+ target: rotation
+ property: "angle"
+ to: 0
+ duration: rotation.duration/2
+ }
+ }
+
+ origin {
+ x: target.width / 2
+ y: target.height / 2
+ }
+
+ axis {
+ x: 1
+ y: 0
+ z: 0
+ }
+
+ function flipTo(value) {
+ if (!!target) {
+ animation.start()
+ text = value
+ }
+ }
+
+ function _updateTargetProperty() {
+ if (!!target) {
+ if (enabled) {
+ animation.start()
+ } else if (!animation.running) {
+ target[property] = text
+ }
+ }
+ }
+
+ onTextChanged: _updateTargetProperty()
+ onTargetChanged: _updateTargetProperty()
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/rpm/harbour-lib-devel.spec
^
|
@@ -0,0 +1,36 @@
+Name: harbour-lib-devel
+
+Summary: Utility library for Sailfish harbour apps
+Version: 1.0
+Release: 1
+Group: System/Libraries
+License: BSD
+URL: https://github.com/monich/harbour-lib
+Source0: %{name}-%{version}.tar.bz2
+
+BuildRequires: pkgconfig(Qt5Core)
+BuildRequires: pkgconfig(Qt5DBus)
+BuildRequires: pkgconfig(Qt5Qml)
+
+%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
+%{!?qtc_make:%define qtc_make make}
+
+%description
+This package contains utility library for Sailfish harbour apps development
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+%qtc_qmake5
+%qtc_make %{?_smp_mflags}
+
+%install
+rm -rf %{buildroot}
+%qmake5_install
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/libharbour-lib.a
+%{_libdir}/pkgconfig/harbour-lib.pc
+%{_includedir}/harbour-lib/*.h
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourAztecCodeGenerator.cpp
^
|
@@ -0,0 +1,244 @@
+/*
+ * 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.
+ */
+
+#include "HarbourAztecCodeGenerator.h"
+
+#include "HarbourBase32.h"
+#include "HarbourTask.h"
+#include "HarbourDebug.h"
+
+#include <QThreadPool>
+
+#include "aztec_encode.h" // Requires https://github.com/monich/libaztec
+
+// ==========================================================================
+// HarbourAztecCodeGenerator::Task
+// ==========================================================================
+
+class HarbourAztecCodeGenerator::Task : public HarbourTask {
+ Q_OBJECT
+public:
+ Task(QThreadPool* aPool, QString aText, int aEcLevel);
+ void performTask() Q_DECL_OVERRIDE;
+public:
+ QString iText;
+ QString iCode;
+ int iEcLevel;
+};
+
+HarbourAztecCodeGenerator::Task::Task(QThreadPool* aPool, QString aText,
+ int aEcLevel) :
+ HarbourTask(aPool),
+ iText(aText),
+ iEcLevel(aEcLevel)
+{
+}
+
+void HarbourAztecCodeGenerator::Task::performTask()
+{
+ QByteArray bytes(generate(iText, iEcLevel));
+ if (!bytes.isEmpty()) {
+ iCode = HarbourBase32::toBase32(bytes);
+ }
+}
+
+// ==========================================================================
+// HarbourAztecCodeGenerator::Private
+// ==========================================================================
+
+class HarbourAztecCodeGenerator::Private : public QObject {
+ Q_OBJECT
+
+public:
+ Private(HarbourAztecCodeGenerator* aParent);
+ ~Private();
+
+ HarbourAztecCodeGenerator* parentObject() const;
+ void setText(QString aValue);
+ void setEcLevel(int aValue);
+ void regenerate();
+
+ static int realEcLevel(int aEcLevel);
+
+public Q_SLOTS:
+ void onTaskDone();
+
+public:
+ QThreadPool* iThreadPool;
+ Task* iTask;
+ int iEcLevel;
+ QString iText;
+ QString iCode;
+};
+
+HarbourAztecCodeGenerator::Private::Private(HarbourAztecCodeGenerator* aParent) :
+ QObject(aParent),
+ iThreadPool(new QThreadPool(this)),
+ iTask(Q_NULLPTR),
+ iEcLevel(ECLevelDefault)
+{
+ // Serialize the tasks:
+ iThreadPool->setMaxThreadCount(1);
+}
+
+HarbourAztecCodeGenerator::Private::~Private()
+{
+ iThreadPool->waitForDone();
+}
+
+inline HarbourAztecCodeGenerator* HarbourAztecCodeGenerator::Private::parentObject() const
+{
+ return qobject_cast<HarbourAztecCodeGenerator*>(parent());
+}
+
+int HarbourAztecCodeGenerator::Private::realEcLevel(int aEcLevel)
+{
+ return (aEcLevel == ECLevelDefault) ? AZTEC_CORRECTION_DEFAULT :
+ (aEcLevel < ECLevelLowest) ? ECLevelLowest :
+ (aEcLevel > ECLevelHighest) ? ECLevelHighest :
+ aEcLevel;
+}
+
+void HarbourAztecCodeGenerator::Private::setText(QString aText)
+{
+ if (iText != aText) {
+ iText = aText;
+ regenerate();
+ Q_EMIT parentObject()->textChanged();
+ }
+}
+
+void HarbourAztecCodeGenerator::Private::setEcLevel(int aValue)
+{
+ const int level = (aValue == ECLevelDefault) ? ECLevelDefault : realEcLevel(aValue);
+ if (iEcLevel != level) {
+ const int prevRealLevel = realEcLevel(iEcLevel);
+ iEcLevel = level;
+ HDEBUG(level);
+ if (realEcLevel(level) != prevRealLevel) {
+ regenerate();
+ }
+ Q_EMIT parentObject()->ecLevelChanged();
+ }
+}
+
+void HarbourAztecCodeGenerator::Private::regenerate()
+{
+ const bool wasRunning = (iTask != Q_NULLPTR);
+ if (iTask) iTask->release(this);
+ iTask = new Task(iThreadPool, iText, iEcLevel);
+ iTask->submit(this, SLOT(onTaskDone()));
+ if (!wasRunning) {
+ Q_EMIT parentObject()->runningChanged();
+ }
+}
+
+void HarbourAztecCodeGenerator::Private::onTaskDone()
+{
+ if (sender() == iTask) {
+ HarbourAztecCodeGenerator* obj = parentObject();
+ const bool changed = (iCode != iTask->iCode);
+ iCode = iTask->iCode;
+ iTask->release();
+ iTask = NULL;
+ if (changed) {
+ Q_EMIT obj->codeChanged();
+ }
+ Q_EMIT obj->runningChanged();
+ }
+}
+
+// ==========================================================================
+// HarbourAztecCodeGenerator
+// ==========================================================================
+
+HarbourAztecCodeGenerator::HarbourAztecCodeGenerator(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private(this))
+{
+}
+
+// Callback for qmlRegisterSingletonType<HarbourAztecCodeGenerator>
+QObject* HarbourAztecCodeGenerator::createSingleton(QQmlEngine*, QJSEngine*)
+{
+ return new HarbourAztecCodeGenerator();
+}
+
+QString HarbourAztecCodeGenerator::text() const
+{
+ return iPrivate->iText;
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourBase32.cpp
^
|
@@ -0,0 +1,252 @@
+/*
+ * 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;
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourBase45.cpp
^
|
@@ -0,0 +1,204 @@
+/*
+ * 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;
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourClipboard.cpp
^
|
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019 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 "HarbourClipboard.h"
+#include "HarbourDebug.h"
+
+#include <QGuiApplication>
+#include <QClipboard>
+
+// ==========================================================================
+// HarbourClipboard::Private
+// ==========================================================================
+
+class HarbourClipboard::Private : public QObject {
+ Q_OBJECT
+
+public:
+ Private(HarbourClipboard* aParent);
+
+ HarbourClipboard* parentObject() const;
+ void setText(QString aValue);
+ void setCacheText(bool aValue);
+
+public Q_SLOTS:
+ void onClipboardChanged();
+
+public:
+ QClipboard* iClipboard;
+ QString iText;
+ bool iCacheText;
+};
+
+HarbourClipboard::Private::Private(HarbourClipboard* aParent) :
+ QObject(aParent),
+ iClipboard(qApp->clipboard()),
+ iText(iClipboard->text()),
+ iCacheText(true)
+{
+ connect(iClipboard, SIGNAL(dataChanged()), SLOT(onClipboardChanged()));
+}
+
+inline HarbourClipboard* HarbourClipboard::Private::parentObject() const
+{
+ return qobject_cast<HarbourClipboard*>(parent());
+}
+
+void HarbourClipboard::Private::onClipboardChanged()
+{
+ const QString clipboardText(iClipboard->text());
+ HDEBUG(clipboardText);
+ if (iText != clipboardText && (!iCacheText || !clipboardText.isEmpty())) {
+ iText = clipboardText;
+ Q_EMIT parentObject()->textChanged();
+ }
+}
+
+void HarbourClipboard::Private::setText(QString aValue)
+{
+ if (iText != aValue) {
+ iText = aValue;
+ HDEBUG(aValue);
+ Q_EMIT parentObject()->textChanged();
+ if (aValue.isEmpty()) {
+ iClipboard->clear();
+ } else {
+ iClipboard->setText(iText);
+ }
+ }
+}
+
+void HarbourClipboard::Private::setCacheText(bool aValue)
+{
+ if (iCacheText != aValue) {
+ iCacheText = aValue;
+ HDEBUG(aValue);
+ HarbourClipboard* obj = parentObject();
+ Q_EMIT obj->cacheTextChanged();
+ if (!iCacheText) {
+ const QString clipboardText(iClipboard->text());
+ if (iText != clipboardText) {
+ iText = clipboardText;
+ Q_EMIT obj->textChanged();
+ }
+ }
+ }
+}
+
+// ==========================================================================
+// HarbourClipboard::Private
+// ==========================================================================
+
+HarbourClipboard::HarbourClipboard(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private(this))
+{
+}
+
+// Callback for qmlRegisterSingletonType<HarbourClipboard>
+QObject* HarbourClipboard::createSingleton(QQmlEngine* aEngine, QJSEngine*)
+{
+ return new HarbourClipboard;
+}
+
+QString HarbourClipboard::text() const
+{
+ return iPrivate->iText;
+}
+
+void HarbourClipboard::setText(QString aValue)
+{
+ iPrivate->setText(aValue);
+}
+
+bool HarbourClipboard::cacheText() const
+{
+ return iPrivate->iCacheText;
+}
+
+void HarbourClipboard::setCacheText(bool aValue)
+{
+ iPrivate->setCacheText(aValue);
+}
+
+#include "HarbourClipboard.moc"
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/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);
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourDisplayBlanking.cpp
^
|
@@ -0,0 +1,300 @@
+/*
+ * Copyright (C) 2015-2019 Jolla Ltd.
+ * Copyright (C) 2015-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 "HarbourDisplayBlanking.h"
+#include "HarbourDebug.h"
+#include "HarbourMce.h"
+
+#include <QQmlEngine>
+
+#include <QDBusMessage>
+#include <QDBusConnection>
+#include <QDBusPendingCallWatcher>
+#include <QDBusPendingReply>
+
+#include <QTimer>
+
+// ==========================================================================
+// HarbourDisplayBlanking::Private
+// ==========================================================================
+
+class HarbourDisplayBlanking::Private : public HarbourMce {
+ Q_OBJECT
+
+public:
+ static const int REPEAT_INTERVAL_SEC = 50;
+ static const QString BLANK_ACTIVE;
+ static const QString BLANK_INACTIVE;
+ static QWeakPointer<HarbourDisplayBlanking> sSharedInstance;
+
+ bool iPaused;
+ bool iPauseAllowed;
+ bool iPauseRequested;
+ bool iPauseActive;
+ QTimer* iRepeatTimer;
+
+ Private(HarbourDisplayBlanking* aParent);
+
+ void setPauseRequested(bool aValue);
+
+private:
+ HarbourDisplayBlanking* parentObject() const;
+ void updateDisplayBlankingPause(QString aState);
+ void updateDisplayBlankingAllowed(bool aAllowed);
+ void checkPause();
+ void requestPause();
+ void cancelPause();
+
+public Q_SLOTS:
+ void onDisplayBlankingPauseChanged(QString);
+ void onDisplayBlankingPauseAllowedChanged(bool);
+ void onDisplayBlankingPauseQueryDone(QDBusPendingCallWatcher*);
+ void onDisplayBlankingPauseAllowedQueryDone(QDBusPendingCallWatcher*);
+ void onRepeatBlankingRequest();
+};
+
+const QString HarbourDisplayBlanking::Private::BLANK_ACTIVE("active");
+const QString HarbourDisplayBlanking::Private::BLANK_INACTIVE("inactive");
+QWeakPointer<HarbourDisplayBlanking> HarbourDisplayBlanking::Private::sSharedInstance;
+
+HarbourDisplayBlanking::Private::Private(
+ HarbourDisplayBlanking* aParent) :
+ HarbourMce(aParent),
+ iPaused(false),
+ iPauseAllowed(false),
+ iPauseRequested(false),
+ iPauseActive(false),
+ iRepeatTimer(Q_NULLPTR)
+{
+ HDEBUG("created");
+ setupProperty("get_display_blanking_pause", "display_blanking_pause_ind",
+ SLOT(onDisplayBlankingPauseQueryDone(QDBusPendingCallWatcher*)),
+ SLOT(onDisplayBlankingPauseChanged(QString)));
+ setupProperty("get_display_blanking_pause_allowed", "display_blanking_pause_allowed_ind",
+ SLOT(onDisplayBlankingPauseAllowedQueryDone(QDBusPendingCallWatcher*)),
+ SLOT(onDisplayBlankingPauseAllowedChanged(bool)));
+}
+
+HarbourDisplayBlanking*
+HarbourDisplayBlanking::Private::parentObject() const
+{
+ return qobject_cast<HarbourDisplayBlanking*>(parent());
+}
+
+void
+HarbourDisplayBlanking::Private::updateDisplayBlankingPause(
+ QString aState)
+{
+ const bool paused = (aState == BLANK_ACTIVE);
+ if (iPaused != paused) {
+ iPaused = paused;
+ Q_EMIT parentObject()->pausedChanged();
+ }
+}
+
+void
+HarbourDisplayBlanking::Private::updateDisplayBlankingAllowed(
+ bool aAllowed)
+{
+ if (iPauseAllowed != aAllowed) {
+ iPauseAllowed = aAllowed;
+ Q_EMIT parentObject()->pauseAllowedChanged();
+ checkPause();
+ }
+}
+
+void
+HarbourDisplayBlanking::Private::onDisplayBlankingPauseChanged(
+ QString aState)
+{
+ HDEBUG(aState);
+ updateDisplayBlankingPause(aState);
+}
+
+void
+HarbourDisplayBlanking::Private::onDisplayBlankingPauseAllowedChanged(
+ bool aAllowed)
+{
+ HDEBUG(aAllowed);
+ updateDisplayBlankingAllowed(aAllowed);
+}
+
+void
+HarbourDisplayBlanking::Private::onDisplayBlankingPauseQueryDone(
+ QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply<QString> reply(*aWatcher);
+ if (reply.isValid() && !reply.isError()) {
+ HDEBUG(reply);
+ updateDisplayBlankingPause(reply.value());
+ } else {
+ HWARN(reply.error());
+ }
+ aWatcher->deleteLater();
+}
+
+void
+HarbourDisplayBlanking::Private::onDisplayBlankingPauseAllowedQueryDone(
+ QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply<bool> reply(*aWatcher);
+ if (reply.isValid() && !reply.isError()) {
+ HDEBUG(reply);
+ updateDisplayBlankingAllowed(reply.value());
+ } else {
+ HWARN(reply.error());
+ updateDisplayBlankingAllowed(true);
+ }
+ aWatcher->deleteLater();
+}
+
+void
+HarbourDisplayBlanking::Private::setPauseRequested(
+ bool aValue)
+{
+ if (iPauseRequested != aValue) {
+ iPauseRequested = aValue;
+ HDEBUG(aValue);
+ Q_EMIT parentObject()->pauseRequestedChanged();
+ checkPause();
+ }
+}
+
+void
+HarbourDisplayBlanking::Private::checkPause()
+{
+ const bool active = iPauseRequested && iPauseAllowed;
+ if (iPauseActive != active) {
+ iPauseActive = active;
+ HDEBUG(active);
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourImageProvider.cpp
^
|
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2018-2019 Jolla Ltd.
+ * Copyright (C) 2018-2019 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 "HarbourImageProvider.h"
+#include "HarbourTheme.h"
+#include "HarbourDebug.h"
+
+#include <QImageReader>
+#include <QQuickWindow>
+
+// ==========================================================================
+// HarbourImageProvider::TextureFactory
+// ==========================================================================
+
+class HarbourImageProvider::TextureFactory : public QQuickTextureFactory
+{
+public:
+ TextureFactory(QString aPath, QSize requestedSize);
+
+ QSGTexture* createTexture(QQuickWindow* aWindow) const Q_DECL_OVERRIDE;
+ QSize textureSize() const Q_DECL_OVERRIDE;
+ int textureByteCount() const Q_DECL_OVERRIDE;
+ QImage image() const Q_DECL_OVERRIDE;
+
+ QImage load() const;
+ static QImage colorize(QImage aImage, QColor aColor);
+
+private:
+ QString iPath;
+ QString iHighlight;
+ QSize iRequestedSize;
+ mutable QImage iImage;
+ HarbourTheme iTheme;
+};
+
+HarbourImageProvider::TextureFactory::TextureFactory(
+ QString aPath,
+ QSize aRequestedSize) :
+ iRequestedSize(aRequestedSize)
+{
+ const int sep1 = aPath.lastIndexOf('?');
+ const int sep2 = aPath.lastIndexOf('/');
+ if (sep1 >= 0 && sep1 > sep2) {
+ iPath = aPath.left(sep1);
+ iHighlight = aPath.mid(sep1 + 1);
+ HDEBUG(iPath << iHighlight);
+ } else {
+ iPath = aPath;
+ }
+}
+
+QImage
+HarbourImageProvider::TextureFactory::load() const
+{
+ if (iImage.isNull() && !iPath.isEmpty()) {
+ if (iRequestedSize.isEmpty()) {
+ if (iImage.load(iPath) && !iImage.size().isEmpty()) {
+ QSize size(iImage.size());
+ if (iRequestedSize.width() > 0) {
+ size.setHeight(qRound(iRequestedSize.width()*
+ (qreal)size.height()/size.width()));
+ size.setWidth(iRequestedSize.width());
+ } else if (iRequestedSize.height() > 0) {
+ size.setWidth(qRound(iRequestedSize.height()*
+ (qreal)size.width()/size.height()));
+ size.setHeight(iRequestedSize.height());
+ }
+ if (iImage.size() != size) {
+ HDEBUG(iImage.size() << "=>" << size);
+ QImageReader imageReader(iPath);
+ imageReader.setScaledSize(size);
+ imageReader.read(&iImage);
+ }
+ }
+ } else {
+ QImageReader imageReader(iPath);
+ imageReader.setScaledSize(iRequestedSize);
+ imageReader.read(&iImage);
+ }
+ if (!iImage.isNull()) {
+ if (iHighlight.isEmpty()) {
+ // Colorize grayscale to match ambience
+ if (iImage.isGrayscale()) {
+ QColor primaryColor(iTheme.primaryColor());
+ if (primaryColor.isValid()) {
+ iImage = colorize(iImage, primaryColor);
+ }
+ }
+ } else {
+ // Colorization required
+ QColor highlightColor(iHighlight);
+ if (highlightColor.isValid()) {
+ HDEBUG(highlightColor);
+ iImage = colorize(iImage, highlightColor);
+ }
+ }
+ } else {
+ HWARN("can't load" << qPrintable(iPath));
+ }
+ }
+ return iImage;
+}
+
+QSize
+HarbourImageProvider::TextureFactory::textureSize() const
+{
+ return image().size();
+}
+
+int
+HarbourImageProvider::TextureFactory::textureByteCount() const
+{
+ QSize size(image().size());
+ return size.width() * size.height() * 4;
+}
+
+QImage
+HarbourImageProvider::TextureFactory::image() const
+{
+ return load();
+}
+
+QSGTexture*
+HarbourImageProvider::TextureFactory::createTexture(
+ QQuickWindow* aWindow) const
+{
+ if (!load().isNull()) {
+ QSGTexture* texture = aWindow->createTextureFromImage(iImage);
+ if (qEnvironmentVariableIsSet("QSG_TRANSIENT_IMAGES")) {
+ iImage = QImage();
+ }
+ return texture;
+ }
+ return NULL;
+}
+
+QImage
+HarbourImageProvider::TextureFactory::colorize(
+ QImage aImage,
+ QColor aColor)
+{
+ QImage::Format format = aImage.format();
+ switch (format) {
+ case QImage::Format_ARGB32:
+ case QImage::Format_ARGB32_Premultiplied:
+ break;
+ default:
+ HWARN("TextureFactory: Image format not supported, doing format conversion");
+ aImage = aImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ format = QImage::Format_ARGB32_Premultiplied;
+ }
+
+ const QRgb rgb = aColor.rgba() & 0x00ffffff;
+ QRgb* bits = (QRgb*)aImage.bits();
+ const int numPixels = aImage.byteCount()/sizeof(QRgb);
+
+ if (format == QImage::Format_ARGB32) {
+ for (int i=0; i<numPixels; i++) {
+ QRgb alpha = bits[i] & 0xff000000;
+ bits[i] = alpha | rgb;
+ }
+ } else if (format == QImage::Format_ARGB32_Premultiplied) {
+ QRgb colorPremultiplied[256];
+ for (int alpha = 0; alpha<256; alpha++) {
+ colorPremultiplied[alpha] =
+ (alpha << 24) |
+ (alpha*qRed(rgb)/255 << 16) |
+ (alpha*qGreen(rgb)/255 << 8) |
+ (alpha*qBlue(rgb) /255);
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourJson.cpp
^
|
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2015-2020 Jolla Ltd.
+ * Copyright (C) 2015-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
+ * 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 "HarbourJson.h"
+#include "HarbourDebug.h"
+
+#include <QDir>
+#include <QFile>
+#include <QFileInfo>
+
+#if QT_VERSION >= 0x050000
+# include <QJsonDocument>
+# include <QJsonObject>
+#else
+# include <qjson/parser.h>
+# include <qjson/serializer.h>
+#endif
+
+#include <unistd.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+bool HarbourJson::save(const QString& aPath, const QVariantMap& aMap)
+{
+ QFileInfo file(aPath);
+ QDir dir(file.dir());
+ if (dir.mkpath(dir.absolutePath())) {
+ const QString absPath(file.absoluteFilePath());
+ QFile f(absPath);
+ if (!aMap.isEmpty()) {
+ struct stat st;
+ const QByteArray pathBytes(absPath.toLocal8Bit());
+ const char* path = pathBytes.constData();
+ const bool haveFileAttr = (stat(path, &st) == 0);
+
+ if (f.open(QIODevice::WriteOnly)) {
+ bool ok;
+#if QT_VERSION >= 0x050000
+ if (f.write(QJsonDocument::fromVariant(aMap).toJson()) >= 0) {
+ ok = true;
+ } else {
+ HWARN("Error writing" << absPath << f.errorString());
+ }
+#else
+ QJson::Serializer serializer;
+ QByteArray json = serializer.serialize(aMap);
+ if (!json.isNull()) {
+ if (f.write(json) >= 0) {
+ ok = true;
+ } else {
+ HWARN("Error writing" << absPath << f.errorString());
+ }
+ } else {
+ HWARN("Json serialization error");
+ }
+#endif
+ if (ok) {
+ if (haveFileAttr) {
+ // Try to restore ownership and mode
+ if (chown(path, st.st_uid, st.st_gid)) {
+ HWARN("Failed to chown" << path << ":" <<
+ strerror(errno));
+ }
+ if (chmod(path, st.st_mode & ~S_IFMT)) {
+ HWARN("Failed to chmod" << path << ":" <<
+ strerror(errno));
+ }
+ }
+ return true;
+ }
+ } else {
+ HWARN("Error opening" << absPath << f.errorString());
+ }
+ } else if (!f.remove()) {
+ HWARN("Error removing" << absPath << f.errorString());
+ }
+ } else {
+ HWARN("Failed to create" << dir.absolutePath());
+ }
+ return false;
+}
+
+bool HarbourJson::load(const QString& aPath, QVariantMap& aRoot)
+{
+ QFile f(aPath);
+ if (f.exists()) {
+ if (f.open(QIODevice::ReadOnly)) {
+ HDEBUG("reading" << aPath);
+#if QT_VERSION >= 0x050000
+ QJsonDocument doc(QJsonDocument::fromJson(f.readAll()).object());
+ if (!doc.isEmpty()) {
+ aRoot = doc.toVariant().toMap();
+ return true;
+ }
+#else
+ QJson::Parser parser;
+ QVariant result = parser.parse(&f);
+ if (result.isValid()) {
+ aRoot = result.toMap();
+ return true;
+ } else {
+ HWARN("Failed to parse" << qPrintable(aPath));
+ }
+#endif
+ } else {
+ HDEBUG("can't open" << aPath << f.errorString());
+ }
+ }
+ return false;
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourLib.cpp
^
|
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2015-2018 Jolla Ltd.
+ * Copyright (C) 2015-2018 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:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of Jolla Ltd 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 "HarbourLib.h"
+#include "HarbourDebug.h"
+#include "HarbourDisplayBlanking.h"
+#include "HarbourSystemState.h"
+#include "HarbourTemporaryFile.h"
+#include "HarbourTransferMethodsModel.h"
+
+#if QT_VERSION >= 0x050000
+# include <QtQml>
+#else
+# include <QtDeclarative/qdeclarative.h>
+#endif
+
+QML_DECLARE_TYPE(HarbourDisplayBlanking)
+QML_DECLARE_TYPE(HarbourSystemState)
+QML_DECLARE_TYPE(HarbourTransferMethodsModel)
+QML_DECLARE_TYPE(HarbourTemporaryFile)
+
+void
+HarbourLib::registerTypes(
+ const char* aUri,
+ int aMajor,
+ int aMinor)
+{
+ HDEBUG(aUri << aMinor << aMajor);
+ qmlRegisterType<HarbourDisplayBlanking>(aUri, aMajor, aMinor, "DisplayBlanking");
+ qmlRegisterType<HarbourSystemState>(aUri, aMajor, aMinor, "SystemState");
+ qmlRegisterType<HarbourTemporaryFile>(aUri, aMajor, aMinor, "TemporaryFile");
+ qmlRegisterType<HarbourTransferMethodsModel>(aUri, aMajor, aMinor, "TransferMethodsModel");
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourMce.cpp
^
|
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2018 Jolla Ltd.
+ * Copyright (C) 2018 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:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - 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.
+ * - Neither the name of Jolla Ltd 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 "HarbourMce.h"
+
+#include <QDBusMessage>
+#include <QDBusConnection>
+#include <QDBusPendingCall>
+#include <QDBusPendingCallWatcher>
+#include <QDBusPendingReply>
+
+const QString HarbourMce::MCE_SERVICE("com.nokia.mce");
+const QString HarbourMce::MCE_REQUEST_PATH("/com/nokia/mce/request");
+const QString HarbourMce::MCE_REQUEST_INTERFACE("com.nokia.mce.request");
+const QString HarbourMce::MCE_SIGNAL_PATH("/com/nokia/mce/signal");
+const QString HarbourMce::MCE_SIGNAL_INTERFACE("com.nokia.mce.signal");
+
+HarbourMce::HarbourMce(QObject* aParent) :
+ QObject(aParent)
+{
+}
+
+QDBusConnection
+HarbourMce::bus()
+{
+ return QDBusConnection::systemBus();
+}
+
+QDBusPendingCall
+HarbourMce::request(
+ QString aMethod)
+{
+ return bus().asyncCall(QDBusMessage::createMethodCall(MCE_SERVICE,
+ MCE_REQUEST_PATH, MCE_REQUEST_INTERFACE, aMethod));
+}
+
+void
+HarbourMce::setupProperty(
+ QString aQueryMethod,
+ QString aSignal,
+ const char* aQuerySlot,
+ const char* aSignalSlot)
+{
+ bus().connect(MCE_SERVICE, MCE_SIGNAL_PATH, MCE_SIGNAL_INTERFACE,
+ aSignal, this, aSignalSlot);
+ connect(new QDBusPendingCallWatcher(request(aQueryMethod), this),
+ SIGNAL(finished(QDBusPendingCallWatcher*)), this, aQuerySlot);
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourMce.h
^
|
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2018 Jolla Ltd.
+ * Copyright (C) 2018 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:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * - 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.
+ * - Neither the name of Jolla Ltd 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_MCE_H
+#define HARBOUR_MCE_H
+
+#include <QDBusConnection>
+#include <QDBusPendingCall>
+
+class HarbourMce : public QObject {
+ Q_OBJECT
+
+public:
+ static const QString MCE_SERVICE;
+ static const QString MCE_REQUEST_PATH;
+ static const QString MCE_REQUEST_INTERFACE;
+ static const QString MCE_SIGNAL_PATH;
+ static const QString MCE_SIGNAL_INTERFACE;
+
+ HarbourMce(QObject* aParent);
+ static QDBusConnection bus();
+ static QDBusPendingCall request(QString aMethod);
+ void setupProperty(QString aQueryMethod, QString aSignal,
+ const char* aQuerySlot, const char* aSignalSlot);
+};
+
+#endif // HARBOUR_MCE_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourMediaPlugin.cpp
^
|
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2017-2020 Jolla Ltd.
+ * Copyright (C) 2017-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
+ * 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 "HarbourMediaPlugin.h"
+#include "HarbourDebug.h"
+
+// Workaround for org.nemomobile.policy (or Sailfish.Media) not being
+// allowed in harbour apps
+
+HarbourMediaPlugin* HarbourMediaPlugin::gInstance = Q_NULLPTR;
+
+const char HarbourMediaPlugin::MEDIAKEY_QML_TYPE[] = "MediaKey";
+
+HarbourMediaPlugin::HarbourMediaPlugin(
+ QQmlEngine* aEngine) :
+ HarbourPluginLoader(aEngine, "Sailfish.Media", 1, 0)
+{
+}
+
+HarbourMediaPlugin::~HarbourMediaPlugin()
+{
+ HASSERT(gInstance == this);
+ gInstance = Q_NULLPTR;
+}
+
+void
+HarbourMediaPlugin::registerTypes(
+ const char* aModule,
+ int aMajor,
+ int aMinor)
+{
+ reRegisterType(MEDIAKEY_QML_TYPE, aModule, aMajor, aMinor);
+}
+
+void
+HarbourMediaPlugin::registerTypes(
+ QQmlEngine* aEngine,
+ const char* aModule,
+ int aMajor,
+ int aMinor)
+{
+ if (!gInstance) {
+ gInstance = new HarbourMediaPlugin(aEngine);
+ }
+ gInstance->registerTypes(aModule, aMajor, aMinor);
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourObject.cpp
^
|
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 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 "HarbourObject.h"
+
+HarbourObject::HarbourObject(QObject* aParent) :
+ QObject(aParent)
+{
+}
+
+QQmlListProperty<QObject> HarbourObject::children()
+{
+ return QQmlListProperty<QObject>(this, iChidren);
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourOrganizeListModel.cpp
^
|
@@ -0,0 +1,236 @@
+/*
+ * 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 "HarbourOrganizeListModel.h"
+
+#include "HarbourDebug.h"
+
+// ==========================================================================
+// HarbourOrganizeListModel::Private
+// ==========================================================================
+
+class HarbourOrganizeListModel::Private {
+public:
+ Private();
+
+ int mapToSource(int aRow) const;
+ int mapFromSource(int aRow) const;
+
+public:
+ int iDragIndex;
+ int iDragPos;
+ const char* iRowsAboutToBeMovedSlot;
+ const char* iRowsMovedSlot;
+};
+
+HarbourOrganizeListModel::Private::Private() :
+ iDragIndex(-1),
+ iDragPos(-1),
+ iRowsAboutToBeMovedSlot(SLOT(_q_sourceRowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))),
+ iRowsMovedSlot(SLOT(_q_sourceRowsMoved(QModelIndex,int,int,QModelIndex,int)))
+{
+}
+
+int HarbourOrganizeListModel::Private::mapToSource(int aRow) const
+{
+ if (iDragIndex < iDragPos) {
+ if (aRow < iDragIndex || aRow > iDragPos) {
+ return aRow;
+ } else if (aRow == iDragPos) {
+ return iDragIndex;
+ } else {
+ return aRow + 1;
+ }
+ } else if (iDragPos < iDragIndex) {
+ if (aRow < iDragPos || aRow > iDragIndex) {
+ return aRow;
+ } else if (aRow == iDragPos) {
+ return iDragIndex;
+ } else {
+ return aRow - 1;
+ }
+ }
+ return aRow;
+}
+
+int HarbourOrganizeListModel::Private::mapFromSource(int aRow) const
+{
+ if (iDragIndex < iDragPos) {
+ if (aRow < iDragIndex || aRow > iDragPos) {
+ return aRow;
+ } else if (aRow == iDragIndex) {
+ return iDragPos;
+ } else {
+ return aRow - 1;
+ }
+ } else if (iDragPos < iDragIndex) {
+ if (aRow < iDragPos || aRow > iDragIndex) {
+ return aRow;
+ } else if (aRow == iDragIndex) {
+ return iDragPos;
+ } else {
+ return aRow + 1;
+ }
+ }
+ return aRow;
+}
+
+// ==========================================================================
+// HarbourOrganizeListModel
+// ==========================================================================
+
+#define SUPER QSortFilterProxyModel
+
+HarbourOrganizeListModel::HarbourOrganizeListModel(QObject* aParent) :
+ SUPER(aParent),
+ iPrivate(new Private)
+{
+ connect(this, SIGNAL(sourceModelChanged()), SIGNAL(sourceModelObjectChanged()));
+}
+
+HarbourOrganizeListModel::~HarbourOrganizeListModel()
+{
+ delete iPrivate;
+}
+
+void HarbourOrganizeListModel::setSourceModelObject(QObject* aModel)
+{
+ setSourceModel(qobject_cast<QAbstractItemModel*>(aModel));
+}
+
+int HarbourOrganizeListModel::dragIndex() const
+{
+ return iPrivate->iDragIndex;
+}
+
+int HarbourOrganizeListModel::dragPos() const
+{
+ return iPrivate->iDragPos;
+}
+
+QModelIndex HarbourOrganizeListModel::mapToSource(const QModelIndex& aIndex) const
+{
+ QAbstractItemModel* source = sourceModel();
+ if (source) {
+ return source->index(iPrivate->mapToSource(aIndex.row()), aIndex.column());
+ }
+ return aIndex;
+}
+
+QModelIndex HarbourOrganizeListModel::mapFromSource(const QModelIndex& aIndex) const
+{
+ return index(iPrivate->mapFromSource(aIndex.row()), aIndex.column());
+}
+
+void HarbourOrganizeListModel::setDragIndex(int aIndex)
+{
+ HDEBUG(aIndex);
+ if (aIndex < 0) {
+ if (iPrivate->iDragIndex >= 0) {
+ // Drag is finished
+ if (iPrivate->iDragPos != iPrivate->iDragIndex) {
+ const int dragIndex = iPrivate->iDragIndex;
+ const int dragPos = iPrivate->iDragPos;
+ iPrivate->iDragPos = iPrivate->iDragIndex = -1;
+ QAbstractItemModel* source = sourceModel();
+ if (source) {
+ //
+ // Now, this is getting a bit hackish.
+ //
+ // We don't need QSortFilterProxyModel to react to
+ // rowsAboutToBeMoved and rowsMoved signals emitted
+ // by the source model when we invoke moveRow() because
+ // that would result in layoutChanged signal which
+ // would reset the view (its current position etc).
+ // That's totally unnecessary because all the rows
+ // are already in the right place as long as the view
+ // is concerned.
+ //
+ // It looks a bit fragile since these slots are
+ // internal and can change at any point of time.
+ // Well, in the worst case we would get the view
+ // reset.
+ //
+ QObject::disconnect(source,
+ SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, iPrivate->iRowsAboutToBeMovedSlot);
+ QObject::disconnect(source,
+ SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, iPrivate->iRowsMovedSlot);
+
+ // Actually move the row
+ source->moveRow(QModelIndex(), dragIndex, QModelIndex(), dragPos);
+
+ // And (hopefully) reconnect the handlers.
+ QObject::connect(source,
+ SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, iPrivate->iRowsAboutToBeMovedSlot);
+ QObject::connect(source,
+ SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/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:
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourPolicyPlugin.cpp
^
|
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2017-2020 Jolla Ltd.
+ * Copyright (C) 2017-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
+ * 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 "HarbourPolicyPlugin.h"
+#include "HarbourDebug.h"
+
+// Workaround for org.nemomobile.policy (or Nemo.Policy) not being
+// allowed in harbour apps
+
+HarbourPolicyPlugin* HarbourPolicyPlugin::gInstance = Q_NULLPTR;
+
+const char HarbourPolicyPlugin::RESOURCE_QML_TYPE[] = "Resource";
+const char HarbourPolicyPlugin::PERMISSIONS_QML_TYPE[] = "Permissions";
+
+HarbourPolicyPlugin::HarbourPolicyPlugin(
+ QQmlEngine* aEngine) :
+ HarbourPluginLoader(aEngine, "org.nemomobile.policy", 1, 0)
+{
+}
+
+HarbourPolicyPlugin::~HarbourPolicyPlugin()
+{
+ HASSERT(gInstance == this);
+ gInstance = Q_NULLPTR;
+}
+
+void
+HarbourPolicyPlugin::registerTypes(
+ const char* aModule,
+ int aMajor,
+ int aMinor)
+{
+ reRegisterType(RESOURCE_QML_TYPE, aModule, aMajor, aMinor);
+ reRegisterType(PERMISSIONS_QML_TYPE, aModule, aMajor, aMinor);
+}
+
+void
+HarbourPolicyPlugin::registerTypes(
+ QQmlEngine* aEngine,
+ const char* aModule,
+ int aMajor,
+ int aMinor)
+{
+ if (!gInstance) {
+ gInstance = new HarbourPolicyPlugin(aEngine);
+ }
+ gInstance->registerTypes(aModule, aMajor, aMinor);
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/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:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourQrCodeGenerator.cpp
^
|
@@ -0,0 +1,273 @@
+/*
+ * 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.
+ */
+
+#include "HarbourQrCodeGenerator.h"
+
+#include "HarbourBase32.h"
+#include "HarbourTask.h"
+#include "HarbourDebug.h"
+
+#include <QThreadPool>
+
+#include "qrencode.h"
+
+// ==========================================================================
+// HarbourQrCodeGenerator::Task
+// ==========================================================================
+
+class HarbourQrCodeGenerator::Task : public HarbourTask
+{
+ Q_OBJECT
+
+public:
+ Task(QThreadPool* aPool, QString aText, ECLevel aEcLevel);
+ void performTask() Q_DECL_OVERRIDE;
+
+public:
+ QString iText;
+ QString iCode;
+ ECLevel iEcLevel;
+};
+
+HarbourQrCodeGenerator::Task::Task(QThreadPool* aPool, QString aText,
+ ECLevel aEcLevel) :
+ HarbourTask(aPool),
+ iText(aText),
+ iEcLevel(aEcLevel)
+{
+}
+
+void HarbourQrCodeGenerator::Task::performTask()
+{
+ QByteArray bytes(generate(iText, iEcLevel));
+ if (!bytes.isEmpty()) {
+ iCode = HarbourBase32::toBase32(bytes);
+ }
+}
+
+// ==========================================================================
+// HarbourQrCodeGenerator::Private
+// ==========================================================================
+
+class HarbourQrCodeGenerator::Private : public QObject
+{
+ Q_OBJECT
+
+public:
+ Private(HarbourQrCodeGenerator* aParent);
+ ~Private();
+
+ HarbourQrCodeGenerator* parentObject() const;
+ void setText(QString aValue);
+ void setEcLevel(int aValue);
+ void regenerate();
+
+ static QRecLevel realEcLevel(ECLevel aEcLevel);
+
+public Q_SLOTS:
+ void onTaskDone();
+
+public:
+ QThreadPool* iThreadPool;
+ Task* iTask;
+ ECLevel iEcLevel;
+ QString iText;
+ QString iCode;
+};
+
+HarbourQrCodeGenerator::Private::Private(HarbourQrCodeGenerator* aParent) :
+ QObject(aParent),
+ iThreadPool(new QThreadPool(this)),
+ iTask(Q_NULLPTR),
+ iEcLevel(ECLevelDefault)
+{
+ // Serialize the tasks:
+ iThreadPool->setMaxThreadCount(1);
+}
+
+HarbourQrCodeGenerator::Private::~Private()
+{
+ if (iTask) iTask->release();
+ iThreadPool->waitForDone();
+}
+
+inline HarbourQrCodeGenerator* HarbourQrCodeGenerator::Private::parentObject() const
+{
+ return qobject_cast<HarbourQrCodeGenerator*>(parent());
+}
+
+QRecLevel HarbourQrCodeGenerator::Private::realEcLevel(ECLevel aEcLevel)
+{
+ switch (aEcLevel) {
+ case ECLevel_L: return QR_ECLEVEL_L;
+ case ECLevel_M: return QR_ECLEVEL_M;
+ case ECLevel_Q: return QR_ECLEVEL_Q;
+ case ECLevel_H: return QR_ECLEVEL_H;
+ case ECLevelDefault:
+ case ECLevelCount:
+ break;
+ }
+ return QR_ECLEVEL_M; // default
+}
+
+void HarbourQrCodeGenerator::Private::setText(QString aText)
+{
+ if (iText != aText) {
+ iText = aText;
+ regenerate();
+ Q_EMIT parentObject()->textChanged();
+ }
+}
+
+void HarbourQrCodeGenerator::Private::setEcLevel(int aValue)
+{
+ const ECLevel level = (aValue < ECLevelDefault) ? ECLevelDefault :
+ (aValue > ECLevelHighest) ? ECLevelHighest : (ECLevel)aValue;
+ if (iEcLevel != level) {
+ const QRecLevel prevRealLevel = realEcLevel(iEcLevel);
+ iEcLevel = level;
+ if (realEcLevel(level) != prevRealLevel) {
+ regenerate();
+ }
+ Q_EMIT parentObject()->ecLevelChanged();
+ }
+}
+
+void HarbourQrCodeGenerator::Private::regenerate()
+{
+ HarbourQrCodeGenerator* obj = parentObject();
+ const bool wasRunning = (iTask != Q_NULLPTR);
+ if (iTask) iTask->release();
+ iTask = new Task(iThreadPool, iText, iEcLevel);
+ iTask->submit(this, SLOT(onTaskDone()));
+ if (!wasRunning) {
+ Q_EMIT obj->runningChanged();
+ }
+}
+
+void HarbourQrCodeGenerator::Private::onTaskDone()
+{
+ if (sender() == iTask) {
+ HarbourQrCodeGenerator* obj = parentObject();
+ const bool qrCodeChanged = (iCode != iTask->iCode);
+ iCode = iTask->iCode;
+ iTask->release();
+ iTask = NULL;
+ if (qrCodeChanged) {
+ Q_EMIT obj->codeChanged();
+ }
+ Q_EMIT obj->runningChanged();
+ }
+}
+
+// ==========================================================================
+// HarbourQrCodeGenerator
+// ==========================================================================
+
+HarbourQrCodeGenerator::HarbourQrCodeGenerator(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private(this))
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourQrCodeImageProvider.cpp
^
|
@@ -0,0 +1,126 @@
+/*
+ * 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 "HarbourQrCodeImageProvider.h"
+
+#include "HarbourBase32.h"
+#include "HarbourDebug.h"
+
+#include <QVector>
+#include <QColor>
+#include <QRgb>
+
+const QColor HarbourQrCodeImageProvider::DEFAULT_COLOR(Qt::black);
+const QColor HarbourQrCodeImageProvider::DEFAULT_BACKGROUND(Qt::transparent);
+
+QImage HarbourQrCodeImageProvider::createImage(QByteArray aBits, QColor aColor, QColor aBackground)
+{
+ if (aBits.size() > 0) {
+ // Bits are packed, rows are rounded at byte boundary
+ int rows, rowSize;
+ for (rows = 2; ((rowSize = (rows + 7)/8) * rows) < aBits.size(); rows++);
+ if ((rows * rowSize) == aBits.size()) {
+ HDEBUG(rows << "x" << rows);
+ QImage img(rows, rows, QImage::Format_Mono);
+ QVector<QRgb> colors;
+ QColor background(aBackground.isValid() ? aBackground : DEFAULT_BACKGROUND);
+ QColor color(aColor.isValid() ? aColor : DEFAULT_COLOR);
+ colors.append(background.rgba());
+ colors.append(color.rgba());
+ img.setColorTable(colors);
+ for (int y = 0; y < rows; y++) {
+ memcpy(img.scanLine(y), aBits.constData() + y * rowSize, rowSize);
+ }
+ return img;
+ }
+ }
+ return QImage();
+}
+
+QImage HarbourQrCodeImageProvider::requestImage(const QString& aId, QSize* aSize, const QSize&)
+{
+ // Default background and foreground
+ QColor background(DEFAULT_BACKGROUND), color(DEFAULT_COLOR);
+
+ // Parse parameters
+ QString base32;
+ const int sep = aId.indexOf('?');
+ if (sep < 0) {
+ base32 = aId;
+ } else {
+ base32 = aId.left(sep);
+ const QStringList params(aId.mid(sep + 1).split('&', QString::SkipEmptyParts));
+ const int n = params.count();
+ for (int i = 0; i < n; i++) {
+ const QString param(params.at(i));
+ const int eq = param.indexOf('=');
+ if (eq > 0) {
+ static const QString BACKGROUND("background");
+ static const QString COLOR("color");
+ const QString name(param.left(eq).trimmed());
+ const QString value(param.mid(eq + 1).trimmed());
+ if (name == COLOR) {
+ const QColor colorValue(value);
+ if (colorValue.isValid()) {
+ color = colorValue;
+ } else {
+ HDEBUG("Invalid" << qPrintable(name) << value);
+ }
+ } else if (name == BACKGROUND) {
+ const QColor colorValue(value);
+ if (colorValue.isValid()) {
+ background = colorValue;
+ } else {
+ HDEBUG("Invalid" << qPrintable(name) << value);
+ }
+ } else {
+ HDEBUG("Invalid parameter name" << name);
+ }
+ } else {
+ HDEBUG("Invalid parameter" << param);
+ }
+ }
+ }
+
+ // Decode BASE32
+ const QByteArray bits(HarbourBase32::fromBase32(base32.toLocal8Bit()));
+ HDEBUG(base32 << "=>" << bits.size() << "bytes");
+
+ // Convert to image
+ QImage img(createImage(bits, color, background));
+ if (!img.isNull() && aSize) {
+ *aSize = img.size();
+ }
+
+ return img;
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourSelectionListModel.cpp
^
|
@@ -0,0 +1,312 @@
+/*
+ * 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()) {
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourSigChildHandler.cpp
^
|
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2016 Jolla Ltd.
+ * Contact: Slava Monich <slava.monich@jolla.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 name of Jolla Ltd 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 "HarbourSigChildHandler.h"
+#include "HarbourDebug.h"
+
+#include <QSocketNotifier>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+// Based on "Calling Qt Functions From Unix Signal Handlers" article
+// http://doc.qt.io/qt-4.8/unix-signals.html
+
+class HarbourSigChildHandler::Private : public QSocketNotifier {
+ Q_OBJECT
+public:
+ static Private* get();
+
+private:
+ Private(int aFd[]);
+ ~Private();
+
+ static void handler(int, siginfo_t* aInfo, void*);
+
+Q_SIGNALS:
+ void processDied(int aPid, int aStatus);
+
+private Q_SLOTS:
+ void handleSigChild();
+
+private:
+ static Private* gInstance;
+ int iFd[2];
+};
+
+HarbourSigChildHandler::Private* HarbourSigChildHandler::Private::gInstance = NULL;
+
+HarbourSigChildHandler::Private::Private(int aFd[]) :
+ QSocketNotifier(aFd[1], QSocketNotifier::Read)
+{
+ iFd[0] = aFd[0];
+ iFd[1] = aFd[1];
+ connect(this, SIGNAL(activated(int)), SLOT(handleSigChild()));
+}
+
+// This object is actually never deleted because there's no easy way
+// to properly synchronize deletion with the incoming signal.
+HarbourSigChildHandler::Private::~Private()
+{
+ close(iFd[0]);
+ close(iFd[1]);
+}
+
+HarbourSigChildHandler::Private* HarbourSigChildHandler::Private::get()
+{
+ if (!gInstance) {
+ int fd[2];
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) == 0) {
+ struct sigaction act;
+ memset (&act, 0, sizeof(act));
+ act.sa_sigaction = Private::handler;
+ act.sa_flags = SA_SIGINFO;
+ HDEBUG("Installing SIGCHLD handler");
+ gInstance = new Private(fd);
+ sigaction(SIGCHLD, &act, NULL);
+ } else {
+ HWARN("Failed to create socket pair");
+ }
+ }
+ return gInstance;
+}
+
+void HarbourSigChildHandler::Private::handler(int, siginfo_t* aInfo, void*)
+{
+ int status = -1;
+ waitpid(aInfo->si_pid, &status, 0);
+ HASSERT(gInstance);
+ if (gInstance) {
+ int data[2];
+ data[0] = aInfo->si_pid;
+ data[1] = status;
+ write(gInstance->iFd[0], data, sizeof(data));
+ }
+}
+
+void HarbourSigChildHandler::Private::handleSigChild()
+{
+ int data[2];
+ if (read(iFd[1], data, sizeof(data)) == sizeof(data)) {
+ HDEBUG("Child" << data[0] << "died, status" << data[1]);
+ Q_EMIT processDied(data[0], data[1]);
+ } else {
+ HWARN("Error handling SIGCHLD");
+ }
+}
+
+HarbourSigChildHandler::HarbourSigChildHandler(Private* aPrivate, QObject* aParent) :
+ QObject(aParent), iPrivate(aPrivate)
+{
+ connect(iPrivate, SIGNAL(processDied(int,int)), SIGNAL(processDied(int,int)));
+}
+
+HarbourSigChildHandler::~HarbourSigChildHandler()
+{
+}
+
+HarbourSigChildHandler* HarbourSigChildHandler::install(QObject* aParent)
+{
+ Private* priv = Private::get();
+ return priv ? new HarbourSigChildHandler(priv, aParent) : NULL;
+}
+
+#include "HarbourSigChildHandler.moc"
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourSingleImageProvider.cpp
^
|
@@ -0,0 +1,221 @@
+/*
+ * 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 "HarbourSingleImageProvider.h"
+
+#include "HarbourDebug.h"
+
+#include <QQuickImageProvider>
+#include <QQmlEngine>
+#include <QQmlContext>
+
+// ==========================================================================
+// HarbourSingleImageProvider::ImageProvider
+// ==========================================================================
+
+class HarbourSingleImageProvider::ImageProvider : public QQuickImageProvider {
+public:
+ static const QString IMAGE_NAME;
+
+ ImageProvider(QImage aImage);
+
+ QImage requestImage(const QString& aId, QSize* aSize,
+ const QSize& aRequested) Q_DECL_OVERRIDE;
+
+private:
+ QImage iImage;
+};
+
+const QString HarbourSingleImageProvider::ImageProvider::IMAGE_NAME("image");
+
+HarbourSingleImageProvider::ImageProvider::ImageProvider(QImage aImage) :
+ QQuickImageProvider(Image),
+ iImage(aImage)
+{
+}
+
+QImage HarbourSingleImageProvider::ImageProvider::requestImage(const QString& aId,
+ QSize* aSize, const QSize& aRequested)
+{
+ HDEBUG(aId);
+ if (aSize) {
+ *aSize = iImage.size();
+ }
+ return iImage;
+}
+
+// ==========================================================================
+// HarbourSingleImageProvider::Private
+// ==========================================================================
+
+class HarbourSingleImageProvider::Private : public QObject {
+ Q_OBJECT
+
+public:
+ Private(HarbourSingleImageProvider* aParent);
+ ~Private();
+
+ bool setEngine(QQmlEngine* aEngine);
+ bool setImage(QImage aImage);
+ void registerProvider();
+
+public Q_SLOTS:
+ void onEngineDied();
+
+public:
+ QImage iImage;
+ QString iId;
+ QString iSourceUri;
+ QQmlEngine* iEngine;
+};
+
+HarbourSingleImageProvider::Private::Private(HarbourSingleImageProvider* aParent) :
+ QObject(aParent),
+ iEngine(Q_NULLPTR)
+{
+}
+
+HarbourSingleImageProvider::Private::~Private()
+{
+ if (!iId.isEmpty()) {
+ iEngine->removeImageProvider(iId);
+ }
+}
+
+void HarbourSingleImageProvider::Private::registerProvider()
+{
+ QQmlImageProviderBase* provider = new ImageProvider(iImage);
+ iId = QString().sprintf("HarbourSingleImageProvider%p", provider);
+ iSourceUri = QString("image://%1/%2").arg(iId, ImageProvider::IMAGE_NAME);
+ HDEBUG("registering provider" << iId);
+ iEngine->addImageProvider(iId, provider);
+}
+
+bool HarbourSingleImageProvider::Private::setEngine(QQmlEngine* aEngine)
+{
+ if (iEngine) {
+ if (!iId.isEmpty()) {
+ iEngine->removeImageProvider(iId);
+ iId = QString();
+ }
+ iEngine->disconnect(this);
+ }
+ iEngine = aEngine;
+ if (iEngine) {
+ connect(iEngine, SIGNAL(destroyed(QObject*)), SLOT(onEngineDied()));
+ if (!iImage.isNull()) {
+ registerProvider();
+ return true;
+ }
+ }
+ return false;
+}
+
+bool HarbourSingleImageProvider::Private::setImage(QImage aImage)
+{
+ HDEBUG(aImage);
+ if (!iId.isEmpty()) {
+ iEngine->removeImageProvider(iId);
+ }
+ iImage = aImage;
+ if (iEngine && !iImage.isNull()) {
+ registerProvider();
+ return true;
+ }
+ return false;
+}
+
+void HarbourSingleImageProvider::Private::onEngineDied()
+{
+ HDEBUG("engine died");
+ iEngine = Q_NULLPTR;
+ iId = QString();
+}
+
+// ==========================================================================
+// HarbourSingleImageProvider
+// ==========================================================================
+
+HarbourSingleImageProvider::HarbourSingleImageProvider(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private(this))
+{
+}
+
+void HarbourSingleImageProvider::classBegin()
+{
+}
+
+void HarbourSingleImageProvider::componentComplete()
+{
+ QQmlContext* context = QQmlEngine::contextForObject(this);
+ HDEBUG(context);
+ if (context) {
+ QQmlEngine* engine = context->engine();
+ HDEBUG(engine);
+ if (iPrivate->setEngine(engine)) {
+ Q_EMIT sourceChanged();
+ }
+ }
+}
+
+QImage HarbourSingleImageProvider::image() const
+{
+ return iPrivate->iImage;
+}
+
+void HarbourSingleImageProvider::setImage(QImage aImage)
+{
+ HDEBUG(aImage);
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourSystem.cpp
^
|
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 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 "HarbourSystem.h"
+#include "HarbourDebug.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+#ifdef LIBDIR
+# define HARBOUR_LIBDIR LIBDIR
+#elif defined __aarch64__
+# define HARBOUR_LIBDIR "/usr/lib64"
+#else
+# define HARBOUR_LIBDIR "/usr/lib"
+#endif
+
+void* HarbourDlopen(const char* aLibFile, int aFlags)
+{
+ const char* libdir = HARBOUR_LIBDIR;
+ const size_t libdir_len = strlen(libdir);
+ const size_t libfile_len = strlen(aLibFile);
+ char* filename = (char*) malloc(libdir_len + libfile_len + 2);
+ void* handle;
+
+ memcpy(filename, libdir, libdir_len);
+ memcpy(filename + libdir_len + 1, aLibFile, libfile_len);
+ filename[libdir_len] = '/';
+ filename[libdir_len + 1 + libfile_len] = '\0';
+ handle = dlopen(filename, aFlags);
+ if (!handle) {
+ HWARN("Failed to load" << filename);
+ }
+ free(filename);
+ return handle;
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/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");
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourSystemState.cpp
^
|
@@ -0,0 +1,242 @@
+/*
+ * Copyright (C) 2015-2019 Jolla Ltd.
+ * Copyright (C) 2015-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 "HarbourSystemState.h"
+#include "HarbourDebug.h"
+#include "HarbourMce.h"
+
+#include <QQmlEngine>
+
+#include <QDBusMessage>
+#include <QDBusConnection>
+#include <QDBusPendingCall>
+#include <QDBusPendingCallWatcher>
+#include <QDBusPendingReply>
+
+const QString HarbourSystemState::MCE_DISPLAY_ON("on");
+const QString HarbourSystemState::MCE_DISPLAY_DIM("dimmed");
+const QString HarbourSystemState::MCE_DISPLAY_OFF("off");
+const QString HarbourSystemState::MCE_TK_LOCKED("locked");
+const QString HarbourSystemState::MCE_TK_UNLOCKED("unlocked");
+
+// ==========================================================================
+// HarbourSystemState::Private
+// ==========================================================================
+class HarbourSystemState::Private : public HarbourMce {
+ Q_OBJECT
+
+public:
+ static QWeakPointer<HarbourSystemState> sSharedInstance;
+ HarbourSystemState* iParent;
+ QString iDisplayStatus;
+ QString iLockMode;
+
+ Private(HarbourSystemState* aParent);
+
+ bool displayOff() const;
+ bool locked() const;
+
+private:
+ void setDisplayStatus(QString aStatus);
+ void setLockMode(QString aStatus);
+
+public Q_SLOTS:
+ void onDisplayStatusChanged(QString);
+ void onDisplayStatusQueryDone(QDBusPendingCallWatcher*);
+ void onLockModeChanged(QString);
+ void onLockModeQueryDone(QDBusPendingCallWatcher*);
+};
+
+QWeakPointer<HarbourSystemState> HarbourSystemState::Private::sSharedInstance;
+
+HarbourSystemState::Private::Private(
+ HarbourSystemState* aParent) :
+ HarbourMce(aParent),
+ iParent(aParent)
+{
+ HDEBUG("created");
+ setupProperty("get_display_status", "display_status_ind",
+ SLOT(onDisplayStatusQueryDone(QDBusPendingCallWatcher*)),
+ SLOT(onDisplayStatusChanged(QString)));
+ setupProperty("get_tklock_mode", "tklock_mode_ind",
+ SLOT(onLockModeQueryDone(QDBusPendingCallWatcher*)),
+ SLOT(onLockModeChanged(QString)));
+}
+
+bool
+HarbourSystemState::Private::displayOff() const
+{
+ return iDisplayStatus == MCE_DISPLAY_OFF;
+}
+
+void
+HarbourSystemState::Private::setDisplayStatus(
+ QString aStatus)
+{
+ if (iDisplayStatus != aStatus) {
+ const bool displayWasOff = displayOff();
+ iDisplayStatus = aStatus;
+ const bool displayIsOff = displayOff();
+ Q_EMIT iParent->displayStatusChanged();
+ if (displayWasOff != displayIsOff) {
+ Q_EMIT iParent->displayOffChanged();
+ }
+ }
+}
+
+void
+HarbourSystemState::Private::onDisplayStatusChanged(
+ QString aStatus)
+{
+ HDEBUG(aStatus);
+ setDisplayStatus(aStatus);
+}
+
+void
+HarbourSystemState::Private::onDisplayStatusQueryDone(
+ QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply<QString> reply(*aWatcher);
+ HDEBUG(reply);
+ if (reply.isValid() && !reply.isError()) {
+ setDisplayStatus(reply.value());
+ }
+ aWatcher->deleteLater();
+}
+
+bool
+HarbourSystemState::Private::locked() const
+{
+ return iLockMode == MCE_TK_LOCKED;
+}
+
+void
+HarbourSystemState::Private::setLockMode(
+ QString aMode)
+{
+ if (iLockMode != aMode) {
+ const bool wasLocked = locked();
+ iLockMode = aMode;
+ const bool isLocked = locked();
+ Q_EMIT iParent->lockModeChanged();
+ if (wasLocked != isLocked) {
+ Q_EMIT iParent->lockedChanged();
+ }
+ }
+}
+
+void
+HarbourSystemState::Private::onLockModeChanged(
+ QString aMode)
+{
+ HDEBUG(aMode);
+ setLockMode(aMode);
+}
+
+void
+HarbourSystemState::Private::onLockModeQueryDone(
+ QDBusPendingCallWatcher* aWatcher)
+{
+ QDBusPendingReply<QString> reply(*aWatcher);
+ HDEBUG(reply);
+ if (reply.isValid() && !reply.isError()) {
+ setLockMode(reply.value());
+ }
+ aWatcher->deleteLater();
+}
+
+// ==========================================================================
+// HarbourSystemState
+// ==========================================================================
+
+HarbourSystemState::HarbourSystemState(
+ QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private(this))
+{
+ HDEBUG("created");
+}
+
+HarbourSystemState::~HarbourSystemState()
+{
+ HDEBUG("destroyed");
+}
+
+// Callback for qmlRegisterSingletonType<HarbourSystemState>
+QObject*
+HarbourSystemState::createSingleton(
+ QQmlEngine*,
+ QJSEngine*)
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourSystemTime.cpp
^
|
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 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 "HarbourSystemTime.h"
+#include "HarbourDebug.h"
+
+#include <QDBusConnection>
+
+#include <gutil_timenotify.h>
+
+// ==========================================================================
+// HarbourSystemTime::Private
+// ==========================================================================
+
+class HarbourSystemTime::Private : public QObject
+{
+ Q_OBJECT
+public:
+ Private(HarbourSystemTime* aSystemTime);
+ ~Private();
+
+ static void timeNotify(GUtilTimeNotify*, void*);
+
+public Q_SLOTS:
+ void onDBusNotify();
+ void notify();
+
+public:
+ GUtilTimeNotify* iNotify;
+ gulong iNotifyId;
+};
+
+HarbourSystemTime::Private::Private(HarbourSystemTime* aParent) :
+ QObject(aParent),
+ iNotify(gutil_time_notify_new()),
+ iNotifyId(gutil_time_notify_add_handler(iNotify, timeNotify, this))
+{
+ QDBusConnection::systemBus().connect("com.nokia.time", "/com/nokia/time",
+ "com.nokia.time", "settings_changed", this, SLOT(onDBusNotify()));
+}
+
+HarbourSystemTime::Private::~Private()
+{
+ gutil_time_notify_remove_handler(iNotify, iNotifyId);
+ gutil_time_notify_unref(iNotify);
+}
+
+void HarbourSystemTime::Private::timeNotify(GUtilTimeNotify*, void* aSelf)
+{
+ HDEBUG("System time changed");
+ QMetaObject::invokeMethod((QObject*)aSelf, "notify");
+}
+
+void HarbourSystemTime::Private::onDBusNotify()
+{
+ HDEBUG("timed settings changed");
+ notify();
+}
+
+void HarbourSystemTime::Private::notify()
+{
+ HarbourSystemTime* obj = qobject_cast<HarbourSystemTime*>(parent());
+ Q_EMIT obj->preNotify(); // For Date.timeZoneUpdated()
+ Q_EMIT obj->notify(); // For everything else
+}
+
+// ==========================================================================
+// HarbourSystemTime
+// ==========================================================================
+
+HarbourSystemTime::HarbourSystemTime(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private(this))
+{
+ HDEBUG("created");
+}
+
+HarbourSystemTime::~HarbourSystemTime()
+{
+ HDEBUG("deleted");
+ delete iPrivate;
+}
+
+// Callback for qmlRegisterSingletonType<HarbourSystemTime>
+QObject* HarbourSystemTime::createSingleton(QQmlEngine*, QJSEngine*)
+{
+ return new HarbourSystemTime();
+}
+
+// Getter for notification property which can be used to force
+// re-evaluation of a JavaScript expression. Always returns an
+// empty string.
+QString HarbourSystemTime::emptyString()
+{
+ return QString();
+}
+
+QSharedPointer<HarbourSystemTime> HarbourSystemTime::sharedInstance()
+{
+ static QWeakPointer<HarbourSystemTime> sSharedInstance;
+ QSharedPointer<HarbourSystemTime> instance = sSharedInstance;
+ if (instance.isNull()) {
+ // QObject::deleteLater protects against trouble in case if the
+ // recipient of the signal drops the last shared reference.
+ sSharedInstance = instance = QSharedPointer<HarbourSystemTime>
+ (new HarbourSystemTime, &QObject::deleteLater);
+ }
+ return instance;
+}
+
+#include "HarbourSystemTime.moc"
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourTask.cpp
^
|
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2018-2019 Jolla Ltd.
+ * Copyright (C) 2018-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 "HarbourTask.h"
+#include "HarbourDebug.h"
+
+#include <QCoreApplication>
+#include <QThreadPool>
+
+// ==========================================================================
+// HarbourTask::Private
+// ==========================================================================
+
+class HarbourTask::Private {
+public:
+ Private(QThreadPool* aPool);
+
+public:
+ QThreadPool* iPool;
+ QObject* iTarget;
+ bool iStarted; // These two flags are set by the worker thread
+ bool iFinished;
+ bool iAboutToQuit; // All other flags are set by the main thread
+ bool iSubmitted;
+ bool iReleased;
+ bool iDone;
+};
+
+HarbourTask::Private::Private(QThreadPool* aPool) :
+ iPool(aPool),
+ iTarget(NULL),
+ iStarted(false),
+ iFinished(false),
+ iAboutToQuit(false),
+ iSubmitted(false),
+ iReleased(false),
+ iDone(false)
+{
+}
+
+// ==========================================================================
+// HarbourTask
+// ==========================================================================
+
+HarbourTask::HarbourTask(QThreadPool* aPool, QThread* aTargetThread) :
+ QObject(aTargetThread ? NULL : aPool), // Cannot move objects with a parent
+ iPrivate(new Private(aPool))
+{
+ if (aTargetThread) moveToThread(aTargetThread);
+ setAutoDelete(false);
+ connect(qApp, SIGNAL(aboutToQuit()), SLOT(onAboutToQuit()));
+ connect(this, SIGNAL(runFinished()), SLOT(onRunFinished()),
+ Qt::QueuedConnection);
+}
+
+HarbourTask::~HarbourTask()
+{
+ // Target can be destroyed before done() signal is delivered to the
+ // main thread and the target has a chance to release the task. In
+ // that case onTargetDestroyed must be invoked before the task gets
+ // destroyed (which clears iPrivate->iTarget).
+ HASSERT(iPrivate->iReleased || !iPrivate->iTarget);
+ HASSERT(!iPrivate->iSubmitted || iPrivate->iFinished);
+ delete iPrivate;
+}
+
+bool HarbourTask::isStarted() const
+{
+ return iPrivate->iStarted;
+}
+
+bool HarbourTask::isCanceled() const
+{
+ return iPrivate->iReleased || iPrivate->iAboutToQuit;
+}
+
+void HarbourTask::submit()
+{
+ HASSERT(!iPrivate->iSubmitted);
+ HASSERT(iPrivate->iPool);
+ if (iPrivate->iPool && !iPrivate->iSubmitted) {
+ iPrivate->iSubmitted = true;
+ iPrivate->iPool->start(this);
+ }
+}
+
+void HarbourTask::submit(QObject* aTarget, const char* aSlot)
+{
+ HASSERT(!iPrivate->iTarget);
+ iPrivate->iTarget = aTarget;
+ connect(aTarget, SIGNAL(destroyed(QObject*)), SLOT(onTargetDestroyed(QObject*)));
+ aTarget->connect(this, SIGNAL(done()), aSlot);
+ submit();
+}
+
+void HarbourTask::release(QObject* aHandler)
+{
+ aHandler->disconnect(this);
+ disconnect(aHandler);
+ released();
+}
+
+void HarbourTask::release()
+{
+ if (iPrivate->iTarget) {
+ iPrivate->iTarget->disconnect(this);
+ disconnect(iPrivate->iTarget);
+ }
+ released();
+}
+
+void HarbourTask::released()
+{
+ iPrivate->iReleased = true;
+ if (!iPrivate->iSubmitted || iPrivate->iDone) {
+ delete this;
+ }
+}
+
+void HarbourTask::run()
+{
+ HASSERT(!iPrivate->iStarted);
+ iPrivate->iStarted = true;
+ if (!isCanceled()) {
+ performTask();
+ }
+ iPrivate->iFinished = true;
+ Q_EMIT runFinished();
+}
+
+void HarbourTask::onRunFinished()
+{
+ HASSERT(!iPrivate->iDone);
+ if (!iPrivate->iReleased) {
+ Q_EMIT done();
+ }
+ iPrivate->iDone = true;
+ if (iPrivate->iReleased) {
+ delete this;
+ }
+}
+
+void HarbourTask::onAboutToQuit()
+{
+ HDEBUG("OK");
+ iPrivate->iAboutToQuit = true;
+}
+
+void HarbourTask::onTargetDestroyed(QObject* aObject)
+{
+ HDEBUG(aObject);
+ HASSERT(iPrivate->iTarget == aObject);
+ if (iPrivate->iTarget == aObject) {
+ iPrivate->iTarget = NULL;
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourTemporaryFile.cpp
^
|
@@ -0,0 +1,211 @@
+/*
+ * Copyright (C) 2018-2021 Jolla Ltd.
+ * Copyright (C) 2018-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.
+ *
+ * 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 "HarbourTemporaryFile.h"
+#include "HarbourDebug.h"
+
+#include <QDir>
+#include <QTemporaryFile>
+#include <QTextStream>
+#include <QStandardPaths>
+
+// ==========================================================================
+// HarbourTemporaryFile::Private
+// ==========================================================================
+
+class HarbourTemporaryFile::Private {
+public:
+ Private();
+ ~Private();
+
+ void reopen(HarbourTemporaryFile* aObject);
+ QString directoryPath() const;
+ QString fileName() const;
+
+public:
+ Location iLocation;
+ QTemporaryFile* iFile;
+ QString iFileTemplate;
+ QString iContent;
+ QUrl iUrl;
+};
+
+HarbourTemporaryFile::Private::Private() :
+ iLocation(Tmp),
+ iFile(NULL)
+{
+}
+
+HarbourTemporaryFile::Private::~Private()
+{
+ if (iFile) {
+ iFile->close();
+ delete iFile;
+ }
+}
+
+inline QString
+HarbourTemporaryFile::Private::fileName() const
+{
+ return iFile ? iFile->fileName() : QString();
+}
+
+QString
+HarbourTemporaryFile::Private::directoryPath() const
+{
+ QStandardPaths::StandardLocation type = QStandardPaths::TempLocation;
+ switch (iLocation) {
+ case Downloads:
+ type = QStandardPaths::DownloadLocation;
+ break;
+ case Tmp:
+ // This is the default
+ break;
+ }
+ return QStandardPaths::writableLocation(type);
+}
+
+void
+HarbourTemporaryFile::Private::reopen(
+ HarbourTemporaryFile* aObject)
+{
+ const QString oldFileName = fileName();
+ QString newFileName;
+ if (iFile && iFile->isOpen()) {
+ iFile->close();
+ delete iFile;
+ iFile = NULL;
+ iUrl = QUrl();
+ }
+ if (!iContent.isEmpty() && !iFileTemplate.isEmpty()) {
+ iFile = new QTemporaryFile(directoryPath() +
+ QDir::separator() + iFileTemplate);
+ iFile->setAutoRemove(true);
+ if (iFile->open()) {
+ newFileName = iFile->fileName();
+ iUrl = QUrl::fromLocalFile(newFileName);
+ HDEBUG("writing" << qPrintable(newFileName));
+ QTextStream stream(iFile);
+ stream << iContent;
+ stream.flush();
+ } else {
+ HWARN("Failed to open temporary file");
+ delete iFile;
+ iFile = NULL;
+ }
+ }
+ if (fileName() != oldFileName) {
+ Q_EMIT aObject->fileNameChanged();
+ Q_EMIT aObject->urlChanged();
+ }
+}
+
+// ==========================================================================
+// HarbourTemporaryFile
+// ==========================================================================
+
+HarbourTemporaryFile::HarbourTemporaryFile(
+ QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private)
+{
+}
+
+HarbourTemporaryFile::~HarbourTemporaryFile()
+{
+ delete iPrivate;
+}
+
+QString
+HarbourTemporaryFile::content() const
+{
+ return iPrivate->iContent;
+}
+
+void
+HarbourTemporaryFile::setContent(QString aValue)
+{
+ if (iPrivate->iContent != aValue) {
+ iPrivate->iContent = aValue;
+ iPrivate->reopen(this);
+ Q_EMIT contentChanged();
+ }
+}
+
+QString
+HarbourTemporaryFile::fileTemplate() const
+{
+ return iPrivate->iFileTemplate;
+}
+
+void
+HarbourTemporaryFile::setFileTemplate(QString aValue)
+{
+ if (iPrivate->iFileTemplate != aValue) {
+ iPrivate->iFileTemplate = aValue;
+ iPrivate->reopen(this);
+ Q_EMIT fileTemplateChanged();
+ }
+}
+
+HarbourTemporaryFile::Location
+HarbourTemporaryFile::location() const
+{
+ return iPrivate->iLocation;
+}
+
+void
+HarbourTemporaryFile::setLocation(Location aValue)
+{
+ if (iPrivate->iLocation != aValue) {
+ iPrivate->iLocation = aValue;
+ iPrivate->reopen(this);
+ Q_EMIT locationChanged();
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourTheme.cpp
^
|
@@ -0,0 +1,273 @@
+/*
+ * Copyright (C) 2018-2021 Jolla Ltd.
+ * Copyright (C) 2018-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
+ * 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()
+{
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourTransferMethodInfo.cpp
^
|
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2016-2018 Jolla Ltd.
+ * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.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 name of Jolla Ltd 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 "HarbourTransferMethodInfo.h"
+
+// ==========================================================================
+// HarbourTransferMethodInfo
+// ==========================================================================
+
+QDBusArgument &operator<<(QDBusArgument& aArg, const HarbourTransferMethodInfo& aInfo)
+{
+ aArg.beginStructure();
+ aArg << aInfo.displayName << aInfo.userName << aInfo.methodId
+ << aInfo.shareUIPath << aInfo.capabilitities << aInfo.accountId;
+ aArg.endStructure();
+ return aArg;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument& aArg, HarbourTransferMethodInfo& aInfo)
+{
+ aArg.beginStructure();
+ aArg >> aInfo.displayName >> aInfo.userName >> aInfo.methodId
+ >> aInfo.shareUIPath >> aInfo.capabilitities >> aInfo.accountId;
+ aArg.endStructure();
+ return aArg;
+}
+
+HarbourTransferMethodInfo::HarbourTransferMethodInfo():
+ accountId(0)
+{
+}
+
+HarbourTransferMethodInfo::HarbourTransferMethodInfo(const HarbourTransferMethodInfo& aInfo):
+ displayName(aInfo.displayName),
+ userName(aInfo.userName),
+ methodId(aInfo.methodId),
+ shareUIPath(aInfo.shareUIPath),
+ capabilitities(aInfo.capabilitities),
+ accountId(aInfo.accountId)
+{
+}
+
+HarbourTransferMethodInfo& HarbourTransferMethodInfo::operator=(const HarbourTransferMethodInfo& aInfo)
+{
+ displayName = aInfo.displayName;
+ userName = aInfo.userName;
+ methodId = aInfo.methodId;
+ shareUIPath = aInfo.shareUIPath;
+ capabilitities = aInfo.capabilitities;
+ accountId = aInfo.accountId;
+ return *this;
+}
+
+bool HarbourTransferMethodInfo::equals(const HarbourTransferMethodInfo& aInfo) const
+{
+ return displayName == aInfo.displayName &&
+ userName == aInfo.userName &&
+ methodId == aInfo.methodId &&
+ shareUIPath == aInfo.shareUIPath &&
+ capabilitities == aInfo.capabilitities &&
+ accountId == aInfo.accountId;
+}
+
+void HarbourTransferMethodInfo::registerTypes()
+{
+ qDBusRegisterMetaType<HarbourTransferMethodInfo>();
+ qDBusRegisterMetaType<HarbourTransferMethodInfoList>();
+}
+
+// ==========================================================================
+// HarbourTransferMethodInfo2
+// ==========================================================================
+
+QDBusArgument &operator<<(QDBusArgument& aArg, const HarbourTransferMethodInfo2& aInfo)
+{
+ aArg.beginStructure();
+ aArg << aInfo.displayName << aInfo.userName << aInfo.methodId
+ << aInfo.shareUIPath << aInfo.capabilitities << aInfo.accountId
+ << aInfo.accountIcon << aInfo.hints;
+ aArg.endStructure();
+ return aArg;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument& aArg, HarbourTransferMethodInfo2& aInfo)
+{
+ aArg.beginStructure();
+ aArg >> aInfo.displayName >> aInfo.userName >> aInfo.methodId
+ >> aInfo.shareUIPath >> aInfo.capabilitities >> aInfo.accountId
+ >> aInfo.accountIcon >> aInfo.hints;
+ aArg.endStructure();
+ return aArg;
+}
+
+HarbourTransferMethodInfo2::HarbourTransferMethodInfo2():
+ accountId(0)
+{
+}
+
+HarbourTransferMethodInfo2::HarbourTransferMethodInfo2(const HarbourTransferMethodInfo2& aInfo):
+ displayName(aInfo.displayName),
+ userName(aInfo.userName),
+ methodId(aInfo.methodId),
+ shareUIPath(aInfo.shareUIPath),
+ capabilitities(aInfo.capabilitities),
+ accountId(aInfo.accountId),
+ accountIcon(aInfo.accountIcon),
+ hints(aInfo.hints)
+{
+}
+
+HarbourTransferMethodInfo2::HarbourTransferMethodInfo2(const HarbourTransferMethodInfo& aInfo):
+ displayName(aInfo.displayName),
+ userName(aInfo.userName),
+ methodId(aInfo.methodId),
+ shareUIPath(aInfo.shareUIPath),
+ capabilitities(aInfo.capabilitities),
+ accountId(aInfo.accountId)
+{
+}
+
+HarbourTransferMethodInfo2& HarbourTransferMethodInfo2::operator=(const HarbourTransferMethodInfo2& aInfo)
+{
+ displayName = aInfo.displayName;
+ userName = aInfo.userName;
+ methodId = aInfo.methodId;
+ shareUIPath = aInfo.shareUIPath;
+ capabilitities = aInfo.capabilitities;
+ accountId = aInfo.accountId;
+ accountIcon = aInfo.accountIcon;
+ hints = aInfo.hints;
+ return *this;
+}
+
+bool HarbourTransferMethodInfo2::equals(const HarbourTransferMethodInfo2& aInfo) const
+{
+ return displayName == aInfo.displayName &&
+ userName == aInfo.userName &&
+ methodId == aInfo.methodId &&
+ shareUIPath == aInfo.shareUIPath &&
+ capabilitities == aInfo.capabilitities &&
+ accountId == aInfo.accountId &&
+ accountIcon == aInfo.accountIcon &&
+ hints == aInfo.hints;
+}
+
+void HarbourTransferMethodInfo2::registerTypes()
+{
+ HarbourTransferMethodInfo::registerTypes();
+ qDBusRegisterMetaType<HarbourTransferMethodInfo2>();
+ qDBusRegisterMetaType<HarbourTransferMethodInfo2List>();
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/HarbourTransferMethodsModel.cpp
^
|
@@ -0,0 +1,444 @@
+/*
+ * 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());
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/src/libcrypto.c
^
|
@@ -0,0 +1,262 @@
+/*
+ * 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 "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>
+
+/*
+ * 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(BN_free, (BIGNUM *a), (a)) \
+ f(DES_ede3_cbc_encrypt, \
+ (const unsigned char* input, unsigned char* output, long length, \
+ DES_key_schedule* ks1, DES_key_schedule* ks2, DES_key_schedule* ks3, \
+ DES_cblock* ivec, int enc), \
+ (input, output, length, ks1, ks2, ks3, ivec, enc)) \
+ f(ERR_load_crypto_strings, (void), ()) \
+ f(RSA_free, (RSA* r), (r))
+
+/* f(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, 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(unsigned char*, SHA1, (const unsigned char* d, size_t n, \
+ unsigned char* md), (d, n, md), NULL) \
+ f(int, SHA1_Final, (unsigned char* md, SHA_CTX* c), (md, c), 0) \
+ f(int, SHA1_Init, (SHA_CTX* c), (c), 0) \
+ f(int, SHA1_Update, (SHA_CTX* c, const void* data, size_t len), \
+ (c, data, len), 0) \
+ f(unsigned char*, SHA256, (const unsigned char* d, size_t n, \
+ unsigned char* md), (d, n, md), NULL) \
+ f(int, SHA256_Final, (unsigned char* md, SHA256_CTX* c), (md, c), 0) \
+ f(int, SHA256_Init, (SHA256_CTX* c), (c), 0) \
+ f(int, SHA256_Update, (SHA256_CTX* c, const void* data, size_t len), \
+ (c, data, len), 0) \
+ f(unsigned char*, SHA512, (const unsigned char* d, size_t n, \
+ unsigned char* md), (d, n, md), NULL) \
+ f(int, SHA512_Final, (unsigned char* md, SHA512_CTX* c), (md, c), 0) \
+ f(int, SHA512_Init, (SHA512_CTX* c), (c), 0) \
+ f(int, SHA512_Update, (SHA512_CTX* c, const void* data, size_t len), \
+ (c, data, len), 0)
+
+static const char* libcrypto_so_path[] = {
+ LIBDIR "/libcrypto.so.1.1",
+ "/lib/libcrypto.so.10"
+};
+
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/test/Makefile
^
|
@@ -0,0 +1,6 @@
+# -*- Mode: makefile-gmake -*-
+
+all:
+%:
+ @$(MAKE) -C TestHarbourBase32 $*
+ @$(MAKE) -C TestHarbourBase45 $*
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/test/Makefile.common
^
|
@@ -0,0 +1,200 @@
+# -*- 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)
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/test/TestHarbourBase32/Makefile
^
|
@@ -0,0 +1,6 @@
+# -*- Mode: makefile-gmake -*-
+
+EXE = TestHarbourBase32
+HARBOUR_SRC = HarbourBase32.cpp
+
+include ../Makefile.common
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/test/TestHarbourBase32/TestHarbourBase32.cpp
^
|
@@ -0,0 +1,202 @@
+/*
+ * 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 "HarbourBase32.h"
+#include "HarbourDebug.h"
+
+#include <glib.h>
+
+/*==========================================================================*
+ * isValidBase45
+ *==========================================================================*/
+
+static
+void
+test_isValidBase32(
+ void)
+{
+ g_assert(HarbourBase32::isValidBase32("AEBAGBAFAYDQQCIKBMGA2DQPCAIREEYUCULBOGI2DMOB2HQ7"));
+ g_assert(HarbourBase32::isValidBase32("aebagbaf aydqqcik bmga2dqp caireeyu culbogi2 dmob2hq7"));
+ g_assert(HarbourBase32::isValidBase32("ae"));
+ g_assert(!HarbourBase32::isValidBase32("aeb"));
+ g_assert(HarbourBase32::isValidBase32("aeba"));
+ g_assert(HarbourBase32::isValidBase32("aebag"));
+ g_assert(!HarbourBase32::isValidBase32("aebagb"));
+ g_assert(!HarbourBase32::isValidBase32("aebagb= x"));
+ g_assert(HarbourBase32::isValidBase32("aebagba"));
+ g_assert(HarbourBase32::isValidBase32("aebagbaf"));
+ g_assert(HarbourBase32::isValidBase32("aebagbafa"));
+ g_assert(HarbourBase32::isValidBase32("aebagbafay"));
+ g_assert(!HarbourBase32::isValidBase32(QString()));
+ g_assert(!HarbourBase32::isValidBase32(" "));
+ g_assert(!HarbourBase32::isValidBase32("01234567"));
+ g_assert(!HarbourBase32::isValidBase32("88888888"));
+ g_assert(!HarbourBase32::isValidBase32("{}"));
+ g_assert(!HarbourBase32::isValidBase32("[]"));
+}
+
+/*==========================================================================*
+ * fromBase32
+ *==========================================================================*/
+
+static
+void
+test_fromBase32(
+ void)
+{
+ static const char out[] = {
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
+ 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14,
+ 0x15, 0x16, 0x17, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
+ };
+ QString in1("AEBAGBAFAYDQQCIKBMGA2DQPCAIREEYUCULBOGI2DMOB2HQ7");
+ QString in2("aebagbaf aydqqcik bmga2dqp caireeyu culbogi2 dmob2hq7");
+ QByteArray out1(HarbourBase32::fromBase32(in1));
+ QByteArray out2(HarbourBase32::fromBase32(in2));
+ g_assert(out1 == out2);
+ g_assert(out1 == QByteArray(out, sizeof(out)));
+ g_assert(HarbourBase32::fromBase32("ae") == QByteArray(out, 1));
+ g_assert(HarbourBase32::fromBase32("aeb").isEmpty());
+ g_assert(HarbourBase32::fromBase32("aeba") == QByteArray(out, 2));
+ g_assert(HarbourBase32::fromBase32("aebag") == QByteArray(out, 3));
+ g_assert(HarbourBase32::fromBase32("aebagb").isEmpty());
+ g_assert(HarbourBase32::fromBase32("aebagb=x").isEmpty());
+ g_assert(HarbourBase32::fromBase32("aebagb= x").isEmpty());
+ g_assert(HarbourBase32::fromBase32("aebagba") == QByteArray(out, 4));
+ g_assert(HarbourBase32::fromBase32("aebagbaf") == QByteArray(out, 5));
+ g_assert(HarbourBase32::fromBase32("aebagbafa") == QByteArray(out, 5));
+ g_assert(HarbourBase32::fromBase32("aebagbafay") == QByteArray(out, 6));
+ g_assert(HarbourBase32::fromBase32(QString()).isEmpty());
+ g_assert(HarbourBase32::fromBase32(" ").isEmpty());
+ g_assert(HarbourBase32::fromBase32("01234567").isEmpty());
+ g_assert(HarbourBase32::fromBase32("88888888").isEmpty());
+ g_assert(HarbourBase32::fromBase32("{}").isEmpty());
+ g_assert(HarbourBase32::fromBase32("[]").isEmpty());
+}
+
+/*==========================================================================*
+ * base32pad
+ *==========================================================================*/
+
+static
+void
+test_base32pad(
+ void)
+{
+ static const char out[] = {
+ 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23
+ };
+ QString in1("DMOB2HQ7EA====="); // One pad character missing
+ QString in2("DMOB2HQ7EAQQ====="); // One extra pagging character
+ QString in3("DMOB2HQ7EAQSE== ="); // Space is ignored
+ QString in4("DMOB2HQ7EAQSEIY=");
+ g_assert(HarbourBase32::fromBase32(in1) == QByteArray(out, sizeof(out) - 3));
+ g_assert(HarbourBase32::fromBase32(in2) == QByteArray(out, sizeof(out) - 2));
+ g_assert(HarbourBase32::fromBase32(in3) == QByteArray(out, sizeof(out) - 1));
+ g_assert(HarbourBase32::fromBase32(in4) == QByteArray(out, sizeof(out)));
+ g_assert(HarbourBase32::fromBase32(QString("=================")).isEmpty());
+ g_assert(HarbourBase32::fromBase32(QString("=DMOB2HQ7EAQSEIY=")).isEmpty());
+ g_assert(HarbourBase32::fromBase32(QString("DMOB2HQ7EB=")).isEmpty());
+}
+
+/*==========================================================================*
+ * toBase32
+ *==========================================================================*/
+
+static
+void
+test_toBase32(
+ void)
+{
+ static const char in[] = {
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
+ 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14,
+ 0x15, 0x16, 0x17, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
+ };
+ QString out("aebagbafaydqqcikbmga2dqpcaireeyuculbogi2dmob2hq7");
+ g_assert(HarbourBase32::toBase32(QByteArray()).isEmpty());
+ g_assert(HarbourBase32::toBase32(QByteArray(in, sizeof(in))) == out);
+}
+
+/*==========================================================================*
+ * rfc4648
+ *==========================================================================*/
+
+static
+void
+test_rfc4648(
+ void)
+{
+ // Test vectors from RFC 4648
+ static const char* test[][2] = {
+ { "f", "MY======" },
+ { "fo", "MZXQ====" },
+ { "foo", "MZXW6===" },
+ { "foob", "MZXW6YQ=" },
+ { "fooba", "MZXW6YTB" },
+ { "foobar", "MZXW6YTBOI======" }
+ };
+
+ for (guint i = 0; i < G_N_ELEMENTS(test); i++) {
+ QByteArray data(test[i][0]);
+ QString base32(test[i][1]);
+ g_assert(HarbourBase32::isValidBase32(base32));
+ g_assert(HarbourBase32::fromBase32(base32) == data);
+ g_assert(HarbourBase32::toBase32(data, false) == base32);
+ }
+}
+
+/*==========================================================================*
+ * Common
+ *==========================================================================*/
+
+#define TEST_(name) "/HarbourBase32/" name
+
+int main(int argc, char* argv[])
+{
+ g_test_init(&argc, &argv, NULL);
+ g_test_add_func(TEST_("isValidBase32"), test_isValidBase32);
+ g_test_add_func(TEST_("fromBase32"), test_fromBase32);
+ g_test_add_func(TEST_("base32pad"), test_base32pad);
+ g_test_add_func(TEST_("rfc4648"), test_rfc4648);
+ g_test_add_func(TEST_("toBase32"), test_toBase32);
+ return g_test_run();
+}
+
+/*
+ * Local Variables:
+ * mode: C++
+ * c-basic-offset: 4
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/test/TestHarbourBase45/Makefile
^
|
@@ -0,0 +1,6 @@
+# -*- Mode: makefile-gmake -*-
+
+EXE = TestHarbourBase45
+HARBOUR_SRC = HarbourBase45.cpp
+
+include ../Makefile.common
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/test/TestHarbourBase45/TestHarbourBase45.cpp
^
|
@@ -0,0 +1,129 @@
+/*
+ * 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"
+
+#include <glib.h>
+
+/*==========================================================================*
+ * isValidBase45
+ *==========================================================================*/
+
+static
+void
+test_isValidBase45(
+ void)
+{
+ g_assert(HarbourBase45::isValidBase45("")); // Empty is considered valid
+ g_assert(HarbourBase45::isValidBase45("BB8"));
+ g_assert(HarbourBase45::isValidBase45("%69 VD92EX0"));
+ g_assert(HarbourBase45::isValidBase45("UJCLQE7W581"));
+ g_assert(!HarbourBase45::isValidBase45("AA("));
+ g_assert(!HarbourBase45::isValidBase45("A(A"));
+ g_assert(!HarbourBase45::isValidBase45("(AA"));
+ g_assert(!HarbourBase45::isValidBase45("A("));
+ g_assert(!HarbourBase45::isValidBase45("A["));
+ g_assert(!HarbourBase45::isValidBase45("[A"));
+ g_assert(!HarbourBase45::isValidBase45("A"));
+ g_assert(!HarbourBase45::isValidBase45("ZZ"));
+ g_assert(!HarbourBase45::isValidBase45("ZZZ"));
+}
+
+/*==========================================================================*
+ * toBase45
+ *==========================================================================*/
+
+static
+void
+test_toBase45(
+ void)
+{
+ g_assert(HarbourBase45::toBase45(QByteArray()).isEmpty());
+ // Examples from draft-faltstrom-base45-07
+ g_assert(HarbourBase45::toBase45(QByteArray("AB")) == QString("BB8"));
+ g_assert(HarbourBase45::toBase45(QByteArray("Hello!!")) == QString("%69 VD92EX0"));
+ g_assert(HarbourBase45::toBase45(QByteArray("base-45")) == QString("UJCLQE7W581"));
+}
+
+/*==========================================================================*
+ * fromBase45
+ *==========================================================================*/
+
+static
+void
+test_fromBase45(
+ void)
+{
+ // Invalid
+ g_assert(HarbourBase45::fromBase45(QByteArray("AA[")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("A[A")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("[AA")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("AA(")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("A(A")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("(AA")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("A(")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("A[")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("[A")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("A")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("ZZ")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("ZZZ")).isEmpty());
+ // Valid
+ g_assert(HarbourBase45::fromBase45(QByteArray()).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("BB8")) == QByteArray("AB"));
+ g_assert(HarbourBase45::fromBase45(QByteArray("%69 VD92EX0")) == QByteArray("Hello!!"));
+ g_assert(HarbourBase45::fromBase45(QByteArray("UJCLQE7W581")) == QByteArray("base-45"));
+}
+
+/*==========================================================================*
+ * Common
+ *==========================================================================*/
+
+#define TEST_(name) "/HarbourBase45/" name
+
+int main(int argc, char* argv[])
+{
+ g_test_init(&argc, &argv, NULL);
+ g_test_add_func(TEST_("isValidBase45"), test_isValidBase45);
+ g_test_add_func(TEST_("fromBase45"), test_fromBase45);
+ g_test_add_func(TEST_("toBase45"), test_toBase45);
+ return g_test_run();
+}
+
+/*
+ * Local Variables:
+ * mode: C++
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/test/coverage/.gitignore
^
|
@@ -0,0 +1,4 @@
+app.gcov
+full.gcov
+report
+*~
|
[-]
[+]
|
Added |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/extern/harbour-lib/test/coverage/run
^
|
@@ -0,0 +1,55 @@
+#!/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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/harbour-aenigma.pro
^
|
@@ -1,16 +1,17 @@
# VERSION
-VERSION = 0.3.4
+VERSION = 0.3.7
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
TARGET = harbour-aenigma
DEFINES += APP_TARGET=\\\"$$TARGET\\\"
-QT += sql
+QT += sql dbus
include(extern/libaenigma/libaenigma.pri)
+include(extern/harbour-lib.pri)
CONFIG += link_pkgconfig sailfishapp
-PKGCONFIG += nemonotifications-qt5 keepalive
+PKGCONFIG += nemonotifications-qt5
SOURCES += src/harbour-aenigma.cpp \
src/cache.cpp \
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/qml/pages/GamePage.qml
^
|
@@ -1,6 +1,6 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
-import Nemo.KeepAlive 1.2
+//import Nemo.KeepAlive 1.2
import org.nubecula.aenigma 1.0
@@ -28,15 +28,27 @@
}, Qt.size(Math.round(Screen.width * 0,75), Math.round(Screen.width * 0,75)))
}
- DisplayBlanking {
- preventBlanking: sudokuGame.gameState === GameState.Playing && settings.preventDisplayBlanking && app.visible
+// DisplayBlanking {
+// preventBlanking: sudokuGame.gameState === GameState.Playing && settings.preventDisplayBlanking && app.visible
+// }
+
+// PageBusyIndicator {
+// anchors.centerIn: parent
+// running: sudokuGame.gameState === GameState.Generating
+// }
+
+ HarbourDisplayBlanking {
+ pauseRequested: sudokuGame.gameState === GameState.Playing && settings.preventDisplayBlanking && app.visible
}
- PageBusyIndicator {
+ BusyIndicator {
anchors.centerIn: parent
+ size: BusyIndicatorSize.Large
running: sudokuGame.gameState === GameState.Generating
}
+
+
SilicaFlickable {
anchors.fill: parent
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/src/harbour-aenigma.cpp
^
|
@@ -12,6 +12,8 @@
#include "aenigma.h"
#include "sudoku.h"
+#include <HarbourDisplayBlanking.h>
+
Q_DECLARE_METATYPE(QVector<quint8>)
Q_DECLARE_METATYPE(QVector<quint16>)
@@ -44,6 +46,7 @@
qmlRegisterType<Cache>(uri, 1, 0, "Cache");
qmlRegisterType<Aenigma::Sudoku>(uri, 1, 0, "Sudoku");
+ qmlRegisterType<HarbourDisplayBlanking>(uri, 1, 0, "HarbourDisplayBlanking");
auto context = v.data()->rootContext();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-aenigma-0.3.7.tar.bz2/translations/harbour-aenigma-nl.ts
^
|
@@ -408,15 +408,15 @@
</message>
<message id="id-revert-to-last-correct-state">
<source>Revert to correct state</source>
- <translation type="unfinished"></translation>
+ <translation>Terugzetten naar foutloos</translation>
</message>
<message id="id-enter-description">
<source>Enter description</source>
- <translation type="unfinished"></translation>
+ <translation>Geef omschrijving</translation>
</message>
<message id="id-add">
<source>Add</source>
- <translation type="unfinished"></translation>
+ <translation>Voeg toe</translation>
</message>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-aenigma.yaml
^
|
@@ -1,6 +1,6 @@
Name: harbour-aenigma
Summary: Sudoku game for Sailfish OS
-Version: 0.3.4
+Version: 0.3.7
Release: 1
# The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
@@ -18,10 +18,11 @@
PackageName: Aenigma
Type: desktop-application
Categories:
- - Games
+ - Game
Custom:
+ DescriptionMD: https://github.com/black-sheep-dev/harbour-aenigma/raw/master/README.md
Repo: https://github.com/black-sheep-dev/harbour-aenigma/
- Icon: https://raw.githubusercontent.com/black-sheep-dev/harbour-aenigma/master/icons/harbour-aenigma.svg
+ Icon: https://raw.githubusercontent.com/black-sheep-dev/harbour-aenigma/master/icons/172x172/harbour-aenigma.png
Screenshots:
- https://github.com/black-sheep-dev/harbour-aenigma/raw/master/metadata/screenshot1.png
Url:
@@ -36,8 +37,9 @@
- Qt5Core
- Qt5Qml
- Qt5Quick
+ - Qt5Sql
+ - Qt5DBus
- nemonotifications-qt5
- - keepalive
# Build dependencies without a pkgconfig setup can be listed here
PkgBR:
|