Old v3.3.x format had a number at the end indicating the queue position.
The naming scheme was '<infohash>.fastresume.<queueposition>'.
However, QSaveFile, which uses QTemporaryFile internally, might leave
non-commited files behind eg after a crash. These files have the
naming scheme '<infohash>.fastresume.XXXXXX' where each X is a random
character. We try to detect the latter and remove it without "migrating"
the fastresume to the new saving system.
Using iostream usually adds a lot of other operators (<<, endl), whereas
*printf takes only 1 function call.
Also use qUtf8Printable whenever possible.
Stops temporary containers being created needlessly due to API misuse.
For example, it’s common for developers to assume QHash::values() and
QHash::keys() are free and abuse them, failing to realize their
implementation internally actually iterates the whole container, allocates
memory, and fills a new QList.
Added a removeIf generic algorithm, similar to std ones. We can't use std
algorithms with Qt dictionaries because Qt iterators have different
behavior from the std ones.
Found using clazy.
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.
On macOS 10.12 Sierra, Apple changed the behaviour of CFPreferencesSetValue()
truncating data after a null character. https://bugreports.qt.io/browse/QTBUG-56344
Due to this, we have to move from native plist to IniFormat.