Cleanup code

Also remove redundant code, it is already handled correctly in subsequent function calls.
This commit is contained in:
Chocobo1 2018-12-28 13:38:08 +08:00
parent 19d6de795c
commit 6759446639
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
5 changed files with 27 additions and 31 deletions

View file

@ -38,7 +38,6 @@
#include <QMimeData>
#include <QProcess>
#include <QPushButton>
#include <QRegularExpression>
#include <QScrollBar>
#include <QShortcut>
#include <QSplitter>
@ -1628,11 +1627,7 @@ void MainWindow::showNotificationBaloon(QString title, QString msg) const
void MainWindow::downloadFromURLList(const QStringList &urlList)
{
const bool useTorrentAdditionDialog = AddNewTorrentDialog::isEnabled();
for (QString url : urlList) {
if (((url.size() == 40) && !url.contains(QRegularExpression("[^0-9A-Fa-f]")))
|| ((url.size() == 32) && !url.contains(QRegularExpression("[^2-7A-Za-z]"))))
url = "magnet:?xt=urn:btih:" + url;
for (const QString &url : urlList) {
if (useTorrentAdditionDialog)
AddNewTorrentDialog::show(url, this);
else