[Lint] Format files with Prettier

Use Prettier to auto-format javascript, CSS and YAML files so that less
manual work is involved and style is consistent across project.
This commit is contained in:
Calum Lind 2018-10-03 11:22:22 +01:00
parent b1cdc32f73
commit 358ff74d0e
97 changed files with 8330 additions and 6334 deletions

6
.prettierignore Normal file
View File

@ -0,0 +1,6 @@
deluge/ui/web/css/ext-*.css
deluge/ui/web/js/extjs/ext-*.js
deluge/ui/web/docs/
deluge/ui/web/themes/images/
*.py*
*.html

13
.prettierrc.yaml Normal file
View File

@ -0,0 +1,13 @@
trailingComma: "es5"
tabWidth: 4
singleQuote: true
overrides:
- files:
- "*.yaml"
- ".*.yaml"
- "*.yml"
- ".*.yml"
- "*.md"
options:
tabWidth: 2
singleQuote: false

View File

@ -22,7 +22,8 @@ install:
# purpose but it is problematic because it tends to cancel builds pushed # purpose but it is problematic because it tends to cancel builds pushed
# directly to master instead of just PR builds (or the converse). # directly to master instead of just PR builds (or the converse).
# credits: JuliaLang developers. # credits: JuliaLang developers.
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod ` - ps:
if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | ` https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { ` Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." } throw "There are newer queued builds for this pull request, failing early." }
@ -77,8 +78,8 @@ install:
- "SET PATH=%TOXENV%;%PYTHON%;%PYTHON%\\Scripts;c:\\openssl-1.1\\bin;C:\\Program Files (x86)\\NSIS;%PATH%" - "SET PATH=%TOXENV%;%PYTHON%;%PYTHON%\\Scripts;c:\\openssl-1.1\\bin;C:\\Program Files (x86)\\NSIS;%PATH%"
- "python --version" - "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\"" - 'python -c "import struct; print(struct.calcsize(\"P\") * 8)"'
- "python -c \"import libtorrent; print(libtorrent.__version__)\"" - 'python -c "import libtorrent; print(libtorrent.__version__)"'
- openssl version -v - openssl version -v
cache: cache:

View File

@ -19,7 +19,6 @@ Ext.ns('Deluge.ux.preferences');
* @extends Ext.Panel * @extends Ext.Panel
*/ */
Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, { Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
title: _('AutoAdd'), title: _('AutoAdd'),
header: false, header: false,
layout: 'fit', layout: 'fit',
@ -33,75 +32,91 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
this.list = new Ext.list.ListView({ this.list = new Ext.list.ListView({
store: new Ext.data.JsonStore({ store: new Ext.data.JsonStore({
fields: [ fields: ['id', 'enabled', 'owner', 'path'],
'id',
'enabled',
'owner',
'path'
]
}), }),
columns: [{ columns: [
{
id: 'enabled', id: 'enabled',
header: _('Active'), header: _('Active'),
sortable: true, sortable: true,
dataIndex: 'enabled', dataIndex: 'enabled',
tpl: new Ext.XTemplate('{enabled:this.getCheckbox}', { tpl: new Ext.XTemplate('{enabled:this.getCheckbox}', {
getCheckbox: function(checked, selected) { getCheckbox: function(checked, selected) {
Deluge.ux.AutoAdd.onClickFunctions[selected.id] = function () { Deluge.ux.AutoAdd.onClickFunctions[
selected.id
] = function() {
if (selected.enabled) { if (selected.enabled) {
deluge.client.autoadd.disable_watchdir(selected.id); deluge.client.autoadd.disable_watchdir(
selected.id
);
checked = false; checked = false;
} } else {
else { deluge.client.autoadd.enable_watchdir(
deluge.client.autoadd.enable_watchdir(selected.id); selected.id
);
checked = true; checked = true;
} }
autoAdd.updateWatchDirs(); autoAdd.updateWatchDirs();
}; };
return '<input id="enabled-' + selected.id + '" type="checkbox"' + (checked ? ' checked' : '') + return (
' onclick="Deluge.ux.AutoAdd.onClickFunctions[' + selected.id +']()" />' '<input id="enabled-' +
} selected.id +
'" type="checkbox"' +
(checked ? ' checked' : '') +
' onclick="Deluge.ux.AutoAdd.onClickFunctions[' +
selected.id +
']()" />'
);
},
}), }),
width: .15 width: 0.15,
}, { },
{
id: 'owner', id: 'owner',
header: _('Owner'), header: _('Owner'),
sortable: true, sortable: true,
dataIndex: 'owner', dataIndex: 'owner',
width: .2 width: 0.2,
}, { },
{
id: 'path', id: 'path',
header: _('Path'), header: _('Path'),
sortable: true, sortable: true,
dataIndex: 'path' dataIndex: 'path',
}], },
],
singleSelect: true, singleSelect: true,
autoExpandColumn: 'path' autoExpandColumn: 'path',
}); });
this.list.on('selectionchange', this.onSelectionChange, this); this.list.on('selectionchange', this.onSelectionChange, this);
this.panel = this.add({ this.panel = this.add({
items: [this.list], items: [this.list],
bbar: { bbar: {
items: [{ items: [
{
text: _('Add'), text: _('Add'),
iconCls: 'icon-add', iconCls: 'icon-add',
handler: this.onAddClick, handler: this.onAddClick,
scope: this scope: this,
}, { },
{
text: _('Edit'), text: _('Edit'),
iconCls: 'icon-edit', iconCls: 'icon-edit',
handler: this.onEditClick, handler: this.onEditClick,
scope: this, scope: this,
disabled: true disabled: true,
}, '->', { },
'->',
{
text: _('Remove'), text: _('Remove'),
iconCls: 'icon-remove', iconCls: 'icon-remove',
handler: this.onRemoveClick, handler: this.onRemoveClick,
scope: this, scope: this,
disabled: true disabled: true,
}] },
} ],
},
}); });
this.on('show', this.onPreferencesShow, this); this.on('show', this.onPreferencesShow, this);
@ -117,7 +132,8 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
var watchdir = {}; var watchdir = {};
watchdir['id'] = id; watchdir['id'] = id;
watchdir['enabled'] = watchdirs[id].enabled; watchdir['enabled'] = watchdirs[id].enabled;
watchdir['owner'] = watchdirs[id].owner || 'localclient'; watchdir['owner'] =
watchdirs[id].owner || 'localclient';
watchdir['path'] = watchdirs[id].path; watchdir['path'] = watchdirs[id].path;
watchdirsArray.push(watchdir); watchdirsArray.push(watchdir);
@ -125,16 +141,20 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
} }
this.list.getStore().loadData(watchdirsArray); this.list.getStore().loadData(watchdirsArray);
}, },
scope: this scope: this,
}); });
}, },
onAddClick: function() { onAddClick: function() {
if (!this.addWin) { if (!this.addWin) {
this.addWin = new Deluge.ux.AutoAdd.AddAutoAddCommandWindow(); this.addWin = new Deluge.ux.AutoAdd.AddAutoAddCommandWindow();
this.addWin.on('watchdiradd', function() { this.addWin.on(
'watchdiradd',
function() {
this.updateWatchDirs(); this.updateWatchDirs();
}, this); },
this
);
} }
this.addWin.show(); this.addWin.show();
}, },
@ -142,9 +162,13 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
onEditClick: function() { onEditClick: function() {
if (!this.editWin) { if (!this.editWin) {
this.editWin = new Deluge.ux.AutoAdd.EditAutoAddCommandWindow(); this.editWin = new Deluge.ux.AutoAdd.EditAutoAddCommandWindow();
this.editWin.on('watchdiredit', function() { this.editWin.on(
'watchdiredit',
function() {
this.updateWatchDirs(); this.updateWatchDirs();
}, this); },
this
);
} }
var id = this.list.getSelectedRecords()[0].id; var id = this.list.getSelectedRecords()[0].id;
this.editWin.show(id, this.watchdirs[id]); this.editWin.show(id, this.watchdirs[id]);
@ -160,26 +184,38 @@ Deluge.ux.preferences.AutoAddPage = Ext.extend(Ext.Panel, {
success: function() { success: function() {
this.updateWatchDirs(); this.updateWatchDirs();
}, },
scope: this scope: this,
}); });
}, },
onSelectionChange: function(dv, selections) { onSelectionChange: function(dv, selections) {
if (selections.length) { if (selections.length) {
this.panel.getBottomToolbar().items.get(1).enable(); this.panel
this.panel.getBottomToolbar().items.get(3).enable(); .getBottomToolbar()
.items.get(1)
.enable();
this.panel
.getBottomToolbar()
.items.get(3)
.enable();
} else { } else {
this.panel.getBottomToolbar().items.get(1).disable(); this.panel
this.panel.getBottomToolbar().items.get(3).disable(); .getBottomToolbar()
} .items.get(1)
.disable();
this.panel
.getBottomToolbar()
.items.get(3)
.disable();
} }
},
}); });
Deluge.plugins.AutoAddPlugin = Ext.extend(Deluge.Plugin, { Deluge.plugins.AutoAddPlugin = Ext.extend(Deluge.Plugin, {
name: 'AutoAdd', name: 'AutoAdd',
static: { static: {
prefsPage: null prefsPage: null,
}, },
onDisable: function() { onDisable: function() {
@ -193,9 +229,11 @@ Deluge.plugins.AutoAddPlugin = Ext.extend(Deluge.Plugin, {
* This will prevent adding unnecessary tabs to the preferences window. * This will prevent adding unnecessary tabs to the preferences window.
*/ */
if (!Deluge.plugins.AutoAddPlugin.prefsPage) { if (!Deluge.plugins.AutoAddPlugin.prefsPage) {
Deluge.plugins.AutoAddPlugin.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.AutoAddPage()); Deluge.plugins.AutoAddPlugin.prefsPage = deluge.preferences.addPage(
} new Deluge.ux.preferences.AutoAddPage()
);
} }
},
}); });
Deluge.registerPlugin('AutoAdd', Deluge.plugins.AutoAddPlugin); Deluge.registerPlugin('AutoAdd', Deluge.plugins.AutoAddPlugin);

View File

@ -16,34 +16,48 @@ Ext.ns('Deluge.ux.AutoAdd');
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, { Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
width: 350, width: 350,
autoHeight: true, autoHeight: true,
closeAction: 'hide', closeAction: 'hide',
spin_ids: ['max_download_speed', 'max_upload_speed', 'stop_ratio'], spin_ids: ['max_download_speed', 'max_upload_speed', 'stop_ratio'],
spin_int_ids: ['max_upload_slots', 'max_connections'], spin_int_ids: ['max_upload_slots', 'max_connections'],
chk_ids: ['stop_at_ratio', 'remove_at_ratio', 'move_completed', chk_ids: [
'add_paused', 'auto_managed', 'queue_to_top'], 'stop_at_ratio',
toggle_ids: ['append_extension_toggle', 'download_location_toggle', 'remove_at_ratio',
'label_toggle', 'copy_torrent_toggle', 'move_completed',
'delete_copy_torrent_toggle', 'seed_mode'], 'add_paused',
'auto_managed',
'queue_to_top',
],
toggle_ids: [
'append_extension_toggle',
'download_location_toggle',
'label_toggle',
'copy_torrent_toggle',
'delete_copy_torrent_toggle',
'seed_mode',
],
accounts: new Ext.data.ArrayStore({ accounts: new Ext.data.ArrayStore({
storeId: 'accountStore', storeId: 'accountStore',
id: 0, id: 0,
fields: [{ fields: [
{
name: 'displayText', name: 'displayText',
type: 'string' type: 'string',
}] },
],
}), }),
labels: new Ext.data.ArrayStore({ labels: new Ext.data.ArrayStore({
storeId: 'labelStore', storeId: 'labelStore',
id: 0, id: 0,
fields: [{ fields: [
{
name: 'displayText', name: 'displayText',
type: 'string' type: 'string',
}] },
],
}), }),
initComponent: function() { initComponent: function() {
@ -57,14 +71,13 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
xtype: 'form', xtype: 'form',
baseCls: 'x-plain', baseCls: 'x-plain',
bodyStyle: 'padding: 5px', bodyStyle: 'padding: 5px',
items: [{ items: [
{
xtype: 'tabpanel', xtype: 'tabpanel',
activeTab: 0, activeTab: 0,
items: [ items: [this.MainTab, this.OptionsTab],
this.MainTab, },
this.OptionsTab ],
]
}]
}); });
}, },
@ -77,8 +90,12 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
options['enabled'] = Ext.getCmp('enabled').getValue(); options['enabled'] = Ext.getCmp('enabled').getValue();
options['path'] = Ext.getCmp('path').getValue(); options['path'] = Ext.getCmp('path').getValue();
options['download_location'] = Ext.getCmp('download_location').getValue(); options['download_location'] = Ext.getCmp(
options['move_completed_path'] = Ext.getCmp('move_completed_path').getValue(); 'download_location'
).getValue();
options['move_completed_path'] = Ext.getCmp(
'move_completed_path'
).getValue();
options['copy_torrent'] = Ext.getCmp('copy_torrent').getValue(); options['copy_torrent'] = Ext.getCmp('copy_torrent').getValue();
options['label'] = Ext.getCmp('label').getValue(); options['label'] = Ext.getCmp('label').getValue();
@ -90,20 +107,31 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
}); });
this.spin_ids.forEach(function(spin_id) { this.spin_ids.forEach(function(spin_id) {
options[spin_id] = Ext.getCmp(spin_id).getValue(); options[spin_id] = Ext.getCmp(spin_id).getValue();
options[spin_id + '_toggle'] = Ext.getCmp(spin_id + '_toggle').getValue(); options[spin_id + '_toggle'] = Ext.getCmp(
spin_id + '_toggle'
).getValue();
}); });
this.spin_int_ids.forEach(function(spin_int_id) { this.spin_int_ids.forEach(function(spin_int_id) {
options[spin_int_id] = Ext.getCmp(spin_int_id).getValue(); options[spin_int_id] = Ext.getCmp(spin_int_id).getValue();
options[spin_int_id + '_toggle'] = Ext.getCmp(spin_int_id + '_toggle').getValue(); options[spin_int_id + '_toggle'] = Ext.getCmp(
spin_int_id + '_toggle'
).getValue();
}); });
this.chk_ids.forEach(function(chk_id) { this.chk_ids.forEach(function(chk_id) {
options[chk_id] = Ext.getCmp(chk_id).getValue(); options[chk_id] = Ext.getCmp(chk_id).getValue();
options[chk_id + '_toggle'] = Ext.getCmp(chk_id + '_toggle').getValue(); options[chk_id + '_toggle'] = Ext.getCmp(
chk_id + '_toggle'
).getValue();
}); });
if (options['copy_torrent_toggle'] && options['path'] === options['copy_torrent']) { if (
throw _('"Watch Folder" directory and "Copy of .torrent' + options['copy_torrent_toggle'] &&
' files to" directory cannot be the same!'); options['path'] === options['copy_torrent']
) {
throw _(
'"Watch Folder" directory and "Copy of .torrent' +
' files to" directory cannot be the same!'
);
} }
return options; return options;
@ -123,22 +151,33 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
); );
Ext.getCmp('isnt_append_extension').setValue(true); Ext.getCmp('isnt_append_extension').setValue(true);
Ext.getCmp('append_extension_toggle').setValue( Ext.getCmp('append_extension_toggle').setValue(
options['append_extension_toggle'] !== undefined ? options['append_extension_toggle'] : false options['append_extension_toggle'] !== undefined
? options['append_extension_toggle']
: false
); );
Ext.getCmp('append_extension').setValue( Ext.getCmp('append_extension').setValue(
options['append_extension'] !== undefined ? options['append_extension'] : '.added' options['append_extension'] !== undefined
? options['append_extension']
: '.added'
); );
Ext.getCmp('download_location_toggle').setValue( Ext.getCmp('download_location_toggle').setValue(
options['download_location_toggle'] !== undefined ? options['download_location_toggle'] : false options['download_location_toggle'] !== undefined
? options['download_location_toggle']
: false
); );
Ext.getCmp('copy_torrent_toggle').setValue( Ext.getCmp('copy_torrent_toggle').setValue(
options['copy_torrent_toggle'] !== undefined ? options['copy_torrent_toggle'] : false options['copy_torrent_toggle'] !== undefined
? options['copy_torrent_toggle']
: false
); );
Ext.getCmp('delete_copy_torrent_toggle').setValue( Ext.getCmp('delete_copy_torrent_toggle').setValue(
options['delete_copy_torrent_toggle'] !== undefined ? options['delete_copy_torrent_toggle'] : false options['delete_copy_torrent_toggle'] !== undefined
? options['delete_copy_torrent_toggle']
: false
); );
value = options['seed_mode'] !== undefined ? options['seed_mode'] : false; value =
options['seed_mode'] !== undefined ? options['seed_mode'] : false;
Ext.getCmp('seed_mode').setValue(value); Ext.getCmp('seed_mode').setValue(value);
this.accounts.removeAll(true); this.accounts.removeAll(true);
@ -149,7 +188,9 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
options['label'] !== undefined ? options['label'] : '' options['label'] !== undefined ? options['label'] : ''
); );
Ext.getCmp('label_toggle').setValue( Ext.getCmp('label_toggle').setValue(
options['label_toggle'] !== undefined ? options['label_toggle'] : false options['label_toggle'] !== undefined
? options['label_toggle']
: false
); );
this.spin_ids.forEach(function(spin_id) { this.spin_ids.forEach(function(spin_id) {
@ -157,7 +198,9 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
options[spin_id] !== undefined ? options[spin_id] : 0 options[spin_id] !== undefined ? options[spin_id] : 0
); );
Ext.getCmp(spin_id + '_toggle').setValue( Ext.getCmp(spin_id + '_toggle').setValue(
options[spin_id + '_toggle'] !== undefined ? options[spin_id + '_toggle'] : false options[spin_id + '_toggle'] !== undefined
? options[spin_id + '_toggle']
: false
); );
}); });
this.chk_ids.forEach(function(chk_id) { this.chk_ids.forEach(function(chk_id) {
@ -165,23 +208,36 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
options[chk_id] !== undefined ? options[chk_id] : true options[chk_id] !== undefined ? options[chk_id] : true
); );
Ext.getCmp(chk_id + '_toggle').setValue( Ext.getCmp(chk_id + '_toggle').setValue(
options[chk_id + '_toggle'] !== undefined ? options[chk_id + '_toggle'] : false options[chk_id + '_toggle'] !== undefined
? options[chk_id + '_toggle']
: false
); );
}); });
value = options['add_paused'] !== undefined ? options['add_paused'] : true; value =
options['add_paused'] !== undefined ? options['add_paused'] : true;
if (!value) { if (!value) {
Ext.getCmp('not_add_paused').setValue(true); Ext.getCmp('not_add_paused').setValue(true);
} }
value = options['queue_to_top'] !== undefined ? options['queue_to_top'] : true; value =
options['queue_to_top'] !== undefined
? options['queue_to_top']
: true;
if (!value) { if (!value) {
Ext.getCmp('not_queue_to_top').setValue(true); Ext.getCmp('not_queue_to_top').setValue(true);
} }
value = options['auto_managed'] !== undefined ? options['auto_managed'] : true; value =
options['auto_managed'] !== undefined
? options['auto_managed']
: true;
if (!value) { if (!value) {
Ext.getCmp('not_auto_managed').setValue(true) Ext.getCmp('not_auto_managed').setValue(true);
} }
['move_completed_path', 'path', 'download_location', [
'copy_torrent'].forEach(function(field) { 'move_completed_path',
'path',
'download_location',
'copy_torrent',
].forEach(function(field) {
value = options[field] !== undefined ? options[field] : ''; value = options[field] !== undefined ? options[field] : '';
Ext.getCmp(field).setValue(value); Ext.getCmp(field).setValue(value);
}); });
@ -191,44 +247,47 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
success: function(config) { success: function(config) {
var value; var value;
Ext.getCmp('download_location').setValue( Ext.getCmp('download_location').setValue(
options['download_location'] !== undefined ? options['download_location'] !== undefined
options['download_location'] : ? options['download_location']
config['download_location'] : config['download_location']
); );
value = options['move_completed_toggle'] !== undefined ? value =
options['move_completed_toggle'] : options['move_completed_toggle'] !== undefined
config['move_completed']; ? options['move_completed_toggle']
: config['move_completed'];
if (value) { if (value) {
Ext.getCmp('move_completed_toggle').setValue( Ext.getCmp('move_completed_toggle').setValue(
options['move_completed_toggle'] !== undefined ? options['move_completed_toggle'] !== undefined
options['move_completed_toggle'] : ? options['move_completed_toggle']
false : false
); );
Ext.getCmp('move_completed_path').setValue( Ext.getCmp('move_completed_path').setValue(
options['move_completed_path'] !== undefined ? options['move_completed_path'] !== undefined
options['move_completed_path'] : ? options['move_completed_path']
config['move_completed_path'] : config['move_completed_path']
); );
} }
value = options['copy_torrent_toggle'] !== undefined ? value =
options['copy_torrent_toggle'] : options['copy_torrent_toggle'] !== undefined
config['copy_torrent_file']; ? options['copy_torrent_toggle']
: config['copy_torrent_file'];
if (value) { if (value) {
Ext.getCmp('copy_torrent_toggle').setValue(true); Ext.getCmp('copy_torrent_toggle').setValue(true);
Ext.getCmp('copy_torrent').setValue( Ext.getCmp('copy_torrent').setValue(
options['copy_torrent'] !== undefined ? options['copy_torrent'] !== undefined
options['copy_torrent'] : ? options['copy_torrent']
config['torrentfiles_location'] : config['torrentfiles_location']
); );
} }
value = options['delete_copy_torrent_toggle'] !== undefined ? value =
options['copy_torrent_toggle'] : options['delete_copy_torrent_toggle'] !== undefined
config['del_copy_torrent_file']; ? options['copy_torrent_toggle']
: config['del_copy_torrent_file'];
if (value) { if (value) {
Ext.getCmp('delete_copy_torrent_toggle').setValue(true) Ext.getCmp('delete_copy_torrent_toggle').setValue(true);
} }
} },
}) });
} }
deluge.client.core.get_enabled_plugins({ deluge.client.core.get_enabled_plugins({
@ -237,7 +296,11 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
this.MainTab.LabelFset.setVisible(true); this.MainTab.LabelFset.setVisible(true);
deluge.client.label.get_labels({ deluge.client.label.get_labels({
success: function(labels) { success: function(labels) {
for (var index = 0; index < labels.length; index++) { for (
var index = 0;
index < labels.length;
index++
) {
labels[index] = [labels[index]]; labels[index] = [labels[index]];
} }
this.labels.loadData(labels, false); this.labels.loadData(labels, false);
@ -245,14 +308,13 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
failure: function(failure) { failure: function(failure) {
console.error(failure); console.error(failure);
}, },
scope: this scope: this,
}); });
} } else {
else {
this.MainTab.LabelFset.setVisible(false); this.MainTab.LabelFset.setVisible(false);
} }
}, },
scope: this scope: this,
}); });
var me = this; var me = this;
@ -262,16 +324,20 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
accounts[index] = [accounts[index]['username']]; accounts[index] = [accounts[index]['username']];
} }
me.accounts.loadData(accounts, false); me.accounts.loadData(accounts, false);
Ext.getCmp('owner').setValue(owner).enable(); Ext.getCmp('owner')
.setValue(owner)
.enable();
} }
function on_accounts_failure(failure) { function on_accounts_failure(failure) {
deluge.client.autoadd.get_auth_user({ deluge.client.autoadd.get_auth_user({
success: function(user) { success: function(user) {
me.accounts.loadData([[user]], false); me.accounts.loadData([[user]], false);
Ext.getCmp('owner').setValue(user).disable(true); Ext.getCmp('owner')
.setValue(user)
.disable(true);
}, },
scope: this scope: this,
}); });
} }
@ -282,44 +348,51 @@ Deluge.ux.AutoAdd.AutoAddWindowBase = Ext.extend(Ext.Window, {
success: function(accounts) { success: function(accounts) {
deluge.client.autoadd.get_auth_user({ deluge.client.autoadd.get_auth_user({
success: function(user) { success: function(user) {
on_accounts(accounts, on_accounts(
options['owner'] !== undefined ? options['owner'] : user accounts,
options['owner'] !== undefined
? options['owner']
: user
); );
}, },
scope: this scope: this,
}); });
}, },
failure: on_accounts_failure, failure: on_accounts_failure,
scope: this scope: this,
}) });
} } else {
else {
on_accounts_failure(null); on_accounts_failure(null);
} }
}, },
scope: this scope: this,
}); });
} },
}); });
/** /**
* @class Deluge.ux.AutoAdd.EditAutoAddCommandWindow * @class Deluge.ux.AutoAdd.EditAutoAddCommandWindow
* @extends Deluge.ux.AutoAdd.AutoAddWindowBase * @extends Deluge.ux.AutoAdd.AutoAddWindowBase
*/ */
Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend(Deluge.ux.AutoAdd.AutoAddWindowBase, { Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend(
Deluge.ux.AutoAdd.AutoAddWindowBase,
{
title: _('Edit Watch Folder'), title: _('Edit Watch Folder'),
initComponent: function() { initComponent: function() {
Deluge.ux.AutoAdd.EditAutoAddCommandWindow.superclass.initComponent.call(this); Deluge.ux.AutoAdd.EditAutoAddCommandWindow.superclass.initComponent.call(
this
);
this.addButton(_('Save'), this.onSaveClick, this); this.addButton(_('Save'), this.onSaveClick, this);
this.addEvents({ this.addEvents({
'watchdiredit': true watchdiredit: true,
}); });
}, },
show: function(watchdir_id, options) { show: function(watchdir_id, options) {
Deluge.ux.AutoAdd.EditAutoAddCommandWindow.superclass.show.call(this); Deluge.ux.AutoAdd.EditAutoAddCommandWindow.superclass.show.call(
this
);
this.watchdir_id = watchdir_id; this.watchdir_id = watchdir_id;
this.loadOptions(options); this.loadOptions(options);
}, },
@ -331,41 +404,45 @@ Deluge.ux.AutoAdd.EditAutoAddCommandWindow = Ext.extend(Deluge.ux.AutoAdd.AutoAd
success: function() { success: function() {
this.fireEvent('watchdiredit', this, options); this.fireEvent('watchdiredit', this, options);
}, },
scope: this scope: this,
}); });
} } catch (err) {
catch(err) {
Ext.Msg.show({ Ext.Msg.show({
title: _('Incompatible Option'), title: _('Incompatible Option'),
msg: err, msg: err,
buttons: Ext.Msg.OK, buttons: Ext.Msg.OK,
scope: this scope: this,
}); });
} }
this.hide(); this.hide();
},
} }
);
});
/** /**
* @class Deluge.ux.AutoAdd.AddAutoAddCommandWindow * @class Deluge.ux.AutoAdd.AddAutoAddCommandWindow
* @extends Deluge.ux.AutoAdd.AutoAddWindowBase * @extends Deluge.ux.AutoAdd.AutoAddWindowBase
*/ */
Deluge.ux.AutoAdd.AddAutoAddCommandWindow = Ext.extend(Deluge.ux.AutoAdd.AutoAddWindowBase, { Deluge.ux.AutoAdd.AddAutoAddCommandWindow = Ext.extend(
Deluge.ux.AutoAdd.AutoAddWindowBase,
{
title: _('Add Watch Folder'), title: _('Add Watch Folder'),
initComponent: function() { initComponent: function() {
Deluge.ux.AutoAdd.AddAutoAddCommandWindow.superclass.initComponent.call(this); Deluge.ux.AutoAdd.AddAutoAddCommandWindow.superclass.initComponent.call(
this
);
this.addButton(_('Add'), this.onAddClick, this); this.addButton(_('Add'), this.onAddClick, this);
this.addEvents({ this.addEvents({
'watchdiradd': true watchdiradd: true,
}); });
}, },
show: function() { show: function() {
Deluge.ux.AutoAdd.AddAutoAddCommandWindow.superclass.show.call(this); Deluge.ux.AutoAdd.AddAutoAddCommandWindow.superclass.show.call(
this
);
this.loadOptions(); this.loadOptions();
}, },
@ -381,18 +458,18 @@ Deluge.ux.AutoAdd.AddAutoAddCommandWindow = Ext.extend(Deluge.ux.AutoAdd.AutoAdd
var error; var error;
if ((error = regex.exec(err.error.message)) !== null) { if ((error = regex.exec(err.error.message)) !== null) {
error = error[1]; error = error[1];
} } else {
else {
error = err.error.message; error = err.error.message;
} }
Ext.Msg.show({ Ext.Msg.show({
title: _('Incompatible Option'), title: _('Incompatible Option'),
msg: error, msg: error,
buttons: Ext.Msg.OK, buttons: Ext.Msg.OK,
scope: this scope: this,
}); });
}, },
scope: this scope: this,
}); });
},
} }
}); );

View File

@ -29,18 +29,21 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;',
width: '85%', width: '85%',
labelWidth: 1, labelWidth: 1,
items: [{ items: [
{
xtype: 'textfield', xtype: 'textfield',
id: 'path', id: 'path',
hideLabel: true, hideLabel: true,
width: 304 width: 304,
}, { },
{
hideLabel: true, hideLabel: true,
id: 'enabled', id: 'enabled',
xtype: 'checkbox', xtype: 'checkbox',
boxLabel: _('Enable this watch folder'), boxLabel: _('Enable this watch folder'),
checked: true checked: true,
}] },
],
}); });
this.torrentActionFset = new Ext.form.FieldSet({ this.torrentActionFset = new Ext.form.FieldSet({
@ -51,12 +54,14 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
width: '85%', width: '85%',
labelWidth: 1, labelWidth: 1,
defaults: { defaults: {
style: 'margin-bottom: 2px' style: 'margin-bottom: 2px',
}, },
items: [{ items: [
{
xtype: 'radiogroup', xtype: 'radiogroup',
columns: 1, columns: 1,
items: [{ items: [
{
xtype: 'radio', xtype: 'radio',
name: 'torrent_action', name: 'torrent_action',
id: 'isnt_append_extension', id: 'isnt_append_extension',
@ -66,78 +71,119 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
listeners: { listeners: {
check: function(cb, newValue) { check: function(cb, newValue) {
if (newValue) { if (newValue) {
Ext.getCmp('append_extension').setDisabled(newValue); Ext.getCmp(
Ext.getCmp('copy_torrent').setDisabled(newValue); 'append_extension'
Ext.getCmp('delete_copy_torrent_toggle').setDisabled(newValue); ).setDisabled(newValue);
Ext.getCmp('copy_torrent').setDisabled(
newValue
);
Ext.getCmp(
'delete_copy_torrent_toggle'
).setDisabled(newValue);
} }
} },
} },
}, { },
{
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
hideLabel: true, hideLabel: true,
items: [{ items: [
{
xtype: 'radio', xtype: 'radio',
name: 'torrent_action', name: 'torrent_action',
id: 'append_extension_toggle', id: 'append_extension_toggle',
boxLabel: _('Append extension after adding:'), boxLabel: _(
'Append extension after adding:'
),
hideLabel: true, hideLabel: true,
listeners: { listeners: {
check: function(cb, newValue) { check: function(cb, newValue) {
if (newValue) { if (newValue) {
Ext.getCmp('append_extension').setDisabled(!newValue); Ext.getCmp(
Ext.getCmp('copy_torrent').setDisabled(newValue); 'append_extension'
Ext.getCmp('delete_copy_torrent_toggle').setDisabled(newValue); ).setDisabled(!newValue);
Ext.getCmp(
'copy_torrent'
).setDisabled(newValue);
Ext.getCmp(
'delete_copy_torrent_toggle'
).setDisabled(newValue);
} }
} },
} },
}, { },
{
xtype: 'textfield', xtype: 'textfield',
id: 'append_extension', id: 'append_extension',
hideLabel: true, hideLabel: true,
disabled: true, disabled: true,
style: 'margin-left: 2px', style: 'margin-left: 2px',
width: 112 width: 112,
}] },
}, { ],
},
{
xtype: 'container', xtype: 'container',
hideLabel: true, hideLabel: true,
items: [{ items: [
{
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
hideLabel: true, hideLabel: true,
items: [{ items: [
{
xtype: 'radio', xtype: 'radio',
name: 'torrent_action', name: 'torrent_action',
id: 'copy_torrent_toggle', id: 'copy_torrent_toggle',
boxLabel: _('Copy of .torrent files to:'), boxLabel: _(
'Copy of .torrent files to:'
),
hideLabel: true, hideLabel: true,
listeners: { listeners: {
check: function(cb, newValue) { check: function(cb, newValue) {
if (newValue) { if (newValue) {
Ext.getCmp('append_extension').setDisabled(newValue); Ext.getCmp(
Ext.getCmp('copy_torrent').setDisabled(!newValue); 'append_extension'
Ext.getCmp('delete_copy_torrent_toggle').setDisabled(!newValue); ).setDisabled(newValue);
Ext.getCmp(
'copy_torrent'
).setDisabled(
!newValue
);
Ext.getCmp(
'delete_copy_torrent_toggle'
).setDisabled(
!newValue
);
} }
} },
} },
}, { },
{
xtype: 'textfield', xtype: 'textfield',
id: 'copy_torrent', id: 'copy_torrent',
hideLabel: true, hideLabel: true,
disabled: true, disabled: true,
style: 'margin-left: 2px', style: 'margin-left: 2px',
width: 152 width: 152,
}] },
}, { ],
},
{
xtype: 'checkbox', xtype: 'checkbox',
id: 'delete_copy_torrent_toggle', id: 'delete_copy_torrent_toggle',
boxLabel: _('Delete copy of torrent file on remove'), boxLabel: _(
'Delete copy of torrent file on remove'
),
style: 'margin-left: 10px', style: 'margin-left: 10px',
disabled: true disabled: true,
}] },
}] ],
}] },
],
},
],
}); });
this.downloadFolderFset = new Ext.form.FieldSet({ this.downloadFolderFset = new Ext.form.FieldSet({
@ -148,23 +194,28 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;',
width: '85%', width: '85%',
labelWidth: 1, labelWidth: 1,
items: [{ items: [
{
hideLabel: true, hideLabel: true,
id: 'download_location_toggle', id: 'download_location_toggle',
xtype: 'checkbox', xtype: 'checkbox',
boxLabel: _('Set download folder'), boxLabel: _('Set download folder'),
listeners: { listeners: {
check: function(cb, checked) { check: function(cb, checked) {
Ext.getCmp('download_location').setDisabled(!checked); Ext.getCmp('download_location').setDisabled(
} !checked
} );
}, { },
},
},
{
xtype: 'textfield', xtype: 'textfield',
id: 'download_location', id: 'download_location',
hideLabel: true, hideLabel: true,
width: 304, width: 304,
disabled: true disabled: true,
}] },
],
}); });
this.moveCompletedFset = new Ext.form.FieldSet({ this.moveCompletedFset = new Ext.form.FieldSet({
@ -175,23 +226,28 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;',
width: '85%', width: '85%',
labelWidth: 1, labelWidth: 1,
items: [{ items: [
{
hideLabel: true, hideLabel: true,
id: 'move_completed_toggle', id: 'move_completed_toggle',
xtype: 'checkbox', xtype: 'checkbox',
boxLabel: _('Set move completed folder'), boxLabel: _('Set move completed folder'),
listeners: { listeners: {
check: function(cb, checked) { check: function(cb, checked) {
Ext.getCmp('move_completed_path').setDisabled(!checked); Ext.getCmp('move_completed_path').setDisabled(
} !checked
} );
}, { },
},
},
{
xtype: 'textfield', xtype: 'textfield',
id: 'move_completed_path', id: 'move_completed_path',
hideLabel: true, hideLabel: true,
width: 304, width: 304,
disabled: true disabled: true,
}] },
],
}); });
this.LabelFset = new Ext.form.FieldSet({ this.LabelFset = new Ext.form.FieldSet({
@ -203,11 +259,13 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
//width: '85%', //width: '85%',
labelWidth: 1, labelWidth: 1,
//hidden: true, //hidden: true,
items: [{ items: [
{
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
hideLabel: true, hideLabel: true,
items: [{ items: [
{
hashLabel: false, hashLabel: false,
id: 'label_toggle', id: 'label_toggle',
xtype: 'checkbox', xtype: 'checkbox',
@ -215,9 +273,10 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
listeners: { listeners: {
check: function(cb, checked) { check: function(cb, checked) {
Ext.getCmp('label').setDisabled(!checked); Ext.getCmp('label').setDisabled(!checked);
} },
} },
}, { },
{
xtype: 'combo', xtype: 'combo',
id: 'label', id: 'label',
hideLabel: true, hideLabel: true,
@ -227,9 +286,11 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
style: 'margin-left: 2px', style: 'margin-left: 2px',
mode: 'local', mode: 'local',
valueField: 'displayText', valueField: 'displayText',
displayField: 'displayText' displayField: 'displayText',
}] },
}] ],
},
],
}); });
this.add([ this.add([
@ -237,7 +298,7 @@ Deluge.ux.AutoAdd.AutoAddMainPanel = Ext.extend(Ext.Panel, {
this.torrentActionFset, this.torrentActionFset,
this.downloadFolderFset, this.downloadFolderFset,
this.moveCompletedFset, this.moveCompletedFset,
this.LabelFset this.LabelFset,
]) ]);
} },
}); });

View File

@ -20,30 +20,32 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
title: _('Options'), title: _('Options'),
initComponent: function() { initComponent: function() {
Deluge.ux.AutoAdd.AutoAddOptionsPanel.superclass.initComponent.call(this); Deluge.ux.AutoAdd.AutoAddOptionsPanel.superclass.initComponent.call(
this
);
var maxDownload = { var maxDownload = {
idCheckbox: 'max_download_speed_toggle', idCheckbox: 'max_download_speed_toggle',
labelCheckbox: 'Max Download Speed (KiB/s):', labelCheckbox: 'Max Download Speed (KiB/s):',
idSpinner: 'max_download_speed', idSpinner: 'max_download_speed',
decimalPrecision: 1 decimalPrecision: 1,
}; };
var maxUploadSpeed = { var maxUploadSpeed = {
idCheckbox: 'max_upload_speed_toggle', idCheckbox: 'max_upload_speed_toggle',
labelCheckbox: 'Max upload Speed (KiB/s):', labelCheckbox: 'Max upload Speed (KiB/s):',
idSpinner: 'max_upload_speed', idSpinner: 'max_upload_speed',
decimalPrecision: 1 decimalPrecision: 1,
}; };
var maxConnections = { var maxConnections = {
idCheckbox: 'max_connections_toggle', idCheckbox: 'max_connections_toggle',
labelCheckbox: 'Max Connections::', labelCheckbox: 'Max Connections::',
idSpinner: 'max_connections', idSpinner: 'max_connections',
decimalPrecision: 0 decimalPrecision: 0,
}; };
var maxUploadSlots = { var maxUploadSlots = {
idCheckbox: 'max_upload_slots_toggle', idCheckbox: 'max_upload_slots_toggle',
labelCheckbox: 'Max Upload Slots:', labelCheckbox: 'Max Upload Slots:',
idSpinner: 'max_upload_slots', idSpinner: 'max_upload_slots',
decimalPrecision: 0 decimalPrecision: 0,
}; };
// queue data // queue data
var addPause = { var addPause = {
@ -52,8 +54,8 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
nameRadio: 'add_paused', nameRadio: 'add_paused',
labelRadio: { labelRadio: {
yes: 'Yes', yes: 'Yes',
no: 'No' no: 'No',
} },
}; };
var queueTo = { var queueTo = {
idCheckbox: 'queue_to_top_toggle', idCheckbox: 'queue_to_top_toggle',
@ -61,8 +63,8 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
nameRadio: 'queue_to_top', nameRadio: 'queue_to_top',
labelRadio: { labelRadio: {
yes: 'Top', yes: 'Top',
no: 'Bottom' no: 'Bottom',
} },
}; };
var autoManaged = { var autoManaged = {
idCheckbox: 'auto_managed_toggle', idCheckbox: 'auto_managed_toggle',
@ -70,8 +72,8 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
nameRadio: 'auto_managed', nameRadio: 'auto_managed',
labelRadio: { labelRadio: {
yes: 'Yes', yes: 'Yes',
no: 'No' no: 'No',
} },
}; };
this.ownerFset = new Ext.form.FieldSet({ this.ownerFset = new Ext.form.FieldSet({
@ -81,15 +83,17 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;',
//width: '85%', //width: '85%',
labelWidth: 1, labelWidth: 1,
items: [{ items: [
{
xtype: 'combo', xtype: 'combo',
id: 'owner', id: 'owner',
hideLabel: true, hideLabel: true,
width: 312, width: 312,
mode: 'local', mode: 'local',
valueField: 'displayText', valueField: 'displayText',
displayField: 'displayText' displayField: 'displayText',
}] },
],
}); });
this.bandwidthFset = new Ext.form.FieldSet({ this.bandwidthFset = new Ext.form.FieldSet({
@ -100,8 +104,8 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
//width: '85%', //width: '85%',
labelWidth: 1, labelWidth: 1,
defaults: { defaults: {
style: 'margin-bottom: 5px' style: 'margin-bottom: 5px',
} },
}); });
this.bandwidthFset.add(this._getBandwidthContainer(maxDownload)); this.bandwidthFset.add(this._getBandwidthContainer(maxDownload));
this.bandwidthFset.add(this._getBandwidthContainer(maxUploadSpeed)); this.bandwidthFset.add(this._getBandwidthContainer(maxUploadSpeed));
@ -116,13 +120,15 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
//width: '85%', //width: '85%',
labelWidth: 1, labelWidth: 1,
defaults: { defaults: {
style: 'margin-bottom: 5px' style: 'margin-bottom: 5px',
}, },
items: [{ items: [
{
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
hideLabel: true hideLabel: true,
}] },
],
}); });
this.queueFset.add(this._getQueueContainer(addPause)); this.queueFset.add(this._getQueueContainer(addPause));
this.queueFset.add(this._getQueueContainer(queueTo)); this.queueFset.add(this._getQueueContainer(queueTo));
@ -130,11 +136,13 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
this.queueFset.add({ this.queueFset.add({
xtype: 'container', xtype: 'container',
hideLabel: true, hideLabel: true,
items: [{ items: [
{
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
hideLabel: true, hideLabel: true,
items: [{ items: [
{
xtype: 'checkbox', xtype: 'checkbox',
id: 'stop_at_ratio_toggle', id: 'stop_at_ratio_toggle',
boxLabel: _('Stop seed at ratio:'), boxLabel: _('Stop seed at ratio:'),
@ -142,11 +150,16 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
width: 175, width: 175,
listeners: { listeners: {
check: function(cb, checked) { check: function(cb, checked) {
Ext.getCmp('stop_ratio').setDisabled(!checked); Ext.getCmp('stop_ratio').setDisabled(
Ext.getCmp('remove_at_ratio').setDisabled(!checked); !checked
} );
} Ext.getCmp('remove_at_ratio').setDisabled(
}, { !checked
);
},
},
},
{
xtype: 'spinnerfield', xtype: 'spinnerfield',
id: 'stop_ratio', id: 'stop_ratio',
hideLabel: true, hideLabel: true,
@ -157,53 +170,57 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
decimalPrecision: 1, decimalPrecision: 1,
incrementValue: 0.1, incrementValue: 0.1,
style: 'margin-left: 2px', style: 'margin-left: 2px',
width: 100 width: 100,
}] },
}, { ],
},
{
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
hideLabel: true, hideLabel: true,
style: 'margin-left: 10px', style: 'margin-left: 10px',
items: [{ items: [
{
xtype: 'checkbox', xtype: 'checkbox',
id: 'remove_at_ratio', id: 'remove_at_ratio',
boxLabel: _('Remove at ratio'), boxLabel: _('Remove at ratio'),
disabled: true, disabled: true,
checked: true checked: true,
}, { },
{
xtype: 'checkbox', xtype: 'checkbox',
id: 'remove_at_ratio_toggle', id: 'remove_at_ratio_toggle',
disabled: true, disabled: true,
checked: true, checked: true,
hidden: true hidden: true,
}, { },
{
xtype: 'checkbox', xtype: 'checkbox',
id: 'stop_ratio_toggle', id: 'stop_ratio_toggle',
disabled: true, disabled: true,
checked: true, checked: true,
hidden: true hidden: true,
}, { },
{
xtype: 'checkbox', xtype: 'checkbox',
id: 'stop_ratio_toggle', id: 'stop_ratio_toggle',
disabled: true, disabled: true,
checked: true, checked: true,
hidden: true hidden: true,
}] },
}] ],
},
],
}); });
this.queueFset.add({ this.queueFset.add({
xtype: 'checkbox', xtype: 'checkbox',
id: 'seed_mode', id: 'seed_mode',
boxLabel: _('Skip File Hash Check'), boxLabel: _('Skip File Hash Check'),
hideLabel: true, hideLabel: true,
width: 175 width: 175,
}); });
this.add([ this.add([this.ownerFset, this.bandwidthFset, this.queueFset]);
this.ownerFset,
this.bandwidthFset,
this.queueFset
]);
}, },
_getBandwidthContainer: function(values) { _getBandwidthContainer: function(values) {
@ -211,7 +228,8 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
hideLabel: true, hideLabel: true,
items: [{ items: [
{
xtype: 'checkbox', xtype: 'checkbox',
hideLabel: true, hideLabel: true,
id: values.idCheckbox, id: values.idCheckbox,
@ -220,9 +238,10 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
listeners: { listeners: {
check: function(cb, checked) { check: function(cb, checked) {
Ext.getCmp(values.idSpinner).setDisabled(!checked); Ext.getCmp(values.idSpinner).setDisabled(!checked);
} },
} },
}, { },
{
xtype: 'spinnerfield', xtype: 'spinnerfield',
id: values.idSpinner, id: values.idSpinner,
hideLabel: true, hideLabel: true,
@ -232,8 +251,9 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
value: 0.0, value: 0.0,
decimalPrecision: values.decimalPrecision, decimalPrecision: values.decimalPrecision,
style: 'margin-left: 2px', style: 'margin-left: 2px',
width: 100 width: 100,
}] },
],
}); });
}, },
@ -242,7 +262,8 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
hideLabel: true, hideLabel: true,
items: [{ items: [
{
xtype: 'checkbox', xtype: 'checkbox',
hideLabel: true, hideLabel: true,
id: values.idCheckbox, id: values.idCheckbox,
@ -251,10 +272,13 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
listeners: { listeners: {
check: function(cb, checked) { check: function(cb, checked) {
Ext.getCmp(values.nameRadio).setDisabled(!checked); Ext.getCmp(values.nameRadio).setDisabled(!checked);
Ext.getCmp('not_' + values.nameRadio).setDisabled(!checked); Ext.getCmp('not_' + values.nameRadio).setDisabled(
} !checked
} );
}, { },
},
},
{
xtype: 'radio', xtype: 'radio',
name: values.nameRadio, name: values.nameRadio,
id: values.nameRadio, id: values.nameRadio,
@ -262,15 +286,17 @@ Deluge.ux.AutoAdd.AutoAddOptionsPanel = Ext.extend(Ext.Panel, {
hideLabel: true, hideLabel: true,
checked: true, checked: true,
disabled: true, disabled: true,
width: 50 width: 50,
}, { },
{
xtype: 'radio', xtype: 'radio',
name: values.nameRadio, name: values.nameRadio,
id: 'not_' + values.nameRadio, id: 'not_' + values.nameRadio,
boxLabel: _(values.labelRadio.no), boxLabel: _(values.labelRadio.no),
hideLabel: true, hideLabel: true,
disabled: true disabled: true,
}] },
],
}); });
} },
}); });

View File

@ -16,7 +16,6 @@ Ext.ns('Deluge.ux.preferences');
* @extends Ext.Panel * @extends Ext.Panel
*/ */
Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, { Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
title: _('Blocklist'), title: _('Blocklist'),
header: false, header: false,
layout: 'fit', layout: 'fit',
@ -34,14 +33,14 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
defaultType: 'textfield', defaultType: 'textfield',
style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;',
autoWidth: true, autoWidth: true,
labelWidth: 40 labelWidth: 40,
}); });
this.URL = this.URLFset.add({ this.URL = this.URLFset.add({
fieldLabel: _('URL:'), fieldLabel: _('URL:'),
labelSeparator: '', labelSeparator: '',
name: 'url', name: 'url',
width: '80%' width: '80%',
}); });
this.SettingsFset = this.add({ this.SettingsFset = this.add({
@ -52,7 +51,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
defaultType: 'spinnerfield', defaultType: 'spinnerfield',
style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;',
autoWidth: true, autoWidth: true,
labelWidth: 160 labelWidth: 160,
}); });
this.checkListDays = this.SettingsFset.add({ this.checkListDays = this.SettingsFset.add({
@ -61,13 +60,13 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
name: 'check_list_days', name: 'check_list_days',
value: 4, value: 4,
decimalPrecision: 0, decimalPrecision: 0,
width: 80 width: 80,
}); });
this.chkImportOnStart = this.SettingsFset.add({ this.chkImportOnStart = this.SettingsFset.add({
xtype: 'checkbox', xtype: 'checkbox',
fieldLabel: _('Import blocklist on startup'), fieldLabel: _('Import blocklist on startup'),
name: 'check_import_startup' name: 'check_import_startup',
}); });
this.OptionsFset = this.add({ this.OptionsFset = this.add({
@ -79,7 +78,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;',
autoWidth: false, autoWidth: false,
width: '80%', width: '80%',
labelWidth: 0 labelWidth: 0,
}); });
this.checkDownload = this.OptionsFset.add({ this.checkDownload = this.OptionsFset.add({
@ -88,18 +87,21 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
margins: '4 0 0 5', margins: '4 0 0 5',
items: [{ items: [
{
xtype: 'button', xtype: 'button',
text: ' Check Download and Import ', text: ' Check Download and Import ',
scale: 'medium' scale: 'medium',
}, { },
{
xtype: 'box', xtype: 'box',
autoEl: { autoEl: {
tag: 'img', tag: 'img',
src: '../icons/ok.png' src: '../icons/ok.png',
}, },
margins: '4 0 0 3' margins: '4 0 0 3',
}] },
],
}); });
this.forceDownload = this.OptionsFset.add({ this.forceDownload = this.OptionsFset.add({
@ -108,7 +110,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
text: ' Force Download and Import ', text: ' Force Download and Import ',
margins: '2 0 0 0', margins: '2 0 0 0',
//icon: '../icons/blocklist_import24.png', //icon: '../icons/blocklist_import24.png',
scale: 'medium' scale: 'medium',
}); });
this.ProgressFset = this.add({ this.ProgressFset = this.add({
@ -120,13 +122,13 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
style: 'margin-top: 1px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 1px; margin-bottom: 0px; padding-bottom: 0px;',
autoWidth: true, autoWidth: true,
labelWidth: 0, labelWidth: 0,
hidden: true hidden: true,
}); });
this.downProgBar = this.ProgressFset.add({ this.downProgBar = this.ProgressFset.add({
fieldLabel: _(''), fieldLabel: _(''),
name: 'progress_bar', name: 'progress_bar',
width: '90%' width: '90%',
}); });
this.InfoFset = this.add({ this.InfoFset = this.add({
@ -136,31 +138,31 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
autoHeight: true, autoHeight: true,
defaultType: 'label', defaultType: 'label',
style: 'margin-top: 0px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 0px; margin-bottom: 0px; padding-bottom: 0px;',
labelWidth: 60 labelWidth: 60,
}); });
this.lblFileSize = this.InfoFset.add({ this.lblFileSize = this.InfoFset.add({
fieldLabel: _('File Size:'), fieldLabel: _('File Size:'),
labelSeparator: '', labelSeparator: '',
name: 'file_size' name: 'file_size',
}); });
this.lblDate = this.InfoFset.add({ this.lblDate = this.InfoFset.add({
fieldLabel: _('Date:'), fieldLabel: _('Date:'),
labelSeparator: '', labelSeparator: '',
name: 'date' name: 'date',
}); });
this.lblType = this.InfoFset.add({ this.lblType = this.InfoFset.add({
fieldLabel: _('Type:'), fieldLabel: _('Type:'),
labelSeparator: '', labelSeparator: '',
name: 'type' name: 'type',
}); });
this.lblURL = this.InfoFset.add({ this.lblURL = this.InfoFset.add({
fieldLabel: _('URL:'), fieldLabel: _('URL:'),
labelSeparator: '', labelSeparator: '',
name: 'lbl_URL' name: 'lbl_URL',
}); });
this.WhitelistFset = this.add({ this.WhitelistFset = this.add({
@ -172,7 +174,8 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;',
autoWidth: true, autoWidth: true,
labelWidth: 0, labelWidth: 0,
items: [{ items: [
{
fieldLabel: _(''), fieldLabel: _(''),
name: 'whitelist', name: 'whitelist',
margins: '2 0 5 5', margins: '2 0 5 5',
@ -181,10 +184,11 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
autoExpandColumn: 'ip', autoExpandColumn: 'ip',
viewConfig: { viewConfig: {
emptyText: _('Add an IP...'), emptyText: _('Add an IP...'),
deferEmptyText: false deferEmptyText: false,
}, },
colModel: new Ext.grid.ColumnModel({ colModel: new Ext.grid.ColumnModel({
columns: [{ columns: [
{
id: 'ip', id: 'ip',
header: _('IP'), header: _('IP'),
dataIndex: 'ip', dataIndex: 'ip',
@ -192,22 +196,23 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
hideable: false, hideable: false,
editable: true, editable: true,
editor: { editor: {
xtype: 'textfield' xtype: 'textfield',
} },
}] },
],
}), }),
selModel: new Ext.grid.RowSelectionModel({ selModel: new Ext.grid.RowSelectionModel({
singleSelect: false, singleSelect: false,
moveEditorOnEnter: false moveEditorOnEnter: false,
}), }),
store: new Ext.data.ArrayStore({ store: new Ext.data.ArrayStore({
autoDestroy: true, autoDestroy: true,
fields: [{name: 'ip'}] fields: [{ name: 'ip' }],
}), }),
listeners: { listeners: {
afteredit: function(e) { afteredit: function(e) {
e.record.commit(); e.record.commit();
} },
}, },
setEmptyText: function(text) { setEmptyText: function(text) {
if (this.viewReady) { if (this.viewReady) {
@ -222,28 +227,32 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
if (this.viewReady) { if (this.viewReady) {
this.getView().updateHeaders(); this.getView().updateHeaders();
} }
} },
}] },
],
}); });
this.ipButtonsContainer = this.WhitelistFset.add({ this.ipButtonsContainer = this.WhitelistFset.add({
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
margins: '4 0 0 5', margins: '4 0 0 5',
items: [{ items: [
{
xtype: 'button', xtype: 'button',
text: ' Add IP ', text: ' Add IP ',
margins: '0 5 0 0' margins: '0 5 0 0',
},{ },
{
xtype: 'button', xtype: 'button',
text: ' Delete IP ' text: ' Delete IP ',
}] },
],
}); });
this.updateTask = Ext.TaskMgr.start({ this.updateTask = Ext.TaskMgr.start({
interval: 2000, interval: 2000,
run: this.onUpdate, run: this.onUpdate,
scope: this scope: this,
}); });
this.on('show', this.updateConfig, this); this.on('show', this.updateConfig, this);
@ -290,8 +299,13 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
this.forceDownload.setDisabled(true); this.forceDownload.setDisabled(true);
this.ProgressFset.show(); this.ProgressFset.show();
this.downProgBar.updateProgress(status['file_progress'],'Downloading '.concat((status['file_progress'] * 100).toFixed(2)).concat('%'),true); this.downProgBar.updateProgress(
status['file_progress'],
'Downloading '
.concat((status['file_progress'] * 100).toFixed(2))
.concat('%'),
true
);
} else if (status['state'] == 'Importing') { } else if (status['state'] == 'Importing') {
this.InfoFset.hide(); this.InfoFset.hide();
this.checkDownload.getComponent(0).setDisabled(true); this.checkDownload.getComponent(0).setDisabled(true);
@ -299,8 +313,9 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
this.forceDownload.setDisabled(true); this.forceDownload.setDisabled(true);
this.ProgressFset.show(); this.ProgressFset.show();
this.downProgBar.updateText('Importing '.concat(status['num_blocked'])); this.downProgBar.updateText(
'Importing '.concat(status['num_blocked'])
);
} else if (status['state'] == 'Idle') { } else if (status['state'] == 'Idle') {
this.ProgressFset.hide(); this.ProgressFset.hide();
this.checkDownload.getComponent(0).setDisabled(false); this.checkDownload.getComponent(0).setDisabled(false);
@ -315,10 +330,12 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
this.lblFileSize.setText(fsize(status['file_size'])); this.lblFileSize.setText(fsize(status['file_size']));
this.lblDate.setText(fdate(status['file_date'])); this.lblDate.setText(fdate(status['file_date']));
this.lblType.setText(status['file_type']); this.lblType.setText(status['file_type']);
this.lblURL.setText(status['file_url'].substr(0,40).concat('...')); this.lblURL.setText(
status['file_url'].substr(0, 40).concat('...')
);
} }
}, },
scope: this scope: this,
}); });
}, },
@ -329,7 +346,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
forceDown: function() { forceDown: function() {
this.onApply(); this.onApply();
deluge.client.blocklist.check_import(force = true); deluge.client.blocklist.check_import((force = true));
}, },
updateConfig: function() { updateConfig: function() {
@ -348,7 +365,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
this.WhitelistFset.getComponent(0).loadData(data); this.WhitelistFset.getComponent(0).loadData(data);
}, },
scope: this scope: this,
}); });
deluge.client.blocklist.get_status({ deluge.client.blocklist.get_status({
@ -356,9 +373,11 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
this.lblFileSize.setText(fsize(status['file_size'])); this.lblFileSize.setText(fsize(status['file_size']));
this.lblDate.setText(fdate(status['file_date'])); this.lblDate.setText(fdate(status['file_date']));
this.lblType.setText(status['file_type']); this.lblType.setText(status['file_type']);
this.lblURL.setText(status['file_url'].substr(0,40).concat('...')); this.lblURL.setText(
status['file_url'].substr(0, 40).concat('...')
);
}, },
scope: this scope: this,
}); });
}, },
@ -366,7 +385,7 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
var store = this.WhitelistFset.getComponent(0).getStore(); var store = this.WhitelistFset.getComponent(0).getStore();
var IP = store.recordType; var IP = store.recordType;
var i = new IP({ var i = new IP({
ip: '' ip: '',
}); });
this.WhitelistFset.getComponent(0).stopEditing(); this.WhitelistFset.getComponent(0).stopEditing();
store.insert(0, i); store.insert(0, i);
@ -374,12 +393,13 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
}, },
deleteIP: function() { deleteIP: function() {
var selections = this.WhitelistFset.getComponent(0).getSelectionModel().getSelections(); var selections = this.WhitelistFset.getComponent(0)
.getSelectionModel()
.getSelections();
var store = this.WhitelistFset.getComponent(0).getStore(); var store = this.WhitelistFset.getComponent(0).getStore();
this.WhitelistFset.getComponent(0).stopEditing(); this.WhitelistFset.getComponent(0).stopEditing();
for (var i = 0; i < selections.length; i++) for (var i = 0; i < selections.length; i++) store.remove(selections[i]);
store.remove(selections[i]);
store.commitChanges(); store.commitChanges();
}, },
@ -389,11 +409,10 @@ Deluge.ux.preferences.BlocklistPage = Ext.extend(Ext.Panel, {
deluge.preferences.un('show', this.updateConfig, this); deluge.preferences.un('show', this.updateConfig, this);
Deluge.ux.preferences.BlocklistPage.superclass.onDestroy.call(this); Deluge.ux.preferences.BlocklistPage.superclass.onDestroy.call(this);
} },
}); });
Deluge.plugins.BlocklistPlugin = Ext.extend(Deluge.Plugin, { Deluge.plugins.BlocklistPlugin = Ext.extend(Deluge.Plugin, {
name: 'Blocklist', name: 'Blocklist',
onDisable: function() { onDisable: function() {
@ -401,8 +420,10 @@ Deluge.plugins.BlocklistPlugin = Ext.extend(Deluge.Plugin, {
}, },
onEnable: function() { onEnable: function() {
this.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.BlocklistPage()); this.prefsPage = deluge.preferences.addPage(
} new Deluge.ux.preferences.BlocklistPage()
);
},
}); });
Deluge.registerPlugin('Blocklist', Deluge.plugins.BlocklistPlugin); Deluge.registerPlugin('Blocklist', Deluge.plugins.BlocklistPlugin);

View File

@ -13,7 +13,6 @@
Ext.ns('Deluge.ux'); Ext.ns('Deluge.ux');
Deluge.ux.ExecuteWindowBase = Ext.extend(Ext.Window, { Deluge.ux.ExecuteWindowBase = Ext.extend(Ext.Window, {
layout: 'fit', layout: 'fit',
width: 400, width: 400,
height: 130, height: 130,
@ -27,7 +26,8 @@ Deluge.ux.ExecuteWindowBase = Ext.extend(Ext.Window, {
xtype: 'form', xtype: 'form',
baseCls: 'x-plain', baseCls: 'x-plain',
bodyStyle: 'padding: 5px', bodyStyle: 'padding: 5px',
items: [{ items: [
{
xtype: 'combo', xtype: 'combo',
width: 270, width: 270,
fieldLabel: _('Event'), fieldLabel: _('Event'),
@ -36,38 +36,39 @@ Deluge.ux.ExecuteWindowBase = Ext.extend(Ext.Window, {
data: [ data: [
['complete', _('Torrent Complete')], ['complete', _('Torrent Complete')],
['added', _('Torrent Added')], ['added', _('Torrent Added')],
['removed', _('Torrent Removed')] ['removed', _('Torrent Removed')],
] ],
}), }),
name: 'event', name: 'event',
mode: 'local', mode: 'local',
editable: false, editable: false,
triggerAction: 'all', triggerAction: 'all',
valueField: 'id', valueField: 'id',
displayField: 'text' displayField: 'text',
}, { },
{
xtype: 'textfield', xtype: 'textfield',
fieldLabel: _('Command'), fieldLabel: _('Command'),
name: 'command', name: 'command',
width: 270 width: 270,
}] },
],
}); });
}, },
onCancelClick: function() { onCancelClick: function() {
this.hide(); this.hide();
} },
}); });
Deluge.ux.EditExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, { Deluge.ux.EditExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, {
title: _('Edit Command'), title: _('Edit Command'),
initComponent: function() { initComponent: function() {
Deluge.ux.EditExecuteCommandWindow.superclass.initComponent.call(this); Deluge.ux.EditExecuteCommandWindow.superclass.initComponent.call(this);
this.addButton(_('Save'), this.onSaveClick, this); this.addButton(_('Save'), this.onSaveClick, this);
this.addEvents({ this.addEvents({
'commandedit': true commandedit: true,
}); });
}, },
@ -76,32 +77,40 @@ Deluge.ux.EditExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, {
this.command = command; this.command = command;
this.form.getForm().setValues({ this.form.getForm().setValues({
event: command.get('event'), event: command.get('event'),
command: command.get('name') command: command.get('name'),
}); });
}, },
onSaveClick: function() { onSaveClick: function() {
var values = this.form.getForm().getFieldValues(); var values = this.form.getForm().getFieldValues();
deluge.client.execute.save_command(this.command.id, values.event, values.command, { deluge.client.execute.save_command(
this.command.id,
values.event,
values.command,
{
success: function() { success: function() {
this.fireEvent('commandedit', this, values.event, values.command); this.fireEvent(
'commandedit',
this,
values.event,
values.command
);
}, },
scope: this scope: this,
});
this.hide();
} }
);
this.hide();
},
}); });
Deluge.ux.AddExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, { Deluge.ux.AddExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, {
title: _('Add Command'), title: _('Add Command'),
initComponent: function() { initComponent: function() {
Deluge.ux.AddExecuteCommandWindow.superclass.initComponent.call(this); Deluge.ux.AddExecuteCommandWindow.superclass.initComponent.call(this);
this.addButton(_('Add'), this.onAddClick, this); this.addButton(_('Add'), this.onAddClick, this);
this.addEvents({ this.addEvents({
'commandadd': true commandadd: true,
}); });
}, },
@ -109,13 +118,17 @@ Deluge.ux.AddExecuteCommandWindow = Ext.extend(Deluge.ux.ExecuteWindowBase, {
var values = this.form.getForm().getFieldValues(); var values = this.form.getForm().getFieldValues();
deluge.client.execute.add_command(values.event, values.command, { deluge.client.execute.add_command(values.event, values.command, {
success: function() { success: function() {
this.fireEvent('commandadd', this, values.event, values.command); this.fireEvent(
'commandadd',
this,
values.event,
values.command
);
}, },
scope: this scope: this,
}); });
this.hide(); this.hide();
} },
}); });
Ext.ns('Deluge.ux.preferences'); Ext.ns('Deluge.ux.preferences');
@ -125,7 +138,6 @@ Ext.ns('Deluge.ux.preferences');
* @extends Ext.Panel * @extends Ext.Panel
*/ */
Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, { Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
title: _('Execute'), title: _('Execute'),
header: false, header: false,
layout: 'fit', layout: 'fit',
@ -133,63 +145,71 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
initComponent: function() { initComponent: function() {
Deluge.ux.preferences.ExecutePage.superclass.initComponent.call(this); Deluge.ux.preferences.ExecutePage.superclass.initComponent.call(this);
var event_map = this.event_map = { var event_map = (this.event_map = {
'complete': _('Torrent Complete'), complete: _('Torrent Complete'),
'added': _('Torrent Added'), added: _('Torrent Added'),
'removed': _('Torrent Removed') removed: _('Torrent Removed'),
}; });
this.list = new Ext.list.ListView({ this.list = new Ext.list.ListView({
store: new Ext.data.SimpleStore({ store: new Ext.data.SimpleStore({
fields: [ fields: [
{ name: 'event', mapping: 1 }, { name: 'event', mapping: 1 },
{name: 'name', mapping: 2} { name: 'name', mapping: 2 },
], ],
id: 0 id: 0,
}), }),
columns: [{ columns: [
width: .3, {
width: 0.3,
header: _('Event'), header: _('Event'),
sortable: true, sortable: true,
dataIndex: 'event', dataIndex: 'event',
tpl: new Ext.XTemplate('{[this.getEvent(values.event)]}', { tpl: new Ext.XTemplate('{[this.getEvent(values.event)]}', {
getEvent: function(e) { getEvent: function(e) {
return (event_map[e]) ? event_map[e] : e; return event_map[e] ? event_map[e] : e;
} },
}) }),
}, { },
{
id: 'name', id: 'name',
header: _('Command'), header: _('Command'),
sortable: true, sortable: true,
dataIndex: 'name' dataIndex: 'name',
}], },
],
singleSelect: true, singleSelect: true,
autoExpandColumn: 'name' autoExpandColumn: 'name',
}); });
this.list.on('selectionchange', this.onSelectionChange, this); this.list.on('selectionchange', this.onSelectionChange, this);
this.panel = this.add({ this.panel = this.add({
items: [this.list], items: [this.list],
bbar: { bbar: {
items: [{ items: [
{
text: _('Add'), text: _('Add'),
iconCls: 'icon-add', iconCls: 'icon-add',
handler: this.onAddClick, handler: this.onAddClick,
scope: this scope: this,
}, { },
{
text: _('Edit'), text: _('Edit'),
iconCls: 'icon-edit', iconCls: 'icon-edit',
handler: this.onEditClick, handler: this.onEditClick,
scope: this, scope: this,
disabled: true disabled: true,
}, '->', { },
'->',
{
text: _('Remove'), text: _('Remove'),
iconCls: 'icon-remove', iconCls: 'icon-remove',
handler: this.onRemoveClick, handler: this.onRemoveClick,
scope: this, scope: this,
disabled: true disabled: true,
}] },
} ],
},
}); });
this.on('show', this.onPreferencesShow, this); this.on('show', this.onPreferencesShow, this);
@ -200,16 +220,20 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
success: function(commands) { success: function(commands) {
this.list.getStore().loadData(commands); this.list.getStore().loadData(commands);
}, },
scope: this scope: this,
}); });
}, },
onAddClick: function() { onAddClick: function() {
if (!this.addWin) { if (!this.addWin) {
this.addWin = new Deluge.ux.AddExecuteCommandWindow(); this.addWin = new Deluge.ux.AddExecuteCommandWindow();
this.addWin.on('commandadd', function() { this.addWin.on(
'commandadd',
function() {
this.updateCommands(); this.updateCommands();
}, this); },
this
);
} }
this.addWin.show(); this.addWin.show();
}, },
@ -217,16 +241,20 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
onCommandAdded: function(win, evt, cmd) { onCommandAdded: function(win, evt, cmd) {
var record = new this.list.getStore().recordType({ var record = new this.list.getStore().recordType({
event: evt, event: evt,
command: cmd command: cmd,
}); });
}, },
onEditClick: function() { onEditClick: function() {
if (!this.editWin) { if (!this.editWin) {
this.editWin = new Deluge.ux.EditExecuteCommandWindow(); this.editWin = new Deluge.ux.EditExecuteCommandWindow();
this.editWin.on('commandedit', function() { this.editWin.on(
'commandedit',
function() {
this.updateCommands(); this.updateCommands();
}, this); },
this
);
} }
this.editWin.show(this.list.getSelectedRecords()[0]); this.editWin.show(this.list.getSelectedRecords()[0]);
}, },
@ -241,23 +269,34 @@ Deluge.ux.preferences.ExecutePage = Ext.extend(Ext.Panel, {
success: function() { success: function() {
this.updateCommands(); this.updateCommands();
}, },
scope: this scope: this,
}); });
}, },
onSelectionChange: function(dv, selections) { onSelectionChange: function(dv, selections) {
if (selections.length) { if (selections.length) {
this.panel.getBottomToolbar().items.get(1).enable(); this.panel
this.panel.getBottomToolbar().items.get(3).enable(); .getBottomToolbar()
.items.get(1)
.enable();
this.panel
.getBottomToolbar()
.items.get(3)
.enable();
} else { } else {
this.panel.getBottomToolbar().items.get(1).disable(); this.panel
this.panel.getBottomToolbar().items.get(3).disable(); .getBottomToolbar()
} .items.get(1)
.disable();
this.panel
.getBottomToolbar()
.items.get(3)
.disable();
} }
},
}); });
Deluge.plugins.ExecutePlugin = Ext.extend(Deluge.Plugin, { Deluge.plugins.ExecutePlugin = Ext.extend(Deluge.Plugin, {
name: 'Execute', name: 'Execute',
onDisable: function() { onDisable: function() {
@ -265,7 +304,9 @@ Deluge.plugins.ExecutePlugin = Ext.extend(Deluge.Plugin, {
}, },
onEnable: function() { onEnable: function() {
this.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.ExecutePage()); this.prefsPage = deluge.preferences.addPage(
} new Deluge.ux.preferences.ExecutePage()
);
},
}); });
Deluge.registerPlugin('Execute', Deluge.plugins.ExecutePlugin); Deluge.registerPlugin('Execute', Deluge.plugins.ExecutePlugin);

View File

@ -16,7 +16,6 @@ Ext.ns('Deluge.ux.preferences');
* @extends Ext.Panel * @extends Ext.Panel
*/ */
Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, { Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, {
title: _('Extractor'), title: _('Extractor'),
header: false, header: false,
layout: 'fit', layout: 'fit',
@ -29,7 +28,7 @@ Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, {
xtype: 'form', xtype: 'form',
layout: 'form', layout: 'form',
border: false, border: false,
autoHeight: true autoHeight: true,
}); });
fieldset = this.form.add({ fieldset = this.form.add({
@ -39,23 +38,22 @@ Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, {
autoHeight: true, autoHeight: true,
labelAlign: 'top', labelAlign: 'top',
labelWidth: 80, labelWidth: 80,
defaultType: 'textfield' defaultType: 'textfield',
}); });
this.extract_path = fieldset.add({ this.extract_path = fieldset.add({
fieldLabel: _('Extract to:'), fieldLabel: _('Extract to:'),
labelSeparator: '', labelSeparator: '',
name: 'extract_path', name: 'extract_path',
width: '97%' width: '97%',
}); });
this.use_name_folder = fieldset.add({ this.use_name_folder = fieldset.add({
xtype: 'checkbox', xtype: 'checkbox',
name: 'use_name_folder', name: 'use_name_folder',
height: 22, height: 22,
hideLabel: true, hideLabel: true,
boxLabel: _('Create torrent name sub-folder') boxLabel: _('Create torrent name sub-folder'),
}); });
this.on('show', this.updateConfig, this); this.on('show', this.updateConfig, this);
@ -81,14 +79,12 @@ Deluge.ux.preferences.ExtractorPage = Ext.extend(Ext.Panel, {
this.extract_path.setValue(config['extract_path']); this.extract_path.setValue(config['extract_path']);
this.use_name_folder.setValue(config['use_name_folder']); this.use_name_folder.setValue(config['use_name_folder']);
}, },
scope: this scope: this,
}); });
} },
}); });
Deluge.plugins.ExtractorPlugin = Ext.extend(Deluge.Plugin, { Deluge.plugins.ExtractorPlugin = Ext.extend(Deluge.Plugin, {
name: 'Extractor', name: 'Extractor',
onDisable: function() { onDisable: function() {
@ -96,7 +92,9 @@ Deluge.plugins.ExtractorPlugin = Ext.extend(Deluge.Plugin, {
}, },
onEnable: function() { onEnable: function() {
this.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.ExtractorPage()); this.prefsPage = deluge.preferences.addPage(
} new Deluge.ux.preferences.ExtractorPage()
);
},
}); });
Deluge.registerPlugin('Extractor', Deluge.plugins.ExtractorPlugin); Deluge.registerPlugin('Extractor', Deluge.plugins.ExtractorPlugin);

View File

@ -16,7 +16,6 @@ Ext.ns('Deluge.ux.preferences');
* @extends Ext.Panel * @extends Ext.Panel
*/ */
Deluge.ux.preferences.LabelPage = Ext.extend(Ext.Panel, { Deluge.ux.preferences.LabelPage = Ext.extend(Ext.Panel, {
title: _('Label'), title: _('Label'),
layout: 'fit', layout: 'fit',
border: false, border: false,
@ -29,20 +28,20 @@ Deluge.ux.preferences.LabelPage = Ext.extend(Ext.Panel, {
title: _('Label Preferences'), title: _('Label Preferences'),
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'panel' defaultType: 'panel',
}); });
fieldset.add({ fieldset.add({
border: false, border: false,
bodyCfg: { bodyCfg: {
html: _('<p>The Label plugin is enabled.</p><br>' + html: _(
'<p>The Label plugin is enabled.</p><br>' +
'<p>To add, remove or edit labels right-click on the Label filter ' + '<p>To add, remove or edit labels right-click on the Label filter ' +
'entry in the sidebar.</p><br>' + 'entry in the sidebar.</p><br>' +
'<p>To apply a label right-click on torrent(s).<p>') '<p>To apply a label right-click on torrent(s).<p>'
} ),
}); },
});
}, },
}); });
Ext.ns('Deluge.ux'); Ext.ns('Deluge.ux');
@ -52,7 +51,6 @@ Ext.ns('Deluge.ux');
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, { Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
title: _('Add Label'), title: _('Add Label'),
width: 300, width: 300,
height: 100, height: 100,
@ -69,20 +67,22 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
bodyStyle: 'padding:5px 5px 0', bodyStyle: 'padding:5px 5px 0',
defaultType: 'textfield', defaultType: 'textfield',
labelWidth: 50, labelWidth: 50,
items: [{ items: [
{
fieldLabel: _('Name'), fieldLabel: _('Name'),
name: 'name', name: 'name',
allowBlank: false, allowBlank: false,
width: 220, width: 220,
listeners: { listeners: {
'specialkey': { specialkey: {
fn: function(field, e) { fn: function(field, e) {
if (e.getKey() == 13) this.onOkClick(); if (e.getKey() == 13) this.onOkClick();
}, },
scope: this scope: this,
} },
} },
}] },
],
}); });
}, },
@ -97,7 +97,7 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
deluge.ui.update(); deluge.ui.update();
this.fireEvent('labeladded', label); this.fireEvent('labeladded', label);
}, },
scope: this scope: this,
}); });
this.hide(); this.hide();
}, },
@ -109,9 +109,11 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
onShow: function(comp) { onShow: function(comp) {
Deluge.ux.AddLabelWindow.superclass.onShow.call(this, comp); Deluge.ux.AddLabelWindow.superclass.onShow.call(this, comp);
this.form.getForm().findField('name').focus(false, 150); this.form
} .getForm()
.findField('name')
.focus(false, 150);
},
}); });
/** /**
@ -119,7 +121,6 @@ Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, { Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
title: _('Label Options'), title: _('Label Options'),
width: 325, width: 325,
height: 240, height: 240,
@ -130,136 +131,178 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
this.addButton(_('Ok'), this.onOkClick, this); this.addButton(_('Ok'), this.onOkClick, this);
this.form = this.add({ this.form = this.add({
xtype: 'form' xtype: 'form',
}); });
this.tabs = this.form.add({ this.tabs = this.form.add({
xtype: 'tabpanel', xtype: 'tabpanel',
height: 175, height: 175,
border: false, border: false,
items: [{ items: [
{
title: _('Maximum'), title: _('Maximum'),
items: [{ items: [
{
border: false, border: false,
items: [{ items: [
{
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
labelWidth: 1, labelWidth: 1,
style: 'margin-bottom: 0px; padding-bottom: 0px;', style:
items: [{ 'margin-bottom: 0px; padding-bottom: 0px;',
items: [
{
xtype: 'checkbox', xtype: 'checkbox',
name: 'apply_max', name: 'apply_max',
fieldLabel: '', fieldLabel: '',
boxLabel: _('Apply per torrent max settings:'), boxLabel: _(
'Apply per torrent max settings:'
),
listeners: { listeners: {
check: this.onFieldChecked check: this.onFieldChecked,
} },
}] },
}, { ],
},
{
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
defaultType: 'spinnerfield', defaultType: 'spinnerfield',
style: 'margin-top: 0px; padding-top: 0px;', style: 'margin-top: 0px; padding-top: 0px;',
items: [{ items: [
{
fieldLabel: _('Download Speed'), fieldLabel: _('Download Speed'),
name: 'max_download_speed', name: 'max_download_speed',
width: 80, width: 80,
disabled: true, disabled: true,
value: -1, value: -1,
minValue: -1 minValue: -1,
}, { },
{
fieldLabel: _('Upload Speed'), fieldLabel: _('Upload Speed'),
name: 'max_upload_speed', name: 'max_upload_speed',
width: 80, width: 80,
disabled: true, disabled: true,
value: -1, value: -1,
minValue: -1 minValue: -1,
}, { },
{
fieldLabel: _('Upload Slots'), fieldLabel: _('Upload Slots'),
name: 'max_upload_slots', name: 'max_upload_slots',
width: 80, width: 80,
disabled: true, disabled: true,
value: -1, value: -1,
minValue: -1 minValue: -1,
}, { },
{
fieldLabel: _('Connections'), fieldLabel: _('Connections'),
name: 'max_connections', name: 'max_connections',
width: 80, width: 80,
disabled: true, disabled: true,
value: -1, value: -1,
minValue: -1 minValue: -1,
}] },
}] ],
}] },
}, { ],
},
],
},
{
title: _('Queue'), title: _('Queue'),
items: [{ items: [
{
border: false, border: false,
items: [{ items: [
{
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
labelWidth: 1, labelWidth: 1,
style: 'margin-bottom: 0px; padding-bottom: 0px;', style:
items: [{ 'margin-bottom: 0px; padding-bottom: 0px;',
items: [
{
xtype: 'checkbox', xtype: 'checkbox',
name: 'apply_queue', name: 'apply_queue',
fieldLabel: '', fieldLabel: '',
boxLabel: _('Apply queue settings:'), boxLabel: _(
'Apply queue settings:'
),
listeners: { listeners: {
check: this.onFieldChecked check: this.onFieldChecked,
} },
}] },
}, { ],
},
{
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox', defaultType: 'checkbox',
style: 'margin-top: 0px; padding-top: 0px;', style: 'margin-top: 0px; padding-top: 0px;',
defaults: { defaults: {
style: 'margin-left: 20px' style: 'margin-left: 20px',
}, },
items: [{ items: [
{
boxLabel: _('Auto Managed'), boxLabel: _('Auto Managed'),
name: 'is_auto_managed', name: 'is_auto_managed',
disabled: true disabled: true,
}, { },
{
boxLabel: _('Stop seed at ratio:'), boxLabel: _('Stop seed at ratio:'),
name: 'stop_at_ratio', name: 'stop_at_ratio',
disabled: true disabled: true,
}, { },
{
xtype: 'spinnerfield', xtype: 'spinnerfield',
name: 'stop_ratio', name: 'stop_ratio',
width: 60, width: 60,
decimalPrecision: 2, decimalPrecision: 2,
incrementValue: 0.1, incrementValue: 0.1,
style: 'position: relative; left: 100px', style:
disabled: true 'position: relative; left: 100px',
}, { disabled: true,
},
{
boxLabel: _('Remove at ratio'), boxLabel: _('Remove at ratio'),
name: 'remove_at_ratio', name: 'remove_at_ratio',
disabled: true disabled: true,
}] },
}] ],
}] },
}, { ],
},
],
},
{
title: _('Folders'), title: _('Folders'),
items: [{ items: [
{
border: false, border: false,
items: [{ items: [
{
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
labelWidth: 1, labelWidth: 1,
style: 'margin-bottom: 0px; padding-bottom: 0px;', style:
items: [{ 'margin-bottom: 0px; padding-bottom: 0px;',
items: [
{
xtype: 'checkbox', xtype: 'checkbox',
name: 'apply_move_completed', name: 'apply_move_completed',
fieldLabel: '', fieldLabel: '',
boxLabel: _('Apply folder settings:'), boxLabel: _(
'Apply folder settings:'
),
listeners: { listeners: {
check: this.onFieldChecked check: this.onFieldChecked,
} },
}] },
}, { ],
},
{
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
labelWidth: 1, labelWidth: 1,
@ -267,64 +310,83 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
labelWidth: 1, labelWidth: 1,
style: 'margin-top: 0px; padding-top: 0px;', style: 'margin-top: 0px; padding-top: 0px;',
defaults: { defaults: {
style: 'margin-left: 20px' style: 'margin-left: 20px',
}, },
items: [{ items: [
{
boxLabel: _('Move completed to:'), boxLabel: _('Move completed to:'),
name: 'move_completed', name: 'move_completed',
disabled: true disabled: true,
}, { },
{
xtype: 'textfield', xtype: 'textfield',
name: 'move_completed_path', name: 'move_completed_path',
width: 250, width: 250,
disabled: true disabled: true,
}] },
}] ],
}] },
}, { ],
},
],
},
{
title: _('Trackers'), title: _('Trackers'),
items: [{ items: [
{
border: false, border: false,
items: [{ items: [
{
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
labelWidth: 1, labelWidth: 1,
style: 'margin-bottom: 0px; padding-bottom: 0px;', style:
items: [{ 'margin-bottom: 0px; padding-bottom: 0px;',
items: [
{
xtype: 'checkbox', xtype: 'checkbox',
name: 'auto_add', name: 'auto_add',
fieldLabel: '', fieldLabel: '',
boxLabel: _('Automatically apply label:'), boxLabel: _(
'Automatically apply label:'
),
listeners: { listeners: {
check: this.onFieldChecked check: this.onFieldChecked,
} },
}] },
}, { ],
},
{
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
labelWidth: 1, labelWidth: 1,
style: 'margin-top: 0px; padding-top: 0px;', style: 'margin-top: 0px; padding-top: 0px;',
defaults: { defaults: {
style: 'margin-left: 20px' style: 'margin-left: 20px',
}, },
defaultType: 'textarea', defaultType: 'textarea',
items: [{ items: [
{
boxLabel: _('Move completed to:'), boxLabel: _('Move completed to:'),
name: 'auto_add_trackers', name: 'auto_add_trackers',
width: 250, width: 250,
height: 100, height: 100,
disabled: true disabled: true,
}] },
}] ],
}] },
}] ],
},
],
},
],
}); });
}, },
getLabelOptions: function() { getLabelOptions: function() {
deluge.client.label.get_options(this.label, { deluge.client.label.get_options(this.label, {
success: this.gotOptions, success: this.gotOptions,
scope: this scope: this,
}); });
}, },
@ -347,7 +409,9 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
onOkClick: function() { onOkClick: function() {
var values = this.form.getForm().getFieldValues(); var values = this.form.getForm().getFieldValues();
if (values['auto_add_trackers']) { if (values['auto_add_trackers']) {
values['auto_add_trackers'] = values['auto_add_trackers'].split('\n'); values['auto_add_trackers'] = values['auto_add_trackers'].split(
'\n'
);
} }
deluge.client.label.set_options(this.label, values); deluge.client.label.set_options(this.label, values);
this.hide(); this.hide();
@ -358,11 +422,9 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
fs.items.each(function(field) { fs.items.each(function(field) {
field.setDisabled(!checked); field.setDisabled(!checked);
}); });
} },
}); });
Ext.ns('Deluge.plugins'); Ext.ns('Deluge.plugins');
/** /**
@ -370,28 +432,31 @@ Ext.ns('Deluge.plugins');
* @extends Deluge.Plugin * @extends Deluge.Plugin
*/ */
Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, { Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
name: 'Label', name: 'Label',
createMenu: function() { createMenu: function() {
this.labelMenu = new Ext.menu.Menu({ this.labelMenu = new Ext.menu.Menu({
items: [{ items: [
{
text: _('Add Label'), text: _('Add Label'),
iconCls: 'icon-add', iconCls: 'icon-add',
handler: this.onLabelAddClick, handler: this.onLabelAddClick,
scope: this scope: this,
}, { },
{
text: _('Remove Label'), text: _('Remove Label'),
disabled: true, disabled: true,
iconCls: 'icon-remove', iconCls: 'icon-remove',
handler: this.onLabelRemoveClick, handler: this.onLabelRemoveClick,
scope: this scope: this,
}, { },
{
text: _('Label Options'), text: _('Label Options'),
disabled: true, disabled: true,
handler: this.onLabelOptionsClick, handler: this.onLabelOptionsClick,
scope: this scope: this,
}] },
],
}); });
}, },
@ -409,7 +474,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
text: _('No Label'), text: _('No Label'),
label: '', label: '',
handler: this.onTorrentMenuClick, handler: this.onTorrentMenuClick,
scope: this scope: this,
}); });
for (var state in states) { for (var state in states) {
if (!state || state == 'All') continue; if (!state || state == 'All') continue;
@ -417,7 +482,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
text: state, text: state,
label: state, label: state,
handler: this.onTorrentMenuClick, handler: this.onTorrentMenuClick,
scope: this scope: this,
}); });
} }
}, },
@ -433,19 +498,22 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
}, },
onEnable: function() { onEnable: function() {
this.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.LabelPage()); this.prefsPage = deluge.preferences.addPage(
new Deluge.ux.preferences.LabelPage()
);
this.torrentMenu = new Ext.menu.Menu(); this.torrentMenu = new Ext.menu.Menu();
this.tmSep = deluge.menus.torrent.add({ this.tmSep = deluge.menus.torrent.add({
xtype: 'menuseparator' xtype: 'menuseparator',
}); });
this.tm = deluge.menus.torrent.add({ this.tm = deluge.menus.torrent.add({
text: _('Label'), text: _('Label'),
menu: this.torrentMenu menu: this.torrentMenu,
}); });
var lbltpl = '<div class="x-deluge-filter">' + var lbltpl =
'<div class="x-deluge-filter">' +
'<tpl if="filter">{filter}</tpl>' + '<tpl if="filter">{filter}</tpl>' +
'<tpl if="!filter">No Label</tpl>' + '<tpl if="!filter">No Label</tpl>' +
' ({count})' + ' ({count})' +
@ -459,7 +527,11 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
filter.list.refresh(); filter.list.refresh();
} else { } else {
deluge.sidebar.on('filtercreate', this.onFilterCreate, this); deluge.sidebar.on('filtercreate', this.onFilterCreate, this);
deluge.sidebar.on('afterfiltercreate', this.onAfterFilterCreate, this); deluge.sidebar.on(
'afterfiltercreate',
this.onAfterFilterCreate,
this
);
Deluge.FilterPanel.templates.label = lbltpl; Deluge.FilterPanel.templates.label = lbltpl;
} }
this.registerTorrentStatus('label', _('Label')); this.registerTorrentStatus('label', _('Label'));
@ -499,7 +571,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
//console.log(states); //console.log(states);
//console.log(statesArray); //console.log(statesArray);
states = {} states = {};
for (i = 0; i < statesArray.length; ++i) { for (i = 0; i < statesArray.length; ++i) {
states[statesArray[i]] = 0; states[statesArray[i]] = 0;
@ -532,7 +604,8 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
}, },
onLabelOptionsClick: function() { onLabelOptionsClick: function() {
if (!this.labelOpts) this.labelOpts = new Deluge.ux.LabelOptionsWindow(); if (!this.labelOpts)
this.labelOpts = new Deluge.ux.LabelOptionsWindow();
this.labelOpts.show(this.filter.getState()); this.labelOpts.show(this.filter.getState());
}, },
@ -547,7 +620,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
var i = item; var i = item;
}, this); }, this);
}, },
scope: this scope: this,
}); });
}, },
@ -558,12 +631,12 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
deluge.client.label.set_torrent(id, item.label, { deluge.client.label.set_torrent(id, item.label, {
success: function() { success: function() {
deluge.ui.update(); deluge.ui.update();
} },
}); });
} else { } else {
deluge.client.label.set_torrent(id, item.label); deluge.client.label.set_torrent(id, item.label);
} }
}); });
} },
}); });
Deluge.registerPlugin('Label', Deluge.plugins.LabelPlugin); Deluge.registerPlugin('Label', Deluge.plugins.LabelPlugin);

View File

@ -16,14 +16,15 @@ Ext.ns('Deluge.ux.preferences');
* @extends Ext.Panel * @extends Ext.Panel
*/ */
Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, { Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
title: _('Notifications'), title: _('Notifications'),
header: false, header: false,
layout: 'fit', layout: 'fit',
border: false, border: false,
initComponent: function() { initComponent: function() {
Deluge.ux.preferences.NotificationsPage.superclass.initComponent.call(this); Deluge.ux.preferences.NotificationsPage.superclass.initComponent.call(
this
);
this.emailNotiFset = new Ext.form.FieldSet({ this.emailNotiFset = new Ext.form.FieldSet({
xtype: 'fieldset', xtype: 'fieldset',
@ -33,7 +34,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
defaultType: 'textfield', defaultType: 'textfield',
style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;',
width: '85%', width: '85%',
labelWidth: 1 labelWidth: 1,
}); });
this.chkEnableEmail = this.emailNotiFset.add({ this.chkEnableEmail = this.emailNotiFset.add({
@ -46,8 +47,8 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
check: function(object, checked) { check: function(object, checked) {
this.setSmtpDisabled(!checked); this.setSmtpDisabled(!checked);
}, },
scope: this scope: this,
} },
}); });
this.hBoxHost = this.emailNotiFset.add({ this.hBoxHost = this.emailNotiFset.add({
@ -57,14 +58,17 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
disabled: true, disabled: true,
items: [{ items: [
{
xtype: 'label', xtype: 'label',
text: _('Hostname:'), text: _('Hostname:'),
margins: '6 0 0 6' margins: '6 0 0 6',
},{ },
{
xtype: 'textfield', xtype: 'textfield',
margins: '2 0 0 4' margins: '2 0 0 4',
}] },
],
}); });
this.hBoxPort = this.emailNotiFset.add({ this.hBoxPort = this.emailNotiFset.add({
@ -74,18 +78,21 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
disabled: true, disabled: true,
items: [{ items: [
{
xtype: 'label', xtype: 'label',
text: _('Port:'), text: _('Port:'),
margins: '6 0 0 6' margins: '6 0 0 6',
},{ },
{
xtype: 'spinnerfield', xtype: 'spinnerfield',
margins: '2 0 0 34', margins: '2 0 0 34',
width: 64, width: 64,
decimalPrecision: 0, decimalPrecision: 0,
minValue: 0, minValue: 0,
maxValue: 65535 maxValue: 65535,
}] },
],
}); });
this.hBoxUser = this.emailNotiFset.add({ this.hBoxUser = this.emailNotiFset.add({
@ -95,14 +102,17 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
disabled: true, disabled: true,
items: [{ items: [
{
xtype: 'label', xtype: 'label',
text: _('Username:'), text: _('Username:'),
margins: '6 0 0 6' margins: '6 0 0 6',
},{ },
{
xtype: 'textfield', xtype: 'textfield',
margins: '2 0 0 3' margins: '2 0 0 3',
}] },
],
}); });
this.hBoxPassword = this.emailNotiFset.add({ this.hBoxPassword = this.emailNotiFset.add({
@ -112,15 +122,18 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
disabled: true, disabled: true,
items: [{ items: [
{
xtype: 'label', xtype: 'label',
text: _('Password:'), text: _('Password:'),
margins: '6 0 0 6' margins: '6 0 0 6',
},{ },
{
xtype: 'textfield', xtype: 'textfield',
inputType: 'password', inputType: 'password',
margins: '2 0 0 5' margins: '2 0 0 5',
}] },
],
}); });
this.hBoxFrom = this.emailNotiFset.add({ this.hBoxFrom = this.emailNotiFset.add({
@ -130,14 +143,17 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
xtype: 'container', xtype: 'container',
layout: 'hbox', layout: 'hbox',
disabled: true, disabled: true,
items: [{ items: [
{
xtype: 'label', xtype: 'label',
text: _('From:'), text: _('From:'),
margins: '6 0 0 6' margins: '6 0 0 6',
},{ },
{
xtype: 'textfield', xtype: 'textfield',
margins: '2 0 0 28' margins: '2 0 0 28',
}] },
],
}); });
this.chkTLS = this.emailNotiFset.add({ this.chkTLS = this.emailNotiFset.add({
@ -146,7 +162,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
name: 'enable_tls_ssl', name: 'enable_tls_ssl',
xtype: 'checkbox', xtype: 'checkbox',
disabled: true, disabled: true,
boxLabel: _('Server requires TLS/SSL') boxLabel: _('Server requires TLS/SSL'),
}); });
this.recipientsFset = new Ext.form.FieldSet({ this.recipientsFset = new Ext.form.FieldSet({
@ -157,7 +173,8 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
defaultType: 'editorgrid', defaultType: 'editorgrid',
style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 3px; margin-bottom: 0px; padding-bottom: 0px;',
autoWidth: true, autoWidth: true,
items: [{ items: [
{
fieldLabel: '', fieldLabel: '',
name: 'recipients', name: 'recipients',
margins: '2 0 5 5', margins: '2 0 5 5',
@ -167,24 +184,28 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
disabled: true, disabled: true,
autoExpandColumn: 'recipient', autoExpandColumn: 'recipient',
bbar: { bbar: {
items: [{ items: [
{
text: _('Add'), text: _('Add'),
iconCls: 'icon-add', iconCls: 'icon-add',
handler: this.onAddClick, handler: this.onAddClick,
scope: this scope: this,
},{ },
{
text: _('Remove'), text: _('Remove'),
iconCls: 'icon-remove', iconCls: 'icon-remove',
handler: this.onRemoveClick, handler: this.onRemoveClick,
scope: this scope: this,
}] },
],
}, },
viewConfig: { viewConfig: {
emptyText: _('Add an recipient...'), emptyText: _('Add an recipient...'),
deferEmptyText: false deferEmptyText: false,
}, },
colModel: new Ext.grid.ColumnModel({ colModel: new Ext.grid.ColumnModel({
columns: [{ columns: [
{
id: 'recipient', id: 'recipient',
header: _('Recipient'), header: _('Recipient'),
dataIndex: 'recipient', dataIndex: 'recipient',
@ -192,22 +213,23 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
hideable: false, hideable: false,
editable: true, editable: true,
editor: { editor: {
xtype: 'textfield' xtype: 'textfield',
} },
}] },
],
}), }),
selModel: new Ext.grid.RowSelectionModel({ selModel: new Ext.grid.RowSelectionModel({
singleSelect: false, singleSelect: false,
moveEditorOnEnter: false moveEditorOnEnter: false,
}), }),
store: new Ext.data.ArrayStore({ store: new Ext.data.ArrayStore({
autoDestroy: true, autoDestroy: true,
fields: [{name: 'recipient'}] fields: [{ name: 'recipient' }],
}), }),
listeners: { listeners: {
afteredit: function(e) { afteredit: function(e) {
e.record.commit(); e.record.commit();
} },
}, },
setEmptyText: function(text) { setEmptyText: function(text) {
if (this.viewReady) { if (this.viewReady) {
@ -222,8 +244,9 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
if (this.viewReady) { if (this.viewReady) {
this.getView().updateHeaders(); this.getView().updateHeaders();
} }
} },
}] },
],
}); });
this.edGridSubs = new Ext.grid.EditorGridPanel({ this.edGridSubs = new Ext.grid.EditorGridPanel({
@ -232,43 +255,59 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
autoExpandColumn: 'event', autoExpandColumn: 'event',
viewConfig: { viewConfig: {
emptyText: _('Loading events...'), emptyText: _('Loading events...'),
deferEmptyText: false deferEmptyText: false,
}, },
colModel: new Ext.grid.ColumnModel({ colModel: new Ext.grid.ColumnModel({
defaults: { defaults: {
renderer: function(value, meta, record, rowIndex, colIndex, store) { renderer: function(
value,
meta,
record,
rowIndex,
colIndex,
store
) {
if (Ext.isNumber(value) && parseInt(value) !== value) { if (Ext.isNumber(value) && parseInt(value) !== value) {
return value.toFixed(6); return value.toFixed(6);
} else if (Ext.isBoolean(value)) { } else if (Ext.isBoolean(value)) {
return '<div class="x-grid3-check-col' + (value ? '-on' : '') + return (
'" style="width: 20px;">&#160;</div>'; '<div class="x-grid3-check-col' +
(value ? '-on' : '') +
'" style="width: 20px;">&#160;</div>'
);
} }
return value; return value;
}
}, },
columns: [{ },
columns: [
{
id: 'event', id: 'event',
header: 'Event', header: 'Event',
dataIndex: 'event', dataIndex: 'event',
sortable: true, sortable: true,
hideable: false hideable: false,
},{ },
{
id: 'email', id: 'email',
header: _('Email'), header: _('Email'),
dataIndex: 'email', dataIndex: 'email',
sortable: true, sortable: true,
hideable: false, hideable: false,
menuDisabled: true, menuDisabled: true,
width: 40 width: 40,
}] },
],
}), }),
store: new Ext.data.ArrayStore({ store: new Ext.data.ArrayStore({
autoDestroy: true, autoDestroy: true,
fields: [{ fields: [
name: 'event' {
},{ name: 'event',
name: 'email' },
}] {
name: 'email',
},
],
}), }),
listeners: { listeners: {
cellclick: function(grid, rowIndex, colIndex, e) { cellclick: function(grid, rowIndex, colIndex, e) {
@ -292,7 +331,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
}, },
afteredit: function(e) { afteredit: function(e) {
e.record.commit(); e.record.commit();
} },
}, },
setEmptyText: function(text) { setEmptyText: function(text) {
if (this.viewReady) { if (this.viewReady) {
@ -313,20 +352,23 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
if (this.viewReady) { if (this.viewReady) {
this.getView().updateHeaders(); this.getView().updateHeaders();
} }
} },
}); });
this.tabPanSettings = this.add({ this.tabPanSettings = this.add({
xtype: 'tabpanel', xtype: 'tabpanel',
activeTab: 0, activeTab: 0,
items: [{ items: [
{
title: _('Settings'), title: _('Settings'),
items: [this.emailNotiFset, this.recipientsFset], items: [this.emailNotiFset, this.recipientsFset],
autoScroll: true autoScroll: true,
},{ },
{
title: _('Subscriptions'), title: _('Subscriptions'),
items: this.edGridSubs items: this.edGridSubs,
}] },
],
}); });
this.on('show', this.updateConfig, this); this.on('show', this.updateConfig, this);
@ -343,7 +385,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
} }
this.edGridSubs.loadData(data); this.edGridSubs.loadData(data);
}, },
scope: this scope: this,
}); });
deluge.client.notifications.get_config({ deluge.client.notifications.get_config({
success: function(config) { success: function(config) {
@ -369,10 +411,12 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
keys = Ext.keys(config['subscriptions']['email']); keys = Ext.keys(config['subscriptions']['email']);
for (var i = 0; i < keys.length; i++) { for (var i = 0; i < keys.length; i++) {
var key = keys[i]; var key = keys[i];
this.edGridSubs.setSub(config['subscriptions']['email'][key]); this.edGridSubs.setSub(
config['subscriptions']['email'][key]
);
} }
}, },
scope: this scope: this,
}); });
}, },
@ -425,7 +469,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
var store = this.recipientsFset.getComponent(0).getStore(); var store = this.recipientsFset.getComponent(0).getStore();
var Recipient = store.recordType; var Recipient = store.recordType;
var i = new Recipient({ var i = new Recipient({
recipient: '' recipient: '',
}); });
this.recipientsFset.getComponent(0).stopEditing(); this.recipientsFset.getComponent(0).stopEditing();
store.insert(0, i); store.insert(0, i);
@ -433,12 +477,14 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
}, },
onRemoveClick: function() { onRemoveClick: function() {
var selections = this.recipientsFset.getComponent(0).getSelectionModel().getSelections(); var selections = this.recipientsFset
.getComponent(0)
.getSelectionModel()
.getSelections();
var store = this.recipientsFset.getComponent(0).getStore(); var store = this.recipientsFset.getComponent(0).getStore();
this.recipientsFset.getComponent(0).stopEditing(); this.recipientsFset.getComponent(0).stopEditing();
for (var i = 0; i < selections.length; i++) for (var i = 0; i < selections.length; i++) store.remove(selections[i]);
store.remove(selections[i]);
store.commitChanges(); store.commitChanges();
}, },
@ -456,8 +502,7 @@ Deluge.ux.preferences.NotificationsPage = Ext.extend(Ext.Panel, {
deluge.preferences.un('show', this.updateConfig, this); deluge.preferences.un('show', this.updateConfig, this);
Deluge.ux.preferences.NotificationsPage.superclass.onDestroy.call(this); Deluge.ux.preferences.NotificationsPage.superclass.onDestroy.call(this);
} },
}); });
Deluge.plugins.NotificationsPlugin = Ext.extend(Deluge.Plugin, { Deluge.plugins.NotificationsPlugin = Ext.extend(Deluge.Plugin, {
@ -468,8 +513,10 @@ Deluge.plugins.NotificationsPlugin = Ext.extend(Deluge.Plugin, {
}, },
onEnable: function() { onEnable: function() {
this.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.NotificationsPage()); this.prefsPage = deluge.preferences.addPage(
} new Deluge.ux.preferences.NotificationsPage()
);
},
}); });
Deluge.registerPlugin('Notifications', Deluge.plugins.NotificationsPlugin); Deluge.registerPlugin('Notifications', Deluge.plugins.NotificationsPlugin);

View File

@ -13,7 +13,6 @@
Ext.ns('Deluge.ux'); Ext.ns('Deluge.ux');
Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, { Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
title: _('Schedule'), title: _('Schedule'),
autoHeight: true, autoHeight: true,
style: 'margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-bottom: 0px; padding-bottom: 0px;',
@ -24,20 +23,20 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
name: 'Normal', name: 'Normal',
backgroundColor: 'LightGreen', backgroundColor: 'LightGreen',
borderColor: 'DarkGreen', borderColor: 'DarkGreen',
value: 0 value: 0,
}, },
{ {
name: 'Throttled', name: 'Throttled',
backgroundColor: 'Yellow', backgroundColor: 'Yellow',
borderColor: 'Gold', borderColor: 'Gold',
value: 1 value: 1,
}, },
{ {
name: 'Paused', name: 'Paused',
backgroundColor: 'OrangeRed', backgroundColor: 'OrangeRed',
borderColor: 'FireBrick', borderColor: 'FireBrick',
value: 2 value: 2,
} },
], ],
daysOfWeek: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], daysOfWeek: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
@ -71,7 +70,8 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
// create state brushes // create state brushes
// tack a random number to the end to avoid clashes // tack a random number to the end to avoid clashes
this.stateBrushName = 'schedule-state-brush-' + Math.round(Math.random() * 10000); this.stateBrushName =
'schedule-state-brush-' + Math.round(Math.random() * 10000);
var el1 = createEl(dom, 'div'); var el1 = createEl(dom, 'div');
@ -124,11 +124,16 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
// cache access to cells for easier access later // cache access to cells for easier access later
this.scheduleCells = {}; this.scheduleCells = {};
Ext.each(this.daysOfWeek, function(day) { Ext.each(
this.daysOfWeek,
function(day) {
var cells = []; var cells = [];
var row = createEl(table, 'tr'); var row = createEl(table, 'tr');
var label = createEl(row, 'th'); var label = createEl(row, 'th');
label.setAttribute('style', 'font-weight: bold; padding-right: 5px;'); label.setAttribute(
'style',
'font-weight: bold; padding-right: 5px;'
);
label.appendChild(document.createTextNode(day)); label.appendChild(document.createTextNode(day));
for (var hour = 0; hour < 24; hour++) { for (var hour = 0; hour < 24; hour++) {
var cell = createEl(row, 'td'); var cell = createEl(row, 'td');
@ -143,7 +148,8 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
cell.style.border = '1px solid #999999'; cell.style.border = '1px solid #999999';
// don't repeat borders in between cells // don't repeat borders in between cells
if (hour != 23) // not the last cell if (hour != 23)
// not the last cell
cell.style.borderRight = 'none'; cell.style.borderRight = 'none';
this.updateCell(cell); this.updateCell(cell);
@ -164,7 +170,9 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
createEl(row, 'td').height = '3px'; createEl(row, 'td').height = '3px';
this.scheduleCells[day] = cells; this.scheduleCells[day] = cells;
}, this); },
this
);
}, },
updateCell: function(cell) { updateCell: function(cell) {
@ -182,10 +190,11 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
getCurrentBrushValue: function() { getCurrentBrushValue: function() {
var v = null; var v = null;
var brushes = Ext.get(this.body.dom).findParent('form').elements[this.stateBrushName]; var brushes = Ext.get(this.body.dom).findParent('form').elements[
this.stateBrushName
];
Ext.each(brushes, function(b) { Ext.each(brushes, function(b) {
if (b.checked) if (b.checked) v = b.value;
v = b.value;
}); });
return v; return v;
@ -209,8 +218,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
this.confirmCells(cell.day, this.dragAnchor.hour, cell.hour); this.confirmCells(cell.day, this.dragAnchor.hour, cell.hour);
else if (cell.hour < this.dragAnchor.hour) else if (cell.hour < this.dragAnchor.hour)
this.confirmCells(cell.day, cell.hour, this.dragAnchor.hour); this.confirmCells(cell.day, cell.hour, this.dragAnchor.hour);
else else this.confirmCells(cell.day, cell.hour, cell.hour);
this.confirmCells(cell.day, cell.hour, cell.hour);
this.hideCellLeftTooltip(); this.hideCellLeftTooltip();
this.hideCellRightTooltip(); this.hideCellRightTooltip();
@ -224,10 +232,11 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
// otherwise if dragging, leave it alone unless we're dragging to the left. // otherwise if dragging, leave it alone unless we're dragging to the left.
// if we're not dragging, show it. // if we're not dragging, show it.
var leftTooltipCell = null; var leftTooltipCell = null;
if (!this.dragAnchor) if (!this.dragAnchor) leftTooltipCell = cell;
leftTooltipCell = cell; else if (
else if ((this.dragAnchor && this.isCellLeftTooltipHidden()) || (this.dragAnchor && this.isCellLeftTooltipHidden()) ||
(this.dragAnchor && this.dragAnchor.hour > cell.hour)) (this.dragAnchor && this.dragAnchor.hour > cell.hour)
)
leftTooltipCell = this.dragAnchor; leftTooltipCell = this.dragAnchor;
if (leftTooltipCell) { if (leftTooltipCell) {
@ -238,23 +247,27 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
if (hour >= 12) { if (hour >= 12) {
pm = true; pm = true;
if (hour > 12) hour -= 12; if (hour > 12) hour -= 12;
} } else if (hour == 0) {
else if (hour == 0) {
// change 0 hour to 12am // change 0 hour to 12am
hour = 12; hour = 12;
} }
this.showCellLeftTooltip(hour + ' ' + (pm ? 'pm' : 'am'), leftTooltipCell); this.showCellLeftTooltip(
hour + ' ' + (pm ? 'pm' : 'am'),
leftTooltipCell
);
} }
// RIGHT TOOL TIP // RIGHT TOOL TIP
var rightTooltipCell = null; var rightTooltipCell = null;
if (this.dragAnchor) { if (this.dragAnchor) {
if (this.dragAnchor.hour == cell.hour) if (this.dragAnchor.hour == cell.hour) this.hideCellRightTooltip();
this.hideCellRightTooltip(); else if (
else if (this.dragAnchor.hour > cell.hour && this.isCellRightTooltipHidden()) this.dragAnchor.hour > cell.hour &&
this.isCellRightTooltipHidden()
)
rightTooltipCell = this.dragAnchor; rightTooltipCell = this.dragAnchor;
else // cell.hour > this.dragAnchor.hour // cell.hour > this.dragAnchor.hour
rightTooltipCell = cell; else rightTooltipCell = cell;
} }
if (rightTooltipCell) { if (rightTooltipCell) {
@ -265,12 +278,14 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
if (hour >= 12) { if (hour >= 12) {
pm = true; pm = true;
if (hour > 12) hour -= 12; if (hour > 12) hour -= 12;
} } else if (hour == 0) {
else if (hour == 0) {
// change 0 hour to 12am // change 0 hour to 12am
hour = 12; hour = 12;
} }
this.showCellRightTooltip(hour + ' ' + (pm ? 'pm' : 'am'), rightTooltipCell); this.showCellRightTooltip(
hour + ' ' + (pm ? 'pm' : 'am'),
rightTooltipCell
);
} }
// preview colour change and // preview colour change and
@ -278,39 +293,38 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
if (this.dragAnchor) { if (this.dragAnchor) {
if (cell.day != this.dragAnchor.day) { if (cell.day != this.dragAnchor.day) {
// dragged into another day. Abort! Abort! // dragged into another day. Abort! Abort!
Ext.each(this.daysOfWeek, function(day) { Ext.each(
this.daysOfWeek,
function(day) {
this.revertCells(day, 0, 23); this.revertCells(day, 0, 23);
}, this); },
this
);
this.dragAnchor = null; this.dragAnchor = null;
this.hideCellLeftTooltip(); this.hideCellLeftTooltip();
this.hideCellRightTooltip(); this.hideCellRightTooltip();
} } else if (cell.hour > this.dragAnchor.hour) {
else if (cell.hour > this.dragAnchor.hour) {
// dragging right // dragging right
this.revertCells(cell.day, cell.hour + 1, 23); this.revertCells(cell.day, cell.hour + 1, 23);
this.previewCells(cell.day, this.dragAnchor.hour, cell.hour); this.previewCells(cell.day, this.dragAnchor.hour, cell.hour);
} } else if (cell.hour < this.dragAnchor.hour) {
else if (cell.hour < this.dragAnchor.hour) {
// dragging left // dragging left
this.revertCells(cell.day, 0, cell.hour - 1); this.revertCells(cell.day, 0, cell.hour - 1);
this.previewCells(cell.day, cell.hour, this.dragAnchor.hour); this.previewCells(cell.day, cell.hour, this.dragAnchor.hour);
} } else {
else {
// back to anchor cell // back to anchor cell
// don't know if it is from right or left, so revert all except this // don't know if it is from right or left, so revert all except this
this.revertCells(cell.day, cell.hour + 1, 23); this.revertCells(cell.day, cell.hour + 1, 23);
this.revertCells(cell.day, 0, cell.hour - 1); this.revertCells(cell.day, 0, cell.hour - 1);
} }
} } else {
else {
// not dragging, just preview this cell // not dragging, just preview this cell
this.previewCells(cell.day, cell.hour, cell.hour); this.previewCells(cell.day, cell.hour, cell.hour);
} }
}, },
onCellMouseOut: function(event, cell) { onCellMouseOut: function(event, cell) {
if (!this.dragAnchor) if (!this.dragAnchor) this.hideCellLeftTooltip();
this.hideCellLeftTooltip();
// revert state. If new state has been set, old and new will be equal. // revert state. If new state has been set, old and new will be equal.
// if dragging, this will be handled by the next mouse over // if dragging, this will be handled by the next mouse over
@ -395,8 +409,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
isCellLeftTooltipHidden: function() { isCellLeftTooltipHidden: function() {
if (this.cellLeftTooltip) if (this.cellLeftTooltip)
return this.cellLeftTooltip.style.visibility == 'hidden'; return this.cellLeftTooltip.style.visibility == 'hidden';
else else return true;
return true;
}, },
showCellRightTooltip: function(text, cell) { showCellRightTooltip: function(text, cell) {
@ -437,8 +450,7 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
isCellRightTooltipHidden: function() { isCellRightTooltipHidden: function() {
if (this.cellRightTooltip) if (this.cellRightTooltip)
return this.cellRightTooltip.style.visibility == 'hidden'; return this.cellRightTooltip.style.visibility == 'hidden';
else else return true;
return true;
}, },
getConfig: function() { getConfig: function() {
@ -448,7 +460,9 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
var hourConfig = [0, 0, 0, 0, 0, 0, 0]; var hourConfig = [0, 0, 0, 0, 0, 0, 0];
for (var j = 0; j < this.daysOfWeek.length; j++) { for (var j = 0; j < this.daysOfWeek.length; j++) {
hourConfig[j] = parseInt(this.scheduleCells[this.daysOfWeek[j]][i].currentValue); hourConfig[j] = parseInt(
this.scheduleCells[this.daysOfWeek[j]][i].currentValue
);
} }
config.push(hourConfig); config.push(hourConfig);
@ -471,13 +485,12 @@ Deluge.ux.ScheduleSelector = Ext.extend(Ext.form.FieldSet, {
this.updateCell(cell); this.updateCell(cell);
} }
} }
} },
}); });
Ext.ns('Deluge.ux.preferences'); Ext.ns('Deluge.ux.preferences');
Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, { Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, {
border: false, border: false,
title: _('Scheduler'), title: _('Scheduler'),
header: false, header: false,
@ -490,7 +503,7 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, {
xtype: 'form', xtype: 'form',
layout: 'form', layout: 'form',
border: false, border: false,
autoHeight: true autoHeight: true,
}); });
this.schedule = this.form.add(new Deluge.ux.ScheduleSelector()); this.schedule = this.form.add(new Deluge.ux.ScheduleSelector());
@ -503,10 +516,10 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, {
defaultType: 'spinnerfield', defaultType: 'spinnerfield',
defaults: { defaults: {
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
}, },
style: 'margin-top: 5px; margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-top: 5px; margin-bottom: 0px; padding-bottom: 0px;',
labelWidth: 200 labelWidth: 200,
}); });
this.downloadLimit = this.slowSettings.add({ this.downloadLimit = this.slowSettings.add({
@ -514,42 +527,46 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, {
name: 'download_limit', name: 'download_limit',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
}); });
this.uploadLimit = this.slowSettings.add({ this.uploadLimit = this.slowSettings.add({
fieldLabel: _('Maximum Upload Speed (KiB/s)'), fieldLabel: _('Maximum Upload Speed (KiB/s)'),
name: 'upload_limit', name: 'upload_limit',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
}); });
this.activeTorrents = this.slowSettings.add({ this.activeTorrents = this.slowSettings.add({
fieldLabel: _('Active Torrents'), fieldLabel: _('Active Torrents'),
name: 'active_torrents', name: 'active_torrents',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
}); });
this.activeDownloading = this.slowSettings.add({ this.activeDownloading = this.slowSettings.add({
fieldLabel: _('Active Downloading'), fieldLabel: _('Active Downloading'),
name: 'active_downloading', name: 'active_downloading',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
}); });
this.activeSeeding = this.slowSettings.add({ this.activeSeeding = this.slowSettings.add({
fieldLabel: _('Active Seeding'), fieldLabel: _('Active Seeding'),
name: 'active_seeding', name: 'active_seeding',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
}); });
this.on('show', this.updateConfig, this); this.on('show', this.updateConfig, this);
}, },
onRender: function(ct, position) { onRender: function(ct, position) {
Deluge.ux.preferences.SchedulerPage.superclass.onRender.call(this, ct, position); Deluge.ux.preferences.SchedulerPage.superclass.onRender.call(
this,
ct,
position
);
this.form.layout = new Ext.layout.FormLayout(); this.form.layout = new Ext.layout.FormLayout();
this.form.layout.setContainer(this); this.form.layout.setContainer(this);
this.form.doLayout(); this.form.doLayout();
@ -583,13 +600,12 @@ Deluge.ux.preferences.SchedulerPage = Ext.extend(Ext.Panel, {
this.activeDownloading.setValue(config['low_active_down']); this.activeDownloading.setValue(config['low_active_down']);
this.activeSeeding.setValue(config['low_active_up']); this.activeSeeding.setValue(config['low_active_up']);
}, },
scope: this scope: this,
}); });
} },
}); });
Deluge.plugins.SchedulerPlugin = Ext.extend(Deluge.Plugin, { Deluge.plugins.SchedulerPlugin = Ext.extend(Deluge.Plugin, {
name: 'Scheduler', name: 'Scheduler',
onDisable: function() { onDisable: function() {
@ -597,7 +613,9 @@ Deluge.plugins.SchedulerPlugin = Ext.extend(Deluge.Plugin, {
}, },
onEnable: function() { onEnable: function() {
this.prefsPage = deluge.preferences.addPage(new Deluge.ux.preferences.SchedulerPage()); this.prefsPage = deluge.preferences.addPage(
} new Deluge.ux.preferences.SchedulerPage()
);
},
}); });
Deluge.registerPlugin('Scheduler', Deluge.plugins.SchedulerPlugin); Deluge.registerPlugin('Scheduler', Deluge.plugins.SchedulerPlugin);

View File

@ -11,16 +11,17 @@
StatsPlugin = Ext.extend(Deluge.Plugin, { StatsPlugin = Ext.extend(Deluge.Plugin, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
name: "Stats" {
}, config); name: 'Stats',
},
config
);
StatsPlugin.superclass.constructor.call(this, config); StatsPlugin.superclass.constructor.call(this, config);
}, },
onDisable: function() { onDisable: function() {},
},
onEnable: function() { onEnable: function() {},
}
}); });
new StatsPlugin(); new StatsPlugin();

View File

@ -11,18 +11,17 @@
TogglePlugin = Ext.extend(Deluge.Plugin, { TogglePlugin = Ext.extend(Deluge.Plugin, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
name: "Toggle" {
}, config); name: 'Toggle',
},
config
);
TogglePlugin.superclass.constructor.call(this, config); TogglePlugin.superclass.constructor.call(this, config);
}, },
onDisable: function() { onDisable: function() {},
}, onEnable: function() {},
onEnable: function() {
}
}); });
new TogglePlugin(); new TogglePlugin();

View File

@ -1,4 +1,5 @@
html, body { html,
body {
font: normal 11px arial, tahoma, helvetica, sans-serif; font: normal 11px arial, tahoma, helvetica, sans-serif;
margin: 0; margin: 0;
padding: 0; padding: 0;
@ -29,13 +30,15 @@ button::-moz-focus-inner {
opacity: 1 !important; opacity: 1 !important;
} }
.deluge-torrents td,
.deluge-torrents td, .x-deluge-peers td { .x-deluge-peers td {
height: 16px; height: 16px;
line-height: 16px; line-height: 16px;
} }
.deluge-torrents .torrent-name, .x-deluge-peer, .x-deluge-seed { .deluge-torrents .torrent-name,
.x-deluge-peer,
.x-deluge-seed {
padding-left: 20px; padding-left: 20px;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
@ -45,40 +48,95 @@ button::-moz-focus-inner {
} }
/* Icon classes */ /* Icon classes */
.x-deluge-all { background-image: url('../icons/all.png'); } .x-deluge-all {
.x-deluge-active { background-image: url('../icons/active.png'); } background-image: url('../icons/all.png');
.x-deluge-downloading, .x-btn .x-deluge-downloading, .x-deluge-peer { background-image: url('../icons/downloading.png'); } }
.x-deluge-seeding, .x-btn .x-deluge-seeding, .deluge-torrents .seeding, .x-deluge-seed { background-image: url('../icons/seeding.png'); } .x-deluge-active {
.x-deluge-queued, .x-btn .x-deluge-queued, .deluge-torrents .queued { background-image: url('../icons/queued.png'); } background-image: url('../icons/active.png');
.x-deluge-paused, .x-btn .x-deluge-paused, .deluge-torrents .paused { background-image: url('../icons/inactive.png'); } }
.x-deluge-error, .deluge-torrents .error { background-image: url('../icons/alert.png'); } .x-deluge-downloading,
.x-deluge-checking, .deluge-torrents .checking { background-image: url('../icons/checking.png'); } .x-btn .x-deluge-downloading,
.x-deluge-dht, .x-btn .x-deluge-dht { background-image: url('../icons/dht.png'); } .x-deluge-peer {
.x-deluge-preferences, .x-btn .x-deluge-preferences { background-image: url('../icons/preferences.png') } background-image: url('../icons/downloading.png');
.x-deluge-connections, .x-btn .x-deluge-connections { background-image: url('../icons/connections.png') } }
.x-deluge-connection-manager, .x-btn .x-deluge-connection-manager { background-image: url('../icons/connection_manager.png') } .x-deluge-seeding,
.x-deluge-traffic, .x-btn .x-deluge-traffic { background-image: url('../icons/traffic.png') } .x-btn .x-deluge-seeding,
.x-deluge-edit-trackers, .x-btn .x-deluge-edit-trackers {background-image: url('../icons/edit_trackers.png'); } .deluge-torrents .seeding,
.x-deluge-freespace, .x-btn .x-deluge-freespace {background-image: url('../icons/drive.png'); } .x-deluge-seed {
background-image: url('../icons/seeding.png');
.x-deluge-install-plugin, .x-btn .x-deluge-install-plugin {background-image: url('../icons/install_plugin.png'); } }
.x-deluge-find-more, .x-btn .x-deluge-find-more {background-image: url('../icons/find_more.png'); } .x-deluge-queued,
.x-btn .x-deluge-queued,
.deluge-torrents .queued {
background-image: url('../icons/queued.png');
}
.x-deluge-paused,
.x-btn .x-deluge-paused,
.deluge-torrents .paused {
background-image: url('../icons/inactive.png');
}
.x-deluge-error,
.deluge-torrents .error {
background-image: url('../icons/alert.png');
}
.x-deluge-checking,
.deluge-torrents .checking {
background-image: url('../icons/checking.png');
}
.x-deluge-dht,
.x-btn .x-deluge-dht {
background-image: url('../icons/dht.png');
}
.x-deluge-preferences,
.x-btn .x-deluge-preferences {
background-image: url('../icons/preferences.png');
}
.x-deluge-connections,
.x-btn .x-deluge-connections {
background-image: url('../icons/connections.png');
}
.x-deluge-connection-manager,
.x-btn .x-deluge-connection-manager {
background-image: url('../icons/connection_manager.png');
}
.x-deluge-traffic,
.x-btn .x-deluge-traffic {
background-image: url('../icons/traffic.png');
}
.x-deluge-edit-trackers,
.x-btn .x-deluge-edit-trackers {
background-image: url('../icons/edit_trackers.png');
}
.x-deluge-freespace,
.x-btn .x-deluge-freespace {
background-image: url('../icons/drive.png');
}
.x-deluge-install-plugin,
.x-btn .x-deluge-install-plugin {
background-image: url('../icons/install_plugin.png');
}
.x-deluge-find-more,
.x-btn .x-deluge-find-more {
background-image: url('../icons/find_more.png');
}
/* Torrent Details */ /* Torrent Details */
#torrentDetails dl, #torrentDetails dl.singleline { #torrentDetails dl,
#torrentDetails dl.singleline {
float: left; float: left;
min-height: 120px; min-height: 120px;
} }
#torrentDetails dl dt, dl.singleline dt { #torrentDetails dl dt,
dl.singleline dt {
float: left; float: left;
font-weight: bold; font-weight: bold;
height: 19px; height: 19px;
} }
#torrentDetails dl dd, dl.singleline dd { #torrentDetails dl dd,
dl.singleline dd {
margin-left: 100px; margin-left: 100px;
width: 140px; width: 140px;
height: 19px; height: 19px;
@ -185,7 +243,8 @@ dl.singleline dd {
} }
/* Add Url Window */ /* Add Url Window */
.x-deluge-add-file, .x-btn .x-deluge-add-file { .x-deluge-add-file,
.x-btn .x-deluge-add-file {
background: url('../icons/add_file.png') no-repeat 2px; background: url('../icons/add_file.png') no-repeat 2px;
} }
@ -348,7 +407,11 @@ dl.singleline dd {
} }
/* Filepriority styles */ /* Filepriority styles */
.x-no-download, .x-low-download, .x-normal-download, .x-high-download, .x-mixed-download { .x-no-download,
.x-low-download,
.x-normal-download,
.x-high-download,
.x-mixed-download {
padding-left: 20px; padding-left: 20px;
background-repeat: no-repeat; background-repeat: no-repeat;
line-height: 16px; line-height: 16px;
@ -431,7 +494,8 @@ dl.singleline dd {
background-image: url('../icons/update.png') !important; background-image: url('../icons/update.png') !important;
} }
.icon-edit-trackers, .icon-edit { .icon-edit-trackers,
.icon-edit {
background-image: url('../icons/edit_trackers.png') !important; background-image: url('../icons/edit_trackers.png') !important;
} }

View File

@ -14,7 +14,6 @@ Ext.ns('Deluge');
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.AddConnectionWindow = Ext.extend(Ext.Window, { Deluge.AddConnectionWindow = Ext.extend(Ext.Window, {
title: _('Add Connection'), title: _('Add Connection'),
iconCls: 'x-deluge-add-window-icon', iconCls: 'x-deluge-add-window-icon',
@ -40,13 +39,15 @@ Deluge.AddConnectionWindow = Ext.extend(Ext.Window, {
defaultType: 'textfield', defaultType: 'textfield',
baseCls: 'x-plain', baseCls: 'x-plain',
labelWidth: 60, labelWidth: 60,
items: [{ items: [
{
fieldLabel: _('Host:'), fieldLabel: _('Host:'),
labelSeparator: '', labelSeparator: '',
name: 'host', name: 'host',
anchor: '75%', anchor: '75%',
value: '' value: '',
}, { },
{
xtype: 'spinnerfield', xtype: 'spinnerfield',
fieldLabel: _('Port:'), fieldLabel: _('Port:'),
labelSeparator: '', labelSeparator: '',
@ -55,50 +56,62 @@ Deluge.AddConnectionWindow = Ext.extend(Ext.Window, {
xtype: 'number', xtype: 'number',
decimalPrecision: 0, decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 65535 maxValue: 65535,
}, },
value: '58846', value: '58846',
anchor: '40%' anchor: '40%',
}, { },
{
fieldLabel: _('Username:'), fieldLabel: _('Username:'),
labelSeparator: '', labelSeparator: '',
name: 'username', name: 'username',
anchor: '75%', anchor: '75%',
value: '' value: '',
}, { },
{
fieldLabel: _('Password:'), fieldLabel: _('Password:'),
labelSeparator: '', labelSeparator: '',
anchor: '75%', anchor: '75%',
name: 'password', name: 'password',
inputType: 'password', inputType: 'password',
value: '' value: '',
}] },
],
}); });
}, },
onAddClick: function() { onAddClick: function() {
var values = this.form.getForm().getValues(); var values = this.form.getForm().getValues();
deluge.client.web.add_host(values.host, Number(values.port), values.username, values.password, { deluge.client.web.add_host(
values.host,
Number(values.port),
values.username,
values.password,
{
success: function(result) { success: function(result) {
if (!result[0]) { if (!result[0]) {
Ext.MessageBox.show({ Ext.MessageBox.show({
title: _('Error'), title: _('Error'),
msg: String.format(_('Unable to add host: {0}'), result[1]), msg: String.format(
_('Unable to add host: {0}'),
result[1]
),
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
modal: false, modal: false,
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
iconCls: 'x-deluge-icon-error' iconCls: 'x-deluge-icon-error',
}); });
} else { } else {
this.fireEvent('hostadded'); this.fireEvent('hostadded');
} }
this.hide(); this.hide();
}, },
scope: this scope: this,
}); }
);
}, },
onHide: function() { onHide: function() {
this.form.getForm().reset(); this.form.getForm().reset();
} },
}); });

View File

@ -15,7 +15,7 @@ Ext.apply(Ext.form.VTypes, {
trackerUrl: function(val, field) { trackerUrl: function(val, field) {
return trackerUrlTest.test(val); return trackerUrlTest.test(val);
}, },
trackerUrlText: 'Not a valid tracker url' trackerUrlText: 'Not a valid tracker url',
}); });
/** /**
@ -23,7 +23,6 @@ Ext.apply(Ext.form.VTypes, {
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.AddTrackerWindow = Ext.extend(Ext.Window, { Deluge.AddTrackerWindow = Ext.extend(Ext.Window, {
title: _('Add Tracker'), title: _('Add Tracker'),
layout: 'fit', layout: 'fit',
width: 375, width: 375,
@ -49,32 +48,47 @@ Deluge.AddTrackerWindow = Ext.extend(Ext.Window, {
defaultType: 'textarea', defaultType: 'textarea',
baseCls: 'x-plain', baseCls: 'x-plain',
labelWidth: 55, labelWidth: 55,
items: [{ items: [
{
fieldLabel: _('Trackers:'), fieldLabel: _('Trackers:'),
labelSeparator: '', labelSeparator: '',
name: 'trackers', name: 'trackers',
anchor: '100%' anchor: '100%',
}] },
}) ],
});
}, },
onAddClick: function() { onAddClick: function() {
var trackers = this.form.getForm().findField('trackers').getValue(); var trackers = this.form
.getForm()
.findField('trackers')
.getValue();
trackers = trackers.split('\n'); trackers = trackers.split('\n');
var cleaned = []; var cleaned = [];
Ext.each(trackers, function(tracker) { Ext.each(
trackers,
function(tracker) {
if (Ext.form.VTypes.trackerUrl(tracker)) { if (Ext.form.VTypes.trackerUrl(tracker)) {
cleaned.push(tracker); cleaned.push(tracker);
} }
}, this); },
this
);
this.fireEvent('add', cleaned); this.fireEvent('add', cleaned);
this.hide(); this.hide();
this.form.getForm().findField('trackers').setValue(''); this.form
.getForm()
.findField('trackers')
.setValue('');
}, },
onCancelClick: function() { onCancelClick: function() {
this.form.getForm().findField('trackers').setValue(''); this.form
.getForm()
.findField('trackers')
.setValue('');
this.hide(); this.hide();
} },
}); });

View File

@ -16,7 +16,6 @@ Ext.namespace('Ext.ux.util');
* @namespace Ext.ux.util * @namespace Ext.ux.util
*/ */
Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, { Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, {
_components: [], _components: [],
_methods: [], _methods: [],
@ -33,7 +32,6 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, {
* @param {Ext.ux.util.RpcClient} this * @param {Ext.ux.util.RpcClient} this
*/ */
constructor: function(config) { constructor: function(config) {
Ext.ux.util.RpcClient.superclass.constructor.call(this, config); Ext.ux.util.RpcClient.superclass.constructor.call(this, config);
this._url = config.url || null; this._url = config.url || null;
this._id = 0; this._id = 0;
@ -49,7 +47,7 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, {
reloadMethods: function() { reloadMethods: function() {
this._execute('system.listMethods', { this._execute('system.listMethods', {
success: this._setMethods, success: this._setMethods,
scope: this scope: this,
}); });
}, },
@ -61,7 +59,7 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, {
var request = Ext.encode({ var request = Ext.encode({
method: method, method: method,
params: options.params, params: options.params,
id: options.id id: options.id,
}); });
this._id++; this._id++;
@ -72,7 +70,7 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, {
failure: this._onFailure, failure: this._onFailure,
scope: this, scope: this,
jsonData: request, jsonData: request,
options: options options: options,
}); });
}, },
@ -83,15 +81,20 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, {
result: null, result: null,
error: { error: {
msg: 'HTTP: ' + response.status + ' ' + response.statusText, msg: 'HTTP: ' + response.status + ' ' + response.statusText,
code: 255 code: 255,
} },
} };
this.fireEvent('error', errorObj, response, requestOptions) this.fireEvent('error', errorObj, response, requestOptions);
if (Ext.type(options.failure) != 'function') return; if (Ext.type(options.failure) != 'function') return;
if (options.scope) { if (options.scope) {
options.failure.call(options.scope, errorObj, response, requestOptions); options.failure.call(
options.scope,
errorObj,
response,
requestOptions
);
} else { } else {
options.failure(errorObj, response, requestOptions); options.failure(errorObj, response, requestOptions);
} }
@ -105,16 +108,32 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, {
if (Ext.type(options.failure) != 'function') return; if (Ext.type(options.failure) != 'function') return;
if (options.scope) { if (options.scope) {
options.failure.call(options.scope, responseObj, response, requestOptions); options.failure.call(
options.scope,
responseObj,
response,
requestOptions
);
} else { } else {
options.failure(responseObj, response, requestOptions); options.failure(responseObj, response, requestOptions);
} }
} else { } else {
if (Ext.type(options.success) != 'function') return; if (Ext.type(options.success) != 'function') return;
if (options.scope) { if (options.scope) {
options.success.call(options.scope, responseObj.result, responseObj, response, requestOptions); options.success.call(
options.scope,
responseObj.result,
responseObj,
response,
requestOptions
);
} else { } else {
options.success(responseObj.result, responseObj, response, requestOptions); options.success(
responseObj.result,
responseObj,
response,
requestOptions
);
} }
} }
}, },
@ -127,26 +146,28 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, {
var options = params[params.length - 1]; var options = params[params.length - 1];
if (Ext.type(options) == 'object') { if (Ext.type(options) == 'object') {
var keys = Ext.keys(options), isOption = false; var keys = Ext.keys(options),
isOption = false;
Ext.each(this._optionKeys, function(key) { Ext.each(this._optionKeys, function(key) {
if (keys.indexOf(key) > -1) isOption = true; if (keys.indexOf(key) > -1) isOption = true;
}); });
if (isOption) { if (isOption) {
params.remove(options) params.remove(options);
} else { } else {
options = {} options = {};
} }
} else { } else {
options = {} options = {};
} }
options.params = params; options.params = params;
return options; return options;
}, },
_setMethods: function(methods) { _setMethods: function(methods) {
var components = {}, self = this; var components = {},
self = this;
Ext.each(methods, function(method) { Ext.each(methods, function(method) {
var parts = method.split('.'); var parts = method.split('.');
@ -155,7 +176,7 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, {
var fn = function() { var fn = function() {
var options = self._parseArgs(arguments); var options = self._parseArgs(arguments);
return self._execute(method, options); return self._execute(method, options);
} };
component[parts[1]] = fn; component[parts[1]] = fn;
components[parts[0]] = component; components[parts[0]] = component;
}); });
@ -163,12 +184,16 @@ Ext.ux.util.RpcClient = Ext.extend(Ext.util.Observable, {
for (var name in components) { for (var name in components) {
self[name] = components[name]; self[name] = components[name];
} }
Ext.each(this._components, function(component) { Ext.each(
this._components,
function(component) {
if (!component in components) { if (!component in components) {
delete this[component]; delete this[component];
} }
}, this); },
this
);
this._components = Ext.keys(components); this._components = Ext.keys(components);
this.fireEvent('connected', this); this.fireEvent('connected', this);
} },
}); });

View File

@ -9,7 +9,6 @@
*/ */
Deluge.ConnectionManager = Ext.extend(Ext.Window, { Deluge.ConnectionManager = Ext.extend(Ext.Window, {
layout: 'fit', layout: 'fit',
width: 300, width: 300,
height: 220, height: 220,
@ -40,13 +39,14 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
{ name: 'host', mapping: 1 }, { name: 'host', mapping: 1 },
{ name: 'port', mapping: 2 }, { name: 'port', mapping: 2 },
{ name: 'user', mapping: 3 }, { name: 'user', mapping: 3 },
{name: 'version', mapping: 5} { name: 'version', mapping: 5 },
], ],
id: 0 id: 0,
}), }),
columns: [{ columns: [
{
header: _('Status'), header: _('Status'),
width: .24, width: 0.24,
sortable: true, sortable: true,
tpl: new Ext.XTemplate( tpl: new Ext.XTemplate(
'<tpl if="status == \'Online\'">', '<tpl if="status == \'Online\'">',
@ -57,26 +57,30 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
'</tpl>', '</tpl>',
'<tpl if="status == \'Connected\'">', '<tpl if="status == \'Connected\'">',
_('Connected'), _('Connected'),
'</tpl>'), '</tpl>'
dataIndex: 'status' ),
}, { dataIndex: 'status',
},
{
id: 'host', id: 'host',
header: _('Host'), header: _('Host'),
width: .51, width: 0.51,
sortable: true, sortable: true,
tpl: '{user}@{host}:{port}', tpl: '{user}@{host}:{port}',
dataIndex: 'host' dataIndex: 'host',
}, { },
{
header: _('Version'), header: _('Version'),
width: .25, width: 0.25,
sortable: true, sortable: true,
tpl: '<tpl if="version">{version}</tpl>', tpl: '<tpl if="version">{version}</tpl>',
dataIndex: 'version' dataIndex: 'version',
}], },
],
singleSelect: true, singleSelect: true,
listeners: { listeners: {
'selectionchange': {fn: this.onSelectionChanged, scope: this} selectionchange: { fn: this.onSelectionChanged, scope: this },
} },
}); });
this.panel = this.add({ this.panel = this.add({
@ -90,33 +94,37 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
text: _('Add'), text: _('Add'),
iconCls: 'icon-add', iconCls: 'icon-add',
handler: this.onAddClick, handler: this.onAddClick,
scope: this scope: this,
}, { },
{
id: 'cm-edit', id: 'cm-edit',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
text: _('Edit'), text: _('Edit'),
iconCls: 'icon-edit', iconCls: 'icon-edit',
handler: this.onEditClick, handler: this.onEditClick,
scope: this scope: this,
}, { },
{
id: 'cm-remove', id: 'cm-remove',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
text: _('Remove'), text: _('Remove'),
iconCls: 'icon-remove', iconCls: 'icon-remove',
handler: this.onRemoveClick, handler: this.onRemoveClick,
disabled: true, disabled: true,
scope: this scope: this,
}, '->', { },
'->',
{
id: 'cm-stop', id: 'cm-stop',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
text: _('Stop Daemon'), text: _('Stop Daemon'),
iconCls: 'icon-error', iconCls: 'icon-error',
handler: this.onStopClick, handler: this.onStopClick,
disabled: true, disabled: true,
scope: this scope: this,
} },
] ],
}) }),
}); });
this.update = this.update.createDelegate(this); this.update = this.update.createDelegate(this);
}, },
@ -134,7 +142,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
this.show(); this.show();
} }
}, },
scope: this scope: this,
}); });
}, },
@ -149,7 +157,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
loadHosts: function() { loadHosts: function() {
deluge.client.web.get_hosts({ deluge.client.web.get_hosts({
success: this.onGetHosts, success: this.onGetHosts,
scope: this scope: this,
}); });
}, },
@ -157,7 +165,7 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
this.list.getStore().each(function(r) { this.list.getStore().each(function(r) {
deluge.client.web.get_host_status(r.id, { deluge.client.web.get_host_status(r.id, {
success: this.onGetHostStatus, success: this.onGetHostStatus,
scope: this scope: this,
}); });
}, this); }, this);
}, },
@ -168,7 +176,8 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
* @param {Ext.data.Record} record The hosts record to update the UI for * @param {Ext.data.Record} record The hosts record to update the UI for
*/ */
updateButtons: function(record) { updateButtons: function(record) {
var button = this.buttons[1], status = record.get('status'); var button = this.buttons[1],
status = record.get('status');
// Update the Connect/Disconnect button // Update the Connect/Disconnect button
button.enable(); button.enable();
@ -180,11 +189,17 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
} }
// Update the Stop/Start Daemon button // Update the Stop/Start Daemon button
if (status.toLowerCase() == 'connected' || status.toLowerCase() == 'online') { if (
status.toLowerCase() == 'connected' ||
status.toLowerCase() == 'online'
) {
this.stopHostButton.enable(); this.stopHostButton.enable();
this.stopHostButton.setText(_('Stop Daemon')); this.stopHostButton.setText(_('Stop Daemon'));
} else { } else {
if (record.get('host') == '127.0.0.1' || record.get('host') == 'localhost') { if (
record.get('host') == '127.0.0.1' ||
record.get('host') == 'localhost'
) {
this.stopHostButton.enable(); this.stopHostButton.enable();
this.stopHostButton.setText(_('Start Daemon')); this.stopHostButton.setText(_('Start Daemon'));
} else { } else {
@ -236,26 +251,38 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
this.update(this); this.update(this);
deluge.events.fire('disconnect'); deluge.events.fire('disconnect');
}, },
scope: me scope: me,
}); });
}; };
if (selected.get('status').toLowerCase() == 'connected') { if (selected.get('status').toLowerCase() == 'connected') {
disconnect(); disconnect();
} else { } else {
if (this.list.getStore().find('status', 'Connected', 0, false, false) > -1) { if (
this.list
.getStore()
.find('status', 'Connected', 0, false, false) > -1
) {
disconnect(); disconnect();
} }
var id = selected.id; var id = selected.id;
deluge.client.web.connect(id, { deluge.client.web.connect(
id,
{
success: function(methods) { success: function(methods) {
deluge.client.reloadMethods(); deluge.client.reloadMethods();
deluge.client.on('connected', function(e) { deluge.client.on(
'connected',
function(e) {
deluge.events.fire('connect'); deluge.events.fire('connect');
}, this, {single: true}); },
this,
{ single: true }
);
},
} }
}); );
this.hide(); this.hide();
} }
}, },
@ -263,21 +290,25 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
// private // private
onGetHosts: function(hosts) { onGetHosts: function(hosts) {
this.list.getStore().loadData(hosts); this.list.getStore().loadData(hosts);
Ext.each(hosts, function(host) { Ext.each(
hosts,
function(host) {
deluge.client.web.get_host_status(host[0], { deluge.client.web.get_host_status(host[0], {
success: this.onGetHostStatus, success: this.onGetHostStatus,
scope: this scope: this,
}); });
}, this); },
this
);
}, },
// private // private
onGetHostStatus: function(host) { onGetHostStatus: function(host) {
var record = this.list.getStore().getById(host[0]); var record = this.list.getStore().getById(host[0]);
record.set('status', host[1]) record.set('status', host[1]);
record.set('version', host[2]) record.set('version', host[2]);
record.commit(); record.commit();
var selected = this.list.getSelectedRecords()[0] var selected = this.list.getSelectedRecords()[0];
if (!selected) return; if (!selected) return;
if (selected == record) this.updateButtons(record); if (selected == record) this.updateButtons(record);
}, },
@ -290,8 +321,11 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
// private // private
onLogin: function() { onLogin: function() {
if (deluge.config.first_login) { if (deluge.config.first_login) {
Ext.MessageBox.confirm(_('Change Default Password'), Ext.MessageBox.confirm(
_('We recommend changing the default password.<br><br>Would you like to change it now?'), _('Change Default Password'),
_(
'We recommend changing the default password.<br><br>Would you like to change it now?'
),
function(res) { function(res) {
this.checkConnected(); this.checkConnected();
if (res == 'yes') { if (res == 'yes') {
@ -299,7 +333,9 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
deluge.preferences.selectPage('Interface'); deluge.preferences.selectPage('Interface');
} }
deluge.client.web.set_config({ first_login: false }); deluge.client.web.set_config({ first_login: false });
}, this); },
this
);
} else { } else {
this.checkConnected(); this.checkConnected();
} }
@ -327,13 +363,13 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
modal: false, modal: false,
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
iconCls: 'x-deluge-icon-error' iconCls: 'x-deluge-icon-error',
}); });
} else { } else {
this.list.getStore().remove(connection); this.list.getStore().remove(connection);
} }
}, },
scope: this scope: this,
}); });
}, },
@ -386,11 +422,11 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, {
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
modal: false, modal: false,
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
iconCls: 'x-deluge-icon-error' iconCls: 'x-deluge-icon-error',
}); });
} }
} },
}); });
} }
} },
}); });

View File

@ -9,25 +9,33 @@
*/ */
// Setup the state manager // Setup the state manager
Ext.state.Manager.setProvider(new Ext.state.CookieProvider({ Ext.state.Manager.setProvider(
new Ext.state.CookieProvider({
/** /**
* By default, cookies will expire after 7 days. Provide * By default, cookies will expire after 7 days. Provide
* an expiry date 10 years in the future to approximate * an expiry date 10 years in the future to approximate
* a cookie that does not expire. * a cookie that does not expire.
*/ */
expires: new Date(new Date().getTime() + (1000 * 60 * 60 * 24 * 365 * 10)) expires: new Date(
})); new Date().getTime() + 1000 * 60 * 60 * 24 * 365 * 10
),
})
);
// Add some additional functions to ext and setup some of the // Add some additional functions to ext and setup some of the
// configurable parameters // configurable parameters
Ext.apply(Ext, { Ext.apply(Ext, {
escapeHTML: function(text) { escapeHTML: function(text) {
text = String(text).replace('<', '&lt;').replace('>', '&gt;'); text = String(text)
.replace('<', '&lt;')
.replace('>', '&gt;');
return text.replace('&', '&amp;'); return text.replace('&', '&amp;');
}, },
isObjectEmpty: function(obj) { isObjectEmpty: function(obj) {
for(var i in obj) { return false; } for (var i in obj) {
return false;
}
return true; return true;
}, },
@ -44,8 +52,8 @@ Ext.apply(Ext, {
keys: function(obj) { keys: function(obj) {
var keys = []; var keys = [];
for (var i in obj) if (obj.hasOwnProperty(i)) for (var i in obj)
{ if (obj.hasOwnProperty(i)) {
keys.push(i); keys.push(i);
} }
return keys; return keys;
@ -63,8 +71,8 @@ Ext.apply(Ext, {
splat: function(obj) { splat: function(obj) {
var type = Ext.type(obj); var type = Ext.type(obj);
return (type) ? ((type != 'array') ? [obj] : obj) : []; return type ? (type != 'array' ? [obj] : obj) : [];
} },
}); });
Ext.getKeys = Ext.keys; Ext.getKeys = Ext.keys;
Ext.BLANK_IMAGE_URL = deluge.config.base + 'images/s.gif'; Ext.BLANK_IMAGE_URL = deluge.config.base + 'images/s.gif';
@ -72,12 +80,12 @@ Ext.USE_NATIVE_JSON = true;
// Create the Deluge namespace // Create the Deluge namespace
Ext.apply(Deluge, { Ext.apply(Deluge, {
// private // private
pluginStore: {}, pluginStore: {},
// private // private
progressTpl: '<div class="x-progress-wrap x-progress-renderered">' + progressTpl:
'<div class="x-progress-wrap x-progress-renderered">' +
'<div class="x-progress-inner">' + '<div class="x-progress-inner">' +
'<div style="width: {2}px" class="x-progress-bar">' + '<div style="width: {2}px" class="x-progress-bar">' +
'<div style="z-index: 99; width: {3}px" class="x-progress-text">' + '<div style="z-index: 99; width: {3}px" class="x-progress-text">' +
@ -90,7 +98,6 @@ Ext.apply(Deluge, {
'</div>' + '</div>' +
'</div>', '</div>',
/** /**
* A method to create a progress bar that can be used by renderers * A method to create a progress bar that can be used by renderers
* to display a bar within a grid or tree. * to display a bar within a grid or tree.
@ -103,8 +110,15 @@ Ext.apply(Deluge, {
modifier = Ext.value(modifier, 10); modifier = Ext.value(modifier, 10);
var progressWidth = ((width / 100.0) * progress).toFixed(0); var progressWidth = ((width / 100.0) * progress).toFixed(0);
var barWidth = progressWidth - 1; var barWidth = progressWidth - 1;
var textWidth = ((progressWidth - modifier) > 0 ? progressWidth - modifier : 0); var textWidth =
return String.format(Deluge.progressTpl, text, width, barWidth, textWidth); progressWidth - modifier > 0 ? progressWidth - modifier : 0;
return String.format(
Deluge.progressTpl,
text,
width,
barWidth,
textWidth
);
}, },
/** /**
@ -120,7 +134,7 @@ Ext.apply(Deluge, {
* @param {String} name The plugin name to check * @param {String} name The plugin name to check
*/ */
hasPlugin: function(name) { hasPlugin: function(name) {
return (Deluge.pluginStore[name]) ? true : false; return Deluge.pluginStore[name] ? true : false;
}, },
/** /**
@ -130,8 +144,7 @@ Ext.apply(Deluge, {
*/ */
registerPlugin: function(name, plugin) { registerPlugin: function(name, plugin) {
Deluge.pluginStore[name] = plugin; Deluge.pluginStore[name] = plugin;
} },
}); });
// Setup a space for plugins to insert themselves // Setup a space for plugins to insert themselves
@ -152,12 +165,12 @@ FILE_PRIORITY = {
6: 'High', 6: 'High',
7: 'High', 7: 'High',
9: 'Mixed', 9: 'Mixed',
'Ignore': 0, Ignore: 0,
'Low': 1, Low: 1,
'Normal': 4, Normal: 4,
'High': 7, High: 7,
'Mixed': 9 Mixed: 9,
} };
FILE_PRIORITY_CSS = { FILE_PRIORITY_CSS = {
0: 'x-no-download', 0: 'x-no-download',
@ -168,5 +181,5 @@ FILE_PRIORITY_CSS = {
5: 'x-high-download', 5: 'x-high-download',
6: 'x-high-download', 6: 'x-high-download',
7: 'x-high-download', 7: 'x-high-download',
9: 'x-mixed-download' 9: 'x-mixed-download',
} };

View File

@ -14,7 +14,6 @@ Ext.ns('Deluge');
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.EditConnectionWindow = Ext.extend(Ext.Window, { Deluge.EditConnectionWindow = Ext.extend(Ext.Window, {
title: _('Edit Connection'), title: _('Edit Connection'),
iconCls: 'x-deluge-add-window-icon', iconCls: 'x-deluge-add-window-icon',
@ -40,13 +39,15 @@ Deluge.EditConnectionWindow = Ext.extend(Ext.Window, {
defaultType: 'textfield', defaultType: 'textfield',
baseCls: 'x-plain', baseCls: 'x-plain',
labelWidth: 60, labelWidth: 60,
items: [{ items: [
{
fieldLabel: _('Host:'), fieldLabel: _('Host:'),
labelSeparator: '', labelSeparator: '',
name: 'host', name: 'host',
anchor: '75%', anchor: '75%',
value: '' value: '',
}, { },
{
xtype: 'spinnerfield', xtype: 'spinnerfield',
fieldLabel: _('Port:'), fieldLabel: _('Port:'),
labelSeparator: '', labelSeparator: '',
@ -55,60 +56,79 @@ Deluge.EditConnectionWindow = Ext.extend(Ext.Window, {
xtype: 'number', xtype: 'number',
decimalPrecision: 0, decimalPrecision: 0,
minValue: 0, minValue: 0,
maxValue: 65535 maxValue: 65535,
}, },
anchor: '40%', anchor: '40%',
value: 58846 value: 58846,
}, { },
{
fieldLabel: _('Username:'), fieldLabel: _('Username:'),
labelSeparator: '', labelSeparator: '',
name: 'username', name: 'username',
anchor: '75%', anchor: '75%',
value: '' value: '',
}, { },
{
fieldLabel: _('Password:'), fieldLabel: _('Password:'),
labelSeparator: '', labelSeparator: '',
anchor: '75%', anchor: '75%',
name: 'password', name: 'password',
inputType: 'password', inputType: 'password',
value: '' value: '',
}] },
],
}); });
}, },
show: function(connection) { show: function(connection) {
Deluge.EditConnectionWindow.superclass.show.call(this); Deluge.EditConnectionWindow.superclass.show.call(this);
this.form.getForm().findField('host').setValue(connection.get('host')); this.form
this.form.getForm().findField('port').setValue(connection.get('port')); .getForm()
this.form.getForm().findField('username').setValue(connection.get('user')); .findField('host')
this.host_id = connection.id .setValue(connection.get('host'));
this.form
.getForm()
.findField('port')
.setValue(connection.get('port'));
this.form
.getForm()
.findField('username')
.setValue(connection.get('user'));
this.host_id = connection.id;
}, },
onEditClick: function() { onEditClick: function() {
var values = this.form.getForm().getValues(); var values = this.form.getForm().getValues();
deluge.client.web.edit_host(this.host_id, values.host, Number(values.port), values.username, values.password, { deluge.client.web.edit_host(
this.host_id,
values.host,
Number(values.port),
values.username,
values.password,
{
success: function(result) { success: function(result) {
if (!result) { if (!result) {
console.log(result) console.log(result);
Ext.MessageBox.show({ Ext.MessageBox.show({
title: _('Error'), title: _('Error'),
msg: String.format(_('Unable to edit host')), msg: String.format(_('Unable to edit host')),
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
modal: false, modal: false,
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
iconCls: 'x-deluge-icon-error' iconCls: 'x-deluge-icon-error',
}); });
} else { } else {
this.fireEvent('hostedited'); this.fireEvent('hostedited');
} }
this.hide(); this.hide();
}, },
scope: this scope: this,
}); }
);
}, },
onHide: function() { onHide: function() {
this.form.getForm().reset(); this.form.getForm().reset();
} },
}); });

View File

@ -14,7 +14,6 @@ Ext.ns('Deluge');
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.EditTrackerWindow = Ext.extend(Ext.Window, { Deluge.EditTrackerWindow = Ext.extend(Ext.Window, {
title: _('Edit Tracker'), title: _('Edit Tracker'),
layout: 'fit', layout: 'fit',
width: 375, width: 375,
@ -40,12 +39,14 @@ Deluge.EditTrackerWindow = Ext.extend(Ext.Window, {
defaultType: 'textfield', defaultType: 'textfield',
baseCls: 'x-plain', baseCls: 'x-plain',
labelWidth: 55, labelWidth: 55,
items: [{ items: [
{
fieldLabel: _('Tracker:'), fieldLabel: _('Tracker:'),
labelSeparator: '', labelSeparator: '',
name: 'tracker', name: 'tracker',
anchor: '100%' anchor: '100%',
}] },
],
}); });
}, },
@ -53,7 +54,10 @@ Deluge.EditTrackerWindow = Ext.extend(Ext.Window, {
Deluge.EditTrackerWindow.superclass.show.call(this); Deluge.EditTrackerWindow.superclass.show.call(this);
this.record = record; this.record = record;
this.form.getForm().findField('tracker').setValue(record.data['url']); this.form
.getForm()
.findField('tracker')
.setValue(record.data['url']);
}, },
onCancelClick: function() { onCancelClick: function() {
@ -61,13 +65,19 @@ Deluge.EditTrackerWindow = Ext.extend(Ext.Window, {
}, },
onHide: function() { onHide: function() {
this.form.getForm().findField('tracker').setValue(''); this.form
.getForm()
.findField('tracker')
.setValue('');
}, },
onSaveClick: function() { onSaveClick: function() {
var url = this.form.getForm().findField('tracker').getValue(); var url = this.form
.getForm()
.findField('tracker')
.getValue();
this.record.set('url', url); this.record.set('url', url);
this.record.commit(); this.record.commit();
this.hide(); this.hide();
} },
}); });

View File

@ -14,7 +14,6 @@ Ext.ns('Deluge');
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.EditTrackersWindow = Ext.extend(Ext.Window, { Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
title: _('Edit Trackers'), title: _('Edit Trackers'),
layout: 'fit', layout: 'fit',
width: 350, width: 350,
@ -46,29 +45,29 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
this.list = new Ext.list.ListView({ this.list = new Ext.list.ListView({
store: new Ext.data.JsonStore({ store: new Ext.data.JsonStore({
root: 'trackers', root: 'trackers',
fields: [ fields: ['tier', 'url'],
'tier',
'url'
]
}), }),
columns: [{ columns: [
{
header: _('Tier'), header: _('Tier'),
width: .1, width: 0.1,
dataIndex: 'tier' dataIndex: 'tier',
}, { },
{
header: _('Tracker'), header: _('Tracker'),
width: .9, width: 0.9,
dataIndex: 'url' dataIndex: 'url',
}], },
],
columnSort: { columnSort: {
sortClasses: ['', ''] sortClasses: ['', ''],
}, },
stripeRows: true, stripeRows: true,
singleSelect: true, singleSelect: true,
listeners: { listeners: {
'dblclick': {fn: this.onListNodeDblClicked, scope: this}, dblclick: { fn: this.onListNodeDblClicked, scope: this },
'selectionchange': {fn: this.onSelect, scope: this} selectionchange: { fn: this.onSelect, scope: this },
} },
}); });
this.panel = this.add({ this.panel = this.add({
@ -80,30 +79,35 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
text: _('Up'), text: _('Up'),
iconCls: 'icon-up', iconCls: 'icon-up',
handler: this.onUpClick, handler: this.onUpClick,
scope: this scope: this,
}, { },
{
text: _('Down'), text: _('Down'),
iconCls: 'icon-down', iconCls: 'icon-down',
handler: this.onDownClick, handler: this.onDownClick,
scope: this scope: this,
}, '->', { },
'->',
{
text: _('Add'), text: _('Add'),
iconCls: 'icon-add', iconCls: 'icon-add',
handler: this.onAddClick, handler: this.onAddClick,
scope: this scope: this,
}, { },
{
text: _('Edit'), text: _('Edit'),
iconCls: 'icon-edit-trackers', iconCls: 'icon-edit-trackers',
handler: this.onEditClick, handler: this.onEditClick,
scope: this scope: this,
}, { },
{
text: _('Remove'), text: _('Remove'),
iconCls: 'icon-remove', iconCls: 'icon-remove',
handler: this.onRemoveClick, handler: this.onRemoveClick,
scope: this scope: this,
} },
] ],
}) }),
}); });
}, },
@ -113,8 +117,11 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
onAddTrackers: function(trackers) { onAddTrackers: function(trackers) {
var store = this.list.getStore(); var store = this.list.getStore();
Ext.each(trackers, function(tracker) { Ext.each(
var duplicate = false, heightestTier = -1; trackers,
function(tracker) {
var duplicate = false,
heightestTier = -1;
store.each(function(record) { store.each(function(record) {
if (record.get('tier') > heightestTier) { if (record.get('tier') > heightestTier) {
heightestTier = record.get('tier'); heightestTier = record.get('tier');
@ -125,8 +132,15 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
} }
}, this); }, this);
if (duplicate) return; if (duplicate) return;
store.add(new store.recordType({'tier': heightestTier + 1, 'url': tracker})); store.add(
}, this); new store.recordType({
tier: heightestTier + 1,
url: tracker,
})
);
},
this
);
}, },
onCancelClick: function() { onCancelClick: function() {
@ -151,14 +165,14 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
var trackers = []; var trackers = [];
this.list.getStore().each(function(record) { this.list.getStore().each(function(record) {
trackers.push({ trackers.push({
'tier': record.get('tier'), tier: record.get('tier'),
'url': record.get('url') url: record.get('url'),
}) });
}, this); }, this);
deluge.client.core.set_torrent_trackers(this.torrentId, trackers, { deluge.client.core.set_torrent_trackers(this.torrentId, trackers, {
failure: this.onSaveFail, failure: this.onSaveFail,
scope: this scope: this,
}); });
this.hide(); this.hide();
@ -176,23 +190,27 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
this.list.getStore().sort('tier', 'ASC'); this.list.getStore().sort('tier', 'ASC');
}, },
onSaveFail: function() { onSaveFail: function() {},
},
onSelect: function(list) { onSelect: function(list) {
if (list.getSelectionCount()) { if (list.getSelectionCount()) {
this.panel.getBottomToolbar().items.get(4).enable(); this.panel
.getBottomToolbar()
.items.get(4)
.enable();
} }
}, },
onShow: function() { onShow: function() {
this.panel.getBottomToolbar().items.get(4).disable(); this.panel
.getBottomToolbar()
.items.get(4)
.disable();
var r = deluge.torrents.getSelected(); var r = deluge.torrents.getSelected();
this.torrentId = r.id; this.torrentId = r.id;
deluge.client.core.get_torrent_status(r.id, ['trackers'], { deluge.client.core.get_torrent_status(r.id, ['trackers'], {
success: this.onRequestComplete, success: this.onRequestComplete,
scope: this scope: this,
}); });
}, },
@ -217,5 +235,5 @@ Deluge.EditTrackersWindow = Ext.extend(Ext.Window, {
r.store.commitChanges(); r.store.commitChanges();
this.list.select(r.store.indexOf(r)); this.list.select(r.store.indexOf(r));
} },
}); });

View File

@ -33,14 +33,20 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, {
deluge.client.web.register_event_listener(eventName); deluge.client.web.register_event_listener(eventName);
} }
} }
Deluge.EventsManager.superclass.addListener.call(this, eventName, fn, scope, o); Deluge.EventsManager.superclass.addListener.call(
this,
eventName,
fn,
scope,
o
);
}, },
getEvents: function() { getEvents: function() {
deluge.client.web.get_events({ deluge.client.web.get_events({
success: this.onGetEventsSuccess, success: this.onGetEventsSuccess,
failure: this.onGetEventsFailure, failure: this.onGetEventsFailure,
scope: this scope: this,
}); });
}, },
@ -71,11 +77,16 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, {
onGetEventsSuccess: function(events) { onGetEventsSuccess: function(events) {
if (!this.running) return; if (!this.running) return;
if (events) { if (events) {
Ext.each(events, function(event) { Ext.each(
var name = event[0], args = event[1]; events,
function(event) {
var name = event[0],
args = event[1];
args.splice(0, 0, name); args.splice(0, 0, name);
this.fireEvent.apply(this, args); this.fireEvent.apply(this, args);
}, this); },
this
);
} }
this.getEvents(); this.getEvents();
}, },
@ -89,19 +100,19 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, {
return; return;
} }
this.getEvents(); this.getEvents();
} },
}); });
/** /**
* Appends an event handler to this object (shorthand for {@link #addListener}) * Appends an event handler to this object (shorthand for {@link #addListener})
* @method * @method
*/ */
Deluge.EventsManager.prototype.on = Deluge.EventsManager.prototype.addListener Deluge.EventsManager.prototype.on = Deluge.EventsManager.prototype.addListener;
/** /**
* Fires the specified event with the passed parameters (minus the * Fires the specified event with the passed parameters (minus the
* event name). * event name).
* @method * @method
*/ */
Deluge.EventsManager.prototype.fire = Deluge.EventsManager.prototype.fireEvent Deluge.EventsManager.prototype.fire = Deluge.EventsManager.prototype.fireEvent;
deluge.events = new Deluge.EventsManager(); deluge.events = new Deluge.EventsManager();

View File

@ -10,7 +10,6 @@
Ext.namespace('Deluge'); Ext.namespace('Deluge');
Deluge.FileBrowser = Ext.extend(Ext.Window, { Deluge.FileBrowser = Ext.extend(Ext.Window, {
title: _('File Browser'), title: _('File Browser'),
width: 500, width: 500,
@ -21,20 +20,24 @@ Deluge.FileBrowser = Ext.extend(Ext.Window, {
this.add({ this.add({
xtype: 'toolbar', xtype: 'toolbar',
items: [{ items: [
{
text: _('Back'), text: _('Back'),
iconCls: 'icon-back' iconCls: 'icon-back',
}, { },
{
text: _('Forward'), text: _('Forward'),
iconCls: 'icon-forward' iconCls: 'icon-forward',
}, { },
{
text: _('Up'), text: _('Up'),
iconCls: 'icon-up' iconCls: 'icon-up',
}, { },
{
text: _('Home'), text: _('Home'),
iconCls: 'icon-home' iconCls: 'icon-home',
}] },
],
}); });
} },
}); });

View File

@ -14,7 +14,6 @@ Ext.ns('Deluge');
* @extends Ext.list.ListView * @extends Ext.list.ListView
*/ */
Deluge.FilterPanel = Ext.extend(Ext.Panel, { Deluge.FilterPanel = Ext.extend(Ext.Panel, {
autoScroll: true, autoScroll: true,
border: false, border: false,
@ -34,9 +33,9 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
} else if (this.filterType == 'label') { } else if (this.filterType == 'label') {
title = _('Labels'); title = _('Labels');
} else { } else {
title = this.filterType.replace('_', ' '), (title = this.filterType.replace('_', ' ')),
parts = title.split(' '), (parts = title.split(' ')),
title = ''; (title = '');
Ext.each(parts, function(p) { Ext.each(parts, function(p) {
fl = p.substring(0, 1).toUpperCase(); fl = p.substring(0, 1).toUpperCase();
title += fl + p.substring(1) + ' '; title += fl + p.substring(1) + ' ';
@ -47,7 +46,8 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
if (Deluge.FilterPanel.templates[this.filterType]) { if (Deluge.FilterPanel.templates[this.filterType]) {
var tpl = Deluge.FilterPanel.templates[this.filterType]; var tpl = Deluge.FilterPanel.templates[this.filterType];
} else { } else {
var tpl = '<div class="x-deluge-filter x-deluge-{filter:lowercase}">{filter} ({count})</div>'; var tpl =
'<div class="x-deluge-filter x-deluge-{filter:lowercase}">{filter} ({count})</div>';
} }
this.list = this.add({ this.list = this.add({
@ -57,14 +57,16 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
reserveScrollOffset: true, reserveScrollOffset: true,
store: new Ext.data.ArrayStore({ store: new Ext.data.ArrayStore({
idIndex: 0, idIndex: 0,
fields: ['filter', 'count'] fields: ['filter', 'count'],
}), }),
columns: [{ columns: [
{
id: 'filter', id: 'filter',
sortable: false, sortable: false,
tpl: tpl, tpl: tpl,
dataIndex: 'filter' dataIndex: 'filter',
}] },
],
}); });
this.relayEvents(this.list, ['selectionchange']); this.relayEvents(this.list, ['selectionchange']);
}, },
@ -102,11 +104,18 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
*/ */
updateStates: function(states) { updateStates: function(states) {
this.states = {}; this.states = {};
Ext.each(states, function(state) { Ext.each(
states,
function(state) {
this.states[state[0]] = state[1]; this.states[state[0]] = state[1];
}, this); },
this
);
var show_zero = (this.show_zero == null) ? deluge.config.sidebar_show_zero : this.show_zero; var show_zero =
this.show_zero == null
? deluge.config.sidebar_show_zero
: this.show_zero;
if (!show_zero) { if (!show_zero) {
var newStates = []; var newStates = [];
Ext.each(states, function(state) { Ext.each(states, function(state) {
@ -119,12 +128,14 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
var store = this.getStore(); var store = this.getStore();
var filters = {}; var filters = {};
Ext.each(states, function(s, i) { Ext.each(
states,
function(s, i) {
var record = store.getById(s[0]); var record = store.getById(s[0]);
if (!record) { if (!record) {
record = new store.recordType({ record = new store.recordType({
filter: s[0], filter: s[0],
count: s[1] count: s[1],
}); });
record.id = s[0]; record.id = s[0];
store.insert(i, record); store.insert(i, record);
@ -134,7 +145,9 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
record.set('count', s[1]); record.set('count', s[1]);
record.endEdit(); record.endEdit();
filters[s[0]] = true; filters[s[0]] = true;
}, this); },
this
);
store.each(function(record) { store.each(function(record) {
if (filters[record.id]) return; if (filters[record.id]) return;
@ -151,10 +164,12 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
if (!this.list.getSelectionCount()) { if (!this.list.getSelectionCount()) {
this.list.select(0); this.list.select(0);
} }
} },
}); });
Deluge.FilterPanel.templates = { Deluge.FilterPanel.templates = {
'tracker_host': '<div class="x-deluge-filter" style="background-image: url(' + deluge.config.base + 'tracker/{filter});">{filter} ({count})</div>' tracker_host:
} '<div class="x-deluge-filter" style="background-image: url(' +
deluge.config.base +
'tracker/{filter});">{filter} ({count})</div>',
};

View File

@ -34,9 +34,15 @@ Deluge.Formatters = {
} }
timestamp = timestamp * 1000; timestamp = timestamp * 1000;
var date = new Date(timestamp); var date = new Date(timestamp);
return String.format('{0}/{1}/{2} {3}:{4}:{5}', return String.format(
zeroPad(date.getDate(), 2), zeroPad(date.getMonth() + 1, 2), date.getFullYear(), '{0}/{1}/{2} {3}:{4}:{5}',
zeroPad(date.getHours(), 2), zeroPad(date.getMinutes(), 2), zeroPad(date.getSeconds(), 2)); zeroPad(date.getDate(), 2),
zeroPad(date.getMonth() + 1, 2),
date.getFullYear(),
zeroPad(date.getHours(), 2),
zeroPad(date.getMinutes(), 2),
zeroPad(date.getSeconds(), 2)
);
}, },
/** /**
@ -50,13 +56,19 @@ Deluge.Formatters = {
if (!bytes && !showZero) return ''; if (!bytes && !showZero) return '';
bytes = bytes / 1024.0; bytes = bytes / 1024.0;
if (bytes < 1024) { return bytes.toFixed(1) + ' KiB'; } if (bytes < 1024) {
else { bytes = bytes / 1024; } return bytes.toFixed(1) + ' KiB';
} else {
bytes = bytes / 1024;
}
if (bytes < 1024) { return bytes.toFixed(1) + ' MiB'; } if (bytes < 1024) {
else { bytes = bytes / 1024; } return bytes.toFixed(1) + ' MiB';
} else {
bytes = bytes / 1024;
}
return bytes.toFixed(1) + ' GiB' return bytes.toFixed(1) + ' GiB';
}, },
/** /**
@ -70,13 +82,19 @@ Deluge.Formatters = {
if (!bytes && !showZero) return ''; if (!bytes && !showZero) return '';
bytes = bytes / 1024.0; bytes = bytes / 1024.0;
if (bytes < 1024) { return bytes.toFixed(1) + ' K'; } if (bytes < 1024) {
else { bytes = bytes / 1024; } return bytes.toFixed(1) + ' K';
} else {
bytes = bytes / 1024;
}
if (bytes < 1024) { return bytes.toFixed(1) + ' M'; } if (bytes < 1024) {
else { bytes = bytes / 1024; } return bytes.toFixed(1) + ' M';
} else {
bytes = bytes / 1024;
}
return bytes.toFixed(1) + ' G' return bytes.toFixed(1) + ' G';
}, },
/** /**
@ -87,7 +105,7 @@ Deluge.Formatters = {
* @return {String} formatted string with KiB, MiB or GiB units. * @return {String} formatted string with KiB, MiB or GiB units.
*/ */
speed: function(bytes, showZero) { speed: function(bytes, showZero) {
return (!bytes && !showZero) ? '' : fsize(bytes, showZero) + '/s'; return !bytes && !showZero ? '' : fsize(bytes, showZero) + '/s';
}, },
/** /**
@ -97,34 +115,42 @@ Deluge.Formatters = {
* @return {String} a formatted time string. will return '' if seconds == 0 * @return {String} a formatted time string. will return '' if seconds == 0
*/ */
timeRemaining: function(time) { timeRemaining: function(time) {
if (time <= 0) { return '&infin;' } if (time <= 0) {
return '&infin;';
}
time = time.toFixed(0); time = time.toFixed(0);
if (time < 60) { return time + 's'; } if (time < 60) {
else { time = time / 60; } return time + 's';
} else {
time = time / 60;
}
if (time < 60) { if (time < 60) {
var minutes = Math.floor(time) var minutes = Math.floor(time);
var seconds = Math.round(60 * (time - minutes)) var seconds = Math.round(60 * (time - minutes));
if (seconds > 0) { if (seconds > 0) {
return minutes + 'm ' + seconds + 's'; return minutes + 'm ' + seconds + 's';
} else { } else {
return minutes + 'm'; } return minutes + 'm';
}
} else {
time = time / 60;
} }
else { time = time / 60; }
if (time < 24) { if (time < 24) {
var hours = Math.floor(time) var hours = Math.floor(time);
var minutes = Math.round(60 * (time - hours)) var minutes = Math.round(60 * (time - hours));
if (minutes > 0) { if (minutes > 0) {
return hours + 'h ' + minutes + 'm'; return hours + 'h ' + minutes + 'm';
} else { } else {
return hours + 'h'; return hours + 'h';
} }
} else {
time = time / 24;
} }
else { time = time / 24; }
var days = Math.floor(time) var days = Math.floor(time);
var hours = Math.round(24 * (time - days)) var hours = Math.round(24 * (time - days));
if (hours > 0) { if (hours > 0) {
return days + 'd ' + hours + 'h'; return days + 'd ' + hours + 'h';
} else { } else {
@ -144,8 +170,8 @@ Deluge.Formatters = {
cssClassEscape: function(value) { cssClassEscape: function(value) {
return value.toLowerCase().replace('.', '_'); return value.toLowerCase().replace('.', '_');
} },
} };
var fsize = Deluge.Formatters.size; var fsize = Deluge.Formatters.size;
var fsize_short = Deluge.Formatters.sizeShort; var fsize_short = Deluge.Formatters.sizeShort;
var fspeed = Deluge.Formatters.speed; var fspeed = Deluge.Formatters.speed;

View File

@ -14,7 +14,6 @@
* @singleton * @singleton
*/ */
Deluge.Keys = { Deluge.Keys = {
/** /**
* Keys that are used within the torrent grid. * Keys that are used within the torrent grid.
* <pre>['queue', 'name', 'total_wanted', 'state', 'progress', 'num_seeds', * <pre>['queue', 'name', 'total_wanted', 'state', 'progress', 'num_seeds',
@ -25,12 +24,33 @@ Deluge.Keys = {
* 'seeds_peers_ratio', 'total_remaining', 'completed_time', 'time_since_transfer']</pre> * 'seeds_peers_ratio', 'total_remaining', 'completed_time', 'time_since_transfer']</pre>
*/ */
Grid: [ Grid: [
'queue', 'name', 'total_wanted', 'state', 'progress', 'num_seeds', 'queue',
'total_seeds', 'num_peers', 'total_peers', 'download_payload_rate', 'name',
'upload_payload_rate', 'eta', 'ratio', 'distributed_copies', 'total_wanted',
'is_auto_managed', 'time_added', 'tracker_host', 'download_location', 'last_seen_complete', 'state',
'total_done', 'total_uploaded', 'max_download_speed', 'max_upload_speed', 'progress',
'seeds_peers_ratio', 'total_remaining', 'completed_time', 'time_since_transfer' 'num_seeds',
'total_seeds',
'num_peers',
'total_peers',
'download_payload_rate',
'upload_payload_rate',
'eta',
'ratio',
'distributed_copies',
'is_auto_managed',
'time_added',
'tracker_host',
'download_location',
'last_seen_complete',
'total_done',
'total_uploaded',
'max_download_speed',
'max_upload_speed',
'seeds_peers_ratio',
'total_remaining',
'completed_time',
'time_since_transfer',
], ],
/** /**
@ -42,34 +62,50 @@ Deluge.Keys = {
* 'seed_rank', 'last_seen_complete', 'completed_time', 'owner', 'public', 'shared']</pre> * 'seed_rank', 'last_seen_complete', 'completed_time', 'owner', 'public', 'shared']</pre>
*/ */
Status: [ Status: [
'total_done', 'total_payload_download', 'total_uploaded', 'total_done',
'total_payload_upload', 'next_announce', 'tracker_status', 'num_pieces', 'total_payload_download',
'piece_length', 'is_auto_managed', 'active_time', 'seeding_time', 'time_since_transfer', 'total_uploaded',
'seed_rank', 'last_seen_complete', 'completed_time', 'owner', 'public', 'shared' 'total_payload_upload',
'next_announce',
'tracker_status',
'num_pieces',
'piece_length',
'is_auto_managed',
'active_time',
'seeding_time',
'time_since_transfer',
'seed_rank',
'last_seen_complete',
'completed_time',
'owner',
'public',
'shared',
], ],
/** /**
* Keys used in the files tab of the statistics panel. * Keys used in the files tab of the statistics panel.
* <pre>['files', 'file_progress', 'file_priorities']</pre> * <pre>['files', 'file_progress', 'file_priorities']</pre>
*/ */
Files: [ Files: ['files', 'file_progress', 'file_priorities'],
'files', 'file_progress', 'file_priorities'
],
/** /**
* Keys used in the peers tab of the statistics panel. * Keys used in the peers tab of the statistics panel.
* <pre>['peers']</pre> * <pre>['peers']</pre>
*/ */
Peers: [ Peers: ['peers'],
'peers'
],
/** /**
* Keys used in the details tab of the statistics panel. * Keys used in the details tab of the statistics panel.
*/ */
Details: [ Details: [
'name', 'download_location', 'total_size', 'num_files', 'message', 'name',
'tracker_host', 'comment', 'creator' 'download_location',
'total_size',
'num_files',
'message',
'tracker_host',
'comment',
'creator',
], ],
/** /**
@ -79,11 +115,19 @@ Deluge.Keys = {
* 'prioritize_first_last']</pre> * 'prioritize_first_last']</pre>
*/ */
Options: [ Options: [
'max_download_speed', 'max_upload_speed', 'max_connections', 'max_download_speed',
'max_upload_slots','is_auto_managed', 'stop_at_ratio', 'stop_ratio', 'max_upload_speed',
'remove_at_ratio', 'private', 'prioritize_first_last', 'max_connections',
'move_completed', 'move_completed_path' 'max_upload_slots',
] 'is_auto_managed',
'stop_at_ratio',
'stop_ratio',
'remove_at_ratio',
'private',
'prioritize_first_last',
'move_completed',
'move_completed_path',
],
}; };
// Merge the grid and status keys together as the status keys contain all the // Merge the grid and status keys together as the status keys contain all the

View File

@ -9,7 +9,6 @@
*/ */
Deluge.LoginWindow = Ext.extend(Ext.Window, { Deluge.LoginWindow = Ext.extend(Ext.Window, {
firstShow: true, firstShow: true,
bodyStyle: 'padding: 10px 5px;', bodyStyle: 'padding: 10px 5px;',
buttonAlign: 'center', buttonAlign: 'center',
@ -31,7 +30,7 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
this.addButton({ this.addButton({
text: _('Login'), text: _('Login'),
handler: this.onLogin, handler: this.onLogin,
scope: this scope: this,
}); });
this.form = this.add({ this.form = this.add({
@ -40,7 +39,7 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
labelWidth: 120, labelWidth: 120,
labelAlign: 'right', labelAlign: 'right',
defaults: { width: 110 }, defaults: { width: 110 },
defaultType: 'textfield' defaultType: 'textfield',
}); });
this.passwordField = this.form.add({ this.passwordField = this.form.add({
@ -52,7 +51,7 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
growMax: '145', growMax: '145',
id: '_password', id: '_password',
name: 'password', name: 'password',
inputType: 'password' inputType: 'password',
}); });
this.passwordField.on('specialkey', this.onSpecialKey, this); this.passwordField.on('specialkey', this.onSpecialKey, this);
}, },
@ -63,7 +62,7 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
success: function(result) { success: function(result) {
this.show(true); this.show(true);
}, },
scope: this scope: this,
}); });
}, },
@ -88,7 +87,7 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
failure: function(result) { failure: function(result) {
this.show(true); this.show(true);
}, },
scope: this scope: this,
}); });
}, },
@ -114,11 +113,11 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
passwordField.focus(true, 10); passwordField.focus(true, 10);
}, },
icon: Ext.MessageBox.WARNING, icon: Ext.MessageBox.WARNING,
iconCls: 'x-deluge-icon-warning' iconCls: 'x-deluge-icon-warning',
}); });
} }
}, },
scope: this scope: this,
}); });
}, },
@ -131,5 +130,5 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
onShow: function() { onShow: function() {
this.passwordField.focus(true, 300); this.passwordField.focus(true, 300);
} },
}); });

View File

@ -23,7 +23,7 @@ deluge.menus = {
deluge.client.core[action](ids, { deluge.client.core[action](ids, {
success: function() { success: function() {
deluge.ui.update(); deluge.ui.update();
} },
}); });
}, },
@ -41,284 +41,348 @@ deluge.menus = {
deluge.moveStorage.show(ids); deluge.moveStorage.show(ids);
break; break;
} }
} },
} };
deluge.menus.torrent = new Ext.menu.Menu({ deluge.menus.torrent = new Ext.menu.Menu({
id: 'torrentMenu', id: 'torrentMenu',
items: [{ items: [
{
torrentAction: 'pause_torrent', torrentAction: 'pause_torrent',
text: _('Pause'), text: _('Pause'),
iconCls: 'icon-pause', iconCls: 'icon-pause',
handler: deluge.menus.onTorrentActionMethod, handler: deluge.menus.onTorrentActionMethod,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: 'resume_torrent', torrentAction: 'resume_torrent',
text: _('Resume'), text: _('Resume'),
iconCls: 'icon-resume', iconCls: 'icon-resume',
handler: deluge.menus.onTorrentActionMethod, handler: deluge.menus.onTorrentActionMethod,
scope: deluge.menus scope: deluge.menus,
}, '-', { },
'-',
{
text: _('Options'), text: _('Options'),
iconCls: 'icon-options', iconCls: 'icon-options',
hideOnClick: false, hideOnClick: false,
menu: new Ext.menu.Menu({ menu: new Ext.menu.Menu({
items: [{ items: [
{
text: _('D/L Speed Limit'), text: _('D/L Speed Limit'),
iconCls: 'x-deluge-downloading', iconCls: 'x-deluge-downloading',
hideOnClick: false, hideOnClick: false,
menu: new Ext.menu.Menu({ menu: new Ext.menu.Menu({
items: [{ items: [
{
torrentAction: ['max_download_speed', 5], torrentAction: ['max_download_speed', 5],
text: _('5 KiB/s'), text: _('5 KiB/s'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_download_speed', 10], torrentAction: ['max_download_speed', 10],
text: _('10 KiB/s'), text: _('10 KiB/s'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_download_speed', 30], torrentAction: ['max_download_speed', 30],
text: _('30 KiB/s'), text: _('30 KiB/s'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_download_speed', 80], torrentAction: ['max_download_speed', 80],
text: _('80 KiB/s'), text: _('80 KiB/s'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_download_speed', 300], torrentAction: ['max_download_speed', 300],
text: _('300 KiB/s'), text: _('300 KiB/s'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
},{ },
{
torrentAction: ['max_download_speed', -1], torrentAction: ['max_download_speed', -1],
text: _('Unlimited'), text: _('Unlimited'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}] },
}) ],
}, { }),
},
{
text: _('U/L Speed Limit'), text: _('U/L Speed Limit'),
iconCls: 'x-deluge-seeding', iconCls: 'x-deluge-seeding',
hideOnClick: false, hideOnClick: false,
menu: new Ext.menu.Menu({ menu: new Ext.menu.Menu({
items: [{ items: [
{
torrentAction: ['max_upload_speed', 5], torrentAction: ['max_upload_speed', 5],
text: _('5 KiB/s'), text: _('5 KiB/s'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_upload_speed', 10], torrentAction: ['max_upload_speed', 10],
text: _('10 KiB/s'), text: _('10 KiB/s'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_upload_speed', 30], torrentAction: ['max_upload_speed', 30],
text: _('30 KiB/s'), text: _('30 KiB/s'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_upload_speed', 80], torrentAction: ['max_upload_speed', 80],
text: _('80 KiB/s'), text: _('80 KiB/s'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_upload_speed', 300], torrentAction: ['max_upload_speed', 300],
text: _('300 KiB/s'), text: _('300 KiB/s'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
},{ },
{
torrentAction: ['max_upload_speed', -1], torrentAction: ['max_upload_speed', -1],
text: _('Unlimited'), text: _('Unlimited'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}] },
}) ],
}, { }),
},
{
text: _('Connection Limit'), text: _('Connection Limit'),
iconCls: 'x-deluge-connections', iconCls: 'x-deluge-connections',
hideOnClick: false, hideOnClick: false,
menu: new Ext.menu.Menu({ menu: new Ext.menu.Menu({
items: [{ items: [
{
torrentAction: ['max_connections', 50], torrentAction: ['max_connections', 50],
text: '50', text: '50',
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_connections', 100], torrentAction: ['max_connections', 100],
text: '100', text: '100',
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_connections', 200], torrentAction: ['max_connections', 200],
text: '200', text: '200',
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_connections', 300], torrentAction: ['max_connections', 300],
text: '300', text: '300',
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_connections', 500], torrentAction: ['max_connections', 500],
text: '500', text: '500',
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
},{ },
{
torrentAction: ['max_connections', -1], torrentAction: ['max_connections', -1],
text: _('Unlimited'), text: _('Unlimited'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}] },
}) ],
}, { }),
},
{
text: _('Upload Slot Limit'), text: _('Upload Slot Limit'),
iconCls: 'icon-upload-slots', iconCls: 'icon-upload-slots',
hideOnClick: false, hideOnClick: false,
menu: new Ext.menu.Menu({ menu: new Ext.menu.Menu({
items: [{ items: [
{
torrentAction: ['max_upload_slots', 0], torrentAction: ['max_upload_slots', 0],
text: '0', text: '0',
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_upload_slots', 1], torrentAction: ['max_upload_slots', 1],
text: '1', text: '1',
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_upload_slots', 2], torrentAction: ['max_upload_slots', 2],
text: '2', text: '2',
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_upload_slots', 3], torrentAction: ['max_upload_slots', 3],
text: '3', text: '3',
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['max_upload_slots', 5], torrentAction: ['max_upload_slots', 5],
text: '5', text: '5',
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
},{ },
{
torrentAction: ['max_upload_slots', -1], torrentAction: ['max_upload_slots', -1],
text: _('Unlimited'), text: _('Unlimited'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}] },
}) ],
}, { }),
},
{
id: 'auto_managed', id: 'auto_managed',
text: _('Auto Managed'), text: _('Auto Managed'),
hideOnClick: false, hideOnClick: false,
menu: new Ext.menu.Menu({ menu: new Ext.menu.Menu({
items: [{ items: [
{
torrentAction: ['auto_managed', true], torrentAction: ['auto_managed', true],
text: _('On'), text: _('On'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: ['auto_managed', false], torrentAction: ['auto_managed', false],
text: _('Off'), text: _('Off'),
handler: deluge.menus.onTorrentActionSetOpt, handler: deluge.menus.onTorrentActionSetOpt,
scope: deluge.menus scope: deluge.menus,
}] },
}) ],
}] }),
}) },
}, '-', { ],
}),
},
'-',
{
text: _('Queue'), text: _('Queue'),
iconCls: 'icon-queue', iconCls: 'icon-queue',
hideOnClick: false, hideOnClick: false,
menu: new Ext.menu.Menu({ menu: new Ext.menu.Menu({
items: [{ items: [
{
torrentAction: 'queue_top', torrentAction: 'queue_top',
text: _('Top'), text: _('Top'),
iconCls: 'icon-top', iconCls: 'icon-top',
handler: deluge.menus.onTorrentActionMethod, handler: deluge.menus.onTorrentActionMethod,
scope: deluge.menus scope: deluge.menus,
},{ },
{
torrentAction: 'queue_up', torrentAction: 'queue_up',
text: _('Up'), text: _('Up'),
iconCls: 'icon-up', iconCls: 'icon-up',
handler: deluge.menus.onTorrentActionMethod, handler: deluge.menus.onTorrentActionMethod,
scope: deluge.menus scope: deluge.menus,
},{ },
{
torrentAction: 'queue_down', torrentAction: 'queue_down',
text: _('Down'), text: _('Down'),
iconCls: 'icon-down', iconCls: 'icon-down',
handler: deluge.menus.onTorrentActionMethod, handler: deluge.menus.onTorrentActionMethod,
scope: deluge.menus scope: deluge.menus,
},{ },
{
torrentAction: 'queue_bottom', torrentAction: 'queue_bottom',
text: _('Bottom'), text: _('Bottom'),
iconCls: 'icon-bottom', iconCls: 'icon-bottom',
handler: deluge.menus.onTorrentActionMethod, handler: deluge.menus.onTorrentActionMethod,
scope: deluge.menus scope: deluge.menus,
}] },
}) ],
}, '-', { }),
},
'-',
{
torrentAction: 'force_reannounce', torrentAction: 'force_reannounce',
text: _('Update Tracker'), text: _('Update Tracker'),
iconCls: 'icon-update-tracker', iconCls: 'icon-update-tracker',
handler: deluge.menus.onTorrentActionMethod, handler: deluge.menus.onTorrentActionMethod,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: 'edit_trackers', torrentAction: 'edit_trackers',
text: _('Edit Trackers'), text: _('Edit Trackers'),
iconCls: 'icon-edit-trackers', iconCls: 'icon-edit-trackers',
handler: deluge.menus.onTorrentActionShow, handler: deluge.menus.onTorrentActionShow,
scope: deluge.menus scope: deluge.menus,
}, '-', { },
'-',
{
torrentAction: 'remove', torrentAction: 'remove',
text: _('Remove Torrent'), text: _('Remove Torrent'),
iconCls: 'icon-remove', iconCls: 'icon-remove',
handler: deluge.menus.onTorrentActionShow, handler: deluge.menus.onTorrentActionShow,
scope: deluge.menus scope: deluge.menus,
}, '-', { },
'-',
{
torrentAction: 'force_recheck', torrentAction: 'force_recheck',
text: _('Force Recheck'), text: _('Force Recheck'),
iconCls: 'icon-recheck', iconCls: 'icon-recheck',
handler: deluge.menus.onTorrentActionMethod, handler: deluge.menus.onTorrentActionMethod,
scope: deluge.menus scope: deluge.menus,
}, { },
{
torrentAction: 'move', torrentAction: 'move',
text: _('Move Download Folder'), text: _('Move Download Folder'),
iconCls: 'icon-move', iconCls: 'icon-move',
handler: deluge.menus.onTorrentActionShow, handler: deluge.menus.onTorrentActionShow,
scope: deluge.menus scope: deluge.menus,
}] },
],
}); });
deluge.menus.filePriorities = new Ext.menu.Menu({ deluge.menus.filePriorities = new Ext.menu.Menu({
id: 'filePrioritiesMenu', id: 'filePrioritiesMenu',
items: [{ items: [
{
id: 'expandAll', id: 'expandAll',
text: _('Expand All'), text: _('Expand All'),
iconCls: 'icon-expand-all' iconCls: 'icon-expand-all',
}, '-', { },
'-',
{
id: 'ignore', id: 'ignore',
text: _('Ignore'), text: _('Ignore'),
iconCls: 'icon-do-not-download', iconCls: 'icon-do-not-download',
filePriority: FILE_PRIORITY['Ignore'] filePriority: FILE_PRIORITY['Ignore'],
}, { },
{
id: 'low', id: 'low',
text: _('Low'), text: _('Low'),
iconCls: 'icon-low', iconCls: 'icon-low',
filePriority: FILE_PRIORITY['Low'] filePriority: FILE_PRIORITY['Low'],
}, { },
{
id: 'normal', id: 'normal',
text: _('Normal'), text: _('Normal'),
iconCls: 'icon-normal', iconCls: 'icon-normal',
filePriority: FILE_PRIORITY['Normal'] filePriority: FILE_PRIORITY['Normal'],
}, { },
{
id: 'high', id: 'high',
text: _('High'), text: _('High'),
iconCls: 'icon-high', iconCls: 'icon-high',
filePriority: FILE_PRIORITY['High'] filePriority: FILE_PRIORITY['High'],
}] },
],
}); });

View File

@ -10,9 +10,9 @@
Ext.namespace('Deluge'); Ext.namespace('Deluge');
Deluge.MoveStorage = Ext.extend(Ext.Window, { Deluge.MoveStorage = Ext.extend(Ext.Window, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
{
title: _('Move Download Folder'), title: _('Move Download Folder'),
width: 375, width: 375,
height: 110, height: 110,
@ -23,8 +23,10 @@ Deluge.MoveStorage = Ext.extend(Ext.Window, {
iconCls: 'x-deluge-move-storage', iconCls: 'x-deluge-move-storage',
plain: true, plain: true,
constrainHeader: true, constrainHeader: true,
resizable: false resizable: false,
}, config); },
config
);
Deluge.MoveStorage.superclass.constructor.call(this, config); Deluge.MoveStorage.superclass.constructor.call(this, config);
}, },
@ -39,13 +41,13 @@ Deluge.MoveStorage = Ext.extend(Ext.Window, {
border: false, border: false,
defaultType: 'textfield', defaultType: 'textfield',
width: 300, width: 300,
bodyStyle: 'padding: 5px' bodyStyle: 'padding: 5px',
}); });
this.moveLocation = this.form.add({ this.moveLocation = this.form.add({
fieldLabel: _('Download Folder'), fieldLabel: _('Download Folder'),
name: 'location', name: 'location',
width: 240 width: 240,
}); });
//this.form.add({ //this.form.add({
// xtype: 'button', // xtype: 'button',
@ -78,6 +80,6 @@ Deluge.MoveStorage = Ext.extend(Ext.Window, {
var dest = this.moveLocation.getValue(); var dest = this.moveLocation.getValue();
deluge.client.core.move_storage(this.torrentIds, dest); deluge.client.core.move_storage(this.torrentIds, dest);
this.hide(); this.hide();
} },
}); });
deluge.moveStorage = new Deluge.MoveStorage(); deluge.moveStorage = new Deluge.MoveStorage();

View File

@ -15,7 +15,6 @@
* @extends Deluge.OptionsManager * @extends Deluge.OptionsManager
*/ */
Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, { Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
constructor: function(config) { constructor: function(config) {
this.currentId = null; this.currentId = null;
this.stored = {}; this.stored = {};
@ -32,9 +31,13 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
if (!dontUpdateBinds) { if (!dontUpdateBinds) {
for (var option in this.options) { for (var option in this.options) {
if (!this.binds[option]) continue; if (!this.binds[option]) continue;
Ext.each(this.binds[option], function(bind) { Ext.each(
this.binds[option],
function(bind) {
bind.setValue(this.get(option)); bind.setValue(this.get(option));
}, this); },
this
);
} }
} }
return oldId; return oldId;
@ -45,7 +48,10 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
* @param {String} id * @param {String} id
*/ */
commit: function() { commit: function() {
this.stored[this.currentId] = Ext.apply(this.stored[this.currentId], this.changed[this.currentId]); this.stored[this.currentId] = Ext.apply(
this.stored[this.currentId],
this.changed[this.currentId]
);
this.reset(); this.reset();
}, },
@ -57,18 +63,28 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
get: function() { get: function() {
if (arguments.length == 1) { if (arguments.length == 1) {
var option = arguments[0]; var option = arguments[0];
return (this.isDirty(option)) ? this.changed[this.currentId][option] : this.getDefault(option); return this.isDirty(option)
? this.changed[this.currentId][option]
: this.getDefault(option);
} else if (arguments.length == 0) { } else if (arguments.length == 0) {
var options = {}; var options = {};
for (var option in this.options) { for (var option in this.options) {
options[option] = (this.isDirty(option)) ? this.changed[this.currentId][option] : this.getDefault(option); options[option] = this.isDirty(option)
? this.changed[this.currentId][option]
: this.getDefault(option);
} }
return options; return options;
} else { } else {
var options = {}; var options = {};
Ext.each(arguments, function(option) { Ext.each(
options[option] = (this.isDirty(option)) ? this.changed[this.currentId][option] : this.getDefault(option); arguments,
}, this); function(option) {
options[option] = this.isDirty(option)
? this.changed[this.currentId][option]
: this.getDefault(option);
},
this
);
return options; return options;
} }
}, },
@ -79,7 +95,9 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
* @returns {Object} the value of the option * @returns {Object} the value of the option
*/ */
getDefault: function(option) { getDefault: function(option) {
return (this.has(option)) ? this.stored[this.currentId][option] : this.options[option]; return this.has(option)
? this.stored[this.currentId][option]
: this.options[option];
}, },
/** /**
@ -87,7 +105,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
* @returns {Object} the changed options * @returns {Object} the changed options
*/ */
getDirty: function() { getDirty: function() {
return (this.changed[this.currentId]) ? this.changed[this.currentId] : {}; return this.changed[this.currentId] ? this.changed[this.currentId] : {};
}, },
/** /**
@ -96,7 +114,10 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
* @returns {Boolean} true if the option has been changed, else false. * @returns {Boolean} true if the option has been changed, else false.
*/ */
isDirty: function(option) { isDirty: function(option) {
return (this.changed[this.currentId] && !Ext.isEmpty(this.changed[this.currentId][option])); return (
this.changed[this.currentId] &&
!Ext.isEmpty(this.changed[this.currentId][option])
);
}, },
/** /**
@ -106,7 +127,10 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
* @returns {Boolean} true if the id has an option, else false. * @returns {Boolean} true if the id has an option, else false.
*/ */
has: function(option) { has: function(option) {
return (this.stored[this.currentId] && !Ext.isEmpty(this.stored[this.currentId][option])); return (
this.stored[this.currentId] &&
!Ext.isEmpty(this.stored[this.currentId][option])
);
}, },
/** /**
@ -171,7 +195,8 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
this.update(key, option[key]); this.update(key, option[key]);
} }
} else { } else {
if (!this.changed[this.currentId]) this.changed[this.currentId] = {}; if (!this.changed[this.currentId])
this.changed[this.currentId] = {};
var defaultValue = this.getDefault(option); var defaultValue = this.getDefault(option);
value = this.convertValueType(defaultValue, value); value = this.convertValueType(defaultValue, value);
@ -180,7 +205,8 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
if (oldValue == value) return; if (oldValue == value) return;
if (defaultValue == value) { if (defaultValue == value) {
if (this.isDirty(option)) delete this.changed[this.currentId][option]; if (this.isDirty(option))
delete this.changed[this.currentId][option];
this.fireEvent('changed', option, value, oldValue); this.fireEvent('changed', option, value, oldValue);
return; return;
} else { } else {
@ -188,5 +214,5 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
this.fireEvent('changed', option, value, oldValue); this.fireEvent('changed', option, value, oldValue);
} }
} }
} },
}); });

View File

@ -18,7 +18,6 @@ Ext.namespace('Deluge');
* @param {Object} config Configuration options * @param {Object} config Configuration options
*/ */
Deluge.OptionsManager = Ext.extend(Ext.util.Observable, { Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
constructor: function(config) { constructor: function(config) {
config = config || {}; config = config || {};
this.binds = {}; this.binds = {};
@ -31,7 +30,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
* @event add * @event add
* Fires when an option is added * Fires when an option is added
*/ */
'add': true, add: true,
/** /**
* @event changed * @event changed
@ -40,13 +39,13 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
* @param {Mixed} value The options new value * @param {Mixed} value The options new value
* @param {Mixed} oldValue The options old value * @param {Mixed} oldValue The options old value
*/ */
'changed': true, changed: true,
/** /**
* @event reset * @event reset
* Fires when the options are reset * Fires when the options are reset
*/ */
'reset': true reset: true,
}); });
this.on('changed', this.onChange, this); this.on('changed', this.onChange, this);
@ -104,7 +103,10 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
case 'boolean': case 'boolean':
if (Ext.type(value) == 'string') { if (Ext.type(value) == 'string') {
value = value.toLowerCase(); value = value.toLowerCase();
value = (value == 'true' || value == '1' || value == 'on') ? true : false; value =
value == 'true' || value == '1' || value == 'on'
? true
: false;
} else { } else {
value = Boolean(value); value = Boolean(value);
} }
@ -122,13 +124,21 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
get: function() { get: function() {
if (arguments.length == 1) { if (arguments.length == 1) {
var option = arguments[0]; var option = arguments[0];
return (this.isDirty(option)) ? this.changed[option] : this.options[option]; return this.isDirty(option)
? this.changed[option]
: this.options[option];
} else { } else {
var options = {}; var options = {};
Ext.each(arguments, function(option) { Ext.each(
arguments,
function(option) {
if (!this.has(option)) return; if (!this.has(option)) return;
options[option] = (this.isDirty(option)) ? this.changed[option] : this.options[option]; options[option] = this.isDirty(option)
}, this); ? this.changed[option]
: this.options[option];
},
this
);
return options; return options;
} }
}, },
@ -164,7 +174,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
* @returns {Boolean} true if the option exists, else false. * @returns {Boolean} true if the option exists, else false.
*/ */
has: function(option) { has: function(option) {
return (this.options[option]); return this.options[option];
}, },
/** /**
@ -190,7 +200,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
} }
} else { } else {
this.options[option] = value; this.options[option] = value;
this.onChange(option, value) this.onChange(option, value);
} }
}, },
@ -255,11 +265,15 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
onChange: function(option, newValue, oldValue) { onChange: function(option, newValue, oldValue) {
// If we don't have a bind there's nothing to do. // If we don't have a bind there's nothing to do.
if (Ext.isEmpty(this.binds[option])) return; if (Ext.isEmpty(this.binds[option])) return;
Ext.each(this.binds[option], function(bind) { Ext.each(
this.binds[option],
function(bind) {
// The field is currently focused so we do not want to change it. // The field is currently focused so we do not want to change it.
if (bind == this.focused) return; if (bind == this.focused) return;
// Set the form field to the new value. // Set the form field to the new value.
bind.setValue(newValue); bind.setValue(newValue);
}, this); },
} this
);
},
}); });

View File

@ -14,7 +14,6 @@ Ext.ns('Deluge');
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.OtherLimitWindow = Ext.extend(Ext.Window, { Deluge.OtherLimitWindow = Ext.extend(Ext.Window, {
layout: 'fit', layout: 'fit',
width: 210, width: 210,
height: 100, height: 100,
@ -29,19 +28,21 @@ Deluge.OtherLimitWindow = Ext.extend(Ext.Window, {
bodyStyle: 'padding: 5px', bodyStyle: 'padding: 5px',
layout: 'hbox', layout: 'hbox',
layoutConfig: { layoutConfig: {
pack: 'start' pack: 'start',
}, },
items: [{ items: [
{
xtype: 'spinnerfield', xtype: 'spinnerfield',
name: 'limit' name: 'limit',
}] },
],
}); });
if (this.initialConfig.unit) { if (this.initialConfig.unit) {
this.form.add({ this.form.add({
border: false, border: false,
baseCls: 'x-plain', baseCls: 'x-plain',
bodyStyle: 'padding: 5px', bodyStyle: 'padding: 5px',
html: this.initialConfig.unit html: this.initialConfig.unit,
}); });
} else { } else {
this.setSize(180, 100); this.setSize(180, 100);
@ -67,12 +68,15 @@ Deluge.OtherLimitWindow = Ext.extend(Ext.Window, {
deluge.client.core.set_config(config, { deluge.client.core.set_config(config, {
success: function() { success: function() {
deluge.ui.update(); deluge.ui.update();
} },
}); });
this.hide(); this.hide();
}, },
doFocusField: function() { doFocusField: function() {
this.form.getForm().findField('limit').focus(true, 10); this.form
} .getForm()
.findField('limit')
.focus(true, 10);
},
}); });

View File

@ -14,7 +14,6 @@ Ext.ns('Deluge');
* @extends Ext.util.Observable * @extends Ext.util.Observable
*/ */
Deluge.Plugin = Ext.extend(Ext.util.Observable, { Deluge.Plugin = Ext.extend(Ext.util.Observable, {
/** /**
* The plugins name * The plugins name
* @property name * @property name
@ -29,13 +28,13 @@ Deluge.Plugin = Ext.extend(Ext.util.Observable, {
* @event enabled * @event enabled
* @param {Plugin} plugin the plugin instance * @param {Plugin} plugin the plugin instance
*/ */
'enabled': true, enabled: true,
/** /**
* @event disabled * @event disabled
* @param {Plugin} plugin the plugin instance * @param {Plugin} plugin the plugin instance
*/ */
'disabled': true disabled: true,
}); });
Deluge.Plugin.superclass.constructor.call(this, config); Deluge.Plugin.superclass.constructor.call(this, config);
}, },
@ -61,14 +60,15 @@ Deluge.Plugin = Ext.extend(Ext.util.Observable, {
registerTorrentStatus: function(key, header, options) { registerTorrentStatus: function(key, header, options) {
options = options || {}; options = options || {};
var cc = options.colCfg || {}, sc = options.storeCfg || {}; var cc = options.colCfg || {},
sc = options.storeCfg || {};
sc = Ext.apply(sc, { name: key }); sc = Ext.apply(sc, { name: key });
deluge.torrents.meta.fields.push(sc); deluge.torrents.meta.fields.push(sc);
deluge.torrents.getStore().reader.onMetaChange(deluge.torrents.meta); deluge.torrents.getStore().reader.onMetaChange(deluge.torrents.meta);
cc = Ext.apply(cc, { cc = Ext.apply(cc, {
header: header, header: header,
dataIndex: key dataIndex: key,
}); });
var cols = deluge.torrents.columns.slice(0); var cols = deluge.torrents.columns.slice(0);
cols.push(cc); cols.push(cc);
@ -100,7 +100,7 @@ Deluge.Plugin = Ext.extend(Ext.util.Observable, {
}); });
Deluge.Keys.Grid = keys; Deluge.Keys.Grid = keys;
deluge.torrents.getView().refresh(true); deluge.torrents.getView().refresh(true);
} },
}); });
Ext.ns('Deluge.plugins'); Ext.ns('Deluge.plugins');

View File

@ -13,7 +13,6 @@
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.RemoveWindow = Ext.extend(Ext.Window, { Deluge.RemoveWindow = Ext.extend(Ext.Window, {
title: _('Remove Torrent'), title: _('Remove Torrent'),
layout: 'fit', layout: 'fit',
width: 350, width: 350,
@ -39,12 +38,14 @@ Deluge.RemoveWindow = Ext.extend(Ext.Window, {
deluge.client.core.remove_torrents(this.torrentIds, removeData, { deluge.client.core.remove_torrents(this.torrentIds, removeData, {
success: function(result) { success: function(result) {
if (result == true) { if (result == true) {
console.log('Error(s) occured when trying to delete torrent(s).'); console.log(
'Error(s) occured when trying to delete torrent(s).'
);
} }
this.onRemoved(this.torrentIds); this.onRemoved(this.torrentIds);
}, },
scope: this, scope: this,
torrentIds: this.torrentIds torrentIds: this.torrentIds,
}); });
}, },
@ -70,7 +71,7 @@ Deluge.RemoveWindow = Ext.extend(Ext.Window, {
deluge.events.fire('torrentsRemoved', torrentIds); deluge.events.fire('torrentsRemoved', torrentIds);
this.hide(); this.hide();
deluge.ui.update(); deluge.ui.update();
} },
}); });
deluge.removeWindow = new Deluge.RemoveWindow(); deluge.removeWindow = new Deluge.RemoveWindow();

View File

@ -18,7 +18,6 @@
* @version 1.3 * @version 1.3
*/ */
Deluge.Sidebar = Ext.extend(Ext.Panel, { Deluge.Sidebar = Ext.extend(Ext.Panel, {
// private // private
panels: {}, panels: {},
@ -26,7 +25,8 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
selected: null, selected: null,
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
{
id: 'sidebar', id: 'sidebar',
region: 'west', region: 'west',
cls: 'deluge-sidebar', cls: 'deluge-sidebar',
@ -35,8 +35,10 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
split: true, split: true,
width: 200, width: 200,
minSize: 100, minSize: 100,
collapsible: true collapsible: true,
}, config); },
config
);
Deluge.Sidebar.superclass.constructor.call(this, config); Deluge.Sidebar.superclass.constructor.call(this, config);
}, },
@ -48,7 +50,7 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
createFilter: function(filter, states) { createFilter: function(filter, states) {
var panel = new Deluge.FilterPanel({ var panel = new Deluge.FilterPanel({
filter: filter filter: filter,
}); });
panel.on('selectionchange', function(view, nodes) { panel.on('selectionchange', function(view, nodes) {
deluge.ui.update(); deluge.ui.update();
@ -77,7 +79,7 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
}, },
getFilterStates: function() { getFilterStates: function() {
var states = {} var states = {};
if (deluge.config.sidebar_multiple_filters) { if (deluge.config.sidebar_multiple_filters) {
// Grab the filters from each of the filter panels // Grab the filters from each of the filter panels
@ -99,7 +101,7 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
}, },
hasFilter: function(filter) { hasFilter: function(filter) {
return (this.panels[filter]) ? true : false; return this.panels[filter] ? true : false;
}, },
// private // private
@ -126,13 +128,17 @@ Deluge.Sidebar = Ext.extend(Ext.Panel, {
} }
// Perform a cleanup of fitlers that are not enabled any more. // Perform a cleanup of fitlers that are not enabled any more.
Ext.each(Ext.keys(this.panels), function(filter) { Ext.each(
Ext.keys(this.panels),
function(filter) {
if (Ext.keys(filters).indexOf(filter) == -1) { if (Ext.keys(filters).indexOf(filter) == -1) {
// We need to remove the panel // We need to remove the panel
this.remove(this.panels[filter]); this.remove(this.panels[filter]);
this.doLayout(); this.doLayout();
delete this.panels[filter]; delete this.panels[filter];
} }
}, this); },
} this
);
},
}); });

View File

@ -11,11 +11,14 @@ Ext.namespace('Deluge');
Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, { Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
{
id: 'deluge-statusbar', id: 'deluge-statusbar',
defaultIconCls: 'x-deluge-statusbar x-not-connected', defaultIconCls: 'x-deluge-statusbar x-not-connected',
defaultText: _('Not Connected') defaultText: _('Not Connected'),
}, config); },
config
);
Deluge.Statusbar.superclass.constructor.call(this, config); Deluge.Statusbar.superclass.constructor.call(this, config);
}, },
@ -27,150 +30,184 @@ Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, {
}, },
createButtons: function() { createButtons: function() {
this.buttons = this.add({ this.buttons = this.add(
{
id: 'statusbar-connections', id: 'statusbar-connections',
text: ' ', text: ' ',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
iconCls: 'x-deluge-connections', iconCls: 'x-deluge-connections',
tooltip: _('Connections'), tooltip: _('Connections'),
menu: new Deluge.StatusbarMenu({ menu: new Deluge.StatusbarMenu({
items: [{ items: [
{
text: '50', text: '50',
value: '50', value: '50',
group: 'max_connections_global', group: 'max_connections_global',
checked: false checked: false,
},{ },
{
text: '100', text: '100',
value: '100', value: '100',
group: 'max_connections_global', group: 'max_connections_global',
checked: false checked: false,
},{ },
{
text: '200', text: '200',
value: '200', value: '200',
group: 'max_connections_global', group: 'max_connections_global',
checked: false checked: false,
},{ },
{
text: '300', text: '300',
value: '300', value: '300',
group: 'max_connections_global', group: 'max_connections_global',
checked: false checked: false,
},{ },
{
text: '500', text: '500',
value: '500', value: '500',
group: 'max_connections_global', group: 'max_connections_global',
checked: false checked: false,
},{ },
{
text: _('Unlimited'), text: _('Unlimited'),
value: '-1', value: '-1',
group: 'max_connections_global', group: 'max_connections_global',
checked: false checked: false,
},'-',{ },
'-',
{
text: _('Other'), text: _('Other'),
value: 'other', value: 'other',
group: 'max_connections_global', group: 'max_connections_global',
checked: false checked: false,
}], },
],
otherWin: { otherWin: {
title: _('Set Maximum Connections') title: _('Set Maximum Connections'),
} },
}) }),
}, '-', { },
'-',
{
id: 'statusbar-downspeed', id: 'statusbar-downspeed',
text: ' ', text: ' ',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
iconCls: 'x-deluge-downloading', iconCls: 'x-deluge-downloading',
tooltip: _('Download Speed'), tooltip: _('Download Speed'),
menu: new Deluge.StatusbarMenu({ menu: new Deluge.StatusbarMenu({
items: [{ items: [
{
value: '5', value: '5',
text: _('5 KiB/s'), text: _('5 KiB/s'),
group: 'max_download_speed', group: 'max_download_speed',
checked: false checked: false,
},{ },
{
value: '10', value: '10',
text: _('10 KiB/s'), text: _('10 KiB/s'),
group: 'max_download_speed', group: 'max_download_speed',
checked: false checked: false,
},{ },
{
value: '30', value: '30',
text: _('30 KiB/s'), text: _('30 KiB/s'),
group: 'max_download_speed', group: 'max_download_speed',
checked: false checked: false,
},{ },
{
value: '80', value: '80',
text: _('80 KiB/s'), text: _('80 KiB/s'),
group: 'max_download_speed', group: 'max_download_speed',
checked: false checked: false,
},{ },
{
value: '300', value: '300',
text: _('300 KiB/s'), text: _('300 KiB/s'),
group: 'max_download_speed', group: 'max_download_speed',
checked: false checked: false,
},{ },
{
value: '-1', value: '-1',
text: _('Unlimited'), text: _('Unlimited'),
group: 'max_download_speed', group: 'max_download_speed',
checked: false checked: false,
},'-',{ },
'-',
{
value: 'other', value: 'other',
text: _('Other'), text: _('Other'),
group: 'max_download_speed', group: 'max_download_speed',
checked: false checked: false,
}], },
],
otherWin: { otherWin: {
title: _('Set Maximum Download Speed'), title: _('Set Maximum Download Speed'),
unit: _('KiB/s') unit: _('KiB/s'),
} },
}) }),
}, '-', { },
'-',
{
id: 'statusbar-upspeed', id: 'statusbar-upspeed',
text: ' ', text: ' ',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
iconCls: 'x-deluge-seeding', iconCls: 'x-deluge-seeding',
tooltip: _('Upload Speed'), tooltip: _('Upload Speed'),
menu: new Deluge.StatusbarMenu({ menu: new Deluge.StatusbarMenu({
items: [{ items: [
{
value: '5', value: '5',
text: _('5 KiB/s'), text: _('5 KiB/s'),
group: 'max_upload_speed', group: 'max_upload_speed',
checked: false checked: false,
},{ },
{
value: '10', value: '10',
text: _('10 KiB/s'), text: _('10 KiB/s'),
group: 'max_upload_speed', group: 'max_upload_speed',
checked: false checked: false,
},{ },
{
value: '30', value: '30',
text: _('30 KiB/s'), text: _('30 KiB/s'),
group: 'max_upload_speed', group: 'max_upload_speed',
checked: false checked: false,
},{ },
{
value: '80', value: '80',
text: _('80 KiB/s'), text: _('80 KiB/s'),
group: 'max_upload_speed', group: 'max_upload_speed',
checked: false checked: false,
},{ },
{
value: '300', value: '300',
text: _('300 KiB/s'), text: _('300 KiB/s'),
group: 'max_upload_speed', group: 'max_upload_speed',
checked: false checked: false,
},{ },
{
value: '-1', value: '-1',
text: _('Unlimited'), text: _('Unlimited'),
group: 'max_upload_speed', group: 'max_upload_speed',
checked: false checked: false,
},'-',{ },
'-',
{
value: 'other', value: 'other',
text: _('Other'), text: _('Other'),
group: 'max_upload_speed', group: 'max_upload_speed',
checked: false checked: false,
}], },
],
otherWin: { otherWin: {
title: _('Set Maximum Upload Speed'), title: _('Set Maximum Upload Speed'),
unit: _('KiB/s') unit: _('KiB/s'),
} },
}) }),
}, '-', { },
'-',
{
id: 'statusbar-traffic', id: 'statusbar-traffic',
text: ' ', text: ' ',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
@ -179,19 +216,25 @@ Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, {
handler: function() { handler: function() {
deluge.preferences.show(); deluge.preferences.show();
deluge.preferences.selectPage('Network'); deluge.preferences.selectPage('Network');
} },
}, '-', { },
'-',
{
id: 'statusbar-externalip', id: 'statusbar-externalip',
text: ' ', text: ' ',
cls: 'x-btn-text', cls: 'x-btn-text',
tooltip: _('External IP Address') tooltip: _('External IP Address'),
}, '-', { },
'-',
{
id: 'statusbar-dht', id: 'statusbar-dht',
text: ' ', text: ' ',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
iconCls: 'x-deluge-dht', iconCls: 'x-deluge-dht',
tooltip: _('DHT Nodes') tooltip: _('DHT Nodes'),
}, '-', { },
'-',
{
id: 'statusbar-freespace', id: 'statusbar-freespace',
text: ' ', text: ' ',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
@ -200,15 +243,16 @@ Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, {
handler: function() { handler: function() {
deluge.preferences.show(); deluge.preferences.show();
deluge.preferences.selectPage('Downloads'); deluge.preferences.selectPage('Downloads');
},
} }
}); );
this.created = true; this.created = true;
}, },
onConnect: function() { onConnect: function() {
this.setStatus({ this.setStatus({
iconCls: 'x-connected', iconCls: 'x-connected',
text: '' text: '',
}); });
if (!this.created) { if (!this.created) {
this.createButtons(); this.createButtons();
@ -233,16 +277,24 @@ Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, {
update: function(stats) { update: function(stats) {
if (!stats) return; if (!stats) return;
function addSpeed(val) {return val + ' KiB/s'} function addSpeed(val) {
return val + ' KiB/s';
}
var updateStat = function(name, config) { var updateStat = function(name, config) {
var item = this.items.get('statusbar-' + name); var item = this.items.get('statusbar-' + name);
if (config.limit.value > 0) { if (config.limit.value > 0) {
var value = (config.value.formatter) ? config.value.formatter(config.value.value, true) : config.value.value; var value = config.value.formatter
var limit = (config.limit.formatter) ? config.limit.formatter(config.limit.value, true) : config.limit.value; ? config.value.formatter(config.value.value, true)
: config.value.value;
var limit = config.limit.formatter
? config.limit.formatter(config.limit.value, true)
: config.limit.value;
var str = String.format(config.format, value, limit); var str = String.format(config.format, value, limit);
} else { } else {
var str = (config.value.formatter) ? config.value.formatter(config.value.value, true) : config.value.value; var str = config.value.formatter
? config.value.formatter(config.value.value, true)
: config.value.value;
} }
item.setText(str); item.setText(str);
@ -253,48 +305,58 @@ Deluge.Statusbar = Ext.extend(Ext.ux.StatusBar, {
updateStat('connections', { updateStat('connections', {
value: { value: stats.num_connections }, value: { value: stats.num_connections },
limit: { value: stats.max_num_connections }, limit: { value: stats.max_num_connections },
format: '{0} ({1})' format: '{0} ({1})',
}); });
updateStat('downspeed', { updateStat('downspeed', {
value: { value: {
value: stats.download_rate, value: stats.download_rate,
formatter: Deluge.Formatters.speed formatter: Deluge.Formatters.speed,
}, },
limit: { limit: {
value: stats.max_download, value: stats.max_download,
formatter: addSpeed formatter: addSpeed,
}, },
format: '{0} ({1})' format: '{0} ({1})',
}); });
updateStat('upspeed', { updateStat('upspeed', {
value: { value: {
value: stats.upload_rate, value: stats.upload_rate,
formatter: Deluge.Formatters.speed formatter: Deluge.Formatters.speed,
}, },
limit: { limit: {
value: stats.max_upload, value: stats.max_upload,
formatter: addSpeed formatter: addSpeed,
}, },
format: '{0} ({1})' format: '{0} ({1})',
}); });
updateStat('traffic', { updateStat('traffic', {
value: { value: {
value: stats.download_protocol_rate, value: stats.download_protocol_rate,
formatter: Deluge.Formatters.speed formatter: Deluge.Formatters.speed,
}, },
limit: { limit: {
value: stats.upload_protocol_rate, value: stats.upload_protocol_rate,
formatter: Deluge.Formatters.speed formatter: Deluge.Formatters.speed,
}, },
format: '{0}/{1}' format: '{0}/{1}',
}); });
this.items.get('statusbar-dht').setText(stats.dht_nodes); this.items.get('statusbar-dht').setText(stats.dht_nodes);
this.items.get('statusbar-freespace').setText(stats.free_space >= 0 ? fsize(stats.free_space): _('Error')); this.items
this.items.get('statusbar-externalip').setText( .get('statusbar-freespace')
String.format(_('<b>IP</b> {0}'), stats.external_ip ? stats.external_ip: _("n/a"))); .setText(
} stats.free_space >= 0 ? fsize(stats.free_space) : _('Error')
);
this.items
.get('statusbar-externalip')
.setText(
String.format(
_('<b>IP</b> {0}'),
stats.external_ip ? stats.external_ip : _('n/a')
)
);
},
}); });

View File

@ -15,10 +15,11 @@ Ext.ns('Deluge');
* @extends Ext.menu.Menu * @extends Ext.menu.Menu
*/ */
Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, { Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
initComponent: function() { initComponent: function() {
Deluge.StatusbarMenu.superclass.initComponent.call(this); Deluge.StatusbarMenu.superclass.initComponent.call(this);
this.otherWin = new Deluge.OtherLimitWindow(this.initialConfig.otherWin || {}); this.otherWin = new Deluge.OtherLimitWindow(
this.initialConfig.otherWin || {}
);
this.items.each(function(item) { this.items.each(function(item) {
if (item.getXType() != 'menucheckitem') return; if (item.getXType() != 'menucheckitem') return;
@ -33,7 +34,7 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
setValue: function(value) { setValue: function(value) {
var beenSet = false; var beenSet = false;
// set the new value // set the new value
this.value = value = (value == 0) ? -1 : value; this.value = value = value == 0 ? -1 : value;
var other = null; var other = null;
// uncheck all items // uncheck all items
@ -61,12 +62,12 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
onLimitChanged: function(item, checked) { onLimitChanged: function(item, checked) {
if (!checked || item.value == 'other') return; // We do not care about unchecked or other. if (!checked || item.value == 'other') return; // We do not care about unchecked or other.
var config = {} var config = {};
config[item.group] = item.value config[item.group] = item.value;
deluge.client.core.set_config(config, { deluge.client.core.set_config(config, {
success: function() { success: function() {
deluge.ui.update(); deluge.ui.update();
} },
}); });
}, },
@ -74,5 +75,5 @@ Deluge.StatusbarMenu = Ext.extend(Ext.menu.Menu, {
this.otherWin.group = item.group; this.otherWin.group = item.group;
this.otherWin.setValue(this.value); this.otherWin.setValue(this.value);
this.otherWin.show(); this.otherWin.show();
} },
}); });

View File

@ -15,92 +15,108 @@
*/ */
Deluge.Toolbar = Ext.extend(Ext.Toolbar, { Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
{
items: [ items: [
{ {
id: 'tbar-deluge-text', id: 'tbar-deluge-text',
disabled: true, disabled: true,
text: _('Deluge'), text: _('Deluge'),
iconCls: 'x-deluge-main-panel' iconCls: 'x-deluge-main-panel',
}, new Ext.Toolbar.Separator(), },
new Ext.Toolbar.Separator(),
{ {
id: 'create', id: 'create',
disabled: true, disabled: true,
hidden: true, hidden: true,
text: _('Create'), text: _('Create'),
iconCls: 'icon-create', iconCls: 'icon-create',
handler: this.onTorrentAction handler: this.onTorrentAction,
},{ },
{
id: 'add', id: 'add',
disabled: true, disabled: true,
text: _('Add'), text: _('Add'),
iconCls: 'icon-add', iconCls: 'icon-add',
handler: this.onTorrentAdd handler: this.onTorrentAdd,
},{ },
{
id: 'remove', id: 'remove',
disabled: true, disabled: true,
text: _('Remove'), text: _('Remove'),
iconCls: 'icon-remove', iconCls: 'icon-remove',
handler: this.onTorrentAction handler: this.onTorrentAction,
}, new Ext.Toolbar.Separator(),{ },
new Ext.Toolbar.Separator(),
{
id: 'pause', id: 'pause',
disabled: true, disabled: true,
text: _('Pause'), text: _('Pause'),
iconCls: 'icon-pause', iconCls: 'icon-pause',
handler: this.onTorrentAction handler: this.onTorrentAction,
},{ },
{
id: 'resume', id: 'resume',
disabled: true, disabled: true,
text: _('Resume'), text: _('Resume'),
iconCls: 'icon-resume', iconCls: 'icon-resume',
handler: this.onTorrentAction handler: this.onTorrentAction,
}, new Ext.Toolbar.Separator(),{ },
new Ext.Toolbar.Separator(),
{
id: 'up', id: 'up',
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
disabled: true, disabled: true,
text: _('Up'), text: _('Up'),
iconCls: 'icon-up', iconCls: 'icon-up',
handler: this.onTorrentAction handler: this.onTorrentAction,
},{ },
{
id: 'down', id: 'down',
disabled: true, disabled: true,
text: _('Down'), text: _('Down'),
iconCls: 'icon-down', iconCls: 'icon-down',
handler: this.onTorrentAction handler: this.onTorrentAction,
}, new Ext.Toolbar.Separator(),{ },
new Ext.Toolbar.Separator(),
{
id: 'preferences', id: 'preferences',
text: _('Preferences'), text: _('Preferences'),
iconCls: 'x-deluge-preferences', iconCls: 'x-deluge-preferences',
handler: this.onPreferencesClick, handler: this.onPreferencesClick,
scope: this scope: this,
},{ },
{
id: 'connectionman', id: 'connectionman',
text: _('Connection Manager'), text: _('Connection Manager'),
iconCls: 'x-deluge-connection-manager', iconCls: 'x-deluge-connection-manager',
handler: this.onConnectionManagerClick, handler: this.onConnectionManagerClick,
scope: this scope: this,
},'->',{ },
'->',
{
id: 'help', id: 'help',
iconCls: 'icon-help', iconCls: 'icon-help',
text: _('Help'), text: _('Help'),
handler: this.onHelpClick, handler: this.onHelpClick,
scope: this scope: this,
},{ },
{
id: 'logout', id: 'logout',
iconCls: 'icon-logout', iconCls: 'icon-logout',
disabled: true, disabled: true,
text: _('Logout'), text: _('Logout'),
handler: this.onLogout, handler: this.onLogout,
scope: this scope: this,
} },
] ],
}, config); },
config
);
Deluge.Toolbar.superclass.constructor.call(this, config); Deluge.Toolbar.superclass.constructor.call(this, config);
}, },
connectedButtons: [ connectedButtons: ['add', 'remove', 'pause', 'resume', 'up', 'down'],
'add', 'remove', 'pause', 'resume', 'up', 'down'
],
initComponent: function() { initComponent: function() {
Deluge.Toolbar.superclass.initComponent.call(this); Deluge.Toolbar.superclass.initComponent.call(this);
@ -109,15 +125,23 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
}, },
onConnect: function() { onConnect: function() {
Ext.each(this.connectedButtons, function(buttonId) { Ext.each(
this.connectedButtons,
function(buttonId) {
this.items.get(buttonId).enable(); this.items.get(buttonId).enable();
}, this); },
this
);
}, },
onDisconnect: function() { onDisconnect: function() {
Ext.each(this.connectedButtons, function(buttonId) { Ext.each(
this.connectedButtons,
function(buttonId) {
this.items.get(buttonId).disable(); this.items.get(buttonId).disable();
}, this); },
this
);
}, },
onLogin: function() { onLogin: function() {
@ -157,7 +181,7 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
deluge.client.core[item.id + '_torrent'](ids, { deluge.client.core[item.id + '_torrent'](ids, {
success: function() { success: function() {
deluge.ui.update(); deluge.ui.update();
} },
}); });
break; break;
case 'up': case 'up':
@ -165,7 +189,7 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
deluge.client.core['queue_' + item.id](ids, { deluge.client.core['queue_' + item.id](ids, {
success: function() { success: function() {
deluge.ui.update(); deluge.ui.update();
} },
}); });
break; break;
} }
@ -173,5 +197,5 @@ Deluge.Toolbar = Ext.extend(Ext.Toolbar, {
onTorrentAdd: function() { onTorrentAdd: function() {
deluge.add.show(); deluge.add.show();
} },
}); });

View File

@ -9,13 +9,16 @@
*/ */
(function() { (function() {
/* Renderers for the Torrent Grid */ /* Renderers for the Torrent Grid */
function queueRenderer(value) { function queueRenderer(value) {
return (value == -1) ? '' : value + 1; return value == -1 ? '' : value + 1;
} }
function torrentNameRenderer(value, p, r) { function torrentNameRenderer(value, p, r) {
return String.format('<div class="torrent-name x-deluge-{0}">{1}</div>', r.data['state'].toLowerCase(), value); return String.format(
'<div class="torrent-name x-deluge-{0}">{1}</div>',
r.data['state'].toLowerCase(),
value
);
} }
function torrentSpeedRenderer(value) { function torrentSpeedRenderer(value) {
if (!value) return; if (!value) return;
@ -30,9 +33,9 @@
var progress = value; var progress = value;
var text = _(r.data['state']) + ' ' + value.toFixed(2) + '%'; var text = _(r.data['state']) + ' ' + value.toFixed(2) + '%';
if (this.style) { if (this.style) {
var style = this.style var style = this.style;
} else { } else {
var style = p.style var style = p.style;
} }
var width = new Number(style.match(/\w+:\s*(\d+)\w+/)[1]); var width = new Number(style.match(/\w+:\s*(\d+)\w+/)[1]);
return Deluge.progressBar(value, width - 8, text); return Deluge.progressBar(value, width - 8, text);
@ -52,10 +55,15 @@
} }
} }
function availRenderer(value, p, r) { function availRenderer(value, p, r) {
return (value < 0) ? '&infin;' : parseFloat(new Number(value).toFixed(3)); return value < 0 ? '&infin;' : parseFloat(new Number(value).toFixed(3));
} }
function trackerRenderer(value, p, r) { function trackerRenderer(value, p, r) {
return String.format('<div style="background: url(' + deluge.config.base + 'tracker/{0}) no-repeat; padding-left: 20px;">{0}</div>', value); return String.format(
'<div style="background: url(' +
deluge.config.base +
'tracker/{0}) no-repeat; padding-left: 20px;">{0}</div>',
value
);
} }
function etaSorter(eta) { function etaSorter(eta) {
@ -63,7 +71,7 @@
} }
function dateOrNever(date) { function dateOrNever(date) {
return date > 0.0 ? fdate(date) : _('Never') return date > 0.0 ? fdate(date) : _('Never');
} }
/** /**
@ -78,194 +86,222 @@
* @param {Object} config Configuration options * @param {Object} config Configuration options
*/ */
Deluge.TorrentGrid = Ext.extend(Ext.grid.GridPanel, { Deluge.TorrentGrid = Ext.extend(Ext.grid.GridPanel, {
// object to store contained torrent ids // object to store contained torrent ids
torrents: {}, torrents: {},
columns: [{ columns: [
{
id: 'queue', id: 'queue',
header: '#', header: '#',
width: 30, width: 30,
sortable: true, sortable: true,
renderer: queueRenderer, renderer: queueRenderer,
dataIndex: 'queue' dataIndex: 'queue',
}, { },
{
id: 'name', id: 'name',
header: _('Name'), header: _('Name'),
width: 150, width: 150,
sortable: true, sortable: true,
renderer: torrentNameRenderer, renderer: torrentNameRenderer,
dataIndex: 'name' dataIndex: 'name',
}, { },
{
header: _('Size'), header: _('Size'),
width: 75, width: 75,
sortable: true, sortable: true,
renderer: fsize, renderer: fsize,
dataIndex: 'total_wanted' dataIndex: 'total_wanted',
}, { },
{
header: _('Progress'), header: _('Progress'),
width: 150, width: 150,
sortable: true, sortable: true,
renderer: torrentProgressRenderer, renderer: torrentProgressRenderer,
dataIndex: 'progress' dataIndex: 'progress',
}, { },
{
header: _('Seeds'), header: _('Seeds'),
hidden: true, hidden: true,
width: 60, width: 60,
sortable: true, sortable: true,
renderer: seedsRenderer, renderer: seedsRenderer,
dataIndex: 'num_seeds' dataIndex: 'num_seeds',
}, { },
{
header: _('Peers'), header: _('Peers'),
hidden: true, hidden: true,
width: 60, width: 60,
sortable: true, sortable: true,
renderer: peersRenderer, renderer: peersRenderer,
dataIndex: 'num_peers' dataIndex: 'num_peers',
}, { },
{
header: _('Down Speed'), header: _('Down Speed'),
width: 80, width: 80,
sortable: true, sortable: true,
renderer: torrentSpeedRenderer, renderer: torrentSpeedRenderer,
dataIndex: 'download_payload_rate' dataIndex: 'download_payload_rate',
}, { },
{
header: _('Up Speed'), header: _('Up Speed'),
width: 80, width: 80,
sortable: true, sortable: true,
renderer: torrentSpeedRenderer, renderer: torrentSpeedRenderer,
dataIndex: 'upload_payload_rate' dataIndex: 'upload_payload_rate',
}, { },
{
header: _('ETA'), header: _('ETA'),
width: 60, width: 60,
sortable: true, sortable: true,
renderer: ftime, renderer: ftime,
dataIndex: 'eta' dataIndex: 'eta',
}, { },
{
header: _('Ratio'), header: _('Ratio'),
hidden: true, hidden: true,
width: 60, width: 60,
sortable: true, sortable: true,
renderer: availRenderer, renderer: availRenderer,
dataIndex: 'ratio' dataIndex: 'ratio',
}, { },
{
header: _('Avail'), header: _('Avail'),
hidden: true, hidden: true,
width: 60, width: 60,
sortable: true, sortable: true,
renderer: availRenderer, renderer: availRenderer,
dataIndex: 'distributed_copies' dataIndex: 'distributed_copies',
}, { },
{
header: _('Added'), header: _('Added'),
hidden: true, hidden: true,
width: 80, width: 80,
sortable: true, sortable: true,
renderer: fdate, renderer: fdate,
dataIndex: 'time_added' dataIndex: 'time_added',
}, { },
{
header: _('Complete Seen'), header: _('Complete Seen'),
hidden: true, hidden: true,
width: 80, width: 80,
sortable: true, sortable: true,
renderer: dateOrNever, renderer: dateOrNever,
dataIndex: 'last_seen_complete' dataIndex: 'last_seen_complete',
}, { },
{
header: _('Completed'), header: _('Completed'),
hidden: true, hidden: true,
width: 80, width: 80,
sortable: true, sortable: true,
renderer: dateOrNever, renderer: dateOrNever,
dataIndex: 'completed_time' dataIndex: 'completed_time',
}, { },
{
header: _('Tracker'), header: _('Tracker'),
hidden: true, hidden: true,
width: 120, width: 120,
sortable: true, sortable: true,
renderer: trackerRenderer, renderer: trackerRenderer,
dataIndex: 'tracker_host' dataIndex: 'tracker_host',
}, { },
{
header: _('Download Folder'), header: _('Download Folder'),
hidden: true, hidden: true,
width: 120, width: 120,
sortable: true, sortable: true,
renderer: fplain, renderer: fplain,
dataIndex: 'download_location' dataIndex: 'download_location',
}, { },
{
header: _('Owner'), header: _('Owner'),
width: 80, width: 80,
sortable: true, sortable: true,
renderer: fplain, renderer: fplain,
dataIndex: 'owner' dataIndex: 'owner',
}, { },
{
header: _('Public'), header: _('Public'),
hidden: true, hidden: true,
width: 80, width: 80,
sortable: true, sortable: true,
renderer: fplain, renderer: fplain,
dataIndex: 'public' dataIndex: 'public',
}, { },
{
header: _('Shared'), header: _('Shared'),
hidden: true, hidden: true,
width: 80, width: 80,
sortable: true, sortable: true,
renderer: fplain, renderer: fplain,
dataIndex: 'shared' dataIndex: 'shared',
}, { },
{
header: _('Downloaded'), header: _('Downloaded'),
hidden: true, hidden: true,
width: 75, width: 75,
sortable: true, sortable: true,
renderer: fsize, renderer: fsize,
dataIndex: 'total_done' dataIndex: 'total_done',
}, { },
{
header: _('Uploaded'), header: _('Uploaded'),
hidden: true, hidden: true,
width: 75, width: 75,
sortable: true, sortable: true,
renderer: fsize, renderer: fsize,
dataIndex: 'total_uploaded' dataIndex: 'total_uploaded',
}, { },
{
header: _('Remaining'), header: _('Remaining'),
hidden: true, hidden: true,
width: 75, width: 75,
sortable: true, sortable: true,
renderer: fsize, renderer: fsize,
dataIndex: 'total_remaining' dataIndex: 'total_remaining',
}, { },
{
header: _('Down Limit'), header: _('Down Limit'),
hidden: true, hidden: true,
width: 75, width: 75,
sortable: true, sortable: true,
renderer: torrentLimitRenderer, renderer: torrentLimitRenderer,
dataIndex: 'max_download_speed' dataIndex: 'max_download_speed',
}, { },
{
header: _('Up Limit'), header: _('Up Limit'),
hidden: true, hidden: true,
width: 75, width: 75,
sortable: true, sortable: true,
renderer: torrentLimitRenderer, renderer: torrentLimitRenderer,
dataIndex: 'max_upload_speed' dataIndex: 'max_upload_speed',
}, { },
{
header: _('Seeds:Peers'), header: _('Seeds:Peers'),
hidden: true, hidden: true,
width: 75, width: 75,
sortable: true, sortable: true,
renderer: availRenderer, renderer: availRenderer,
dataIndex: 'seeds_peers_ratio' dataIndex: 'seeds_peers_ratio',
}, { },
{
header: _('Last Transfer'), header: _('Last Transfer'),
hidden: true, hidden: true,
width: 75, width: 75,
sortable: true, sortable: true,
renderer: ftime, renderer: ftime,
dataIndex: 'time_since_transfer' dataIndex: 'time_since_transfer',
}], },
],
meta: { meta: {
root: 'torrents', root: 'torrents',
idProperty: 'id', idProperty: 'id',
fields: [ fields: [
{name: 'queue', sortType: Deluge.data.SortTypes.asQueuePosition}, {
name: 'queue',
sortType: Deluge.data.SortTypes.asQueuePosition,
},
{ name: 'name', sortType: Deluge.data.SortTypes.asName }, { name: 'name', sortType: Deluge.data.SortTypes.asName },
{ name: 'total_wanted', type: 'int' }, { name: 'total_wanted', type: 'int' },
{ name: 'state' }, { name: 'state' },
@ -288,28 +324,32 @@
{ name: 'max_download_speed', type: 'int' }, { name: 'max_download_speed', type: 'int' },
{ name: 'max_upload_speed', type: 'int' }, { name: 'max_upload_speed', type: 'int' },
{ name: 'seeds_peers_ratio', type: 'float' }, { name: 'seeds_peers_ratio', type: 'float' },
{name: 'time_since_transfer', type: 'int'} { name: 'time_since_transfer', type: 'int' },
] ],
}, },
keys: [{ keys: [
{
key: 'a', key: 'a',
ctrl: true, ctrl: true,
stopEvent: true, stopEvent: true,
handler: function() { handler: function() {
deluge.torrents.getSelectionModel().selectAll(); deluge.torrents.getSelectionModel().selectAll();
} },
}, { },
{
key: [46], key: [46],
stopEvent: true, stopEvent: true,
handler: function() { handler: function() {
ids = deluge.torrents.getSelectedIds(); ids = deluge.torrents.getSelectedIds();
deluge.removeWindow.show(ids); deluge.removeWindow.show(ids);
} },
}], },
],
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
{
id: 'torrentGrid', id: 'torrentGrid',
store: new Ext.data.JsonStore(this.meta), store: new Ext.data.JsonStore(this.meta),
columns: this.columns, columns: this.columns,
@ -324,9 +364,11 @@
stateful: true, stateful: true,
view: new Ext.ux.grid.BufferView({ view: new Ext.ux.grid.BufferView({
rowHeight: 26, rowHeight: 26,
scrollDelay: false scrollDelay: false,
}) }),
}, config); },
config
);
Deluge.TorrentGrid.superclass.constructor.call(this, config); Deluge.TorrentGrid.superclass.constructor.call(this, config);
}, },
@ -375,7 +417,7 @@
* @return {String} The currently selected id. * @return {String} The currently selected id.
*/ */
getSelectedId: function() { getSelectedId: function() {
return this.getSelectionModel().getSelected().id return this.getSelectionModel().getSelected().id;
}, },
/** /**
@ -432,7 +474,7 @@
}, this); }, this);
store.commitChanges(); store.commitChanges();
var sortState = store.getSortState() var sortState = store.getSortState();
if (!sortState) return; if (!sortState) return;
store.sort(sortState.field, sortState.direction); store.sort(sortState.field, sortState.direction);
}, },
@ -446,15 +488,19 @@
// private // private
onTorrentsRemoved: function(torrentIds) { onTorrentsRemoved: function(torrentIds) {
var selModel = this.getSelectionModel(); var selModel = this.getSelectionModel();
Ext.each(torrentIds, function(torrentId) { Ext.each(
torrentIds,
function(torrentId) {
var record = this.getStore().getById(torrentId); var record = this.getStore().getById(torrentId);
if (selModel.isSelected(record)) { if (selModel.isSelected(record)) {
selModel.deselectRow(this.getStore().indexOf(record)); selModel.deselectRow(this.getStore().indexOf(record));
} }
this.getStore().remove(record); this.getStore().remove(record);
delete this.torrents[torrentId]; delete this.torrents[torrentId];
}, this); },
} this
);
},
}); });
deluge.torrents = new Deluge.TorrentGrid(); deluge.torrents = new Deluge.TorrentGrid();
})(); })();

View File

@ -24,7 +24,8 @@ var TORRENT_STATE_TRANSLATION = [
_('Paused'), _('Paused'),
_('Checking'), _('Checking'),
_('Queued'), _('Queued'),
_('Error')]; _('Error'),
];
/** /**
* @static * @static
@ -33,7 +34,6 @@ var TORRENT_STATE_TRANSLATION = [
* together and handles the 2 second poll. * together and handles the 2 second poll.
*/ */
deluge.ui = { deluge.ui = {
errorCount: 0, errorCount: 0,
filters: null, filters: null,
@ -62,9 +62,7 @@ deluge.ui = {
minSize: 100, minSize: 100,
collapsible: true, collapsible: true,
layout: 'fit', layout: 'fit',
items: [ items: [deluge.details],
deluge.details
]
}); });
this.MainPanel = new Ext.Panel({ this.MainPanel = new Ext.Panel({
@ -73,17 +71,13 @@ deluge.ui = {
layout: 'border', layout: 'border',
border: false, border: false,
tbar: deluge.toolbar, tbar: deluge.toolbar,
items: [ items: [deluge.sidebar, this.detailsPanel, deluge.torrents],
deluge.sidebar, bbar: deluge.statusbar,
this.detailsPanel,
deluge.torrents
],
bbar: deluge.statusbar
}); });
this.Viewport = new Ext.Viewport({ this.Viewport = new Ext.Viewport({
layout: 'fit', layout: 'fit',
items: [this.MainPanel] items: [this.MainPanel],
}); });
deluge.events.on('connect', this.onConnect, this); deluge.events.on('connect', this.onConnect, this);
@ -91,7 +85,7 @@ deluge.ui = {
deluge.events.on('PluginDisabledEvent', this.onPluginDisabled, this); deluge.events.on('PluginDisabledEvent', this.onPluginDisabled, this);
deluge.events.on('PluginEnabledEvent', this.onPluginEnabled, this); deluge.events.on('PluginEnabledEvent', this.onPluginEnabled, this);
deluge.client = new Ext.ux.util.RpcClient({ deluge.client = new Ext.ux.util.RpcClient({
url: deluge.config.base + 'json' url: deluge.config.base + 'json',
}); });
// enable all the already active plugins // enable all the already active plugins
@ -104,9 +98,14 @@ deluge.ui = {
// Initialize quicktips so all the tooltip configs start working. // Initialize quicktips so all the tooltip configs start working.
Ext.QuickTips.init(); Ext.QuickTips.init();
deluge.client.on('connected', function(e) { deluge.client.on(
'connected',
function(e) {
deluge.login.show(); deluge.login.show();
}, this, {single: true}); },
this,
{ single: true }
);
this.update = this.update.createDelegate(this); this.update = this.update.createDelegate(this);
this.checkConnection = this.checkConnection.createDelegate(this); this.checkConnection = this.checkConnection.createDelegate(this);
@ -118,7 +117,7 @@ deluge.ui = {
deluge.client.web.connected({ deluge.client.web.connected({
success: this.onConnectionSuccess, success: this.onConnectionSuccess,
failure: this.onConnectionError, failure: this.onConnectionError,
scope: this scope: this,
}); });
}, },
@ -130,19 +129,17 @@ deluge.ui = {
deluge.client.web.update_ui(Deluge.Keys.Grid, filters, { deluge.client.web.update_ui(Deluge.Keys.Grid, filters, {
success: this.onUpdate, success: this.onUpdate,
failure: this.onUpdateError, failure: this.onUpdateError,
scope: this scope: this,
}); });
deluge.details.update(); deluge.details.update();
}, },
onConnectionError: function(error) { onConnectionError: function(error) {},
},
onConnectionSuccess: function(result) { onConnectionSuccess: function(result) {
deluge.statusbar.setStatus({ deluge.statusbar.setStatus({
iconCls: 'x-deluge-statusbar icon-ok', iconCls: 'x-deluge-statusbar icon-ok',
text: _('Connection restored') text: _('Connection restored'),
}); });
clearInterval(this.checking); clearInterval(this.checking);
if (!result) { if (!result) {
@ -156,12 +153,12 @@ deluge.ui = {
title: _('Lost Connection'), title: _('Lost Connection'),
msg: _('The connection to the webserver has been lost!'), msg: _('The connection to the webserver has been lost!'),
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR icon: Ext.MessageBox.ERROR,
}); });
deluge.events.fire('disconnect'); deluge.events.fire('disconnect');
deluge.statusbar.setStatus({ deluge.statusbar.setStatus({
text: _('Lost connection to webserver')} text: _('Lost connection to webserver'),
); });
this.checking = setInterval(this.checkConnection, 2000); this.checking = setInterval(this.checkConnection, 2000);
} }
this.errorCount++; this.errorCount++;
@ -179,8 +176,12 @@ deluge.ui = {
} }
if (deluge.config.show_session_speed) { if (deluge.config.show_session_speed) {
document.title = 'D: ' + fsize_short(data['stats'].download_rate, true) + document.title =
' U: ' + fsize_short(data['stats'].upload_rate, true) + ' - ' + 'D: ' +
fsize_short(data['stats'].download_rate, true) +
' U: ' +
fsize_short(data['stats'].upload_rate, true) +
' - ' +
this.originalTitle; this.originalTitle;
} }
if (Ext.areObjectsEqual(this.filters, this.oldFilters)) { if (Ext.areObjectsEqual(this.filters, this.oldFilters)) {
@ -205,7 +206,7 @@ deluge.ui = {
} }
deluge.client.web.get_plugins({ deluge.client.web.get_plugins({
success: this.onGotPlugins, success: this.onGotPlugins,
scope: this scope: this,
}); });
}, },
@ -218,13 +219,17 @@ deluge.ui = {
}, },
onGotPlugins: function(plugins) { onGotPlugins: function(plugins) {
Ext.each(plugins.enabled_plugins, function(plugin) { Ext.each(
plugins.enabled_plugins,
function(plugin) {
if (deluge.plugins[plugin]) return; if (deluge.plugins[plugin]) return;
deluge.client.web.get_plugin_resources(plugin, { deluge.client.web.get_plugin_resources(plugin, {
success: this.onGotPluginResources, success: this.onGotPluginResources,
scope: this scope: this,
}); });
}, this); },
this
);
}, },
onPluginEnabled: function(pluginName) { onPluginEnabled: function(pluginName) {
@ -233,20 +238,26 @@ deluge.ui = {
} else { } else {
deluge.client.web.get_plugin_resources(pluginName, { deluge.client.web.get_plugin_resources(pluginName, {
success: this.onGotPluginResources, success: this.onGotPluginResources,
scope: this scope: this,
}); });
} }
}, },
onGotPluginResources: function(resources) { onGotPluginResources: function(resources) {
var scripts = (Deluge.debug) ? resources.debug_scripts : resources.scripts; var scripts = Deluge.debug
Ext.each(scripts, function(script) { ? resources.debug_scripts
: resources.scripts;
Ext.each(
scripts,
function(script) {
Ext.ux.JSLoader({ Ext.ux.JSLoader({
url: deluge.config.base + script, url: deluge.config.base + script,
onLoad: this.onPluginLoaded, onLoad: this.onPluginLoaded,
pluginName: resources.name pluginName: resources.name,
}); });
}, this); },
this
);
}, },
onPluginDisabled: function(pluginName) { onPluginDisabled: function(pluginName) {
@ -273,8 +284,8 @@ deluge.ui = {
this.running = false; this.running = false;
deluge.torrents.getStore().removeAll(); deluge.torrents.getStore().removeAll();
} }
} },
} };
Ext.onReady(function(e) { Ext.onReady(function(e) {
deluge.ui.initialize(); deluge.ui.initialize();

View File

@ -13,7 +13,11 @@ Ext.namespace('Deluge.add');
// This override allows file upload buttons to contain icons // This override allows file upload buttons to contain icons
Ext.override(Ext.ux.form.FileUploadField, { Ext.override(Ext.ux.form.FileUploadField, {
onRender: function(ct, position) { onRender: function(ct, position) {
Ext.ux.form.FileUploadField.superclass.onRender.call(this, ct, position); Ext.ux.form.FileUploadField.superclass.onRender.call(
this,
ct,
position
);
this.wrap = this.el.wrap({ cls: 'x-form-field-wrap x-form-file-wrap' }); this.wrap = this.el.wrap({ cls: 'x-form-field-wrap x-form-file-wrap' });
this.el.addClass('x-form-file-text'); this.el.addClass('x-form-file-text');
@ -21,12 +25,16 @@ Ext.override(Ext.ux.form.FileUploadField, {
this.createFileInput(); this.createFileInput();
var btnCfg = Ext.applyIf(this.buttonCfg || {}, { var btnCfg = Ext.applyIf(this.buttonCfg || {}, {
text: this.buttonText text: this.buttonText,
}); });
this.button = new Ext.Button(Ext.apply(btnCfg, { this.button = new Ext.Button(
Ext.apply(btnCfg, {
renderTo: this.wrap, renderTo: this.wrap,
cls: 'x-form-file-btn' + (btnCfg.iconCls ? ' x-btn-text-icon' : '') cls:
})); 'x-form-file-btn' +
(btnCfg.iconCls ? ' x-btn-text-icon' : ''),
})
);
if (this.buttonOnly) { if (this.buttonOnly) {
this.el.hide(); this.el.hide();
@ -35,7 +43,7 @@ Ext.override(Ext.ux.form.FileUploadField, {
this.bindListeners(); this.bindListeners();
this.resizeEl = this.positionEl = this.wrap; this.resizeEl = this.positionEl = this.wrap;
} },
}); });
Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, { Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
@ -58,9 +66,15 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
function torrentRenderer(value, p, r) { function torrentRenderer(value, p, r) {
if (r.data['info_hash']) { if (r.data['info_hash']) {
return String.format('<div class="x-deluge-add-torrent-name">{0}</div>', value); return String.format(
'<div class="x-deluge-add-torrent-name">{0}</div>',
value
);
} else { } else {
return String.format('<div class="x-deluge-add-torrent-name-loading">{0}</div>', value); return String.format(
'<div class="x-deluge-add-torrent-name-loading">{0}</div>',
value
);
} }
} }
@ -68,29 +82,31 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
store: new Ext.data.SimpleStore({ store: new Ext.data.SimpleStore({
fields: [ fields: [
{ name: 'info_hash', mapping: 1 }, { name: 'info_hash', mapping: 1 },
{name: 'text', mapping: 2} { name: 'text', mapping: 2 },
], ],
id: 0 id: 0,
}), }),
columns: [{ columns: [
{
id: 'torrent', id: 'torrent',
width: 150, width: 150,
sortable: true, sortable: true,
renderer: torrentRenderer, renderer: torrentRenderer,
dataIndex: 'text' dataIndex: 'text',
}], },
],
stripeRows: true, stripeRows: true,
singleSelect: true, singleSelect: true,
listeners: { listeners: {
'selectionchange': { selectionchange: {
fn: this.onSelect, fn: this.onSelect,
scope: this scope: this,
} },
}, },
hideHeaders: true, hideHeaders: true,
autoExpandColumn: 'torrent', autoExpandColumn: 'torrent',
height: '100%', height: '100%',
autoScroll: true autoScroll: true,
}); });
this.add({ this.add({
@ -98,43 +114,51 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
items: [this.list], items: [this.list],
border: false, border: false,
bbar: new Ext.Toolbar({ bbar: new Ext.Toolbar({
items: [{ items: [
{
id: 'fileUploadForm', id: 'fileUploadForm',
xtype: 'form', xtype: 'form',
layout: 'fit', layout: 'fit',
baseCls: 'x-plain', baseCls: 'x-plain',
fileUpload: true, fileUpload: true,
items: [{ items: [
{
buttonOnly: true, buttonOnly: true,
xtype: 'fileuploadfield', xtype: 'fileuploadfield',
id: 'torrentFile', id: 'torrentFile',
name: 'file', name: 'file',
buttonCfg: { buttonCfg: {
iconCls: 'x-deluge-add-file', iconCls: 'x-deluge-add-file',
text: _('File') text: _('File'),
}, },
listeners: { listeners: {
scope: this, scope: this,
'fileselected': this.onFileSelected fileselected: this.onFileSelected,
} },
}] },
}, { ],
},
{
text: _('Url'), text: _('Url'),
iconCls: 'icon-add-url', iconCls: 'icon-add-url',
handler: this.onUrl, handler: this.onUrl,
scope: this scope: this,
}, { },
{
text: _('Infohash'), text: _('Infohash'),
iconCls: 'icon-add-magnet', iconCls: 'icon-add-magnet',
hidden: true, hidden: true,
disabled: true disabled: true,
}, '->', { },
'->',
{
text: _('Remove'), text: _('Remove'),
iconCls: 'icon-remove', iconCls: 'icon-remove',
handler: this.onRemove, handler: this.onRemove,
scope: this scope: this,
}] },
}) ],
}),
}); });
this.fileUploadForm = Ext.getCmp('fileUploadForm').getForm(); this.fileUploadForm = Ext.getCmp('fileUploadForm').getForm();
@ -157,13 +181,12 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
var id = r.get('info_hash'); var id = r.get('info_hash');
torrents.push({ torrents.push({
path: this.optionsPanel.getFilename(id), path: this.optionsPanel.getFilename(id),
options: this.optionsPanel.getOptions(id) options: this.optionsPanel.getOptions(id),
}); });
}, this); }, this);
deluge.client.web.add_torrents(torrents, { deluge.client.web.add_torrents(torrents, {
success: function(result) { success: function(result) {},
}
}); });
this.clear(); this.clear();
this.hide(); this.hide();
@ -192,7 +215,8 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
this.list.getStore().remove(torrent); this.list.getStore().remove(torrent);
this.optionsPanel.clear(); this.optionsPanel.clear();
if (this.torrents && this.torrents[torrent.id]) delete this.torrents[torrent.id]; if (this.torrents && this.torrents[torrent.id])
delete this.torrents[torrent.id];
}, },
onSelect: function(list, selections) { onSelect: function(list, selections) {
@ -222,7 +246,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
url: deluge.config.base + 'upload', url: deluge.config.base + 'upload',
waitMsg: _('Uploading your torrent...'), waitMsg: _('Uploading your torrent...'),
success: this.onUploadSuccess, success: this.onUploadSuccess,
scope: this scope: this,
}); });
var name = this.fileUploadForm.findField('torrentFile').value; var name = this.fileUploadForm.findField('torrentFile').value;
name = name.split('\\').slice(-1)[0]; name = name.split('\\').slice(-1)[0];
@ -237,7 +261,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
deluge.client.web.get_torrent_info(filename, { deluge.client.web.get_torrent_info(filename, {
success: this.onGotInfo, success: this.onGotInfo,
scope: this, scope: this,
filename: filename filename: filename,
}); });
} }
}, },
@ -261,7 +285,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
modal: false, modal: false,
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
iconCls: 'x-deluge-icon-error' iconCls: 'x-deluge-icon-error',
}); });
this.list.getStore().remove(r); this.list.getStore().remove(r);
} else { } else {
@ -275,5 +299,5 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
onUrl: function(button, event) { onUrl: function(button, event) {
this.url.show(); this.url.show();
} },
}); });

View File

@ -14,7 +14,6 @@ Ext.ns('Deluge.add');
* @extends Ext.ux.tree.TreeGrid * @extends Ext.ux.tree.TreeGrid
*/ */
Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
layout: 'fit', layout: 'fit',
title: _('Files'), title: _('Files'),
@ -24,29 +23,37 @@ Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
disabled: true, disabled: true,
rootVisible: false, rootVisible: false,
columns: [{ columns: [
{
header: _('Filename'), header: _('Filename'),
width: 295, width: 295,
dataIndex: 'filename' dataIndex: 'filename',
},{ },
{
header: _('Size'), header: _('Size'),
width: 60, width: 60,
dataIndex: 'size', dataIndex: 'size',
tpl: new Ext.XTemplate('{size:this.fsize}', { tpl: new Ext.XTemplate('{size:this.fsize}', {
fsize: function(v) { fsize: function(v) {
return fsize(v); return fsize(v);
} },
}) }),
},{ },
{
header: _('Download'), header: _('Download'),
width: 65, width: 65,
dataIndex: 'download', dataIndex: 'download',
tpl: new Ext.XTemplate('{download:this.format}', { tpl: new Ext.XTemplate('{download:this.format}', {
format: function(v) { format: function(v) {
return '<div rel="chkbox" class="x-grid3-check-col'+(v?'-on':'')+'"> </div>'; return (
} '<div rel="chkbox" class="x-grid3-check-col' +
}) (v ? '-on' : '') +
}], '"> </div>'
);
},
}),
},
],
initComponent: function() { initComponent: function() {
Deluge.add.FilesTab.superclass.initComponent.call(this); Deluge.add.FilesTab.superclass.initComponent.call(this);
@ -88,5 +95,5 @@ Deluge.add.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
if (el.getAttribute('rel') == 'chkbox') { if (el.getAttribute('rel') == 'chkbox') {
this.setDownload(node, !node.attributes.download); this.setDownload(node, !node.attributes.download);
} }
} },
}); });

View File

@ -10,7 +10,6 @@
Ext.ns('Deluge.add'); Ext.ns('Deluge.add');
Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, { Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
torrents: {}, torrents: {},
// layout options // layout options
@ -30,17 +29,24 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
addTorrent: function(torrent) { addTorrent: function(torrent) {
this.torrents[torrent['info_hash']] = torrent; this.torrents[torrent['info_hash']] = torrent;
var fileIndexes = {}; var fileIndexes = {};
this.walkFileTree(torrent['files_tree'], function(filename, type, entry, parent) { this.walkFileTree(
torrent['files_tree'],
function(filename, type, entry, parent) {
if (type != 'file') return; if (type != 'file') return;
fileIndexes[entry.index] = entry.download; fileIndexes[entry.index] = entry.download;
}, this); },
this
);
var priorities = []; var priorities = [];
Ext.each(Ext.keys(fileIndexes), function(index) { Ext.each(Ext.keys(fileIndexes), function(index) {
priorities[index] = fileIndexes[index]; priorities[index] = fileIndexes[index];
}); });
var oldId = this.form.optionsManager.changeId(torrent['info_hash'], true); var oldId = this.form.optionsManager.changeId(
torrent['info_hash'],
true
);
this.form.optionsManager.setDefault('file_priorities', priorities); this.form.optionsManager.setDefault('file_priorities', priorities);
this.form.optionsManager.changeId(oldId, true); this.form.optionsManager.changeId(oldId, true);
}, },
@ -59,7 +65,7 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
var options = this.form.optionsManager.get(); var options = this.form.optionsManager.get();
this.form.optionsManager.changeId(oldId, true); this.form.optionsManager.changeId(oldId, true);
Ext.each(options['file_priorities'], function(priority, index) { Ext.each(options['file_priorities'], function(priority, index) {
options['file_priorities'][index] = (priority) ? 1 : 0; options['file_priorities'][index] = priority ? 1 : 0;
}); });
return options; return options;
}, },
@ -77,17 +83,22 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
this.form.setDisabled(false); this.form.setDisabled(false);
if (this.torrents[torrentId]['files_tree']) { if (this.torrents[torrentId]['files_tree']) {
this.walkFileTree(this.torrents[torrentId]['files_tree'], function(filename, type, entry, parentNode) { this.walkFileTree(
this.torrents[torrentId]['files_tree'],
function(filename, type, entry, parentNode) {
var node = new Ext.tree.TreeNode({ var node = new Ext.tree.TreeNode({
download: (entry.index) ? priorities[entry.index] : true, download: entry.index ? priorities[entry.index] : true,
filename: filename, filename: filename,
fileindex: entry.index, fileindex: entry.index,
leaf: type != 'dir', leaf: type != 'dir',
size: entry.length size: entry.length,
}); });
parentNode.appendChild(node); parentNode.appendChild(node);
if (type == 'dir') return node; if (type == 'dir') return node;
}, this, root); },
this,
root
);
root.firstChild.expand(); root.firstChild.expand();
this.files.setDisabled(false); this.files.setDisabled(false);
this.files.show(); this.files.show();
@ -96,7 +107,6 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
this.form.show(); this.form.show();
this.files.setDisabled(true); this.files.setDisabled(true);
} }
}, },
walkFileTree: function(files, callback, scope, parentNode) { walkFileTree: function(files, callback, scope, parentNode) {
@ -105,7 +115,12 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
var type = entry.type; var type = entry.type;
if (scope) { if (scope) {
var ret = callback.apply(scope, [filename, type, entry, parentNode]); var ret = callback.apply(scope, [
filename,
type,
entry,
parentNode,
]);
} else { } else {
var ret = callback(filename, type, entry, parentNode); var ret = callback(filename, type, entry, parentNode);
} }
@ -115,12 +130,17 @@ Deluge.add.OptionsPanel = Ext.extend(Ext.TabPanel, {
}, },
onFilesChecked: function(nodes, newValue, oldValue) { onFilesChecked: function(nodes, newValue, oldValue) {
Ext.each(nodes, function(node) { Ext.each(
nodes,
function(node) {
if (node.attributes.fileindex < 0) return; if (node.attributes.fileindex < 0) return;
var priorities = this.form.optionsManager.get('file_priorities'); var priorities = this.form.optionsManager.get(
'file_priorities'
);
priorities[node.attributes.fileindex] = newValue; priorities[node.attributes.fileindex] = newValue;
this.form.optionsManager.update('file_priorities', priorities); this.form.optionsManager.update('file_priorities', priorities);
}, this); },
this
} );
},
}); });

View File

@ -14,7 +14,6 @@ Ext.ns('Deluge.add');
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, { Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, {
title: _('Options'), title: _('Options'),
height: 170, height: 170,
border: false, border: false,
@ -35,14 +34,17 @@ Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, {
defaultType: 'textfield', defaultType: 'textfield',
labelWidth: 1, labelWidth: 1,
fieldLabel: '', fieldLabel: '',
style: 'padding: 5px 0; margin-bottom: 0;' style: 'padding: 5px 0; margin-bottom: 0;',
}); });
this.optionsManager.bind('download_location', fieldset.add({ this.optionsManager.bind(
'download_location',
fieldset.add({
fieldLabel: '', fieldLabel: '',
name: 'download_location', name: 'download_location',
anchor: '95%', anchor: '95%',
labelSeparator: '' labelSeparator: '',
})); })
);
var fieldset = this.add({ var fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
title: _('Move Completed Folder'), title: _('Move Completed Folder'),
@ -51,20 +53,20 @@ Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, {
defaultType: 'togglefield', defaultType: 'togglefield',
labelWidth: 1, labelWidth: 1,
fieldLabel: '', fieldLabel: '',
style: 'padding: 5px 0; margin-bottom: 0;' style: 'padding: 5px 0; margin-bottom: 0;',
}); });
var field = fieldset.add({ var field = fieldset.add({
fieldLabel: '', fieldLabel: '',
name: 'move_completed_path', name: 'move_completed_path',
anchor:'98%' anchor: '98%',
}); });
this.optionsManager.bind('move_completed', field.toggle) this.optionsManager.bind('move_completed', field.toggle);
this.optionsManager.bind('move_completed_path', field.input) this.optionsManager.bind('move_completed_path', field.input);
var panel = this.add({ var panel = this.add({
border: false, border: false,
layout: 'column', layout: 'column',
defaultType: 'fieldset' defaultType: 'fieldset',
}); });
fieldset = panel.add({ fieldset = panel.add({
@ -75,95 +77,131 @@ Deluge.add.OptionsTab = Ext.extend(Ext.form.FormPanel, {
labelWidth: 105, labelWidth: 105,
width: 200, width: 200,
defaultType: 'spinnerfield', defaultType: 'spinnerfield',
style: 'padding-right: 10px;' style: 'padding-right: 10px;',
}); });
this.optionsManager.bind('max_download_speed', fieldset.add({ this.optionsManager.bind(
'max_download_speed',
fieldset.add({
fieldLabel: _('Max Down Speed'), fieldLabel: _('Max Down Speed'),
name: 'max_download_speed', name: 'max_download_speed',
width: 60 width: 60,
})); })
this.optionsManager.bind('max_upload_speed', fieldset.add({ );
this.optionsManager.bind(
'max_upload_speed',
fieldset.add({
fieldLabel: _('Max Up Speed'), fieldLabel: _('Max Up Speed'),
name: 'max_upload_speed', name: 'max_upload_speed',
width: 60 width: 60,
})); })
this.optionsManager.bind('max_connections', fieldset.add({ );
this.optionsManager.bind(
'max_connections',
fieldset.add({
fieldLabel: _('Max Connections'), fieldLabel: _('Max Connections'),
name: 'max_connections', name: 'max_connections',
width: 60 width: 60,
})); })
this.optionsManager.bind('max_upload_slots', fieldset.add({ );
this.optionsManager.bind(
'max_upload_slots',
fieldset.add({
fieldLabel: _('Max Upload Slots'), fieldLabel: _('Max Upload Slots'),
name: 'max_upload_slots', name: 'max_upload_slots',
width: 60 width: 60,
})); })
);
fieldset = panel.add({ fieldset = panel.add({
title: _('General'), title: _('General'),
border: false, border: false,
autoHeight: true, autoHeight: true,
defaultType: 'checkbox' defaultType: 'checkbox',
}); });
this.optionsManager.bind('add_paused', fieldset.add({ this.optionsManager.bind(
'add_paused',
fieldset.add({
name: 'add_paused', name: 'add_paused',
boxLabel: _('Add In Paused State'), boxLabel: _('Add In Paused State'),
fieldLabel: '', fieldLabel: '',
labelSeparator: '' labelSeparator: '',
})); })
this.optionsManager.bind('prioritize_first_last_pieces', fieldset.add({ );
this.optionsManager.bind(
'prioritize_first_last_pieces',
fieldset.add({
name: 'prioritize_first_last_pieces', name: 'prioritize_first_last_pieces',
boxLabel: _('Prioritize First/Last Pieces'), boxLabel: _('Prioritize First/Last Pieces'),
fieldLabel: '', fieldLabel: '',
labelSeparator: '' labelSeparator: '',
})); })
this.optionsManager.bind('sequential_download', fieldset.add({ );
this.optionsManager.bind(
'sequential_download',
fieldset.add({
name: 'sequential_download', name: 'sequential_download',
boxLabel: _('Sequential Download'), boxLabel: _('Sequential Download'),
fieldLabel: '', fieldLabel: '',
labelSeparator: '' labelSeparator: '',
})); })
this.optionsManager.bind('seed_mode', fieldset.add({ );
this.optionsManager.bind(
'seed_mode',
fieldset.add({
name: 'seed_mode', name: 'seed_mode',
boxLabel: _('Skip File Hash Check'), boxLabel: _('Skip File Hash Check'),
fieldLabel: '', fieldLabel: '',
labelSeparator: '' labelSeparator: '',
})); })
this.optionsManager.bind('pre_allocate_storage', fieldset.add({ );
this.optionsManager.bind(
'pre_allocate_storage',
fieldset.add({
name: 'pre_allocate_storage', name: 'pre_allocate_storage',
boxLabel: _('Preallocate Disk Space'), boxLabel: _('Preallocate Disk Space'),
fieldLabel: '', fieldLabel: '',
labelSeparator: '' labelSeparator: '',
})); })
);
}, },
getDefaults: function() { getDefaults: function() {
var keys = ['add_paused','pre_allocate_storage','download_location', var keys = [
'max_connections_per_torrent','max_download_speed_per_torrent', 'add_paused',
'move_completed', 'move_completed_path', 'pre_allocate_storage',
'max_upload_slots_per_torrent','max_upload_speed_per_torrent', 'download_location',
'prioritize_first_last_pieces', 'sequential_download']; 'max_connections_per_torrent',
'max_download_speed_per_torrent',
'move_completed',
'move_completed_path',
'max_upload_slots_per_torrent',
'max_upload_speed_per_torrent',
'prioritize_first_last_pieces',
'sequential_download',
];
deluge.client.core.get_config_values(keys, { deluge.client.core.get_config_values(keys, {
success: function(config) { success: function(config) {
var options = { var options = {
'file_priorities': [], file_priorities: [],
'add_paused': config.add_paused, add_paused: config.add_paused,
'sequential_download': config.sequential_download, sequential_download: config.sequential_download,
'pre_allocate_storage': config.pre_allocate_storage, pre_allocate_storage: config.pre_allocate_storage,
'download_location': config.download_location, download_location: config.download_location,
'move_completed': config.move_completed, move_completed: config.move_completed,
'move_completed_path': config.move_completed_path, move_completed_path: config.move_completed_path,
'max_connections': config.max_connections_per_torrent, max_connections: config.max_connections_per_torrent,
'max_download_speed': config.max_download_speed_per_torrent, max_download_speed: config.max_download_speed_per_torrent,
'max_upload_slots': config.max_upload_slots_per_torrent, max_upload_slots: config.max_upload_slots_per_torrent,
'max_upload_speed': config.max_upload_speed_per_torrent, max_upload_speed: config.max_upload_speed_per_torrent,
'prioritize_first_last_pieces': config.prioritize_first_last_pieces, prioritize_first_last_pieces:
'seed_mode': false config.prioritize_first_last_pieces,
} seed_mode: false,
};
this.optionsManager.options = options; this.optionsManager.options = options;
this.optionsManager.resetAll(); this.optionsManager.resetAll();
}, },
scope: this scope: this,
}); });
} },
}); });

View File

@ -10,7 +10,6 @@
Ext.namespace('Deluge.add'); Ext.namespace('Deluge.add');
Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
title: _('Add from Url'), title: _('Add from Url'),
modal: true, modal: true,
plain: true, plain: true,
@ -31,14 +30,14 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
xtype: 'form', xtype: 'form',
defaultType: 'textfield', defaultType: 'textfield',
baseCls: 'x-plain', baseCls: 'x-plain',
labelWidth: 55 labelWidth: 55,
}); });
this.urlField = form.add({ this.urlField = form.add({
fieldLabel: _('Url'), fieldLabel: _('Url'),
id: 'url', id: 'url',
name: 'url', name: 'url',
width: '97%' width: '97%',
}); });
this.urlField.on('specialkey', this.onAdd, this); this.urlField.on('specialkey', this.onAdd, this);
@ -46,13 +45,17 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
fieldLabel: _('Cookies'), fieldLabel: _('Cookies'),
id: 'cookies', id: 'cookies',
name: 'cookies', name: 'cookies',
width: '97%' width: '97%',
}); });
this.cookieField.on('specialkey', this.onAdd, this); this.cookieField.on('specialkey', this.onAdd, this);
}, },
onAddClick: function(field, e) { onAddClick: function(field, e) {
if ((field.id == 'url' || field.id == 'cookies') && e.getKey() != e.ENTER) return; if (
(field.id == 'url' || field.id == 'cookies') &&
e.getKey() != e.ENTER
)
return;
var field = this.urlField; var field = this.urlField;
var url = field.getValue(); var url = field.getValue();
@ -64,13 +67,13 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
success: this.onGotInfo, success: this.onGotInfo,
scope: this, scope: this,
filename: url, filename: url,
torrentId: torrentId torrentId: torrentId,
}); });
} else { } else {
deluge.client.web.download_torrent_from_url(url, cookies, { deluge.client.web.download_torrent_from_url(url, cookies, {
success: this.onDownload, success: this.onDownload,
scope: this, scope: this,
torrentId: torrentId torrentId: torrentId,
}); });
} }
@ -84,12 +87,12 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
success: this.onGotInfo, success: this.onGotInfo,
scope: this, scope: this,
filename: filename, filename: filename,
torrentId: req.options.torrentId torrentId: req.options.torrentId,
}); });
}, },
onGotInfo: function(info, obj, response, request) { onGotInfo: function(info, obj, response, request) {
info['filename'] = request.options.filename; info['filename'] = request.options.filename;
this.fireEvent('add', request.options.torrentId, info); this.fireEvent('add', request.options.torrentId, info);
} },
}); });

View File

@ -17,10 +17,7 @@ Ext.ns('Deluge.add');
Deluge.add.Window = Ext.extend(Ext.Window, { Deluge.add.Window = Ext.extend(Ext.Window, {
initComponent: function() { initComponent: function() {
Deluge.add.Window.superclass.initComponent.call(this); Deluge.add.Window.superclass.initComponent.call(this);
this.addEvents( this.addEvents('beforeadd', 'add');
'beforeadd',
'add'
);
}, },
/** /**
@ -28,5 +25,5 @@ Deluge.add.Window = Ext.extend(Ext.Window, {
*/ */
createTorrentId: function() { createTorrentId: function() {
return new Date().getTime(); return new Date().getTime();
} },
}); });

View File

@ -23,25 +23,31 @@ Ext.namespace('Deluge.data');
Deluge.data.Peer = Ext.data.Record.create([ Deluge.data.Peer = Ext.data.Record.create([
{ {
name: 'country', name: 'country',
type: 'string' type: 'string',
}, { },
{
name: 'ip', name: 'ip',
type: 'string', type: 'string',
sortType: Deluge.data.SortTypes.asIPAddress sortType: Deluge.data.SortTypes.asIPAddress,
}, { },
{
name: 'client', name: 'client',
type: 'string' type: 'string',
}, { },
{
name: 'progress', name: 'progress',
type: 'float' type: 'float',
}, { },
{
name: 'down_speed', name: 'down_speed',
type: 'int' type: 'int',
}, { },
{
name: 'up_speed', name: 'up_speed',
type: 'int' type: 'int',
}, { },
{
name: 'seed', name: 'seed',
type: 'int' type: 'int',
} },
]); ]);

View File

@ -20,15 +20,17 @@ Ext.namespace('Deluge.data');
*/ */
Deluge.data.SortTypes = { Deluge.data.SortTypes = {
asIPAddress: function(value) { asIPAddress: function(value) {
var d = value.match(/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\:(\d+)/); var d = value.match(
return ((((((+d[1])*256)+(+d[2]))*256)+(+d[3]))*256)+(+d[4]); /(\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) { asQueuePosition: function(value) {
return (value > -1) ? value : Number.MAX_VALUE; return value > -1 ? value : Number.MAX_VALUE;
}, },
asName: function(value) { asName: function(value) {
return String(value).toLowerCase(); return String(value).toLowerCase();
} },
} };

View File

@ -20,78 +20,102 @@ Ext.namespace('Deluge.data');
* @constructor * @constructor
* @param {Object} data The torrents data * @param {Object} data The torrents data
*/ */
Deluge.data.Torrent = Ext.data.Record.create([{ Deluge.data.Torrent = Ext.data.Record.create([
{
name: 'queue', name: 'queue',
type: 'int' type: 'int',
}, { },
{
name: 'name', name: 'name',
type: 'string', type: 'string',
sortType: Deluge.data.SortTypes.asName sortType: Deluge.data.SortTypes.asName,
}, { },
{
name: 'total_wanted', name: 'total_wanted',
type: 'int' type: 'int',
}, { },
{
name: 'state', name: 'state',
type: 'string' type: 'string',
}, { },
{
name: 'progress', name: 'progress',
type: 'int' type: 'int',
}, { },
{
name: 'num_seeds', name: 'num_seeds',
type: 'int' type: 'int',
}, { },
{
name: 'total_seeds', name: 'total_seeds',
type: 'int' type: 'int',
}, { },
{
name: 'num_peers', name: 'num_peers',
type: 'int' type: 'int',
}, { },
{
name: 'total_peers', name: 'total_peers',
type: 'int' type: 'int',
}, { },
{
name: 'download_payload_rate', name: 'download_payload_rate',
type: 'int' type: 'int',
}, { },
{
name: 'upload_payload_rate', name: 'upload_payload_rate',
type: 'int' type: 'int',
}, { },
{
name: 'eta', name: 'eta',
type: 'int' type: 'int',
}, { },
{
name: 'ratio', name: 'ratio',
type: 'float' type: 'float',
}, { },
{
name: 'distributed_copies', name: 'distributed_copies',
type: 'float' type: 'float',
}, { },
{
name: 'time_added', name: 'time_added',
type: 'int' type: 'int',
}, { },
{
name: 'tracker_host', name: 'tracker_host',
type: 'string' type: 'string',
}, { },
{
name: 'save_path', name: 'save_path',
type: 'string' type: 'string',
}, { },
{
name: 'total_done', name: 'total_done',
type: 'int' type: 'int',
}, { },
{
name: 'total_uploaded', name: 'total_uploaded',
type: 'int' type: 'int',
}, { },
{
name: 'total_remaining', name: 'total_remaining',
type: 'int' type: 'int',
}, { },
{
name: 'max_download_speed', name: 'max_download_speed',
type: 'int' type: 'int',
}, { },
{
name: 'max_upload_speed', name: 'max_upload_speed',
type: 'int' type: 'int',
}, { },
{
name: 'seeds_peers_ratio', name: 'seeds_peers_ratio',
type: 'float' type: 'float',
}, { },
{
name: 'time_since_transfer', name: 'time_since_transfer',
type: 'int' type: 'int',
} },
]); ]);

View File

@ -13,7 +13,6 @@ Ext.namespace('Deluge.details');
* @class Deluge.details.DetailsPanel * @class Deluge.details.DetailsPanel
*/ */
Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, { Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, {
id: 'torrentDetails', id: 'torrentDetails',
activeTab: 0, activeTab: 0,
@ -35,7 +34,6 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, {
}); });
}, },
update: function(tab) { update: function(tab) {
var torrent = deluge.torrents.getSelected(); var torrent = deluge.torrents.getSelected();
if (!torrent) { if (!torrent) {
@ -55,14 +53,22 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, {
// We need to add the events in onRender since Deluge.Torrents has not been created yet. // We need to add the events in onRender since Deluge.Torrents has not been created yet.
onRender: function(ct, position) { onRender: function(ct, position) {
Deluge.details.DetailsPanel.superclass.onRender.call(this, ct, position); Deluge.details.DetailsPanel.superclass.onRender.call(
this,
ct,
position
);
deluge.events.on('disconnect', this.clear, this); deluge.events.on('disconnect', this.clear, this);
deluge.torrents.on('rowclick', this.onTorrentsClick, this); deluge.torrents.on('rowclick', this.onTorrentsClick, this);
this.on('tabchange', this.onTabChange, this); this.on('tabchange', this.onTabChange, this);
deluge.torrents.getSelectionModel().on('selectionchange', function(selModel) { deluge.torrents.getSelectionModel().on(
'selectionchange',
function(selModel) {
if (!selModel.hasSelection()) this.clear(); if (!selModel.hasSelection()) this.clear();
}, this); },
this
);
}, },
onTabChange: function(panel, tab) { onTabChange: function(panel, tab) {
@ -71,5 +77,5 @@ Deluge.details.DetailsPanel = Ext.extend(Ext.TabPanel, {
onTorrentsClick: function(grid, rowIndex, e) { onTorrentsClick: function(grid, rowIndex, e) {
this.update(); this.update();
} },
}); });

View File

@ -16,7 +16,6 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
autoScroll: true, autoScroll: true,
queuedItems: {}, queuedItems: {},
oldData: {}, oldData: {},
initComponent: function() { initComponent: function() {
@ -53,7 +52,11 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
// private // private
doAddItem: function(id, label) { doAddItem: function(id, label) {
Ext.DomHelper.append(this.dl, { tag: 'dt', cls: id, html: label }); Ext.DomHelper.append(this.dl, { tag: 'dt', cls: id, html: label });
this.fields[id] = Ext.DomHelper.append(this.dl, {tag: 'dd', cls: id, html: ''}, true); this.fields[id] = Ext.DomHelper.append(
this.dl,
{ tag: 'dd', cls: id, html: '' },
true
);
}, },
clear: function() { clear: function() {
@ -61,14 +64,14 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
for (var k in this.fields) { for (var k in this.fields) {
this.fields[k].dom.innerHTML = ''; this.fields[k].dom.innerHTML = '';
} }
this.oldData = {} this.oldData = {};
}, },
update: function(torrentId) { update: function(torrentId) {
deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Details, { deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Details, {
success: this.onRequestComplete, success: this.onRequestComplete,
scope: this, scope: this,
torrentId: torrentId torrentId: torrentId,
}); });
}, },
@ -82,7 +85,7 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
status: torrent.message, status: torrent.message,
tracker: torrent.tracker_host, tracker: torrent.tracker_host,
comment: torrent.comment, comment: torrent.comment,
creator: torrent.creator creator: torrent.creator,
}; };
for (var field in this.fields) { for (var field in this.fields) {
@ -91,5 +94,5 @@ Deluge.details.DetailsTab = Ext.extend(Ext.Panel, {
this.fields[field].dom.innerHTML = Ext.escapeHTML(data[field]); this.fields[field].dom.innerHTML = Ext.escapeHTML(data[field]);
} }
this.oldData = data; this.oldData = data;
} },
}); });

View File

@ -9,48 +9,62 @@
*/ */
Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, { Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
title: _('Files'), title: _('Files'),
rootVisible: false, rootVisible: false,
columns: [{ columns: [
{
header: _('Filename'), header: _('Filename'),
width: 330, width: 330,
dataIndex: 'filename' dataIndex: 'filename',
}, { },
{
header: _('Size'), header: _('Size'),
width: 150, width: 150,
dataIndex: 'size', dataIndex: 'size',
tpl: new Ext.XTemplate('{size:this.fsize}', { tpl: new Ext.XTemplate('{size:this.fsize}', {
fsize: function(v) { return fsize(v); } fsize: function(v) {
}) return fsize(v);
}, { },
}),
},
{
xtype: 'tgrendercolumn', xtype: 'tgrendercolumn',
header: _('Progress'), header: _('Progress'),
width: 150, width: 150,
dataIndex: 'progress', dataIndex: 'progress',
renderer: function(v) { renderer: function(v) {
var progress = v * 100; var progress = v * 100;
return Deluge.progressBar(progress, this.col.width, progress.toFixed(2) + '%', 0); return Deluge.progressBar(
} progress,
}, { this.col.width,
progress.toFixed(2) + '%',
0
);
},
},
{
header: _('Priority'), header: _('Priority'),
width: 150, width: 150,
dataIndex: 'priority', dataIndex: 'priority',
tpl: new Ext.XTemplate('<tpl if="!isNaN(priority)">' + tpl: new Ext.XTemplate(
'<tpl if="!isNaN(priority)">' +
'<div class="{priority:this.getClass}">' + '<div class="{priority:this.getClass}">' +
'{priority:this.getName}' + '{priority:this.getName}' +
'</div></tpl>', { '</div></tpl>',
{
getClass: function(v) { getClass: function(v) {
return FILE_PRIORITY_CSS[v]; return FILE_PRIORITY_CSS[v];
}, },
getName: function(v) { getName: function(v) {
return _(FILE_PRIORITY[v]); return _(FILE_PRIORITY[v]);
},
} }
}) ),
}], },
],
selModel: new Ext.tree.MultiSelectionModel(), selModel: new Ext.tree.MultiSelectionModel(),
@ -75,15 +89,21 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
for (var file in files.contents) { for (var file in files.contents) {
var item = files.contents[file]; var item = files.contents[file];
if (item.type == 'dir') { if (item.type == 'dir') {
walk(item, parentNode.appendChild(new Ext.tree.TreeNode({ walk(
item,
parentNode.appendChild(
new Ext.tree.TreeNode({
text: file, text: file,
filename: file, filename: file,
size: item.size, size: item.size,
progress: item.progress, progress: item.progress,
priority: item.priority priority: item.priority,
}))); })
)
);
} else { } else {
parentNode.appendChild(new Ext.tree.TreeNode({ parentNode.appendChild(
new Ext.tree.TreeNode({
text: file, text: file,
filename: file, filename: file,
fileIndex: item.index, fileIndex: item.index,
@ -92,8 +112,9 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
priority: item.priority, priority: item.priority,
leaf: true, leaf: true,
iconCls: 'x-deluge-file', iconCls: 'x-deluge-file',
uiProvider: Ext.ux.tree.TreeGridNodeUI uiProvider: Ext.ux.tree.TreeGridNodeUI,
})); })
);
} }
} }
} }
@ -111,7 +132,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
deluge.client.web.get_torrent_files(torrentId, { deluge.client.web.get_torrent_files(torrentId, {
success: this.onRequestComplete, success: this.onRequestComplete,
scope: this, scope: this,
torrentId: torrentId torrentId: torrentId,
}); });
}, },
@ -137,7 +158,7 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
deluge.menus.filePriorities.on('itemclick', this.onItemClick, this); deluge.menus.filePriorities.on('itemclick', this.onItemClick, this);
this.on('contextmenu', this.onContextMenu, this); this.on('contextmenu', this.onContextMenu, this);
this.sorter = new Ext.tree.TreeSorter(this, { this.sorter = new Ext.tree.TreeSorter(this, {
folderSort: true folderSort: true,
}); });
}, },
@ -160,7 +181,8 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
var indexes = {}; var indexes = {};
function walk(node) { function walk(node) {
if (Ext.isEmpty(node.attributes.fileIndex)) return; if (Ext.isEmpty(node.attributes.fileIndex)) return;
indexes[node.attributes.fileIndex] = node.attributes.priority; indexes[node.attributes.fileIndex] =
node.attributes.priority;
} }
this.getRootNode().cascade(walk); this.getRootNode().cascade(walk);
@ -169,11 +191,13 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
if (!node.isLeaf()) { if (!node.isLeaf()) {
function setPriorities(node) { function setPriorities(node) {
if (Ext.isEmpty(node.attributes.fileIndex)) return; if (Ext.isEmpty(node.attributes.fileIndex)) return;
indexes[node.attributes.fileIndex] = baseItem.filePriority; indexes[node.attributes.fileIndex] =
baseItem.filePriority;
} }
node.cascade(setPriorities); node.cascade(setPriorities);
} else if (!Ext.isEmpty(node.attributes.fileIndex)) { } else if (!Ext.isEmpty(node.attributes.fileIndex)) {
indexes[node.attributes.fileIndex] = baseItem.filePriority; indexes[node.attributes.fileIndex] =
baseItem.filePriority;
return; return;
} }
}); });
@ -183,14 +207,18 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
priorities[index] = indexes[index]; priorities[index] = indexes[index];
} }
deluge.client.core.set_torrent_options([this.torrentId], {'file_priorities': priorities}, { deluge.client.core.set_torrent_options(
[this.torrentId],
{ file_priorities: priorities },
{
success: function() { success: function() {
Ext.each(nodes, function(node) { Ext.each(nodes, function(node) {
node.setColumnValue(3, baseItem.filePriority); node.setColumnValue(3, baseItem.filePriority);
}); });
}, },
scope: this scope: this,
}); }
);
break; break;
} }
}, },
@ -201,5 +229,5 @@ Deluge.details.FilesTab = Ext.extend(Ext.ux.tree.TreeGrid, {
} else { } else {
this.updateFileTree(files); this.updateFileTree(files);
} }
} },
}); });

View File

@ -8,11 +8,10 @@
* See LICENSE for more details. * See LICENSE for more details.
*/ */
Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, { Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
{
autoScroll: true, autoScroll: true,
bodyStyle: 'padding: 5px;', bodyStyle: 'padding: 5px;',
border: false, border: false,
@ -20,34 +19,36 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
defaults: { defaults: {
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox' defaultType: 'checkbox',
}, },
deferredRender: false, deferredRender: false,
layout: 'column', layout: 'column',
title: _('Options') title: _('Options'),
}, config); },
config
);
Deluge.details.OptionsTab.superclass.constructor.call(this, config); Deluge.details.OptionsTab.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Deluge.details.OptionsTab.superclass.initComponent.call(this); Deluge.details.OptionsTab.superclass.initComponent.call(this);
this.fieldsets = {}, this.fields = {}; (this.fieldsets = {}), (this.fields = {});
this.optionsManager = new Deluge.MultiOptionsManager({ this.optionsManager = new Deluge.MultiOptionsManager({
options: { options: {
'max_download_speed': -1, max_download_speed: -1,
'max_upload_speed': -1, max_upload_speed: -1,
'max_connections': -1, max_connections: -1,
'max_upload_slots': -1, max_upload_slots: -1,
'auto_managed': false, auto_managed: false,
'stop_at_ratio': false, stop_at_ratio: false,
'stop_ratio': 2.0, stop_ratio: 2.0,
'remove_at_ratio': false, remove_at_ratio: false,
'move_completed': false, move_completed: false,
'move_completed_path': '', move_completed_path: '',
'private': false, private: false,
'prioritize_first_last': false prioritize_first_last: false,
} },
}); });
/* /*
@ -64,7 +65,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
style: 'margin-left: 10px; margin-right: 5px; padding: 5px', style: 'margin-left: 10px; margin-right: 5px; padding: 5px',
title: _('Bandwidth'), title: _('Bandwidth'),
width: 250 width: 250,
}); });
/* /*
@ -74,7 +75,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
xtype: 'label', xtype: 'label',
text: _('Max Download Speed:'), text: _('Max Download Speed:'),
forId: 'max_download_speed', forId: 'max_download_speed',
cls: 'x-deluge-options-label' cls: 'x-deluge-options-label',
}); });
this.fields.max_download_speed = this.fieldsets.bandwidth.add({ this.fields.max_download_speed = this.fieldsets.bandwidth.add({
id: 'max_download_speed', id: 'max_download_speed',
@ -84,13 +85,13 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
xtype: 'number', xtype: 'number',
decimalPrecision: 1, decimalPrecision: 1,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
} },
}); });
this.fieldsets.bandwidth.add({ this.fieldsets.bandwidth.add({
xtype: 'label', xtype: 'label',
text: _('KiB/s'), text: _('KiB/s'),
style: 'margin-left: 10px' style: 'margin-left: 10px',
}); });
/* /*
@ -100,7 +101,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
xtype: 'label', xtype: 'label',
text: _('Max Upload Speed:'), text: _('Max Upload Speed:'),
forId: 'max_upload_speed', forId: 'max_upload_speed',
cls: 'x-deluge-options-label' cls: 'x-deluge-options-label',
}); });
this.fields.max_upload_speed = this.fieldsets.bandwidth.add({ this.fields.max_upload_speed = this.fieldsets.bandwidth.add({
id: 'max_upload_speed', id: 'max_upload_speed',
@ -111,13 +112,13 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
xtype: 'number', xtype: 'number',
decimalPrecision: 1, decimalPrecision: 1,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
} },
}); });
this.fieldsets.bandwidth.add({ this.fieldsets.bandwidth.add({
xtype: 'label', xtype: 'label',
text: _('KiB/s'), text: _('KiB/s'),
style: 'margin-left: 10px' style: 'margin-left: 10px',
}); });
/* /*
@ -127,7 +128,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
xtype: 'label', xtype: 'label',
text: _('Max Connections:'), text: _('Max Connections:'),
forId: 'max_connections', forId: 'max_connections',
cls: 'x-deluge-options-label' cls: 'x-deluge-options-label',
}); });
this.fields.max_connections = this.fieldsets.bandwidth.add({ this.fields.max_connections = this.fieldsets.bandwidth.add({
id: 'max_connections', id: 'max_connections',
@ -138,9 +139,9 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
xtype: 'number', xtype: 'number',
decimalPrecision: 0, decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
}, },
colspan: 2 colspan: 2,
}); });
/* /*
@ -150,7 +151,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
xtype: 'label', xtype: 'label',
text: _('Max Upload Slots:'), text: _('Max Upload Slots:'),
forId: 'max_upload_slots', forId: 'max_upload_slots',
cls: 'x-deluge-options-label' cls: 'x-deluge-options-label',
}); });
this.fields.max_upload_slots = this.fieldsets.bandwidth.add({ this.fields.max_upload_slots = this.fieldsets.bandwidth.add({
id: 'max_upload_slots', id: 'max_upload_slots',
@ -161,9 +162,9 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
xtype: 'number', xtype: 'number',
decimalPrecision: 0, decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
}, },
colspan: 2 colspan: 2,
}); });
/* /*
@ -181,8 +182,8 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
defaults: { defaults: {
fieldLabel: '', fieldLabel: '',
labelSeparator: '' labelSeparator: '',
} },
}); });
this.fields.auto_managed = this.fieldsets.queue.add({ this.fields.auto_managed = this.fieldsets.queue.add({
@ -192,7 +193,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
name: 'is_auto_managed', name: 'is_auto_managed',
boxLabel: _('Auto Managed'), boxLabel: _('Auto Managed'),
width: 200, width: 200,
colspan: 2 colspan: 2,
}); });
this.fields.stop_at_ratio = this.fieldsets.queue.add({ this.fields.stop_at_ratio = this.fieldsets.queue.add({
@ -202,7 +203,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
width: 120, width: 120,
boxLabel: _('Stop seed at ratio:'), boxLabel: _('Stop seed at ratio:'),
handler: this.onStopRatioChecked, handler: this.onStopRatioChecked,
scope: this scope: this,
}); });
this.fields.stop_ratio = this.fieldsets.queue.add({ this.fields.stop_ratio = this.fieldsets.queue.add({
@ -218,8 +219,8 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
maxValue: 99999, maxValue: 99999,
incrementValue: 0.1, incrementValue: 0.1,
alternateIncrementValue: 1, alternateIncrementValue: 1,
decimalPrecision: 1 decimalPrecision: 1,
} },
}); });
this.fields.remove_at_ratio = this.fieldsets.queue.add({ this.fields.remove_at_ratio = this.fieldsets.queue.add({
@ -230,7 +231,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
bodyStyle: 'padding-left: 10px', bodyStyle: 'padding-left: 10px',
boxLabel: _('Remove at ratio'), boxLabel: _('Remove at ratio'),
disabled: true, disabled: true,
colspan: 2 colspan: 2,
}); });
this.fields.move_completed = this.fieldsets.queue.add({ this.fields.move_completed = this.fieldsets.queue.add({
@ -240,7 +241,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
boxLabel: _('Move Completed:'), boxLabel: _('Move Completed:'),
colspan: 2, colspan: 2,
handler: this.onMoveCompletedChecked, handler: this.onMoveCompletedChecked,
scope: this scope: this,
}); });
this.fields.move_completed_path = this.fieldsets.queue.add({ this.fields.move_completed_path = this.fieldsets.queue.add({
@ -250,10 +251,9 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
colspan: 3, colspan: 3,
bodyStyle: 'margin-left: 20px', bodyStyle: 'margin-left: 20px',
width: 180, width: 180,
disabled: true disabled: true,
}); });
/* /*
* General Options * General Options
*/ */
@ -261,7 +261,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
autoHeight: true, autoHeight: true,
style: 'margin-left: 5px', style: 'margin-left: 5px',
width: 210 width: 210,
}); });
this.fieldsets.general = this.rightColumn.add({ this.fieldsets.general = this.rightColumn.add({
@ -269,7 +269,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
autoHeight: true, autoHeight: true,
defaultType: 'checkbox', defaultType: 'checkbox',
title: _('General'), title: _('General'),
layout: 'form' layout: 'form',
}); });
this.fields['private'] = this.fieldsets.general.add({ this.fields['private'] = this.fieldsets.general.add({
@ -277,14 +277,14 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
labelSeparator: '', labelSeparator: '',
boxLabel: _('Private'), boxLabel: _('Private'),
id: 'private', id: 'private',
disabled: true disabled: true,
}); });
this.fields.prioritize_first_last = this.fieldsets.general.add({ this.fields.prioritize_first_last = this.fieldsets.general.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('Prioritize First/Last'), boxLabel: _('Prioritize First/Last'),
id: 'prioritize_first_last' id: 'prioritize_first_last',
}); });
// Bind the fields so the options manager can manage them. // Bind the fields so the options manager can manage them.
@ -298,7 +298,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
this.buttonPanel = this.rightColumn.add({ this.buttonPanel = this.rightColumn.add({
layout: 'hbox', layout: 'hbox',
xtype: 'panel', xtype: 'panel',
border: false border: false,
}); });
/* /*
@ -313,7 +313,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
width: 100, width: 100,
handler: this.onEditTrackers, handler: this.onEditTrackers,
scope: this scope: this,
}); });
/* /*
@ -327,7 +327,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
width: 100, width: 100,
handler: this.onApply, handler: this.onApply,
scope: this scope: this,
}); });
}, },
@ -361,7 +361,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
} }
deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Options, { deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Options, {
success: this.onRequestComplete, success: this.onRequestComplete,
scope: this scope: this,
}); });
}, },
@ -371,7 +371,7 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
success: function() { success: function() {
this.optionsManager.commit(); this.optionsManager.commit();
}, },
scope: this scope: this,
}); });
}, },
@ -396,11 +396,14 @@ Deluge.details.OptionsTab = Ext.extend(Ext.form.FormPanel, {
this.fields['private'].setDisabled(true); this.fields['private'].setDisabled(true);
delete torrent['private']; delete torrent['private'];
torrent['auto_managed'] = torrent['is_auto_managed']; torrent['auto_managed'] = torrent['is_auto_managed'];
torrent['prioritize_first_last_pieces'] = torrent['prioritize_first_last']; torrent['prioritize_first_last_pieces'] =
torrent['prioritize_first_last'];
this.optionsManager.setDefault(torrent); this.optionsManager.setDefault(torrent);
var stop_at_ratio = this.optionsManager.get('stop_at_ratio'); var stop_at_ratio = this.optionsManager.get('stop_at_ratio');
this.fields.remove_at_ratio.setDisabled(!stop_at_ratio); this.fields.remove_at_ratio.setDisabled(!stop_at_ratio);
this.fields.stop_ratio.setDisabled(!stop_at_ratio); this.fields.stop_ratio.setDisabled(!stop_at_ratio);
this.fields.move_completed_path.setDisabled(!this.optionsManager.get('move_completed')); this.fields.move_completed_path.setDisabled(
} !this.optionsManager.get('move_completed')
);
},
}); });

View File

@ -13,10 +13,15 @@
if (!value.replace(' ', '').replace(' ', '')) { if (!value.replace(' ', '').replace(' ', '')) {
return ''; return '';
} }
return String.format('<img src="{0}flag/{1}" />', deluge.config.base, value); return String.format(
'<img src="{0}flag/{1}" />',
deluge.config.base,
value
);
} }
function peerAddressRenderer(value, p, record) { function peerAddressRenderer(value, p, record) {
var seed = (record.data['seed'] == 1024) ? 'x-deluge-seed' : 'x-deluge-peer'; var seed =
record.data['seed'] == 1024 ? 'x-deluge-seed' : 'x-deluge-peer';
// Modify display of IPv6 to include brackets // Modify display of IPv6 to include brackets
var peer_ip = value.split(':'); var peer_ip = value.split(':');
if (peer_ip.length > 2) { if (peer_ip.length > 2) {
@ -32,61 +37,73 @@
} }
Deluge.details.PeersTab = Ext.extend(Ext.grid.GridPanel, { Deluge.details.PeersTab = Ext.extend(Ext.grid.GridPanel, {
// fast way to figure out if we have a peer already. // fast way to figure out if we have a peer already.
peers: {}, peers: {},
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
{
title: _('Peers'), title: _('Peers'),
cls: 'x-deluge-peers', cls: 'x-deluge-peers',
store: new Ext.data.Store({ store: new Ext.data.Store({
reader: new Ext.data.JsonReader({ reader: new Ext.data.JsonReader(
{
idProperty: 'ip', idProperty: 'ip',
root: 'peers' root: 'peers',
}, Deluge.data.Peer) },
Deluge.data.Peer
),
}), }),
columns: [{ columns: [
{
header: '&nbsp;', header: '&nbsp;',
width: 30, width: 30,
sortable: true, sortable: true,
renderer: flagRenderer, renderer: flagRenderer,
dataIndex: 'country' dataIndex: 'country',
}, { },
{
header: _('Address'), header: _('Address'),
width: 125, width: 125,
sortable: true, sortable: true,
renderer: peerAddressRenderer, renderer: peerAddressRenderer,
dataIndex: 'ip' dataIndex: 'ip',
}, { },
{
header: _('Client'), header: _('Client'),
width: 125, width: 125,
sortable: true, sortable: true,
renderer: fplain, renderer: fplain,
dataIndex: 'client' dataIndex: 'client',
}, { },
{
header: _('Progress'), header: _('Progress'),
width: 150, width: 150,
sortable: true, sortable: true,
renderer: peerProgressRenderer, renderer: peerProgressRenderer,
dataIndex: 'progress' dataIndex: 'progress',
}, { },
{
header: _('Down Speed'), header: _('Down Speed'),
width: 100, width: 100,
sortable: true, sortable: true,
renderer: fspeed, renderer: fspeed,
dataIndex: 'down_speed' dataIndex: 'down_speed',
}, { },
{
header: _('Up Speed'), header: _('Up Speed'),
width: 100, width: 100,
sortable: true, sortable: true,
renderer: fspeed, renderer: fspeed,
dataIndex: 'up_speed' dataIndex: 'up_speed',
}], },
],
stripeRows: true, stripeRows: true,
deferredRender: false, deferredRender: false,
autoScroll:true autoScroll: true,
}, config); },
config
);
Deluge.details.PeersTab.superclass.constructor.call(this, config); Deluge.details.PeersTab.superclass.constructor.call(this, config);
}, },
@ -98,7 +115,7 @@
update: function(torrentId) { update: function(torrentId) {
deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Peers, { deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Peers, {
success: this.onRequestComplete, success: this.onRequestComplete,
scope: this scope: this,
}); });
}, },
@ -110,7 +127,9 @@
var addresses = {}; var addresses = {};
// Go through the peers updating and creating peer records // Go through the peers updating and creating peer records
Ext.each(torrent.peers, function(peer) { Ext.each(
torrent.peers,
function(peer) {
if (this.peers[peer.ip]) { if (this.peers[peer.ip]) {
var record = store.getById(peer.ip); var record = store.getById(peer.ip);
record.beginEdit(); record.beginEdit();
@ -125,7 +144,9 @@
newPeers.push(new Deluge.data.Peer(peer, peer.ip)); newPeers.push(new Deluge.data.Peer(peer, peer.ip));
} }
addresses[peer.ip] = 1; addresses[peer.ip] = 1;
}, this); },
this
);
store.add(newPeers); store.add(newPeers);
// Remove any peers that should not be left in the store. // Remove any peers that should not be left in the store.
@ -140,6 +161,6 @@
var sortState = store.getSortState(); var sortState = store.getSortState();
if (!sortState) return; if (!sortState) return;
store.sort(sortState.field, sortState.direction); store.sort(sortState.field, sortState.direction);
} },
}); });
})(); })();

View File

@ -22,7 +22,7 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
this.progressBar = this.add({ this.progressBar = this.add({
xtype: 'progress', xtype: 'progress',
cls: 'x-deluge-status-progressbar' cls: 'x-deluge-status-progressbar',
}); });
this.status = this.add({ this.status = this.add({
@ -32,17 +32,19 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
border: false, border: false,
width: 1000, width: 1000,
listeners: { listeners: {
'render': { render: {
fn: function(panel) { fn: function(panel) {
panel.load({ panel.load({
url: deluge.config.base + 'render/tab_status.html', url: deluge.config.base + 'render/tab_status.html',
text: _('Loading') + '...' text: _('Loading') + '...',
}); });
panel.getUpdater().on('update', this.onPanelUpdate, this); panel
.getUpdater()
.on('update', this.onPanelUpdate, this);
},
scope: this,
},
}, },
scope: this
}
}
}); });
}, },
@ -57,31 +59,49 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
if (!this.fields) this.getFields(); if (!this.fields) this.getFields();
deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Status, { deluge.client.web.get_torrent_status(torrentId, Deluge.Keys.Status, {
success: this.onRequestComplete, success: this.onRequestComplete,
scope: this scope: this,
}); });
}, },
onPanelUpdate: function(el, response) { onPanelUpdate: function(el, response) {
this.fields = {}; this.fields = {};
Ext.each(Ext.query('dd', this.status.body.dom), function(field) { Ext.each(
Ext.query('dd', this.status.body.dom),
function(field) {
this.fields[field.className] = field; this.fields[field.className] = field;
}, this); },
this
);
}, },
onRequestComplete: function(status) { onRequestComplete: function(status) {
seeds = status.total_seeds > -1 ? status.num_seeds + ' (' + status.total_seeds + ')' : status.num_seeds; seeds =
peers = status.total_peers > -1 ? status.num_peers + ' (' + status.total_peers + ')' : status.num_peers; status.total_seeds > -1
last_seen_complete = status.last_seen_complete > 0.0 ? fdate(status.last_seen_complete) : 'Never'; ? status.num_seeds + ' (' + status.total_seeds + ')'
completed_time = status.completed_time > 0.0 ? fdate(status.completed_time) : ''; : status.num_seeds;
peers =
status.total_peers > -1
? status.num_peers + ' (' + status.total_peers + ')'
: status.num_peers;
last_seen_complete =
status.last_seen_complete > 0.0
? fdate(status.last_seen_complete)
: 'Never';
completed_time =
status.completed_time > 0.0 ? fdate(status.completed_time) : '';
var data = { var data = {
downloaded: fsize(status.total_done, true), downloaded: fsize(status.total_done, true),
uploaded: fsize(status.total_uploaded, true), uploaded: fsize(status.total_uploaded, true),
share: (status.ratio == -1) ? '&infin;' : status.ratio.toFixed(3), share: status.ratio == -1 ? '&infin;' : status.ratio.toFixed(3),
announce: ftime(status.next_announce), announce: ftime(status.next_announce),
tracker_status: status.tracker_status, tracker_status: status.tracker_status,
downspeed: (status.download_payload_rate) ? fspeed(status.download_payload_rate) : '0.0 KiB/s', downspeed: status.download_payload_rate
upspeed: (status.upload_payload_rate) ? fspeed(status.upload_payload_rate) : '0.0 KiB/s', ? fspeed(status.download_payload_rate)
: '0.0 KiB/s',
upspeed: status.upload_payload_rate
? fspeed(status.upload_payload_rate)
: '0.0 KiB/s',
eta: ftime(status.eta), eta: ftime(status.eta),
pieces: status.num_pieces + ' (' + fsize(status.piece_length) + ')', pieces: status.num_pieces + ' (' + fsize(status.piece_length) + ')',
seeds: seeds, seeds: seeds,
@ -93,30 +113,43 @@ Deluge.details.StatusTab = Ext.extend(Ext.Panel, {
time_added: fdate(status.time_added), time_added: fdate(status.time_added),
last_seen_complete: last_seen_complete, last_seen_complete: last_seen_complete,
completed_time: completed_time, completed_time: completed_time,
time_since_transfer: ftime(status.time_since_transfer) time_since_transfer: ftime(status.time_since_transfer),
} };
data.auto_managed = _((status.is_auto_managed) ? 'True' : 'False'); data.auto_managed = _(status.is_auto_managed ? 'True' : 'False');
var translate_tracker_status = { var translate_tracker_status = {
'Error' : _('Error'), Error: _('Error'),
'Warning' : _('Warning'), Warning: _('Warning'),
'Announce OK': _('Announce OK'), 'Announce OK': _('Announce OK'),
'Announce Sent' : _('Announce Sent') 'Announce Sent': _('Announce Sent'),
}; };
for (var key in translate_tracker_status) { for (var key in translate_tracker_status) {
if (data.tracker_status.indexOf(key) != -1) { if (data.tracker_status.indexOf(key) != -1) {
data.tracker_status = data.tracker_status.replace(key, translate_tracker_status[key]); data.tracker_status = data.tracker_status.replace(
key,
translate_tracker_status[key]
);
break; break;
} }
} }
data.downloaded += ' (' + ((status.total_payload_download) ? fsize(status.total_payload_download) : '0.0 KiB') + ')'; data.downloaded +=
data.uploaded += ' (' + ((status.total_payload_upload) ? fsize(status.total_payload_upload): '0.0 KiB') + ')'; ' (' +
(status.total_payload_download
? fsize(status.total_payload_download)
: '0.0 KiB') +
')';
data.uploaded +=
' (' +
(status.total_payload_upload
? fsize(status.total_payload_upload)
: '0.0 KiB') +
')';
for (var field in this.fields) { for (var field in this.fields) {
this.fields[field].innerHTML = data[field]; this.fields[field].innerHTML = data[field];
} }
var text = status.state + ' ' + status.progress.toFixed(2) + '%'; var text = status.state + ' ' + status.progress.toFixed(2) + '%';
this.progressBar.updateProgress(status.progress / 100.0, text); this.progressBar.updateProgress(status.progress / 100.0, text);
} },
}); });

View File

@ -15,13 +15,16 @@ Ext.namespace('Deluge.preferences');
*/ */
Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
{
border: false, border: false,
title: _('Bandwidth'), title: _('Bandwidth'),
header: false, header: false,
layout: 'form', layout: 'form',
labelWidth: 10 labelWidth: 10,
}, config); },
config
);
Deluge.preferences.Bandwidth.superclass.constructor.call(this, config); Deluge.preferences.Bandwidth.superclass.constructor.call(this, config);
}, },
@ -37,82 +40,107 @@ Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, {
defaultType: 'spinnerfield', defaultType: 'spinnerfield',
defaults: { defaults: {
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
}, },
style: 'margin-bottom: 0px; padding-bottom: 0px;', style: 'margin-bottom: 0px; padding-bottom: 0px;',
autoHeight: true autoHeight: true,
}); });
om.bind('max_connections_global', fieldset.add({ om.bind(
'max_connections_global',
fieldset.add({
name: 'max_connections_global', name: 'max_connections_global',
fieldLabel: _('Maximum Connections:'), fieldLabel: _('Maximum Connections:'),
labelSeparator: '', labelSeparator: '',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
})); })
om.bind('max_upload_slots_global', fieldset.add({ );
om.bind(
'max_upload_slots_global',
fieldset.add({
name: 'max_upload_slots_global', name: 'max_upload_slots_global',
fieldLabel: _('Maximum Upload Slots'), fieldLabel: _('Maximum Upload Slots'),
labelSeparator: '', labelSeparator: '',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
})); })
om.bind('max_download_speed', fieldset.add({ );
om.bind(
'max_download_speed',
fieldset.add({
name: 'max_download_speed', name: 'max_download_speed',
fieldLabel: _('Maximum Download Speed (KiB/s):'), fieldLabel: _('Maximum Download Speed (KiB/s):'),
labelSeparator: '', labelSeparator: '',
width: 80, width: 80,
value: -1.0, value: -1.0,
decimalPrecision: 1 decimalPrecision: 1,
})); })
om.bind('max_upload_speed', fieldset.add({ );
om.bind(
'max_upload_speed',
fieldset.add({
name: 'max_upload_speed', name: 'max_upload_speed',
fieldLabel: _('Maximum Upload Speed (KiB/s):'), fieldLabel: _('Maximum Upload Speed (KiB/s):'),
labelSeparator: '', labelSeparator: '',
width: 80, width: 80,
value: -1.0, value: -1.0,
decimalPrecision: 1 decimalPrecision: 1,
})); })
om.bind('max_half_open_connections', fieldset.add({ );
om.bind(
'max_half_open_connections',
fieldset.add({
name: 'max_half_open_connections', name: 'max_half_open_connections',
fieldLabel: _('Maximum Half-Open Connections:'), fieldLabel: _('Maximum Half-Open Connections:'),
labelSeparator: '', labelSeparator: '',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
})); })
om.bind('max_connections_per_second', fieldset.add({ );
om.bind(
'max_connections_per_second',
fieldset.add({
name: 'max_connections_per_second', name: 'max_connections_per_second',
fieldLabel: _('Maximum Connection Attempts per Second:'), fieldLabel: _('Maximum Connection Attempts per Second:'),
labelSeparator: '', labelSeparator: '',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
border: false, border: false,
title: '', title: '',
defaultType: 'checkbox', defaultType: 'checkbox',
style: 'padding-top: 0px; padding-bottom: 5px; margin-top: 0px; margin-bottom: 0px;', style:
autoHeight: true 'padding-top: 0px; padding-bottom: 5px; margin-top: 0px; margin-bottom: 0px;',
autoHeight: true,
}); });
om.bind('ignore_limits_on_local_network', fieldset.add({ om.bind(
'ignore_limits_on_local_network',
fieldset.add({
name: 'ignore_limits_on_local_network', name: 'ignore_limits_on_local_network',
height: 22, height: 22,
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('Ignore limits on local network') boxLabel: _('Ignore limits on local network'),
})); })
om.bind('rate_limit_ip_overhead', fieldset.add({ );
om.bind(
'rate_limit_ip_overhead',
fieldset.add({
name: 'rate_limit_ip_overhead', name: 'rate_limit_ip_overhead',
height: 22, height: 22,
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('Rate limit IP overhead') boxLabel: _('Rate limit IP overhead'),
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -123,41 +151,53 @@ Deluge.preferences.Bandwidth = Ext.extend(Ext.form.FormPanel, {
labelWidth: 200, labelWidth: 200,
defaults: { defaults: {
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
}, },
autoHeight: true autoHeight: true,
}); });
om.bind('max_connections_per_torrent', fieldset.add({ om.bind(
'max_connections_per_torrent',
fieldset.add({
name: 'max_connections_per_torrent', name: 'max_connections_per_torrent',
fieldLabel: _('Maximum Connections:'), fieldLabel: _('Maximum Connections:'),
labelSeparator: '', labelSeparator: '',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
})); })
om.bind('max_upload_slots_per_torrent', fieldset.add({ );
om.bind(
'max_upload_slots_per_torrent',
fieldset.add({
name: 'max_upload_slots_per_torrent', name: 'max_upload_slots_per_torrent',
fieldLabel: _('Maximum Upload Slots:'), fieldLabel: _('Maximum Upload Slots:'),
labelSeparator: '', labelSeparator: '',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
})); })
om.bind('max_download_speed_per_torrent', fieldset.add({ );
om.bind(
'max_download_speed_per_torrent',
fieldset.add({
name: 'max_download_speed_per_torrent', name: 'max_download_speed_per_torrent',
fieldLabel: _('Maximum Download Speed (KiB/s):'), fieldLabel: _('Maximum Download Speed (KiB/s):'),
labelSeparator: '', labelSeparator: '',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
})); })
om.bind('max_upload_speed_per_torrent', fieldset.add({ );
om.bind(
'max_upload_speed_per_torrent',
fieldset.add({
name: 'max_upload_speed_per_torrent', name: 'max_upload_speed_per_torrent',
fieldLabel: _('Maximum Upload Speed (KiB/s):'), fieldLabel: _('Maximum Upload Speed (KiB/s):'),
labelSeparator: '', labelSeparator: '',
width: 80, width: 80,
value: -1, value: -1,
decimalPrecision: 0 decimalPrecision: 0,
})); })
} );
},
}); });

View File

@ -14,13 +14,11 @@ Ext.namespace('Deluge.preferences');
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
title: _('Cache'), title: _('Cache'),
header: false, header: false,
layout: 'form', layout: 'form',
initComponent: function() { initComponent: function() {
Deluge.preferences.Cache.superclass.initComponent.call(this); Deluge.preferences.Cache.superclass.initComponent.call(this);
@ -36,22 +34,28 @@ Deluge.preferences.Cache = Ext.extend(Ext.form.FormPanel, {
defaults: { defaults: {
decimalPrecision: 0, decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 999999 maxValue: 999999,
} },
}); });
om.bind('cache_size', fieldset.add({ om.bind(
'cache_size',
fieldset.add({
fieldLabel: _('Cache Size (16 KiB Blocks):'), fieldLabel: _('Cache Size (16 KiB Blocks):'),
labelSeparator: '', labelSeparator: '',
name: 'cache_size', name: 'cache_size',
width: 60, width: 60,
value: 512 value: 512,
})); })
om.bind('cache_expiry', fieldset.add({ );
om.bind(
'cache_expiry',
fieldset.add({
fieldLabel: _('Cache Expiry (seconds):'), fieldLabel: _('Cache Expiry (seconds):'),
labelSeparator: '', labelSeparator: '',
name: 'cache_expiry', name: 'cache_expiry',
width: 60, width: 60,
value: 60 value: 60,
})); })
} );
},
}); });

View File

@ -14,7 +14,6 @@ Ext.namespace('Deluge.preferences');
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
title: _('Daemon'), title: _('Daemon'),
header: false, header: false,
@ -30,17 +29,20 @@ Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
title: _('Port'), title: _('Port'),
autoHeight: true, autoHeight: true,
defaultType: 'spinnerfield' defaultType: 'spinnerfield',
}); });
om.bind('daemon_port', fieldset.add({ om.bind(
'daemon_port',
fieldset.add({
fieldLabel: _('Daemon port:'), fieldLabel: _('Daemon port:'),
labelSeparator: '', labelSeparator: '',
name: 'daemon_port', name: 'daemon_port',
value: 58846, value: 58846,
decimalPrecision: 0, decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -48,15 +50,18 @@ Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, {
title: _('Connections'), title: _('Connections'),
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox' defaultType: 'checkbox',
}); });
om.bind('allow_remote', fieldset.add({ om.bind(
'allow_remote',
fieldset.add({
fieldLabel: '', fieldLabel: '',
height: 22, height: 22,
labelSeparator: '', labelSeparator: '',
boxLabel: _('Allow Remote Connections'), boxLabel: _('Allow Remote Connections'),
name: 'allow_remote' name: 'allow_remote',
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -64,14 +69,17 @@ Deluge.preferences.Daemon = Ext.extend(Ext.form.FormPanel, {
title: _('Other'), title: _('Other'),
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox' defaultType: 'checkbox',
}); });
om.bind('new_release_check', fieldset.add({ om.bind(
'new_release_check',
fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
height: 40, height: 40,
boxLabel: _('Periodically check the website for new releases'), boxLabel: _('Periodically check the website for new releases'),
id: 'new_release_check' id: 'new_release_check',
})); })
} );
},
}); });

View File

@ -15,14 +15,17 @@ Ext.namespace('Deluge.preferences');
*/ */
Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
{
border: false, border: false,
title: _('Downloads'), title: _('Downloads'),
header: false, header: false,
layout: 'form', layout: 'form',
autoHeight: true, autoHeight: true,
width: 320 width: 320,
}, config); },
config
);
Deluge.preferences.Downloads.superclass.constructor.call(this, config); Deluge.preferences.Downloads.superclass.constructor.call(this, config);
}, },
@ -39,22 +42,25 @@ Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, {
autoHeight: true, autoHeight: true,
labelAlign: 'top', labelAlign: 'top',
width: 300, width: 300,
style: 'margin-bottom: 5px; padding-bottom: 5px;' style: 'margin-bottom: 5px; padding-bottom: 5px;',
}); });
optMan.bind('download_location', fieldset.add({ optMan.bind(
'download_location',
fieldset.add({
xtype: 'textfield', xtype: 'textfield',
name: 'download_location', name: 'download_location',
fieldLabel: _('Download to:'), fieldLabel: _('Download to:'),
labelSeparator: '', labelSeparator: '',
width: 280 width: 280,
})); })
);
var field = fieldset.add({ var field = fieldset.add({
name: 'move_completed_path', name: 'move_completed_path',
fieldLabel: _('Move completed to:'), fieldLabel: _('Move completed to:'),
labelSeparator: '', labelSeparator: '',
width: 280 width: 280,
}); });
optMan.bind('move_completed', field.toggle); optMan.bind('move_completed', field.toggle);
optMan.bind('move_completed_path', field.input); optMan.bind('move_completed_path', field.input);
@ -63,7 +69,7 @@ Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, {
name: 'torrentfiles_location', name: 'torrentfiles_location',
fieldLabel: _('Copy of .torrent files to:'), fieldLabel: _('Copy of .torrent files to:'),
labelSeparator: '', labelSeparator: '',
width: 280 width: 280,
}); });
optMan.bind('copy_torrent_file', field.toggle); optMan.bind('copy_torrent_file', field.toggle);
optMan.bind('torrentfiles_location', field.input); optMan.bind('torrentfiles_location', field.input);
@ -76,32 +82,43 @@ Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, {
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox', defaultType: 'checkbox',
style: 'margin-bottom: 0; padding-bottom: 0;', style: 'margin-bottom: 0; padding-bottom: 0;',
width: 280 width: 280,
}); });
optMan.bind('prioritize_first_last_pieces', fieldset.add({ optMan.bind(
'prioritize_first_last_pieces',
fieldset.add({
name: 'prioritize_first_last_pieces', name: 'prioritize_first_last_pieces',
labelSeparator: '', labelSeparator: '',
height: 22, height: 22,
boxLabel: _('Prioritize first and last pieces of torrent') boxLabel: _('Prioritize first and last pieces of torrent'),
})); })
optMan.bind('sequential_download', fieldset.add({ );
optMan.bind(
'sequential_download',
fieldset.add({
name: 'sequential_download', name: 'sequential_download',
labelSeparator: '', labelSeparator: '',
height: 22, height: 22,
boxLabel: _('Sequential download') boxLabel: _('Sequential download'),
})); })
optMan.bind('add_paused', fieldset.add({ );
optMan.bind(
'add_paused',
fieldset.add({
name: 'add_paused', name: 'add_paused',
labelSeparator: '', labelSeparator: '',
height: 22, height: 22,
boxLabel: _('Add torrents in Paused state') boxLabel: _('Add torrents in Paused state'),
})); })
optMan.bind('pre_allocate_storage', fieldset.add({ );
optMan.bind(
'pre_allocate_storage',
fieldset.add({
name: 'pre_allocate_storage', name: 'pre_allocate_storage',
labelSeparator: '', labelSeparator: '',
height: 22, height: 22,
boxLabel: _('Pre-allocate disk space') boxLabel: _('Pre-allocate disk space'),
})); })
);
} },
}); });

View File

@ -14,7 +14,6 @@ Ext.namespace('Deluge.preferences');
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
title: _('Encryption'), title: _('Encryption'),
header: false, header: false,
@ -31,9 +30,11 @@ Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
header: false, header: false,
autoHeight: true, autoHeight: true,
defaultType: 'combo', defaultType: 'combo',
width: 300 width: 300,
}); });
optMan.bind('enc_in_policy', fieldset.add({ optMan.bind(
'enc_in_policy',
fieldset.add({
fieldLabel: _('Incoming:'), fieldLabel: _('Incoming:'),
labelSeparator: '', labelSeparator: '',
mode: 'local', mode: 'local',
@ -43,15 +44,18 @@ Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
data: [ data: [
[0, _('Forced')], [0, _('Forced')],
[1, _('Enabled')], [1, _('Enabled')],
[2, _('Disabled')] [2, _('Disabled')],
] ],
}), }),
editable: false, editable: false,
triggerAction: 'all', triggerAction: 'all',
valueField: 'id', valueField: 'id',
displayField: 'text' displayField: 'text',
})); })
optMan.bind('enc_out_policy', fieldset.add({ );
optMan.bind(
'enc_out_policy',
fieldset.add({
fieldLabel: _('Outgoing:'), fieldLabel: _('Outgoing:'),
labelSeparator: '', labelSeparator: '',
mode: 'local', mode: 'local',
@ -61,15 +65,18 @@ Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
data: [ data: [
[0, _('Forced')], [0, _('Forced')],
[1, _('Enabled')], [1, _('Enabled')],
[2, _('Disabled')] [2, _('Disabled')],
] ],
}), }),
editable: false, editable: false,
triggerAction: 'all', triggerAction: 'all',
valueField: 'id', valueField: 'id',
displayField: 'text' displayField: 'text',
})); })
optMan.bind('enc_level', fieldset.add({ );
optMan.bind(
'enc_level',
fieldset.add({
fieldLabel: _('Level:'), fieldLabel: _('Level:'),
labelSeparator: '', labelSeparator: '',
mode: 'local', mode: 'local',
@ -79,13 +86,14 @@ Deluge.preferences.Encryption = Ext.extend(Ext.form.FormPanel, {
data: [ data: [
[0, _('Handshake')], [0, _('Handshake')],
[1, _('Full Stream')], [1, _('Full Stream')],
[2, _('Either')] [2, _('Either')],
] ],
}), }),
editable: false, editable: false,
triggerAction: 'all', triggerAction: 'all',
valueField: 'id', valueField: 'id',
displayField: 'text' displayField: 'text',
})); })
} );
},
}); });

View File

@ -14,7 +14,6 @@ Ext.namespace('Deluge.preferences');
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.preferences.InstallPluginWindow = Ext.extend(Ext.Window, { Deluge.preferences.InstallPluginWindow = Ext.extend(Ext.Window, {
title: _('Install Plugin'), title: _('Install Plugin'),
layout: 'fit', layout: 'fit',
height: 115, height: 115,
@ -28,7 +27,9 @@ Deluge.preferences.InstallPluginWindow = Ext.extend(Ext.Window, {
plain: true, plain: true,
initComponent: function() { initComponent: function() {
Deluge.preferences.InstallPluginWindow.superclass.initComponent.call(this); Deluge.preferences.InstallPluginWindow.superclass.initComponent.call(
this
);
this.addButton(_('Install'), this.onInstall, this); this.addButton(_('Install'), this.onInstall, this);
this.form = this.add({ this.form = this.add({
@ -37,16 +38,18 @@ Deluge.preferences.InstallPluginWindow = Ext.extend(Ext.Window, {
labelWidth: 70, labelWidth: 70,
autoHeight: true, autoHeight: true,
fileUpload: true, fileUpload: true,
items: [{ items: [
{
xtype: 'fileuploadfield', xtype: 'fileuploadfield',
width: 240, width: 240,
emptyText: _('Select an egg'), emptyText: _('Select an egg'),
fieldLabel: _('Plugin Egg'), fieldLabel: _('Plugin Egg'),
name: 'file', name: 'file',
buttonCfg: { buttonCfg: {
text: _('Browse...') text: _('Browse...'),
} },
}] },
],
}); });
}, },
@ -55,7 +58,7 @@ Deluge.preferences.InstallPluginWindow = Ext.extend(Ext.Window, {
url: deluge.config.base + 'upload', url: deluge.config.base + 'upload',
waitMsg: _('Uploading your plugin...'), waitMsg: _('Uploading your plugin...'),
success: this.onUploadSuccess, success: this.onUploadSuccess,
scope: this scope: this,
}); });
}, },
@ -67,14 +70,14 @@ Deluge.preferences.InstallPluginWindow = Ext.extend(Ext.Window, {
this.hide(); this.hide();
if (upload.result.success) { if (upload.result.success) {
var filename = this.form.getForm().getFieldValues().file; var filename = this.form.getForm().getFieldValues().file;
filename = filename.split('\\').slice(-1)[0] filename = filename.split('\\').slice(-1)[0];
var path = upload.result.files[0]; var path = upload.result.files[0];
this.form.getForm().setValues({ file: '' }); this.form.getForm().setValues({ file: '' });
deluge.client.web.upload_plugin(filename, path, { deluge.client.web.upload_plugin(filename, path, {
success: this.onUploadPlugin, success: this.onUploadPlugin,
scope: this, scope: this,
filename: filename filename: filename,
}); });
} }
} },
}); });

View File

@ -14,7 +14,6 @@ Ext.namespace('Deluge.preferences');
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
title: _('Interface'), title: _('Interface'),
header: false, header: false,
@ -23,7 +22,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
initComponent: function() { initComponent: function() {
Deluge.preferences.Interface.superclass.initComponent.call(this); Deluge.preferences.Interface.superclass.initComponent.call(this);
var om = this.optionsManager = new Deluge.OptionsManager(); var om = (this.optionsManager = new Deluge.OptionsManager());
this.on('show', this.onPageShow, this); this.on('show', this.onPageShow, this);
var fieldset = this.add({ var fieldset = this.add({
@ -37,21 +36,30 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
defaults: { defaults: {
height: 17, height: 17,
fieldLabel: '', fieldLabel: '',
labelSeparator: '' labelSeparator: '',
} },
}); });
om.bind('show_session_speed', fieldset.add({ om.bind(
'show_session_speed',
fieldset.add({
name: 'show_session_speed', name: 'show_session_speed',
boxLabel: _('Show session speed in titlebar') boxLabel: _('Show session speed in titlebar'),
})); })
om.bind('sidebar_show_zero', fieldset.add({ );
om.bind(
'sidebar_show_zero',
fieldset.add({
name: 'sidebar_show_zero', name: 'sidebar_show_zero',
boxLabel: _('Show filters with zero torrents') boxLabel: _('Show filters with zero torrents'),
})); })
om.bind('sidebar_multiple_filters', fieldset.add({ );
om.bind(
'sidebar_multiple_filters',
fieldset.add({
name: 'sidebar_multiple_filters', name: 'sidebar_multiple_filters',
boxLabel: _('Allow the use of multiple filters at once') boxLabel: _('Allow the use of multiple filters at once'),
})); })
);
var languagePanel = this.add({ var languagePanel = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -60,22 +68,25 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
style: 'margin-bottom: 0px; padding-bottom: 5px; padding-top: 5px', style: 'margin-bottom: 0px; padding-bottom: 5px; padding-top: 5px',
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox' defaultType: 'checkbox',
}); });
this.language = om.bind('language', languagePanel.add({ this.language = om.bind(
'language',
languagePanel.add({
xtype: 'combo', xtype: 'combo',
labelSeparator: '', labelSeparator: '',
name: 'language', name: 'language',
mode: 'local', mode: 'local',
width: 200, width: 200,
store: new Ext.data.ArrayStore({ store: new Ext.data.ArrayStore({
fields: ['id', 'text'] fields: ['id', 'text'],
}), }),
editable: false, editable: false,
triggerAction: 'all', triggerAction: 'all',
valueField: 'id', valueField: 'id',
displayField: 'text' displayField: 'text',
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -90,21 +101,21 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
inputType: 'password', inputType: 'password',
labelStyle: 'padding-left: 5px', labelStyle: 'padding-left: 5px',
height: 20, height: 20,
labelSeparator: '' labelSeparator: '',
} },
}); });
this.oldPassword = fieldset.add({ this.oldPassword = fieldset.add({
name: 'old_password', name: 'old_password',
fieldLabel: _('Old:') fieldLabel: _('Old:'),
}); });
this.newPassword = fieldset.add({ this.newPassword = fieldset.add({
name: 'new_password', name: 'new_password',
fieldLabel: _('New:') fieldLabel: _('New:'),
}); });
this.confirmPassword = fieldset.add({ this.confirmPassword = fieldset.add({
name: 'confirm_password', name: 'confirm_password',
fieldLabel: _('Confirm:') fieldLabel: _('Confirm:'),
}); });
fieldset = this.add({ fieldset = this.add({
@ -119,46 +130,63 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
labelSeparator: '', labelSeparator: '',
labelStyle: 'padding-left: 5px', labelStyle: 'padding-left: 5px',
height: 20, height: 20,
width: 80 width: 80,
} },
}); });
om.bind('session_timeout', fieldset.add({ om.bind(
'session_timeout',
fieldset.add({
name: 'session_timeout', name: 'session_timeout',
fieldLabel: _('Session Timeout:'), fieldLabel: _('Session Timeout:'),
decimalPrecision: 0, decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
})); })
om.bind('port', fieldset.add({ );
om.bind(
'port',
fieldset.add({
name: 'port', name: 'port',
fieldLabel: _('Port:'), fieldLabel: _('Port:'),
decimalPrecision: 0, decimalPrecision: 0,
minValue: 1, minValue: 1,
maxValue: 65535 maxValue: 65535,
})); })
this.httpsField = om.bind('https', fieldset.add({ );
this.httpsField = om.bind(
'https',
fieldset.add({
xtype: 'checkbox', xtype: 'checkbox',
name: 'https', name: 'https',
hideLabel: true, hideLabel: true,
width: 300, width: 300,
style: 'margin-left: 5px', style: 'margin-left: 5px',
boxLabel: _('Enable SSL (paths relative to Deluge config folder)') boxLabel: _(
})); 'Enable SSL (paths relative to Deluge config folder)'
),
})
);
this.httpsField.on('check', this.onSSLCheck, this); this.httpsField.on('check', this.onSSLCheck, this);
this.pkeyField = om.bind('pkey', fieldset.add({ this.pkeyField = om.bind(
'pkey',
fieldset.add({
xtype: 'textfield', xtype: 'textfield',
disabled: true, disabled: true,
name: 'pkey', name: 'pkey',
width: 180, width: 180,
fieldLabel: _('Private Key:') fieldLabel: _('Private Key:'),
})); })
this.certField = om.bind('cert', fieldset.add({ );
this.certField = om.bind(
'cert',
fieldset.add({
xtype: 'textfield', xtype: 'textfield',
disabled: true, disabled: true,
name: 'cert', name: 'cert',
width: 180, width: 180,
fieldLabel: _('Certificate:') fieldLabel: _('Certificate:'),
})); })
);
}, },
onApply: function() { onApply: function() {
@ -166,7 +194,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
if (!Ext.isObjectEmpty(changed)) { if (!Ext.isObjectEmpty(changed)) {
deluge.client.web.set_config(changed, { deluge.client.web.set_config(changed, {
success: this.onSetConfig, success: this.onSetConfig,
scope: this scope: this,
}); });
for (var key in deluge.config) { for (var key in deluge.config) {
@ -175,16 +203,18 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
if ('language' in changed) { if ('language' in changed) {
Ext.Msg.show({ Ext.Msg.show({
title: _('WebUI Language Changed'), title: _('WebUI Language Changed'),
msg: _('Do you want to refresh the page now to use the new language?'), msg: _(
'Do you want to refresh the page now to use the new language?'
),
buttons: { buttons: {
yes: _('Refresh'), yes: _('Refresh'),
no: _('Close') no: _('Close'),
}, },
multiline: false, multiline: false,
fn: function(btnText) { fn: function(btnText) {
if (btnText === 'yes') location.reload(); if (btnText === 'yes') location.reload();
}, },
icon: Ext.MessageBox.QUESTION icon: Ext.MessageBox.QUESTION,
}); });
} }
} }
@ -202,7 +232,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
}, },
onGotLanguages: function(info, obj, response, request) { onGotLanguages: function(info, obj, response, request) {
info.unshift(['', _('System Default')]) info.unshift(['', _('System Default')]);
this.language.store.loadData(info); this.language.store.loadData(info);
this.language.setValue(this.optionsManager.get('language')); this.language.setValue(this.optionsManager.get('language'));
}, },
@ -212,11 +242,11 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
if (newPassword != this.confirmPassword.getValue()) { if (newPassword != this.confirmPassword.getValue()) {
Ext.MessageBox.show({ Ext.MessageBox.show({
title: _('Invalid Password'), title: _('Invalid Password'),
msg: _('Your passwords don\'t match!'), msg: _("Your passwords don't match!"),
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
modal: false, modal: false,
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
iconCls: 'x-deluge-icon-error' iconCls: 'x-deluge-icon-error',
}); });
return; return;
} }
@ -231,7 +261,7 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
modal: false, modal: false,
icon: Ext.MessageBox.ERROR, icon: Ext.MessageBox.ERROR,
iconCls: 'x-deluge-icon-error' iconCls: 'x-deluge-icon-error',
}); });
this.oldPassword.setValue(''); this.oldPassword.setValue('');
} else { } else {
@ -241,14 +271,14 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
buttons: Ext.MessageBox.OK, buttons: Ext.MessageBox.OK,
modal: false, modal: false,
icon: Ext.MessageBox.INFO, icon: Ext.MessageBox.INFO,
iconCls: 'x-deluge-icon-info' iconCls: 'x-deluge-icon-info',
}); });
this.oldPassword.setValue(''); this.oldPassword.setValue('');
this.newPassword.setValue(''); this.newPassword.setValue('');
this.confirmPassword.setValue(''); this.confirmPassword.setValue('');
} }
}, },
scope: this scope: this,
}); });
}, },
@ -259,16 +289,16 @@ Deluge.preferences.Interface = Ext.extend(Ext.form.FormPanel, {
onPageShow: function() { onPageShow: function() {
deluge.client.web.get_config({ deluge.client.web.get_config({
success: this.onGotConfig, success: this.onGotConfig,
scope: this scope: this,
}); });
deluge.client.webutils.get_languages({ deluge.client.webutils.get_languages({
success: this.onGotLanguages, success: this.onGotLanguages,
scope: this scope: this,
}); });
}, },
onSSLCheck: function(e, checked) { onSSLCheck: function(e, checked) {
this.pkeyField.setDisabled(!checked); this.pkeyField.setDisabled(!checked);
this.certField.setDisabled(!checked); this.certField.setDisabled(!checked);
} },
}); });

View File

@ -15,7 +15,7 @@ Ext.apply(Ext.form.VTypes, {
return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(v); return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(v);
}, },
IPAddressText: 'Must be a numeric IP address', IPAddressText: 'Must be a numeric IP address',
IPAddressMask: /[\d\.]/i IPAddressMask: /[\d\.]/i,
}); });
/** /**
@ -23,7 +23,6 @@ Ext.apply(Ext.form.VTypes, {
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
layout: 'form', layout: 'form',
title: _('Network'), title: _('Network'),
@ -40,15 +39,18 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
style: 'margin-bottom: 5px; padding-bottom: 0px;', style: 'margin-bottom: 5px; padding-bottom: 0px;',
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'textfield' defaultType: 'textfield',
}); });
optMan.bind('listen_interface', fieldset.add({ optMan.bind(
'listen_interface',
fieldset.add({
name: 'listen_interface', name: 'listen_interface',
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
width: 200, width: 200,
vtype: 'IPAddress' vtype: 'IPAddress',
})); })
);
var fieldset = this.add({ var fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -57,23 +59,26 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
style: 'margin-bottom: 5px; padding-bottom: 0px;', style: 'margin-bottom: 5px; padding-bottom: 0px;',
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox' defaultType: 'checkbox',
}); });
optMan.bind('random_port', fieldset.add({ optMan.bind(
'random_port',
fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('Use Random Port'), boxLabel: _('Use Random Port'),
name: 'random_port', name: 'random_port',
height: 22, height: 22,
listeners: { listeners: {
'check': { check: {
fn: function(e, checked) { fn: function(e, checked) {
this.listenPort.setDisabled(checked); this.listenPort.setDisabled(checked);
}, },
scope: this scope: this,
} },
} },
})); })
);
this.listenPort = fieldset.add({ this.listenPort = fieldset.add({
xtype: 'spinnerfield', xtype: 'spinnerfield',
@ -85,8 +90,8 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
xtype: 'number', xtype: 'number',
decimalPrecision: 0, decimalPrecision: 0,
minValue: 0, minValue: 0,
maxValue: 65535 maxValue: 65535,
} },
}); });
optMan.bind('listen_ports', this.listenPort); optMan.bind('listen_ports', this.listenPort);
@ -97,14 +102,17 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
style: 'margin-bottom: 5px; padding-bottom: 0px;', style: 'margin-bottom: 5px; padding-bottom: 0px;',
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'textfield' defaultType: 'textfield',
}); });
optMan.bind('outgoing_interface', fieldset.add({ optMan.bind(
'outgoing_interface',
fieldset.add({
name: 'outgoing_interface', name: 'outgoing_interface',
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
width: 40, width: 40,
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -113,23 +121,26 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
style: 'margin-bottom: 5px; padding-bottom: 0px;', style: 'margin-bottom: 5px; padding-bottom: 0px;',
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox' defaultType: 'checkbox',
}); });
optMan.bind('random_outgoing_ports', fieldset.add({ optMan.bind(
'random_outgoing_ports',
fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('Use Random Ports'), boxLabel: _('Use Random Ports'),
name: 'random_outgoing_ports', name: 'random_outgoing_ports',
height: 22, height: 22,
listeners: { listeners: {
'check': { check: {
fn: function(e, checked) { fn: function(e, checked) {
this.outgoingPorts.setDisabled(checked); this.outgoingPorts.setDisabled(checked);
}, },
scope: this scope: this,
} },
} },
})); })
);
this.outgoingPorts = fieldset.add({ this.outgoingPorts = fieldset.add({
xtype: 'spinnergroup', xtype: 'spinnergroup',
name: 'outgoing_ports', name: 'outgoing_ports',
@ -137,27 +148,30 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
labelSeparator: '', labelSeparator: '',
colCfg: { colCfg: {
labelWidth: 40, labelWidth: 40,
style: 'margin-right: 10px;' style: 'margin-right: 10px;',
}, },
items: [{ items: [
{
fieldLabel: _('From:'), fieldLabel: _('From:'),
labelSeparator: '', labelSeparator: '',
strategy: { strategy: {
xtype: 'number', xtype: 'number',
decimalPrecision: 0, decimalPrecision: 0,
minValue: 0, minValue: 0,
maxValue: 65535 maxValue: 65535,
} },
}, { },
{
fieldLabel: _('To:'), fieldLabel: _('To:'),
labelSeparator: '', labelSeparator: '',
strategy: { strategy: {
xtype: 'number', xtype: 'number',
decimalPrecision: 0, decimalPrecision: 0,
minValue: 0, minValue: 0,
maxValue: 65535 maxValue: 65535,
} },
}] },
],
}); });
optMan.bind('outgoing_ports', this.outgoingPorts); optMan.bind('outgoing_ports', this.outgoingPorts);
@ -168,43 +182,58 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
autoHeight: true, autoHeight: true,
layout: 'table', layout: 'table',
layoutConfig: { layoutConfig: {
columns: 3 columns: 3,
}, },
defaultType: 'checkbox' defaultType: 'checkbox',
}); });
optMan.bind('upnp', fieldset.add({ optMan.bind(
'upnp',
fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('UPnP'), boxLabel: _('UPnP'),
name: 'upnp' name: 'upnp',
})); })
optMan.bind('natpmp', fieldset.add({ );
optMan.bind(
'natpmp',
fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('NAT-PMP'), boxLabel: _('NAT-PMP'),
ctCls: 'x-deluge-indent-checkbox', ctCls: 'x-deluge-indent-checkbox',
name: 'natpmp' name: 'natpmp',
})); })
optMan.bind('utpex', fieldset.add({ );
optMan.bind(
'utpex',
fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('Peer Exchange'), boxLabel: _('Peer Exchange'),
ctCls: 'x-deluge-indent-checkbox', ctCls: 'x-deluge-indent-checkbox',
name: 'utpex' name: 'utpex',
})); })
optMan.bind('lsd', fieldset.add({ );
optMan.bind(
'lsd',
fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('LSD'), boxLabel: _('LSD'),
name: 'lsd' name: 'lsd',
})); })
optMan.bind('dht', fieldset.add({ );
optMan.bind(
'dht',
fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
boxLabel: _('DHT'), boxLabel: _('DHT'),
ctCls: 'x-deluge-indent-checkbox', ctCls: 'x-deluge-indent-checkbox',
name: 'dht' name: 'dht',
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -213,13 +242,16 @@ Deluge.preferences.Network = Ext.extend(Ext.form.FormPanel, {
style: 'margin-bottom: 5px; padding-bottom: 0px;', style: 'margin-bottom: 5px; padding-bottom: 0px;',
bodyStyle: 'margin: 0px; padding: 0px', bodyStyle: 'margin: 0px; padding: 0px',
autoHeight: true, autoHeight: true,
defaultType: 'textfield' defaultType: 'textfield',
}); });
optMan.bind('peer_tos', fieldset.add({ optMan.bind(
'peer_tos',
fieldset.add({
name: 'peer_tos', name: 'peer_tos',
fieldLabel: _('Peer TOS Byte:'), fieldLabel: _('Peer TOS Byte:'),
labelSeparator: '', labelSeparator: '',
width: 40 width: 40,
})); })
} );
},
}); });

View File

@ -15,12 +15,15 @@ Ext.namespace('Deluge.preferences');
*/ */
Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
{
border: false, border: false,
title: _('Other'), title: _('Other'),
header: false, header: false,
layout: 'form' layout: 'form',
}, config); },
config
);
Deluge.preferences.Other.superclass.constructor.call(this, config); Deluge.preferences.Other.superclass.constructor.call(this, config);
}, },
@ -35,15 +38,18 @@ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, {
title: _('Updates'), title: _('Updates'),
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox' defaultType: 'checkbox',
}); });
optMan.bind('new_release_check', fieldset.add({ optMan.bind(
'new_release_check',
fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
height: 22, height: 22,
name: 'new_release_check', name: 'new_release_check',
boxLabel: _('Be alerted about new releases') boxLabel: _('Be alerted about new releases'),
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -51,22 +57,27 @@ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, {
title: _('System Information'), title: _('System Information'),
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox' defaultType: 'checkbox',
}); });
fieldset.add({ fieldset.add({
xtype: 'panel', xtype: 'panel',
border: false, border: false,
bodyCfg: { bodyCfg: {
html: _('Help us improve Deluge by sending us your Python version, PyGTK version, OS and processor types. Absolutely no other information is sent.') html: _(
} 'Help us improve Deluge by sending us your Python version, PyGTK version, OS and processor types. Absolutely no other information is sent.'
),
},
}); });
optMan.bind('send_info', fieldset.add({ optMan.bind(
'send_info',
fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
height: 22, height: 22,
boxLabel: _('Yes, please send anonymous statistics'), boxLabel: _('Yes, please send anonymous statistics'),
name: 'send_info' name: 'send_info',
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -74,13 +85,16 @@ Deluge.preferences.Other = Ext.extend(Ext.form.FormPanel, {
title: _('GeoIP Database'), title: _('GeoIP Database'),
autoHeight: true, autoHeight: true,
labelWidth: 80, labelWidth: 80,
defaultType: 'textfield' defaultType: 'textfield',
}); });
optMan.bind('geoip_db_location', fieldset.add({ optMan.bind(
'geoip_db_location',
fieldset.add({
name: 'geoip_db_location', name: 'geoip_db_location',
fieldLabel: _('Path:'), fieldLabel: _('Path:'),
labelSeparator: '', labelSeparator: '',
width: 200 width: 200,
})); })
} );
},
}); });

View File

@ -14,7 +14,6 @@ Ext.namespace('Deluge.preferences');
* @extends Ext.Panel * @extends Ext.Panel
*/ */
Deluge.preferences.Plugins = Ext.extend(Ext.Panel, { Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
layout: 'border', layout: 'border',
title: _('Plugins'), title: _('Plugins'),
header: false, header: false,
@ -23,60 +22,79 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
pluginTemplate: new Ext.Template( pluginTemplate: new Ext.Template(
'<dl class="singleline">' + '<dl class="singleline">' +
'<dt>' + _('Author:') + '</dt><dd>{author}</dd>' + '<dt>' +
'<dt>' + _('Version:') + '</dt><dd>{version}</dd>' + _('Author:') +
'<dt>' + _('Author Email:') + '</dt><dd>{email}</dd>' + '</dt><dd>{author}</dd>' +
'<dt>' + _('Homepage:') + '</dt><dd>{homepage}</dd>' + '<dt>' +
'<dt>' + _('Details:') + '</dt><dd style="white-space:normal">{details}</dd>' + _('Version:') +
'</dt><dd>{version}</dd>' +
'<dt>' +
_('Author Email:') +
'</dt><dd>{email}</dd>' +
'<dt>' +
_('Homepage:') +
'</dt><dd>{homepage}</dd>' +
'<dt>' +
_('Details:') +
'</dt><dd style="white-space:normal">{details}</dd>' +
'</dl>' '</dl>'
), ),
initComponent: function() { initComponent: function() {
Deluge.preferences.Plugins.superclass.initComponent.call(this); Deluge.preferences.Plugins.superclass.initComponent.call(this);
this.defaultValues = { this.defaultValues = {
'version': '', version: '',
'email': '', email: '',
'homepage': '', homepage: '',
'details': '' details: '',
}; };
this.pluginTemplate.compile(); this.pluginTemplate.compile();
var checkboxRenderer = function(v, p, record) { var checkboxRenderer = function(v, p, record) {
p.css += ' x-grid3-check-col-td'; p.css += ' x-grid3-check-col-td';
return '<div class="x-grid3-check-col'+(v?'-on':'')+'"> </div>'; return (
} '<div class="x-grid3-check-col' + (v ? '-on' : '') + '"> </div>'
);
};
this.list = this.add({ this.list = this.add({
xtype: 'listview', xtype: 'listview',
store: new Ext.data.ArrayStore({ store: new Ext.data.ArrayStore({
fields: [ fields: [
{ name: 'enabled', mapping: 0 }, { name: 'enabled', mapping: 0 },
{name: 'plugin', mapping: 1, sortType: 'asUCString'} { name: 'plugin', mapping: 1, sortType: 'asUCString' },
] ],
}), }),
columns: [{ columns: [
{
id: 'enabled', id: 'enabled',
header: _('Enabled'), header: _('Enabled'),
width: .2, width: 0.2,
sortable: true, sortable: true,
tpl: new Ext.XTemplate('{enabled:this.getCheckbox}', { tpl: new Ext.XTemplate('{enabled:this.getCheckbox}', {
getCheckbox: function(v) { getCheckbox: function(v) {
return '<div class="x-grid3-check-col'+(v?'-on':'')+'" rel="chkbox"> </div>'; return (
} '<div class="x-grid3-check-col' +
(v ? '-on' : '') +
'" rel="chkbox"> </div>'
);
},
}), }),
dataIndex: 'enabled' dataIndex: 'enabled',
}, { },
{
id: 'plugin', id: 'plugin',
header: _('Plugin'), header: _('Plugin'),
width: .8, width: 0.8,
sortable: true, sortable: true,
dataIndex: 'plugin' dataIndex: 'plugin',
}], },
],
singleSelect: true, singleSelect: true,
autoExpandColumn: 'plugin', autoExpandColumn: 'plugin',
listeners: { listeners: {
selectionchange: {fn: this.onPluginSelect, scope: this} selectionchange: { fn: this.onPluginSelect, scope: this },
} },
}); });
this.panel = this.add({ this.panel = this.add({
@ -84,23 +102,27 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
autoScroll: true, autoScroll: true,
items: [this.list], items: [this.list],
bbar: new Ext.Toolbar({ bbar: new Ext.Toolbar({
items: [{ items: [
{
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
iconCls: 'x-deluge-install-plugin', iconCls: 'x-deluge-install-plugin',
text: _('Install'), text: _('Install'),
handler: this.onInstallPluginWindow, handler: this.onInstallPluginWindow,
scope: this scope: this,
}, '->', { },
'->',
{
cls: 'x-btn-text-icon', cls: 'x-btn-text-icon',
text: _('Find More'), text: _('Find More'),
iconCls: 'x-deluge-find-more', iconCls: 'x-deluge-find-more',
handler: this.onFindMorePlugins, handler: this.onFindMorePlugins,
scope: this scope: this,
}] },
}) ],
}),
}); });
var pp = this.pluginInfo = this.add({ var pp = (this.pluginInfo = this.add({
xtype: 'panel', xtype: 'panel',
border: false, border: false,
height: 100, height: 100,
@ -108,9 +130,9 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
padding: '5', padding: '5',
autoScroll: true, autoScroll: true,
bodyCfg: { bodyCfg: {
style: 'white-space: nowrap' style: 'white-space: nowrap',
} },
}); }));
this.pluginInfo.on('render', this.onPluginInfoRender, this); this.pluginInfo.on('render', this.onPluginInfoRender, this);
this.list.on('click', this.onNodeClick, this); this.list.on('click', this.onNodeClick, this);
@ -141,30 +163,34 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
deluge.client.core.get_enabled_plugins({ deluge.client.core.get_enabled_plugins({
success: onGotEnabledPlugins, success: onGotEnabledPlugins,
scope: this scope: this,
}); });
} };
var onGotEnabledPlugins = function(plugins) { var onGotEnabledPlugins = function(plugins) {
this.enabledPlugins = plugins; this.enabledPlugins = plugins;
this.onGotPlugins() this.onGotPlugins();
} };
deluge.client.core.get_available_plugins({ deluge.client.core.get_available_plugins({
success: onGotAvailablePlugins, success: onGotAvailablePlugins,
scope: this scope: this,
}); });
}, },
updatePluginsGrid: function() { updatePluginsGrid: function() {
var plugins = []; var plugins = [];
Ext.each(this.availablePlugins, function(plugin) { Ext.each(
this.availablePlugins,
function(plugin) {
if (this.enabledPlugins.indexOf(plugin) > -1) { if (this.enabledPlugins.indexOf(plugin) > -1) {
plugins.push([true, plugin]); plugins.push([true, plugin]);
} else { } else {
plugins.push([false, plugin]); plugins.push([false, plugin]);
} }
}, this); },
this
);
this.list.getStore().loadData(plugins); this.list.getStore().loadData(plugins);
}, },
@ -173,7 +199,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
if (el.getAttribute('rel') != 'chkbox') return; if (el.getAttribute('rel') != 'chkbox') return;
var r = dv.getStore().getAt(index); var r = dv.getStore().getAt(index);
if (r.get('plugin') == "WebUi") return; if (r.get('plugin') == 'WebUi') return;
r.set('enabled', !r.get('enabled')); r.set('enabled', !r.get('enabled'));
r.commit(); r.commit();
if (r.get('enabled')) { if (r.get('enabled')) {
@ -198,8 +224,8 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
version: info['Version'], version: info['Version'],
email: info['Author-email'], email: info['Author-email'],
homepage: info['Home-page'], homepage: info['Home-page'],
details: info['Description'] details: info['Description'],
} };
this.setInfo(values); this.setInfo(values);
delete info; delete info;
}, },
@ -237,7 +263,7 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
var r = dv.getRecords(selections)[0]; var r = dv.getRecords(selections)[0];
deluge.client.web.get_plugin_info(r.get('plugin'), { deluge.client.web.get_plugin_info(r.get('plugin'), {
success: this.onGotPluginInfo, success: this.onGotPluginInfo,
scope: this scope: this,
}); });
}, },
@ -247,5 +273,5 @@ Deluge.preferences.Plugins = Ext.extend(Ext.Panel, {
onPluginInfoRender: function(ct, position) { onPluginInfoRender: function(ct, position) {
this.setInfo(); this.setInfo();
} },
}); });

View File

@ -16,7 +16,6 @@ PreferencesRecord = Ext.data.Record.create([{name:'name', type:'string'}]);
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, { Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
/** /**
* @property {String} currentPage The currently selected page. * @property {String} currentPage The currently selected page.
*/ */
@ -38,33 +37,38 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
pages: {}, pages: {},
initComponent: function() { initComponent: function() {
Deluge.preferences.PreferencesWindow.superclass.initComponent.call(this); Deluge.preferences.PreferencesWindow.superclass.initComponent.call(
this
);
this.list = new Ext.list.ListView({ this.list = new Ext.list.ListView({
store: new Ext.data.Store(), store: new Ext.data.Store(),
columns: [{ columns: [
{
id: 'name', id: 'name',
renderer: fplain, renderer: fplain,
dataIndex: 'name' dataIndex: 'name',
}], },
],
singleSelect: true, singleSelect: true,
listeners: { listeners: {
'selectionchange': { selectionchange: {
fn: this.onPageSelect, scope: this fn: this.onPageSelect,
} scope: this,
},
}, },
hideHeaders: true, hideHeaders: true,
autoExpandColumn: 'name', autoExpandColumn: 'name',
deferredRender: false, deferredRender: false,
autoScroll: true, autoScroll: true,
collapsible: true collapsible: true,
}); });
this.add({ this.add({
region: 'west', region: 'west',
items: [this.list], items: [this.list],
width: 120, width: 120,
margins: '0 5 0 0', margins: '0 5 0 0',
cmargins: '0 5 0 0' cmargins: '0 5 0 0',
}); });
this.configPanel = this.add({ this.configPanel = this.add({
@ -73,10 +77,10 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
region: 'center', region: 'center',
layout: 'card', layout: 'card',
layoutConfig: { layoutConfig: {
deferredRender: true deferredRender: true,
}, },
autoScroll: true, autoScroll: true,
width: 300 width: 300,
}); });
this.addButton(_('Close'), this.onClose, this); this.addButton(_('Close'), this.onClose, this);
@ -110,11 +114,14 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
if (!Ext.isObjectEmpty(changed)) { if (!Ext.isObjectEmpty(changed)) {
// Workaround for only displaying single listen port but still pass array to core. // Workaround for only displaying single listen port but still pass array to core.
if ('listen_ports' in changed) { if ('listen_ports' in changed) {
changed.listen_ports = [changed.listen_ports, changed.listen_ports] changed.listen_ports = [
changed.listen_ports,
changed.listen_ports,
];
} }
deluge.client.core.set_config(changed, { deluge.client.core.set_config(changed, {
success: this.onSetConfig, success: this.onSetConfig,
scope: this scope: this,
}); });
} }
@ -123,7 +130,6 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
} }
}, },
/** /**
* Return the options manager for the preferences window. * Return the options manager for the preferences window.
* @returns {Deluge.OptionsManager} the options manager * @returns {Deluge.OptionsManager} the options manager
@ -165,7 +171,9 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
*/ */
selectPage: function(page) { selectPage: function(page) {
if (this.pages[page].index < 0) { if (this.pages[page].index < 0) {
this.pages[page].index = this.configPanel.items.indexOf(this.pages[page]); this.pages[page].index = this.configPanel.items.indexOf(
this.pages[page]
);
} }
this.list.select(this.pages[page].index); this.list.select(this.pages[page].index);
}, },
@ -173,7 +181,9 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
// private // private
doSelectPage: function(page) { doSelectPage: function(page) {
if (this.pages[page].index < 0) { if (this.pages[page].index < 0) {
this.pages[page].index = this.configPanel.items.indexOf(this.pages[page]); this.pages[page].index = this.configPanel.items.indexOf(
this.pages[page]
);
} }
this.configPanel.getLayout().setActiveItem(this.pages[page].index); this.configPanel.getLayout().setActiveItem(this.pages[page].index);
this.currentPage = page; this.currentPage = page;
@ -208,8 +218,8 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
if (!deluge.client.core) return; if (!deluge.client.core) return;
deluge.client.core.get_config({ deluge.client.core.get_config({
success: this.onGotConfig, success: this.onGotConfig,
scope: this scope: this,
}) });
}, },
// private // private
@ -223,7 +233,7 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
if (!Ext.isObjectEmpty(changed)) { if (!Ext.isObjectEmpty(changed)) {
deluge.client.core.set_config(changed, { deluge.client.core.set_config(changed, {
success: this.onSetConfig, success: this.onSetConfig,
scope: this scope: this,
}); });
} }
@ -232,5 +242,5 @@ Deluge.preferences.PreferencesWindow = Ext.extend(Ext.Window, {
} }
this.hide(); this.hide();
} },
}); });

View File

@ -14,7 +14,6 @@ Ext.ns('Deluge.preferences');
* @extends Ext.form.FieldSet * @extends Ext.form.FieldSet
*/ */
Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
border: false, border: false,
autoHeight: true, autoHeight: true,
labelWidth: 70, labelWidth: 70,
@ -37,13 +36,13 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
[3, _('Socks5 Auth')], [3, _('Socks5 Auth')],
[4, _('HTTP')], [4, _('HTTP')],
[5, _('HTTP Auth')], [5, _('HTTP Auth')],
[6, _('I2P')] [6, _('I2P')],
] ],
}), }),
editable: false, editable: false,
triggerAction: 'all', triggerAction: 'all',
valueField: 'id', valueField: 'id',
displayField: 'text' displayField: 'text',
}); });
this.proxyType.on('change', this.onFieldChange, this); this.proxyType.on('change', this.onFieldChange, this);
this.proxyType.on('select', this.onTypeSelect, this); this.proxyType.on('select', this.onTypeSelect, this);
@ -53,7 +52,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
name: 'hostname', name: 'hostname',
fieldLabel: _('Host:'), fieldLabel: _('Host:'),
labelSeparator: '', labelSeparator: '',
width: 220 width: 220,
}); });
this.hostname.on('change', this.onFieldChange, this); this.hostname.on('change', this.onFieldChange, this);
@ -65,7 +64,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
width: 80, width: 80,
decimalPrecision: 0, decimalPrecision: 0,
minValue: 0, minValue: 0,
maxValue: 65535 maxValue: 65535,
}); });
this.port.on('change', this.onFieldChange, this); this.port.on('change', this.onFieldChange, this);
@ -74,7 +73,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
name: 'username', name: 'username',
fieldLabel: _('Username:'), fieldLabel: _('Username:'),
labelSeparator: '', labelSeparator: '',
width: 220 width: 220,
}); });
this.username.on('change', this.onFieldChange, this); this.username.on('change', this.onFieldChange, this);
@ -84,7 +83,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
fieldLabel: _('Password:'), fieldLabel: _('Password:'),
labelSeparator: '', labelSeparator: '',
inputType: 'password', inputType: 'password',
width: 220 width: 220,
}); });
this.password.on('change', this.onFieldChange, this); this.password.on('change', this.onFieldChange, this);
@ -93,7 +92,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
name: 'proxy_host_resolve', name: 'proxy_host_resolve',
fieldLabel: '', fieldLabel: '',
boxLabel: _('Proxy Hostnames'), boxLabel: _('Proxy Hostnames'),
width: 220 width: 220,
}); });
this.proxy_host_resolve.on('change', this.onFieldChange, this); this.proxy_host_resolve.on('change', this.onFieldChange, this);
@ -102,7 +101,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
name: 'proxy_peer_conn', name: 'proxy_peer_conn',
fieldLabel: '', fieldLabel: '',
boxLabel: _('Proxy Peers'), boxLabel: _('Proxy Peers'),
width: 220 width: 220,
}); });
this.proxy_peer_conn.on('change', this.onFieldChange, this); this.proxy_peer_conn.on('change', this.onFieldChange, this);
@ -111,7 +110,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
name: 'proxy_tracker_conn', name: 'proxy_tracker_conn',
fieldLabel: '', fieldLabel: '',
boxLabel: _('Proxy Trackers'), boxLabel: _('Proxy Trackers'),
width: 220 width: 220,
}); });
this.proxy_tracker_conn.on('change', this.onFieldChange, this); this.proxy_tracker_conn.on('change', this.onFieldChange, this);
@ -122,7 +121,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox', defaultType: 'checkbox',
style: 'padding-left: 0px; margin-top: 10px' style: 'padding-left: 0px; margin-top: 10px',
}); });
this.force_proxy = fieldset.add({ this.force_proxy = fieldset.add({
@ -130,8 +129,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
labelSeparator: '', labelSeparator: '',
height: 20, height: 20,
name: 'force_proxy', name: 'force_proxy',
boxLabel: _('Force Use of Proxy') boxLabel: _('Force Use of Proxy'),
}); });
this.force_proxy.on('change', this.onFieldChange, this); this.force_proxy.on('change', this.onFieldChange, this);
@ -140,7 +138,7 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
labelSeparator: '', labelSeparator: '',
height: 20, height: 20,
name: 'anonymous_mode', name: 'anonymous_mode',
boxLabel: _('Hide Client Identity') boxLabel: _('Hide Client Identity'),
}); });
this.anonymous_mode.on('change', this.onFieldChange, this); this.anonymous_mode.on('change', this.onFieldChange, this);
@ -153,17 +151,17 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
getValue: function() { getValue: function() {
return { return {
'type': this.proxyType.getValue(), type: this.proxyType.getValue(),
'hostname': this.hostname.getValue(), hostname: this.hostname.getValue(),
'port': Number(this.port.getValue()), port: Number(this.port.getValue()),
'username': this.username.getValue(), username: this.username.getValue(),
'password': this.password.getValue(), password: this.password.getValue(),
'proxy_hostnames': this.proxy_host_resolve.getValue(), proxy_hostnames: this.proxy_host_resolve.getValue(),
'proxy_peer_connections': this.proxy_peer_conn.getValue(), proxy_peer_connections: this.proxy_peer_conn.getValue(),
'proxy_tracker_connections': this.proxy_tracker_conn.getValue(), proxy_tracker_connections: this.proxy_tracker_conn.getValue(),
'force_proxy': this.force_proxy.getValue(), force_proxy: this.force_proxy.getValue(),
'anonymous_mode': this.anonymous_mode.getValue() anonymous_mode: this.anonymous_mode.getValue(),
} };
}, },
// Set the values of the proxies // Set the values of the proxies
@ -223,5 +221,5 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
this.username.hide(); this.username.hide();
this.password.hide(); this.password.hide();
} }
} },
}); });

View File

@ -15,30 +15,35 @@ Ext.namespace('Deluge.preferences');
*/ */
Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) { constructor: function(config) {
config = Ext.apply({ config = Ext.apply(
{
border: false, border: false,
title: _('Proxy'), title: _('Proxy'),
header: false, header: false,
layout: 'form', layout: 'form',
autoScroll: true autoScroll: true,
}, config); },
config
);
Deluge.preferences.Proxy.superclass.constructor.call(this, config); Deluge.preferences.Proxy.superclass.constructor.call(this, config);
}, },
initComponent: function() { initComponent: function() {
Deluge.preferences.Proxy.superclass.initComponent.call(this); Deluge.preferences.Proxy.superclass.initComponent.call(this);
this.proxy = this.add(new Deluge.preferences.ProxyField({ this.proxy = this.add(
new Deluge.preferences.ProxyField({
title: _('Proxy'), title: _('Proxy'),
name: 'proxy' name: 'proxy',
})); })
);
this.proxy.on('change', this.onProxyChange, this); this.proxy.on('change', this.onProxyChange, this);
deluge.preferences.getOptionsManager().bind('proxy', this.proxy); deluge.preferences.getOptionsManager().bind('proxy', this.proxy);
}, },
getValue: function() { getValue: function() {
return { return {
'proxy': this.proxy.getValue() proxy: this.proxy.getValue(),
} };
}, },
setValue: function(value) { setValue: function(value) {
@ -53,5 +58,5 @@ Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, {
oldValues[field.getName()] = oldValue; oldValues[field.getName()] = oldValue;
this.fireEvent('change', this, newValues, oldValues); this.fireEvent('change', this, newValues, oldValues);
} },
}); });

View File

@ -14,7 +14,6 @@ Ext.namespace('Deluge.preferences');
* @extends Ext.form.FormPanel * @extends Ext.form.FormPanel
*/ */
Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, { Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
border: false, border: false,
title: _('Queue'), title: _('Queue'),
header: false, header: false,
@ -32,15 +31,18 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
style: 'padding-top: 5px; margin-bottom: 0px;', style: 'padding-top: 5px; margin-bottom: 0px;',
autoHeight: true, autoHeight: true,
labelWidth: 1, labelWidth: 1,
defaultType: 'checkbox' defaultType: 'checkbox',
}); });
om.bind('queue_new_to_top', fieldset.add({ om.bind(
'queue_new_to_top',
fieldset.add({
fieldLabel: '', fieldLabel: '',
labelSeparator: '', labelSeparator: '',
height: 22, height: 22,
boxLabel: _('Queue to top'), boxLabel: _('Queue to top'),
name: 'queue_new_to_top' name: 'queue_new_to_top',
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -49,9 +51,11 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
autoHeight: true, autoHeight: true,
labelWidth: 150, labelWidth: 150,
defaultType: 'spinnerfield', defaultType: 'spinnerfield',
style: 'padding-top: 5px; margin-bottom: 0px' style: 'padding-top: 5px; margin-bottom: 0px',
}); });
om.bind('max_active_limit', fieldset.add({ om.bind(
'max_active_limit',
fieldset.add({
fieldLabel: _('Total:'), fieldLabel: _('Total:'),
labelSeparator: '', labelSeparator: '',
name: 'max_active_limit', name: 'max_active_limit',
@ -59,9 +63,12 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
width: 80, width: 80,
decimalPrecision: 0, decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
})); })
om.bind('max_active_downloading', fieldset.add({ );
om.bind(
'max_active_downloading',
fieldset.add({
fieldLabel: _('Downloading:'), fieldLabel: _('Downloading:'),
labelSeparator: '', labelSeparator: '',
name: 'max_active_downloading', name: 'max_active_downloading',
@ -69,9 +76,12 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
width: 80, width: 80,
decimalPrecision: 0, decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
})); })
om.bind('max_active_seeding', fieldset.add({ );
om.bind(
'max_active_seeding',
fieldset.add({
fieldLabel: _('Seeding:'), fieldLabel: _('Seeding:'),
labelSeparator: '', labelSeparator: '',
name: 'max_active_seeding', name: 'max_active_seeding',
@ -79,21 +89,28 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
width: 80, width: 80,
decimalPrecision: 0, decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
})); })
om.bind('dont_count_slow_torrents', fieldset.add({ );
om.bind(
'dont_count_slow_torrents',
fieldset.add({
xtype: 'checkbox', xtype: 'checkbox',
name: 'dont_count_slow_torrents', name: 'dont_count_slow_torrents',
height: 22, height: 22,
hideLabel: true, hideLabel: true,
boxLabel: _('Ignore slow torrents') boxLabel: _('Ignore slow torrents'),
})); })
om.bind('auto_manage_prefer_seeds', fieldset.add({ );
om.bind(
'auto_manage_prefer_seeds',
fieldset.add({
xtype: 'checkbox', xtype: 'checkbox',
name: 'auto_manage_prefer_seeds', name: 'auto_manage_prefer_seeds',
hideLabel: true, hideLabel: true,
boxLabel: _('Prefer seeding torrents') boxLabel: _('Prefer seeding torrents'),
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -102,9 +119,11 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
autoHeight: true, autoHeight: true,
labelWidth: 150, labelWidth: 150,
defaultType: 'spinnerfield', defaultType: 'spinnerfield',
style: 'padding-top: 5px; margin-bottom: 0px' style: 'padding-top: 5px; margin-bottom: 0px',
}); });
om.bind('share_ratio_limit', fieldset.add({ om.bind(
'share_ratio_limit',
fieldset.add({
fieldLabel: _('Share Ratio:'), fieldLabel: _('Share Ratio:'),
labelSeparator: '', labelSeparator: '',
name: 'share_ratio_limit', name: 'share_ratio_limit',
@ -114,9 +133,12 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
minValue: -1, minValue: -1,
maxValue: 99999, maxValue: 99999,
alternateIncrementValue: 1, alternateIncrementValue: 1,
decimalPrecision: 2 decimalPrecision: 2,
})); })
om.bind('seed_time_ratio_limit', fieldset.add({ );
om.bind(
'seed_time_ratio_limit',
fieldset.add({
fieldLabel: _('Time Ratio:'), fieldLabel: _('Time Ratio:'),
labelSeparator: '', labelSeparator: '',
name: 'seed_time_ratio_limit', name: 'seed_time_ratio_limit',
@ -126,9 +148,12 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
minValue: -1, minValue: -1,
maxValue: 99999, maxValue: 99999,
alternateIncrementValue: 1, alternateIncrementValue: 1,
decimalPrecision: 2 decimalPrecision: 2,
})); })
om.bind('seed_time_limit', fieldset.add({ );
om.bind(
'seed_time_limit',
fieldset.add({
fieldLabel: _('Time (m):'), fieldLabel: _('Time (m):'),
labelSeparator: '', labelSeparator: '',
name: 'seed_time_limit', name: 'seed_time_limit',
@ -136,8 +161,9 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
width: 80, width: 80,
decimalPrecision: 0, decimalPrecision: 0,
minValue: -1, minValue: -1,
maxValue: 99999 maxValue: 99999,
})); })
);
fieldset = this.add({ fieldset = this.add({
xtype: 'fieldset', xtype: 'fieldset',
@ -153,12 +179,12 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
defaults: { defaults: {
fieldLabel: '', fieldLabel: '',
labelSeparator: '' labelSeparator: '',
} },
}); });
this.stopAtRatio = fieldset.add({ this.stopAtRatio = fieldset.add({
name: 'stop_seed_at_ratio', name: 'stop_seed_at_ratio',
boxLabel: _('Share Ratio:') boxLabel: _('Share Ratio:'),
}); });
this.stopAtRatio.on('check', this.onStopRatioCheck, this); this.stopAtRatio.on('check', this.onStopRatioCheck, this);
om.bind('stop_seed_at_ratio', this.stopAtRatio); om.bind('stop_seed_at_ratio', this.stopAtRatio);
@ -174,7 +200,7 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
minValue: -1, minValue: -1,
maxValue: 99999, maxValue: 99999,
alternateIncrementValue: 1, alternateIncrementValue: 1,
decimalPrecision: 2 decimalPrecision: 2,
}); });
om.bind('stop_seed_ratio', this.stopRatio); om.bind('stop_seed_ratio', this.stopRatio);
@ -183,17 +209,20 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
columns: 1, columns: 1,
colspan: 2, colspan: 2,
disabled: true, disabled: true,
style: "margin-left: 10px", style: 'margin-left: 10px',
items: [{ items: [
{
boxLabel: _('Pause torrent'), boxLabel: _('Pause torrent'),
name: 'at_ratio', name: 'at_ratio',
inputValue: false, inputValue: false,
checked: true checked: true,
}, { },
{
boxLabel: _('Remove torrent'), boxLabel: _('Remove torrent'),
name: 'at_ratio', name: 'at_ratio',
inputValue: true inputValue: true,
}] },
],
}); });
om.bind('remove_seed_at_ratio', this.removeAtRatio); om.bind('remove_seed_at_ratio', this.removeAtRatio);
}, },
@ -201,5 +230,5 @@ Deluge.preferences.Queue = Ext.extend(Ext.form.FormPanel, {
onStopRatioCheck: function(e, checked) { onStopRatioCheck: function(e, checked) {
this.stopRatio.setDisabled(!checked); this.stopRatio.setDisabled(!checked);
this.removeAtRatio.setDisabled(!checked); this.removeAtRatio.setDisabled(!checked);
} },
}); });

View File

@ -6,7 +6,7 @@ Ext.ux.JSLoader = function(options) {
options: options, options: options,
onLoad: options.onLoad || Ext.emptyFn, onLoad: options.onLoad || Ext.emptyFn,
onError: options.onError || Ext.ux.JSLoader.stdError, onError: options.onError || Ext.ux.JSLoader.stdError,
scope: options.scope || this scope: options.scope || this,
}; };
Ext.Ajax.request({ Ext.Ajax.request({
@ -28,11 +28,13 @@ Ext.ux.JSLoader = function(options) {
var script = Ext.ux.JSLoader.scripts[options.scriptIndex]; var script = Ext.ux.JSLoader.scripts[options.scriptIndex];
script.success = false; script.success = false;
script.onError(script.options, response.status); script.onError(script.options, response.status);
} },
}); });
}; };
Ext.ux.JSLoader.index = 0; Ext.ux.JSLoader.index = 0;
Ext.ux.JSLoader.scripts = []; Ext.ux.JSLoader.scripts = [];
Ext.ux.JSLoader.stdError = function(options, e) { Ext.ux.JSLoader.stdError = function(options, e) {
window.alert('Error loading script:\n\n' + options.url + '\n\nstatus: ' + e); window.alert(
'Error loading script:\n\n' + options.url + '\n\nstatus: ' + e
);
}; };

View File

@ -37,22 +37,21 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
}, },
doRender: function(ct, position) { doRender: function(ct, position) {
var el = this.el = this.field.getEl(); var el = (this.el = this.field.getEl());
var f = this.field; var f = this.field;
if (!f.wrap) { if (!f.wrap) {
f.wrap = this.wrap = el.wrap({ f.wrap = this.wrap = el.wrap({
cls: "x-form-field-wrap" cls: 'x-form-field-wrap',
}); });
} } else {
else {
this.wrap = f.wrap.addClass('x-form-field-wrap'); this.wrap = f.wrap.addClass('x-form-field-wrap');
} }
this.trigger = this.wrap.createChild({ this.trigger = this.wrap.createChild({
tag: "img", tag: 'img',
src: Ext.BLANK_IMAGE_URL, src: Ext.BLANK_IMAGE_URL,
cls: "x-form-trigger " + this.triggerClass cls: 'x-form-trigger ' + this.triggerClass,
}); });
if (!f.width) { if (!f.width) {
@ -62,17 +61,20 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
this.splitter = this.wrap.createChild({ this.splitter = this.wrap.createChild({
tag: 'div', tag: 'div',
cls: this.splitterClass, cls: this.splitterClass,
style: 'width:13px; height:2px;' style: 'width:13px; height:2px;',
}); });
this.splitter.setRight((Ext.isIE) ? 1 : 2).setTop(10).show(); this.splitter
.setRight(Ext.isIE ? 1 : 2)
.setTop(10)
.show();
this.proxy = this.trigger.createProxy('', this.splitter, true); this.proxy = this.trigger.createProxy('', this.splitter, true);
this.proxy.addClass("x-form-spinner-proxy"); this.proxy.addClass('x-form-spinner-proxy');
this.proxy.setStyle('left', '0px'); this.proxy.setStyle('left', '0px');
this.proxy.setSize(14, 1); this.proxy.setSize(14, 1);
this.proxy.hide(); this.proxy.hide();
this.dd = new Ext.dd.DDProxy(this.splitter.dom.id, "SpinnerDrag", { this.dd = new Ext.dd.DDProxy(this.splitter.dom.id, 'SpinnerDrag', {
dragElId: this.proxy.id dragElId: this.proxy.id,
}); });
this.initTrigger(); this.initTrigger();
@ -113,9 +115,14 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
if (!this.mimicing) { if (!this.mimicing) {
this.wrap.addClass('x-trigger-wrap-focus'); this.wrap.addClass('x-trigger-wrap-focus');
this.mimicing = true; this.mimicing = true;
Ext.get(Ext.isIE ? document.body : document).on("mousedown", this.mimicBlur, this, { Ext.get(Ext.isIE ? document.body : document).on(
delay: 10 'mousedown',
}); this.mimicBlur,
this,
{
delay: 10,
}
);
this.el.on('keydown', this.checkTab, this); this.el.on('keydown', this.checkTab, this);
} }
}, },
@ -137,8 +144,12 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
// private // private
triggerBlur: function() { triggerBlur: function() {
this.mimicing = false; this.mimicing = false;
Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this); Ext.get(Ext.isIE ? document.body : document).un(
this.el.un("keydown", this.checkTab, this); 'mousedown',
this.mimicBlur,
this
);
this.el.un('keydown', this.checkTab, this);
this.field.beforeBlur(); this.field.beforeBlur();
this.wrap.removeClass('x-trigger-wrap-focus'); this.wrap.removeClass('x-trigger-wrap-focus');
this.field.onBlur.call(this.field); this.field.onBlur.call(this.field);
@ -151,40 +162,40 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
initSpinner: function() { initSpinner: function() {
this.field.addEvents({ this.field.addEvents({
'spin': true, spin: true,
'spinup': true, spinup: true,
'spindown': true spindown: true,
}); });
this.keyNav = new Ext.KeyNav(this.el, { this.keyNav = new Ext.KeyNav(this.el, {
"up": function(e){ up: function(e) {
e.preventDefault(); e.preventDefault();
this.onSpinUp(); this.onSpinUp();
}, },
"down": function(e){ down: function(e) {
e.preventDefault(); e.preventDefault();
this.onSpinDown(); this.onSpinDown();
}, },
"pageUp": function(e){ pageUp: function(e) {
e.preventDefault(); e.preventDefault();
this.onSpinUpAlternate(); this.onSpinUpAlternate();
}, },
"pageDown": function(e){ pageDown: function(e) {
e.preventDefault(); e.preventDefault();
this.onSpinDownAlternate(); this.onSpinDownAlternate();
}, },
scope: this scope: this,
}); });
this.repeater = new Ext.util.ClickRepeater(this.trigger, { this.repeater = new Ext.util.ClickRepeater(this.trigger, {
accelerate: this.accelerate accelerate: this.accelerate,
}); });
this.field.mon(this.repeater, "click", this.onTriggerClick, this, { this.field.mon(this.repeater, 'click', this.onTriggerClick, this, {
preventDefault: true preventDefault: true,
}); });
this.field.mon(this.trigger, { this.field.mon(this.trigger, {
@ -194,10 +205,10 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
mousedown: this.onMouseDown, mousedown: this.onMouseDown,
mouseup: this.onMouseUp, mouseup: this.onMouseUp,
scope: this, scope: this,
preventDefault: true preventDefault: true,
}); });
this.field.mon(this.wrap, "mousewheel", this.handleMouseWheel, this); this.field.mon(this.wrap, 'mousewheel', this.handleMouseWheel, this);
this.dd.setXConstraint(0, 0, 10); this.dd.setXConstraint(0, 0, 10);
this.dd.setYConstraint(1500, 1500, 10); this.dd.setYConstraint(1500, 1500, 10);
@ -211,7 +222,10 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
return; return;
} }
var middle = this.getMiddle(); var middle = this.getMiddle();
this.tmpHoverClass = (Ext.EventObject.getPageY() < middle) ? 'x-form-spinner-overup' : 'x-form-spinner-overdown'; this.tmpHoverClass =
Ext.EventObject.getPageY() < middle
? 'x-form-spinner-overup'
: 'x-form-spinner-overdown';
this.trigger.addClass(this.tmpHoverClass); this.trigger.addClass(this.tmpHoverClass);
}, },
@ -226,8 +240,12 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
return; return;
} }
var middle = this.getMiddle(); var middle = this.getMiddle();
if (((Ext.EventObject.getPageY() > middle) && this.tmpHoverClass == "x-form-spinner-overup") || if (
((Ext.EventObject.getPageY() < middle) && this.tmpHoverClass == "x-form-spinner-overdown")) { (Ext.EventObject.getPageY() > middle &&
this.tmpHoverClass == 'x-form-spinner-overup') ||
(Ext.EventObject.getPageY() < middle &&
this.tmpHoverClass == 'x-form-spinner-overdown')
) {
} }
}, },
@ -237,7 +255,10 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
return; return;
} }
var middle = this.getMiddle(); var middle = this.getMiddle();
this.tmpClickClass = (Ext.EventObject.getPageY() < middle) ? 'x-form-spinner-clickup' : 'x-form-spinner-clickdown'; this.tmpClickClass =
Ext.EventObject.getPageY() < middle
? 'x-form-spinner-clickup'
: 'x-form-spinner-clickdown';
this.trigger.addClass(this.tmpClickClass); this.trigger.addClass(this.tmpClickClass);
}, },
@ -252,7 +273,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
return; return;
} }
var middle = this.getMiddle(); var middle = this.getMiddle();
var ud = (Ext.EventObject.getPageY() < middle) ? 'Up' : 'Down'; var ud = Ext.EventObject.getPageY() < middle ? 'Up' : 'Down';
this['onSpin' + ud](); this['onSpin' + ud]();
}, },
@ -260,7 +281,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
getMiddle: function() { getMiddle: function() {
var t = this.trigger.getTop(); var t = this.trigger.getTop();
var h = this.trigger.getHeight(); var h = this.trigger.getHeight();
var middle = t + (h / 2); var middle = t + h / 2;
return middle; return middle;
}, },
@ -284,9 +305,7 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
if (delta > 0) { if (delta > 0) {
this.onSpinUp(); this.onSpinUp();
e.stopEvent(); e.stopEvent();
} } else if (delta < 0) {
else
if (delta < 0) {
this.onSpinDown(); this.onSpinDown();
e.stopEvent(); e.stopEvent();
} }
@ -332,12 +351,11 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
if (Ext.EventObject.shiftKey == true) { if (Ext.EventObject.shiftKey == true) {
this.onSpinUpAlternate(); this.onSpinUpAlternate();
return; return;
} } else {
else {
this.spin(false, false); this.spin(false, false);
} }
this.field.fireEvent("spin", this); this.field.fireEvent('spin', this);
this.field.fireEvent("spinup", this); this.field.fireEvent('spinup', this);
}, },
//private //private
@ -348,12 +366,11 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
if (Ext.EventObject.shiftKey == true) { if (Ext.EventObject.shiftKey == true) {
this.onSpinDownAlternate(); this.onSpinDownAlternate();
return; return;
} } else {
else {
this.spin(true, false); this.spin(true, false);
} }
this.field.fireEvent("spin", this); this.field.fireEvent('spin', this);
this.field.fireEvent("spindown", this); this.field.fireEvent('spindown', this);
}, },
//private //private
@ -362,8 +379,8 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
return; return;
} }
this.spin(false, true); this.spin(false, true);
this.field.fireEvent("spin", this); this.field.fireEvent('spin', this);
this.field.fireEvent("spinup", this); this.field.fireEvent('spinup', this);
}, },
//private //private
@ -372,16 +389,19 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
return; return;
} }
this.spin(true, true); this.spin(true, true);
this.field.fireEvent("spin", this); this.field.fireEvent('spin', this);
this.field.fireEvent("spindown", this); this.field.fireEvent('spindown', this);
}, },
spin: function(down, alternate) { spin: function(down, alternate) {
var v = parseFloat(this.field.getValue()); var v = parseFloat(this.field.getValue());
var incr = (alternate == true) ? this.alternateIncrementValue : this.incrementValue; var incr =
(down == true) ? v -= incr : v += incr; alternate == true
? this.alternateIncrementValue
: this.incrementValue;
down == true ? (v -= incr) : (v += incr);
v = (isNaN(v)) ? this.defaultValue : v; v = isNaN(v) ? this.defaultValue : v;
v = this.fixBoundries(v); v = this.fixBoundries(v);
this.field.setRawValue(v); this.field.setRawValue(v);
}, },
@ -402,10 +422,17 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
// private // private
fixPrecision: function(value) { fixPrecision: function(value) {
var nan = isNaN(value); var nan = isNaN(value);
if (!this.field.allowDecimals || this.field.decimalPrecision == -1 || nan || !value) { if (
!this.field.allowDecimals ||
this.field.decimalPrecision == -1 ||
nan ||
!value
) {
return nan ? '' : value; return nan ? '' : value;
} }
return parseFloat(parseFloat(value).toFixed(this.field.decimalPrecision)); return parseFloat(
parseFloat(value).toFixed(this.field.decimalPrecision)
);
}, },
doDestroy: function() { doDestroy: function() {
@ -434,9 +461,13 @@ Ext.ux.Spinner = Ext.extend(Ext.util.Observable, {
this.repeater.purgeListeners(); this.repeater.purgeListeners();
} }
if (this.mimicing) { if (this.mimicing) {
Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this); Ext.get(Ext.isIE ? document.body : document).un(
} 'mousedown',
this.mimicBlur,
this
);
} }
},
}); });
//backwards compat //backwards compat

View File

@ -198,7 +198,7 @@ sb.setStatus({
this.currIconCls = this.iconCls || this.defaultIconCls; this.currIconCls = this.iconCls || this.defaultIconCls;
this.statusEl = new Ext.Toolbar.TextItem({ this.statusEl = new Ext.Toolbar.TextItem({
cls: 'x-status-text ' + (this.currIconCls || ''), cls: 'x-status-text ' + (this.currIconCls || ''),
text: this.text || this.defaultText || '' text: this.text || this.defaultText || '',
}); });
if (right) { if (right) {
@ -318,7 +318,11 @@ statusBar.setStatus({
} }
var text = o.useDefaults ? this.defaultText : this.emptyText, var text = o.useDefaults ? this.defaultText : this.emptyText,
iconCls = o.useDefaults ? (this.defaultIconCls ? this.defaultIconCls : '') : ''; iconCls = o.useDefaults
? this.defaultIconCls
? this.defaultIconCls
: ''
: '';
if (o.anim) { if (o.anim) {
// animate the statusEl Ext.Element // animate the statusEl Ext.Element
@ -329,18 +333,18 @@ statusBar.setStatus({
callback: function() { callback: function() {
this.setStatus({ this.setStatus({
text: text, text: text,
iconCls: iconCls iconCls: iconCls,
}); });
this.statusEl.el.show(); this.statusEl.el.show();
} },
}); });
} else { } else {
// hide/show the el to avoid jumpy text or icon // hide/show the el to avoid jumpy text or icon
this.statusEl.hide(); this.statusEl.hide();
this.setStatus({ this.setStatus({
text: text, text: text,
iconCls: iconCls iconCls: iconCls,
}); });
this.statusEl.show(); this.statusEl.show();
} }
@ -410,9 +414,9 @@ statusBar.setStatus({
} }
o = Ext.applyIf(o || {}, { o = Ext.applyIf(o || {}, {
text: this.busyText, text: this.busyText,
iconCls: this.busyIconCls iconCls: this.busyIconCls,
}); });
return this.setStatus(o); return this.setStatus(o);
} },
}); });
Ext.reg('statusbar', Ext.ux.StatusBar); Ext.reg('statusbar', Ext.ux.StatusBar);

View File

@ -60,7 +60,11 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, {
// private // private
onRender: function(ct, position) { onRender: function(ct, position) {
Ext.ux.form.FileUploadField.superclass.onRender.call(this, ct, position); Ext.ux.form.FileUploadField.superclass.onRender.call(
this,
ct,
position
);
this.wrap = this.el.wrap({ cls: 'x-form-field-wrap x-form-file-wrap' }); this.wrap = this.el.wrap({ cls: 'x-form-field-wrap x-form-file-wrap' });
this.el.addClass('x-form-file-text'); this.el.addClass('x-form-file-text');
@ -68,12 +72,14 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, {
this.createFileInput(); this.createFileInput();
var btnCfg = Ext.applyIf(this.buttonCfg || {}, { var btnCfg = Ext.applyIf(this.buttonCfg || {}, {
text: this.buttonText text: this.buttonText,
}); });
this.button = new Ext.Button(Ext.apply(btnCfg, { this.button = new Ext.Button(
Ext.apply(btnCfg, {
renderTo: this.wrap, renderTo: this.wrap,
cls: 'x-form-file-btn' + (btnCfg.iconCls ? ' x-btn-icon' : '') cls: 'x-form-file-btn' + (btnCfg.iconCls ? ' x-btn-icon' : ''),
})); })
);
if (this.buttonOnly) { if (this.buttonOnly) {
this.el.hide(); this.el.hide();
@ -88,22 +94,30 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, {
this.fileInput.on({ this.fileInput.on({
scope: this, scope: this,
mouseenter: function() { mouseenter: function() {
this.button.addClass(['x-btn-over','x-btn-focus']) this.button.addClass(['x-btn-over', 'x-btn-focus']);
}, },
mouseleave: function() { mouseleave: function() {
this.button.removeClass(['x-btn-over','x-btn-focus','x-btn-click']) this.button.removeClass([
'x-btn-over',
'x-btn-focus',
'x-btn-click',
]);
}, },
mousedown: function() { mousedown: function() {
this.button.addClass('x-btn-click') this.button.addClass('x-btn-click');
}, },
mouseup: function() { mouseup: function() {
this.button.removeClass(['x-btn-over','x-btn-focus','x-btn-click']) this.button.removeClass([
'x-btn-over',
'x-btn-focus',
'x-btn-click',
]);
}, },
change: function() { change: function() {
var v = this.fileInput.dom.value; var v = this.fileInput.dom.value;
this.setValue(v); this.setValue(v);
this.fireEvent('fileselected', this, v); this.fireEvent('fileselected', this, v);
} },
}); });
}, },
@ -114,7 +128,7 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, {
cls: 'x-form-file', cls: 'x-form-file',
tag: 'input', tag: 'input',
type: 'file', type: 'file',
size: 1 size: 1,
}); });
}, },
@ -139,7 +153,10 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, {
this.wrap.setWidth(w); this.wrap.setWidth(w);
if (!this.buttonOnly) { if (!this.buttonOnly) {
var w = this.wrap.getWidth() - this.button.getEl().getWidth() - this.buttonOffset; var w =
this.wrap.getWidth() -
this.button.getEl().getWidth() -
this.buttonOffset;
this.el.setWidth(w); this.el.setWidth(w);
} }
}, },
@ -158,7 +175,6 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, {
onEnable: function() { onEnable: function() {
Ext.ux.form.FileUploadField.superclass.onEnable.call(this); Ext.ux.form.FileUploadField.superclass.onEnable.call(this);
this.doDisable(false); this.doDisable(false);
}, },
// private // private
@ -167,15 +183,13 @@ Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, {
this.button.setDisabled(disabled); this.button.setDisabled(disabled);
}, },
// private // private
preFocus: Ext.emptyFn, preFocus: Ext.emptyFn,
// private // private
alignErrorIcon: function() { alignErrorIcon: function() {
this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]); this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);
} },
}); });
Ext.reg('fileuploadfield', Ext.ux.form.FileUploadField); Ext.reg('fileuploadfield', Ext.ux.form.FileUploadField);

View File

@ -10,7 +10,6 @@
// Allow radiogroups to be treated as a single form element. // Allow radiogroups to be treated as a single form element.
Ext.override(Ext.form.RadioGroup, { Ext.override(Ext.form.RadioGroup, {
afterRender: function() { afterRender: function() {
this.items.each(function(i) { this.items.each(function(i) {
this.relayEvents(i, ['check']); this.relayEvents(i, ['check']);
@ -20,7 +19,7 @@ Ext.override(Ext.form.RadioGroup, {
delete this.value; delete this.value;
delete this.lazyValue; delete this.lazyValue;
} }
Ext.form.RadioGroup.superclass.afterRender.call(this) Ext.form.RadioGroup.superclass.afterRender.call(this);
}, },
getName: function() { getName: function() {
@ -39,11 +38,13 @@ Ext.override(Ext.form.RadioGroup, {
} }
this.items.each(function(item) { this.items.each(function(item) {
if (item.rendered) { if (item.rendered) {
var checked = (item.el.getValue() == String(v)); var checked = item.el.getValue() == String(v);
item.el.dom.checked = checked; item.el.dom.checked = checked;
item.el.dom.defaultChecked = checked; item.el.dom.defaultChecked = checked;
item.wrap[checked ? 'addClass' : 'removeClass'](item.checkedCls); item.wrap[checked ? 'addClass' : 'removeClass'](
item.checkedCls
);
} }
}); });
} },
}); });

View File

@ -20,17 +20,24 @@ Ext.ux.form.SpinnerField = Ext.extend(Ext.form.NumberField, {
adjustSize: Ext.BoxComponent.prototype.adjustSize, adjustSize: Ext.BoxComponent.prototype.adjustSize,
constructor: function(config) { constructor: function(config) {
var spinnerConfig = Ext.copyTo({}, config, 'incrementValue,alternateIncrementValue,accelerate,defaultValue,triggerClass,splitterClass'); var spinnerConfig = Ext.copyTo(
{},
config,
'incrementValue,alternateIncrementValue,accelerate,defaultValue,triggerClass,splitterClass'
);
var spl = this.spinner = new Ext.ux.Spinner(spinnerConfig); var spl = (this.spinner = new Ext.ux.Spinner(spinnerConfig));
var plugins = config.plugins var plugins = config.plugins
? (Ext.isArray(config.plugins) ? Ext.isArray(config.plugins)
? config.plugins.push(spl) ? config.plugins.push(spl)
: [config.plugins, spl]) : [config.plugins, spl]
: spl; : spl;
Ext.ux.form.SpinnerField.superclass.constructor.call(this, Ext.apply(config, {plugins: plugins})); Ext.ux.form.SpinnerField.superclass.constructor.call(
this,
Ext.apply(config, { plugins: plugins })
);
}, },
// private // private
@ -52,7 +59,7 @@ Ext.ux.form.SpinnerField = Ext.extend(Ext.form.NumberField, {
validateBlur: function() { validateBlur: function() {
return true; return true;
} },
}); });
Ext.reg('spinnerfield', Ext.ux.form.SpinnerField); Ext.reg('spinnerfield', Ext.ux.form.SpinnerField);

View File

@ -9,5 +9,5 @@
*/ */
Ext.override(Ext.ux.form.SpinnerField, { Ext.override(Ext.ux.form.SpinnerField, {
onBlur: Ext.form.Field.prototype.onBlur onBlur: Ext.form.Field.prototype.onBlur,
}); });

View File

@ -13,7 +13,6 @@ Ext.ns('Ext.ux.form');
* *
*/ */
Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, { Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, {
// private // private
defaultType: 'spinnerfield', defaultType: 'spinnerfield',
anchor: '98%', anchor: '98%',
@ -30,46 +29,48 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, {
cls: this.groupCls, cls: this.groupCls,
layout: 'column', layout: 'column',
border: false, border: false,
renderTo: ct renderTo: ct,
}; };
var colCfg = Ext.apply({ var colCfg = Ext.apply(
{
defaultType: this.defaultType, defaultType: this.defaultType,
layout: 'form', layout: 'form',
border: false, border: false,
labelWidth: 60, labelWidth: 60,
defaults: { defaults: {
hideLabel: true, hideLabel: true,
anchor: '60%' anchor: '60%',
} },
}, this.colCfg); },
this.colCfg
);
if (this.items[0].items) { if (this.items[0].items) {
// The container has standard ColumnLayout configs, so pass them in directly // The container has standard ColumnLayout configs, so pass them in directly
Ext.apply(panelCfg, { Ext.apply(panelCfg, {
layoutConfig: { columns: this.items.length }, layoutConfig: { columns: this.items.length },
defaults: this.defaults, defaults: this.defaults,
items: this.items items: this.items,
}); });
for (var i = 0, len = this.items.length; i < len; i++) { for (var i = 0, len = this.items.length; i < len; i++) {
Ext.applyIf(this.items[i], colCfg); Ext.applyIf(this.items[i], colCfg);
}; }
} else { } else {
// The container has field item configs, so we have to generate the column // The container has field item configs, so we have to generate the column
// panels first then move the items into the columns as needed. // panels first then move the items into the columns as needed.
var numCols, cols = []; var numCols,
cols = [];
if(typeof this.columns == 'string'){ // 'auto' so create a col per item if (typeof this.columns == 'string') {
// 'auto' so create a col per item
this.columns = this.items.length; this.columns = this.items.length;
} }
if (!Ext.isArray(this.columns)) { if (!Ext.isArray(this.columns)) {
var cs = []; var cs = [];
for (var i = 0; i < this.columns; i++) { for (var i = 0; i < this.columns; i++) {
cs.push((100/this.columns)*.01); // distribute by even % cs.push((100 / this.columns) * 0.01); // distribute by even %
} }
this.columns = cs; this.columns = cs;
} }
@ -79,16 +80,22 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, {
// Generate the column configs with the correct width setting // Generate the column configs with the correct width setting
for (var i = 0; i < numCols; i++) { for (var i = 0; i < numCols; i++) {
var cc = Ext.apply({ items: [] }, colCfg); var cc = Ext.apply({ items: [] }, colCfg);
cc[this.columns[i] <= 1 ? 'columnWidth' : 'width'] = this.columns[i]; cc[
this.columns[i] <= 1 ? 'columnWidth' : 'width'
] = this.columns[i];
if (this.defaults) { if (this.defaults) {
cc.defaults = Ext.apply(cc.defaults || {}, this.defaults) cc.defaults = Ext.apply(
cc.defaults || {},
this.defaults
);
} }
cols.push(cc); cols.push(cc);
}; }
// Distribute the original items into the columns // Distribute the original items into the columns
if (this.vertical) { if (this.vertical) {
var rows = Math.ceil(this.items.length / numCols), ri = 0; var rows = Math.ceil(this.items.length / numCols),
ri = 0;
for (var i = 0, len = this.items.length; i < len; i++) { for (var i = 0, len = this.items.length; i < len; i++) {
if (i > 0 && i % rows == 0) { if (i > 0 && i % rows == 0) {
ri++; ri++;
@ -97,7 +104,7 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, {
this.items[i].hideLabel = false; this.items[i].hideLabel = false;
} }
cols[ri].items.push(this.items[i]); cols[ri].items.push(this.items[i]);
}; }
} else { } else {
for (var i = 0, len = this.items.length; i < len; i++) { for (var i = 0, len = this.items.length; i < len; i++) {
var ci = i % numCols; var ci = i % numCols;
@ -105,12 +112,12 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, {
this.items[i].hideLabel = false; this.items[i].hideLabel = false;
} }
cols[ci].items.push(this.items[i]); cols[ci].items.push(this.items[i]);
}; }
} }
Ext.apply(panelCfg, { Ext.apply(panelCfg, {
layoutConfig: { columns: numCols }, layoutConfig: { columns: numCols },
items: cols items: cols,
}); });
} }
@ -194,6 +201,6 @@ Ext.ux.form.SpinnerGroup = Ext.extend(Ext.form.CheckboxGroup, {
item.setRawValue(value[i]); item.setRawValue(value[i]);
}); });
} }
} },
}); });
Ext.reg('spinnergroup', Ext.ux.form.SpinnerGroup); Ext.reg('spinnergroup', Ext.ux.form.SpinnerGroup);

View File

@ -7,7 +7,7 @@
* the additional special exception to link portions of this program with the OpenSSL library. * the additional special exception to link portions of this program with the OpenSSL library.
* See LICENSE for more details. * See LICENSE for more details.
*/ */
Ext.namespace("Ext.ux.form"); Ext.namespace('Ext.ux.form');
/** /**
* Ext.ux.form.ToggleField class * Ext.ux.form.ToggleField class
@ -19,7 +19,6 @@ Ext.namespace("Ext.ux.form");
* @extends Ext.form.TriggerField * @extends Ext.form.TriggerField
*/ */
Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, { Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, {
cls: 'x-toggle-field', cls: 'x-toggle-field',
initComponent: function() { initComponent: function() {
@ -29,7 +28,7 @@ Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, {
this.toggle.on('check', this.onToggleCheck, this); this.toggle.on('check', this.onToggleCheck, this);
this.input = new Ext.form.TextField({ this.input = new Ext.form.TextField({
disabled: true disabled: true,
}); });
}, },
@ -39,10 +38,10 @@ Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, {
cls: this.groupCls, cls: this.groupCls,
layout: 'table', layout: 'table',
layoutConfig: { layoutConfig: {
columns: 2 columns: 2,
}, },
border: false, border: false,
renderTo: ct renderTo: ct,
}); });
this.panel.ownerCt = this; this.panel.ownerCt = this;
this.el = this.panel.getEl(); this.el = this.panel.getEl();
@ -51,7 +50,10 @@ Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, {
this.panel.add(this.input); this.panel.add(this.input);
this.panel.doLayout(); this.panel.doLayout();
this.toggle.getEl().parent().setStyle('padding-right', '10px'); this.toggle
.getEl()
.parent()
.setStyle('padding-right', '10px');
} }
Ext.ux.form.ToggleField.superclass.onRender.call(this, ct, position); Ext.ux.form.ToggleField.superclass.onRender.call(this, ct, position);
}, },
@ -68,6 +70,6 @@ Ext.ux.form.ToggleField = Ext.extend(Ext.form.Field, {
onToggleCheck: function(toggle, checked) { onToggleCheck: function(toggle, checked) {
this.input.setDisabled(!checked); this.input.setDisabled(!checked);
} },
}); });
Ext.reg('togglefield', Ext.ux.form.ToggleField); Ext.reg('togglefield', Ext.ux.form.ToggleField);

View File

@ -59,7 +59,9 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, {
ts.rowBody = new Ext.Template( ts.rowBody = new Ext.Template(
'<table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">', '<table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
'<tbody><tr>{cells}</tr>', '<tbody><tr>{cells}</tr>',
(this.enableRowBody ? '<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>' : ''), this.enableRowBody
? '<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>'
: '',
'</tbody></table>' '</tbody></table>'
); );
ts.rowBody.disableFormats = true; ts.rowBody.disableFormats = true;
@ -67,7 +69,9 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, {
}, },
getStyleRowHeight: function() { getStyleRowHeight: function() {
return Ext.isBorderBox ? (this.rowHeight + this.borderHeight) : this.rowHeight; return Ext.isBorderBox
? this.rowHeight + this.borderHeight
: this.rowHeight;
}, },
getCalculatedRowHeight: function() { getCalculatedRowHeight: function() {
@ -77,16 +81,19 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, {
getVisibleRowCount: function() { getVisibleRowCount: function() {
var rh = this.getCalculatedRowHeight(), var rh = this.getCalculatedRowHeight(),
visibleHeight = this.scroller.dom.clientHeight; visibleHeight = this.scroller.dom.clientHeight;
return (visibleHeight < 1) ? 0 : Math.ceil(visibleHeight / rh); return visibleHeight < 1 ? 0 : Math.ceil(visibleHeight / rh);
}, },
getVisibleRows: function() { getVisibleRows: function() {
var count = this.getVisibleRowCount(), var count = this.getVisibleRowCount(),
sc = this.scroller.dom.scrollTop, sc = this.scroller.dom.scrollTop,
start = (sc === 0 ? 0 : Math.floor(sc/this.getCalculatedRowHeight())-1); start =
sc === 0
? 0
: Math.floor(sc / this.getCalculatedRowHeight()) - 1;
return { return {
first: Math.max(start, 0), first: Math.max(start, 0),
last: Math.min(start + count + 2, this.ds.getCount()-1) last: Math.min(start + count + 2, this.ds.getCount() - 1),
}; };
}, },
@ -107,19 +114,25 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, {
rp = { tstyle: tstyle }, rp = { tstyle: tstyle },
r; r;
for (var j = 0, len = rs.length; j < len; j++) { for (var j = 0, len = rs.length; j < len; j++) {
r = rs[j]; cb = []; r = rs[j];
var rowIndex = (j+startRow), cb = [];
var rowIndex = j + startRow,
visible = rowIndex >= vr.first && rowIndex <= vr.last; visible = rowIndex >= vr.first && rowIndex <= vr.last;
if (visible) { if (visible) {
for (var i = 0; i < colCount; i++) { for (var i = 0; i < colCount; i++) {
c = cs[i]; c = cs[i];
p.id = c.id; p.id = c.id;
p.css = i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : ''); p.css =
p.attr = p.cellAttr = ""; i === 0
? 'x-grid3-cell-first '
: i == last
? 'x-grid3-cell-last '
: '';
p.attr = p.cellAttr = '';
p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds); p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);
p.style = c.style; p.style = c.style;
if (p.value === undefined || p.value === "") { if (p.value === undefined || p.value === '') {
p.value = "&#160;"; p.value = '&#160;';
} }
if (r.dirty && typeof r.modified[c.name] !== 'undefined') { if (r.dirty && typeof r.modified[c.name] !== 'undefined') {
p.css += ' x-grid3-dirty-cell'; p.css += ' x-grid3-dirty-cell';
@ -128,21 +141,25 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, {
} }
} }
var alt = []; var alt = [];
if(stripe && ((rowIndex+1) % 2 === 0)){ if (stripe && (rowIndex + 1) % 2 === 0) {
alt[0] = "x-grid3-row-alt"; alt[0] = 'x-grid3-row-alt';
} }
if (r.dirty) { if (r.dirty) {
alt[1] = " x-grid3-dirty-row"; alt[1] = ' x-grid3-dirty-row';
} }
rp.cols = colCount; rp.cols = colCount;
if (this.getRowClass) { if (this.getRowClass) {
alt[2] = this.getRowClass(r, rowIndex, rp, ds); alt[2] = this.getRowClass(r, rowIndex, rp, ds);
} }
rp.alt = alt.join(" "); rp.alt = alt.join(' ');
rp.cells = cb.join(""); rp.cells = cb.join('');
buf[buf.length] = !visible ? ts.rowHolder.apply(rp) : (onlyBody ? rb.apply(rp) : rt.apply(rp)); buf[buf.length] = !visible
? ts.rowHolder.apply(rp)
: onlyBody
? rb.apply(rp)
: rt.apply(rp);
} }
return buf.join(""); return buf.join('');
}, },
isRowRendered: function(index) { isRowRendered: function(index) {
@ -185,7 +202,15 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, {
for (var i = vr.first; i <= vr.last; i++) { for (var i = vr.first; i <= vr.last; i++) {
// if row is NOT rendered and is visible, render it // if row is NOT rendered and is visible, render it
if (!this.isRowRendered(i) && (row = this.getRow(i))) { if (!this.isRowRendered(i) && (row = this.getRow(i))) {
var html = this.doRender(cs, [ds.getAt(i)], ds, i, cm.getColumnCount(), g.stripeRows, true); var html = this.doRender(
cs,
[ds.getAt(i)],
ds,
i,
cm.getColumnCount(),
g.stripeRows,
true
);
row.innerHTML = html; row.innerHTML = html;
} }
} }
@ -207,7 +232,8 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, {
vr.first -= this.cacheSize; vr.first -= this.cacheSize;
vr.last += this.cacheSize; vr.last += this.cacheSize;
var i = 0, rows = this.getRows(); var i = 0,
rows = this.getRows();
// if first is less than 0, all rows have been rendered // if first is less than 0, all rows have been rendered
// so lets clean the end... // so lets clean the end...
if (vr.first <= 0) { if (vr.first <= 0) {
@ -240,5 +266,5 @@ Ext.ux.grid.BufferView = Ext.extend(Ext.grid.GridView, {
layout: function() { layout: function() {
Ext.ux.grid.BufferView.superclass.layout.call(this); Ext.ux.grid.BufferView.superclass.layout.call(this);
this.update(); this.update();
} },
}); });

View File

@ -13,7 +13,12 @@
// the label. don't use hideLabel with this. // the label. don't use hideLabel with this.
Ext.override(Ext.layout.FormLayout, { Ext.override(Ext.layout.FormLayout, {
renderItem: function(c, position, target) { renderItem: function(c, position, target) {
if(c && !c.rendered && (c.isFormField || c.fieldLabel) && c.inputType != 'hidden'){ if (
c &&
!c.rendered &&
(c.isFormField || c.fieldLabel) &&
c.inputType != 'hidden'
) {
var args = this.getTemplateArgs(c); var args = this.getTemplateArgs(c);
if (typeof position == 'number') { if (typeof position == 'number') {
position = target.dom.childNodes[position] || null; position = target.dom.childNodes[position] || null;
@ -30,5 +35,5 @@ Ext.override(Ext.layout.FormLayout, {
} else { } else {
Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments); Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments);
} }
} },
}); });

View File

@ -13,7 +13,6 @@
* @author Damien Churchill <damoxc@gmail.com> * @author Damien Churchill <damoxc@gmail.com>
*/ */
Ext.override(Ext.tree.MultiSelectionModel, { Ext.override(Ext.tree.MultiSelectionModel, {
onNodeClick: function(node, e) { onNodeClick: function(node, e) {
if (e.ctrlKey && this.isSelected(node)) { if (e.ctrlKey && this.isSelected(node)) {
this.unselect(node); this.unselect(node);
@ -31,7 +30,7 @@ Ext.override(Ext.tree.MultiSelectionModel, {
// Swap the values if required // Swap the values if required
if (fi > li) { if (fi > li) {
fi = fi + li, li = fi - li, fi = fi - li; (fi = fi + li), (li = fi - li), (fi = fi - li);
} }
// Select all the nodes // Select all the nodes
@ -65,6 +64,5 @@ Ext.override(Ext.tree.MultiSelectionModel, {
this.fireEvent('selectionchange', this, this.selNodes); this.fireEvent('selectionchange', this, this.selNodes);
} }
return node; return node;
} },
}); });

View File

@ -37,7 +37,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
l = new Ext.ux.tree.TreeGridLoader({ l = new Ext.ux.tree.TreeGridLoader({
dataUrl: this.dataUrl, dataUrl: this.dataUrl,
requestMethod: this.requestMethod, requestMethod: this.requestMethod,
store: this.store store: this.store,
}); });
} else if (Ext.isObject(l) && !l.load) { } else if (Ext.isObject(l) && !l.load) {
l = new Ext.ux.tree.TreeGridLoader(l); l = new Ext.ux.tree.TreeGridLoader(l);
@ -49,7 +49,10 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
this.initColumns(); this.initColumns();
if (this.enableSort) { if (this.enableSort) {
this.treeGridSorter = new Ext.ux.tree.TreeGridSorter(this, this.enableSort); this.treeGridSorter = new Ext.ux.tree.TreeGridSorter(
this,
this.enableSort
);
} }
if (this.columnResize) { if (this.columnResize) {
@ -66,10 +69,16 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
'<table style="table-layout: fixed;" cellspacing="0" cellpadding="0" border="0"><colgroup><tpl for="columns"><col /></tpl></colgroup>', '<table style="table-layout: fixed;" cellspacing="0" cellpadding="0" border="0"><colgroup><tpl for="columns"><col /></tpl></colgroup>',
'<thead><tr class="x-grid3-hd-row">', '<thead><tr class="x-grid3-hd-row">',
'<tpl for="columns">', '<tpl for="columns">',
'<td class="x-grid3-hd x-grid3-cell x-treegrid-hd" style="text-align: {align};" id="', this.id, '-xlhd-{#}">', '<td class="x-grid3-hd x-grid3-cell x-treegrid-hd" style="text-align: {align};" id="',
this.id,
'-xlhd-{#}">',
'<div class="x-grid3-hd-inner x-treegrid-hd-inner" unselectable="on">', '<div class="x-grid3-hd-inner x-treegrid-hd-inner" unselectable="on">',
this.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '', this.enableHdMenu
'{header}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />', ? '<a class="x-grid3-hd-btn" href="#"></a>'
: '',
'{header}<img class="x-grid3-sort-icon" src="',
Ext.BLANK_IMAGE_URL,
'" />',
'</div>', '</div>',
'</td></tpl>', '</td></tpl>',
'</tr></thead>', '</tr></thead>',
@ -93,12 +102,17 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
var cs = this.columns, var cs = this.columns,
len = cs.length, len = cs.length,
columns = [], columns = [],
i, c; i,
c;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
c = cs[i]; c = cs[i];
if (!c.isColumn) { if (!c.isColumn) {
c.xtype = c.xtype ? (/^tg/.test(c.xtype) ? c.xtype : 'tg' + c.xtype) : 'tgcolumn'; c.xtype = c.xtype
? /^tg/.test(c.xtype)
? c.xtype
: 'tg' + c.xtype
: 'tgcolumn';
c = Ext.create(c); c = Ext.create(c);
} }
c.init(this); c.init(this);
@ -119,7 +133,13 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
this.el.addClass('x-treegrid'); this.el.addClass('x-treegrid');
this.outerCt = this.body.createChild({ this.outerCt = this.body.createChild({
cls:'x-tree-root-ct x-treegrid-ct ' + (this.useArrows ? 'x-tree-arrows' : this.lines ? 'x-tree-lines' : 'x-tree-no-lines') cls:
'x-tree-root-ct x-treegrid-ct ' +
(this.useArrows
? 'x-tree-arrows'
: this.lines
? 'x-tree-lines'
: 'x-tree-no-lines'),
}); });
this.internalTpl.overwrite(this.outerCt, { columns: this.columns }); this.internalTpl.overwrite(this.outerCt, { columns: this.columns });
@ -133,22 +153,23 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
if (this.hideHeaders) { if (this.hideHeaders) {
this.el.child('.x-grid3-header').setDisplayed('none'); this.el.child('.x-grid3-header').setDisplayed('none');
} } else if (this.enableHdMenu !== false) {
else if(this.enableHdMenu !== false){
this.hmenu = new Ext.menu.Menu({ id: this.id + '-hctx' }); this.hmenu = new Ext.menu.Menu({ id: this.id + '-hctx' });
if (this.enableColumnHide !== false) { if (this.enableColumnHide !== false) {
this.colMenu = new Ext.menu.Menu({id: this.id + '-hcols-menu'}); this.colMenu = new Ext.menu.Menu({
id: this.id + '-hcols-menu',
});
this.colMenu.on({ this.colMenu.on({
scope: this, scope: this,
beforeshow: this.beforeColMenuShow, beforeshow: this.beforeColMenuShow,
itemclick: this.handleHdMenuClick itemclick: this.handleHdMenuClick,
}); });
this.hmenu.add({ this.hmenu.add({
itemId: 'columns', itemId: 'columns',
hideOnClick: false, hideOnClick: false,
text: this.columnsText, text: this.columnsText,
menu: this.colMenu, menu: this.colMenu,
iconCls: 'x-cols-icon' iconCls: 'x-cols-icon',
}); });
} }
this.hmenu.on('itemclick', this.handleHdMenuClick, this); this.hmenu.on('itemclick', this.handleHdMenuClick, this);
@ -159,7 +180,9 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
node.attributes.uiProvider = Ext.ux.tree.TreeGridRootNodeUI; node.attributes.uiProvider = Ext.ux.tree.TreeGridRootNodeUI;
node = Ext.ux.tree.TreeGrid.superclass.setRootNode.call(this, node); node = Ext.ux.tree.TreeGrid.superclass.setRootNode.call(this, node);
if (this.innerCt) { if (this.innerCt) {
this.colgroupTpl.insertFirst(this.innerCt, {columns: this.columns}); this.colgroupTpl.insertFirst(this.innerCt, {
columns: this.columns,
});
} }
return node; return node;
}, },
@ -183,7 +206,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
this.mon(this.mainHd, { this.mon(this.mainHd, {
scope: this, scope: this,
mouseover: this.handleHdOver, mouseover: this.handleHdOver,
mouseout: this.handleHdOut mouseout: this.handleHdOut,
}); });
}, },
@ -198,17 +221,23 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
} }
if (Ext.isNumber(h)) { if (Ext.isNumber(h)) {
bd.style.height = this.body.getHeight(true) - hd.offsetHeight + 'px'; bd.style.height =
this.body.getHeight(true) - hd.offsetHeight + 'px';
} }
if (Ext.isNumber(w)) { if (Ext.isNumber(w)) {
var sw = Ext.num(this.scrollOffset, Ext.getScrollBarWidth()); var sw = Ext.num(this.scrollOffset, Ext.getScrollBarWidth());
if(this.reserveScrollOffset || ((bd.offsetWidth - bd.clientWidth) > 10)){ if (
this.reserveScrollOffset ||
bd.offsetWidth - bd.clientWidth > 10
) {
this.setScrollOffset(sw); this.setScrollOffset(sw);
} else { } else {
var me = this; var me = this;
setTimeout(function() { setTimeout(function() {
me.setScrollOffset(bd.offsetWidth - bd.clientWidth > 10 ? sw : 0); me.setScrollOffset(
bd.offsetWidth - bd.clientWidth > 10 ? sw : 0
);
}, 10); }, 10);
} }
} }
@ -219,7 +248,10 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
colCount = cols.length, colCount = cols.length,
groups = this.outerCt.query('colgroup'), groups = this.outerCt.query('colgroup'),
groupCount = groups.length, groupCount = groups.length,
c, g, i, j; c,
g,
i,
j;
for (i = 0; i < colCount; i++) { for (i = 0; i < colCount; i++) {
c = cols[i]; c = cols[i];
@ -229,18 +261,23 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
} }
} }
for(i = 0, groups = this.innerHd.query('td'), len = groups.length; i<len; i++) { for (
i = 0, groups = this.innerHd.query('td'), len = groups.length;
i < len;
i++
) {
c = Ext.fly(groups[i]); c = Ext.fly(groups[i]);
if (cols[i] && cols[i].hidden) { if (cols[i] && cols[i].hidden) {
c.addClass('x-treegrid-hd-hidden'); c.addClass('x-treegrid-hd-hidden');
} } else {
else {
c.removeClass('x-treegrid-hd-hidden'); c.removeClass('x-treegrid-hd-hidden');
} }
} }
var tcw = this.getTotalColumnWidth(); var tcw = this.getTotalColumnWidth();
Ext.fly(this.innerHd.dom.firstChild).setWidth(tcw + (this.scrollOffset || 0)); Ext.fly(this.innerHd.dom.firstChild).setWidth(
tcw + (this.scrollOffset || 0)
);
this.outerCt.select('table').setWidth(tcw); this.outerCt.select('table').setWidth(tcw);
this.syncHeaderScroll(); this.syncHeaderScroll();
}, },
@ -261,7 +298,11 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
getTotalColumnWidth: function() { getTotalColumnWidth: function() {
var total = 0; var total = 0;
for(var i = 0, cs = this.getVisibleColumns(), len = cs.length; i<len; i++) { for (
var i = 0, cs = this.getVisibleColumns(), len = cs.length;
i < len;
i++
) {
total += cs[i].width; total += cs[i].width;
} }
return total; return total;
@ -289,13 +330,17 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
this.fireEvent('headerbuttonclick', ms, c, hd, index); this.fireEvent('headerbuttonclick', ms, c, hd, index);
this.hmenu.on('hide', function(){ this.hmenu.on(
'hide',
function() {
Ext.fly(hd).removeClass('x-grid3-hd-menu-open'); Ext.fly(hd).removeClass('x-grid3-hd-menu-open');
}, this, {single:true}); },
this,
{ single: true }
);
this.hmenu.show(t, 'tl-bl?'); this.hmenu.show(t, 'tl-bl?');
} } else if (hd) {
else if(hd) {
var index = this.findHeaderIndex(hd); var index = this.findHeaderIndex(hd);
this.fireEvent('headerclick', this.columns[index], hd, index); this.fireEvent('headerclick', this.columns[index], hd, index);
} }
@ -313,7 +358,8 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
el.addClass('x-grid3-hd-over'); el.addClass('x-grid3-hd-over');
this.activeHdBtn = el.child('.x-grid3-hd-btn'); this.activeHdBtn = el.child('.x-grid3-hd-btn');
if (this.activeHdBtn) { if (this.activeHdBtn) {
this.activeHdBtn.dom.style.height = (hd.firstChild.offsetHeight-1)+'px'; this.activeHdBtn.dom.style.height =
hd.firstChild.offsetHeight - 1 + 'px';
} }
} }
}, },
@ -331,7 +377,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
findHeaderIndex: function(hd) { findHeaderIndex: function(hd) {
hd = hd.dom || hd; hd = hd.dom || hd;
var cs = hd.parentNode.childNodes; var cs = hd.parentNode.childNodes;
for(var i = 0, c; c = cs[i]; i++){ for (var i = 0, c; (c = cs[i]); i++) {
if (c == hd) { if (c == hd) {
return i; return i;
} }
@ -343,18 +389,21 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
beforeColMenuShow: function() { beforeColMenuShow: function() {
var cols = this.columns, var cols = this.columns,
colCount = cols.length, colCount = cols.length,
i, c; i,
c;
this.colMenu.removeAll(); this.colMenu.removeAll();
for (i = 1; i < colCount; i++) { for (i = 1; i < colCount; i++) {
c = cols[i]; c = cols[i];
if (c.hideable !== false) { if (c.hideable !== false) {
this.colMenu.add(new Ext.menu.CheckItem({ this.colMenu.add(
new Ext.menu.CheckItem({
itemId: 'col-' + i, itemId: 'col-' + i,
text: c.header, text: c.header,
checked: !c.hidden, checked: !c.hidden,
hideOnClick: false, hideOnClick: false,
disabled: c.hideable === false disabled: c.hideable === false,
})); })
);
} }
} }
}, },
@ -364,7 +413,14 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
var index = this.hdCtxIndex, var index = this.hdCtxIndex,
id = item.getItemId(); id = item.getItemId();
if(this.fireEvent('headermenuclick', this.columns[index], id, index) !== false) { if (
this.fireEvent(
'headermenuclick',
this.columns[index],
id,
index
) !== false
) {
index = id.substr(4); index = id.substr(4);
if (index > 0 && this.columns[index]) { if (index > 0 && this.columns[index]) {
this.setColumnVisible(index, !item.checked); this.setColumnVisible(index, !item.checked);
@ -406,7 +462,7 @@ Ext.ux.tree.TreeGrid = Ext.extend(Ext.tree.TreePanel, {
if (!n.uiProvider && !n.isRoot && !n.ui.isTreeGridNodeUI) { if (!n.uiProvider && !n.isRoot && !n.ui.isTreeGridNodeUI) {
n.ui = new Ext.ux.tree.TreeGridNodeUI(n); n.ui = new Ext.ux.tree.TreeGridNodeUI(n);
} }
} },
}); });
Ext.reg('treegrid', Ext.ux.tree.TreeGrid); Ext.reg('treegrid', Ext.ux.tree.TreeGrid);

View File

@ -33,7 +33,7 @@ Ext.tree.ColumnResizer = Ext.extend(Ext.util.Observable, {
onDrag: this.onDrag.createDelegate(this), onDrag: this.onDrag.createDelegate(this),
onEnd: this.onEnd.createDelegate(this), onEnd: this.onEnd.createDelegate(this),
tolerance: 3, tolerance: 3,
autoStart: 300 autoStart: 300,
}); });
this.tracker.initEl(tree.innerHd); this.tracker.initEl(tree.innerHd);
tree.on('beforedestroy', this.tracker.destroy, this.tracker); tree.on('beforedestroy', this.tracker.destroy, this.tracker);
@ -93,12 +93,16 @@ Ext.tree.ColumnResizer = Ext.extend(Ext.util.Observable, {
this.proxy.setX(this.hdX); this.proxy.setX(this.hdX);
this.proxy.setWidth(x - this.hdX); this.proxy.setWidth(x - this.hdX);
this.maxWidth = this.tree.outerCt.getWidth() - this.tree.innerBody.translatePoints(this.hdX).left; this.maxWidth =
this.tree.outerCt.getWidth() -
this.tree.innerBody.translatePoints(this.hdX).left;
}, },
onDrag: function(e) { onDrag: function(e) {
var cursorX = this.tracker.getXY()[0]; var cursorX = this.tracker.getXY()[0];
this.proxy.setWidth((cursorX-this.hdX).constrain(this.minWidth, this.maxWidth)); this.proxy.setWidth(
(cursorX - this.hdX).constrain(this.minWidth, this.maxWidth)
);
}, },
onEnd: function(e) { onEnd: function(e) {
@ -115,5 +119,5 @@ Ext.tree.ColumnResizer = Ext.extend(Ext.util.Observable, {
setTimeout(function() { setTimeout(function() {
tree.headersDisabled = disabled; tree.headersDisabled = disabled;
}, 100); }, 100);
} },
}); });

View File

@ -12,7 +12,8 @@
if (this.type) { if (this.type) {
if (Ext.isString(this.type)) { if (Ext.isString(this.type)) {
this.type = Ext.data.Types[this.type.toUpperCase()] || types.AUTO; this.type =
Ext.data.Types[this.type.toUpperCase()] || types.AUTO;
} }
} else { } else {
this.type = types.AUTO; this.type = types.AUTO;
@ -24,7 +25,7 @@
} else if (Ext.isEmpty(st)) { } else if (Ext.isEmpty(st)) {
this.sortType = this.type.sortType; this.sortType = this.type.sortType;
} }
} },
}); });
Ext.tree.Column = Ext.extend(Ext.list.Column, {}); Ext.tree.Column = Ext.extend(Ext.list.Column, {});

View File

@ -14,5 +14,5 @@ Ext.ux.tree.TreeGridLoader = Ext.extend(Ext.tree.TreeLoader, {
attr.uiProvider = Ext.ux.tree.TreeGridNodeUI; attr.uiProvider = Ext.ux.tree.TreeGridNodeUI;
} }
return Ext.tree.TreeLoader.prototype.createNode.call(this, attr); return Ext.tree.TreeLoader.prototype.createNode.call(this, attr);
} },
}); });

View File

@ -15,47 +15,89 @@ Ext.ux.tree.TreeGridNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
var t = n.getOwnerTree(), var t = n.getOwnerTree(),
cols = t.columns, cols = t.columns,
c = cols[0], c = cols[0],
i, buf, len; i,
buf,
len;
this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : ''; this.indentMarkup = n.parentNode
? n.parentNode.ui.getChildIndent()
: '';
buf = [ buf = [
'<tbody class="x-tree-node">', '<tbody class="x-tree-node">',
'<tr ext:tree-node-id="', n.id ,'" class="x-tree-node-el x-tree-node-leaf ', a.cls, '">', '<tr ext:tree-node-id="',
n.id,
'" class="x-tree-node-el x-tree-node-leaf ',
a.cls,
'">',
'<td class="x-treegrid-col">', '<td class="x-treegrid-col">',
'<span class="x-tree-node-indent">', this.indentMarkup, "</span>", '<span class="x-tree-node-indent">',
'<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow" />', this.indentMarkup,
'<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon', (a.icon ? " x-tree-node-inline-icon" : ""), (a.iconCls ? " "+a.iconCls : ""), '" unselectable="on" />', '</span>',
'<a hidefocus="on" class="x-tree-node-anchor" href="', a.href ? a.href : '#', '" tabIndex="1" ', '<img src="',
a.hrefTarget ? ' target="'+a.hrefTarget+'"' : '', '>', this.emptyIcon,
'<span unselectable="on">', (c.tpl ? c.tpl.apply(a) : a[c.dataIndex] || c.text), '</span></a>', '" class="x-tree-ec-icon x-tree-elbow" />',
'</td>' '<img src="',
a.icon || this.emptyIcon,
'" class="x-tree-node-icon',
a.icon ? ' x-tree-node-inline-icon' : '',
a.iconCls ? ' ' + a.iconCls : '',
'" unselectable="on" />',
'<a hidefocus="on" class="x-tree-node-anchor" href="',
a.href ? a.href : '#',
'" tabIndex="1" ',
a.hrefTarget ? ' target="' + a.hrefTarget + '"' : '',
'>',
'<span unselectable="on">',
c.tpl ? c.tpl.apply(a) : a[c.dataIndex] || c.text,
'</span></a>',
'</td>',
]; ];
for (i = 1, len = cols.length; i < len; i++) { for (i = 1, len = cols.length; i < len; i++) {
c = cols[i]; c = cols[i];
buf.push( buf.push(
'<td class="x-treegrid-col ', (c.cls ? c.cls : ''), '">', '<td class="x-treegrid-col ',
'<div unselectable="on" class="x-treegrid-text"', (c.align ? ' style="text-align: ' + c.align + ';"' : ''), '>', c.cls ? c.cls : '',
(c.tpl ? c.tpl.apply(a) : a[c.dataIndex]), '">',
'<div unselectable="on" class="x-treegrid-text"',
c.align ? ' style="text-align: ' + c.align + ';"' : '',
'>',
c.tpl ? c.tpl.apply(a) : a[c.dataIndex],
'</div>', '</div>',
'</td>' '</td>'
); );
} }
buf.push( buf.push(
'</tr><tr class="x-tree-node-ct"><td colspan="', cols.length, '">', '</tr><tr class="x-tree-node-ct"><td colspan="',
'<table class="x-treegrid-node-ct-table" cellpadding="0" cellspacing="0" style="table-layout: fixed; display: none; width: ', t.innerCt.getWidth() ,'px;"><colgroup>' cols.length,
'">',
'<table class="x-treegrid-node-ct-table" cellpadding="0" cellspacing="0" style="table-layout: fixed; display: none; width: ',
t.innerCt.getWidth(),
'px;"><colgroup>'
); );
for (i = 0, len = cols.length; i < len; i++) { for (i = 0, len = cols.length; i < len; i++) {
buf.push('<col style="width: ', (cols[i].hidden ? 0 : cols[i].width) ,'px;" />'); buf.push(
'<col style="width: ',
cols[i].hidden ? 0 : cols[i].width,
'px;" />'
);
} }
buf.push('</colgroup></table></td></tr></tbody>'); buf.push('</colgroup></table></td></tr></tbody>');
if (bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()) { if (bulkRender !== true && n.nextSibling && n.nextSibling.ui.getEl()) {
this.wrap = Ext.DomHelper.insertHtml("beforeBegin", n.nextSibling.ui.getEl(), buf.join('')); this.wrap = Ext.DomHelper.insertHtml(
'beforeBegin',
n.nextSibling.ui.getEl(),
buf.join('')
);
} else { } else {
this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf.join('')); this.wrap = Ext.DomHelper.insertHtml(
'beforeEnd',
targetNode,
buf.join('')
);
} }
this.elNode = this.wrap.childNodes[0]; this.elNode = this.wrap.childNodes[0];
@ -70,9 +112,9 @@ Ext.ux.tree.TreeGridNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
// private // private
animExpand: function(cb) { animExpand: function(cb) {
this.ctNode.style.display = ""; this.ctNode.style.display = '';
Ext.ux.tree.TreeGridNodeUI.superclass.animExpand.call(this, cb); Ext.ux.tree.TreeGridNodeUI.superclass.animExpand.call(this, cb);
} },
}); });
Ext.ux.tree.TreeGridRootNodeUI = Ext.extend(Ext.tree.TreeNodeUI, { Ext.ux.tree.TreeGridRootNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
@ -91,7 +133,7 @@ Ext.ux.tree.TreeGridRootNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
ct.style.tableLayout = null; ct.style.tableLayout = null;
(function() { (function() {
ct.style.tableLayout = 'fixed'; ct.style.tableLayout = 'fixed';
}).defer(1); }.defer(1));
} }
}, },
@ -103,5 +145,5 @@ Ext.ux.tree.TreeGridRootNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
}, },
collapse: Ext.emptyFn, collapse: Ext.emptyFn,
expand : Ext.emptyFn expand: Ext.emptyFn,
}); });

View File

@ -9,7 +9,6 @@
*/ */
Ext.override(Ext.ux.tree.TreeGridNodeUI, { Ext.override(Ext.ux.tree.TreeGridNodeUI, {
updateColumns: function() { updateColumns: function() {
if (!this.rendered) return; if (!this.rendered) return;
@ -19,13 +18,16 @@ Ext.override(Ext.ux.tree.TreeGridNodeUI, {
c = cols[0]; c = cols[0];
// Update the first column // Update the first column
this.anchor.firstChild.innerHTML = (c.tpl ? c.tpl.apply(a) : a[c.dataIndex] || c.text); this.anchor.firstChild.innerHTML = c.tpl
? c.tpl.apply(a)
: a[c.dataIndex] || c.text;
// Update the remaining columns // Update the remaining columns
for (i = 1, len = cols.length; i < len; i++) { for (i = 1, len = cols.length; i < len; i++) {
c = cols[i]; c = cols[i];
this.elNode.childNodes[i].firstChild.innerHTML = (c.tpl ? c.tpl.apply(a) : a[c.dataIndex] || c.text); this.elNode.childNodes[i].firstChild.innerHTML = c.tpl
? c.tpl.apply(a)
: a[c.dataIndex] || c.text;
} }
} },
}); });

View File

@ -1,10 +1,9 @@
Ext.tree.RenderColumn = Ext.extend(Ext.tree.Column, { Ext.tree.RenderColumn = Ext.extend(Ext.tree.Column, {
constructor: function(c) { constructor: function(c) {
c.tpl = c.tpl || new Ext.XTemplate('{' + c.dataIndex + ':this.format}'); c.tpl = c.tpl || new Ext.XTemplate('{' + c.dataIndex + ':this.format}');
c.tpl.format = c.renderer; c.tpl.format = c.renderer;
c.tpl.col = this; c.tpl.col = this;
Ext.tree.RenderColumn.superclass.constructor.call(this, c); Ext.tree.RenderColumn.superclass.constructor.call(this, c);
} },
}); });
Ext.reg('tgrendercolumn', Ext.tree.RenderColumn); Ext.reg('tgrendercolumn', Ext.tree.RenderColumn);

View File

@ -44,11 +44,14 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, {
if (!Ext.isObject(config)) { if (!Ext.isObject(config)) {
config = { config = {
property: tree.columns[0].dataIndex || 'text', property: tree.columns[0].dataIndex || 'text',
folderSort: true folderSort: true,
} };
} }
Ext.ux.tree.TreeGridSorter.superclass.constructor.apply(this, arguments); Ext.ux.tree.TreeGridSorter.superclass.constructor.apply(
this,
arguments
);
this.tree = tree; this.tree = tree;
tree.on('headerclick', this.onHeaderClick, this); tree.on('headerclick', this.onHeaderClick, this);
@ -56,7 +59,6 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, {
var me = this; var me = this;
this.defaultSortFn = function(n1, n2) { this.defaultSortFn = function(n1, n2) {
var desc = me.dir && me.dir.toLowerCase() == 'desc', var desc = me.dir && me.dir.toLowerCase() == 'desc',
prop = me.property || 'text', prop = me.property || 'text',
sortType = me.sortType, sortType = me.sortType,
@ -75,8 +77,16 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, {
} }
var prop1 = attr1[prop], var prop1 = attr1[prop],
prop2 = attr2[prop], prop2 = attr2[prop],
v1 = sortType ? sortType(prop1) : (caseSensitive ? prop1 : prop1.toUpperCase()); v1 = sortType
v2 = sortType ? sortType(prop2) : (caseSensitive ? prop2 : prop2.toUpperCase()); ? sortType(prop1)
: caseSensitive
? prop1
: prop1.toUpperCase();
v2 = sortType
? sortType(prop2)
: caseSensitive
? prop2
: prop2.toUpperCase();
if (v1 < v2) { if (v1 < v2) {
return desc ? +1 : -1; return desc ? +1 : -1;
@ -93,9 +103,18 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, {
onAfterTreeRender: function() { onAfterTreeRender: function() {
if (this.tree.hmenu) { if (this.tree.hmenu) {
this.tree.hmenu.insert(0, this.tree.hmenu.insert(
{itemId:'asc', text: this.sortAscText, cls: 'xg-hmenu-sort-asc'}, 0,
{itemId:'desc', text: this.sortDescText, cls: 'xg-hmenu-sort-desc'} {
itemId: 'asc',
text: this.sortAscText,
cls: 'xg-hmenu-sort-asc',
},
{
itemId: 'desc',
text: this.sortDescText,
cls: 'xg-hmenu-sort-desc',
}
); );
} }
this.updateSortIcon(0, 'asc'); this.updateSortIcon(0, 'asc');
@ -113,9 +132,11 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, {
var me = this; var me = this;
me.property = c.dataIndex; me.property = c.dataIndex;
me.dir = c.dir = (c.dir === 'desc' ? 'asc' : 'desc'); me.dir = c.dir = c.dir === 'desc' ? 'asc' : 'desc';
me.sortType = c.sortType; me.sortType = c.sortType;
me.caseSensitive === Ext.isBoolean(c.caseSensitive) ? c.caseSensitive : this.caseSensitive; me.caseSensitive === Ext.isBoolean(c.caseSensitive)
? c.caseSensitive
: this.caseSensitive;
me.sortFn = c.sortFn || this.defaultSortFn; me.sortFn = c.sortFn || this.defaultSortFn;
this.tree.root.cascade(function(n) { this.tree.root.cascade(function(n) {
@ -133,5 +154,5 @@ Ext.ux.tree.TreeGridSorter = Ext.extend(Ext.tree.TreeSorter, {
var sc = this.sortClasses, var sc = this.sortClasses,
hds = this.tree.innerHd.select('td').removeClass(sc); hds = this.tree.innerHd.select('td').removeClass(sc);
hds.item(col).addClass(sc[dir == 'desc' ? 1 : 0]); hds.item(col).addClass(sc[dir == 'desc' ? 1 : 0]);
} },
}); });

View File

@ -46,7 +46,8 @@ body {
border-color: #fff; border-color: #fff;
} }
.x-color-palette a:hover, .x-color-palette a.x-color-palette-sel { .x-color-palette a:hover,
.x-color-palette a.x-color-palette-sel {
border-color: #8bb8f3; border-color: #8bb8f3;
background-color: #deecfd; background-color: #deecfd;
} }
@ -63,11 +64,17 @@ body {
background-image: url(../images/default/shadow-c.png); background-image: url(../images/default/shadow-c.png);
} }
.x-shadow .xsml, .x-shadow .xsmr { .x-shadow .xsml,
.x-shadow .xsmr {
background-image: url(../images/default/shadow-lr.png); background-image: url(../images/default/shadow-lr.png);
} }
.x-shadow .xstl, .x-shadow .xstc, .x-shadow .xstr, .x-shadow .xsbl, .x-shadow .xsbc, .x-shadow .xsbr{ .x-shadow .xstl,
.x-shadow .xstc,
.x-shadow .xstr,
.x-shadow .xsbl,
.x-shadow .xsbc,
.x-shadow .xsbr {
background-image: url(../images/default/shadow.png); background-image: url(../images/default/shadow.png);
} }
@ -78,14 +85,17 @@ body {
.x-spotlight { .x-spotlight {
background-color: #ccc; background-color: #ccc;
}.x-tab-panel-header, .x-tab-panel-footer { }
.x-tab-panel-header,
.x-tab-panel-footer {
background-color: #e18325; background-color: #e18325;
border-color: #8db2e3; border-color: #8db2e3;
overflow: hidden; overflow: hidden;
zoom: 1; zoom: 1;
} }
.x-tab-panel-header, .x-tab-panel-footer { .x-tab-panel-header,
.x-tab-panel-footer {
border-color: #222; border-color: #222;
} }
@ -125,7 +135,9 @@ ul.x-tab-strip-bottom{
color: #aaaaaa; color: #aaaaaa;
} }
.x-tab-strip-top .x-tab-right, .x-tab-strip-top .x-tab-left, .x-tab-strip-top .x-tab-strip-inner{ .x-tab-strip-top .x-tab-right,
.x-tab-strip-top .x-tab-left,
.x-tab-strip-top .x-tab-strip-inner {
background-image: url(../images/access/tabs/tabs-sprite.gif); background-image: url(../images/access/tabs/tabs-sprite.gif);
} }
@ -177,8 +189,8 @@ ul.x-tab-strip-bottom{
.x-tab-scroller-left-disabled { .x-tab-scroller-left-disabled {
background-position: -18px 0; background-position: -18px 0;
opacity:.5; opacity: 0.5;
-moz-opacity:.5; -moz-opacity: 0.5;
filter: alpha(opacity=50); filter: alpha(opacity=50);
cursor: default; cursor: default;
} }
@ -188,14 +200,16 @@ ul.x-tab-strip-bottom{
border-bottom-color: #8db2e3; border-bottom-color: #8db2e3;
} }
.x-tab-panel-bbar .x-toolbar, .x-tab-panel-tbar .x-toolbar { .x-tab-panel-bbar .x-toolbar,
.x-tab-panel-tbar .x-toolbar {
border-color: #99bbe8; border-color: #99bbe8;
} }
.x-form-field { .x-form-field {
font: normal 15px tahoma, arial, helvetica, sans-serif; font: normal 15px tahoma, arial, helvetica, sans-serif;
} }
.x-form-text, textarea.x-form-field{ .x-form-text,
textarea.x-form-field {
color: #ffffff; color: #ffffff;
background-color: #33373d; background-color: #33373d;
background-image: url(../images/access/form/text-bg.gif); background-image: url(../images/access/form/text-bg.gif);
@ -203,11 +217,13 @@ ul.x-tab-strip-bottom{
border-width: 2px; border-width: 2px;
} }
.ext-webkit .x-form-text, .ext-webkit textarea.x-form-field{ .ext-webkit .x-form-text,
.ext-webkit textarea.x-form-field {
border-width: 2px; border-width: 2px;
} }
.x-form-text, .ext-ie .x-form-file { .x-form-text,
.ext-ie .x-form-file {
height: 26px; height: 26px;
} }
@ -293,12 +309,15 @@ ul.x-tab-strip-bottom{
border-bottom-color: #b5b8c8; border-bottom-color: #b5b8c8;
} }
.x-form-focus, textarea.x-form-focus{ .x-form-focus,
textarea.x-form-focus {
border-color: #ff9c33; border-color: #ff9c33;
} }
.x-form-invalid, textarea.x-form-invalid, .x-form-invalid,
.ext-webkit .x-form-invalid, .ext-webkit textarea.x-form-invalid{ textarea.x-form-invalid,
.ext-webkit .x-form-invalid,
.ext-webkit textarea.x-form-invalid {
background-color: #15171a; background-color: #15171a;
background-image: url(../images/access/grid/invalid_line.gif); background-image: url(../images/access/grid/invalid_line.gif);
border-color: #c30; border-color: #c30;
@ -311,7 +330,8 @@ ul.x-tab-strip-bottom{
} }
*/ */
.x-form-inner-invalid, textarea.x-form-inner-invalid{ .x-form-inner-invalid,
textarea.x-form-inner-invalid {
background-color: #fff; background-color: #fff;
background-image: url(../images/access/grid/invalid_line.gif); background-image: url(../images/access/grid/invalid_line.gif);
} }
@ -354,7 +374,7 @@ ul.x-tab-strip-bottom{
} }
.x-fieldset { .x-fieldset {
border-color:#737B8C; border-color: #737b8c;
} }
.x-fieldset legend { .x-fieldset legend {
@ -376,8 +396,10 @@ ul.x-tab-strip-bottom{
color: #fff; color: #fff;
} }
.x-btn-noicon .x-btn-small .x-btn-text, .x-btn-text-icon .x-btn-icon-small-left .x-btn-text, .x-btn-noicon .x-btn-small .x-btn-text,
.x-btn-icon .x-btn-small .x-btn-text, .x-btn-text-icon .x-btn-icon-small-right .x-btn-text { .x-btn-text-icon .x-btn-icon-small-left .x-btn-text,
.x-btn-icon .x-btn-small .x-btn-text,
.x-btn-text-icon .x-btn-icon-small-right .x-btn-text {
height: 18px; height: 18px;
} }
@ -414,11 +436,21 @@ ul.x-tab-strip-bottom{
font-weight: normal; font-weight: normal;
} }
.x-btn-tl, .x-btn-tr, .x-btn-tc, .x-btn-ml, .x-btn-mr, .x-btn-mc, .x-btn-bl, .x-btn-br, .x-btn-bc{ .x-btn-tl,
.x-btn-tr,
.x-btn-tc,
.x-btn-ml,
.x-btn-mr,
.x-btn-mc,
.x-btn-bl,
.x-btn-br,
.x-btn-bc {
background-image: url(../images/access/button/btn.gif); background-image: url(../images/access/button/btn.gif);
} }
.x-btn-click .x-btn-text, .x-btn-menu-active .x-btn-text, .x-btn-pressed .x-btn-text{ .x-btn-click .x-btn-text,
.x-btn-menu-active .x-btn-text,
.x-btn-pressed .x-btn-text {
color: #fff; color: #fff;
} }
@ -436,7 +468,10 @@ ul.x-tab-strip-bottom{
padding-right: 20px; padding-right: 20px;
} }
.x-btn-over .x-btn-mc em.x-btn-split, .x-btn-click .x-btn-mc em.x-btn-split, .x-btn-menu-active .x-btn-mc em.x-btn-split, .x-btn-pressed .x-btn-mc em.x-btn-split { .x-btn-over .x-btn-mc em.x-btn-split,
.x-btn-click .x-btn-mc em.x-btn-split,
.x-btn-menu-active .x-btn-mc em.x-btn-split,
.x-btn-pressed .x-btn-mc em.x-btn-split {
background-image: url(../images/access/button/s-arrow-o.gif); background-image: url(../images/access/button/s-arrow-o.gif);
} }
@ -448,7 +483,10 @@ ul.x-tab-strip-bottom{
background-image: url(../images/access/button/s-arrow-b.gif); background-image: url(../images/access/button/s-arrow-b.gif);
} }
.x-btn-over .x-btn-mc em.x-btn-split-bottom, .x-btn-click .x-btn-mc em.x-btn-split-bottom, .x-btn-menu-active .x-btn-mc em.x-btn-split-bottom, .x-btn-pressed .x-btn-mc em.x-btn-split-bottom { .x-btn-over .x-btn-mc em.x-btn-split-bottom,
.x-btn-click .x-btn-mc em.x-btn-split-bottom,
.x-btn-menu-active .x-btn-mc em.x-btn-split-bottom,
.x-btn-pressed .x-btn-mc em.x-btn-split-bottom {
background-image: url(../images/access/button/s-arrow-bo.gif); background-image: url(../images/access/button/s-arrow-bo.gif);
} }
@ -497,7 +535,12 @@ ul.x-tab-strip-bottom{
background-image: url(../images/access/toolbar/bg.gif); background-image: url(../images/access/toolbar/bg.gif);
} }
.x-toolbar td,.x-toolbar span,.x-toolbar input,.x-toolbar div,.x-toolbar select,.x-toolbar label{ .x-toolbar td,
.x-toolbar span,
.x-toolbar input,
.x-toolbar div,
.x-toolbar select,
.x-toolbar label {
font: normal 14px arial, tahoma, helvetica, sans-serif; font: normal 14px arial, tahoma, helvetica, sans-serif;
} }
@ -513,9 +556,10 @@ ul.x-tab-strip-bottom{
background-image: url(../images/access/button/s-arrow-noline.gif); background-image: url(../images/access/button/s-arrow-noline.gif);
} }
.x-toolbar .x-btn-over .x-btn-mc em.x-btn-split, .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split, .x-toolbar .x-btn-over .x-btn-mc em.x-btn-split,
.x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split, .x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split,
{ .x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split,
.x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split {
background-image: url(../images/access/button/s-arrow-o.gif); background-image: url(../images/access/button/s-arrow-o.gif);
} }
@ -523,9 +567,10 @@ ul.x-tab-strip-bottom{
background-image: url(../images/access/button/s-arrow-b-noline.gif); background-image: url(../images/access/button/s-arrow-b-noline.gif);
} }
.x-toolbar .x-btn-over .x-btn-mc em.x-btn-split-bottom, .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split-bottom, .x-toolbar .x-btn-over .x-btn-mc em.x-btn-split-bottom,
.x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split-bottom, .x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split-bottom .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split-bottom,
{ .x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split-bottom,
.x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split-bottom {
background-image: url(../images/access/button/s-arrow-bo.gif); background-image: url(../images/access/button/s-arrow-bo.gif);
} }
@ -610,31 +655,38 @@ ul.x-tab-strip-bottom{
color: #000; color: #000;
} }
.x-resizable-over .x-resizable-handle-east, .x-resizable-pinned .x-resizable-handle-east, .x-resizable-over .x-resizable-handle-east,
.x-resizable-over .x-resizable-handle-west, .x-resizable-pinned .x-resizable-handle-west .x-resizable-pinned .x-resizable-handle-east,
{ .x-resizable-over .x-resizable-handle-west,
.x-resizable-pinned .x-resizable-handle-west {
background-image: url(../images/access/sizer/e-handle.gif); background-image: url(../images/access/sizer/e-handle.gif);
} }
.x-resizable-over .x-resizable-handle-south, .x-resizable-pinned .x-resizable-handle-south, .x-resizable-over .x-resizable-handle-south,
.x-resizable-over .x-resizable-handle-north, .x-resizable-pinned .x-resizable-handle-north .x-resizable-pinned .x-resizable-handle-south,
{ .x-resizable-over .x-resizable-handle-north,
.x-resizable-pinned .x-resizable-handle-north {
background-image: url(../images/access/sizer/s-handle.gif); background-image: url(../images/access/sizer/s-handle.gif);
} }
.x-resizable-over .x-resizable-handle-north, .x-resizable-pinned .x-resizable-handle-north{ .x-resizable-over .x-resizable-handle-north,
.x-resizable-pinned .x-resizable-handle-north {
background-image: url(../images/access/sizer/s-handle.gif); background-image: url(../images/access/sizer/s-handle.gif);
} }
.x-resizable-over .x-resizable-handle-southeast, .x-resizable-pinned .x-resizable-handle-southeast{ .x-resizable-over .x-resizable-handle-southeast,
.x-resizable-pinned .x-resizable-handle-southeast {
background-image: url(../images/access/sizer/se-handle.gif); background-image: url(../images/access/sizer/se-handle.gif);
} }
.x-resizable-over .x-resizable-handle-northwest, .x-resizable-pinned .x-resizable-handle-northwest{ .x-resizable-over .x-resizable-handle-northwest,
.x-resizable-pinned .x-resizable-handle-northwest {
background-image: url(../images/access/sizer/nw-handle.gif); background-image: url(../images/access/sizer/nw-handle.gif);
} }
.x-resizable-over .x-resizable-handle-northeast, .x-resizable-pinned .x-resizable-handle-northeast{ .x-resizable-over .x-resizable-handle-northeast,
.x-resizable-pinned .x-resizable-handle-northeast {
background-image: url(../images/access/sizer/ne-handle.gif); background-image: url(../images/access/sizer/ne-handle.gif);
} }
.x-resizable-over .x-resizable-handle-southwest, .x-resizable-pinned .x-resizable-handle-southwest{ .x-resizable-over .x-resizable-handle-southwest,
.x-resizable-pinned .x-resizable-handle-southwest {
background-image: url(../images/access/sizer/sw-handle.gif); background-image: url(../images/access/sizer/sw-handle.gif);
} }
.x-resizable-proxy { .x-resizable-proxy {
@ -651,7 +703,9 @@ ul.x-tab-strip-bottom{
border-color: #223; border-color: #223;
} }
.x-grid3-hd-row td, .x-grid3-row td, .x-grid3-summary-row td{ .x-grid3-hd-row td,
.x-grid3-row td,
.x-grid3-summary-row td {
font: normal 14px arial, tahoma, helvetica, sans-serif; font: normal 14px arial, tahoma, helvetica, sans-serif;
} }
@ -701,17 +755,24 @@ ul.x-tab-strip-bottom{
background-image: url(../images/default/grid/hd-pop.gif); background-image: url(../images/default/grid/hd-pop.gif);
} }
td.x-grid3-hd-over, td.sort-desc, td.sort-asc, td.x-grid3-hd-menu-open { td.x-grid3-hd-over,
td.sort-desc,
td.sort-asc,
td.x-grid3-hd-menu-open {
border-left-color: #889; border-left-color: #889;
border-right-color: #445; border-right-color: #445;
} }
td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-asc .x-grid3-hd-inner, td.x-grid3-hd-menu-open .x-grid3-hd-inner { td.x-grid3-hd-over .x-grid3-hd-inner,
td.sort-desc .x-grid3-hd-inner,
td.sort-asc .x-grid3-hd-inner,
td.x-grid3-hd-menu-open .x-grid3-hd-inner {
background-color: #4e628a; background-color: #4e628a;
background-image: url(../images/access/grid/grid3-hrow-over.gif); background-image: url(../images/access/grid/grid3-hrow-over.gif);
} }
.x-grid3-cell-inner, .x-grid3-hd-inner { .x-grid3-cell-inner,
.x-grid3-hd-inner {
color: #fff; color: #fff;
} }
@ -729,7 +790,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
margin-left: 5px; margin-left: 5px;
} }
.x-grid3-cell-text, .x-grid3-hd-text { .x-grid3-cell-text,
.x-grid3-hd-text {
color: #fff; color: #fff;
} }
@ -778,7 +840,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
color: #fff; color: #fff;
} }
.x-grid3-locked td.x-grid3-row-marker, .x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker{ .x-grid3-locked td.x-grid3-row-marker,
.x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker {
background-color: #ebeadb !important; background-color: #ebeadb !important;
background-image: url(../images/default/grid/grid-hrow.gif) !important; background-image: url(../images/default/grid/grid-hrow.gif) !important;
color: #fff; color: #fff;
@ -786,7 +849,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
border-right-color: #6fa0df !important; border-right-color: #6fa0df !important;
} }
.x-grid3-locked td.x-grid3-row-marker div, .x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker div{ .x-grid3-locked td.x-grid3-row-marker div,
.x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker div {
color: #fff !important; color: #fff !important;
} }
@ -794,7 +858,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
background-image: url(../images/access/grid/dirty.gif); background-image: url(../images/access/grid/dirty.gif);
} }
.x-grid3-topbar, .x-grid3-bottombar{ .x-grid3-topbar,
.x-grid3-bottombar {
font: normal 14px arial, tahoma, helvetica, sans-serif; font: normal 14px arial, tahoma, helvetica, sans-serif;
} }
@ -848,7 +913,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
background-image: url(../images/access/grid/grid3-special-col-bg.gif); background-image: url(../images/access/grid/grid3-special-col-bg.gif);
} }
.x-grid3-row-checker, .x-grid3-hd-checker { .x-grid3-row-checker,
.x-grid3-hd-checker {
background-image: url(../images/default/grid/row-check-sprite.gif); background-image: url(../images/default/grid/row-check-sprite.gif);
} }
@ -878,7 +944,9 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
background-image: url(../images/default/menu/checked.gif); background-image: url(../images/default/menu/checked.gif);
} }
.x-grid-group, .x-grid-group-body, .x-grid-group-hd { .x-grid-group,
.x-grid-group-body,
.x-grid-group-hd {
zoom: 1; zoom: 1;
} }
@ -1043,19 +1111,23 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
font: normal 14px arial, tahoma, helvetica, sans-serif; font: normal 14px arial, tahoma, helvetica, sans-serif;
} }
.x-tree-node a, .x-dd-drag-ghost a{ .x-tree-node a,
.x-dd-drag-ghost a {
color: #fff; color: #fff;
} }
.x-tree-node a span, .x-dd-drag-ghost a span{ .x-tree-node a span,
.x-dd-drag-ghost a span {
color: #fff; color: #fff;
} }
.x-tree-node .x-tree-selected a, .x-dd-drag-ghost a{ .x-tree-node .x-tree-selected a,
.x-dd-drag-ghost a {
color: #fff; color: #fff;
} }
.x-tree-node .x-tree-selected a span, .x-dd-drag-ghost a span{ .x-tree-node .x-tree-selected a span,
.x-dd-drag-ghost a span {
color: #fff; color: #fff;
} }
@ -1112,10 +1184,12 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
background-color: #21252e; background-color: #21252e;
} }
.x-date-middle,.x-date-left,.x-date-right { .x-date-middle,
.x-date-left,
.x-date-right {
background-image: url(../images/access/shared/hd-sprite.gif); background-image: url(../images/access/shared/hd-sprite.gif);
color: #fff; color: #fff;
font:bold 14px "sans serif", tahoma, verdana, helvetica; font: bold 14px 'sans serif', tahoma, verdana, helvetica;
} }
.x-date-middle .x-btn .x-btn-text { .x-date-middle .x-btn .x-btn-text {
@ -1171,7 +1245,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
font-weight: bold; font-weight: bold;
} }
.x-date-inner .x-date-prevday a,.x-date-inner .x-date-nextday a { .x-date-inner .x-date-prevday a,
.x-date-inner .x-date-nextday a {
color: #aaa; color: #aaa;
} }
@ -1181,7 +1256,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
background-image: url(../images/access/shared/glass-bg.gif); background-image: url(../images/access/shared/glass-bg.gif);
} }
.x-date-inner a:hover, .x-date-inner .x-date-disabled a:hover{ .x-date-inner a:hover,
.x-date-inner .x-date-disabled a:hover {
color: #fff; color: #fff;
background-color: #7e5530; background-color: #7e5530;
} }
@ -1224,11 +1300,13 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
border-top-color: #c5d2df; border-top-color: #c5d2df;
} }
td.x-date-mp-month a,td.x-date-mp-year a { td.x-date-mp-month a,
td.x-date-mp-year a {
color: #fff; color: #fff;
} }
td.x-date-mp-month a:hover,td.x-date-mp-year a:hover { td.x-date-mp-month a:hover,
td.x-date-mp-year a:hover {
color: #fff; color: #fff;
background-color: #7e5530; background-color: #7e5530;
} }
@ -1250,7 +1328,14 @@ td.x-date-mp-sep {
background-image: url(../images/access/qtip/close.gif); background-image: url(../images/access/qtip/close.gif);
} }
.x-tip .x-tip-tc, .x-tip .x-tip-tl, .x-tip .x-tip-tr, .x-tip .x-tip-bc, .x-tip .x-tip-bl, .x-tip .x-tip-br, .x-tip .x-tip-ml, .x-tip .x-tip-mr { .x-tip .x-tip-tc,
.x-tip .x-tip-tl,
.x-tip .x-tip-tr,
.x-tip .x-tip-bc,
.x-tip .x-tip-bl,
.x-tip .x-tip-br,
.x-tip .x-tip-ml,
.x-tip .x-tip-mr {
background-image: url(../images/access/qtip/tip-sprite.gif); background-image: url(../images/access/qtip/tip-sprite.gif);
} }
@ -1271,9 +1356,14 @@ td.x-date-mp-sep {
color: #000; color: #000;
} }
.x-form-invalid-tip .x-tip-tc, .x-form-invalid-tip .x-tip-tl, .x-form-invalid-tip .x-tip-tr, .x-form-invalid-tip .x-tip-bc, .x-form-invalid-tip .x-tip-tc,
.x-form-invalid-tip .x-tip-bl, .x-form-invalid-tip .x-tip-br, .x-form-invalid-tip .x-tip-ml, .x-form-invalid-tip .x-tip-mr .x-form-invalid-tip .x-tip-tl,
{ .x-form-invalid-tip .x-tip-tr,
.x-form-invalid-tip .x-tip-bc,
.x-form-invalid-tip .x-tip-bl,
.x-form-invalid-tip .x-tip-br,
.x-form-invalid-tip .x-tip-ml,
.x-form-invalid-tip .x-tip-mr {
background-image: url(../images/default/form/error-tip-corners.gif); background-image: url(../images/default/form/error-tip-corners.gif);
} }
@ -1376,7 +1466,8 @@ a.x-menu-item {
.x-box-mc { .x-box-mc {
background-color: #eee; background-color: #eee;
background-image: url(../images/default/box/tb.gif); background-image: url(../images/default/box/tb.gif);
font-family: "Myriad Pro","Myriad Web","Tahoma","Helvetica","Arial",sans-serif; font-family: 'Myriad Pro', 'Myriad Web', 'Tahoma', 'Helvetica', 'Arial',
sans-serif;
color: #393939; color: #393939;
font-size: 15px; font-size: 15px;
} }
@ -1402,11 +1493,16 @@ a.x-menu-item {
background-image: url(../images/default/box/corners.gif); background-image: url(../images/default/box/corners.gif);
} }
.x-box-blue .x-box-bl, .x-box-blue .x-box-br, .x-box-blue .x-box-tl, .x-box-blue .x-box-tr { .x-box-blue .x-box-bl,
.x-box-blue .x-box-br,
.x-box-blue .x-box-tl,
.x-box-blue .x-box-tr {
background-image: url(../images/default/box/corners-blue.gif); background-image: url(../images/default/box/corners-blue.gif);
} }
.x-box-blue .x-box-bc, .x-box-blue .x-box-mc, .x-box-blue .x-box-tc { .x-box-blue .x-box-bc,
.x-box-blue .x-box-mc,
.x-box-blue .x-box-tc {
background-image: url(../images/default/box/tb-blue.gif); background-image: url(../images/default/box/tb-blue.gif);
} }
@ -1488,15 +1584,18 @@ a.x-menu-item {
background-color: #1f2730; background-color: #1f2730;
} }
.x-panel-bbar .x-toolbar, .x-panel-tbar .x-toolbar { .x-panel-bbar .x-toolbar,
.x-panel-tbar .x-toolbar {
border-color: #223; border-color: #223;
} }
.x-panel-tbar-noheader .x-toolbar, .x-panel-mc .x-panel-tbar .x-toolbar { .x-panel-tbar-noheader .x-toolbar,
.x-panel-mc .x-panel-tbar .x-toolbar {
border-top-color: #223; border-top-color: #223;
} }
.x-panel-body-noheader, .x-panel-mc .x-panel-body { .x-panel-body-noheader,
.x-panel-mc .x-panel-body {
border-top-color: #223; border-top-color: #223;
} }
@ -1509,7 +1608,10 @@ a.x-menu-item {
background-image: url(../images/access/panel/top-bottom.gif); background-image: url(../images/access/panel/top-bottom.gif);
} }
.x-panel-tl, .x-panel-tr, .x-panel-bl, .x-panel-br{ .x-panel-tl,
.x-panel-tr,
.x-panel-bl,
.x-panel-br {
background-image: url(../images/access/panel/corners-sprite.gif); background-image: url(../images/access/panel/corners-sprite.gif);
border-bottom-color: #222224; border-bottom-color: #222224;
} }
@ -1547,7 +1649,12 @@ a.x-menu-item {
border-color: #18181a; border-color: #18181a;
} }
.x-panel-fbar td,.x-panel-fbar span,.x-panel-fbar input,.x-panel-fbar div,.x-panel-fbar select,.x-panel-fbar label{ .x-panel-fbar td,
.x-panel-fbar span,
.x-panel-fbar input,
.x-panel-fbar div,
.x-panel-fbar select,
.x-panel-fbar label {
font: normal 14px arial, tahoma, helvetica, sans-serif; font: normal 14px arial, tahoma, helvetica, sans-serif;
} }
.x-window-proxy { .x-window-proxy {
@ -1625,14 +1732,14 @@ a.x-menu-item {
.x-window-plain .x-window-body { .x-window-plain .x-window-body {
color: #fffff6; color: #fffff6;
border-color: #464F61; border-color: #464f61;
} }
body.x-body-masked .x-window-plain .x-window-mc { body.x-body-masked .x-window-plain .x-window-mc {
background-color: #464f61; background-color: #464f61;
} }
.x-html-editor-wrap { .x-html-editor-wrap {
border-color:#737B8C; border-color: #737b8c;
background-color: #fff; background-color: #fff;
} }
.x-html-editor-wrap iframe { .x-html-editor-wrap iframe {
@ -1640,7 +1747,8 @@ body.x-body-masked .x-window-plain .x-window-mc {
} }
.x-html-editor-tb .x-btn-text { .x-html-editor-tb .x-btn-text {
background-image: url(../images/access/editor/tb-sprite.gif); background-image: url(../images/access/editor/tb-sprite.gif);
}.x-panel-noborder .x-panel-header-noborder { }
.x-panel-noborder .x-panel-header-noborder {
border-bottom-color: #343d4e; border-bottom-color: #343d4e;
} }
@ -1751,7 +1859,7 @@ body.x-body-masked .x-window-plain .x-window-mc {
} }
.x-list-body-inner { .x-list-body-inner {
background-color:#1B232B; background-color: #1b232b;
} }
.x-list-body dt em { .x-list-body dt em {
@ -1759,11 +1867,11 @@ body.x-body-masked .x-window-plain .x-window-mc {
} }
.x-list-over { .x-list-over {
background-color:#7E5530; background-color: #7e5530;
} }
.x-list-selected { .x-list-selected {
background-color:#E5872C; background-color: #e5872c;
} }
.x-list-resizer { .x-list-resizer {
@ -1771,11 +1879,14 @@ body.x-body-masked .x-window-plain .x-window-mc {
border-right-color: #555; border-right-color: #555;
} }
.x-list-header-inner em.sort-asc, .x-list-header-inner em.sort-desc { .x-list-header-inner em.sort-asc,
.x-list-header-inner em.sort-desc {
background-image: url(../images/access/grid/sort-hd.gif); background-image: url(../images/access/grid/sort-hd.gif);
border-color: #3e4e6c; border-color: #3e4e6c;
} }
.x-slider-horz, .x-slider-horz .x-slider-end, .x-slider-horz .x-slider-inner { .x-slider-horz,
.x-slider-horz .x-slider-end,
.x-slider-horz .x-slider-inner {
background-image: url(../images/access/slider/slider-bg.png); background-image: url(../images/access/slider/slider-bg.png);
} }
@ -1783,7 +1894,9 @@ body.x-body-masked .x-window-plain .x-window-mc {
background-image: url(../images/access/slider/slider-thumb.png); background-image: url(../images/access/slider/slider-thumb.png);
} }
.x-slider-vert, .x-slider-vert .x-slider-end, .x-slider-vert .x-slider-inner { .x-slider-vert,
.x-slider-vert .x-slider-end,
.x-slider-vert .x-slider-inner {
background-image: url(../images/access/slider/slider-v-bg.png); background-image: url(../images/access/slider/slider-v-bg.png);
} }

View File

@ -41,7 +41,8 @@
border-color: #fff; border-color: #fff;
} }
.x-color-palette a:hover, .x-color-palette a.x-color-palette-sel { .x-color-palette a:hover,
.x-color-palette a.x-color-palette-sel {
border-color: #8bb8f3; border-color: #8bb8f3;
background-color: #deecfd; background-color: #deecfd;
} }
@ -64,11 +65,17 @@
background-image: url(../images/default/shadow-c.png); background-image: url(../images/default/shadow-c.png);
} }
.x-shadow .xsml, .x-shadow .xsmr { .x-shadow .xsml,
.x-shadow .xsmr {
background-image: url(../images/default/shadow-lr.png); background-image: url(../images/default/shadow-lr.png);
} }
.x-shadow .xstl, .x-shadow .xstc, .x-shadow .xstr, .x-shadow .xsbl, .x-shadow .xsbc, .x-shadow .xsbr{ .x-shadow .xstl,
.x-shadow .xstc,
.x-shadow .xstr,
.x-shadow .xsbl,
.x-shadow .xsbc,
.x-shadow .xsbr {
background-image: url(../images/default/shadow.png); background-image: url(../images/default/shadow.png);
} }
@ -80,14 +87,16 @@
.x-spotlight { .x-spotlight {
background-color: #ccc; background-color: #ccc;
} }
.x-tab-panel-header, .x-tab-panel-footer { .x-tab-panel-header,
.x-tab-panel-footer {
background-color: #deecfd; background-color: #deecfd;
border-color: #8db2e3; border-color: #8db2e3;
overflow: hidden; overflow: hidden;
zoom: 1; zoom: 1;
} }
.x-tab-panel-header, .x-tab-panel-footer { .x-tab-panel-header,
.x-tab-panel-footer {
border-color: #8db2e3; border-color: #8db2e3;
} }
@ -127,7 +136,9 @@ ul.x-tab-strip-bottom{
color: #aaaaaa; color: #aaaaaa;
} }
.x-tab-strip-top .x-tab-right, .x-tab-strip-top .x-tab-left, .x-tab-strip-top .x-tab-strip-inner{ .x-tab-strip-top .x-tab-right,
.x-tab-strip-top .x-tab-left,
.x-tab-strip-top .x-tab-strip-inner {
background-image: url(../images/default/tabs/tabs-sprite.gif); background-image: url(../images/default/tabs/tabs-sprite.gif);
} }
@ -187,8 +198,8 @@ ul.x-tab-strip-bottom{
.x-tab-scroller-left-disabled { .x-tab-scroller-left-disabled {
background-position: -18px 0; background-position: -18px 0;
opacity:.5; opacity: 0.5;
-moz-opacity:.5; -moz-opacity: 0.5;
filter: alpha(opacity=50); filter: alpha(opacity=50);
cursor: default; cursor: default;
} }
@ -198,13 +209,16 @@ ul.x-tab-strip-bottom{
border-bottom-color: #8db2e3; border-bottom-color: #8db2e3;
} }
.x-tab-panel-bbar .x-toolbar, .x-tab-panel-tbar .x-toolbar { .x-tab-panel-bbar .x-toolbar,
.x-tab-panel-tbar .x-toolbar {
border-color: #99bbe8; border-color: #99bbe8;
}.x-form-field { }
.x-form-field {
font: normal 12px tahoma, arial, helvetica, sans-serif; font: normal 12px tahoma, arial, helvetica, sans-serif;
} }
.x-form-text, textarea.x-form-field { .x-form-text,
textarea.x-form-field {
background-color: #fff; background-color: #fff;
background-image: url(../images/default/form/text-bg.gif); background-image: url(../images/default/form/text-bg.gif);
border-color: #b5b8c8; border-color: #b5b8c8;
@ -253,11 +267,13 @@ ul.x-tab-strip-bottom{
border-bottom-color: #b5b8c8; border-bottom-color: #b5b8c8;
} }
.x-form-focus, textarea.x-form-focus { .x-form-focus,
textarea.x-form-focus {
border-color: #7eadd9; border-color: #7eadd9;
} }
.x-form-invalid, textarea.x-form-invalid { .x-form-invalid,
textarea.x-form-invalid {
background-color: #fff; background-color: #fff;
background-image: url(../images/default/grid/invalid_line.gif); background-image: url(../images/default/grid/invalid_line.gif);
border-color: #c30; border-color: #c30;
@ -274,7 +290,8 @@ ul.x-tab-strip-bottom{
border-color: #c30; border-color: #c30;
} }
.x-form-inner-invalid, textarea.x-form-inner-invalid { .x-form-inner-invalid,
textarea.x-form-inner-invalid {
background-color: #fff; background-color: #fff;
background-image: url(../images/default/grid/invalid_line.gif); background-image: url(../images/default/grid/invalid_line.gif);
} }
@ -331,11 +348,21 @@ ul.x-tab-strip-bottom{
font-weight: normal; font-weight: normal;
} }
.x-btn-tl, .x-btn-tr, .x-btn-tc, .x-btn-ml, .x-btn-mr, .x-btn-mc, .x-btn-bl, .x-btn-br, .x-btn-bc{ .x-btn-tl,
.x-btn-tr,
.x-btn-tc,
.x-btn-ml,
.x-btn-mr,
.x-btn-mc,
.x-btn-bl,
.x-btn-br,
.x-btn-bc {
background-image: url(../images/default/button/btn.gif); background-image: url(../images/default/button/btn.gif);
} }
.x-btn-click .x-btn-text, .x-btn-menu-active .x-btn-text, .x-btn-pressed .x-btn-text{ .x-btn-click .x-btn-text,
.x-btn-menu-active .x-btn-text,
.x-btn-pressed .x-btn-text {
color: #000; color: #000;
} }
@ -351,7 +378,10 @@ ul.x-tab-strip-bottom{
background-image: url(../images/default/button/s-arrow.gif); background-image: url(../images/default/button/s-arrow.gif);
} }
.x-btn-over .x-btn-mc em.x-btn-split, .x-btn-click .x-btn-mc em.x-btn-split, .x-btn-menu-active .x-btn-mc em.x-btn-split, .x-btn-pressed .x-btn-mc em.x-btn-split { .x-btn-over .x-btn-mc em.x-btn-split,
.x-btn-click .x-btn-mc em.x-btn-split,
.x-btn-menu-active .x-btn-mc em.x-btn-split,
.x-btn-pressed .x-btn-mc em.x-btn-split {
background-image: url(../images/default/button/s-arrow-o.gif); background-image: url(../images/default/button/s-arrow-o.gif);
} }
@ -363,7 +393,10 @@ ul.x-tab-strip-bottom{
background-image: url(../images/default/button/s-arrow-b.gif); background-image: url(../images/default/button/s-arrow-b.gif);
} }
.x-btn-over .x-btn-mc em.x-btn-split-bottom, .x-btn-click .x-btn-mc em.x-btn-split-bottom, .x-btn-menu-active .x-btn-mc em.x-btn-split-bottom, .x-btn-pressed .x-btn-mc em.x-btn-split-bottom { .x-btn-over .x-btn-mc em.x-btn-split-bottom,
.x-btn-click .x-btn-mc em.x-btn-split-bottom,
.x-btn-menu-active .x-btn-mc em.x-btn-split-bottom,
.x-btn-pressed .x-btn-mc em.x-btn-split-bottom {
background-image: url(../images/default/button/s-arrow-bo.gif); background-image: url(../images/default/button/s-arrow-bo.gif);
} }
@ -404,13 +437,19 @@ ul.x-tab-strip-bottom{
.x-btn-group-notitle .x-btn-group-tc { .x-btn-group-notitle .x-btn-group-tc {
background-image: url(../images/default/button/group-tb.gif); background-image: url(../images/default/button/group-tb.gif);
}.x-toolbar{ }
.x-toolbar {
border-color: #a9bfd3; border-color: #a9bfd3;
background-color: #d0def0; background-color: #d0def0;
background-image: url(../images/default/toolbar/bg.gif); background-image: url(../images/default/toolbar/bg.gif);
} }
.x-toolbar td,.x-toolbar span,.x-toolbar input,.x-toolbar div,.x-toolbar select,.x-toolbar label{ .x-toolbar td,
.x-toolbar span,
.x-toolbar input,
.x-toolbar div,
.x-toolbar select,
.x-toolbar label {
font: normal 11px arial, tahoma, helvetica, sans-serif; font: normal 11px arial, tahoma, helvetica, sans-serif;
} }
@ -426,9 +465,10 @@ ul.x-tab-strip-bottom{
background-image: url(../images/default/button/s-arrow-noline.gif); background-image: url(../images/default/button/s-arrow-noline.gif);
} }
.x-toolbar .x-btn-over .x-btn-mc em.x-btn-split, .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split, .x-toolbar .x-btn-over .x-btn-mc em.x-btn-split,
.x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split, .x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split,
{ .x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split,
.x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split {
background-image: url(../images/default/button/s-arrow-o.gif); background-image: url(../images/default/button/s-arrow-o.gif);
} }
@ -436,9 +476,10 @@ ul.x-tab-strip-bottom{
background-image: url(../images/default/button/s-arrow-b-noline.gif); background-image: url(../images/default/button/s-arrow-b-noline.gif);
} }
.x-toolbar .x-btn-over .x-btn-mc em.x-btn-split-bottom, .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split-bottom, .x-toolbar .x-btn-over .x-btn-mc em.x-btn-split-bottom,
.x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split-bottom, .x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split-bottom .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split-bottom,
{ .x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split-bottom,
.x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split-bottom {
background-image: url(../images/default/button/s-arrow-bo.gif); background-image: url(../images/default/button/s-arrow-bo.gif);
} }
@ -492,35 +533,43 @@ ul.x-tab-strip-bottom{
.x-toolbar-more-icon { .x-toolbar-more-icon {
background-image: url(../images/default/toolbar/more.gif) !important; background-image: url(../images/default/toolbar/more.gif) !important;
}.x-resizable-handle { }
.x-resizable-handle {
background-color: #fff; background-color: #fff;
} }
.x-resizable-over .x-resizable-handle-east, .x-resizable-pinned .x-resizable-handle-east, .x-resizable-over .x-resizable-handle-east,
.x-resizable-over .x-resizable-handle-west, .x-resizable-pinned .x-resizable-handle-west .x-resizable-pinned .x-resizable-handle-east,
{ .x-resizable-over .x-resizable-handle-west,
.x-resizable-pinned .x-resizable-handle-west {
background-image: url(../images/default/sizer/e-handle.gif); background-image: url(../images/default/sizer/e-handle.gif);
} }
.x-resizable-over .x-resizable-handle-south, .x-resizable-pinned .x-resizable-handle-south, .x-resizable-over .x-resizable-handle-south,
.x-resizable-over .x-resizable-handle-north, .x-resizable-pinned .x-resizable-handle-north .x-resizable-pinned .x-resizable-handle-south,
{ .x-resizable-over .x-resizable-handle-north,
.x-resizable-pinned .x-resizable-handle-north {
background-image: url(../images/default/sizer/s-handle.gif); background-image: url(../images/default/sizer/s-handle.gif);
} }
.x-resizable-over .x-resizable-handle-north, .x-resizable-pinned .x-resizable-handle-north{ .x-resizable-over .x-resizable-handle-north,
.x-resizable-pinned .x-resizable-handle-north {
background-image: url(../images/default/sizer/s-handle.gif); background-image: url(../images/default/sizer/s-handle.gif);
} }
.x-resizable-over .x-resizable-handle-southeast, .x-resizable-pinned .x-resizable-handle-southeast{ .x-resizable-over .x-resizable-handle-southeast,
.x-resizable-pinned .x-resizable-handle-southeast {
background-image: url(../images/default/sizer/se-handle.gif); background-image: url(../images/default/sizer/se-handle.gif);
} }
.x-resizable-over .x-resizable-handle-northwest, .x-resizable-pinned .x-resizable-handle-northwest{ .x-resizable-over .x-resizable-handle-northwest,
.x-resizable-pinned .x-resizable-handle-northwest {
background-image: url(../images/default/sizer/nw-handle.gif); background-image: url(../images/default/sizer/nw-handle.gif);
} }
.x-resizable-over .x-resizable-handle-northeast, .x-resizable-pinned .x-resizable-handle-northeast{ .x-resizable-over .x-resizable-handle-northeast,
.x-resizable-pinned .x-resizable-handle-northeast {
background-image: url(../images/default/sizer/ne-handle.gif); background-image: url(../images/default/sizer/ne-handle.gif);
} }
.x-resizable-over .x-resizable-handle-southwest, .x-resizable-pinned .x-resizable-handle-southwest{ .x-resizable-over .x-resizable-handle-southwest,
.x-resizable-pinned .x-resizable-handle-southwest {
background-image: url(../images/default/sizer/sw-handle.gif); background-image: url(../images/default/sizer/sw-handle.gif);
} }
.x-resizable-proxy { .x-resizable-proxy {
@ -537,7 +586,8 @@ ul.x-tab-strip-bottom{
border-color: #99bbe8; border-color: #99bbe8;
} }
.x-grid3-row td, .x-grid3-summary-row td{ .x-grid3-row td,
.x-grid3-summary-row td {
font: normal 11px/13px arial, tahoma, helvetica, sans-serif; font: normal 11px/13px arial, tahoma, helvetica, sans-serif;
} }
@ -545,7 +595,6 @@ ul.x-tab-strip-bottom{
font: normal 11px/15px arial, tahoma, helvetica, sans-serif; font: normal 11px/15px arial, tahoma, helvetica, sans-serif;
} }
.x-grid3-hd-row td { .x-grid3-hd-row td {
border-left-color: #eee; border-left-color: #eee;
border-right-color: #d0d0d0; border-right-color: #d0d0d0;
@ -593,15 +642,20 @@ ul.x-tab-strip-bottom{
background-image: url(../images/default/grid/hd-pop.gif); background-image: url(../images/default/grid/hd-pop.gif);
} }
td.x-grid3-hd-over, td.sort-desc, td.sort-asc, td.x-grid3-hd-menu-open { td.x-grid3-hd-over,
td.sort-desc,
td.sort-asc,
td.x-grid3-hd-menu-open {
border-left-color: #aaccf6; border-left-color: #aaccf6;
border-right-color: #aaccf6; border-right-color: #aaccf6;
} }
td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-asc .x-grid3-hd-inner, td.x-grid3-hd-menu-open .x-grid3-hd-inner { td.x-grid3-hd-over .x-grid3-hd-inner,
td.sort-desc .x-grid3-hd-inner,
td.sort-asc .x-grid3-hd-inner,
td.x-grid3-hd-menu-open .x-grid3-hd-inner {
background-color: #ebf3fd; background-color: #ebf3fd;
background-image: url(../images/default/grid/grid3-hrow-over.gif); background-image: url(../images/default/grid/grid3-hrow-over.gif);
} }
.sort-asc .x-grid3-sort-icon { .sort-asc .x-grid3-sort-icon {
@ -612,7 +666,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
background-image: url(../images/default/grid/sort_desc.gif); background-image: url(../images/default/grid/sort_desc.gif);
} }
.x-grid3-cell-text, .x-grid3-hd-text { .x-grid3-cell-text,
.x-grid3-hd-text {
color: #000; color: #000;
} }
@ -661,7 +716,8 @@ td.grid-hd-group-cell {
color: #000; color: #000;
} }
.x-grid3-locked td.x-grid3-row-marker, .x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker{ .x-grid3-locked td.x-grid3-row-marker,
.x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker {
background-color: #ebeadb !important; background-color: #ebeadb !important;
background-image: url(../images/default/grid/grid-hrow.gif) !important; background-image: url(../images/default/grid/grid-hrow.gif) !important;
color: #000; color: #000;
@ -669,7 +725,8 @@ td.grid-hd-group-cell {
border-right-color: #6fa0df !important; border-right-color: #6fa0df !important;
} }
.x-grid3-locked td.x-grid3-row-marker div, .x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker div{ .x-grid3-locked td.x-grid3-row-marker div,
.x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker div {
color: #15428b !important; color: #15428b !important;
} }
@ -677,7 +734,8 @@ td.grid-hd-group-cell {
background-image: url(../images/default/grid/dirty.gif); background-image: url(../images/default/grid/dirty.gif);
} }
.x-grid3-topbar, .x-grid3-bottombar{ .x-grid3-topbar,
.x-grid3-bottombar {
font: normal 11px arial, tahoma, helvetica, sans-serif; font: normal 11px arial, tahoma, helvetica, sans-serif;
} }
@ -728,7 +786,8 @@ td.grid-hd-group-cell {
background-image: url(../images/default/grid/grid3-special-col-bg.gif); background-image: url(../images/default/grid/grid3-special-col-bg.gif);
} }
.x-grid3-row-checker, .x-grid3-hd-checker { .x-grid3-row-checker,
.x-grid3-hd-checker {
background-image: url(../images/default/grid/row-check-sprite.gif); background-image: url(../images/default/grid/row-check-sprite.gif);
} }
@ -758,7 +817,9 @@ td.grid-hd-group-cell {
background-image: url(../images/default/menu/checked.gif); background-image: url(../images/default/menu/checked.gif);
} }
.x-grid-group, .x-grid-group-body, .x-grid-group-hd { .x-grid-group,
.x-grid-group-body,
.x-grid-group-hd {
zoom: 1; zoom: 1;
} }
@ -799,12 +860,13 @@ td.grid-hd-group-cell {
.x-grid-with-col-lines .x-grid3-row-selected { .x-grid-with-col-lines .x-grid3-row-selected {
border-top-color: #a3bae9; border-top-color: #a3bae9;
}.x-pivotgrid .x-grid3-header-offset table td { }
.x-pivotgrid .x-grid3-header-offset table td {
background: url(../images/default/grid/grid3-hrow.gif) repeat-x 50% 100%; background: url(../images/default/grid/grid3-hrow.gif) repeat-x 50% 100%;
border-left: 1px solid; border-left: 1px solid;
border-right: 1px solid; border-right: 1px solid;
border-left-color: #EEE; border-left-color: #eee;
border-right-color: #D0D0D0; border-right-color: #d0d0d0;
} }
.x-pivotgrid .x-grid3-row-headers { .x-pivotgrid .x-grid3-row-headers {
@ -812,13 +874,14 @@ td.grid-hd-group-cell {
} }
.x-pivotgrid .x-grid3-row-headers table td { .x-pivotgrid .x-grid3-row-headers table td {
background: #EEE url(../images/default/grid/grid3-rowheader.gif) repeat-x left top; background: #eee url(../images/default/grid/grid3-rowheader.gif) repeat-x
left top;
border-left: 1px solid; border-left: 1px solid;
border-right: 1px solid; border-right: 1px solid;
border-left-color: #EEE; border-left-color: #eee;
border-right-color: #D0D0D0; border-right-color: #d0d0d0;
border-bottom: 1px solid; border-bottom: 1px solid;
border-bottom-color: #D0D0D0; border-bottom-color: #d0d0d0;
height: 18px; height: 18px;
} }
.x-dd-drag-ghost { .x-dd-drag-ghost {
@ -843,7 +906,8 @@ td.grid-hd-group-cell {
.x-view-selector { .x-view-selector {
background-color: #c3daf9; background-color: #c3daf9;
border-color: #3399bb; border-color: #3399bb;
}.x-tree-node-expanded .x-tree-node-icon{ }
.x-tree-node-expanded .x-tree-node-icon {
background-image: url(../images/default/tree/folder-open.gif); background-image: url(../images/default/tree/folder-open.gif);
} }
@ -933,11 +997,13 @@ td.grid-hd-group-cell {
font: normal 11px arial, tahoma, helvetica, sans-serif; font: normal 11px arial, tahoma, helvetica, sans-serif;
} }
.x-tree-node a, .x-dd-drag-ghost a{ .x-tree-node a,
.x-dd-drag-ghost a {
color: #000; color: #000;
} }
.x-tree-node a span, .x-dd-drag-ghost a span{ .x-tree-node a span,
.x-dd-drag-ghost a span {
color: #000; color: #000;
} }
@ -988,15 +1054,18 @@ td.grid-hd-group-cell {
.x-tree-drop-ok-between .x-dd-drop-icon { .x-tree-drop-ok-between .x-dd-drop-icon {
background-image: url(../images/default/tree/drop-between.gif); background-image: url(../images/default/tree/drop-between.gif);
}.x-date-picker { }
.x-date-picker {
border-color: #1b376c; border-color: #1b376c;
background-color: #fff; background-color: #fff;
} }
.x-date-middle,.x-date-left,.x-date-right { .x-date-middle,
.x-date-left,
.x-date-right {
background-image: url(../images/default/shared/hd-sprite.gif); background-image: url(../images/default/shared/hd-sprite.gif);
color: #fff; color: #fff;
font:bold 11px "sans serif", tahoma, verdana, helvetica; font: bold 11px 'sans serif', tahoma, verdana, helvetica;
} }
.x-date-middle .x-btn .x-btn-text { .x-date-middle .x-btn .x-btn-text {
@ -1050,7 +1119,8 @@ td.grid-hd-group-cell {
font-weight: bold; font-weight: bold;
} }
.x-date-inner .x-date-prevday a,.x-date-inner .x-date-nextday a { .x-date-inner .x-date-prevday a,
.x-date-inner .x-date-nextday a {
color: #aaa; color: #aaa;
} }
@ -1060,7 +1130,8 @@ td.grid-hd-group-cell {
background-image: url(../images/default/shared/glass-bg.gif); background-image: url(../images/default/shared/glass-bg.gif);
} }
.x-date-inner a:hover, .x-date-inner .x-date-disabled a:hover{ .x-date-inner a:hover,
.x-date-inner .x-date-disabled a:hover {
color: #000; color: #000;
background-color: #ddecfe; background-color: #ddecfe;
} }
@ -1103,11 +1174,13 @@ td.grid-hd-group-cell {
border-top-color: #c5d2df; border-top-color: #c5d2df;
} }
td.x-date-mp-month a,td.x-date-mp-year a { td.x-date-mp-month a,
td.x-date-mp-year a {
color: #15428b; color: #15428b;
} }
td.x-date-mp-month a:hover,td.x-date-mp-year a:hover { td.x-date-mp-month a:hover,
td.x-date-mp-year a:hover {
color: #15428b; color: #15428b;
background-color: #ddecfe; background-color: #ddecfe;
} }
@ -1124,11 +1197,19 @@ td.x-date-mp-sel a {
td.x-date-mp-sep { td.x-date-mp-sep {
border-right-color: #c5d2df; border-right-color: #c5d2df;
}.x-tip .x-tip-close{ }
.x-tip .x-tip-close {
background-image: url(../images/default/qtip/close.gif); background-image: url(../images/default/qtip/close.gif);
} }
.x-tip .x-tip-tc, .x-tip .x-tip-tl, .x-tip .x-tip-tr, .x-tip .x-tip-bc, .x-tip .x-tip-bl, .x-tip .x-tip-br, .x-tip .x-tip-ml, .x-tip .x-tip-mr { .x-tip .x-tip-tc,
.x-tip .x-tip-tl,
.x-tip .x-tip-tr,
.x-tip .x-tip-bc,
.x-tip .x-tip-bl,
.x-tip .x-tip-br,
.x-tip .x-tip-ml,
.x-tip .x-tip-mr {
background-image: url(../images/default/qtip/tip-sprite.gif); background-image: url(../images/default/qtip/tip-sprite.gif);
} }
@ -1149,9 +1230,14 @@ td.x-date-mp-sep {
color: #444; color: #444;
} }
.x-form-invalid-tip .x-tip-tc, .x-form-invalid-tip .x-tip-tl, .x-form-invalid-tip .x-tip-tr, .x-form-invalid-tip .x-tip-bc, .x-form-invalid-tip .x-tip-tc,
.x-form-invalid-tip .x-tip-bl, .x-form-invalid-tip .x-tip-br, .x-form-invalid-tip .x-tip-ml, .x-form-invalid-tip .x-tip-mr .x-form-invalid-tip .x-tip-tl,
{ .x-form-invalid-tip .x-tip-tr,
.x-form-invalid-tip .x-tip-bc,
.x-form-invalid-tip .x-tip-bl,
.x-form-invalid-tip .x-tip-br,
.x-form-invalid-tip .x-tip-ml,
.x-form-invalid-tip .x-tip-mr {
background-image: url(../images/default/form/error-tip-corners.gif); background-image: url(../images/default/form/error-tip-corners.gif);
} }
@ -1161,7 +1247,8 @@ td.x-date-mp-sep {
.x-tip-anchor { .x-tip-anchor {
background-image: url(../images/default/qtip/tip-anchor-sprite.gif); background-image: url(../images/default/qtip/tip-anchor-sprite.gif);
}.x-menu { }
.x-menu {
background-color: #f0f0f0; background-color: #f0f0f0;
background-image: url(../images/default/menu/menu.gif); background-image: url(../images/default/menu/menu.gif);
} }
@ -1222,7 +1309,8 @@ a.x-menu-item {
background-image: none; background-image: none;
} }
.x-date-menu, .x-color-menu{ .x-date-menu,
.x-color-menu {
background-color: #fff !important; background-color: #fff !important;
} }
@ -1261,7 +1349,8 @@ a.x-menu-item {
.x-box-mc { .x-box-mc {
background-color: #eee; background-color: #eee;
background-image: url(../images/default/box/tb.gif); background-image: url(../images/default/box/tb.gif);
font-family: "Myriad Pro","Myriad Web","Tahoma","Helvetica","Arial",sans-serif; font-family: 'Myriad Pro', 'Myriad Web', 'Tahoma', 'Helvetica', 'Arial',
sans-serif;
color: #393939; color: #393939;
font-size: 12px; font-size: 12px;
} }
@ -1287,11 +1376,16 @@ a.x-menu-item {
background-image: url(../images/default/box/corners.gif); background-image: url(../images/default/box/corners.gif);
} }
.x-box-blue .x-box-bl, .x-box-blue .x-box-br, .x-box-blue .x-box-tl, .x-box-blue .x-box-tr { .x-box-blue .x-box-bl,
.x-box-blue .x-box-br,
.x-box-blue .x-box-tl,
.x-box-blue .x-box-tr {
background-image: url(../images/default/box/corners-blue.gif); background-image: url(../images/default/box/corners-blue.gif);
} }
.x-box-blue .x-box-bc, .x-box-blue .x-box-mc, .x-box-blue .x-box-tc { .x-box-blue .x-box-bc,
.x-box-blue .x-box-mc,
.x-box-blue .x-box-tc {
background-image: url(../images/default/box/tb-blue.gif); background-image: url(../images/default/box/tb-blue.gif);
} }
@ -1309,7 +1403,8 @@ a.x-menu-item {
.x-box-blue .x-box-mr { .x-box-blue .x-box-mr {
background-image: url(../images/default/box/r-blue.gif); background-image: url(../images/default/box/r-blue.gif);
}.x-combo-list { }
.x-combo-list {
border-color: #98c0f4; border-color: #98c0f4;
background-color: #ddecfe; background-color: #ddecfe;
font: normal 12px tahoma, arial, helvetica, sans-serif; font: normal 12px tahoma, arial, helvetica, sans-serif;
@ -1345,7 +1440,8 @@ a.x-menu-item {
.x-combo-list-small { .x-combo-list-small {
font: normal 11px tahoma, arial, helvetica, sans-serif; font: normal 11px tahoma, arial, helvetica, sans-serif;
}.x-panel { }
.x-panel {
border-color: #99bbe8; border-color: #99bbe8;
} }
@ -1363,15 +1459,18 @@ a.x-menu-item {
background-color: #fff; background-color: #fff;
} }
.x-panel-bbar .x-toolbar, .x-panel-tbar .x-toolbar { .x-panel-bbar .x-toolbar,
.x-panel-tbar .x-toolbar {
border-color: #99bbe8; border-color: #99bbe8;
} }
.x-panel-tbar-noheader .x-toolbar, .x-panel-mc .x-panel-tbar .x-toolbar { .x-panel-tbar-noheader .x-toolbar,
.x-panel-mc .x-panel-tbar .x-toolbar {
border-top-color: #99bbe8; border-top-color: #99bbe8;
} }
.x-panel-body-noheader, .x-panel-mc .x-panel-body { .x-panel-body-noheader,
.x-panel-mc .x-panel-body {
border-top-color: #99bbe8; border-top-color: #99bbe8;
} }
@ -1384,7 +1483,10 @@ a.x-menu-item {
background-image: url(../images/default/panel/top-bottom.gif); background-image: url(../images/default/panel/top-bottom.gif);
} }
.x-panel-tl, .x-panel-tr, .x-panel-bl, .x-panel-br{ .x-panel-tl,
.x-panel-tr,
.x-panel-bl,
.x-panel-br {
background-image: url(../images/default/panel/corners-sprite.gif); background-image: url(../images/default/panel/corners-sprite.gif);
border-bottom-color: #99bbe8; border-bottom-color: #99bbe8;
} }
@ -1423,7 +1525,12 @@ a.x-menu-item {
border-color: #99bbe8; border-color: #99bbe8;
} }
.x-panel-fbar td,.x-panel-fbar span,.x-panel-fbar input,.x-panel-fbar div,.x-panel-fbar select,.x-panel-fbar label{ .x-panel-fbar td,
.x-panel-fbar span,
.x-panel-fbar input,
.x-panel-fbar div,
.x-panel-fbar select,
.x-panel-fbar label {
font: normal 11px arial, tahoma, helvetica, sans-serif; font: normal 11px arial, tahoma, helvetica, sans-serif;
} }
.x-window-proxy { .x-window-proxy {
@ -1505,13 +1612,15 @@ a.x-menu-item {
body.x-body-masked .x-window-plain .x-window-mc { body.x-body-masked .x-window-plain .x-window-mc {
background-color: #ccd9e8; background-color: #ccd9e8;
}.x-html-editor-wrap { }
.x-html-editor-wrap {
border-color: #a9bfd3; border-color: #a9bfd3;
background-color: #fff; background-color: #fff;
} }
.x-html-editor-tb .x-btn-text { .x-html-editor-tb .x-btn-text {
background-image: url(../images/default/editor/tb-sprite.gif); background-image: url(../images/default/editor/tb-sprite.gif);
}.x-panel-noborder .x-panel-header-noborder { }
.x-panel-noborder .x-panel-header-noborder {
border-bottom-color: #99bbe8; border-bottom-color: #99bbe8;
} }
@ -1529,7 +1638,8 @@ body.x-body-masked .x-window-plain .x-window-mc {
.x-tab-panel-tbar-noborder .x-toolbar { .x-tab-panel-tbar-noborder .x-toolbar {
border-bottom-color: #99bbe8; border-bottom-color: #99bbe8;
}.x-border-layout-ct { }
.x-border-layout-ct {
background-color: #dfe8f6; background-color: #dfe8f6;
} }
@ -1575,7 +1685,8 @@ body.x-body-masked .x-window-plain .x-window-mc {
.x-layout-cmini-south .x-layout-mini { .x-layout-cmini-south .x-layout-mini {
background-image: url(../images/default/layout/mini-top.gif); background-image: url(../images/default/layout/mini-top.gif);
}.x-progress-wrap { }
.x-progress-wrap {
border-color: #6593cf; border-color: #6593cf;
} }
@ -1600,7 +1711,8 @@ body.x-body-masked .x-window-plain .x-window-mc {
.x-progress-text-back { .x-progress-text-back {
color: #396095; color: #396095;
}.x-list-header{ }
.x-list-header {
background-color: #f9f9f9; background-color: #f9f9f9;
background-image: url(../images/default/grid/grid3-hrow.gif); background-image: url(../images/default/grid/grid3-hrow.gif);
} }
@ -1627,10 +1739,14 @@ body.x-body-masked .x-window-plain .x-window-mc {
border-right-color: #555; border-right-color: #555;
} }
.x-list-header-inner em.sort-asc, .x-list-header-inner em.sort-desc { .x-list-header-inner em.sort-asc,
.x-list-header-inner em.sort-desc {
background-image: url(../images/default/grid/sort-hd.gif); background-image: url(../images/default/grid/sort-hd.gif);
border-color: #99bbe8; border-color: #99bbe8;
}.x-slider-horz, .x-slider-horz .x-slider-end, .x-slider-horz .x-slider-inner { }
.x-slider-horz,
.x-slider-horz .x-slider-end,
.x-slider-horz .x-slider-inner {
background-image: url(../images/default/slider/slider-bg.png); background-image: url(../images/default/slider/slider-bg.png);
} }
@ -1638,13 +1754,16 @@ body.x-body-masked .x-window-plain .x-window-mc {
background-image: url(../images/default/slider/slider-thumb.png); background-image: url(../images/default/slider/slider-thumb.png);
} }
.x-slider-vert, .x-slider-vert .x-slider-end, .x-slider-vert .x-slider-inner { .x-slider-vert,
.x-slider-vert .x-slider-end,
.x-slider-vert .x-slider-inner {
background-image: url(../images/default/slider/slider-v-bg.png); background-image: url(../images/default/slider/slider-v-bg.png);
} }
.x-slider-vert .x-slider-thumb { .x-slider-vert .x-slider-thumb {
background-image: url(../images/default/slider/slider-v-thumb.png); background-image: url(../images/default/slider/slider-v-thumb.png);
}.x-window-dlg .ext-mb-text, }
.x-window-dlg .ext-mb-text,
.x-window-dlg .x-window-header-text { .x-window-dlg .x-window-header-text {
font-size: 12px; font-size: 12px;
} }

View File

@ -42,8 +42,9 @@
border-color: #fff; border-color: #fff;
} }
.x-color-palette a:hover, .x-color-palette a.x-color-palette-sel { .x-color-palette a:hover,
border-color:#CFCFCF; .x-color-palette a.x-color-palette-sel {
border-color: #cfcfcf;
background-color: #eaeaea; background-color: #eaeaea;
} }
@ -65,11 +66,17 @@
background-image: url(../images/default/shadow-c.png); background-image: url(../images/default/shadow-c.png);
} }
.x-shadow .xsml, .x-shadow .xsmr { .x-shadow .xsml,
.x-shadow .xsmr {
background-image: url(../images/default/shadow-lr.png); background-image: url(../images/default/shadow-lr.png);
} }
.x-shadow .xstl, .x-shadow .xstc, .x-shadow .xstr, .x-shadow .xsbl, .x-shadow .xsbc, .x-shadow .xsbr{ .x-shadow .xstl,
.x-shadow .xstc,
.x-shadow .xstr,
.x-shadow .xsbl,
.x-shadow .xsbc,
.x-shadow .xsbr {
background-image: url(../images/default/shadow.png); background-image: url(../images/default/shadow.png);
} }
@ -80,14 +87,17 @@
.x-spotlight { .x-spotlight {
background-color: #ccc; background-color: #ccc;
}.x-tab-panel-header, .x-tab-panel-footer { }
.x-tab-panel-header,
.x-tab-panel-footer {
background-color: #eaeaea; background-color: #eaeaea;
border-color: #d0d0d0; border-color: #d0d0d0;
overflow: hidden; overflow: hidden;
zoom: 1; zoom: 1;
} }
.x-tab-panel-header, .x-tab-panel-footer { .x-tab-panel-header,
.x-tab-panel-footer {
border-color: #d0d0d0; border-color: #d0d0d0;
} }
@ -127,7 +137,9 @@ ul.x-tab-strip-bottom{
color: #aaaaaa; color: #aaaaaa;
} }
.x-tab-strip-top .x-tab-right, .x-tab-strip-top .x-tab-left, .x-tab-strip-top .x-tab-strip-inner{ .x-tab-strip-top .x-tab-right,
.x-tab-strip-top .x-tab-left,
.x-tab-strip-top .x-tab-strip-inner {
background-image: url(../images/gray/tabs/tabs-sprite.gif); background-image: url(../images/gray/tabs/tabs-sprite.gif);
} }
@ -187,8 +199,8 @@ ul.x-tab-strip-bottom{
.x-tab-scroller-left-disabled { .x-tab-scroller-left-disabled {
background-position: -18px 0; background-position: -18px 0;
opacity:.5; opacity: 0.5;
-moz-opacity:.5; -moz-opacity: 0.5;
filter: alpha(opacity=50); filter: alpha(opacity=50);
cursor: default; cursor: default;
} }
@ -198,22 +210,24 @@ ul.x-tab-strip-bottom{
border-bottom-color: #d0d0d0; border-bottom-color: #d0d0d0;
} }
.x-tab-panel-bbar .x-toolbar, .x-tab-panel-tbar .x-toolbar { .x-tab-panel-bbar .x-toolbar,
.x-tab-panel-tbar .x-toolbar {
border-color: #d0d0d0; border-color: #d0d0d0;
} }
.x-form-field { .x-form-field {
font: normal 12px tahoma, arial, helvetica, sans-serif; font: normal 12px tahoma, arial, helvetica, sans-serif;
} }
.x-form-text, textarea.x-form-field{ .x-form-text,
textarea.x-form-field {
background-color: #fff; background-color: #fff;
background-image: url(../images/default/form/text-bg.gif); background-image: url(../images/default/form/text-bg.gif);
border-color:#C1C1C1; border-color: #c1c1c1;
} }
.x-form-select-one { .x-form-select-one {
background-color: #fff; background-color: #fff;
border-color:#C1C1C1; border-color: #c1c1c1;
} }
.x-form-check-group-label { .x-form-check-group-label {
@ -254,11 +268,13 @@ ul.x-tab-strip-bottom{
border-bottom-color: #b5b8c8; border-bottom-color: #b5b8c8;
} }
.x-form-focus, textarea.x-form-focus{ .x-form-focus,
textarea.x-form-focus {
border-color: #777777; border-color: #777777;
} }
.x-form-invalid, textarea.x-form-invalid{ .x-form-invalid,
textarea.x-form-invalid {
background-color: #fff; background-color: #fff;
background-image: url(../images/default/grid/invalid_line.gif); background-image: url(../images/default/grid/invalid_line.gif);
border-color: #c30; border-color: #c30;
@ -269,7 +285,8 @@ ul.x-tab-strip-bottom{
border-color: #ff7870; border-color: #ff7870;
} }
.x-form-inner-invalid, textarea.x-form-inner-invalid{ .x-form-inner-invalid,
textarea.x-form-inner-invalid {
background-color: #fff; background-color: #fff;
background-image: url(../images/default/grid/invalid_line.gif); background-image: url(../images/default/grid/invalid_line.gif);
} }
@ -305,13 +322,14 @@ ul.x-tab-strip-bottom{
} }
.x-fieldset { .x-fieldset {
border-color:#CCCCCC; border-color: #cccccc;
} }
.x-fieldset legend { .x-fieldset legend {
font: bold 11px tahoma, arial, helvetica, sans-serif; font: bold 11px tahoma, arial, helvetica, sans-serif;
color: #777777; color: #777777;
}.x-btn{ }
.x-btn {
font: normal 11px tahoma, verdana, helvetica; font: normal 11px tahoma, verdana, helvetica;
} }
@ -325,11 +343,21 @@ ul.x-tab-strip-bottom{
font-weight: normal; font-weight: normal;
} }
.x-btn-tl, .x-btn-tr, .x-btn-tc, .x-btn-ml, .x-btn-mr, .x-btn-mc, .x-btn-bl, .x-btn-br, .x-btn-bc{ .x-btn-tl,
.x-btn-tr,
.x-btn-tc,
.x-btn-ml,
.x-btn-mr,
.x-btn-mc,
.x-btn-bl,
.x-btn-br,
.x-btn-bc {
background-image: url(../images/gray/button/btn.gif); background-image: url(../images/gray/button/btn.gif);
} }
.x-btn-click .x-btn-text, .x-btn-menu-active .x-btn-text, .x-btn-pressed .x-btn-text{ .x-btn-click .x-btn-text,
.x-btn-menu-active .x-btn-text,
.x-btn-pressed .x-btn-text {
color: #000; color: #000;
} }
@ -345,7 +373,10 @@ ul.x-tab-strip-bottom{
background-image: url(../images/default/button/s-arrow.gif); background-image: url(../images/default/button/s-arrow.gif);
} }
.x-btn-over .x-btn-mc em.x-btn-split, .x-btn-click .x-btn-mc em.x-btn-split, .x-btn-menu-active .x-btn-mc em.x-btn-split, .x-btn-pressed .x-btn-mc em.x-btn-split { .x-btn-over .x-btn-mc em.x-btn-split,
.x-btn-click .x-btn-mc em.x-btn-split,
.x-btn-menu-active .x-btn-mc em.x-btn-split,
.x-btn-pressed .x-btn-mc em.x-btn-split {
background-image: url(../images/gray/button/s-arrow-o.gif); background-image: url(../images/gray/button/s-arrow-o.gif);
} }
@ -357,7 +388,10 @@ ul.x-tab-strip-bottom{
background-image: url(../images/default/button/s-arrow-b.gif); background-image: url(../images/default/button/s-arrow-b.gif);
} }
.x-btn-over .x-btn-mc em.x-btn-split-bottom, .x-btn-click .x-btn-mc em.x-btn-split-bottom, .x-btn-menu-active .x-btn-mc em.x-btn-split-bottom, .x-btn-pressed .x-btn-mc em.x-btn-split-bottom { .x-btn-over .x-btn-mc em.x-btn-split-bottom,
.x-btn-click .x-btn-mc em.x-btn-split-bottom,
.x-btn-menu-active .x-btn-mc em.x-btn-split-bottom,
.x-btn-pressed .x-btn-mc em.x-btn-split-bottom {
background-image: url(../images/gray/button/s-arrow-bo.gif); background-image: url(../images/gray/button/s-arrow-bo.gif);
} }
@ -405,7 +439,12 @@ ul.x-tab-strip-bottom{
background-image: url(../images/gray/toolbar/bg.gif); background-image: url(../images/gray/toolbar/bg.gif);
} }
.x-toolbar td,.x-toolbar span,.x-toolbar input,.x-toolbar div,.x-toolbar select,.x-toolbar label{ .x-toolbar td,
.x-toolbar span,
.x-toolbar input,
.x-toolbar div,
.x-toolbar select,
.x-toolbar label {
font: normal 11px arial, tahoma, helvetica, sans-serif; font: normal 11px arial, tahoma, helvetica, sans-serif;
} }
@ -421,9 +460,10 @@ ul.x-tab-strip-bottom{
background-image: url(../images/default/button/s-arrow-noline.gif); background-image: url(../images/default/button/s-arrow-noline.gif);
} }
.x-toolbar .x-btn-over .x-btn-mc em.x-btn-split, .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split, .x-toolbar .x-btn-over .x-btn-mc em.x-btn-split,
.x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split, .x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split,
{ .x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split,
.x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split {
background-image: url(../images/gray/button/s-arrow-o.gif); background-image: url(../images/gray/button/s-arrow-o.gif);
} }
@ -431,9 +471,10 @@ ul.x-tab-strip-bottom{
background-image: url(../images/default/button/s-arrow-b-noline.gif); background-image: url(../images/default/button/s-arrow-b-noline.gif);
} }
.x-toolbar .x-btn-over .x-btn-mc em.x-btn-split-bottom, .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split-bottom, .x-toolbar .x-btn-over .x-btn-mc em.x-btn-split-bottom,
.x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split-bottom, .x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split-bottom .x-toolbar .x-btn-click .x-btn-mc em.x-btn-split-bottom,
{ .x-toolbar .x-btn-menu-active .x-btn-mc em.x-btn-split-bottom,
.x-toolbar .x-btn-pressed .x-btn-mc em.x-btn-split-bottom {
background-image: url(../images/gray/button/s-arrow-bo.gif); background-image: url(../images/gray/button/s-arrow-bo.gif);
} }
@ -492,31 +533,38 @@ ul.x-tab-strip-bottom{
background-color: #fff; background-color: #fff;
} }
.x-resizable-over .x-resizable-handle-east, .x-resizable-pinned .x-resizable-handle-east, .x-resizable-over .x-resizable-handle-east,
.x-resizable-over .x-resizable-handle-west, .x-resizable-pinned .x-resizable-handle-west .x-resizable-pinned .x-resizable-handle-east,
{ .x-resizable-over .x-resizable-handle-west,
.x-resizable-pinned .x-resizable-handle-west {
background-image: url(../images/gray/sizer/e-handle.gif); background-image: url(../images/gray/sizer/e-handle.gif);
} }
.x-resizable-over .x-resizable-handle-south, .x-resizable-pinned .x-resizable-handle-south, .x-resizable-over .x-resizable-handle-south,
.x-resizable-over .x-resizable-handle-north, .x-resizable-pinned .x-resizable-handle-north .x-resizable-pinned .x-resizable-handle-south,
{ .x-resizable-over .x-resizable-handle-north,
.x-resizable-pinned .x-resizable-handle-north {
background-image: url(../images/gray/sizer/s-handle.gif); background-image: url(../images/gray/sizer/s-handle.gif);
} }
.x-resizable-over .x-resizable-handle-north, .x-resizable-pinned .x-resizable-handle-north{ .x-resizable-over .x-resizable-handle-north,
.x-resizable-pinned .x-resizable-handle-north {
background-image: url(../images/gray/sizer/s-handle.gif); background-image: url(../images/gray/sizer/s-handle.gif);
} }
.x-resizable-over .x-resizable-handle-southeast, .x-resizable-pinned .x-resizable-handle-southeast{ .x-resizable-over .x-resizable-handle-southeast,
.x-resizable-pinned .x-resizable-handle-southeast {
background-image: url(../images/gray/sizer/se-handle.gif); background-image: url(../images/gray/sizer/se-handle.gif);
} }
.x-resizable-over .x-resizable-handle-northwest, .x-resizable-pinned .x-resizable-handle-northwest{ .x-resizable-over .x-resizable-handle-northwest,
.x-resizable-pinned .x-resizable-handle-northwest {
background-image: url(../images/gray/sizer/nw-handle.gif); background-image: url(../images/gray/sizer/nw-handle.gif);
} }
.x-resizable-over .x-resizable-handle-northeast, .x-resizable-pinned .x-resizable-handle-northeast{ .x-resizable-over .x-resizable-handle-northeast,
.x-resizable-pinned .x-resizable-handle-northeast {
background-image: url(../images/gray/sizer/ne-handle.gif); background-image: url(../images/gray/sizer/ne-handle.gif);
} }
.x-resizable-over .x-resizable-handle-southwest, .x-resizable-pinned .x-resizable-handle-southwest{ .x-resizable-over .x-resizable-handle-southwest,
.x-resizable-pinned .x-resizable-handle-southwest {
background-image: url(../images/gray/sizer/sw-handle.gif); background-image: url(../images/gray/sizer/sw-handle.gif);
} }
.x-resizable-proxy { .x-resizable-proxy {
@ -533,7 +581,8 @@ ul.x-tab-strip-bottom{
border-color: #d0d0d0; border-color: #d0d0d0;
} }
.x-grid3-row td, .x-grid3-summary-row td{ .x-grid3-row td,
.x-grid3-summary-row td {
font: normal 11px/13px arial, tahoma, helvetica, sans-serif; font: normal 11px/13px arial, tahoma, helvetica, sans-serif;
} }
@ -588,15 +637,20 @@ ul.x-tab-strip-bottom{
background-image: url(../images/default/grid/hd-pop.gif); background-image: url(../images/default/grid/hd-pop.gif);
} }
td.x-grid3-hd-over, td.sort-desc, td.sort-asc, td.x-grid3-hd-menu-open { td.x-grid3-hd-over,
border-left-color:#ACACAC; td.sort-desc,
border-right-color:#ACACAC; td.sort-asc,
td.x-grid3-hd-menu-open {
border-left-color: #acacac;
border-right-color: #acacac;
} }
td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-asc .x-grid3-hd-inner, td.x-grid3-hd-menu-open .x-grid3-hd-inner { td.x-grid3-hd-over .x-grid3-hd-inner,
td.sort-desc .x-grid3-hd-inner,
td.sort-asc .x-grid3-hd-inner,
td.x-grid3-hd-menu-open .x-grid3-hd-inner {
background-color: #f9f9f9; background-color: #f9f9f9;
background-image: url(../images/gray/grid/grid3-hrow-over2.gif); background-image: url(../images/gray/grid/grid3-hrow-over2.gif);
} }
.sort-asc .x-grid3-sort-icon { .sort-asc .x-grid3-sort-icon {
@ -607,7 +661,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
background-image: url(../images/gray/grid/sort_desc.gif); background-image: url(../images/gray/grid/sort_desc.gif);
} }
.x-grid3-cell-text, .x-grid3-hd-text { .x-grid3-cell-text,
.x-grid3-hd-text {
color: #000; color: #000;
} }
@ -622,7 +677,7 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
.x-dd-drag-proxy .x-grid3-hd-inner { .x-dd-drag-proxy .x-grid3-hd-inner {
background-color: #f9f9f9; background-color: #f9f9f9;
background-image: url(../images/gray/grid/grid3-hrow-over2.gif); background-image: url(../images/gray/grid/grid3-hrow-over2.gif);
border-color:#ACACAC; border-color: #acacac;
} }
.col-move-top { .col-move-top {
@ -634,13 +689,13 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
} }
.x-grid3-row-selected { .x-grid3-row-selected {
background-color:#CCCCCC !important; background-color: #cccccc !important;
background-image: none; background-image: none;
border-color:#ACACAC; border-color: #acacac;
} }
.x-grid3-cell-selected { .x-grid3-cell-selected {
background-color: #CBCBCB !important; background-color: #cbcbcb !important;
color: #000; color: #000;
} }
@ -652,7 +707,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
color: #000; color: #000;
} }
.x-grid3-locked td.x-grid3-row-marker, .x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker{ .x-grid3-locked td.x-grid3-row-marker,
.x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker {
background-color: #ebeadb !important; background-color: #ebeadb !important;
background-image: url(../images/default/grid/grid-hrow.gif) !important; background-image: url(../images/default/grid/grid-hrow.gif) !important;
color: #000; color: #000;
@ -660,7 +716,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
border-right-color: #6fa0df !important; border-right-color: #6fa0df !important;
} }
.x-grid3-locked td.x-grid3-row-marker div, .x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker div{ .x-grid3-locked td.x-grid3-row-marker div,
.x-grid3-locked .x-grid3-row-selected td.x-grid3-row-marker div {
color: #333 !important; color: #333 !important;
} }
@ -668,7 +725,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
background-image: url(../images/default/grid/dirty.gif); background-image: url(../images/default/grid/dirty.gif);
} }
.x-grid3-topbar, .x-grid3-bottombar{ .x-grid3-topbar,
.x-grid3-bottombar {
font: normal 11px arial, tahoma, helvetica, sans-serif; font: normal 11px arial, tahoma, helvetica, sans-serif;
} }
@ -719,7 +777,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
background-image: url(../images/default/grid/grid3-special-col-bg.gif); background-image: url(../images/default/grid/grid3-special-col-bg.gif);
} }
.x-grid3-row-checker, .x-grid3-hd-checker { .x-grid3-row-checker,
.x-grid3-hd-checker {
background-image: url(../images/default/grid/row-check-sprite.gif); background-image: url(../images/default/grid/row-check-sprite.gif);
} }
@ -749,7 +808,9 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
background-image: url(../images/default/menu/checked.gif); background-image: url(../images/default/menu/checked.gif);
} }
.x-grid-group, .x-grid-group-body, .x-grid-group-hd { .x-grid-group,
.x-grid-group-body,
.x-grid-group-hd {
zoom: 1; zoom: 1;
} }
@ -759,7 +820,7 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
.x-grid-group-hd div.x-grid-group-title { .x-grid-group-hd div.x-grid-group-title {
background-image: url(../images/gray/grid/group-collapse.gif); background-image: url(../images/gray/grid/group-collapse.gif);
color:#5F5F5F; color: #5f5f5f;
font: bold 11px tahoma, arial, helvetica, sans-serif; font: bold 11px tahoma, arial, helvetica, sans-serif;
} }
@ -793,14 +854,14 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
} }
.x-grid-with-col-lines .x-grid3-row-selected { .x-grid-with-col-lines .x-grid3-row-selected {
border-top-color:#B9B9B9; border-top-color: #b9b9b9;
} }
.x-pivotgrid .x-grid3-header-offset table td { .x-pivotgrid .x-grid3-header-offset table td {
background: url(../images/gray/grid/grid3-hrow2.gif) repeat-x 50% 100%; background: url(../images/gray/grid/grid3-hrow2.gif) repeat-x 50% 100%;
border-left: 1px solid; border-left: 1px solid;
border-right: 1px solid; border-right: 1px solid;
border-left-color: #D0D0D0; border-left-color: #d0d0d0;
border-right-color: #D0D0D0; border-right-color: #d0d0d0;
} }
.x-pivotgrid .x-grid3-row-headers { .x-pivotgrid .x-grid3-row-headers {
@ -808,13 +869,14 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
} }
.x-pivotgrid .x-grid3-row-headers table td { .x-pivotgrid .x-grid3-row-headers table td {
background: #EEE url(../images/default/grid/grid3-rowheader.gif) repeat-x left top; background: #eee url(../images/default/grid/grid3-rowheader.gif) repeat-x
left top;
border-left: 1px solid; border-left: 1px solid;
border-right: 1px solid; border-right: 1px solid;
border-left-color: #EEE; border-left-color: #eee;
border-right-color: #D0D0D0; border-right-color: #d0d0d0;
border-bottom: 1px solid; border-bottom: 1px solid;
border-bottom-color: #D0D0D0; border-bottom-color: #d0d0d0;
height: 18px; height: 18px;
} }
.x-dd-drag-ghost { .x-dd-drag-ghost {
@ -837,9 +899,10 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
} }
.x-view-selector { .x-view-selector {
background-color:#D6D6D6; background-color: #d6d6d6;
border-color: #888888; border-color: #888888;
}.x-tree-node-expanded .x-tree-node-icon{ }
.x-tree-node-expanded .x-tree-node-icon {
background-image: url(../images/default/tree/folder-open.gif); background-image: url(../images/default/tree/folder-open.gif);
} }
@ -934,11 +997,13 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
font: normal 11px arial, tahoma, helvetica, sans-serif; font: normal 11px arial, tahoma, helvetica, sans-serif;
} }
.x-tree-node a, .x-dd-drag-ghost a{ .x-tree-node a,
.x-dd-drag-ghost a {
color: #000; color: #000;
} }
.x-tree-node a span, .x-dd-drag-ghost a span{ .x-tree-node a span,
.x-dd-drag-ghost a span {
color: #000; color: #000;
} }
@ -995,10 +1060,12 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
background-color: #fff; background-color: #fff;
} }
.x-date-middle,.x-date-left,.x-date-right { .x-date-middle,
.x-date-left,
.x-date-right {
background-image: url(../images/gray/shared/hd-sprite.gif); background-image: url(../images/gray/shared/hd-sprite.gif);
color: #fff; color: #fff;
font:bold 11px "sans serif", tahoma, verdana, helvetica; font: bold 11px 'sans serif', tahoma, verdana, helvetica;
} }
.x-date-middle .x-btn .x-btn-text { .x-date-middle .x-btn .x-btn-text {
@ -1018,9 +1085,9 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
} }
.x-date-inner th { .x-date-inner th {
background-color:#D8D8D8; background-color: #d8d8d8;
background-image: url(../images/gray/panel/white-top-bottom.gif); background-image: url(../images/gray/panel/white-top-bottom.gif);
border-bottom-color:#AFAFAF; border-bottom-color: #afafaf;
font: normal 10px arial, helvetica, tahoma, sans-serif; font: normal 10px arial, helvetica, tahoma, sans-serif;
color: #595959; color: #595959;
} }
@ -1040,8 +1107,8 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
.x-date-inner .x-date-selected a { .x-date-inner .x-date-selected a {
background-image: none; background-image: none;
background-color:#D8D8D8; background-color: #d8d8d8;
border-color:#DCDCDC; border-color: #dcdcdc;
} }
.x-date-inner .x-date-today a { .x-date-inner .x-date-today a {
@ -1052,19 +1119,21 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
font-weight: bold; font-weight: bold;
} }
.x-date-inner .x-date-prevday a,.x-date-inner .x-date-nextday a { .x-date-inner .x-date-prevday a,
.x-date-inner .x-date-nextday a {
color: #aaa; color: #aaa;
} }
.x-date-bottom { .x-date-bottom {
border-top-color:#AFAFAF; border-top-color: #afafaf;
background-color:#D8D8D8; background-color: #d8d8d8;
background:#D8D8D8 url(../images/gray/panel/white-top-bottom.gif) 0 -2px; background: #d8d8d8 url(../images/gray/panel/white-top-bottom.gif) 0 -2px;
} }
.x-date-inner a:hover, .x-date-inner .x-date-disabled a:hover{ .x-date-inner a:hover,
.x-date-inner .x-date-disabled a:hover {
color: #000; color: #000;
background-color:#D8D8D8; background-color: #d8d8d8;
} }
.x-date-inner .x-date-disabled a { .x-date-inner .x-date-disabled a {
@ -1090,34 +1159,36 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as
} }
.x-date-mp-btns button { .x-date-mp-btns button {
background-color:#4E565F; background-color: #4e565f;
color: #fff; color: #fff;
border-color:#C0C0C0 #434343 #434343 #C0C0C0; border-color: #c0c0c0 #434343 #434343 #c0c0c0;
font: normal 11px arial, helvetica, tahoma, sans-serif; font: normal 11px arial, helvetica, tahoma, sans-serif;
} }
.x-date-mp-btns { .x-date-mp-btns {
background-color:#D8D8D8; background-color: #d8d8d8;
background:#D8D8D8 url(../images/gray/panel/white-top-bottom.gif) 0 -2px; background: #d8d8d8 url(../images/gray/panel/white-top-bottom.gif) 0 -2px;
} }
.x-date-mp-btns td { .x-date-mp-btns td {
border-top-color:#AFAFAF; border-top-color: #afafaf;
} }
td.x-date-mp-month a,td.x-date-mp-year a { td.x-date-mp-month a,
td.x-date-mp-year a {
color: #333; color: #333;
} }
td.x-date-mp-month a:hover,td.x-date-mp-year a:hover { td.x-date-mp-month a:hover,
td.x-date-mp-year a:hover {
color: #333; color: #333;
background-color:#FDFDFD; background-color: #fdfdfd;
} }
td.x-date-mp-sel a { td.x-date-mp-sel a {
background-color:#D8D8D8; background-color: #d8d8d8;
background:#D8D8D8 url(../images/gray/panel/white-top-bottom.gif) 0 -2px; background: #d8d8d8 url(../images/gray/panel/white-top-bottom.gif) 0 -2px;
border-color:#DCDCDC; border-color: #dcdcdc;
} }
.x-date-mp-ybtn a { .x-date-mp-ybtn a {
@ -1125,12 +1196,20 @@ td.x-date-mp-sel a {
} }
td.x-date-mp-sep { td.x-date-mp-sep {
border-right-color:#D7D7D7; border-right-color: #d7d7d7;
}.x-tip .x-tip-close{ }
.x-tip .x-tip-close {
background-image: url(../images/gray/qtip/close.gif); background-image: url(../images/gray/qtip/close.gif);
} }
.x-tip .x-tip-tc, .x-tip .x-tip-tl, .x-tip .x-tip-tr, .x-tip .x-tip-bc, .x-tip .x-tip-bl, .x-tip .x-tip-br, .x-tip .x-tip-ml, .x-tip .x-tip-mr { .x-tip .x-tip-tc,
.x-tip .x-tip-tl,
.x-tip .x-tip-tr,
.x-tip .x-tip-bc,
.x-tip .x-tip-bl,
.x-tip .x-tip-br,
.x-tip .x-tip-ml,
.x-tip .x-tip-mr {
background-image: url(../images/gray/qtip/tip-sprite.gif); background-image: url(../images/gray/qtip/tip-sprite.gif);
} }
@ -1151,9 +1230,14 @@ td.x-date-mp-sep {
color: #444; color: #444;
} }
.x-form-invalid-tip .x-tip-tc, .x-form-invalid-tip .x-tip-tl, .x-form-invalid-tip .x-tip-tr, .x-form-invalid-tip .x-tip-bc, .x-form-invalid-tip .x-tip-tc,
.x-form-invalid-tip .x-tip-bl, .x-form-invalid-tip .x-tip-br, .x-form-invalid-tip .x-tip-ml, .x-form-invalid-tip .x-tip-mr .x-form-invalid-tip .x-tip-tl,
{ .x-form-invalid-tip .x-tip-tr,
.x-form-invalid-tip .x-tip-bc,
.x-form-invalid-tip .x-tip-bl,
.x-form-invalid-tip .x-tip-br,
.x-form-invalid-tip .x-tip-ml,
.x-form-invalid-tip .x-tip-mr {
background-image: url(../images/default/form/error-tip-corners.gif); background-image: url(../images/default/form/error-tip-corners.gif);
} }
@ -1163,13 +1247,14 @@ td.x-date-mp-sep {
.x-tip-anchor { .x-tip-anchor {
background-image: url(../images/gray/qtip/tip-anchor-sprite.gif); background-image: url(../images/gray/qtip/tip-anchor-sprite.gif);
}.x-menu { }
.x-menu {
background-color: #f0f0f0; background-color: #f0f0f0;
background-image: url(../images/default/menu/menu.gif); background-image: url(../images/default/menu/menu.gif);
} }
.x-menu-floating { .x-menu-floating {
border-color:#7D7D7D; border-color: #7d7d7d;
} }
.x-menu-nosep { .x-menu-nosep {
@ -1196,11 +1281,11 @@ a.x-menu-item {
.x-menu-item-active { .x-menu-item-active {
background-image: url(../images/gray/menu/item-over.gif); background-image: url(../images/gray/menu/item-over.gif);
background-color: #f1f1f1; background-color: #f1f1f1;
border-color:#ACACAC; border-color: #acacac;
} }
.x-menu-item-active a.x-menu-item { .x-menu-item-active a.x-menu-item {
border-color:#ACACAC; border-color: #acacac;
} }
.x-menu-check-item .x-menu-item-icon { .x-menu-check-item .x-menu-item-icon {
@ -1224,12 +1309,12 @@ a.x-menu-item {
} }
.x-menu .x-date-picker { .x-menu .x-date-picker {
border-color:#AFAFAF; border-color: #afafaf;
} }
.x-cycle-menu .x-menu-item-checked { .x-cycle-menu .x-menu-item-checked {
border-color:#B9B9B9 !important; border-color: #b9b9b9 !important;
background-color:#F1F1F1; background-color: #f1f1f1;
} }
.x-menu-scroller-top { .x-menu-scroller-top {
@ -1238,7 +1323,8 @@ a.x-menu-item {
.x-menu-scroller-bottom { .x-menu-scroller-bottom {
background-image: url(../images/default/layout/mini-bottom.gif); background-image: url(../images/default/layout/mini-bottom.gif);
}.x-box-tl { }
.x-box-tl {
background-image: url(../images/default/box/corners.gif); background-image: url(../images/default/box/corners.gif);
} }
@ -1257,7 +1343,8 @@ a.x-menu-item {
.x-box-mc { .x-box-mc {
background-color: #eee; background-color: #eee;
background-image: url(../images/default/box/tb.gif); background-image: url(../images/default/box/tb.gif);
font-family: "Myriad Pro","Myriad Web","Tahoma","Helvetica","Arial",sans-serif; font-family: 'Myriad Pro', 'Myriad Web', 'Tahoma', 'Helvetica', 'Arial',
sans-serif;
color: #393939; color: #393939;
font-size: 12px; font-size: 12px;
} }
@ -1283,11 +1370,16 @@ a.x-menu-item {
background-image: url(../images/default/box/corners.gif); background-image: url(../images/default/box/corners.gif);
} }
.x-box-blue .x-box-bl, .x-box-blue .x-box-br, .x-box-blue .x-box-tl, .x-box-blue .x-box-tr { .x-box-blue .x-box-bl,
.x-box-blue .x-box-br,
.x-box-blue .x-box-tl,
.x-box-blue .x-box-tr {
background-image: url(../images/default/box/corners-blue.gif); background-image: url(../images/default/box/corners-blue.gif);
} }
.x-box-blue .x-box-bc, .x-box-blue .x-box-mc, .x-box-blue .x-box-tc { .x-box-blue .x-box-bc,
.x-box-blue .x-box-mc,
.x-box-blue .x-box-tc {
background-image: url(../images/default/box/tb-blue.gif); background-image: url(../images/default/box/tb-blue.gif);
} }
@ -1320,11 +1412,11 @@ a.x-menu-item {
font: bold 11px tahoma, arial, helvetica, sans-serif; font: bold 11px tahoma, arial, helvetica, sans-serif;
color: #333; color: #333;
background-image: url(../images/default/layout/panel-title-light-bg.gif); background-image: url(../images/default/layout/panel-title-light-bg.gif);
border-bottom-color:#BCBCBC; border-bottom-color: #bcbcbc;
} }
.x-resizable-pinned .x-combo-list-inner { .x-resizable-pinned .x-combo-list-inner {
border-bottom-color:#BEBEBE; border-bottom-color: #bebebe;
} }
.x-combo-list-item { .x-combo-list-item {
@ -1337,12 +1429,13 @@ a.x-menu-item {
} }
.x-combo-list .x-toolbar { .x-combo-list .x-toolbar {
border-top-color:#BCBCBC; border-top-color: #bcbcbc;
} }
.x-combo-list-small { .x-combo-list-small {
font: normal 11px tahoma, arial, helvetica, sans-serif; font: normal 11px tahoma, arial, helvetica, sans-serif;
}.x-panel { }
.x-panel {
border-color: #d0d0d0; border-color: #d0d0d0;
} }
@ -1360,15 +1453,18 @@ a.x-menu-item {
background-color: #fff; background-color: #fff;
} }
.x-panel-bbar .x-toolbar, .x-panel-tbar .x-toolbar { .x-panel-bbar .x-toolbar,
.x-panel-tbar .x-toolbar {
border-color: #d0d0d0; border-color: #d0d0d0;
} }
.x-panel-tbar-noheader .x-toolbar, .x-panel-mc .x-panel-tbar .x-toolbar { .x-panel-tbar-noheader .x-toolbar,
.x-panel-mc .x-panel-tbar .x-toolbar {
border-top-color: #d0d0d0; border-top-color: #d0d0d0;
} }
.x-panel-body-noheader, .x-panel-mc .x-panel-body { .x-panel-body-noheader,
.x-panel-mc .x-panel-body {
border-top-color: #d0d0d0; border-top-color: #d0d0d0;
} }
@ -1381,7 +1477,10 @@ a.x-menu-item {
background-image: url(../images/gray/panel/top-bottom.gif); background-image: url(../images/gray/panel/top-bottom.gif);
} }
.x-panel-tl, .x-panel-tr, .x-panel-bl, .x-panel-br{ .x-panel-tl,
.x-panel-tr,
.x-panel-bl,
.x-panel-br {
background-image: url(../images/gray/panel/corners-sprite.gif); background-image: url(../images/gray/panel/corners-sprite.gif);
border-bottom-color: #d0d0d0; border-bottom-color: #d0d0d0;
} }
@ -1420,7 +1519,12 @@ a.x-menu-item {
border-color: #d0d0d0; border-color: #d0d0d0;
} }
.x-panel-fbar td,.x-panel-fbar span,.x-panel-fbar input,.x-panel-fbar div,.x-panel-fbar select,.x-panel-fbar label{ .x-panel-fbar td,
.x-panel-fbar span,
.x-panel-fbar input,
.x-panel-fbar div,
.x-panel-fbar select,
.x-panel-fbar label {
font: normal 11px arial, tahoma, helvetica, sans-serif; font: normal 11px arial, tahoma, helvetica, sans-serif;
} }
.x-window-proxy { .x-window-proxy {
@ -1492,19 +1596,19 @@ a.x-menu-item {
} }
.x-window-plain .x-window-mc { .x-window-plain .x-window-mc {
background-color: #E8E8E8; background-color: #e8e8e8;
border-color: #D0D0D0 #EEEEEE #EEEEEE #D0D0D0; border-color: #d0d0d0 #eeeeee #eeeeee #d0d0d0;
} }
.x-window-plain .x-window-body { .x-window-plain .x-window-body {
border-color: #EEEEEE #D0D0D0 #D0D0D0 #EEEEEE; border-color: #eeeeee #d0d0d0 #d0d0d0 #eeeeee;
} }
body.x-body-masked .x-window-plain .x-window-mc { body.x-body-masked .x-window-plain .x-window-mc {
background-color: #E4E4E4; background-color: #e4e4e4;
} }
.x-html-editor-wrap { .x-html-editor-wrap {
border-color:#BCBCBC; border-color: #bcbcbc;
background-color: #fff; background-color: #fff;
} }
.x-html-editor-tb .x-btn-text { .x-html-editor-tb .x-btn-text {
@ -1581,20 +1685,20 @@ body.x-body-masked .x-window-plain .x-window-mc {
background-image: url(../images/default/layout/mini-top.gif); background-image: url(../images/default/layout/mini-top.gif);
} }
.x-progress-wrap { .x-progress-wrap {
border-color:#8E8E8E; border-color: #8e8e8e;
} }
.x-progress-inner { .x-progress-inner {
background-color:#E7E7E7; background-color: #e7e7e7;
background-image: url(../images/gray/qtip/bg.gif); background-image: url(../images/gray/qtip/bg.gif);
} }
.x-progress-bar { .x-progress-bar {
background-color:#BCBCBC; background-color: #bcbcbc;
background-image: url(../images/gray/progress/progress-bg.gif); background-image: url(../images/gray/progress/progress-bg.gif);
border-top-color:#E2E2E2; border-top-color: #e2e2e2;
border-bottom-color:#A4A4A4; border-bottom-color: #a4a4a4;
border-right-color:#A4A4A4; border-right-color: #a4a4a4;
} }
.x-progress-text { .x-progress-text {
@ -1604,7 +1708,7 @@ body.x-body-masked .x-window-plain .x-window-mc {
} }
.x-progress-text-back { .x-progress-text-back {
color:#5F5F5F; color: #5f5f5f;
} }
.x-list-header { .x-list-header {
background-color: #f9f9f9; background-color: #f9f9f9;
@ -1633,11 +1737,14 @@ body.x-body-masked .x-window-plain .x-window-mc {
border-right-color: #555; border-right-color: #555;
} }
.x-list-header-inner em.sort-asc, .x-list-header-inner em.sort-desc { .x-list-header-inner em.sort-asc,
.x-list-header-inner em.sort-desc {
background-image: url(../images/gray/grid/sort-hd.gif); background-image: url(../images/gray/grid/sort-hd.gif);
border-color: #d0d0d0; border-color: #d0d0d0;
} }
.x-slider-horz, .x-slider-horz .x-slider-end, .x-slider-horz .x-slider-inner { .x-slider-horz,
.x-slider-horz .x-slider-end,
.x-slider-horz .x-slider-inner {
background-image: url(../images/default/slider/slider-bg.png); background-image: url(../images/default/slider/slider-bg.png);
} }
@ -1645,7 +1752,9 @@ body.x-body-masked .x-window-plain .x-window-mc {
background-image: url(../images/gray/slider/slider-thumb.png); background-image: url(../images/gray/slider/slider-thumb.png);
} }
.x-slider-vert, .x-slider-vert .x-slider-end, .x-slider-vert .x-slider-inner { .x-slider-vert,
.x-slider-vert .x-slider-end,
.x-slider-vert .x-slider-inner {
background-image: url(../images/default/slider/slider-v-bg.png); background-image: url(../images/default/slider/slider-v-bg.png);
} }

View File

@ -4,16 +4,18 @@ For a quick summary read: https://docs.pipenv.org/basics/
## Prerequisites ## Prerequisites
* python-libtorrent - python-libtorrent
* pip - pip
* pipenv - pipenv
## Install pipenv and packages ## Install pipenv and packages
Install Pipenv and upgrade pip: Install Pipenv and upgrade pip:
pip install -U pip pipenv pip install -U pip pipenv
On Ubuntu: On Ubuntu:
sudo -H pip install -U pip pipenv sudo -H pip install -U pip pipenv
In order to have access to system libtorrent we use `--site-packages` and In order to have access to system libtorrent we use `--site-packages` and