From 1b8a2bf7c140d4f27b26b04944a303d52f9eac82 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 19 Oct 2011 19:55:11 +0300 Subject: [PATCH] Web UI: Add support for speed limits scheduling --- src/preferences/options.ui | 2 +- src/webui/eventmanager.cpp | 26 +++++ src/webui/html/preferences_content.html | 133 +++++++++++++++++++++--- 3 files changed, 144 insertions(+), 17 deletions(-) diff --git a/src/preferences/options.ui b/src/preferences/options.ui index 736187624..b858fab57 100644 --- a/src/preferences/options.ui +++ b/src/preferences/options.ui @@ -1419,7 +1419,7 @@ 0 - 0 + -40 494 454 diff --git a/src/webui/eventmanager.cpp b/src/webui/eventmanager.cpp index 04936a02a..4495c2679 100644 --- a/src/webui/eventmanager.cpp +++ b/src/webui/eventmanager.cpp @@ -236,6 +236,22 @@ void EventManager::setGlobalPreferences(QVariantMap m) { #endif if(m.contains("limit_tcp_overhead")) pref.includeOverheadInLimits(m["limit_tcp_overhead"].toBool()); + if(m.contains("alt_dl_limit")) + pref.setAltGlobalDownloadLimit(m["alt_dl_limit"].toInt()); + if(m.contains("alt_up_limit")) + pref.setAltGlobalUploadLimit(m["alt_up_limit"].toInt()); + if(m.contains("scheduler_enabled")) + pref.setSchedulerEnabled(m["scheduler_enabled"].toBool()); + if(m.contains("schedule_from_hour") && m.contains("schedule_from_min")) { + pref.setSchedulerStartTime(QTime(m["schedule_from_hour"].toInt(), + m["schedule_from_min"].toInt())); + } + if(m.contains("schedule_to_hour") && m.contains("schedule_to_min")) { + pref.setSchedulerEndTime(QTime(m["schedule_to_hour"].toInt(), + m["schedule_to_min"].toInt())); + } + if(m.contains("scheduler_days")) + pref.setSchedulerDays(scheduler_days(m["scheduler_days"].toInt())); // Bittorrent if(m.contains("dht")) pref.setDHTEnabled(m["dht"].toBool()); @@ -360,6 +376,16 @@ QVariantMap EventManager::getGlobalPreferences() const { 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(); diff --git a/src/webui/html/preferences_content.html b/src/webui/html/preferences_content.html index ef1887389..85975e3cf 100644 --- a/src/webui/html/preferences_content.html +++ b/src/webui/html/preferences_content.html @@ -1,4 +1,4 @@ -
+
_(Listening Port) @@ -60,6 +60,47 @@
+
+ _(Alternative Global Rate Limits) + + + + + + + + + +
+ _(Upload:) +   _(KiB/s)
+ _(Download:) +   _(KiB/s)
+ +
+ + + _(from) + : + _(to) + : +
+ _(When:) + +
+
+