Start all torrents auto-managed to prevent simultaneous checking
of multiple torrents.
Handle checking state of paused torrent to prevent it from being
resumed when qBittorrent is closed until checking isn't complete.
Unlike "toNativePath" which name clearly reflects the function result
"fromNativePath" has no such clear meaning.
Since this function converts path into uniform format "toUniformPath"
is better name.
TorrentInfo::origFilePath will return the very original path from
.torrent file, not the most recent file path before the rename operation
and thus the code would not be working as we expected.
Add/restore all torrents in "paused" state and then resume those
that need to be really "resumed" (added/restored in "resumed" state).
Keep torrents with missing files paused.
Force recheck torrent with missing files when it's resumed by the user.
During startup we can get above 1000 alerts at each pop even with only
30 torrents in the queue. This is because libtorrent will post
piece_finished_alert and file_completed_alert for each torrent. These
alerts push out of the way the ones we care about.
The alert queue will be grown to max only if needed. So we don't use
more memory. It will greatly depend on how many torrents a user has in
their session.
When getting fastresume_rejected_alert we need to act as fast as
possible in pausing it, otherwise there's a chance it will begin
downloading and writing to disk before we pause it.
Updating file priorities is an async operation in libtorrent, when we
just updated it and immediately query it, we might get the
old/wrong values, so we rely on `updatedFilePrio` in this case.
Don't post "torrent resumed" event when torrent starts in "resumed"
state.
Fix confusing names. Now "resumed torrent" means "unpaused torrent"
only. When we load previously added torrent it is called "restored
torrent".