last used quality profile is now used as default

This commit is contained in:
kay.one 2013-05-27 22:40:58 -07:00
parent 465dc725c8
commit e4e6bcae1d
16 changed files with 70 additions and 66 deletions

View file

@ -1,6 +1,15 @@
"use strict";
define(['app'], function () {
NzbDrone.Config = {
Events: {
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
},
Keys : {
DefaultQualityProfileId: 'DefaultQualityProfileId'
}
};
NzbDrone.Config.GetValue = function (key, defaultValue) {
var storeValue = localStorage.getItem(key);
@ -9,12 +18,20 @@ define(['app'], function () {
return defaultValue;
}
return storeValue;
return storeValue.toString();
};
NzbDrone.Config.SetValue = function (key, value) {
console.log('Config: [{0}] => [{1}] '.format(key, value));
if (NzbDrone.Config.GetValue(key) === value.toString()) {
return;
}
localStorage.setItem(key, value);
NzbDrone.vent.trigger(NzbDrone.Config.Events.ConfigUpdatedEvent, {key: key, value: value});
};
});