[-]
[+]
|
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">6f7586c</param>
+ <param name="revision">3380a06</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/logger/logger.pro
^
|
@@ -35,7 +35,8 @@
SOURCES += \
src/LoggerBuffer.cpp \
src/LoggerCategory.cpp \
- src/LoggerCategoryListModel.cpp \
+ src/LoggerCategoryModel.cpp \
+ src/LoggerCategoryFilterModel.cpp \
src/LoggerEntry.cpp \
src/LoggerHints.cpp \
src/LoggerLogModel.cpp \
@@ -47,7 +48,8 @@
include/LoggerMain.h \
src/LoggerBuffer.h \
src/LoggerCategory.h \
- src/LoggerCategoryListModel.h \
+ src/LoggerCategoryModel.h \
+ src/LoggerCategoryFilterModel.h \
src/LoggerEntry.h \
src/LoggerHints.h \
src/LoggerLogModel.h \
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/logger/qml/pages/CategoryPage.qml
^
|
@@ -36,43 +36,69 @@
SilicaFlickable {
id: categoryPage
property var categoryModel: CategoryModel
+ property var filterModel: CategoryFilterModel
+ property string searchString
+
+ onSearchStringChanged: {
+ console.log(searchString)
+ filterModel.setFilterFixedString(searchString)
+ }
PullDownMenu {
- visible: categoryModel.connected
+ visible: canEnableDisable || canReset
+ readonly property bool canEnableDisable: filterModel.count > 0
+ readonly property bool canReset: filterModel.haveDefaults
MenuItem {
//% "Enable all"
text: qsTrId("logger-categories-pm-enable-all")
- onClicked: categoryModel.enableAll()
- visible: categoryModel.count > 0
+ onClicked: filterModel.enableAll()
+ visible: canEnableDisable
}
MenuItem {
//% "Disable all"
text: qsTrId("logger-categories-pm-disable-all")
- onClicked: categoryModel.disableAll()
- visible: categoryModel.count > 0
+ onClicked: filterModel.disableAll()
+ visible: canEnableDisable
}
MenuItem {
//% "Reset to default"
text: qsTrId("logger-categories-pm-default")
- onClicked: categoryModel.reset()
- visible: categoryModel.haveDefaults
+ onClicked: filterModel.reset()
+ visible: canReset
}
}
SilicaListView {
id: list
- model: categoryModel
+ model: filterModel
clip: true
anchors.fill: parent
-
- //% "Log categories"
- header: PageHeader { title: qsTrId("logger-categories-title") }
+ currentIndex: -1 // to keep focus
+ header: Column {
+ width: parent.width
+ //% "Log categories"
+ PageHeader { title: qsTrId("logger-categories-title") }
+ SearchField {
+ id: searchField
+ width: parent.width
+ //: Placeholder text for the search field
+ //% "Select categories"
+ placeholderText: qsTrId("logger-categories-select-placeholder")
+ autoScrollEnabled: false
+ focus: parent.focus
+ focusOutBehavior: FocusBehavior.KeepFocus
+ inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase
+ EnterKey.iconSource: "image://theme/icon-m-enter-close"
+ EnterKey.onClicked: categoryPage.focus = true
+ onTextChanged: searchString = text.toLowerCase().trim()
+ }
+ }
delegate: Item {
width: parent.width
height: checkBox.height
TextSwitch {
id: checkBox
- text: categoryName
+ text: Theme.highlightText(categoryName, searchString, Theme.highlightColor)
checked: categoryEnabled
automaticCheck: false
onClicked: {
@@ -90,7 +116,8 @@
}
}
}
-
+ // Hide the keyboard on flick
+ onFlickStarted: categoryPage.focus = true
VerticalScrollDecorator {}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/logger/src/LoggerCategory.cpp
^
|
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 Jolla Ltd.
+ * Copyright (C) 2016-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
@@ -79,7 +79,7 @@
}
LoggerCategory::LoggerCategory(DBusLogCategory* aCategory) :
- iPrivate(new Private(aCategory))
+ iPrivate(aCategory ? new Private(aCategory) : NULL)
{
}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/logger/src/LoggerCategoryFilterModel.cpp
^
|
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2017 Jolla Ltd.
+ * Contact: Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Jolla Ltd nor the names of its contributors may
+ * be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "LoggerCategoryFilterModel.h"
+#include "LoggerCategoryModel.h"
+#include "HarbourDebug.h"
+
+LoggerCategoryFilterModel::LoggerCategoryFilterModel(LoggerCategoryModel* aSource) :
+ QSortFilterProxyModel(aSource),
+ iHaveDefaults(aSource->haveDefaults())
+{
+ setSourceModel(aSource);
+ setDynamicSortFilter(true);
+ setFilterCaseSensitivity(Qt::CaseInsensitive);
+ setFilterRole(LoggerCategoryModel::NameRole);
+
+ connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(countChanged()));
+ connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), SIGNAL(countChanged()));
+ connect(this, SIGNAL(modelReset()), SIGNAL(countChanged()));
+
+ connect(this, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)), SLOT(updateHaveDefaults()));
+ connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(updateHaveDefaults()));
+ connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(updateHaveDefaults()));
+ connect(this, SIGNAL(modelReset()), SLOT(updateHaveDefaults()));
+}
+
+int LoggerCategoryFilterModel::count() const
+{
+ return rowCount();
+}
+
+int LoggerCategoryFilterModel::sourceRow(int aProxyRow) const
+{
+ QModelIndex proxyIndex = index(aProxyRow, 0);
+ QModelIndex sourceIndex = mapToSource(proxyIndex);
+ return sourceIndex.isValid() ? sourceIndex.row() : -1;
+}
+
+QList<LoggerCategory> LoggerCategoryFilterModel::selectedCategories() const
+{
+ QList<LoggerCategory> list;
+ const LoggerCategoryModel* fullModel = categoryModel();
+ if (fullModel) {
+ const int n = rowCount();
+ list.reserve(n);
+ for (int i=0; i<n; i++) {
+ LoggerCategory cat = fullModel->loggerCategoryAt(sourceRow(i));
+ if (cat.isValid()) {
+ list.append(cat);
+ }
+ }
+ }
+ return list;
+}
+
+void LoggerCategoryFilterModel::reset()
+{
+ LoggerCategoryModel* fullModel = categoryModel();
+ if (fullModel) {
+ if (fullModel->count() == count()) {
+ // This is more efficient
+ fullModel->reset();
+ } else {
+ HDEBUG("resetting all selected categories");
+ fullModel->resetCategories(selectedCategories());
+ }
+ }
+}
+
+void LoggerCategoryFilterModel::enableAll()
+{
+ LoggerCategoryModel* fullModel = categoryModel();
+ if (fullModel) {
+ if (fullModel->count() == count()) {
+ // This is more efficient
+ fullModel->enableAll();
+ } else {
+ HDEBUG("enabling all selected categories");
+ fullModel->enableCategories(selectedCategories());
+ }
+ }
+}
+
+void LoggerCategoryFilterModel::disableAll()
+{
+ LoggerCategoryModel* fullModel = categoryModel();
+ if (fullModel) {
+ if (fullModel->count() == count()) {
+ // This is more efficient
+ fullModel->disableAll();
+ } else {
+ HDEBUG("disabling all selected categories");
+ fullModel->disableCategories(selectedCategories());
+ }
+ }
+}
+
+void LoggerCategoryFilterModel::updateHaveDefaults()
+{
+ bool haveDefaults = false;
+ LoggerCategoryModel* fullModel = categoryModel();
+ if (fullModel && fullModel->isConnected()) {
+ const int n = rowCount();
+ if (fullModel->count() == n) {
+ // Same as the source model
+ haveDefaults = fullModel->haveDefaults();
+ } else {
+ for (int i=0; i<n; i++) {
+ LoggerCategory cat = fullModel->loggerCategoryAt(sourceRow(i));
+ if (cat.enabledByDefault()) {
+ haveDefaults = true;
+ break;
+ }
+ }
+ }
+ }
+ if (iHaveDefaults != haveDefaults) {
+ iHaveDefaults = haveDefaults;
+ Q_EMIT haveDefaultsChanged();
+ }
+}
+
+const LoggerCategoryModel* LoggerCategoryFilterModel::categoryModel() const
+{
+ return qobject_cast<LoggerCategoryModel*>(parent());
+}
+
+
+LoggerCategoryModel* LoggerCategoryFilterModel::categoryModel()
+{
+ return qobject_cast<LoggerCategoryModel*>(parent());
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/logger/src/LoggerCategoryFilterModel.h
^
|
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2017 Jolla Ltd.
+ * Contact: Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Jolla Ltd nor the names of its contributors may
+ * be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LOGGER_CATEGORY_FILTER_MODEL_H
+#define LOGGER_CATEGORY_FILTER_MODEL_H
+
+#include "LoggerCategory.h"
+
+#include <QList>
+#include <QSortFilterProxyModel>
+
+class LoggerCategoryModel;
+class LoggerCategoryFilterModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(bool haveDefaults READ haveDefaults NOTIFY haveDefaultsChanged)
+
+public:
+ LoggerCategoryFilterModel(LoggerCategoryModel* aSourceModel);
+
+ int count() const;
+ bool haveDefaults() const;
+
+ Q_INVOKABLE void reset();
+ Q_INVOKABLE void enableAll();
+ Q_INVOKABLE void disableAll();
+
+Q_SIGNALS:
+ void countChanged();
+ void haveDefaultsChanged();
+
+private:
+ LoggerCategoryModel* categoryModel();
+ const LoggerCategoryModel* categoryModel() const;
+ QList<LoggerCategory> selectedCategories() const;
+ int sourceRow(int aRow) const;
+
+private Q_SLOTS:
+ void updateHaveDefaults();
+
+private:
+ bool iHaveDefaults;
+};
+
+inline bool LoggerCategoryFilterModel::haveDefaults() const
+ { return iHaveDefaults; }
+
+#endif // LOGGER_CATEGORY_FILTER_MODEL_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/logger/src/LoggerCategoryModel.cpp
^
|
@@ -0,0 +1,367 @@
+/*
+ * Copyright (C) 2016-2017 Jolla Ltd.
+ * Contact: Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Jolla Ltd nor the names of its contributors may
+ * be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "LoggerCategoryModel.h"
+#include "LoggerSettings.h"
+#include "HarbourDebug.h"
+
+#include "gutil_strv.h"
+
+#undef signals
+#include "dbuslog_client.h"
+
+#define SUPER QAbstractListModel
+
+LoggerCategoryModel::LoggerCategoryModel(LoggerSettings* aSettings,
+ DBusLogClient* aClient, QObject* aParent) : SUPER(aParent),
+ iSettings(aSettings),
+ iClient(dbus_log_client_ref(aClient)),
+ iHaveDefaults(false)
+{
+ memset(iClientSignals, 0, sizeof(iClientSignals));
+ iClientSignals[DBusLogClientSignalConnected] =
+ dbus_log_client_add_connected_handler(iClient,
+ connectedProc, this);
+ iClientSignals[DBusLogClientSignalCategoryAdded] =
+ dbus_log_client_add_category_added_handler(iClient,
+ categoryAddedProc, this);
+ iClientSignals[DBusLogClientSignalCategoryRemoved] =
+ dbus_log_client_add_category_removed_handler(iClient,
+ categoryRemovedProc, this);
+ iClientSignals[DBusLogClientSignalCategoryFlags] =
+ dbus_log_client_add_category_flags_handler(iClient,
+ categoryFlagsProc, this);
+ handleConnected();
+}
+
+LoggerCategoryModel::~LoggerCategoryModel()
+{
+ dbus_log_client_remove_handlers(iClient, iClientSignals, G_N_ELEMENTS(iClientSignals));
+ dbus_log_client_unref(iClient);
+}
+
+int LoggerCategoryModel::count() const
+{
+ return iClient->connected ? iClient->categories->len : 0;
+}
+
+bool LoggerCategoryModel::isConnected() const
+{
+ return iClient->connected != FALSE;
+}
+
+DBusLogCategory* LoggerCategoryModel::categoryAt(int aRow) const
+{
+ const int count = iClient->categories->len;
+ if (aRow >= 0 && aRow < count) {
+ return (DBusLogCategory*)g_ptr_array_index(iClient->categories, aRow);
+ } else {
+ return NULL;
+ }
+}
+
+QHash<int,QByteArray> LoggerCategoryModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[NameRole] = "categoryName";
+ roles[EnabledRole] = "categoryEnabled";
+ roles[EnabledByDefaultRole] = "categoryEnabledByDefault";
+ roles[IdRole] = "categoryId";
+ return roles;
+}
+
+int LoggerCategoryModel::rowCount(const QModelIndex& aParent) const
+{
+ return count();
+}
+
+QVariant LoggerCategoryModel::data(const QModelIndex& aIndex, int aRole) const
+{
+ QVariant value;
+ LoggerCategory cat(loggerCategoryAt(aIndex.row()));
+ if (cat.isValid()) {
+ switch (aRole) {
+ case NameRole:
+ value = cat.name();
+ break;
+ case EnabledRole:
+ value = cat.enabled();
+ break;
+ case EnabledByDefaultRole:
+ value = cat.enabledByDefault();
+ break;
+ case IdRole:
+ value = cat.id();
+ break;
+ default:
+ break;
+ }
+ }
+ return value;
+}
+
+void LoggerCategoryModel::enable(uint aId)
+{
+ LoggerCategory category(iCategories.value(aId));
+ HASSERT(category.isValid());
+ if (category.isValid() && !category.enabled()) {
+ HDEBUG(category.cname());
+ dbus_log_client_enable_category(iClient, category.cname(), NULL, NULL);
+ }
+}
+
+void LoggerCategoryModel::disable(uint aId)
+{
+ LoggerCategory category(iCategories.value(aId));
+ HASSERT(category.isValid());
+ if (category.isValid() && category.enabled()) {
+ HDEBUG(category.cname());
+ dbus_log_client_disable_category(iClient, category.cname(), NULL, NULL);
+ }
+}
+
+void LoggerCategoryModel::enableAll()
+{
+ HDEBUG("enabling all categories");
+ dbus_log_client_enable_pattern(iClient, "*", NULL, NULL);
+}
+
+void LoggerCategoryModel::disableAll()
+{
+ HDEBUG("disabling all categories");
+ dbus_log_client_disable_pattern(iClient, "*", NULL, NULL);
+}
+
+void LoggerCategoryModel::resetCategories(QList<LoggerCategory> aCategories)
+{
+ GStrV* enable = NULL;
+ GStrV* disable = NULL;
+ const guint n = aCategories.count();
+ for (guint i = 0; i < n; i++) {
+ LoggerCategory cat = aCategories.at(i);
+ if (cat.enabledByDefault()) {
+ if (!cat.enabled()) {
+ HDEBUG("enable" << cat.cname());
+ enable = gutil_strv_add(enable, cat.cname());
+ }
+ } else {
+ if (cat.enabled()) {
+ HDEBUG("disable" << cat.cname());
+ disable = gutil_strv_add(disable, cat.cname());
+ }
+ }
+ }
+ if (enable) {
+ dbus_log_client_enable_categories(iClient, enable, NULL, NULL);
+ g_strfreev(enable);
+ }
+ if (disable) {
+ dbus_log_client_disable_categories(iClient, disable, NULL, NULL);
+ g_strfreev(disable);
+ }
+}
+
+void LoggerCategoryModel::enableCategories(QList<LoggerCategory> aCategories)
+{
+ GStrV* enable = NULL;
+ const guint n = aCategories.count();
+ for (guint i = 0; i < n; i++) {
+ LoggerCategory cat = aCategories.at(i);
+ if (cat.isValid() && !cat.enabled()) {
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/logger/src/LoggerCategoryModel.h
^
|
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2016-2017 Jolla Ltd.
+ * Contact: Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Jolla Ltd nor the names of its contributors may
+ * be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LOGGER_CATEGORY_MODEL_H
+#define LOGGER_CATEGORY_MODEL_H
+
+#include "LoggerCategory.h"
+#include "LoggerBuffer.h"
+
+#include "dbuslog_client_types.h"
+
+#include <QAbstractListModel>
+
+class LoggerSettings;
+class LoggerCategoryModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+ Q_PROPERTY(bool connected READ isConnected NOTIFY connectedChanged)
+ Q_PROPERTY(bool haveDefaults READ haveDefaults NOTIFY haveDefaultsChanged)
+
+public:
+ enum Role {
+ NameRole = Qt::UserRole + 1,
+ EnabledRole,
+ EnabledByDefaultRole,
+ IdRole
+ };
+
+ LoggerCategoryModel(LoggerSettings* aSettings, DBusLogClient* aClient,
+ QObject* aParent);
+ ~LoggerCategoryModel();
+
+ virtual QHash<int,QByteArray> roleNames() const;
+ virtual int rowCount(const QModelIndex& aParent) const;
+ virtual QVariant data(const QModelIndex& aIndex, int aRole) const;
+
+ int count() const;
+ bool isConnected() const;
+ bool haveDefaults() const;
+
+ LoggerCategory loggerCategoryAt(int aRow) const;
+ void resetCategories(QList<LoggerCategory> aCategories);
+ void enableCategories(QList<LoggerCategory> aCategories);
+ void disableCategories(QList<LoggerCategory> aCategories);
+
+ Q_INVOKABLE void reset();
+ Q_INVOKABLE void enable(uint id);
+ Q_INVOKABLE void disable(uint id);
+ Q_INVOKABLE void enableAll();
+ Q_INVOKABLE void disableAll();
+
+Q_SIGNALS:
+ void countChanged();
+ void connectedChanged();
+ void haveDefaultsChanged();
+
+private Q_SLOTS:
+ void handleConnected();
+ void handleCategoryAdded(DBusLogCategory* aCategory, uint aIndex);
+ void handleCategoryRemoved(DBusLogCategory* aCategory, uint aIndex);
+ void handleCategoryFlags(DBusLogCategory* aCategory, uint aIndex);
+
+private:
+ static void connectedProc(DBusLogClient* aClient, gpointer aData);
+ static void categoryAddedProc(DBusLogClient* aClient,
+ DBusLogCategory* aCategory, guint aIndex, gpointer aData);
+ static void categoryRemovedProc(DBusLogClient* aClient,
+ DBusLogCategory* aCategory, guint aIndex, gpointer aData);
+ static void categoryFlagsProc(DBusLogClient* aClient,
+ DBusLogCategory* aCategory, guint aIndex, gpointer aData);
+
+ void updateHaveDefaults();
+ DBusLogCategory* categoryAt(int aRow) const;
+
+private:
+ enum DBusLogClientSignals {
+ DBusLogClientSignalConnected,
+ DBusLogClientSignalCategoryAdded,
+ DBusLogClientSignalCategoryRemoved,
+ DBusLogClientSignalCategoryFlags,
+ DBusLogClientSignalCount
+ };
+
+ LoggerSettings* iSettings;
+ DBusLogClient* iClient;
+ gulong iClientSignals[DBusLogClientSignalCount];
+ QHash<guint32,LoggerCategory> iCategories;
+ bool iHaveDefaults;
+};
+
+inline LoggerCategory LoggerCategoryModel::loggerCategoryAt(int aRow) const
+ { return LoggerCategory(categoryAt(aRow)); }
+inline bool LoggerCategoryModel::haveDefaults() const
+ { return iHaveDefaults; }
+
+#endif // LOGGER_CATEGORY_MODEL_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/logger/src/LoggerMain.cpp
^
|
@@ -35,7 +35,8 @@
#include "LoggerLogModel.h"
#include "LoggerLogSaver.h"
#include "LoggerSettings.h"
-#include "LoggerCategoryListModel.h"
+#include "LoggerCategoryModel.h"
+#include "LoggerCategoryFilterModel.h"
#include "HarbourDebug.h"
#include "HarbourSigChildHandler.h"
@@ -182,7 +183,8 @@
// Models and stuff
LoggerSettings* logSettings = new LoggerSettings(iFullAppName, iApp);
LoggerLogModel* logModel = new LoggerLogModel(logSettings, iClient, iApp);
- LoggerCategoryListModel* categoryModel = new LoggerCategoryListModel(logSettings, iClient, iApp);
+ LoggerCategoryModel* categoryModel = new LoggerCategoryModel(logSettings, iClient, iApp);
+ LoggerCategoryFilterModel* filterModel = new LoggerCategoryFilterModel(categoryModel);
LoggerLogSaver* logSaver = new LoggerLogSaver(iPackage, iApp);
logSaver->connect(logModel, SIGNAL(entryAdded(LoggerEntry)), SLOT(addEntry(LoggerEntry)));
logSaver->connect(sigChild, SIGNAL(processDied(int,int)), SLOT(onProcessDied(int,int)));
@@ -197,6 +199,7 @@
context->setContextProperty("LogModel", logModel);
context->setContextProperty("LogSaver", logSaver);
context->setContextProperty("CategoryModel", categoryModel);
+ context->setContextProperty("CategoryFilterModel", filterModel);
context->setContextProperty("AppName", iFullAppName);
setupView(view);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/ofono/ofono.pro
^
|
@@ -36,7 +36,7 @@
HARBOUR_LIB_DIR = $$_PRO_FILE_PWD_/../harbour-lib
LOGGER_LIB_DIR = $$_PRO_FILE_PWD_/../logger
QOFONOEXT_LIB_DIR = $$_PRO_FILE_PWD_/src/libqofonoext
-QCONNMAN_LIB_DIR = $$_PRO_FILE_PWD_/..//libconnman-qt
+QCONNMAN_LIB_DIR = $$_PRO_FILE_PWD_/../libconnman-qt
# Libraries
HARBOUR_LIB = $$OUT_PWD/../harbour-lib/libharbour-lib.a
@@ -125,7 +125,7 @@
$${LOGGER_LIB_DIR}/qml \
$${LOGGER_LIB_DIR}/settings
-TRANSLATION_FILES = $${NAME} $${NAME}-ru $${NAME}-sv
+TRANSLATION_FILES = $${NAME} $${NAME}-pl $${NAME}-ru $${NAME}-sv
for(t, TRANSLATION_FILES) {
suffix = $$replace(t,-,_)
|
[-]
[+]
|
Added |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/ofono/translations/harbour-logger-ofono-pl.ts
^
|
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1">
+<context>
+ <name></name>
+ <message id="logger-cover-title">
+ <source>Log</source>
+ <translation>ofono</translation>
+ </message>
+ <message id="logger-mainpage-swipe-left-hint">
+ <source>Swipe left to configure log categories</source>
+ <translation>Przesuń w lewo aby skonfigurować kategorie logów</translation>
+ </message>
+ <message id="ofono-logger-pm-fix-mobile-data">
+ <source>Fix mobile data</source>
+ <extracomment>Pull-down menu item</extracomment>
+ <translation>Napraw dane mobilne</translation>
+ </message>
+ <message id="ofono-logger-pm-enable-mobile-data">
+ <source>Enable mobile data</source>
+ <extracomment>Pull-down menu item</extracomment>
+ <translation>Włącz dane mobilne</translation>
+ </message>
+ <message id="logger-logpage-pm-clear-log">
+ <source>Clear log</source>
+ <translation>Wyczyść logi</translation>
+ </message>
+ <message id="logger-logpage-pm-pack-and-send">
+ <source>Pack and send</source>
+ <translation>Spakuj i wyślij</translation>
+ </message>
+ <message id="logger-logpage-title">
+ <source>Log</source>
+ <translation>Logi Ofono</translation>
+ </message>
+ <message id="logger-logpage-msg-connected">
+ <source>Connected.</source>
+ <translation>Połączono z Ofono</translation>
+ </message>
+ <message id="logger-logpage-msg-connect-error">
+ <source>We are having trouble connecting to the service.</source>
+ <translation>Mamy problemy z połączenie z usługami. Możliwe, że ta wersja Ofono nie wspiera zbierania logów.</translation>
+ </message>
+ <message id="logger-logpage-msg-disconnected">
+ <source>Connection lost.</source>
+ <translation>Połączenie z Ofono utracone</translation>
+ </message>
+ <message id="logger-logpage-msg-log-cleared">
+ <source>Log cleared</source>
+ <translation>Logi wyczyszczone</translation>
+ </message>
+ <message id="logger-categories-title">
+ <source>Log categories</source>
+ <translation>Kategorie logów</translation>
+ </message>
+ <message id="logger-categories-pm-enable-all">
+ <source>Enable all</source>
+ <translation>Włącz wszystko</translation>
+ </message>
+ <message id="logger-categories-pm-disable-all">
+ <source>Disable all</source>
+ <translation>Wyłącz wszystko</translation>
+ </message>
+ <message id="logger-categories-pm-default">
+ <source>Reset to default</source>
+ <translation>Przywróć do wartości fabrycznych</translation>
+ </message>
+ <message id="logger-categories-select-placeholder">
+ <source>Select categories</source>
+ <extracomment>Placeholder text for the search field</extracomment>
+ <translation type="unfinished">Wybierz kategorie</translation>
+ </message>
+ <message id="logger-categories-not-connected">
+ <source>Not connected</source>
+ <translation>Niepołączony z Ofono</translation>
+ </message>
+ <message id="logger-sharemethodlist-add-account">
+ <source>Add account</source>
+ <translation>Dodaj konto</translation>
+ </message>
+ <message id="logger-sharepage-save-ok">
+ <source>Saved %1</source>
+ <translation>Zapisano %1</translation>
+ </message>
+ <message id="logger-sharepage-save-error">
+ <source>Failed to save %1</source>
+ <translation>Błąd zapisu %1</translation>
+ </message>
+ <message id="logger-sharepage-pm-save-to-documents">
+ <source>Save to documents</source>
+ <translation>Zapisane do dokumentów</translation>
+ </message>
+ <message id="logger-sharepage-header">
+ <source>Pack and send</source>
+ <translation>Spakuj i wyślij</translation>
+ </message>
+ <message id="logger-sharepage-default-subject">
+ <source>Log</source>
+ <extracomment>Default email subject</extracomment>
+ <translation>Logi Ofono</translation>
+ </message>
+ <message id="logger-sharepage-default-email">
+ <source></source>
+ <extracomment>Default email recipient</extracomment>
+ <translation>ofono-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>Miej na uwadze, że część informacji zawartych w tym archiwum może być prywatna. Jeśli chcesz sprawdzić co wysyłasz, proszę rozważ wysłanie logów, w pierwszej kolejności, do siebie i sprawdzź ich zawartość. </translation>
+ </message>
+ <message id="logger-sharepage-please-wait">
+ <source>Please wait</source>
+ <translation>Proszę czekać</translation>
+ </message>
+ <message id="logger-settings-page-header">
+ <source>Logger</source>
+ <extracomment>Page header</extracomment>
+ <translation>Logger</translation>
+ </message>
+ <message id="logger-settings-section-header-display">
+ <source>Display</source>
+ <extracomment>Section header</extracomment>
+ <translation>Wyświetl</translation>
+ </message>
+ <message id="logger-settings-logsizelimit">
+ <source>Screen buffer size</source>
+ <translation>Rozmiar bufora ekranu</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>Nie martw się, wszystko zostanie zapisane do pliku logów, bez względu na rozmiar buforu ekranu.</translation>
+ </message>
+ <message id="logger-settings-logsizelimit-unlimited">
+ <source>Unlimited</source>
+ <translation>Nieograniczone</translation>
+ </message>
+ <message id="logger-settings-fontsize-label">
+ <source>Font size</source>
+ <translation>Rozmiar czcionki</translation>
+ </message>
+ <message id="logger-settings-section-header-logging">
+ <source>Logging</source>
+ <extracomment>Section header</extracomment>
+ <translation>Zbieranie logów</translation>
+ </message>
+ <message id="logger-settings-autoenable_logging-switch-label">
+ <source>Automatically enable logging</source>
+ <extracomment>Text switch label</extracomment>
+ <translation>Automatycznie włącz logowanie</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>Włącz wszystkie kategorie logowania podczas startu aplikacji.</translation>
+ </message>
+ <message id="logger-settings-autoreset_logging-switch-label">
+ <source>Automatically reset logging on exit</source>
+ <extracomment>Text switch label</extracomment>
+ <translation>Automatycznie zresetuj logi na wyjściu</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>Zresetuj wszystkie kategorie logowania do wartości domyślnych podczas opuszczania aplikacji. W innym przypadku logowanie będzie kontynuowane w tle, zużywając zasoby i rozładowując baterię.</translation>
+ </message>
+</context>
+</TS>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/ofono/translations/harbour-logger-ofono-ru.ts
^
|
@@ -55,16 +55,21 @@
</message>
<message id="logger-categories-pm-enable-all">
<source>Enable all</source>
- <translation>Включить всё</translation>
+ <translation>Включить все</translation>
</message>
<message id="logger-categories-pm-disable-all">
<source>Disable all</source>
- <translation>Выключить всё</translation>
+ <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>ofono не отвечает</translation>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/ofono/translations/harbour-logger-ofono-sv.ts
^
|
@@ -65,6 +65,11 @@
<source>Reset to default</source>
<translation>Återställ standard</translation>
</message>
+ <message id="logger-categories-select-placeholder">
+ <source>Select categories</source>
+ <extracomment>Placeholder text for the search field</extracomment>
+ <translation type="unfinished">Välj kategorier</translation>
+ </message>
<message id="logger-categories-not-connected">
<source>Not connected</source>
<translation>Ej ansluten</translation>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-logger-ofono-1.0.10.tar.bz2/ofono/translations/harbour-logger-ofono.ts
^
|
@@ -65,6 +65,11 @@
<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 ofono</translation>
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-logger-ofono-1.0.9.tar.bz2/logger/src/LoggerCategoryListModel.cpp
^
|
@@ -1,297 +0,0 @@
-/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
- *
- * You may use this file under the terms of BSD license as follows:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "LoggerCategoryListModel.h"
-#include "LoggerSettings.h"
-#include "HarbourDebug.h"
-
-#include "gutil_strv.h"
-
-#undef signals
-#include "dbuslog_client.h"
-
-#define SUPER QAbstractListModel
-
-LoggerCategoryListModel::LoggerCategoryListModel(LoggerSettings* aSettings,
- DBusLogClient* aClient, QObject* aParent) : SUPER(aParent),
- iSettings(aSettings),
- iClient(dbus_log_client_ref(aClient)),
- iHaveDefaults(false)
-{
- memset(iClientSignals, 0, sizeof(iClientSignals));
- iClientSignals[DBusLogClientSignalConnected] =
- dbus_log_client_add_connected_handler(iClient,
- connectedProc, this);
- iClientSignals[DBusLogClientSignalCategoryAdded] =
- dbus_log_client_add_category_added_handler(iClient,
- categoryAddedProc, this);
- iClientSignals[DBusLogClientSignalCategoryRemoved] =
- dbus_log_client_add_category_removed_handler(iClient,
- categoryRemovedProc, this);
- iClientSignals[DBusLogClientSignalCategoryFlags] =
- dbus_log_client_add_category_flags_handler(iClient,
- categoryFlagsProc, this);
- handleConnected();
-}
-
-LoggerCategoryListModel::~LoggerCategoryListModel()
-{
- dbus_log_client_remove_handlers(iClient, iClientSignals, G_N_ELEMENTS(iClientSignals));
- dbus_log_client_unref(iClient);
-}
-
-int LoggerCategoryListModel::count() const
-{
- return iClient->connected ? iClient->categories->len : 0;
-}
-
-bool LoggerCategoryListModel::isConnected() const
-{
- return iClient->connected != FALSE;
-}
-
-QHash<int,QByteArray> LoggerCategoryListModel::roleNames() const
-{
- QHash<int, QByteArray> roles;
- roles[NameRole] = "categoryName";
- roles[EnabledRole] = "categoryEnabled";
- roles[EnabledByDefaultRole] = "categoryEnabledByDefault";
- roles[IdRole] = "categoryId";
- return roles;
-}
-
-int LoggerCategoryListModel::rowCount(const QModelIndex& aParent) const
-{
- return count();
-}
-
-QVariant LoggerCategoryListModel::data(const QModelIndex& aIndex, int aRole) const
-{
- QVariant value;
- const int row = aIndex.row();
- const int count = iClient->categories->len;
- if (row >= 0 && row < count) {
- const DBusLogCategory* cat = (DBusLogCategory*)g_ptr_array_index(iClient->categories, row);
- LoggerCategory logcat(iCategories.value(cat->id));
- switch (aRole) {
- case NameRole:
- value = logcat.name();
- break;
- case EnabledRole:
- value = logcat.enabled();
- break;
- case EnabledByDefaultRole:
- value = logcat.enabledByDefault();
- break;
- case IdRole:
- value = logcat.id();
- break;
- default:
- break;
- }
- }
- return value;
-}
-
-void LoggerCategoryListModel::enable(uint aId)
-{
- LoggerCategory category(iCategories.value(aId));
- HASSERT(category.isValid());
- if (category.isValid() && !category.enabled()) {
- HDEBUG(category.cname());
- dbus_log_client_enable_category(iClient, category.cname(), NULL, NULL);
- }
-}
-
-void LoggerCategoryListModel::disable(uint aId)
-{
- LoggerCategory category(iCategories.value(aId));
- HASSERT(category.isValid());
- if (category.isValid() && category.enabled()) {
- HDEBUG(category.cname());
- dbus_log_client_disable_category(iClient, category.cname(), NULL, NULL);
- }
-}
-
-void LoggerCategoryListModel::enableAll()
-{
- HDEBUG("enabling all categories");
- dbus_log_client_enable_pattern(iClient, "*", NULL, NULL);
-}
-
-void LoggerCategoryListModel::disableAll()
-{
- HDEBUG("disabling all categories");
- dbus_log_client_disable_pattern(iClient, "*", NULL, NULL);
-}
-
-void LoggerCategoryListModel::reset()
-{
- GStrV* enable = NULL;
- GStrV* disable = NULL;
- for (guint i = 0; i < iClient->categories->len; i++) {
- DBusLogCategory* cat = (DBusLogCategory*)g_ptr_array_index(iClient->categories, i);
- if (cat->flags & DBUSLOG_CATEGORY_FLAG_ENABLED_BY_DEFAULT) {
- if (!(cat->flags & DBUSLOG_CATEGORY_FLAG_ENABLED)) {
- HDEBUG("enable" << cat->name);
- enable = gutil_strv_add(enable, cat->name);
- }
- } else {
- if (cat->flags & DBUSLOG_CATEGORY_FLAG_ENABLED) {
- HDEBUG("disable" << cat->name);
- disable = gutil_strv_add(disable, cat->name);
- }
- }
- }
- if (enable) {
- dbus_log_client_enable_categories(iClient, enable, NULL, NULL);
- g_strfreev(enable);
- }
- if (disable) {
- dbus_log_client_disable_categories(iClient, disable, NULL, NULL);
- g_strfreev(disable);
- }
-}
-
-void LoggerCategoryListModel::updateDefaults()
-{
- bool haveDefaults = false;
- if (iClient->connected) {
- for (guint i = 0; i < iClient->categories->len; i++) {
- DBusLogCategory* cat = (DBusLogCategory*)g_ptr_array_index(iClient->categories, i);
- if (cat->flags & DBUSLOG_CATEGORY_FLAG_ENABLED_BY_DEFAULT) {
- haveDefaults = true;
- break;
- }
- }
- }
- if (iHaveDefaults != haveDefaults) {
- iHaveDefaults = haveDefaults;
- Q_EMIT haveDefaultsChanged();
|
[-]
[+]
|
Deleted |
_service:tar_git:harbour-logger-ofono-1.0.9.tar.bz2/logger/src/LoggerCategoryListModel.h
^
|
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2016-2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
- *
- * You may use this file under the terms of BSD license as follows:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LOGGER_CATEGORY_LIST_MODEL_H
-#define LOGGER_CATEGORY_LIST_MODEL_H
-
-#include "LoggerCategory.h"
-#include "LoggerBuffer.h"
-
-#include "dbuslog_client_types.h"
-
-#include <QAbstractListModel>
-
-class LoggerSettings;
-class LoggerCategoryListModel : public QAbstractListModel
-{
- Q_OBJECT
- Q_PROPERTY(int count READ count NOTIFY countChanged)
- Q_PROPERTY(bool connected READ isConnected NOTIFY connectedChanged)
- Q_PROPERTY(bool haveDefaults READ haveDefaults NOTIFY haveDefaultsChanged)
-
-public:
- enum Role {
- NameRole = Qt::UserRole + 1,
- EnabledRole,
- EnabledByDefaultRole,
- IdRole
- };
-
- LoggerCategoryListModel(LoggerSettings* aSettings, DBusLogClient* aClient,
- QObject* aParent);
- ~LoggerCategoryListModel();
-
- virtual QHash<int,QByteArray> roleNames() const;
- virtual int rowCount(const QModelIndex& aParent) const;
- virtual QVariant data(const QModelIndex& aIndex, int aRole) const;
-
- int count() const;
- bool isConnected() const;
- bool haveDefaults() const;
-
- Q_INVOKABLE void reset();
- Q_INVOKABLE void enable(uint id);
- Q_INVOKABLE void disable(uint id);
- Q_INVOKABLE void enableAll();
- Q_INVOKABLE void disableAll();
-
-Q_SIGNALS:
- void countChanged();
- void connectedChanged();
- void haveDefaultsChanged();
-
-private Q_SLOTS:
- void handleConnected();
- void handleCategoryAdded(DBusLogCategory* aCategory, uint aIndex);
- void handleCategoryRemoved(DBusLogCategory* aCategory, uint aIndex);
- void handleCategoryFlags(DBusLogCategory* aCategory, uint aIndex);
-
-private:
- static void connectedProc(DBusLogClient* aClient, gpointer aData);
- static void categoryAddedProc(DBusLogClient* aClient,
- DBusLogCategory* aCategory, guint aIndex, gpointer aData);
- static void categoryRemovedProc(DBusLogClient* aClient,
- DBusLogCategory* aCategory, guint aIndex, gpointer aData);
- static void categoryFlagsProc(DBusLogClient* aClient,
- DBusLogCategory* aCategory, guint aIndex, gpointer aData);
-
- void updateDefaults();
-
-private:
- enum DBusLogClientSignals {
- DBusLogClientSignalConnected,
- DBusLogClientSignalCategoryAdded,
- DBusLogClientSignalCategoryRemoved,
- DBusLogClientSignalCategoryFlags,
- DBusLogClientSignalCount
- };
-
- LoggerSettings* iSettings;
- DBusLogClient* iClient;
- gulong iClientSignals[DBusLogClientSignalCount];
- QHash<guint32,LoggerCategory> iCategories;
- bool iHaveDefaults;
-};
-
-inline bool LoggerCategoryListModel::haveDefaults() const
- { return iHaveDefaults; }
-
-#endif // LOGGER_CATEGORY_LIST_MODEL_H
|