From f52c117b095be828099f3a4c3bc7195cfa01a597 Mon Sep 17 00:00:00 2001 From: Alex Devero Date: Fri, 19 Jan 2018 13:27:44 +0100 Subject: [PATCH] Add font size settings --- ElectronClient/app/gui/ConfigScreen.jsx | 13 +++++++++++++ ElectronClient/app/theme.js | 2 +- ReactNativeClient/lib/models/Setting.js | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ElectronClient/app/gui/ConfigScreen.jsx b/ElectronClient/app/gui/ConfigScreen.jsx index ed72bd11f..cade280e7 100644 --- a/ElectronClient/app/gui/ConfigScreen.jsx +++ b/ElectronClient/app/gui/ConfigScreen.jsx @@ -109,6 +109,19 @@ class ConfigScreenComponent extends React.Component { {onTextChange(event)}} /> ); + } else if (md.type === Setting.TYPE_INT) { + const onNumChange = (event) => { + const settings = Object.assign({}, this.state.settings); + settings[key] = event.target.value; + this.setState({ settings: settings}); + }; + + return ( +
+
+ {onNumChange(event)}} min={md.minimum} max={md.maximum} step={md.step}/> +
+ ); } else { console.warn('Type not implemented: ' + key); } diff --git a/ElectronClient/app/theme.js b/ElectronClient/app/theme.js index ca27c8945..bf194838d 100644 --- a/ElectronClient/app/theme.js +++ b/ElectronClient/app/theme.js @@ -1,7 +1,7 @@ const Setting = require('lib/models/Setting.js'); const globalStyle = { - fontSize: 12, + fontSize: 12 * Setting.value('style.zoom')/100, fontFamily: 'sans-serif', margin: 15, // No text and no interactive component should be within this margin itemMarginTop: 10, diff --git a/ReactNativeClient/lib/models/Setting.js b/ReactNativeClient/lib/models/Setting.js index ff57cb96a..5987c4ec0 100644 --- a/ReactNativeClient/lib/models/Setting.js +++ b/ReactNativeClient/lib/models/Setting.js @@ -74,6 +74,7 @@ class Setting extends BaseModel { 86400: _('%d hours', 24), }; }}, + 'style.zoom': {value: "100", type: Setting.TYPE_INT, public: true, appTypes: ['desktop'], label: () => _('Set application zoom percentage'), minimum: "50", maximum: "500", step: "10"}, 'noteVisiblePanes': { value: ['editor', 'viewer'], type: Setting.TYPE_ARRAY, public: false, appTypes: ['desktop'] }, 'autoUpdateEnabled': { value: true, type: Setting.TYPE_BOOL, public: true, appTypes: ['desktop'], label: () => _('Automatically update the application') }, 'showAdvancedOptions': { value: false, type: Setting.TYPE_BOOL, public: true, appTypes: ['mobile' ], label: () => _('Show advanced options') },