update the doc strings
This commit is contained in:
parent
d39f6843c9
commit
454321614b
|
@ -31,14 +31,13 @@ Copyright:
|
||||||
statement from all source files in the program, then also delete it here.
|
statement from all source files in the program, then also delete it here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @namespace Deluge.Events
|
|
||||||
* @class Deluge.Events
|
|
||||||
* @name Deluge.Events
|
|
||||||
* @description Class for holding global events that occur within the UI.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
/**
|
||||||
|
* @class Deluge.Events
|
||||||
|
* <p>Deluge.Events is a singleton that components of the UI can use to fire global events</p>
|
||||||
|
* @singleton
|
||||||
|
* Class for holding global events that occur within the UI.
|
||||||
|
*/
|
||||||
Events = Ext.extend(Ext.util.Observable, {
|
Events = Ext.extend(Ext.util.Observable, {
|
||||||
constructor: function() {
|
constructor: function() {
|
||||||
this.toRegister = [];
|
this.toRegister = [];
|
||||||
|
@ -46,6 +45,9 @@ Copyright:
|
||||||
Events.superclass.constructor.call(this);
|
Events.superclass.constructor.call(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append an event handler to this object.
|
||||||
|
*/
|
||||||
addListener: function(eventName, fn, scope, o) {
|
addListener: function(eventName, fn, scope, o) {
|
||||||
this.addEvents(eventName);
|
this.addEvents(eventName);
|
||||||
if (/[A-Z]/.test(eventName.substring(0, 1))) {
|
if (/[A-Z]/.test(eventName.substring(0, 1))) {
|
||||||
|
@ -65,6 +67,9 @@ Copyright:
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts the EventsManager checking for events.
|
||||||
|
*/
|
||||||
start: function() {
|
start: function() {
|
||||||
Ext.each(this.toRegister, function(eventName) {
|
Ext.each(this.toRegister, function(eventName) {
|
||||||
Deluge.Client.web.register_event_listener(eventName);
|
Deluge.Client.web.register_event_listener(eventName);
|
||||||
|
@ -74,18 +79,23 @@ Copyright:
|
||||||
this.poll();
|
this.poll();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the EventsManager checking for events.
|
||||||
|
*/
|
||||||
stop: function() {
|
stop: function() {
|
||||||
if (this.running) {
|
if (this.running) {
|
||||||
clearInterval(this.running);
|
clearInterval(this.running);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// private
|
||||||
onLogin: function() {
|
onLogin: function() {
|
||||||
this.start();
|
this.start();
|
||||||
this.on('PluginEnabledEvent', this.onPluginEnabled, this);
|
this.on('PluginEnabledEvent', this.onPluginEnabled, this);
|
||||||
this.on('PluginDisabledEvent', this.onPluginDisabled, this);
|
this.on('PluginDisabledEvent', this.onPluginDisabled, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// private
|
||||||
onPollSuccess: function(events) {
|
onPollSuccess: function(events) {
|
||||||
if (!events) return;
|
if (!events) return;
|
||||||
Ext.each(events, function(event) {
|
Ext.each(events, function(event) {
|
||||||
|
@ -95,7 +105,17 @@ Copyright:
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends an event handler to this object (shorthand for {@link #addListener})
|
||||||
|
* @method
|
||||||
|
*/
|
||||||
Events.prototype.on = Events.prototype.addListener
|
Events.prototype.on = Events.prototype.addListener
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fires the specified event with the passed parameters (minus the event name).
|
||||||
|
* @method
|
||||||
|
*/
|
||||||
Events.prototype.fire = Events.prototype.fireEvent
|
Events.prototype.fire = Events.prototype.fireEvent
|
||||||
Deluge.Events = new Events();
|
Deluge.Events = new Events();
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -32,16 +32,19 @@ Copyright:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description A collection of functions for string formatting values.
|
* A collection of functions for string formatting values.
|
||||||
* @namespace Deluge.Formatters
|
* @class Deluge.Formatters
|
||||||
|
* @author Damien Churchill <damoxc@gmail.com>
|
||||||
|
* @version 1.3
|
||||||
|
* @singleton
|
||||||
*/
|
*/
|
||||||
Deluge.Formatters = {
|
Deluge.Formatters = {
|
||||||
/**
|
/**
|
||||||
* Formats a date string in the locale's date representation based on the
|
* Formats a date string in the locale's date representation based on the
|
||||||
* systems timezone.
|
* systems timezone.
|
||||||
*
|
*
|
||||||
* @param {number} timestamp time in seconds since the Epoch
|
* @param {Number} timestamp time in seconds since the Epoch
|
||||||
* @returns {string} a string in the locale's date representation or ""
|
* @return {String} a string in the locale's date representation or ""
|
||||||
* if seconds < 0
|
* if seconds < 0
|
||||||
*/
|
*/
|
||||||
date: function(timestamp) {
|
date: function(timestamp) {
|
||||||
|
@ -60,8 +63,8 @@ Deluge.Formatters = {
|
||||||
/**
|
/**
|
||||||
* Formats the bytes value into a string with KiB, MiB or GiB units.
|
* Formats the bytes value into a string with KiB, MiB or GiB units.
|
||||||
*
|
*
|
||||||
* @param {number} bytes the filesize in bytes
|
* @param {Number} bytes the filesize in bytes
|
||||||
* @returns {string} formatted string with KiB, MiB or GiB units.
|
* @return {String} formatted string with KiB, MiB or GiB units.
|
||||||
*/
|
*/
|
||||||
size: function(bytes) {
|
size: function(bytes) {
|
||||||
if (!bytes) return '';
|
if (!bytes) return '';
|
||||||
|
@ -77,10 +80,10 @@ Deluge.Formatters = {
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats a string to display a transfer speed utilizing {@link Deluge.Formatters.size}
|
* Formats a string to display a transfer speed utilizing {@link #size}
|
||||||
*
|
*
|
||||||
* @param {number} bytes the filesize in bytes
|
* @param {Number} bytes the filesize in bytes
|
||||||
* @returns {string} formatted string with KiB, MiB or GiB units.
|
* @return {String} formatted string with KiB, MiB or GiB units.
|
||||||
*/
|
*/
|
||||||
speed: function(bits) {
|
speed: function(bits) {
|
||||||
return fsize(bits) + '/s'
|
return fsize(bits) + '/s'
|
||||||
|
@ -89,8 +92,8 @@ Deluge.Formatters = {
|
||||||
/**
|
/**
|
||||||
* Formats a string to show time in a human readable form.
|
* Formats a string to show time in a human readable form.
|
||||||
*
|
*
|
||||||
* @param {number} time the number of seconds
|
* @param {Number} time the number of seconds
|
||||||
* @returns {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 '∞' }
|
if (time == 0) { return '∞' }
|
||||||
|
@ -131,8 +134,8 @@ Deluge.Formatters = {
|
||||||
/**
|
/**
|
||||||
* Simply returns the value untouched, for when no formatting is required.
|
* Simply returns the value untouched, for when no formatting is required.
|
||||||
*
|
*
|
||||||
* @param value, the value to be displayed
|
* @param {Mixed} value the value to be displayed
|
||||||
* @returns the untouched value.
|
* @return the untouched value.
|
||||||
*/
|
*/
|
||||||
plain: function(value) {
|
plain: function(value) {
|
||||||
return value;
|
return value;
|
||||||
|
|
|
@ -33,11 +33,17 @@ Copyright:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description The torrent status keys that are commonly used around the UI.
|
* @description The torrent status keys that are commonly used around the UI.
|
||||||
* @namespace Deluge.Keys
|
* @class Deluge.Keys
|
||||||
|
* @singleton
|
||||||
*/
|
*/
|
||||||
Deluge.Keys = {
|
Deluge.Keys = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* Keys that are used within the torrent grid.
|
||||||
|
* <pre>['queue', 'name', 'total_size', 'state', 'progress', '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']</pre>
|
||||||
*/
|
*/
|
||||||
Grid: [
|
Grid: [
|
||||||
'queue', 'name', 'total_size', 'state', 'progress', 'num_seeds',
|
'queue', 'name', 'total_size', 'state', 'progress', 'num_seeds',
|
||||||
|
@ -47,10 +53,12 @@ Deluge.Keys = {
|
||||||
],
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Keys used in the status tab of the statistics panel.
|
* Keys used in the status tab of the statistics panel.
|
||||||
* These get extended
|
* These get updated to include the keys in {@link #Grid}.
|
||||||
* by {@link Deluge.Keys.Grid}.
|
* <pre>['total_done', 'total_payload_download', 'total_uploaded',
|
||||||
* @static
|
* 'total_payload_upload', 'next_announce', 'tracker_status', 'num_pieces',
|
||||||
|
* 'piece_length', 'is_auto_managed', 'active_time', 'seeding_time',
|
||||||
|
* 'seed_rank']</pre>
|
||||||
*/
|
*/
|
||||||
Status: [
|
Status: [
|
||||||
'total_done', 'total_payload_download', 'total_uploaded',
|
'total_done', 'total_payload_download', 'total_uploaded',
|
||||||
|
@ -60,8 +68,7 @@ Deluge.Keys = {
|
||||||
],
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* Keys used in the files tab of the statistics panel.
|
||||||
* @description 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: [
|
||||||
|
@ -69,17 +76,15 @@ Deluge.Keys = {
|
||||||
],
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 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>
|
||||||
* @static
|
|
||||||
*/
|
*/
|
||||||
Peers: [
|
Peers: [
|
||||||
'peers'
|
'peers'
|
||||||
],
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description Keys used in the details tab of the statistics panel.
|
* Keys used in the details tab of the statistics panel.
|
||||||
* @static
|
|
||||||
*/
|
*/
|
||||||
Details: [
|
Details: [
|
||||||
'name', 'save_path', 'total_size', 'num_files', 'tracker_status',
|
'name', 'save_path', 'total_size', 'num_files', 'tracker_status',
|
||||||
|
@ -87,8 +92,7 @@ Deluge.Keys = {
|
||||||
],
|
],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* Keys used in the options tab of the statistics panel.
|
||||||
* @description Keys used in the options tab of the statistics panel.
|
|
||||||
* <pre>['max_download_speed', 'max_upload_speed', 'max_connections', 'max_upload_slots',
|
* <pre>['max_download_speed', 'max_upload_speed', 'max_connections', 'max_upload_slots',
|
||||||
* 'is_auto_managed', 'stop_at_ratio', 'stop_ratio', 'remove_at_ratio', 'private',
|
* 'is_auto_managed', 'stop_at_ratio', 'stop_ratio', 'remove_at_ratio', 'private',
|
||||||
* 'prioritize_first_last']</pre>
|
* 'prioritize_first_last']</pre>
|
||||||
|
|
|
@ -35,6 +35,7 @@ Copyright:
|
||||||
* @description A class that can be used to manage options throughout the ui.
|
* @description A class that can be used to manage options throughout the ui.
|
||||||
* @namespace Deluge
|
* @namespace Deluge
|
||||||
* @class Deluge.MultiOptionsManager
|
* @class Deluge.MultiOptionsManager
|
||||||
|
* @extends Deluge.OptionsManager
|
||||||
*/
|
*/
|
||||||
Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
|
Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value for an option
|
* Get the value for an option
|
||||||
* @param {String|Array} [option] A single option or an array of options to return.
|
* @param {String/Array} option A single option or an array of options to return.
|
||||||
* @returns {Object} the options value.
|
* @returns {Object} the options value.
|
||||||
*/
|
*/
|
||||||
get: function() {
|
get: function() {
|
||||||
|
@ -97,7 +98,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default value for an option.
|
* Get the default value for an option.
|
||||||
* @param {String|Array} [option] A single option or an array of options to return.
|
* @param {String} option A single option.
|
||||||
* @returns {Object} the value of the option
|
* @returns {Object} the value of the option
|
||||||
*/
|
*/
|
||||||
getDefault: function(option) {
|
getDefault: function(option) {
|
||||||
|
@ -182,7 +183,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
|
||||||
/**
|
/**
|
||||||
* Update the value for the specified option and id.
|
* Update the value for the specified option and id.
|
||||||
* @param {String} id
|
* @param {String} id
|
||||||
* @param {String|Object} option or options to update
|
* @param {String/Object} option or options to update
|
||||||
* @param {Object} [value];
|
* @param {Object} [value];
|
||||||
*/
|
*/
|
||||||
update: function(option, value) {
|
update: function(option, value) {
|
||||||
|
@ -212,9 +213,7 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/******************
|
// Event Handlers
|
||||||
* Event Handlers *
|
|
||||||
******************/
|
|
||||||
/**
|
/**
|
||||||
* Stops a form fields value from being blocked by the change functions
|
* Stops a form fields value from being blocked by the change functions
|
||||||
* @param {Ext.form.Field} field
|
* @param {Ext.form.Field} field
|
||||||
|
@ -224,6 +223,13 @@ Deluge.MultiOptionsManager = Ext.extend(Deluge.OptionsManager, {
|
||||||
this.update(field._doption, field.getValue());
|
this.update(field._doption, field.getValue());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles updating binds when an option's value is changed.
|
||||||
|
* @param {String} id The current option id
|
||||||
|
* @param {String} option The option that has changed.
|
||||||
|
* @param {Mixed} newValue The new value
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
onChange: function(id, option, newValue, oldValue) {
|
onChange: function(id, 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;
|
||||||
|
|
|
@ -43,9 +43,6 @@ Ext.namespace('Deluge');
|
||||||
*/
|
*/
|
||||||
Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
|
Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new instance of the OptionsManager.
|
|
||||||
*/
|
|
||||||
constructor: function(config) {
|
constructor: function(config) {
|
||||||
config = config || {};
|
config = config || {};
|
||||||
this.binds = {};
|
this.binds = {};
|
||||||
|
@ -54,8 +51,25 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
|
||||||
this.focused = null;
|
this.focused = null;
|
||||||
|
|
||||||
this.addEvents({
|
this.addEvents({
|
||||||
|
/**
|
||||||
|
* @event add
|
||||||
|
* Fires when an option is added
|
||||||
|
*/
|
||||||
'add': true,
|
'add': true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @event changed
|
||||||
|
* Fires when an option is changed
|
||||||
|
* @param {String} option The changed option
|
||||||
|
* @param {Mixed} value The options new value
|
||||||
|
* @param {Mixed} oldValue The options old value
|
||||||
|
*/
|
||||||
'changed': true,
|
'changed': true,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @event reset
|
||||||
|
* Fires when the options are reset
|
||||||
|
*/
|
||||||
'reset': true
|
'reset': true
|
||||||
});
|
});
|
||||||
this.on('changed', this.onChange, this);
|
this.on('changed', this.onChange, this);
|
||||||
|
@ -205,7 +219,7 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the value for the specified option and id.
|
* Update the value for the specified option and id.
|
||||||
* @param {String|Object} option or options to update
|
* @param {String/Object} option or options to update
|
||||||
* @param {Object} [value];
|
* @param {Object} [value];
|
||||||
*/
|
*/
|
||||||
update: function(option, value) {
|
update: function(option, value) {
|
||||||
|
@ -233,9 +247,6 @@ Deluge.OptionsManager = Ext.extend(Ext.util.Observable, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/******************
|
|
||||||
* Event Handlers *
|
|
||||||
******************/
|
|
||||||
/**
|
/**
|
||||||
* Lets the option manager know when a field is blurred so if a value
|
* Lets the option manager know when a field is blurred so if a value
|
||||||
* so value changing operations can continue on that field.
|
* so value changing operations can continue on that field.
|
||||||
|
|
|
@ -121,9 +121,7 @@ Ext.deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
// Set the values of the proxies
|
||||||
* Set the values of the proxies
|
|
||||||
*/
|
|
||||||
setValue: function(value) {
|
setValue: function(value) {
|
||||||
this.setting = true;
|
this.setting = true;
|
||||||
this.type.setValue(value['type']);
|
this.type.setValue(value['type']);
|
||||||
|
|
|
@ -79,7 +79,7 @@ Copyright:
|
||||||
* Ext.deluge.TorrentGrid Class
|
* Ext.deluge.TorrentGrid Class
|
||||||
*
|
*
|
||||||
* @author Damien Churchill <damoxc@gmail.com>
|
* @author Damien Churchill <damoxc@gmail.com>
|
||||||
* @version 1.2
|
* @version 1.3
|
||||||
*
|
*
|
||||||
* @class Ext.deluge.TorrentGrid
|
* @class Ext.deluge.TorrentGrid
|
||||||
* @extends Ext.grid.GridPanel
|
* @extends Ext.grid.GridPanel
|
||||||
|
|
Loading…
Reference in New Issue