Module: deluge
Branch: master
Commit: 323638a751b63af89780e1b12baa642ddd5bdfbe

Author: Damien Churchill <[email protected]>
Date:   Sat Mar 27 12:40:16 2010 +0000

add a new namespace for data records, Deluge.data
rename Deluge.Torrent to Deluge.data.Torrent
add new file Deluge.data.Peer that contains records in the Peers grid
add a singleton that contains sort functions

---

 deluge/ui/web/js/deluge-all/.build                 |    1 +
 deluge/ui/web/js/deluge-all/Deluge.Sorters.js      |   50 ++++++++++++++
 deluge/ui/web/js/deluge-all/Deluge.Torrents.js     |    2 +-
 deluge/ui/web/js/deluge-all/Deluge.data.Peer.js    |   71 ++++++++++++++++++++
 .../{Deluge.Torrent.js => Deluge.data.Torrent.js}  |   10 ++-
 deluge/ui/web/server.py                            |    4 +-
 6 files changed, 132 insertions(+), 6 deletions(-)

diff --git a/deluge/ui/web/js/deluge-all/.build 
b/deluge/ui/web/js/deluge-all/.build
index 8002f0d..4eaaec9 100644
--- a/deluge/ui/web/js/deluge-all/.build
+++ b/deluge/ui/web/js/deluge-all/.build
@@ -4,6 +4,7 @@ add_file "Deluge.js"
 add_file "Deluge.Formatters.js"
 add_file "Deluge.Keys.js"
 add_file "Deluge.Menus.js"
+add_file "Deluge.Sorters.js"
 add_file "Deluge.EventsManager.js"
 add_file "Deluge.OptionsManager.js"
 add_file "Deluge.MultiOptionsManager.js"
diff --git a/deluge/ui/web/js/deluge-all/Deluge.Sorters.js 
b/deluge/ui/web/js/deluge-all/Deluge.Sorters.js
new file mode 100644
index 0000000..33ad9d6
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/Deluge.Sorters.js
@@ -0,0 +1,50 @@
+/*
+Script: Deluge.data.Peer.js
+    Contains the definition for a Peer record.
+
+Copyright:
+    (C) Damien Churchill 2009-2010 <[email protected]>
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 3, or (at your option)
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, write to:
+            The Free Software Foundation, Inc.,
+            51 Franklin Street, Fifth Floor
+            Boston, MA  02110-1301, USA.
+
+    In addition, as a special exception, the copyright holders give
+    permission to link the code of portions of this program with the OpenSSL
+    library.
+    You must obey the GNU General Public License in all respects for all of
+    the code used other than OpenSSL. If you modify file(s) with this
+    exception, you may extend this exception to your version of the file(s),
+    but you are not obligated to do so. If you do not wish to do so, delete
+    this exception statement from your version. If you delete this exception
+    statement from all source files in the program, then also delete it here.
+*/
+
+Ext.namespace('Deluge');
+
+/**
+ * Common sort functions that can be used for data Stores.
+ *
+ * @author Damien Churchill <[email protected]>
+ * @version 1.3
+ *
+ * @class Deluge.Sorters
+ * @singleton
+ */ 
+Deluge.Sorters = {
+       ipAddress: 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]);
+       }
+}
diff --git a/deluge/ui/web/js/deluge-all/Deluge.Torrents.js 
b/deluge/ui/web/js/deluge-all/Deluge.Torrents.js
index 4aae0b7..6a2caa6 100644
--- a/deluge/ui/web/js/deluge-all/Deluge.Torrents.js
+++ b/deluge/ui/web/js/deluge-all/Deluge.Torrents.js
@@ -273,7 +273,7 @@ Copyright:
                                }
                                record.endEdit();
                        } else {
-                               var record = new Deluge.Torrent(torrent);
+                               var record = new Deluge.data.Torrent(torrent);
                                record.id = t;
                                this.torrents[t] = 1;
                                newTorrents.push(record);
diff --git a/deluge/ui/web/js/deluge-all/Deluge.data.Peer.js 
b/deluge/ui/web/js/deluge-all/Deluge.data.Peer.js
new file mode 100644
index 0000000..4b5e52a
--- /dev/null
+++ b/deluge/ui/web/js/deluge-all/Deluge.data.Peer.js
@@ -0,0 +1,71 @@
+/*
+Script: Deluge.data.Peer.js
+       Contains the definition for a Peer record.
+
+Copyright:
+    (C) Damien Churchill 2009-2010 <[email protected]>
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 3, or (at your option)
+    any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, write to:
+            The Free Software Foundation, Inc.,
+            51 Franklin Street, Fifth Floor
+            Boston, MA  02110-1301, USA.
+
+    In addition, as a special exception, the copyright holders give
+    permission to link the code of portions of this program with the OpenSSL
+    library.
+    You must obey the GNU General Public License in all respects for all of
+    the code used other than OpenSSL. If you modify file(s) with this
+    exception, you may extend this exception to your version of the file(s),
+    but you are not obligated to do so. If you do not wish to do so, delete
+    this exception statement from your version. If you delete this exception
+    statement from all source files in the program, then also delete it here.
+*/
+
+Ext.namespace('Deluge.data');
+
+/**
+ * Deluge.data.Peer record
+ *
+ * @author Damien Churchill <[email protected]>
+ * @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: 'address',
+               type: 'string',
+               sortType: Deluge.Sorters.ipSorter
+       }, {
+               name: 'client',
+               type: 'string'
+       }, {
+               name: 'progress',
+               type: 'float'
+       }, {
+               name: 'downspeed',
+               type: 'int'
+       }, {
+               name: 'upspeed',
+               type: 'int'
+       }, {
+               name: 'seed',
+               type: 'int'
+       }
+]);
diff --git a/deluge/ui/web/js/deluge-all/Deluge.Torrent.js 
b/deluge/ui/web/js/deluge-all/Deluge.data.Torrent.js
similarity index 92%
rename from deluge/ui/web/js/deluge-all/Deluge.Torrent.js
rename to deluge/ui/web/js/deluge-all/Deluge.data.Torrent.js
index 979587a..7f8ffc6 100644
--- a/deluge/ui/web/js/deluge-all/Deluge.Torrent.js
+++ b/deluge/ui/web/js/deluge-all/Deluge.data.Torrent.js
@@ -1,5 +1,5 @@
 /*
-Script: Deluge.Torrent.js
+Script: Deluge.data.Torrent.js
        Contains the Deluge.Torrent record.
 
 Copyright:
@@ -31,18 +31,20 @@ Copyright:
        statement from all source files in the program, then also delete it 
here.
 */
 
+Ext.namespace('Deluge.data');
+
 /**
- * Deluge.Torrent record
+ * Deluge.data.Torrent record
  *
  * @author Damien Churchill <[email protected]>
  * @version 1.3
  *
- * @class Deluge.Torrent
+ * @class Deluge.data.Torrent
  * @extends Ext.data.Record
  * @constructor
  * @param {Object} data The torrents data
  */
-Deluge.Torrent = Ext.data.Record.create([{
+Deluge.data.Torrent = Ext.data.Record.create([{
                name: 'queue',
                type: 'int'
        }, {
diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py
index 3072c2a..1638277 100644
--- a/deluge/ui/web/server.py
+++ b/deluge/ui/web/server.py
@@ -325,9 +325,12 @@ class TopLevel(resource.Resource):
         "js/deluge-all/Deluge.js",
         "js/deluge-all/Deluge.Formatters.js",
         "js/deluge-all/Deluge.Menus.js",
+        "js/deluge-all/Deluge.Sorters.js",
         "js/deluge-all/Deluge.EventsManager.js",
         "js/deluge-all/Deluge.OptionsManager.js",
         "js/deluge-all/Deluge.MultiOptionsManager.js",
+        "js/deluge-all/Deluge.data.Peer.js",
+        "js/deluge-all/Deluge.data.Torrent.js",
         "js/deluge-all/Deluge.Add.js",
         "js/deluge-all/Deluge.Add.File.js",
         "js/deluge-all/Deluge.Add.Url.js",
@@ -362,7 +365,6 @@ class TopLevel(resource.Resource):
         "js/deluge-all/Deluge.Sidebar.js",
         "js/deluge-all/Deluge.Statusbar.js",
         "js/deluge-all/Deluge.Toolbar.js",
-        "js/deluge-all/Deluge.Torrent.js",
         "js/deluge-all/Deluge.Torrents.js",
         "js/deluge-all/Deluge.UI.js"
     ]

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to