gtorrent / gtorrent-core

Core library of gTorrent which handles everything but UI/UX
GNU General Public License v3.0
39 stars 12 forks source link

Events. #111

Closed fuyukaidesu closed 9 years ago

fuyukaidesu commented 9 years ago

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) UI default parameters (colors) were moved outside of core.

[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]

zovt commented 9 years ago

Hey, this looks pretty good! I'm assuming this adds the ability to track state changes between downloading, seeding, etc., right?

fuyukaidesu commented 9 years ago

Yes.

zovt commented 9 years ago

Perfect! It looks good on my end. Maybe wait for one more dev? Also, once this is merged we can close #81

Sidenote: I should be on tomorrow to do some work.

benwaffle commented 9 years ago

the logs are annoying & you should probably use gt::Log

benwaffle commented 9 years ago

random crash: gtorrent-gtk: /usr/include/boost/smart_ptr/intrusive_ptr.hpp:162: T *boost::intrusive_ptr<const libtorrent::torrent_info>::operator->() const [T = const libtorrent::torrent_info]: Assertion 'px != 0' failed.

i think what i did was add a magnet, let it download, remove it, then add it again

fuyukaidesu commented 9 years ago

Crash is from gtk, and is due to the status box trying to retrieve the number of pieces on a magnet that has no metadata.