From e0cec2720ef1d3d7e9d1da7a2f221a47cfb846af Mon Sep 17 00:00:00 2001 From: Danail Karadaliev Date: Wed, 8 Apr 2020 12:05:10 +0300 Subject: [PATCH 1/3] GPII-4424: Added new option inside siteConfig > qss > showQssCloseButton which determines if the Close (X) button of the QSS itself will be there or not --- siteconfig.json5 | 10 ++++++-- src/main/common/utils.js | 12 ++++++++-- src/main/dialogs/quickSetStrip/qssDialog.js | 26 ++++++++++++++------- src/main/qss.js | 4 +++- src/renderer/qss/css/qss.css | 3 ++- 5 files changed, 40 insertions(+), 15 deletions(-) diff --git a/siteconfig.json5 b/siteconfig.json5 index f6aa2d7c8..dbf45249a 100644 --- a/siteconfig.json5 +++ b/siteconfig.json5 @@ -17,6 +17,12 @@ // The scaling factor for the QSS scaleFactor: 1.2, + + // Determines if the close (X) button will be displayed on the QSS + // set to `true` if the button should be there, and `false` to hide it + showQssCloseButton: false, + + // All of the url based settings urls: { account: "http://morphic.world/account", cloudFolder: "https://drive.google.com/drive/folders/11m-AKdP-0wjEBocpVtvnK8iE23P7hFTS", @@ -87,7 +93,7 @@ // - "grid-visible", or "x" // For visible gray grid space (same size as the invisible one) buttonList: [ - { + /*{ "buttonId": "MakeYourOwn", "buttonName": "Task Manager", "buttonType": "KEY", @@ -119,7 +125,7 @@ "office-simplification", "high-contrast", "mouse", - "read-aloud", + "read-aloud",*/ "volume", "launch-documorph", "cloud-folder-open", diff --git a/src/main/common/utils.js b/src/main/common/utils.js index 0d26df5a0..8488d0e65 100644 --- a/src/main/common/utils.js +++ b/src/main/common/utils.js @@ -355,16 +355,18 @@ gpii.app.buttonListShortcuts = function (buttonName) { /** * Filters the full button list based on the provided array of `id` attributes * @param {Array} siteConfigButtonList - basic array of strings + * @param {Boolean} siteConfigShowCloseButton - boolean with the option from qss > showQssCloseButton * @param {Object[]} availableButtons - all available buttons found in settings.json * @return {Object[]} - filtered version of available buttons (same structure) */ -gpii.app.filterButtonList = function (siteConfigButtonList, availableButtons) { +gpii.app.filterButtonList = function (siteConfigButtonList, siteConfigShowCloseButton, availableButtons) { /** * These buttons are explicitly selected in the siteConfig, added in the same order. * All of the buttons that don't have `id` at all, they are added at the end of the list * starting tabindex, adding +10 of each new item. */ var nonTabindex = ["separator", "separator-visible", "grid", "grid-visible"], + closeButtonId = "service-close", matchedList = [], afterList = [], tabindex = 100; @@ -381,7 +383,13 @@ gpii.app.filterButtonList = function (siteConfigButtonList, availableButtons) { // this is custom button matchedButton = gpii.app.generateCustomButton(buttonId); } else { - matchedButton = gpii.app.findButtonById(buttonId, availableButtons); + if (buttonId === closeButtonId) { + if (siteConfigShowCloseButton) { + matchedButton = gpii.app.findButtonById(buttonId, availableButtons); + } + } else { + matchedButton = gpii.app.findButtonById(buttonId, availableButtons); + } } if (matchedButton) { // the separators and grid elements don't need tabindex diff --git a/src/main/dialogs/quickSetStrip/qssDialog.js b/src/main/dialogs/quickSetStrip/qssDialog.js index c604dfbc4..ed839b478 100644 --- a/src/main/dialogs/quickSetStrip/qssDialog.js +++ b/src/main/dialogs/quickSetStrip/qssDialog.js @@ -236,10 +236,15 @@ gpii.app.qss.computeQssButtonsWidth = function (options, modelScaleFactor, butto qssButtonTypes = options.qssButtonTypes, buttonWidth = options.dialogContentMetrics.buttonWidth, separatorWidth = options.dialogContentMetrics.separatorWidth, - closeButtonWidth = options.dialogContentMetrics.closeButtonWidth; + closeButtonWidth = options.dialogContentMetrics.closeButtonWidth, + buttonsWidth = buttonWidth * 2, // adding the first buttons by default + showQssCloseButton = (options.siteConfig && options.siteConfig.showQssCloseButton) ? true : false; + + if (showQssCloseButton) { + // start off with the first button size and the constant close button + buttonsWidth += closeButtonWidth; + } - // start off with the first button size and the constant close button - var buttonsWidth = closeButtonWidth + buttonWidth; // check the type of the previous button, if the current is small // in the future, we might have the case that there aren't two small sequential buttons for (var i = 1; i < buttons.length; i++) { @@ -247,12 +252,15 @@ gpii.app.qss.computeQssButtonsWidth = function (options, modelScaleFactor, butto !buttons[i - 1].buttonTypes.includes(qssButtonTypes.smallButton) && buttons[i].path !== qssButtonTypes.closeButton ) { - if (separatorIds.includes(buttons[i].buttonTypes[0])) { - // this is separator type button, which is slimmer that the others - buttonsWidth += separatorWidth; - } else { - // standart button width - buttonsWidth += buttonWidth; + if (buttons[i].path !== qssButtonTypes.closeButton) { + console.log(buttons[i].path, qssButtonTypes.closeButton); + if (separatorIds.includes(buttons[i].buttonTypes[0])) { + // this is separator type button, which is slimmer that the others + buttonsWidth += separatorWidth; + } else { + // standart button width + buttonsWidth += buttonWidth; + } } } } diff --git a/src/main/qss.js b/src/main/qss.js index 278af9ba2..054224c7b 100644 --- a/src/main/qss.js +++ b/src/main/qss.js @@ -619,11 +619,13 @@ gpii.app.qssWrapper.populateLanguageSettingOptions = function (settingOptions, l gpii.app.qssWrapper.loadSettings = function (assetsManager, installedLanguages, locale, messageBundles, settingOptions, settingsFixturePath, siteConfig) { var availableSettings = fluid.require(settingsFixturePath), // list of all available buttons loadedSettings = availableSettings, // by default we are getting all of the buttons + buttonList = siteConfig.buttonList ? siteConfig.buttonList : [], // gets the full button list if exists + showQssCloseButton = siteConfig.showQssCloseButton ? siteConfig.showQssCloseButton : false, // gets the showQssCloseButton setting multiplier = 1000; // the precision multiplier should match the one used in the qssBaseStepperWidget if (gpii.app.hasButtonList(siteConfig)) { // checking if we have a valid button list in the siteConfig // filtering the buttons based on buttonList array - loadedSettings = gpii.app.filterButtonList(siteConfig.buttonList, availableSettings); + loadedSettings = gpii.app.filterButtonList(buttonList, showQssCloseButton ,availableSettings); } // the multiplier used through all of the calculations below it's there because we have too small of values diff --git a/src/renderer/qss/css/qss.css b/src/renderer/qss/css/qss.css index b9fa1cc0a..a25a273ac 100644 --- a/src/renderer/qss/css/qss.css +++ b/src/renderer/qss/css/qss.css @@ -8,6 +8,7 @@ body { .fl-qss { display: flex; height: 100%; + padding: 0 5px; flex-direction: column; flex-wrap: wrap; @@ -85,7 +86,7 @@ body { .fl-qss-button.fl-qss-closeButton { width: 24px; height: 24px; - margin: 0 0 0 5px; + margin: 0 -5px 0 0; border-radius: 0; padding: 0; From b402e229c5b145dd64c9fd297bab4ed8f435767c Mon Sep 17 00:00:00 2001 From: Danail Karadaliev Date: Wed, 8 Apr 2020 12:41:24 +0300 Subject: [PATCH 2/3] GPII-4424: Small changes --- siteconfig.json5 | 2 +- src/main/dialogs/quickSetStrip/qssDialog.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/siteconfig.json5 b/siteconfig.json5 index dbf45249a..1e813169d 100644 --- a/siteconfig.json5 +++ b/siteconfig.json5 @@ -20,7 +20,7 @@ // Determines if the close (X) button will be displayed on the QSS // set to `true` if the button should be there, and `false` to hide it - showQssCloseButton: false, + showQssCloseButton: true, // All of the url based settings urls: { diff --git a/src/main/dialogs/quickSetStrip/qssDialog.js b/src/main/dialogs/quickSetStrip/qssDialog.js index ed839b478..312583674 100644 --- a/src/main/dialogs/quickSetStrip/qssDialog.js +++ b/src/main/dialogs/quickSetStrip/qssDialog.js @@ -253,7 +253,6 @@ gpii.app.qss.computeQssButtonsWidth = function (options, modelScaleFactor, butto buttons[i].path !== qssButtonTypes.closeButton ) { if (buttons[i].path !== qssButtonTypes.closeButton) { - console.log(buttons[i].path, qssButtonTypes.closeButton); if (separatorIds.includes(buttons[i].buttonTypes[0])) { // this is separator type button, which is slimmer that the others buttonsWidth += separatorWidth; From 1322f02f10bb0faa5afe01459058c09a2bdcbfd4 Mon Sep 17 00:00:00 2001 From: Danail Karadaliev Date: Thu, 9 Apr 2020 09:44:54 +0300 Subject: [PATCH 3/3] GPII-4424: Fixed the commented out buttons on the QSS --- siteconfig.json5 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/siteconfig.json5 b/siteconfig.json5 index 1e813169d..8e3c86464 100644 --- a/siteconfig.json5 +++ b/siteconfig.json5 @@ -93,7 +93,7 @@ // - "grid-visible", or "x" // For visible gray grid space (same size as the invisible one) buttonList: [ - /*{ + { "buttonId": "MakeYourOwn", "buttonName": "Task Manager", "buttonType": "KEY", @@ -125,7 +125,7 @@ "office-simplification", "high-contrast", "mouse", - "read-aloud",*/ + "read-aloud", "volume", "launch-documorph", "cloud-folder-open",