diff options
author | Mathias Hasselmann <mathias.hasselmann@kdab.com> | 2013-11-03 11:09:18 +0100 |
---|---|---|
committer | Mathias Hasselmann <mathias.hasselmann@kdab.com> | 2013-11-03 11:09:18 +0100 |
commit | 6e887d4410690f248fc89801969afda40c4af66d (patch) | |
tree | fc1fdf58270d777688a074fbf06fcf7bb76b2889 | |
parent | a9c9cac38edfdaa7b1cbf67a0c867281a2fe4760 (diff) |
Rename Object class to Item
-rw-r--r-- | src/QuickStreamer/QuickStreamer.pro | 4 | ||||
-rw-r--r-- | src/QuickStreamer/item.cpp (renamed from src/QuickStreamer/object.cpp) | 50 | ||||
-rw-r--r-- | src/QuickStreamer/item.h (renamed from src/QuickStreamer/object.h) | 16 | ||||
-rw-r--r-- | src/QuickStreamer/metapads.h | 2 | ||||
-rw-r--r-- | src/QuickStreamer/plugin.cpp | 4 | ||||
-rw-r--r-- | src/Tools/makemetapads.cpp | 34 | ||||
-rw-r--r-- | tests/tst_metaobject/tst_metaobjecttest.cpp | 12 |
7 files changed, 61 insertions, 61 deletions
diff --git a/src/QuickStreamer/QuickStreamer.pro b/src/QuickStreamer/QuickStreamer.pro index f96b2c9..68095f2 100644 --- a/src/QuickStreamer/QuickStreamer.pro +++ b/src/QuickStreamer/QuickStreamer.pro @@ -10,12 +10,12 @@ PKGCONFIG += gstreamer-1.0 SOURCES = \ metapads.cpp \ plugin.cpp \ - object.cpp + item.cpp HEADERS = \ metapads.h \ plugin.h \ - object.h + item.h DEPLOY_FILES = \ qmldir diff --git a/src/QuickStreamer/object.cpp b/src/QuickStreamer/item.cpp index 1e0746e..f710f04 100644 --- a/src/QuickStreamer/object.cpp +++ b/src/QuickStreamer/item.cpp @@ -1,4 +1,4 @@ -#include "object.h" +#include "item.h" #include "metapads.h" #include <gst/gst.h> @@ -371,8 +371,8 @@ struct TypeInfo g_type_class_unref(gobject_class); - typedef QtMetaTypePrivate::QMetaTypeFunctionHelper<Object> MetaTypeHelper; - static const QMetaType::TypeFlags typeFlags(QtPrivate::QMetaTypeTypeFlags<Object>::Flags); + typedef QtMetaTypePrivate::QMetaTypeFunctionHelper<Item> MetaTypeHelper; + static const QMetaType::TypeFlags typeFlags(QtPrivate::QMetaTypeTypeFlags<Item>::Flags); typeInfo->metaObject = objectBuilder.toMetaObject(); typeInfo->elementName = objectBuilder.className().mid(3); @@ -382,7 +382,7 @@ struct TypeInfo metaTypePads.create, MetaTypeHelper::Destruct, metaTypePads.construct, - sizeof(Object), + sizeof(Item), typeFlags, typeInfo->metaObject); @@ -398,19 +398,19 @@ struct TypeInfo typeId, 0 /*qRegisterNormalizedMetaType<QQmlListProperty<T> >(listName.constData())*/, - sizeof(Object), metaTypePads.createInto, + sizeof(Item), metaTypePads.createInto, QString(), NAMESPACE_URI, MAJOR_VERSION, MINOR_VERSION, typeInfo->elementName, typeInfo->metaObject, - QQmlPrivate::attachedPropertiesFunc<Object>(), - QQmlPrivate::attachedPropertiesMetaObject<Object>(), + QQmlPrivate::attachedPropertiesFunc<Item>(), + QQmlPrivate::attachedPropertiesMetaObject<Item>(), - QQmlPrivate::StaticCastSelector<Object, QQmlParserStatus>::cast(), - QQmlPrivate::StaticCastSelector<Object, QQmlPropertyValueSource>::cast(), - QQmlPrivate::StaticCastSelector<Object, QQmlPropertyValueInterceptor>::cast(), + QQmlPrivate::StaticCastSelector<Item, QQmlParserStatus>::cast(), + QQmlPrivate::StaticCastSelector<Item, QQmlPropertyValueSource>::cast(), + QQmlPrivate::StaticCastSelector<Item, QQmlPropertyValueInterceptor>::cast(), 0, 0, @@ -476,7 +476,7 @@ struct TypeInfo return id - properties.size(); } - void emitPropertyChanged(Object *object, const GParamSpec *pspec) const + void emitPropertyChanged(Item *object, const GParamSpec *pspec) const { for (int i = 0; i < properties.size(); ++i) { // can compare by pointer because GParamSpec::name is interned @@ -505,43 +505,43 @@ QHash<GType, TypeInfo *> TypeInfo::cache; using Private::TypeInfo; using Private::toCamelCase; -Object::Object(GstObject *target, QObject *parent) +Item::Item(GstObject *target, QObject *parent) : QObject(parent) , m_target(target) { Q_ASSERT(m_target != Q_NULLPTR); g_object_ref_sink(m_target); - g_signal_connect_swapped(target, "notify", reinterpret_cast<GCallback>(&Object::emitPropertyChanged), this); + g_signal_connect_swapped(target, "notify", reinterpret_cast<GCallback>(&Item::emitPropertyChanged), this); } -Object::Object(const Object &other) +Item::Item(const Item &other) : QObject(other.parent()) , m_target(static_cast<GstObject *>(g_object_ref(other.m_target))) { } -Object::~Object() +Item::~Item() { g_object_unref(m_target); } -bool Object::registerElementFactory(GstElementFactory *factory) +bool Item::registerElementFactory(GstElementFactory *factory) { return TypeInfo::find(factory) != Q_NULLPTR; } -bool Object::registerObjectClass(GType type) +bool Item::registerObjectClass(GType type) { return TypeInfo::find(type) != Q_NULLPTR; } -const QMetaObject *Object::metaObject() const +const QMetaObject *Item::metaObject() const { return TypeInfo::find(G_OBJECT_TYPE(m_target))->metaObject; } -void *Object::qt_metacast(const char *className) +void *Item::qt_metacast(const char *className) { qDebug("%s: %s %p", Q_FUNC_INFO, className, this); @@ -556,7 +556,7 @@ void *Object::qt_metacast(const char *className) return QObject::qt_metacast(className); } -int Object::qt_metacall(QMetaObject::Call call, int id, void **args) +int Item::qt_metacall(QMetaObject::Call call, int id, void **args) { qDebug("%s: %d(%d)", Q_FUNC_INFO, call, id); id = QObject::qt_metacall(call, id, args); @@ -590,31 +590,31 @@ int Object::qt_metacall(QMetaObject::Call call, int id, void **args) return id; } -void Object::classBegin() +void Item::classBegin() { Q_ASSERT(parent() != Q_NULLPTR); qDebug() << Q_FUNC_INFO << metaObject()->className() << parent()->children(); } -void Object::componentComplete() +void Item::componentComplete() { Q_ASSERT(parent() != Q_NULLPTR); qDebug() << Q_FUNC_INFO << metaObject()->className() << parent()->children(); } -int Object::readProperty(int id, QVariant *value) +int Item::readProperty(int id, QVariant *value) { const auto *const typeInfo = TypeInfo::find(G_OBJECT_TYPE(m_target)); return typeInfo->readProperty(m_target, id, value); } -int Object::writeProperty(int id, const void *value) +int Item::writeProperty(int id, const void *value) { const auto *const typeInfo = TypeInfo::find(G_OBJECT_TYPE(m_target)); return typeInfo->writeProperty(m_target, id, value); } -void Object::emitPropertyChanged(Object *self, GParamSpec *pspec) +void Item::emitPropertyChanged(Item *self, GParamSpec *pspec) { const auto *const typeInfo = TypeInfo::find(G_OBJECT_TYPE(self->m_target)); typeInfo->emitPropertyChanged(self, pspec); diff --git a/src/QuickStreamer/object.h b/src/QuickStreamer/item.h index 36153dc..beff427 100644 --- a/src/QuickStreamer/object.h +++ b/src/QuickStreamer/item.h @@ -1,5 +1,5 @@ -#ifndef QQUICKSTREAMER_OBJECT_H -#define QQUICKSTREAMER_OBJECT_H +#ifndef QQUICKSTREAMER_ITEM_H +#define QQUICKSTREAMER_ITEM_H #include <QObject> #include <QQmlParserStatus> @@ -11,17 +11,17 @@ typedef struct _GstObject GstObject; namespace QQuickStreamer { -class Object : public QObject, public QQmlParserStatus +class Item : public QObject, public QQmlParserStatus { public: Q_OBJECT_CHECK Q_INTERFACES(QQmlParserStatus) - explicit Object(GstObject *target, QObject *parent = Q_NULLPTR); - Object(const Object &other); + explicit Item(GstObject *target, QObject *parent = Q_NULLPTR); + Item(const Item &other); - ~Object(); + ~Item(); static bool registerElementFactory(GstElementFactory *factory); static bool registerObjectClass(GType type); @@ -36,7 +36,7 @@ public: protected: int readProperty(int id, QVariant *value); int writeProperty(int id, const void *value); - static void emitPropertyChanged(Object *self, GParamSpec *pspec); + static void emitPropertyChanged(Item *self, GParamSpec *pspec); private: GstObject *const m_target; @@ -44,4 +44,4 @@ private: } // namespace QQuickStreamer -#endif // QQUICKSTREAMEROBJECT_H +#endif // QQUICKSTREAMER_ITEM_H diff --git a/src/QuickStreamer/metapads.h b/src/QuickStreamer/metapads.h index b6cf3f3..ee16485 100644 --- a/src/QuickStreamer/metapads.h +++ b/src/QuickStreamer/metapads.h @@ -1,4 +1,4 @@ -#include "object.h" +#include "item.h" namespace QQuickStreamer { namespace Private { diff --git a/src/QuickStreamer/plugin.cpp b/src/QuickStreamer/plugin.cpp index 23307c2..be65cbe 100644 --- a/src/QuickStreamer/plugin.cpp +++ b/src/QuickStreamer/plugin.cpp @@ -1,5 +1,5 @@ #include "plugin.h" -#include "object.h" +#include "item.h" #include <gst/gst.h> @@ -31,7 +31,7 @@ void Plugin::registerTypes(const char *uri) for (auto *l = elements; l; l = l->next) { auto *const feature = GST_PLUGIN_FEATURE(l->data); auto *const factory = GST_ELEMENT_FACTORY(gst_plugin_feature_load(feature)); - Object::registerElementFactory(factory); + Item::registerElementFactory(factory); g_object_unref(factory); } diff --git a/src/Tools/makemetapads.cpp b/src/Tools/makemetapads.cpp index 75587a0..16dfba6 100644 --- a/src/Tools/makemetapads.cpp +++ b/src/Tools/makemetapads.cpp @@ -31,7 +31,7 @@ int main(int argc, char **argv) QTextStream out(stdout); out << "#include \"metapads.h\"" << endl - << "#include \"object.h\"" << endl + << "#include \"item.h\"" << endl << "#include <gst/gst.h>" << endl << "#include <QVector>" << endl << endl @@ -44,19 +44,19 @@ int main(int argc, char **argv) << "static void *createObject(int which, const void *t) Q_DECL_NOEXCEPT" << endl << "{" << endl << " if (t)" << endl - << " return new Object(*static_cast<const Object*>(t));" << endl + << " return new Item(*static_cast<const Item*>(t));" << endl << endl << " const auto type = objectTypes.at(which);" << endl - << " return new Object(GST_OBJECT(g_object_newv(type, 0, Q_NULLPTR)));" << endl + << " return new Item(GST_OBJECT(g_object_newv(type, 0, Q_NULLPTR)));" << endl << "}" << endl << endl << "static void *constructObject(int which, void *where, const void *t) Q_DECL_NOEXCEPT" << endl << "{" << endl << " if (t)" << endl - << " return new(where) Object(*static_cast<const Object*>(t));" << endl + << " return new(where) Item(*static_cast<const Item*>(t));" << endl << endl << " const auto type = objectTypes.at(which);" << endl - << " return new(where) Object(GST_OBJECT(g_object_newv(type, 0, Q_NULLPTR)));" << endl + << " return new(where) Item(GST_OBJECT(g_object_newv(type, 0, Q_NULLPTR)));" << endl << "}" << endl << endl; @@ -83,19 +83,19 @@ int main(int argc, char **argv) out << "static void *createObject" << i << "(const void *t) Q_DECL_NOEXCEPT" << endl << "{" << endl << " if (t)" << endl - << " return new Object(*static_cast<const Object*>(t));" << endl + << " return new Item(*static_cast<const Item*>(t));" << endl << endl << " const auto type = objectTypes.at(" << i << ");" << endl - << " return new Object(GST_OBJECT(g_object_newv(type, 0, Q_NULLPTR)));" << endl + << " return new Item(GST_OBJECT(g_object_newv(type, 0, Q_NULLPTR)));" << endl << "}" << endl << endl << "static void *constructObject" << i << "(void *where, const void *t) Q_DECL_NOEXCEPT" << endl << "{" << endl << " if (t)" << endl - << " return new(where) Object(*static_cast<const Object*>(t));" << endl + << " return new(where) Item(*static_cast<const Item*>(t));" << endl << endl << " const auto type = objectTypes.at(" << i << ");" << endl - << " return new(where) Object(GST_OBJECT(g_object_newv(type, 0, Q_NULLPTR)));" << endl + << " return new(where) Item(GST_OBJECT(g_object_newv(type, 0, Q_NULLPTR)));" << endl << "}" << endl << endl; } @@ -127,21 +127,21 @@ int main(int argc, char **argv) out << "static void *createElement(int which, const void *t) Q_DECL_NOEXCEPT" << endl << "{" << endl << " if (t)" << endl - << " return new Object(*static_cast<const Object*>(t));" << endl + << " return new Item(*static_cast<const Item*>(t));" << endl << endl << " auto *const factory = elementFactories.at(which);" << endl << " auto *const element = gst_element_factory_create(factory, Q_NULLPTR);" << endl - << " return new Object(GST_OBJECT(element));" << endl + << " return new Item(GST_OBJECT(element));" << endl << "}" << endl << endl << "static void *constructElement(int which, void *where, const void *t) Q_DECL_NOEXCEPT" << endl << "{" << endl << " if (t)" << endl - << " return new(where) Object(*static_cast<const Object*>(t));" << endl + << " return new(where) Item(*static_cast<const Item*>(t));" << endl << endl << " auto *const factory = elementFactories.at(which);" << endl << " auto *const element = gst_element_factory_create(factory, Q_NULLPTR);" << endl - << " return new(where) Object(GST_OBJECT(element));" << endl + << " return new(where) Item(GST_OBJECT(element));" << endl << "}" << endl << endl; @@ -168,21 +168,21 @@ int main(int argc, char **argv) out << "static void *createElement" << i << "(const void *t) Q_DECL_NOEXCEPT" << endl << "{" << endl << " if (t)" << endl - << " return new Object(*static_cast<const Object*>(t));" << endl + << " return new Item(*static_cast<const Item*>(t));" << endl << endl << " auto *const factory = elementFactories.at(" << i << ");" << endl << " auto *const element = gst_element_factory_create(factory, Q_NULLPTR);" << endl - << " return new Object(GST_OBJECT(element));" << endl + << " return new Item(GST_OBJECT(element));" << endl << "}" << endl << endl << "static void *constructElement" << i << "(void *where, const void *t) Q_DECL_NOEXCEPT" << endl << "{" << endl << " if (t)" << endl - << " return new(where) Object(*static_cast<const Object*>(t));" << endl + << " return new(where) Item(*static_cast<const Item*>(t));" << endl << endl << " auto *const factory = elementFactories.at(" << i << ");" << endl << " auto *const element = gst_element_factory_create(factory, Q_NULLPTR);" << endl - << " return new(where) Object(GST_OBJECT(element));" << endl + << " return new(where) Item(GST_OBJECT(element));" << endl << "}" << endl << endl; } diff --git a/tests/tst_metaobject/tst_metaobjecttest.cpp b/tests/tst_metaobject/tst_metaobjecttest.cpp index 9a85e03..cfd9c29 100644 --- a/tests/tst_metaobject/tst_metaobjecttest.cpp +++ b/tests/tst_metaobject/tst_metaobjecttest.cpp @@ -1,4 +1,4 @@ -#include "QuickStreamer/object.h" +#include "QuickStreamer/item.h" #include <gst/gst.h> @@ -6,7 +6,7 @@ #include <QQmlParserStatus> #include <QtTest> -using QQuickStreamer::Object; +using QQuickStreamer::Item; class MetaObjectTest : public QObject { @@ -21,18 +21,18 @@ private slots: void init() { gst_init(Q_NULLPTR, Q_NULLPTR); - QVERIFY(Object::registerObjectClass(GST_TYPE_PIPELINE)); + QVERIFY(Item::registerObjectClass(GST_TYPE_PIPELINE)); } void testClassName() { - Object item(GST_OBJECT(gst_pipeline_new(Q_NULLPTR))); + Item item(GST_OBJECT(gst_pipeline_new(Q_NULLPTR))); QCOMPARE(item.metaObject()->className(), "GstPipeline"); } void testProperties() { - Object item(GST_OBJECT(gst_pipeline_new(Q_NULLPTR))); + Item item(GST_OBJECT(gst_pipeline_new(Q_NULLPTR))); const int propertyIndex = item.metaObject()->indexOfProperty("name"); @@ -49,7 +49,7 @@ private slots: void testQObjectCast() { - Object item(GST_OBJECT(gst_pipeline_new(Q_NULLPTR))); + Item item(GST_OBJECT(gst_pipeline_new(Q_NULLPTR))); QCOMPARE(qobject_cast<QQmlParserStatus *>(&item), &item); } }; |