Legacy SearchEngine class really has three roles:
1. Manage search plugins,
2. Handle the search job, and
3. Handle the download of the torrent file using the search plugin.
Now it is splitted into 3 classes: SearchManager, SearchHandler and
SearchDownloadHandler.
Search GUI is also improved.
* Add more checks and also more strict checks for invalid conditions
* Add http version field
* Raise max request size to 64 MB
* Add author in license
* Use Qt5 new connect syntax
`torrent_info` constructor has default limits that can't be changed via
parameters, so we handle the loading process manually and explicitly
specifiy the limits to `bdecode()`.
The token_limit is also changed to 10000000.
1. Using FileSystemPathEdit is not entirely correct, as it only always
shows false warnings when parameters are present.
2. FileSystemPathEdit::selectedPath() modifies the path to unix format,
in this specific case, we need to faithfully execute what user inputted.
3. Given the above it is reasonable to revert back to QLineEdit, as it
is just sufficient in functionality and doesn't modifiy the inputs.
Explicit or implicit calls to begin() and end() cause a non-const
container to detach from shared data, ie. to perform a deep-copy to gain
a unique copy of the data.
That can be a expensive although unneeded operation.
In order to assist the developer a copyAsConst function is added.
copyAsConst returns a const copy of the object.
For lvalues just use qAsConst. It's only available on Qt 5.7.0. But we
added also for earlier versions. The developer can always use qAsConst.
Intended uses:
QString s = ...;
for (const auto &ch : qAsConst(s))
process(ch);
for (const auto &ch : copyAsConst(funcReturningQString()))
process(ch);
It prevents detachments:
To illustrate:
QMap<QString, QString> map;
/* code compiles and works fine but find() returns the non-const
QMap::iterator that detaches!
*/
QMap<QString, QString>::const_iterator it = map.find("girish");
but also some subtle bugs:
QHash<int, int> wrong;
if (wrong.find(1) == wrong.cend()) {
qDebug() << "Not found";
} else {
/* find() detached the container before cend() was called, so it
prints "Found"
*/
qDebug() << "Found";
}
QHash<int, int> right;
if (right.constFind(1) == right.cend()) {
qDebug() << "Not found"; // This is correct now !
} else {
qDebug() << "Found";
}
Enforced by QT_STRICT_ITERATORS definition.