Major progress on revamp

* Deprecated explicit prompt.hjson/general.promptFile, etc.: menu.hjson can simply include any number of files
* All menus and themes, their events, etc. are managed by ThemeManager allowing includes, refs, etc. and much cleaner code
This commit is contained in:
Bryan Ashby 2020-06-17 00:10:51 -06:00
parent 1a96ad41d2
commit 4d4be5d6a9
No known key found for this signature in database
GPG key ID: B49EB437951D2542
15 changed files with 331 additions and 400 deletions

View file

@ -83,7 +83,7 @@ function Client(/*input, output*/) {
const self = this;
this.user = new User();
this.currentTheme = { info : { name : 'N/A', description : 'None' } };
this.currentThemeConfig = { info : { name : 'N/A', description : 'None' } };
this.lastActivityTime = Date.now();
this.menuStack = new MenuStack(this);
this.acs = new ACS( { client : this, user : this.user } );
@ -94,6 +94,26 @@ function Client(/*input, output*/) {
this.mciCache = {};
};
Object.defineProperty(this, 'currentTheme', {
get : () => {
if (this.currentThemeConfig) {
return this.currentThemeConfig.get();
} else {
return {
info : {
name : 'N/A',
author : 'N/A',
description : 'N/A',
group : 'N/A',
}
};
}
},
set : (theme) => {
this.currentThemeConfig = theme;
}
});
Object.defineProperty(this, 'node', {
get : function() {
return self.session.id;
@ -120,7 +140,7 @@ function Client(/*input, output*/) {
this.themeChangedListener = function( { themeId } ) {
if(_.get(self.currentTheme, 'info.themeId') === themeId) {
self.currentTheme = require('./theme.js').getAvailableThemes().get(themeId);
self.currentThemeConfig = require('./theme.js').getAvailableThemes().get(themeId);
}
};