summaryrefslogtreecommitdiffstats
path: root/deluge/ui/web/js/deluge-all/data
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/ui/web/js/deluge-all/data')
-rw-r--r--deluge/ui/web/js/deluge-all/data/.order1
-rw-r--r--deluge/ui/web/js/deluge-all/data/PeerRecord.js53
-rw-r--r--deluge/ui/web/js/deluge-all/data/SortTypes.js37
-rw-r--r--deluge/ui/web/js/deluge-all/data/TorrentRecord.js121
4 files changed, 212 insertions, 0 deletions
diff --git a/deluge/ui/web/js/deluge-all/data/.order b/deluge/ui/web/js/deluge-all/data/.order
new file mode 100644
index 0000000..f9befc4
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/data/.order
@@ -0,0 +1 @@
++ SortTypes.js
diff --git a/deluge/ui/web/js/deluge-all/data/PeerRecord.js b/deluge/ui/web/js/deluge-all/data/PeerRecord.js
new file mode 100644
index 0000000..7f33769
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/data/PeerRecord.js
@@ -0,0 +1,53 @@
+/**
+ * Deluge.data.PeerRecord.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.data');
+
+/**
+ * Deluge.data.Peer record
+ *
+ * @author Damien Churchill <damoxc@gmail.com>
+ * @version 1.3
+ *
+ * @class Deluge.data.Peer
+ * @extends Ext.data.Record
+ * @constructor
+ * @param {Object} data The peer data
+ */
+Deluge.data.Peer = Ext.data.Record.create([
+ {
+ name: 'country',
+ type: 'string',
+ },
+ {
+ name: 'ip',
+ type: 'string',
+ sortType: Deluge.data.SortTypes.asIPAddress,
+ },
+ {
+ name: 'client',
+ type: 'string',
+ },
+ {
+ name: 'progress',
+ type: 'float',
+ },
+ {
+ name: 'down_speed',
+ type: 'int',
+ },
+ {
+ name: 'up_speed',
+ type: 'int',
+ },
+ {
+ name: 'seed',
+ type: 'int',
+ },
+]);
diff --git a/deluge/ui/web/js/deluge-all/data/SortTypes.js b/deluge/ui/web/js/deluge-all/data/SortTypes.js
new file mode 100644
index 0000000..199f895
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/data/SortTypes.js
@@ -0,0 +1,37 @@
+/**
+ * Deluge.data.SortTypes.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.data');
+
+/**
+ * Common sort functions that can be used for data Stores.
+ *
+ * @author Damien Churchill <damoxc@gmail.com>
+ * @version 1.3
+ *
+ * @class Deluge.data.SortTypes
+ * @singleton
+ */
+Deluge.data.SortTypes = {
+ // prettier-ignore
+ asIPAddress: function(value) {
+ var d = value.match(
+ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/
+ );
+ return ((+d[1] * 256 + (+d[2])) * 256 + (+d[3])) * 256 + (+d[4]);
+ },
+
+ asQueuePosition: function(value) {
+ return value > -1 ? value : Number.MAX_VALUE;
+ },
+
+ asName: function(value) {
+ return String(value).toLowerCase();
+ },
+};
diff --git a/deluge/ui/web/js/deluge-all/data/TorrentRecord.js b/deluge/ui/web/js/deluge-all/data/TorrentRecord.js
new file mode 100644
index 0000000..e510234
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/data/TorrentRecord.js
@@ -0,0 +1,121 @@
+/**
+ * Deluge.data.TorrentRecord.js
+ *
+ * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
+ * the additional special exception to link portions of this program with the OpenSSL library.
+ * See LICENSE for more details.
+ */
+Ext.namespace('Deluge.data');
+
+/**
+ * Deluge.data.Torrent record
+ *
+ * @author Damien Churchill <damoxc@gmail.com>
+ * @version 1.3
+ *
+ * @class Deluge.data.Torrent
+ * @extends Ext.data.Record
+ * @constructor
+ * @param {Object} data The torrents data
+ */
+Deluge.data.Torrent = Ext.data.Record.create([
+ {
+ name: 'queue',
+ type: 'int',
+ },
+ {
+ name: 'name',
+ type: 'string',
+ sortType: Deluge.data.SortTypes.asName,
+ },
+ {
+ name: 'total_wanted',
+ type: 'int',
+ },
+ {
+ name: 'state',
+ type: 'string',
+ },
+ {
+ name: 'progress',
+ type: 'int',
+ },
+ {
+ name: 'num_seeds',
+ type: 'int',
+ },
+ {
+ name: 'total_seeds',
+ type: 'int',
+ },
+ {
+ name: 'num_peers',
+ type: 'int',
+ },
+ {
+ name: 'total_peers',
+ type: 'int',
+ },
+ {
+ name: 'download_payload_rate',
+ type: 'int',
+ },
+ {
+ name: 'upload_payload_rate',
+ type: 'int',
+ },
+ {
+ name: 'eta',
+ type: 'int',
+ },
+ {
+ name: 'ratio',
+ type: 'float',
+ },
+ {
+ name: 'distributed_copies',
+ type: 'float',
+ },
+ {
+ name: 'time_added',
+ type: 'int',
+ },
+ {
+ name: 'tracker_host',
+ type: 'string',
+ },
+ {
+ name: 'save_path',
+ type: 'string',
+ },
+ {
+ name: 'total_done',
+ type: 'int',
+ },
+ {
+ name: 'total_uploaded',
+ type: 'int',
+ },
+ {
+ name: 'total_remaining',
+ type: 'int',
+ },
+ {
+ name: 'max_download_speed',
+ type: 'int',
+ },
+ {
+ name: 'max_upload_speed',
+ type: 'int',
+ },
+ {
+ name: 'seeds_peers_ratio',
+ type: 'float',
+ },
+ {
+ name: 'time_since_transfer',
+ type: 'int',
+ },
+]);