From df7955d5d6c1db94560bc22dd19fb8f4a9825f3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sawicz?= Date: Mon, 14 Dec 2015 17:36:13 +0100 Subject: Sync gcc 5.1 rebuild --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index b6bdb59..6729df8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +qmenumodel (0.2.9+15.04.20150430-0ubuntu2~gcc5.1) wily; urgency=medium + + * No-change test rebuild for g++5 ABI transition + + -- Steve Langasek Wed, 15 Jul 2015 15:58:40 +0000 + qmenumodel (0.2.9+15.04.20150430-0ubuntu1) vivid; urgency=medium [ Michael Terry ] -- cgit v1.2.3 From 2291decf1d2a2a6cb88f600c3371bcecda0e51c7 Mon Sep 17 00:00:00 2001 From: Nick Dedekind Date: Fri, 19 Feb 2016 11:06:04 +0000 Subject: use logging categories --- libqmenumodel/src/unitymenumodel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index 63d5e5b..67fe95d 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -22,6 +22,7 @@ #include "unitymenumodelevents.h" #include "unitymenuaction.h" #include "unitymenuactionevents.h" +#include "logging.h" #include #include @@ -33,6 +34,8 @@ extern "C" { #include "gtk/gtksimpleactionobserver.h" } +Q_LOGGING_CATEGORY(unitymenumodel, "qmenumodel.unitymenumodel", QtWarningMsg) + G_DEFINE_QUARK (UNITY_MENU_MODEL, unity_menu_model) G_DEFINE_QUARK (UNITY_SUBMENU_MODEL, unity_submenu_model) G_DEFINE_QUARK (UNITY_MENU_ITEM_EXTENDED_ATTRIBUTES, unity_menu_item_extended_attributes) @@ -654,7 +657,7 @@ bool UnityMenuModel::loadExtendedAttributes(int position, const QVariantMap &sch GVariant *value = gtk_menu_tracker_item_get_attribute_value (item, name.toUtf8(), NULL); if (value == NULL) { - qWarning("loadExtendedAttributes: menu item does not contain '%s'", it.key().toUtf8().constData()); + qCDebug(unitymenumodel, "loadExtendedAttributes: menu item does not contain '%s'", it.key().toUtf8().constData()); continue; } @@ -662,7 +665,7 @@ bool UnityMenuModel::loadExtendedAttributes(int position, const QVariantMap &sch if (qvalue.isValid()) extendedAttrs->insert(qtify_name (name.toUtf8()), qvalue); else - qWarning("loadExtendedAttributes: key '%s' is of type '%s' (expected '%s')", + qCWarning(unitymenumodel, "loadExtendedAttributes: key '%s' is of type '%s' (expected '%s')", name.toUtf8().constData(), g_variant_get_type_string(value), type.constData()); g_variant_unref (value); -- cgit v1.2.3 From 2bf63470a4d25af32eb6c39b9c5da2e64a9cdf8f Mon Sep 17 00:00:00 2001 From: Nick Dedekind Date: Tue, 23 Feb 2016 14:29:04 +0000 Subject: added missing file --- libqmenumodel/src/logging.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 libqmenumodel/src/logging.h diff --git a/libqmenumodel/src/logging.h b/libqmenumodel/src/logging.h new file mode 100644 index 0000000..bd7e708 --- /dev/null +++ b/libqmenumodel/src/logging.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2016 Canonical, Ltd. + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License version 3, as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, + * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +#ifndef QMENUMODEL_LOGGING_H +#define QMENUMODEL_LOGGING_H + +#include +Q_DECLARE_LOGGING_CATEGORY(unitymenumodel) + +#endif // QMENUMODEL_LOGGING_H -- cgit v1.2.3 From 4ad605553fa905edb3a78578fa01dba6c2819176 Mon Sep 17 00:00:00 2001 From: Nick Dedekind Date: Tue, 23 Feb 2016 14:35:57 +0000 Subject: only log critical --- libqmenumodel/src/unitymenumodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index 67fe95d..70412a4 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -34,7 +34,7 @@ extern "C" { #include "gtk/gtksimpleactionobserver.h" } -Q_LOGGING_CATEGORY(unitymenumodel, "qmenumodel.unitymenumodel", QtWarningMsg) +Q_LOGGING_CATEGORY(unitymenumodel, "qmenumodel.unitymenumodel", QtCriticalMsg) G_DEFINE_QUARK (UNITY_MENU_MODEL, unity_menu_model) G_DEFINE_QUARK (UNITY_SUBMENU_MODEL, unity_submenu_model) @@ -657,7 +657,7 @@ bool UnityMenuModel::loadExtendedAttributes(int position, const QVariantMap &sch GVariant *value = gtk_menu_tracker_item_get_attribute_value (item, name.toUtf8(), NULL); if (value == NULL) { - qCDebug(unitymenumodel, "loadExtendedAttributes: menu item does not contain '%s'", it.key().toUtf8().constData()); + qCWarning(unitymenumodel, "loadExtendedAttributes: menu item does not contain '%s'", it.key().toUtf8().constData()); continue; } -- cgit v1.2.3 From 9efd410b91168d2afe730d3fc53bc8718ca39347 Mon Sep 17 00:00:00 2001 From: CI Train Bot Date: Tue, 29 Mar 2016 12:57:01 +0000 Subject: Releasing 0.2.9+16.04.20160329-0ubuntu1 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 6729df8..9f44317 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +qmenumodel (0.2.9+16.04.20160329-0ubuntu1) xenial; urgency=medium + + [ Nick Dedekind ] + * Use Qt logging categories (LP: #1562992) + + -- Michał Sawicz Tue, 29 Mar 2016 12:57:00 +0000 + qmenumodel (0.2.9+15.04.20150430-0ubuntu2~gcc5.1) wily; urgency=medium * No-change test rebuild for g++5 ABI transition -- cgit v1.2.3 From c6bba62bdac1f3cdb20e9bd7a763a2ec03beeb44 Mon Sep 17 00:00:00 2001 From: Florian Boucault Date: Tue, 19 Jul 2016 22:41:52 +0200 Subject: Crossbuilding fixes. --- debian/control | 6 +++--- libqmenumodel/QMenuModel/CMakeLists.txt | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/debian/control b/debian/control index f8021ce..2008f64 100644 --- a/debian/control +++ b/debian/control @@ -9,9 +9,9 @@ Build-Depends: debhelper (>= 9.0.0), qt5-qmake, qtbase5-dev (>= 5.0), qtdeclarative5-dev (>= 5.0), - python3, - python3-dbus, - python3-gi, + python3:any, + python3-dbus:native, + python3-gi:native, gir1.2-glib-2.0, dbus-test-runner, libgles2-mesa-dev | libgl-dev, diff --git a/libqmenumodel/QMenuModel/CMakeLists.txt b/libqmenumodel/QMenuModel/CMakeLists.txt index 78e062b..eb4d463 100644 --- a/libqmenumodel/QMenuModel/CMakeLists.txt +++ b/libqmenumodel/QMenuModel/CMakeLists.txt @@ -24,11 +24,7 @@ qt5_use_modules(qmenumodel-qml Qml Quick) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}/qmldir") -execute_process( - COMMAND qmake -query QT_INSTALL_QML - OUTPUT_VARIABLE QT_IMPORTS_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE -) +set(QT_IMPORTS_DIR "${CMAKE_INSTALL_LIBDIR}/qt5/qml") set(QMLPLUGIN_INSTALL_PREFIX "${QT_IMPORTS_DIR}/QMenuModel") install(TARGETS qmenumodel-qml DESTINATION ${QMLPLUGIN_INSTALL_PREFIX}) install(FILES qmldir DESTINATION ${QMLPLUGIN_INSTALL_PREFIX}) -- cgit v1.2.3 From 449ac3d20ef7aa4d63f258eeb2a160a5f55cfa9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 14 Oct 2016 17:26:49 +0200 Subject: Converter: add support to LongLong and ULongLong --- libqmenumodel/src/converter.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 69e6629..021fc82 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -156,12 +156,18 @@ GVariant* Converter::toGVariant(const QVariant &value) case QVariant::Int: result = g_variant_new_int32(value.toInt()); break; + case QVariant::LongLong: + result = g_variant_new_int64(value.toLongLong()); + break; case QVariant::String: result = g_variant_new_string(value.toString().toUtf8().data()); break; case QVariant::UInt: result = g_variant_new_uint32(value.toUInt()); break; + case QVariant::ULongLong: + result = g_variant_new_uint64(value.toULongLong()); + break; case QVariant::Map: { GVariantBuilder *b; -- cgit v1.2.3 From 1e9cf635d3074b82759b0edab44ba4549af5085e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 14 Oct 2016 17:29:10 +0200 Subject: UnityMenuModel add support for activating and changing state with a variant string parameter --- libqmenumodel/src/unitymenumodel.cpp | 34 ++++++++++++++++++++++++++++++++++ libqmenumodel/src/unitymenumodel.h | 2 ++ 2 files changed, 36 insertions(+) diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index 70412a4..6e9a5f7 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -715,6 +715,40 @@ void UnityMenuModel::activate(int index, const QVariant& parameter) } } +static QVariant parseVariantString(const QString& string) +{ + QVariant qvariant; + GVariant *gvariant; + GError *error = NULL; + + if (string.isEmpty()) { + return qvariant; + } + + gvariant = g_variant_parse (NULL, string.toStdString().c_str(), NULL, NULL, &error); + + if (error) { + qWarning() << "Impossible to parse" << string << "as variant string:"<< error->message; + g_error_free (error); + return qvariant; + } + + qvariant = Converter::toQVariant(gvariant); + g_variant_unref (gvariant); + + return qvariant; +} + +void UnityMenuModel::activateByVariantString(int index, const QString& parameter) +{ + activate(index, parseVariantString(parameter)); +} + +void UnityMenuModel::changeStateByVariantString(int index, const QString& parameter) +{ + changeState(index, parseVariantString(parameter)); +} + void UnityMenuModel::changeState(int index, const QVariant& parameter) { GSequenceIter *it; diff --git a/libqmenumodel/src/unitymenumodel.h b/libqmenumodel/src/unitymenumodel.h index 8816d22..826d5b2 100644 --- a/libqmenumodel/src/unitymenumodel.h +++ b/libqmenumodel/src/unitymenumodel.h @@ -63,7 +63,9 @@ public: Q_INVOKABLE QVariant get(int row, const QByteArray &role); Q_INVOKABLE void activate(int index, const QVariant& parameter = QVariant()); + Q_INVOKABLE void activateByVariantString(int index, const QString& parameter = QString()); Q_INVOKABLE void changeState(int index, const QVariant& parameter); + Q_INVOKABLE void changeStateByVariantString(int index, const QString& parameter = QString()); void registerAction(UnityMenuAction* action); void unregisterAction(UnityMenuAction* action); -- cgit v1.2.3 From edc354a439fa0a42a4684848c4c571b29af8e5ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 14 Oct 2016 17:30:46 +0200 Subject: debian/changelog: bump version number --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 9f44317..37c0c3e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +qmenumodel (0.2.10) UNRELEASED; urgency=medium + + * Add ability to activate or change state of an action by variant string + + -- Marco Trevisan (Treviño) Fri, 14 Oct 2016 17:07:41 +0200 + qmenumodel (0.2.9+16.04.20160329-0ubuntu1) xenial; urgency=medium [ Nick Dedekind ] -- cgit v1.2.3 From 462b8422fd363d6ef3b6882459926a87ca389fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 14 Oct 2016 17:40:18 +0200 Subject: UnityMenuModel: avoid copying the string to a new std one --- libqmenumodel/src/unitymenumodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index 6e9a5f7..a407ac1 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -725,7 +725,7 @@ static QVariant parseVariantString(const QString& string) return qvariant; } - gvariant = g_variant_parse (NULL, string.toStdString().c_str(), NULL, NULL, &error); + gvariant = g_variant_parse (NULL, string.toUtf8().data(), NULL, NULL, &error); if (error) { qWarning() << "Impossible to parse" << string << "as variant string:"<< error->message; -- cgit v1.2.3 From 33b75336e5148b7dcf6113dcfe59d58ee38f9481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 15 Oct 2016 02:04:05 +0200 Subject: UnityMenuModel: avoid initializing an empty QVariant if not needed --- libqmenumodel/src/unitymenumodel.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index a407ac1..4c238d8 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -717,12 +717,11 @@ void UnityMenuModel::activate(int index, const QVariant& parameter) static QVariant parseVariantString(const QString& string) { - QVariant qvariant; GVariant *gvariant; GError *error = NULL; if (string.isEmpty()) { - return qvariant; + return QVariant(); } gvariant = g_variant_parse (NULL, string.toUtf8().data(), NULL, NULL, &error); @@ -730,10 +729,10 @@ static QVariant parseVariantString(const QString& string) if (error) { qWarning() << "Impossible to parse" << string << "as variant string:"<< error->message; g_error_free (error); - return qvariant; + return QVariant(); } - qvariant = Converter::toQVariant(gvariant); + const QVariant& qvariant = Converter::toQVariant(gvariant); g_variant_unref (gvariant); return qvariant; -- cgit v1.2.3 From f52b49722542123844b5c46157dcbc515e319f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 17 Oct 2016 10:01:14 +0200 Subject: converterTest: split tests by type --- tests/client/convertertest.cpp | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index db2807f..d3f1174 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -67,44 +67,77 @@ private Q_SLOTS: /* * Test converter QVariant to GVariant */ - void testToGVariant() + + void testBooleanToGVariant() { // Boolean QVERIFY(compare(QVariant(true), G_VARIANT_TYPE_BOOLEAN)); + } + void testByteToGVariant() + { // Byte QVERIFY(compare(QVariant::fromValue(42), G_VARIANT_TYPE_BYTE)); + } + void testInt16ToGVariant() + { // Int16 QVERIFY(compare(QVariant::fromValue(-42), G_VARIANT_TYPE_INT16)); + } + void testUInt16ToGVariant() + { // UInt16 QVERIFY(compare(QVariant::fromValue(-42), G_VARIANT_TYPE_UINT16)); + } + void testInt32ToGVariant() + { // Int32 QVERIFY(compare(QVariant(-42), G_VARIANT_TYPE_INT32)); + } + void testUInt32ToGVariant() + { // UInt32 QVERIFY(compare(QVariant((uint)42), G_VARIANT_TYPE_UINT32)); + } + void testInt64ToGVariant() + { // Int64 QVERIFY(compare(QVariant::fromValue(-42), G_VARIANT_TYPE_INT64)); + } + void testUInt64ToGVariant() + { // UInt64 QVERIFY(compare(QVariant::fromValue(42), G_VARIANT_TYPE_UINT64)); + } + void testDoubleToGVariant() + { // Double QVERIFY(compare(QVariant((double)42.42), G_VARIANT_TYPE_DOUBLE)); + } + void testStringToGVariant() + { // String QVERIFY(compare(QVariant(QString("42")), G_VARIANT_TYPE_STRING)); + } + void testByteArrayToGVariant() + { // ByteArray QVERIFY(compare(QVariant(QByteArray("42")), G_VARIANT_TYPE_BYTESTRING)); + } + void testMapToGVariant() + { // Map QVERIFY(compare(QVariantMap(), G_VARIANT_TYPE_VARDICT)); - } void testTupleConversion() -- cgit v1.2.3 From c998da02c995ae39d688b10f6993f840a6573c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 17 Oct 2016 10:04:20 +0200 Subject: convertertest: add tests for [U]LongLong converters --- tests/client/convertertest.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index d3f1174..6f0f949 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -116,6 +116,18 @@ private Q_SLOTS: QVERIFY(compare(QVariant::fromValue(42), G_VARIANT_TYPE_UINT64)); } + void testQlongLongToGVariant() + { + // Int64 + QVERIFY(compare(QVariant::fromValue(-42), G_VARIANT_TYPE_INT64)); + } + + void testUQlongLongToGVariant() + { + // UInt64 + QVERIFY(compare(QVariant::fromValue(42), G_VARIANT_TYPE_UINT64)); + } + void testDoubleToGVariant() { // Double -- cgit v1.2.3 From 1adf4a6c1c9a978d1853612bf994f622599ea29a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 11:44:04 +0200 Subject: Converter: move parseVariantString here from UnityMenuModel --- libqmenumodel/src/converter.cpp | 24 ++++++++++++++++++++++++ libqmenumodel/src/converter.h | 2 ++ libqmenumodel/src/unitymenumodel.cpp | 27 ++------------------------- 3 files changed, 28 insertions(+), 25 deletions(-) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 021fc82..527ae85 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -24,6 +24,7 @@ extern "C" { #include "converter.h" #include +#include #include /*! \internal */ @@ -137,6 +138,29 @@ static GVariant* toGVariant(const QString &typeName, const QVariant &value) return NULL; } +QVariant Converter::toQVariantFromVariantString(const QString &variantString) +{ + GVariant *gvariant; + GError *error = NULL; + + if (variantString.isEmpty()) { + return QVariant(); + } + + gvariant = g_variant_parse (NULL, variantString.toUtf8().data(), NULL, NULL, &error); + + if (error) { + qWarning() << "Impossible to parse" << variantString << "as variant string:"<< error->message; + g_error_free (error); + return QVariant(); + } + + const QVariant& qvariant = Converter::toQVariant(gvariant); + g_variant_unref (gvariant); + + return qvariant; +} + GVariant* Converter::toGVariant(const QVariant &value) { GVariant *result = NULL; diff --git a/libqmenumodel/src/converter.h b/libqmenumodel/src/converter.h index f47c09e..27cdcae 100644 --- a/libqmenumodel/src/converter.h +++ b/libqmenumodel/src/converter.h @@ -21,12 +21,14 @@ #define CONVERTER_H typedef struct _GVariant GVariant; +class QString; class QVariant; class Converter { public: static QVariant toQVariant(GVariant *value); + static QVariant toQVariantFromVariantString(const QString &variantString); static GVariant* toGVariant(const QVariant &value); // This converts a QVariant to a GVariant using a provided gvariant schema as diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index 4c238d8..5e8c8e3 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -715,37 +715,14 @@ void UnityMenuModel::activate(int index, const QVariant& parameter) } } -static QVariant parseVariantString(const QString& string) -{ - GVariant *gvariant; - GError *error = NULL; - - if (string.isEmpty()) { - return QVariant(); - } - - gvariant = g_variant_parse (NULL, string.toUtf8().data(), NULL, NULL, &error); - - if (error) { - qWarning() << "Impossible to parse" << string << "as variant string:"<< error->message; - g_error_free (error); - return QVariant(); - } - - const QVariant& qvariant = Converter::toQVariant(gvariant); - g_variant_unref (gvariant); - - return qvariant; -} - void UnityMenuModel::activateByVariantString(int index, const QString& parameter) { - activate(index, parseVariantString(parameter)); + activate(index, Converter::toQVariantFromVariantString(parameter)); } void UnityMenuModel::changeStateByVariantString(int index, const QString& parameter) { - changeState(index, parseVariantString(parameter)); + changeState(index, Converter::toQVariantFromVariantString(parameter)); } void UnityMenuModel::changeState(int index, const QVariant& parameter) -- cgit v1.2.3 From 06687a7f140678f26d9394b4f0b5a4a41aaab63c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 11:55:14 +0200 Subject: QStateAction: add ability to activate or change state by variant string --- libqmenumodel/src/qstateaction.cpp | 20 ++++++++++++++++++++ libqmenumodel/src/qstateaction.h | 2 ++ libqmenumodel/src/unitymenumodel.h | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libqmenumodel/src/qstateaction.cpp b/libqmenumodel/src/qstateaction.cpp index 983064a..fcffa44 100644 --- a/libqmenumodel/src/qstateaction.cpp +++ b/libqmenumodel/src/qstateaction.cpp @@ -19,6 +19,7 @@ #include "qstateaction.h" +#include "converter.h" #include "qdbusactiongroup.h" /*! @@ -98,6 +99,15 @@ void QStateAction::updateState(const QVariant &state) m_group->updateActionState(m_name, v); } +/*! + Request for the state of action to be changed to \a paramenter. + This call merely requests a change. The action may refuse to change its state or may change its state to something other than \a paramenter. +*/ +void QStateAction::updateStateByVariantString(const QString &state) +{ + updateState(Converter::toQVariantFromVariantString(state)); +} + /*! Activates the action passing \a parameter. \a parameter must be the correct type of parameter for the action @@ -107,6 +117,16 @@ void QStateAction::activate(const QVariant ¶meter) m_group->activateAction(m_name, parameter); } +/*! + Activates the action passing \a parameter using GLib Variant String format. + \a parameter must be the correct type of parameter for the action +*/ +void QStateAction::activateByVariantString(const QString ¶meter) +{ + activate(Converter::toQVariantFromVariantString(parameter)); +} + + /*! \internal */ QString QStateAction::name() const { diff --git a/libqmenumodel/src/qstateaction.h b/libqmenumodel/src/qstateaction.h index 0fc68c2..4d05a7a 100644 --- a/libqmenumodel/src/qstateaction.h +++ b/libqmenumodel/src/qstateaction.h @@ -36,7 +36,9 @@ public: bool isValid() const; Q_INVOKABLE void activate(const QVariant ¶meter = QVariant()); + Q_INVOKABLE void activateByVariantString(const QString ¶meter = QString()); Q_INVOKABLE void updateState(const QVariant ¶meter); + Q_INVOKABLE void updateStateByVariantString(const QString ¶meter); Q_SIGNALS: void stateChanged(QVariant state); diff --git a/libqmenumodel/src/unitymenumodel.h b/libqmenumodel/src/unitymenumodel.h index 826d5b2..ed3bcd7 100644 --- a/libqmenumodel/src/unitymenumodel.h +++ b/libqmenumodel/src/unitymenumodel.h @@ -65,7 +65,7 @@ public: Q_INVOKABLE void activate(int index, const QVariant& parameter = QVariant()); Q_INVOKABLE void activateByVariantString(int index, const QString& parameter = QString()); Q_INVOKABLE void changeState(int index, const QVariant& parameter); - Q_INVOKABLE void changeStateByVariantString(int index, const QString& parameter = QString()); + Q_INVOKABLE void changeStateByVariantString(int index, const QString& parameter); void registerAction(UnityMenuAction* action); void unregisterAction(UnityMenuAction* action); -- cgit v1.2.3 From c3b68232c33ee5ef53e58624024192f78f8337a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 12:06:02 +0200 Subject: CMakeLists.txt: we can safely use c++11 here --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95440ca..0aef573 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32) pkg_check_modules(GIO REQUIRED gio-2.0>=2.32) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) +SET(CMAKE_CXX_FLAGS "-std=c++11") add_definitions(-DQT_NO_KEYWORDS) find_program(DBUS_RUNNER dbus-test-runner) @@ -26,7 +27,7 @@ if(ENABLE_COVERAGE) message(FATAL_ERROR "gcov command not found") endif() SET(CMAKE_C_FLAGS "-g -O0 -Wall --coverage") - SET(CMAKE_CXX_FLAGS "-g -O0 -Wall --coverage") + SET(CMAKE_CXX_FLAGS "-g -O0 -Wall -std=c++11 --coverage") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") include(${CMAKE_SOURCE_DIR}/cmake/lcov.cmake) endif() -- cgit v1.2.3 From 894fbb91c8fa95e696fc45364f8ffda76417427e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 12:06:35 +0200 Subject: convertertest: use better variant map test --- tests/client/convertertest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 6f0f949..fe70840 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -149,7 +149,7 @@ private Q_SLOTS: void testMapToGVariant() { // Map - QVERIFY(compare(QVariantMap(), G_VARIANT_TYPE_VARDICT)); + QVERIFY(compare(QVariantMap({{"fooBar", 0xdeadbeef}}), G_VARIANT_TYPE_VARDICT)); } void testTupleConversion() -- cgit v1.2.3 From 3edd18dc46ebb95962f17de0c77ee72f469fd917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 12:40:19 +0200 Subject: ConverterTest: add tests for toQVariant --- tests/client/convertertest.cpp | 85 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 3 deletions(-) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index fe70840..a6a82de 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -39,12 +39,29 @@ private: result = g_variant_type_equal(g_variant_get_type(gv), type); if (!result) { qWarning() << "types are different: QVariant:" << qv.typeName() - << "Result:" << (const char*) g_variant_get_type(gv) - << "Expected:"<< (const char*) type; + << "Result:" << g_variant_type_peek_string (g_variant_get_type(gv)) + << "Expected:"<< g_variant_type_peek_string (type); + } + g_variant_unref(gv); + return result; + } + bool compare(GVariant *gv, const QVariant::Type type) + { + g_variant_ref_sink(gv); + const QVariant& qv = Converter::toQVariant(gv); + bool result = (qv.type() == type); + if (!result) { + qWarning() << "types are different: GVariant:" << g_variant_type_peek_string (g_variant_get_type(gv)) + << "Result:" << qv.type() + << "Expected:"<< type; } g_variant_unref(gv); return result; } + bool compare(GVariant *gv, const QMetaType::Type type) + { + return compare(gv, (QVariant::Type) type); + } bool compareWithSchema(const QVariant &qv, const QString strType) { GVariantType* expected_type; @@ -89,7 +106,7 @@ private Q_SLOTS: void testUInt16ToGVariant() { // UInt16 - QVERIFY(compare(QVariant::fromValue(-42), G_VARIANT_TYPE_UINT16)); + QVERIFY(compare(QVariant::fromValue(42), G_VARIANT_TYPE_UINT16)); } void testInt32ToGVariant() @@ -152,6 +169,68 @@ private Q_SLOTS: QVERIFY(compare(QVariantMap({{"fooBar", 0xdeadbeef}}), G_VARIANT_TYPE_VARDICT)); } + // LIST CHECK! + + void testBooleanToQVariant() + { + // Boolean + QVERIFY(compare(g_variant_new_boolean(TRUE), QVariant::Bool)); + } + + void testByteToQVariant() + { + // Byte + QVERIFY(compare(g_variant_new_byte(53), QMetaType::UChar)); + } + + void testInt16ToQVariant() + { + // Int16 + QVERIFY(compare(g_variant_new_int16(-53), QMetaType::Short)); + } + + void testUInt16ToQVariant() + { + // UInt16 + QVERIFY(compare(g_variant_new_uint16(53), QMetaType::UShort)); + } + + void testInt32ToQVariant() + { + // Int32 + QVERIFY(compare(g_variant_new_int32(-53), QVariant::Int)); + } + + void testUInt32ToQVariant() + { + // UInt32 + QVERIFY(compare(g_variant_new_uint32(53), QVariant::UInt)); + } + + void testInt64ToQVariant() + { + // Int64 + QVERIFY(compare(g_variant_new_int64(-53), QVariant::LongLong)); + } + + void testUInt64ToQVariant() + { + // UInt64 + QVERIFY(compare(g_variant_new_uint64(53), QVariant::ULongLong)); + } + + void testDoubleToQVariant() + { + // Double + QVERIFY(compare(g_variant_new_double(53.53), QVariant::Double)); + } + + void testStringToQVariant() + { + // String + QVERIFY(compare(g_variant_new_string("53"), QVariant::String)); + } + void testTupleConversion() { QVariantList qTuple; -- cgit v1.2.3 From e87701e0f2d5f3b7dd291c7b8c62e407b5abf4c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 12:53:27 +0200 Subject: Converter: add bytestring support --- libqmenumodel/src/converter.cpp | 6 +++++- tests/client/convertertest.cpp | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 527ae85..91cafab 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -58,6 +58,11 @@ QVariant Converter::toQVariant(GVariant *value) gsize size = 0; const gchar *v = g_variant_get_string(value, &size); result.setValue(QString::fromUtf8(v, size)); + } else if (g_variant_type_equal(type, G_VARIANT_TYPE_BYTESTRING)) { + gsize size = 0; + gchar *bs = g_variant_dup_bytestring(value, &size); + result.setValue(QByteArray::fromRawData(bs, size)); + g_free(bs); } else if (g_variant_type_equal(type, G_VARIANT_TYPE_VARIANT)) { GVariant *var = g_variant_get_variant(value); result = toQVariant(var); @@ -111,7 +116,6 @@ QVariant Converter::toQVariant(GVariant *value) * G_VARIANT_TYPE_DICT_ENTRY * G_VARIANT_TYPE_DICTIONARY * G_VARIANT_TYPE_STRING_ARRAY - * G_VARIANT_TYPE_BYTESTRING * G_VARIANT_TYPE_OBJECT_PATH_ARRAY * G_VARIANT_TYPE_BYTESTRING_ARRAY */ diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index a6a82de..e61caa0 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -169,8 +169,6 @@ private Q_SLOTS: QVERIFY(compare(QVariantMap({{"fooBar", 0xdeadbeef}}), G_VARIANT_TYPE_VARDICT)); } - // LIST CHECK! - void testBooleanToQVariant() { // Boolean @@ -231,6 +229,12 @@ private Q_SLOTS: QVERIFY(compare(g_variant_new_string("53"), QVariant::String)); } + void testByteArrayToQVariant() + { + // ByteArray + QVERIFY(compare(g_variant_new_bytestring("53"), QVariant::ByteArray)); + } + void testTupleConversion() { QVariantList qTuple; -- cgit v1.2.3 From c42bc210a32f06b2850fbe010be9356d477330b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 15:39:20 +0200 Subject: Converter: add support for ByteArrayList --- libqmenumodel/src/converter.cpp | 22 +++++++++++++++++++++- tests/client/convertertest.cpp | 15 +++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 91cafab..9fd65ed 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -63,6 +63,15 @@ QVariant Converter::toQVariant(GVariant *value) gchar *bs = g_variant_dup_bytestring(value, &size); result.setValue(QByteArray::fromRawData(bs, size)); g_free(bs); + } else if (g_variant_type_equal(type, G_VARIANT_TYPE_BYTESTRING_ARRAY)) { + gsize size = 0; + const gchar **bsa = g_variant_get_bytestring_array(value, &size); + QByteArrayList list; + for (gsize i = 0; i < size; ++i) { + list << bsa[i]; + } + result.setValue(list); + g_free(bsa); } else if (g_variant_type_equal(type, G_VARIANT_TYPE_VARIANT)) { GVariant *var = g_variant_get_variant(value); result = toQVariant(var); @@ -117,7 +126,6 @@ QVariant Converter::toQVariant(GVariant *value) * G_VARIANT_TYPE_DICTIONARY * G_VARIANT_TYPE_STRING_ARRAY * G_VARIANT_TYPE_OBJECT_PATH_ARRAY - * G_VARIANT_TYPE_BYTESTRING_ARRAY */ return result; @@ -211,6 +219,18 @@ GVariant* Converter::toGVariant(const QVariant &value) g_variant_builder_unref(b); break; } + case QMetaType::QByteArrayList: + { + const QByteArrayList &list = qvariant_cast(value); + GVariantBuilder *b = g_variant_builder_new(G_VARIANT_TYPE_BYTESTRING_ARRAY); + + for (const QByteArray &ba : list) { + g_variant_builder_add_value(b, g_variant_new_bytestring(ba)); + } + result = g_variant_builder_end(b); + g_variant_builder_unref(b); + break; + } case QVariant::List: { QVariantList lst = value.toList(); diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index e61caa0..933ed2f 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -163,6 +163,14 @@ private Q_SLOTS: QVERIFY(compare(QVariant(QByteArray("42")), G_VARIANT_TYPE_BYTESTRING)); } + void testByteArrayListToGVariant() + { + // ByteArrayList + QVariant result; + result.setValue(QByteArrayList({"42", "53"})); + QVERIFY(compare(result, G_VARIANT_TYPE_BYTESTRING_ARRAY)); + } + void testMapToGVariant() { // Map @@ -235,6 +243,13 @@ private Q_SLOTS: QVERIFY(compare(g_variant_new_bytestring("53"), QVariant::ByteArray)); } + void testByteArrayListToQVariant() + { + // ByteArrayList + const gchar * byteArray[] = {"42", "53", NULL}; + QVERIFY(compare(g_variant_new_bytestring_array(byteArray, -1), QMetaType::QByteArrayList)); + } + void testTupleConversion() { QVariantList qTuple; -- cgit v1.2.3 From 36681ba81d33e3c1e66bef49450f4e7008154b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 15:50:17 +0200 Subject: Converter: use QMetaType to check integer subtypes --- libqmenumodel/src/converter.cpp | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 9fd65ed..9f89662 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -131,25 +131,6 @@ QVariant Converter::toQVariant(GVariant *value) return result; } -static GVariant* toGVariant(const QString &typeName, const QVariant &value) -{ - if (typeName == "uchar") { - return g_variant_new_byte(value.value()); - } else if (typeName == "short") { - return g_variant_new_int16(value.value()); - } else if (typeName == "ushort") { - return g_variant_new_uint16(value.value()); - } else if (typeName == "long") { - return g_variant_new_int64(value.value()); - } else if (typeName == "ulong") { - return g_variant_new_uint64(value.value()); - } else { - qWarning() << "QVariant type not supported:" << typeName; - } - - return NULL; -} - QVariant Converter::toQVariantFromVariantString(const QString &variantString) { GVariant *gvariant; @@ -204,6 +185,21 @@ GVariant* Converter::toGVariant(const QVariant &value) case QVariant::ULongLong: result = g_variant_new_uint64(value.toULongLong()); break; + case QMetaType::UChar: + result = g_variant_new_byte(value.value()); + break; + case QMetaType::Short: + result = g_variant_new_int16(value.value()); + break; + case QMetaType::UShort: + result = g_variant_new_uint16(value.value()); + break; + case QMetaType::Long: + result = g_variant_new_int64(value.value()); + break; + case QMetaType::ULong: + result = g_variant_new_uint64(value.value()); + break; case QVariant::Map: { GVariantBuilder *b; @@ -243,7 +239,7 @@ GVariant* Converter::toGVariant(const QVariant &value) break; } default: - result = ::toGVariant(value.typeName(), value); + qWarning() << "QVariant type not supported:" << value.type(); } return result; -- cgit v1.2.3 From d3899e64d6c24337d1547854da7e3cb9499d9d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 16:09:51 +0200 Subject: convertertest: add conversion from map to qvariant check --- tests/client/convertertest.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 933ed2f..89e1de4 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -246,10 +246,19 @@ private Q_SLOTS: void testByteArrayListToQVariant() { // ByteArrayList - const gchar * byteArray[] = {"42", "53", NULL}; + const gchar *byteArray[] = {"42", "53", NULL}; QVERIFY(compare(g_variant_new_bytestring_array(byteArray, -1), QMetaType::QByteArrayList)); } + void testMapToQVariant() + { + // Map + GVariantBuilder *b = g_variant_builder_new(G_VARIANT_TYPE_VARDICT); + g_variant_builder_add(b, "{sv}", "Foo", g_variant_new_int32(53)); + QVERIFY(compare(g_variant_builder_end(b), QVariant::Map)); + g_variant_builder_unref(b); + } + void testTupleConversion() { QVariantList qTuple; -- cgit v1.2.3 From d8aa8818169b758899ede0ec7932c6fe6f3ef4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 16:15:55 +0200 Subject: ConverterTest: add QVariantList conversion test --- tests/client/convertertest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 89e1de4..32d6091 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -177,6 +177,12 @@ private Q_SLOTS: QVERIFY(compare(QVariantMap({{"fooBar", 0xdeadbeef}}), G_VARIANT_TYPE_VARDICT)); } + void testListToGVariant() + { + // List + QVERIFY(compare(QVariantList({"42", 53}), G_VARIANT_TYPE("(si)"))); + } + void testBooleanToQVariant() { // Boolean -- cgit v1.2.3 From 3bd198ee6bdaec2fefff032098b2442b0160c961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 16:48:00 +0200 Subject: Converter: use some c++11 facilities for lists --- libqmenumodel/src/converter.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 9f89662..3131d4f 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -229,13 +229,13 @@ GVariant* Converter::toGVariant(const QVariant &value) } case QVariant::List: { - QVariantList lst = value.toList(); - GVariant **vars = g_new(GVariant*, lst.size()); - for (int i=0; i < lst.size(); i++) { - vars[i] = toGVariant(lst[i]); + GVariantBuilder *b = g_variant_builder_new(G_VARIANT_TYPE_TUPLE); + + for (const QVariant &v : value.toList()) { + g_variant_builder_add_value(b, toGVariant(v)); } - result = g_variant_new_tuple(vars, lst.size()); - g_free(vars); + result = g_variant_builder_end(b); + g_variant_builder_unref(b); break; } default: @@ -307,14 +307,14 @@ GVariant* Converter::toGVariantWithSchema(const QVariant &value, const char* sch const GVariantType* entry_type; GVariant* data; entry_type = g_variant_type_element(schema_type); - gchar* entryTypeString = g_variant_type_dup_string(entry_type); + const gchar* entryTypeString = g_variant_type_peek_string(entry_type); - QVariantList lst = value.toList(); + const QVariantList &lst = value.toList(); GVariant **vars = g_new(GVariant*, lst.size()); bool ok = true; - for (int i=0; i < lst.size(); i++) { - data = Converter::toGVariantWithSchema(lst[i], entryTypeString); + for (int i=0, iMax=lst.size(); i < iMax; i++) { + data = Converter::toGVariantWithSchema(lst.at(i), entryTypeString); if (data) { vars[i] = data; @@ -328,7 +328,6 @@ GVariant* Converter::toGVariantWithSchema(const QVariant &value, const char* sch if (ok) { result = g_variant_new_array(entry_type, vars, lst.size()); } - g_free(entryTypeString); g_free(vars); } } else if (g_variant_type_is_tuple(schema_type)) { @@ -341,11 +340,11 @@ GVariant* Converter::toGVariantWithSchema(const QVariant &value, const char* sch const GVariantType* entry_type = g_variant_type_first(schema_type); bool ok = true; - for (int i=0; i < lst.size(); i++) { + for (int i=0,iMax=lst.size(); i < iMax; i++) { gchar* entryTypeString = g_variant_type_dup_string(entry_type); - data = Converter::toGVariantWithSchema(lst[i], entryTypeString); + data = Converter::toGVariantWithSchema(lst.at(i), entryTypeString); if (data) { vars[i] = data; -- cgit v1.2.3 From 3def677b32e7cf1916de2cdf6be01a7a0cc43d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 17:27:13 +0200 Subject: Converter: use builders and c++ facilities for schema conversions --- libqmenumodel/src/converter.cpp | 60 +++++++++++++++-------------------------- tests/client/convertertest.cpp | 26 +++++++++--------- 2 files changed, 35 insertions(+), 51 deletions(-) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 3131d4f..aef34d0 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -303,69 +303,53 @@ GVariant* Converter::toGVariantWithSchema(const QVariant &value, const char* sch } } else if (g_variant_type_is_array(schema_type)) { if (value.canConvert(QVariant::List)) { + const GVariantType* entryType = g_variant_type_element(schema_type); + const gchar* entryTypeString = g_variant_type_peek_string(entryType); - const GVariantType* entry_type; - GVariant* data; - entry_type = g_variant_type_element(schema_type); - const gchar* entryTypeString = g_variant_type_peek_string(entry_type); - - const QVariantList &lst = value.toList(); - GVariant **vars = g_new(GVariant*, lst.size()); - + GVariantBuilder *b = g_variant_builder_new(G_VARIANT_TYPE_ARRAY); bool ok = true; - for (int i=0, iMax=lst.size(); i < iMax; i++) { - data = Converter::toGVariantWithSchema(lst.at(i), entryTypeString); + + for (const QVariant &v : value.toList()) { + GVariant *data = toGVariantWithSchema(v, entryTypeString); if (data) { - vars[i] = data; - } - else { + g_variant_builder_add_value(b, data); + } else { ok = false; qWarning() << "Failed to convert list to array with schema:" << schema; break; } } if (ok) { - result = g_variant_new_array(entry_type, vars, lst.size()); + result = g_variant_builder_end(b); } - g_free(vars); + g_variant_builder_unref(b); } } else if (g_variant_type_is_tuple(schema_type)) { if (value.canConvert(QVariant::List)) { - GVariant* data; - - QVariantList lst = value.toList(); - GVariant **vars = g_new(GVariant*, lst.size()); - - const GVariantType* entry_type = g_variant_type_first(schema_type); + const GVariantType* entryType = g_variant_type_first(schema_type); + GVariantBuilder *b = g_variant_builder_new(G_VARIANT_TYPE_TUPLE); bool ok = true; - for (int i=0,iMax=lst.size(); i < iMax; i++) { - - gchar* entryTypeString = g_variant_type_dup_string(entry_type); - data = Converter::toGVariantWithSchema(lst.at(i), entryTypeString); + for (const QVariant &v : value.toList()) { + gchar* entryTypeString = g_variant_type_dup_string(entryType); + GVariant *data = toGVariantWithSchema(v, entryTypeString); + g_free(entryTypeString); if (data) { - vars[i] = data; - } - else { + g_variant_builder_add_value(b, data); + entryType = g_variant_type_next(entryType); + } else { ok = false; - qWarning() << "Failed to convert list to tuple with schema:" << schema; - g_free(entryTypeString); - break; - } - g_free(entryTypeString); - - entry_type = g_variant_type_next(entry_type); - if (!entry_type) { + qWarning() << "Failed to convert list to array with schema:" << schema; break; } } if (ok) { - result = g_variant_new_tuple(vars, lst.size()); + result = g_variant_builder_end(b); } - g_free(vars); + g_variant_builder_unref(b); } } diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 32d6091..5a9367f 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -295,38 +295,38 @@ private Q_SLOTS: void testSchemaConvert() { // convert to integer - compareWithSchema(QVariant::fromValue(1), "i"); - compareWithSchema(QVariant::fromValue(1.1), "i"); + QVERIFY(compareWithSchema(QVariant::fromValue(1), "i")); + QVERIFY(compareWithSchema(QVariant::fromValue(1.1), "i")); // convert to integer - compareWithSchema(QVariant::fromValue(true), "b"); - compareWithSchema(QVariant::fromValue(1), "b"); + QVERIFY(compareWithSchema(QVariant::fromValue(true), "b")); + QVERIFY(compareWithSchema(QVariant::fromValue(1), "b")); // convert to double - compareWithSchema(QVariant::fromValue(1.0), "d"); - compareWithSchema(QVariant::fromValue(1), "d"); + QVERIFY(compareWithSchema(QVariant::fromValue(1.0), "d")); + QVERIFY(compareWithSchema(QVariant::fromValue(1), "d")); // convert to string - compareWithSchema(QVariant::fromValue(1), "s"); - compareWithSchema(QVariant::fromValue(1.1), "s"); + QVERIFY(compareWithSchema(QVariant::fromValue(1), "s")); + QVERIFY(compareWithSchema(QVariant::fromValue(1.1), "s")); // convert to tuple - compareWithSchema(QVariantList() << QVariant::fromValue(true) << QVariant::fromValue(1) << QVariant::fromValue(1) << QVariant::fromValue("test1"), "(bdis)"); + QVERIFY(compareWithSchema(QVariantList() << QVariant::fromValue(true) << QVariant::fromValue(1) << QVariant::fromValue(1) << QVariant::fromValue("test1"), "(bdis)")); // convert to array - compareWithSchema(QVariantList() << QVariant::fromValue(1) << QVariant::fromValue(1), "ad"); - compareWithSchema(QVariantList() << QVariant::fromValue("test1") << QVariant::fromValue("test2"), "as"); + QVERIFY(compareWithSchema(QVariantList() << QVariant::fromValue(1) << QVariant::fromValue(1), "ad")); + QVERIFY(compareWithSchema(QVariantList() << QVariant::fromValue("test1") << QVariant::fromValue("test2"), "as")); // convert to array of tuple QVariantList si1(QVariantList() << QVariant::fromValue("test1") << QVariant::fromValue(1)); QVariantList si2(QVariantList() << QVariant::fromValue("test1") << QVariant::fromValue(1)); - compareWithSchema(QVariantList() << QVariant::fromValue(si1) << QVariant::fromValue(si2), "a(sd)"); + QVERIFY(compareWithSchema(QVariantList() << QVariant::fromValue(si1) << QVariant::fromValue(si2), "a(sd)")); // convert to vardict QVariantMap map; map["test1"] = QVariant::fromValue(1); map["test2"] = QVariant::fromValue(1); - compareWithSchema(map, "a{sv}"); + QVERIFY(compareWithSchema(map, "a{sv}")); } }; -- cgit v1.2.3 From 901e9dcbf13b658545d5bc1e2d96ccac2ed61111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 18 Oct 2016 17:34:52 +0200 Subject: converter: stop looking if w'eve no entryType --- libqmenumodel/src/converter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index aef34d0..1b63272 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -340,6 +340,8 @@ GVariant* Converter::toGVariantWithSchema(const QVariant &value, const char* sch if (data) { g_variant_builder_add_value(b, data); entryType = g_variant_type_next(entryType); + if (!entryType) + break; } else { ok = false; qWarning() << "Failed to convert list to array with schema:" << schema; -- cgit v1.2.3 From bba640d9c189be19d66c6294873b6ab8ffa4efc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 20 Oct 2016 12:22:05 +0200 Subject: ActionGroupTest: split tests depending on they need the helper script or not And cleanup units --- tests/client/actiongrouptest.cpp | 101 +++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 47 deletions(-) diff --git a/tests/client/actiongrouptest.cpp b/tests/client/actiongrouptest.cpp index d187ea7..cc43245 100644 --- a/tests/client/actiongrouptest.cpp +++ b/tests/client/actiongrouptest.cpp @@ -27,26 +27,15 @@ #include #include -class ActionGroupTest : public QObject +class ActionGroupTestBase : public QObject { Q_OBJECT -private: - DBusMenuScript m_script; +protected: QDBusMenuModel m_model; QDBusActionGroup m_actionGroup; -private Q_SLOTS: - void initTestCase() - { - QVERIFY(m_script.connect()); - } - - void cleanupTestCase() - { - m_script.quit(); - } - - void init() +protected Q_SLOTS: + virtual void init() { m_model.stop(); m_model.setBusType(DBusEnums::SessionBus); @@ -59,11 +48,6 @@ private Q_SLOTS: m_actionGroup.setObjectPath(MENU_OBJECT_PATH); } - void cleanup() - { - m_script.unpublishMenu(); - } - /* * Test if the propety busType handle correct integer values */ @@ -88,27 +72,57 @@ private Q_SLOTS: */ void testServiceAppear() { - m_model.start(); - m_actionGroup.start(); QCOMPARE(m_actionGroup.status(), DBusEnums::Connecting); // Make menu available + DBusMenuScript m_script; + m_script.connect(); m_script.publishMenu(); QCOMPARE(m_actionGroup.status(), DBusEnums::Connected); } +}; - /* - * Test if QDBusActionGroup change to correct state after DBus - * service disappear - */ - void testServiceDisappear() +class ActionGroupTestWithScript : public ActionGroupTestBase +{ + Q_OBJECT +private: + DBusMenuScript m_script; + +private Q_SLOTS: + void initTestCase() + { + QVERIFY(m_script.connect()); + } + + void cleanupTestCase() { + m_script.quit(); + } + + void init() + { + ActionGroupTestBase::init(); + + // start model m_model.start(); m_actionGroup.start(); // Make menu available m_script.publishMenu(); + } + + void cleanup() + { + m_script.unpublishMenu(); + } + + /* + * Test if QDBusActionGroup change to correct state after DBus + * service disappear + */ + void testServiceDisappear() + { QCOMPARE(m_actionGroup.status(), DBusEnums::Connected); // Append menus @@ -127,12 +141,7 @@ private Q_SLOTS: */ void testActiveAction() { - // start model - m_model.start(); - m_actionGroup.start(); - - // Make menu available - m_script.publishMenu(); + // Append 2 menus m_script.walk(2); // Get Action @@ -158,12 +167,7 @@ private Q_SLOTS: */ void testRemoveAction() { - // start model - m_model.start(); - m_actionGroup.start(); - - // Make menu available and append 2 menus - m_script.publishMenu(); + // Append 2 menus m_script.walk(2); // Get Action @@ -183,13 +187,6 @@ private Q_SLOTS: */ void testActionIsValid() { - // start model - m_model.start(); - m_actionGroup.start(); - - // Make menu available and append 2 menus - m_script.publishMenu(); - // Get invalid Action QStateAction *act = m_actionGroup.action(QString("Menu1Act")); QVERIFY(act); @@ -204,6 +201,16 @@ private Q_SLOTS: } }; -QTEST_MAIN(ActionGroupTest) +int main(int argc, char *argv[]) +{ + ActionGroupTestBase baseTests; + ActionGroupTestWithScript scriptTests; + + QApplication a(argc, argv); + int baseTestsResults = QTest::qExec(&baseTests); + int scriptTestsResults = QTest::qExec(&scriptTests); + + return std::max(baseTestsResults, scriptTestsResults); +} #include "actiongrouptest.moc" -- cgit v1.2.3 From 6d2a0aac08c8536d735d4d7407cfe28b8c053149 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 20 Oct 2016 16:06:30 +0200 Subject: ActionGroupTest: add test for activateByVariantString --- tests/client/actiongrouptest.cpp | 128 ++++++++++++++++++++------------------- 1 file changed, 65 insertions(+), 63 deletions(-) diff --git a/tests/client/actiongrouptest.cpp b/tests/client/actiongrouptest.cpp index cc43245..3ab329c 100644 --- a/tests/client/actiongrouptest.cpp +++ b/tests/client/actiongrouptest.cpp @@ -27,15 +27,28 @@ #include #include -class ActionGroupTestBase : public QObject +class ActionGroupTest : public QObject { Q_OBJECT -protected: +private: QDBusMenuModel m_model; QDBusActionGroup m_actionGroup; + DBusMenuScript m_script; + + void getMenuAction(QStateAction **act, int index) + { + // Append 2 menus + m_script.walk(2); -protected Q_SLOTS: - virtual void init() + // Get Action + QVariant action = m_model.data(m_model.index(index, 0), QMenuModel::Action); + QVERIFY(action.isValid()); + *act = m_actionGroup.action(action.toString()); + QVERIFY(act); + } + +private Q_SLOTS: + void init() { m_model.stop(); m_model.setBusType(DBusEnums::SessionBus); @@ -46,6 +59,28 @@ protected Q_SLOTS: m_actionGroup.setBusType(DBusEnums::SessionBus); m_actionGroup.setBusName(MENU_SERVICE_NAME); m_actionGroup.setObjectPath(MENU_OBJECT_PATH); + + // start model + m_model.start(); + m_actionGroup.start(); + + // Make menu available + m_script.publishMenu(); + } + + void initTestCase() + { + QVERIFY(m_script.connect()); + } + + void cleanupTestCase() + { + m_script.quit(); + } + + void cleanup() + { + m_script.unpublishMenu(); } /* @@ -72,50 +107,15 @@ protected Q_SLOTS: */ void testServiceAppear() { + m_script.unpublishMenu(); QCOMPARE(m_actionGroup.status(), DBusEnums::Connecting); // Make menu available - DBusMenuScript m_script; m_script.connect(); m_script.publishMenu(); QCOMPARE(m_actionGroup.status(), DBusEnums::Connected); } -}; - -class ActionGroupTestWithScript : public ActionGroupTestBase -{ - Q_OBJECT -private: - DBusMenuScript m_script; - -private Q_SLOTS: - void initTestCase() - { - QVERIFY(m_script.connect()); - } - - void cleanupTestCase() - { - m_script.quit(); - } - - void init() - { - ActionGroupTestBase::init(); - - // start model - m_model.start(); - m_actionGroup.start(); - - // Make menu available - m_script.publishMenu(); - } - - void cleanup() - { - m_script.unpublishMenu(); - } /* * Test if QDBusActionGroup change to correct state after DBus @@ -136,30 +136,42 @@ private Q_SLOTS: QCOMPARE(m_actionGroup.status(), DBusEnums::Disconnected); } + void testActionName() + { + QStateAction *act; + getMenuAction(&act, 1); + QCOMPARE(act->property("name").toString(), QString("Menu1Act")); + } + /* * Test if Action::trigger active the action over DBus */ - void testActiveAction() + void testStringActionActivation() { - // Append 2 menus - m_script.walk(2); + QStateAction *act; + getMenuAction(&act, 1); + act->activate(QVariant("42")); - // Get Action - QVariant action = m_model.data(m_model.index(1, 0), QMenuModel::Action); - QVERIFY(action.isValid()); - QStateAction *act = m_actionGroup.action(action.toString()); - QVERIFY(act); + // wait for dbus propagation + QTest::qWait(500); - // test action name - QCOMPARE(act->property("name").toString(), QString("Menu1Act")); + QPair result = m_script.popActivatedAction(); + QCOMPARE(result.first, QString("Menu1Act")); + QCOMPARE(result.second.toString(), QString("42")); + } + + void testStringActionActivationByVariantString() + { + QStateAction *act; + getMenuAction(&act, 1); + act->activateByVariantString("\"53\""); - act->activate(QVariant("42")); // wait for dbus propagation QTest::qWait(500); QPair result = m_script.popActivatedAction(); QCOMPARE(result.first, QString("Menu1Act")); - QCOMPARE(result.second.toString(), QString("42")); + QCOMPARE(result.second.toString(), QString("53")); } /* @@ -201,16 +213,6 @@ private Q_SLOTS: } }; -int main(int argc, char *argv[]) -{ - ActionGroupTestBase baseTests; - ActionGroupTestWithScript scriptTests; - - QApplication a(argc, argv); - int baseTestsResults = QTest::qExec(&baseTests); - int scriptTestsResults = QTest::qExec(&scriptTests); - - return std::max(baseTestsResults, scriptTestsResults); -} +QTEST_MAIN(ActionGroupTest); #include "actiongrouptest.moc" -- cgit v1.2.3 From 81e73a200ead6b9eee4d86a0a0484c184b1ee758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 22 Oct 2016 18:21:35 +0200 Subject: ConverterTest: use data in the testSchemaConvert --- tests/client/convertertest.cpp | 46 ++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 6f0f949..1f930df 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -179,41 +179,57 @@ private Q_SLOTS: g_variant_unref(gTuple); } - void testSchemaConvert() + void testSchemaConvert_data() { - // convert to integer - compareWithSchema(QVariant::fromValue(1), "i"); - compareWithSchema(QVariant::fromValue(1.1), "i"); + QTest::addColumn("value"); + QTest::addColumn("schema"); // convert to integer - compareWithSchema(QVariant::fromValue(true), "b"); - compareWithSchema(QVariant::fromValue(1), "b"); + QTest::newRow("integer") << QVariant::fromValue(1) << "i"; + QTest::newRow("integer from double") << QVariant::fromValue(1.1) << "i"; + + // convert to bool + QTest::newRow("bool") << QVariant::fromValue(true) << "b"; + QTest::newRow("bool from int") << QVariant::fromValue(1) << "b"; // convert to double - compareWithSchema(QVariant::fromValue(1.0), "d"); - compareWithSchema(QVariant::fromValue(1), "d"); + QTest::newRow("double") << QVariant::fromValue(1.0) << "d"; + QTest::newRow("double from int") << QVariant::fromValue(1) << "d"; // convert to string - compareWithSchema(QVariant::fromValue(1), "s"); - compareWithSchema(QVariant::fromValue(1.1), "s"); + QTest::newRow("string") << QVariant::fromValue("FoooBar") << "x"; + QTest::newRow("string from int") << QVariant::fromValue(1) << "s"; + QTest::newRow("string from double") << QVariant::fromValue(1.1) << "s"; // convert to tuple - compareWithSchema(QVariantList() << QVariant::fromValue(true) << QVariant::fromValue(1) << QVariant::fromValue(1) << QVariant::fromValue("test1"), "(bdis)"); + auto list = QVariantList() << QVariant::fromValue(true) << QVariant::fromValue(1) << QVariant::fromValue(1) << QVariant::fromValue("test1"); + QTest::newRow("tuple") << QVariant(list) << "(bdis)"; // convert to array - compareWithSchema(QVariantList() << QVariant::fromValue(1) << QVariant::fromValue(1), "ad"); - compareWithSchema(QVariantList() << QVariant::fromValue("test1") << QVariant::fromValue("test2"), "as"); + list = QVariantList() << QVariant::fromValue(1) << QVariant::fromValue(1); + QTest::newRow("int list") << QVariant(list) << "ad"; + list = QVariantList() << QVariant::fromValue("test1") << QVariant::fromValue("test2"); + QTest::newRow("string list") << QVariant(list) << "as"; // convert to array of tuple QVariantList si1(QVariantList() << QVariant::fromValue("test1") << QVariant::fromValue(1)); QVariantList si2(QVariantList() << QVariant::fromValue("test1") << QVariant::fromValue(1)); - compareWithSchema(QVariantList() << QVariant::fromValue(si1) << QVariant::fromValue(si2), "a(sd)"); + list = QVariantList() << QVariant::fromValue(si1) << QVariant::fromValue(si2); + QTest::newRow("array of tuple") << QVariant(list) << "a(sd)"; // convert to vardict QVariantMap map; map["test1"] = QVariant::fromValue(1); map["test2"] = QVariant::fromValue(1); - compareWithSchema(map, "a{sv}"); + QTest::newRow("map") << QVariant(map) << "a{sv}"; + } + + void testSchemaConvert() + { + QFETCH(QVariant, value); + QFETCH(QString, schema); + + compareWithSchema(value, schema); } }; -- cgit v1.2.3 From 00ddb5fcb1b738480e161a47a319fd6b3470b2c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 22 Oct 2016 18:40:29 +0200 Subject: convertertest: repeat tests using test data --- tests/client/convertertest.cpp | 107 ++++++++++------------------------------- 1 file changed, 26 insertions(+), 81 deletions(-) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 1f930df..05656ed 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -68,88 +68,33 @@ private Q_SLOTS: * Test converter QVariant to GVariant */ - void testBooleanToGVariant() + void testConvertToGVariant_data() { - // Boolean - QVERIFY(compare(QVariant(true), G_VARIANT_TYPE_BOOLEAN)); - } - - void testByteToGVariant() - { - // Byte - QVERIFY(compare(QVariant::fromValue(42), G_VARIANT_TYPE_BYTE)); - } - - void testInt16ToGVariant() - { - // Int16 - QVERIFY(compare(QVariant::fromValue(-42), G_VARIANT_TYPE_INT16)); - } - - void testUInt16ToGVariant() - { - // UInt16 - QVERIFY(compare(QVariant::fromValue(-42), G_VARIANT_TYPE_UINT16)); - } - - void testInt32ToGVariant() - { - // Int32 - QVERIFY(compare(QVariant(-42), G_VARIANT_TYPE_INT32)); - } - - void testUInt32ToGVariant() - { - // UInt32 - QVERIFY(compare(QVariant((uint)42), G_VARIANT_TYPE_UINT32)); - } - - void testInt64ToGVariant() - { - // Int64 - QVERIFY(compare(QVariant::fromValue(-42), G_VARIANT_TYPE_INT64)); - } - - void testUInt64ToGVariant() - { - // UInt64 - QVERIFY(compare(QVariant::fromValue(42), G_VARIANT_TYPE_UINT64)); - } - - void testQlongLongToGVariant() - { - // Int64 - QVERIFY(compare(QVariant::fromValue(-42), G_VARIANT_TYPE_INT64)); - } - - void testUQlongLongToGVariant() - { - // UInt64 - QVERIFY(compare(QVariant::fromValue(42), G_VARIANT_TYPE_UINT64)); - } - - void testDoubleToGVariant() - { - // Double - QVERIFY(compare(QVariant((double)42.42), G_VARIANT_TYPE_DOUBLE)); - } - - void testStringToGVariant() - { - // String - QVERIFY(compare(QVariant(QString("42")), G_VARIANT_TYPE_STRING)); - } - - void testByteArrayToGVariant() + QTest::addColumn("value"); + QTest::addColumn("expectedType"); + + QTest::newRow("Boolean") << QVariant(true) << reinterpret_cast(G_VARIANT_TYPE_BOOLEAN); + QTest::newRow("Byte") << QVariant::fromValue(42) << reinterpret_cast(G_VARIANT_TYPE_BYTE); + QTest::newRow("Int16") << QVariant::fromValue(-42) << reinterpret_cast(G_VARIANT_TYPE_INT16); + QTest::newRow("UInt16") << QVariant::fromValue(-42) << reinterpret_cast(G_VARIANT_TYPE_UINT16); + QTest::newRow("Int32") << QVariant(-42) << reinterpret_cast(G_VARIANT_TYPE_INT32); + QTest::newRow("UInt32") << QVariant((uint)42) << reinterpret_cast(G_VARIANT_TYPE_UINT32); + QTest::newRow("Int64") << QVariant::fromValue(-42) << reinterpret_cast(G_VARIANT_TYPE_INT64); + QTest::newRow("UInt64") << QVariant::fromValue(42) << reinterpret_cast(G_VARIANT_TYPE_UINT64); + QTest::newRow("Int64") << QVariant::fromValue(-42) << reinterpret_cast(G_VARIANT_TYPE_INT64); + QTest::newRow("UInt64") << QVariant::fromValue(42) << reinterpret_cast(G_VARIANT_TYPE_UINT64); + QTest::newRow("Double") << QVariant((double)42.42) << reinterpret_cast(G_VARIANT_TYPE_DOUBLE); + QTest::newRow("String") << QVariant(QString("42")) << reinterpret_cast(G_VARIANT_TYPE_STRING); + QTest::newRow("ByteArray") << QVariant(QByteArray("42")) << reinterpret_cast(G_VARIANT_TYPE_BYTESTRING); + QTest::newRow("Map") << QVariant(QVariantMap()) << reinterpret_cast(G_VARIANT_TYPE_VARDICT); + } + + void testConvertToGVariant() { - // ByteArray - QVERIFY(compare(QVariant(QByteArray("42")), G_VARIANT_TYPE_BYTESTRING)); - } + QFETCH(QVariant, value); + QFETCH(QString, expectedType); - void testMapToGVariant() - { - // Map - QVERIFY(compare(QVariantMap(), G_VARIANT_TYPE_VARDICT)); + QVERIFY(compare(value, g_variant_type_new(expectedType.toUtf8().data()))); } void testTupleConversion() @@ -179,7 +124,7 @@ private Q_SLOTS: g_variant_unref(gTuple); } - void testSchemaConvert_data() + void testConvertToGVariantWithSchema_data() { QTest::addColumn("value"); QTest::addColumn("schema"); @@ -224,7 +169,7 @@ private Q_SLOTS: QTest::newRow("map") << QVariant(map) << "a{sv}"; } - void testSchemaConvert() + void testConvertToGVariantWithSchema() { QFETCH(QVariant, value); QFETCH(QString, schema); -- cgit v1.2.3 From 4b495fc2651d2626a5fd0bf1c19263ad4b11ce8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 22 Oct 2016 18:54:58 +0200 Subject: convertertest: create QGVariantType wrapper to avoid reinterperating a QString --- tests/client/convertertest.cpp | 54 +++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 05656ed..9e563cd 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012 Canonical Ltd. + * Copyright 2012-2016 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,6 +15,7 @@ * * Authors: * Renato Araujo Oliveira Filho + * Marco Trevisan */ extern "C" { @@ -27,6 +28,21 @@ extern "C" { #include #include +class QGVariantType : public QObject +{ + Q_OBJECT +public: + QGVariantType() : type(nullptr) {} + QGVariantType(const GVariantType *gvtype) : type(gvtype) {} + QGVariantType(const QGVariantType &other) : type(other.type) {} + const GVariantType *getType() const { return type; } + operator const GVariantType*() const { return type; } + +private: + const GVariantType *type; +}; +Q_DECLARE_METATYPE(QGVariantType); + class ConverterTest : public QObject { Q_OBJECT @@ -71,30 +87,30 @@ private Q_SLOTS: void testConvertToGVariant_data() { QTest::addColumn("value"); - QTest::addColumn("expectedType"); - - QTest::newRow("Boolean") << QVariant(true) << reinterpret_cast(G_VARIANT_TYPE_BOOLEAN); - QTest::newRow("Byte") << QVariant::fromValue(42) << reinterpret_cast(G_VARIANT_TYPE_BYTE); - QTest::newRow("Int16") << QVariant::fromValue(-42) << reinterpret_cast(G_VARIANT_TYPE_INT16); - QTest::newRow("UInt16") << QVariant::fromValue(-42) << reinterpret_cast(G_VARIANT_TYPE_UINT16); - QTest::newRow("Int32") << QVariant(-42) << reinterpret_cast(G_VARIANT_TYPE_INT32); - QTest::newRow("UInt32") << QVariant((uint)42) << reinterpret_cast(G_VARIANT_TYPE_UINT32); - QTest::newRow("Int64") << QVariant::fromValue(-42) << reinterpret_cast(G_VARIANT_TYPE_INT64); - QTest::newRow("UInt64") << QVariant::fromValue(42) << reinterpret_cast(G_VARIANT_TYPE_UINT64); - QTest::newRow("Int64") << QVariant::fromValue(-42) << reinterpret_cast(G_VARIANT_TYPE_INT64); - QTest::newRow("UInt64") << QVariant::fromValue(42) << reinterpret_cast(G_VARIANT_TYPE_UINT64); - QTest::newRow("Double") << QVariant((double)42.42) << reinterpret_cast(G_VARIANT_TYPE_DOUBLE); - QTest::newRow("String") << QVariant(QString("42")) << reinterpret_cast(G_VARIANT_TYPE_STRING); - QTest::newRow("ByteArray") << QVariant(QByteArray("42")) << reinterpret_cast(G_VARIANT_TYPE_BYTESTRING); - QTest::newRow("Map") << QVariant(QVariantMap()) << reinterpret_cast(G_VARIANT_TYPE_VARDICT); + QTest::addColumn("expectedType"); + + QTest::newRow("Boolean") << QVariant(true) << QGVariantType(G_VARIANT_TYPE_BOOLEAN); + QTest::newRow("Byte") << QVariant::fromValue(42) << QGVariantType(G_VARIANT_TYPE_BYTE); + QTest::newRow("Int16") << QVariant::fromValue(-42) << QGVariantType(G_VARIANT_TYPE_INT16); + QTest::newRow("UInt16") << QVariant::fromValue(-42) << QGVariantType(G_VARIANT_TYPE_UINT16); + QTest::newRow("Int32") << QVariant(-42) << QGVariantType(G_VARIANT_TYPE_INT32); + QTest::newRow("UInt32") << QVariant((uint)42) << QGVariantType(G_VARIANT_TYPE_UINT32); + QTest::newRow("Int64") << QVariant::fromValue(-42) << QGVariantType(G_VARIANT_TYPE_INT64); + QTest::newRow("UInt64") << QVariant::fromValue(42) << QGVariantType(G_VARIANT_TYPE_UINT64); + QTest::newRow("Int64") << QVariant::fromValue(-42) << QGVariantType(G_VARIANT_TYPE_INT64); + QTest::newRow("UInt64") << QVariant::fromValue(42) << QGVariantType(G_VARIANT_TYPE_UINT64); + QTest::newRow("Double") << QVariant((double)42.42) << QGVariantType(G_VARIANT_TYPE_DOUBLE); + QTest::newRow("String") << QVariant(QString("42")) << QGVariantType(G_VARIANT_TYPE_STRING); + QTest::newRow("ByteArray") << QVariant(QByteArray("42")) << QGVariantType(G_VARIANT_TYPE_BYTESTRING); + QTest::newRow("Map") << QVariant(QVariantMap()) << QGVariantType(G_VARIANT_TYPE_VARDICT); } void testConvertToGVariant() { QFETCH(QVariant, value); - QFETCH(QString, expectedType); + QFETCH(QGVariantType, expectedType); - QVERIFY(compare(value, g_variant_type_new(expectedType.toUtf8().data()))); + QVERIFY(compare(value, expectedType)); } void testTupleConversion() -- cgit v1.2.3 -- cgit v1.2.3 From 3d2c260f804273e5a65f27a379f4ad74407ee921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 22 Oct 2016 19:00:49 +0200 Subject: remove deprecated g_type_init() calls --- libqmenumodel/src/qdbusobject.cpp | 1 - tests/client/actiongrouptest.cpp | 1 + tests/client/cachetest.cpp | 5 ----- tests/client/convertertest.cpp | 4 ++-- tests/client/modelsignalstest.cpp | 5 ----- tests/client/treetest.cpp | 5 ----- 6 files changed, 3 insertions(+), 18 deletions(-) diff --git a/libqmenumodel/src/qdbusobject.cpp b/libqmenumodel/src/qdbusobject.cpp index be9fb93..fab2df7 100644 --- a/libqmenumodel/src/qdbusobject.cpp +++ b/libqmenumodel/src/qdbusobject.cpp @@ -81,7 +81,6 @@ QDBusObject::QDBusObject(QObject* listener) m_busType(DBusEnums::None), m_status(DBusEnums::Disconnected) { - g_type_init(); qRegisterMetaType("DBusEnums::ConnectionStatus"); } diff --git a/tests/client/actiongrouptest.cpp b/tests/client/actiongrouptest.cpp index 3ab329c..425f97c 100644 --- a/tests/client/actiongrouptest.cpp +++ b/tests/client/actiongrouptest.cpp @@ -43,6 +43,7 @@ private: // Get Action QVariant action = m_model.data(m_model.index(index, 0), QMenuModel::Action); QVERIFY(action.isValid()); + printf("aCTION IS %s\n",action.toString().toUtf8().data()); *act = m_actionGroup.action(action.toString()); QVERIFY(act); } diff --git a/tests/client/cachetest.cpp b/tests/client/cachetest.cpp index 22fe5d3..8ad65af 100644 --- a/tests/client/cachetest.cpp +++ b/tests/client/cachetest.cpp @@ -77,11 +77,6 @@ class CacheTest : public QObject Q_OBJECT private Q_SLOTS: - void initTestCase() - { - g_type_init(); - } - // Verify that normal menu items are not cached (only sub-menus are) void testCacheContents() { diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 9e563cd..ddb6aa2 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -32,7 +32,7 @@ class QGVariantType : public QObject { Q_OBJECT public: - QGVariantType() : type(nullptr) {} + QGVariantType() : type(NULL) {} QGVariantType(const GVariantType *gvtype) : type(gvtype) {} QGVariantType(const QGVariantType &other) : type(other.type) {} const GVariantType *getType() const { return type; } @@ -163,7 +163,7 @@ private Q_SLOTS: QTest::newRow("string from double") << QVariant::fromValue(1.1) << "s"; // convert to tuple - auto list = QVariantList() << QVariant::fromValue(true) << QVariant::fromValue(1) << QVariant::fromValue(1) << QVariant::fromValue("test1"); + QVariantList list = QVariantList() << QVariant::fromValue(true) << QVariant::fromValue(1) << QVariant::fromValue(1) << QVariant::fromValue("test1"); QTest::newRow("tuple") << QVariant(list) << "(bdis)"; // convert to array diff --git a/tests/client/modelsignalstest.cpp b/tests/client/modelsignalstest.cpp index 40a76c6..3064778 100644 --- a/tests/client/modelsignalstest.cpp +++ b/tests/client/modelsignalstest.cpp @@ -192,11 +192,6 @@ class ModelSignalsTest : public QObject { Q_OBJECT private Q_SLOTS: - void initTestCase() - { - g_type_init(); - } - /* * Test if the model state still correct before and after insert a new row */ diff --git a/tests/client/treetest.cpp b/tests/client/treetest.cpp index b6fec3c..81399f7 100644 --- a/tests/client/treetest.cpp +++ b/tests/client/treetest.cpp @@ -62,11 +62,6 @@ class TreeTest : public QObject Q_OBJECT private Q_SLOTS: - void initTestCase() - { - g_type_init(); - } - void testMenuBuild() { TestModel menu; -- cgit v1.2.3 From 7f78a2c234dd017b19de1a43c0fac12a15326be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 24 Oct 2016 20:46:51 +0200 Subject: converterTest: QVERIFY comparison return value --- tests/client/actiongrouptest.cpp | 1 - tests/client/convertertest.cpp | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/client/actiongrouptest.cpp b/tests/client/actiongrouptest.cpp index 425f97c..3ab329c 100644 --- a/tests/client/actiongrouptest.cpp +++ b/tests/client/actiongrouptest.cpp @@ -43,7 +43,6 @@ private: // Get Action QVariant action = m_model.data(m_model.index(index, 0), QMenuModel::Action); QVERIFY(action.isValid()); - printf("aCTION IS %s\n",action.toString().toUtf8().data()); *act = m_actionGroup.action(action.toString()); QVERIFY(act); } diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index ddb6aa2..636c299 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -158,7 +158,7 @@ private Q_SLOTS: QTest::newRow("double from int") << QVariant::fromValue(1) << "d"; // convert to string - QTest::newRow("string") << QVariant::fromValue("FoooBar") << "x"; + QTest::newRow("string") << QVariant::fromValue("FoooBar") << "s"; QTest::newRow("string from int") << QVariant::fromValue(1) << "s"; QTest::newRow("string from double") << QVariant::fromValue(1.1) << "s"; @@ -190,7 +190,7 @@ private Q_SLOTS: QFETCH(QVariant, value); QFETCH(QString, schema); - compareWithSchema(value, schema); + QVERIFY(compareWithSchema(value, schema)); } }; -- cgit v1.2.3 From abc65a4bd4bf3957b47367da58783265773b5bb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 24 Oct 2016 21:02:38 +0200 Subject: convertertest: add tests for converting to QVariant --- tests/client/convertertest.cpp | 66 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 636c299..10c3b4c 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -43,6 +43,22 @@ private: }; Q_DECLARE_METATYPE(QGVariantType); +class QGVariant : public QObject +{ + Q_OBJECT +public: + QGVariant() : variant(NULL) {} + ~QGVariant() { if (variant) g_variant_unref(variant); } + QGVariant(GVariant *gv) : variant(g_variant_ref_sink(gv)) {} + QGVariant(const QGVariant &other) : variant(g_variant_ref_sink(other.variant)) {} + GVariant *gvariant() const { return variant; } + operator GVariant*() const { return variant; } + +private: + GVariant *variant; +}; +Q_DECLARE_METATYPE(QGVariant); + class ConverterTest : public QObject { Q_OBJECT @@ -55,8 +71,21 @@ private: result = g_variant_type_equal(g_variant_get_type(gv), type); if (!result) { qWarning() << "types are different: QVariant:" << qv.typeName() - << "Result:" << (const char*) g_variant_get_type(gv) - << "Expected:"<< (const char*) type; + << "Result:" << g_variant_type_peek_string(g_variant_get_type(gv)) + << "Expected:"<< g_variant_type_peek_string(type); + } + g_variant_unref(gv); + return result; + } + bool compare(GVariant *gv, const QVariant::Type type) + { + g_variant_ref_sink(gv); + const QVariant& qv = Converter::toQVariant(gv); + bool result = (qv.type() == type); + if (!result) { + qWarning() << "types are different: GVariant:" << g_variant_type_peek_string(g_variant_get_type(gv)) + << "Result:" << qv.type() + << "Expected:"<< type; } g_variant_unref(gv); return result; @@ -71,8 +100,8 @@ private: result = g_variant_type_equal(g_variant_get_type(gv), expected_type); if (!result) { qWarning() << "types are different: QVariant:" << qv.typeName() - << "Result:" << (const char*) g_variant_get_type(gv) - << "Expected:"<< (const char*) expected_type; + << "Result:" << g_variant_type_peek_string(g_variant_get_type(gv)) + << "Expected:"<< g_variant_type_peek_string(expected_type); } g_variant_unref(gv); return result; @@ -193,6 +222,35 @@ private Q_SLOTS: QVERIFY(compareWithSchema(value, schema)); } + /* + * Test converter GVariant to QVariant + */ + + void testConvertToQVariant_data() + { + QTest::addColumn("value"); + QTest::addColumn("expectedType"); + + QTest::newRow("Boolean") << QGVariant(g_variant_new_boolean(TRUE)) << (unsigned) QVariant::Bool; + QTest::newRow("Byte") << QGVariant(g_variant_new_byte(53)) << (unsigned) QMetaType::UChar; + QTest::newRow("Int16") << QGVariant(g_variant_new_int16(-53)) << (unsigned) QMetaType::Short; + QTest::newRow("UInt16") << QGVariant(g_variant_new_uint16(53)) << (unsigned) QMetaType::UShort; + QTest::newRow("Int32") << QGVariant(g_variant_new_int32(-53)) << (unsigned) QVariant::Int; + QTest::newRow("UInt32") << QGVariant(g_variant_new_uint32(53)) << (unsigned) QVariant::UInt; + QTest::newRow("Int64") << QGVariant(g_variant_new_int64(-53)) << (unsigned) QVariant::LongLong; + QTest::newRow("UInt64") << QGVariant(g_variant_new_uint64(53)) << (unsigned) QVariant::ULongLong; + QTest::newRow("Double") << QGVariant(g_variant_new_double(53.3)) << (unsigned) QVariant::Double; + QTest::newRow("String") << QGVariant(g_variant_new_string("53")) << (unsigned) QVariant::String; + } + + void testConvertToQVariant() + { + QFETCH(QGVariant, value); + QFETCH(unsigned, expectedType); + + QVERIFY(compare(value, (QVariant::Type) expectedType)); + } + }; QTEST_MAIN(ConverterTest) -- cgit v1.2.3 From 3bcc60fe180a27a63ccc7a4b0635454316e37748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 24 Oct 2016 21:13:30 +0200 Subject: converterTest: add tests for toQVariantFromVariantString --- tests/client/convertertest.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 10c3b4c..fe72181 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -251,6 +251,32 @@ private Q_SLOTS: QVERIFY(compare(value, (QVariant::Type) expectedType)); } + void testConvertToQVariantFromString_data() + { + QTest::addColumn("value"); + QTest::addColumn("expectedType"); + + QTest::newRow("Boolean") << "true" << (unsigned) QVariant::Bool; + QTest::newRow("Byte") << "byte 0xFF" << (unsigned) QMetaType::UChar; + QTest::newRow("Int16") << "int16 65" << (unsigned) QMetaType::Short; + QTest::newRow("UInt16") << "uint16 65" << (unsigned) QMetaType::UShort; + QTest::newRow("Int32") << "int32 65" << (unsigned) QVariant::Int; + QTest::newRow("UInt32") << "uint32 65" << (unsigned) QVariant::UInt; + QTest::newRow("Int64") << "int64 65" << (unsigned) QVariant::LongLong; + QTest::newRow("UInt64") << "uint64 65" << (unsigned) QVariant::ULongLong; + QTest::newRow("Double") << "double 65" << (unsigned) QVariant::Double; + QTest::newRow("String") << "string '65'" << (unsigned) QVariant::String; + QTest::newRow("String simple") << "\"65\"" << (unsigned) QVariant::String; + } + + void testConvertToQVariantFromString() + { + QFETCH(QString, value); + QFETCH(unsigned, expectedType); + + QCOMPARE(Converter::toQVariantFromVariantString(value).type(), (QVariant::Type) expectedType); + } + }; QTEST_MAIN(ConverterTest) -- cgit v1.2.3 From 3509321d765b02355e3e207050bb137b48eade44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 24 Oct 2016 21:21:48 +0200 Subject: Add conversion tests for maps and lists to QVariant --- tests/client/convertertest.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index fe72181..1a3bce8 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -241,6 +241,16 @@ private Q_SLOTS: QTest::newRow("UInt64") << QGVariant(g_variant_new_uint64(53)) << (unsigned) QVariant::ULongLong; QTest::newRow("Double") << QGVariant(g_variant_new_double(53.3)) << (unsigned) QVariant::Double; QTest::newRow("String") << QGVariant(g_variant_new_string("53")) << (unsigned) QVariant::String; + + GVariantBuilder* builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); + g_variant_builder_add(builder, "{sv}", "fooo", g_variant_new_variant(g_variant_new_int64(53))); + QTest::newRow("Map") << QGVariant(g_variant_new("a{sv}", builder)) << (unsigned) QVariant::Map; + g_variant_builder_unref(builder); + + builder = g_variant_builder_new(G_VARIANT_TYPE("ai")); + g_variant_builder_add(builder, "i", g_variant_new_int32(53)); + QTest::newRow("List") << QGVariant(g_variant_new("ai", builder)) << (unsigned) QVariant::List; + g_variant_builder_unref(builder); } void testConvertToQVariant() @@ -267,6 +277,8 @@ private Q_SLOTS: QTest::newRow("Double") << "double 65" << (unsigned) QVariant::Double; QTest::newRow("String") << "string '65'" << (unsigned) QVariant::String; QTest::newRow("String simple") << "\"65\"" << (unsigned) QVariant::String; + QTest::newRow("Map") << "{'foo': <65>}" << (unsigned) QVariant::Map; + QTest::newRow("List") << "[65, 66]" << (unsigned) QVariant::List; } void testConvertToQVariantFromString() -- cgit v1.2.3 From c314929116d21057b5fae27c4a929c75d17d6183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 25 Oct 2016 13:37:07 +0200 Subject: ConverterTest: add checks for tuples and lists --- tests/client/convertertest.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 1a3bce8..cd791c7 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -132,6 +132,7 @@ private Q_SLOTS: QTest::newRow("String") << QVariant(QString("42")) << QGVariantType(G_VARIANT_TYPE_STRING); QTest::newRow("ByteArray") << QVariant(QByteArray("42")) << QGVariantType(G_VARIANT_TYPE_BYTESTRING); QTest::newRow("Map") << QVariant(QVariantMap()) << QGVariantType(G_VARIANT_TYPE_VARDICT); + QTest::newRow("List") << QVariant(QVariantList()) << QGVariantType(G_VARIANT_TYPE_UNIT); } void testConvertToGVariant() @@ -241,6 +242,7 @@ private Q_SLOTS: QTest::newRow("UInt64") << QGVariant(g_variant_new_uint64(53)) << (unsigned) QVariant::ULongLong; QTest::newRow("Double") << QGVariant(g_variant_new_double(53.3)) << (unsigned) QVariant::Double; QTest::newRow("String") << QGVariant(g_variant_new_string("53")) << (unsigned) QVariant::String; + QTest::newRow("Tuple") << QGVariant(g_variant_new("(si)", "foo", 53)) << (unsigned) QVariant::List; GVariantBuilder* builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); g_variant_builder_add(builder, "{sv}", "fooo", g_variant_new_variant(g_variant_new_int64(53))); @@ -279,6 +281,7 @@ private Q_SLOTS: QTest::newRow("String simple") << "\"65\"" << (unsigned) QVariant::String; QTest::newRow("Map") << "{'foo': <65>}" << (unsigned) QVariant::Map; QTest::newRow("List") << "[65, 66]" << (unsigned) QVariant::List; + QTest::newRow("Tuple") << "('foo', 65)" << (unsigned) QVariant::List; } void testConvertToQVariantFromString() -- cgit v1.2.3 From 6d2076c889b4d914672e2bbfd1c218252b9ed1cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 25 Oct 2016 16:50:59 +0200 Subject: Converter: add support to String Arrays --- libqmenumodel/src/converter.cpp | 23 +++++++++++++++++++++-- tests/client/convertertest.cpp | 3 +++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 1b63272..e2a31c0 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012 Canonical Ltd. + * Copyright 2012-2016 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -15,6 +15,7 @@ * * Authors: * Renato Araujo Oliveira Filho + * Marco Trevisan */ extern "C" { @@ -58,6 +59,14 @@ QVariant Converter::toQVariant(GVariant *value) gsize size = 0; const gchar *v = g_variant_get_string(value, &size); result.setValue(QString::fromUtf8(v, size)); + } else if (g_variant_type_equal(type, G_VARIANT_TYPE_STRING_ARRAY)) { + gsize size = 0; + const gchar **sa = g_variant_get_strv(value, &size); + QStringList list; + for (gsize i = 0; i < size; ++i) { + list << QString::fromUtf8(sa[i]); + } + result.setValue(list); } else if (g_variant_type_equal(type, G_VARIANT_TYPE_BYTESTRING)) { gsize size = 0; gchar *bs = g_variant_dup_bytestring(value, &size); @@ -124,7 +133,6 @@ QVariant Converter::toQVariant(GVariant *value) * G_VARIANT_TYPE_UNIT * G_VARIANT_TYPE_DICT_ENTRY * G_VARIANT_TYPE_DICTIONARY - * G_VARIANT_TYPE_STRING_ARRAY * G_VARIANT_TYPE_OBJECT_PATH_ARRAY */ @@ -238,6 +246,17 @@ GVariant* Converter::toGVariant(const QVariant &value) g_variant_builder_unref(b); break; } + case QVariant::StringList: + { + GVariantBuilder *b = g_variant_builder_new(G_VARIANT_TYPE_STRING_ARRAY); + + for (const QString &s : value.toStringList()) { + g_variant_builder_add(b, "s", s.toUtf8().data()); + } + result = g_variant_builder_end(b); + g_variant_builder_unref(b); + break; + } default: qWarning() << "QVariant type not supported:" << value.type(); } diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 45b104e..3bd1f74 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -131,6 +131,7 @@ private Q_SLOTS: QTest::newRow("UInt64") << QVariant::fromValue(42) << QGVariantType(G_VARIANT_TYPE_UINT64); QTest::newRow("Double") << QVariant((double)42.42) << QGVariantType(G_VARIANT_TYPE_DOUBLE); QTest::newRow("String") << QVariant(QString("42")) << QGVariantType(G_VARIANT_TYPE_STRING); + QTest::newRow("String List") << QVariant(QStringList({"42", "42"})) << QGVariantType(G_VARIANT_TYPE_STRING_ARRAY); QTest::newRow("ByteArray") << QVariant(QByteArray("42")) << QGVariantType(G_VARIANT_TYPE_BYTESTRING); QTest::newRow("Map") << QVariant(QVariantMap()) << QGVariantType(G_VARIANT_TYPE_VARDICT); QTest::newRow("Map Filled") << QVariant(QVariantMap({{"fooBar", 0xdeadbeef}})) << QGVariantType(G_VARIANT_TYPE_VARDICT); @@ -264,6 +265,7 @@ private Q_SLOTS: const gchar *byteArray[] = {"42", "53", NULL}; QTest::newRow("ByteArrayList") << QGVariant(g_variant_new_bytestring_array(byteArray, -1)) << (unsigned) QMetaType::QByteArrayList; + QTest::newRow("String List") << QGVariant(g_variant_new_strv(byteArray, -1)) << (unsigned) QVariant::StringList; } void testConvertToQVariant() @@ -290,6 +292,7 @@ private Q_SLOTS: QTest::newRow("Double") << "double 65" << (unsigned) QVariant::Double; QTest::newRow("String") << "string '65'" << (unsigned) QVariant::String; QTest::newRow("String simple") << "\"65\"" << (unsigned) QVariant::String; + QTest::newRow("String List") << "['foo', 'bar']" << (unsigned) QVariant::StringList; QTest::newRow("Byte string") << "b'fooo'" << (unsigned) QVariant::ByteArray; QTest::newRow("Map") << "{'foo': <65>}" << (unsigned) QVariant::Map; QTest::newRow("List") << "[65, 66]" << (unsigned) QVariant::List; -- cgit v1.2.3 From a4c1bb65572e613df99badc821c79a79764986f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 25 Oct 2016 16:58:28 +0200 Subject: converterTest: simplify metatype definitions --- tests/client/convertertest.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 3bd1f74..9e13ccb 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -28,13 +28,11 @@ extern "C" { #include #include -class QGVariantType : public QObject +class QGVariantType { - Q_OBJECT public: QGVariantType() : type(NULL) {} QGVariantType(const GVariantType *gvtype) : type(gvtype) {} - QGVariantType(const QGVariantType &other) : type(other.type) {} const GVariantType *getType() const { return type; } operator const GVariantType*() const { return type; } @@ -43,14 +41,13 @@ private: }; Q_DECLARE_METATYPE(QGVariantType); -class QGVariant : public QObject +class QGVariant { - Q_OBJECT public: QGVariant() : variant(NULL) {} ~QGVariant() { if (variant) g_variant_unref(variant); } QGVariant(GVariant *gv) : variant(g_variant_ref_sink(gv)) {} - QGVariant(const QGVariant &other) : variant(g_variant_ref_sink(other.variant)) {} + QGVariant(const QGVariant &other) : QGVariant(other.variant) {} GVariant *gvariant() const { return variant; } operator GVariant*() const { return variant; } -- cgit v1.2.3 From 307efb494989e3be1086731dc591c886d5f57583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 25 Oct 2016 19:57:38 +0200 Subject: UnityMenuModel: use conversion with gschema in unity actions --- libqmenumodel/src/unitymenumodel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index 5e8c8e3..695d053 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -692,6 +692,8 @@ void UnityMenuModel::activate(int index, const QVariant& parameter) { GSequenceIter *it; GtkMenuTrackerItem *item; + GVariant *value; + const GVariantType *parameter_type; it = g_sequence_get_iter_at_pos (priv->items, index); if (g_sequence_iter_is_end (it)) { @@ -707,7 +709,9 @@ void UnityMenuModel::activate(int index, const QVariant& parameter) gchar *action; action = gtk_menu_tracker_item_get_action_name (item); - g_action_group_activate_action (G_ACTION_GROUP (priv->muxer), action, Converter::toGVariant(parameter)); + parameter_type = g_action_group_get_action_parameter_type (G_ACTION_GROUP (priv->muxer), action); + value = Converter::toGVariantWithSchema(parameter, g_variant_type_peek_string (parameter_type)); + g_action_group_activate_action (G_ACTION_GROUP (priv->muxer), action, value); g_free (action); } else { -- cgit v1.2.3 From 0d1bfd69b848b2c86b48a3de198bc7dad9c96441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 25 Oct 2016 20:01:23 +0200 Subject: UnityMenuModel: avoid copy on assignment --- libqmenumodel/src/unitymenumodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index 695d053..aac1d92 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -661,7 +661,7 @@ bool UnityMenuModel::loadExtendedAttributes(int position, const QVariantMap &sch continue; } - QVariant qvalue = attributeToQVariant(value, type); + const QVariant &qvalue = attributeToQVariant(value, type); if (qvalue.isValid()) extendedAttrs->insert(qtify_name (name.toUtf8()), qvalue); else -- cgit v1.2.3 From 64ac22dc0d80ab3d44fe0fa08cbc517a5bc6b1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Tue, 25 Oct 2016 20:23:06 +0200 Subject: converter: use qUtf8Printable function --- libqmenumodel/src/converter.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index e2a31c0..a7c3adf 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -148,7 +148,7 @@ QVariant Converter::toQVariantFromVariantString(const QString &variantString) return QVariant(); } - gvariant = g_variant_parse (NULL, variantString.toUtf8().data(), NULL, NULL, &error); + gvariant = g_variant_parse (NULL, qUtf8Printable(variantString), NULL, NULL, &error); if (error) { qWarning() << "Impossible to parse" << variantString << "as variant string:"<< error->message; @@ -185,7 +185,7 @@ GVariant* Converter::toGVariant(const QVariant &value) result = g_variant_new_int64(value.toLongLong()); break; case QVariant::String: - result = g_variant_new_string(value.toString().toUtf8().data()); + result = g_variant_new_string(qUtf8Printable(value.toString())); break; case QVariant::UInt: result = g_variant_new_uint32(value.toUInt()); @@ -217,7 +217,7 @@ GVariant* Converter::toGVariant(const QVariant &value) QMapIterator i(value.toMap()); while (i.hasNext()) { i.next(); - g_variant_builder_add(b, "{sv}", i.key().toUtf8().data(), toGVariant(i.value())); + g_variant_builder_add(b, "{sv}", qUtf8Printable(i.key()), toGVariant(i.value())); } result = g_variant_builder_end(b); g_variant_builder_unref(b); @@ -251,7 +251,7 @@ GVariant* Converter::toGVariant(const QVariant &value) GVariantBuilder *b = g_variant_builder_new(G_VARIANT_TYPE_STRING_ARRAY); for (const QString &s : value.toStringList()) { - g_variant_builder_add(b, "s", s.toUtf8().data()); + g_variant_builder_add(b, "s", qUtf8Printable(s)); } result = g_variant_builder_end(b); g_variant_builder_unref(b); @@ -312,7 +312,7 @@ GVariant* Converter::toGVariantWithSchema(const QVariant &value, const char* sch } } else if (g_variant_type_equal(schema_type, G_VARIANT_TYPE_STRING)) { if (value.canConvert()) { - result = g_variant_new_string(value.toString().toUtf8().data()); + result = g_variant_new_string(qUtf8Printable(value.toString())); } } else if (g_variant_type_equal(schema_type, G_VARIANT_TYPE_VARIANT)) { result = Converter::toGVariant(value); -- cgit v1.2.3 From edfe13a5191e0df28575a7847e8ce94ac29a3e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 25 Oct 2016 20:29:53 +0200 Subject: converter: free the strv container --- libqmenumodel/src/converter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index a7c3adf..483e646 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -67,6 +67,7 @@ QVariant Converter::toQVariant(GVariant *value) list << QString::fromUtf8(sa[i]); } result.setValue(list); + g_free(sa); } else if (g_variant_type_equal(type, G_VARIANT_TYPE_BYTESTRING)) { gsize size = 0; gchar *bs = g_variant_dup_bytestring(value, &size); -- cgit v1.2.3 From fc52f8461996abd0b4f66d59360e870581f19d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 25 Oct 2016 20:38:43 +0200 Subject: converter: free schema type on destruction --- libqmenumodel/src/converter.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 483e646..cbf8076 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -272,8 +272,7 @@ GVariant* Converter::toGVariantWithSchema(const QVariant &value, const char* sch } GVariant* result = NULL; - const GVariantType* schema_type; - schema_type = g_variant_type_new(schema); + GVariantType* schema_type = g_variant_type_new(schema); if (g_variant_type_equal(schema_type, G_VARIANT_TYPE_BOOLEAN)) { if (value.canConvert()) { @@ -379,6 +378,9 @@ GVariant* Converter::toGVariantWithSchema(const QVariant &value, const char* sch if (!result) { result = Converter::toGVariant(value); } + + g_free(schema_type); + return result; } -- cgit v1.2.3 From eb6e5b591ec3972dad11656fff6bfa0597483c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 25 Oct 2016 20:55:34 +0200 Subject: converter: verify integer type conversions --- tests/client/convertertest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 9e13ccb..f1fd48e 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -180,9 +180,17 @@ private Q_SLOTS: QTest::addColumn("value"); QTest::addColumn("schema"); + // convert to byte + QTest::newRow("byte") << QVariant::fromValue(1) << "y"; + // convert to integer QTest::newRow("integer") << QVariant::fromValue(1) << "i"; QTest::newRow("integer from double") << QVariant::fromValue(1.1) << "i"; + QTest::newRow("int16") << QVariant::fromValue(-1) << "n"; + QTest::newRow("uint16") << QVariant::fromValue(1) << "q"; + QTest::newRow("uint32") << QVariant::fromValue(1) << "u"; + QTest::newRow("int64") << QVariant::fromValue(1) << "x"; + QTest::newRow("uint64") << QVariant::fromValue(1) << "t"; // convert to bool QTest::newRow("bool") << QVariant::fromValue(true) << "b"; -- cgit v1.2.3 From d56d0baefd53a8c7f3a9cd10fcaaeef1826e7d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 25 Oct 2016 20:56:40 +0200 Subject: converter: return a variant when the schema is a variant --- libqmenumodel/src/converter.cpp | 2 +- tests/client/convertertest.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index cbf8076..ff70803 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -315,7 +315,7 @@ GVariant* Converter::toGVariantWithSchema(const QVariant &value, const char* sch result = g_variant_new_string(qUtf8Printable(value.toString())); } } else if (g_variant_type_equal(schema_type, G_VARIANT_TYPE_VARIANT)) { - result = Converter::toGVariant(value); + result = g_variant_new_variant(Converter::toGVariant(value)); } else if (g_variant_type_equal(schema_type, G_VARIANT_TYPE_VARDICT)) { if (value.canConvert(QVariant::Map)) { result = Converter::toGVariant(value.toMap()); diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index f1fd48e..5492a02 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -192,6 +192,11 @@ private Q_SLOTS: QTest::newRow("int64") << QVariant::fromValue(1) << "x"; QTest::newRow("uint64") << QVariant::fromValue(1) << "t"; + // convert to variant + QTest::newRow("variant from int") << QVariant::fromValue(1) << "v"; + QTest::newRow("variant from double") << QVariant::fromValue(1.1) << "v"; + QTest::newRow("variant from string") << QVariant::fromValue("string") << "v"; + // convert to bool QTest::newRow("bool") << QVariant::fromValue(true) << "b"; QTest::newRow("bool from int") << QVariant::fromValue(1) << "b"; -- cgit v1.2.3 From e1ee47eaef71ffa0519843c5022d1d239512b866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 26 Oct 2016 14:28:59 +0200 Subject: converterTest: add conversion to GVariant and back to verify content is correct --- tests/client/convertertest.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index 5492a02..bc10f10 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -148,6 +148,24 @@ private Q_SLOTS: QVERIFY(compare(value, expectedType)); } + void testConvertToGVariantAndBack_data() + { + testConvertToGVariant_data(); + } + + void testConvertToGVariantAndBack() + { + QFETCH(QVariant, value); + QFETCH(QGVariantType, expectedType); + + GVariant *gv = Converter::toGVariant(value); + QVERIFY(gv != NULL); + + QCOMPARE(Converter::toQVariant(gv), value); + + g_variant_unref(gv); + } + void testTupleConversion() { QVariantList qTuple; -- cgit v1.2.3 From 210cae9ff99fc5bbb206b904c8c7bfa2736f503f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 26 Oct 2016 14:29:33 +0200 Subject: converter: properly set the QByteArray using ctor, or it will be created twice --- libqmenumodel/src/converter.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index ff70803..459e77f 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -69,10 +69,7 @@ QVariant Converter::toQVariant(GVariant *value) result.setValue(list); g_free(sa); } else if (g_variant_type_equal(type, G_VARIANT_TYPE_BYTESTRING)) { - gsize size = 0; - gchar *bs = g_variant_dup_bytestring(value, &size); - result.setValue(QByteArray::fromRawData(bs, size)); - g_free(bs); + result.setValue(QByteArray(g_variant_get_bytestring(value))); } else if (g_variant_type_equal(type, G_VARIANT_TYPE_BYTESTRING_ARRAY)) { gsize size = 0; const gchar **bsa = g_variant_get_bytestring_array(value, &size); -- cgit v1.2.3 From 352a7702cca19608712423e6ca2c91f491e79013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 26 Oct 2016 14:58:18 +0200 Subject: converterTest: add content conversions back and further from gvariant --- tests/client/convertertest.cpp | 44 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/tests/client/convertertest.cpp b/tests/client/convertertest.cpp index bc10f10..43127a7 100644 --- a/tests/client/convertertest.cpp +++ b/tests/client/convertertest.cpp @@ -156,7 +156,6 @@ private Q_SLOTS: void testConvertToGVariantAndBack() { QFETCH(QVariant, value); - QFETCH(QGVariantType, expectedType); GVariant *gv = Converter::toGVariant(value); QVERIFY(gv != NULL); @@ -291,6 +290,8 @@ private Q_SLOTS: QTest::newRow("List") << QGVariant(g_variant_new("ai", builder)) << (unsigned) QVariant::List; g_variant_builder_unref(builder); + QTest::newRow("Tuple") << QGVariant(g_variant_new("(i)", 53)) << (unsigned) QVariant::List; + const gchar *byteArray[] = {"42", "53", NULL}; QTest::newRow("ByteArrayList") << QGVariant(g_variant_new_bytestring_array(byteArray, -1)) << (unsigned) QMetaType::QByteArrayList; QTest::newRow("String List") << QGVariant(g_variant_new_strv(byteArray, -1)) << (unsigned) QVariant::StringList; @@ -304,6 +305,47 @@ private Q_SLOTS: QVERIFY(compare(value, (QVariant::Type) expectedType)); } + void testConvertToQVariantAndBack_data() + { + testConvertToQVariant_data(); + } + + void testConvertToQVariantAndBack() + { + QFETCH(QGVariant, value); + + QVariant qv = Converter::toQVariant(value); + QVERIFY(qv.isValid()); + + GVariant *gv = Converter::toGVariant(qv); + gboolean equals = g_variant_equal(value, gv); + + if (!equals && qv.type() == QVariant::List) { + QVERIFY(g_variant_type_is_array(g_variant_get_type(value))); + QVERIFY(g_variant_type_is_tuple(g_variant_get_type(gv))); + + gsize vsize = g_variant_n_children(value); + QCOMPARE(vsize, g_variant_n_children(gv)); + + for (gsize i = 0; i < vsize; ++i) { + equals = g_variant_equal(g_variant_get_child_value(value, i), g_variant_get_child_value(gv, i)); + if (!equals) + break; + } + } + + if (!equals) { + gchar *vs = g_variant_print(value, TRUE); + gchar *gvs = g_variant_print(gv, TRUE); + qWarning() << "Values do not match. Old" << vs << "converted" << gvs; + g_free(vs); + g_free(gvs); + } + + g_variant_unref(gv); + QVERIFY(equals != FALSE); + } + void testConvertToQVariantFromString_data() { QTest::addColumn("value"); -- cgit v1.2.3 From 24f649fed3630e9fbb3c24140dde1b4f9018f4aa Mon Sep 17 00:00:00 2001 From: Bileto Bot Date: Wed, 26 Oct 2016 17:28:36 +0000 Subject: Releasing 0.2.10+17.04.20161026.2-0ubuntu1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 37c0c3e..e050d43 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -qmenumodel (0.2.10) UNRELEASED; urgency=medium +qmenumodel (0.2.10+17.04.20161026.2-0ubuntu1) zesty; urgency=medium * Add ability to activate or change state of an action by variant string - -- Marco Trevisan (Treviño) Fri, 14 Oct 2016 17:07:41 +0200 + -- Marco Trevisan (Treviño) Wed, 26 Oct 2016 17:28:36 +0000 qmenumodel (0.2.9+16.04.20160329-0ubuntu1) xenial; urgency=medium -- cgit v1.2.3 From 89f2b36ed993aead5599d937f0d870db1321b9e1 Mon Sep 17 00:00:00 2001 From: Bileto Bot Date: Wed, 16 Nov 2016 10:42:18 +0000 Subject: Releasing 0.2.10+17.04.20161116-0ubuntu1 --- debian/changelog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/debian/changelog b/debian/changelog index e050d43..75a16d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +qmenumodel (0.2.10+17.04.20161116-0ubuntu1) zesty; urgency=medium + + [ Florian Boucault ] + * Crossbuilding fixes. + + [ Marco Trevisan (Treviño) ] + * converter: cleanup and add support for more variant types + + -- Marco Trevisan (Treviño) Wed, 16 Nov 2016 10:42:17 +0000 + qmenumodel (0.2.10+17.04.20161026.2-0ubuntu1) zesty; urgency=medium * Add ability to activate or change state of an action by variant string -- cgit v1.2.3