Enable portable mode if "profile" directory exists in the app dir.
Remove "--portable" command line argument.
Add logging of current profile config directory.
Closes#9445.
Using iostream usually adds a lot of other operators (<<, endl), whereas
*printf takes only 1 function call.
Also use qUtf8Printable whenever possible.
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.
Conditionally change absolute paths to relative in the fastresume data files.
The condition is specified by user via a command line parameter and
paths are relative to the profile dir.
On Windows the convertion to relative path is performed if the path and
the profile are on the same drive only.
This allows to pass options via environment variables. The variable name
is constructed from parameter name by transforming the name to upper
case and prefixing "QBT_".
It may be useful to have different configurations either for portable
versions or for debugging purposes. To implement this we add two
options, avaliable via command line switches
1. An option to change configuration name ("--configuration"). The name
supplied via this option is appended to
QCoreApplication::applicationName() to form "qBittorrent_<conf_name>"
name for the configuration files.
2. An option to provide a path do directory where all the settings are
stored (kind of profile directory). There is a shortcut "--portable"
which means "use directory 'profile' near the executable location".
In order to implement that we have to perform initialisation of the
profile directories before the SettingStorage and Preferences singletones
are initialised. Thus, options parsing shall be performed without defaults
read from preferences.