Web UI code clean up

This commit is contained in:
Christophe Dumez 2011-09-25 11:31:20 +03:00
parent 3f4947259b
commit 4be897a4e5

View File

@ -238,7 +238,7 @@ void HttpConnection::respond() {
} }
} }
if (list[0] == "command") { if (list[0] == "command") {
QString command = list[1]; const QString& command = list[1];
respondCommand(command); respondCommand(command);
m_generator.setStatusLine(200, "OK"); m_generator.setStatusLine(200, "OK");
write(); write();
@ -361,8 +361,7 @@ void HttpConnection::respondGlobalTransferInfoJson() {
void HttpConnection::respondCommand(const QString& command) void HttpConnection::respondCommand(const QString& command)
{ {
if(command == "download") if(command == "download") {
{
QString urls = m_parser.post("urls"); QString urls = m_parser.post("urls");
QStringList list = urls.split('\n'); QStringList list = urls.split('\n');
foreach(QString url, list){ foreach(QString url, list){
@ -382,6 +381,7 @@ void HttpConnection::respondCommand(const QString& command)
} }
return; return;
} }
if(command == "addTrackers") { if(command == "addTrackers") {
QString hash = m_parser.post("hash"); QString hash = m_parser.post("hash");
if(!hash.isEmpty()) { if(!hash.isEmpty()) {
@ -451,7 +451,7 @@ void HttpConnection::respondCommand(const QString& command)
m_generator.setStatusLine(200, "OK"); m_generator.setStatusLine(200, "OK");
m_generator.setContentTypeByExt("html"); m_generator.setContentTypeByExt("html");
#if LIBTORRENT_VERSION_MINOR > 15 #if LIBTORRENT_VERSION_MINOR > 15
generator.setMessage(QString::number(QBtSession::instance()->getSession()->settings().upload_rate_limit)); m_generator.setMessage(QString::number(QBtSession::instance()->getSession()->settings().upload_rate_limit));
#else #else
m_generator.setMessage(QString::number(QBtSession::instance()->getSession()->upload_rate_limit())); m_generator.setMessage(QString::number(QBtSession::instance()->getSession()->upload_rate_limit()));
#endif #endif
@ -461,7 +461,7 @@ void HttpConnection::respondCommand(const QString& command)
m_generator.setStatusLine(200, "OK"); m_generator.setStatusLine(200, "OK");
m_generator.setContentTypeByExt("html"); m_generator.setContentTypeByExt("html");
#if LIBTORRENT_VERSION_MINOR > 15 #if LIBTORRENT_VERSION_MINOR > 15
generator.setMessage(QString::number(QBtSession::instance()->getSession()->settings().download_rate_limit)); m_generator.setMessage(QString::number(QBtSession::instance()->getSession()->settings().download_rate_limit));
#else #else
m_generator.setMessage(QString::number(QBtSession::instance()->getSession()->download_rate_limit())); m_generator.setMessage(QString::number(QBtSession::instance()->getSession()->download_rate_limit()));
#endif #endif