[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/harbour-mmslog.git</param>
<param name="branch">master</param>
- <param name="revision">1.0.16</param>
+ <param name="revision">c07e27d</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-mmslog-1.0.16.tar.bz2/qml/pages/ShareMethodList.qml
^
|
@@ -1,150 +0,0 @@
-/*
- Copyright (C) 2014-2018 Jolla Ltd.
- Copyright (C) 2014-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:
-
- * 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 the 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.
-*/
-
-import QtQuick 2.0
-import Sailfish.Silica 1.0
-import harbour.mmslog 1.0
-import org.nemomobile.dbus 2.0
-
-SilicaListView {
- id: root
-
- property url source
- property string subject
- property string emailTo
- property alias filter: transferMethodsModel.filter
- property alias type: content.type
-
- width: parent.width
- height: Theme.itemSizeSmall * transferMethodsModel.count
-
- QtObject {
- id: content
- property string type
- }
-
- DBusInterface {
- id: settings
-
- service: "com.jolla.settings"
- path: "/com/jolla/settings/ui"
- iface: "com.jolla.settings.ui"
- }
-
- model: TransferMethodsModel { id: transferMethodsModel }
-
- delegate: BackgroundItem {
- id: backgroundItem
- width: root.width
-
- Image {
- id: icon
-
- x: Theme.horizontalPageMargin
- anchors.verticalCenter: parent.verticalCenter
- source: accountIcon ? accountIcon :
- transferMethodsModel.accountIconSupported ? "image://theme/icon-m-share" : ""
- visible: transferMethodsModel.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(shareUIPath, {
- source: root.source,
- content: content,
- methodId: methodId,
- displayName: displayName,
- accountId: accountId,
- accountName: userName,
- emailTo: root.emailTo,
- emailSubject: root.subject
- })
- }
- }
-
- footer: BackgroundItem {
- id: addItem
-
- Image {
- id: addAccountIcon
-
- x: Theme.horizontalPageMargin
- anchors.verticalCenter: parent.verticalCenter
- source: transferMethodsModel.accountIconSupported ?
- ("image://theme/icon-m-add" + (addItem.highlighted ? "?" + Theme.highlightColor : "")) : ""
- visible: transferMethodsModel.accountIconSupported
- }
-
- Label {
- //: Share list item
- //% "Add account"
- text: qsTrId("mmslog-sharemethodlist-add-account")
- 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: settings.call("showAccounts", undefined)
- }
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-mmslog-1.0.16.tar.bz2/src/libdbusaccess/debian/libdbusaccess-dev.install
^
|
@@ -1,3 +0,0 @@
-debian/tmp/usr/lib/libdbusaccess.so usr/lib
-include/*.h usr/include/dbusaccess
-build/libdbusaccess.pc usr/lib/pkgconfig
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-mmslog-1.0.16.tar.bz2/src/libdbusaccess/debian/libdbusaccess.install
^
|
@@ -1 +0,0 @@
-debian/tmp/usr/lib/libdbusaccess.so.* usr/lib
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-mmslog-1.0.16.tar.bz2/src/libdbuslog/debian/libdbuslogserver-dbus-dev.install
^
|
@@ -1,3 +0,0 @@
-debian/tmp/usr/lib/libdbuslogserver-dbus.so usr/lib
-debian/tmp/usr/include/dbuslogserver/dbus/*.h usr/include/dbuslogserver/dbus
-debian/tmp/usr/lib/pkgconfig/libdbuslogserver-dbus.pc usr/lib/pkgconfig
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-mmslog-1.0.16.tar.bz2/src/libdbuslog/debian/libdbuslogserver-dbus.install
^
|
@@ -1 +0,0 @@
-debian/tmp/usr/lib/libdbuslogserver-dbus.so.* usr/lib
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-mmslog-1.0.16.tar.bz2/src/libdbuslog/debian/libdbuslogserver-gio-dev.install
^
|
@@ -1,3 +0,0 @@
-debian/tmp/usr/lib/libdbuslogserver-gio.so usr/lib
-debian/tmp/usr/include/dbuslogserver/gio/*.h usr/include/dbuslogserver/gio
-debian/tmp/usr/lib/pkgconfig/libdbuslogserver-gio.pc usr/lib/pkgconfig
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-mmslog-1.0.16.tar.bz2/src/libdbuslog/debian/libdbuslogserver-gio.install
^
|
@@ -1 +0,0 @@
-debian/tmp/usr/lib/libdbuslogserver-gio.so.* usr/lib
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-mmslog-1.0.16.tar.bz2/src/libglibutil/debian/libglibutil-dev.install
^
|
@@ -1,3 +0,0 @@
-debian/tmp/usr/lib/libglibutil.so usr/lib
-include/*.h usr/include/gutil
-build/libglibutil.pc usr/lib/pkgconfig
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-mmslog-1.0.16.tar.bz2/src/libglibutil/debian/libglibutil.install
^
|
@@ -1 +0,0 @@
-debian/tmp/usr/lib/libglibutil.so.* usr/lib
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/harbour-mmslog.pro
^
|
@@ -14,6 +14,7 @@
}
TARGET = $${PREFIX}-$${NAME}
+
QT += dbus
CONFIG += sailfishapp link_pkgconfig
PKGCONFIG += mlite5 sailfishapp gio-2.0 gio-unix-2.0 glib-2.0
@@ -24,9 +25,12 @@
DEFINES += DEBUG HARBOUR_DEBUG
}
+TARGET_DATA_DIR = /usr/share/$${TARGET}
+
HARBOUR_LIB = src/harbour-lib
HARBOUR_LIB_INCLUDE = $${HARBOUR_LIB}/include
HARBOUR_LIB_SRC = $${HARBOUR_LIB}/src
+HARBOUR_LIB_QML = $${HARBOUR_LIB}/qml
LIBGLIBUTIL = src/libglibutil
LIBGLIBUTIL_SRC = $${LIBGLIBUTIL}/src
@@ -151,6 +155,14 @@
INSTALLS += $${icon_target}
}
+# harbour-lib QML components
+HARBOUR_QML_COMPONENTS = \
+ $${HARBOUR_LIB_QML}/HarbourShareMethodList.qml
+
+qml_components.files = $${HARBOUR_QML_COMPONENTS}
+qml_components.path = $${TARGET_DATA_DIR}/qml/harbour
+INSTALLS += qml_components
+
# Settings
app_settings {
settings_json.files = settings/$${TARGET}.json
@@ -163,7 +175,7 @@
}
settings_qml.files = settings/*.qml
-settings_qml.path = /usr/share/$${TARGET}/qml/settings/
+settings_qml.path = $${TARGET_DATA_DIR}/qml/settings/
INSTALLS += settings_qml
# Priveleges
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/qml/pages/SharePage.qml
^
|
@@ -1,6 +1,6 @@
/*
- Copyright (C) 2014-2017 Jolla Ltd.
- Contact: Slava Monich <slava.monich@jolla.com>
+ Copyright (C) 2014-2020 Jolla Ltd.
+ Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -8,14 +8,14 @@
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.
+ 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
@@ -34,8 +34,11 @@
import Sailfish.Silica 1.0
import org.nemomobile.notifications 1.0
+import "../harbour"
+
Page {
id: page
+
allowedOrientations: window.allowedOrientations
// backNavigation has to be true when the page is pushed to the page stack
// so that the right animation is used (consistent with the settings page)
@@ -97,35 +100,33 @@
title: qsTrId("mmslog-sharepage-header")
}
- ShareMethodList {
+ HarbourShareMethodList {
+ id: shareMethods
+
visible: opacity > 0
opacity: _canShare
- id: shareMethods
+ model: TransferMethodsModel
source: FsIoLog.archivePath
- filter: FsIoLog.archiveType
type: FsIoLog.archiveType
subject: "Jolla MMS log"
emailTo: "mms-debug@jolla.com"
+ //: Share list item
+ //% "Add account"
+ addAccountText: qsTrId("mmslog-sharemethodlist-add-account")
Behavior on opacity { FadeAnimation {} }
anchors {
top: header.bottom
left: parent.left
- right: _portrait ? parent.right : warning.left
- rightMargin: _portrait ? 0 : Theme.paddingLarge
- bottom: _portrait ? warning.top : parent.bottom
- bottomMargin: _portrait ? Theme.paddingLarge : 0
}
VerticalScrollDecorator {}
}
Label {
id: warning
+
visible: opacity > 0
opacity: _canShare
- width: (_portrait ? parent.width : parent.width*2/5) - 2*Theme.paddingLarge
height: implicitHeight
- x: _portrait ? Theme.paddingLarge : (parent.width - width - Theme.paddingLarge)
- y: _portrait ? (_fullHeight - height - Theme.paddingLarge) : (header.y + header.height)
Behavior on opacity { FadeAnimation {} }
wrapMode: Text.WordWrap
font.pixelSize: Theme.fontSizeExtraSmall
@@ -134,6 +135,53 @@
//% "Keep in mind that some of the information contained in this archive may be considered private. If you would like to check what you are about to send, please consider sending it to yourself first and emailing this file to mms-debug@jolla.com later from your computer. If you trust Jolla, then you can conveniently email it to Jolla directly from your phone."
text: qsTrId("mmslog-sharepage-warning")
}
+
+ states: [
+ State {
+ name: "PORTRAIT"
+ when: page.orientation === Orientation.Portrait
+ AnchorChanges {
+ target: shareMethods
+ anchors {
+ right: parent.right
+ bottom: warning.top
+ }
+ }
+ PropertyChanges {
+ target: shareMethods
+ anchors.bottomMargin: Theme.paddingLarge
+ anchors.rightMargin: 0
+ }
+ PropertyChanges {
+ target: warning
+ x: Theme.horizontalPageMargin
+ y: window.height - height - Theme.paddingLarge
+ width: parent.width - 2*Theme.horizontalPageMargin
+ }
+ },
+ State {
+ name: "LANDSCAPE"
+ when: page.orientation !== Orientation.Portrait
+ AnchorChanges {
+ target: shareMethods
+ anchors {
+ right: warning.left
+ bottom: parent.bottom
+ }
+ }
+ PropertyChanges {
+ target: shareMethods
+ anchors.bottomMargin: 0
+ anchors.rightMargin: Theme.horizontalPageMargin
+ }
+ PropertyChanges {
+ target: warning
+ x: parent.width - width - Theme.horizontalPageMargin
+ y: header.y + header.height
+ width: parent.width*2/5 - 2*Theme.horizontalPageMargin
+ }
+ }
+ ]
}
Column {
@@ -143,13 +191,14 @@
spacing: Theme.paddingLarge
Behavior on opacity { FadeAnimation {} }
BusyIndicator {
- id: busy
+ anchors.horizontalCenter: parent.horizontalCenter
size: BusyIndicatorSize.Large
running: !_canShare
}
Label {
- anchors.horizontalCenter: busy.horizontalCenter
+ anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
+ color: Theme.highlightColor
//% "Please wait"
text: qsTrId("mmslog-sharepage-please-wait")
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/LICENSE
^
|
@@ -1,5 +1,5 @@
-Copyright (C) 2015-2018 Jolla Ltd.
-Copyright (C) 2015-2018 Slava Monich <slava@monich.com>
+Copyright (C) 2015-2019 Jolla Ltd.
+Copyright (C) 2015-2019 Slava Monich <slava@monich.com>
You may use this file under the terms of BSD license as follows:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/README
^
|
@@ -3,7 +3,7 @@
Some of them allow to access undocumented Sailfish OS features, some
provide compatibility with older releases of Sailfish OS. This code
-has been tested agaist Sailfish OS 2.0 meaning that most of it is
+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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/harbour-lib.pro
^
|
@@ -4,6 +4,10 @@
QT += dbus
QT-= gui
+# For HarbourSystemTime
+CONFIG += link_pkgconfig
+PKGCONFIG += libglibutil
+
VERSION = 1.0
greaterThan(QT_MAJOR_VERSION, 4) {
@@ -20,14 +24,21 @@
SOURCES += \
src/HarbourBase32.cpp \
+ src/HarbourClipboard.cpp \
src/HarbourDisplayBlanking.cpp \
src/HarbourJson.cpp \
src/HarbourLib.cpp \
src/HarbourMce.cpp \
+ src/HarbourMediaPlugin.cpp \
src/HarbourOrganizeListModel.cpp \
+ src/HarbourPolicyPlugin.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 \
@@ -43,14 +54,21 @@
INCLUDEPATH += include
PUBLIC_HEADERS += \
include/HarbourBase32.h \
+ include/HarbourClipboard.h \
include/HarbourDebug.h \
include/HarbourDisplayBlanking.h \
include/HarbourJson.h \
include/HarbourLib.h \
+ include/HarbourMediaPlugin.h \
include/HarbourOrganizeListModel.h \
+ include/HarbourPolicyPlugin.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 \
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/include/HarbourAztecCodeGenerator.h
^
|
@@ -0,0 +1,72 @@
+/*
+ * 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_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(QString code READ code NOTIFY codeChanged)
+ Q_PROPERTY(bool running READ running NOTIFY runningChanged)
+
+public:
+ HarbourAztecCodeGenerator(QObject* aParent = Q_NULLPTR);
+
+ QString text() const;
+ void setText(QString aValue);
+
+ QString code() const;
+ bool running() const;
+
+ static QByteArray generate(QString aText);
+
+ // Callback for qmlRegisterSingletonType<HarbourAztecCodeGenerator>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+
+Q_SIGNALS:
+ void textChanged();
+ 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-mmslog-1.0.17.tar.bz2/src/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
+
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/include/HarbourDebug.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2015-2016 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * 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:
*
@@ -8,15 +8,15 @@
* 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.
+ * 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
@@ -74,4 +74,10 @@
# 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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/include/HarbourDisplayBlanking.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2015-2018 Jolla Ltd.
- * Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
+ * 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:
*
@@ -48,7 +48,7 @@
Q_PROPERTY(bool pauseRequested READ pauseRequested WRITE setPauseRequested NOTIFY pauseRequestedChanged)
public:
- explicit HarbourDisplayBlanking(QObject* aParent = NULL);
+ explicit HarbourDisplayBlanking(QObject* aParent = Q_NULLPTR);
~HarbourDisplayBlanking();
// Callback for qmlRegisterSingletonType<HarbourDisplayBlanking>
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/include/HarbourOrganizeListModel.h
^
|
@@ -39,18 +39,18 @@
// This model helps to implement rearranging list items by dragging.
// When drag starts, QML sets dragIndex property and then updates
-// dragPos when with the popsition of the dragged list item. When
+// 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 sourceModelChanged)
+ 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 = NULL);
+ HarbourOrganizeListModel(QObject* aParent = Q_NULLPTR);
~HarbourOrganizeListModel();
void setSourceModelObject(QObject* aModel);
@@ -66,7 +66,7 @@
QModelIndex mapFromSource(const QModelIndex& aIndex) const Q_DECL_OVERRIDE;
Q_SIGNALS:
- void sourceModelChanged();
+ void sourceModelObjectChanged();
void dragIndexChanged();
void dragPosChanged();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/include/HarbourPluginLoader.h
^
|
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Copyright (C) 2017 Slava Monich <slava.monich@jolla.com>
+ * 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 BSD license as follows:
+ * You may use this file under the terms of the BSD license as follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -11,23 +11,24 @@
* 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.
+ * 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.
+ * 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
@@ -79,6 +80,7 @@
const char* aModule, int aMajor, int aMinor);
private:
+ class LibQt5Qml;
class Private;
Private* iPrivate;
};
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/include/HarbourQrCodeGenerator.h
^
|
@@ -52,7 +52,7 @@
QString code() const;
bool running() const;
- Q_INVOKABLE static QByteArray generate(QString aText);
+ static QByteArray generate(QString aText);
// Callback for qmlRegisterSingletonType<HarbourQrCodeGenerator>
static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/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-mmslog-1.0.17.tar.bz2/src/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-mmslog-1.0.17.tar.bz2/src/harbour-lib/include/HarbourSystemInfo.h
^
|
@@ -0,0 +1,72 @@
+/*
+ * 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
+ * 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 int osVersionCompare(QString aVersion);
+ static int osVersionCompareWith(QString aVersion);
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_SYSTEM_INFO_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/include/HarbourSystemState.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2015-2018 Jolla Ltd.
- * Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
+ * 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:
*
@@ -63,7 +63,7 @@
static const QString MCE_TK_UNLOCKED;
public:
- explicit HarbourSystemState(QObject* aParent = NULL);
+ explicit HarbourSystemState(QObject* aParent = Q_NULLPTR);
~HarbourSystemState();
// Callback for qmlRegisterSingletonType<HarbourSystemState>
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/include/HarbourTask.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * 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:
*
@@ -11,24 +11,28 @@
* 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
+ * 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.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
*/
#ifndef HARBOUR_TASK_H
@@ -47,7 +51,7 @@
Q_OBJECT
protected:
- HarbourTask(QThreadPool* aPool, QThread* aTargetThread = NULL);
+ HarbourTask(QThreadPool* aPool, QThread* aTargetThread = Q_NULLPTR);
public:
virtual ~HarbourTask();
@@ -64,7 +68,7 @@
void released();
protected:
- virtual void run();
+ void run() Q_DECL_OVERRIDE;
virtual void performTask() = 0;
Q_SIGNALS:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/include/HarbourTheme.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava@monich.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -43,11 +43,17 @@
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_ENUMS(ColorScheme)
+
+ 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;
@@ -57,18 +63,27 @@
DarkOnLight
};
- explicit HarbourTheme(QObject* aParent = NULL);
+ explicit HarbourTheme(QObject* aParent = Q_NULLPTR);
~HarbourTheme();
// Callback for qmlRegisterSingletonType<HarbourTheme>
static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+ QColor invertedPrimaryColor() const;
QColor primaryColor() const;
ColorScheme colorScheme() const;
bool lightOnDark() const;
bool darkOnLight() const;
+ qreal opacityFaint() const;
+ qreal opacityLow() const;
+ qreal opacityHigh() const;
+ qreal opacityOverlay() const;
+
+ Q_INVOKABLE static QColor invertedColor(const QColor& aColor);
+ Q_INVOKABLE static qreal colorDifference(const QColor& aColor1, const QColor& aColor2);
+
Q_SIGNALS:
void colorSchemeChanged();
void primaryColorChanged();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/include/HarbourTransferMethodsModel.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2019 Jolla Ltd.
- * Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -22,7 +22,7 @@
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
@@ -37,7 +37,6 @@
#include "HarbourTransferMethodInfo.h"
#include <QLocale>
-#include <QRegExp>
class QTranslator;
class QQmlEngine;
@@ -49,17 +48,8 @@
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)
- typedef QDBusPendingCallWatcher* (HarbourTransferMethodsModel::*RequestUpdate)();
-
-public:
- enum TransferMethodsRole {
- DisplayNameRole = Qt::UserRole + 1,
- UserNameRole,
- MethodIdRole,
- ShareUIPathRole,
- AccountIdRole,
- AccountIconRole
- };
+ Q_PROPERTY(bool showAccountsPending READ showAccountsPending NOTIFY showAccountsPendingChanged)
+ Q_PROPERTY(bool canShowAccounts READ canShowAccounts NOTIFY canShowAccountsChanged)
public:
explicit HarbourTransferMethodsModel(QObject* aParent = Q_NULLPTR);
@@ -74,39 +64,27 @@
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;
-private:
- void filterModel();
- static QRegExp regExp(QString aRegExp);
- QDBusPendingCallWatcher* checkTransferMethods();
- QDBusPendingCallWatcher* requestTransferMethods();
- QDBusPendingCallWatcher* requestTransferMethods2();
- void setTransferMethods2(HarbourTransferMethodInfo2List aList);
-
-private Q_SLOTS:
- void onTransferMethodsCheckFinished(QDBusPendingCallWatcher* aWatch);
- void onTransferMethodsFinished(QDBusPendingCallWatcher* aWatch);
- void onTransferMethods2Finished(QDBusPendingCallWatcher* aWatch);
- void requestUpdate();
-
Q_SIGNALS:
void countChanged();
void filterChanged();
void accountIconSupportedChanged();
+ void showAccountsPendingChanged();
+ void canShowAccountsChanged();
private:
+ class Private;
class TransferEngine;
- TransferEngine* iTransferEngine;
- QString iFilter;
- QList<HarbourTransferMethodInfo2> iMethodList;
- QList<int> iFilteredList;
- bool iAccountIconSupported;
- RequestUpdate iRequestUpdate;
- QDBusPendingCallWatcher* iUpdateWatcher;
+ Private* iPrivate;
};
#endif // HARBOUR_TRANSFER_METHODS_MODEL_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/qml/HarbourBadge.qml
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava@monich.com>
+ * 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:
*
@@ -31,22 +31,22 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import QtQuick 2.2
+import QtQuick 2.0
import Sailfish.Silica 1.0
Item {
id: badge
- property real maxWidth
+ property real maxWidth: parent.width
property alias text: label.text
readonly property real radius: height/2
- width: maxWidth > 0 ? Math.max(label.paintedWidth + radius, height) : height
+ width: Math.max(label.implicitWidth + radius, height)
height: Theme.itemSizeSmall/2
visible: opacity > 0
opacity: text.length ? 1 : 0
- Behavior on opacity { FadeAnimator {} }
+ Behavior on opacity { FadeAnimation {} }
Rectangle {
id: background
@@ -60,8 +60,8 @@
id: label
font.bold: true
- width: Math.max((maxWidth > 0 ? maxWidth : parent.width) - radius, height)
- height: Math.floor(parent.height - radius/2)
+ maxWidth: Math.max(badge.maxWidth - radius, 2 * radius)
+ maxHeight: Math.floor(parent.height - radius/2)
anchors.centerIn: background
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/qml/HarbourFitLabel.qml
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava@monich.com>
+ * 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:
*
@@ -11,8 +11,8 @@
* 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
+ * 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
@@ -31,13 +31,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import QtQuick 2.2
+import QtQuick 2.0
import Sailfish.Silica 1.0
Label {
property int minFontSize: Theme.fontSizeTiny
property int maxFontSize: Theme.fontSizeMedium
- property int refitting
+ property real maxWidth: width
+ property real maxHeight: height
+ property bool refitting
smooth: true
visible: opacity > 0
@@ -46,33 +48,41 @@
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
- Behavior on opacity { FadeAnimator {} }
+ Behavior on opacity { FadeAnimation {} }
- Component.onCompleted: refitText()
+ Component.onCompleted: {
+ refitting = true
+ font.pixelSize = maxFontSize
+ refitTextRun()
+ refitting = false
+ }
- onWidthChanged: refitText()
- onHeightChanged: refitText()
+ onMaxWidthChanged: refitText()
+ onMaxHeightChanged: refitText()
onTextChanged: refitText()
onMaxFontSizeChanged: refitText()
onMinFontSizeChanged: refitText()
function refitText() {
- refitting++
- if (refitting == 1 && paintedHeight > 0 && paintedWidth > 0) {
+ if (!refitting) {
+ refitting = true
+ refitTextRun()
+ refitting = false
+ }
+ }
+
+ function refitTextRun() {
+ if (implicitHeight > 0 && implicitWidth > 0) {
if (font.pixelSize % 2) font.pixelSize++
- while (paintedWidth > width || paintedHeight > height) {
- if ((font.pixelSize -= 2) <= minFontSize)
- break
+ while ((implicitWidth > maxWidth || implicitHeight > maxHeight || font.pixelSize > maxFontSize) && (font.pixelSize - 2) >= minFontSize) {
+ font.pixelSize -= 2
}
- while (paintedWidth < width && paintedHeight < height) {
+ while (implicitWidth < maxWidth && implicitHeight < maxHeight && (font.pixelSize + 2) <= maxFontSize) {
font.pixelSize += 2
}
- font.pixelSize -= 2
- if (font.pixelSize >= maxFontSize) {
- font.pixelSize = maxFontSize
- return
+ if (implicitWidth > maxWidth || implicitHeight > maxHeight) {
+ font.pixelSize -= 2
}
}
- refitting--
}
}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/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-mmslog-1.0.17.tar.bz2/src/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
+ }
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/qml/HarbourHorizontalSwipeHint.qml
^
|
@@ -1,4 +1,37 @@
-import QtQuick 2.2
+/*
+ * 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 {
@@ -7,15 +40,20 @@
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() {
- touchInteractionHint.start()
+ if (!touchInteractionHint.running) {
+ touchInteractionHint.direction = touchInteractionHint.defaultDirection
+ touchInteractionHint.start()
+ }
}
onHintEnabledChanged: {
@@ -33,15 +71,25 @@
anchors.bottom: parent.bottom
opacity: touchInteractionHint.running ? 1.0 : 0.0
- Behavior on opacity { FadeAnimator { duration: 1000 } }
+ Behavior on opacity { FadeAnimation { duration: 1000 } }
}
TouchInteractionHint {
id: touchInteractionHint
- direction: swipeRight ? TouchInteraction.Right : TouchInteraction.Left
+ 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) hint.hintShown()
+ onRunningChanged: {
+ if (!running) {
+ if (bothWays && direction === defaultDirection) {
+ direction = otherDirection
+ start()
+ } else {
+ hint.hintShown()
+ }
+ }
+ }
}
Timer {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/qml/HarbourIconTextButton.qml
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava@monich.com>
+ * 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:
*
@@ -11,8 +11,8 @@
* 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
+ * 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
@@ -38,7 +38,7 @@
property alias icon: image
property bool down: pressed && containsMouse
property bool highlighted: down
- property alias iconSource: image.imageSource
+ property alias iconSource: image.source
property alias text: label.text
readonly property bool _showPress: highlighted || pressTimer.running
@@ -54,25 +54,11 @@
width: Math.max(image.width, label.width)
height: image.height + label.height
- Image {
+ HarbourHighlightIcon {
id: image
- readonly property color highlightColor: Theme.highlightColor
- property url imageSource
- property string highlightSource: {
- if (source != "") {
- var tmpSource = image.source.toString()
- var index = tmpSource.lastIndexOf("?")
- if (index !== -1) {
- tmpSource = tmpSource.substring(0, index)
- }
- return tmpSource + "?" + highlightColor
- } else {
- return ""
- }
- }
+ highlightColor: _showPress ? Theme.highlightColor : Theme.primaryColor
sourceSize: Qt.size(Theme.itemSizeSmall, Theme.itemSizeSmall)
- source: _showPress ? highlightSource : imageSource
opacity: parent.enabled ? 1.0 : 0.4
anchors {
top: parent.top
@@ -91,7 +77,7 @@
}
wrapMode: Text.Wrap
font.pixelSize: Theme.fontSizeExtraSmall
- color: highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
+ color: _showPress ? Theme.secondaryHighlightColor : Theme.secondaryColor
}
Timer {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/qml/HarbourPasswordInputField.qml
^
|
@@ -47,10 +47,7 @@
textRightMargin: textMargin
echoMode: _usePasswordEchoMode ? passwordEchoMode : TextInput.Normal
inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
-
- //: Default placeholder for password field
- //% "Password"
- placeholderText: qsTrId("components-ph-password")
+ placeholderText: label
//: Default label for password field
//% "Password"
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/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 { }
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/qml/HarbourTextFlip.qml
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava@monich.com>
+ * 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:
*
@@ -39,12 +39,14 @@
property string text
property Item target
property real duration: 500
+ property bool enabled: true
+ property string property: "text"
property var animation: SequentialAnimation {
alwaysRunToEnd: true
onRunningChanged: {
- if (!running && target.text !== rotation.text) {
+ if (!running && target[property] != rotation.text) {
start()
}
}
@@ -57,7 +59,7 @@
to: 90
duration: rotation.duration/2
}
- ScriptAction { script: target.text = rotation.text; }
+ ScriptAction { script: target[property] = rotation.text; }
NumberAnimation {
easing.type: Easing.InOutSine
target: rotation
@@ -78,5 +80,23 @@
z: 0
}
- onTextChanged: animation.start()
+ 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-mmslog-1.0.17.tar.bz2/src/harbour-lib/src/HarbourAztecCodeGenerator.cpp
^
|
@@ -0,0 +1,199 @@
+/*
+ * 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 "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);
+ void performTask() Q_DECL_OVERRIDE;
+public:
+ QString iText;
+ QString iCode;
+};
+
+HarbourAztecCodeGenerator::Task::Task(QThreadPool* aPool, QString aText) :
+ HarbourTask(aPool),
+ iText(aText)
+{
+}
+
+void HarbourAztecCodeGenerator::Task::performTask()
+{
+ QByteArray bytes(generate(iText));
+ 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);
+
+public Q_SLOTS:
+ void onTaskDone();
+
+public:
+ QThreadPool* iThreadPool;
+ Task* iTask;
+ QString iText;
+ QString iCode;
+};
+
+HarbourAztecCodeGenerator::Private::Private(HarbourAztecCodeGenerator* aParent) :
+ QObject(aParent),
+ iThreadPool(new QThreadPool(this)),
+ iTask(Q_NULLPTR)
+{
+ // Serialize the tasks:
+ iThreadPool->setMaxThreadCount(1);
+}
+
+HarbourAztecCodeGenerator::Private::~Private()
+{
+ iThreadPool->waitForDone();
+}
+
+inline HarbourAztecCodeGenerator* HarbourAztecCodeGenerator::Private::parentObject() const
+{
+ return qobject_cast<HarbourAztecCodeGenerator*>(parent());
+}
+
+void HarbourAztecCodeGenerator::Private::setText(QString aText)
+{
+ if (iText != aText) {
+ iText = aText;
+ HarbourAztecCodeGenerator* obj = parentObject();
+ const bool wasRunning = (iTask != Q_NULLPTR);
+ if (iTask) iTask->release(this);
+ iTask = new Task(iThreadPool, aText);
+ iTask->submit(this, SLOT(onTaskDone()));
+ Q_EMIT obj->textChanged();
+ if (!wasRunning) {
+ Q_EMIT obj->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;
+}
+
+void HarbourAztecCodeGenerator::setText(QString aValue)
+{
+ iPrivate->setText(aValue);
+}
+
+QString HarbourAztecCodeGenerator::code() const
+{
+ return iPrivate->iCode;
+}
+
+bool HarbourAztecCodeGenerator::running() const
+{
+ return iPrivate->iTask != Q_NULLPTR;
+}
+
+QByteArray HarbourAztecCodeGenerator::generate(QString aText)
+{
+ HDEBUG(aText);
+ QByteArray in(aText.toUtf8()), out;
+ AztecSymbol* aztec = aztec_encode_inv(in.constData(), in.size(),
+ AZTEC_CORRECTION_DEFAULT);
+ if (aztec) {
+ const int bytesPerRow = (aztec->size + 7) / 8;
+ out.reserve(bytesPerRow * aztec->size);
+ for (guint y = 0; y < aztec->size; y++) {
+ out.append((char*)aztec->rows[y], bytesPerRow);
+ }
+ aztec_symbol_free(aztec);
+ }
+ return out;
+}
+
+#include "HarbourAztecCodeGenerator.moc"
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/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"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/src/HarbourDisplayBlanking.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2015-2018 Jolla Ltd.
- * Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
+ * 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:
*
@@ -94,7 +94,7 @@
iPauseAllowed(false),
iPauseRequested(false),
iPauseActive(false),
- iRepeatTimer(NULL)
+ iRepeatTimer(Q_NULLPTR)
{
HDEBUG("created");
setupProperty("get_display_blanking_pause", "display_blanking_pause_ind",
@@ -253,10 +253,10 @@
// Callback for qmlRegisterSingletonType<HarbourDisplayBlanking>
QObject*
HarbourDisplayBlanking::createSingleton(
- QQmlEngine* aEngine,
- QJSEngine* aScript)
+ QQmlEngine*,
+ QJSEngine*)
{
- return new HarbourDisplayBlanking(aEngine);
+ return new HarbourDisplayBlanking();
}
QSharedPointer<HarbourDisplayBlanking>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/src/HarbourImageProvider.cpp
^
|
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava@monich.com>
+ * 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:
+ * 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
@@ -11,23 +11,24 @@
* 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.
+ * 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.
+ * 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.
+ * 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"
@@ -82,11 +83,31 @@
HarbourImageProvider::TextureFactory::load() const
{
if (iImage.isNull() && !iPath.isEmpty()) {
- QImageReader imageReader(iPath);
- if (iRequestedSize.width() > 0 && iRequestedSize.height() > 0) {
+ 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 (imageReader.read(&iImage) && !iImage.isNull()) {
+ if (!iImage.isNull()) {
if (iHighlight.isEmpty()) {
// Colorize grayscale to match ambience
if (iImage.isGrayscale()) {
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/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);
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/src/HarbourOrganizeListModel.cpp
^
|
@@ -115,6 +115,7 @@
SUPER(aParent),
iPrivate(new Private)
{
+ connect(this, SIGNAL(sourceModelChanged()), SIGNAL(sourceModelObjectChanged()));
}
HarbourOrganizeListModel::~HarbourOrganizeListModel()
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/src/HarbourPluginLoader.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Copyright (C) 2017 Slava Monich <slava.monich@jolla.com>
+ * 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:
*
@@ -11,26 +11,28 @@
* 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.
+ * 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.
+ * 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
@@ -72,7 +74,7 @@
// _ZNK8QQmlType22attachedPropertiesTypeEP17QQmlEnginePrivate
//
-#define LIBQT5QML_SO "/usr/lib/libQt5Qml.so.5"
+#define LIBQT5QML_SO "libQt5Qml.so.5"
// sym,ret,name,args
#define QMLTYPE_FUNCTIONS(f) \
@@ -124,13 +126,45 @@
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);
- ~Private();
QQmlType* qmlType(QString aName);
@@ -142,18 +176,18 @@
const char* aModule, int aMajor, int aMinor);
public:
+ static const LibQt5Qml gLibQt5Qml;
+
+public:
QQmlEngine* iEngine;
QString iModule;
int iMajor;
int iMinor;
bool iLoaded;
- void* iHandle;
- union {
- QmlTypeFunctions fn;
- void* ptr[NUM_FUNCTIONS];
- } iLibQt5Qml;
};
+const HarbourPluginLoader::LibQt5Qml HarbourPluginLoader::Private::gLibQt5Qml;
+
HarbourPluginLoader::Private::Private(
QQmlEngine* aEngine,
QString aModule,
@@ -163,37 +197,21 @@
iModule(aModule),
iMajor(aMajor),
iMinor(aMinor),
- iLoaded(false),
- iHandle(NULL)
+ iLoaded(false)
{
- memset(&iLibQt5Qml, 0, sizeof(iLibQt5Qml));
- // Load the actual import library
- QQmlComponent* component = new QQmlComponent(iEngine);
- component->setData(QString("import QtQuick 2.0\nimport %1 %2.%3\nQtObject {}").
- arg(iModule).arg(iMajor).arg(iMinor).toUtf8(), QUrl());
- if (component->status() == QQmlComponent::Ready) {
- delete component->create();
- // Resolve unstable symbols
- iHandle = dlopen(LIBQT5QML_SO, RTLD_LAZY);
- if (iHandle) {
- for (uint i = 0; i < NUM_FUNCTIONS; i++) {
- iLibQt5Qml.ptr[i] = dlsym(iHandle, QmlTypeSymbols[i]);
- HDEBUG(QmlTypeSymbols[i] << (iLibQt5Qml.ptr[i] ? "OK" : "missing"));
- }
+ HASSERT(gLibQt5Qml.iHandle);
+ if (gLibQt5Qml.iHandle) {
+ // Load the actual import library
+ QQmlComponent* component = new QQmlComponent(iEngine);
+ component->setData(QString("import QtQuick 2.0\nimport %1 %2.%3\nQtObject {}").
+ arg(iModule).arg(iMajor).arg(iMinor).toUtf8(), QUrl());
+ if (component->status() == QQmlComponent::Ready) {
+ delete component->create();
+ iLoaded = true;
} else {
- HWARN("Failed to load" << LIBQT5QML_SO);
+ HWARN(component->errors());
}
- iLoaded = true;
- } else {
- HWARN(component->errors());
- }
- delete component;
-}
-
-HarbourPluginLoader::Private::~Private()
-{
- if (iHandle) {
- dlclose(iHandle);
+ delete component;
}
}
@@ -244,16 +262,16 @@
if (aType && iEngine) {
// Get around the ABI break in Qt 5.6
QQmlAttachedPropertiesFunc attachedPropertiesFunction =
- iLibQt5Qml.fn.AttachedPropertiesFunctionProc ?
- iLibQt5Qml.fn.AttachedPropertiesFunctionProc(aType) :
- iLibQt5Qml.fn.AttachedPropertiesFunctionProc6 ?
- iLibQt5Qml.fn.AttachedPropertiesFunctionProc6(aType, iEngine->d_func()) :
+ gLibQt5Qml.iSym.fn.AttachedPropertiesFunctionProc ?
+ gLibQt5Qml.iSym.fn.AttachedPropertiesFunctionProc(aType) :
+ gLibQt5Qml.iSym.fn.AttachedPropertiesFunctionProc6 ?
+ gLibQt5Qml.iSym.fn.AttachedPropertiesFunctionProc6(aType, iEngine->d_func()) :
NULL;
const QMetaObject *attachedPropertiesMetaObject =
- iLibQt5Qml.fn.AttachedPropertiesTypeProc ?
- iLibQt5Qml.fn.AttachedPropertiesTypeProc(aType) :
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/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-mmslog-1.0.17.tar.bz2/src/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-mmslog-1.0.17.tar.bz2/src/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-mmslog-1.0.17.tar.bz2/src/harbour-lib/src/HarbourSystemInfo.cpp
^
|
@@ -0,0 +1,205 @@
+/*
+ * 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
+ * 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>
+
+// ==========================================================================
+// 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);
+
+public:
+ QString iName;
+ QString iVersion;
+ QVector<uint> iParsedVersion;
+};
+
+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));
+}
+
+// ==========================================================================
+// HarbourSystemInfo
+// ==========================================================================
+
+HarbourSystemInfo::HarbourSystemInfo(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private)
+{
+ HDEBUG("created");
+}
+
+HarbourSystemInfo::~HarbourSystemInfo()
+{
+ HDEBUG("deleted");
+ delete iPrivate;
+}
+
+// Callback for qmlRegisterSingletonType<HarbourSystemInfo>
+QObject* HarbourSystemInfo::createSingleton(QQmlEngine*, QJSEngine*)
+{
+ return new HarbourSystemInfo(); // Singleton doesn't need a parent
+}
+
+QString HarbourSystemInfo::osName() const
+{
+ return iPrivate->iName;
+}
+
+QString HarbourSystemInfo::osVersion() const
+{
+ return iPrivate->iVersion;
+}
+
+int HarbourSystemInfo::osVersionCompare(QString aVersion)
+{
+ return Private::compareVersions(iPrivate->iParsedVersion, aVersion);
+}
+
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/src/HarbourSystemState.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2015-2018 Jolla Ltd.
- * Copyright (C) 2015-2018 Slava Monich <slava.monich@jolla.com>
+ * 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:
*
@@ -195,10 +195,10 @@
// Callback for qmlRegisterSingletonType<HarbourSystemState>
QObject*
HarbourSystemState::createSingleton(
- QQmlEngine* aEngine,
- QJSEngine* aScript)
+ QQmlEngine*,
+ QJSEngine*)
{
- return new HarbourSystemState(aEngine);
+ return new HarbourSystemState();
}
QSharedPointer<HarbourSystemState>
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/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"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/src/HarbourTask.cpp
^
|
@@ -85,7 +85,11 @@
HarbourTask::~HarbourTask()
{
- HASSERT(iPrivate->iReleased);
+ // 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;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/src/HarbourTheme.cpp
^
|
@@ -1,8 +1,8 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava@monich.com>
+ * 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:
+ * 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
@@ -11,33 +11,35 @@
* 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.
+ * 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.
+ * 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.
+ * 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 "/usr/lib/libsailfishsilica.so.1"
+#define SILICA_SO "libsailfishsilica.so.1"
#define SILICA_FUNCTIONS(f) \
f("_ZN6Silica5Theme8instanceEv", /* Silica::Theme* Silica::Theme::instance() */ \
QObject*, instance,()) \
@@ -46,7 +48,15 @@
f("_ZNK6Silica5Theme11colorSchemeEv", /* Silica::ColorScheme Silica::Theme::colorScheme() const */ \
HarbourTheme::ColorScheme, colorScheme,(QObject*)) \
f("_ZNK6Silica5Theme12primaryColorEv", /* QColor Silica::Theme::primaryColor() const */ \
- QColor, primaryColor,(QObject*))
+ 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
@@ -65,6 +75,11 @@
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;
@@ -72,11 +87,20 @@
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)
@@ -88,7 +112,7 @@
QObject* HarbourTheme::Private::instance()
{
- return gSilica.instance ? gSilica.instance() : NULL;
+ return gSilica.instance ? gSilica.instance() : Q_NULLPTR;
}
HarbourTheme::ColorScheme HarbourTheme::Private::colorScheme()
@@ -110,6 +134,34 @@
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
// ==========================================================================
@@ -117,7 +169,7 @@
HarbourTheme::HarbourTheme(QObject* aParent) : QObject(aParent)
{
if (!Private::gHandle) {
- Private::gHandle = dlopen(SILICA_SO, RTLD_LAZY);
+ Private::gHandle = HarbourDlopen(SILICA_SO, RTLD_LAZY);
if (Private::gHandle) {
void** ptr = (void**)&Private::gSilica;
for (uint i = 0; i < NUM_FUNCTIONS; i++) {
@@ -148,9 +200,9 @@
}
// Callback for qmlRegisterSingletonType<HarbourTheme>
-QObject* HarbourTheme::createSingleton(QQmlEngine* aEngine, QJSEngine* aScript)
+QObject* HarbourTheme::createSingleton(QQmlEngine*, QJSEngine*)
{
- return new HarbourTheme(aEngine);
+ return new HarbourTheme();
}
QColor HarbourTheme::primaryColor() const
@@ -158,6 +210,29 @@
return Private::primaryColor();
}
+QColor HarbourTheme::invertedPrimaryColor() const
+{
+ return invertedColor(Private::primaryColor());
+}
+
+QColor HarbourTheme::invertedColor(const QColor& aColor)
+{
+ if (aColor.isValid()) {
+ const QRgb rgba = aColor.rgba();
+ return QColor(((~(rgba & RGB_MASK)) & RGB_MASK) | (rgba & (~RGB_MASK)));
+ } else {
+ return aColor;
+ }
+}
+
+qreal HarbourTheme::colorDifference(const QColor& aColor1, const QColor& aColor2)
+{
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/harbour-lib/src/HarbourTransferMethodsModel.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2019 Jolla Ltd.
- * Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -22,7 +22,7 @@
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
@@ -36,6 +36,7 @@
#include <QTranslator>
#include <QQmlEngine>
+#include <QRegExp>
// ==========================================================================
// HarbourTransferMethodsModel::TransferEngine
@@ -45,82 +46,111 @@
{
Q_OBJECT
- static const char SERVICE[];
- static const char PATH[];
- static const char INTERFACE[];
-
public:
- TransferEngine(QObject* aParent) : QDBusAbstractInterface(SERVICE, PATH,
- INTERFACE, QDBusConnection::sessionBus(), aParent) {}
+ 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("transferMethods"); }
+ { return asyncCall(QStringLiteral("transferMethods")); }
inline QDBusPendingCall transferMethods2()
- { return asyncCall("transferMethods2"); }
+ { return asyncCall(QStringLiteral("transferMethods2")); }
Q_SIGNALS: // SIGNALS
void transferMethodListChanged();
};
-const char HarbourTransferMethodsModel::TransferEngine::SERVICE[] = "org.nemo.transferengine";
-const char HarbourTransferMethodsModel::TransferEngine::PATH[] = "/org/nemo/transferengine";
-const char HarbourTransferMethodsModel::TransferEngine::INTERFACE[] = "org.nemo.transferengine";
-
// ==========================================================================
-// HarbourTransferMethodsModel
+// HarbourTransferMethodsModel::Private
// ==========================================================================
-HarbourTransferMethodsModel::HarbourTransferMethodsModel(QObject* aParent):
- QAbstractListModel(aParent),
+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(&HarbourTransferMethodsModel::checkTransferMethods),
- iUpdateWatcher(NULL)
+ iRequestUpdate(&Private::checkTransferMethods),
+ iUpdateWatcher(Q_NULLPTR),
+ iShowAccountsWatcher(Q_NULLPTR),
+ iShowAccountsFailed(false),
+ iTransferEngine(new TransferEngine(this))
{
- iTransferEngine = new TransferEngine(this);
connect(iTransferEngine,
SIGNAL(transferMethodListChanged()),
SLOT(requestUpdate()));
requestUpdate();
}
-HarbourTransferMethodsModel::~HarbourTransferMethodsModel()
+HarbourTransferMethodsModel::Private::~Private()
{
delete iTransferEngine;
}
-// Callback for qmlRegisterSingletonType<HarbourTransferMethodsModel>
-QObject*
-HarbourTransferMethodsModel::createSingleton(QQmlEngine* aEngine, QJSEngine* aScript)
+inline HarbourTransferMethodsModel* HarbourTransferMethodsModel::Private::parentModel()
{
- return new HarbourTransferMethodsModel(aEngine);
+ return qobject_cast<HarbourTransferMethodsModel*>(parent());
}
-bool HarbourTransferMethodsModel::loadTranslations(QTranslator* aTranslator, QLocale aLocale)
-{
- if (aTranslator->load(aLocale, "sailfish_transferengine_plugins", "-",
- "/usr/share/translations")) {
- return true;
- } else {
- HWARN("Failed to load transferengine plugin translator for" << aLocale);
- return false;
- }
-}
-
-void HarbourTransferMethodsModel::requestUpdate()
+void HarbourTransferMethodsModel::Private::requestUpdate()
{
if (iUpdateWatcher) {
- HDEBUG("dropping pending call");
+ HDEBUG("dropping pending method list query");
iUpdateWatcher->disconnect(this);
delete iUpdateWatcher;
- iUpdateWatcher = NULL;
}
iUpdateWatcher = (this->*iRequestUpdate)();
}
-void HarbourTransferMethodsModel::setTransferMethods2(HarbourTransferMethodInfo2List aList)
+void HarbourTransferMethodsModel::Private::setTransferMethods2(HarbourTransferMethodInfo2List aList)
{
- iRequestUpdate = &HarbourTransferMethodsModel::requestTransferMethods2;
+ iRequestUpdate = &Private::requestTransferMethods2;
HDEBUG(aList.count() << "methods");
if (iMethodList != aList) {
iMethodList = aList;
@@ -128,11 +158,11 @@
}
if (!iAccountIconSupported) {
iAccountIconSupported = true;
- Q_EMIT accountIconSupportedChanged();
+ Q_EMIT parentModel()->accountIconSupportedChanged();
}
}
-QDBusPendingCallWatcher* HarbourTransferMethodsModel::checkTransferMethods()
+QDBusPendingCallWatcher* HarbourTransferMethodsModel::Private::checkTransferMethods()
{
// First try transferMethods2() and see if it works
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher
@@ -142,7 +172,7 @@
return watcher;
}
-QDBusPendingCallWatcher* HarbourTransferMethodsModel::requestTransferMethods()
+QDBusPendingCallWatcher* HarbourTransferMethodsModel::Private::requestTransferMethods()
{
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher
(iTransferEngine->transferMethods(), this);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/.gitignore
^
|
@@ -4,9 +4,11 @@
test/coverage/results
debian/files
debian/libdbusaccess-dev.debhelper.log
+debian/libdbusaccess-dev.install
debian/libdbusaccess-dev.substvars
debian/libdbusaccess-dev
debian/libdbusaccess.debhelper.log
+debian/libdbusaccess.install
debian/libdbusaccess.postinst.debhelper
debian/libdbusaccess.postrm.debhelper
debian/libdbusaccess.substvars
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/LICENSE
^
|
@@ -1,4 +1,4 @@
-Copyright (C) 2017-2019 Jolla Ltd.
+Copyright (C) 2017-2020 Jolla Ltd.
You may use this file under the terms of BSD license as follows:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/Makefile
^
|
@@ -1,6 +1,8 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release test
+.PHONY: clean all debug release coverage pkgconfig install install-dev test
+.PHONY: print_debug_lib print_release_lib print_coverage_lib
+
#
# Required packages
@@ -20,7 +22,7 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
-VERSION_RELEASE = 8
+VERSION_RELEASE = 11
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
@@ -36,6 +38,7 @@
LIB_SYMLINK2 = $(LIB_SYMLINK1).$(VERSION_MINOR)
LIB_SONAME = $(LIB_SYMLINK1)
LIB = $(LIB_SONAME).$(VERSION_MINOR).$(VERSION_RELEASE)
+STATIC_LIB = $(LIB_NAME).a
#
# Sources
@@ -62,40 +65,26 @@
GEN_DIR = $(BUILD_DIR)
DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
RELEASE_BUILD_DIR = $(BUILD_DIR)/release
-
-#
-# Code coverage
-#
-
-ifndef GCOV
-GCOV = 0
-endif
-
-ifneq ($(GCOV),0)
-CFLAGS += --coverage
-LDFLAGS += --coverage
-endif
+COVERAGE_BUILD_DIR = $(BUILD_DIR)/coverage
#
# Tools and flags
#
-CC = $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
LD = $(CC)
WARNINGS = -Wall
INCLUDES = -I$(INCLUDE_DIR) -I$(GEN_DIR) -I$(SRC_DIR)
BASE_FLAGS = -fPIC
FULL_CFLAGS = $(BASE_FLAGS) $(CFLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) \
-MMD -MP $(shell pkg-config --cflags $(PKGS))
-FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -Wl,-soname,$(LIB_SONAME) \
- $(shell pkg-config --libs $(PKGS))
+FULL_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS) -shared -Wl,-soname=$(LIB_SONAME) \
+ -Wl,--version-script=$(LIB_NAME).map $(shell pkg-config --libs $(PKGS))
DEBUG_FLAGS = -g
RELEASE_FLAGS =
+COVERAGE_FLAGS = -g
-ifndef KEEP_SYMBOLS
-KEEP_SYMBOLS = 0
-endif
-
+KEEP_SYMBOLS ?= 0
ifneq ($(KEEP_SYMBOLS),0)
RELEASE_FLAGS += -g
endif
@@ -104,6 +93,7 @@
RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG
RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
+COVERAGE_CFLAGS = $(FULL_CFLAGS) $(COVERAGE_FLAGS) --coverage
#
# Files
@@ -116,14 +106,25 @@
RELEASE_OBJS = \
$(GEN_SRC:%.c=$(RELEASE_BUILD_DIR)/%.o) \
$(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
+COVERAGE_OBJS = \
+ $(GEN_SRC:%.c=$(COVERAGE_BUILD_DIR)/%.o) \
+ $(SRC:%.c=$(COVERAGE_BUILD_DIR)/%.o)
GEN_FILES = $(GEN_SRC:%=$(GEN_DIR)/%)
.PRECIOUS: $(GEN_FILES)
+DEBUG_LIB = $(DEBUG_BUILD_DIR)/$(LIB)
+RELEASE_LIB = $(RELEASE_BUILD_DIR)/$(LIB)
+DEBUG_LINK = $(DEBUG_BUILD_DIR)/$(LIB_SYMLINK1)
+RELEASE_LINK = $(RELEASE_BUILD_DIR)/$(LIB_SYMLINK1)
+DEBUG_STATIC_LIB = $(DEBUG_BUILD_DIR)/$(STATIC_LIB)
+RELEASE_STATIC_LIB = $(RELEASE_BUILD_DIR)/$(STATIC_LIB)
+COVERAGE_STATIC_LIB = $(COVERAGE_BUILD_DIR)/$(STATIC_LIB)
+
#
# Dependencies
#
-DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d)
+DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d) $(COVERAGE_OBJS:%.o=%.d)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(DEPS)),)
-include $(DEPS)
@@ -131,29 +132,28 @@
endif
$(GEN_FILES): | $(GEN_DIR)
-$(DEBUG_OBJS) $(DEBUG_LIB): | $(DEBUG_BUILD_DIR)
-$(RELEASE_OBJS) $(RELEASE_LIB): | $(RELEASE_BUILD_DIR)
+$(DEBUG_OBJS) $(DEBUG_LIB) $(DEBUG_STATIC_LIB): | $(DEBUG_BUILD_DIR)
+$(RELEASE_OBJS) $(RELEASE_LIB) $(RELEASE_STATIC_LIB): | $(RELEASE_BUILD_DIR)
+$(COVERAGE_OBJS) $(COVERAGE_STATIC_LIB): | $(COVERAGE_BUILD_DIR)
#
# Rules
#
-DEBUG_LIB = $(DEBUG_BUILD_DIR)/$(LIB)
-RELEASE_LIB = $(RELEASE_BUILD_DIR)/$(LIB)
-DEBUG_LINK = $(DEBUG_BUILD_DIR)/$(LIB_SYMLINK1)
-RELEASE_LINK = $(RELEASE_BUILD_DIR)/$(LIB_SYMLINK1)
-
-debug: $(DEBUG_LIB) $(DEBUG_LINK)
+debug: $(DEBUG_STATIC_LIB) $(DEBUG_LIB) $(DEBUG_LINK)
-release: $(RELEASE_LIB) $(RELEASE_LINK)
+release: $(RELEASE_STATIC_LIB) $(RELEASE_LIB) $(RELEASE_LINK)
-pkgconfig: $(PKGCONFIG)
+coverage: $(COVERAGE_STATIC_LIB)
print_debug_lib:
- @echo $(DEBUG_LIB)
+ @echo $(DEBUG_STATIC_LIB)
print_release_lib:
- @echo $(RELEASE_LIB)
+ @echo $(RELEASE_STATIC_LIB)
+
+print_coverage_lib:
+ @echo $(COVERAGE_STATIC_LIB)
print_debug_link:
@echo $(DEBUG_LINK)
@@ -161,12 +161,6 @@
print_release_link:
@echo $(RELEASE_LINK)
-print_debug_path:
- @echo $(DEBUG_BUILD_DIR)
-
-print_release_path:
- @echo $(RELEASE_BUILD_DIR)
-
clean:
make -C test clean
make -C tools/dbus-creds clean
@@ -174,9 +168,10 @@
rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~
rm -fr $(BUILD_DIR) RPMS installroot
rm -fr debian/tmp debian/dbusaccess-tools
- rm -fr debian/libdbusaccess debian/libdbusaccess-dev
+ rm -fr debian/lib$(NAME) debian/lib$(NAME)-dev
rm -f documentation.list debian/files debian/*.substvars
rm -f debian/*.debhelper.log debian/*.debhelper debian/*~
+ rm -f debian/libdbusaccess.install debian/libdbusaccess-dev.install
test:
make -C test test
@@ -190,6 +185,9 @@
$(RELEASE_BUILD_DIR):
mkdir -p $@
+$(COVERAGE_BUILD_DIR):
+ mkdir -p $@
+
$(GEN_DIR)/%.tab.c : $(SRC_DIR)/%.y
bison -d -o $@ $<
@@ -202,12 +200,18 @@
$(RELEASE_BUILD_DIR)/%.o : $(GEN_DIR)/%.c
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+$(COVERAGE_BUILD_DIR)/%.o : $(GEN_DIR)/%.c
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+$(COVERAGE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/debian/changelog
^
|
@@ -1,3 +1,22 @@
+libdbusaccess (1.0.11) unstable; urgency=low
+
+ * Hide internal symbols
+ * Respect arch specific lib dir
+
+ -- Slava Monich <slava.monich@jolla.com> Mon, 25 May 2020 15:50:24 +0300
+
+libdbusaccess (1.0.10) unstable; urgency=low
+
+ * Assume syntax version 1 by default
+
+ -- Slava Monich <slava.monich@jolla.com> Mon, 04 Nov 2019 10:44:11 +0300
+
+libdbusaccess (1.0.9) unstable; urgency=low
+
+ * Avoid unnecessary linkage with gio
+
+ -- Slava Monich <slava.monich@jolla.com> Fri, 01 Nov 2019 19:47:53 +0200
+
libdbusaccess (1.0.8) unstable; urgency=low
* Tolerate non-existent users and groups
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/debian/control
^
|
@@ -2,7 +2,7 @@
Section: libs
Priority: optional
Maintainer: Slava Monich <slava.monich@jolla.com>
-Build-Depends: debhelper (>= 7), libglib2.0-dev (>= 2.0), libglibutil-dev
+Build-Depends: debhelper (>= 8.1.3), libglib2.0-dev (>= 2.0), libglibutil-dev
Standards-Version: 3.8.4
Package: libdbusaccess
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/debian/copyright
^
|
@@ -1,4 +1,4 @@
-Copyright (C) 2017 Jolla Ltd.
+Copyright (C) 2017-2020 Jolla Ltd.
You may use this file under the terms of BSD license as follows:
@@ -11,9 +11,9 @@
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.
+ 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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/debian/libdbusaccess-dev.install.in
^
|
@@ -0,0 +1,3 @@
+debian/tmp/@LIBDIR@/libdbusaccess.so @LIBDIR@
+debian/tmp/@LIBDIR@/pkgconfig/libdbusaccess.pc @LIBDIR@/pkgconfig
+debian/tmp/usr/include/* usr/include
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/debian/libdbusaccess.install.in
^
|
@@ -0,0 +1 @@
+debian/tmp/@LIBDIR@/libdbusaccess.so.* @LIBDIR@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/debian/rules
^
|
@@ -5,17 +5,18 @@
#export DH_VERBOSE=1
DBUS_CREDS_DIR=tools/dbus-creds
+LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
override_dh_auto_clean:
dh_auto_clean
dh_auto_clean -- -C $(DBUS_CREDS_DIR)
override_dh_auto_build:
- dh_auto_build
+ dh_auto_build -- LIBDIR=$(LIBDIR) release pkgconfig debian/libdbusaccess.install debian/libdbusaccess-dev.install
dh_auto_build -- -C $(DBUS_CREDS_DIR)
override_dh_auto_install:
- dh_auto_install -- install-dev
+ dh_auto_install -- LIBDIR=$(LIBDIR) install-dev
dh_auto_install -- -C $(DBUS_CREDS_DIR)
%:
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/libdbusaccess.map
^
|
@@ -0,0 +1,10 @@
+{
+ global:
+ da_peer_*;
+ da_policy_*;
+ da_self_*;
+ da_system_*;
+ dbusaccess_log;
+ local:
+ *;
+};
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/libdbusaccess.pc.in
^
|
@@ -1,10 +1,10 @@
name=dbusaccess
-libdir=/usr/lib
+libdir=@libdir@
includedir=/usr/include
Name: libdbusaccess
Description: D-Bus access control library
-Version: [version]
-Requires: gio-2.0 glib-2.0 libglibutil
+Version: @version@
+Requires.private: glib-2.0 gio-2.0 libglibutil
Libs: -L${libdir} -l${name}
Cflags: -I${includedir} -I${includedir}/${name}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/rpm/libdbusaccess.spec
^
|
@@ -1,10 +1,10 @@
Name: libdbusaccess
-Version: 1.0.8
+Version: 1.0.11
Release: 0
Summary: Access control over D-Bus
Group: Development/Libraries
License: BSD
-URL: https://git.merproject.org/mer-core/libdbusaccess
+URL: https://git.sailfishos.org/mer-core/libdbusaccess
Source: %{name}-%{version}.tar.bz2
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gio-2.0)
@@ -39,12 +39,12 @@
%setup -q
%build
-make KEEP_SYMBOLS=1 release pkgconfig
-make KEEP_SYMBOLS=1 -C tools/dbus-creds release
+make LIBDIR=%{_libdir} KEEP_SYMBOLS=1 release pkgconfig
+make LIBDIR=%{_libdir} KEEP_SYMBOLS=1 -C tools/dbus-creds release
%install
rm -rf %{buildroot}
-make DESTDIR=%{buildroot} install-dev
+make DESTDIR=%{buildroot} LIBDIR=%{_libdir} install-dev
make DESTDIR=%{buildroot} -C tools/dbus-creds install
%check
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/src/dbusaccess_cred.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * 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 BSD license as follows:
*
@@ -13,9 +13,9 @@
* 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.
+ * 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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/src/dbusaccess_cred_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * 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 BSD license as follows:
*
@@ -13,9 +13,9 @@
* 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.
+ * 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
@@ -44,11 +44,13 @@
DACred* cred,
DACredPriv* priv,
const char* data,
- gsize len);
+ gsize len)
+ G_GNUC_INTERNAL;
void
da_cred_priv_cleanup(
- DACredPriv* priv);
+ DACredPriv* priv)
+ G_GNUC_INTERNAL;
#endif /* DBUSACCESS_CRED_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/src/dbusaccess_log.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * 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 BSD license as follows:
*
@@ -13,9 +13,9 @@
* 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.
+ * 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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/src/dbusaccess_parser.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * 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 BSD license as follows:
*
@@ -13,9 +13,9 @@
* 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.
+ * 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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/src/dbusaccess_parser.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017-2019 Jolla Ltd.
- * Copyright (C) 2017-2019 Slava Monich <slava.monich@jolla.com>
+ * 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 BSD license as follows:
*
@@ -72,15 +72,18 @@
DAParser*
da_parser_compile(
const char* spec,
- const DA_ACTION* actions);
+ const DA_ACTION* actions)
+ G_GNUC_INTERNAL;
GSList*
da_parser_get_result(
- DAParser* parser);
+ DAParser* parser)
+ G_GNUC_INTERNAL;
void
da_parser_delete(
- DAParser* parser);
+ DAParser* parser)
+ G_GNUC_INTERNAL;
#endif /* DBUSACCESS_PARSER_H */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/src/dbusaccess_parser_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * 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 BSD license as follows:
*
@@ -13,9 +13,9 @@
* 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.
+ * 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
@@ -42,7 +42,7 @@
#ifdef DEBUG
# define YYDEBUG 1
-extern int da_parser_debug;
+extern int da_parser_debug G_GNUC_INTERNAL;
#endif
#define YY_LEX da_parser_lex
@@ -58,89 +58,105 @@
da_parser_error(
DAParser* parser,
DAScanner* scanner,
- const char* error);
+ const char* error)
+ G_GNUC_INTERNAL;
/* Generated scanner */
DAScanner*
da_scanner_create(
- void);
+ void)
+ G_GNUC_INTERNAL;
void
da_scanner_delete(
- DAScanner* scanner);
+ DAScanner* scanner)
+ G_GNUC_INTERNAL;
DAScannerBuffer*
da_scanner_buffer_create(
const char* str,
- DAScanner* scanner);
+ DAScanner* scanner)
+ G_GNUC_INTERNAL;
void
da_scanner_buffer_delete(
DAScannerBuffer* buffer,
- DAScanner* scanner);
+ DAScanner* scanner)
+ G_GNUC_INTERNAL;
int
da_parser_parse(
DAParser* parser,
- DAScanner* scanner);
+ DAScanner* scanner)
+ G_GNUC_INTERNAL;
/* These are for the scanner */
void
da_parser_start_string(
- DAParser* parser);
+ DAParser* parser)
+ G_GNUC_INTERNAL;
void
da_parser_append_char(
DAParser* parser,
- char c);
+ char c)
+ G_GNUC_INTERNAL;
const char*
da_parser_finish_string(
- DAParser* parser);
+ DAParser* parser)
+ G_GNUC_INTERNAL;
/* And these are for the generated parser */
GSList*
da_parser_new_link(
DAParser* parser,
- void* data);
+ void* data)
+ G_GNUC_INTERNAL;
char*
da_parser_new_string(
DAParser* parser,
- const char* str);
+ const char* str)
+ G_GNUC_INTERNAL;
DAParserExpr*
da_parser_new_expr_identity(
DAParser* parser,
int uid,
- int gid);
+ int gid)
+ G_GNUC_INTERNAL;
DAParserExpr*
da_parser_new_expr_custom(
DAParser* parser,
const char* name,
- const char* param);
+ const char* param)
+ G_GNUC_INTERNAL;
DAParserExpr*
da_parser_new_expr(
DAParser* parser,
DA_PARSER_EXPR type,
DAParserExpr* left,
- DAParserExpr* right);
+ DAParserExpr* right)
+ G_GNUC_INTERNAL;
DAParserEntry*
da_parser_new_entry(
DAParser* parser,
DAParserExpr* expr,
- DA_ACCESS access);
+ DA_ACCESS access)
+ G_GNUC_INTERNAL;
void
da_parser_add_entries(
DAParser* parser,
- GSList* entries);
+ GSList* entries)
+ G_GNUC_INTERNAL;
#endif /* DBUSACCESS_PARSER_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/src/dbusaccess_policy1.l
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * 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 BSD license as follows:
*
@@ -13,9 +13,9 @@
* 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.
+ * 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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/src/dbusaccess_policy1.y
^
|
@@ -90,6 +90,14 @@
{
da_parser_add_entries(parser, $3);
}
+ | entries
+ {
+ da_parser_add_entries(parser, $1);
+ }
+ | entries ';'
+ {
+ da_parser_add_entries(parser, $1);
+ }
version:
NUMBER
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/src/dbusaccess_self.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * 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 BSD license as follows:
*
@@ -13,9 +13,9 @@
* 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.
+ * 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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/src/dbusaccess_system.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * 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 BSD license as follows:
*
@@ -13,9 +13,9 @@
* 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.
+ * 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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/test/common/Makefile
^
|
@@ -1,6 +1,6 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release lib-release lib-debug
+.PHONY: clean all debug release coverage debug_lib release_lib coverage_lib
#
# Real test makefile defines EXE (and possibly SRC) and includes this one.
@@ -17,7 +17,7 @@
# Required packages
#
-PKGS += libglibutil glib-2.0
+PKGS += libglibutil gio-2.0
#
# Default target
@@ -35,20 +35,7 @@
BUILD_DIR = build
DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
RELEASE_BUILD_DIR = $(BUILD_DIR)/release
-
-#
-# Code coverage
-#
-
-ifndef GCOV
-GCOV = 0
-endif
-
-ifneq ($(GCOV),0)
-CFLAGS += --coverage
-LDFLAGS += --coverage
-SUBMAKE_OPTS += GCOV=1
-endif
+COVERAGE_BUILD_DIR = $(BUILD_DIR)/coverage
#
# Tools and flags
@@ -68,6 +55,7 @@
QUIET_MAKE = make --no-print-directory
DEBUG_FLAGS = -g
RELEASE_FLAGS =
+COVERAGE_FLAGS = -g
ifndef KEEP_SYMBOLS
KEEP_SYMBOLS = 0
@@ -80,8 +68,11 @@
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
RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
+COVERAGE_CFLAGS = $(FULL_CFLAGS) $(COVERAGE_FLAGS) --coverage
#
# Files
@@ -93,12 +84,17 @@
RELEASE_OBJS = \
$(COMMON_SRC:%.c=$(RELEASE_BUILD_DIR)/common_%.o) \
$(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
+COVERAGE_OBJS = \
+ $(COMMON_SRC:%.c=$(COVERAGE_BUILD_DIR)/common_%.o) \
+ $(SRC:%.c=$(COVERAGE_BUILD_DIR)/%.o)
DEBUG_LIB_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_debug_lib)
RELEASE_LIB_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_release_lib)
-DEBUG_LIB_PATH := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_debug_path)
+COVERAGE_LIB_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_coverage_lib)
+
DEBUG_LIB := $(LIB_DIR)/$(DEBUG_LIB_FILE)
RELEASE_LIB := $(LIB_DIR)/$(RELEASE_LIB_FILE)
+COVERAGE_LIB := $(LIB_DIR)/$(COVERAGE_LIB_FILE)
#
# Dependencies
@@ -111,8 +107,13 @@
endif
endif
+$(DEBUG_LIB): | debug_lib
+$(RELEASE_LIB): | release_lib
+$(COVERAGE_LIB): | coverage_lib
+
$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
+$(COVERAGE_OBJS): | $(COVERAGE_BUILD_DIR)
#
# Rules
@@ -120,10 +121,13 @@
DEBUG_EXE = $(DEBUG_BUILD_DIR)/$(EXE)
RELEASE_EXE = $(RELEASE_BUILD_DIR)/$(EXE)
+COVERAGE_EXE = $(COVERAGE_BUILD_DIR)/$(EXE)
+
+debug: debug_lib $(DEBUG_EXE)
-debug: lib-debug $(DEBUG_EXE)
+release: release_lib $(RELEASE_EXE)
-release: lib-release $(RELEASE_EXE)
+coverage: coverage_lib $(COVERAGE_EXE)
clean:
rm -f *~
@@ -136,10 +140,10 @@
@echo "===========" $(EXE) "=========== "
test: test_banner debug
- @LD_LIBRARY_PATH="$(LIB_DIR)/$(DEBUG_LIB_PATH)" $(DEBUG_EXE)
+ @$(DEBUG_EXE)
valgrind: test_banner debug
- @LD_LIBRARY_PATH="$(LIB_DIR)/$(DEBUG_LIB_PATH)" G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --leak-check=full --show-possibly-lost=no $(DEBUG_EXE)
+ @G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --leak-check=full --show-possibly-lost=no $(DEBUG_EXE)
$(DEBUG_BUILD_DIR):
mkdir -p $@
@@ -147,18 +151,27 @@
$(RELEASE_BUILD_DIR):
mkdir -p $@
+$(COVERAGE_BUILD_DIR):
+ mkdir -p $@
+
$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+$(COVERAGE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
$(DEBUG_BUILD_DIR)/common_%.o : $(COMMON_DIR)/%.c
$(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(RELEASE_BUILD_DIR)/common_%.o : $(COMMON_DIR)/%.c
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+$(COVERAGE_BUILD_DIR)/common_%.o : $(COMMON_DIR)/%.c
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
$(DEBUG_EXE): $(DEBUG_LIB) $(DEBUG_BUILD_DIR) $(DEBUG_OBJS)
$(LD) $(DEBUG_LDFLAGS) $(DEBUG_OBJS) $< $(LIBS) -o $@
@@ -168,8 +181,14 @@
strip $@
endif
-lib-debug:
+$(COVERAGE_EXE): $(COVERAGE_LIB) $(COVERAGE_BUILD_DIR) $(COVERAGE_OBJS)
+ $(LD) $(COVERAGE_LDFLAGS) $(COVERAGE_OBJS) $< $(LIBS) -o $@
+
+debug_lib:
@make $(SUBMAKE_OPTS) -C $(LIB_DIR) debug
-lib-release:
+release_lib:
@make $(SUBMAKE_OPTS) -C $(LIB_DIR) release
+
+coverage_lib:
+ @make $(SUBMAKE_OPTS) -C $(LIB_DIR) coverage
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/test/coverage/run
^
|
@@ -8,8 +8,6 @@
test_policy \
test_self"
-FLAVOR="release"
-
pushd `dirname $0` > /dev/null
COV_DIR="$PWD"
pushd .. > /dev/null
@@ -20,13 +18,13 @@
popd > /dev/null
popd > /dev/null
-export LD_LIBRARY_PATH="$BASE_DIR/build/$FLAVOR"
+export LD_LIBRARY_PATH="$BASE_DIR/build/coverage"
-make GCOV=1 -C "$BASE_DIR" clean $FLAVOR
+make GCOV=1 -C "$BASE_DIR" clean coverage
for t in $TESTS ; do
pushd "$TEST_DIR/$t"
- make GCOV=1 -C "$TEST_DIR/$t" clean $FLAVOR || exit 1
- build/$FLAVOR/$t || exit 1
+ make GCOV=1 -C "$TEST_DIR/$t" clean coverage || exit 1
+ build/coverage/$t || exit 1
popd
done
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/test/test_policy/test_policy.c
^
|
@@ -143,21 +143,33 @@
da_policy_unref(policy);
da_policy_unref(policy);
- policy = da_policy_new_full(V ";user(user:group) & call(foo) & "
- "(arg('a')|arg(\"b\"))=deny; user(baduser)=allow; "
- "group(badgroup)=allow", actions);
+#define BASIC_RULE1 "user(user:group) & call(foo) & " \
+ "(arg('\\'a\\'')|arg(\"\\\"b\\\"\"))=deny; user(baduser)=allow; " \
+ "group(badgroup)=allow"
+
+ da_policy_unref(policy = da_policy_new_full(V ";" BASIC_RULE1, actions));
g_assert(policy);
- da_policy_unref(policy);
- policy = da_policy_new_full(V ";user(user) & call('foo')=deny;"
- "group(*) & call(call) = deny;"
- "user(22) & call(call)", actions);
+ da_policy_unref(policy = da_policy_new_full(BASIC_RULE1, actions));
g_assert(policy);
- da_policy_unref(policy);
- policy = da_policy_new_full(V ";user(*) & !group(222) = deny; ", actions);
+#define BASIC_RULE2 "user(user) & call('foo')=deny;" \
+ "group(*) & call(call) = deny;" \
+ "user(22) & call(call)"
+
+ da_policy_unref(policy = da_policy_new_full(V ";" BASIC_RULE2, actions));
+ g_assert(policy);
+
+ da_policy_unref(policy = da_policy_new_full(BASIC_RULE2, actions));
+ g_assert(policy);
+
+#define BASIC_RULE3 "user(*) & !group(222) = deny; "
+
+ da_policy_unref(policy = da_policy_new_full(V ";" BASIC_RULE3, actions));
+ g_assert(policy);
+
+ da_policy_unref(policy = da_policy_new_full(BASIC_RULE3, actions));
g_assert(policy);
- da_policy_unref(policy);
}
/*==========================================================================*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/tools/dbus-creds/Makefile
^
|
@@ -6,7 +6,7 @@
# Required packages
#
-PKGS = glib-2.0 gio-2.0 libglibutil
+PKGS = glib-2.0 libglibutil
#
# Default target
@@ -72,12 +72,8 @@
DEBUG_OBJS = $(SRC:%.c=$(DEBUG_BUILD_DIR)/%.o)
RELEASE_OBJS = $(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
-DEBUG_LIB_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_debug_lib)
-RELEASE_LIB_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_release_lib)
DEBUG_LINK_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_debug_link)
RELEASE_LINK_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_release_link)
-DEBUG_LIB = $(LIB_DIR)/$(DEBUG_LIB_FILE)
-RELEASE_LIB = $(LIB_DIR)/$(RELEASE_LIB_FILE)
#
# Dependencies
@@ -123,20 +119,20 @@
$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
-$(DEBUG_EXE): $(DEBUG_LIB) $(DEBUG_BUILD_DIR) $(DEBUG_OBJS)
- $(LD) $(DEBUG_OBJS) $(DEBUG_LDFLAGS) $< -o $@
+$(DEBUG_EXE): lib-debug $(DEBUG_OBJS)
+ $(LD) $(DEBUG_OBJS) $(DEBUG_LDFLAGS) $(LIB_DIR)/$(DEBUG_LINK_FILE) -o $@
-$(RELEASE_EXE): $(RELEASE_LIB) $(RELEASE_BUILD_DIR) $(RELEASE_OBJS)
- $(LD) $(RELEASE_OBJS) $(RELEASE_LDFLAGS) $< -o $@
+$(RELEASE_EXE): lib-release $(RELEASE_OBJS)
+ $(LD) $(RELEASE_OBJS) $(RELEASE_LDFLAGS) $(LIB_DIR)/$(RELEASE_LINK_FILE) -o $@
ifeq ($(KEEP_SYMBOLS),0)
strip $@
endif
lib-debug:
- @make $(SUBMAKE_OPTS) -C $(LIB_DIR) $(DEBUG_LIB_FILE) $(DEBUG_LINK_FILE)
+ @make $(SUBMAKE_OPTS) -C $(LIB_DIR) debug $(DEBUG_LINK_FILE)
lib-release:
- @make $(SUBMAKE_OPTS) -C $(LIB_DIR) $(RELEASE_LIB_FILE) $(RELEASE_LINK_FILE)
+ @make $(SUBMAKE_OPTS) -C $(LIB_DIR) release $(RELEASE_LINK_FILE)
#
# Install
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbusaccess/tools/dbus-creds/dbus-creds.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * 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 BSD license as follows:
*
@@ -13,9 +13,9 @@
* 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.
+ * 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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/.gitignore
^
|
@@ -12,8 +12,12 @@
debian/*.debhelper
debian/libdbuslogserver-common-dev
debian/libdbuslogserver-dbus-dev
+debian/libdbuslogserver-dbus-dev.install
debian/libdbuslogserver-dbus.postrm.debhelper
debian/libdbuslogserver-dbus
+debian/libdbuslogserver-dbus.install
debian/libdbuslogserver-gio-dev
+debian/libdbuslogserver-gio-dev.install
debian/libdbuslogserver-gio
+debian/libdbuslogserver-gio.install
debian/tmp
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/LICENSE
^
|
@@ -1,4 +1,5 @@
-Copyright (C) 2016-2017 Jolla Ltd.
+Copyright (C) 2016-2019 Jolla Ltd.
+Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -11,9 +12,9 @@
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.
+ 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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/Makefile
^
|
@@ -1,10 +1,18 @@
# -*- Mode: makefile-gmake -*-
+LIBDIR ?= usr/lib
+
all:
%:
@$(MAKE) -C client $*
@$(MAKE) -C server $*
+debian/%.install: debian/%.install.in
+ sed 's|@LIBDIR@|$(LIBDIR)|g' $< > $@
+
+check:
+ @$(MAKE) -C test test
+
clean:
@$(MAKE) -C client $@
@$(MAKE) -C server $@
@@ -14,6 +22,10 @@
rm -fr debian/tmp
rm -fr debian/dbuslog-tools debian/libdbuslogserver-common-dev
rm -fr debian/libdbuslogserver-dbus debian/libdbuslogserver-dbus-dev
+ rm -fr debian/libdbuslogserver-dbus.install
+ rm -fr debian/libdbuslogserver-dbus-dev.install
rm -fr debian/libdbuslogserver-gio debian/libdbuslogserver-gio-dev
+ rm -fr debian/libdbuslogserver-gio.install
+ rm -fr debian/libdbuslogserver-gio-dev.install
rm -f documentation.list debian/files debian/*.substvars
rm -f debian/*.debhelper.log debian/*.debhelper debian/*~
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/VERSION
^
|
@@ -1 +1 @@
-1.0.15
+1.0.19
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/client/Makefile
^
|
@@ -1,6 +1,6 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release pkgconfig
+.PHONY: clean distclean all debug release pkgconfig
.PHONY: common_debug common_release
#
@@ -120,6 +120,7 @@
endif
endif
+$(PKGCONFIG): | $(BUILD_DIR)
$(GEN_FILES): | $(GEN_DIR)
$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
@@ -137,6 +138,8 @@
pkgconfig: $(PKGCONFIG)
+distclean: clean
+
clean:
rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~
rm -fr $(BUILD_DIR)
@@ -179,24 +182,28 @@
$(AR) $(ARFLAGS) $@ $(RELEASE_OBJS)
ranlib $@
-$(PKGCONFIG): $(LIB_NAME).pc.in
- sed -e 's/\[version\]/'$(PCVERSION)/g $< > $@
+#
+# LIBDIR usually gets substituted with arch specific dir
+# It's relative in deb build and can be whatever in rpm build.
+#
+
+LIBDIR ?= usr/lib
+ABS_LIBDIR := $(shell echo /$(LIBDIR) | sed -r 's|/+|/|g')
+
+$(PKGCONFIG): $(LIB_NAME).pc.in Makefile
+ sed -e 's|@version@|$(PCVERSION)|g' -e 's|@libdir@|$(ABS_LIBDIR)|g' $< > $@
#
# Install
#
-INSTALL_PERM = 644
-INSTALL_OWNER = $(shell id -u)
-INSTALL_GROUP = $(shell id -g)
-
INSTALL = install
INSTALL_DIRS = $(INSTALL) -d
-INSTALL_FILES = $(INSTALL) -m $(INSTALL_PERM)
+INSTALL_FILES = $(INSTALL) -m 644
-INSTALL_LIB_DIR = $(DESTDIR)/usr/lib
+INSTALL_LIB_DIR = $(DESTDIR)$(ABS_LIBDIR)
INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/$(NAME)
-INSTALL_PKGCONFIG_DIR = $(DESTDIR)/usr/lib/pkgconfig
+INSTALL_PKGCONFIG_DIR = $(DESTDIR)$(ABS_LIBDIR)/pkgconfig
INSTALL_ALIAS = $(INSTALL_LIB_DIR)/$(LIB_SHORTCUT)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/client/libdbuslogclient.pc.in
^
|
@@ -1,10 +1,10 @@
name=dbuslogclient
-libdir=/usr/lib
+libdir=@libdir@
includedir=/usr/include
Name: libdbuslogclient
Description: D-Bus Log client
-Version: [version]
-Requires: glib-2.0 gio-2.0
-Libs: -L${libdir} -l${name} -ldbuslogcommon
+Version: @version@
+Requires.private: glib-2.0 gio-2.0
+Libs.private: -L${libdir} -l${name} -ldbuslogcommon
Cflags: -I${includedir} -I${includedir}/${name}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/client/src/dbuslog_client.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -30,6 +30,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "dbuslog_client.h"
#include "dbuslog_client_log.h"
#include "dbuslog_receiver.h"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/common/Makefile
^
|
@@ -1,6 +1,6 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release
+.PHONY: clean distclean all debug release
#
# Required packages
@@ -20,7 +20,8 @@
SRC = \
dbuslog_category.c \
- dbuslog_message.c
+ dbuslog_message.c \
+ dbuslog_util.c
#
# Directories
@@ -98,6 +99,8 @@
release: $(RELEASE_LIB)
+disclean: clean
+
clean:
rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~
rm -fr $(BUILD_DIR)
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/common/include/dbuslog_util.h
^
|
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 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 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 DBUSLOG_UTIL_H
+#define DBUSLOG_UTIL_H
+
+/* Since 1.0.19 */
+
+#include "dbuslog_protocol.h"
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+DBUSLOG_LEVEL
+dbus_log_level_from_gutil(
+ int level);
+
+int
+dbus_log_level_to_gutil(
+ DBUSLOG_LEVEL level);
+
+G_END_DECLS
+
+#endif /* DBUSLOG_UTIL_H */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/common/src/dbuslog_util.c
^
|
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 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 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 "dbuslog_util.h"
+
+#include <gutil_log.h>
+
+DBUSLOG_LEVEL
+dbus_log_level_from_gutil(
+ int level) /* Since 1.0.19 */
+{
+ switch (level) {
+ case GLOG_LEVEL_ALWAYS:
+ return DBUSLOG_LEVEL_ALWAYS;
+ case GLOG_LEVEL_ERR:
+ return DBUSLOG_LEVEL_ERROR;
+ case GLOG_LEVEL_WARN:
+ return DBUSLOG_LEVEL_WARNING;
+ case GLOG_LEVEL_INFO:
+ return DBUSLOG_LEVEL_INFO;
+ case GLOG_LEVEL_DEBUG:
+ return DBUSLOG_LEVEL_DEBUG;
+ case GLOG_LEVEL_VERBOSE:
+ return DBUSLOG_LEVEL_VERBOSE;
+ default:
+ return DBUSLOG_LEVEL_UNDEFINED;
+ }
+}
+
+int
+dbus_log_level_to_gutil(
+ DBUSLOG_LEVEL level) /* Since 1.0.19 */
+{
+ switch (level) {
+ case DBUSLOG_LEVEL_ALWAYS:
+ return GLOG_LEVEL_ALWAYS;
+ case DBUSLOG_LEVEL_ERROR:
+ return GLOG_LEVEL_ERR;
+ case DBUSLOG_LEVEL_WARNING:
+ return GLOG_LEVEL_WARN;
+ case DBUSLOG_LEVEL_INFO:
+ return GLOG_LEVEL_INFO;
+ case DBUSLOG_LEVEL_DEBUG:
+ return GLOG_LEVEL_DEBUG;
+ case DBUSLOG_LEVEL_VERBOSE:
+ return GLOG_LEVEL_VERBOSE;
+ default:
+ return GLOG_LEVEL_NONE;
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/debian/changelog
^
|
@@ -1,3 +1,31 @@
+libdbuslog (1.0.19) unstable; urgency=low
+
+ * Added dbus_log_server_set_category_level() function
+ * Added dbus_log_level_from_gutil() function
+ * Added dbus_log_level_to_gutil() function
+
+ -- Slava Monich <slava.monich@jolla.com> Mon, 06 Jul 2020 21:45:06 +0300
+
+libdbuslog (1.0.18) unstable; urgency=low
+
+ * Fixed glib deprecation warnings
+ * Hide internal symbols
+ * Respect arch specific lib dir
+
+ -- Slava Monich <slava.monich@jolla.com> Tue, 26 May 2020 15:56:22 +0300
+
+libdbuslog (1.0.17) unstable; urgency=low
+
+ * Made dbus_log_sender_send thread-safe
+
+ -- Slava Monich <slava.monich@jolla.com> Fri, 20 Dec 2019 23:12:41 +0200
+
+libdbuslog (1.0.16) unstable; urgency=low
+
+ * Avoid overlinking
+
+ -- Slava Monich <slava.monich@jolla.com> Fri, 01 Nov 2019 20:20:30 +0200
+
libdbuslog (1.0.15) unstable; urgency=low
* Allow to configure backlog over D-Bus
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/debian/control
^
|
@@ -2,7 +2,7 @@
Section: libs
Priority: optional
Maintainer: Slava Monich <slava.monich@jolla.com>
-Build-Depends: debhelper (>= 7), libglib2.0-dev (>= 2.0), libdbus-1-dev, libglibutil-dev, libdbusaccess-dev
+Build-Depends: debhelper (>= 8.1.3), libglib2.0-dev (>= 2.0), libdbus-1-dev, libglibutil-dev (>= 1.0.43), libdbusaccess-dev
Standards-Version: 3.8.4
Package: libdbuslogserver-common-dev
@@ -13,7 +13,7 @@
Package: libdbuslogserver-dbus
Section: libs
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: libglibutil (>= 1.0.43), ${shlibs:Depends}, ${misc:Depends}
Description: Library of logging utilities for libdbus based programs
Package: libdbuslogserver-dbus-dev
@@ -25,7 +25,7 @@
Package: libdbuslogserver-gio
Section: libs
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: libglibutil (>= 1.0.43), ${shlibs:Depends}, ${misc:Depends}
Description: Library of logging utilities for libdbus based programs
Package: libdbuslogserver-gio-dev
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/debian/copyright
^
|
@@ -1,5 +1,5 @@
-Copyright (C) 2016-2018 Jolla Ltd.
-Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+Copyright (C) 2016-2019 Jolla Ltd.
+Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/debian/libdbuslogserver-dbus-dev.install.in
^
|
@@ -0,0 +1,3 @@
+debian/tmp/@LIBDIR@/libdbuslogserver-dbus.so @LIBDIR@
+debian/tmp/@LIBDIR@/pkgconfig/libdbuslogserver-dbus.pc @LIBDIR@/pkgconfig
+debian/tmp/usr/include/dbuslogserver/dbus/*.h usr/include/dbuslogserver/dbus
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/debian/libdbuslogserver-dbus.install.in
^
|
@@ -0,0 +1 @@
+debian/tmp/@LIBDIR@/libdbuslogserver-dbus.so.* @LIBDIR@
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/debian/libdbuslogserver-gio-dev.install.in
^
|
@@ -0,0 +1,3 @@
+debian/tmp/@LIBDIR@/libdbuslogserver-gio.so @LIBDIR@
+debian/tmp/@LIBDIR@/pkgconfig/libdbuslogserver-gio.pc @LIBDIR@/pkgconfig
+debian/tmp/usr/include/dbuslogserver/gio/*.h usr/include/dbuslogserver/gio
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/debian/libdbuslogserver-gio.install.in
^
|
@@ -0,0 +1 @@
+debian/tmp/@LIBDIR@/libdbuslogserver-gio.so.* @LIBDIR@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/debian/rules
^
|
@@ -4,6 +4,7 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
+LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DBUSLOG_CLIENT_DIR=tools/dbuslog-client
override_dh_auto_clean:
@@ -14,12 +15,13 @@
dh_auto_clean -- -C $(DBUSLOG_CLIENT_DIR)
override_dh_auto_build:
- dh_auto_build -- -C server release pkgconfig
+ dh_auto_build -- LIBDIR=$(LIBDIR) debian/libdbuslogserver-dbus.install debian/libdbuslogserver-dbus-dev.install debian/libdbuslogserver-gio.install debian/libdbuslogserver-gio-dev.install
+ dh_auto_build -- LIBDIR=$(LIBDIR) -C server release pkgconfig
dh_auto_build -- -C $(DBUSLOG_CLIENT_DIR) release
override_dh_auto_install:
+ dh_auto_install -- LIBDIR=$(LIBDIR) -C server install-dev
dh_auto_install -- -C $(DBUSLOG_CLIENT_DIR)
- dh_auto_install -- -C server
%:
dh $@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/rpm/libdbuslog.spec
^
|
@@ -1,14 +1,16 @@
Name: dbuslog-tools
-Version: 1.0.15
+Version: 1.0.19
Release: 0
Summary: Command line client for libdbuslogserver
Group: Development/Tools
License: BSD
-URL: https://git.merproject.org/mer-core/libdbuslog
+URL: https://git.sailfishos.org/mer-core/libdbuslog
Source: %{name}-%{version}.tar.bz2
-Requires: libglibutil >= 1.0.9
+
+%define libglibutil_version 1.0.43
+
+BuildRequires: pkgconfig(libglibutil) >= %{libglibutil_version}
BuildRequires: pkgconfig(libdbusaccess)
-BuildRequires: pkgconfig(libglibutil)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(gio-unix-2.0)
@@ -21,16 +23,16 @@
%setup -q
%build
-make -C tools/dbuslog-client KEEP_SYMBOLS=1 release
-make -C server KEEP_SYMBOLS=1 release pkgconfig
+make KEEP_SYMBOLS=1 LIBDIR=%{_libdir} -C tools/dbuslog-client release
+make KEEP_SYMBOLS=1 LIBDIR=%{_libdir} -C server release pkgconfig
%check
make -C test test
%install
rm -rf %{buildroot}
-make -C tools/dbuslog-client install DESTDIR=%{buildroot}
-make -C server install DESTDIR=%{buildroot}
+make DESTDIR=%{buildroot} LIBDIR=%{_libdir} -C tools/dbuslog-client install
+make DESTDIR=%{buildroot} LIBDIR=%{_libdir} -C server install-dev
%files
%defattr(-,root,root,-)
@@ -56,6 +58,7 @@
Summary: Library of logging utilities for libdbus based programs
Group: Development/Libraries
BuildRequires: pkgconfig(dbus-1)
+Requires: libglibutil >= %{libglibutil_version}
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
@@ -91,6 +94,7 @@
%package -n libdbuslogserver-gio
Summary: Library of logging utilities for gio based programs
Group: Development/Libraries
+Requires: libglibutil >= %{libglibutil_version}
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/Makefile
^
|
@@ -1,10 +1,10 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release pkgconfig
+.PHONY: clean distclean all debug release pkgconfig
.PHONY: common_debug common_release
.PHONY: common-install-dev install
-.PHONY: dbus-install dbus-install-dev
-.PHONY: gio-install gio-install-dev
+.PHONY: dbus-pkgconfig dbus-install dbus-install-dev
+.PHONY: gio-pkgconfig gio-install gio-install-dev
#
# Required packages
@@ -12,7 +12,7 @@
PKGS = libdbusaccess libglibutil glib-2.0
GIO_PKGS = gio-2.0 gio-unix-2.0
-DBUS_PKGS = dbus-1
+DBUS_PKGS = gobject-2.0 dbus-1
#
# Default target
@@ -75,6 +75,8 @@
# Library name
#
+MAP_FILE = libdbuslogserver.map
+
DBUS_NAME = dbuslogserver-dbus
DBUS_LIB_NAME = lib$(DBUS_NAME)
DBUS_LIB_DEV_SYMLINK = $(DBUS_LIB_NAME).so
@@ -82,6 +84,7 @@
DBUS_LIB_SYMLINK2 = $(DBUS_LIB_SYMLINK1).$(VERSION_MINOR)
DBUS_LIB_SONAME = $(DBUS_LIB_SYMLINK1)
DBUS_LIB = $(DBUS_LIB_SONAME).$(VERSION_MINOR).$(VERSION_RELEASE)
+DBUS_EXPORTS = $(MAP_FILE)
GIO_NAME = dbuslogserver-gio
GIO_LIB_NAME = lib$(GIO_NAME)
@@ -90,6 +93,7 @@
GIO_LIB_SYMLINK2 = $(GIO_LIB_SYMLINK1).$(VERSION_MINOR)
GIO_LIB_SONAME = $(GIO_LIB_SYMLINK1)
GIO_LIB = $(GIO_LIB_SONAME).$(VERSION_MINOR).$(VERSION_RELEASE)
+GIO_EXPORTS = $(MAP_FILE)
#
# Common code
@@ -115,23 +119,25 @@
DBUS_INCLUDES = -I$(SRC_DIR) -I$(DBUS_INCLUDE_DIR)
GIO_INCLUDES = -I$(SRC_DIR) -I$(GIO_INCLUDE_DIR) -I$(GIO_GEN_DIR)
BASE_FLAGS = -fPIC $(CFLAGS)
+BASE_LDLAGS = $(BASE_FLAGS) -shared \
+ -u dbus_log_level_from_gutil \
+ -u dbus_log_level_to_gutil
FULL_CFLAGS = $(BASE_FLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) -MMD -MP \
$(shell pkg-config --cflags $(PKGS))
DBUS_FULL_CFLAGS = $(FULL_CFLAGS) $(DBUS_INCLUDES) \
$(shell pkg-config --cflags $(DBUS_PKGS))
-DBUS_LDFLAGS = $(BASE_FLAGS) -shared -Wl,-soname -Wl,$(DBUS_LIB_SONAME) \
- $(shell pkg-config --libs $(DBUS_PKGS) $(PKGS))
+DBUS_LDFLAGS = $(BASE_LDLAGS) -Wl,-soname=$(DBUS_LIB_SONAME) \
+ -Wl,--version-script=$(DBUS_EXPORTS) \
+ $(shell pkg-config --libs $(DBUS_PKGS) $(PKGS))
GIO_FULL_CFLAGS = $(FULL_CFLAGS) $(GIO_INCLUDES) \
$(shell pkg-config --cflags $(GIO_PKGS))
-GIO_LDFLAGS = $(BASE_FLAGS) -shared -Wl,-soname -Wl,$(GIO_LIB_SONAME) \
+GIO_LDFLAGS = $(BASE_LDLAGS) -Wl,-soname=$(GIO_LIB_SONAME) \
+ -Wl,--version-script=$(GIO_EXPORTS) \
$(shell pkg-config --libs $(GIO_PKGS) $(PKGS))
DEBUG_FLAGS = -g
RELEASE_FLAGS =
-ifndef KEEP_SYMBOLS
-KEEP_SYMBOLS = 0
-endif
-
+KEEP_SYMBOLS ?= 0
ifneq ($(KEEP_SYMBOLS),0)
RELEASE_FLAGS += -g
endif
@@ -236,6 +242,8 @@
gio-pkgconfig: $(GIO_PKGCONFIG)
+distclean: clean
+
clean:
rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~
rm -fr $(BUILD_DIR)
@@ -318,9 +326,6 @@
$(DBUS_RELEASE_BUILD_DIR)/$(DBUS_LIB_SYMLINK2): $(DBUS_RELEASE_LIB)
ln -sf $(DBUS_LIB) $@
-$(DBUS_PKGCONFIG): $(DBUS_LIB_NAME).pc.in
- sed -e 's/\[version\]/'$(PCVERSION)/g $< > $@
-
$(GIO_DEBUG_LIB): $(DEBUG_OBJS) $(GIO_DEBUG_OBJS)
$(LD) $^ $(DEBUG_LIBS) $(GIO_DEBUG_LDFLAGS) -o $@
@@ -342,8 +347,16 @@
$(GIO_RELEASE_BUILD_DIR)/$(GIO_LIB_SYMLINK2): $(GIO_RELEASE_LIB)
ln -sf $(GIO_LIB) $@
-$(GIO_PKGCONFIG): $(GIO_LIB_NAME).pc.in
- sed -e 's/\[version\]/'$(PCVERSION)/g $< > $@
+#
+# LIBDIR usually gets substituted with arch specific dir
+# It's relative in deb build and can be whatever in rpm build.
+#
+
+LIBDIR ?= usr/lib
+ABS_LIBDIR := $(shell echo /$(LIBDIR) | sed -r 's|/+|/|g')
+
+$(BUILD_DIR)/%.pc: %.pc.in Makefile
+ sed -e 's|@version@|$(PCVERSION)|g' -e 's|@libdir@|$(ABS_LIBDIR)|g' $< > $@
#
# Install
@@ -353,19 +366,24 @@
INSTALL_DIRS = $(INSTALL) -d
INSTALL_FILES = $(INSTALL) -m 644
-INSTALL_LIB_DIR = $(DESTDIR)/usr/lib
-INSTALL_PKGCONFIG_DIR = $(DESTDIR)/usr/lib/pkgconfig
+INSTALL_LIB_DIR = $(DESTDIR)$(ABS_LIBDIR)
+INSTALL_PKGCONFIG_DIR = $(DESTDIR)$(ABS_LIBDIR)/pkgconfig
INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/dbuslogserver
DBUS_INSTALL_INCLUDE_DIR = $(INSTALL_INCLUDE_DIR)/dbus
GIO_INSTALL_INCLUDE_DIR = $(INSTALL_INCLUDE_DIR)/gio
INSTALL_ALIAS = $(INSTALL_LIB_DIR)/$(LIB_SHORTCUT)
+INSTALL_COMMON_HEADERS = \
+ $(COMMON_INCLUDE_DIR)/dbuslog_protocol.h \
+ $(COMMON_INCLUDE_DIR)/dbuslog_util.h
+
+install: dbus-install gio-install
-install: dbus-install-dev gio-install-dev
+install-dev: dbus-install-dev gio-install-dev
common-install-dev: $(INSTALL_INCLUDE_DIR)
$(INSTALL_FILES) $(INCLUDE_DIR)/*.h $(INSTALL_INCLUDE_DIR)
- $(INSTALL_FILES) $(COMMON_INCLUDE_DIR)/dbuslog_protocol.h $(INSTALL_INCLUDE_DIR)
+ $(INSTALL_FILES) $(INSTALL_COMMON_HEADERS) $(INSTALL_INCLUDE_DIR)
dbus-install: $(INSTALL_LIB_DIR)
$(INSTALL_FILES) $(DBUS_RELEASE_LIB) $(INSTALL_LIB_DIR)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/include/dbuslog_server.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* 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.
+ * 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
@@ -92,6 +92,12 @@
DBusLogServer* server,
DBUSLOG_LEVEL level);
+gboolean
+dbus_log_server_set_category_level(
+ DBusLogServer* server,
+ const char* name,
+ DBUSLOG_LEVEL level); /* Since 1.0.19 */
+
void
dbus_log_server_add_category(
DBusLogServer* server,
@@ -147,7 +153,7 @@
dbus_log_server_add_default_level_handler(
DBusLogServer* server,
DBusLogServerLogLevelFunc fn,
- gpointer user_data); /* since 1.0.14 */
+ gpointer user_data); /* Since 1.0.14 */
void
dbus_log_server_remove_handler(
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/libdbuslogserver-dbus.pc.in
^
|
@@ -1,11 +1,11 @@
name=dbuslogserver-dbus
-libdir=/usr/lib
+libdir=@libdir@
includedir=/usr/include
rootincludedir=/usr/include/dbuslogserver
Name: libdbuslogserver-dbus
Description: D-Bus Log server (libdbus-based)
-Version: [version]
-Requires: libglibutil glib-2.0 dbus-1
+Version: @version@
+Requires.private: libglibutil glib-2.0 dbus-1
Libs: -L${libdir} -l${name}
Cflags: -I${includedir} -I${rootincludedir} -I${rootincludedir}/dbus
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/libdbuslogserver-gio.pc.in
^
|
@@ -1,11 +1,11 @@
name=dbuslogserver-gio
-libdir=/usr/lib
+libdir=@libdir@
includedir=/usr/include
rootincludedir=/usr/include/dbuslogserver
Name: libdbuslogserver-gio
Description: D-Bus Log server (libgio-based)
-Version: [version]
-Requires: libglibutil glib-2.0 gio-2.0
+Version: @version@
+Requires.private: libglibutil glib-2.0 gio-2.0
Libs: -L${libdir} -l${name}
Cflags: -I${includedir} -I${rootincludedir} -I${rootincludedir}/gio
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/libdbuslogserver.map
^
|
@@ -0,0 +1,10 @@
+{
+ global:
+ dbus_log_category_*;
+ dbus_log_message_*;
+ dbus_log_server_*;
+ dbus_log_level_*;
+ dbuslog_server_log;
+ local:
+ *;
+};
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/src/dbus/dbuslog_server_dbus.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -58,6 +58,7 @@
};
typedef DBusLogServerClass DBusLogServerDbusClass;
+GType dbus_log_server_dbus_get_type() G_GNUC_INTERNAL;
G_DEFINE_TYPE(DBusLogServerDbus, dbus_log_server_dbus, DBUSLOG_SERVER_TYPE)
#define PARENT_CLASS (dbus_log_server_dbus_parent_class)
#define DBUSLOG_SERVER_DBUS_TYPE (dbus_log_server_dbus_get_type())
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/src/dbuslog_core.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -37,8 +37,16 @@
#include <gutil_idlepool.h>
#include <gutil_misc.h>
-/* Log module */
-GLOG_MODULE_DEFINE("dbuslog");
+/* Log module (don't forward our own log) */
+GLogModule GLOG_MODULE_NAME = {
+ "dbuslog", /* name */
+ NULL, /* parent */
+ gutil_log_stdout2, /* log_proc */
+ GLOG_LEVEL_MAX, /* max_level */
+ GLOG_LEVEL_INHERIT, /* level */
+ 0, /* flags */
+ 0 /* reserved2 */
+};
/* Object definition */
struct dbus_log_core {
@@ -447,7 +455,7 @@
}
}
-void
+gboolean
dbus_log_core_set_category_level(
DBusLogCore* self,
const char* name,
@@ -457,11 +465,15 @@
G_LIKELY(level >= DBUSLOG_LEVEL_UNDEFINED) &&
G_LIKELY(level < DBUSLOG_LEVEL_COUNT)) {
DBusLogCategory* cat = g_hash_table_lookup(self->categories, name);
- if (cat && cat->level != level) {
- cat->level = level;
- dbus_log_core_emit_signal(self, cat, SIGNAL_CATEGORY_LEVEL);
+ if (cat) {
+ if (cat->level != level) {
+ cat->level = level;
+ dbus_log_core_emit_signal(self, cat, SIGNAL_CATEGORY_LEVEL);
+ }
+ return TRUE;
}
}
+ return FALSE;
}
static
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/src/dbuslog_core.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -136,7 +136,7 @@
const char* name,
gboolean enabled);
-void
+gboolean
dbus_log_core_set_category_level(
DBusLogCore* core,
const char* name,
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/src/dbuslog_sender.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -30,6 +30,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "dbuslog_sender.h"
#include "dbuslog_protocol.h"
#include "dbuslog_server_log.h"
@@ -54,6 +56,8 @@
guint packet_fixed_part;
guint packet_written;
DBusLogMessage* current_message;
+ GMainContext* context;
+ GMutex mutex;
};
typedef GObjectClass DBusLogSenderClass;
@@ -74,12 +78,17 @@
static
void
-dbus_log_sender_send_bye(
+dbus_log_sender_prepare_bye(
DBusLogSender* self);
static
void
-dbus_log_sender_send_message(
+dbus_log_sender_prepare_current_message(
+ DBusLogSender* self);
+
+static
+void
+dbus_log_sender_schedule_write(
DBusLogSender* self);
/*==========================================================================*
@@ -142,24 +151,34 @@
}
/* The entire packet has been sent, pick the next one */
+
+ /* Lock */
+ g_mutex_lock(&priv->mutex);
dbus_log_message_unref(priv->current_message);
priv->current_message = gutil_ring_get(priv->buffer);
priv->packet_written = priv->packet_size = priv->packet_fixed_part = 0;
if (priv->current_message) {
- dbus_log_sender_send_message(self);
+ dbus_log_sender_prepare_current_message(self);
+ g_mutex_unlock(&priv->mutex);
+ /* Unlock */
+ dbus_log_sender_schedule_write(self);
return TRUE;
} else if (priv->bye) {
- dbus_log_sender_send_bye(self);
+ dbus_log_sender_prepare_bye(self);
+ g_mutex_unlock(&priv->mutex);
+ /* Unlock */
+ dbus_log_sender_schedule_write(self);
return TRUE;
- } else if (priv->done) {
- GVERBOSE("%s done", priv->name);
- priv->write_watch_id = 0;
- dbus_log_sender_shutdown(self, TRUE);
- return FALSE;
} else {
- /* Remove the watch if there's nothing queued */
- GVERBOSE("%s queue empty", priv->name);
+ g_mutex_unlock(&priv->mutex);
+ /* Unlock */
priv->write_watch_id = 0;
+ if (priv->done) {
+ GVERBOSE("%s done", priv->name);
+ dbus_log_sender_shutdown(self, TRUE);
+ } else {
+ GVERBOSE("%s queue empty", priv->name);
+ }
return FALSE;
}
}
@@ -208,6 +227,15 @@
}
}
+static
+gboolean
+dbus_log_sender_schedule_write_in_context(
+ gpointer user_data)
+{
+ dbus_log_sender_schedule_write(DBUSLOG_SENDER(user_data));
+ return G_SOURCE_REMOVE;
+}
+
inline static
void
dbus_log_sender_put_uint32(
@@ -250,7 +278,7 @@
static
void
-dbus_log_sender_send_bye(
+dbus_log_sender_prepare_bye(
DBusLogSender* self)
{
DBusLogSenderPriv* priv = self->priv;
@@ -262,12 +290,11 @@
priv->bye = FALSE;
dbus_log_sender_fill_header(self, 0, DBUSLOG_PACKET_TYPE_BYE);
- dbus_log_sender_schedule_write(self);
}
static
void
-dbus_log_sender_send_message(
+dbus_log_sender_prepare_current_message(
DBusLogSender* self)
{
DBusLogSenderPriv* priv = self->priv;
@@ -289,7 +316,6 @@
DBUSLOG_MESSAGE_CATEGORY_OFFSET,
msg->category);
priv->packet[DBUSLOG_MESSAGE_LEVEL_OFFSET] = msg->level;
- dbus_log_sender_schedule_write(self);
}
static
@@ -396,11 +422,19 @@
{
if (G_LIKELY(self) && G_LIKELY(msg)) {
DBusLogSenderPriv* priv = self->priv;
+ /* Lock */
+ g_mutex_lock(&priv->mutex);
if (!priv->done) {
if (priv->packet_size == priv->packet_written) {
GASSERT(!priv->current_message);
priv->current_message = dbus_log_message_ref(msg);
- dbus_log_sender_send_message(self);
+ dbus_log_sender_prepare_current_message(self);
+ g_mutex_unlock(&priv->mutex);
+ /* Unlock */
+ g_main_context_invoke_full(priv->context, G_PRIORITY_DEFAULT,
+ dbus_log_sender_schedule_write_in_context,
+ dbus_log_sender_ref(self), g_object_unref);
+ return;
} else {
/* Queue the message */
if (!gutil_ring_can_put(priv->buffer, 1)) {
@@ -414,6 +448,8 @@
}
}
}
+ g_mutex_unlock(&priv->mutex);
+ /* Unlock */
}
}
@@ -425,13 +461,24 @@
if (G_LIKELY(self)) {
DBusLogSenderPriv* priv = self->priv;
if (!priv->done) {
+ /* Lock */
+ g_mutex_lock(&priv->mutex);
+ /* Non-main threads are not supposed to change the 'done'
+ * flag, they only check it. This function is supposed to
+ * be called by the main thread. Therefore, there's no need
+ * to re-check the flag under mutex. */
priv->done = TRUE;
if (priv->packet_size == priv->packet_written &&
!gutil_ring_size(priv->buffer)) {
- dbus_log_sender_send_bye(self);
+ dbus_log_sender_prepare_bye(self);
+ g_mutex_unlock(&priv->mutex);
+ /* Unlock */
+ dbus_log_sender_schedule_write(self);
} else {
/* Will send it after flushing pending messages */
priv->bye = TRUE;
+ g_mutex_unlock(&priv->mutex);
+ /* Unlock */
}
}
}
@@ -508,6 +555,8 @@
{
DBusLogSenderPriv* priv = G_TYPE_INSTANCE_GET_PRIVATE(self,
DBUSLOG_SENDER_TYPE, DBusLogSenderPriv);
+ g_mutex_init(&priv->mutex);
+ priv->context = g_main_context_default();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/src/dbuslog_server.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -30,6 +30,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "dbuslog_server_p.h"
#include "dbuslog_server_log.h"
@@ -500,6 +502,16 @@
return G_LIKELY(self) && dbus_log_core_set_default_level(self->core, level);
}
+gboolean
+dbus_log_server_set_category_level(
+ DBusLogServer* self,
+ const char* name,
+ DBUSLOG_LEVEL level) /* Since 1.0.19 */
+{
+ return G_LIKELY(self) &&
+ dbus_log_core_set_category_level(self->core, name, level);
+}
+
void
dbus_log_server_add_category(
DBusLogServer* self,
@@ -594,7 +606,7 @@
dbus_log_server_add_default_level_handler(
DBusLogServer* self,
DBusLogServerLogLevelFunc fn,
- gpointer data)
+ gpointer data) /* Since 1.0.14 */
{
return (G_LIKELY(self) && G_LIKELY(fn)) ? g_signal_connect(self,
SIGNAL_DEFAULT_LEVEL_NAME, G_CALLBACK(fn), data) : 0;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/src/dbuslog_server_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -106,7 +106,7 @@
int backlog);
} DBusLogServerClass;
-GType dbus_log_server_get_type(void);
+GType dbus_log_server_get_type(void) G_GNUC_INTERNAL;
#define DBUSLOG_SERVER_TYPE (dbus_log_server_get_type())
#define DBUSLOG_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
DBUSLOG_SERVER_TYPE, DBusLogServer))
@@ -115,56 +115,65 @@
dbus_log_server_initialize(
DBusLogServer* self,
DBUSLOG_BUS bus,
- const char* path);
+ const char* path)
+ G_GNUC_INTERNAL;
void
dbus_log_server_peer_vanished(
DBusLogServer* self,
- const char* name);
+ const char* name)
+ G_GNUC_INTERNAL;
int
dbus_log_server_call_set_default_level(
DBusLogServer* server,
const char* peer,
- DBUSLOG_LEVEL level);
+ DBUSLOG_LEVEL level)
+ G_GNUC_INTERNAL;
int
dbus_log_server_call_set_category_level(
DBusLogServer* server,
const char* peer,
const char* name,
- DBUSLOG_LEVEL level);
+ DBUSLOG_LEVEL level)
+ G_GNUC_INTERNAL;
int
dbus_log_server_call_log_open(
DBusLogServer* server,
- const char* peer);
+ const char* peer)
+ G_GNUC_INTERNAL;
void
dbus_log_server_call_log_close(
DBusLogServer* server,
const char* peer,
- guint cookie);
+ guint cookie)
+ G_GNUC_INTERNAL;
int
dbus_log_server_call_set_names_enabled(
DBusLogServer* server,
const char* peer,
const GStrV* names,
- gboolean enable);
+ gboolean enable)
+ G_GNUC_INTERNAL;
int
dbus_log_server_call_set_pattern_enabled(
DBusLogServer* self,
const char* peer,
const char* pattern,
- gboolean enable);
+ gboolean enable)
+ G_GNUC_INTERNAL;
int
dbus_log_server_call_set_backlog(
DBusLogServer* server,
const char* peer,
- int backlog);
+ int backlog)
+ G_GNUC_INTERNAL;
#endif /* DBUSLOG_SERVER_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/server/src/gio/dbuslog_server_gio.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -68,6 +68,7 @@
} DBusLogServerGio;
typedef DBusLogServerClass DBusLogServerGioClass;
+GType dbus_log_server_gio_get_type() G_GNUC_INTERNAL;
G_DEFINE_TYPE(DBusLogServerGio, dbus_log_server_gio, DBUSLOG_SERVER_TYPE)
#define PARENT_CLASS (dbus_log_server_gio_parent_class)
#define DBUSLOG_SERVER_GIO_TYPE (dbus_log_server_gio_get_type())
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/test/Makefile
^
|
@@ -3,8 +3,8 @@
all:
%:
@$(MAKE) -C test_logger $*
+ @$(MAKE) -C test_util $@
-clean:
- @$(MAKE) -C test_logger $@
+clean: distclean
rm -f coverage/*.gcov
rm -fr coverage/results
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/test/common/Makefile
^
|
@@ -1,6 +1,6 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release
+.PHONY: clean distclean all debug release
#
# Real test makefile defines EXE (and possibly SRC) and includes this one.
@@ -122,6 +122,8 @@
release: $(RELEASE_EXE)
+distclean: clean
+
clean:
rm -f *~
rm -fr $(BUILD_DIR)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/test/coverage/run
^
|
@@ -3,7 +3,7 @@
# This script requires lcov to be installed
#
-TESTS="test_logger"
+TESTS="test_logger test_util"
FLAVOR="release"
pushd `dirname $0` > /dev/null
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/test/test_logger/test_logger.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -331,6 +331,7 @@
int add_count;
int remove_count;
int flags_count;
+ int level_count;
int ret;
} TestCat;
@@ -360,6 +361,18 @@
static
void
+test_cat_level_changed(
+ DBusLogCore* core,
+ DBusLogCategory* category,
+ gpointer user_data)
+{
+ TestCat* test = user_data;
+ GDEBUG("%s %d", category->name, category->level);
+ test->level_count++;
+}
+
+static
+void
test_cat_flags(
DBusLogCore* core,
DBusLogCategory* category,
@@ -418,7 +431,8 @@
TestCat test;
DBusLogCore* core;
DBusLogCategory* disabled;
- gulong id[2], cid[3];
+ DBusLogCategory* cat;
+ gulong id[2], cid[4];
memset(&test, 0, sizeof(test));
test.ret = RET_ERR;
@@ -434,6 +448,8 @@
test_cat_removed, &test);
cid[2] = dbus_log_core_add_category_flags_handler(core,
test_cat_flags, &test);
+ cid[3] = dbus_log_core_add_category_level_handler(core,
+ test_cat_level_changed, &test);
test.sender = dbus_log_core_new_sender(core, "Test");
test.receiver = dbus_log_receiver_new(dup(test.sender->readfd), TRUE);
@@ -470,53 +486,34 @@
g_main_loop_run(loop);
- if (test.msg_count != 3) {
- GERR("Unexpected message count %d", test.msg_count);
- test.ret = RET_ERR;
- }
-
- if (test.ret == RET_OK) {
- DBusLogCategory* cat = dbus_log_core_new_category(core, "Enabled",
- DBUSLOG_LEVEL_UNDEFINED, DBUSLOG_CATEGORY_FLAG_ENABLED);
- if (cat != test.enabled) {
- GERR("Second category with the same name?");
- test.ret = RET_ERR;
- }
- dbus_log_category_unref(cat);
- if (!test.enabled->id || !disabled->id ||
- test.enabled->id == disabled->id) {
- GERR("Unexpected category ids");
- test.ret = RET_ERR;
- }
- if (dbus_log_core_find_category(core, "Enabled") != test.enabled) {
- GERR("Category not found");
- test.ret = RET_ERR;
- }
- if (dbus_log_core_get_categories(core)->len != 3) {
- GERR("Unexpected number of categories");
- test.ret = RET_ERR;
- }
- if (dbus_log_core_find_categories(core, "*")->len != 3) {
- GERR("Unexpected number of categories found");
- test.ret = RET_ERR;
- }
- if (dbus_log_core_find_categories(core, "*abled")->len != 2) {
- GERR("Failed to find *abled");
- test.ret = RET_ERR;
- }
- if (dbus_log_core_find_categories(core, "Disabled")->len != 1) {
- GERR("Failed to find Disabled");
- test.ret = RET_ERR;
- }
- if (!dbus_log_core_remove_category(core, "Enabled")) {
- GERR("Failed to find Enabled");
- test.ret = RET_ERR;
- }
- if (dbus_log_core_remove_category(core, "Non-existent")) {
- GERR("Removed non-existent category?");
- test.ret = RET_ERR;
- }
- }
+ g_assert_cmpint(test.msg_count, == ,3);
+ cat = dbus_log_core_new_category(core, "Enabled", DBUSLOG_LEVEL_UNDEFINED,
+ DBUSLOG_CATEGORY_FLAG_ENABLED);
+
+ g_assert(cat == test.enabled);
+ dbus_log_category_unref(cat);
+ g_assert(test.enabled->id);
+ g_assert(disabled->id);
+ g_assert_cmpuint(test.enabled->id, != ,disabled->id);
+
+ g_assert(dbus_log_core_find_category(core, test.enabled->name) ==
+ test.enabled);
+ g_assert_cmpuint(dbus_log_core_get_categories(core)->len, == ,3);
+ g_assert_cmpuint(dbus_log_core_find_categories(core, "*")->len, == ,3);
+ g_assert(dbus_log_core_find_categories(core, "*abled")->len == 2);
+ g_assert(dbus_log_core_find_categories(core, disabled->name)->len == 1);
+ g_assert(dbus_log_core_remove_category(core, test.enabled->name));
+ g_assert(!dbus_log_core_remove_category(core, "Non-existent"));
+
+ /* Setting category log level */
+ g_assert(!dbus_log_core_set_category_level(core, "Non-existent",
+ DBUSLOG_LEVEL_UNDEFINED));
+ g_assert(dbus_log_core_set_category_level(core, disabled->name,
+ DBUSLOG_LEVEL_UNDEFINED));
+ g_assert_cmpint(test.level_count, == ,0);
+ g_assert(dbus_log_core_set_category_level(core, disabled->name,
+ DBUSLOG_LEVEL_ALWAYS));
+ g_assert_cmpint(test.level_count, == ,1);
dbus_log_category_unref(test.enabled);
dbus_log_category_unref(test.verbose);
@@ -526,21 +523,14 @@
dbus_log_receiver_unref(test.receiver);
dbus_log_sender_unref(test.sender);
- if (test.add_count != 3 ||
- test.remove_count != 1 ||
- test.flags_count != 2) {
- GERR("Unexpected signal counts %d/%d/%d", test.add_count,
- test.remove_count, test.flags_count);
- test.ret = RET_ERR;
- }
+ g_assert_cmpint(test.add_count, == ,3);
+ g_assert_cmpint(test.remove_count, == ,1);
+ g_assert_cmpint(test.flags_count, == ,2);
dbus_log_core_remove_all_categories(core);
dbus_log_core_remove_all_categories(core);
- if (test.remove_count != 3) {
- GERR("Unexpected remove signal count %d", test.remove_count);
- test.ret = RET_ERR;
- }
+ g_assert_cmpint(test.remove_count, == ,3);
dbus_log_core_remove_handler(core, cid[0]);
dbus_log_core_remove_handlers(core, cid + 1, G_N_ELEMENTS(cid) - 1);
@@ -548,11 +538,8 @@
dbus_log_category_unref(dbus_log_core_new_category(core, "Dummy",
DBUSLOG_LEVEL_UNDEFINED, 0));
dbus_log_core_remove_all_categories(core);
- if (test.add_count != 3 || test.remove_count != 3) {
- GERR("Unexpected signal counts %d/%d",
- test.add_count, test.remove_count);
- test.ret = RET_ERR;
- }
+ g_assert_cmpint(test.add_count, == ,3);
+ g_assert_cmpint(test.remove_count, == ,3);
dbus_log_core_ref(core);
dbus_log_core_unref(core);
@@ -561,9 +548,7 @@
/* Test NULL resistance */
dbus_log_category_ref(NULL);
dbus_log_category_unref(NULL);
- if (dbus_log_category_values(NULL)) {
- test.ret = RET_ERR;
- }
+ g_assert(!dbus_log_category_values(NULL));
return test.ret;
}
@@ -890,6 +875,9 @@
{ NULL }
};
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ g_type_init();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
options = g_option_context_new("[TEST]");
g_option_context_add_main_entries(options, entries, NULL);
if (g_option_context_parse(options, &argc, &argv, &error)) {
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/test/test_util/Makefile
^
|
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake -*-
+
+EXE = test_util
+
+COMMON_SRC = dbuslog_util.c
+
+include ../common/Makefile
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/test/test_util/test_util.c
^
|
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 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 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 "dbuslog_util.h"
+
+#include <gutil_log.h>
+
+/*==========================================================================*
+ * log_level_from_gutil
+ *==========================================================================*/
+
+static
+void
+test_log_level_from_gutil(
+ void)
+{
+ g_assert_cmpint(dbus_log_level_from_gutil
+ (GLOG_LEVEL_ALWAYS), == ,(DBUSLOG_LEVEL_ALWAYS));
+ g_assert_cmpint(dbus_log_level_from_gutil
+ (GLOG_LEVEL_ERR), == ,(DBUSLOG_LEVEL_ERROR));
+ g_assert_cmpint(dbus_log_level_from_gutil
+ (GLOG_LEVEL_WARN), == ,(DBUSLOG_LEVEL_WARNING));
+ g_assert_cmpint(dbus_log_level_from_gutil
+ (GLOG_LEVEL_INFO), == ,(DBUSLOG_LEVEL_INFO));
+ g_assert_cmpint(dbus_log_level_from_gutil
+ (GLOG_LEVEL_DEBUG), == ,(DBUSLOG_LEVEL_DEBUG));
+ g_assert_cmpint(dbus_log_level_from_gutil
+ (GLOG_LEVEL_VERBOSE), == ,(DBUSLOG_LEVEL_VERBOSE));
+ g_assert_cmpint(dbus_log_level_from_gutil
+ (GLOG_LEVEL_NONE), == ,(DBUSLOG_LEVEL_UNDEFINED));
+ g_assert_cmpint(dbus_log_level_from_gutil
+ (GLOG_LEVEL_INHERIT), == ,(DBUSLOG_LEVEL_UNDEFINED));
+ g_assert_cmpint(dbus_log_level_from_gutil
+ (999), == ,(DBUSLOG_LEVEL_UNDEFINED));
+}
+
+/*==========================================================================*
+ * log_level_to_gutil
+ *==========================================================================*/
+
+static
+void
+test_log_level_to_gutil(
+ void)
+{
+ g_assert_cmpint(dbus_log_level_to_gutil
+ (DBUSLOG_LEVEL_ALWAYS), == ,(GLOG_LEVEL_ALWAYS));
+ g_assert_cmpint(dbus_log_level_to_gutil
+ (DBUSLOG_LEVEL_ERROR), == ,(GLOG_LEVEL_ERR));
+ g_assert_cmpint(dbus_log_level_to_gutil
+ (DBUSLOG_LEVEL_WARNING), == ,(GLOG_LEVEL_WARN));
+ g_assert_cmpint(dbus_log_level_to_gutil
+ (DBUSLOG_LEVEL_INFO), == ,(GLOG_LEVEL_INFO));
+ g_assert_cmpint(dbus_log_level_to_gutil
+ (DBUSLOG_LEVEL_DEBUG), == ,(GLOG_LEVEL_DEBUG));
+ g_assert_cmpint(dbus_log_level_to_gutil
+ (DBUSLOG_LEVEL_VERBOSE), == ,(GLOG_LEVEL_VERBOSE));
+ g_assert_cmpint(dbus_log_level_to_gutil
+ (DBUSLOG_LEVEL_UNDEFINED), == ,(GLOG_LEVEL_NONE));
+ g_assert_cmpint(dbus_log_level_to_gutil
+ (999), == ,(GLOG_LEVEL_NONE));
+}
+
+/*==========================================================================*
+ * Common
+ *==========================================================================*/
+
+#define TEST_(name) "/util/" name
+
+int main(int argc, char* argv[])
+{
+ g_test_init(&argc, &argv, NULL);
+ g_test_add_func(TEST_("log_level_from_gutil"), test_log_level_from_gutil);
+ g_test_add_func(TEST_("log_level_to_gutil"), test_log_level_to_gutil);
+ return g_test_run();
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libdbuslog/tools/dbuslog-client/Makefile
^
|
@@ -1,6 +1,6 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release install
+.PHONY: clean distclean all debug release install
.PHONY: common_debug common_release
.PHONY: client_debug client_release
@@ -129,6 +129,7 @@
release: common_release client_release $(RELEASE_EXE)
clean:
+distclean:
rm -f *~
rm -fr $(BUILD_DIR)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/.gitignore
^
|
@@ -6,9 +6,11 @@
test/coverage/results
debian/files
debian/libglibutil-dev.debhelper.log
+debian/libglibutil-dev.install
debian/libglibutil-dev.substvars
debian/libglibutil-dev
debian/libglibutil.debhelper.log
+debian/libglibutil.install
debian/libglibutil.postinst.debhelper
debian/libglibutil.postrm.debhelper
debian/libglibutil.substvars
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/LICENSE
^
|
@@ -0,0 +1,28 @@
+Copyright (C) 2014-2020 Jolla Ltd.
+
+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 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.
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/Makefile
^
|
@@ -1,7 +1,7 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release test
-
+.PHONY: clean all debug release coverage pkgconfig install install-dev test
+.PHONY: print_debug_lib print_release_lib print_coverage_lib
#
# Required packages
#
@@ -20,7 +20,7 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
-VERSION_RELEASE = 35
+VERSION_RELEASE = 46
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
@@ -36,6 +36,7 @@
LIB_SYMLINK2 = $(LIB_SYMLINK1).$(VERSION_MINOR)
LIB_SONAME = $(LIB_SYMLINK1)
LIB = $(LIB_SONAME).$(VERSION_MINOR).$(VERSION_RELEASE)
+STATIC_LIB = $(LIB_NAME).a
#
# Sources
@@ -63,25 +64,14 @@
BUILD_DIR = build
DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
RELEASE_BUILD_DIR = $(BUILD_DIR)/release
-
-#
-# Code coverage
-#
-
-ifndef GCOV
-GCOV = 0
-endif
-
-ifneq ($(GCOV),0)
-CFLAGS += --coverage
-LDFLAGS += --coverage
-endif
+COVERAGE_BUILD_DIR = $(BUILD_DIR)/coverage
#
# Tools and flags
#
-CC = $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
+STRIP ?= strip
LD = $(CC)
WARNINGS = -Wall
INCLUDES = -I$(INCLUDE_DIR)
@@ -92,11 +82,9 @@
$(shell pkg-config --libs $(PKGS))
DEBUG_FLAGS = -g
RELEASE_FLAGS =
+COVERAGE_FLAGS = -g
-ifndef KEEP_SYMBOLS
-KEEP_SYMBOLS = 0
-endif
-
+KEEP_SYMBOLS ?= 0
ifneq ($(KEEP_SYMBOLS),0)
RELEASE_FLAGS += -g
endif
@@ -105,6 +93,7 @@
RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG
RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
+COVERAGE_CFLAGS = $(FULL_CFLAGS) $(COVERAGE_FLAGS) --coverage
#
# Files
@@ -113,12 +102,23 @@
PKGCONFIG = $(BUILD_DIR)/$(LIB_NAME).pc
DEBUG_OBJS = $(SRC:%.c=$(DEBUG_BUILD_DIR)/%.o)
RELEASE_OBJS = $(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
+COVERAGE_OBJS = $(SRC:%.c=$(COVERAGE_BUILD_DIR)/%.o)
+
+DEBUG_LIB = $(DEBUG_BUILD_DIR)/$(LIB)
+RELEASE_LIB = $(RELEASE_BUILD_DIR)/$(LIB)
+DEBUG_LINK = $(DEBUG_BUILD_DIR)/$(LIB_SYMLINK1)
+RELEASE_LINK = $(RELEASE_BUILD_DIR)/$(LIB_SYMLINK1)
+DEBUG_DEV_LINK = $(DEBUG_BUILD_DIR)/$(LIB_DEV_SYMLINK)
+RELEASE_DEV_LINK = $(RELEASE_BUILD_DIR)/$(LIB_DEV_SYMLINK)
+DEBUG_STATIC_LIB = $(DEBUG_BUILD_DIR)/$(STATIC_LIB)
+RELEASE_STATIC_LIB = $(RELEASE_BUILD_DIR)/$(STATIC_LIB)
+COVERAGE_STATIC_LIB = $(COVERAGE_BUILD_DIR)/$(STATIC_LIB)
#
# Dependencies
#
-DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d)
+DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d) $(COVERAGE_OBJS:%.o=%.d)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(DEPS)),)
-include $(DEPS)
@@ -126,41 +126,30 @@
endif
$(PKGCONFIG): | $(BUILD_DIR)
-$(DEBUG_OBJS) $(DEBUG_LIB): | $(DEBUG_BUILD_DIR)
-$(RELEASE_OBJS) $(RELEASE_LIB): | $(RELEASE_BUILD_DIR)
+$(DEBUG_OBJS) $(DEBUG_LIB) $(DEBUG_STATIC_LIB): | $(DEBUG_BUILD_DIR)
+$(RELEASE_OBJS) $(RELEASE_LIB) $(RELEASE_STATIC_LIB): | $(RELEASE_BUILD_DIR)
+$(COVERAGE_OBJS) $(COVERAGE_STATIC_LIB): | $(COVERAGE_BUILD_DIR)
#
# Rules
#
-DEBUG_LIB = $(DEBUG_BUILD_DIR)/$(LIB)
-RELEASE_LIB = $(RELEASE_BUILD_DIR)/$(LIB)
-DEBUG_LINK = $(DEBUG_BUILD_DIR)/$(LIB_SYMLINK1)
-RELEASE_LINK = $(RELEASE_BUILD_DIR)/$(LIB_SYMLINK1)
+debug: $(DEBUG_STATIC_LIB) $(DEBUG_LIB) $(DEBUG_LINK) $(DEBUG_DEV_LINK)
-debug: $(DEBUG_LIB)
+release: $(RELEASE_STATIC_LIB) $(RELEASE_LIB) $(RELEASE_LINK) $(RELEASE_DEV_LINK)
-release: $(RELEASE_LIB)
+coverage: $(COVERAGE_STATIC_LIB)
pkgconfig: $(PKGCONFIG)
print_debug_lib:
- @echo $(DEBUG_LIB)
+ @echo $(DEBUG_STATIC_LIB)
print_release_lib:
- @echo $(RELEASE_LIB)
+ @echo $(RELEASE_STATIC_LIB)
-print_debug_link:
- @echo $(DEBUG_LINK)
-
-print_release_link:
- @echo $(RELEASE_LINK)
-
-print_debug_path:
- @echo $(DEBUG_BUILD_DIR)
-
-print_release_path:
- @echo $(RELEASE_BUILD_DIR)
+print_coverage_lib:
+ @echo $(COVERAGE_STATIC_LIB)
clean:
make -C test clean
@@ -170,6 +159,7 @@
rm -fr debian/tmp debian/libglibutil debian/libglibutil-dev
rm -f documentation.list debian/files debian/*.substvars
rm -f debian/*.debhelper.log debian/*.debhelper debian/*~
+ rm -fr debian/*.install
test:
make -C test test
@@ -183,12 +173,18 @@
$(RELEASE_BUILD_DIR):
mkdir -p $@
+$(COVERAGE_BUILD_DIR):
+ mkdir -p $@
+
$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+$(COVERAGE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
$(DEBUG_LIB): $(DEBUG_OBJS)
$(LD) $(DEBUG_OBJS) $(DEBUG_LDFLAGS) -o $@
ln -sf $(LIB) $(DEBUG_LINK)
@@ -197,11 +193,43 @@
$(LD) $(RELEASE_OBJS) $(RELEASE_LDFLAGS) -o $@
ln -sf $(LIB) $(RELEASE_LINK)
ifeq ($(KEEP_SYMBOLS),0)
- strip $@
+ $(STRIP) $@
endif
-$(PKGCONFIG): $(LIB_NAME).pc.in
- sed -e 's/\[version\]/'$(PCVERSION)/g $< > $@
+$(DEBUG_LINK):
+ ln -sf $(LIB) $@
+
+$(RELEASE_LINK):
+ ln -sf $(LIB) $@
+
+$(DEBUG_DEV_LINK):
+ ln -sf $(LIB_SYMLINK1) $@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/debian/changelog
^
|
@@ -1,3 +1,73 @@
+libglibutil (1.0.46) unstable; urgency=low
+
+ * Allow STRIP to be defined by the environment
+
+ -- Slava Monich <slava.monich@jolla.com> Sat, 30 May 2020 00:02:35 +0300
+
+libglibutil (1.0.45) unstable; urgency=low
+
+ * Support for multiple archs
+
+ -- Slava Monich <slava.monich@jolla.com> Fri, 22 May 2020 16:11:42 +0300
+
+libglibutil (1.0.44) unstable; urgency=low
+
+ * Adapted to side-by-side linking
+ * Allow overriding CC for unit tests
+
+ -- Slava Monich <slava.monich@jolla.com> Tue, 17 Mar 2020 19:01:45 +0200
+
+libglibutil (1.0.43) unstable; urgency=low
+
+ * Allow specifying per-module logging function
+ * Added default GLogProc2 compatible callbacks
+
+ -- Slava Monich <slava.monich@jolla.com> Fri, 20 Dec 2019 19:31:32 +0200
+
+libglibutil (1.0.42) unstable; urgency=low
+
+ * Zero-initialize timespec::tv_nsec
+ * Optimized gutil_strv_equal()
+
+ -- Slava Monich <slava.monich@jolla.com> Fri, 22 Nov 2019 00:49:13 +0200
+
+libglibutil (1.0.41) unstable; urgency=low
+
+ * Added gutil_bytes_equal() and gutil_bytes_equal_data()
+
+ -- Slava Monich <slava.monich@jolla.com> Sun, 10 Nov 2019 17:14:19 +0300
+
+libglibutil (1.0.40) unstable; urgency=low
+
+ * Added gutil_strv_bsearch()
+
+ -- Slava Monich <slava.monich@jolla.com> Mon, 16 Sep 2019 02:22:51 +0300
+
+libglibutil (1.0.39) unstable; urgency=low
+
+ * Allow use of CC defined by build system
+
+ -- Slava Monich <slava.monich@jolla.com> Tue, 27 Aug 2019 13:19:56 +0300
+
+libglibutil (1.0.38) unstable; urgency=low
+
+ * Added gutil_data_has_prefix() and gutil_data_has_suffix()
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 01 Aug 2019 00:13:32 +0300
+
+libglibutil (1.0.37) unstable; urgency=low
+
+ * Added gutil_bytes_concat() and gutil_bytes_xor()
+
+ -- Slava Monich <slava.monich@jolla.com> Tue, 23 Jul 2019 21:17:18 +0300
+
+libglibutil (1.0.36) unstable; urgency=low
+
+ * Handle empty log prefix as no prefix at all
+ * Don't nullify default log name in gutil_log_set_type()
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 13 Jun 2019 18:15:33 +0300
+
libglibutil (1.0.35) unstable; urgency=low
* Added gutil_strv_last() function
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/debian/control
^
|
@@ -2,7 +2,7 @@
Section: libs
Priority: optional
Maintainer: Slava Monich <slava.monich@jolla.com>
-Build-Depends: debhelper (>= 7), libglib2.0-dev (>= 2.0)
+Build-Depends: debhelper (>= 8.1.3), libglib2.0-dev (>= 2.0)
Standards-Version: 3.8.4
Package: libglibutil
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/debian/copyright
^
|
@@ -1,5 +1,4 @@
-Copyright (C) 2014-2015 Jolla Ltd.
-Contact: Slava Monich <slava.monich@jolla.com>
+Copyright (C) 2014-2020 Jolla Ltd.
You may use this file under the terms of BSD license as follows:
@@ -12,9 +11,9 @@
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 the 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.
+ 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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/debian/libglibutil-dev.install.in
^
|
@@ -0,0 +1,3 @@
+debian/tmp/@LIBDIR@/libglibutil.so @LIBDIR@
+debian/tmp/@LIBDIR@/pkgconfig/libglibutil.pc @LIBDIR@/pkgconfig
+debian/tmp/usr/include/* usr/include/
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/debian/libglibutil.install.in
^
|
@@ -0,0 +1 @@
+debian/tmp/@LIBDIR@/libglibutil.so.* @LIBDIR@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/debian/rules
^
|
@@ -4,8 +4,13 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
+LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+override_dh_auto_build:
+ dh_auto_build -- LIBDIR=$(LIBDIR) release pkgconfig debian/libglibutil.install debian/libglibutil-dev.install
+
override_dh_auto_install:
- dh_auto_install -- install-dev
+ dh_auto_install -- LIBDIR=$(LIBDIR) install-dev
%:
dh $@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/include/gutil_log.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2018 Jolla Ltd.
- * Copyright (C) 2014-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2019 Jolla Ltd.
+ * Copyright (C) 2014-2019 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -75,11 +75,19 @@
# endif
#endif
+/* Logging function prototypes */
+#define GUTIL_DEFINE_LOG_FN(fn) void fn(const char* name, int level, \
+ const char* format, va_list va)
+#define GUTIL_DEFINE_LOG_FN2(fn) void fn(const GLogModule* module, \
+ int level, const char* format, va_list va)
+typedef GUTIL_DEFINE_LOG_FN((*GLogProc));
+typedef GUTIL_DEFINE_LOG_FN2((*GLogProc2));
+
/* Log module */
struct glog_module {
const char* name; /* Name (used as prefix) */
const GLogModule* parent; /* Parent log module (optional) */
- void* reserved; /* Reserved for future expansion */
+ GLogProc2 log_proc; /* Per-module logging function (1.0.43) */
const int max_level; /* Maximum level defined at compile time */
int level; /* Current log level */
int flags; /* Flags (see below) */
@@ -145,19 +153,17 @@
extern const char GLOG_TYPE_SYSLOG[];
/* Available log handlers */
-#define GUTIL_DEFINE_LOG_FN(fn) void fn(const char* name, int level, \
- const char* format, va_list va)
-#define GUTIL_DEFINE_LOG_FN2(fn) void fn(const GLogModule* module, \
- int level, const char* format, va_list va)
GUTIL_DEFINE_LOG_FN(gutil_log_stdout);
GUTIL_DEFINE_LOG_FN(gutil_log_stderr);
GUTIL_DEFINE_LOG_FN(gutil_log_glib);
GUTIL_DEFINE_LOG_FN(gutil_log_syslog);
+GUTIL_DEFINE_LOG_FN2(gutil_log_stdout2); /* Since 1.0.43 */
+GUTIL_DEFINE_LOG_FN2(gutil_log_stderr2); /* Since 1.0.43 */
+GUTIL_DEFINE_LOG_FN2(gutil_log_glib2); /* Since 1.0.43 */
+GUTIL_DEFINE_LOG_FN2(gutil_log_syslog2); /* Since 1.0.43 */
/* Log configuration */
GLOG_MODULE_DECL(gutil_log_default)
-typedef GUTIL_DEFINE_LOG_FN((*GLogProc));
-typedef GUTIL_DEFINE_LOG_FN2((*GLogProc2));
extern GLogProc gutil_log_func;
extern GLogProc2 gutil_log_func2;
extern gboolean gutil_log_timestamp; /* Only affects stdout and stderr */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/include/gutil_misc.h
^
|
@@ -54,7 +54,6 @@
const char* str,
gssize len);
-/* since 1.0.29 */
#define GUTIL_HEXDUMP_BUFSIZE (70)
#define GUTIL_HEXDUMP_MAXBYTES (16)
@@ -62,30 +61,61 @@
gutil_hexdump(
char* buf,
const void* data,
- guint len);
+ guint size); /* Since 1.0.29 */
-/* since 1.0.30 */
gboolean
gutil_parse_int(
const char* str,
int base,
- int* value);
+ int* value); /* Since 1.0.30 */
-/* since 1.0.31 */
gboolean
gutil_data_equal(
const GUtilData* data1,
- const GUtilData* data2);
+ const GUtilData* data2); /* Since 1.0.31 */
+
+gboolean
+gutil_data_has_prefix(
+ const GUtilData* data,
+ const GUtilData* prefix); /* Since 1.0.38 */
+
+gboolean
+gutil_data_has_suffix(
+ const GUtilData* data,
+ const GUtilData* suffix); /* Since 1.0.38 */
const GUtilData*
gutil_data_from_string(
GUtilData* data,
- const char* str);
+ const char* str); /* Since 1.0.31 */
const GUtilData*
gutil_data_from_bytes(
GUtilData* data,
- GBytes* bytes);
+ GBytes* bytes); /* Since 1.0.31 */
+
+GBytes*
+gutil_bytes_concat(
+ GBytes* bytes,
+ ...) /* Since 1.0.37 */
+ G_GNUC_WARN_UNUSED_RESULT
+ G_GNUC_NULL_TERMINATED;
+
+GBytes*
+gutil_bytes_xor(
+ GBytes* bytes1,
+ GBytes* bytes2); /* Since 1.0.37 */
+
+gboolean
+gutil_bytes_equal(
+ GBytes* bytes,
+ const void* data,
+ gsize size); /* Since 1.0.41 */
+
+gboolean
+gutil_bytes_equal_data(
+ GBytes* bytes,
+ const GUtilData* data); /* Since 1.0.41 */
G_END_DECLS
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/include/gutil_strv.h
^
|
@@ -110,6 +110,19 @@
gboolean ascending);
/**
+ * Binary search in the sorted string array. Returns index of the
+ * specified string in the string array, or -1 if the string is not
+ * found. It's basically a version of gutil_strv_find optimized for
+ * sorted arrays. The string array must be sorted by gutil_strv_sort
+ * with the same 'ascending' argument.
+ */
+int
+gutil_strv_bsearch(
+ GStrV* sv,
+ const char* s,
+ gboolean ascending); /* Since 1.0.40 */
+
+/**
* Removes leading and trailing whitespaces from all strings in the vector.
*/
GStrV*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/libglibutil.pc.in
^
|
@@ -1,10 +1,10 @@
name=glibutil
-libdir=/usr/lib
+libdir=@libdir@
includedir=/usr/include
Name: libglibutil
Description: Library of glib utilities
-Version: [version]
-Requires: glib-2.0
+Version: @version@
+Requires.private: glib-2.0
Libs: -L${libdir} -l${name}
Cflags: -I${includedir} -I${includedir}/gutil
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/rpm/libglibutil.spec
^
|
@@ -1,10 +1,10 @@
Name: libglibutil
-Version: 1.0.35
+Version: 1.0.46
Release: 0
Summary: Library of glib utilities
Group: Development/Libraries
License: BSD
-URL: https://git.merproject.org/mer-core/libglibutil
+URL: https://git.sailfishos.org/mer-core/libglibutil
Source: %{name}-%{version}.tar.bz2
BuildRequires: pkgconfig(glib-2.0)
Requires(post): /sbin/ldconfig
@@ -25,11 +25,11 @@
%setup -q
%build
-make KEEP_SYMBOLS=1 release pkgconfig
+make LIBDIR=%{_libdir} KEEP_SYMBOLS=1 release pkgconfig
%install
rm -rf %{buildroot}
-make install-dev DESTDIR=%{buildroot}
+make LIBDIR=%{_libdir} DESTDIR=%{buildroot} install-dev
%check
make -C test test
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/src/gutil_log.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2018 Jolla Ltd.
- * Copyright (C) 2014-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2019 Jolla Ltd.
+ * Copyright (C) 2014-2019 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -58,7 +58,7 @@
GLogModule gutil_log_default = {
NULL, /* name */
NULL, /* parent */
- NULL, /* reserved */
+ NULL, /* log_proc */
GLOG_LEVEL_MAX, /* max_level */
GLOG_LEVEL_DEFAULT, /* level */
0, /* flags */
@@ -108,6 +108,7 @@
{
int size, nchars = -1;
char* buffer;
+
if (buf) {
size = bufsize;
buffer = buf;
@@ -115,10 +116,11 @@
size = MAX(100,bufsize);
buffer = g_malloc(size);
}
- while (buffer) {
+ while (buffer) {
/* Try to print in the allocated space. */
va_list va2;
+
G_VA_COPY(va2, va);
nchars = g_vsnprintf(buffer, size, format, va2);
va_end(va2);
@@ -151,13 +153,26 @@
char buf[512];
const char* prefix = "";
char* msg;
+
if (gutil_log_timestamp) {
time_t now;
+#ifndef _WIN32
+ struct tm tm_;
+#define localtime(t) localtime_r(t, &tm_)
+#endif
+
time(&now);
strftime(t, sizeof(t), "%Y-%m-%d %H:%M:%S ", localtime(&now));
+#undef localtime
} else {
t[0] = 0;
}
+
+ /* Empty name is treated the same way as NULL */
+ if (name && !name[0]) {
+ name = NULL;
+ }
+
switch (level) {
case GLOG_LEVEL_WARN: prefix = "WARNING: "; break;
case GLOG_LEVEL_ERR: prefix = "ERROR: "; break;
@@ -203,6 +218,26 @@
gutil_log_stdio(stderr, name, level, format, va);
}
+void
+gutil_log_stdout2(
+ const GLogModule* module,
+ int level,
+ const char* format,
+ va_list va) /* Since 1.0.43 */
+{
+ gutil_log_stdout(module ? module->name : NULL, level, format, va);
+}
+
+void
+gutil_log_stderr2(
+ const GLogModule* module,
+ int level,
+ const char* format,
+ va_list va) /* Since 1.0.43 */
+{
+ gutil_log_stderr(module ? module->name : NULL, level, format, va);
+}
+
/* Formards output to syslog */
#if GLOG_SYSLOG
#include <syslog.h>
@@ -215,6 +250,7 @@
{
int priority;
const char* prefix = NULL;
+
switch (level) {
default:
case GLOG_LEVEL_INFO:
@@ -235,6 +271,15 @@
prefix = "ERROR! ";
break;
}
+
+ if (name) {
+ /* We don't want to see default name twice in the log */
+ if (!name[0] || name == gutil_log_default.name ||
+ !g_strcmp0(name, gutil_log_default.name)) {
+ name = NULL;
+ }
+ }
+
if (name || prefix) {
char buf[512];
char* msg = gutil_log_format(buf, sizeof(buf), format, va);
@@ -249,6 +294,16 @@
vsyslog(priority, format, va);
}
}
+
+void
+gutil_log_syslog2(
+ const GLogModule* module,
+ int level,
+ const char* format,
+ va_list va) /* Since 1.0.43 */
+{
+ gutil_log_syslog(module ? module->name : NULL, level, format, va);
+}
#endif /* GLOG_SYSLOG */
/* Forwards output to g_logv */
@@ -271,6 +326,16 @@
}
g_logv(name, flags, format, va);
}
+
+void
+gutil_log_glib2(
+ const GLogModule* module,
+ int level,
+ const char* format,
+ va_list va) /* Since 1.0.43 */
+{
+ gutil_log_glib(module ? module->name : NULL, level, format, va);
+}
#endif /* GLOG_GLIB */
/**
@@ -311,11 +376,11 @@
check->level : gutil_log_default.level;
if ((level > GLOG_LEVEL_NONE && level <= max_level) ||
(level == GLOG_LEVEL_ALWAYS)) {
- GLogProc2 log = gutil_log_func2;
- if (G_LIKELY(log)) {
- if (!module) module = &gutil_log_default;
- log(module, level, format, va);
- }
+ GLogProc2 log;
+ /* Caller makes sure that at least gutil_log_func2 is there */
+ if (!module) module = &gutil_log_default;
+ log = module->log_proc ? module->log_proc : gutil_log_func2;
+ log(module, level, format, va);
}
}
}
@@ -498,7 +563,10 @@
if (gutil_log_func != gutil_log_syslog) {
openlog(NULL, LOG_PID | LOG_CONS, LOG_USER);
}
- gutil_log_default.name = NULL;
+ /* NULL default_name means "don't change the default name" */
+ if (default_name) {
+ gutil_log_default.name = default_name;
+ }
gutil_log_func = gutil_log_syslog;
return TRUE;
}
@@ -506,7 +574,10 @@
closelog();
}
#endif /* GLOG_SYSLOG */
- gutil_log_default.name = default_name;
+ /* NULL default_name means "don't change the default name" */
+ if (default_name) {
+ gutil_log_default.name = default_name;
+ }
if (!g_ascii_strcasecmp(type, GLOG_TYPE_STDOUT)) {
gutil_log_func = gutil_log_stdout;
return TRUE;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/src/gutil_misc.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2019 Jolla Ltd.
+ * Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* 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.
+ * 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
@@ -228,6 +228,193 @@
return data;
}
+gboolean
+gutil_data_has_prefix(
+ const GUtilData* data,
+ const GUtilData* prefix) /* Since 1.0.38 */
+{
+ /*
+ * Not that it was overly important, but let's postulate that
+ * NULL begins with NULL, empty block begins with empty block
+ * but NULL doesn't begin with empty block and empty block
+ * doesn't begin with NULL.
+ */
+ if (G_LIKELY(data)) {
+ return G_LIKELY(prefix) &&
+ prefix->size <= data->size &&
+ !memcmp(data->bytes, prefix->bytes, prefix->size);
+ } else {
+ return !prefix;
+ }
+}
+
+gboolean
+gutil_data_has_suffix(
+ const GUtilData* data,
+ const GUtilData* suffix) /* Since 1.0.38 */
+{
+ /*
+ * Similarly to gutil_data_has_prefix, NULL ends with NULL, empty
+ * block ends with empty block but NULL doesn't end with empty block
+ * and empty block doesn't end with NULL.
+ */
+ if (G_LIKELY(data)) {
+ return G_LIKELY(suffix) &&
+ suffix->size <= data->size &&
+ !memcmp(data->bytes + (data->size - suffix->size),
+ suffix->bytes, suffix->size);
+ } else {
+ return !suffix;
+ }
+}
+
+GBytes*
+gutil_bytes_concat(
+ GBytes* bytes1,
+ ...) /* Since 1.0.37 */
+{
+ if (G_LIKELY(bytes1)) {
+ va_list args;
+ gsize size = g_bytes_get_size(bytes1);
+ gsize total = size;
+ guint non_empty_count;
+ GBytes* non_empty;
+ GBytes* b;
+
+ if (!size) {
+ non_empty_count = 0;
+ non_empty = NULL;
+ } else {
+ non_empty_count = 1;
+ non_empty = bytes1;
+ }
+
+ va_start(args, bytes1);
+ b = va_arg(args, GBytes*);
+ while (b) {
+ size = g_bytes_get_size(b);
+ total += size;
+ if (size) {
+ non_empty_count++;
+ non_empty = b;
+ }
+ b = va_arg(args, GBytes*);
+ }
+ va_end(args);
+
+ if (non_empty_count == 0) {
+ /* All arrays are empty */
+ return g_bytes_ref(bytes1);
+ } else if (non_empty_count == 1) {
+ /* Only one array is non-empty */
+ return g_bytes_ref(non_empty);
+ } else {
+ /* We actually need to concatenate something */
+ guint8* buf = g_malloc(total);
+ guint8* dest;
+ gsize size;
+ const void* src = g_bytes_get_data(bytes1, &size);
+
+ memcpy(buf, src, size);
+ dest = buf + size;
+
+ va_start(args, bytes1);
+ b = va_arg(args, GBytes*);
+ while (b) {
+ src = g_bytes_get_data(b, &size);
+ memcpy(dest, src, size);
+ dest += size;
+ b = va_arg(args, GBytes*);
+ }
+ va_end(args);
+
+ return g_bytes_new_take(buf, total);
+ }
+ }
+ return NULL;
+}
+
+GBytes*
+gutil_bytes_xor(
+ GBytes* bytes1,
+ GBytes* bytes2) /* Since 1.0.37 */
+{
+ if (G_LIKELY(bytes1) && G_LIKELY(bytes2)) {
+ gsize size1, size2;
+ const guint8* data1 = g_bytes_get_data(bytes1, &size1);
+ const guint8* data2 = g_bytes_get_data(bytes2, &size2);
+ const gsize size = MIN(size1, size2);
+
+ if (G_LIKELY(size)) {
+ gsize i;
+ guint8* xor_data = g_malloc(size);
+ unsigned long* xor_long = (unsigned long*)xor_data;
+ const unsigned long* long1 = (const unsigned long*)data1;
+ const unsigned long* long2 = (const unsigned long*)data2;
+ const guint8* tail1;
+ const guint8* tail2;
+ guint8* xor_tail;
+
+ /* Optimize by XOR-ing entire words */
+ for (i = 0; (i + sizeof(*long1)) <= size; i += sizeof(*long1)) {
+ *xor_long++ = (*long1++) ^ (*long2++);
+ }
+
+ /* Finish the process byte-by-byte */
+ tail1 = (const guint8*)long1;
+ tail2 = (const guint8*)long2;
+ xor_tail = (guint8*)xor_long;
+ for(; i < size; i++) {
+ *xor_tail++ = (*tail1++) ^ (*tail2++);
+ }
+ return g_bytes_new_take(xor_data, size);
+ }
+ return g_bytes_ref(size1 ? bytes2 : bytes1);
+ }
+ return NULL;
+}
+
+gboolean
+gutil_bytes_equal(
+ GBytes* bytes,
+ const void* data,
+ gsize size) /* Since 1.0.41 */
+{
+ if (bytes && data) {
+ gsize bytes_size;
+ const guint8* contents = g_bytes_get_data(bytes, &bytes_size);
+
+ if (bytes_size == size) {
+ return !bytes_size || !memcmp(contents, data, size);
+ } else {
+ return FALSE;
+ }
+ } else {
+ /* NULLs are equal to each other but not to anything else */
+ return !bytes && !data;
+ }
+}
+
+gboolean
+gutil_bytes_equal_data(
+ GBytes* bytes,
+ const GUtilData* data) /* Since 1.0.41 */
+{
+ if (bytes && data) {
+ gsize bytes_size;
+ const guint8* contents = g_bytes_get_data(bytes, &bytes_size);
+
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/src/gutil_strv.c
^
|
@@ -161,25 +161,37 @@
}
/**
- * Checks two string arrays for equality.
+ * Checks two string arrays for equality. NULL and empty arrays are equal.
+ *
+ * This is basically a NULL-tolerant equivalent of g_strv_equal which
+ * appeared in glib 2.60.
*/
gboolean
gutil_strv_equal(
const GStrV* sv1,
const GStrV* sv2)
{
- const guint len1 = gutil_strv_length(sv1);
- const guint len2 = gutil_strv_length(sv2);
- if (len1 == len2) {
- guint i;
- for (i=0; i<len1; i++) {
- if (strcmp(sv1[i], sv2[i])) {
- return FALSE;
+ if (sv1 == sv2) {
+ return TRUE;
+ } else if (!sv1) {
+ return !sv2[0];
+ } else if (!sv2) {
+ return !sv1[0];
+ } else {
+ guint len = 0;
+
+ while (sv1[len] && sv2[len]) len++;
+ if (!sv1[len] && !sv2[len]) {
+ guint i;
+ for (i=0; i<len; i++) {
+ if (strcmp(sv1[i], sv2[i])) {
+ return FALSE;
+ }
}
+ return TRUE;
}
- return TRUE;
+ return FALSE;
}
- return FALSE;
}
static
@@ -218,6 +230,32 @@
}
/**
+ * Binary search in the sorted string array. Returns index of the
+ * specified string in the string array, or -1 if the string is not
+ * found. It's basically a version of gutil_strv_find optimized for
+ * sorted arrays. The string array must be sorted by gutil_strv_sort
+ * with the same 'ascending' argument.
+ */
+int
+gutil_strv_bsearch(
+ GStrV* sv,
+ const char* s,
+ gboolean ascending) /* Since 1.0.40 */
+{
+ if (s) {
+ guint len = gutil_strv_length(sv);
+ if (len > 0) {
+ GStrV* found = bsearch(&s, sv, len, sizeof(char*), ascending ?
+ gutil_strv_sort_ascending : gutil_strv_sort_descending);
+ if (found) {
+ return found - sv;
+ }
+ }
+ }
+ return -1;
+}
+
+/**
* Removes leading and trailing whitespaces from all strings in the vector.
*/
GStrV*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/src/gutil_timenotify.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2019 Jolla Ltd.
+ * Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 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.
+ * 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
@@ -31,7 +31,7 @@
*/
#include "gutil_timenotify.h"
-#include <gutil_log.h>
+#include "gutil_log.h"
#include <glib-object.h>
@@ -167,6 +167,7 @@
gutil_time_notify_callback, self);
/* Set timeout to the latest possible value */
+ memset(&timer, 0, sizeof(timer));
timer.it_value.tv_sec = TIME_T_MAX;
timer.it_interval.tv_sec = TIME_T_MAX;
if (timerfd_settime(fd, TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET,
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/test/common/Makefile
^
|
@@ -1,6 +1,6 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release libglibutil-release libglibutil-debug
+.PHONY: clean all debug release coverage debug_lib release_lib coverage_lib
#
# Real test makefile defines EXE (and possibly SRC) and includes this one.
@@ -35,26 +35,13 @@
BUILD_DIR = build
DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
RELEASE_BUILD_DIR = $(BUILD_DIR)/release
-
-#
-# Code coverage
-#
-
-ifndef GCOV
-GCOV = 0
-endif
-
-ifneq ($(GCOV),0)
-CFLAGS += --coverage
-LDFLAGS += --coverage
-SUBMAKE_OPTS += GCOV=1
-endif
+COVERAGE_BUILD_DIR = $(BUILD_DIR)/coverage
#
# Tools and flags
#
-CC = $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
LD = $(CC)
WARNINGS = -Wall
INCLUDES = -I$(LIB_DIR)/include -I$(LIB_DIR)/src -I$(COMMON_DIR)
@@ -68,6 +55,7 @@
QUIET_MAKE = make --no-print-directory
DEBUG_FLAGS = -g
RELEASE_FLAGS =
+COVERAGE_FLAGS = -g
ifndef KEEP_SYMBOLS
KEEP_SYMBOLS = 0
@@ -80,8 +68,11 @@
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
RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
+COVERAGE_CFLAGS = $(FULL_CFLAGS) $(COVERAGE_FLAGS) --coverage
#
# Files
@@ -93,26 +84,36 @@
RELEASE_OBJS = \
$(COMMON_SRC:%.c=$(RELEASE_BUILD_DIR)/common_%.o) \
$(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
+COVERAGE_OBJS = \
+ $(COMMON_SRC:%.c=$(COVERAGE_BUILD_DIR)/common_%.o) \
+ $(SRC:%.c=$(COVERAGE_BUILD_DIR)/%.o)
DEBUG_LIB_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_debug_lib)
RELEASE_LIB_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_release_lib)
-DEBUG_LIB_PATH := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_debug_path)
+COVERAGE_LIB_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_coverage_lib)
+
DEBUG_LIB := $(LIB_DIR)/$(DEBUG_LIB_FILE)
RELEASE_LIB := $(LIB_DIR)/$(RELEASE_LIB_FILE)
+COVERAGE_LIB := $(LIB_DIR)/$(COVERAGE_LIB_FILE)
#
# Dependencies
#
-DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d)
+DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d) $(COVERAGE_OBJS:%.o=%.d)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(DEPS)),)
-include $(DEPS)
endif
endif
+$(DEBUG_LIB): | debug_lib
+$(RELEASE_LIB): | release_lib
+$(COVERAGE_LIB): | coverage_lib
+
$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
+$(COVERAGE_OBJS): | $(COVERAGE_BUILD_DIR)
#
# Rules
@@ -120,10 +121,13 @@
DEBUG_EXE = $(DEBUG_BUILD_DIR)/$(EXE)
RELEASE_EXE = $(RELEASE_BUILD_DIR)/$(EXE)
+COVERAGE_EXE = $(COVERAGE_BUILD_DIR)/$(EXE)
+
+debug: debug_lib $(DEBUG_EXE)
-debug: libglibutil-debug $(DEBUG_EXE)
+release: release_lib $(RELEASE_EXE)
-release: libglibutil-release $(RELEASE_EXE)
+coverage: coverage_lib $(COVERAGE_EXE)
clean:
rm -f *~
@@ -136,10 +140,10 @@
@echo "===========" $(EXE) "=========== "
test: test_banner debug
- @LD_LIBRARY_PATH="$(LIB_DIR)/$(DEBUG_LIB_PATH)" $(DEBUG_EXE)
+ @$(DEBUG_EXE)
valgrind: test_banner debug
- @LD_LIBRARY_PATH="$(LIB_DIR)/$(DEBUG_LIB_PATH)" G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --leak-check=full --show-possibly-lost=no $(DEBUG_EXE)
+ @G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --leak-check=full --show-possibly-lost=no $(DEBUG_EXE)
$(DEBUG_BUILD_DIR):
mkdir -p $@
@@ -147,18 +151,27 @@
$(RELEASE_BUILD_DIR):
mkdir -p $@
+$(COVERAGE_BUILD_DIR):
+ mkdir -p $@
+
$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+$(COVERAGE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
$(DEBUG_BUILD_DIR)/common_%.o : $(COMMON_DIR)/%.c
$(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
$(RELEASE_BUILD_DIR)/common_%.o : $(COMMON_DIR)/%.c
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+$(COVERAGE_BUILD_DIR)/common_%.o : $(COMMON_DIR)/%.c
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
$(DEBUG_EXE): $(DEBUG_LIB) $(DEBUG_BUILD_DIR) $(DEBUG_OBJS)
$(LD) $(DEBUG_LDFLAGS) $(DEBUG_OBJS) $< $(LIBS) -o $@
@@ -168,8 +181,14 @@
strip $@
endif
-libglibutil-debug:
+$(COVERAGE_EXE): $(COVERAGE_LIB) $(COVERAGE_BUILD_DIR) $(COVERAGE_OBJS)
+ $(LD) $(COVERAGE_LDFLAGS) $(COVERAGE_OBJS) $< $(LIBS) -o $@
+
+debug_lib:
@make $(SUBMAKE_OPTS) -C $(LIB_DIR) debug
-libglibutil-release:
+release_lib:
@make $(SUBMAKE_OPTS) -C $(LIB_DIR) release
+
+coverage_lib:
+ @make $(SUBMAKE_OPTS) -C $(LIB_DIR) coverage
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/test/coverage/run
^
|
@@ -15,7 +15,7 @@
test_ring \
test_strv"
-FLAVOR="release"
+FLAVOR="coverage"
pushd `dirname $0` > /dev/null
COV_DIR="$PWD"
@@ -32,7 +32,7 @@
make GCOV=1 -C "$BASE_DIR" clean $FLAVOR
for t in $TESTS ; do
pushd "$TEST_DIR/$t"
- make GCOV=1 -C "$TEST_DIR/$t" clean $FLAVOR || exit 1
+ make -C "$TEST_DIR/$t" clean $FLAVOR || exit 1
build/$FLAVOR/$t || exit 1
popd
done
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/test/libglibutil_test.dsw
^
|
@@ -90,6 +90,21 @@
###############################################################################
+Project: "test_log"=.\test_log\test_log.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name libglibutil
+ End Project Dependency
+}}}
+
+###############################################################################
+
Project: "test_misc"=.\test_misc\test_misc.dsp - Package Owner=<4>
Package=<5>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/test/test_log/Makefile
^
|
@@ -1,5 +1,6 @@
# -*- Mode: makefile-gmake -*-
+CFLAGS += -DGLOG_LEVEL_MAX=GLOG_LEVEL_VERBOSE
EXE = test_log
include ../common/Makefile
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/test/test_log/test_log.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017-2018 Jolla Ltd.
- * Copyright (C) 2017-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2017-2019 Jolla Ltd.
+ * Copyright (C) 2017-2019 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -30,6 +30,11 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef linux
+# define _GNU_SOURCE /* for fopencookie */
+# define HAVE_TEST_LOG_FILE
+#endif
+
#include "test_common.h"
#include "gutil_strv.h"
@@ -112,6 +117,115 @@
}
/*==========================================================================*
+ * File
+ *==========================================================================*/
+
+#ifdef HAVE_TEST_LOG_FILE
+
+static
+ssize_t
+test_log_file_write(
+ void* buf,
+ const char* chars,
+ size_t size)
+{
+ g_string_append_len(buf, chars, size);
+ return size;
+}
+
+static
+void
+test_log_drop(
+ const GLogModule* module,
+ int level,
+ const char* format,
+ va_list va)
+{
+}
+
+static
+void
+test_log_file(
+ void)
+{
+ static const cookie_io_functions_t funcs = {
+ .write = test_log_file_write
+ };
+ GString* buf = g_string_new(NULL);
+ FILE* out = fopencookie(buf, "w", funcs);
+ FILE* default_stdout = stdout;
+ const int level = gutil_log_default.level;
+ GLogProc2 log_proc;
+
+ g_assert(out);
+ g_assert(gutil_log_set_type(GLOG_TYPE_STDOUT, NULL));
+ g_assert(gutil_log_func == gutil_log_stdout);
+ gutil_log_timestamp = FALSE;
+ gutil_log_default.level = GLOG_LEVEL_WARN;
+
+ /* Warning pefix */
+ stdout = out;
+ gutil_log(NULL, GLOG_LEVEL_WARN, "Test");
+ stdout = default_stdout;
+ g_assert(fflush(out) == 0);
+ GDEBUG("%s", buf->str);
+ g_assert(!g_strcmp0(buf->str, "WARNING: Test\n"));
+ g_string_set_size(buf, 0);
+
+ /* Error prefix */
+ stdout = out;
+ gutil_log(NULL, GLOG_LEVEL_ERR, "Test");
+ stdout = default_stdout;
+ g_assert(fflush(out) == 0);
+ GDEBUG("%s", buf->str);
+ g_assert(!g_strcmp0(buf->str, "ERROR: Test\n"));
+ g_string_set_size(buf, 0);
+
+ /* Empty name (dropped) */
+ gutil_log_default.name = "";
+ stdout = out;
+ gutil_log(NULL, GLOG_LEVEL_ALWAYS, "Test");
+ stdout = default_stdout;
+ g_assert(fflush(out) == 0);
+ GDEBUG("%s", buf->str);
+ g_assert(!g_strcmp0(buf->str, "Test\n"));
+ g_string_set_size(buf, 0);
+
+ /* Non-empty name */
+ gutil_log_default.name = "test";
+ stdout = out;
+ gutil_log(NULL, GLOG_LEVEL_ALWAYS, "Test");
+ stdout = default_stdout;
+ g_assert(fflush(out) == 0);
+ GDEBUG("%s", buf->str);
+ g_assert(!g_strcmp0(buf->str, "[test] Test\n"));
+ g_string_set_size(buf, 0);
+
+ /* Hide the name */
+ gutil_log_default.flags |= GLOG_FLAG_HIDE_NAME;
+ stdout = out;
+ gutil_log(NULL, GLOG_LEVEL_ALWAYS, "Test");
+ stdout = default_stdout;
+ g_assert(fflush(out) == 0);
+ GDEBUG("%s", buf->str);
+ g_assert(!g_strcmp0(buf->str, "Test\n"));
+ g_string_set_size(buf, 0);
+
+ /* Forward output to test_log_drop */
+ log_proc = gutil_log_default.log_proc;
+ gutil_log_default.log_proc = test_log_drop;
+ gutil_log(&gutil_log_default, GLOG_LEVEL_ALWAYS, "Test");
+ g_assert(!buf->len); /* Dropped by test_log_drop */
+ gutil_log_default.log_proc = log_proc;
+
+ fclose(out);
+ gutil_log_default.level = level;
+ g_string_free(buf, TRUE);
+}
+
+#endif /* HAVE_TEST_LOG_FILE */
+
+/*==========================================================================*
* Enabled
*==========================================================================*/
@@ -190,6 +304,9 @@
{
g_test_init(&argc, &argv, NULL);
g_test_add_func(TEST_PREFIX "basic", test_log_basic);
+#ifdef HAVE_TEST_LOG_FILE
+ g_test_add_func(TEST_PREFIX "file", test_log_file);
+#endif
g_test_add_func(TEST_PREFIX "enabled", test_log_enabled);
g_test_add_func(TEST_PREFIX "misc", test_log_misc);
test_init(&test_opt, argc, argv);
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/test/test_log/test_log.dsp
^
|
@@ -0,0 +1,106 @@
+# Microsoft Developer Studio Project File - Name="test_log" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=test_log - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "test_log.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "test_log.mak" CFG="test_log - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "test_log - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "test_log - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "test_log - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "build/release"
+# PROP BASE Intermediate_Dir "build/release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "build/release"
+# PROP Intermediate_Dir "build/release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "../../include" /I "../common" /I "$(GTK_ROOT)/include/glib-2.0" /I "$(GTK_ROOT)/lib/glib-2.0/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /FR /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 glib-2.0.lib gobject-2.0.lib /nologo /subsystem:console /machine:I386 /libpath:"$(GTK_ROOT)/lib"
+
+!ELSEIF "$(CFG)" == "test_log - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "build/debug"
+# PROP BASE Intermediate_Dir "build/debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "build/debug"
+# PROP Intermediate_Dir "build/debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../../include" /I "../common" /I "$(GTK_ROOT)/include/glib-2.0" /I "$(GTK_ROOT)/lib/glib-2.0/include" /D "_DEBUG" /D "DEBUG" /D "WIN32" /D "_CONSOLE" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 glib-2.0.lib gobject-2.0.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept /libpath:"$(GTK_ROOT)/lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "test_log - Win32 Release"
+# Name "test_log - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\test_log.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\common\test_main.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=..\common\test_common.h
+# End Source File
+# End Group
+# End Target
+# End Project
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/test/test_misc/test_misc.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2019 Jolla Ltd.
+ * Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* 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.
+ * 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
@@ -39,7 +39,7 @@
static TestOpt test_opt;
/*==========================================================================*
- * Disconnect
+ * disconnect
*==========================================================================*/
static
@@ -81,7 +81,7 @@
}
/*==========================================================================*
- * Hex2bin
+ * hex2bin
*==========================================================================*/
static
@@ -95,6 +95,7 @@
const void* data;
static const guint8 buf1[4] = { 0x01, 0x23, 0x45, 0x67 };
static const guint8 buf2[4] = { 0x89, 0xab, 0xcd, 0xef };
+
g_assert(!gutil_hex2bin(NULL, 0, NULL));
g_assert(!gutil_hex2bin("x", 0, NULL));
g_assert(!gutil_hex2bin("x", 0, buf));
@@ -126,7 +127,7 @@
}
/*==========================================================================*
- * Hexdump
+ * hexdump
*==========================================================================*/
static
@@ -158,7 +159,7 @@
}
/*==========================================================================*
- * ParseInt
+ * parse_int
*==========================================================================*/
static
@@ -186,7 +187,7 @@
}
/*==========================================================================*
- * DataEqual
+ * data_equal
*==========================================================================*/
static
@@ -215,7 +216,67 @@
}
/*==========================================================================*
- * DataFromBytes
+ * data_prefix
+ *==========================================================================*/
+
+static
+void
+test_data_prefix(
+ void)
+{
+ static const guint8 val_123[] = { '1', '2', '3' };
+ static const guint8 val_1234[] = { '1', '2', '3', '4' };
+ static const guint8 val_234[] = { '2', '3', '4' };
+
+ GUtilData data_empty, data_123, data_1234, data_234;
+
+ memset(&data_empty, 0, sizeof(data_empty));
+ TEST_INIT_DATA(data_123, val_123);
+ TEST_INIT_DATA(data_1234, val_1234);
+ TEST_INIT_DATA(data_234, val_234);
+
+ g_assert(gutil_data_has_prefix(NULL, NULL));
+ g_assert(!gutil_data_has_prefix(&data_empty, NULL));
+ g_assert(!gutil_data_has_prefix(NULL, &data_empty));
+ g_assert(gutil_data_has_prefix(&data_empty, &data_empty));
+ g_assert(gutil_data_has_prefix(&data_123, &data_empty));
+ g_assert(gutil_data_has_prefix(&data_1234, &data_123));
+ g_assert(!gutil_data_has_prefix(&data_123, &data_1234));
+ g_assert(!gutil_data_has_prefix(&data_1234, &data_234));
+}
+
+/*==========================================================================*
+ * data_suffix
+ *==========================================================================*/
+
+static
+void
+test_data_suffix(
+ void)
+{
+ static const guint8 val_123[] = { '1', '2', '3' };
+ static const guint8 val_1234[] = { '1', '2', '3', '4' };
+ static const guint8 val_234[] = { '2', '3', '4' };
+
+ GUtilData data_empty, data_123, data_1234, data_234;
+
+ memset(&data_empty, 0, sizeof(data_empty));
+ TEST_INIT_DATA(data_123, val_123);
+ TEST_INIT_DATA(data_1234, val_1234);
+ TEST_INIT_DATA(data_234, val_234);
+
+ g_assert(gutil_data_has_suffix(NULL, NULL));
+ g_assert(!gutil_data_has_suffix(&data_empty, NULL));
+ g_assert(!gutil_data_has_suffix(NULL, &data_empty));
+ g_assert(gutil_data_has_suffix(&data_empty, &data_empty));
+ g_assert(gutil_data_has_suffix(&data_123, &data_empty));
+ g_assert(gutil_data_has_suffix(&data_1234, &data_234));
+ g_assert(!gutil_data_has_suffix(&data_234, &data_1234));
+ g_assert(!gutil_data_has_suffix(&data_1234, &data_123));
+}
+
+/*==========================================================================*
+ * data_from_bytes
*==========================================================================*/
static
@@ -242,7 +303,7 @@
}
/*==========================================================================*
- * DataFromString
+ * data_from_string
*==========================================================================*/
static
@@ -267,10 +328,167 @@
}
/*==========================================================================*
+ * bytes_concat
+ *==========================================================================*/
+
+static
+void
+test_bytes_concat(
+ void)
+{
+ static const guint8 val1[] = {0x01,0x02,0x03,0x04,0x05};
+ static const guint8 val2[] = {0x06,0x07,0x08,0x09};
+ static const guint8 val3[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09};
+ GBytes* b1 = g_bytes_new_static(val1, sizeof(val1));
+ GBytes* b2 = g_bytes_new_static(val2, sizeof(val2));
+ GBytes* b3 = g_bytes_new_static(val3, sizeof(val3));
+ GBytes* empty = g_bytes_new(NULL, 0);
+ GBytes* b;
+
+ g_assert(!gutil_bytes_concat(NULL, NULL));
+
+ b = gutil_bytes_concat(b1, NULL);
+ g_assert(b == b1);
+ g_bytes_unref(b);
+
+ b = gutil_bytes_concat(empty, NULL);
+ g_assert(b == empty);
+ g_bytes_unref(b);
+
+ b = gutil_bytes_concat(b1, empty, NULL);
+ g_assert(b == b1);
+ g_bytes_unref(b);
+
+ b = gutil_bytes_concat(empty, b1, NULL);
+ g_assert(b == b1);
+ g_bytes_unref(b);
+
+ b = gutil_bytes_concat(b1, empty, b2, NULL);
+ g_assert(g_bytes_equal(b, b3));
+ g_bytes_unref(b);
+
+ g_bytes_unref(b1);
+ g_bytes_unref(b2);
+ g_bytes_unref(b3);
+ g_bytes_unref(empty);
+}
+
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/libglibutil/test/test_strv/test_strv.c
^
|
@@ -99,11 +99,19 @@
char** sv3 = g_strsplit("a,a,a, ,", ",", 0);
char** sv4 = g_strsplit("a,b,c,,", ",", 0);
char** sv5 = g_strsplit("a,b,c,", ",", 0);
+ char* empty = NULL;
+ g_assert(gutil_strv_equal(NULL, NULL));
+ g_assert(gutil_strv_equal(NULL, &empty));
+ g_assert(gutil_strv_equal(&empty, NULL));
+ g_assert(!gutil_strv_equal(sv1, NULL));
+ g_assert(!gutil_strv_equal(NULL, sv2));
+ g_assert(gutil_strv_equal(sv1, sv1));
g_assert(gutil_strv_equal(sv1, sv2));
g_assert(!gutil_strv_equal(sv1, sv3));
g_assert(!gutil_strv_equal(sv1, sv4));
g_assert(!gutil_strv_equal(sv1, sv5));
+ g_assert(!gutil_strv_equal(sv5, sv1));
g_strfreev(sv1);
g_strfreev(sv2);
@@ -128,6 +136,7 @@
g_assert(gutil_strv_contains(sv, "c"));
g_assert(!gutil_strv_contains(sv, "d"));
g_assert(gutil_strv_find(sv, "b") == 1);
+ g_assert(!gutil_strv_contains(sv, NULL));
g_assert(!gutil_strv_contains(NULL, "a"));
g_assert(!gutil_strv_contains(NULL, NULL));
g_strfreev(sv);
@@ -187,6 +196,31 @@
}
/*==========================================================================*
+ * Bsearch
+ *==========================================================================*/
+
+static
+void
+test_bsearch(
+ void)
+{
+ char** a = g_strsplit("a,b,c,d", ",", 0);
+ char** d = g_strsplit("d,c,b,a", ",", 0);
+
+ g_assert(gutil_strv_sort(a, TRUE) == a);
+ g_assert(gutil_strv_sort(d, FALSE) == d);
+
+ g_assert(gutil_strv_bsearch(NULL, "a", TRUE) < 0);
+ g_assert(gutil_strv_bsearch(a, NULL, TRUE) < 0);
+ g_assert(gutil_strv_bsearch(a, "x", TRUE) < 0);
+ g_assert(gutil_strv_bsearch(a, "a", TRUE) == 0);
+ g_assert(gutil_strv_bsearch(d, "a", FALSE) == 3);
+
+ g_strfreev(a);
+ g_strfreev(d);
+}
+
+/*==========================================================================*
* Strip
*==========================================================================*/
@@ -218,6 +252,7 @@
g_test_add_func(TEST_PREFIX "find", test_find);
g_test_add_func(TEST_PREFIX "remove", test_remove);
g_test_add_func(TEST_PREFIX "sort", test_sort);
+ g_test_add_func(TEST_PREFIX "bsearch", test_bsearch);
g_test_add_func(TEST_PREFIX "strip", test_strip);
test_init(&test_opt, argc, argv);
return g_test_run();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/main.cpp
^
|
@@ -1,6 +1,6 @@
/*
- Copyright (C) 2014-2018 Jolla Ltd.
- Copyright (C) 2014-2018 Slava Monich <slava.monich@jolla.com>
+ Copyright (C) 2014-2020 Jolla Ltd.
+ Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -8,14 +8,14 @@
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.
+ 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
@@ -37,7 +37,6 @@
#include "HarbourDebug.h"
#include "HarbourSigChildHandler.h"
-#include "HarbourTransferMethodInfo.h"
#include "HarbourTransferMethodsModel.h"
#include <sailfishapp.h>
@@ -53,22 +52,6 @@
#define PLUGIN_PREFIX "harbour.mmslog"
-static void register_types(const char* uri, int v1 = 1, int v2 = 0)
-{
- qmlRegisterType<HarbourTransferMethodsModel>(uri, v1, v2, "TransferMethodsModel");
-}
-
-static bool load_transferengine_translations(QTranslator* tr, QLocale locale)
-{
- if (tr->load(locale, "sailfish_transferengine_plugins", "-",
- "/usr/share/translations")) {
- return true;
- } else {
- HDEBUG("Failed to load transferengine plugin translator for" << locale);
- return false;
- }
-}
-
static void save_disk_usage(QString dir)
{
QString file(dir);
@@ -89,17 +72,10 @@
QGuiApplication* app = SailfishApp::application(argc, argv);
HarbourTransferMethodInfo2::registerTypes();
OfonoLogger::registerType();
- register_types(PLUGIN_PREFIX, 1, 0);
-
- // The application may (and should) be started with "privileged"
- // effective gid, reset file system identity to the real identity
- // of the process so that files are owned by nemo:nemo
- setfsuid(getuid());
- setfsgid(getgid());
// Load translations
QLocale locale;
- QTranslator* translator = new QTranslator(app);
+ QTranslator* ts = new QTranslator(app);
#ifdef OPENREPOS
// OpenRepos build has settings applet
const bool appSettingsMenu = false;
@@ -110,19 +86,19 @@
const QString transDir = SailfishApp::pathTo("translations").toLocalFile();
const QString transFile("harbour-mmslog");
#endif
- if (translator->load(locale, transFile, "-", transDir) ||
- translator->load(transFile, transDir)) {
- app->installTranslator(translator);
+ if (ts->load(locale, transFile, "-", transDir) ||
+ ts->load(transFile, transDir)) {
+ app->installTranslator(ts);
} else {
HDEBUG("Failed to load translator for" << locale);
- delete translator;
+ delete ts;
}
- translator = new QTranslator(app);
- if (load_transferengine_translations(translator, locale) ||
- load_transferengine_translations(translator, QLocale("en_GB"))) {
- app->installTranslator(translator);
+ ts = new QTranslator(app);
+ if (HarbourTransferMethodsModel::loadTranslations(ts, locale) ||
+ HarbourTransferMethodsModel::loadTranslations(ts, QLocale("en"))) {
+ app->installTranslator(ts);
} else {
- delete translator;
+ delete ts;
}
// Install signal handler
@@ -133,6 +109,8 @@
AppSettings* settings = new AppSettings(app);
FsIoLogModel* mmsLog = new FsIoLogModel(settings, app);
MMSEngine* mmsEngine = new MMSEngine(mmsLog->dirName(), app);
+ HarbourTransferMethodsModel* tm = new HarbourTransferMethodsModel(app);
+ tm->setFilter(mmsLog->archiveType());
mmsLog->connect(mmsEngine, SIGNAL(message(QString,bool)),
SLOT(append(QString,bool)));
if (sigChildHandler) {
@@ -148,6 +126,8 @@
QQuickView* view = SailfishApp::createView();
QQmlContext* context = view->rootContext();
context->setContextProperty("FsIoLog", mmsLog);
+ context->setContextProperty("TransferMethodsModel", tm);
+ context->setContextProperty("AppSettings", settings);
context->setContextProperty("AppSettings", settings);
context->setContextProperty("AppSettingsMenu",
QVariant::fromValue(appSettingsMenu));
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/mmsengine.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2019 Jolla Ltd.
- * Copyright (C) 2014-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2020 Jolla Ltd.
+ * Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -38,6 +38,8 @@
#include "HarbourDebug.h"
#include <QDir>
+#include <QDBusMessage>
+#include <QDBusConnection>
#include <errno.h>
#include <unistd.h>
@@ -45,8 +47,10 @@
#include <signal.h>
#include <sys/prctl.h>
+#define MMS_ENGINE_BUS QDBusConnection::systemBus()
#define MMS_ENGINE "/usr/sbin/mms-engine"
#define MMS_ENGINE_NAME "org.nemomobile.MmsEngine"
+#define MMS_ENGINE_IFACE "org.nemomobile.MmsEngine"
#define MMS_ENGINE_RESTART_DELAY (1000)
#define MMS_ENGINE_MAX_RESTARTS (10)
@@ -91,7 +95,12 @@
DAPeer* peer = da_peer_get(DA_BUS_SYSTEM, MMS_ENGINE_NAME);
if (peer) {
HDEBUG("MMS engine already running, pid" << peer->pid);
- if (kill(peer->pid, SIGTERM) < 0) {
+
+ /* Try to stop it with a D-Bus request (works wince mms-engine 1.0.70) */
+ if (MMS_ENGINE_BUS.call(QDBusMessage::createMethodCall(MMS_ENGINE_NAME, "/",
+ MMS_ENGINE_IFACE, "exit")).type() == QDBusMessage::ReplyMessage) {
+ HDEBUG("MMS engine stopped over D-Bus");
+ } else if (kill(peer->pid, SIGTERM) < 0) {
HWARN("Failed to kill MMS engine:" << strerror(errno));
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.17.tar.bz2/src/mmslogmodel.cpp
^
|
@@ -1,6 +1,6 @@
/*
- Copyright (C) 2014-2018 Jolla Ltd.
- Copyright (C) 2014-2018 Slava Monich <slava.monich@jolla.com>
+ Copyright (C) 2014-2020 Jolla Ltd.
+ Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -8,14 +8,14 @@
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.
+ 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
@@ -40,6 +40,7 @@
#include <signal.h>
#include <unistd.h>
+#include <errno.h>
#define LOG_FILE "mms-engine.log"
@@ -301,7 +302,14 @@
iPid = fork();
if (iPid > 0) {
// Parent
- packingChanged();
+ HDEBUG("Tar done, pid" << aPid << "status" << aStatus);
+ const QByteArray tarball(iArchivePath.toLocal8Bit());
+ if (chown(tarball.constData(), getuid(), getgid()) < 0) {
+ HWARN("Failed to chown" << tarball.constData() << ":"
+ << strerror(errno));
+ }
+ iPid = -1;
+ packingChanged();
} else if (iPid == 0) {
// Child
sleep(1); // To improve parent's chance to finish the flush
|