some name changes to camelcase and a few fixes for IE7
This commit is contained in:
parent
52cbd0a435
commit
71bc34be0d
|
@ -34,15 +34,15 @@ Deluge.Widgets.TorrentGrid = new Class({
|
|||
'Checking': '/pixmaps/inactive16.png'
|
||||
},
|
||||
|
||||
get_selected_torrents: function() {
|
||||
getSelectedTorrents: function() {
|
||||
var torrentIds = [];
|
||||
this.get_selected().each(function(row) {
|
||||
this.getSelected().each(function(row) {
|
||||
torrentIds.include(row.id);
|
||||
});
|
||||
return torrentIds;
|
||||
},
|
||||
|
||||
set_torrent_filter: function(state) {
|
||||
setTorrentFilter: function(state) {
|
||||
state = state.replace(' ', '');
|
||||
this.filterer = function (r) {
|
||||
if (r.torrent.state == state) { return true } else { return false };
|
||||
|
@ -50,7 +50,7 @@ Deluge.Widgets.TorrentGrid = new Class({
|
|||
this.render();
|
||||
},
|
||||
|
||||
update_torrents: function(torrents) {
|
||||
updateTorrents: function(torrents) {
|
||||
torrents.getKeys().each(function(torrentId) {
|
||||
var torrent = torrents[torrentId]
|
||||
var torrentIds = torrents.getKeys()
|
||||
|
|
|
@ -23,7 +23,7 @@ Deluge.UI = {
|
|||
filePriorities: this.filePriorities.bindWithEvent(this),
|
||||
labelsChanged: this.labelsChanged.bindWithEvent(this)
|
||||
};
|
||||
this.loadUi.delay(100, this);
|
||||
this.loadUi.delay(250, this);
|
||||
},
|
||||
|
||||
loadUi: function() {
|
||||
|
@ -31,27 +31,29 @@ Deluge.UI = {
|
|||
|
||||
this.toolbar = new Deluge.Widgets.Toolbar();
|
||||
this.addWindow = new Deluge.Widgets.AddWindow();
|
||||
if (Browser.Engine.name != 'trident') {
|
||||
this.prefsWindow = new Deluge.Widgets.PreferencesWindow();
|
||||
}
|
||||
|
||||
this.statusbar = new Deluge.Widgets.StatusBar();
|
||||
this.labels = new Deluge.Widgets.Labels()
|
||||
this.details = new Deluge.Widgets.Details()
|
||||
|
||||
this.initialize_grid()
|
||||
this.initializeGrid()
|
||||
|
||||
this.split_horz = new Widgets.SplitPane('top', this.labels, this.grid, {
|
||||
pane1: {min: 150},
|
||||
pane2: {min: 100, expand: true}
|
||||
});
|
||||
var details = $W('details')
|
||||
this.split_vert = new Widgets.SplitPane('main', this.split_horz, details, {
|
||||
this.splitVert = new Widgets.SplitPane('main', this.split_horz, details, {
|
||||
direction: 'vertical',
|
||||
pane1: {min: 100, expand: true},
|
||||
pane2: {min: 200}
|
||||
});
|
||||
|
||||
this.vbox.addBox(this.toolbar, {fixed: true});
|
||||
this.vbox.addBox(this.split_vert);
|
||||
this.vbox.addBox(this.splitVert);
|
||||
this.vbox.addBox(this.statusbar, {fixed: true});
|
||||
this.vbox.calculatePositions();
|
||||
this.details.expand()
|
||||
|
@ -68,7 +70,7 @@ Deluge.UI = {
|
|||
this.overlay = $('overlay').dispose();
|
||||
},
|
||||
|
||||
initialize_grid: function() {
|
||||
initializeGrid: function() {
|
||||
this.grid = new Deluge.Widgets.TorrentGrid('torrents')
|
||||
|
||||
var menu = new Widgets.PopupMenu()
|
||||
|
@ -146,7 +148,7 @@ Deluge.UI = {
|
|||
this.torrents.each(function(torrent, torrent_id) {
|
||||
torrent.id = torrent_id;
|
||||
})
|
||||
this.grid.update_torrents(this.torrents);
|
||||
this.grid.updateTorrents(this.torrents);
|
||||
this.statusbar.update(this.stats);
|
||||
|
||||
if ($chk(this.grid.selectedRow))
|
||||
|
@ -180,15 +182,15 @@ Deluge.UI = {
|
|||
},
|
||||
|
||||
toolbarClick: function(event) {
|
||||
this.torrent_action(event.action);
|
||||
this.torrentAction(event.action);
|
||||
},
|
||||
|
||||
labelsChanged: function(event) {
|
||||
this.update()
|
||||
},
|
||||
|
||||
torrent_action: function(action, value) {
|
||||
var torrentIds = this.grid.get_selected_torrents();
|
||||
torrentAction: function(action, value) {
|
||||
var torrentIds = this.grid.getSelectedTorrents();
|
||||
var client = Deluge.Client;
|
||||
switch (action) {
|
||||
case 'resume':
|
||||
|
|
|
@ -36,7 +36,6 @@ Deluge.Keys = {
|
|||
'max_upload_slots','is_auto_managed', 'stop_at_ratio', 'stop_ratio',
|
||||
'remove_at_ratio', 'private', 'prioritize_first_last'
|
||||
]
|
||||
}
|
||||
Deluge.Keys.Statistics.extend(Deluge.Keys.Grid)
|
||||
|
||||
};
|
||||
Deluge.Keys.Statistics.extend(Deluge.Keys.Grid);
|
||||
Deluge.Widgets = $empty;
|
||||
|
|
|
@ -118,6 +118,7 @@ Array.implement({
|
|||
var total = 0
|
||||
this.each(function(item) {
|
||||
var value = item
|
||||
if (!$defined(value)) return;
|
||||
if ($defined(key)) { value = item[key] }
|
||||
if ($type(value) == 'number') { total += value }
|
||||
}, this)
|
||||
|
@ -128,7 +129,7 @@ Array.implement({
|
|||
Element.implement({
|
||||
getInnerSize: function() {
|
||||
this.getPadding()
|
||||
if ((/^(?:body|html)$/i).test(this.tagName)) return window.getSize();
|
||||
if ((/^(?:body|html)$/i).test(this.tagName)) return this.getWindow().getSize();
|
||||
return {x: this.clientWidth - this.padding.x, y: this.clientHeight - this.padding.y};
|
||||
},
|
||||
|
||||
|
@ -1268,7 +1269,7 @@ Widgets.DataGrid = new Class({
|
|||
this.columns[0].order = -1
|
||||
if ($chk(this.element)) { this.scanElement() } else { this.createElement }
|
||||
this.element.setStyle('MozUserSelect', 'none')
|
||||
this.resize_columns()
|
||||
this.resizeColumns()
|
||||
this.addEvent('resize', this.resized.bindWithEvent(this))
|
||||
},
|
||||
|
||||
|
@ -1371,7 +1372,7 @@ Widgets.DataGrid = new Class({
|
|||
return row
|
||||
},
|
||||
|
||||
get_selected: function() {
|
||||
getSelected: function() {
|
||||
selected = []
|
||||
this.rows.each(function(row) {
|
||||
if (row.selected) { selected.include(row) }
|
||||
|
@ -1413,13 +1414,14 @@ Widgets.DataGrid = new Class({
|
|||
if (selected) { this.selected = $A(this.body.rows).indexOf(selected) }
|
||||
},
|
||||
|
||||
resize_columns: function() {
|
||||
|
||||
var total_width = this.options.columns.sum('width')
|
||||
this.table.setStyle('width', total_width)
|
||||
resizeColumns: function() {
|
||||
var totalWidth = this.options.columns.sum('width')
|
||||
this.table.setStyle('width', totalWidth)
|
||||
var cols = this.header.getElements('th')
|
||||
cols.each(function(col, index) {
|
||||
if (this.options.columns[index]) {
|
||||
col.setStyle('width', this.options.columns[index].width)
|
||||
}
|
||||
}, this)
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue