diff --git a/deluge/ui/web/css/deluge.css b/deluge/ui/web/css/deluge.css
index 972888485..204a76ebf 100644
--- a/deluge/ui/web/css/deluge.css
+++ b/deluge/ui/web/css/deluge.css
@@ -194,4 +194,27 @@ input {
.x-deluge-add-file-checkbox {
margin-top: 2px;
+}
+
+/* Filepriority styles */
+.x-no-download, .x-normal-download, .x-high-download, .x-highest-download {
+ padding-left: 20px;
+ background-repeat: no-repeat;
+ line-height: 16px;
+}
+
+.x-no-download {
+ background-image: url(/icons/no_download.png);
+}
+
+.x-normal-download {
+ background-image: url(/icons/normal.png);
+}
+
+.x-high-download {
+ background-image: url(/icons/high.png);
+}
+
+.x-highest-download {
+ background-image: url(/icons/highest.png);
}
\ No newline at end of file
diff --git a/deluge/ui/web/icons/high.png b/deluge/ui/web/icons/high.png
new file mode 100644
index 000000000..977b9e509
Binary files /dev/null and b/deluge/ui/web/icons/high.png differ
diff --git a/deluge/ui/web/icons/highest.png b/deluge/ui/web/icons/highest.png
new file mode 100644
index 000000000..e383d6bc0
Binary files /dev/null and b/deluge/ui/web/icons/highest.png differ
diff --git a/deluge/ui/web/icons/no_download.png b/deluge/ui/web/icons/no_download.png
new file mode 100644
index 000000000..7af3a5189
Binary files /dev/null and b/deluge/ui/web/icons/no_download.png differ
diff --git a/deluge/ui/web/icons/normal.png b/deluge/ui/web/icons/normal.png
new file mode 100644
index 000000000..2dfaef50f
Binary files /dev/null and b/deluge/ui/web/icons/normal.png differ
diff --git a/deluge/ui/web/js/deluge-details.js b/deluge/ui/web/js/deluge-details.js
index e02f08d24..921ca2ac3 100644
--- a/deluge/ui/web/js/deluge-details.js
+++ b/deluge/ui/web/js/deluge-details.js
@@ -232,6 +232,7 @@ Deluge.Details.Files = {
text: file, // this needs to be here for sorting
size: fsize(item[0]),
progress: item[1],
+ priority: item[2],
leaf: true,
iconCls: 'x-deluge-file',
uiProvider: Ext.tree.ColumnNodeUI
@@ -298,11 +299,22 @@ function peer_address(value, p, record) {
return String.format('
{1}
', seed, value);
}
-function peer_progress(value) {
+function progress_renderer(value) {
var progress = (value * 100).toInt();
return String.format(tpl, progress, '', progress);
}
+FILE_PRIORITY_CSS = {
+ 0: 'x-no-download',
+ 1: 'x-normal-download',
+ 2: 'x-high-download',
+ 5: 'x-highest-download'
+}
+
+function priority_renderer(value) {
+ return String.format('{1}
', FILE_PRIORITY_CSS[value], _(FILE_PRIORITY[value]));
+}
+
function sort_address(value) {
var m = value.match(/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/);
var address = 0;
@@ -363,11 +375,12 @@ Deluge.Details.Panel = new Ext.TabPanel({
header: _('Progress'),
width: 150,
dataIndex: 'progress',
- renderer: peer_progress
+ renderer: progress_renderer
},{
header: _('Priority'),
width: 150,
- dataIndex: 'priority'
+ dataIndex: 'priority',
+ renderer: priority_renderer
}],
root: new Ext.tree.TreeNode({
@@ -383,7 +396,7 @@ Deluge.Details.Panel = new Ext.TabPanel({
{header: ' ', width: 30, sortable: true, renderer: flag, dataIndex: 'country'},
{header: 'Address', width: 125, sortable: true, renderer: peer_address, dataIndex: 'address'},
{header: 'Client', width: 125, sortable: true, renderer: Deluge.Formatters.plain, dataIndex: 'client'},
- {header: 'Progress', width: 150, sortable: true, renderer: peer_progress, dataIndex: 'progress'},
+ {header: 'Progress', width: 150, sortable: true, renderer: progress_renderer, dataIndex: 'progress'},
{header: 'Down Speed', width: 100, sortable: true, renderer: fspeed, dataIndex: 'downspeed'},
{header: 'Up Speed', width: 100, sortable: true, renderer: fspeed, dataIndex: 'upspeed'}
],
diff --git a/deluge/ui/web/js/deluge.js b/deluge/ui/web/js/deluge.js
index cede132e6..b25aae7a3 100644
--- a/deluge/ui/web/js/deluge.js
+++ b/deluge/ui/web/js/deluge.js
@@ -120,6 +120,17 @@ Deluge.Formatters = {
}
}
+FILE_PRIORITY = {
+ 0: 'Do Not Download',
+ 1: 'Normal Priority',
+ 2: 'High Priority',
+ 5: 'Highest Priority',
+ 'Do Not Download': 0,
+ 'Normal Priority': 1,
+ 'High Priority': 2,
+ 'Highest Priority': 5
+}
+
var fsize = Deluge.Formatters.size;
var fspeed = Deluge.Formatters.speed;
var ftime = Deluge.Formatters.timeRemaining;
diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py
index f13083678..c0c68b58a 100644
--- a/deluge/ui/web/json_api.py
+++ b/deluge/ui/web/json_api.py
@@ -332,6 +332,7 @@ class WebApi(JSONComponent):
def _on_got_files(self, torrent, d):
files = torrent.get("files")
file_progress = torrent.get("file_progress")
+ file_priorities = torrent.get("file_priorities")
paths = []
info = {}
@@ -339,12 +340,14 @@ class WebApi(JSONComponent):
path = torrent_file["path"]
paths.append(path)
torrent_file["progress"] = file_progress[index]
+ torrent_file["priority"] = file_priorities[index]
info[path] = torrent_file
def walk(path, item):
if type(item) is dict:
return item
- return [info[path]["size"], info[path]["progress"]]
+ return [info[path]["size"], info[path]["progress"],
+ info[path]["priority"]]
file_tree = uicommon.FileTree(paths)
file_tree.walk(walk)