From 6adada01e428a8527c7297353499af5c55f8df22 Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Thu, 19 Feb 2009 01:12:58 +0000 Subject: [PATCH] rearrange the details module to make it more managable --- deluge/ui/web/js/deluge-details.js | 142 ++++++++++++++++++++--------- deluge/ui/web/js/deluge-ui.js | 7 +- 2 files changed, 103 insertions(+), 46 deletions(-) diff --git a/deluge/ui/web/js/deluge-details.js b/deluge/ui/web/js/deluge-details.js index 493955c0d..31dcdd207 100644 --- a/deluge/ui/web/js/deluge-details.js +++ b/deluge/ui/web/js/deluge-details.js @@ -1,43 +1,103 @@ -Deluge.Details = new Ext.TabPanel({ - region: 'south', - split: true, - height: 200, - minSize: 100, - collapsible: true, - title: 'Details', - margins: '0 5 5 5', - activeTab: 0, - items: [{ - id: 'status', - title: 'Status' - },{ - id: 'details', - title: 'Details' - },{ - id: 'files', - title: 'Files' - },{ - id: 'peers', - title: 'Peers' - },{ - id: 'options', - title: 'Options' - }] -}); +Deluge.Details = {} -Deluge.Details.StatusProgressBar = new Ext.ProgressBar({ - text: "0% Stopped", - id: "pbar-status", - cls: 'deluge-status-progressbar' -}); -Deluge.Details.Status = Deluge.Details.items.get('status'); -Deluge.Details.Status.add(Deluge.Details.StatusProgressBar); -Deluge.Details.Status.add({ - id: 'status-details', - cls: 'deluge-status', - border: false -}); - -Deluge.Details.update = function(torrentId) { - Deluge.Details.getActiveTab().update(torrent); +Deluge.Details.Status = { + onRender: function(panel) { + this.panel = panel; + this.progressBar = new Ext.ProgressBar({ + text: "0% Stopped", + id: "pbar-status", + cls: 'deluge-status-progressbar' + }); + this.panel.add(this.progressBar); + this.panel.add({ + id: 'status-details', + cls: 'deluge-status', + border: false, + listeners: {'render': Deluge.Details.Status.onStatusRender} + }); + }, + + onStatusRender: function(panel) { + this.status = panel; + this.status.load({ + url: "/render/tab_statistics.html", + text: _("Loading") + "...", + callback: this.onStatusLoaded + }); + }, + + onStatusLoaded: function() { + alert("loaded"); + } } + +Deluge.Details.Details = { + onRender: function(panel) { + this.panel = panel.load({ + url: "/render/tab_details.html" + }); + } +} + +$extend(Deluge.Details, { + + update: function(torrentId) { + + }, + + Panel: new Ext.TabPanel({ + region: 'south', + split: true, + height: 200, + minSize: 100, + collapsible: true, + margins: '0 5 5 5', + activeTab: 0, + items: [{ + id: 'status', + title: _('Status'), + listeners: {'render': Deluge.Details.Status.onRender} + },{ + id: 'details', + title: _('Details'), + listeners: {'render': Deluge.Details.Details.onRender} + },{ + id: 'files', + title: _('Files') + },{ + id: 'peers', + title: _('Peers') + },{ + id: 'options', + title: _('Options') + }] + }) +}); + +/*Deluge.Details.Status = { + onShow: function(panel) { + this.panel = panel; + }, + + initialize: function() { + this.Panel = Deluge.Details.Panel.items.get('status'); + this.ProgressBar = new Ext.ProgressBar({ + text: "0% Stopped", + id: "pbar-status", + cls: 'deluge-status-progressbar' + }); + this.Panel.add(this.ProgressBar); + + + this.Panel.add({ + id: 'status-details', + cls: 'deluge-status', + border: false + }); + + //this.Details = Deluge.Details.Status.Panel.items.get("status-details").load({ + // url: "/render/tab_statistics.html" + //}); + + } +}*/ \ No newline at end of file diff --git a/deluge/ui/web/js/deluge-ui.js b/deluge/ui/web/js/deluge-ui.js index 7fe3f575d..ab7de5c7a 100644 --- a/deluge/ui/web/js/deluge-ui.js +++ b/deluge/ui/web/js/deluge-ui.js @@ -7,7 +7,7 @@ Deluge.Ui = { title: 'Deluge', layout: 'border', tbar: Deluge.ToolBar, - items: [Deluge.SideBar, Deluge.Details, Deluge.Torrents], + items: [Deluge.SideBar, Deluge.Details.Panel, Deluge.Torrents], bbar: Deluge.StatusBar }); @@ -18,10 +18,7 @@ Deluge.Ui = { Deluge.Login.Window.show(); Deluge.Client = new JSON.RPC('/json'); - - Deluge.Details.Status.items.get("status-details").load({ - url: "/render/tab_statistics.html" - }); + Deluge.Details.initialize(); Deluge.SideBar = this.MainPanel.items.get('sidebar'); },