diff options
-rw-r--r-- | examples/player/main.cpp | 4 | ||||
-rw-r--r-- | src/QGlib/connectimpl.h | 18 | ||||
-rw-r--r-- | src/QGlib/emitimpl.h | 22 | ||||
-rw-r--r-- | src/QGlib/signal.cpp | 20 | ||||
-rw-r--r-- | src/QGlib/signal.h | 225 | ||||
-rw-r--r-- | src/QGst/Ui/videowidget.cpp | 8 | ||||
-rw-r--r-- | src/QGst/bus.cpp | 2 | ||||
-rw-r--r-- | tests/auto/bustest.cpp | 4 | ||||
-rw-r--r-- | tests/auto/signalstest.cpp | 19 |
9 files changed, 161 insertions, 161 deletions
diff --git a/examples/player/main.cpp b/examples/player/main.cpp index 54dfb1f..5992d90 100644 --- a/examples/player/main.cpp +++ b/examples/player/main.cpp @@ -65,7 +65,7 @@ Player::Player(const QString & fileName) QGst::ElementPtr decodebin = QGst::ElementFactory::make("decodebin2"); filesrc->setProperty("location", fileName); - QGlib::Signal::connect(decodebin, "new-decoded-pad", this, &Player::onNewDecodedPad); + QGlib::connect(decodebin, "new-decoded-pad", this, &Player::onNewDecodedPad); m_pipeline->add(filesrc); m_pipeline->add(decodebin); @@ -73,7 +73,7 @@ Player::Player(const QString & fileName) QGst::BusPtr bus = m_pipeline->bus(); bus->enableSyncMessageEmission(); - QGlib::Signal::connect(bus, "sync-message", this, &Player::onBusSyncMessage); + QGlib::connect(bus, "sync-message", this, &Player::onBusSyncMessage); m_pipeline->setState(QGst::StatePlaying); } diff --git a/src/QGlib/connectimpl.h b/src/QGlib/connectimpl.h index fac248f..023da11 100644 --- a/src/QGlib/connectimpl.h +++ b/src/QGlib/connectimpl.h @@ -217,11 +217,11 @@ struct CppClosure<F, R (Args...)> } //namespace Private -//BEGIN ******** Signal::connect ******** +//BEGIN ******** QGlib::connect ******** template <typename T, typename R, typename... Args> -SignalHandler Signal::connect(void *instance, const char *detailedSignal, - T *receiver, R (T::*slot)(Args...), ConnectFlags flags) +SignalHandler connect(void *instance, const char *detailedSignal, + T *receiver, R (T::*slot)(Args...), ConnectFlags flags) { typedef QGlib::Private::MemberFunction<T, R, Args...> F; @@ -230,7 +230,7 @@ SignalHandler Signal::connect(void *instance, const char *detailedSignal, return connect(instance, detailedSignal, closure, flags); } -//END ******** Signal::connect ******** +//END ******** QGlib::connect ******** } //namespace QGlib @@ -340,16 +340,16 @@ struct CppClosure<F, R (QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS)> } //namespace Private -//BEGIN ******** bostpp Signal::connect ******** +//BEGIN ******** bostpp QGlib::connect ******** # define QGLIB_SIGNAL_IMPL_BIND_ARGS \ BOOST_PP_COMMA_IF(QGLIB_SIGNAL_IMPL_NUM_ARGS) \ BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(QGLIB_SIGNAL_IMPL_NUM_ARGS), _) template <typename T, typename R QGLIB_SIGNAL_IMPL_TRAILING_TEMPLATE_PARAMS> -SignalHandler Signal::connect(void *instance, const char *detailedSignal, - T *receiver, R (T::*slot)(QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS), - ConnectFlags flags) +SignalHandler connect(void *instance, const char *detailedSignal, + T *receiver, R (T::*slot)(QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS), + ConnectFlags flags) { boost::function<R (QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS)> f = boost::bind(slot, receiver QGLIB_SIGNAL_IMPL_BIND_ARGS); @@ -364,7 +364,7 @@ SignalHandler Signal::connect(void *instance, const char *detailedSignal, # undef QGLIB_SIGNAL_IMPL_BIND_ARGS -//END ******** bostpp Signal::connect ******** +//END ******** bostpp QGlib::connect ******** } //namespace QGlib diff --git a/src/QGlib/emitimpl.h b/src/QGlib/emitimpl.h index 97340c3..87f0fa2 100644 --- a/src/QGlib/emitimpl.h +++ b/src/QGlib/emitimpl.h @@ -70,7 +70,7 @@ struct EmitImpl<R (Args...)> static inline R emit(void *instance, const char *detailedSignal, const Args & ... args) { try { - Value && returnValue = Signal::emit(instance, detailedSignal, packArguments(args...)); + Value && returnValue = QGlib::emit(instance, detailedSignal, packArguments(args...)); return ValueImpl<R>::get(returnValue); } catch(const std::exception & e) { qCritical() << "Error during emission of signal" << detailedSignal << ":" << e.what(); @@ -85,7 +85,7 @@ struct EmitImpl<void (Args...)> static inline void emit(void *instance, const char *detailedSignal, const Args & ... args) { try { - Value && returnValue = Signal::emit(instance, detailedSignal, packArguments(args...)); + Value && returnValue = QGlib::emit(instance, detailedSignal, packArguments(args...)); if (returnValue.isValid()) { qWarning() << "Ignoring return value from emission of signal" << detailedSignal; @@ -100,15 +100,15 @@ struct EmitImpl<void (Args...)> } //namespace Private -//BEGIN ******** Signal::emit ******** +//BEGIN ******** QGlib::emit ******** template <typename R, typename... Args> -R Signal::emit(void *instance, const char *detailedSignal, const Args & ... args) +R emit(void *instance, const char *detailedSignal, const Args & ... args) { return QGlib::Private::EmitImpl<R (Args...)>::emit(instance, detailedSignal, args...); } -//END ******** Signal::emit ******** +//END ******** QGlib::emit ******** } //namespace QGlib @@ -127,7 +127,7 @@ R Signal::emit(void *instance, const char *detailedSignal, const Args & ... args /* This part is included from BOOST_PP_ITERATE(). It defines specializations of struct EmitImpl with different number of arguments as well as the multiple implementations of the non-variadic - Signal::emit. This part is included multiple times (QGLIB_SIGNAL_MAX_ARGS defines how many), + QGlib::emit. This part is included multiple times (QGLIB_SIGNAL_MAX_ARGS defines how many), and each time it defines those classes and functions with different number of arguments. The concept is based on the implementation of boost::function. */ @@ -179,7 +179,7 @@ struct EmitImpl<R (QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS)> try { QList<Value> values; QGLIB_SIGNAL_IMPL_PACK_ARGS(values) - Value returnValue = Signal::emit(instance, detailedSignal, values); + Value returnValue = QGlib::emit(instance, detailedSignal, values); return ValueImpl<R>::get(returnValue); } catch(const std::exception & e) { qCritical() << "Error during emission of signal" << detailedSignal << ":" << e.what(); @@ -197,7 +197,7 @@ struct EmitImpl<void (QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS)> try { QList<Value> values; QGLIB_SIGNAL_IMPL_PACK_ARGS(values) - Value returnValue = Signal::emit(instance, detailedSignal, values); + Value returnValue = QGlib::emit(instance, detailedSignal, values); if (returnValue.isValid()) { qWarning() << "Ignoring return value from emission of signal" << detailedSignal; } @@ -214,16 +214,16 @@ struct EmitImpl<void (QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS)> } //namespace Private -//BEGIN ******** boostpp Signal::emit ******** +//BEGIN ******** boostpp QGlib::emit ******** template <typename R QGLIB_SIGNAL_IMPL_TRAILING_TEMPLATE_PARAMS> -R Signal::emit(void *instance, const char *detailedSignal QGLIB_SIGNAL_IMPL_FUNCTION_PARAMS) +R emit(void *instance, const char *detailedSignal QGLIB_SIGNAL_IMPL_FUNCTION_PARAMS) { return QGlib::Private::EmitImpl<R (QGLIB_SIGNAL_IMPL_TEMPLATE_ARGS)> ::emit(instance, detailedSignal QGLIB_SIGNAL_IMPL_FUNCTION_ARGS); } -//END ******** boostpp Signal::emit ******** +//END ******** boostpp QGlib::emit ******** } //namespace QGlib diff --git a/src/QGlib/signal.cpp b/src/QGlib/signal.cpp index b2a8406..513737b 100644 --- a/src/QGlib/signal.cpp +++ b/src/QGlib/signal.cpp @@ -148,10 +148,10 @@ QList<Signal> Signal::listSignals(Type type) } //END ******** Signal ******** -//BEGIN ******** Signal::emit ******** +//BEGIN ******** QGlib::emit ******** //static -Value Signal::emit(void *instance, const char *detailedSignal, const QList<Value> & args) +Value emit(void *instance, const char *detailedSignal, const QList<Value> & args) { Value result; Type itype = Type::fromInstance(instance); @@ -171,7 +171,7 @@ Value Signal::emit(void *instance, const char *detailedSignal, const QList<Value try { //find the signal and perform sanity checks - Signal signal = lookup(signalParts[0].toUtf8(), itype); + Signal signal = Signal::lookup(signalParts[0].toUtf8(), itype); if (!signal.isValid()) { throw QString(QLatin1String("Could not find any signal named %1 " "on this instance type")).arg(signalParts[0]); @@ -180,13 +180,13 @@ Value Signal::emit(void *instance, const char *detailedSignal, const QList<Value QList<Type> paramTypes = signal.paramTypes(); if (paramTypes.size() != args.size()) { throw QString(QLatin1String("The number of arguments that the signal accepts differ " - "from the number of arguments provided to Signal::emit")); + "from the number of arguments provided to emit")); } //set arguments for(int i=0; i<args.size(); i++) { if (!paramTypes[i].isA(args[i].type())) { - throw QString(QLatin1String("Argument %1 provided to Signal::emit is not of the " + throw QString(QLatin1String("Argument %1 provided to emit is not of the " "type that the signal expects")).arg(i); } else { g_value_init(&values[i+1], args[i].type()); @@ -223,7 +223,7 @@ Value Signal::emit(void *instance, const char *detailedSignal, const QList<Value return result; } -//END ******** Signal::emit ******** +//END ******** QGlib::emit ******** //BEGIN ******** Closure ******** void Closure::ref(bool increaseRef) @@ -334,17 +334,17 @@ ClosurePtr createCppClosure(ClosureDataBase *closureData) } //namespace Private -//BEGIN ******** Signal::connect ******** +//BEGIN ******** QGlib::connect ******** //static -SignalHandler Signal::connect(void *instance, const char *detailedSignal, - const ClosurePtr & closure, ConnectFlags flags) +SignalHandler connect(void *instance, const char *detailedSignal, + const ClosurePtr & closure, ConnectFlags flags) { uint id = g_signal_connect_closure(instance, detailedSignal, closure, (flags & ConnectAfter) ? TRUE : FALSE); return SignalHandler(instance, id); } -//END ******** Signal::connect ******** +//END ******** QGlib::connect ******** } //namespace QGlib diff --git a/src/QGlib/signal.h b/src/QGlib/signal.h index c51c506..08b9a9e 100644 --- a/src/QGlib/signal.h +++ b/src/QGlib/signal.h @@ -32,10 +32,10 @@ //Qt's emit will clash #if defined(emit) # if defined(Q_CC_GNU) -# warning "The emit keyword is defined and will be undefined here to compile QGlib::Signal::emit." +# warning "The emit keyword is defined and will be undefined here to compile QGlib::emit." # warning "It is recommended to compile your project with QT_NO_KEYWORDS defined." # elif defined(Q_CC_MSVC) -# pragma message("Warning: The emit keyword is defined and will be undefined here to compile QGlib::Signal::emit.") +# pragma message("Warning: The emit keyword is defined and will be undefined here to compile QGlib::emit.") # pragma message("Warning: It is recommended to compile your project with QT_NO_KEYWORDS defined.") # endif # undef emit @@ -58,11 +58,10 @@ public: void block(); void unblock(); -private: - friend class Signal; inline SignalHandler(void *instance, ulong id) : m_instance(instance), m_id(id) {} +private: void *m_instance; ulong m_id; }; @@ -93,24 +92,6 @@ public: }; Q_DECLARE_FLAGS(SignalFlags, SignalFlag); - /*! These flags define options that can be passed to connect() to modify its behaviour. */ - enum ConnectFlag { //codegen: skip=true - /*! If ConnectAfter is specified, the slot passed to connect() will be invoked after the - * default signal handler of this signal has been called. See the Glib signals - * documentation for more details on this parameter. - */ - ConnectAfter = 1, - /*! If PassSender is specified, the slot passed to connect() will receive as the first - * argument a pointer to the sender of the signal. Thus, your slot should be defined - * like this: - * \code - * void mySlot(const QGlib::ObjectPtr & sender, const Foo & firstArgument, ...); - * \endcode - */ - PassSender = 2 - }; - Q_DECLARE_FLAGS(ConnectFlags, ConnectFlag); - Signal(const Signal & other); Signal & operator=(const Signal & other); virtual ~Signal(); @@ -128,122 +109,142 @@ public: static Signal lookup(const char *name, Type type); static QList<Signal> listSignals(Type type); +private: + Signal(uint id); -#if QGLIB_HAVE_CXX0X + struct Private; + QSharedDataPointer<Private> d; +}; - /*! Emits a signal on a specified \a instance with the specified arguments. - * - * This method will convert all the specified arguments to GValues using Value::set() - * and will then call the non-templated emit() method, which is a wrapper for g_signal_emitv(). - * The returned value from the signal (if the signal returns a value) will be converted - * from GValue to the type R using Value::get() and will be returned. If some argument - * is not of the type that the signal expects, a warning will be printed to stderr at runtime - * and the signal will not be emitted. If the return value is not of the type that the signal - * returns, the signal will be emitted, but a default-constructed value for the type R will - * be returned and a warning will be printed to stderr. - * - * Note that since the implementation uses Value::set() to convert the GValues into the - * specified types, the same rules that apply to Value::set() apply here (i.e. you should - * only use the types of the bindings and not the C types, which means QGst::ObjectPtr instead - * of GstObject*, etc...). - * - * Emitting a signal is useful for the so-called Action signals. These are meant to be emitted - * from the application and not connected to. They are more like dynamic methods that can be - * identified with a string. - * - * \note This method makes use of C++0x features (namely, variadic templates and rvalue - * references). If your compiler does not support them, a hacky implementation using boost's - * preprocessor, function and bind libraries will be compiled instead. That version has a - * limit of 9 arguments. - * - * \param instance The instance of the object on which the signal will be emitted. You can pass - * a RefPointer as an instance without any problems; it will automatically cast to void*. - * \param detailedSignal The name of the signal that you want to emit, with an optional - * detail if the signal is detailed. The detail may be specified with the following syntax: - * "signal::detail". - * \param args The arguments that will be passed to the signal. - * \returns The return value of the signal. + +/*! These flags define options that can be passed to connect() to modify its behaviour. */ +enum ConnectFlag { //codegen: skip=true + /*! If ConnectAfter is specified, the slot passed to connect() will be invoked after the + * default signal handler of this signal has been called. See the Glib signals + * documentation for more details on this parameter. */ - template <typename R, typename... Args> - static R emit(void *instance, const char *detailedSignal, const Args & ... args); - - /*! Connects a signal to a specified \a slot. - * - * This method will generate a set of template functions and classes that bind on a GClosure. - * When the signal is emitted, this GClosure will be invoked and its templated marshaller - * function will take care of converting the parameters of the signal (which are given as - * GValues) to the types that the \a slot expects. In case the types do not match, a warning - * will be printed to stderr at runtime and the \a slot will not be invoked. You are - * responsible for defining the \a slot with the correct arguments! - * - * Note that since the implementation uses Value::get() to convert the GValues into the - * specified types, the same rules that apply to Value::get() apply here (i.e. you should - * only use the types of the bindings and not the C types, which means QGst::ObjectPtr instead - * of GstObject*, etc...). - * - * \note - * \li You can use const references for the arguments of the slot to avoid unnecessary - * copying of objects. The marshaller will always hold one copy of them during the execution - * of your \a slot. - * \li This method makes use of C++0x features (namely, variadic templates and rvalue - * references). If your compiler does not support them, a hacky implementation using boost's - * preprocessor, function and bind libraries will be compiled instead. That version has a - * limit of 9 slot arguments. - * - * \param instance The instance of the object that emits this signal. You can pass - * a RefPointer as an instance without any problems; it will automatically cast to void*. - * \param detailedSignal The name of the signal that you want to connect to, with an optional - * detail if the signal is detailed. The detail may be specified with the following syntax: - * "signal::detail". - * \param receiver The instance of the class on which \a slot will be invoked. - * \param slot A pointer to a member function that will be invoked when the signal is emitted. - * \param flags See ConnectFlag. - * \returns A SignalHandler instance, which can be used to disconnect or block this handler. - * Note that the return type of this function is subject to change before a stable release is made. + ConnectAfter = 1, + /*! If PassSender is specified, the slot passed to connect() will receive as the first + * argument a pointer to the sender of the signal. Thus, your slot should be defined + * like this: + * \code + * void mySlot(const QGlib::ObjectPtr & sender, const Foo & firstArgument, ...); + * \endcode */ - template <typename T, typename R, typename... Args> - static SignalHandler connect(void *instance, const char *detailedSignal, - T *receiver, R (T::*slot)(Args...), ConnectFlags flags = 0); + PassSender = 2 +}; +Q_DECLARE_FLAGS(ConnectFlags, ConnectFlag); + +#if QGLIB_HAVE_CXX0X + +/*! Emits a signal on a specified \a instance with the specified arguments. + * + * This method will convert all the specified arguments to GValues using Value::set() + * and will then call the non-templated emit() method, which is a wrapper for g_signal_emitv(). + * The returned value from the signal (if the signal returns a value) will be converted + * from GValue to the type R using Value::get() and will be returned. If some argument + * is not of the type that the signal expects, a warning will be printed to stderr at runtime + * and the signal will not be emitted. If the return value is not of the type that the signal + * returns, the signal will be emitted, but a default-constructed value for the type R will + * be returned and a warning will be printed to stderr. + * + * Note that since the implementation uses Value::set() to convert the GValues into the + * specified types, the same rules that apply to Value::set() apply here (i.e. you should + * only use the types of the bindings and not the C types, which means QGst::ObjectPtr instead + * of GstObject*, etc...). + * + * Emitting a signal is useful for the so-called Action signals. These are meant to be emitted + * from the application and not connected to. They are more like dynamic methods that can be + * identified with a string. + * + * \note This method makes use of C++0x features (namely, variadic templates and rvalue + * references). If your compiler does not support them, a hacky implementation using boost's + * preprocessor, function and bind libraries will be compiled instead. That version has a + * limit of 9 arguments. + * + * \param instance The instance of the object on which the signal will be emitted. You can pass + * a RefPointer as an instance without any problems; it will automatically cast to void*. + * \param detailedSignal The name of the signal that you want to emit, with an optional + * detail if the signal is detailed. The detail may be specified with the following syntax: + * "signal::detail". + * \param args The arguments that will be passed to the signal. + * \returns The return value of the signal. + */ +template <typename R, typename... Args> +R emit(void *instance, const char *detailedSignal, const Args & ... args); + +/*! Connects a signal to a specified \a slot. + * + * This method will generate a set of template functions and classes that bind on a GClosure. + * When the signal is emitted, this GClosure will be invoked and its templated marshaller + * function will take care of converting the parameters of the signal (which are given as + * GValues) to the types that the \a slot expects. In case the types do not match, a warning + * will be printed to stderr at runtime and the \a slot will not be invoked. You are + * responsible for defining the \a slot with the correct arguments! + * + * Note that since the implementation uses Value::get() to convert the GValues into the + * specified types, the same rules that apply to Value::get() apply here (i.e. you should + * only use the types of the bindings and not the C types, which means QGst::ObjectPtr instead + * of GstObject*, etc...). + * + * \note + * \li You can use const references for the arguments of the slot to avoid unnecessary + * copying of objects. The marshaller will always hold one copy of them during the execution + * of your \a slot. + * \li This method makes use of C++0x features (namely, variadic templates and rvalue + * references). If your compiler does not support them, a hacky implementation using boost's + * preprocessor, function and bind libraries will be compiled instead. That version has a + * limit of 9 slot arguments. + * + * \param instance The instance of the object that emits this signal. You can pass + * a RefPointer as an instance without any problems; it will automatically cast to void*. + * \param detailedSignal The name of the signal that you want to connect to, with an optional + * detail if the signal is detailed. The detail may be specified with the following syntax: + * "signal::detail". + * \param receiver The instance of the class on which \a slot will be invoked. + * \param slot A pointer to a member function that will be invoked when the signal is emitted. + * \param flags See ConnectFlag. + * \returns A SignalHandler instance, which can be used to disconnect or block this handler. + * Note that the return type of this function is subject to change before a stable release is made. + */ +template <typename T, typename R, typename... Args> +SignalHandler connect(void *instance, const char *detailedSignal, + T *receiver, R (T::*slot)(Args...), ConnectFlags flags = 0); #else //QGLIB_HAVE_CXX0X # define QGLIB_SIGNAL_EMIT_DECLARATION(z, n, data) \ template <typename R BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A) > \ - static R emit(void *instance, const char *detailedSignal \ - BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(n, const A, & a) ); + R emit(void *instance, const char *detailedSignal \ + BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(n, const A, & a) ); # define QGLIB_SIGNAL_CONNECT_DECLARATION(z, n, data) \ template <typename T, typename R BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A) > \ - static SignalHandler connect(void *instance, const char *detailedSignal, \ - T *receiver, R (T::*slot)(BOOST_PP_ENUM_PARAMS(n, A)), \ - ConnectFlags flags = 0); + SignalHandler connect(void *instance, const char *detailedSignal, \ + T *receiver, R (T::*slot)(BOOST_PP_ENUM_PARAMS(n, A)), \ + ConnectFlags flags = 0); - BOOST_PP_REPEAT_FROM_TO(0, BOOST_PP_INC(QGLIB_SIGNAL_MAX_ARGS), QGLIB_SIGNAL_EMIT_DECLARATION, dummy) - BOOST_PP_REPEAT_FROM_TO(0, BOOST_PP_INC(QGLIB_SIGNAL_MAX_ARGS), QGLIB_SIGNAL_CONNECT_DECLARATION, dummy) +BOOST_PP_REPEAT_FROM_TO(0, BOOST_PP_INC(QGLIB_SIGNAL_MAX_ARGS), QGLIB_SIGNAL_EMIT_DECLARATION, dummy) +BOOST_PP_REPEAT_FROM_TO(0, BOOST_PP_INC(QGLIB_SIGNAL_MAX_ARGS), QGLIB_SIGNAL_CONNECT_DECLARATION, dummy) # undef QGLIB_SIGNAL_CONNECT_DECLARATION # undef QGLIB_SIGNAL_EMIT_DECLARATION #endif //QGLIB_HAVE_CXX0X - /*! \internal This method is used internally from the templated emit() method. */ - static Value emit(void *instance, const char *detailedSignal, const QList<Value> & args); - /*! \internal This method is used internally from the templated connect() method. */ - static SignalHandler connect(void *instance, const char *detailedSignal, - const ClosurePtr & closure, ConnectFlags flags = 0); +/*! \internal This method is used internally from the templated emit() method. */ +Value emit(void *instance, const char *detailedSignal, const QList<Value> & args); -private: - Signal(uint id); +/*! \internal This method is used internally from the templated connect() method. */ +SignalHandler connect(void *instance, const char *detailedSignal, + const ClosurePtr & closure, ConnectFlags flags = 0); - struct Private; - QSharedDataPointer<Private> d; -}; } //namespace QGlib Q_DECLARE_OPERATORS_FOR_FLAGS(QGlib::Signal::SignalFlags) -Q_DECLARE_OPERATORS_FOR_FLAGS(QGlib::Signal::ConnectFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(QGlib::ConnectFlags) #define IN_QGLIB_SIGNAL_H # include "emitimpl.h" diff --git a/src/QGst/Ui/videowidget.cpp b/src/QGst/Ui/videowidget.cpp index 7b43bf7..f61a38a 100644 --- a/src/QGst/Ui/videowidget.cpp +++ b/src/QGst/Ui/videowidget.cpp @@ -119,10 +119,10 @@ public: childAdded(sink->childByIndex(i)); } - m_childAddedHandler = QGlib::Signal::connect(sink, "child-added", - this, &ProxyRenderer::childAdded); - m_childRemovedHandler = QGlib::Signal::connect(sink, "child-removed", - this, &ProxyRenderer::childRemoved); + m_childAddedHandler = QGlib::connect(sink, "child-added", + this, &ProxyRenderer::childAdded); + m_childRemovedHandler = QGlib::connect(sink, "child-removed", + this, &ProxyRenderer::childRemoved); } virtual ~ProxyRenderer() diff --git a/src/QGst/bus.cpp b/src/QGst/bus.cpp index 5a853ed..79fe820 100644 --- a/src/QGst/bus.cpp +++ b/src/QGst/bus.cpp @@ -55,7 +55,7 @@ private: GstMessage *message; gst_object_ref(m_bus); while((message = gst_bus_pop(m_bus)) != NULL) { - QGlib::Signal::emit<void>(m_bus, "message", MessagePtr::wrap(message, false)); + QGlib::emit<void>(m_bus, "message", MessagePtr::wrap(message, false)); } gst_object_unref(m_bus); } diff --git a/tests/auto/bustest.cpp b/tests/auto/bustest.cpp index 20e298f..8c85303 100644 --- a/tests/auto/bustest.cpp +++ b/tests/auto/bustest.cpp @@ -83,7 +83,7 @@ void BusTest::watchTest() m_messagesReceived = 0; thread.bus->addSignalWatch(); - QGlib::Signal::connect(thread.bus, "message", this, &BusTest::messageClosure); + QGlib::connect(thread.bus, "message", this, &BusTest::messageClosure); thread.start(); @@ -105,7 +105,7 @@ void BusTest::watchTestWithWatchRemoval() m_messagesReceived = 0; thread.bus->addSignalWatch(); - QGlib::Signal::connect(thread.bus, "message", this, &BusTest::messageClosure); + QGlib::connect(thread.bus, "message", this, &BusTest::messageClosure); thread.start(); diff --git a/tests/auto/signalstest.cpp b/tests/auto/signalstest.cpp index b803a98..9fc5025 100644 --- a/tests/auto/signalstest.cpp +++ b/tests/auto/signalstest.cpp @@ -46,8 +46,7 @@ void SignalsTest::closureTest() QGst::BinPtr bin = QGst::Bin::create("mybin"); closureCalled = false; - QGlib::Signal::connect(bin, "parent-set", this, - &SignalsTest::closureTestClosure, QGlib::Signal::PassSender); + QGlib::connect(bin, "parent-set", this, &SignalsTest::closureTestClosure, QGlib::PassSender); bin->setParent(pipeline); QCOMPARE(closureCalled, true); } @@ -82,31 +81,31 @@ void SignalsTest::emitTestClosure(const QGlib::ObjectPtr & instance, const QGlib void SignalsTest::emitTest() { QGst::BinPtr bin = QGst::Bin::create("mybin"); - QGlib::SignalHandler handler = QGlib::Signal::connect(bin, "notify::name", - this, &SignalsTest::emitTestClosure, - QGlib::Signal::PassSender); + QGlib::SignalHandler handler = QGlib::connect(bin, "notify::name", + this, &SignalsTest::emitTestClosure, + QGlib::PassSender); QVERIFY(handler.isConnected()); closureCalled = false; - QGlib::Signal::emit<void>(bin, "notify::name", bin->findProperty("name")); + QGlib::emit<void>(bin, "notify::name", bin->findProperty("name")); QCOMPARE(closureCalled, true); //calling with wrong return value. should show error message but *call* the signal //and return default constructed value for int closureCalled = false; - int r = QGlib::Signal::emit<int>(bin, "notify::name", bin->findProperty("name")); + int r = QGlib::emit<int>(bin, "notify::name", bin->findProperty("name")); QCOMPARE(r, int()); QCOMPARE(closureCalled, true); //calling with wrong number of arguments. should show error message and *not call* the signal closureCalled = false; - QGlib::Signal::emit<void>(bin, "notify::name"); + QGlib::emit<void>(bin, "notify::name"); QCOMPARE(closureCalled, false); //calling wrong signal. will return default constructed value for int closureCalled = false; - r = QGlib::Signal::emit<int>(bin, "foobar"); + r = QGlib::emit<int>(bin, "foobar"); QCOMPARE(r, int()); QCOMPARE(closureCalled, false); @@ -114,7 +113,7 @@ void SignalsTest::emitTest() QVERIFY(!handler.isConnected()); closureCalled = false; - QGlib::Signal::emit<void>(bin, "notify::name", bin->findProperty("name")); + QGlib::emit<void>(bin, "notify::name", bin->findProperty("name")); QCOMPARE(closureCalled, false); } |