[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/harbour-logger</param>
<param name="branch">master</param>
- <param name="revision">1.0.12</param>
+ <param name="revision">7e14182</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-logger-ofono-1.0.12.tar.bz2/libconnman-qt/plugin/components.cpp
^
|
@@ -1,42 +0,0 @@
-/*
- * Copyright 2011 Intel Corporation.
- * Copyright © 2012, Jolla.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0. The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- */
-
-#include "components.h"
-
-#include <networkservice.h>
-#include <clockmodel.h>
-#include "networkingmodel.h"
-#include "technologymodel.h"
-#include "savedservicemodel.h"
-#include "useragent.h"
-#include "networksession.h"
-#include "counter.h"
-
-void Components::registerTypes(const char *uri)
-{
- // @uri MeeGo.Connman
-
- qmlRegisterType<NetworkService>(uri,0,2,"NetworkService");
- qmlRegisterType<NetworkingModel>(uri,0,2,"NetworkingModel");
- qmlRegisterType<TechnologyModel>(uri,0,2,"TechnologyModel");
- qmlRegisterType<SavedServiceModel>(uri,0,2,"SavedServiceModel");
- qmlRegisterType<UserAgent>(uri,0,2,"UserAgent");
- qmlRegisterType<ClockModel>(uri,0,2,"ClockModel");
- qmlRegisterType<NetworkSession>(uri,0,2,"NetworkSession");
- qmlRegisterType<NetworkManager>(uri,0,2,"NetworkManager");
- qmlRegisterType<NetworkManagerFactory>(uri,0,2,"NetworkManagerFactory");
- qmlRegisterType<NetworkTechnology>(uri,0,2,"NetworkTechnology");
- qmlRegisterType<Counter>(uri,0,2,"NetworkCounter");
-}
-
-void Components::initializeEngine(QQmlEngine *engine, const char *uri)
-{
- Q_UNUSED(uri);
- Q_UNUSED(engine);
-}
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-logger-ofono-1.0.12.tar.bz2/libconnman-qt/plugin/components.h
^
|
@@ -1,28 +0,0 @@
-/*
- * Copyright 2011 Intel Corporation.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0. The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- */
-
-#ifndef COMPONENTS_H
-#define COMPONENTS_H
-#include <QtPlugin>
-
-#include <QtQml>
-#include <QQmlEngine>
-#include <QQmlExtensionPlugin>
-
-class Components : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "MeeGo.Connman")
-
-public:
- void registerTypes(const char *uri);
-
- void initializeEngine(QQmlEngine *engine, const char *uri);
-};
-
-#endif // COMPONENTS_H
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-logger-ofono-1.0.12.tar.bz2/libconnman-qt/plugin/networkingmodel.cpp
^
|
@@ -1,211 +0,0 @@
-/*
- * Copyright © 2010, Intel Corporation.
- * Copyright © 2012, Jolla.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0. The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-#include <QDebug>
-#include "networkingmodel.h"
-
-static const char AGENT_PATH[] = "/WifiSettings";
-
-#define CONNECT_WIFI_SIGNALS(wifi) \
- connect(wifi, \
- SIGNAL(poweredChanged(bool)), \
- this, \
- SIGNAL(wifiPoweredChanged(bool))); \
- connect(wifi, \
- SIGNAL(scanFinished()), \
- this, \
- SIGNAL(scanRequestFinished()))
-
-NetworkingModel::NetworkingModel(QObject* parent)
- : QObject(parent),
- m_manager(NULL),
- m_wifi(NULL)
-{
- m_manager = NetworkManagerFactory::createInstance();
-
- new UserInputAgent(this); // this object will be freed when NetworkingModel is freed
-
- m_wifi = m_manager->getTechnology("wifi"); // TODO: use constant literal
- if (m_wifi) {
- CONNECT_WIFI_SIGNALS(m_wifi);
- }
-
- connect(m_manager, SIGNAL(availabilityChanged(bool)),
- this, SLOT(managerAvailabilityChanged(bool)));
-
- connect(m_manager,
- SIGNAL(technologiesChanged()),
- this,
- SLOT(updateTechnologies()));
-
- connect(m_manager,
- SIGNAL(servicesChanged()),
- this,
- SIGNAL(networksChanged()));
-
- QDBusConnection::systemBus().registerObject(AGENT_PATH, this);
- m_manager->registerAgent(QString(AGENT_PATH));
-}
-
-NetworkingModel::~NetworkingModel()
-{
- m_manager->unregisterAgent(QString(AGENT_PATH));
-}
-
-bool NetworkingModel::isAvailable() const
-{
- return m_manager->isAvailable();
-}
-
-QList<QObject*> NetworkingModel::networks() const
-{
- QList<QObject*> networks;
- // FIXME: how to get rid of this douple looping since we
- // must return a QList<QObject*>?
- Q_FOREACH (NetworkService* network, m_manager->getServices("wifi")) {
- networks.append(network);
- }
- return networks;
-}
-
-bool NetworkingModel::isWifiPowered() const
-{
- if (m_wifi) {
- return m_wifi->powered();
- } else {
- qWarning() << "Can't get: wifi technology is NULL";
- return false;
- }
-}
-
-void NetworkingModel::setWifiPowered(const bool &wifiPowered)
-{
- if (m_wifi) {
- m_wifi->setPowered(wifiPowered);
- } else {
- qWarning() << "Can't set: wifi technology is NULL";
- }
-}
-
-void NetworkingModel::requestScan() const
-{
- qDebug() << "scan requested for wifi";
- if (m_wifi) {
- m_wifi->scan();
- }
-}
-
-void NetworkingModel::updateTechnologies()
-{
- NetworkTechnology *test = NULL;
- if (m_wifi) {
- if ((test = m_manager->getTechnology("wifi")) == NULL) {
- // if wifi is set and manager doesn't return a wifi, it means
- // that wifi was removed
- m_wifi = NULL;
- }
- } else {
- if ((test = m_manager->getTechnology("wifi")) != NULL) {
- // if wifi is not set and manager returns a wifi, it means
- // that wifi was added
- m_wifi = test;
-
- CONNECT_WIFI_SIGNALS(m_wifi);
- }
- }
-
- Q_EMIT technologiesChanged();
-}
-
-void NetworkingModel::managerAvailabilityChanged(bool available)
-{
- if (available)
- m_manager->registerAgent(QString(AGENT_PATH));
-
- Q_EMIT availabilityChanged(available);
-}
-
-void NetworkingModel::requestUserInput(ServiceReqData* data)
-{
- m_req_data = data;
- Q_EMIT userInputRequested(data->fields);
-}
-
-void NetworkingModel::reportError(const QString &error) {
- Q_EMIT errorReported(error);
-}
-
-void NetworkingModel::sendUserReply(const QVariantMap &input) {
- if (!input.isEmpty()) {
- QDBusMessage &reply = m_req_data->reply;
- reply << input;
- QDBusConnection::systemBus().send(reply);
- } else {
- QDBusMessage error = m_req_data->msg.createErrorReply(
- QString("net.connman.Agent.Error.Canceled"),
- QString("canceled by user"));
- QDBusConnection::systemBus().send(error);
- }
- delete m_req_data;
-}
-
-// DBus-adaptor for NetworkingModel /////////////////////
-
-UserInputAgent::UserInputAgent(NetworkingModel* parent)
- : QDBusAbstractAdaptor(parent),
- m_networkingmodel(parent)
-{
- // TODO
-}
-
-UserInputAgent::~UserInputAgent() {}
-
-void UserInputAgent::Release()
-{
- // here do clean up
-}
-
-void UserInputAgent::ReportError(const QDBusObjectPath &service_path, const QString &error)
-{
- qDebug() << "From " << service_path.path() << " got this error:\n" << error;
- m_networkingmodel->reportError(error);
-}
-
-void UserInputAgent::RequestBrowser(const QDBusObjectPath &service_path, const QString &url)
-{
- qDebug() << "Service " << service_path.path() << " wants browser to open hotspot's url " << url;
-}
-
-void UserInputAgent::RequestInput(const QDBusObjectPath &service_path,
- const QVariantMap &fields,
- const QDBusMessage &message)
-{
- qDebug() << "Service " << service_path.path() << " wants user input";
-
- QVariantMap json;
- Q_FOREACH (const QString &key, fields.keys()){
- QVariantMap payload = qdbus_cast<QVariantMap>(fields[key]);
- json.insert(key, payload);
- }
-
- message.setDelayedReply(true);
-
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-logger-ofono-1.0.12.tar.bz2/libconnman-qt/plugin/networkingmodel.h
^
|
@@ -1,98 +0,0 @@
-/*
- * Copyright © 2010, Intel Corporation.
- * Copyright © 2012, Jolla.
- *
- * This program is licensed under the terms and conditions of the
- * Apache License, version 2.0. The full text of the Apache License is at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- */
-
-#ifndef NETWORKINGMODEL_H
-#define NETWORKINGMODEL_H
-
-#include <QDBusAbstractAdaptor>
-#include <networkmanager.h>
-#include <networktechnology.h>
-#include <networkservice.h>
-
-struct ServiceReqData
-{
- QVariantMap fields;
- QDBusMessage reply;
- QDBusMessage msg;
-};
-
-/*
- * WARNING: this class is going to be deprecated. Use TechnologyModel and
- * UserAgent classes instead.
- */
-class NetworkingModel : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(bool available READ isAvailable NOTIFY availabilityChanged)
- Q_PROPERTY(bool wifiPowered READ isWifiPowered WRITE setWifiPowered NOTIFY wifiPoweredChanged)
- Q_PROPERTY(QList<QObject*> networks READ networks NOTIFY networksChanged)
-
-public:
- NetworkingModel(QObject* parent=0);
- virtual ~NetworkingModel();
-
- bool isAvailable() const;
-
- QList<QObject*> networks() const;
- bool isWifiPowered() const;
- void requestUserInput(ServiceReqData* data);
- void reportError(const QString &error);
-
-public Q_SLOTS:
- void setWifiPowered(const bool &wifiPowered);
- void requestScan() const;
- void sendUserReply(const QVariantMap &input);
-
-Q_SIGNALS:
- void availabilityChanged(bool available);
- void wifiPoweredChanged(const bool &wifiPowered);
- void networksChanged();
- void technologiesChanged();
- void userInputRequested(QVariantMap fields);
- void errorReported(const QString &error);
- void scanRequestFinished();
-
-private:
- NetworkManager* m_manager;
- NetworkTechnology* m_wifi;
- ServiceReqData* m_req_data;
-
-private Q_SLOTS:
- void updateTechnologies();
- void managerAvailabilityChanged(bool available);
-
-private:
- Q_DISABLE_COPY(NetworkingModel)
-};
-
-class UserInputAgent : public QDBusAbstractAdaptor
-{
- Q_OBJECT
- Q_CLASSINFO("D-Bus Interface", "net.connman.Agent")
-
-public:
- UserInputAgent(NetworkingModel* parent);
- virtual ~UserInputAgent();
-
-public Q_SLOTS:
- void Release();
- void ReportError(const QDBusObjectPath &service_path, const QString &error);
- void RequestBrowser(const QDBusObjectPath &service_path, const QString &url);
- Q_NOREPLY void RequestInput(const QDBusObjectPath &service_path,
- const QVariantMap &fields,
- const QDBusMessage &message);
- void Cancel();
-
-private:
- NetworkingModel* m_networkingmodel;
-};
-
-#endif //NETWORKINGMODEL_H
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-logger-ofono-1.0.12.tar.bz2/logger/qml/pages/ShareMethodList.qml
^
|
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
- *
- * You may use this file under the terms of BSD license as follows:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import QtQuick 2.0
-import Sailfish.Silica 1.0
-import org.nemomobile.dbus 2.0
-
-SilicaListView {
- id: root
-
- property url source
- property string subject
- property string emailTo
- 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
-
- 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 {
- //% "Add account"
- text: qsTrId("logger-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)
- }
-}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/.gitmodules
^
|
@@ -3,13 +3,13 @@
url = https://github.com/monich/harbour-lib.git
[submodule "libdbuslog"]
path = logger/src/libdbuslog
- url = https://git.merproject.org/mer-core/libdbuslog.git
+ url = https://github.com/monich/libdbuslog.git
[submodule "libglibutil"]
path = logger/src/libglibutil
- url = https://git.merproject.org/mer-core/libglibutil.git
+ url = https://github.com/monich/libglibutil.git
[submodule "libqofonoext"]
path = ofono/src/libqofonoext
- url = https://git.merproject.org/mer-core/libqofonoext.git
+ url = https://github.com/monich/libqofonoext.git
[submodule "libconnman-qt"]
path = libconnman-qt
- url = https://git.merproject.org/mer-core/libconnman-qt.git
+ url = https://github.com/monich/libconnman-qt.git
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/LICENSE
^
|
@@ -1,3 +1,6 @@
+Copyright (C) 2016-2019 Jolla Ltd.
+Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
@@ -7,9 +10,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-logger-ofono-1.0.16.tar.bz2/harbour-lib/LICENSE
^
|
@@ -1,7 +1,7 @@
-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 the BSD license as follows:
+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
@@ -13,9 +13,9 @@
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
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/README
^
|
@@ -0,0 +1,14 @@
+Reusable components for Jolla harbour apps
+==========================================
+
+Some of them allow to access undocumented Sailfish OS features, some
+provide compatibility with older releases of Sailfish OS. This code
+has been tested against Sailfish OS 2.0 meaning that most of it is
+probably incompatible with older versions.
+
+The easiest way to use this code in your project is to add this repo
+as a git submodule to your project and add the files you need to your
+.pro file.
+
+This repository is always work in progress, don't expect any tags,
+formal releases or anything like that.
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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) {
@@ -19,12 +23,22 @@
}
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 \
@@ -33,17 +47,28 @@
greaterThan(QT_MAJOR_VERSION, 4) {
SOURCES += \
src/HarbourImageProvider.cpp \
- src/HarbourPluginLoader.cpp
+ src/HarbourPluginLoader.cpp \
+ src/HarbourTheme.cpp
}
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 \
@@ -52,7 +77,9 @@
greaterThan(QT_MAJOR_VERSION, 4) {
PUBLIC_HEADERS += \
include/HarbourImageProvider.h \
- include/HarbourPluginLoader.h
+ include/HarbourPluginLoader.h \
+ include/HarbourTheme.h
+OTHER_FILES += qml/*.qml
}
HEADERS += \
@@ -61,6 +88,7 @@
OTHER_FILES += \
LICENSE \
+ README \
rpm/harbour-lib-devel.spec
headers.path = $$INSTALL_ROOT$$PREFIX/include/$$TARGET
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/harbour-lib/include/HarbourBase32.h
^
|
@@ -0,0 +1,49 @@
+/*
+ * 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_IMAGE_BASE32_H
+#define HARBOUR_IMAGE_BASE32_H
+
+#include <QString>
+#include <QByteArray>
+
+class HarbourBase32 {
+ class Private;
+ HarbourBase32();
+public:
+ static QByteArray fromBase32(QString aBase32);
+ static QString toBase32(QByteArray aBinary, bool aLowerCase = true);
+ static bool isValidBase32(QString aBase32);
+};
+
+#endif // HARBOUR_IMAGE_BASE32_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/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:
*
@@ -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
@@ -38,17 +38,21 @@
#include <QString>
#include <QSharedPointer>
-class HarbourDisplayBlanking: public QObject
-{
+class QQmlEngine;
+class QJSEngine;
+
+class HarbourDisplayBlanking: public QObject {
Q_OBJECT
Q_PROPERTY(bool paused READ paused NOTIFY pausedChanged)
Q_PROPERTY(bool pauseAllowed READ pauseAllowed NOTIFY pauseAllowedChanged)
Q_PROPERTY(bool pauseRequested READ pauseRequested WRITE setPauseRequested NOTIFY pauseRequestedChanged)
public:
- explicit HarbourDisplayBlanking(QObject* aParent = NULL);
+ explicit HarbourDisplayBlanking(QObject* aParent = Q_NULLPTR);
~HarbourDisplayBlanking();
+ // Callback for qmlRegisterSingletonType<HarbourDisplayBlanking>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
static QSharedPointer<HarbourDisplayBlanking> sharedInstance();
bool paused() const;
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/include/HarbourMediaPlugin.h
^
|
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2017-2020 Jolla Ltd.
+ * Copyright (C) 2017-2020 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
+ */
+
+#ifndef HARBOUR_MEDIA_PLUGIN_H
+#define HARBOUR_MEDIA_PLUGIN_H
+
+#include "HarbourPluginLoader.h"
+
+// Workaround for org.nemomobile.policy (or Sailfish.Media) not being
+// allowed in harbour apps
+
+class HarbourMediaPlugin : public HarbourPluginLoader
+{
+ static HarbourMediaPlugin* gInstance;
+ static const char MEDIAKEY_QML_TYPE[];
+
+public:
+ static void registerTypes(QQmlEngine* aEngine, const char* aModule,
+ int aMajor, int aMinor);
+
+private:
+ HarbourMediaPlugin(QQmlEngine* aEngine);
+ ~HarbourMediaPlugin();
+ void registerTypes(const char* aModule, int aMajor, int aMinor);
+};
+
+#endif // HARBOUR_MEDIA_PLUGIN_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/include/HarbourOrganizeListModel.h
^
|
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HARBOUR_ORGANIZE_LIST_MODEL_H
+#define HARBOUR_ORGANIZE_LIST_MODEL_H
+
+#include <QtQml>
+#include <QSortFilterProxyModel>
+
+// This model helps to implement rearranging list items by dragging.
+// When drag starts, QML sets dragIndex property and then updates
+// dragPos when with the position of the dragged list item. When
+// drag is finished, QML sets dragIndex to -1 and the model calls
+// moveRow() on the underlying (source) model, to finish the move.
+
+class HarbourOrganizeListModel : public QSortFilterProxyModel {
+ Q_OBJECT
+ Q_PROPERTY(QObject* sourceModel READ sourceModel WRITE setSourceModelObject NOTIFY sourceModelObjectChanged)
+ Q_PROPERTY(int dragIndex READ dragIndex WRITE setDragIndex NOTIFY dragIndexChanged)
+ Q_PROPERTY(int dragPos READ dragPos WRITE setDragPos NOTIFY dragPosChanged)
+
+public:
+ HarbourOrganizeListModel(QObject* aParent = Q_NULLPTR);
+ ~HarbourOrganizeListModel();
+
+ void setSourceModelObject(QObject* aModel);
+
+ int dragIndex() const;
+ void setDragIndex(int aIndex);
+
+ int dragPos() const;
+ void setDragPos(int aPos);
+
+ // QAbstractProxyModel
+ QModelIndex mapToSource(const QModelIndex& aIndex) const Q_DECL_OVERRIDE;
+ QModelIndex mapFromSource(const QModelIndex& aIndex) const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void sourceModelObjectChanged();
+ void dragIndexChanged();
+ void dragPosChanged();
+
+private:
+ class Private;
+ Private* iPrivate;
+};
+
+QML_DECLARE_TYPE(HarbourOrganizeListModel)
+
+#endif // HARBOUR_ORGANIZE_LIST_MODEL_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/harbour-lib/include/HarbourPolicyPlugin.h
^
|
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2017-2020 Jolla Ltd.
+ * Copyright (C) 2017-2020 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
+ */
+
+#ifndef HARBOUR_POLICY_PLUGIN_H
+#define HARBOUR_POLICY_PLUGIN_H
+
+#include "HarbourPluginLoader.h"
+
+// Workaround for org.nemomobile.policy (or Nemo.Policy) not being
+// allowed in harbour apps
+
+class HarbourPolicyPlugin : public HarbourPluginLoader
+{
+ static HarbourPolicyPlugin* gInstance;
+ static const char RESOURCE_QML_TYPE[];
+ static const char PERMISSIONS_QML_TYPE[];
+
+public:
+ static void registerTypes(QQmlEngine* aEngine, const char* aModule,
+ int aMajor, int aMinor);
+
+private:
+ HarbourPolicyPlugin(QQmlEngine* aEngine);
+ ~HarbourPolicyPlugin();
+ void registerTypes(const char* aModule, int aMajor, int aMinor);
+};
+
+#endif // HARBOUR_POLICY_PLUGIN_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/include/HarbourQrCodeGenerator.h
^
|
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HARBOUR_QRCODE_GENERATOR_H
+#define HARBOUR_QRCODE_GENERATOR_H
+
+#include <QtQml>
+
+class HarbourQrCodeGenerator : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+ Q_PROPERTY(QString code READ code NOTIFY codeChanged)
+ Q_PROPERTY(QString qrcode READ code NOTIFY codeChanged)
+ Q_PROPERTY(bool running READ running NOTIFY runningChanged)
+
+public:
+ HarbourQrCodeGenerator(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<HarbourQrCodeGenerator>
+ 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(HarbourQrCodeGenerator)
+
+#endif // HARBOUR_QRCODE_GENERATOR_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/include/HarbourQrCodeImageProvider.h
^
|
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HARBOUR_QRCODE_IMAGEPROVIDER_H
+#define HARBOUR_QRCODE_IMAGEPROVIDER_H
+
+#include <QImage>
+#include <QQuickImageProvider>
+
+class HarbourQrCodeImageProvider : public QQuickImageProvider {
+public:
+ HarbourQrCodeImageProvider() : QQuickImageProvider(Image) {}
+
+ static const QColor DEFAULT_COLOR; // Qt::black
+ static const QColor DEFAULT_BACKGROUND; // Qt::transparent
+
+ static QImage createImage(QByteArray aBits, QColor aColor = DEFAULT_COLOR,
+ QColor aBackground = DEFAULT_BACKGROUND);
+
+ QImage requestImage(const QString& aId, QSize* aSize,
+ const QSize& aRequested) Q_DECL_OVERRIDE;
+};
+
+#endif // HARBOUR_QRCODE_IMAGEPROVIDER_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/harbour-lib/include/HarbourSingleImageProvider.h
^
|
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HARBOUR_SINGLE_IMAGE_PROVIDER_H
+#define HARBOUR_SINGLE_IMAGE_PROVIDER_H
+
+#include <QImage>
+#include <QObject>
+#include <QQmlParserStatus>
+
+class HarbourSingleImageProvider : public QObject, public QQmlParserStatus {
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QImage image READ image WRITE setImage NOTIFY imageChanged)
+ Q_PROPERTY(QString source READ source NOTIFY sourceChanged)
+
+public:
+ HarbourSingleImageProvider(QObject* aParent = Q_NULLPTR);
+
+ QImage image() const;
+ void setImage(QImage aImage);
+
+ QString source() const;
+
+ Q_INVOKABLE void clear();
+
+ // QQmlParserStatus
+ void classBegin() Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void imageChanged();
+ void sourceChanged();
+
+private:
+ class Private;
+ class ImageProvider;
+ Private* iPrivate;
+};
+
+#endif // HARBOUR_SINGLE_IMAGE_PROVIDER_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/harbour-lib/include/HarbourSystemState.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2015-2016 Jolla Ltd.
- * Copyright (C) 2015-2017 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:
*
@@ -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
@@ -38,6 +38,9 @@
#include <QString>
#include <QSharedPointer>
+class QQmlEngine;
+class QJSEngine;
+
class HarbourSystemState: public QObject
{
Q_OBJECT
@@ -60,9 +63,11 @@
static const QString MCE_TK_UNLOCKED;
public:
- explicit HarbourSystemState(QObject* aParent = NULL);
+ explicit HarbourSystemState(QObject* aParent = Q_NULLPTR);
~HarbourSystemState();
+ // Callback for qmlRegisterSingletonType<HarbourSystemState>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
static QSharedPointer<HarbourSystemState> sharedInstance();
QString displayStatus() const;
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/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:
@@ -74,6 +78,7 @@
private Q_SLOTS:
void onAboutToQuit();
void onRunFinished();
+ void onTargetDestroyed(QObject* aObject);
private:
class Private;
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/include/HarbourTheme.h
^
|
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HARBOUR_THEME_H
+#define HARBOUR_THEME_H
+
+#include <QObject>
+#include <QColor>
+
+class QQmlEngine;
+class QJSEngine;
+
+class HarbourTheme : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(ColorScheme)
+ Q_PROPERTY(ColorScheme colorScheme READ colorScheme NOTIFY colorSchemeChanged)
+ Q_PROPERTY(QColor invertedPrimaryColor READ invertedPrimaryColor NOTIFY primaryColorChanged)
+ Q_PROPERTY(QColor primaryColor READ primaryColor NOTIFY primaryColorChanged)
+ Q_PROPERTY(bool lightOnDark READ lightOnDark NOTIFY colorSchemeChanged)
+ Q_PROPERTY(bool darkOnLight READ darkOnLight NOTIFY colorSchemeChanged)
+
+ Q_PROPERTY(qreal opacityFaint READ opacityFaint CONSTANT)
+ Q_PROPERTY(qreal opacityLow READ opacityLow CONSTANT)
+ Q_PROPERTY(qreal opacityHigh READ opacityHigh CONSTANT)
+ Q_PROPERTY(qreal opacityOverlay READ opacityOverlay CONSTANT)
+
+public:
+ class Private;
+
+ enum ColorScheme {
+ LightOnDark,
+ DarkOnLight
+ };
+
+ explicit HarbourTheme(QObject* aParent = Q_NULLPTR);
+
+ ~HarbourTheme();
+
+ // Callback for qmlRegisterSingletonType<HarbourTheme>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+
+ QColor invertedPrimaryColor() const;
+ QColor primaryColor() const;
+ ColorScheme colorScheme() const;
+ bool lightOnDark() const;
+ bool darkOnLight() const;
+
+ qreal opacityFaint() const;
+ qreal opacityLow() const;
+ qreal opacityHigh() const;
+ qreal opacityOverlay() const;
+
+ Q_INVOKABLE static QColor invertedColor(const QColor& aColor);
+ Q_INVOKABLE static qreal colorDifference(const QColor& aColor1, const QColor& aColor2);
+
+Q_SIGNALS:
+ void colorSchemeChanged();
+ void primaryColorChanged();
+
+private:
+ QObject* iPrivate;
+};
+
+#endif // HARBOUR_THEME_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/include/HarbourTransferMethodsModel.h
^
|
@@ -1,8 +1,8 @@
/*
- * 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:
+ * 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,36 @@
* 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_TRANSFER_METHODS_MODEL_H
#define HARBOUR_TRANSFER_METHODS_MODEL_H
#include "HarbourTransferMethodInfo.h"
+
#include <QLocale>
-#include <QRegExp>
class QTranslator;
+class QQmlEngine;
+class QJSEngine;
class HarbourTransferMethodsModel: public QAbstractListModel
{
@@ -45,63 +48,43 @@
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 = NULL);
+ explicit HarbourTransferMethodsModel(QObject* aParent = Q_NULLPTR);
~HarbourTransferMethodsModel();
+ // Callback for qmlRegisterSingletonType<HarbourTransferMethodsModel>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+
static bool loadTranslations(QTranslator* aTranslator, QLocale aLocale);
int count() const;
QString filter() const;
void setFilter(QString filter);
bool accountIconSupported() const;
+ bool showAccountsPending() const;
+ bool canShowAccounts() const;
- int rowCount(const QModelIndex& aParent) const;
- QVariant data(const QModelIndex& aIndex, int aRole) const;
-
-protected:
- QHash<int,QByteArray> roleNames() const;
+ Q_INVOKABLE void showAccounts();
-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();
+ // QAbstractListModel
+ QHash<int,QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex& aParent) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex& aIndex, int aRole) const Q_DECL_OVERRIDE;
Q_SIGNALS:
void countChanged();
void filterChanged();
void accountIconSupportedChanged();
+ void showAccountsPendingChanged();
+ void canShowAccountsChanged();
private:
+ class Private;
class TransferEngine;
- TransferEngine* iTransferEngine;
- QString iFilter;
- QList<HarbourTransferMethodInfo2> iMethodList;
- QList<int> iFilteredList;
- bool iAccountIconSupported;
- RequestUpdate iRequestUpdate;
- QDBusPendingCallWatcher* iUpdateWatcher;
+ Private* iPrivate;
};
#endif // HARBOUR_TRANSFER_METHODS_MODEL_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/qml/HarbourBadge.qml
^
|
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2018-2019 Jolla Ltd.
+ * Copyright (C) 2018-2019 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Item {
+ id: badge
+
+ property real maxWidth: parent.width
+ property alias text: label.text
+ readonly property real radius: height/2
+
+ width: Math.max(label.implicitWidth + radius, height)
+ height: Theme.itemSizeSmall/2
+ visible: opacity > 0
+ opacity: text.length ? 1 : 0
+
+ Behavior on opacity { FadeAnimation {} }
+
+ Rectangle {
+ id: background
+
+ anchors.fill: parent
+ color: Theme.rgba(Theme.primaryColor, 0.2)
+ radius: badge.radius
+ }
+
+ HarbourFitLabel {
+ id: label
+
+ font.bold: true
+ maxWidth: Math.max(badge.maxWidth - radius, 2 * radius)
+ maxHeight: Math.floor(parent.height - radius/2)
+ anchors.centerIn: background
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/qml/HarbourFitLabel.qml
^
|
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Label {
+ property int minFontSize: Theme.fontSizeTiny
+ property int maxFontSize: Theme.fontSizeMedium
+ property real maxWidth: width
+ property real maxHeight: height
+ property bool refitting
+
+ smooth: true
+ visible: opacity > 0
+ color: Theme.highlightColor
+ anchors.margins: Theme.paddingMedium
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignHCenter
+
+ Behavior on opacity { FadeAnimation {} }
+
+ Component.onCompleted: {
+ refitting = true
+ font.pixelSize = maxFontSize
+ refitTextRun()
+ refitting = false
+ }
+
+ onMaxWidthChanged: refitText()
+ onMaxHeightChanged: refitText()
+ onTextChanged: refitText()
+ onMaxFontSizeChanged: refitText()
+ onMinFontSizeChanged: refitText()
+
+ function refitText() {
+ if (!refitting) {
+ refitting = true
+ refitTextRun()
+ refitting = false
+ }
+ }
+
+ function refitTextRun() {
+ if (implicitHeight > 0 && implicitWidth > 0) {
+ if (font.pixelSize % 2) font.pixelSize++
+ while ((implicitWidth > maxWidth || implicitHeight > maxHeight || font.pixelSize > maxFontSize) && (font.pixelSize - 2) >= minFontSize) {
+ font.pixelSize -= 2
+ }
+ while (implicitWidth < maxWidth && implicitHeight < maxHeight && (font.pixelSize + 2) <= maxFontSize) {
+ font.pixelSize += 2
+ }
+ if (implicitWidth > maxWidth || implicitHeight > maxHeight) {
+ font.pixelSize -= 2
+ }
+ }
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/harbour-lib/qml/HarbourHintIconButton.qml
^
|
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+MouseArea {
+ property alias icon: image
+ property bool down: pressed && containsMouse
+ property bool highlighted: down
+ property string hint
+
+ signal showHint(var text)
+ signal hideHint()
+
+ width: Theme.itemSizeSmall
+ height: Theme.itemSizeSmall
+
+ readonly property bool _showPress: highlighted || pressTimer.running
+
+ onPressedChanged: {
+ if (pressed) {
+ pressTimer.start()
+ }
+ }
+
+ onClicked: hideHint()
+
+ onReleased: hideHint()
+
+ onPressAndHold: if (hint !== "") showHint(hint)
+
+ onCanceled: {
+ pressTimer.stop()
+ hideHint()
+ }
+
+ Timer {
+ id: pressTimer
+
+ interval: 50
+ }
+
+ HarbourHighlightIcon {
+ id: image
+
+ highlightColor: _showPress ? Theme.highlightColor : Theme.primaryColor
+ sourceSize: Qt.size(Theme.iconSizeMedium, Theme.iconSizeMedium)
+ anchors.centerIn: parent
+ opacity: parent.enabled ? 1.0 : 0.4
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/qml/HarbourHorizontalSwipeHint.qml
^
|
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2019-2020 Jolla Ltd.
+ * Copyright (C) 2019-2020 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Item {
+ id: hint
+
+ anchors.fill: parent
+
+ property bool swipeRight
+ property bool bothWays
+ property bool hintEnabled
+ property alias text: label.text
+ property alias hintDelay: hintDelayTimer.interval
+ property alias loops: touchInteractionHint.loops
+ readonly property bool hintRunning: hintDelayTimer.running || touchInteractionHint.running || label.opacity > 0
+
+ signal hintShown()
+
+ function showHint() {
+ if (!touchInteractionHint.running) {
+ touchInteractionHint.direction = touchInteractionHint.defaultDirection
+ touchInteractionHint.start()
+ }
+ }
+
+ onHintEnabledChanged: {
+ if (hint.hintEnabled) {
+ hintDelayTimer.restart()
+ } else {
+ hintDelayTimer.stop()
+ }
+ }
+
+ Component.onCompleted: if (hint.hintEnabled) hintDelayTimer.start()
+
+ InteractionHintLabel {
+ id: label
+
+ anchors.bottom: parent.bottom
+ opacity: touchInteractionHint.running ? 1.0 : 0.0
+ Behavior on opacity { FadeAnimation { duration: 1000 } }
+ }
+
+ TouchInteractionHint {
+ id: touchInteractionHint
+
+ readonly property int defaultDirection: swipeRight ? TouchInteraction.Right : TouchInteraction.Left
+ readonly property int otherDirection: swipeRight ? TouchInteraction.Left : TouchInteraction.Right
+ anchors.verticalCenter: parent.verticalCenter
+ onRunningChanged: {
+ if (!running) {
+ if (bothWays && direction === defaultDirection) {
+ direction = otherDirection
+ start()
+ } else {
+ hint.hintShown()
+ }
+ }
+ }
+ }
+
+ Timer {
+ id: hintDelayTimer
+
+ interval: 1000
+ onTriggered: showHint()
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/qml/HarbourIconTextButton.qml
^
|
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+MouseArea {
+ property alias icon: image
+ property bool down: pressed && containsMouse
+ property bool highlighted: down
+ property alias iconSource: image.source
+ property alias text: label.text
+
+ readonly property bool _showPress: highlighted || pressTimer.running
+
+ onPressedChanged: {
+ if (pressed) {
+ pressTimer.start()
+ }
+ }
+
+ onCanceled: pressTimer.stop()
+
+ width: Math.max(image.width, label.width)
+ height: image.height + label.height
+
+ HarbourHighlightIcon {
+ id: image
+
+ highlightColor: _showPress ? Theme.highlightColor : Theme.primaryColor
+ sourceSize: Qt.size(Theme.itemSizeSmall, Theme.itemSizeSmall)
+ opacity: parent.enabled ? 1.0 : 0.4
+ anchors {
+ top: parent.top
+ horizontalCenter: parent.horizontalCenter
+ }
+ }
+
+ Label {
+ id: label
+
+ height: text.length ? (implicitHeight + Theme.paddingMedium) : 0
+ opacity: parent.enabled ? 1.0 : 0.4
+ anchors {
+ top: image.bottom
+ horizontalCenter: parent.horizontalCenter
+ }
+ wrapMode: Text.Wrap
+ font.pixelSize: Theme.fontSizeExtraSmall
+ color: _showPress ? Theme.secondaryHighlightColor : Theme.secondaryColor
+ }
+
+ Timer {
+ id: pressTimer
+
+ interval: ('minimumPressHighlightTime' in Theme) ? Theme.minimumPressHighlightTime : 64
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/qml/HarbourPasswordInputField.qml
^
|
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2018 Jolla Ltd.
+ * Copyright (C) 2018 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+TextField {
+ id: field
+
+ property bool showEchoModeToggle: activeFocus
+ property int passwordEchoMode: TextInput.Password
+
+ property bool _usePasswordEchoMode: true
+ property int _buttonLeftMargin: Theme.paddingLarge
+
+ width: (parent ? parent.width : Screen.width) - 2*x
+ textRightMargin: textMargin
+ echoMode: _usePasswordEchoMode ? passwordEchoMode : TextInput.Normal
+ inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
+ placeholderText: label
+
+ //: Default label for password field
+ //% "Password"
+ label: qsTrId("components-la-password")
+
+ function requestFocus() {
+ focusOutBehavior = FocusBehavior.KeepFocus
+ forceActiveFocus()
+ keepFocusTimer.start()
+ }
+
+ Connections {
+ target: Qt.application
+ onActiveChanged: {
+ if (!Qt.application.active) {
+ _usePasswordEchoMode = true
+ }
+ }
+ }
+
+ Timer {
+ id: keepFocusTimer
+
+ interval: 500
+ onTriggered: field.focusOutBehavior = FocusBehavior.ClearItemFocus
+ }
+
+ states: State {
+ name: "showToggle"
+ when: field.showEchoModeToggle
+ PropertyChanges {
+ target: field
+ textRightMargin: field._buttonLeftMargin/2 + passwordVisibilityButton.width + field.textMargin
+ }
+ PropertyChanges {
+ target: passwordVisibilityButton
+ opacity: 1
+ enabled: true
+ }
+ }
+
+ transitions: Transition {
+ from: ""
+ to: "showToggle"
+ reversible: true
+ NumberAnimation {
+ property: "textRightMargin"
+ duration: 50
+ }
+ FadeAnimation {
+ target: passwordVisibilityButton
+ }
+ }
+
+ MouseArea {
+ id: passwordVisibilityButton
+
+ parent: field // ensure the field is visible, avoid auto-parenting to TextBase contentItem
+ x: field.width - width - field.textMargin
+ width: Math.max(textAbc.implicitWidth, textDots.implicitWidth) + field._buttonLeftMargin/2
+ height: field.height - Theme.paddingLarge
+ opacity: 0
+ enabled: false
+
+ onClicked: {
+ field._usePasswordEchoMode = !field._usePasswordEchoMode
+ }
+
+ Text {
+ id: textAbc
+
+ anchors {
+ top: parent.top
+ topMargin: field.textTopMargin
+ horizontalCenter: parent.horizontalCenter
+ }
+ visible: field.echoMode == TextInput.Password
+ font.pixelSize: Theme.fontSizeMedium
+ text: "abc"
+ textFormat: Text.PlainText
+ color: parent.pressed && parent.containsMouse ? Theme.highlightColor : Theme.primaryColor
+ }
+
+ Text {
+ id: textDots
+
+ anchors {
+ top: parent.top
+ topMargin: field.textTopMargin
+ horizontalCenter: parent.horizontalCenter
+ }
+ visible: field.echoMode == TextInput.Normal
+ font.pixelSize: Theme.fontSizeMedium
+ text: "\u2022\u2022\u2022"
+ textFormat: Text.PlainText
+ color: parent.pressed && parent.containsMouse ? Theme.highlightColor : Theme.primaryColor
+ }
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/qml/HarbourShakeAnimation.qml
^
|
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2018 Jolla Ltd.
+ * Copyright (C) 2018 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+SequentialAnimation {
+ id: animation
+
+ property var target
+ property real amplitude: Theme.horizontalPageMargin * 4 / 5
+ property real x: 0
+
+ alwaysRunToEnd: true
+
+ NumberAnimation {
+ target: animation.target
+ property: "x"
+ to: animation.x + animation.amplitude
+ duration: 25
+ easing.type: Easing.InOutSine
+ }
+
+ NumberAnimation {
+ target: animation.target
+ property: "x"
+ from: animation.x + animation.amplitude
+ to: animation.x
+ duration: 500
+ easing.type: Easing.OutElastic
+ easing.amplitude: 2
+ easing.period: 0.2
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/qml/HarbourShareMethodList.qml
^
|
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+SilicaListView {
+ id: view
+
+ property url source
+ property string subject
+ property string emailTo
+ property string type
+
+ width: parent.width
+ height: Theme.itemSizeSmall * model.count
+
+ property string addAccountText: "Add account"
+ readonly property bool accountIconSupported: model.accountIconSupported
+ property var content: []
+ // model: HarbourTransferMethodsModel
+
+ onTypeChanged: content.type = type
+
+ Component.onCompleted: content.type = type
+
+ delegate: BackgroundItem {
+ id: backgroundItem
+ width: view.width
+
+ Image {
+ id: icon
+
+ x: Theme.horizontalPageMargin
+ anchors.verticalCenter: parent.verticalCenter
+ source: accountIcon ? accountIcon :
+ view.accountIconSupported ? "image://theme/icon-m-share" : ""
+ visible: view.accountIconSupported
+ }
+
+ Label {
+ id: displayNameLabel
+
+ text: displayName
+ color: backgroundItem.highlighted ? Theme.highlightColor : Theme.primaryColor
+ truncationMode: TruncationMode.Fade
+ x: Theme.horizontalPageMargin
+ anchors {
+ left: icon.visible ? icon.right : parent.left
+ leftMargin: icon.visible ? Theme.paddingMedium : Theme.horizontalPageMargin
+ verticalCenter: parent.verticalCenter
+ }
+ width: Math.min(implicitWidth, parent.width - 2*Theme.horizontalPageMargin)
+ }
+
+ Label {
+ text: userName
+ font.pixelSize: Theme.fontSizeMedium
+ color: backgroundItem.highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor
+ truncationMode: TruncationMode.Fade
+ anchors {
+ left: displayNameLabel.right
+ leftMargin: Theme.paddingSmall
+ right: parent.right
+ rightMargin: Theme.horizontalPageMargin
+ verticalCenter: parent.verticalCenter
+ }
+ visible: text.length > 0
+ }
+
+ onClicked: {
+ pageStack.push(model.shareUIPath, {
+ source: view.source,
+ content: content,
+ methodId: model.methodId,
+ displayName: model.displayName,
+ accountId: model.accountId,
+ accountName: model.userName,
+ emailTo: view.emailTo,
+ emailSubject: view.subject
+ })
+ }
+ }
+
+ footer: BackgroundItem {
+ enabled: model.canShowAccounts && !model.showAccountsPending
+ opacity: enabled ? 1.0 : 0.4
+
+ Image {
+ id: addAccountIcon
+
+ x: Theme.horizontalPageMargin
+ anchors.verticalCenter: parent.verticalCenter
+ source: view.accountIconSupported ?
+ ("image://theme/icon-m-add" + (parent.highlighted ? "?" + Theme.highlightColor : "")) : ""
+ visible: view.accountIconSupported
+ }
+
+ Label {
+ text: addAccountText
+ x: Theme.horizontalPageMargin
+ anchors {
+ left: addAccountIcon.visible ? addAccountIcon.right : parent.left
+ leftMargin: addAccountIcon.visible ? Theme.paddingMedium : Theme.horizontalPageMargin
+ verticalCenter: parent.verticalCenter
+ }
+ color: highlighted ? Theme.highlightColor : Theme.primaryColor
+ }
+
+ onClicked: model.showAccounts()
+ }
+
+ VerticalScrollDecorator { }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/qml/HarbourTextFlip.qml
^
|
@@ -0,0 +1,102 @@
+/*
+ * 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
+
+Rotation {
+ id: rotation
+
+ 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[property] != rotation.text) {
+ start()
+ }
+ }
+
+ NumberAnimation {
+ easing.type: Easing.InOutSine
+ target: rotation
+ property: "angle"
+ from: 0
+ to: 90
+ duration: rotation.duration/2
+ }
+ ScriptAction { script: target[property] = rotation.text; }
+ NumberAnimation {
+ easing.type: Easing.InOutSine
+ target: rotation
+ property: "angle"
+ to: 0
+ duration: rotation.duration/2
+ }
+ }
+
+ origin {
+ x: target.width / 2
+ y: target.height / 2
+ }
+
+ axis {
+ x: 1
+ y: 0
+ z: 0
+ }
+
+ function flipTo(value) {
+ if (!!target) {
+ animation.start()
+ text = value
+ }
+ }
+
+ function _updateTargetProperty() {
+ if (!!target) {
+ if (enabled) {
+ animation.start()
+ } else if (!animation.running) {
+ target[property] = text
+ }
+ }
+ }
+
+ onTextChanged: _updateTargetProperty()
+ onTargetChanged: _updateTargetProperty()
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/harbour-lib/src/HarbourBase32.cpp
^
|
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourBase32.h"
+
+#include "HarbourDebug.h"
+
+#define BASE32_BITS_PER_NIBBLE (5)
+#define BASE32_BYTES_PER_CHUNK (5)
+#define BASE32_NIBBLES_PER_CHUNK (8)
+#define BASE32_BITS_PER_CHUNK (BASE32_BITS_PER_NIBBLE*BASE32_NIBBLES_PER_CHUNK)
+#define BASE32_NIBBLE_MASK ((1 << BASE32_BITS_PER_NIBBLE) - 1)
+Q_STATIC_ASSERT(BASE32_BITS_PER_CHUNK == BASE32_BYTES_PER_CHUNK * 8);
+
+// ==========================================================================
+// HarbourBase32::Private
+// ==========================================================================
+
+class HarbourBase32::Private {
+public:
+ static char nibbleToBase32(int nibble, char a);
+ static int base32ToNibble(char a);
+};
+
+inline char HarbourBase32::Private::nibbleToBase32(int nibble, char a)
+{
+ return (nibble < 26) ? (a + nibble) : ('2' + (nibble - 26));
+}
+
+inline int HarbourBase32::Private::base32ToNibble(char c)
+{
+ if (c >= 'a' && c <= 'z') {
+ return c - 'a';
+ } else if (c >= 'A' && c <= 'Z') {
+ return c - 'A';
+ } else if (c >= '2' && c <= '7') {
+ return 26 + (c - '2');
+ } else {
+ return -1;
+ }
+}
+
+// ==========================================================================
+// HarbourBase32
+// ==========================================================================
+
+bool HarbourBase32::isValidBase32(QString aBase32)
+{
+ const int n = aBase32.length();
+ const QChar* chars = aBase32.constData();
+
+ qint64 buf = 0;
+ int i, bits = 0;
+ bool empty = true;
+
+ for (i = 0; i < n; i++) {
+ const QChar c = chars[i];
+
+ if (!c.isSpace()) {
+ const char l = c.toLatin1();
+
+ empty = false;
+ if (l == '=') {
+ i++;
+ break;
+ } else {
+ const int nibble = Private::base32ToNibble(l);
+
+ if (nibble < 0) {
+ HDEBUG("Invalid BASE32 character" << c);
+ return false;
+ }
+ bits += BASE32_BITS_PER_NIBBLE;
+ buf <<= BASE32_BITS_PER_NIBBLE;
+ buf += nibble;
+ if (bits == BASE32_BITS_PER_CHUNK) {
+ bits = 0;
+ buf = 0;
+ }
+ }
+ }
+ }
+
+ // Handle padding per RFC 4648
+ if (bits) {
+ while (i < n) {
+ const QChar c = chars[i++];
+
+ if (!c.isSpace()) {
+ empty = false;
+ if (c != '=') {
+ HDEBUG("Invalid BASE32 string" << aBase32);
+ return false;
+ }
+ }
+ }
+ const int realbits = bits/8*8;
+ const int mask = (1 << (bits - realbits)) - 1;
+ if (buf & mask) {
+ return false;
+ }
+ }
+ return !empty;
+}
+
+QByteArray HarbourBase32::fromBase32(QString aBase32)
+{
+ QByteArray out;
+
+ const int n = aBase32.length();
+ const QChar* chars = aBase32.constData();
+
+ qint64 buf = 0;
+ int i, bits = 0;
+ char bytes[BASE32_BYTES_PER_CHUNK];
+
+ out.reserve((n * 5 + 7)/8);
+
+ for (i = 0; i < n; i++) {
+ const QChar c = chars[i];
+
+ if (!c.isSpace()) {
+ const char l = c.toLatin1();
+
+ if (l == '=') {
+ i++;
+ break;
+ } else {
+ const int nibble = Private::base32ToNibble(l);
+
+ if (nibble < 0) {
+ HDEBUG("Invalid BASE32 character" << c);
+ return QByteArray();
+ } else {
+ bits += BASE32_BITS_PER_NIBBLE;
+ buf <<= BASE32_BITS_PER_NIBBLE;
+ buf += nibble;
+ if (bits == BASE32_BITS_PER_CHUNK) {
+ bits = 0;
+ for (int k = BASE32_BYTES_PER_CHUNK; k > 0; k--) {
+ bytes[k - 1] = (char)buf;
+ buf >>= 8;
+ }
+ out.append(bytes, BASE32_BYTES_PER_CHUNK);
+ }
+ }
+ }
+ }
+ }
+
+ // Handle padding per RFC 4648
+ if (bits) {
+ while (i < n) {
+ const QChar c = chars[i++];
+
+ if (!c.isSpace() && c != '=') {
+ HDEBUG("Invalid BASE32 string" << aBase32);
+ return QByteArray();
+ }
+ }
+ const int realbits = bits/8*8;
+ const int mask = (1 << (bits - realbits)) - 1;
+ if (buf & mask) {
+ HDEBUG("Invalid BASE32 string" << aBase32);
+ return QByteArray();
+ } else {
+ buf >>= (bits - realbits);
+ for (int k = realbits / 8; k > 0; k--) {
+ bytes[k - 1] = (char)buf;
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/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:
*
@@ -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
@@ -35,6 +35,8 @@
#include "HarbourDebug.h"
#include "HarbourMce.h"
+#include <QQmlEngine>
+
#include <QDBusMessage>
#include <QDBusConnection>
#include <QDBusPendingCallWatcher>
@@ -45,11 +47,12 @@
// ==========================================================================
// HarbourDisplayBlanking::Private
// ==========================================================================
+
class HarbourDisplayBlanking::Private : public HarbourMce {
Q_OBJECT
public:
- static const int REPEAT_INERVAL_SEC = 50;
+ static const int REPEAT_INTERVAL_SEC = 50;
static const QString BLANK_ACTIVE;
static const QString BLANK_INACTIVE;
static QWeakPointer<HarbourDisplayBlanking> sSharedInstance;
@@ -91,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",
@@ -197,7 +200,7 @@
if (iPauseActive) {
if (!iRepeatTimer) {
iRepeatTimer = new QTimer(this);
- iRepeatTimer->setInterval(REPEAT_INERVAL_SEC * 1000);
+ iRepeatTimer->setInterval(REPEAT_INTERVAL_SEC * 1000);
iRepeatTimer->setSingleShot(false);
connect(iRepeatTimer, SIGNAL(timeout()),
SLOT(onRepeatBlankingRequest()));
@@ -247,6 +250,15 @@
HDEBUG("destroyed");
}
+// Callback for qmlRegisterSingletonType<HarbourDisplayBlanking>
+QObject*
+HarbourDisplayBlanking::createSingleton(
+ QQmlEngine*,
+ QJSEngine*)
+{
+ return new HarbourDisplayBlanking();
+}
+
QSharedPointer<HarbourDisplayBlanking>
HarbourDisplayBlanking::sharedInstance()
{
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/src/HarbourImageProvider.cpp
^
|
@@ -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 the BSD license as follows:
*
@@ -11,12 +11,12 @@
* 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
@@ -32,72 +32,12 @@
*/
#include "HarbourImageProvider.h"
+#include "HarbourTheme.h"
#include "HarbourDebug.h"
#include <QImageReader>
#include <QQuickWindow>
-#include <dlfcn.h>
-
-#define SILICA_SO "/usr/lib/libsailfishsilica.so.1"
-#define SILICA_FUNCTIONS(f) \
- f("_ZN6Silica5Theme8instanceEv", /* Silica::Theme* Silica::Theme::instance() */ \
- HarbourImageProvider::Theme*, Instance,()) \
- f("_ZNK6Silica5Theme5styleEv", /* Silica::Style Silica::Theme::style() const */ \
- HarbourImageProvider::Theme::Style, Style,(HarbourImageProvider::Theme*)) \
- f("_ZNK6Silica5Theme12primaryColorEv", /* QColor Silica::Theme::primaryColor() const */ \
- QColor, PrimaryColor,(HarbourImageProvider::Theme*))
-
-// ==========================================================================
-// HarbourImageProvider::Theme
-// ==========================================================================
-
-class HarbourImageProvider::Theme
-{
-public:
- enum Style {
- StyleLight,
- StyleDark
- };
-
- typedef struct _SilicaFunctions {
- #define SILICA_TYPEDEF(sym,ret,name,args) ret (*name) args;
- SILICA_FUNCTIONS(SILICA_TYPEDEF)
- } SilicaFunctions;
-
- static Theme* instance();
- static Style style(Theme* theme);
-
-public:
- static void* gHandle;
- static SilicaFunctions gSilica;
-};
-
-void* HarbourImageProvider::Theme::gHandle = NULL;
-HarbourImageProvider::Theme::SilicaFunctions HarbourImageProvider::Theme::gSilica;
-
-static const char* SilicaSymbols[] = {
-#define SILICA_SYMBOL(sym,ret,name,args) sym,
- SILICA_FUNCTIONS(SILICA_SYMBOL)
-};
-
-#define _N(a) (sizeof(a)/sizeof((a)[0]))
-#define NUM_FUNCTIONS _N(SilicaSymbols)
-Q_STATIC_ASSERT(sizeof(HarbourImageProvider::Theme::SilicaFunctions) == NUM_FUNCTIONS*sizeof(void*));
-
-HarbourImageProvider::Theme*
-HarbourImageProvider::Theme::instance()
-{
- return gSilica.Instance ? gSilica.Instance() : NULL;
-}
-
-HarbourImageProvider::Theme::Style
-HarbourImageProvider::Theme::style(
- Theme* aTheme)
-{
- return (aTheme && gSilica.Style) ? gSilica.Style(aTheme) : StyleDark;
-}
-
// ==========================================================================
// HarbourImageProvider::TextureFactory
// ==========================================================================
@@ -107,7 +47,7 @@
public:
TextureFactory(QString aPath, QSize requestedSize);
- QSGTexture *createTexture(QQuickWindow *window) const Q_DECL_OVERRIDE;
+ QSGTexture* createTexture(QQuickWindow* aWindow) const Q_DECL_OVERRIDE;
QSize textureSize() const Q_DECL_OVERRIDE;
int textureByteCount() const Q_DECL_OVERRIDE;
QImage image() const Q_DECL_OVERRIDE;
@@ -120,6 +60,7 @@
QString iHighlight;
QSize iRequestedSize;
mutable QImage iImage;
+ HarbourTheme iTheme;
};
HarbourImageProvider::TextureFactory::TextureFactory(
@@ -142,19 +83,38 @@
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()) {
- HDEBUG("loaded" << qPrintable(iPath));
+ if (!iImage.isNull()) {
if (iHighlight.isEmpty()) {
- // Invert grayscale icon colors on inverted ambience
- Theme* theme = Theme::instance();
- if (Theme::style(theme) == Theme::StyleLight &&
- iImage.isGrayscale() &&
- Theme::gSilica.PrimaryColor) {
- iImage = colorize(iImage, Theme::gSilica.PrimaryColor(theme));
+ // Colorize grayscale to match ambience
+ if (iImage.isGrayscale()) {
+ QColor primaryColor(iTheme.primaryColor());
+ if (primaryColor.isValid()) {
+ iImage = colorize(iImage, primaryColor);
+ }
}
} else {
// Colorization required
@@ -254,16 +214,6 @@
HarbourImageProvider::HarbourImageProvider() :
QQuickImageProvider(QQuickImageProvider::Texture)
{
- if (!Theme::gHandle) {
- Theme::gHandle = dlopen(SILICA_SO, RTLD_LAZY);
- if (Theme::gHandle) {
- void** ptr = (void**)&Theme::gSilica;
- for (uint i = 0; i < NUM_FUNCTIONS; i++) {
- ptr[i] = dlsym(Theme::gHandle, SilicaSymbols[i]);
- HDEBUG(SilicaSymbols[i] << (ptr[i] ? "OK" : "missing"));
- }
- }
- }
}
QQuickTextureFactory*
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/src/HarbourMediaPlugin.cpp
^
|
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2017-2020 Jolla Ltd.
+ * Copyright (C) 2017-2020 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
+ */
+
+#include "HarbourMediaPlugin.h"
+#include "HarbourDebug.h"
+
+// Workaround for org.nemomobile.policy (or Sailfish.Media) not being
+// allowed in harbour apps
+
+HarbourMediaPlugin* HarbourMediaPlugin::gInstance = Q_NULLPTR;
+
+const char HarbourMediaPlugin::MEDIAKEY_QML_TYPE[] = "MediaKey";
+
+HarbourMediaPlugin::HarbourMediaPlugin(
+ QQmlEngine* aEngine) :
+ HarbourPluginLoader(aEngine, "Sailfish.Media", 1, 0)
+{
+}
+
+HarbourMediaPlugin::~HarbourMediaPlugin()
+{
+ HASSERT(gInstance == this);
+ gInstance = Q_NULLPTR;
+}
+
+void
+HarbourMediaPlugin::registerTypes(
+ const char* aModule,
+ int aMajor,
+ int aMinor)
+{
+ reRegisterType(MEDIAKEY_QML_TYPE, aModule, aMajor, aMinor);
+}
+
+void
+HarbourMediaPlugin::registerTypes(
+ QQmlEngine* aEngine,
+ const char* aModule,
+ int aMajor,
+ int aMinor)
+{
+ if (!gInstance) {
+ gInstance = new HarbourMediaPlugin(aEngine);
+ }
+ gInstance->registerTypes(aModule, aMajor, aMinor);
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/src/HarbourOrganizeListModel.cpp
^
|
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourOrganizeListModel.h"
+
+#include "HarbourDebug.h"
+
+// ==========================================================================
+// HarbourOrganizeListModel::Private
+// ==========================================================================
+
+class HarbourOrganizeListModel::Private {
+public:
+ Private();
+
+ int mapToSource(int aRow) const;
+ int mapFromSource(int aRow) const;
+
+public:
+ int iDragIndex;
+ int iDragPos;
+ const char* iRowsAboutToBeMovedSlot;
+ const char* iRowsMovedSlot;
+};
+
+HarbourOrganizeListModel::Private::Private() :
+ iDragIndex(-1),
+ iDragPos(-1),
+ iRowsAboutToBeMovedSlot(SLOT(_q_sourceRowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))),
+ iRowsMovedSlot(SLOT(_q_sourceRowsMoved(QModelIndex,int,int,QModelIndex,int)))
+{
+}
+
+int HarbourOrganizeListModel::Private::mapToSource(int aRow) const
+{
+ if (iDragIndex < iDragPos) {
+ if (aRow < iDragIndex || aRow > iDragPos) {
+ return aRow;
+ } else if (aRow == iDragPos) {
+ return iDragIndex;
+ } else {
+ return aRow + 1;
+ }
+ } else if (iDragPos < iDragIndex) {
+ if (aRow < iDragPos || aRow > iDragIndex) {
+ return aRow;
+ } else if (aRow == iDragPos) {
+ return iDragIndex;
+ } else {
+ return aRow - 1;
+ }
+ }
+ return aRow;
+}
+
+int HarbourOrganizeListModel::Private::mapFromSource(int aRow) const
+{
+ if (iDragIndex < iDragPos) {
+ if (aRow < iDragIndex || aRow > iDragPos) {
+ return aRow;
+ } else if (aRow == iDragIndex) {
+ return iDragPos;
+ } else {
+ return aRow - 1;
+ }
+ } else if (iDragPos < iDragIndex) {
+ if (aRow < iDragPos || aRow > iDragIndex) {
+ return aRow;
+ } else if (aRow == iDragIndex) {
+ return iDragPos;
+ } else {
+ return aRow + 1;
+ }
+ }
+ return aRow;
+}
+
+// ==========================================================================
+// HarbourOrganizeListModel
+// ==========================================================================
+
+#define SUPER QSortFilterProxyModel
+
+HarbourOrganizeListModel::HarbourOrganizeListModel(QObject* aParent) :
+ SUPER(aParent),
+ iPrivate(new Private)
+{
+ connect(this, SIGNAL(sourceModelChanged()), SIGNAL(sourceModelObjectChanged()));
+}
+
+HarbourOrganizeListModel::~HarbourOrganizeListModel()
+{
+ delete iPrivate;
+}
+
+void HarbourOrganizeListModel::setSourceModelObject(QObject* aModel)
+{
+ setSourceModel(qobject_cast<QAbstractItemModel*>(aModel));
+}
+
+int HarbourOrganizeListModel::dragIndex() const
+{
+ return iPrivate->iDragIndex;
+}
+
+int HarbourOrganizeListModel::dragPos() const
+{
+ return iPrivate->iDragPos;
+}
+
+QModelIndex HarbourOrganizeListModel::mapToSource(const QModelIndex& aIndex) const
+{
+ QAbstractItemModel* source = sourceModel();
+ if (source) {
+ return source->index(iPrivate->mapToSource(aIndex.row()), aIndex.column());
+ }
+ return aIndex;
+}
+
+QModelIndex HarbourOrganizeListModel::mapFromSource(const QModelIndex& aIndex) const
+{
+ return index(iPrivate->mapFromSource(aIndex.row()), aIndex.column());
+}
+
+void HarbourOrganizeListModel::setDragIndex(int aIndex)
+{
+ HDEBUG(aIndex);
+ if (aIndex < 0) {
+ if (iPrivate->iDragIndex >= 0) {
+ // Drag is finished
+ if (iPrivate->iDragPos != iPrivate->iDragIndex) {
+ const int dragIndex = iPrivate->iDragIndex;
+ const int dragPos = iPrivate->iDragPos;
+ iPrivate->iDragPos = iPrivate->iDragIndex = -1;
+ QAbstractItemModel* source = sourceModel();
+ if (source) {
+ //
+ // Now, this is getting a bit hackish.
+ //
+ // We don't need QSortFilterProxyModel to react to
+ // rowsAboutToBeMoved and rowsMoved signals emitted
+ // by the source model when we invoke moveRow() because
+ // that would result in layoutChanged signal which
+ // would reset the view (its current position etc).
+ // That's totally unnecessary because all the rows
+ // are already in the right place as long as the view
+ // is concerned.
+ //
+ // It looks a bit fragile since these slots are
+ // internal and can change at any point of time.
+ // Well, in the worst case we would get the view
+ // reset.
+ //
+ QObject::disconnect(source,
+ SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, iPrivate->iRowsAboutToBeMovedSlot);
+ QObject::disconnect(source,
+ SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, iPrivate->iRowsMovedSlot);
+
+ // Actually move the row
+ source->moveRow(QModelIndex(), dragIndex, QModelIndex(), dragPos);
+
+ // And (hopefully) reconnect the handlers.
+ QObject::connect(source,
+ SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, iPrivate->iRowsAboutToBeMovedSlot);
+ QObject::connect(source,
+ SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/harbour-lib/src/HarbourQrCodeGenerator.cpp
^
|
@@ -0,0 +1,215 @@
+/*
+ * 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 "HarbourQrCodeGenerator.h"
+
+#include "HarbourBase32.h"
+#include "HarbourTask.h"
+#include "HarbourDebug.h"
+
+#include <QThreadPool>
+
+#include "qrencode.h"
+
+// ==========================================================================
+// HarbourQrCodeGenerator::Task
+// ==========================================================================
+
+class HarbourQrCodeGenerator::Task : public HarbourTask {
+ Q_OBJECT
+public:
+ Task(QThreadPool* aPool, QString aText);
+ void performTask() Q_DECL_OVERRIDE;
+public:
+ QString iText;
+ QString iCode;
+};
+
+HarbourQrCodeGenerator::Task::Task(QThreadPool* aPool, QString aText) :
+ HarbourTask(aPool),
+ iText(aText)
+{
+}
+
+void HarbourQrCodeGenerator::Task::performTask()
+{
+ QByteArray bytes(generate(iText));
+ if (!bytes.isEmpty()) {
+ iCode = HarbourBase32::toBase32(bytes);
+ }
+}
+
+// ==========================================================================
+// HarbourQrCodeGenerator::Private
+// ==========================================================================
+
+class HarbourQrCodeGenerator::Private : public QObject {
+ Q_OBJECT
+
+public:
+ Private(HarbourQrCodeGenerator* aParent);
+ ~Private();
+
+ HarbourQrCodeGenerator* parentObject() const;
+ void setText(QString aValue);
+
+public Q_SLOTS:
+ void onTaskDone();
+
+public:
+ QThreadPool* iThreadPool;
+ Task* iTask;
+ QString iText;
+ QString iCode;
+};
+
+HarbourQrCodeGenerator::Private::Private(HarbourQrCodeGenerator* aParent) :
+ QObject(aParent),
+ iThreadPool(new QThreadPool(this)),
+ iTask(Q_NULLPTR)
+{
+ // Serialize the tasks:
+ iThreadPool->setMaxThreadCount(1);
+}
+
+HarbourQrCodeGenerator::Private::~Private()
+{
+ iThreadPool->waitForDone();
+}
+
+inline HarbourQrCodeGenerator* HarbourQrCodeGenerator::Private::parentObject() const
+{
+ return qobject_cast<HarbourQrCodeGenerator*>(parent());
+}
+
+void HarbourQrCodeGenerator::Private::setText(QString aText)
+{
+ if (iText != aText) {
+ iText = aText;
+ HarbourQrCodeGenerator* 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 HarbourQrCodeGenerator::Private::onTaskDone()
+{
+ if (sender() == iTask) {
+ HarbourQrCodeGenerator* obj = parentObject();
+ const bool qrCodeChanged = (iCode != iTask->iCode);
+ iCode = iTask->iCode;
+ iTask->release();
+ iTask = NULL;
+ if (qrCodeChanged) {
+ Q_EMIT obj->codeChanged();
+ }
+ Q_EMIT obj->runningChanged();
+ }
+}
+
+// ==========================================================================
+// HarbourQrCodeGenerator
+// ==========================================================================
+
+HarbourQrCodeGenerator::HarbourQrCodeGenerator(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private(this))
+{
+}
+
+// Callback for qmlRegisterSingletonType<HarbourQrCodeGenerator>
+QObject* HarbourQrCodeGenerator::createSingleton(QQmlEngine* aEngine, QJSEngine*)
+{
+ return new HarbourQrCodeGenerator(aEngine);
+}
+
+QString HarbourQrCodeGenerator::text() const
+{
+ return iPrivate->iText;
+}
+
+void HarbourQrCodeGenerator::setText(QString aValue)
+{
+ iPrivate->setText(aValue);
+}
+
+QString HarbourQrCodeGenerator::code() const
+{
+ return iPrivate->iCode;
+}
+
+bool HarbourQrCodeGenerator::running() const
+{
+ return iPrivate->iTask != Q_NULLPTR;
+}
+
+QByteArray HarbourQrCodeGenerator::generate(QString aText)
+{
+ QByteArray in(aText.toUtf8()), out;
+ QRcode* code = QRcode_encodeString(in.constData(), 0, QR_ECLEVEL_M, QR_MODE_8, true);
+ if (code) {
+ const int bytesPerRow = (code->width + 7) / 8;
+ if (bytesPerRow > 0) {
+ out.reserve(bytesPerRow * code->width);
+ for (int y = 0; y < code->width; y++) {
+ const unsigned char* row = code->data + (code->width * y);
+ char c = (row[0] & 1);
+ int x = 1;
+ for (; x < code->width; x++) {
+ if (!(x % 8)) {
+ out.append(&c, 1);
+ c = row[x] & 1;
+ } else {
+ c = (c << 1) | (row[x] & 1);
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/src/HarbourQrCodeImageProvider.cpp
^
|
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourQrCodeImageProvider.h"
+
+#include "HarbourBase32.h"
+#include "HarbourDebug.h"
+
+#include <QVector>
+#include <QColor>
+#include <QRgb>
+
+const QColor HarbourQrCodeImageProvider::DEFAULT_COLOR(Qt::black);
+const QColor HarbourQrCodeImageProvider::DEFAULT_BACKGROUND(Qt::transparent);
+
+QImage HarbourQrCodeImageProvider::createImage(QByteArray aBits, QColor aColor, QColor aBackground)
+{
+ if (aBits.size() > 0) {
+ // Bits are packed, rows are rounded at byte boundary
+ int rows, rowSize;
+ for (rows = 2; ((rowSize = (rows + 7)/8) * rows) < aBits.size(); rows++);
+ if ((rows * rowSize) == aBits.size()) {
+ HDEBUG(rows << "x" << rows);
+ QImage img(rows, rows, QImage::Format_Mono);
+ QVector<QRgb> colors;
+ QColor background(aBackground.isValid() ? aBackground : DEFAULT_BACKGROUND);
+ QColor color(aColor.isValid() ? aColor : DEFAULT_COLOR);
+ colors.append(background.rgba());
+ colors.append(color.rgba());
+ img.setColorTable(colors);
+ for (int y = 0; y < rows; y++) {
+ memcpy(img.scanLine(y), aBits.constData() + y * rowSize, rowSize);
+ }
+ return img;
+ }
+ }
+ return QImage();
+}
+
+QImage HarbourQrCodeImageProvider::requestImage(const QString& aId, QSize* aSize, const QSize&)
+{
+ // Default background and foreground
+ QColor background(DEFAULT_BACKGROUND), color(DEFAULT_COLOR);
+
+ // Parse parameters
+ QString base32;
+ const int sep = aId.indexOf('?');
+ if (sep < 0) {
+ base32 = aId;
+ } else {
+ base32 = aId.left(sep);
+ const QStringList params(aId.mid(sep + 1).split('&', QString::SkipEmptyParts));
+ const int n = params.count();
+ for (int i = 0; i < n; i++) {
+ const QString param(params.at(i));
+ const int eq = param.indexOf('=');
+ if (eq > 0) {
+ static const QString BACKGROUND("background");
+ static const QString COLOR("color");
+ const QString name(param.left(eq).trimmed());
+ const QString value(param.mid(eq + 1).trimmed());
+ if (name == COLOR) {
+ const QColor colorValue(value);
+ if (colorValue.isValid()) {
+ color = colorValue;
+ } else {
+ HDEBUG("Invalid" << qPrintable(name) << value);
+ }
+ } else if (name == BACKGROUND) {
+ const QColor colorValue(value);
+ if (colorValue.isValid()) {
+ background = colorValue;
+ } else {
+ HDEBUG("Invalid" << qPrintable(name) << value);
+ }
+ } else {
+ HDEBUG("Invalid parameter name" << name);
+ }
+ } else {
+ HDEBUG("Invalid parameter" << param);
+ }
+ }
+ }
+
+ // Decode BASE32
+ const QByteArray bits(HarbourBase32::fromBase32(base32.toLocal8Bit()));
+ HDEBUG(base32 << "=>" << bits.size() << "bytes");
+
+ // Convert to image
+ QImage img(createImage(bits, color, background));
+ if (!img.isNull() && aSize) {
+ *aSize = img.size();
+ }
+
+ return img;
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/harbour-lib/src/HarbourSingleImageProvider.cpp
^
|
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourSingleImageProvider.h"
+
+#include "HarbourDebug.h"
+
+#include <QQuickImageProvider>
+#include <QQmlEngine>
+#include <QQmlContext>
+
+// ==========================================================================
+// HarbourSingleImageProvider::ImageProvider
+// ==========================================================================
+
+class HarbourSingleImageProvider::ImageProvider : public QQuickImageProvider {
+public:
+ static const QString IMAGE_NAME;
+
+ ImageProvider(QImage aImage);
+
+ QImage requestImage(const QString& aId, QSize* aSize,
+ const QSize& aRequested) Q_DECL_OVERRIDE;
+
+private:
+ QImage iImage;
+};
+
+const QString HarbourSingleImageProvider::ImageProvider::IMAGE_NAME("image");
+
+HarbourSingleImageProvider::ImageProvider::ImageProvider(QImage aImage) :
+ QQuickImageProvider(Image),
+ iImage(aImage)
+{
+}
+
+QImage HarbourSingleImageProvider::ImageProvider::requestImage(const QString& aId,
+ QSize* aSize, const QSize& aRequested)
+{
+ HDEBUG(aId);
+ if (aSize) {
+ *aSize = iImage.size();
+ }
+ return iImage;
+}
+
+// ==========================================================================
+// HarbourSingleImageProvider::Private
+// ==========================================================================
+
+class HarbourSingleImageProvider::Private : public QObject {
+ Q_OBJECT
+
+public:
+ Private(HarbourSingleImageProvider* aParent);
+ ~Private();
+
+ bool setEngine(QQmlEngine* aEngine);
+ bool setImage(QImage aImage);
+ void registerProvider();
+
+public Q_SLOTS:
+ void onEngineDied();
+
+public:
+ QImage iImage;
+ QString iId;
+ QString iSourceUri;
+ QQmlEngine* iEngine;
+};
+
+HarbourSingleImageProvider::Private::Private(HarbourSingleImageProvider* aParent) :
+ QObject(aParent),
+ iEngine(Q_NULLPTR)
+{
+}
+
+HarbourSingleImageProvider::Private::~Private()
+{
+ if (!iId.isEmpty()) {
+ iEngine->removeImageProvider(iId);
+ }
+}
+
+void HarbourSingleImageProvider::Private::registerProvider()
+{
+ QQmlImageProviderBase* provider = new ImageProvider(iImage);
+ iId = QString().sprintf("HarbourSingleImageProvider%p", provider);
+ iSourceUri = QString("image://%1/%2").arg(iId, ImageProvider::IMAGE_NAME);
+ HDEBUG("registering provider" << iId);
+ iEngine->addImageProvider(iId, provider);
+}
+
+bool HarbourSingleImageProvider::Private::setEngine(QQmlEngine* aEngine)
+{
+ if (iEngine) {
+ if (!iId.isEmpty()) {
+ iEngine->removeImageProvider(iId);
+ iId = QString();
+ }
+ iEngine->disconnect(this);
+ }
+ iEngine = aEngine;
+ if (iEngine) {
+ connect(iEngine, SIGNAL(destroyed(QObject*)), SLOT(onEngineDied()));
+ if (!iImage.isNull()) {
+ registerProvider();
+ return true;
+ }
+ }
+ return false;
+}
+
+bool HarbourSingleImageProvider::Private::setImage(QImage aImage)
+{
+ HDEBUG(aImage);
+ if (!iId.isEmpty()) {
+ iEngine->removeImageProvider(iId);
+ }
+ iImage = aImage;
+ if (iEngine && !iImage.isNull()) {
+ registerProvider();
+ return true;
+ }
+ return false;
+}
+
+void HarbourSingleImageProvider::Private::onEngineDied()
+{
+ HDEBUG("engine died");
+ iEngine = Q_NULLPTR;
+ iId = QString();
+}
+
+// ==========================================================================
+// HarbourSingleImageProvider
+// ==========================================================================
+
+HarbourSingleImageProvider::HarbourSingleImageProvider(QObject* aParent) :
+ QObject(aParent),
+ iPrivate(new Private(this))
+{
+}
+
+void HarbourSingleImageProvider::classBegin()
+{
+}
+
+void HarbourSingleImageProvider::componentComplete()
+{
+ QQmlContext* context = QQmlEngine::contextForObject(this);
+ HDEBUG(context);
+ if (context) {
+ QQmlEngine* engine = context->engine();
+ HDEBUG(engine);
+ if (iPrivate->setEngine(engine)) {
+ Q_EMIT sourceChanged();
+ }
+ }
+}
+
+QImage HarbourSingleImageProvider::image() const
+{
+ return iPrivate->iImage;
+}
+
+void HarbourSingleImageProvider::setImage(QImage aImage)
+{
+ HDEBUG(aImage);
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/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:
*
@@ -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
@@ -35,6 +35,8 @@
#include "HarbourDebug.h"
#include "HarbourMce.h"
+#include <QQmlEngine>
+
#include <QDBusMessage>
#include <QDBusConnection>
#include <QDBusPendingCall>
@@ -190,6 +192,15 @@
HDEBUG("destroyed");
}
+// Callback for qmlRegisterSingletonType<HarbourSystemState>
+QObject*
+HarbourSystemState::createSingleton(
+ QQmlEngine*,
+ QJSEngine*)
+{
+ return new HarbourSystemState();
+}
+
QSharedPointer<HarbourSystemState>
HarbourSystemState::sharedInstance()
{
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/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-logger-ofono-1.0.16.tar.bz2/harbour-lib/src/HarbourTask.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2019 Jolla Ltd.
+ * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -14,9 +14,9 @@
* 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
@@ -47,18 +47,22 @@
public:
QThreadPool* iPool;
- bool iAboutToQuit;
+ QObject* iTarget;
+ bool iStarted; // These two flags are set by the worker thread
+ bool iFinished;
+ bool iAboutToQuit; // All other flags are set by the main thread
bool iSubmitted;
- bool iStarted;
bool iReleased;
bool iDone;
};
HarbourTask::Private::Private(QThreadPool* aPool) :
iPool(aPool),
+ iTarget(NULL),
+ iStarted(false),
+ iFinished(false),
iAboutToQuit(false),
iSubmitted(false),
- iStarted(false),
iReleased(false),
iDone(false)
{
@@ -81,8 +85,12 @@
HarbourTask::~HarbourTask()
{
- HASSERT(iPrivate->iReleased);
- if (iPrivate->iSubmitted) wait();
+ // 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;
}
@@ -108,19 +116,26 @@
void HarbourTask::submit(QObject* aTarget, const char* aSlot)
{
+ HASSERT(!iPrivate->iTarget);
+ iPrivate->iTarget = aTarget;
+ connect(aTarget, SIGNAL(destroyed(QObject*)), SLOT(onTargetDestroyed(QObject*)));
aTarget->connect(this, SIGNAL(done()), aSlot);
submit();
}
void HarbourTask::release(QObject* aHandler)
{
+ aHandler->disconnect(this);
disconnect(aHandler);
released();
}
void HarbourTask::release()
{
- disconnect();
+ if (iPrivate->iTarget) {
+ iPrivate->iTarget->disconnect(this);
+ disconnect(iPrivate->iTarget);
+ }
released();
}
@@ -136,7 +151,10 @@
{
HASSERT(!iPrivate->iStarted);
iPrivate->iStarted = true;
- performTask();
+ if (!isCanceled()) {
+ performTask();
+ }
+ iPrivate->iFinished = true;
Q_EMIT runFinished();
}
@@ -157,3 +175,12 @@
HDEBUG("OK");
iPrivate->iAboutToQuit = true;
}
+
+void HarbourTask::onTargetDestroyed(QObject* aObject)
+{
+ HDEBUG(aObject);
+ HASSERT(iPrivate->iTarget == aObject);
+ if (iPrivate->iTarget == aObject) {
+ iPrivate->iTarget = NULL;
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/src/HarbourTheme.cpp
^
|
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourTheme.h"
+#include "HarbourSystem.h"
+#include "HarbourDebug.h"
+
+#include <QQmlEngine>
+
+#include <dlfcn.h>
+
+#define SILICA_SO "libsailfishsilica.so.1"
+#define SILICA_FUNCTIONS(f) \
+ f("_ZN6Silica5Theme8instanceEv", /* Silica::Theme* Silica::Theme::instance() */ \
+ QObject*, instance,()) \
+ f("_ZNK6Silica5Theme5styleEv", /* Silica::Style Silica::Theme::style() const */ \
+ HarbourTheme::Private::Style, style,(QObject*)) \
+ f("_ZNK6Silica5Theme11colorSchemeEv", /* Silica::ColorScheme Silica::Theme::colorScheme() const */ \
+ HarbourTheme::ColorScheme, colorScheme,(QObject*)) \
+ f("_ZNK6Silica5Theme12primaryColorEv", /* QColor Silica::Theme::primaryColor() const */ \
+ QColor, primaryColor,(QObject*)) \
+ f("_ZNK6Silica5Theme12opacityFaintEv", /* qreal Silica::Theme::opacityFaint() const */ \
+ qreal, opacityFaint,(QObject*)) \
+ f("_ZNK6Silica5Theme10opacityLowEv", /* qreal Silica::Theme::opacityLow() const */ \
+ qreal, opacityLow,(QObject*)) \
+ f("_ZNK6Silica5Theme11opacityHighEv", /* qreal Silica::Theme::opacityHigh() const */ \
+ qreal, opacityHigh,(QObject*)) \
+ f("_ZNK6Silica5Theme14opacityOverlayEv", /* qreal Silica::Theme::opacityOverlay() const */ \
+ qreal, opacityOverlay,(QObject*))
+
+// ==========================================================================
+// HarbourTheme::Private
+// ==========================================================================
+
+class HarbourTheme::Private
+{
+public:
+ enum Style {
+ StyleLight,
+ StyleDark
+ };
+
+ typedef struct _SilicaFunctions {
+ #define SILICA_TYPEDEF(sym,ret,name,args) ret (*name) args;
+ SILICA_FUNCTIONS(SILICA_TYPEDEF)
+ } SilicaFunctions;
+
+ static const qreal DEFAULT_OPACITY_FAINT;
+ static const qreal DEFAULT_OPACITY_LOW;
+ static const qreal DEFAULT_OPACITY_HIGH;
+ static const qreal DEFAULT_OPACITY_OVERLAY;
+
+ static void* gHandle;
+ static SilicaFunctions gSilica;
+
+public:
+ static QObject* instance();
+ static ColorScheme colorScheme();
+ static QColor primaryColor();
+ static qreal opacityFaint();
+ static qreal opacityLow();
+ static qreal opacityHigh();
+ static qreal opacityOverlay();
+};
+
+void* HarbourTheme::Private::gHandle;
+HarbourTheme::Private::SilicaFunctions HarbourTheme::Private::gSilica;
+
+const qreal HarbourTheme::Private::DEFAULT_OPACITY_FAINT = 0.2;
+const qreal HarbourTheme::Private::DEFAULT_OPACITY_LOW = 0.4;
+const qreal HarbourTheme::Private::DEFAULT_OPACITY_HIGH = 0.6;
+const qreal HarbourTheme::Private::DEFAULT_OPACITY_OVERLAY = 0.8;
+
+static const char* SilicaSymbols[] = {
+#define SILICA_SYMBOL(sym,ret,name,args) sym,
+ SILICA_FUNCTIONS(SILICA_SYMBOL)
+};
+
+#define _N(a) (sizeof(a)/sizeof((a)[0]))
+#define NUM_FUNCTIONS _N(SilicaSymbols)
+Q_STATIC_ASSERT(sizeof(HarbourTheme::Private::SilicaFunctions) == NUM_FUNCTIONS*sizeof(void*));
+
+QObject* HarbourTheme::Private::instance()
+{
+ return gSilica.instance ? gSilica.instance() : Q_NULLPTR;
+}
+
+HarbourTheme::ColorScheme HarbourTheme::Private::colorScheme()
+{
+ QObject* silica = instance();
+ if (silica) {
+ if (gSilica.colorScheme) {
+ return gSilica.colorScheme(silica);
+ } else if (gSilica.style) {
+ gSilica.style(silica);
+ }
+ }
+ return LightOnDark;
+}
+
+QColor HarbourTheme::Private::primaryColor()
+{
+ QObject* silica = instance();
+ return (silica && gSilica.primaryColor) ? gSilica.primaryColor(silica) : QColor();
+}
+
+qreal HarbourTheme::Private::opacityFaint()
+{
+ QObject* silica = instance();
+ return (silica && gSilica.opacityFaint) ? gSilica.opacityFaint(silica) :
+ DEFAULT_OPACITY_FAINT;
+}
+
+qreal HarbourTheme::Private::opacityLow()
+{
+ QObject* silica = instance();
+ return (silica && gSilica.opacityLow) ? gSilica.opacityLow(silica) :
+ DEFAULT_OPACITY_LOW;
+}
+
+qreal HarbourTheme::Private::opacityHigh()
+{
+ QObject* silica = instance();
+ return (silica && gSilica.opacityHigh) ? gSilica.opacityHigh(silica) :
+ DEFAULT_OPACITY_HIGH;
+}
+
+qreal HarbourTheme::Private::opacityOverlay()
+{
+ QObject* silica = instance();
+ return (silica && gSilica.opacityOverlay) ? gSilica.opacityOverlay(silica) :
+ DEFAULT_OPACITY_OVERLAY;
+}
+
+// ==========================================================================
+// HarbourTheme
+// ==========================================================================
+
+HarbourTheme::HarbourTheme(QObject* aParent) : QObject(aParent)
+{
+ if (!Private::gHandle) {
+ Private::gHandle = HarbourDlopen(SILICA_SO, RTLD_LAZY);
+ if (Private::gHandle) {
+ void** ptr = (void**)&Private::gSilica;
+ for (uint i = 0; i < NUM_FUNCTIONS; i++) {
+ ptr[i] = dlsym(Private::gHandle, SilicaSymbols[i]);
+ HDEBUG(SilicaSymbols[i] << (ptr[i] ? "OK" : "missing"));
+ }
+ }
+ }
+ QObject* silica = Private::instance();
+ if (silica) {
+ if (Private::gSilica.colorScheme) {
+ // Colors update is delayed, queue this signal
+ QObject::connect(silica,
+ SIGNAL(colorSchemeChanged()),
+ SIGNAL(colorSchemeChanged()),
+ Qt::QueuedConnection);
+ }
+ if (Private::gSilica.primaryColor) {
+ QObject::connect(silica,
+ SIGNAL(primaryColorChanged()),
+ SIGNAL(primaryColorChanged()));
+ }
+ }
+}
+
+HarbourTheme::~HarbourTheme()
+{
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-lib/src/HarbourTransferMethodsModel.cpp
^
|
@@ -1,8 +1,8 @@
/*
- * 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:
+ * 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,29 +11,32 @@
* 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 "HarbourTransferMethodsModel.h"
#include "HarbourDebug.h"
#include <QTranslator>
+#include <QQmlEngine>
+#include <QRegExp>
// ==========================================================================
// HarbourTransferMethodsModel::TransferEngine
@@ -43,75 +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;
}
-bool HarbourTransferMethodsModel::loadTranslations(QTranslator* aTranslator, QLocale aLocale)
+inline HarbourTransferMethodsModel* HarbourTransferMethodsModel::Private::parentModel()
{
- if (aTranslator->load(aLocale, "sailfish_transferengine_plugins", "-",
- "/usr/share/translations")) {
- return true;
- } else {
- HWARN("Failed to load transferengine plugin translator for" << aLocale);
- return false;
- }
+ return qobject_cast<HarbourTransferMethodsModel*>(parent());
}
-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)
{
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/harbour-logger.pro
^
|
@@ -1,4 +1,8 @@
TEMPLATE = subdirs
-SUBDIRS = harbour-lib logger ofono
-ofono.depends = harbour-lib logger
-OTHER_FILES += rpm/*.spec
+SUBDIRS = logger nfc ofono
+logger.target = logger-common
+nfc.target = logger-nfc
+nfc.depends = logger-common
+ofono.target = logger-ofono
+ofono.depends = logger-common
+OTHER_FILES += LICENSE rpm/*.spec
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/README.rst
^
|
@@ -13,11 +13,6 @@
`UserAgent` is a QML component providing `net.connman.Agent` D-Bus interface.
-The class `NetworkingModel` is a QML component adapting a static instance of
-`NetworkManager`. Also it provides the D-Bus interface `net.connman.Agent`.
-
-.. warning:: `NetworkingModel` is going to be deprecated.
-
These classes are written to be re-usable in the qml environment, by setting the
path property to that of an appropriate dbus path, will re-initialize the object to be used for the path given.
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/clockmodel.h
^
|
@@ -51,9 +51,6 @@
void setDate(QDate date);
void setTime(QTime time);
- // helper function for Timepicker
- QTime time(QString h, QString m) { return QTime(h.toInt(), m.toInt()); }
-
Q_SIGNALS:
void timezoneChanged();
void timezoneUpdatesChanged();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/commondbustypes.cpp
^
|
@@ -1,13 +1,45 @@
/*
- * Copyright © 2010, Intel Corporation.
+ * Copyright © 2010 Intel Corporation.
+ * Copyright © 2012-2017 Jolla Ltd.
+ * Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
- *
*/
-#include "commondbustypes.h"
+#include "libconnman_p.h"
+
+#define CONNMAN_ERROR "net.connman.Error"
+
+const QString ConnmanError::Failed(CONNMAN_ERROR ".Failed");
+const QString ConnmanError::InvalidArguments(CONNMAN_ERROR ".InvalidArguments");
+const QString ConnmanError::PermissionDenied(CONNMAN_ERROR ".PermissionDenied");
+const QString ConnmanError::PassphraseRequired(CONNMAN_ERROR ".PassphraseRequired");
+const QString ConnmanError::NotRegistered(CONNMAN_ERROR ".NotRegistered");
+const QString ConnmanError::NotUnique(CONNMAN_ERROR ".NotUnique");
+const QString ConnmanError::NotSupported(CONNMAN_ERROR ".NotSupported");
+const QString ConnmanError::NotImplemented(CONNMAN_ERROR ".NotImplemented");
+const QString ConnmanError::NotFound(CONNMAN_ERROR ".NotFound");
+const QString ConnmanError::NoCarrier(CONNMAN_ERROR ".NoCarrier");
+const QString ConnmanError::InProgress(CONNMAN_ERROR ".InProgress");
+const QString ConnmanError::AlreadyExists(CONNMAN_ERROR ".AlreadyExists");
+const QString ConnmanError::AlreadyEnabled(CONNMAN_ERROR ".AlreadyEnabled");
+const QString ConnmanError::AlreadyDisabled(CONNMAN_ERROR ".AlreadyDisabled");
+const QString ConnmanError::AlreadyConnected(CONNMAN_ERROR ".AlreadyConnected");
+const QString ConnmanError::NotConnected(CONNMAN_ERROR ".NotConnected");
+const QString ConnmanError::OperationAborted(CONNMAN_ERROR ".OperationAborted");
+const QString ConnmanError::OperationTimeout(CONNMAN_ERROR ".OperationTimeout");
+const QString ConnmanError::InvalidService(CONNMAN_ERROR ".InvalidService");
+const QString ConnmanError::InvalidProperty(CONNMAN_ERROR ".InvalidProperty");
+
+const QString ConnmanState::Idle("idle");
+const QString ConnmanState::Association("association");
+const QString ConnmanState::Configuration("configuration");
+const QString ConnmanState::Ready("ready");
+const QString ConnmanState::Online("online");
+const QString ConnmanState::Disconnect("disconnect");
+const QString ConnmanState::Failure("failure");
// Marshall the ConnmanObject data into a D-Bus argument
QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanObject &obj)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/commondbustypes.h
^
|
@@ -20,6 +20,12 @@
typedef QMap<QString, QString> StringMap;
Q_DECLARE_METATYPE ( StringMap )
+typedef QPair<QString, QString> StringPair;
+Q_DECLARE_METATYPE(StringPair)
+
+typedef QVector<StringPair> StringPairArray;
+Q_DECLARE_METATYPE(StringPairArray)
+
// TODO: re-implement with better interface i.e. "const QString path() const" instead of objpath
struct ConnmanObject {
QDBusObjectPath objpath;
@@ -34,6 +40,8 @@
inline void registerCommonDataTypes() {
qDBusRegisterMetaType<StringMap>();
+ qDBusRegisterMetaType<StringPair>();
+ qDBusRegisterMetaType<StringPairArray>();
qDBusRegisterMetaType<ConnmanObject>();
qDBusRegisterMetaType<ConnmanObjectList>();
qRegisterMetaType<ConnmanObjectList>("ConnmanObjectList");
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/counter.cpp
^
|
@@ -47,7 +47,7 @@
m_manager->unregisterCounter(counterPath);
}
-void Counter::serviceUsage(const QString &servicePath, const QVariantMap &counters, bool roaming)
+void Counter::serviceUsage(const QString &servicePath, const QVariantMap &counters, bool roaming)
{
Q_EMIT counterChanged(servicePath, counters, roaming);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/counter.h
^
|
@@ -36,9 +36,9 @@
Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged)
Q_DISABLE_COPY(Counter)
-public:
- explicit Counter(QObject *parent = 0);
+public:
+ explicit Counter(QObject *parent = 0);
virtual ~Counter();
quint64 bytesReceived() const;
@@ -74,7 +74,7 @@
friend class CounterAdaptor;
- void serviceUsage(const QString &servicePath, const QVariantMap &counters, bool roaming);
+ void serviceUsage(const QString &servicePath, const QVariantMap &counters, bool roaming);
void release();
quint64 bytesInHome;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/libconnman-qt.pro
^
|
@@ -4,7 +4,7 @@
CONFIG += qt create_pc create_prl link_pkgconfig
isEmpty(VERSION) {
- VERSION = 1.1.10
+ VERSION = 1.2.8
message("VERSION is unset, assuming $$VERSION")
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/libconnman_p.h
^
|
@@ -15,6 +15,46 @@
#define CONNMAN_BUS QDBusConnection::systemBus()
#define CONNMAN_SERVICE QLatin1String("net.connman")
+class ConnmanError {
+public:
+ static const QString Failed;
+ static const QString InvalidArguments;
+ static const QString PermissionDenied;
+ static const QString PassphraseRequired;
+ static const QString NotRegistered;
+ static const QString NotUnique;
+ static const QString NotSupported;
+ static const QString NotImplemented;
+ static const QString NotFound;
+ static const QString NoCarrier;
+ static const QString InProgress;
+ static const QString AlreadyExists;
+ static const QString AlreadyEnabled;
+ static const QString AlreadyDisabled;
+ static const QString AlreadyConnected;
+ static const QString NotConnected;
+ static const QString OperationAborted;
+ static const QString OperationTimeout;
+ static const QString InvalidService;
+ static const QString InvalidProperty;
+};
+
+class ConnmanState {
+public:
+ static const QString Idle;
+ static const QString Association;
+ static const QString Configuration;
+ static const QString Ready;
+ static const QString Online;
+ static const QString Disconnect;
+ static const QString Failure;
+
+ static inline bool connecting(QString state)
+ { return (state == Association || state == Configuration); }
+ static inline bool connected(QString state)
+ { return (state == Online || state == Ready); }
+};
+
#ifndef CONNMAN_DEBUG
# define CONNMAN_DEBUG 0
#endif // CONNMAN_DEBUG
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/networkmanager.cpp
^
|
@@ -41,7 +41,9 @@
Q_OBJECT
public:
- static const QString Ethernet;
+ static const QString InputRequestTimeout;
+ static const uint DefaultInputRequestTimeout;
+
static const QString WifiTechnology;
static const QString CellularTechnology;
static const QString BluetoothTechnology;
@@ -65,7 +67,9 @@
void maybeCreateInterfaceProxy();
};
-const QString NetworkManager::Private::Ethernet("ethernet");
+const QString NetworkManager::Private::InputRequestTimeout("InputRequestTimeout");
+const uint NetworkManager::Private::DefaultInputRequestTimeout(300000);
+
const QString NetworkManager::Private::WifiTechnology("/net/connman/technology/wifi");
const QString NetworkManager::Private::CellularTechnology("/net/connman/technology/cellular");
const QString NetworkManager::Private::BluetoothTechnology("/net/connman/technology/bluetooth");
@@ -143,6 +147,13 @@
// <method name="DestroySession">
// <arg name="session" type="o"/>
// </method>
+// <method name="CreateService">
+// <arg name="service_type" type="s"/>
+// <arg name="device_ident" type="s"/>
+// <arg name="network_ident" type="s"/>
+// <arg name="settings" type="a(ss)"/>
+// <arg name="service" type="o"/>
+// </method>
// <signal name="TechnologyAdded">
// <arg name="technology" type="o"/>
// <arg name="properties" type="a{sv}"/>
@@ -194,6 +205,8 @@
{ return asyncCall("CreateSession", settings, qVariantFromValue(QDBusObjectPath(path))); }
QDBusPendingCall DestroySession(const QString &path)
{ return asyncCall("DestroySession", qVariantFromValue(QDBusObjectPath(path))); }
+ QDBusPendingReply<QDBusObjectPath> CreateService(const QString &type, const QString &device, const QString &network, const StringPairArray &settings)
+ { return asyncCall("CreateService", type, device, network, qVariantFromValue(settings)); }
Q_SIGNALS:
void PropertyChanged(const QString &name, const QDBusVariant &value);
@@ -233,6 +246,11 @@
{
}
+NetworkManager* NetworkManager::instance()
+{
+ return NetworkManagerFactory::createInstance();
+}
+
void NetworkManager::onConnmanRegistered()
{
// Store the current connman registration state so that
@@ -601,7 +619,7 @@
}
-const QString NetworkManager::state() const
+QString NetworkManager::state() const
{
return m_propertiesCache[State].toString();
}
@@ -621,7 +639,7 @@
return m_technologiesCache.value(type);
}
-const QVector<NetworkTechnology *> NetworkManager::getTechnologies() const
+QVector<NetworkTechnology *> NetworkManager::getTechnologies() const
{
QVector<NetworkTechnology *> techs;
@@ -632,7 +650,7 @@
return techs;
}
-const QVector<NetworkService*> NetworkManager::selectServices(const QString &tech,
+QVector<NetworkService*> NetworkManager::selectServices(const QString &tech,
ServiceSelector selector) const
{
QVector<NetworkService *> services;
@@ -649,17 +667,17 @@
return services;
}
-const QVector<NetworkService*> NetworkManager::getServices(const QString &tech) const
+QVector<NetworkService*> NetworkManager::getServices(const QString &tech) const
{
return selectServices(tech, Private::selectAll);
}
-const QVector<NetworkService*> NetworkManager::getSavedServices(const QString &tech) const
+QVector<NetworkService*> NetworkManager::getSavedServices(const QString &tech) const
{
return selectServices(tech, Private::selectSaved);
}
-const QVector<NetworkService*> NetworkManager::getAvailableServices(const QString &tech) const
+QVector<NetworkService*> NetworkManager::getAvailableServices(const QString &tech) const
{
return selectServices(tech, Private::selectAvailable);
}
@@ -671,7 +689,7 @@
// Setters
-void NetworkManager::setOfflineMode(const bool &offline)
+void NetworkManager::setOfflineMode(bool offline)
{
if (m_proxy) {
m_proxy->SetProperty(OfflineMode, offline);
@@ -723,7 +741,60 @@
}
}
-void NetworkManager::setSessionMode(const bool &sessionMode)
+bool NetworkManager::createService(
+ const QVariantMap &settings, const QString &tech, const QString &service, const QString &device)
+{
+ if (m_proxy) {
+ // The public type is QVariantMap for QML's benefit, covert to a string map now.
+ StringPairArray settingsStrings;
+ for (QVariantMap::const_iterator it = settings.begin(); it != settings.end(); ++it) {
+ settingsStrings.append(qMakePair(it.key(), it.value().toString()));
+ }
+
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(
+ m_proxy->CreateService(tech, device, service, settingsStrings), this);
+
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *watcher) {
+ watcher->deleteLater();
+
+ QDBusReply<QDBusObjectPath> reply = *watcher;
+
+ if (!reply.isValid()) {
+ qWarning() << "NetworkManager: Failed to create service." << reply.error().name() << reply.error().message();
+ emit serviceCreationFailed(reply.error().name());
+ } else {
+ emit serviceCreated(reply.value().path());
+ }
+ });
+ return true;
+ } else {
+ return false;
+ }
+}
+
+QString NetworkManager::createServiceSync(
+ const QVariantMap &settings, const QString &tech, const QString &service, const QString &device)
+{
+ if (m_proxy) {
+ // The public type is QVariantMap for QML's benefit, covert to a string map now.
+ StringPairArray settingsStrings;
+ for (QVariantMap::const_iterator it = settings.begin(); it != settings.end(); ++it) {
+ settingsStrings.append(qMakePair(it.key(), it.value().toString()));
+ }
+ QDBusPendingReply<QDBusObjectPath> reply = m_proxy->CreateService(tech, device, service, settingsStrings);
+ reply.waitForFinished();
+
+ if (reply.isError()) {
+ qWarning() << "NetworkManager: Failed to create service." << reply.error().name() << reply.error().message();
+ }
+
+ return reply.value().path();
+ } else {
+ return QString();
+ }
+}
+
+void NetworkManager::setSessionMode(bool sessionMode)
{
if (m_proxy) {
m_proxy->SetProperty(SessionMode, sessionMode);
@@ -744,12 +815,21 @@
Q_EMIT offlineModeChanged(value.toBool());
} else if (name == SessionMode) {
Q_EMIT sessionModeChanged(value.toBool());
+ } else if (name == Private::InputRequestTimeout) {
+ Q_EMIT inputRequestTimeoutChanged();
}
}
bool NetworkManager::sessionMode() const
{
- return m_propertiesCache[SessionMode].toBool();
+ return m_propertiesCache.value(SessionMode).toBool();
+}
+
+uint NetworkManager::inputRequestTimeout() const
+{
+ bool ok = false;
+ uint value = m_propertiesCache.value(Private::InputRequestTimeout).toUInt(&ok);
+ return (ok && value) ? value : Private::DefaultInputRequestTimeout;
}
bool NetworkManager::servicesEnabled() const
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/networkmanager.h
^
|
@@ -17,7 +17,6 @@
#include "networkservice.h"
#include <QtDBus>
-class NetConnmanManagerInterface;
class NetworkManager;
class NetworkManagerFactory : public QObject
@@ -41,6 +40,7 @@
Q_PROPERTY(NetworkService* defaultRoute READ defaultRoute NOTIFY defaultRouteChanged)
Q_PROPERTY(bool sessionMode READ sessionMode WRITE setSessionMode NOTIFY sessionModeChanged)
+ Q_PROPERTY(uint inputRequestTimeout READ inputRequestTimeout NOTIFY inputRequestTimeoutChanged)
Q_PROPERTY(bool servicesEnabled READ servicesEnabled WRITE setServicesEnabled NOTIFY servicesEnabledChanged)
Q_PROPERTY(bool technologiesEnabled READ technologiesEnabled WRITE setTechnologiesEnabled NOTIFY technologiesEnabledChanged)
@@ -51,16 +51,18 @@
Q_PROPERTY(QString GpsTechnology READ gpsTechnologyPath CONSTANT)
public:
- NetworkManager(QObject* parent=0);
+ static NetworkManager* instance();
+
+ NetworkManager(QObject *parent = 0);
virtual ~NetworkManager();
bool isAvailable() const;
Q_INVOKABLE NetworkTechnology* getTechnology(const QString &type) const;
- const QVector<NetworkTechnology *> getTechnologies() const;
- const QVector<NetworkService*> getServices(const QString &tech = QString()) const;
- const QVector<NetworkService*> getSavedServices(const QString &tech = QString()) const;
- const QVector<NetworkService*> getAvailableServices(const QString &tech = QString()) const;
+ QVector<NetworkTechnology *> getTechnologies() const;
+ QVector<NetworkService*> getServices(const QString &tech = QString()) const;
+ QVector<NetworkService*> getSavedServices(const QString &tech = QString()) const;
+ QVector<NetworkService*> getAvailableServices(const QString &tech = QString()) const;
void removeSavedService(const QString &identifier) const;
Q_INVOKABLE QStringList servicesList(const QString &tech);
@@ -70,11 +72,12 @@
Q_INVOKABLE QString technologyPathForService(const QString &path);
Q_INVOKABLE QString technologyPathForType(const QString &type);
- const QString state() const;
+ QString state() const;
bool offlineMode() const;
NetworkService* defaultRoute() const;
bool sessionMode() const;
+ uint inputRequestTimeout() const;
bool servicesEnabled() const;
void setServicesEnabled(bool enabled);
@@ -90,20 +93,31 @@
QString gpsTechnologyPath() const;
public Q_SLOTS:
- void setOfflineMode(const bool &offlineMode);
+ void setOfflineMode(bool offlineMode);
void registerAgent(const QString &path);
void unregisterAgent(const QString &path);
- void registerCounter(const QString &path, quint32 accuracy,quint32 period);
+ void registerCounter(const QString &path, quint32 accuracy, quint32 period);
void unregisterCounter(const QString &path);
QDBusObjectPath createSession(const QVariantMap &settings, const QString &sessionNotifierPath);
void destroySession(const QString &sessionAgentPath);
- void setSessionMode(const bool &sessionMode);
+ bool createService(
+ const QVariantMap &settings,
+ const QString &tech = QString(),
+ const QString &service = QString(),
+ const QString &device = QString());
+ QString createServiceSync(
+ const QVariantMap &settings,
+ const QString &tech = QString(),
+ const QString &service = QString(),
+ const QString &device = QString());
+ void setSessionMode(bool sessionMode);
Q_SIGNALS:
void availabilityChanged(bool available);
void stateChanged(const QString &state);
void offlineModeChanged(bool offlineMode);
+ void inputRequestTimeoutChanged();
void technologiesChanged();
void servicesChanged();
void savedServicesChanged();
@@ -113,6 +127,9 @@
void serviceAdded(const QString &servicePath);
void serviceRemoved(const QString &servicePath);
+ void serviceCreated(const QString &servicePath);
+ void serviceCreationFailed(const QString &error);
+
void servicesEnabledChanged();
void technologiesEnabledChanged();
@@ -125,7 +142,7 @@
void setConnmanAvailable(bool available);
bool connectToConnman();
void disconnectFromConnman();
- const QVector<NetworkService*> selectServices(const QString &tech, ServiceSelector selector) const;
+ QVector<NetworkService*> selectServices(const QString &tech, ServiceSelector selector) const;
QStringList selectServiceList(const QString &tech, ServiceSelector selector) const;
InterfaceProxy *m_proxy;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/networkservice.cpp
^
|
@@ -8,11 +8,66 @@
* is at http://www.apache.org/licenses/LICENSE-2.0
*/
-#include <QSettings>
-
#include "networkservice.h"
+#include "networkmanager.h"
#include "libconnman_p.h"
+#define COUNT(a) ((uint)(sizeof(a)/sizeof(a[0])))
+
+#define NETWORK_SERVICE_PROPERTIES(ConnmanArg,ConnmanNoArg,ClassArg,ClassNoArg) \
+ ClassArg(Path,path) \
+ ClassArg(Connected,connected) \
+ ClassNoArg(Connecting,connecting) \
+ ClassNoArg(Managed,managed) \
+ ClassNoArg(SecurityType,securityType) \
+ ClassNoArg(EapMethod,eapMethod) \
+ ClassNoArg(PassphraseAvailable,passphraseAvailable) \
+ ClassNoArg(IdentityAvailable,identityAvailable) \
+ ClassNoArg(EapMethodAvailable,eapMethodAvailable) \
+ ClassNoArg(LastConnectError,lastConnectError) \
+ ConnmanArg("Type",Type,type) \
+ ConnmanArg("Name",Name,name) \
+ ConnmanArg("State",State,state) \
+ ConnmanArg("Error",Error,error) \
+ ConnmanArg("Security",Security,security) \
+ ConnmanArg("Strength",Strength,strength) \
+ ConnmanArg("Favorite",Favorite,favorite) \
+ ConnmanArg("AutoConnect",AutoConnect,autoConnect) \
+ ConnmanArg("IPv4",Ipv4,ipv4) \
+ ConnmanArg("IPv4.Configuration",Ipv4Config,ipv4Config) \
+ ConnmanArg("IPv6",Ipv6,ipv6) \
+ ConnmanArg("IPv6.Configuration",Ipv6Config,ipv6Config) \
+ ConnmanArg("Nameservers",Nameservers,nameservers) \
+ ConnmanArg("Nameservers.Configuration",NameserversConfig,nameserversConfig) \
+ ConnmanArg("Domains",Domains,domains) \
+ ConnmanArg("Domains.Configuration",DomainsConfig,domainsConfig) \
+ ConnmanArg("Proxy",Proxy,proxy) \
+ ConnmanArg("Proxy.Configuration",ProxyConfig,proxyConfig) \
+ ConnmanArg("Ethernet",Ethernet,ethernet) \
+ ConnmanArg("Roaming",Roaming,roaming) \
+ ConnmanArg("Timeservers",Timeservers,timeservers) \
+ ConnmanArg("Timeservers.Configuration",TimeserversConfig,timeserversConfig) \
+ ConnmanArg("BSSID",Bssid,bssid) \
+ ConnmanArg("MaxRate",MaxRate,maxRate) \
+ ConnmanArg("Frequency",Frequency,frequency) \
+ ConnmanArg("EncryptionMode",EncryptionMode,encryptionMode) \
+ ConnmanArg("Hidden",Hidden,hidden) \
+ ConnmanArg("Passphrase",Passphrase,passphrase) \
+ ConnmanArg("Identity",Identity,identity) \
+ ConnmanNoArg("Available",Available,available) \
+ ConnmanNoArg("Saved",Saved,saved)
+
+#define NETWORK_SERVICE_PROPERTIES2(Connman,Class) \
+ NETWORK_SERVICE_PROPERTIES(Connman,Connman,Class,Class)
+
+#define IGNORE(X,x)
+
+// New private date and methods are added to NetworkService::Private
+// whenever possible to avoid contaminating the public header with
+// irrelevant information. The old redundant stuff (the one which
+// existed before NetworkService::Private was introduced) is still
+// kept in the public header, for backward ABI compatibility.
+
class NetworkService::Private: public QObject
{
Q_OBJECT
@@ -22,22 +77,17 @@
class GetPropertyWatcher;
typedef QHash<QString,EapMethod> EapMethodMap;
typedef QSharedPointer<EapMethodMap> EapMethodMapRef;
+ typedef void (NetworkService::Private::*SignalEmitter)(NetworkService*);
- static const int NUM_EAP_METHODS = 4; // None, PEAP, TTLS, TLS
- static const QString EapMethodName[NUM_EAP_METHODS];
-
- static const int NUM_SECURITY_TYPES = 5; // Unknown, None, WEP, PSK, IEEE802.1x
- static const QString SecurityTypeName[NUM_SECURITY_TYPES];
+ static const QString EapMethodName[];
+ static const QString SecurityTypeName[];
+ static const QString PolicyPrefix;
+#define DECLARE_STATIC_STRING(K,X,x) static const QString X;
+ NETWORK_SERVICE_PROPERTIES2(DECLARE_STATIC_STRING,IGNORE)
static const QString Access;
static const QString DefaultAccess;
- static const QString Identity;
- static const QString Passphrase;
static const QString EAP;
- static const QString Available;
- static const QString Saved;
-
- static const QString PolicyPrefix;
enum PropertyFlags {
PropertyNone = 0x00000000,
@@ -62,53 +112,110 @@
CallAll = 0x000000ff
};
- struct PropertyInfo {
+ enum Signal {
+ NoSignal = -1,
+#define SIGNAL_ID_(K,X,x) SIGNAL_ID(X,x)
+#define SIGNAL_ID(X,x) Signal##X##Changed,
+ NETWORK_SERVICE_PROPERTIES2(SIGNAL_ID_,SIGNAL_ID)
+ SignalCount
+ };
+
+ struct PropertyAccessInfo {
const QString &name;
PropertyFlags flag;
- void (NetworkService::*notify)();
+ Signal sig;
};
- static const int NUM_PROPERTIES = 5;
- static const PropertyInfo* Properties[NUM_PROPERTIES];
- static const PropertyInfo PropAccess;
- static const PropertyInfo PropDefaultAccess;
- static const PropertyInfo PropIdentity;
- static const PropertyInfo PropPassphrase;
- static const PropertyInfo PropEAP;
+ // Properties that are subject to access control
+ static const PropertyAccessInfo* Properties[];
+ static const PropertyAccessInfo PropAccess;
+ static const PropertyAccessInfo PropDefaultAccess;
+ static const PropertyAccessInfo PropIdentity;
+ static const PropertyAccessInfo PropPassphrase;
+ static const PropertyAccessInfo PropEAP;
- static QVariantMap adaptToConnmanProperties(const QVariantMap& map);
+ static QVariantMap adaptToConnmanProperties(const QVariantMap &map);
- Private(NetworkService* parent);
+ Private(const QString &path, const QVariantMap &properties, NetworkService *parent);
void deleteProxy();
- InterfaceProxy* createProxy(QString path);
+ void setPath(const QString &path);
+ InterfaceProxy* createProxy(const QString &path);
NetworkService* service();
EapMethodMapRef eapMethodMap();
EapMethod eapMethod();
- bool updateSecurityType();
+ uint uintValue(const QString &key);
+ bool boolValue(const QString &key, bool defaultValue = false);
+ QVariantMap variantMapValue(const QString &key);
+ QStringList stringListValue(const QString &key);
+ QString stringValue(const QString &key);
+ QString state();
+ bool managed();
+ bool requestConnect();
+ void updateSecurityType();
void setEapMethod(EapMethod method);
- void setProperty(QString name, QVariant value);
- void setPropertyAvailable(const PropertyInfo* prop, bool available);
+ void setProperty(const QString &name, const QVariant &value);
+ void setPropertyAvailable(const PropertyAccessInfo *prop, bool available);
+ void setLastConnectError(const QString &error);
+ void updateProperties(QVariantMap properties);
+ void updateConnecting();
+ void updateConnected();
+ void updateState();
+ void updateManaged();
+ void queueSignal(Signal sig);
+ void emitQueuedSignals();
#if HAVE_LIBDBUSACCESS
- void policyCheck(QString rules);
+ void policyCheck(const QString &rules);
#endif // HAVE_LIBDBUSACCESS
+private Q_SLOTS:
+ void onPropertyChanged(const QString &name, const QDBusVariant &value);
+ void onRestrictedPropertyChanged(const QString &name);
+ void onGetPropertyFinished(QDBusPendingCallWatcher *call);
+ void onGetPropertiesFinished(QDBusPendingCallWatcher *call);
+ void onCheckAccessFinished(QDBusPendingCallWatcher *call);
+ void onConnectFinished(QDBusPendingCallWatcher *call);
+
private:
+ void updateConnecting(const QString &state);
+ void updateConnected(const QString &state);
void checkAccess();
-
-private Q_SLOTS:
- void onRestrictedPropertyChanged(QString name);
- void onGetPropertyFinished(QDBusPendingCallWatcher* call);
- void onCheckAccessFinished(QDBusPendingCallWatcher* call);
+ void resetProperties();
+ void reconnectServiceInterface();
+ void updatePropertyCache(const QString &name, const QVariant &value);
+
+ // Wrappers for signal emitters
+#define DEFINE_EMITTER_CONNMAN_ARG(K,X,x) DEFINE_EMITTER_ARG(X,x)
+#define DEFINE_EMITTER_CONNMAN_NO_ARG(K,X,x) DEFINE_EMITTER_NO_ARG(X,x)
+#define DEFINE_EMITTER_ARG(X,x) \
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/networkservice.h
^
|
@@ -11,10 +11,8 @@
#ifndef NETWORKSERVICE_H
#define NETWORKSERVICE_H
-#include <QtDBus>
-
-#define CONNECT_TIMEOUT 300000 // user is supposed to provide input for unconfigured networks
-#define CONNECT_TIMEOUT_FAVORITE 60000
+#include <QObject>
+#include <QVariant>
class NetworkService : public QObject
{
@@ -63,6 +61,8 @@
Q_PROPERTY(bool available READ available NOTIFY availableChanged)
Q_PROPERTY(bool managed READ managed NOTIFY managedChanged)
Q_PROPERTY(bool saved READ saved NOTIFY savedChanged)
+ Q_PROPERTY(bool connecting READ connecting NOTIFY connectingChanged)
+ Q_PROPERTY(QString lastConnectError READ lastConnectError NOTIFY lastConnectErrorChanged)
class Private;
friend class Private;
@@ -88,48 +88,44 @@
virtual ~NetworkService();
- const QString name() const;
- const QString type() const;
- const QString state() const;
- const QString error() const;
- const QStringList security() const;
+ QString name() const;
+ QString type() const;
+ QString state() const;
+ QString error() const;
+ QStringList security() const;
SecurityType securityType() const;
bool autoConnect() const;
uint strength() const;
bool favorite() const;
- const QString path() const;
- const QVariantMap ipv4() const;
- const QVariantMap ipv4Config() const;
- const QVariantMap ipv6() const;
- const QVariantMap ipv6Config() const;
- const QStringList nameservers() const;
- const QStringList nameserversConfig() const;
- const QStringList domains() const;
- const QStringList domainsConfig() const;
- const QVariantMap proxy() const;
- const QVariantMap proxyConfig() const;
- const QVariantMap ethernet() const;
+ QString path() const;
+ QVariantMap ipv4() const;
+ QVariantMap ipv4Config() const;
+ QVariantMap ipv6() const;
+ QVariantMap ipv6Config() const;
+ QStringList nameservers() const;
+ QStringList nameserversConfig() const;
+ QStringList domains() const;
+ QStringList domainsConfig() const;
+ QVariantMap proxy() const;
+ QVariantMap proxyConfig() const;
+ QVariantMap ethernet() const;
bool roaming() const;
void setPath(const QString &path);
void updateProperties(const QVariantMap &properties);
- bool connected();
+
bool connected() const;
bool available() const;
bool managed() const;
bool saved() const;
+ bool connecting() const;
+ QString lastConnectError() const;
QStringList timeservers() const;
QStringList timeserversConfig() const;
void setTimeserversConfig(const QStringList &servers);
- const QString bssid();
- quint32 maxRate();
- quint16 frequency();
- const QString encryptionMode();
bool hidden() const;
-
- // Canonical variants of the above with const in the right place
QString bssid() const;
quint32 maxRate() const;
quint16 frequency() const;
@@ -152,8 +148,8 @@
void stateChanged(const QString &state);
void errorChanged(const QString &error);
void securityChanged(const QStringList &security);
- void strengthChanged(const uint strength);
- void favoriteChanged(const bool &favorite);
+ void strengthChanged(uint strength);
+ void favoriteChanged(bool favorite);
void autoConnectChanged(bool autoconnect);
void pathChanged(const QString &path);
void ipv4Changed(const QVariantMap &ipv4);
@@ -195,13 +191,15 @@
void eapMethodAvailableChanged();
void availableChanged();
void savedChanged();
+ void connectingChanged();
+ void lastConnectErrorChanged();
public Q_SLOTS:
void requestConnect();
void requestDisconnect();
void remove();
- void setAutoConnect(const bool autoconnect);
+ void setAutoConnect(bool autoconnect);
void setIpv4Config(const QVariantMap &ipv4);
void setIpv6Config(const QVariantMap &ipv6);
void setNameserversConfig(const QStringList &nameservers);
@@ -212,52 +210,8 @@
private:
Private *m_priv;
- QString m_path;
- QVariantMap m_propertiesCache;
-
- static const QString Name;
- static const QString State;
- static const QString Type;
- static const QString Security;
- static const QString Strength;
- static const QString Error;
- static const QString Favorite;
- static const QString AutoConnect;
- static const QString IPv4;
- static const QString IPv4Config;
- static const QString IPv6;
- static const QString IPv6Config;
- static const QString Nameservers;
- static const QString NameserversConfig;
- static const QString Domains;
- static const QString DomainsConfig;
- static const QString Proxy;
- static const QString ProxyConfig;
- static const QString Ethernet;
- static const QString Roaming;
- static const QString Timeservers;
- static const QString TimeserversConfig;
-
- static const QString BSSID;
- static const QString MaxRate;
- static const QString Frequency;
- static const QString EncryptionMode;
- static const QString Hidden;
-
- bool m_connected;
-
-private Q_SLOTS:
- void updateProperty(const QString &name, const QDBusVariant &value);
- void emitPropertyChange(const QString &name, const QVariant &value);
- void getPropertiesFinished(QDBusPendingCallWatcher *call);
-
- void handleConnectReply(QDBusPendingCallWatcher *call);
- void handleAutoConnectReply(QDBusPendingCallWatcher*);
private:
- void resetProperties();
- void reconnectServiceInterface();
-
Q_DISABLE_COPY(NetworkService)
};
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/networksession.cpp
^
|
@@ -26,10 +26,8 @@
{
if (m_path.isEmpty())
return;
- if (m_sessionAgent) {
- delete m_sessionAgent;
- m_sessionAgent = 0;
- }
+
+ delete m_sessionAgent;
m_sessionAgent = new SessionAgent(m_path ,this);
connect(m_sessionAgent,SIGNAL(settingsUpdated(QVariantMap)),
this,SLOT(sessionSettingsUpdated(QVariantMap)));
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/networktechnology.cpp
^
|
@@ -45,10 +45,8 @@
if (path != m_path) {
m_path = path;
- if (m_technology) {
- delete m_technology;
- m_technology = 0;
- }
+ delete m_technology;
+ m_technology = 0;
// Clear the property cache (only) if the path is becoming empty.
if (m_path.isEmpty()) {
@@ -103,12 +101,12 @@
return m_path;
}
-const QString NetworkTechnology::name() const
+QString NetworkTechnology::name() const
{
return m_propertiesCache.value(Name).toString();
}
-const QString NetworkTechnology::type() const
+QString NetworkTechnology::type() const
{
return m_propertiesCache.value(Type).toString();
}
@@ -123,7 +121,7 @@
return m_propertiesCache.value(Connected).toBool();
}
-const QString NetworkTechnology::objPath() const
+QString NetworkTechnology::objPath() const
{
if (m_technology)
return m_technology->path();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/networktechnology.h
^
|
@@ -35,11 +35,11 @@
virtual ~NetworkTechnology();
- const QString name() const;
- const QString type() const;
+ QString name() const;
+ QString type() const;
bool powered() const;
bool connected() const;
- const QString objPath() const;
+ QString objPath() const;
QString path() const;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/sessionagent.cpp
^
|
@@ -117,16 +117,16 @@
void SessionAgent::onConnectFinished(QDBusPendingCallWatcher *call)
{
- QDBusPendingReply<> reply = *call;
- if (reply.isError())
- qDebug() << reply.error().message();
+ QDBusPendingReply<> reply = *call;
+ if (reply.isError())
+ qDebug() << reply.error().message();
- call->deleteLater();
+ call->deleteLater();
}
SessionNotificationAdaptor::SessionNotificationAdaptor(SessionAgent* parent)
- : QDBusAbstractAdaptor(parent),
- m_sessionAgent(parent)
+ : QDBusAbstractAdaptor(parent),
+ m_sessionAgent(parent)
{
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/sessionagent.h
^
|
@@ -19,7 +19,7 @@
Q_OBJECT
public:
- explicit SessionAgent(const QString &path,QObject* parent = 0);
+ explicit SessionAgent(const QString &path, QObject *parent = 0);
virtual ~SessionAgent();
void setAllowedBearers(const QStringList &bearers);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/useragent.cpp
^
|
@@ -150,7 +150,7 @@
return agentPath;
}
-void UserAgent::setAgentPath(QString &path)
+void UserAgent::setAgentPath(const QString &path)
{
if (path.isEmpty())
return;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/libconnman-qt/useragent.h
^
|
@@ -51,7 +51,7 @@
QString connectionRequestType() const;
QString path() const;
- void setAgentPath(QString &path);
+ void setAgentPath(const QString &path);
Q_SIGNALS:
void userInputRequested(const QString &servicePath, const QVariantMap &fields);
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/plugin/plugin.cpp
^
|
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2011 Intel Corporation.
+ * Copyright © 2012, Jolla.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0. The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+#include <QtPlugin>
+
+#include <QtQml>
+#include <QQmlEngine>
+#include <QQmlExtensionPlugin>
+
+#include <networkservice.h>
+#include <clockmodel.h>
+#include "technologymodel.h"
+#include "savedservicemodel.h"
+#include "useragent.h"
+#include "networksession.h"
+#include "counter.h"
+
+class ConnmanPlugin: public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "MeeGo.Connman")
+
+public:
+ void registerTypes(const char *uri);
+
+ void initializeEngine(QQmlEngine *engine, const char *uri);
+};
+
+void ConnmanPlugin::registerTypes(const char *uri)
+{
+ // @uri MeeGo.Connman
+
+ qmlRegisterType<NetworkService>(uri,0,2,"NetworkService");
+ qmlRegisterType<TechnologyModel>(uri,0,2,"TechnologyModel");
+ qmlRegisterType<SavedServiceModel>(uri,0,2,"SavedServiceModel");
+ qmlRegisterType<UserAgent>(uri,0,2,"UserAgent");
+ qmlRegisterType<ClockModel>(uri,0,2,"ClockModel");
+ qmlRegisterType<NetworkSession>(uri,0,2,"NetworkSession");
+ qmlRegisterType<NetworkManager>(uri,0,2,"NetworkManager");
+ qmlRegisterType<NetworkManagerFactory>(uri,0,2,"NetworkManagerFactory");
+ qmlRegisterType<NetworkTechnology>(uri,0,2,"NetworkTechnology");
+ qmlRegisterType<Counter>(uri,0,2,"NetworkCounter");
+}
+
+void ConnmanPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
+{
+ Q_UNUSED(uri);
+ Q_UNUSED(engine);
+}
+
+#include "plugin.moc"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/plugin/plugin.pro
^
|
@@ -2,8 +2,8 @@
TEMPLATE = lib
QT += dbus
CONFIG += plugin
-SOURCES = components.cpp networkingmodel.cpp technologymodel.cpp savedservicemodel.cpp
-HEADERS = components.h networkingmodel.h technologymodel.h savedservicemodel.h
+SOURCES = plugin.cpp technologymodel.cpp savedservicemodel.cpp
+HEADERS = technologymodel.h savedservicemodel.h
INCLUDEPATH += ../libconnman-qt
LIBS += -L../libconnman-qt
QT -= gui
@@ -15,13 +15,16 @@
LIBS += -l$$qtLibraryTarget(connman-$$TARGET_SUFFIX)
QT += qml
-OTHER_FILES += plugin.json qmldirs
+OTHER_FILES += plugin.json plugins.qmltypes qmldirs
MODULENAME = MeeGo/Connman
TARGETPATH = $$[QT_INSTALL_QML]/$$MODULENAME
target.path = $$TARGETPATH
-qmldir.files += qmldir
+qmldir.files += qmldir plugins.qmltypes
qmldir.path = $$TARGETPATH
INSTALLS += target qmldir
+
+qmltypes.commands = qmlplugindump -nonrelocatable MeeGo.Connman 0.2 > $$PWD/plugins.qmltypes
+QMAKE_EXTRA_TARGETS += qmltypes
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/plugin/plugins.qmltypes
^
|
@@ -0,0 +1,1071 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable MeeGo.Connman 0.2'
+
+Module {
+ dependencies: []
+ Component {
+ name: "ClockModel"
+ prototype: "QObject"
+ exports: ["MeeGo.Connman/ClockModel 0.2"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "timezone"; type: "string" }
+ Property { name: "timezoneUpdates"; type: "string" }
+ Property { name: "timeUpdates"; type: "string" }
+ Property { name: "timeservers"; type: "QStringList" }
+ // sdk-make-qmltypes:keep
+ Signal { name: "timezoneChanged" }
+ // sdk-make-qmltypes:keep
+ Signal { name: "timezoneUpdatesChanged" }
+ // sdk-make-qmltypes:keep
+ Signal { name: "timeUpdatesChanged" }
+ // sdk-make-qmltypes:keep
+ Signal { name: "timeserversChanged" }
+ Method { name: "timezone"; type: "string" }
+ Method {
+ name: "setTimezone"
+ Parameter { name: "val"; type: "string" }
+ }
+ Method { name: "timezoneUpdates"; type: "string" }
+ Method {
+ name: "setTimezoneUpdates"
+ Parameter { name: "val"; type: "string" }
+ }
+ Method { name: "timeUpdates"; type: "string" }
+ Method {
+ name: "setTimeUpdates"
+ Parameter { name: "val"; type: "string" }
+ }
+ Method { name: "timeservers"; type: "QStringList" }
+ Method {
+ name: "setTimeservers"
+ Parameter { name: "val"; type: "QStringList" }
+ }
+ Method {
+ name: "setDate"
+ Parameter { name: "date"; type: "QDate" }
+ }
+ Method {
+ name: "setTime"
+ Parameter { name: "time"; type: "QTime" }
+ }
+ }
+ Component {
+ name: "Counter"
+ prototype: "QObject"
+ exports: ["MeeGo.Connman/NetworkCounter 0.2"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "bytesReceived"; type: "qulonglong"; isReadonly: true }
+ Property { name: "bytesTransmitted"; type: "qulonglong"; isReadonly: true }
+ Property { name: "secondsOnline"; type: "uint"; isReadonly: true }
+ Property { name: "roaming"; type: "bool"; isReadonly: true }
+ Property { name: "accuracy"; type: "uint" }
+ Property { name: "interval"; type: "uint" }
+ Property { name: "running"; type: "bool" }
+ Signal {
+ name: "counterChanged"
+ Parameter { name: "servicePath"; type: "string" }
+ Parameter { name: "counters"; type: "QVariantMap" }
+ Parameter { name: "roaming"; type: "bool" }
+ }
+ Signal {
+ name: "bytesReceivedChanged"
+ Parameter { name: "bytesRx"; type: "qulonglong" }
+ }
+ Signal {
+ name: "bytesTransmittedChanged"
+ Parameter { name: "bytesTx"; type: "qulonglong" }
+ }
+ Signal {
+ name: "secondsOnlineChanged"
+ Parameter { name: "seconds"; type: "uint" }
+ }
+ Signal {
+ name: "roamingChanged"
+ Parameter { name: "roaming"; type: "bool" }
+ }
+ Signal {
+ name: "accuracyChanged"
+ Parameter { name: "accuracy"; type: "uint" }
+ }
+ Signal {
+ name: "intervalChanged"
+ Parameter { name: "interval"; type: "uint" }
+ }
+ Signal {
+ name: "runningChanged"
+ Parameter { name: "running"; type: "bool" }
+ }
+ }
+ Component {
+ name: "NetworkManager"
+ prototype: "QObject"
+ exports: ["MeeGo.Connman/NetworkManager 0.2"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "available"; type: "bool"; isReadonly: true }
+ Property { name: "state"; type: "string"; isReadonly: true }
+ Property { name: "offlineMode"; type: "bool" }
+ Property { name: "defaultRoute"; type: "NetworkService"; isReadonly: true; isPointer: true }
+ Property { name: "sessionMode"; type: "bool" }
+ Property { name: "inputRequestTimeout"; type: "uint"; isReadonly: true }
+ Property { name: "servicesEnabled"; type: "bool" }
+ Property { name: "technologiesEnabled"; type: "bool" }
+ Property { name: "WifiTechnology"; type: "string"; isReadonly: true }
+ Property { name: "CellularTechnology"; type: "string"; isReadonly: true }
+ Property { name: "BluetoothTechnology"; type: "string"; isReadonly: true }
+ Property { name: "GpsTechnology"; type: "string"; isReadonly: true }
+ Signal {
+ name: "availabilityChanged"
+ Parameter { name: "available"; type: "bool" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { name: "state"; type: "string" }
+ }
+ Signal {
+ name: "offlineModeChanged"
+ Parameter { name: "offlineMode"; type: "bool" }
+ }
+ // sdk-make-qmltypes:keep
+ Signal { name: "inputRequestTimeoutChanged" }
+ Signal { name: "technologiesChanged" }
+ Signal { name: "servicesChanged" }
+ Signal { name: "savedServicesChanged" }
+ Signal {
+ name: "defaultRouteChanged"
+ Parameter { name: "defaultRoute"; type: "NetworkService"; isPointer: true }
+ }
+ Signal {
+ name: "sessionModeChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "servicesListChanged"
+ Parameter { name: "list"; type: "QStringList" }
+ }
+ Signal {
+ name: "serviceAdded"
+ Parameter { name: "servicePath"; type: "string" }
+ }
+ Signal {
+ name: "serviceRemoved"
+ Parameter { name: "servicePath"; type: "string" }
+ }
+ Signal {
+ name: "serviceCreated"
+ Parameter { name: "servicePath"; type: "string" }
+ }
+ Signal {
+ name: "serviceCreationFailed"
+ Parameter { name: "error"; type: "string" }
+ }
+ // sdk-make-qmltypes:keep
+ Signal { name: "serviceEnabledChanged" }
+ // sdk-make-qmltypes:keep
+ Signal { name: "technologiesEnabledChanged" }
+ Method {
+ name: "setOfflineMode"
+ Parameter { name: "offlineMode"; type: "bool" }
+ }
+ Method {
+ name: "registerAgent"
+ Parameter { name: "path"; type: "string" }
+ }
+ Method {
+ name: "unregisterAgent"
+ Parameter { name: "path"; type: "string" }
+ }
+ Method {
+ name: "registerCounter"
+ Parameter { name: "path"; type: "string" }
+ Parameter { name: "accuracy"; type: "uint" }
+ Parameter { name: "period"; type: "uint" }
+ }
+ Method {
+ name: "unregisterCounter"
+ Parameter { name: "path"; type: "string" }
+ }
+ Method {
+ name: "createSession"
+ type: "QDBusObjectPath"
+ Parameter { name: "settings"; type: "QVariantMap" }
+ Parameter { name: "sessionNotifierPath"; type: "string" }
+ }
+ Method {
+ name: "destroySession"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/plugin/qmldir
^
|
@@ -1,2 +1,3 @@
module MeeGo.Connman
plugin ConnmanQtDeclarative
+typeinfo plugins.qmltypes
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/plugin/savedservicemodel.cpp
^
|
@@ -80,7 +80,7 @@
return m_services.count();
}
-const QString SavedServiceModel::name() const
+QString SavedServiceModel::name() const
{
return m_techname;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/plugin/savedservicemodel.h
^
|
@@ -6,8 +6,7 @@
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*
- * WARNING: this class is experimetal and is about to be refactored in order
- * to deprecate NetworkingModel.
+ * WARNING: this class is experimental and is about to be refactored
*/
#ifndef SAVEDSERVICEMODEL_H
@@ -41,7 +40,7 @@
QVariant data(const QModelIndex &index, int role) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
- const QString name() const;
+ QString name() const;
void setName(const QString &name);
bool sort() const;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/plugin/technologymodel.cpp
^
|
@@ -69,7 +69,7 @@
return rowCount();
}
-const QString TechnologyModel::name() const
+QString TechnologyModel::name() const
{
return m_techname;
}
@@ -123,7 +123,7 @@
}
}
-void TechnologyModel::setPowered(const bool &powered)
+void TechnologyModel::setPowered(bool powered)
{
if (m_tech) {
m_tech->setPowered(powered);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/plugin/technologymodel.h
^
|
@@ -52,10 +52,10 @@
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int count() const;
-
- const QString name() const;
+ QString name() const;
bool isAvailable() const;
bool isConnected() const;
+ void setPowered(bool powered);
bool isPowered() const;
bool isScanning() const;
bool changesInhibited() const;
@@ -67,10 +67,7 @@
Q_INVOKABLE int indexOf(const QString &dbusObjectPath) const;
Q_INVOKABLE NetworkService *get(int index) const;
-
-public Q_SLOTS:
- void setPowered(const bool &powered);
- void requestScan();
+ Q_INVOKABLE void requestScan();
Q_SIGNALS:
void nameChanged(const QString &name);
@@ -82,7 +79,6 @@
void technologiesChanged();
void countChanged();
void filterChanged();
-
void scanRequestFinished();
private:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/libconnman-qt/rpm/connman-qt5.spec
^
|
@@ -1,6 +1,6 @@
Name: connman-qt5
Summary: Qt bindings for connman
-Version: 1.1.10
+Version: 1.2.8
Release: 1
Group: System/GUI/Other
License: ASL 2.0
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/include/LoggerMain.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 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
@@ -33,8 +33,9 @@
#ifndef LOGGER_MAIN_H
#define LOGGER_MAIN_H
-#include <QString>
#include <QObject>
+#include <QString>
+#include <QStringList>
class QQuickView;
class QGuiApplication;
@@ -44,16 +45,13 @@
public:
LoggerMain(int* aArgc, char** aArgv, const char* aService,
- QString aPackage, QString aQmlPath);
+ QStringList aRpmPackages, QString aAppSuffix, QString aQmlPath);
virtual ~LoggerMain();
int run();
- // Quick way to run the app
- static int Run(int aArgc, char** aArgv, const char* aService,
- QString aPackage, QString aQmlPath);
-
protected:
+ bool saveOutput(const char* const aArgv[], QString aOut) const;
bool saveOutput(const char* aExe, const char* const aArgv[],
QString aOut) const;
bool saveOutput(const char* aExe, const char* aArg1, const char* aArg2,
@@ -70,7 +68,8 @@
protected:
QGuiApplication* iApp;
QString iService;
- QString iPackage;
+ QStringList iRpmPackages;
+ QString iAppSuffix;
QString iQmlPath;
struct dbus_log_client* iClient;
QString iFullAppName;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/logger.pro
^
|
@@ -9,6 +9,8 @@
QMAKE_CFLAGS += -Wno-unused-parameter
HARBOUR_LIB_DIR = $$_PRO_FILE_PWD_/../harbour-lib
+HARBOUR_LIB_SRC = $${HARBOUR_LIB_DIR}/src
+HARBOUR_LIB_INCLUDE = $${HARBOUR_LIB_DIR}/include
LIBGLIBUTIL = src/libglibutil
LIBGLIBUTIL_SRC = $${LIBGLIBUTIL}/src
@@ -57,6 +59,16 @@
src/LoggerSettings.h
SOURCES += \
+ $${HARBOUR_LIB_SRC}/HarbourSigChildHandler.cpp \
+ $${HARBOUR_LIB_SRC}/HarbourTransferMethodInfo.cpp \
+ $${HARBOUR_LIB_SRC}/HarbourTransferMethodsModel.cpp
+
+HEADERS += \
+ $${HARBOUR_LIB_INCLUDE}/HarbourSigChildHandler.h \
+ $${HARBOUR_LIB_INCLUDE}/HarbourTransferMethodInfo.h \
+ $${HARBOUR_LIB_INCLUDE}/HarbourTransferMethodsModel.h
+
+SOURCES += \
$${LIBDBUSLOG_COMMON_SRC}/dbuslog_category.c \
$${LIBDBUSLOG_COMMON_SRC}/dbuslog_message.c
@@ -72,7 +84,7 @@
INCLUDEPATH += \
include \
- $${HARBOUR_LIB_DIR}/include \
+ $${HARBOUR_LIB_INCLUDE} \
$${LIBDBUSLOG_COMMON_INCLUDE} \
$${LIBDBUSLOG_CLIENT_INCLUDE} \
$${LIBGLIBUTIL_INCLUDE}
@@ -80,6 +92,7 @@
OTHER_FILES += \
qml/pages/*.js \
qml/pages/*.qml \
+ qml/pages/images/*.svg \
settings/*.qml \
settings/*.json
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/qml/pages/CategoryPage.qml
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Copyright (C) 2016-2017 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:
*
@@ -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
@@ -35,6 +35,9 @@
SilicaFlickable {
id: categoryPage
+
+ property alias pullDownMenuActive: menu.active
+
property var categoryModel: CategoryModel
property var filterModel: CategoryFilterModel
property string searchString
@@ -45,6 +48,7 @@
PullDownMenu {
id: menu
+
visible: canEnableDisable || canReset
readonly property bool canEnableDisable: filterModel && filterModel.count > 0
readonly property bool canReset: filterModel.haveDefaults
@@ -69,7 +73,6 @@
}
SilicaListView {
- id: list
model: filterModel
clip: true
anchors.fill: parent
@@ -79,7 +82,6 @@
//% "Log categories"
PageHeader { title: qsTrId("logger-categories-title") }
SearchField {
- id: searchField
width: parent.width
//: Placeholder text for the search field
//% "Select categories"
@@ -91,6 +93,9 @@
EnterKey.iconSource: "image://theme/icon-m-enter-close"
EnterKey.onClicked: categoryPage.focus = true
onTextChanged: searchString = text.toLowerCase().trim()
+ visible: opacity > 0
+ opacity: categoryModel.connected ? 1 : 0
+ Behavior on opacity { FadeAnimation {} }
}
}
delegate: Item {
@@ -124,7 +129,6 @@
ViewPlaceholder {
enabled: !categoryModel.connected
visible: opacity > 0
- Behavior on opacity { FadeAnimation {} }
//% "Not connected"
text: qsTrId("logger-categories-not-connected")
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/qml/pages/LogPage.qml
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -33,11 +33,16 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import "logger.js" as Logger
+import "../harbour"
SilicaFlickable {
- id: page
+ id: thisView
+
+ property alias pullDownMenuActive: menu.active
+
property var logModel: LogModel
readonly property string fontFamily: "Monospace"
+ clip: true
function packAndShare() {
LogSaver.pack()
@@ -56,47 +61,11 @@
}
Component.onCompleted: {
- // Dynamically bind custom menu item
- if (customLogMenuItem) {
- customMenuItem.clicked.connect(customLogMenuItem.clicked)
- customLogMenuItemTextComponent.createObject(page)
- customLogMenuItemVisibleComponent.createObject(page)
- if (customLogMenuItem.active !== undefined) {
- customLogMenuItemActiveComponent.createObject(page)
- }
- }
if (logModel.connected) {
connected()
}
}
- Component {
- id: customLogMenuItemTextComponent
- Binding {
- target: customMenuItem
- property: "text"
- value: customLogMenuItem.text
- }
- }
-
- Component {
- id: customLogMenuItemVisibleComponent
- Binding {
- target: customMenuItem
- property: "visible"
- value: customLogMenuItem.visible
- }
- }
-
- Component {
- id: customLogMenuItemActiveComponent
- Binding {
- target: customLogMenuItem
- property: "active"
- value: pullDownMenu.active
- }
- }
-
Connections {
target: logModel
//% "Log cleared"
@@ -112,10 +81,15 @@
}
PullDownMenu {
- id: pullDownMenu
+ id: menu
+
+ // Delay the click because the action may cause custom item to disappear
+ property bool customMenuItemClicked
+
MenuItem {
- id: customMenuItem
- visible: false
+ text: customLogMenuItem ? customLogMenuItem.text : ""
+ visible: customLogMenuItem ? customLogMenuItem.visible : false
+ onClicked: menu.customMenuItemClicked = true
}
MenuItem {
//% "Clear log"
@@ -128,23 +102,52 @@
text: qsTrId("logger-logpage-pm-pack-and-send")
onClicked: packAndShare()
}
+
+ onActiveChanged: {
+ if (!active && customMenuItemClicked) {
+ customMenuItemClicked = false
+ customLogMenuItem.clicked()
+ }
+ }
+ }
+
+ PageHeader {
+ id: pageHeader
+
+ //% "Log"
+ title: qsTrId("logger-logpage-title")
+ visible: y > -height
+ y: (list.contentHeight <= thisView.height || !list.atBottom) ? 0 : -height
+ Behavior on y { SmoothedAnimation { duration: 200 } }
}
SilicaListView {
id: list
+
+ y: pageHeader.y + pageHeader.height
+ width: parent.width
+ height: Math.min(contentHeight, thisView.height - y)
+ verticalLayoutDirection: ListView.BottomToTop
model: logModel
- anchors.fill: parent
clip: true
readonly property int rawTextSize: Theme.fontSizeTiny + LogSettings.fontSizeAdjustment
readonly property int textSize: Math.min(Math.max(Theme.fontSizeTiny, rawTextSize), Theme.fontSizeHuge)
+ readonly property real offsetFromBottom: contentHeight + originY - contentY - height
+ readonly property bool atBottom: atYEnd || offsetFromBottom <= Theme.paddingLarge/2
+
+ header: Component {
+ Item {
+ width: 1
+ height: Theme.paddingLarge
+ }
+ }
- //% "Log"
- header: PageHeader { title: qsTrId("logger-logpage-title") }
delegate: Item {
width: parent.width
height: textLabel.height
readonly property color textColor: Logger.textColor(messageType, messageLevel)
+
Label {
id: timeLabel
text: (messageType === Logger.TypeLog) ? messageTime : ""
@@ -157,11 +160,12 @@
rightMargin: Theme.horizontalPageMargin
}
}
+
Label {
id: textLabel
text: messageCategory ? messageCategory + ": " + messageText : messageText
font.pixelSize: list.textSize
- font.family: page.fontFamily
+ font.family: thisView.fontFamily
wrapMode: Text.WordWrap
color: textColor
anchors {
@@ -174,26 +178,52 @@
}
}
- onCountChanged: {
- if (atYEnd && !dragging && !flicking) {
- positioner.restart()
- }
- }
-
- onHeightChanged: if (atYEnd) positioner.restart()
-
VerticalScrollDecorator {}
}
- Timer {
- id: positioner
- interval: 100
- onTriggered: {
- if (!pullDownMenu.active) {
- list.cancelFlick()
- list.positionViewAtEnd()
+ InteractionHintLabel {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/qml/pages/MainPage.qml
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Copyright (C) 2016-2017 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:
*
@@ -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
@@ -36,9 +36,9 @@
Page {
id: mainPage
allowedOrientations: window.allowedOrientations
- property var customLogMenuItem
- readonly property var pages: [ logPage, categoryPage ]
+ property var customLogMenuItem
+ readonly property bool pullDownMenuActive: scroller.currentItem && scroller.currentItem.pullDownMenuActive
readonly property bool swipeHintEnabled: loggerHints.categoryLeftSwipe < loggerHints.categoryLeftSwipeMax
Component {
@@ -53,20 +53,26 @@
SilicaListView {
id: scroller
+
anchors.fill: parent
orientation: ListView.Horizontal
snapMode: ListView.SnapOneItem
- model: pages
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ flickDeceleration: maximumFlickVelocity
clip: true
+ model: [ logPage, categoryPage ]
delegate: Item {
+ readonly property bool pullDownMenuActive: delegateLoader.item && delegateLoader.item.pullDownMenuActive
+
width: scroller.width
height: scroller.height
Loader {
+ id: delegateLoader
+
anchors.fill: parent
sourceComponent: modelData
}
}
- highlightRangeMode: ListView.StrictlyEnforceRange
onCurrentIndexChanged: {
if (currentIndex && swipeHintEnabled) {
// User has seen the second page
@@ -90,6 +96,7 @@
Loader {
id: swipeHint
+
anchors.fill: scroller
active: false
property bool hintShown
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/qml/pages/SharePage.qml
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Copyright (C) 2016-2017 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:
*
@@ -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
@@ -34,10 +34,15 @@
import Sailfish.Silica 1.0
import org.nemomobile.notifications 1.0
+import "../harbour"
+
Page {
id: page
- property var logSaver: LogSaver
+
allowedOrientations: window.allowedOrientations
+
+ property var logSaver: LogSaver
+ property var shareModel: TransferMethodsModel
property bool _canShare: !logSaver.packing && !logSaver.saving && !minWaitTimer.running
// For the page slide animation to kick in, the initial value of
@@ -97,10 +102,12 @@
title: qsTrId("logger-sharepage-header")
}
- ShareMethodList {
+ HarbourShareMethodList {
+ id: shareMethods
+
visible: opacity > 0
opacity: _canShare
- id: shareMethods
+ model: shareModel
source: logSaver.archivePath
type: logSaver.archiveType
//: Default email subject
@@ -109,6 +116,8 @@
//: Default email recipient
//% ""
emailTo: qsTrId("logger-sharepage-default-email")
+ //% "Add account"
+ addAccountText: qsTrId("logger-sharemethodlist-add-account")
Behavior on opacity { FadeAnimation {} }
anchors {
top: header.bottom
@@ -119,6 +128,7 @@
Label {
id: warning
+
visible: opacity > 0
opacity: _canShare
height: implicitHeight
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/qml/pages/images/down.svg
^
|
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1"
+ width="64px"
+ height="64px"
+ viewBox="0 0 64 64"
+ style="enable-background:new 0 0 64 64;"
+ xml:space="preserve">
+ <rect
+ style="opacity:0;fill:#ffffff"
+ width="64"
+ height="64"/>
+ <g>
+ <circle
+ style="opacity:0.2;fill:#ffffff"
+ cx="32"
+ cy="32"
+ r="30"/>
+ <path
+ style="fill:#ffffff"
+ d="M32,40.246c-1.28,0-2.561-0.487-3.535-1.462l-9.172-9.173c-0.391-0.391-0.391-1.024,0-1.414 c0.391-0.391,1.023-0.391,1.414,0l9.172,9.173c1.17,1.17,3.072,1.17,4.242,0l9.172-9.171c0.391-0.391,1.023-0.391,1.414,0 s0.391,1.023,0,1.414l-9.172,9.171C34.561,39.759,33.28,40.246,32,40.246z"/>
+ </g>
+</svg>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/settings/harbour-logger.json
^
|
@@ -3,9 +3,9 @@
"entries": [
{
"path": "applications/harbour-logger.desktop",
- "title": "MMS Logger",
+ "title": "Logger",
"type": "page",
- "icon": "harbour-mmslog",
+ "icon": "harbour-logger",
"params": {
"source": "/usr/share/harbour-logger/settings/settings.qml"
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/LoggerLogModel.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -85,7 +85,8 @@
const int bufsize = iBuffer.size();
if (bufsize > iLogSizeLimit) {
const int dropCount = (bufsize - iLogSizeLimit);
- beginRemoveRows(QModelIndex(), 0, dropCount-1);
+ const int first = bufsize - dropCount;
+ beginRemoveRows(QModelIndex(), first, first + dropCount - 1);
iBuffer.drop(dropCount);
endRemoveRows();
}
@@ -135,12 +136,13 @@
{
const bool wasEmpty = isEmpty();
if (!iBuffer.canPut(1)) {
- beginRemoveRows(QModelIndex(), 0, iLogRemoveCount-1);
+ // Remove last iLogRemoveCount entries
+ const int first = iBuffer.size() - iLogRemoveCount;
+ beginRemoveRows(QModelIndex(), first, first + iLogRemoveCount - 1);
iBuffer.drop(iLogRemoveCount);
endRemoveRows();
}
- const int count = iBuffer.size();
- beginInsertRows(QModelIndex(), count, count);
+ beginInsertRows(QModelIndex(), 0, 0);
HVERIFY(iBuffer.put(aEntry));
endInsertRows();
if (wasEmpty) {
@@ -201,7 +203,7 @@
if (row >= 0) {
const int count = iBuffer.size();
if (row < count) {
- LoggerEntry entry(iBuffer.at(row));
+ LoggerEntry entry(iBuffer.at(count - row - 1));
switch (aRole) {
case TypeRole:
value = entry.type();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/LoggerLogSaver.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -38,6 +38,7 @@
#include <QDir>
#include <unistd.h>
+#include <sys/types.h>
// ==========================================================================
// LoggerLogSaver::WriteTask
@@ -50,7 +51,7 @@
{ setAutoDelete(true); }
protected:
- virtual void run();
+ void run() Q_DECL_OVERRIDE;
private:
LoggerLogSaver* iOwner;
@@ -156,6 +157,11 @@
{
if (iPid > 0 && iPid == aPid) {
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;
Q_EMIT packingChanged();
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/LoggerMain.cpp
^
|
@@ -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:
*
@@ -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
@@ -59,26 +59,26 @@
static void register_types(const char* uri, int v1 = 1, int v2 = 0)
{
qmlRegisterType<LoggerHints>(uri, v1, v2, "LoggerHints");
- qmlRegisterType<HarbourTransferMethodsModel>(uri, v1, v2, "TransferMethodsModel");
}
LoggerMain::LoggerMain(int* aArgc, char** aArgv, const char* aService,
- QString aPackage, QString aQmlPath) :
+ QStringList aRpmPackages, QString aAppSuffix, QString aQmlPath) :
iApp(SailfishApp::application(*aArgc, aArgv)),
iService(aService),
- iPackage(aPackage),
+ iRpmPackages(aRpmPackages),
+ iAppSuffix(aAppSuffix),
iQmlPath(aQmlPath),
iClient(dbus_log_client_new(G_BUS_TYPE_SYSTEM, aService, "/",
DBUSLOG_CLIENT_FLAG_AUTOSTART)),
#ifdef OPENREPOS
- iFullAppName(QString("openrepos-logger-") + aPackage),
+ iFullAppName(QString("openrepos-logger-") + aAppSuffix),
iTransDir("/usr/share/translations")
#else
- iFullAppName(QString("harbour-logger-") + aPackage),
+ iFullAppName(QString("harbour-logger-") + aAppSuffix),
iTransDir(SailfishApp::pathTo("translations").toLocalFile())
#endif
{
- QString pluginPrefix(QString("harbour.logger.") + aPackage);
+ QString pluginPrefix(QString("harbour.logger.") + aAppSuffix);
register_types(qPrintable(pluginPrefix));
HarbourTransferMethodInfo2::registerTypes();
}
@@ -132,6 +132,11 @@
}
}
+bool LoggerMain::saveOutput(const char* const aArgv[], QString aOut) const
+{
+ return saveOutput(aArgv[0], aArgv, aOut);
+}
+
bool LoggerMain::saveOutput(const char* aExe, const char* aArg1,
const char* aArg2, QString aOut) const
{
@@ -165,9 +170,20 @@
QFile::copy("/etc/sailfish-release", aDir + "/sailfish-release");
QFile::copy("/etc/hw-release", aDir + "/hw-release");
- // And the package version
- saveOutput("rpm", "-q", qPrintable(iPackage),
- aDir + "/" + iPackage + "-version");
+ // And the package version(s)
+ const int n = iRpmPackages.count();
+ if (n > 0) {
+ QByteArray printablePackages[n];
+ const char* args[n + 3];
+ args[0] = "rpm";
+ args[1] = "-q";
+ for (int i = 0; i < n; i++) {
+ printablePackages[i] = iRpmPackages.at(i).toLocal8Bit();
+ args[i + 2] = printablePackages[i].constData();
+ }
+ args[n + 2] = NULL;
+ saveOutput(args, aDir + "/" + iAppSuffix + "-packages");
+ }
}
void LoggerMain::setupView(QQuickView* aView)
@@ -176,12 +192,6 @@
int LoggerMain::run()
{
- // 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());
-
loadTranslations();
// Signal handler
@@ -192,7 +202,9 @@
LoggerLogModel* logModel = new LoggerLogModel(logSettings, iClient, iApp);
LoggerCategoryModel* categoryModel = new LoggerCategoryModel(logSettings, iClient, iApp);
LoggerCategoryFilterModel* filterModel = new LoggerCategoryFilterModel(categoryModel);
- LoggerLogSaver* logSaver = new LoggerLogSaver(iPackage, iApp);
+ LoggerLogSaver* logSaver = new LoggerLogSaver(iAppSuffix, iApp);
+ HarbourTransferMethodsModel* transferModel = new HarbourTransferMethodsModel(iApp);
+ transferModel->setFilter(logSaver->archiveType());
logSaver->connect(logModel, SIGNAL(entryAdded(LoggerEntry)), SLOT(addEntry(LoggerEntry)));
logSaver->connect(sigChild, SIGNAL(processDied(int,int)), SLOT(onProcessDied(int,int)));
@@ -207,6 +219,7 @@
context->setContextProperty("LogSaver", logSaver);
context->setContextProperty("CategoryModel", categoryModel);
context->setContextProperty("CategoryFilterModel", filterModel);
+ context->setContextProperty("TransferMethodsModel", transferModel);
context->setContextProperty("AppName", iFullAppName);
setupView(view);
@@ -222,12 +235,3 @@
delete view;
return ret;
}
-
-int LoggerMain::Run(int aArgc, char* aArgv[], const char* aService,
- QString aPackage, QString aQmlPath)
-{
- LoggerMain* main = new LoggerMain(&aArgc, aArgv, aService, aPackage, aQmlPath);
- int ret = main->run();
- delete main;
- return ret;
-}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/.gitignore
^
|
@@ -3,3 +3,21 @@
test/coverage/full.gcov
test/coverage/libdbuslog.gcov
test/coverage/results
+debian/dbuslog-tools.debhelper.log
+debian/dbuslog-tools.substvars
+debian/dbuslog-tools/
+debian/files
+debian/*.debhelper.log
+debian/*.substvars
+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-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/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 $@
@@ -12,7 +20,12 @@
rm -f *~ rpm/*~
rm -fr $(BUILD_DIR) RPMS installroot
rm -fr debian/tmp
- rm -fr debian/libdbuslogserver debian/libdbuslogserver-dev
- rm -fr debian/libdbuslogclient debian/libdbuslogclient-dev
+ 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-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/VERSION
^
|
@@ -1 +1 @@
-1.0.11
+1.0.19
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/client/include/dbuslog_client.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2018 Jolla Ltd.
+ * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -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
@@ -56,6 +56,8 @@
DBUSLOG_LEVEL default_level;
gboolean connected;
gboolean started;
+ int api_version;
+ int backlog;
};
typedef
@@ -124,6 +126,13 @@
gpointer user_data);
DBusLogClientCall*
+dbus_log_client_set_backlog(
+ DBusLogClient* client,
+ int backlog,
+ DBusLogClientCallFunc fn,
+ gpointer user_data);
+
+DBusLogClientCall*
dbus_log_client_start(
DBusLogClient* client,
DBusLogClientCallFunc fn,
@@ -190,7 +199,7 @@
gpointer user_data);
gulong
-dbus_log_client_add_max_level_handler(
+dbus_log_client_add_backlog_handler(
DBusLogClient* client,
DBusLogClientFunc fn,
gpointer user_data);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/client/src/dbuslog_client.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -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"
@@ -105,7 +107,7 @@
enum dbus_log_client_signal {
SIGNAL_CONNECT_ERROR,
SIGNAL_CONNECTED_CHANGED,
- SIGNAL_MAX_LEVEL_CHANGED,
+ SIGNAL_BACKLOG_CHANGED,
SIGNAL_CATEGORY_ADDED,
SIGNAL_CATEGORY_REMOVED,
SIGNAL_CATEGORY_FLAGS,
@@ -118,7 +120,7 @@
#define SIGNAL_CONNECT_ERROR_NAME "dbuslog-client-connect-error"
#define SIGNAL_CONNECTED_CHANGED_NAME "dbuslog-client-connected-changed"
-#define SIGNAL_MAX_LEVEL_CHANGED_NAME "dbuslog-client-max-level-changed"
+#define SIGNAL_BACKLOG_CHANGED_NAME "dbuslog-client-backlog-changed"
#define SIGNAL_CATEGORY_ADDED_NAME "dbuslog-client-category-added"
#define SIGNAL_CATEGORY_REMOVED_NAME "dbuslog-client-category-removed"
#define SIGNAL_CATEGORY_FLAGS_NAME "dbuslog-client-category-flags"
@@ -492,14 +494,18 @@
void
dbus_log_client_init_free(
DBusLogClientInit* init,
- gboolean ok)
+ GError* error)
{
if (init) {
DBusLogClient* self = init->client;
DBusLogClientPriv* priv = self->priv;
if (priv->init == init) {
priv->init = NULL;
- if (ok) {
+ if (error) {
+ /* Failed to connect */
+ GERR("%s", GERRMSG(error));
+ dbus_log_client_emit(self, SIGNAL_CONNECT_ERROR, error);
+ } else {
/* Replace the public array */
g_ptr_array_unref(self->categories);
self->categories = dbus_log_category_values(init->categories);
@@ -519,6 +525,9 @@
if (init->categories) {
g_hash_table_destroy(init->categories);
}
+ if (error) {
+ g_error_free(error);
+ }
g_object_unref(init->bus);
g_object_unref(init->cancel);
g_slice_free(DBusLogClientInit, init);
@@ -528,48 +537,107 @@
static
void
+dbus_log_client_decode_categories(
+ DBusLogClientInit* init,
+ GVariant* cats)
+{
+ GVariantIter it;
+ GVariant* child;
+ GDEBUG("%u categories", (guint)g_variant_n_children(cats));
+ for (g_variant_iter_init(&it, cats);
+ (child = g_variant_iter_next_value(&it)) != NULL;
+ g_variant_unref(child)) {
+ DBusLogCategory* cat;
+ const char* name = NULL;
+ guint id = 0, flags = 0;
+ gint level = 0;
+ g_variant_get(child, "(&suui)", &name, &id, &flags, &level);
+ cat = dbus_log_category_new(name, id);
+ cat->flags = flags;
+ cat->level = level;
+ /* Hashtable takes ownership of this DBusLogCategory */
+ g_hash_table_replace(init->categories, GINT_TO_POINTER(id), cat);
+ }
+}
+
+static
+void
dbus_log_client_init_get_all_finished(
GObject* proxy,
GAsyncResult* result,
gpointer data)
{
- GError* error = NULL;
DBusLogClientInit* init = data;
+ GError* error = NULL;
gint version;
gint default_level;
- GVariant* list = NULL;
+ GVariant* cats = NULL;
GASSERT(ORG_NEMOMOBILE_LOGGER(proxy) == init->proxy);
if (org_nemomobile_logger_call_get_all_finish(init->proxy, &version,
- &default_level, &list, result, &error)) {
- GVariantIter it;
- GVariant* child;
-
- /* Decode categories */
- GDEBUG("%u categories", (guint)g_variant_n_children(list));
- for (g_variant_iter_init(&it, list);
- (child = g_variant_iter_next_value(&it)) != NULL;
- g_variant_unref(child)) {
- DBusLogCategory* cat;
- const char* name = NULL;
- guint id = 0, flags = 0;
- gint level = 0;
- g_variant_get(child, "(&suui)", &name, &id, &flags, &level);
- cat = dbus_log_category_new(name, id);
- cat->flags = flags;
- cat->level = level;
- /* Hashtable takes ownership of this DBusLogCategory */
- g_hash_table_replace(init->categories, GINT_TO_POINTER(id), cat);
- }
- g_variant_unref(list);
+ &default_level, &cats, result, &error)) {
+ dbus_log_client_decode_categories(init, cats);
+ g_variant_unref(cats);
init->client->default_level = default_level;
+ /* Done with init. This emits the CONNECTED signal */
+ dbus_log_client_init_free(init, NULL);
+ } else {
+ dbus_log_client_init_free(init, error);
+ }
+}
+static
+void
+dbus_log_client_init_get_all2_finished(
+ GObject* proxy,
+ GAsyncResult* result,
+ gpointer data)
+{
+ DBusLogClientInit* init = data;
+ GError* error = NULL;
+ gint version, default_level, backlog;
+ GVariant* cats = NULL;
+ GASSERT(ORG_NEMOMOBILE_LOGGER(proxy) == init->proxy);
+ if (org_nemomobile_logger_call_get_all2_finish(init->proxy, &version,
+ &default_level, &cats, &backlog, result, &error)) {
+ DBusLogClient* client = init->client;
+ dbus_log_client_decode_categories(init, cats);
+ g_variant_unref(cats);
+ client->default_level = default_level;
+ client->backlog = backlog;
/* Done with init. This emits the CONNECTED signal */
- dbus_log_client_init_free(init, TRUE);
+ dbus_log_client_init_free(init, NULL);
} else {
- GERR("%s", GERRMSG(error));
- dbus_log_client_emit(init->client, SIGNAL_CONNECT_ERROR, error);
- g_error_free(error);
- dbus_log_client_init_free(init, FALSE);
+ dbus_log_client_init_free(init, error);
+ }
+}
+
+static
+void
+dbus_log_client_init_get_interface_version_finished(
+ GObject* proxy,
+ GAsyncResult* result,
+ gpointer data)
+{
+ DBusLogClientInit* init = data;
+ GError* error = NULL;
+ gint version;
+ GASSERT(ORG_NEMOMOBILE_LOGGER(proxy) == init->proxy);
+ if (org_nemomobile_logger_call_get_interface_version_finish(init->proxy,
+ &version,result, &error)) {
+ init->client->api_version = version;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/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:
+ */
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/debian/changelog
^
|
@@ -0,0 +1,53 @@
+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
+
+ -- Slava Monich <slava.monich@jolla.com> Sun, 18 Nov 2018 02:54:03 +0200
+
+libdbuslog (1.0.14) unstable; urgency=low
+
+ * Added dbus_log_server_add_default_level_handler() function
+
+ -- Slava Monich <slava.monich@jolla.com> Sun, 04 Nov 2018 02:05:48 +0300
+
+libdbuslog (1.0.13) unstable; urgency=low
+
+ * Added pkgconfig files to debian packages
+ * Fixed dbuslog-client permissions
+ * Added dbus_log_server_remove_all_handlers macro
+
+ -- Slava Monich <slava.monich@jolla.com> Fri, 02 Nov 2018 01:19:11 +0300
+
+libdbuslog (1.0.12) unstable; urgency=low
+
+ * Added debian packaging
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 01 Nov 2018 12:07:55 +0300
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/debian/compat
^
|
@@ -0,0 +1 @@
+5
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/debian/control
^
|
@@ -0,0 +1,41 @@
+Source: libdbuslog
+Section: libs
+Priority: optional
+Maintainer: Slava Monich <slava.monich@jolla.com>
+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
+Section: libdevel
+Architecture: any
+Description: Common development files for libdbuslogserver-dbus-devel and libdbuslogserver-gio-devel
+
+Package: libdbuslogserver-dbus
+Section: libs
+Architecture: any
+Depends: libglibutil (>= 1.0.43), ${shlibs:Depends}, ${misc:Depends}
+Description: Library of logging utilities for libdbus based programs
+
+Package: libdbuslogserver-dbus-dev
+Section: libdevel
+Architecture: any
+Depends: libdbuslogserver-dbus(= ${binary:Version}), libdbuslogserver-common-dev(= ${binary:Version}), ${misc:Depends}
+Description: Development files for libdbusaccess
+
+Package: libdbuslogserver-gio
+Section: libs
+Architecture: any
+Depends: libglibutil (>= 1.0.43), ${shlibs:Depends}, ${misc:Depends}
+Description: Library of logging utilities for libdbus based programs
+
+Package: libdbuslogserver-gio-dev
+Section: libdevel
+Architecture: any
+Depends: libdbuslogserver-gio(= ${binary:Version}), libdbuslogserver-common-dev(= ${binary:Version}), ${misc:Depends}
+Description: Development files for libdbusaccess
+
+Package: dbuslog-tools
+Section: utils
+Architecture: any
+Depends: libdbusaccess, ${shlibs:Depends}, ${misc:Depends}
+Description: D-Bus logging tools
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/debian/copyright
^
|
@@ -0,0 +1,29 @@
+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:
+
+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.
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/debian/dbuslog-tools.install
^
|
@@ -0,0 +1 @@
+debian/tmp/usr/bin/* usr/bin
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/debian/libdbuslogserver-common-dev.install
^
|
@@ -0,0 +1 @@
+debian/tmp/usr/include/dbuslogserver/*.h usr/include/dbuslogserver
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/debian/libdbuslogserver-dbus.install.in
^
|
@@ -0,0 +1 @@
+debian/tmp/@LIBDIR@/libdbuslogserver-dbus.so.* @LIBDIR@
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/debian/libdbuslogserver-gio.install.in
^
|
@@ -0,0 +1 @@
+debian/tmp/@LIBDIR@/libdbuslogserver-gio.so.* @LIBDIR@
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/debian/rules
^
|
@@ -0,0 +1,27 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# 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:
+ dh_auto_clean -- -C test
+ dh_auto_clean -- -C common
+ dh_auto_clean -- -C client
+ dh_auto_clean -- -C server
+ dh_auto_clean -- -C $(DBUSLOG_CLIENT_DIR)
+
+override_dh_auto_build:
+ 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 $@
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/debian/source/format
^
|
@@ -0,0 +1 @@
+1.0
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/debian/source/options
^
|
@@ -0,0 +1 @@
+tar-ignore = ".git"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/rpm/libdbuslog.spec
^
|
@@ -1,14 +1,16 @@
Name: dbuslog-tools
-Version: 1.0.11
+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,19 +23,16 @@
%setup -q
%build
-make -C tools/dbuslog-client KEEP_SYMBOLS=1 release
-make -C server KEEP_SYMBOLS=1 dbus-release dbus-pkgconfig
-make -C server KEEP_SYMBOLS=1 gio-release gio-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 server dbus-install-dev DESTDIR=%{buildroot}
-make -C server gio-install-dev DESTDIR=%{buildroot}
-install -d %{buildroot}/%{_bindir}
-install -m 755 tools/dbuslog-client/build/release/dbuslog-client %{buildroot}/%{_bindir}
+make DESTDIR=%{buildroot} LIBDIR=%{_libdir} -C tools/dbuslog-client install
+make DESTDIR=%{buildroot} LIBDIR=%{_libdir} -C server install-dev
%files
%defattr(-,root,root,-)
@@ -41,10 +40,25 @@
#############################################################################
+%package -n libdbuslogserver-common-devel
+Summary: Common development files
+Group: Development/Libraries
+
+%description -n libdbuslogserver-common-devel
+This package contains development files shared by libdbuslogserver-dbus-devel
+and libdbuslogserver-gio-devel.
+
+%files -n libdbuslogserver-common-devel
+%defattr(-,root,root,-)
+%{_includedir}/dbuslogserver/*.h
+
+#############################################################################
+
%package -n libdbuslogserver-dbus
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
@@ -54,6 +68,7 @@
%package -n libdbuslogserver-dbus-devel
Summary: Development library for libdbuslogserver-dbus
+Requires: libdbuslogserver-common-devel = %{version}
Requires: libdbuslogserver-dbus = %{version}
Requires: pkgconfig
@@ -72,13 +87,14 @@
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/libdbuslogserver-dbus.pc
%{_libdir}/libdbuslogserver-dbus.so
-%{_includedir}/dbuslogserver-dbus/*.h
+%{_includedir}/dbuslogserver/dbus/*.h
#############################################################################
%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
@@ -88,6 +104,7 @@
%package -n libdbuslogserver-gio-devel
Summary: Development library for libdbuslogserver-gio
+Requires: libdbuslogserver-common-devel = %{version}
Requires: libdbuslogserver-gio = %{version}
Requires: pkgconfig
@@ -106,4 +123,4 @@
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/libdbuslogserver-gio.pc
%{_libdir}/libdbuslogserver-gio.so
-%{_includedir}/dbuslogserver-gio/*.h
+%{_includedir}/dbuslogserver/gio/*.h
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/Makefile
^
|
@@ -1,7 +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-pkgconfig dbus-install dbus-install-dev
+.PHONY: gio-pkgconfig gio-install gio-install-dev
#
# Required packages
@@ -9,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
@@ -72,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
@@ -79,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)
@@ -87,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
@@ -112,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
@@ -233,6 +242,8 @@
gio-pkgconfig: $(GIO_PKGCONFIG)
+distclean: clean
+
clean:
rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~
rm -fr $(BUILD_DIR)
@@ -315,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 $@
@@ -339,38 +347,51 @@
$(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
#
-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_PKGCONFIG_DIR = $(DESTDIR)/usr/lib/pkgconfig
-INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include
-DBUS_INSTALL_INCLUDE_DIR = $(INSTALL_INCLUDE_DIR)/$(DBUS_NAME)
-GIO_INSTALL_INCLUDE_DIR = $(INSTALL_INCLUDE_DIR)/$(GIO_NAME)
+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-dev: dbus-install-dev gio-install-dev
+
+common-install-dev: $(INSTALL_INCLUDE_DIR)
+ $(INSTALL_FILES) $(INCLUDE_DIR)/*.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)
ln -sf $(DBUS_LIB) $(INSTALL_LIB_DIR)/$(DBUS_LIB_SYMLINK2)
ln -sf $(DBUS_LIB_SYMLINK2) $(INSTALL_LIB_DIR)/$(DBUS_LIB_SYMLINK1)
-dbus-install-dev: dbus-install $(DBUS_INSTALL_INCLUDE_DIR) $(INSTALL_PKGCONFIG_DIR)
- $(INSTALL_FILES) $(INCLUDE_DIR)/*.h $(DBUS_INSTALL_INCLUDE_DIR)
+dbus-install-dev: dbus-install common-install-dev $(DBUS_INSTALL_INCLUDE_DIR) $(INSTALL_PKGCONFIG_DIR)
$(INSTALL_FILES) $(DBUS_INCLUDE_DIR)/*.h $(DBUS_INSTALL_INCLUDE_DIR)
- $(INSTALL_FILES) $(COMMON_INCLUDE_DIR)/dbuslog_protocol.h $(DBUS_INSTALL_INCLUDE_DIR)
$(INSTALL_FILES) $(DBUS_PKGCONFIG) $(INSTALL_PKGCONFIG_DIR)
ln -sf $(DBUS_LIB_SYMLINK1) $(INSTALL_LIB_DIR)/$(DBUS_LIB_DEV_SYMLINK)
@@ -379,16 +400,17 @@
ln -sf $(GIO_LIB) $(INSTALL_LIB_DIR)/$(GIO_LIB_SYMLINK2)
ln -sf $(GIO_LIB_SYMLINK2) $(INSTALL_LIB_DIR)/$(GIO_LIB_SYMLINK1)
-gio-install-dev: gio-install $(GIO_INSTALL_INCLUDE_DIR) $(INSTALL_PKGCONFIG_DIR)
- $(INSTALL_FILES) $(INCLUDE_DIR)/*.h $(GIO_INSTALL_INCLUDE_DIR)
+gio-install-dev: gio-install common-install-dev $(GIO_INSTALL_INCLUDE_DIR) $(INSTALL_PKGCONFIG_DIR)
$(INSTALL_FILES) $(GIO_INCLUDE_DIR)/*.h $(GIO_INSTALL_INCLUDE_DIR)
- $(INSTALL_FILES) $(COMMON_INCLUDE_DIR)/dbuslog_protocol.h $(GIO_INSTALL_INCLUDE_DIR)
$(INSTALL_FILES) $(GIO_PKGCONFIG) $(INSTALL_PKGCONFIG_DIR)
ln -sf $(GIO_LIB_SYMLINK1) $(INSTALL_LIB_DIR)/$(GIO_LIB_DEV_SYMLINK)
$(INSTALL_LIB_DIR):
$(INSTALL_DIRS) $@
+$(INSTALL_INCLUDE_DIR):
+ $(INSTALL_DIRS) $@
+
$(DBUS_INSTALL_INCLUDE_DIR):
$(INSTALL_DIRS) $@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/include/dbuslog_server.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -55,6 +55,13 @@
DBUSLOG_LEVEL level,
gpointer user_data);
+typedef
+void
+(*DBusLogServerLogLevelFunc)(
+ DBusLogServer* server,
+ DBUSLOG_LEVEL level,
+ gpointer user_data);
+
DBusLogServer*
dbus_log_server_ref(
DBusLogServer* server);
@@ -85,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,
@@ -136,6 +149,12 @@
DBusLogServerCategoryLevelFunc fn,
gpointer user_data);
+gulong
+dbus_log_server_add_default_level_handler(
+ DBusLogServer* server,
+ DBusLogServerLogLevelFunc fn,
+ gpointer user_data); /* Since 1.0.14 */
+
void
dbus_log_server_remove_handler(
DBusLogServer* server,
@@ -147,6 +166,9 @@
gulong* ids,
guint count);
+#define dbus_log_server_remove_all_handlers(server,ids) \
+ dbus_log_server_remove_handlers(server, ids, G_N_ELEMENTS(ids))
+
G_END_DECLS
#endif /* DBUSLOG_SERVER_H */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/libdbuslogserver-dbus.pc.in
^
|
@@ -1,10 +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${includedir}/${name}
+Cflags: -I${includedir} -I${rootincludedir} -I${rootincludedir}/dbus
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/libdbuslogserver-gio.pc.in
^
|
@@ -1,10 +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${includedir}/${name}
+Cflags: -I${includedir} -I${rootincludedir} -I${rootincludedir}/gio
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/src/dbus/dbuslog_server_dbus.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -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())
@@ -223,22 +224,20 @@
}
static
-DBusMessage*
-dbus_log_server_dbus_handle_get_all(
+void
+dbus_log_server_dbus_append_get_all(
DBusLogServerDbus* self,
- DBusMessage* msg)
+ DBusMessageIter* it)
{
DBusLogCore* core = self->server.core;
GPtrArray* cats = dbus_log_core_get_categories(core);
- DBusMessage* reply = dbus_message_new_method_return(msg);
- DBusMessageIter it, a;
+ DBusMessageIter a;
guint i;
const dbus_int32_t version = DBUSLOG_INTERFACE_VERSION;
const dbus_int32_t loglevel = dbus_log_core_default_level(core);
- dbus_message_iter_init_append(reply, &it);
- dbus_message_iter_append_basic(&it, DBUS_TYPE_INT32, &version);
- dbus_message_iter_append_basic(&it, DBUS_TYPE_INT32, &loglevel);
- dbus_message_iter_open_container(&it, DBUS_TYPE_ARRAY, "(suui)", &a);
+ dbus_message_iter_append_basic(it, DBUS_TYPE_INT32, &version);
+ dbus_message_iter_append_basic(it, DBUS_TYPE_INT32, &loglevel);
+ dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, "(suui)", &a);
for (i=0; i<cats->len; i++) {
DBusMessageIter s;
DBusLogCategory* cat = g_ptr_array_index(cats, i);
@@ -252,7 +251,44 @@
dbus_message_iter_append_basic(&s, DBUS_TYPE_INT32, &level);
dbus_message_iter_close_container(&a, &s);
}
- dbus_message_iter_close_container(&it, &a);
+ dbus_message_iter_close_container(it, &a);
+}
+
+static
+DBusMessage*
+dbus_log_server_dbus_handle_get_all(
+ DBusLogServerDbus* self,
+ DBusMessage* msg)
+{
+ DBusMessageIter it;
+ DBusMessage* reply = dbus_message_new_method_return(msg);
+ dbus_message_iter_init_append(reply, &it);
+ dbus_log_server_dbus_append_get_all(self, &it);
+ return reply;
+}
+
+static
+void
+dbus_log_server_dbus_append_get_all2(
+ DBusLogServerDbus* self,
+ DBusMessageIter* it)
+{
+ DBusLogCore* core = self->server.core;
+ const dbus_int32_t backlog = dbus_log_core_backlog(core);
+ dbus_log_server_dbus_append_get_all(self, it);
+ dbus_message_iter_append_basic(it, DBUS_TYPE_INT32, &backlog);
+}
+
+static
+DBusMessage*
+dbus_log_server_dbus_handle_get_all2(
+ DBusLogServerDbus* self,
+ DBusMessage* msg)
+{
+ DBusMessageIter it;
+ DBusMessage* reply = dbus_message_new_method_return(msg);
+ dbus_message_iter_init_append(reply, &it);
+ dbus_log_server_dbus_append_get_all2(self, &it);
return reply;
}
@@ -443,6 +479,23 @@
}
static
+DBusMessage*
+dbus_log_server_dbus_handle_set_backlog(
+ DBusLogServerDbus* self,
+ DBusMessage* msg)
+{
+ int err = -EINVAL;
+ dbus_int32_t backlog = 0;
+ if (dbus_message_get_args(msg, NULL,
+ DBUS_TYPE_INT32, &backlog,
+ DBUS_TYPE_INVALID)) {
+ err = dbus_log_server_call_set_backlog(&self->server,
+ dbus_message_get_sender(msg), backlog);
+ }
+ return dbus_log_server_return(msg, err);
+}
+
+static
void
dbus_log_server_dbus_emit_default_level_changed(
DBusLogServer* server)
@@ -552,6 +605,26 @@
}
static
+void
+dbus_log_server_dbus_emit_backlog_changed(
+ DBusLogServer* server,
+ int backlog)
+{
+ DBusLogServerDbus* self = DBUSLOG_SERVER_DBUS(server);
+ DBusMessage* signal = dbus_message_new_signal(server->path,
+ DBUSLOG_INTERFACE, "BacklogChanged");
+ if (signal) {
+ const dbus_int32_t value = backlog;
+ if (dbus_message_append_args(signal,
+ DBUS_TYPE_INT32, &value,
+ DBUS_TYPE_INVALID)) {
+ dbus_connection_send(self->conn, signal, NULL);
+ }
+ dbus_message_unref(signal);
+ }
+}
+
+static
DBusHandlerResult
dbus_log_server_dbus_filter(
DBusConnection* conn,
@@ -575,6 +648,9 @@
"GetAll", "",
dbus_log_server_dbus_handle_get_all
},{
+ "GetAll2", "",
+ dbus_log_server_dbus_handle_get_all2
+ },{
"SetDefaultLevel", "i",
dbus_log_server_dbus_handle_set_default_level
},{
@@ -594,10 +670,13 @@
dbus_log_server_dbus_handle_category_enable_pattern
},{
"CategoryDisable", "as",
- dbus_log_server_dbus_handle_category_disable
+ dbus_log_server_dbus_handle_category_disable
},{
"CategoryDisablePattern", "s",
dbus_log_server_dbus_handle_category_disable_pattern
+ },{
+ "SetBacklog", "i",
+ dbus_log_server_dbus_handle_set_backlog
}
};
guint i;
@@ -740,6 +819,7 @@
klass->emit_category_removed = dbus_log_server_dbus_emit_category_removed;
klass->emit_category_flags_changed =
dbus_log_server_dbus_emit_category_flags_changed;
+ klass->emit_backlog_changed = dbus_log_server_dbus_emit_backlog_changed;
G_OBJECT_CLASS(klass)->finalize = dbus_log_server_dbus_finalize;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/src/dbuslog_core.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -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 {
@@ -61,6 +69,7 @@
DBUSLOG_CORE_TYPE, DBusLogCore))
enum dbus_log_core_signal {
+ SIGNAL_BACKLOG,
SIGNAL_DEFAULT_LEVEL,
SIGNAL_CATEGORY_ADDED,
SIGNAL_CATEGORY_REMOVED,
@@ -69,6 +78,7 @@
SIGNAL_COUNT
};
+#define SIGNAL_BACKLOG_NAME "dbuslog-core-backlog"
#define SIGNAL_DEFAULT_LEVEL_NAME "dbuslog-core-default-level"
#define SIGNAL_CATEGORY_ADDED_NAME "dbuslog-core-category-added"
#define SIGNAL_CATEGORY_REMOVED_NAME "dbuslog-core-category-removed"
@@ -119,7 +129,7 @@
guint backlog)
{
DBusLogCore* self = g_object_new(DBUSLOG_CORE_TYPE, NULL);
- self->backlog = backlog;
+ self->backlog = dbus_log_sender_normalize_backlog(backlog);
return self;
}
@@ -262,6 +272,34 @@
return FALSE;
}
+int
+dbus_log_core_backlog(
+ DBusLogCore* self)
+{
+ return G_LIKELY(self) ? self->backlog : 0;
+}
+
+void
+dbus_log_core_set_backlog(
+ DBusLogCore* self,
+ int backlog)
+{
+ if (G_LIKELY(self)) {
+ backlog = dbus_log_sender_normalize_backlog(backlog);
+ if (self->backlog != backlog) {
+ GPtrArray* senders = self->senders;
+ guint i;
+
+ self->backlog = backlog;
+ for (i = 0; i < senders->len; i++) {
+ dbus_log_sender_set_backlog(g_ptr_array_index(senders, i),
+ backlog);
+ }
+ g_signal_emit(self, dbus_log_core_signals[SIGNAL_BACKLOG], 0);
+ }
+ }
+}
+
DBusLogCategory*
dbus_log_core_new_category(
DBusLogCore* self,
@@ -417,7 +455,7 @@
}
}
-void
+gboolean
dbus_log_core_set_category_level(
DBusLogCore* self,
const char* name,
@@ -427,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
@@ -529,6 +571,16 @@
}
gulong
+dbus_log_core_add_backlog_handler(
+ DBusLogCore* self,
+ DBusLogCoreFunc fn,
+ gpointer data)
+{
+ return (G_LIKELY(self) && G_LIKELY(fn)) ? g_signal_connect(self,
+ SIGNAL_BACKLOG_NAME, G_CALLBACK(fn), data) : 0;
+}
+
+gulong
dbus_log_core_add_default_level_handler(
DBusLogCore* self,
DBusLogCoreFunc fn,
@@ -679,6 +731,10 @@
g_signal_new(SIGNAL_DEFAULT_LEVEL_NAME,
class_type, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
+ dbus_log_core_signals[SIGNAL_BACKLOG] =
+ g_signal_new(SIGNAL_BACKLOG_NAME,
+ class_type, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 0);
dbus_log_core_signals[SIGNAL_CATEGORY_ADDED] =
g_signal_new(SIGNAL_CATEGORY_ADDED_NAME,
class_type, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL,
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/src/dbuslog_core.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -91,6 +91,15 @@
DBusLogCore* core,
DBUSLOG_LEVEL level);
+int
+dbus_log_core_backlog(
+ DBusLogCore* core);
+
+void
+dbus_log_core_set_backlog(
+ DBusLogCore* core,
+ int backlog);
+
DBusLogCategory*
dbus_log_core_new_category(
DBusLogCore* core,
@@ -127,7 +136,7 @@
const char* name,
gboolean enabled);
-void
+gboolean
dbus_log_core_set_category_level(
DBusLogCore* core,
const char* name,
@@ -151,6 +160,12 @@
/* Signals */
gulong
+dbus_log_core_add_backlog_handler(
+ DBusLogCore* core,
+ DBusLogCoreFunc fn,
+ gpointer data);
+
+gulong
dbus_log_core_add_default_level_handler(
DBusLogCore* core,
DBusLogCoreFunc fn,
@@ -191,6 +206,9 @@
gulong* ids,
guint count);
+#define dbus_log_core_remove_all_handlers(core,ids) \
+ dbus_log_core_remove_handlers(core, ids, G_N_ELEMENTS(ids))
+
#endif /* DBUSLOG_CORE_H */
/*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/src/dbuslog_sender.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -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_prepare_current_message(
DBusLogSender* self);
static
void
-dbus_log_sender_send_message(
+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
@@ -317,9 +343,9 @@
DBusLogSenderPriv* priv = self->priv;
int writefd = pipefd[1];
self->readfd = pipefd[0];
- priv->buffer = gutil_ring_new_full(0, (backlog > 0) ? backlog :
- (backlog == 0) ? DBUSLOG_SENDER_DEFAULT_BACKLOG :
- GUTIL_RING_UNLIMITED_SIZE, dbus_log_sender_buffer_free_func);
+ priv->buffer = gutil_ring_new_full(0,
+ dbus_log_sender_normalize_backlog(backlog),
+ dbus_log_sender_buffer_free_func);
self->name = priv->name = g_strdup(name);
priv->io = g_io_channel_unix_new(writefd);
if (priv->io) {
@@ -358,6 +384,19 @@
}
}
+void
+dbus_log_sender_set_backlog(
+ DBusLogSender* self,
+ int backlog)
+{
+ if (G_LIKELY(self)) {
+ DBusLogSenderPriv* priv = self->priv;
+
+ gutil_ring_set_max_size(priv->buffer,
+ dbus_log_sender_normalize_backlog(backlog));
+ }
+}
+
gboolean
dbus_log_sender_ping(
DBusLogSender* self)
@@ -383,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,
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/src/dbuslog_sender.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2018 Jolla Ltd.
+ * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -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
@@ -66,6 +66,11 @@
dbus_log_sender_unref(
DBusLogSender* sender);
+void
+dbus_log_sender_set_backlog(
+ DBusLogSender* sender,
+ int backlog);
+
gboolean
dbus_log_sender_ping(
DBusLogSender* sender);
@@ -96,6 +101,10 @@
DBusLogSender* sender,
gulong id);
+int
+dbus_log_sender_normalize_backlog(
+ int backlog);
+
#endif /* DBUSLOG_SENDER_H */
/*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/src/dbuslog_server.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -30,6 +30,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "dbuslog_server_p.h"
#include "dbuslog_server_log.h"
@@ -39,6 +41,7 @@
#include <errno.h>
enum dbus_log_server_core_signal {
+ DBUSLOG_CORE_SIGNAL_BACKLOG,
DBUSLOG_CORE_SIGNAL_DEFAULT_LEVEL,
DBUSLOG_CORE_SIGNAL_CATEGORY_ADDED,
DBUSLOG_CORE_SIGNAL_CATEGORY_REMOVED,
@@ -70,12 +73,14 @@
SIGNAL_CATEGORY_ENABLED,
SIGNAL_CATEGORY_DISABLED,
SIGNAL_CATEGORY_LEVEL,
+ SIGNAL_DEFAULT_LEVEL,
SIGNAL_COUNT
};
#define SIGNAL_CATEGORY_ENABLED_NAME "dbuslog-server-category-enabled"
#define SIGNAL_CATEGORY_DISABLED_NAME "dbuslog-server-category-disabled"
#define SIGNAL_CATEGORY_LEVEL_NAME "dbuslog-server-category-level"
+#define SIGNAL_DEFAULT_LEVEL_NAME "dbuslog-server-default-level"
static guint dbus_log_server_signals[SIGNAL_COUNT] = { 0 };
@@ -85,7 +90,8 @@
DBUSLOG_ACTION_SET_CATEGORY_LEVEL,
DBUSLOG_ACTION_LOG_OPEN,
DBUSLOG_ACTION_CATEGORY_ENABLE,
- DBUSLOG_ACTION_CATEGORY_DISABLE
+ DBUSLOG_ACTION_CATEGORY_DISABLE,
+ DBUSLOG_ACTION_SET_BACKLOG
} DBUSLOG_ACTION;
static const DA_ACTION dbus_log_server_policy_actions[] = {
@@ -94,6 +100,7 @@
{ "LogOpen", DBUSLOG_ACTION_LOG_OPEN, 0 },
{ "CategoryEnable", DBUSLOG_ACTION_CATEGORY_ENABLE, 0 },
{ "CategoryDisable", DBUSLOG_ACTION_CATEGORY_DISABLE, 0 },
+ { "SetBacklog", DBUSLOG_ACTION_SET_BACKLOG, 0 },
{ NULL }
};
@@ -122,13 +129,29 @@
static
void
+dbus_log_server_backlog_changed(
+ DBusLogCore* core,
+ gpointer user_data)
+{
+ DBusLogServer* self = DBUSLOG_SERVER(user_data);
+ DBusLogServerClass* klass = DBUSLOG_SERVER_GET_CLASS(self);
+ if (self->started && klass->emit_backlog_changed) {
+ klass->emit_backlog_changed(self, dbus_log_core_backlog(self->core));
+ }
+}
+
+static
+void
dbus_log_server_default_level_changed(
DBusLogCore* core,
gpointer user_data)
{
DBusLogServer* self = DBUSLOG_SERVER(user_data);
- if (self->started) {
- DBUSLOG_SERVER_GET_CLASS(self)->emit_default_level_changed(self);
+ DBusLogServerClass* klass = DBUSLOG_SERVER_GET_CLASS(self);
+ g_signal_emit(self, dbus_log_server_signals[SIGNAL_DEFAULT_LEVEL], 0,
+ dbus_log_core_default_level(self->core));
+ if (self->started && klass->emit_default_level_changed) {
+ klass->emit_default_level_changed(self);
}
}
@@ -336,6 +359,21 @@
}
}
+int
+dbus_log_server_call_set_backlog(
+ DBusLogServer* self,
+ const char* sender,
+ int backlog)
+{
+ if (!dbus_log_server_access_allowed(self, sender,
+ DBUSLOG_ACTION_SET_BACKLOG)) {
+ return -EACCES;
+ } else {
+ dbus_log_core_set_backlog(self->core, backlog);
+ return 0;
+ }
+}
+
/*==========================================================================*
* API
*==========================================================================*/
@@ -353,11 +391,6 @@
/* Attach to the core signals */
self->core = dbus_log_core_new(0);
- if (klass->emit_default_level_changed) {
- priv->core_signal_id[DBUSLOG_CORE_SIGNAL_DEFAULT_LEVEL] =
- dbus_log_core_add_default_level_handler(self->core,
- dbus_log_server_default_level_changed, self);
- }
if (klass->emit_category_added) {
priv->core_signal_id[DBUSLOG_CORE_SIGNAL_CATEGORY_ADDED] =
dbus_log_core_add_category_added_handler(self->core,
@@ -374,6 +407,12 @@
priv->core_signal_id[DBUSLOG_CORE_SIGNAL_CATEGORY_LEVEL] =
dbus_log_core_add_category_level_handler(self->core,
dbus_log_server_category_level_changed, self);
+ priv->core_signal_id[DBUSLOG_CORE_SIGNAL_DEFAULT_LEVEL] =
+ dbus_log_core_add_default_level_handler(self->core,
+ dbus_log_server_default_level_changed, self);
+ priv->core_signal_id[DBUSLOG_CORE_SIGNAL_BACKLOG] =
+ dbus_log_core_add_backlog_handler(self->core,
+ dbus_log_server_backlog_changed, self);
}
DBusLogServer*
@@ -463,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,
@@ -553,6 +602,16 @@
SIGNAL_CATEGORY_LEVEL_NAME, G_CALLBACK(fn), data) : 0;
}
+gulong
+dbus_log_server_add_default_level_handler(
+ DBusLogServer* self,
+ DBusLogServerLogLevelFunc fn,
+ 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;
+}
+
void
dbus_log_server_remove_handler(
DBusLogServer* self,
@@ -632,8 +691,7 @@
{
DBusLogServer* self = DBUSLOG_SERVER(object);
DBusLogServerPriv* priv = self->priv;
- dbus_log_core_remove_handlers(self->core, priv->core_signal_id,
- G_N_ELEMENTS(priv->core_signal_id));
+ dbus_log_core_remove_all_handlers(self->core, priv->core_signal_id);
dbus_log_core_unref(self->core);
da_policy_unref(priv->policy);
g_hash_table_destroy(priv->peers);
@@ -666,6 +724,10 @@
g_signal_new(SIGNAL_CATEGORY_LEVEL_NAME, class_type,
G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL,
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_INT);
+ dbus_log_server_signals[SIGNAL_DEFAULT_LEVEL] =
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/src/dbuslog_server_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -38,7 +38,7 @@
#include <gutil_strv.h>
-#define DBUSLOG_INTERFACE_VERSION (1)
+#define DBUSLOG_INTERFACE_VERSION (2)
#define DBUSLOG_LOG_COOKIE (1)
typedef struct dbus_log_server_priv DBusLogServerPriv;
@@ -55,6 +55,7 @@
const char* path;
gboolean started;
gboolean exported;
+ int backlog;
};
typedef struct dbus_log_server_class {
@@ -99,9 +100,13 @@
DBusLogServer* self,
guint id,
guint flags);
+ void
+ (*emit_backlog_changed)(
+ DBusLogServer* self,
+ 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))
@@ -110,50 +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)
+ G_GNUC_INTERNAL;
#endif /* DBUSLOG_SERVER_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/server/src/gio/dbuslog_server_gio.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -53,6 +53,8 @@
DBUSLOG_METHOD_ENABLE_PATTERN,
DBUSLOG_METHOD_DISABLE,
DBUSLOG_METHOD_DISABLE_PATTERN,
+ DBUSLOG_METHOD_GET_ALL2,
+ DBUSLOG_METHOD_SET_BACKLOG,
DBUSLOG_METHOD_COUNT
};
@@ -66,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())
@@ -208,6 +211,18 @@
static
void
+dbus_log_server_gio_emit_backlog_changed(
+ DBusLogServer* server,
+ int backlog)
+{
+ DBusLogServerGio* self = DBUSLOG_SERVER_GIO(server);
+ if (self->iface) {
+ org_nemomobile_logger_emit_backlog_changed(self->iface, backlog);
+ }
+}
+
+static
+void
dbus_log_server_bus_acquired(
GDBusConnection* bus,
const char* name,
@@ -293,25 +308,48 @@
}
static
-gboolean
-dbus_log_server_handle_get_all(
- OrgNemomobileLogger* proxy,
- GDBusMethodInvocation* call,
- DBusLogServerGio* self)
+GVariant* /* floating */
+dbus_log_server_get_categories_as_variant(
+ DBusLogCore* core)
{
- DBusLogCore* core = self->server.core;
GPtrArray* cats = dbus_log_core_get_categories(core);
GVariantBuilder vb;
guint i;
g_variant_builder_init(&vb, G_VARIANT_TYPE("a(suui)"));
- for (i=0; i<cats->len; i++) {
+ for (i = 0; i < cats->len; i++) {
DBusLogCategory* cat = g_ptr_array_index(cats, i);
g_variant_builder_add(&vb, "(suui)", cat->name, cat->id, cat->flags,
cat->level);
}
+ return g_variant_builder_end(&vb);
+}
+
+static
+gboolean
+dbus_log_server_handle_get_all(
+ OrgNemomobileLogger* proxy,
+ GDBusMethodInvocation* call,
+ DBusLogServerGio* self)
+{
+ DBusLogCore* core = self->server.core;
org_nemomobile_logger_complete_get_all(proxy, call,
DBUSLOG_INTERFACE_VERSION, dbus_log_core_default_level(core),
- g_variant_builder_end(&vb));
+ dbus_log_server_get_categories_as_variant(core));
+ return TRUE;
+}
+
+static
+gboolean
+dbus_log_server_handle_get_all2(
+ OrgNemomobileLogger* proxy,
+ GDBusMethodInvocation* call,
+ DBusLogServerGio* self)
+{
+ DBusLogCore* core = self->server.core;
+ org_nemomobile_logger_complete_get_all2(proxy, call,
+ DBUSLOG_INTERFACE_VERSION, dbus_log_core_default_level(core),
+ dbus_log_server_get_categories_as_variant(core),
+ dbus_log_core_backlog(core));
return TRUE;
}
@@ -464,6 +502,24 @@
return TRUE;
}
+static
+gboolean
+dbus_log_server_handle_set_backlog(
+ OrgNemomobileLogger* proxy,
+ GDBusMethodInvocation* call,
+ gint backlog,
+ DBusLogServerGio* self)
+{
+ const int err = dbus_log_server_call_set_backlog(&self->server,
+ g_dbus_method_invocation_get_sender(call), backlog);
+ if (err) {
+ dbus_log_server_return_error(call, err);
+ } else {
+ org_nemomobile_logger_complete_set_backlog(proxy, call);
+ }
+ return TRUE;
+}
+
/*==========================================================================*
* API
*==========================================================================*/
@@ -487,6 +543,9 @@
self->iface_method_id[DBUSLOG_METHOD_GET_ALL] =
g_signal_connect(self->iface, "handle-get-all",
G_CALLBACK(dbus_log_server_handle_get_all), self);
+ self->iface_method_id[DBUSLOG_METHOD_GET_ALL] =
+ g_signal_connect(self->iface, "handle-get-all2",
+ G_CALLBACK(dbus_log_server_handle_get_all2), self);
self->iface_method_id[DBUSLOG_METHOD_SET_DEFAULT_LEVEL] =
g_signal_connect(self->iface, "handle-set-default-level",
G_CALLBACK(dbus_log_server_handle_set_default_level), self);
@@ -511,6 +570,9 @@
self->iface_method_id[DBUSLOG_METHOD_DISABLE_PATTERN] =
g_signal_connect(self->iface, "handle-category-disable-pattern",
G_CALLBACK(dbus_log_server_handle_disable_pattern), self);
+ self->iface_method_id[DBUSLOG_METHOD_SET_BACKLOG] =
+ g_signal_connect(self->iface, "handle-set-backlog",
+ G_CALLBACK(dbus_log_server_handle_set_backlog), self);
/* And start watching the requested name */
if (service) {
@@ -586,6 +648,7 @@
klass->emit_category_added = dbus_log_server_gio_emit_category_added;
klass->emit_category_removed = dbus_log_server_gio_emit_category_removed;
klass->emit_category_flags_changed = dbus_log_server_gio_emit_flags_changed;
+ klass->emit_backlog_changed = dbus_log_server_gio_emit_backlog_changed;
G_OBJECT_CLASS(klass)->finalize = dbus_log_server_gio_finalize;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/spec/org.nemomobile.Logger.xml
^
|
@@ -3,10 +3,12 @@
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.nemomobile.Logger">
- <!-- Interface version is 1 -->
<method name="GetInterfaceVersion">
<arg name="version" type="i" direction="out"/>
</method>
+
+ <!-- Interface version 1 -->
+
<!--
Each list entry contains name (s), id(u), flags(u) and level(i)
@@ -72,5 +74,20 @@
<signal name="CategoryRemoved">
<arg name="id" type="u"/>
</signal>
+
+ <!-- Interface version 2 -->
+
+ <method name="GetAll2">
+ <arg name="version" type="i" direction="out"/>
+ <arg name="level" type="i" direction="out"/>
+ <arg name="list" type="a(suui)" direction="out"/>
+ <arg name="backlog" type="i" direction="out"/>
+ </method>
+ <method name="SetBacklog">
+ <arg name="backlog" type="i" direction="in"/>
+ </method>
+ <signal name="BacklogChanged">
+ <arg name="backlog" type="i"/>
+ </signal>
</interface>
</node>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/test/Makefile
^
|
@@ -3,3 +3,8 @@
all:
%:
@$(MAKE) -C test_logger $*
+ @$(MAKE) -C test_util $@
+
+clean: distclean
+ rm -f coverage/*.gcov
+ rm -fr coverage/results
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/test/test_logger/test_logger.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -83,6 +83,7 @@
GMainLoop* loop;
DBusLogSender* sender;
int default_level_changed;
+ int backlog_changed;
int received;
int received_ok;
int ret;
@@ -106,6 +107,17 @@
static
void
+test_basic_backlog_changed(
+ DBusLogCore* core,
+ gpointer user_data)
+{
+ TestBasic* test = user_data;
+ test->backlog_changed++;
+ GVERBOSE_("%d", dbus_log_core_backlog(core));
+}
+
+static
+void
test_basic_message_received(
DBusLogReceiver* receiver,
DBusLogMessage* msg,
@@ -153,7 +165,7 @@
DBusLogReceiver* receiver;
DBusLogSender* dummy;
DBusLogMessage* dummy_msg = dbus_log_message_new(NULL);
- gulong message_id, closed_id, default_level_id;
+ gulong message_id, closed_id, default_level_id, backlog_id;
guint i;
memset(&test, 0, sizeof(test));
@@ -164,6 +176,9 @@
default_level_id = dbus_log_core_add_default_level_handler(core,
test_basic_default_level_changed, &test);
+ backlog_id = dbus_log_core_add_backlog_handler(core,
+ test_basic_backlog_changed, &test);
+ g_assert(backlog_id);
dummy = dbus_log_core_new_sender(core, "Dummy1");
dbus_log_core_remove_sender(core, dummy);
@@ -225,6 +240,20 @@
dbus_log_core_add_category_removed_handler(core, NULL, NULL);
dbus_log_core_add_category_flags_handler(NULL, NULL, NULL);
dbus_log_core_add_category_flags_handler(core, NULL, NULL);
+
+ g_assert(!dbus_log_core_add_backlog_handler(NULL, NULL, NULL));
+ g_assert(!dbus_log_core_add_backlog_handler(core, NULL, NULL));
+ g_assert(!dbus_log_core_backlog(NULL));
+ g_assert(dbus_log_core_backlog(core));
+ dbus_log_core_set_backlog(NULL, 0);
+ g_assert(!test.backlog_changed);
+ dbus_log_core_set_backlog(core, 1);
+ g_assert(test.backlog_changed == 1);
+ dbus_log_core_set_backlog(core, 1);
+ g_assert(test.backlog_changed == 1);
+ dbus_log_core_set_backlog(core, 2);
+ g_assert(test.backlog_changed == 2);
+
dbus_log_core_remove_handler(NULL, 0);
dbus_log_core_remove_handler(core, 0);
dbus_log_message_ref(NULL);
@@ -281,6 +310,7 @@
dbus_log_receiver_unref(receiver);
dbus_log_sender_unref(test.sender);
dbus_log_core_remove_handler(core, default_level_id);
+ dbus_log_core_remove_handler(core, backlog_id);
dbus_log_core_unref(core);
dbus_log_message_unref(dummy_msg);
@@ -301,6 +331,7 @@
int add_count;
int remove_count;
int flags_count;
+ int level_count;
int ret;
} TestCat;
@@ -330,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,
@@ -388,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;
@@ -404,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);
@@ -440,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);
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/tools/dbuslog-client/Makefile
^
|
@@ -1,6 +1,6 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release
+.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)
@@ -164,3 +165,17 @@
ifeq ($(KEEP_SYMBOLS),0)
strip $@
endif
+
+#
+# Install
+#
+
+INSTALL = install
+
+INSTALL_BIN_DIR = $(DESTDIR)/usr/bin
+
+install: release $(INSTALL_BIN_DIR)
+ $(INSTALL) -m 755 $(RELEASE_EXE) $(INSTALL_BIN_DIR)
+
+$(INSTALL_BIN_DIR):
+ $(INSTALL) -d $@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libdbuslog/tools/dbuslog-client/main.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2018 Jolla Ltd.
+ * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -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
@@ -62,6 +62,7 @@
gboolean datetime;
gboolean timestamp;
gboolean print_log_level;
+ gboolean print_backlog;
char* out_filename;
FILE* out_file;
gulong event_id[APP_N_EVENTS];
@@ -254,6 +255,23 @@
static
DBusLogClientCall*
+app_action_set_backlog(
+ AppAction* action)
+{
+ AppActionInt* int_action = G_CAST(action,AppActionInt,action);
+ DBusLogClient* client = action->app->client;
+ if (client->api_version > 1) {
+ GDEBUG("Settings backlog to %d", int_action->value);
+ return dbus_log_client_set_backlog(action->app->client,
+ int_action->value, app_action_call_done, action);
+ } else {
+ GERR("Backlog API is not supported by the remote");
+ return NULL;
+ }
+}
+
+static
+DBusLogClientCall*
app_action_enable_all(
AppAction* action)
{
@@ -348,10 +366,19 @@
client_connected(
App* app)
{
+ DBusLogClient* client = app->client;
GDEBUG("Connected!");
if (app->print_log_level) {
app->print_log_level = FALSE;
- printf("%d\n", app->client->default_level);
+ printf("%d\n", client->default_level);
+ }
+ if (app->print_backlog) {
+ app->print_backlog = FALSE;
+ if (client->api_version > 1) {
+ printf("%d\n", client->backlog);
+ } else {
+ GERR("Backlog API is not supported by the remote");
+ }
}
app_next_action(app);
}
@@ -652,6 +679,32 @@
static
gboolean
+app_option_backlog(
+ const gchar* name,
+ const gchar* value,
+ gpointer data,
+ GError** error)
+{
+ App* app = data;
+ if (value) {
+ const int level = atoi(value);
+ if (level > 0) {
+ app_add_action(app, app_action_int_new(app,
+ app_action_set_backlog, level));
+ return TRUE;
+ } else {
+ g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
+ "Invalid backlog \'%s\'", value);
+ return FALSE;
+ }
+ } else {
+ app->print_backlog = TRUE;
+ return TRUE;
+ }
+}
+
+static
+gboolean
app_init(
App* app,
int argc,
@@ -685,6 +738,10 @@
app_option_log_level, "Show the current log level", NULL },
{ "log-level", 'l', 0, G_OPTION_ARG_CALLBACK, app_option_log_level,
"Set the log level (1..8)", "LEVEL" },
+ { "print-backlog", 'B', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
+ app_option_backlog, "Show current backlog", NULL },
+ { "backlog", 'b', 0, G_OPTION_ARG_CALLBACK, app_option_backlog,
+ "Set the backlog", "COUNT" },
{ "all", 'a', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
app_option_enable_all, "Enable all log categories", NULL },
{ "none", 'n', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
@@ -721,7 +778,7 @@
if (list) {
app_add_action(app, app_action_new(app, app_action_list));
}
- if (!app->actions && !app->print_log_level) {
+ if (!app->actions && !app->print_log_level && !app->print_backlog) {
/* Default action */
app->follow = TRUE;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/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 = 29
+VERSION_RELEASE = 42
# 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,16 @@
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
#
+ifndef CC
CC = $(CROSS_COMPILE)gcc
+endif
+
LD = $(CC)
WARNINGS = -Wall
INCLUDES = -I$(INCLUDE_DIR)
@@ -92,6 +84,7 @@
$(shell pkg-config --libs $(PKGS))
DEBUG_FLAGS = -g
RELEASE_FLAGS =
+COVERAGE_FLAGS = -g
ifndef KEEP_SYMBOLS
KEEP_SYMBOLS = 0
@@ -105,6 +98,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 +107,21 @@
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_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 +129,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: $(DEBUG_LIB)
+release: $(RELEASE_STATIC_LIB) $(RELEASE_LIB) $(RELEASE_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
@@ -183,12 +175,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)
@@ -200,6 +198,21 @@
strip $@
endif
+$(DEBUG_LINK):
+ ln -sf $(LIB) $@
+
+$(RELEASE_LINK):
+ ln -sf $(LIB) $@
+
+$(DEBUG_STATIC_LIB): $(DEBUG_OBJS)
+ $(AR) rc $@ $?
+
+$(RELEASE_STATIC_LIB): $(RELEASE_OBJS)
+ $(AR) rc $@ $?
+
+$(COVERAGE_STATIC_LIB): $(COVERAGE_OBJS)
+ $(AR) rc $@ $?
+
$(PKGCONFIG): $(LIB_NAME).pc.in
sed -e 's/\[version\]/'$(PCVERSION)/g $< > $@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/debian/changelog
^
|
@@ -1,3 +1,91 @@
+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
+
+ -- Slava Monich <slava.monich@jolla.com> Wed, 13 Feb 2019 19:56:31 +0300
+
+libglibutil (1.0.34) unstable; urgency=low
+
+ * Added a few more GUtilIdlePool functions:
+
+ gutil_idle_pool_destroy
+ gutil_idle_pool_add_bytes
+ gutil_idle_pool_add_bytes_ref
+
+ -- Slava Monich <slava.monich@jolla.com> Wed, 07 Nov 2018 17:57:52 +0300
+
+libglibutil (1.0.33) unstable; urgency=low
+
+ * Added GLOG_FLAG_DISABLE flag
+
+ -- Slava Monich <slava.monich@jolla.com> Sat, 03 Nov 2018 11:47:25 +0300
+
+libglibutil (1.0.32) unstable; urgency=low
+
+ * Added gutil_idle_pool_add_strv function
+
+ -- Slava Monich <slava.monich@jolla.com> Sun, 14 Oct 2018 00:47:01 +0300
+
+libglibutil (1.0.31) unstable; urgency=low
+
+ * Added GUtilData type and functions to work with it:
+
+ gutil_data_equal
+ gutil_data_from_string
+ gutil_data_from_bytes
+
+ -- Slava Monich <slava.monich@jolla.com> Sat, 13 Oct 2018 13:17:45 +0300
+
+libglibutil (1.0.30) unstable; urgency=low
+
+ * Added gutil_parse_int function
+
+ -- Slava Monich <slava.monich@jolla.com> Fri, 20 Jul 2018 00:06:40 +0300
+
libglibutil (1.0.29) unstable; urgency=low
* Added gutil_hexdump function
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/include/gutil_idlepool.h
^
|
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016-2018 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2018 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
@@ -48,6 +48,7 @@
* gutil_idle_pool_add_object()
* gutil_idle_pool_add_variant()
* gutil_idle_pool_add_ptr_array()
+ * gutil_idle_pool_add_bytes()
*
* The following functions, however, do add the reference and hold it
* until the pool is drained:
@@ -55,6 +56,7 @@
* gutil_idle_pool_add_object_ref()
* gutil_idle_pool_add_variant_ref()
* gutil_idle_pool_add_ptr_array_ref()
+ * gutil_idle_pool_add_bytes_ref()
*/
GUtilIdlePool*
@@ -73,6 +75,10 @@
GUtilIdlePool* pool);
void
+gutil_idle_pool_destroy(
+ GUtilIdlePool* pool); /* Since 1.0.34 */
+
+void
gutil_idle_pool_drain(
GUtilIdlePool* pool);
@@ -83,6 +89,11 @@
GDestroyNotify destroy);
void
+gutil_idle_pool_add_strv(
+ GUtilIdlePool* pool,
+ char** strv); /* Since 1.0.32 */
+
+void
gutil_idle_pool_add_object(
GUtilIdlePool* pool,
gpointer object);
@@ -98,6 +109,11 @@
GPtrArray* array);
void
+gutil_idle_pool_add_bytes(
+ GUtilIdlePool* pool,
+ GBytes* bytes); /* Since 1.0.34 */
+
+void
gutil_idle_pool_add_object_ref(
GUtilIdlePool* pool,
gpointer object);
@@ -112,6 +128,11 @@
GUtilIdlePool* pool,
GPtrArray* array);
+void
+gutil_idle_pool_add_bytes_ref(
+ GUtilIdlePool* pool,
+ GBytes* bytes); /* Since 1.0.34 */
+
G_END_DECLS
#endif /* GUTIL_IDLEPOOL_H */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/include/gutil_log.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2016 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * 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:
*
@@ -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 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
@@ -87,6 +87,7 @@
};
#define GLOG_FLAG_HIDE_NAME (0x01) /* Don't print the module name */
+#define GLOG_FLAG_DISABLE (0x02) /* Don't print this log */
/* Command line parsing helper. Option format is [module]:level
* where level can be either a number or log level name ("none", err etc.) */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/include/gutil_misc.h
^
|
@@ -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
@@ -40,7 +40,7 @@
void
gutil_disconnect_handlers(
gpointer instance,
- gulong *ids,
+ gulong* ids,
int count);
void*
@@ -61,7 +61,61 @@
gutil_hexdump(
char* buf,
const void* data,
- guint len); /* since 1.0.29 */
+ guint size); /* Since 1.0.29 */
+
+gboolean
+gutil_parse_int(
+ const char* str,
+ int base,
+ int* value); /* Since 1.0.30 */
+
+gboolean
+gutil_data_equal(
+ const GUtilData* data1,
+ 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); /* Since 1.0.31 */
+
+const GUtilData*
+gutil_data_from_bytes(
+ GUtilData* data,
+ 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-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/include/gutil_strv.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -53,6 +53,13 @@
guint i);
/**
+ * Returns the last string in the array, NULL if there's nothing there.
+ */
+const char*
+gutil_strv_last(
+ const GStrV* sv); /* Since 1.0.35 */
+
+/**
* Returns index of the specified string in the string array,
* or -1 if the string is not found.
*/
@@ -103,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-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/include/gutil_types.h
^
|
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014-2018 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2018 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
@@ -49,6 +49,11 @@
typedef struct gutil_ring GUtilRing;
typedef struct gutil_time_notify GUtilTimeNotify;
+typedef struct gutil_data {
+ const guint8* bytes;
+ gsize size;
+} GUtilData;
+
#define GLOG_MODULE_DECL(m) extern GLogModule m;
typedef struct glog_module GLogModule;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/libglibutil.pc.in
^
|
@@ -5,6 +5,6 @@
Name: libglibutil
Description: Library of glib utilities
Version: [version]
-Requires: glib-2.0
+Requires.private: glib-2.0
Libs: -L${libdir} -l${name}
Cflags: -I${includedir} -I${includedir}/gutil
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/rpm/libglibutil.spec
^
|
@@ -1,10 +1,10 @@
Name: libglibutil
-Version: 1.0.29
+Version: 1.0.42
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
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/src/gutil_idlepool.c
^
|
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016-2018 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2018 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
@@ -55,7 +55,7 @@
gutil_idle_pool_new()
{
GUtilIdlePool* self = g_slice_new0(GUtilIdlePool);
- self->ref_count = 1;
+ g_atomic_int_set(&self->ref_count, 1);
return self;
}
@@ -109,6 +109,14 @@
}
void
+gutil_idle_pool_destroy(
+ GUtilIdlePool* self) /* Since 1.0.34 */
+{
+ gutil_idle_pool_drain(self);
+ gutil_idle_pool_unref(self);
+}
+
+void
gutil_idle_pool_drain(
GUtilIdlePool* self)
{
@@ -169,6 +177,16 @@
}
void
+gutil_idle_pool_add_strv(
+ GUtilIdlePool* self,
+ char** strv) /* Since 1.0.32 */
+{
+ if (G_LIKELY(strv)) {
+ gutil_idle_pool_add(self, strv, (GDestroyNotify) g_strfreev);
+ }
+}
+
+void
gutil_idle_pool_add_object(
GUtilIdlePool* self,
gpointer object)
@@ -199,6 +217,16 @@
}
void
+gutil_idle_pool_add_bytes(
+ GUtilIdlePool* self,
+ GBytes* bytes) /* Since 1.0.34 */
+{
+ if (G_LIKELY(bytes)) {
+ gutil_idle_pool_add(self, bytes, (GDestroyNotify)g_bytes_unref);
+ }
+}
+
+void
gutil_idle_pool_add_object_ref(
GUtilIdlePool* self,
gpointer object)
@@ -228,6 +256,16 @@
}
}
+void
+gutil_idle_pool_add_bytes_ref(
+ GUtilIdlePool* self,
+ GBytes* bytes) /* Since 1.0.34 */
+{
+ if (G_LIKELY(self) && G_LIKELY(bytes)) {
+ gutil_idle_pool_add_bytes(self, g_bytes_ref(bytes));
+ }
+}
+
/*
* Local Variables:
* mode: C
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/src/gutil_log.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -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;
@@ -215,6 +230,7 @@
{
int priority;
const char* prefix = NULL;
+
switch (level) {
default:
case GLOG_LEVEL_INFO:
@@ -235,6 +251,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);
@@ -302,17 +327,20 @@
const char* format,
va_list va)
{
- if (check && check->level == GLOG_LEVEL_INHERIT && check->parent) {
- gutil_logv_r(module, check->parent, level, format, va);
- } else {
- const int max_level = (check && check->level != GLOG_LEVEL_INHERIT) ?
- 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);
+ if (!check || !(check->flags & GLOG_FLAG_DISABLE)) {
+ if (check && check->level == GLOG_LEVEL_INHERIT && check->parent) {
+ gutil_logv_r(module, check->parent, level, format, va);
+ } else {
+ const int max_level =
+ (check && check->level != GLOG_LEVEL_INHERIT) ?
+ 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);
+ }
}
}
}
@@ -363,7 +391,9 @@
const GLogModule* module,
int level)
{
- if (module->level == GLOG_LEVEL_INHERIT && module->parent) {
+ if (module->flags & GLOG_FLAG_DISABLE) {
+ return FALSE;
+ } else if (module->level == GLOG_LEVEL_INHERIT && module->parent) {
return gutil_log_enabled_r(module->parent, level);
} else {
const int max_level = (module->level == GLOG_LEVEL_INHERIT) ?
@@ -493,7 +523,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;
}
@@ -501,7 +534,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-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/src/gutil_misc.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
@@ -35,6 +35,8 @@
#include <glib-object.h>
#include <ctype.h>
+#include <limits.h>
+#include <errno.h>
void
gutil_disconnect_handlers(
@@ -151,6 +153,268 @@
return bytes_dumped;
}
+/* Since 1.0.30 */
+gboolean
+gutil_parse_int(
+ const char* str,
+ int base,
+ int* value)
+{
+ gboolean ok = FALSE;
+
+ if (str && str[0]) {
+ char* str2 = g_strstrip(g_strdup(str));
+ char* end = str2;
+ gint64 l;
+
+ errno = 0;
+ l = g_ascii_strtoll(str2, &end, base);
+ ok = !*end && errno != ERANGE && l >= INT_MIN && l <= INT_MAX;
+ if (ok && value) {
+ *value = (int)l;
+ }
+ g_free(str2);
+ }
+ return ok;
+}
+
+/* since 1.0.31 */
+gboolean
+gutil_data_equal(
+ const GUtilData* data1,
+ const GUtilData* data2)
+{
+ if (data1 == data2) {
+ return TRUE;
+ } else if (!data1 || !data2) {
+ return FALSE;
+ } else if (data1->size == data2->size) {
+ return !memcmp(data1->bytes, data2->bytes, data1->size);
+ } else {
+ return FALSE;
+ }
+}
+
+const GUtilData*
+gutil_data_from_string(
+ GUtilData* data,
+ const char* str)
+{
+ if (data) {
+ if (str) {
+ data->bytes = (const void*)str;
+ data->size = strlen(str);
+ } else {
+ data->bytes = NULL;
+ data->size = 0;
+ }
+ }
+ return data;
+}
+
+const GUtilData*
+gutil_data_from_bytes(
+ GUtilData* data,
+ GBytes* bytes)
+{
+ if (data) {
+ if (bytes) {
+ data->bytes = g_bytes_get_data(bytes, &data->size);
+ } else {
+ data->bytes = NULL;
+ data->size = 0;
+ }
+ }
+ 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;
+
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/src/gutil_strv.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -70,6 +70,21 @@
}
/**
+ * Returns the last string in the array, NULL if there's nothing there.
+ */
+const char*
+gutil_strv_last(
+ const GStrV* sv) /* Since 1.0.35 */
+{
+ if (G_LIKELY(sv) && G_LIKELY(sv[0])) {
+ guint k = 0;
+ while (sv[k + 1]) k++;
+ return sv[k];
+ }
+ return NULL;
+}
+
+/**
* Returns index of the specified string in the string array,
* or -1 if the string is not found.
*/
@@ -146,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
@@ -203,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-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/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,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,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-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/test/common/test_common.h
^
|
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016-2018 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2018 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
@@ -55,6 +55,10 @@
int argc,
char* argv[]);
+/* Macros */
+
+#define TEST_INIT_DATA(a,b) ((a).bytes = (void*)(b), (a).size = sizeof(b))
+
#endif /* TEST_COMMON_H */
/*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/test/test_idlepool/test_idlepool.c
^
|
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2016-2018 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2018 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
@@ -33,6 +33,7 @@
#include "test_common.h"
#include "gutil_idlepool.h"
+#include "gutil_strv.h"
#include "gutil_log.h"
#define TEST_TIMEOUT (10) /* seconds */
@@ -57,6 +58,44 @@
}
/*==========================================================================*
+ * Null
+ *==========================================================================*/
+
+static
+void
+test_null(
+ void)
+{
+ GUtilIdlePool* pool = gutil_idle_pool_new();
+
+ /* These have no effect, just testing NULL-telerance */
+ gutil_idle_pool_add_strv(NULL, NULL);
+ gutil_idle_pool_add_strv(pool, NULL);
+ gutil_idle_pool_add_ptr_array(NULL, NULL);
+ gutil_idle_pool_add_ptr_array(pool, NULL);
+ gutil_idle_pool_add_ptr_array_ref(NULL, NULL);
+ gutil_idle_pool_add_ptr_array_ref(pool, NULL);
+ gutil_idle_pool_add_variant(NULL, NULL);
+ gutil_idle_pool_add_variant(pool, NULL);
+ gutil_idle_pool_add_variant_ref(NULL, NULL);
+ gutil_idle_pool_add_variant_ref(pool, NULL);
+ gutil_idle_pool_add_object(NULL, NULL);
+ gutil_idle_pool_add_object(pool, NULL);
+ gutil_idle_pool_add_object_ref(NULL, NULL);
+ gutil_idle_pool_add_object_ref(pool, NULL);
+ gutil_idle_pool_add_bytes(NULL, NULL);
+ gutil_idle_pool_add_bytes(pool, NULL);
+ gutil_idle_pool_add_bytes_ref(NULL, NULL);
+ gutil_idle_pool_add_bytes_ref(pool, NULL);
+ gutil_idle_pool_add(NULL, NULL, NULL);
+ gutil_idle_pool_add(pool, NULL, NULL);
+ gutil_idle_pool_ref(NULL);
+ gutil_idle_pool_unref(NULL);
+ gutil_idle_pool_drain(NULL);
+ gutil_idle_pool_unref(pool);
+}
+
+/*==========================================================================*
* Basic
*==========================================================================*/
@@ -114,6 +153,8 @@
GVariant* variant = g_variant_take_ref(g_variant_new_int32(1));
GObject* object = g_object_new(TEST_OBJECT_TYPE, NULL);
GMainLoop* loop = g_main_loop_new(NULL, TRUE);
+ GStrV* strv = gutil_strv_add(NULL, "foo");
+ GBytes* bytes = g_bytes_new("bar", 3);
TestBasic test;
memset(&test, 0, sizeof(test));
@@ -123,26 +164,8 @@
g_timeout_add_seconds(TEST_TIMEOUT, test_timeout, loop);
}
- /* These have no effect, just testing NULL-telerance */
gutil_idle_pool_unref(gutil_idle_pool_new());
- gutil_idle_pool_add_ptr_array(NULL, array);
- gutil_idle_pool_add_ptr_array(test.pool, NULL);
- gutil_idle_pool_add_ptr_array_ref(NULL, array);
- gutil_idle_pool_add_ptr_array_ref(test.pool, NULL);
- gutil_idle_pool_add_variant(NULL, variant);
- gutil_idle_pool_add_variant(test.pool, NULL);
- gutil_idle_pool_add_variant_ref(NULL, variant);
- gutil_idle_pool_add_variant_ref(test.pool, NULL);
- gutil_idle_pool_add_object(NULL, object);
- gutil_idle_pool_add_object(test.pool, NULL);
- gutil_idle_pool_add_object_ref(NULL, object);
- gutil_idle_pool_add_object_ref(test.pool, NULL);
- gutil_idle_pool_add(NULL, NULL, test_basic_unref_pool);
- gutil_idle_pool_add(test.pool, NULL, NULL);
- gutil_idle_pool_ref(NULL);
- gutil_idle_pool_unref(NULL);
- gutil_idle_pool_drain(NULL);
-
+ gutil_idle_pool_add_strv(test.pool, strv);
g_ptr_array_add(array, &test);
gutil_idle_pool_add_ptr_array_ref(test.pool, array);
g_ptr_array_unref(array);
@@ -150,12 +173,14 @@
g_variant_unref(variant);
gutil_idle_pool_add_object_ref(test.pool, object);
g_object_unref(object);
+ gutil_idle_pool_add_bytes_ref(test.pool, bytes);
+ g_bytes_unref(bytes);
gutil_idle_pool_ref(test.pool);
gutil_idle_pool_add(test.pool, &test, test_basic_unref_pool);
gutil_idle_pool_add(test.pool, loop, test_done);
g_main_loop_run(loop);
gutil_idle_pool_add(test.pool, &test, test_basic_add_during_drain);
- gutil_idle_pool_unref(test.pool);
+ gutil_idle_pool_destroy(test.pool);
g_assert(test.ok);
g_assert(!test_object_count);
@@ -196,7 +221,7 @@
* Common
*==========================================================================*/
-#define TEST_PREFIX "/idlepool/"
+#define TEST_(test) "/idlepool/" test
int main(int argc, char* argv[])
{
@@ -204,8 +229,9 @@
g_type_init();
G_GNUC_END_IGNORE_DEPRECATIONS;
g_test_init(&argc, &argv, NULL);
- g_test_add_func(TEST_PREFIX "basic", test_basic);
- g_test_add_func(TEST_PREFIX "shared", test_shared);
+ g_test_add_func(TEST_("null"), test_null);
+ g_test_add_func(TEST_("basic"), test_basic);
+ g_test_add_func(TEST_("shared"), test_shared);
test_init(&test_opt, argc, argv);
return g_test_run();
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/test/test_log/test_log.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -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"
@@ -92,6 +97,12 @@
g_assert(test_log_basic_buf->len);
g_string_set_size(test_log_basic_buf, 0);
+ /* Test GLOG_FLAG_DISABLE */
+ module.flags |= GLOG_FLAG_DISABLE;
+ gutil_log(&module, GLOG_LEVEL_ALWAYS, "Always!");
+ g_assert(!test_log_basic_buf->len);
+ module.flags &= ~GLOG_FLAG_DISABLE;
+
/* Without log functions these calls have no effect */
gutil_log_func = NULL;
gutil_log(NULL, GLOG_LEVEL_ALWAYS, "Always!");
@@ -106,6 +117,97 @@
}
/*==========================================================================*
+ * 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_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;
+
+ 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);
+
+ fclose(out);
+ gutil_log_default.level = level;
+ g_string_free(buf, TRUE);
+}
+
+#endif /* HAVE_TEST_LOG_FILE */
+
+/*==========================================================================*
* Enabled
*==========================================================================*/
@@ -126,6 +228,9 @@
gutil_log_default.level = GLOG_LEVEL_INFO;
g_assert(gutil_log_enabled(&gutil_log_default, GLOG_LEVEL_ALWAYS));
g_assert(gutil_log_enabled(&gutil_log_default, GLOG_LEVEL_INFO));
+ gutil_log_default.flags |= GLOG_FLAG_DISABLE;
+ g_assert(!gutil_log_enabled(&gutil_log_default, GLOG_LEVEL_INFO));
+ gutil_log_default.flags &= ~GLOG_FLAG_DISABLE;
g_assert(!gutil_log_enabled(&gutil_log_default, GLOG_LEVEL_DEBUG));
/* It makes no sense to have default as INHERIT so it's treated as NONE */
@@ -181,6 +286,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-logger-ofono-1.0.16.tar.bz2/logger/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-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/test/test_misc/test_misc.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
@@ -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,10 +159,336 @@
}
/*==========================================================================*
+ * parse_int
+ *==========================================================================*/
+
+static
+void
+test_parse_int(
+ void)
+{
+ int value;
+
+ g_assert(!gutil_parse_int(NULL, 0, NULL));
+ g_assert(!gutil_parse_int("", 0, NULL));
+ g_assert(!gutil_parse_int("garbage", 0, NULL));
+ g_assert(!gutil_parse_int("0 trailing garbage", 0, NULL));
+ g_assert(gutil_parse_int("0", 0, NULL));
+ g_assert(gutil_parse_int("0", 0, &value));
+ g_assert(value == 0);
+ g_assert(!gutil_parse_int("0x10000000000000000", 0, &value));
+ g_assert(!gutil_parse_int("-2147483649", 0, &value));
+ g_assert(!gutil_parse_int("4294967295", 0, &value));
+ g_assert(gutil_parse_int(" 0x7fffffff ", 0, &value));
+ g_assert(value == 0x7fffffff);
+ g_assert(gutil_parse_int(" 7fffffff ", 16, &value));
+ g_assert(value == 0x7fffffff);
+ g_assert(!gutil_parse_int("0xffffffff", 0, &value));
+}
+
+/*==========================================================================*
+ * data_equal
+ *==========================================================================*/
+
+static
+void
+test_data_equal(
+ void)
+{
+ static const guint8 val_123[] = { '1', '2', '3' };
+ static const guint8 val_1234[] = { '1', '2', '3', '4' };
+ static const guint8 val_321[] = { '3', '2', '1' };
+
+ GUtilData data_123, data_123a, data_1234, data_321;
+
+ TEST_INIT_DATA(data_123, val_123);
+ TEST_INIT_DATA(data_123a, val_123);
+ TEST_INIT_DATA(data_1234, val_1234);
+ TEST_INIT_DATA(data_321, val_321);
+
+ g_assert(gutil_data_equal(NULL, NULL));
+ g_assert(gutil_data_equal(&data_123, &data_123));
+ g_assert(gutil_data_equal(&data_123, &data_123a));
+ g_assert(!gutil_data_equal(&data_123, &data_1234));
+ g_assert(!gutil_data_equal(&data_123, &data_321));
+ g_assert(!gutil_data_equal(&data_123, NULL));
+ g_assert(!gutil_data_equal(NULL, &data_123));
+}
+
+/*==========================================================================*
+ * 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
+void
+test_data_from_bytes(
+ void)
+{
+ static const guint8 val_123[] = { '1', '2', '3' };
+ GBytes* bytes_123 = g_bytes_new_static(val_123, sizeof(val_123));
+ GUtilData data_123, data;
+
+ TEST_INIT_DATA(data_123, val_123);
+ TEST_INIT_DATA(data, val_123);
+
+ g_assert(!gutil_data_from_bytes(NULL, NULL));
+
+ g_assert(gutil_data_from_bytes(&data, NULL) == &data);
+ g_assert(!data.bytes);
+ g_assert(!data.size);
+
+ g_assert(gutil_data_from_bytes(&data, bytes_123) == &data);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/logger/src/libglibutil/test/test_strv/test_strv.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2015-2017 Jolla Ltd.
- * Contact: 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 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
@@ -61,6 +61,29 @@
}
/*==========================================================================*
+ * Last
+ *==========================================================================*/
+
+static
+void
+test_last(
+ void)
+{
+ char** empty = g_new0(char*, 1);
+ char** a = g_strsplit("a", ",", 0);
+ char** ab = g_strsplit("a,b", ",", 0);
+
+ g_assert(!gutil_strv_last(NULL));
+ g_assert(!gutil_strv_last(empty));
+ g_assert(!g_strcmp0(gutil_strv_last(a), "a"));
+ g_assert(!g_strcmp0(gutil_strv_last(ab), "b"));
+
+ g_strfreev(empty);
+ g_strfreev(a);
+ g_strfreev(ab);
+}
+
+/*==========================================================================*
* Equal
*==========================================================================*/
@@ -76,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);
@@ -105,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);
@@ -164,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
*==========================================================================*/
@@ -190,10 +247,12 @@
{
g_test_init(&argc, &argv, NULL);
g_test_add_func(TEST_PREFIX "basic", test_basic);
+ g_test_add_func(TEST_PREFIX "last", test_last);
g_test_add_func(TEST_PREFIX "equal", test_equal);
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();
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/harbour-logger-nfc.desktop
^
|
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Application
+Name=NFC Logger
+Name[ru]=Журнал NFC
+X-Nemo-Application-Type=silica-qt5
+Icon=harbour-logger-nfc
+Exec=harbour-logger-nfc
|
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/icons/108x108/harbour-logger-nfc.png
^
|
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/icons/128x128/harbour-logger-nfc.png
^
|
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/icons/256x256/harbour-logger-nfc.png
^
|
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/icons/86x86/harbour-logger-nfc.png
^
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/icons/harbour-logger-nfc.svg
^
|
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ x="0px"
+ y="0px"
+ width="86px"
+ height="86px"
+ viewBox="0 0 86 86"
+ enable-background="new 0 0 86 86"
+ xml:space="preserve"
+ inkscape:version="0.92.4 (unknown)"
+ sodipodi:docname="harbour-logger-nfc.svg"
+ inkscape:export-xdpi="285.76746"
+ inkscape:export-ydpi="285.76746">
+ <defs>
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient839">
+ <stop
+ style="stop-color:#9be5ff;stop-opacity:1"
+ offset="0"
+ id="stop835"/>
+ <stop
+ style="stop-color:#87d3ff;stop-opacity:1"
+ offset="1"
+ id="stop837"/>
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient839"
+ id="linearGradient841"
+ x1="21.563559"
+ y1="22.411016"
+ x2="64.254242"
+ y2="64.13559"
+ gradientUnits="userSpaceOnUse"/>
+ </defs>
+ <metadata>
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+ <dc:title/>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ display="none">
+ </g>
+ <g>
+ <linearGradient
+ id="SVGID_1_"
+ gradientUnits="userSpaceOnUse"
+ x1="12.8062"
+ y1="12.8066"
+ x2="85.2829"
+ y2="85.2833">
+ <stop
+ offset="0.0049"
+ style="stop-color:#29a5f9;stop-opacity:1"
+ id="stop7199"/>
+ <stop
+ offset="1"
+ style="stop-color:#067dcc;stop-opacity:1"
+ id="stop7201"/>
+ </linearGradient>
+ <path
+ d="M85.699,43c0-23.582-19.117-42.7-42.7-42.7C19.417,0.3,0.3,19.418,0.3,43 c0,23.583,19.117,42.7,42.7,42.7c0.636,0,41.277,0,41.277,0c0.786,0,1.423-0.637,1.423-1.423C85.7,84.277,85.699,43.636,85.699,43z "
+ fill="url(#SVGID_1_)"/>
+ </g>
+ <g
+ transform="matrix(2.997423,0,0,3.1000509,61.42846,1.850079)">
+ <g>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill-rule:evenodd;stroke-width:1.33060896"
+ d="m 6.1183852,22.224267 -2.257889,-2.176235 c 1.384268,-1.912693 2.202245,-4.233201 2.202245,-6.740764 0,-6.5149481 -5.47764703,-11.7963358 -12.2346941,-11.7963357 -6.7570481,-10e-8 -12.2346961,5.2813874 -12.2346961,11.7963357 0,6.514948 5.477649,11.796335 12.2346964,11.796335 2.6007459,0 5.0074854,-0.788669 6.99125377,-2.12334 l 2.26991603,2.188585 c 0.838173,0.796353 1.92461,0.651597 2.701689,-0.08834 0.94936,-0.903977 1.104985,-2.034948 0.327479,-2.856244 z"
+ sodipodi:nodetypes="scssssccscs"/>
+ </g>
+ </g>
+ <circle
+ style="fill:url(#linearGradient841);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.54362178"
+ cx="43"
+ cy="43"
+ r="30"/>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#0674bb;fill-opacity:1;stroke-width:1.20000005"
+ d="m 28.9264,60.232301 c -0.5904,0 -1.068,-0.4776 -1.068,-1.068 v -32.5008 c 0,-1.5156 0.8088,-2.0448 1.1568,-2.202 0.3492,-0.1572 1.2804,-0.4152 2.418,0.5868 l 20.3448,17.9136 c 0.4428,0.39 0.4848,1.0644 0.096,1.5072 -0.3912,0.4428 -1.0668,0.4824 -1.5072,0.096 l -20.3436,-17.9136 c -0.0096,-0.0084 -0.0192,-0.0168 -0.0276,-0.024 0,0.012 0,0.024 0,0.036 v 32.4996 c -0.0012,0.5904 -0.4788,1.0692 -1.0692,1.0692 z"/>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:#0674bb;fill-opacity:1;stroke-width:1.20000005"
+ d="m 56.26,61.689101 c -0.4464,0 -1.0356,-0.1584 -1.6932,-0.7368 L 34.222,43.038701 c -0.4428,-0.39 -0.486,-1.0644 -0.096,-1.5072 0.3888,-0.4428 1.0644,-0.4872 1.5072,-0.096 l 20.3448,17.9148 c 0.0096,0.0084 0.0192,0.0168 0.0264,0.024 0.0012,-0.012 0.0012,-0.024 0.0012,-0.036 v -32.5008 c 0,-0.5904 0.4776,-1.068 1.068,-1.068 0.5904,0 1.068,0.4776 1.068,1.068 v 32.4996 c 0,1.5168 -0.8088,2.0448 -1.1568,2.202 -0.1488,0.066 -0.3996,0.15 -0.7248,0.15 z"/>
+</svg>
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/nfc.pro
^
|
@@ -0,0 +1,154 @@
+openrepos {
+ PREFIX = openrepos
+ DEFINES += OPENREPOS
+} else {
+ PREFIX = harbour
+}
+
+NAME = logger-nfc
+TARGET = $${PREFIX}-$${NAME}
+
+app_settings {
+ # This path is hardcoded in jolla-settings
+ TRANSLATIONS_PATH = /usr/share/translations
+} else {
+ TRANSLATIONS_PATH = /usr/share/$${TARGET}/translations
+}
+
+CONFIG += sailfishapp link_pkgconfig
+PKGCONFIG += sailfishapp mlite5 gio-2.0 gio-unix-2.0 glib-2.0
+QT += dbus
+
+WARNINGS = -Wall -Wno-unused-parameter -Wno-deprecated-declarations
+QMAKE_CXXFLAGS += $$WARNINGS -Wno-psabi
+QMAKE_CFLAGS += $$WARNINGS
+
+CONFIG(debug, debug|release) {
+ QMAKE_CXXFLAGS_DEBUG *= -O0
+ QMAKE_CFLAGS_DEBUG *= -O0
+}
+
+CONFIG(debug, debug|release) {
+ DEFINES += HARBOUR_DEBUG=1
+}
+
+# Directories
+HARBOUR_LIB_DIR = $$_PRO_FILE_PWD_/../harbour-lib
+LOGGER_LIB_DIR = $$_PRO_FILE_PWD_/../logger
+
+# Libraries
+LOGGER_LIB = $$OUT_PWD/../logger/liblogger.a
+
+PRE_TARGETDEPS += \
+ $$LOGGER_LIB \
+ $$HARBOUR_LIB
+
+LIBS += \
+ $$LOGGER_LIB \
+ $$HARBOUR_LIB
+
+OTHER_FILES += \
+ icons/harbour-$${NAME}.svg \
+ harbour-$${NAME}.desktop \
+ qml/*.qml \
+ privileges/* \
+ translations/*.ts
+
+TARGET_DATA_DIR = /usr/share/$${TARGET}
+TARGET_ICON_ROOT = /usr/share/icons/hicolor
+
+logger_qml.files = $${LOGGER_LIB_DIR}/qml/*
+logger_qml.path = $${TARGET_DATA_DIR}/qml
+INSTALLS += logger_qml
+
+INCLUDEPATH += \
+ src \
+ $${LOGGER_LIB_DIR}/include \
+ $${HARBOUR_LIB_DIR}/include
+
+SOURCES += \
+ src/main.cpp
+
+# harbour-lib QML components
+
+HARBOUR_LIB_QML = $${HARBOUR_LIB_DIR}/qml
+HARBOUR_QML_COMPONENTS = \
+ $${HARBOUR_LIB_QML}/HarbourHighlightIcon.qml \
+ $${HARBOUR_LIB_QML}/HarbourHintIconButton.qml \
+ $${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 = $${LOGGER_LIB_DIR}/settings/$${TARGET}.json
+ settings_json.path = /usr/share/jolla-settings/entries/
+ settings_json.extra = sed s/harbour-logger/$${TARGET}/g $${LOGGER_LIB_DIR}/settings/harbour-logger.json > $$eval(settings_json.files)
+ settings_json.CONFIG += no_check_exist
+ settings_qml.files = $${LOGGER_LIB_DIR}/settings/settings.qml
+ settings_qml.path = /usr/share/$${TARGET}/settings/
+ settings_qml.extra = sed -i s/harbour-logger-conf/$${TARGET}/g $$eval(settings_qml.files)
+ INSTALLS += settings_qml settings_json
+}
+
+# Priveleges
+privileges.files = privileges/$${PREFIX}-logger-nfc
+privileges.path = /usr/share/mapplauncherd/privileges.d/
+INSTALLS += privileges
+
+# Desktop file
+openrepos {
+ desktop.extra = sed s/harbour/openrepos/g harbour-$${NAME}.desktop > $${TARGET}.desktop
+ desktop.CONFIG += no_check_exist
+}
+
+# Icons
+ICON_SIZES = 86 108 128 256
+for(s, ICON_SIZES) {
+ icon_target = icon$${s}
+ icon_dir = icons/$${s}x$${s}
+ $${icon_target}.files = $${icon_dir}/$${TARGET}.png
+ $${icon_target}.path = /usr/share/icons/hicolor/$${s}x$${s}/apps
+ openrepos {
+ $${icon_target}.extra = cp $${icon_dir}/harbour-$${NAME}.png $$eval($${icon_target}.files)
+ $${icon_target}.CONFIG += no_check_exist
+ }
+ INSTALLS += $${icon_target}
+}
+
+# Translations
+TRANSLATION_SOURCES = \
+ $${_PRO_FILE_PWD_}/qml \
+ $${LOGGER_LIB_DIR}/qml \
+ $${LOGGER_LIB_DIR}/settings
+
+TRANSLATION_FILES = \
+ $${NAME} \
+ $${NAME}-ru
+
+for(t, TRANSLATION_FILES) {
+ suffix = $$replace(t,-,_)
+ in = $${_PRO_FILE_PWD_}/translations/harbour-$${t}
+ out = $${OUT_PWD}/translations/$${PREFIX}-$${t}
+
+ lupdate_target = lupdate_$$suffix
+ lrelease_target = lrelease_$$suffix
+
+ $${lupdate_target}.commands = lupdate -noobsolete -extensions qml $${TRANSLATION_SOURCES} -ts \"$${in}.ts\" && \
+ mkdir -p \"$${_PRO_FILE_PWD_}/translations\" && [ \"$${in}.ts\" != \"$${out}.ts\" ] && \
+ cp -af \"$${in}.ts\" \"$${out}.ts\" || :
+
+ $${lrelease_target}.target = $${out}.qm
+ $${lrelease_target}.depends = $${lupdate_target}
+ $${lrelease_target}.commands = lrelease -idbased \"$${out}.ts\"
+
+ QMAKE_EXTRA_TARGETS += $${lrelease_target} $${lupdate_target}
+ PRE_TARGETDEPS += \"$${out}.qm\"
+ qm.files += \"$$relative_path($${out},$${_PRO_FILE_PWD_}).qm\"
+}
+
+qm.path = $$TRANSLATIONS_PATH
+qm.CONFIG += no_check_exist
+INSTALLS += qm
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/privileges/harbour-logger-nfc
^
|
@@ -0,0 +1,2 @@
+# Tells invoker to run NFC logger as nemo:privileged
+/usr/bin/harbour-logger-nfc,
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/privileges/openrepos-logger-nfc
^
|
@@ -0,0 +1,2 @@
+# Tells invoker to run NFC logger as nemo:privileged
+/usr/bin/openrepos-logger-nfc,
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/qml/main.qml
^
|
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019-2020 Jolla Ltd.
+ * Copyright (C) 2019-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.
+ */
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+import harbour.logger.nfc 1.0
+
+import "pages"
+
+ApplicationWindow {
+ id: window
+
+ allowedOrientations: Orientation.Portrait | Orientation.Landscape | Orientation.LandscapeInverted
+ initialPage: Component { MainPage { } }
+ cover: Component { CoverPage { } }
+
+ LoggerHints {
+ id: loggerHints
+ appName: AppName
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/src/main.cpp
^
|
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 Jolla Ltd.
+ * Copyright (C) 2019 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 "LoggerMain.h"
+
+Q_DECL_EXPORT int main(int argc, char* argv[])
+{
+ QStringList packages;
+ packages.append("libgbinder");
+ packages.append("libncicore");
+ packages.append("libnciplugin");
+ packages.append("libglibutil");
+ packages.append("nfcd");
+ packages.append("nfcd-binder-plugin");
+ packages.append("pn54x-binder-plugin");
+ return LoggerMain(&argc, argv, "org.sailfishos.nfc.daemon", packages,
+ "nfc", "qml/main.qml").run();
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/translations/harbour-logger-nfc-ru.ts
^
|
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="ru">
+<context>
+ <name></name>
+ <message id="logger-cover-title">
+ <source>Log</source>
+ <translation>NFC</translation>
+ </message>
+ <message id="logger-mainpage-swipe-left-hint">
+ <source>Swipe left to configure log categories</source>
+ <translation>Там справа что-то есть</translation>
+ </message>
+ <message id="logger-logpage-pm-clear-log">
+ <source>Clear log</source>
+ <translation>Очистить журнал</translation>
+ </message>
+ <message id="logger-logpage-pm-pack-and-send">
+ <source>Pack and send</source>
+ <translation>Упаковка и отправка</translation>
+ </message>
+ <message id="logger-logpage-title">
+ <source>Log</source>
+ <translation>Журнал NFC</translation>
+ </message>
+ <message id="logger-logpage-msg-connected">
+ <source>Connected.</source>
+ <translation>Соединение установлено.</translation>
+ </message>
+ <message id="logger-logpage-msg-connect-error">
+ <source>We are having trouble connecting to the service.</source>
+ <translation>Почему-то не удалось связаться с сервисом NFC. Скорее всего, либо ваш телефон, либо эта версия Sailfish OS не поддерживает NFC.</translation>
+ </message>
+ <message id="logger-logpage-msg-disconnected">
+ <source>Connection lost.</source>
+ <translation>Соединение с сервисом NFC прервано.</translation>
+ </message>
+ <message id="logger-logpage-msg-log-cleared">
+ <source>Log cleared</source>
+ <translation>Журнал очищен</translation>
+ </message>
+ <message id="logger-logpage-hint-jump_to_bottom">
+ <source>Jump to the end of the log to see the most recent messages and follow new messages in real time</source>
+ <extracomment>Hint text, displayed on long tap</extracomment>
+ <translation>Перескочить к последнему сообщению и следить за новыми в реальном времени</translation>
+ </message>
+ <message id="logger-categories-title">
+ <source>Log categories</source>
+ <translation>Категории</translation>
+ </message>
+ <message id="logger-categories-pm-enable-all">
+ <source>Enable all</source>
+ <translation>Включить все</translation>
+ </message>
+ <message id="logger-categories-pm-disable-all">
+ <source>Disable all</source>
+ <translation>Выключить все</translation>
+ </message>
+ <message id="logger-categories-pm-default">
+ <source>Reset to default</source>
+ <translation>Сбросить по умолчанию</translation>
+ </message>
+ <message id="logger-categories-select-placeholder">
+ <source>Select categories</source>
+ <extracomment>Placeholder text for the search field</extracomment>
+ <translation>Выбрать</translation>
+ </message>
+ <message id="logger-categories-not-connected">
+ <source>Not connected</source>
+ <translation>Сервис NFC не отвечает</translation>
+ </message>
+ <message id="logger-sharemethodlist-add-account">
+ <source>Add account</source>
+ <translation>Добавить учётную запись</translation>
+ </message>
+ <message id="logger-sharepage-save-ok">
+ <source>Saved %1</source>
+ <translation>Файл %1 сохранён</translation>
+ </message>
+ <message id="logger-sharepage-save-error">
+ <source>Failed to save %1</source>
+ <translation>Не получилось сохранить %1</translation>
+ </message>
+ <message id="logger-sharepage-pm-save-to-documents">
+ <source>Save to documents</source>
+ <translation>Сохранить в документы</translation>
+ </message>
+ <message id="logger-sharepage-header">
+ <source>Pack and send</source>
+ <translation>Упаковка и отправка</translation>
+ </message>
+ <message id="logger-sharepage-default-subject">
+ <source>Log</source>
+ <extracomment>Default email subject</extracomment>
+ <translation>NFC log</translation>
+ </message>
+ <message id="logger-sharepage-default-email">
+ <source></source>
+ <extracomment>Default email recipient</extracomment>
+ <translation>nfc-debug@jolla.com</translation>
+ </message>
+ <message id="logger-sharepage-warning">
+ <source>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 and checking its contents first.</source>
+ <translation>Возможно, вы не захотите делиться с другими некоторой информацией, которую собрала эта программа. Вы можете сначала переслать файл на свой компьютер и проверить, нет ли там чего лишнего.</translation>
+ </message>
+ <message id="logger-sharepage-please-wait">
+ <source>Please wait</source>
+ <translation>Секундочку</translation>
+ </message>
+ <message id="logger-settings-page-header">
+ <source>Logger</source>
+ <extracomment>Page header</extracomment>
+ <translation>Журнал NFC</translation>
+ </message>
+ <message id="logger-settings-section-header-display">
+ <source>Display</source>
+ <extracomment>Section header</extracomment>
+ <translation>Вывод на экран</translation>
+ </message>
+ <message id="logger-settings-logsizelimit">
+ <source>Screen buffer size</source>
+ <translation>Количество строк</translation>
+ </message>
+ <message id="logger-settings-logsizelimit-description">
+ <source>Don't worry, everything will be written to the log file regardless of the screen buffer size.</source>
+ <translation>Не волнуйтесь, в любом случае всё будет записано в файл ― даже то, что пропало с экрана.</translation>
+ </message>
+ <message id="logger-settings-logsizelimit-unlimited">
+ <source>Unlimited</source>
+ <translation>Неограниченное</translation>
+ </message>
+ <message id="logger-settings-fontsize-label">
+ <source>Font size</source>
+ <translation>Размер шрифта</translation>
+ </message>
+ <message id="logger-settings-section-header-logging">
+ <source>Logging</source>
+ <extracomment>Section header</extracomment>
+ <translation>Сбор информации</translation>
+ </message>
+ <message id="logger-settings-autoenable_logging-switch-label">
+ <source>Automatically enable logging</source>
+ <extracomment>Text switch label</extracomment>
+ <translation>Автоматически начинать сбор отладочной информации</translation>
+ </message>
+ <message id="logger-settings-autoenable_logging-switch-description">
+ <source>Enable all logging categories when the application starts.</source>
+ <extracomment>Text switch description</extracomment>
+ <translation>Эта опция позволяет включать сбор и вывод на экран всей доступной отладочной информации всякий раз, когда приложение запускается.</translation>
+ </message>
+ <message id="logger-settings-autoreset_logging-switch-label">
+ <source>Automatically reset logging on exit</source>
+ <extracomment>Text switch label</extracomment>
+ <translation>Автоматически отключать сбор отладочной информации</translation>
+ </message>
+ <message id="logger-settings-autoreset_logging-switch-description">
+ <source>Reset all logging categories to their default values when the application is exiting. Otherwise logging would continue in the background, wasting the system resources and eating up your battery.</source>
+ <extracomment>Text switch description</extracomment>
+ <translation>Отключать сбор отладочной информации, когда приложение закрывается. Иначе всё это будет продолжать форматироваться и записываться в журнал в фоновом режиме, что в большинстве случаев бесполезно и только разряжает аккумулятор.</translation>
+ </message>
+</context>
+</TS>
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/nfc/translations/harbour-logger-nfc.ts
^
|
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="en">
+<context>
+ <name></name>
+ <message id="logger-cover-title">
+ <source>Log</source>
+ <translation>NFC</translation>
+ </message>
+ <message id="logger-mainpage-swipe-left-hint">
+ <source>Swipe left to configure log categories</source>
+ <translation>Swipe left to configure log categories</translation>
+ </message>
+ <message id="logger-logpage-pm-clear-log">
+ <source>Clear log</source>
+ <translation>Clear log</translation>
+ </message>
+ <message id="logger-logpage-pm-pack-and-send">
+ <source>Pack and send</source>
+ <translation>Pack and send</translation>
+ </message>
+ <message id="logger-logpage-title">
+ <source>Log</source>
+ <translation>NFC log</translation>
+ </message>
+ <message id="logger-logpage-msg-connected">
+ <source>Connected.</source>
+ <translation>Connected to NFC service.</translation>
+ </message>
+ <message id="logger-logpage-msg-connect-error">
+ <source>We are having trouble connecting to the service.</source>
+ <translation>We are having trouble connecting to the NFC service. Most likely is means that either this device doesn't have NFC or this release of Sailfish OS doesn't support it.</translation>
+ </message>
+ <message id="logger-logpage-msg-disconnected">
+ <source>Connection lost.</source>
+ <translation>Lost connection to NFC service.</translation>
+ </message>
+ <message id="logger-logpage-msg-log-cleared">
+ <source>Log cleared</source>
+ <translation>Log cleared</translation>
+ </message>
+ <message id="logger-logpage-hint-jump_to_bottom">
+ <source>Jump to the end of the log to see the most recent messages and follow new messages in real time</source>
+ <extracomment>Hint text, displayed on long tap</extracomment>
+ <translation>Jump to the end of the log to see the most recent messages and follow new messages in real time</translation>
+ </message>
+ <message id="logger-categories-title">
+ <source>Log categories</source>
+ <translation>Log categories</translation>
+ </message>
+ <message id="logger-categories-pm-enable-all">
+ <source>Enable all</source>
+ <translation>Enable all</translation>
+ </message>
+ <message id="logger-categories-pm-disable-all">
+ <source>Disable all</source>
+ <translation>Disable all</translation>
+ </message>
+ <message id="logger-categories-pm-default">
+ <source>Reset to default</source>
+ <translation>Reset to default</translation>
+ </message>
+ <message id="logger-categories-select-placeholder">
+ <source>Select categories</source>
+ <extracomment>Placeholder text for the search field</extracomment>
+ <translation>Select categories</translation>
+ </message>
+ <message id="logger-categories-not-connected">
+ <source>Not connected</source>
+ <translation>Not connected to NFC service</translation>
+ </message>
+ <message id="logger-sharemethodlist-add-account">
+ <source>Add account</source>
+ <translation>Add account</translation>
+ </message>
+ <message id="logger-sharepage-save-ok">
+ <source>Saved %1</source>
+ <translation>Saved %1</translation>
+ </message>
+ <message id="logger-sharepage-save-error">
+ <source>Failed to save %1</source>
+ <translation>Failed to save %1</translation>
+ </message>
+ <message id="logger-sharepage-pm-save-to-documents">
+ <source>Save to documents</source>
+ <translation>Save to documents</translation>
+ </message>
+ <message id="logger-sharepage-header">
+ <source>Pack and send</source>
+ <translation>Pack and send</translation>
+ </message>
+ <message id="logger-sharepage-default-subject">
+ <source>Log</source>
+ <extracomment>Default email subject</extracomment>
+ <translation>NFC log</translation>
+ </message>
+ <message id="logger-sharepage-default-email">
+ <source></source>
+ <extracomment>Default email recipient</extracomment>
+ <translation>nfc-debug@jolla.com</translation>
+ </message>
+ <message id="logger-sharepage-warning">
+ <source>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 and checking its contents first.</source>
+ <translation>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 and checking its contents first.</translation>
+ </message>
+ <message id="logger-sharepage-please-wait">
+ <source>Please wait</source>
+ <translation>Please wait</translation>
+ </message>
+ <message id="logger-settings-page-header">
+ <source>Logger</source>
+ <extracomment>Page header</extracomment>
+ <translation>NFC Logger</translation>
+ </message>
+ <message id="logger-settings-section-header-display">
+ <source>Display</source>
+ <extracomment>Section header</extracomment>
+ <translation>Display</translation>
+ </message>
+ <message id="logger-settings-logsizelimit">
+ <source>Screen buffer size</source>
+ <translation>Screen buffer size</translation>
+ </message>
+ <message id="logger-settings-logsizelimit-description">
+ <source>Don't worry, everything will be written to the log file regardless of the screen buffer size.</source>
+ <translation>Don't worry, everything will be written to the log file regardless of the screen buffer size.</translation>
+ </message>
+ <message id="logger-settings-logsizelimit-unlimited">
+ <source>Unlimited</source>
+ <translation>Unlimited</translation>
+ </message>
+ <message id="logger-settings-fontsize-label">
+ <source>Font size</source>
+ <translation>Font size</translation>
+ </message>
+ <message id="logger-settings-section-header-logging">
+ <source>Logging</source>
+ <extracomment>Section header</extracomment>
+ <translation>Logging</translation>
+ </message>
+ <message id="logger-settings-autoenable_logging-switch-label">
+ <source>Automatically enable logging</source>
+ <extracomment>Text switch label</extracomment>
+ <translation>Automatically enable logging</translation>
+ </message>
+ <message id="logger-settings-autoenable_logging-switch-description">
+ <source>Enable all logging categories when the application starts.</source>
+ <extracomment>Text switch description</extracomment>
+ <translation>Enable all logging categories when the application starts.</translation>
+ </message>
+ <message id="logger-settings-autoreset_logging-switch-label">
+ <source>Automatically reset logging on exit</source>
+ <extracomment>Text switch label</extracomment>
+ <translation>Automatically reset logging on exit</translation>
+ </message>
+ <message id="logger-settings-autoreset_logging-switch-description">
+ <source>Reset all logging categories to their default values when the application is exiting. Otherwise logging would continue in the background, wasting the system resources and eating up your battery.</source>
+ <extracomment>Text switch description</extracomment>
+ <translation>Reset all logging categories to their default values when the application is exiting. Otherwise logging would continue in the background, wasting the system resources and eating up your battery.</translation>
+ </message>
+</context>
+</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/ofono.pro
^
|
@@ -39,7 +39,6 @@
QCONNMAN_LIB_DIR = $$_PRO_FILE_PWD_/../libconnman-qt
# Libraries
-HARBOUR_LIB = $$OUT_PWD/../harbour-lib/libharbour-lib.a
LOGGER_LIB = $$OUT_PWD/../logger/liblogger.a
PRE_TARGETDEPS += \
@@ -60,9 +59,9 @@
TARGET_DATA_DIR = /usr/share/$${TARGET}
TARGET_ICON_ROOT = /usr/share/icons/hicolor
-qml_pages.files = $${LOGGER_LIB_DIR}/qml/*
-qml_pages.path = $${TARGET_DATA_DIR}/qml
-INSTALLS += qml_pages
+logger_qml.files = $${LOGGER_LIB_DIR}/qml/*
+logger_qml.path = $${TARGET_DATA_DIR}/qml
+INSTALLS += logger_qml
INCLUDEPATH += \
src \
@@ -81,6 +80,18 @@
$${QOFONOEXT_LIB_DIR}/src/qofonoextmodemmanager.cpp \
$${QCONNMAN_LIB_DIR}/libconnman-qt/networktechnology.cpp
+# harbour-lib QML components
+
+HARBOUR_LIB_QML = $${HARBOUR_LIB_DIR}/qml
+HARBOUR_QML_COMPONENTS = \
+ $${HARBOUR_LIB_QML}/HarbourHighlightIcon.qml \
+ $${HARBOUR_LIB_QML}/HarbourHintIconButton.qml \
+ $${HARBOUR_LIB_QML}/HarbourShareMethodList.qml
+
+qml_components.files = $${HARBOUR_QML_COMPONENTS}
+qml_components.path = $${TARGET_DATA_DIR}/qml/harbour
+INSTALLS += qml_components
+
# D-Bus interfaces
DBUS_INTERFACES += net_connman_technology
net_connman_technology.files = $${QCONNMAN_LIB_DIR}/libconnman-qt/connman_technology.xml
@@ -156,7 +167,7 @@
QMAKE_EXTRA_TARGETS += $${lrelease_target} $${lupdate_target}
PRE_TARGETDEPS += \"$${out}.qm\"
- qm.files += \"$${out}.qm\"
+ qm.files += \"$$relative_path($${out},$${_PRO_FILE_PWD_}).qm\"
}
qm.path = $$TRANSLATIONS_PATH
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/qml/main.qml
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: 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:
*
@@ -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
@@ -33,26 +33,23 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import harbour.logger.ofono 1.0
+
import "pages"
-ApplicationWindow
-{
+ApplicationWindow {
id: window
- LoggerHints {
- id: loggerHints
- appName: AppName
- }
- TransferMethodsModel {
- id: transferMethodsModel
- filter: LogSaver.archiveType
- }
+
allowedOrientations: Orientation.Portrait | Orientation.Landscape | Orientation.LandscapeInverted
initialPage: Component {
MainPage {
- customLogMenuItem: MenuItem {
+ id: mainPage
+
+ customLogMenuItem: QtObject {
id: fixMobileDataMenuItem
- property bool active
- text: OfonoLogger.mobileDataBroken ?
+
+ property bool visible: shouldBeVisible
+ readonly property bool shouldBeVisible: OfonoLogger.mobileDataBroken || OfonoLogger.mobileDataDisabled
+ property string text: OfonoLogger.mobileDataBroken ?
//: Pull-down menu item
//% "Fix mobile data"
qsTrId("ofono-logger-pm-fix-mobile-data") :
@@ -60,21 +57,21 @@
//% "Enable mobile data"
qsTrId("ofono-logger-pm-enable-mobile-data")
- onClicked: {
+ function updateVisiblity() {
+ if (!mainPage.pullDownMenuActive) {
+ visible = shouldBeVisible
+ }
+ }
+ function clicked() {
if (OfonoLogger.mobileDataBroken) {
OfonoLogger.fixMobileData()
} else {
OfonoLogger.enableMobileData()
}
}
- onActiveChanged: updateVisiblity()
- Component.onCompleted: updateVisiblity()
- function updateVisiblity() {
- if (!active) {
- visible = OfonoLogger.mobileDataBroken || OfonoLogger.mobileDataDisabled
- }
- }
}
+ onPullDownMenuActiveChanged:fixMobileDataMenuItem.updateVisiblity()
+
Connections {
target: OfonoLogger
onMobileDataBrokenChanged: fixMobileDataMenuItem.updateVisiblity()
@@ -83,4 +80,9 @@
}
}
cover: Component { CoverPage { } }
+
+ LoggerHints {
+ id: loggerHints
+ appName: AppName
+ }
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/plugin/plugin.pro
^
|
@@ -22,10 +22,13 @@
qofonoextmodemlistmodel.h \
qofonoextsimlistmodel.h
-OTHER_FILES += qmldir
+OTHER_FILES += qmldir plugins.qmltypes
target.path = $$[QT_INSTALL_QML]/org/nemomobile/ofono
qmldir.path = $$[QT_INSTALL_QML]/org/nemomobile/ofono
-qmldir.files += qmldir
+qmldir.files += qmldir plugins.qmltypes
INSTALLS += target qmldir
+
+qmltypes.commands = qmlplugindump -nonrelocatable org.nemomobile.ofono 1.0 > $$PWD/plugins.qmltypes
+QMAKE_EXTRA_TARGETS += qmltypes
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/plugin/plugins.qmltypes
^
|
@@ -0,0 +1,259 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable org.nemomobile.ofono 1.0'
+
+Module {
+ dependencies: ["QtQuick 2.0"]
+ Component {
+ name: "QOfonoExtCell"
+ prototype: "QObject"
+ exports: ["org.nemomobile.ofono/OfonoExtCell 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Type"
+ values: {
+ "Unknown": 0,
+ "GSM": 1,
+ "WCDMA": 2,
+ "LTE": 3,
+ "UNKNOWN": 0
+ }
+ }
+ Enum {
+ name: "Constants"
+ values: {
+ "InvalidValue": 2147483647
+ }
+ }
+ Property { name: "path"; type: "string" }
+ Property { name: "valid"; type: "bool"; isReadonly: true }
+ Property { name: "type"; type: "Type"; isReadonly: true }
+ Property { name: "registered"; type: "bool"; isReadonly: true }
+ Property { name: "mcc"; type: "int"; isReadonly: true }
+ Property { name: "mnc"; type: "int"; isReadonly: true }
+ Property { name: "signalStrength"; type: "int"; isReadonly: true }
+ Property { name: "lac"; type: "int"; isReadonly: true }
+ Property { name: "cid"; type: "int"; isReadonly: true }
+ Property { name: "arfcn"; type: "int"; isReadonly: true }
+ Property { name: "bsic"; type: "int"; isReadonly: true }
+ Property { name: "bitErrorRate"; type: "int"; isReadonly: true }
+ Property { name: "psc"; type: "int"; isReadonly: true }
+ Property { name: "uarfcn"; type: "int"; isReadonly: true }
+ Property { name: "ci"; type: "int"; isReadonly: true }
+ Property { name: "pci"; type: "int"; isReadonly: true }
+ Property { name: "tac"; type: "int"; isReadonly: true }
+ Property { name: "earfcn"; type: "int"; isReadonly: true }
+ Property { name: "rsrp"; type: "int"; isReadonly: true }
+ Property { name: "rsrq"; type: "int"; isReadonly: true }
+ Property { name: "rssnr"; type: "int"; isReadonly: true }
+ Property { name: "cqi"; type: "int"; isReadonly: true }
+ Property { name: "timingAdvance"; type: "int"; isReadonly: true }
+ Signal {
+ name: "propertyChanged"
+ Parameter { name: "name"; type: "string" }
+ Parameter { name: "value"; type: "int" }
+ }
+ Signal { name: "removed" }
+ }
+ Component {
+ name: "QOfonoExtCellInfo"
+ prototype: "QObject"
+ exports: ["org.nemomobile.ofono/OfonoExtCellInfo 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "modemPath"; type: "string" }
+ Property { name: "valid"; type: "bool"; isReadonly: true }
+ Property { name: "cells"; type: "QStringList"; isReadonly: true }
+ Signal {
+ name: "cellsAdded"
+ Parameter { name: "cells"; type: "QStringList" }
+ }
+ Signal {
+ name: "cellsRemoved"
+ Parameter { name: "cells"; type: "QStringList" }
+ }
+ }
+ Component {
+ name: "QOfonoExtModemListModel"
+ prototype: "QAbstractListModel"
+ exports: ["org.nemomobile.ofono/OfonoModemListModel 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "valid"; type: "bool"; isReadonly: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Signal {
+ name: "validChanged"
+ Parameter { name: "aValid"; type: "bool" }
+ }
+ Signal {
+ name: "countChanged"
+ Parameter { name: "aCount"; type: "int" }
+ }
+ }
+ Component {
+ name: "QOfonoExtModemManager"
+ prototype: "QObject"
+ exports: ["org.nemomobile.ofono/OfonoModemManager 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "valid"; type: "bool"; isReadonly: true }
+ Property { name: "interfaceVersion"; type: "int"; isReadonly: true }
+ Property { name: "availableModems"; type: "QStringList"; isReadonly: true }
+ Property { name: "enabledModems"; type: "QStringList" }
+ Property { name: "defaultDataModem"; type: "string"; isReadonly: true }
+ Property { name: "defaultVoiceModem"; type: "string"; isReadonly: true }
+ Property { name: "defaultDataSim"; type: "string" }
+ Property { name: "defaultVoiceSim"; type: "string" }
+ Property { name: "presentSims"; type: "QList<bool>"; isReadonly: true }
+ Property { name: "imeiCodes"; type: "QStringList"; isReadonly: true }
+ Property { name: "imeisvCodes"; type: "QStringList"; isReadonly: true }
+ Property { name: "mmsSim"; type: "string"; isReadonly: true }
+ Property { name: "mmsModem"; type: "string"; isReadonly: true }
+ Property { name: "ready"; type: "bool"; isReadonly: true }
+ Property { name: "presentSimCount"; type: "int"; isReadonly: true }
+ Property { name: "activeSimCount"; type: "int"; isReadonly: true }
+ Property { name: "errorCount"; type: "int"; isReadonly: true }
+ Signal {
+ name: "validChanged"
+ Parameter { name: "value"; type: "bool" }
+ }
+ Signal {
+ name: "interfaceVersionChanged"
+ Parameter { name: "value"; type: "int" }
+ }
+ Signal {
+ name: "availableModemsChanged"
+ Parameter { name: "value"; type: "QStringList" }
+ }
+ Signal {
+ name: "enabledModemsChanged"
+ Parameter { name: "value"; type: "QStringList" }
+ }
+ Signal {
+ name: "defaultVoiceModemChanged"
+ Parameter { name: "value"; type: "string" }
+ }
+ Signal {
+ name: "defaultDataModemChanged"
+ Parameter { name: "value"; type: "string" }
+ }
+ Signal {
+ name: "defaultVoiceSimChanged"
+ Parameter { name: "value"; type: "string" }
+ }
+ Signal {
+ name: "defaultDataSimChanged"
+ Parameter { name: "value"; type: "string" }
+ }
+ Signal {
+ name: "presentSimsChanged"
+ Parameter { name: "value"; type: "QList<bool>" }
+ }
+ Signal {
+ name: "presentSimChanged"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "present"; type: "bool" }
+ }
+ Signal {
+ name: "presentSimCountChanged"
+ Parameter { name: "value"; type: "int" }
+ }
+ Signal {
+ name: "activeSimCountChanged"
+ Parameter { name: "value"; type: "int" }
+ }
+ Signal {
+ name: "imeiCodesChanged"
+ Parameter { name: "value"; type: "QStringList" }
+ }
+ Signal {
+ name: "imeisvCodesChanged"
+ Parameter { name: "value"; type: "QStringList" }
+ }
+ Signal {
+ name: "mmsSimChanged"
+ Parameter { name: "value"; type: "string" }
+ }
+ Signal {
+ name: "mmsModemChanged"
+ Parameter { name: "value"; type: "string" }
+ }
+ Signal {
+ name: "readyChanged"
+ Parameter { name: "value"; type: "bool" }
+ }
+ Signal {
+ name: "errorCountChanged"
+ Parameter { name: "value"; type: "int" }
+ }
+ Signal {
+ name: "modemError"
+ Parameter { name: "modemPath"; type: "string" }
+ Parameter { name: "errorId"; type: "string" }
+ Parameter { name: "errorMessage"; type: "string" }
+ }
+ Method {
+ name: "imeiAt"
+ type: "string"
+ Parameter { name: "aIndex"; type: "int" }
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/plugin/qmldir
^
|
@@ -1,2 +1,3 @@
module org.nemomobile.ofono
plugin qofonoextdeclarative
+typeinfo plugins.qmltypes
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/plugin/qofonoextmodemlistmodel.cpp
^
|
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015-2016 Jolla Ltd.
+** Copyright (C) 2015-2017 Jolla Ltd.
** Contact: Slava Monich <slava.monich@jolla.com>
**
** GNU Lesser General Public License Usage
@@ -41,6 +41,12 @@
connect(iModemManager.data(),
SIGNAL(presentSimChanged(int,bool)),
SLOT(onPresentSimChanged(int,bool)));
+ connect(iModemManager.data(),
+ SIGNAL(imeiCodesChanged(QStringList)),
+ SLOT(onImeiCodesChanged(QStringList)));
+ connect(iModemManager.data(),
+ SIGNAL(imeisvCodesChanged(QStringList)),
+ SLOT(onImeisvCodesChanged(QStringList)));
}
bool QOfonoExtModemListModel::valid() const
@@ -62,6 +68,7 @@
roles[DefaultVoiceRole] = "defaultForVoice";
roles[SimPresentRole] = "simPresent";
roles[IMEIRole] = "imei";
+ roles[IMEISVRole] = "imeisv";
return roles;
}
@@ -81,6 +88,7 @@
case DefaultVoiceRole: return iAvailableModems.indexOf(iDefaultVoiceModem) == row;
case SimPresentRole: return iModemManager->simPresentAt(row);
case IMEIRole: return iModemManager->imeiAt(row);
+ case IMEISVRole: return iModemManager->imeisvAt(row);
}
}
qWarning() << aIndex << aRole;
@@ -182,4 +190,35 @@
Q_EMIT dataChanged(index, index, role);
}
}
+}
+
+void QOfonoExtModemListModel::onImeiCodesChanged(QStringList aList)
+{
+ QStringList prev = iImeiList;
+ iImeiList = aList;
+ roleChanged(IMEIRole, prev, aList);
+}
+
+void QOfonoExtModemListModel::onImeisvCodesChanged(QStringList aList)
+{
+ QStringList prev = iImeisvList;
+ iImeisvList = aList;
+ roleChanged(IMEISVRole, prev, aList);
+}
+
+void QOfonoExtModemListModel::roleChanged(Role aRole, QStringList aPrevList, QStringList aNewList)
+{
+ // This is slightly paranoid... All these 3 counts should be the same
+ const int n1 = iAvailableModems.count();
+ const int n2 = aPrevList.count();
+ const int n3 = aNewList.count();
+ const int n = qMin(n1, qMin(n2, n3));
+ QVector<int> role;
+ role.append(aRole);
+ for (int i=0; i<n; i++) {
+ if (aPrevList.at(i) != aNewList.at(i)) {
+ QModelIndex index(createIndex(i, 0));
+ Q_EMIT dataChanged(index, index, role);
+ }
+ }
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/plugin/qofonoextmodemlistmodel.h
^
|
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015-2016 Jolla Ltd.
+** Copyright (C) 2015-2017 Jolla Ltd.
** Contact: Slava Monich <slava.monich@jolla.com>
**
** GNU Lesser General Public License Usage
@@ -32,7 +32,8 @@
DefaultDataRole,
DefaultVoiceRole,
SimPresentRole,
- IMEIRole
+ IMEIRole,
+ IMEISVRole
};
explicit QOfonoExtModemListModel(QObject* aParent = NULL);
@@ -56,9 +57,12 @@
void onDefaultDataModemChanged(QString aModemPath);
void onDefaultVoiceModemChanged(QString aModemPath);
void onPresentSimChanged(int aIndex, bool aPresent);
+ void onImeiCodesChanged(QStringList aList);
+ void onImeisvCodesChanged(QStringList aList);
private:
void defaultModemChanged(Role aRole, int aPrevRow, int aNewRow);
+ void roleChanged(Role aRole, QStringList aPrevList, QStringList aNewList);
private:
QSharedPointer<QOfonoExtModemManager> iModemManager;
@@ -66,6 +70,8 @@
QStringList iEnabledModems;
QString iDefaultVoiceModem;
QString iDefaultDataModem;
+ QStringList iImeiList;
+ QStringList iImeisvList;
};
#endif // QOFONOEXTMODEMLISTMODEL_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/plugin/qofonoextsimlistmodel.cpp
^
|
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 Jolla Ltd.
+** Copyright (C) 2016-2018 Jolla Ltd.
** Contact: slava.monich@jolla.com
**
** GNU Lesser General Public License Usage
@@ -22,12 +22,12 @@
Q_OBJECT
SimData(QOfonoExtSimListModel* aParent,
+ QSharedPointer<QOfonoExtModemManager> aModemManager,
QOfonoSimManager::SharedPointer aSimManager,
int aIndex = -1);
private Q_SLOTS:
void onValidChanged();
- void onPresentSimListChanged();
void onSubscriberIdentityChanged();
void onMobileCountryCodeChanged();
void onMobileNetworkCodeChanged();
@@ -44,25 +44,36 @@
private:
void propertyChanged(Role role);
+ bool isValid() const;
+ int slotNumber() const;
public:
QOfonoExtSimListModel* iParent;
+ QSharedPointer<QOfonoExtModemManager> iModemManager;
QOfonoSimManager::SharedPointer iSim;
QOfonoExtSimInfo* iCache;
int iIndex;
+ int iSlot;
+ bool iValid;
};
QOfonoExtSimListModel::SimData::SimData(QOfonoExtSimListModel* aParent,
+ QSharedPointer<QOfonoExtModemManager> aModemManager,
QOfonoSimManager::SharedPointer aSimManager, int aIndex) :
QObject(aParent),
iParent(aParent),
+ iModemManager(aModemManager),
iSim(aSimManager),
iCache(new QOfonoExtSimInfo(this)),
iIndex(aIndex)
{
+ iSlot = slotNumber();
+ iValid = isValid();
+
QOfonoSimManager* sim = iSim.data();
QQmlEngine::setObjectOwnership(iCache, QQmlEngine::CppOwnership);
iCache->setModemPath(sim->modemPath());
+
connect(iCache,
SIGNAL(validChanged(bool)),
SLOT(onValidChanged()));
@@ -72,7 +83,8 @@
connect(iCache,
SIGNAL(serviceProviderNameChanged(QString)),
SLOT(onServiceProviderNameChanged()));
- iParent->connect(iCache,
+
+ connect(iModemManager.data(),
SIGNAL(validChanged(bool)),
SLOT(onValidChanged()));
@@ -121,9 +133,34 @@
}
}
+bool QOfonoExtSimListModel::SimData::isValid() const
+{
+ // QOfonoSimWatcher guarantees that QOfonoSimManager is valid
+ return iModemManager->valid() && iCache->valid();
+}
+
+int QOfonoExtSimListModel::SimData::slotNumber() const
+{
+ // The first slot is 1, second slot 2 and so on
+ return iModemManager->availableModems().indexOf(iSim->modemPath()) + 1;
+}
+
void QOfonoExtSimListModel::SimData::onValidChanged()
{
- propertyChanged(ValidRole);
+ const bool valid = isValid();
+ if (valid) {
+ // Once set, slot number doesn't change
+ const int slot = slotNumber();
+ if (slot && iSlot != slot) {
+ iSlot = slot;
+ propertyChanged(SlotRole);
+ }
+ }
+ if (iValid != valid) {
+ iValid = valid;
+ propertyChanged(ValidRole);
+ iParent->checkValid();
+ }
}
void QOfonoExtSimListModel::SimData::onSubscriberIdentityChanged()
@@ -197,18 +234,19 @@
QOfonoExtSimListModel::QOfonoExtSimListModel(QObject *aParent) :
QAbstractListModel(aParent),
+ iModemManager(QOfonoExtModemManager::instance()),
iSimWatcher(new QOfonoSimWatcher(this)),
iValid(false)
{
iSimWatcher->setRequireSubscriberIdentity(false);
QList<QOfonoSimManager::SharedPointer> sims(iSimWatcher->presentSimList());
for (int i=0; i<sims.count(); i++) {
- iSimList.append(new SimData(this, sims.at(i), i));
+ iSimList.append(new SimData(this, iModemManager, sims.at(i), i));
}
iValid = isValid();
connect(iSimWatcher,
SIGNAL(validChanged()),
- SLOT(onValidChanged()));
+ SLOT(onPresentSimListChanged()));
connect(iSimWatcher,
SIGNAL(presentSimListChanged()),
SLOT(onPresentSimListChanged()));
@@ -227,6 +265,7 @@
QHash<int,QByteArray> QOfonoExtSimListModel::roleNames() const
{
QHash<int, QByteArray> roles;
+ roles[SlotRole] = "slot";
roles[PathRole] = "path";
roles[ValidRole] = "valid";
roles[SubscriberIdentityRole] = "subscriberIdentity";
@@ -256,6 +295,8 @@
if (row >= 0 && row < iSimList.count()) {
const SimData* d = iSimList.at(row);
switch (aRole) {
+ case SlotRole: return d->iSlot;
+ case ValidRole: return d->iValid;
case PathRole: return d->iSim->modemPath();
case MobileCountryCodeRole: return d->iSim->mobileCountryCode();
case MobileNetworkCodeRole: return d->iSim->mobileNetworkCode();
@@ -268,7 +309,6 @@
case PinRetriesRole: return d->iSim->pinRetries();
case FixedDialingRole: return d->iSim->fixedDialing();
case BarredDialingRole: return d->iSim->barredDialing();
- case ValidRole: return d->iCache->valid();
case SubscriberIdentityRole: return d->iCache->subscriberIdentity();
case ServiceProviderNameRole: return d->iCache->serviceProviderName();
}
@@ -280,7 +320,10 @@
void QOfonoExtSimListModel::onPresentSimListChanged()
{
- QList<QOfonoSimManager::SharedPointer> sims(iSimWatcher->presentSimList());
+ QList<QOfonoSimManager::SharedPointer> sims;
+ if (iSimWatcher->isValid()) {
+ sims = iSimWatcher->presentSimList();
+ }
const bool countHasChanged(iSimList.count() != sims.count());
const bool wasValid = iValid;
QStringList paths;
@@ -302,7 +345,7 @@
for (i=0; i<sims.count(); i++) {
if (iSimList.count() <= i ||
iSimList.at(i)->iSim->modemPath() != paths.at(i)) {
- SimData* data = new SimData(this, sims.at(i), i);
+ SimData* data = new SimData(this, iModemManager, sims.at(i), i);
beginInsertRows(QModelIndex(), i, i);
iSimList.insert(i, data);
endInsertRows();
@@ -324,14 +367,14 @@
{
bool valid = iSimWatcher->isValid();
for (int i=0; valid && i<iSimList.count(); i++) {
- if (!iSimList.at(i)->iCache->valid()) {
+ if (!iSimList.at(i)->iValid) {
valid = false;
}
}
return valid;
}
-void QOfonoExtSimListModel::onValidChanged()
+void QOfonoExtSimListModel::checkValid()
{
const bool wasValid = iValid;
iValid = isValid();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/plugin/qofonoextsimlistmodel.h
^
|
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 Jolla Ltd.
+** Copyright (C) 2016-2018 Jolla Ltd.
** Contact: slava.monich@jolla.com
**
** GNU Lesser General Public License Usage
@@ -18,6 +18,7 @@
#include "qofonosimwatcher.h"
#include "qofonoextsiminfo.h"
+#include "qofonoextmodemmanager.h"
class QOfonoExtSimListModel : public QAbstractListModel {
Q_OBJECT
@@ -27,6 +28,7 @@
public:
enum Role {
PathRole = Qt::UserRole + 1,
+ SlotRole,
ValidRole,
SubscriberIdentityRole,
MobileCountryCodeRole,
@@ -61,13 +63,15 @@
private Q_SLOTS:
void onPresentSimListChanged();
- void onValidChanged();
private:
+ void checkValid();
bool isValid() const;
private:
class SimData;
+ friend class SimData;
+ QSharedPointer<QOfonoExtModemManager> iModemManager;
QOfonoSimWatcher* iSimWatcher;
QList<SimData*> iSimList;
bool iValid;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/rpm/libqofonoext.spec
^
|
@@ -1,12 +1,12 @@
Name: libqofonoext
Summary: A library of Qt bindings for ofono extensions
-Version: 1.0.16
+Version: 1.0.25
Release: 1
Group: System/Libraries
-License: LGPLv2.1
-URL: https://git.merproject.org/mer-core/libqofonoext
-Source0: libqofonoext-%{version}.tar.bz2
+License: LGPLv2
+URL: https://git.sailfishos.org/mer-core/libqofonoext
+Source0: %{name}-%{version}.tar.bz2
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires: libqofono-qt5 >= 0.87
@@ -22,22 +22,22 @@
This package contains Qt bindings for ofono extensions
%package declarative
-Summary: Declarative plugin for libqofonoext
+Summary: Declarative plugin for %{name}
Group: Development/Tools
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{version}
%description declarative
-This package contains declarative plugin for libqofonoext
+This package contains declarative plugin for %{name}
%package devel
-Summary: Development files for libqofonoext
+Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: %{name} = %{version}
%description devel
-This package contains the development header files for libqofonoext
+This package contains the development header files for %{name}
%prep
%setup -q -n %{name}-%{version}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/src/qofonoextcell.cpp
^
|
@@ -22,8 +22,9 @@
static const QString kTypeLte("lte");
#define CELL_PROPERTIES(p) \
- p(mcc) p(mnc) p(signalStrength) p(lac) p(cid) p(bitErrorRate) p(psc) \
- p(ci) p(pci) p(tac) p(rsrp) p(rsrq) p(rssnr) p(cqi) p(timingAdvance)
+ p(mcc) p(mnc) p(signalStrength) p(lac) p(cid) p(arfcn) p(bsic) \
+ p(bitErrorRate) p(psc) p(uarfcn) p(ci) p(pci) p(tac) p(earfcn) p(rsrp) \
+ p(rsrq) p(rssnr) p(cqi) p(timingAdvance)
// ==========================================================================
// QOfonoExtCellProxy
@@ -120,7 +121,7 @@
{
// Extract modem path from the cell path, e.g. "/ril_0/cell_0" => "/ril_0"
iCellInfo = QOfonoExtCellInfo::instance(aPath.left(aPath.lastIndexOf('/')));
- memset(iProperties, -1, sizeof(iProperties));
+ for (int i = 0; i < PropertyCount; i++) iProperties[i] = InvalidValue;
connect(this, SIGNAL(Removed()),
aParent, SIGNAL(removed()));
connect(this,
@@ -158,7 +159,7 @@
int QOfonoExtCell::Private::value(Private* aThis, QOfonoExtCell::Private::Property aProperty)
{
- return aThis ? aThis->iProperties[aProperty] : -1;
+ return aThis ? aThis->iProperties[aProperty] : InvalidValue;
}
void QOfonoExtCell::Private::onCellsChanged()
@@ -205,6 +206,7 @@
getAll();
}
} else {
+ int i;
const bool wasRegistered = iRegistered;
const Type prevType = iType;
iType = typeFromString(reply.argumentAt<1>());
@@ -213,10 +215,10 @@
// Unpack properties (they are all integers)
int prevProps[PropertyCount];
memcpy(prevProps, iProperties, sizeof(iProperties));
- memset(iProperties, -1, sizeof(iProperties));
+ for (i = 0; i < PropertyCount; i++) iProperties[i] = InvalidValue;
QVariantMap variants = reply.argumentAt<3>();
QStringList keys = variants.keys();
- for (int i=0; i<keys.count(); i++) {
+ for (i=0; i<keys.count(); i++) {
QString key = keys.at(i);
QVariant value = variants.value(key);
bool ok = false;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/src/qofonoextcell.h
^
|
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 Jolla Ltd.
+** Copyright (C) 2016-2017 Jolla Ltd.
** Contact: Slava Monich <slava.monich@jolla.com>
**
** GNU Lesser General Public License Usage
@@ -30,24 +30,34 @@
Q_PROPERTY(int signalStrength READ signalStrength NOTIFY signalStrengthChanged)
Q_PROPERTY(int lac READ lac NOTIFY lacChanged)
Q_PROPERTY(int cid READ cid NOTIFY cidChanged)
+ Q_PROPERTY(int arfcn READ arfcn NOTIFY arfcnChanged)
+ Q_PROPERTY(int bsic READ bsic NOTIFY bsicChanged)
Q_PROPERTY(int bitErrorRate READ bitErrorRate NOTIFY bitErrorRateChanged)
Q_PROPERTY(int psc READ psc NOTIFY pscChanged)
+ Q_PROPERTY(int uarfcn READ uarfcn NOTIFY uarfcnChanged)
Q_PROPERTY(int ci READ ci NOTIFY ciChanged)
Q_PROPERTY(int pci READ pci NOTIFY pciChanged)
Q_PROPERTY(int tac READ tac NOTIFY tacChanged)
+ Q_PROPERTY(int earfcn READ earfcn NOTIFY earfcnChanged)
Q_PROPERTY(int rsrp READ rsrp NOTIFY rsrpChanged)
Q_PROPERTY(int rsrq READ rsrq NOTIFY rsrqChanged)
Q_PROPERTY(int rssnr READ rssnr NOTIFY rssnrChanged)
Q_PROPERTY(int cqi READ cqi NOTIFY cqiChanged)
Q_PROPERTY(int timingAdvance READ timingAdvance NOTIFY timingAdvanceChanged)
Q_ENUMS(Type)
+ Q_ENUMS(Constants)
public:
enum Type {
- UNKNOWN,
+ Unknown,
GSM,
WCDMA,
- LTE
+ LTE,
+ UNKNOWN = Unknown // For backward compatibility
+ };
+
+ enum Constants {
+ InvalidValue = INT_MAX
};
explicit QOfonoExtCell(QObject* aParent = NULL);
@@ -66,6 +76,10 @@
int mnc() const;
int signalStrength() const;
+ // GSM:
+ int arfcn() const;
+ int bsic() const;
+
// GSM and WCDMA:
int lac() const;
int cid() const;
@@ -73,11 +87,13 @@
// WCDMA:
int psc() const;
+ int uarfcn() const;
// LTE:
int ci() const;
int pci() const;
int tac() const;
+ int earfcn() const;
int rsrp() const;
int rsrq() const;
int rssnr() const;
@@ -94,11 +110,15 @@
void signalStrengthChanged();
void lacChanged();
void cidChanged();
+ void arfcnChanged();
+ void bsicChanged();
void bitErrorRateChanged();
void pscChanged();
+ void uarfcnChanged();
void ciChanged();
void pciChanged();
void tacChanged();
+ void earfcnChanged();
void rsrpChanged();
void rsrqChanged();
void rssnrChanged();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/src/qofonoextmodemmanager.cpp
^
|
@@ -59,6 +59,10 @@
{ return asyncCall("GetAll5"); }
QDBusPendingCall GetAll6()
{ return asyncCall("GetAll6"); }
+ QDBusPendingCall GetAll7()
+ { return asyncCall("GetAll7"); }
+ QDBusPendingCall GetAll8()
+ { return asyncCall("GetAll8"); }
QDBusPendingCall SetDefaultDataSim(QString aImsi)
{ return asyncCall("SetDefaultDataSim", aImsi); }
QDBusPendingCall SetDefaultVoiceSim(const QString &aImsi)
@@ -127,6 +131,7 @@
QString iDefaultDataSim;
QList<bool> iPresentSims;
QStringList iIMEIs;
+ QStringList iIMEISVs;
QString iMmsSim;
QString iMmsModem;
int iPresentSimCount;
@@ -140,6 +145,7 @@
static QStringList toStringList(QList<QDBusObjectPath> aList);
static QList<QDBusObjectPath> toPathList(QStringList aList);
+ QStringList dummyStringList();
void getAll();
void getInterfaceVersion();
@@ -285,7 +291,9 @@
(iInterfaceVersion == 3) ? QDBusPendingCall(iProxy->GetAll3()) :
(iInterfaceVersion == 4) ? QDBusPendingCall(iProxy->GetAll4()) :
(iInterfaceVersion == 5) ? QDBusPendingCall(iProxy->GetAll5()) :
- QDBusPendingCall(iProxy->GetAll6()), iProxy);
+ (iInterfaceVersion == 6) ? QDBusPendingCall(iProxy->GetAll6()) :
+ (iInterfaceVersion == 7) ? QDBusPendingCall(iProxy->GetAll7()) :
+ QDBusPendingCall(iProxy->GetAll8()), iProxy);
connect(iInitCall, SIGNAL(finished(QDBusPendingCallWatcher*)),
SLOT(onGetAllFinished(QDBusPendingCallWatcher*)));
}
@@ -371,10 +379,13 @@
if (version >= 3) {
// 8: imei
list = reply.argumentAt(8).toStringList();
- if (iIMEIs != list) {
- iIMEIs = list;
- Q_EMIT iParent->imeiCodesChanged(iIMEIs);
- }
+ } else {
+ list = dummyStringList();
+ }
+
+ if (iIMEIs != list) {
+ iIMEIs = list;
+ Q_EMIT iParent->imeiCodesChanged(iIMEIs);
}
if (version >= 4) {
@@ -392,10 +403,10 @@
updateReady(true);
}
+ int errorCount = 0;
if (version >= 6) {
// 12: modemErrors
ModemErrors me = qdbus_cast<ModemErrors>(reply.argumentAt(12));
- int errorCount = 0;
const int n = me.count();
for (int i=0; i<n; i++) {
const ErrorList& errors = me.at(i);
@@ -404,12 +415,34 @@
errorCount += errors.at(j).iCount;
}
}
- if (iErrorCount != errorCount) {
- iErrorCount = errorCount;
- Q_EMIT iParent->errorCountChanged(errorCount);
+ }
+
+ if (version >= 7) {
+ // 13: imeisv
+ list = reply.argumentAt(13).toStringList();
+ } else {
+ list = dummyStringList();
+ }
+
+ if (version >= 8) {
+ // 14: errors
+ ErrorList errors = qdbus_cast<ErrorList>(reply.argumentAt(14));
+ const int k = errors.count();
+ for (int i=0; i<k; i++) {
+ errorCount += errors.at(i).iCount;
}
}
+ if (iErrorCount != errorCount) {
+ iErrorCount = errorCount;
+ Q_EMIT iParent->errorCountChanged(errorCount);
+ }
+
+ if (iIMEISVs != list) {
+ iIMEISVs = list;
+ Q_EMIT iParent->imeisvCodesChanged(iIMEISVs);
+ }
+
if (!iValid) {
iValid = true;
Q_EMIT iParent->validChanged(iValid);
@@ -418,6 +451,16 @@
aWatcher->deleteLater();
}
+QStringList QOfonoExtModemManager::Private::dummyStringList()
+{
+ QStringList list;
+ const int n = iAvailableModems.count();
+ for (int i=0; i<n; i++) {
+ list.append(QString());
+ }
+ return list;
+}
+
void QOfonoExtModemManager::Private::presentSimsChanged(QList<bool> aOldList)
{
int i;
@@ -668,6 +711,11 @@
return iPrivate->iIMEIs;
}
+QStringList QOfonoExtModemManager::imeisvCodes() const
+{
+ return iPrivate->iIMEISVs;
+}
+
QString QOfonoExtModemManager::mmsSim() const
{
return iPrivate->iMmsSim;
@@ -705,6 +753,15 @@
} else {
return QString();
}
+}
+
+QString QOfonoExtModemManager::imeisvAt(int aIndex) const
+{
+ if (aIndex >= 0 && aIndex < iPrivate->iIMEISVs.count()) {
+ return iPrivate->iIMEISVs.at(aIndex);
+ } else {
+ return QString();
+ }
}
bool QOfonoExtModemManager::simPresentAt(int aIndex) const
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/src/qofonoextmodemmanager.h
^
|
@@ -31,6 +31,7 @@
Q_PROPERTY(QString defaultVoiceSim READ defaultVoiceSim WRITE setDefaultVoiceSim NOTIFY defaultVoiceSimChanged)
Q_PROPERTY(QList<bool> presentSims READ presentSims NOTIFY presentSimsChanged)
Q_PROPERTY(QStringList imeiCodes READ imeiCodes NOTIFY imeiCodesChanged)
+ Q_PROPERTY(QStringList imeisvCodes READ imeisvCodes NOTIFY imeisvCodesChanged)
Q_PROPERTY(QString mmsSim READ mmsSim NOTIFY mmsSimChanged)
Q_PROPERTY(QString mmsModem READ mmsModem NOTIFY mmsModemChanged)
Q_PROPERTY(bool ready READ ready NOTIFY readyChanged)
@@ -52,6 +53,7 @@
QString defaultVoiceSim() const;
QList<bool> presentSims() const;
QStringList imeiCodes() const;
+ QStringList imeisvCodes() const;
QString mmsSim() const;
QString mmsModem() const;
bool ready() const;
@@ -60,6 +62,7 @@
int errorCount() const;
Q_INVOKABLE QString imeiAt(int aIndex) const;
+ Q_INVOKABLE QString imeisvAt(int aIndex) const;
Q_INVOKABLE bool simPresentAt(int aIndex) const;
void setEnabledModems(QStringList aModems);
@@ -82,6 +85,7 @@
void presentSimCountChanged(int value);
void activeSimCountChanged(int value);
void imeiCodesChanged(QStringList value);
+ void imeisvCodesChanged(QStringList value);
void mmsSimChanged(QString value);
void mmsModemChanged(QString value);
void readyChanged(bool value);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/src/qofonoextsiminfo.cpp
^
|
@@ -73,6 +73,7 @@
QString modemPath() const;
void setModemPath(QString aPath);
void invalidate();
+ void getAll();
private Q_SLOTS:
void checkInterfacePresence();
@@ -112,6 +113,7 @@
SLOT(checkInterfacePresence()));
checkInterfacePresence();
}
+ iParent->modemPathChanged(modemPath());
}
}
@@ -122,9 +124,6 @@
if (!iProxy) {
iProxy = new QOfonoExtSimInfoProxy(iModem->objectPath(), this);
if (iProxy->isValid()) {
- connect(new QDBusPendingCallWatcher(iProxy->GetAll(), iProxy),
- SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(onGetAllFinished(QDBusPendingCallWatcher*)));
connect(iProxy,
SIGNAL(CardIdentifierChanged(QString)),
SLOT(onCardIdentifierChanged(QString)));
@@ -134,6 +133,7 @@
connect(iProxy,
SIGNAL(ServiceProviderNameChanged(QString)),
SLOT(onServiceProviderNameChanged(QString)));
+ getAll();
} else {
invalidate();
}
@@ -155,6 +155,13 @@
}
}
+void QOfonoExtSimInfo::Private::getAll()
+{
+ connect(new QDBusPendingCallWatcher(iProxy->GetAll(), iProxy),
+ SIGNAL(finished(QDBusPendingCallWatcher*)),
+ SLOT(onGetAllFinished(QDBusPendingCallWatcher*)));
+}
+
void QOfonoExtSimInfo::Private::onGetAllFinished(QDBusPendingCallWatcher* aWatcher)
{
QDBusPendingReply<int, // InterfaceVersion
@@ -163,7 +170,11 @@
QString> // ServiceProviderName
reply(*aWatcher);
if (reply.isError()) {
+ // Repeat the call on timeout
qWarning() << reply.error();
+ if (QOfonoExt::isTimeout(reply.error())) {
+ getAll();
+ }
} else {
QString iccid = reply.argumentAt<1>();
if (iCardIdentifier != iccid) {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/libqofonoext/src/version.pri
^
|
@@ -1 +1 @@
-VERSION = 1.0.16
+VERSION = 1.0.25
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/src/main.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Copyright (C) 2016-2017 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
@@ -51,8 +51,9 @@
Q_PROPERTY(bool mobileDataBroken READ mobileDataBroken NOTIFY mobileDataBrokenChanged)
Q_PROPERTY(bool mobileDataDisabled READ mobileDataDisabled NOTIFY mobileDataDisabledChanged)
static const QString AUTO;
+
public:
- OfonoLogger(int* aArgc, char** aArgv);
+ OfonoLogger(int* aArgc, char** aArgv, QStringList aPackages);
bool mobileDataBroken() const;
bool mobileDataDisabled() const;
Q_INVOKABLE void fixMobileData();
@@ -65,8 +66,8 @@
void dumpConnmanInfo(QString aPath, QString aService) const;
protected:
- virtual void saveFilesAtStartup(QString aDir);
- virtual void setupView(QQuickView* aView);
+ void saveFilesAtStartup(QString aDir) Q_DECL_OVERRIDE;
+ void setupView(QQuickView* aView) Q_DECL_OVERRIDE;
private Q_SLOTS:
void updateModemManagerState();
@@ -90,8 +91,8 @@
const QString OfonoLogger::AUTO("auto");
-OfonoLogger::OfonoLogger(int* aArgc, char** aArgv) :
- SUPER(aArgc, aArgv, "org.ofono", "ofono", "qml/main.qml"),
+OfonoLogger::OfonoLogger(int* aArgc, char** aArgv, QStringList aPackages) :
+ SUPER(aArgc, aArgv, "org.ofono", aPackages, "ofono", "qml/main.qml"),
iModemManager(QOfonoExtModemManager::instance()),
iNetworkTechnology(new NetworkTechnology(this)),
iFilesSaved(false),
@@ -249,10 +250,15 @@
Q_DECL_EXPORT int main(int argc, char* argv[])
{
- OfonoLogger* logger = new OfonoLogger(&argc, argv);
- int ret = logger->run();
- delete logger;
- return ret;
+ QStringList packages;
+ packages.append("libgbinder");
+ packages.append("libgbinder-radio");
+ packages.append("libglibutil");
+ packages.append("libgrilio");
+ packages.append("libgrilio-binder");
+ packages.append("ofono");
+ packages.append("ofono-ril-binder-plugin");
+ return OfonoLogger(&argc, argv, packages).run();
}
#include "main.moc"
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/translations/harbour-logger-ofono-nl.ts
^
|
@@ -49,6 +49,11 @@
<source>Log cleared</source>
<translation>Log gewist</translation>
</message>
+ <message id="logger-logpage-hint-jump_to_bottom">
+ <source>Jump to the end of the log to see the most recent messages and follow new messages in real time</source>
+ <extracomment>Hint text, displayed on long tap</extracomment>
+ <translation type="unfinished">Spring naar het einde van het logboek om de meest recente berichten te zien en om nieuwe berichten in realtime te volgen</translation>
+ </message>
<message id="logger-categories-title">
<source>Log categories</source>
<translation>Logcategorieën</translation>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/translations/harbour-logger-ofono-pl.ts
^
|
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.1">
+<TS version="2.1" language="pl">
<context>
<name></name>
<message id="logger-cover-title">
@@ -49,6 +49,11 @@
<source>Log cleared</source>
<translation>Logi wyczyszczone</translation>
</message>
+ <message id="logger-logpage-hint-jump_to_bottom">
+ <source>Jump to the end of the log to see the most recent messages and follow new messages in real time</source>
+ <extracomment>Hint text, displayed on long tap</extracomment>
+ <translation type="unfinished">Przejdź do ostatniej wiadomości i śledź nowe w czasie rzeczywistym</translation>
+ </message>
<message id="logger-categories-title">
<source>Log categories</source>
<translation>Kategorie logów</translation>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/translations/harbour-logger-ofono-ru.ts
^
|
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.1">
+<TS version="2.1" language="ru">
<context>
<name></name>
<message id="logger-cover-title">
@@ -49,6 +49,11 @@
<source>Log cleared</source>
<translation>Журнал очищен</translation>
</message>
+ <message id="logger-logpage-hint-jump_to_bottom">
+ <source>Jump to the end of the log to see the most recent messages and follow new messages in real time</source>
+ <extracomment>Hint text, displayed on long tap</extracomment>
+ <translation>Перескочить к последнему сообщению и следить за новыми в реальном времени</translation>
+ </message>
<message id="logger-categories-title">
<source>Log categories</source>
<translation>Категории</translation>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/translations/harbour-logger-ofono-sv.ts
^
|
@@ -49,6 +49,11 @@
<source>Log cleared</source>
<translation>Loggen rensad</translation>
</message>
+ <message id="logger-logpage-hint-jump_to_bottom">
+ <source>Jump to the end of the log to see the most recent messages and follow new messages in real time</source>
+ <extracomment>Hint text, displayed on long tap</extracomment>
+ <translation type="unfinished">Hoppa till slutet av loggen för att se de senaste meddelandena och följ nya meddelanden i realtid</translation>
+ </message>
<message id="logger-categories-title">
<source>Log categories</source>
<translation>Loggkategorier</translation>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.16.tar.bz2/ofono/translations/harbour-logger-ofono.ts
^
|
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.1">
+<TS version="2.1" language="en">
<context>
<name></name>
<message id="logger-cover-title">
@@ -49,6 +49,11 @@
<source>Log cleared</source>
<translation>Log cleared</translation>
</message>
+ <message id="logger-logpage-hint-jump_to_bottom">
+ <source>Jump to the end of the log to see the most recent messages and follow new messages in real time</source>
+ <extracomment>Hint text, displayed on long tap</extracomment>
+ <translation>Jump to the end of the log to see the most recent messages and follow new messages in real time</translation>
+ </message>
<message id="logger-categories-title">
<source>Log categories</source>
<translation>Log categories</translation>
|