From d23a290dae52eec26bb4fd772168f38bd6e59f4e Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Thu, 13 Jan 2022 12:51:32 +0100 Subject: Fix all build warnings --- libqmenumodel/src/ayatanamenuaction.cpp | 7 ++++--- libqmenumodel/src/ayatanamenumodel.cpp | 8 ++++---- libqmenumodel/src/ayatanamenumodelevents.cpp | 6 ++++-- libqmenumodel/src/converter.cpp | 27 ++++++++++++++------------- tests/client/actiongrouptest.cpp | 8 +++++--- tests/script/dbusmenuscript.h | 4 +++- 6 files changed, 34 insertions(+), 26 deletions(-) diff --git a/libqmenumodel/src/ayatanamenuaction.cpp b/libqmenumodel/src/ayatanamenuaction.cpp index 7e13b35..72d65af 100644 --- a/libqmenumodel/src/ayatanamenuaction.cpp +++ b/libqmenumodel/src/ayatanamenuaction.cpp @@ -1,5 +1,6 @@ /* * Copyright 2013 Canonical Ltd. + * Copyright 2022 Robert Tari * * 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 @@ -13,7 +14,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * - * Authors: Nick Dedekind + * Authors: + * Nick Dedekind + * Robert Tari */ #include "ayatanamenuaction.h" @@ -148,8 +151,6 @@ bool AyatanaMenuAction::event(QEvent* e) setState(umasce->state); return true; } else if (e->type() == AyatanaMenuActionRemoveEvent::eventType) { - AyatanaMenuActionRemoveEvent *umare = static_cast(e); - setValid(false); return true; } diff --git a/libqmenumodel/src/ayatanamenumodel.cpp b/libqmenumodel/src/ayatanamenumodel.cpp index 2c735e6..39ce0bc 100644 --- a/libqmenumodel/src/ayatanamenumodel.cpp +++ b/libqmenumodel/src/ayatanamenumodel.cpp @@ -1,5 +1,6 @@ /* * Copyright 2013 Canonical Ltd. + * Copyright 2022 Robert Tari * * 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 @@ -13,7 +14,9 @@ * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * - * Authors: Lars Uebernickel + * Authors: + * Lars Uebernickel + * Robert Tari */ #include "ayatanamenumodel.h" @@ -270,12 +273,10 @@ void AyatanaMenuModelPrivate::menuItemChanged(GObject *object, GParamSpec *pspec { GSequenceIter *it = (GSequenceIter *) user_data; GtkMenuTrackerItem *item; - GtkActionObservable *muxer; AyatanaMenuModel *model; gint position; item = (GtkMenuTrackerItem *) g_sequence_get (it); - muxer = _gtk_menu_tracker_item_get_observable (item); model = (AyatanaMenuModel *) g_object_get_qdata (G_OBJECT (item), ayatana_menu_model_quark ()); position = g_sequence_iter_get_position (it); @@ -928,7 +929,6 @@ char * AyatanaMenuModelPrivate::fullActionName(AyatanaMenuAction *action) GSequenceIter *iter; QByteArray bytes; const gchar *name; - gchar *full_name = NULL; bytes = action->name().toUtf8(); name = bytes.constData(); diff --git a/libqmenumodel/src/ayatanamenumodelevents.cpp b/libqmenumodel/src/ayatanamenumodelevents.cpp index 357b6be..70f2cfc 100644 --- a/libqmenumodel/src/ayatanamenumodelevents.cpp +++ b/libqmenumodel/src/ayatanamenumodelevents.cpp @@ -1,5 +1,6 @@ /* * Copyright 2013 Canonical Ltd. + * Copyright 2022 Robert Tari * * 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 +16,7 @@ * * Authors: * Nicholas Dedekind */ #include @@ -39,7 +41,7 @@ AyatanaMenuModelAddRowEvent::AyatanaMenuModelAddRowEvent(GPtrArray *_items, int position(_position) { if (items) { - for (gint i = 0; i < items->len; ++i) + for (guint i = 0; i < items->len; ++i) g_object_ref(g_ptr_array_index(items, i)); g_ptr_array_ref(items); } @@ -48,7 +50,7 @@ AyatanaMenuModelAddRowEvent::AyatanaMenuModelAddRowEvent(GPtrArray *_items, int AyatanaMenuModelAddRowEvent::~AyatanaMenuModelAddRowEvent() { if (items) { - for (gint i = 0; i < items->len; ++i) + for (guint i = 0; i < items->len; ++i) g_object_unref(g_ptr_array_index(items, i)); g_ptr_array_unref(items); } diff --git a/libqmenumodel/src/converter.cpp b/libqmenumodel/src/converter.cpp index 49ced63..98757da 100644 --- a/libqmenumodel/src/converter.cpp +++ b/libqmenumodel/src/converter.cpp @@ -1,5 +1,6 @@ /* * Copyright 2012-2016 Canonical Ltd. + * Copyright 2022 Robert Tari * * 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 @@ -16,6 +17,7 @@ * Authors: * Renato Araujo Oliveira Filho * Marco Trevisan + * Robert Tari */ #include @@ -164,29 +166,29 @@ GVariant* Converter::toGVariant(const QVariant &value) if (value.isNull() || !value.isValid()) return result; - switch(value.type()) { - case QVariant::Bool: + switch((QMetaType::Type)value.type()) { + case QMetaType::Bool: result = g_variant_new_boolean(value.toBool()); break; - case QVariant::ByteArray: + case QMetaType::QByteArray: result = g_variant_new_bytestring(value.toByteArray()); break; - case QVariant::Double: + case QMetaType::Double: result = g_variant_new_double(value.toDouble()); break; - case QVariant::Int: + case QMetaType::Int: result = g_variant_new_int32(value.toInt()); break; - case QVariant::LongLong: + case QMetaType::LongLong: result = g_variant_new_int64(value.toLongLong()); break; - case QVariant::String: + case QMetaType::QString: result = g_variant_new_string(qUtf8Printable(value.toString())); break; - case QVariant::UInt: + case QMetaType::UInt: result = g_variant_new_uint32(value.toUInt()); break; - case QVariant::ULongLong: + case QMetaType::ULongLong: result = g_variant_new_uint64(value.toULongLong()); break; case QMetaType::UChar: @@ -204,10 +206,9 @@ GVariant* Converter::toGVariant(const QVariant &value) case QMetaType::ULong: result = g_variant_new_uint64(value.value()); break; - case QVariant::Map: + case QMetaType::QVariantMap: { GVariantBuilder *b; - GVariant *dict; b = g_variant_builder_new(G_VARIANT_TYPE_VARDICT); QMapIterator i(value.toMap()); @@ -231,7 +232,7 @@ GVariant* Converter::toGVariant(const QVariant &value) g_variant_builder_unref(b); break; } - case QVariant::List: + case QMetaType::QVariantList: { GVariantBuilder *b = g_variant_builder_new(G_VARIANT_TYPE_TUPLE); @@ -242,7 +243,7 @@ GVariant* Converter::toGVariant(const QVariant &value) g_variant_builder_unref(b); break; } - case QVariant::StringList: + case QMetaType::QStringList: { GVariantBuilder *b = g_variant_builder_new(G_VARIANT_TYPE_STRING_ARRAY); diff --git a/tests/client/actiongrouptest.cpp b/tests/client/actiongrouptest.cpp index 3ab329c..f2621eb 100644 --- a/tests/client/actiongrouptest.cpp +++ b/tests/client/actiongrouptest.cpp @@ -1,5 +1,6 @@ /* * Copyright 2012 Canonical Ltd. + * Copyright 2022 Robert Tari * * 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 +16,7 @@ * * Authors: * Renato Araujo Oliveira Filho + * Robert Tari */ #include "qdbusmenumodel.h" @@ -138,7 +140,7 @@ private Q_SLOTS: void testActionName() { - QStateAction *act; + QStateAction *act = nullptr; getMenuAction(&act, 1); QCOMPARE(act->property("name").toString(), QString("Menu1Act")); } @@ -148,7 +150,7 @@ private Q_SLOTS: */ void testStringActionActivation() { - QStateAction *act; + QStateAction *act = nullptr; getMenuAction(&act, 1); act->activate(QVariant("42")); @@ -162,7 +164,7 @@ private Q_SLOTS: void testStringActionActivationByVariantString() { - QStateAction *act; + QStateAction *act = nullptr; getMenuAction(&act, 1); act->activateByVariantString("\"53\""); diff --git a/tests/script/dbusmenuscript.h b/tests/script/dbusmenuscript.h index 03c5ad3..ff6119d 100644 --- a/tests/script/dbusmenuscript.h +++ b/tests/script/dbusmenuscript.h @@ -1,5 +1,6 @@ /* * Copyright 2012 Canonical Ltd. + * Copyright 2022 Robert Tari * * 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,10 +16,11 @@ * * Authors: * Renato Araujo Oliveira Filho + * Robert Tari */ #ifndef DBUSMENUSCRIPT_H -#define DBUSMENUSCRITP_H +#define DBUSMENUSCRIPT_H #include #include -- cgit v1.2.3