Added a window which displays loaded resources

Can be opened with F10.
Fixed possible crash on shutdown

When deleting SpriteDefinition instances during shutdown it could happen
that an ImageSet that was deleted as a result would try to decrease the
reference count on an ImageResource that had already been deleted.

Also switched the two QMap instances in ResourceManager to QHash, which
should be a little bit faster since it does not bother with sorting its
contents.
Added support for tileset margin and spacing

Also tried to reduce the amount of calculation done for each tile a
little by remembering more about the current tileset.

Closes #44
Fixed the timeout on unused resources

The CACHE_TIME was used as milliseconds but documented as seconds.
This changes the timeout from 60 milliseconds to 30 seconds.

It may take up to 40 seconds for resources to be cleaned up, since
the cleanup happens every 10 seconds.