-
+
@@ -422,8 +420,8 @@ http://ex1.com/f2.mp4 http://ex2.com/f2.mp4
diff --git a/js/ctrls/modal.js b/js/ctrls/modal.js
index 2f78941..e91d463 100644
--- a/js/ctrls/modal.js
+++ b/js/ctrls/modal.js
@@ -30,8 +30,8 @@ angular
'webui.services.settings'
])
.controller('ModalCtrl', [
- '$_', '$scope', '$rpc', '$modals', '$settings',
- function(_, scope, rpc, modals, settings) {
+ '$_', '$scope', '$rpc', '$modals',
+ function(_, scope, rpc, modals) {
scope.getUris = {
shown: false,
@@ -45,14 +45,18 @@ angular
.filter(function(d) { return d.length })
.value();
},
- finish: function() {
+ success: function() {
var uris = this.parse();
this.uris = '';
if (this.cb) this.cb(uris);
+ this.close();
+
+ },
+ close: function() {
+ this.shown = this.open = false;
this.cb = null;
- this.shown = false;
}
};
@@ -62,16 +66,19 @@ angular
init: function(cb) { this.shown = true; this.cb = cb },
files: [],
- finish: function() {
+ success: function() {
var self = this;
console.log('parsing files');
parseFiles(self.files, function(txts) {
console.log('calling cb', this.cb);
if (self.cb) self.cb(txts);
- self.cb = null;
- self.shown = false;
+ self.close();
});
+ },
+ close: function() {
+ this.cb = null;
+ this.shown = false;
}
};
});
@@ -79,26 +86,18 @@ angular
scope.globalSettings = {
shown: false,
settings: [],
- init: function(cb) {
- var self = this;
- self.cb = cb;
-
- rpc.once('getGlobalOption', [], function(data) {
- var vals = data[0];
- for (var i in vals) {
- if (!(i in data)) {
- data.push({ name: i, val: vals[i], desc: '' });
- }
- else data[i].val = vals[i];
- }
- console.log(vals);
- self.shown = true;
- });
-
- self.settings = settings;
+ init: function(settings, cb) {
+ this.cb = cb;
+ this.settings = settings;
+ this.shown = true;
},
- finish: function() {
-
+ success: function() {
+ if (this.cb) this.cb(this.settings);
+ this.close();
+ },
+ close: function() {
+ this.cb = null;
+ this.shown = this.open = false;
}
};
@@ -107,14 +106,13 @@ angular
'globalSettings'
], function(name) {
modals.register(name, function(cb) {
- if (scope[name].open) {
+ if (scope[name].open && scope[name].cb) {
// modal already shown, user is busy
// TODO: get a better method of passing this info
cb([]);
}
else {
var args = Array.prototype.slice.call(arguments, 0);
- console.log('setting cb for ', name, cb);
scope[name].open = true;
scope[name].init.apply(scope[name], args);
};
diff --git a/js/ctrls/nav.js b/js/ctrls/nav.js
index 36b38c6..ebe67f2 100644
--- a/js/ctrls/nav.js
+++ b/js/ctrls/nav.js
@@ -1,11 +1,12 @@
angular
.module('webui.ctrls.nav', [
'webui.services.constants', 'webui.services.modals',
- 'webui.services.rpc.helpers'
+ 'webui.services.rpc', 'webui.services.rpc.helpers',
+ 'webui.services.settings'
])
.controller('NavCtrl', [
- '$scope', '$name', '$modals', '$rpchelpers',
- function(scope, name, modals, rhelpers) {
+ '$scope', '$name', '$modals', '$rpc', '$rpchelpers', '$settings',
+ function(scope, name, modals, rpc, rhelpers, settings) {
scope.name = name;
@@ -37,8 +38,23 @@ angular
};
scope.changeGSettings = function() {
- modals.invoke('globalSettings', function() {
- alert('closing dialog');
+ rpc.once('getGlobalOption', [], function(data) {
+ var vals = data[0];
+ for (var i in vals) {
+ if (!(i in settings)) {
+ settings[i] = { name: i, val: vals[i], desc: '' };
+ }
+ else {
+ settings[i].val = vals[i];
+ }
+ }
+
+ modals.invoke('globalSettings', settings, function(settings) {
+ var sets = {};
+ for (var i in settings) { sets[i] = settings[i].val };
+
+ rpc.once('changeGlobalOption', [sets]);
+ });
});
};
diff --git a/js/services/settings/settings.js b/js/services/settings/settings.js
index 4f30525..1c464a0 100644
--- a/js/services/settings/settings.js
+++ b/js/services/settings/settings.js
@@ -84,7 +84,7 @@ angular.module('webui.services.settings', [])
},
"bt-prioritize-piece": {
- val: '1M',
+ val: '',
desc: "Try to download first and last pieces of each file first. This is useful for previewing files. The argument can contain 2 keywords: head and tail. To include both keywords, they must be separated by comma. These keywords can take one parameter, SIZE. For example, if head=
is specified, pieces in the range of first SIZE bytes of each file get higher priority. tail= means the range of last SIZE bytes of each file. SIZE can include K or M (1K = 1024, 1M = 1024K). If SIZE is omitted, SIZE=1M is used."
},