From 900a179f7e91b552d977b868cefa9fa2b4df5b90 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Sat, 6 Feb 2021 13:06:33 +0300 Subject: [PATCH] [dark theme] added ui themes switcher --- .../main/app/view/FileMenuPanels.js | 24 ++++++++++++++++++ apps/documenteditor/main/locale/en.json | 3 +++ .../main/app/view/FileMenuPanels.js | 23 +++++++++++++++++ apps/presentationeditor/main/locale/en.json | 3 +++ .../main/app/view/FileMenuPanels.js | 25 ++++++++++++++++++- apps/spreadsheeteditor/main/locale/en.json | 3 +++ 6 files changed, 80 insertions(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index f47f50bd1..c9d7e6058 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -240,6 +240,10 @@ define([ '', '','', /** coauthoring end **/ + '', + '', + '', + '','', '', '', '
', @@ -446,6 +450,18 @@ define([ }); this.btnAutoCorrect.on('click', _.bind(this.autoCorrect, this)); + + this.cmbTheme = new Common.UI.ComboBox({ + el : $markup.findById('#fms-cmb-theme'), + style : 'width: 160px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 'theme-light', displayValue: this.txtThemeLight }, + { value: 'theme-dark', displayValue: this.txtThemeDark } + ] + }); + this.btnApply = new Common.UI.Button({ el: $markup.findById('#fms-btn-apply') }); @@ -564,9 +580,14 @@ define([ this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc); this.chPaste.setValue(Common.Utils.InternalSettings.get("de-settings-paste-button")); + + item = this.cmbTheme.store.findWhere({value: Common.UI.Themes.current()}); + this.cmbTheme.setValue(item ? item.get('value') : 0); }, applySettings: function() { + Common.UI.Themes.setTheme(this.cmbTheme.getValue()); + Common.localStorage.setItem("de-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0); Common.localStorage.setItem("de-settings-zoom", this.cmbZoom.getValue()); Common.Utils.InternalSettings.set("de-settings-zoom", Common.localStorage.getItem("de-settings-zoom")); @@ -689,6 +710,9 @@ define([ strPaste: 'Cut, copy and paste', strPasteButton: 'Show Paste Options button when content is pasted', txtProofing: 'Proofing', + strTheme: 'Theme', + txtThemeLight: 'Light', + txtThemeDark: 'Dark', txtAutoCorrect: 'AutoCorrect options...' }, DE.Views.FileMenuPanels.Settings || {})); diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 165b8f3b0..32500fa65 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1649,6 +1649,9 @@ "DE.Views.FileMenuPanels.Settings.txtWarnMacros": "Show Notification", "DE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification", "DE.Views.FileMenuPanels.Settings.txtWin": "as Windows", + "DE.Views.FileMenuPanels.Settings.strTheme": "Theme", + "DE.Views.FileMenuPanels.Settings.txtThemeLight": "Light", + "DE.Views.FileMenuPanels.Settings.txtThemeDark": "Dark", "DE.Views.FormSettings.textCheckbox": "Checkbox", "DE.Views.FormSettings.textColor": "Border color", "DE.Views.FormSettings.textComb": "Comb of characters", diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index 20b5c73a5..54cf303af 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -214,6 +214,10 @@ define([ '', '','', /** coauthoring end **/ + '', + '', + '', + '','', '', '', '
', @@ -389,6 +393,17 @@ define([ }); this.btnAutoCorrect.on('click', _.bind(this.autoCorrect, this)); + this.cmbTheme = new Common.UI.ComboBox({ + el : $markup.findById('#fms-cmb-theme'), + style : 'width: 160px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 'theme-light', displayValue: this.txtThemeLight }, + { value: 'theme-dark', displayValue: this.txtThemeDark } + ] + }); + this.btnApply = new Common.UI.Button({ el: $markup.findById('#fms-btn-apply') }); @@ -496,9 +511,14 @@ define([ this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc); this.chPaste.setValue(Common.Utils.InternalSettings.get("pe-settings-paste-button")); + + item = this.cmbTheme.store.findWhere({value: Common.UI.Themes.current()}); + this.cmbTheme.setValue(item ? item.get('value') : 0); }, applySettings: function() { + Common.UI.Themes.setTheme(this.cmbTheme.getValue()); + Common.localStorage.setItem("pe-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0); Common.localStorage.setItem("pe-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0); Common.localStorage.setItem("pe-settings-zoom", this.cmbZoom.getValue()); @@ -595,6 +615,9 @@ define([ strPaste: 'Cut, copy and paste', strPasteButton: 'Show Paste Options button when content is pasted', txtProofing: 'Proofing', + strTheme: 'Theme', + txtThemeLight: 'Light', + txtThemeDark: 'Dark', txtAutoCorrect: 'AutoCorrect options...' }, PE.Views.FileMenuPanels.Settings || {})); diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index ab80d8cc3..6885db5c7 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1302,6 +1302,9 @@ "PE.Views.FileMenuPanels.Settings.txtWarnMacros": "Show Notification", "PE.Views.FileMenuPanels.Settings.txtWarnMacrosDesc": "Disable all macros with a notification", "PE.Views.FileMenuPanels.Settings.txtWin": "as Windows", + "PE.Views.FileMenuPanels.Settings.strTheme": "Theme", + "PE.Views.FileMenuPanels.Settings.txtThemeLight": "Light", + "PE.Views.FileMenuPanels.Settings.txtThemeDark": "Dark", "PE.Views.HeaderFooterDialog.applyAllText": "Apply to all", "PE.Views.HeaderFooterDialog.applyText": "Apply", "PE.Views.HeaderFooterDialog.diffLanguage": "You can’t use a date format in a different language than the slide master.
To change the master, click 'Apply to all' instead of 'Apply'", diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index d30df3151..22c9a4a41 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -691,6 +691,10 @@ define([ '', '','', /** coauthoring end **/ + '', + '', + '', + '','', '', '', '
', @@ -994,7 +998,18 @@ define([ el: $markup.findById('#fms-chb-paste-settings'), labelText: this.strPasteButton }); - + + this.cmbTheme = new Common.UI.ComboBox({ + el : $markup.findById('#fms-cmb-theme'), + style : 'width: 160px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 'theme-light', displayValue: this.txtThemeLight }, + { value: 'theme-dark', displayValue: this.txtThemeDark } + ] + }); + this.btnApply = new Common.UI.Button({ el: $markup.findById('#fms-btn-apply') }); @@ -1141,9 +1156,14 @@ define([ this.lblMacrosDesc.text(item ? item.get('descValue') : this.txtWarnMacrosDesc); this.chPaste.setValue(Common.Utils.InternalSettings.get("sse-settings-paste-button")); + + item = this.cmbTheme.store.findWhere({value: Common.UI.Themes.current()}); + this.cmbTheme.setValue(item ? item.get('value') : 0); }, applySettings: function() { + Common.UI.Themes.setTheme(this.cmbTheme.getValue()); + Common.localStorage.setItem("sse-settings-zoom", this.cmbZoom.getValue()); Common.Utils.InternalSettings.set("sse-settings-zoom", Common.localStorage.getItem("sse-settings-zoom")); /** coauthoring begin **/ @@ -1289,6 +1309,9 @@ define([ txtRunMacrosDesc: 'Enable all macros without notification', txtStopMacrosDesc: 'Disable all macros without notification', strPaste: 'Cut, copy and paste', + strTheme: 'Theme', + txtThemeLight: 'Light', + txtThemeDark: 'Dark', strPasteButton: 'Show Paste Options button when content is pasted' }, SSE.Views.FileMenuPanels.MainSettingsGeneral || {})); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 0c14f7462..04991b785 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1803,6 +1803,9 @@ "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWarnMacros": "Show Notification", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWarnMacrosDesc": "Disable all macros with a notification", "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtWin": "as Windows", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.strTheme": "Theme", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtThemeLight": "Light", + "SSE.Views.FileMenuPanels.MainSettingsGeneral.txtThemeDark": "Dark", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.okButtonText": "Apply", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.strDictionaryLanguage": "Dictionary language", "SSE.Views.FileMenuPanels.MainSpellCheckSettings.strIgnoreWordsInUPPERCASE": "Ignore words in UPPERCASE",