Use custom method IDs to determine binding to invoke

Using sender() and senderSignalIndex() to determine which binding to
invoke in QtSignalForwarder::qt_metacall() had a number of
disadvantages:

 * The sender() and senderSignalIndex() are slow as they acquire a mutex
   in the sending object.

 * sender() and senderSignalIndex() are not available if the binding
   was invoked via a queued connection.

 * senderSignalIndex() requires Qt 4.8 or later

 * The sender() and senderSignalIndex() cost is linear in the number of
   connected senders, which limits how much we can share proxy objects
   between senders, so the previous code created a new proxy object
   for every sender.

 * In the event that multiple bindings are connected to the same
   (sender, signal) we cannot disambiguate between them.  The previous
   code just invoked all matching bindings.

Instead, this patch refactors QtSignalForwarder to use custom method IDs
which are internally mapped to individual bindings and use as few proxy
objects as possible amongst multiple bindings.

We cannot always use just a signal proxy object because method IDs are
limited to 2^16 internally in Qt, so additional proxy objects must be
created onces the number of bindings exceeds that limit.

The invocation of methods in the proxy has also been changed to always
use direct connections so that we always receive the destroyed(QObject*)
signal before the object is actually destroyed and don't keep possibly
null QObject* pointers around in the internal maps.
Restrict usage of QtSignalForwarder::connect() to the main thread

QtSignalForwarder is currently not thread-safe internally, so restrict
usage of the static convenience methods to the main thread.

Clients that need to use QSF on another thread must construct their own
QSF instance and use the bind() method.
Enable method IDs used for signal bindings to be re-used

When a binding is removed, push the method ID onto a free-list
for future re-use, instead of always allocating a new higher method ID.
Forward non-signal binding invocations to QObject::qt_metcall()

Check the methodId in QtSignalForwarder, if it isn't from the range
allocated for signal bindings, forward it to the standard
QObject::qt_metacall() implementation.
Fix VS2010 build

std::function does not allow discarding return values in VS2010
as explained at
http://stackoverflow.com/questions/6628442/can-tr1function-swallow-return-values