From 4a76526417054b964d8d0ed28954506d89f160df Mon Sep 17 00:00:00 2001 From: ngosang Date: Sun, 14 Jun 2015 10:12:35 +0200 Subject: [PATCH] Code clean up This changes were proposed by @PiotrNawrot in these PRs: #2967, #2970. --- src/gui/addnewtorrentdialog.cpp | 15 ++++++--------- src/webui/webapplication.cpp | 16 ++++++---------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index 1afafa26a..f99cfa196 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -555,16 +555,13 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint&) } else { int prio = prio::NORMAL; - if (act == ui->actionHigh) { + if (act == ui->actionHigh) prio = prio::HIGH; - } - else { - if (act == ui->actionMaximum) - prio = prio::MAXIMUM; - else - if (act == ui->actionNot_downloaded) - prio = prio::IGNORED; - } + else if (act == ui->actionMaximum) + prio = prio::MAXIMUM; + else if (act == ui->actionNot_downloaded) + prio = prio::IGNORED; + qDebug("Setting files priority"); foreach (const QModelIndex &index, selectedRows) { qDebug("Setting priority(%d) for file at row %d", prio, index.row()); diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index aae42a6d0..cf02e52a1 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -688,18 +688,14 @@ void WebApplication::parsePath() // check action for requested path QStringList pathItems = request().path.split('/', QString::SkipEmptyParts); - if (!pathItems.empty()) { - if (actions_.contains(pathItems.front())) { - scope_ = pathItems.front(); - pathItems.pop_front(); - } + if (!pathItems.empty() && actions_.contains(pathItems.front())) { + scope_ = pathItems.front(); + pathItems.pop_front(); } - if (!pathItems.empty()) { - if (actions_[scope_].contains(pathItems.front())) { - action_ = pathItems.front(); - pathItems.pop_front(); - } + if (!pathItems.empty() && actions_[scope_].contains(pathItems.front())) { + action_ = pathItems.front(); + pathItems.pop_front(); } args_ = pathItems;