gtorrent/gtorrent-core — pull request #111 by fuyukaidesu (2014-08-20 04:50:49+00:00)
Title: Events.

Mainly implements events.
You can set up a callback std::function that is called every time the object change states.
Also changed the getFileSizeString method to support more sizeprefixes (Up to YB)

[spoiler]
For some reason the oldstate argument maybe uninitialized, and the old state may also be unrelated to a previous new state and sometimes, libtorrent changes the state a few times at once, but that's a libtorrent issue.
For example, in a call, you may have
oldstate = 31231, new state = 7

or in two consecutive calls
oldstate = 0 new state = 4
oldstate = 0 new state = 5

And most of the time it's a mix of these two.
[/spoiler]