add basic edit trackers window

This commit is contained in:
Damien Churchill 2009-05-05 18:00:32 +00:00
parent 0b1b6d65de
commit 554181a590
5 changed files with 145 additions and 4 deletions

View File

@ -184,7 +184,9 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
cls: 'x-btn-text-icon',
iconCls: 'x-deluge-edit-trackers',
border: false,
width: 100
width: 100,
handler: this.onEditTrackers,
scope: this
}]
}, {
items: [{
@ -238,6 +240,10 @@ Ext.deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
});
},
onEditTrackers: function() {
Deluge.EditTrackers.show();
},
onRequestComplete: function(torrent, options) {
}

View File

@ -0,0 +1,132 @@
/*
Script: Deluge.EditTrackers.js
Contains the edit trackers window.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
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.
*/
Ext.deluge.EditTrackers = Ext.extend(Ext.Window, {
constructor: function(config) {
config = Ext.apply({
title: _('Edit Trackers'),
width: 300,
height: 220,
bodyStyle: 'padding: 5px',
layout: 'fit',
buttonAlign: 'right',
closeAction: 'hide',
closable: true,
iconCls: 'x-deluge-edit-trackers',
plain: true,
resizable: true
}, config);
Ext.deluge.EditTrackers.superclass.constructor.call(this, config);
},
initComponent: function() {
Ext.deluge.EditTrackers.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancel, this);
this.addButton(_('Ok'), this.onOk, this);
this.grid = this.add({
xtype: 'grid',
store: new Ext.data.SimpleStore({
fields: [
{name: 'tier', mapping: 0},
{name: 'tracker', mapping: 1}
]
}),
columns: [{
header: _('Tier'),
width: 50,
sortable: true,
renderer: fplain,
dataIndex: 'tier'
}, {
id:'tracker',
header: _('Tracker'),
sortable: true,
renderer: fplain,
dataIndex: 'tracker'
}],
stripeRows: true,
selModel: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
'rowselect': {fn: this.onSelect, scope: this}
}
}),
autoExpandColumn: 'tracker',
deferredRender:false,
autoScroll:true,
margins: '0 0 0 0',
bbar: new Ext.Toolbar({
items: [
{
id: 'up',
cls: 'x-btn-text-icon',
text: _('Up'),
icon: '/icons/up.png',
handler: this.onUp,
scope: this
}, {
id: 'down',
cls: 'x-btn-text-icon',
text: _('Down'),
icon: '/icons/down.png',
handler: this.onDown,
scope: this
}, '->', {
id: 'add',
cls: 'x-btn-text-icon',
text: _('Add'),
icon: '/icons/add.png',
handler: this.onAdd,
scope: this
}, {
id: 'remove',
cls: 'x-btn-text-icon',
text: _('Remove'),
icon: '/icons/remove.png',
handler: this.onRemove,
scope: this
}
]
})
});
},
onCancel: function() {
this.hide();
},
onHide: function() {
this.grid.getStore().removeAll();
},
onOk: function() {
this.hide();
},
onShow: function() {
}
});
Deluge.EditTrackers = new Ext.deluge.EditTrackers();

View File

@ -48,6 +48,9 @@ Deluge.Menus = {
}
});
break;
case 'edit_trackers':
Deluge.EditTrackers.show();
break;
case 'update':
Deluge.Client.core.force_reannounce(ids, {
success: function() {
@ -208,7 +211,7 @@ Deluge.Menus.Torrent = new Ext.menu.Menu({
handler: Deluge.Menus.onTorrentAction,
scope: Deluge.Menus
}, {
edit: 'edit_trackers',
id: 'edit_trackers',
text: _('Edit Trackers'),
icon: '/icons/edit_trackers.png',
handler: Deluge.Menus.onTorrentAction,

View File

@ -1,4 +1,4 @@
DELUGE_FILES="Deluge.js Deluge.Formatters.js Deluge.Menus.js Deluge.Events.js Deluge.Add.js Deluge.Add.File.js Deluge.Add.Url.js Deluge.Client.js Deluge.ConnectionManager.js Deluge.Details.js Deluge.Details.Status.js Deluge.Details.Details.js Deluge.Details.Files.js Deluge.Details.Peers.js Deluge.Details.Options.js Deluge.Keys.js Deluge.Login.js Deluge.Preferences.js Deluge.Preferences.Downloads.js Deluge.Preferences.Network.js Deluge.Preferences.Bandwidth.js Deluge.Preferences.Interface.js Deluge.Preferences.Other.js Deluge.Preferences.Daemon.js Deluge.Preferences.Queue.js Deluge.Preferences.Proxy.js Deluge.Preferences.Notification.js Deluge.Preferences.Plugins.js Deluge.Sidebar.js Deluge.Statusbar.js Deluge.Toolbar.js Deluge.Torrents.js Deluge.UI.js"
DELUGE_FILES="Deluge.js Deluge.Formatters.js Deluge.Menus.js Deluge.Events.js Deluge.Add.js Deluge.Add.File.js Deluge.Add.Url.js Deluge.Client.js Deluge.ConnectionManager.js Deluge.Details.js Deluge.Details.Status.js Deluge.Details.Details.js Deluge.Details.Files.js Deluge.Details.Peers.js Deluge.Details.Options.js Deluge.EditTrackers.js Deluge.Keys.js Deluge.Login.js Deluge.Preferences.js Deluge.Preferences.Downloads.js Deluge.Preferences.Network.js Deluge.Preferences.Bandwidth.js Deluge.Preferences.Interface.js Deluge.Preferences.Other.js Deluge.Preferences.Daemon.js Deluge.Preferences.Queue.js Deluge.Preferences.Proxy.js Deluge.Preferences.Notification.js Deluge.Preferences.Plugins.js Deluge.Sidebar.js Deluge.Statusbar.js Deluge.Toolbar.js Deluge.Torrents.js Deluge.UI.js"
ALL_FILES="ext-extensions-debug.js $DELUGE_FILES"
scan() {

File diff suppressed because one or more lines are too long