[-]
[+]
|
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">f0ca9e3</param>
+ <param name="revision">f9f00e9</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/logger.pro
^
|
@@ -28,6 +28,10 @@
DEFINES += DEBUG=1
}
+openrepos {
+ DEFINES += OPENREPOS
+}
+
SOURCES += \
src/LoggerBuffer.cpp \
src/LoggerCategory.cpp \
@@ -71,7 +75,9 @@
OTHER_FILES += \
qml/pages/*.js \
- qml/pages/*.qml
+ qml/pages/*.qml \
+ settings/*.qml \
+ settings/*.json
DBUS_SPEC_DIR = $$_PRO_FILE_PWD_/src/libdbuslog/spec
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/qml/pages/LogPage.qml
^
|
@@ -77,7 +77,6 @@
PullDownMenu {
id: pullDownMenu
- visible: logModel.connected
MenuItem {
//% "Clear log"
text: qsTrId("logger-logpage-pm-clear-log")
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/qml/pages/MainPage.qml
^
|
@@ -56,6 +56,7 @@
orientation: ListView.Horizontal
snapMode: ListView.SnapOneItem
model: pages
+ clip: true
delegate: Item {
width: scroller.width
height: scroller.height
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/settings/harbour-logger.json
^
|
@@ -0,0 +1,14 @@
+{
+ "translation_catalog" : "harbour-logger",
+ "entries": [
+ {
+ "path": "applications/harbour-logger.desktop",
+ "title": "MMS Logger",
+ "type": "page",
+ "icon": "harbour-mmslog",
+ "params": {
+ "source": "/usr/share/harbour-logger/settings/settings.qml"
+ }
+ }
+ ]
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/settings/settings.qml
^
|
@@ -0,0 +1,104 @@
+/*
+ Copyright (C) 2015-2016 Jolla Ltd.
+ Contact: Slava Monich <slava.monich@jolla.com>
+
+ You may use this file under the terms of BSD license as follows:
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Jolla Ltd nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+import org.nemomobile.configuration 1.0
+
+Page {
+ SilicaFlickable {
+ anchors.fill: parent
+ contentHeight: content.height
+
+ Column {
+ id: content
+ width: parent.width
+
+ PageHeader {
+ //% "Logger"
+ title: qsTrId("logger-settings-page-header")
+ }
+
+ ComboBox {
+ id: logSizeLimitComboBox
+ //% "Screen buffer size"
+ label: qsTrId("logger-settings-logsizelimit")
+ //% "Don't worry, everything will be written to the log file regardless of the screen buffer size."
+ description: qsTrId("logger-settings-logsizelimit-description")
+ value: currentItem ? currentItem.text : ""
+ menu: logSizeLimitMenu
+ ContextMenu {
+ id: logSizeLimitMenu
+ readonly property int defaultIndex: 1
+ MenuItem {
+ text: maxLines
+ readonly property int maxLines: 100
+ }
+ MenuItem {
+ text: maxLines
+ readonly property int maxLines: 1000
+ }
+ MenuItem {
+ text: maxLines
+ readonly property int maxLines: 10000
+ }
+ MenuItem {
+ //% "Unlimited"
+ text: qsTrId("logger-settings-logsizelimit-unlimited")
+ readonly property int maxLines: 0
+ }
+ }
+ onCurrentIndexChanged: if (currentItem) logSizeLimit.value = currentItem.maxLines
+ Component.onCompleted: updateSelection(logSizeLimit.value)
+ function updateSelection(value) {
+ if (value === undefined) {
+ currentIndex = logSizeLimitMenu.defaultIndex
+ } else {
+ var n = logSizeLimitMenu.children.length
+ for (var i=0; i<n; i++) {
+ if (value === logSizeLimitMenu.children[i].maxLines) {
+ currentIndex = i
+ return
+ }
+ }
+ currentItem = null // Non-standard value
+ }
+ }
+ ConfigurationValue {
+ id: logSizeLimit
+ key: "/apps/harbour-logger-conf/logSizeLimit"
+ onValueChanged: logSizeLimitComboBox.updateSelection(value)
+ defaultValue: 1000
+ }
+ }
+ }
+ }
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/LoggerBuffer.h
^
|
@@ -44,6 +44,8 @@
~LoggerBuffer();
int size() const;
+ int maxSize() const;
+ void setMaxSize(int aMaxSize);
bool isEmpty() const;
bool put(LoggerEntry aEntry);
LoggerEntry get();
@@ -67,6 +69,10 @@
{ gutil_ring_unref(iRingBuffer); }
inline int LoggerBuffer::size() const
{ return gutil_ring_size(iRingBuffer); }
+inline int LoggerBuffer::maxSize() const
+ { return gutil_ring_max_size(iRingBuffer); }
+inline void LoggerBuffer::setMaxSize(int aMaxSize)
+ { gutil_ring_set_max_size(iRingBuffer, aMaxSize); }
inline bool LoggerBuffer::isEmpty() const
{ return !gutil_ring_size(iRingBuffer); }
inline bool LoggerBuffer::canPut(int aCount) const
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/LoggerLogModel.cpp
^
|
@@ -38,14 +38,25 @@
#include "dbuslog_client.h"
#define SUPER QAbstractListModel
-#define MAX_DEPTH 1000
-#define REMOVE_CHUNK 50
-LoggerLogModel::LoggerLogModel(DBusLogClient* aClient, QObject* aParent) :
- SUPER(aParent),
+#define DCONF_PATH(app) QString("/apps/") + app + "/"
+#define DCONF_KEY(app,key) DCONF_PATH(app) + key
+#define DCONF_LOG_SIZE_LIMIT(app) DCONF_KEY(app, "logSizeLimit")
+
+#define LOG_REMOVE_COUNT_MAX (100)
+#define LOG_SIZE_LIMIT_DEFAULT (1000)
+#define LOG_SIZE_LIMIT_MIN (100)
+#define LOG_SIZE_LIMIT_NONE (0)
+
+LoggerLogModel::LoggerLogModel(QString aAppName, DBusLogClient* aClient,
+ QObject* aParent) : SUPER(aParent),
iClient(dbus_log_client_ref(aClient)),
- iBuffer(MAX_DEPTH)
+ iBuffer(LOG_SIZE_LIMIT_DEFAULT),
+ iLogSizeLimitConf(new MGConfItem(DCONF_LOG_SIZE_LIMIT(aAppName), this))
{
+ // updateLogSizeLimit() will initialize iLogSizeLimit and iLogRemoveCount:
+ updateLogSizeLimit();
+ connect(iLogSizeLimitConf, SIGNAL(valueChanged()), SLOT(updateLogSizeLimit()));
memset(iClientSignals, 0, sizeof(iClientSignals));
iClientSignals[DBusLogClientSignalConnected] =
dbus_log_client_add_connected_handler(iClient, connectedProc, this);
@@ -62,6 +73,45 @@
dbus_log_client_unref(iClient);
}
+void LoggerLogModel::updateLogSizeLimit()
+{
+ iLogSizeLimit = LOG_SIZE_LIMIT_DEFAULT;
+ QVariant value = iLogSizeLimitConf->value();
+ if (value.isValid()) {
+ bool ok = false;
+ int ival = value.toInt(&ok);
+ if (ok) {
+ if (ival <= 0) {
+ iLogSizeLimit = LOG_SIZE_LIMIT_NONE;
+ } else if (ival < LOG_SIZE_LIMIT_MIN) {
+ iLogSizeLimit = LOG_SIZE_LIMIT_MIN;
+ } else {
+ iLogSizeLimit = ival;
+ }
+ }
+ }
+ if (iLogSizeLimit > 0) {
+ // Truncate the buffer if necessary
+ const int bufsize = iBuffer.size();
+ if (bufsize > iLogSizeLimit) {
+ const int dropCount = (bufsize - iLogSizeLimit);
+ beginRemoveRows(QModelIndex(), 0, dropCount-1);
+ iBuffer.drop(dropCount);
+ endRemoveRows();
+ }
+ HDEBUG("log size limit" << iLogSizeLimit);
+ iBuffer.setMaxSize(iLogSizeLimit);
+ iLogRemoveCount = iLogSizeLimit/50;
+ if (iLogRemoveCount > LOG_REMOVE_COUNT_MAX) {
+ iLogRemoveCount = LOG_REMOVE_COUNT_MAX;
+ }
+ } else {
+ HDEBUG("log size unlimited");
+ iLogRemoveCount = LOG_REMOVE_COUNT_MAX;
+ iBuffer.setMaxSize(GUTIL_RING_UNLIMITED_SIZE);
+ }
+}
+
void LoggerLogModel::handleConnected()
{
iCategories.clear();
@@ -95,8 +145,8 @@
{
const bool wasEmpty = isEmpty();
if (!iBuffer.canPut(1)) {
- beginRemoveRows(QModelIndex(), 0, REMOVE_CHUNK-1);
- iBuffer.drop(REMOVE_CHUNK);
+ beginRemoveRows(QModelIndex(), 0, iLogRemoveCount-1);
+ iBuffer.drop(iLogRemoveCount);
endRemoveRows();
}
const int count = iBuffer.size();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/LoggerLogModel.h
^
|
@@ -40,6 +40,7 @@
#include "dbuslog_message.h"
#include <QAbstractListModel>
+#include <MGConfItem>
class LoggerLogModel : public QAbstractListModel
{
@@ -56,7 +57,7 @@
TextRole
};
- LoggerLogModel(DBusLogClient* aClient, QObject* aParent);
+ LoggerLogModel(QString aAppName, DBusLogClient* aClient, QObject* aParent);
~LoggerLogModel();
virtual QHash<int,QByteArray> roleNames() const;
@@ -76,6 +77,9 @@
void connectedChanged();
void entryAdded(LoggerEntry entry);
+private Q_SLOTS:
+ void updateLogSizeLimit();
+
private:
static void connectedProc(DBusLogClient* aClient, gpointer aData);
static void messageProc(DBusLogClient* aClient, DBusLogCategory* aCategory,
@@ -99,6 +103,9 @@
gulong iClientSignals[DBusLogClientSignalCount];
QHash<guint32,LoggerCategory> iCategories;
LoggerBuffer iBuffer;
+ MGConfItem* iLogSizeLimitConf;
+ int iLogSizeLimit;
+ int iLogRemoveCount;
};
#endif // LOGGER_LOG_MODEL_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/LoggerLogSaver.cpp
^
|
@@ -108,7 +108,7 @@
iBuffer(-1),
iThreadPool(new QThreadPool),
iArchiveType("application/x-gzip"),
- iArchiveName(aName + QDateTime::currentDateTime().toString("_yyyy-dd-MM_hhmmss")),
+ iArchiveName(aName + QDateTime::currentDateTime().toString("_yyyy-MM-dd_hhmmss")),
iArchiveFile(iArchiveName + ".tar.gz"),
iTempDir(QString("/tmp/") + aName + "_XXXXXX"),
iRootDir(iTempDir.path() + "/" + iArchiveName),
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/LoggerMain.cpp
^
|
@@ -61,22 +61,27 @@
int Logger::Main(int aArgc, char* aArgv[], const char* aService,
QString aPackage, QString aQmlPath)
{
- QString pluginPrefix(QString("harbour.logger.") + aPackage);
- QString fullAppName(QString("harbour-logger-") + aPackage);
-
QGuiApplication* app = SailfishApp::application(aArgc, aArgv);
- HarbourTransferMethodInfo::registerTypes();
+
+ QString pluginPrefix(QString("harbour.logger.") + aPackage);
register_types(qPrintable(pluginPrefix));
+ HarbourTransferMethodInfo::registerTypes();
// Load translations
QLocale locale;
QTranslator* translator = new QTranslator(app);
+#ifdef OPENREPOS
+ QString fullAppName(QString("openrepos-logger-") + aPackage);
+ QString transDir("/usr/share/translations");
+#else
+ QString fullAppName(QString("harbour-logger-") + aPackage);
QString transDir = SailfishApp::pathTo("translations").toLocalFile();
+#endif
if (translator->load(locale, fullAppName, "-", transDir) ||
translator->load(fullAppName, transDir)) {
app->installTranslator(translator);
} else {
- HDEBUG("Failed to load translations for" << locale);
+ HWARN("Failed to load" << qPrintable(fullAppName) << "translations for" << locale);
HDEBUG("Translation directory" << transDir);
HDEBUG("App name" << fullAppName);
delete translator;
@@ -96,7 +101,7 @@
// Log client and models
DBusLogClient* client = dbus_log_client_new(G_BUS_TYPE_SYSTEM,
aService, "/", DBUSLOG_CLIENT_FLAG_AUTOSTART);
- LoggerLogModel* logModel = new LoggerLogModel(client, app);
+ LoggerLogModel* logModel = new LoggerLogModel(fullAppName, client, app);
LoggerCategoryListModel* categoryModel = new LoggerCategoryListModel(client, app);
LoggerLogSaver* logSaver = new LoggerLogSaver(aPackage, app);
logSaver->connect(logModel, SIGNAL(entryAdded(LoggerEntry)), SLOT(addEntry(LoggerEntry)));
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libdbuslog/VERSION
^
|
@@ -1 +1 @@
-1.0.0
+1.0.3
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libdbuslog/client/Makefile
^
|
@@ -49,9 +49,9 @@
# Library version
#
-VERSION_MAJOR = 1
-VERSION_MINOR = 0
-VERSION_RELEASE = 0
+VERSION_MAJOR = $(shell head -1 ../VERSION | cut -f1 -d.)
+VERSION_MINOR = $(shell head -1 ../VERSION | cut -f2 -d.)
+VERSION_RELEASE = $(shell head -1 ../VERSION | cut -f3 -d.)
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libdbuslog/rpm/dbuslog-tools.spec
^
|
@@ -0,0 +1,31 @@
+Name: dbuslog-tools
+Version: 1.0.3
+Release: 0
+Summary: Command line tools for libdbuslogserver
+Group: Development/Tools
+License: BSD
+URL: https://git.merproject.org/mer-core/libdbuslog
+Source: %{name}-%{version}.tar.bz2
+BuildRequires: pkgconfig(libglibutil)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(gio-2.0)
+BuildRequires: pkgconfig(gio-unix-2.0)
+
+%description
+Provides command line tool for setting up logging options and pulling
+logs from the command line.
+
+%prep
+%setup -q
+
+%build
+make -C tools/dbuslog-client KEEP_SYMBOLS=1 release
+
+%install
+rm -rf %{buildroot}
+install -d %{buildroot}/%{_bindir}
+install -m 755 tools/dbuslog-client/build/release/dbuslog-client %{buildroot}/%{_bindir}
+
+%files
+%defattr(-,root,root,-)
+%{_bindir}/dbuslog-client
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libdbuslog/rpm/libdbuslogserver-dbus.spec
^
|
@@ -1,5 +1,5 @@
Name: libdbuslogserver-dbus
-Version: 1.0
+Version: 1.0.3
Release: 0
Summary: Library of logging utilities
Group: Development/Libraries
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libdbuslog/rpm/libdbuslogserver-gio.spec
^
|
@@ -1,5 +1,5 @@
Name: libdbuslogserver-gio
-Version: 1.0
+Version: 1.0.3
Release: 0
Summary: Library of logging utilities
Group: Development/Libraries
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libdbuslog/server/src/dbuslog_sender.c
^
|
@@ -159,6 +159,7 @@
} else {
/* Remove the watch if there's nothing queued */
GVERBOSE("%s queue empty", priv->name);
+ priv->write_watch_id = 0;
return FALSE;
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libdbuslog/tools/dbuslog-client/Makefile
^
|
@@ -59,6 +59,14 @@
DEBUG_FLAGS = -g
RELEASE_FLAGS =
+ifndef KEEP_SYMBOLS
+KEEP_SYMBOLS = 0
+endif
+
+ifneq ($(KEEP_SYMBOLS),0)
+RELEASE_FLAGS += -g
+endif
+
DEBUG_LDFLAGS = $(FULL_LDFLAGS) $(DEBUG_FLAGS)
RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libdbuslog/tools/dbuslog-client/main.c
^
|
@@ -32,6 +32,7 @@
#include <dbuslog_client.h>
#include <gutil_macros.h>
+#include <gutil_strv.h>
#include <gutil_log.h>
#include <glib-unix.h>
@@ -41,6 +42,13 @@
#define RET_CANCEL (2)
#define RET_TIMEOUT (3)
+enum {
+ APP_EVENT_ERROR,
+ APP_EVENT_CONNECT,
+ APP_EVENT_MESSAGE,
+ APP_N_EVENTS
+};
+
typedef struct app_action AppAction;
typedef DBusLogClientCall* (*AppActionRunFunc)(AppAction* action);
typedef void (*AppActionFreeFunc)(AppAction* action);
@@ -50,6 +58,8 @@
DBusLogClient* client;
DBusLogClientCall* call;
AppAction* actions;
+ gboolean follow;
+ gulong event_id[APP_N_EVENTS];
gint timeout;
guint timeout_id;
guint sigterm_id;
@@ -71,6 +81,11 @@
static
void
+app_follow(
+ App* app);
+
+static
+void
app_quit(
App* app)
{
@@ -89,7 +104,11 @@
app->call = action->fn_run(action);
}
if (!app->call) {
- app_quit(app);
+ if (app->follow) {
+ app_follow(app);
+ } else {
+ app_quit(app);
+ }
}
}
@@ -198,10 +217,21 @@
static
DBusLogClientCall*
+app_action_enable_all(
+ AppAction* action)
+{
+ GDEBUG("Enabling all categories");
+ return dbus_log_client_enable_pattern(action->app->client, "*",
+ app_action_call_done, action);
+}
+
+static
+DBusLogClientCall*
app_action_enable(
AppAction* action)
{
AppActionStr* str_action = G_CAST(action,AppActionStr,action);
+ GDEBUG("Enabling '%s'", str_action->str);
return dbus_log_client_enable_pattern(action->app->client,
str_action->str, app_action_call_done, action);
}
@@ -212,11 +242,61 @@
AppAction* action)
{
AppActionStr* str_action = G_CAST(action,AppActionStr,action);
+ GDEBUG("Disabling '%s'", str_action->str);
return dbus_log_client_disable_pattern(action->app->client,
str_action->str, app_action_call_done, action);
}
static
+DBusLogClientCall*
+app_action_reset(
+ AppAction* action)
+{
+ DBusLogClient* client = action->app->client;
+ GStrV* enable = NULL;
+ GStrV* disable = NULL;
+ guint i;
+
+ GDEBUG("Resetting categories...");
+ for (i=0; i<client->categories->len; i++) {
+ DBusLogCategory* cat = g_ptr_array_index(client->categories, i);
+ if (cat->flags & DBUSLOG_CATEGORY_FLAG_ENABLED_BY_DEFAULT) {
+ if (!(cat->flags & DBUSLOG_CATEGORY_FLAG_ENABLED)) {
+ GVERBOSE(" enable %s", cat->name);
+ enable = gutil_strv_add(enable, cat->name);
+ }
+ } else {
+ if (cat->flags & DBUSLOG_CATEGORY_FLAG_ENABLED) {
+ GVERBOSE(" disable %s", cat->name);
+ disable = gutil_strv_add(disable, cat->name);
+ }
+ }
+ }
+
+ if (enable || disable) {
+ DBusLogClientCall* call;
+ if (enable && disable) {
+ /* Register callback for the second call only */
+ dbus_log_client_enable_categories(client, enable, NULL, NULL);
+ call = dbus_log_client_disable_categories(client, disable,
+ app_action_call_done, action);
+ } else if (enable) {
+ call = dbus_log_client_enable_categories(client, enable,
+ app_action_call_done, action);
+ } else {
+ call = dbus_log_client_disable_categories(client, disable,
+ app_action_call_done, action);
+ }
+ g_strfreev(enable);
+ g_strfreev(disable);
+ return call;
+ } else {
+ GDEBUG("Nothing to reset");
+ return NULL;
+ }
+}
+
+static
void
client_connected(
App* app)
@@ -242,6 +322,22 @@
static
void
+app_follow(
+ App* app)
+{
+ if (!app->event_id[APP_EVENT_MESSAGE]) {
+ app->event_id[APP_EVENT_MESSAGE] =
+ dbus_log_client_add_message_handler(app->client,
+ client_message, app);
+ }
+ if (!app->client->started) {
+ GDEBUG("Starting live capture...");
+ dbus_log_client_start(app->client, NULL, NULL);
+ }
+}
+
+static
+void
client_connected_cb(
DBusLogClient* client,
gpointer user_data)
@@ -327,26 +423,20 @@
app_run(
App* app)
{
- int n = 0;
- gulong id[2];
gboolean run_loop = TRUE;
app->loop = g_main_loop_new(NULL, FALSE);
app->sigterm_id = g_unix_signal_add(SIGTERM, app_sigterm, app);
app->sigint_id = g_unix_signal_add(SIGINT, app_sigint, app);
- id[n++] = dbus_log_client_add_connect_error_handler(app->client,
- client_connect_error, app);
- if (app->actions) {
- if (app->client->connected) {
- client_connected(app);
- run_loop = FALSE;
- } else {
- id[n++] = dbus_log_client_add_connected_handler(app->client,
- client_connected_cb, app);
- }
- } else {
- id[n++] = dbus_log_client_add_message_handler(app->client,
- client_message, app);
+ app->event_id[APP_EVENT_ERROR] =
+ dbus_log_client_add_connect_error_handler(app->client,
+ client_connect_error, app);
+ app->event_id[APP_EVENT_CONNECT] =
+ dbus_log_client_add_connected_handler(app->client,
+ client_connected_cb, app);
+ if (app->client->connected) {
+ client_connected(app);
+ run_loop = app->follow;
}
if (app->timeout > 0) {
@@ -362,7 +452,7 @@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libglibutil/Makefile
^
|
@@ -1,6 +1,6 @@
# -*- Mode: makefile-gmake -*-
-.PHONY: clean all debug release
+.PHONY: clean all debug release test
#
# Required packages
@@ -20,7 +20,7 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
-VERSION_RELEASE = 10
+VERSION_RELEASE = 12
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
@@ -157,12 +157,17 @@
@echo $(RELEASE_BUILD_DIR)
clean:
+ make -C test clean
+ rm -fr test/coverage/results test/coverage/*.gcov
rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~
rm -fr $(BUILD_DIR) RPMS installroot
rm -fr debian/tmp debian/libglibutil debian/libglibutil-dev
rm -f documentation.list debian/files debian/*.substvars
rm -f debian/*.debhelper.log debian/*.debhelper debian/*~
+test:
+ make -C test test
+
$(GEN_DIR):
mkdir -p $@
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libglibutil/debian/changelog
^
|
@@ -1,3 +1,18 @@
+libglibutil (1.0.12) unstable; urgency=low
+
+ * Cleaned up debian build
+ * Fixed test_idlepool against glib < 2.36
+ * Added gutil_ring_max_size and gutil_ring_set_max_size
+ * Fixed gutil_ring_flatten behavior with empty ring buffer
+
+ -- Slava Monich <slava.monich@jolla.com> Wed, 07 Sep 2016 12:43:14 +0300
+
+libglibutil (1.0.11) unstable; urgency=low
+
+ * Moved GLOG_MODULE_DECL from gutil_log.h to gutil_types.h
+
+ -- Slava Monich <slava.monich@jolla.com> Sun, 10 Jul 2016 11:46:30 +0300
+
libglibutil (1.0.10) unstable; urgency=low
* Fixed test_idlepool
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libglibutil/debian/source/format
^
|
@@ -0,0 +1 @@
+3.0 (native)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libglibutil/include/gutil_log.h
^
|
@@ -154,7 +154,6 @@
GUTIL_DEFINE_LOG_FN(gutil_log_syslog);
/* Log configuration */
-#define GLOG_MODULE_DECL(m) extern GLogModule m;
GLOG_MODULE_DECL(gutil_log_default)
typedef GUTIL_DEFINE_LOG_FN((*GLogProc));
typedef GUTIL_DEFINE_LOG_FN2((*GLogProc2));
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libglibutil/include/gutil_ring.h
^
|
@@ -77,6 +77,15 @@
GDestroyNotify free_func);
gint
+gutil_ring_max_size(
+ GUtilRing* ring);
+
+void
+gutil_ring_set_max_size(
+ GUtilRing* ring,
+ gint max_size);
+
+gint
gutil_ring_size(
GUtilRing* ring);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libglibutil/include/gutil_types.h
^
|
@@ -38,9 +38,11 @@
#include <string.h>
#include <stdio.h>
-typedef struct glog_module GLogModule;
typedef char* GStrV;
+#define GLOG_MODULE_DECL(m) extern GLogModule m;
+typedef struct glog_module GLogModule;
+
#endif /* GUTIL_TYPES_H */
/*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libglibutil/libglibutil.dsp
^
|
@@ -87,6 +87,10 @@
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
+SOURCE=.\src\gutil_idlepool.c
+# End Source File
+# Begin Source File
+
SOURCE=.\src\gutil_log.c
# End Source File
# Begin Source File
@@ -95,6 +99,10 @@
# End Source File
# Begin Source File
+SOURCE=.\src\gutil_ring.c
+# End Source File
+# Begin Source File
+
SOURCE=.\src\gutil_strv.c
# End Source File
# End Group
@@ -103,6 +111,10 @@
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
+SOURCE=.\include\gutil_idlepool.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\gutil_log.h
# End Source File
# Begin Source File
@@ -115,6 +127,10 @@
# End Source File
# Begin Source File
+SOURCE=.\include\gutil_ring.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\gutil_strv.h
# End Source File
# Begin Source File
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libglibutil/rpm/libglibutil.spec
^
|
@@ -1,5 +1,5 @@
Name: libglibutil
-Version: 1.0.10
+Version: 1.0.12
Release: 0
Summary: Library of glib utilities
Group: Development/Libraries
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libglibutil/src/gutil_ring.c
^
|
@@ -66,7 +66,7 @@
GUtilRing* r = g_slice_new0(GUtilRing);
r->ref_count = 1;
r->start = r->end = -1;
- r->maxsiz = max_size;
+ r->maxsiz = (max_size < 0) ? GUTIL_RING_UNLIMITED_SIZE : max_size;
r->free_func = free_func;
if (reserved_size) {
r->data = g_new(gpointer, reserved_size);
@@ -117,6 +117,29 @@
}
gint
+gutil_ring_max_size(
+ GUtilRing* r)
+{
+ return G_LIKELY(r) ? r->maxsiz : 0;
+}
+
+void
+gutil_ring_set_max_size(
+ GUtilRing* r,
+ gint max_size)
+{
+ /* Normalize the value */
+ if (max_size < 0) max_size = GUTIL_RING_UNLIMITED_SIZE;
+ if (G_LIKELY(r) && r->maxsiz != max_size) {
+ const gint size = gutil_ring_size(r);
+ if (max_size >= 0 && size > max_size) {
+ gutil_ring_drop(r, size - max_size);
+ }
+ r->maxsiz = max_size;
+ }
+}
+
+gint
gutil_ring_size(
GUtilRing* r)
{
@@ -382,7 +405,7 @@
{
gpointer* data = NULL;
gint n = gutil_ring_size(r);
- if (G_LIKELY(r) && n >= 0) {
+ if (G_LIKELY(r) && n > 0) {
if (r->start > 0 && r->start >= r->end) {
gpointer* buf = g_new(gpointer, n);
const gint n1 = r->alloc - r->start;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libglibutil/test/test_idlepool/test_idlepool.c
^
|
@@ -255,6 +255,12 @@
{ NULL }
};
+ /* g_type_init has been deprecated since version 2.36
+ * the type system is initialised automagically since then */
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ g_type_init();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
+
options = g_option_context_new("[TEST]");
g_option_context_add_main_entries(options, entries, NULL);
if (g_option_context_parse(options, &argc, &argv, &error)) {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/logger/src/libglibutil/test/test_ring/test_ring.c
^
|
@@ -113,6 +113,13 @@
gutil_ring_compact(r);
gutil_ring_compact(r);
+
+ gutil_ring_clear(r);
+ if (gutil_ring_flatten(r, &i) || i != 0) {
+ GDEBUG("Flattened data mismatch");
+ ret = RET_ERR;
+ }
+
gutil_ring_unref(r);
return ret;
}
@@ -393,6 +400,89 @@
}
/*==========================================================================*
+ * MaxSize
+ *==========================================================================*/
+
+int
+test_max_size()
+{
+ int i, ret = RET_OK;
+ const int n = 5;
+ GUtilRing* r = gutil_ring_sized_new(0, -2);
+
+ if (gutil_ring_max_size(NULL) != 0 ||
+ gutil_ring_max_size(r) != GUTIL_RING_UNLIMITED_SIZE) {
+ GDEBUG("Unexpected unlimited max size");
+ ret = RET_ERR;
+ }
+
+ gutil_ring_set_max_size(NULL, n); /* This one shouldn't crash */
+ gutil_ring_set_max_size(r, n);
+ for (i=0; i<n; i++) {
+ if (!gutil_ring_put(r, GINT_TO_POINTER(i))) {
+ GDEBUG("Failed to put data");
+ ret = RET_ERR;
+ }
+ }
+ if (gutil_ring_put(r, GINT_TO_POINTER(i))) {
+ GDEBUG("Put unexpectedly succeeded");
+ ret = RET_ERR;
+ }
+ if (gutil_ring_size(r) != n) {
+ GDEBUG("Unexpected ring size");
+ ret = RET_ERR;
+ }
+ gutil_ring_set_max_size(r, n);
+ if (gutil_ring_size(r) != n) {
+ GDEBUG("Unexpected ring size 2");
+ ret = RET_ERR;
+ }
+
+ gutil_ring_set_max_size(r, 2*n);
+ for (i=0; i<n; i++) {
+ if (!gutil_ring_put(r, GINT_TO_POINTER(i+n))) {
+ GDEBUG("Failed to put data 2");
+ ret = RET_ERR;
+ }
+ }
+ if (gutil_ring_put(r, GINT_TO_POINTER(i))) {
+ GDEBUG("Put unexpectedly succeeded");
+ ret = RET_ERR;
+ }
+ if (gutil_ring_size(r) != 2*n) {
+ GDEBUG("Unexpected ring size 3");
+ ret = RET_ERR;
+ }
+
+ gutil_ring_set_max_size(r, n);
+ if (gutil_ring_size(r) != n) {
+ GDEBUG("Unexpected ring size 3");
+ ret = RET_ERR;
+ }
+
+ for (i=0; i<n; i++) {
+ if (gutil_ring_get(r) != GINT_TO_POINTER(i+n)) {
+ GDEBUG("Data get mismatch");
+ ret = RET_ERR;
+ }
+ }
+
+ if (gutil_ring_size(r)) {
+ GDEBUG("Ring is not empty");
+ ret = RET_ERR;
+ }
+
+ gutil_ring_set_max_size(r, -2);
+ if (gutil_ring_max_size(r) != GUTIL_RING_UNLIMITED_SIZE) {
+ GDEBUG("Unexpected unlimited max size 2");
+ ret = RET_ERR;
+ }
+
+ gutil_ring_unref(r);
+ return ret;
+}
+
+/*==========================================================================*
* Free
*==========================================================================*/
@@ -515,6 +605,9 @@
"DropLast",
test_drop_last
},{
+ "MaxSize",
+ test_max_size
+ },{
"Limit",
test_limit
},{
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/ofono/ofono.pro
^
|
@@ -1,4 +1,20 @@
-TARGET = harbour-logger-ofono
+openrepos {
+ PREFIX = openrepos
+ DEFINES += OPENREPOS
+} else {
+ PREFIX = harbour
+}
+
+NAME = logger-ofono
+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
@@ -33,80 +49,86 @@
$$HARBOUR_LIB
OTHER_FILES += \
- icons/harbour-logger-ofono.svg \
- harbour-logger-ofono.desktop \
+ icons/harbour-$${NAME}.svg \
+ harbour-$${NAME}.desktop \
qml/*.qml \
translations/*.ts
-TARGET_DATA_DIR = /usr/share/harbour-logger-ofono
+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
-icon86.files = icons/86x86/$${TARGET}.png
-icon86.path = $${TARGET_ICON_ROOT}/86x86/apps
-INSTALLS += icon86
-
-icon108.files = icons/108x108/$${TARGET}.png
-icon108.path = $${TARGET_ICON_ROOT}/108x108/apps
-INSTALLS += icon108
-
-icon128.files = icons/128x128/$${TARGET}.png
-icon128.path = $${TARGET_ICON_ROOT}/128x128/apps
-INSTALLS += icon128
-
-icon256.files = icons/256x256/$${TARGET}.png
-icon256.path = $${TARGET_ICON_ROOT}/256x256/apps
-INSTALLS += icon256
+# 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
+}
+
+# Desktop file
+equals(PREFIX, "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
+ equals(PREFIX, "openrepos") {
+ $${icon_target}.extra = cp $${icon_dir}/harbour-$${NAME}.png $$eval($${icon_target}.files)
+ $${icon_target}.CONFIG += no_check_exist
+ }
+ INSTALLS += $${icon_target}
+}
INCLUDEPATH += \
src \
- $$LOGGER_LIB_DIR/include
+ $${LOGGER_LIB_DIR}/include
SOURCES += \
src/main.cpp
-TRANSLATIONS += \
- translations/harbour-logger-ofono.ts \
- translations/harbour-logger-ofono-ru.ts
-
# Translations
-TS_FILE = \"$${_PRO_FILE_PWD_}/translations/$${TARGET}.ts\"
-HAVE_TRANSLATIONS = 0
-
-# Translation source directories
-TRANSLATION_SOURCE_CANDIDATES = $${_PRO_FILE_PWD_}/src $${_PRO_FILE_PWD_}/qml $${LOGGER_LIB_DIR}/qml
-for(dir, TRANSLATION_SOURCE_CANDIDATES) {
- exists($$dir) {
- TRANSLATION_SOURCES += \"$$dir\"
- }
-}
-
-# prefix all TRANSLATIONS with the src dir
-# the qm files are generated from the ts files copied to out dir
-for(t, TRANSLATIONS) {
- TRANSLATIONS_IN += \"$${_PRO_FILE_PWD_}/$$t\"
- TRANSLATIONS_OUT += \"$${OUT_PWD}/$$t\"
- HAVE_TRANSLATIONS = 1
+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 \"$${OUT_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 += \"$${out}.qm\"
}
-qm.files = $$replace(TRANSLATIONS_OUT, \.ts, .qm)
-qm.path = /usr/share/$${TARGET}/translations
+qm.path = $$TRANSLATIONS_PATH
qm.CONFIG += no_check_exist
-
-# update the ts files in the src dir and then copy them to the out dir
-TRANSLATE_OBSOLETE = -noobsolete
-qm.commands += lupdate $${TRANSLATE_OBSOLETE} $${TRANSLATION_SOURCES} -ts $${TS_FILE} $$TRANSLATIONS_IN && \
- mkdir -p translations && \
- [ \"$${OUT_PWD}\" != \"$${_PRO_FILE_PWD_}\" -a $$HAVE_TRANSLATIONS -eq 1 ] && \
- cp -af $${TRANSLATIONS_IN} \"$${OUT_PWD}/translations\" || :
-
-TRANSLATE_UNFINISHED = -nounfinished
-TRANSLATE_IDBASED = -idbased
-
-# create the qm files
-qm.commands += [ $$HAVE_TRANSLATIONS -eq 1 ] && lrelease $${TRANSLATE_IDBASED} $${TRANSLATE_UNFINISHED} $${TRANSLATIONS_OUT} || :
-
INSTALLS += qm
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/ofono/translations/harbour-logger-ofono-ru.ts
^
|
@@ -95,5 +95,21 @@
<source>Please wait</source>
<translation>Секундочку</translation>
</message>
+ <message id="logger-settings-page-header">
+ <source>Logger</source>
+ <translation>Журнал ofono</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>
</context>
</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.1.tar.bz2/ofono/translations/harbour-logger-ofono.ts
^
|
@@ -95,5 +95,21 @@
<source>Please wait</source>
<translation>Please wait</translation>
</message>
+ <message id="logger-settings-page-header">
+ <source>Logger</source>
+ <translation>Ofono logger</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>
</context>
</TS>
|