Revert back old behavior (incorrect but, perhaps, more user-friendly),
when Unread list populates with "unread" articles only but then it can
contain "read" articles if they become "read" when Unread list is shown.
write() is declared with __attribute__ ((__warn_unused_result__)) and as
such we shall check its return value. Took opportunity and adjusted
error reporting a bit: if writing to stderr fails, try to write to
stdout.
Arguments include adding torrents as paused/started, skiping hash check, setting category, downloading in sequential order, downloading first and last pieces first, and skipping the 'add new torrent' dialog. Added TriStateBoolOption class for specifying options that don't have a default value when unused (e.g. add-paused). Also improved command line usage text to include more information, have better organization, and not exceed 80 columns in width. Also also added firstLastPiecePriority field to BitTorrent::AddTorrentData, and modified TorrentHandle so that if first/last piece priority should be on, it will be toggled on after the torrent's metadata has loaded.
Looking for incomplete files in a new torrent by using a pre-generated
directory listing presents several disadvantages:
- It requires us to extract the top-level directory name (in case it
was renamed).
- It requires us to know whether the top-level directory was stripped.
- In the latter case, it may result in recursively traversing the
entire contents of all downloaded torrents.
Calling QFile::exists() individually for each file solves all these
issues.
In so doing, the handling of single-file and multiple-file torrents are
rendered pretty much identical, and can therefore be merged.
Because AddNewTorrentDialog is a sheet in macOS, repositioning it causes bad things to happen, particularly if the main dialog is on a secondary monitor.