From a0d21ead18a0eeb568a7cd73aaf5d617f56fa88b Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 26 May 2012 22:58:53 +0300 Subject: [PATCH] Further rewriting of the JSON-related code --- src/webui/btjson.cpp | 21 ++ src/webui/btjson.h | 1 + src/webui/httpconnection.cpp | 21 +- src/webui/httpserver.cpp | 20 +- src/webui/httpserver.h | 5 - src/webui/json.cpp | 24 -- src/webui/json.h | 2 - src/webui/{eventmanager.cpp => prefjson.cpp} | 217 +++++++++---------- src/webui/{eventmanager.h => prefjson.h} | 30 +-- src/webui/scripts/client.js | 4 +- src/webui/webui.pri | 8 +- 11 files changed, 154 insertions(+), 199 deletions(-) rename src/webui/{eventmanager.cpp => prefjson.cpp} (71%) rename src/webui/{eventmanager.h => prefjson.h} (72%) diff --git a/src/webui/btjson.cpp b/src/webui/btjson.cpp index b02e0c032..aa86b2790 100644 --- a/src/webui/btjson.cpp +++ b/src/webui/btjson.cpp @@ -103,6 +103,10 @@ static const char KEY_FILE_PROGRESS[] = "progress"; static const char KEY_FILE_PRIORITY[] = "priority"; static const char KEY_FILE_IS_SEED[] = "is_seed"; +// TransferInfo keys +static const char KEY_TRANSFER_DLSPEED[] = "dl_info"; +static const char KEY_TRANSFER_UPSPEED[] = "up_info"; + static JsonDict toJson(const QTorrentHandle& h) { JsonDict ret; @@ -343,3 +347,20 @@ QString btjson::getFilesForTorrent(const QString& hash) return file_list.toString(); } + +/** + * Returns the global transfer information in JSON format. + * + * The return value is a JSON-formatted dictionary. + * The dictionary keys are: + * - "dl_info": Global download info + * - "up_info": Global upload info + */ +QString btjson::getTransferInfo() +{ + CACHED_VARIABLE(JsonDict, info, CACHE_DURATION_MS); + session_status sessionStatus = QBtSession::instance()->getSessionStatus(); + info.add(KEY_TRANSFER_DLSPEED, tr("D: %1/s - T: %2", "Download speed: x KiB/s - Transferred: x MiB").arg(misc::friendlyUnit(sessionStatus.payload_download_rate)).arg(misc::friendlyUnit(sessionStatus.total_payload_download))); + info.add(KEY_TRANSFER_UPSPEED, tr("U: %1/s - T: %2", "Upload speed: x KiB/s - Transferred: x MiB").arg(misc::friendlyUnit(sessionStatus.payload_upload_rate)).arg(misc::friendlyUnit(sessionStatus.total_payload_upload))); + return info.toString(); +} diff --git a/src/webui/btjson.h b/src/webui/btjson.h index 96b410826..1cb194c18 100644 --- a/src/webui/btjson.h +++ b/src/webui/btjson.h @@ -45,6 +45,7 @@ public: static QString getTrackersForTorrent(const QString& hash); static QString getPropertiesForTorrent(const QString& hash); static QString getFilesForTorrent(const QString& hash); + static QString getTransferInfo(); }; // class btjson #endif // BTJSON_H diff --git a/src/webui/httpconnection.cpp b/src/webui/httpconnection.cpp index 508184d6e..1b3514341 100644 --- a/src/webui/httpconnection.cpp +++ b/src/webui/httpconnection.cpp @@ -31,10 +31,9 @@ #include "httpconnection.h" #include "httpserver.h" -#include "eventmanager.h" #include "preferences.h" -#include "json.h" #include "btjson.h" +#include "prefjson.h" #include "qbtsession.h" #include "misc.h" #ifndef DISABLE_GUI @@ -160,7 +159,8 @@ void HttpConnection::translateDocument(QString& data) { QByteArray word = regex.cap(1).toLocal8Bit(); QString translation = word; - if (m_httpserver->isTranslationNeeded()) { + bool isTranslationNeeded = !Preferences().getLocale().startsWith("en"); + if (isTranslationNeeded) { int context_index = 0; do { translation = qApp->translate(contexts[context_index].c_str(), word.constData(), 0, QCoreApplication::UnicodeUTF8, 1); @@ -367,23 +367,16 @@ void HttpConnection::respondFilesPropertiesJson(const QString& hash) { } void HttpConnection::respondPreferencesJson() { - EventManager* manager = m_httpserver->eventManager(); - QString string = json::toJson(manager->getGlobalPreferences()); m_generator.setStatusLine(200, "OK"); m_generator.setContentTypeByExt("js"); - m_generator.setMessage(string); + m_generator.setMessage(prefjson::getPreferences()); write(); } void HttpConnection::respondGlobalTransferInfoJson() { - QVariantMap info; - session_status sessionStatus = QBtSession::instance()->getSessionStatus(); - info["DlInfos"] = tr("D: %1/s - T: %2", "Download speed: x KiB/s - Transferred: x MiB").arg(misc::friendlyUnit(sessionStatus.payload_download_rate)).arg(misc::friendlyUnit(sessionStatus.total_payload_download)); - info["UpInfos"] = tr("U: %1/s - T: %2", "Upload speed: x KiB/s - Transferred: x MiB").arg(misc::friendlyUnit(sessionStatus.payload_upload_rate)).arg(misc::friendlyUnit(sessionStatus.total_payload_upload)); - QString string = json::toJson(info); m_generator.setStatusLine(200, "OK"); m_generator.setContentTypeByExt("js"); - m_generator.setMessage(string); + m_generator.setMessage(btjson::getTransferInfo()); write(); } @@ -464,9 +457,7 @@ void HttpConnection::respondCommand(const QString& command) { return; } if (command == "setPreferences") { - QString json_str = m_parser.post("json"); - EventManager* manager = m_httpserver->eventManager(); - manager->setGlobalPreferences(json::fromJson(json_str)); + prefjson::setPreferences(m_parser.post("json")); return; } if (command == "setFilePrio") { diff --git a/src/webui/httpserver.cpp b/src/webui/httpserver.cpp index b9346916c..e41ead27c 100644 --- a/src/webui/httpserver.cpp +++ b/src/webui/httpserver.cpp @@ -31,7 +31,6 @@ #include "httpserver.h" #include "httpconnection.h" -#include "eventmanager.h" #include "qbtsession.h" #include #include @@ -89,16 +88,14 @@ void HttpServer::resetNbFailedAttemptsForIp(const QString& ip) { m_clientFailedAttempts.remove(ip); } -HttpServer::HttpServer(QObject* parent) : QTcpServer(parent), - m_eventManager(new EventManager(this)) { +HttpServer::HttpServer(QObject* parent) : QTcpServer(parent) +{ const Preferences pref; m_username = pref.getWebUiUsername().toLocal8Bit(); m_passwordSha1 = pref.getWebUiPassword().toLocal8Bit(); m_localAuthEnabled = pref.isWebUiLocalAuthEnabled(); - m_needsTranslation = !Preferences().getLocale().startsWith("en"); - connect(m_eventManager, SIGNAL(localeChanged(QString)), SLOT(onLocaleChanged(QString))); // HTTPS-related #ifndef QT_NO_OPENSSL @@ -141,7 +138,6 @@ HttpServer::HttpServer(QObject* parent) : QTcpServer(parent), } HttpServer::~HttpServer() { - delete m_eventManager; } #ifndef QT_NO_OPENSSL @@ -301,10 +297,6 @@ bool HttpServer::isAuthorized(const QByteArray& auth, return prop_response == response; } -EventManager* HttpServer::eventManager() const { - return m_eventManager; -} - void HttpServer::setlocalAuthEnabled(bool enabled) { m_localAuthEnabled = enabled; } @@ -312,11 +304,3 @@ void HttpServer::setlocalAuthEnabled(bool enabled) { bool HttpServer::isLocalAuthEnabled() const { return m_localAuthEnabled; } - -bool HttpServer::isTranslationNeeded() { - return m_needsTranslation; -} - -void HttpServer::onLocaleChanged(const QString &locale) { - m_needsTranslation = !locale.startsWith("en"); -} diff --git a/src/webui/httpserver.h b/src/webui/httpserver.h index fdd51a6ee..de83df6fd 100644 --- a/src/webui/httpserver.h +++ b/src/webui/httpserver.h @@ -64,12 +64,10 @@ public: bool isAuthorized(const QByteArray& auth, const QString& method) const; void setlocalAuthEnabled(bool enabled); bool isLocalAuthEnabled() const; - EventManager *eventManager() const; QString generateNonce() const; int NbFailedAttemptsForIp(const QString& ip) const; void increaseNbFailedAttemptsForIp(const QString& ip); void resetNbFailedAttemptsForIp(const QString& ip); - bool isTranslationNeeded(); #ifndef QT_NO_OPENSSL void enableHttps(const QSslCertificate &certificate, const QSslKey &key); @@ -81,7 +79,6 @@ private: private slots: void UnbanTimerEvent(); - void onLocaleChanged(const QString &locale); private: void handleNewConnection(QTcpSocket *socket); @@ -89,10 +86,8 @@ private: private: QByteArray m_username; QByteArray m_passwordSha1; - EventManager *m_eventManager; // TODO: Remove QHash m_clientFailedAttempts; bool m_localAuthEnabled; - bool m_needsTranslation; #ifndef QT_NO_OPENSSL bool m_https; QSslCertificate m_certificate; diff --git a/src/webui/json.cpp b/src/webui/json.cpp index 90b1d2b29..6c7f531a3 100644 --- a/src/webui/json.cpp +++ b/src/webui/json.cpp @@ -94,16 +94,6 @@ QString json::toJson(const QVariant& v) { } } -// TODO: Remove -QString json::toJson(const QVariantMap& m) { - QStringList vlist; - QVariantMap::ConstIterator it; - for (it = m.constBegin(); it != m.constEnd(); it++) { - vlist << toJson(it.key())+":"+toJson(it.value()); - } - return "{"+vlist.join(",")+"}"; -} - QVariantMap json::fromJson(const QString& json) { qDebug("JSON is %s", qPrintable(json)); QVariantMap m; @@ -165,17 +155,3 @@ QVariantMap json::fromJson(const QString& json) { } return m; } - -// TODO: Remove -QString json::toJson(const QList& v) { - QStringList res; - foreach (QVariantMap m, v) { - QStringList vlist; - QVariantMap::ConstIterator it; - for (it = m.constBegin(); it != m.constEnd(); it++) { - vlist << toJson(it.key())+":"+toJson(it.value()); - } - res << "{"+vlist.join(",")+"}"; - } - return "["+res.join(",")+"]"; -} diff --git a/src/webui/json.h b/src/webui/json.h index d9a74c217..983c6b592 100644 --- a/src/webui/json.h +++ b/src/webui/json.h @@ -37,8 +37,6 @@ namespace json { QString toJson(const QVariant& v); - QString toJson(const QVariantMap& m); // TODO: Remove - QString toJson(const QList& v); // TODO: Remove QVariantMap fromJson(const QString& json); } // namespace json diff --git a/src/webui/eventmanager.cpp b/src/webui/prefjson.cpp similarity index 71% rename from src/webui/eventmanager.cpp rename to src/webui/prefjson.cpp index 25abf0bde..b7280573c 100644 --- a/src/webui/eventmanager.cpp +++ b/src/webui/prefjson.cpp @@ -1,6 +1,6 @@ /* * Bittorrent Client using Qt4 and libtorrent. - * Copyright (C) 2006 Ishan Arora and Christophe Dumez + * Copyright (C) 2006-2012 Ishan Arora and Christophe Dumez * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,30 +28,124 @@ * Contact : chris@qbittorrent.org */ - -#include -#include "eventmanager.h" +#include "prefjson.h" +#include "jsondict.h" +#include "preferences.h" +#include "json.h" #include "qbtsession.h" #include "scannedfoldersmodel.h" -#include "misc.h" -#include "preferences.h" -//#include "proplistdelegate.h" -#include "torrentpersistentdata.h" -#include -#include + +#include #ifndef QT_NO_OPENSSL #include #include #endif +#include -using namespace libtorrent; +prefjson::prefjson() +{ +} -EventManager::EventManager(QObject *parent) - : QObject(parent) +QString prefjson::getPreferences() { + const Preferences pref; + JsonDict data; + // UI + data.add("locale", pref.getLocale()); + // Downloads + data.add("save_path", pref.getSavePath()); + data.add("temp_path_enabled", pref.isTempPathEnabled()); + data.add("temp_path", pref.getTempPath()); + data.add("scan_dirs", pref.getScanDirs()); + QVariantList var_list; + foreach (bool b, pref.getDownloadInScanDirs()) { + var_list << b; + } + data.add("download_in_scan_dirs", var_list); + data.add("export_dir_enabled", pref.isTorrentExportEnabled()); + data.add("export_dir", pref.getExportDir()); + data.add("mail_notification_enabled", pref.isMailNotificationEnabled()); + data.add("mail_notification_email", pref.getMailNotificationEmail()); + data.add("mail_notification_smtp", pref.getMailNotificationSMTP()); + data.add("mail_notification_ssl_enabled", pref.getMailNotificationSMTPSSL()); + data.add("mail_notification_auth_enabled", pref.getMailNotificationSMTPAuth()); + data.add("mail_notification_username", pref.getMailNotificationSMTPUsername()); + data.add("mail_notification_password", pref.getMailNotificationSMTPPassword()); + data.add("autorun_enabled", pref.isAutoRunEnabled()); + data.add("autorun_program", pref.getAutoRunProgram()); + data.add("preallocate_all", pref.preAllocateAllFiles()); + data.add("queueing_enabled", pref.isQueueingSystemEnabled()); + data.add("max_active_downloads", pref.getMaxActiveDownloads()); + data.add("max_active_torrents", pref.getMaxActiveTorrents()); + data.add("max_active_uploads", pref.getMaxActiveUploads()); + data.add("dont_count_slow_torrents", pref.ignoreSlowTorrentsForQueueing()); + data.add("incomplete_files_ext", pref.useIncompleteFilesExtension()); + // Connection + data.add("listen_port", pref.getSessionPort()); + data.add("upnp", pref.isUPnPEnabled()); + data.add("dl_limit", pref.getGlobalDownloadLimit()); + data.add("up_limit", pref.getGlobalUploadLimit()); + data.add("max_connec", pref.getMaxConnecs()); + data.add("max_connec_per_torrent", pref.getMaxConnecsPerTorrent()); + data.add("max_uploads_per_torrent", pref.getMaxUploadsPerTorrent()); +#if LIBTORRENT_VERSION_MINOR >= 16 + data.add("enable_utp", pref.isuTPEnabled()); + data.add("limit_utp_rate", pref.isuTPRateLimited()); +#endif + data.add("limit_tcp_overhead", pref.includeOverheadInLimits()); + data.add("alt_dl_limit", pref.getAltGlobalDownloadLimit()); + data.add("alt_up_limit", pref.getAltGlobalUploadLimit()); + data.add("scheduler_enabled", pref.isSchedulerEnabled()); + const QTime start_time = pref.getSchedulerStartTime(); + data.add("schedule_from_hour", start_time.hour()); + data.add("schedule_from_min", start_time.minute()); + const QTime end_time = pref.getSchedulerEndTime(); + data.add("schedule_to_hour", end_time.hour()); + data.add("schedule_to_min", end_time.minute()); + data.add("scheduler_days", pref.getSchedulerDays()); + // Bittorrent + data.add("dht", pref.isDHTEnabled()); + data.add("dhtSameAsBT", pref.isDHTPortSameAsBT()); + data.add("dht_port", pref.getDHTPort()); + data.add("pex", pref.isPeXEnabled()); + data.add("lsd", pref.isLSDEnabled()); + data.add("encryption", pref.getEncryptionSetting()); +#if LIBTORRENT_VERSION_MINOR >= 16 + data.add("anonymous_mode", pref.isAnonymousModeEnabled()); +#endif + // Proxy + data.add("proxy_type", pref.getProxyType()); + data.add("proxy_ip", pref.getProxyIp()); + data.add("proxy_port", pref.getProxyPort()); + data.add("proxy_peer_connections", pref.proxyPeerConnections()); + data.add("proxy_auth_enabled", pref.isProxyAuthEnabled()); + data.add("proxy_username", pref.getProxyUsername()); + data.add("proxy_password", pref.getProxyPassword()); + // IP Filter + data.add("ip_filter_enabled", pref.isFilteringEnabled()); + data.add("ip_filter_path", pref.getFilter()); + // Web UI + data.add("web_ui_port", pref.getWebUiPort()); + data.add("web_ui_username", pref.getWebUiUsername()); + data.add("web_ui_password", pref.getWebUiPassword()); + data.add("bypass_local_auth", !pref.isWebUiLocalAuthEnabled()); + data.add("use_https", pref.isWebUiHttpsEnabled()); + data.add("ssl_key", QString::fromAscii(pref.getWebUiHttpsKey())); + data.add("ssl_cert", QString::fromAscii(pref.getWebUiHttpsCertificate())); + // DynDns + data.add("dyndns_enabled", pref.isDynDNSEnabled()); + data.add("dyndns_service", pref.getDynDNSService()); + data.add("dyndns_username", pref.getDynDNSUsername()); + data.add("dyndns_password", pref.getDynDNSPassword()); + data.add("dyndns_domain", pref.getDynDomainName()); + + return data.toString(); } -void EventManager::setGlobalPreferences(QVariantMap m) { +void prefjson::setPreferences(const QString& json) +{ + const QVariantMap m = json::fromJson(json); + // UI Preferences pref; if (m.contains("locale")) { @@ -66,7 +160,6 @@ void EventManager::setGlobalPreferences(QVariantMap m) { qApp->installTranslator(translator); pref.setLocale(locale); - emit localeChanged(locale); } } // Downloads @@ -252,97 +345,3 @@ void EventManager::setGlobalPreferences(QVariantMap m) { // Reload preferences QBtSession::instance()->configureSession(); } - -QVariantMap EventManager::getGlobalPreferences() const { - const Preferences pref; - QVariantMap data; - // UI - data["locale"] = pref.getLocale(); - // Downloads - data["save_path"] = pref.getSavePath(); - data["temp_path_enabled"] = pref.isTempPathEnabled(); - data["temp_path"] = pref.getTempPath(); - data["scan_dirs"] = pref.getScanDirs(); - QVariantList var_list; - foreach (bool b, pref.getDownloadInScanDirs()) { - var_list << b; - } - data["download_in_scan_dirs"] = var_list; - data["export_dir_enabled"] = pref.isTorrentExportEnabled(); - data["export_dir"] = pref.getExportDir(); - data["mail_notification_enabled"] = pref.isMailNotificationEnabled(); - data["mail_notification_email"] = pref.getMailNotificationEmail(); - data["mail_notification_smtp"] = pref.getMailNotificationSMTP(); - data["mail_notification_ssl_enabled"] = pref.getMailNotificationSMTPSSL(); - data["mail_notification_auth_enabled"] = pref.getMailNotificationSMTPAuth(); - data["mail_notification_username"] = pref.getMailNotificationSMTPUsername(); - data["mail_notification_password"] = pref.getMailNotificationSMTPPassword(); - data["autorun_enabled"] = pref.isAutoRunEnabled(); - data["autorun_program"] = pref.getAutoRunProgram(); - data["preallocate_all"] = pref.preAllocateAllFiles(); - data["queueing_enabled"] = pref.isQueueingSystemEnabled(); - data["max_active_downloads"] = pref.getMaxActiveDownloads(); - data["max_active_torrents"] = pref.getMaxActiveTorrents(); - data["max_active_uploads"] = pref.getMaxActiveUploads(); - data["dont_count_slow_torrents"] = pref.ignoreSlowTorrentsForQueueing(); - data["incomplete_files_ext"] = pref.useIncompleteFilesExtension(); - // Connection - data["listen_port"] = pref.getSessionPort(); - data["upnp"] = pref.isUPnPEnabled(); - data["dl_limit"] = pref.getGlobalDownloadLimit(); - data["up_limit"] = pref.getGlobalUploadLimit(); - data["max_connec"] = pref.getMaxConnecs(); - data["max_connec_per_torrent"] = pref.getMaxConnecsPerTorrent(); - data["max_uploads_per_torrent"] = pref.getMaxUploadsPerTorrent(); -#if LIBTORRENT_VERSION_MINOR >= 16 - data["enable_utp"] = pref.isuTPEnabled(); - data["limit_utp_rate"] = pref.isuTPRateLimited(); -#endif - data["limit_tcp_overhead"] = pref.includeOverheadInLimits(); - data["alt_dl_limit"] = pref.getAltGlobalDownloadLimit(); - data["alt_up_limit"] = pref.getAltGlobalUploadLimit(); - data["scheduler_enabled"] = pref.isSchedulerEnabled(); - const QTime start_time = pref.getSchedulerStartTime(); - data["schedule_from_hour"] = start_time.hour(); - data["schedule_from_min"] = start_time.minute(); - const QTime end_time = pref.getSchedulerEndTime(); - data["schedule_to_hour"] = end_time.hour(); - data["schedule_to_min"] = end_time.minute(); - data["scheduler_days"] = pref.getSchedulerDays(); - // Bittorrent - data["dht"] = pref.isDHTEnabled(); - data["dhtSameAsBT"] = pref.isDHTPortSameAsBT(); - data["dht_port"] = pref.getDHTPort(); - data["pex"] = pref.isPeXEnabled(); - data["lsd"] = pref.isLSDEnabled(); - data["encryption"] = pref.getEncryptionSetting(); -#if LIBTORRENT_VERSION_MINOR >= 16 - data["anonymous_mode"] = pref.isAnonymousModeEnabled(); -#endif - // Proxy - data["proxy_type"] = pref.getProxyType(); - data["proxy_ip"] = pref.getProxyIp(); - data["proxy_port"] = pref.getProxyPort(); - data["proxy_peer_connections"] = pref.proxyPeerConnections(); - data["proxy_auth_enabled"] = pref.isProxyAuthEnabled(); - data["proxy_username"] = pref.getProxyUsername(); - data["proxy_password"] = pref.getProxyPassword(); - // IP Filter - data["ip_filter_enabled"] = pref.isFilteringEnabled(); - data["ip_filter_path"] = pref.getFilter(); - // Web UI - data["web_ui_port"] = pref.getWebUiPort(); - data["web_ui_username"] = pref.getWebUiUsername(); - data["web_ui_password"] = pref.getWebUiPassword(); - data["bypass_local_auth"] = !pref.isWebUiLocalAuthEnabled(); - data["use_https"] = pref.isWebUiHttpsEnabled(); - data["ssl_key"] = QString::fromAscii(pref.getWebUiHttpsKey()); - data["ssl_cert"] = QString::fromAscii(pref.getWebUiHttpsCertificate()); - // DynDns - data["dyndns_enabled"] = pref.isDynDNSEnabled(); - data["dyndns_service"] = pref.getDynDNSService(); - data["dyndns_username"] = pref.getDynDNSUsername(); - data["dyndns_password"] = pref.getDynDNSPassword(); - data["dyndns_domain"] = pref.getDynDomainName(); - return data; -} diff --git a/src/webui/eventmanager.h b/src/webui/prefjson.h similarity index 72% rename from src/webui/eventmanager.h rename to src/webui/prefjson.h index f6bb7924b..b061fa2c5 100644 --- a/src/webui/eventmanager.h +++ b/src/webui/prefjson.h @@ -1,6 +1,6 @@ /* * Bittorrent Client using Qt4 and libtorrent. - * Copyright (C) 2006 Ishan Arora and Christophe Dumez + * Copyright (C) 2006-2012 Ishan Arora and Christophe Dumez * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -28,30 +28,20 @@ * Contact : chris@qbittorrent.org */ +#ifndef PREFJSON_H +#define PREFJSON_H -#ifndef EVENTMANAGER_H -#define EVENTMANAGER_H +#include -#include "qtorrenthandle.h" -#include -#include - -class EventManager : public QObject +class prefjson { - Q_OBJECT - Q_DISABLE_COPY(EventManager) - -protected: - void update(QVariantMap event); +private: + prefjson(); public: - EventManager(QObject *parent); - QList getPropFilesInfo(QString hash) const; - QVariantMap getGlobalPreferences() const; - void setGlobalPreferences(QVariantMap m); + static QString getPreferences(); + static void setPreferences(const QString& json); -signals: - void localeChanged(const QString &locale); }; -#endif +#endif // PREFJSON_H diff --git a/src/webui/scripts/client.js b/src/webui/scripts/client.js index b97f65f77..04970f1b9 100644 --- a/src/webui/scripts/client.js +++ b/src/webui/scripts/client.js @@ -218,8 +218,8 @@ window.addEvent('load', function(){ }, onSuccess: function(info) { if(info) { - $("DlInfos").set('html', info.DlInfos); - $("UpInfos").set('html', info.UpInfos); + $("DlInfos").set('html', info.dl_info); + $("UpInfos").set('html', info.up_info); waitingTrInfo=false; loadTransferInfo.delay(3000); } diff --git a/src/webui/webui.pri b/src/webui/webui.pri index 914232860..4cae09b6c 100644 --- a/src/webui/webui.pri +++ b/src/webui/webui.pri @@ -4,20 +4,20 @@ HEADERS += $$PWD/httpserver.h \ $$PWD/httpconnection.h \ $$PWD/httprequestparser.h \ $$PWD/httpresponsegenerator.h \ - $$PWD/eventmanager.h \ $$PWD/json.h \ $$PWD/jsonlist.h \ $$PWD/jsondict.h \ - $$PWD/btjson.h + $$PWD/btjson.h \ + $$PWD/prefjson.h SOURCES += $$PWD/httpserver.cpp \ $$PWD/httpconnection.cpp \ $$PWD/httprequestparser.cpp \ $$PWD/httpresponsegenerator.cpp \ - $$PWD/eventmanager.cpp \ $$PWD/jsonlist.cpp \ $$PWD/jsondict.cpp \ $$PWD/btjson.cpp \ - $$PWD/json.cpp + $$PWD/json.cpp \ + $$PWD/prefjson.cpp RESOURCES += $$PWD/webui.qrc