This commit is contained in:
Igor Timofeev 2018-09-19 22:23:20 +03:00
parent d5bacbd379
commit 535efd4abe
5 changed files with 24 additions and 6 deletions

View File

@ -9,8 +9,9 @@
screenHeight = "Height",
screenPreferredMonitor = "Monitor",
screenScaleInfo = "Using this option will allow you to select the optimal screen resolution to get rid of the \"black rectangles\" effect",
screenInvalidResolution = "The text in the input fields should consist of digits, and the maximum resolution should't exceed %d characters",
wallpaper = "Wallpapers",
wallpaper = "Wallpaper",
wallpaperWallpaper = "Wallpaper",
wallpaperScreensaver = "Screensaver",
wallpaperScreensaverPath = "Screensaver script path",

View File

@ -9,6 +9,7 @@
screenHeight = "Hauteur",
screenPreferredMonitor = "Surveiller",
screenScaleInfo = "L'utilisation de cette option vous permettra de sélectionner la résolution d'écran optimale pour éliminer l'effet des \"barres noires\"",
screenInvalidResolution = "Le texte dans les champs de saisie doit être composé de chiffres et la résolution maximale ne doit pas dépasser %d caractères",
wallpaper = "Fonds d'écran et économiseur d'écran",
wallpaperWallpaper = "Fonds d'écran",

View File

@ -9,6 +9,7 @@
screenHeight = "Высота",
screenPreferredMonitor = "Монитор",
screenScaleInfo = "Использование этой опции позволит подобрать оптимальное разрешение экрана, чтобы избавиться от эффекта \"черных полос\"",
screenInvalidResolution = "Текст в полях ввода должен состоять из цифр, а максимальное разрешение не должно превышать %d символов",
wallpaper = "Обои и заставка",
wallpaperWallpaper = "Обои",

View File

@ -9,6 +9,7 @@
screenHeight = "Висота",
screenPreferredMonitor = "Монітор",
screenScaleInfo = "Використання цієї опції дозволить підібрати оптимальний дозвіл екрана, щоб позбутися від ефекту \"чорних смуг \"",
screenInvalidResolution = "Текст в полях введення повинен складатися з цифр, а максимальна роздільна здатність не повинно перевищувати %d символів",
wallpaper = "Обои і заставка",
wallpaperWallpaper = "Шпалери",

View File

@ -61,36 +61,50 @@ module.onTouch = function()
layout:addChild(GUI.text(1, 1, 0x2D2D2D, "x"))
local heightInput = layout:addChild(GUI.input(1, 1, 17, 3, 0xE1E1E1, 0x696969, 0xA5A5A5, 0xE1E1E1, 0x2D2D2D, "", localization.screenHeight))
local maxWidth, maxHeight = buffer.getGPUProxy().maxResolution()
local limit = maxWidth * maxHeight
local cykaTextBox = window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0x880000, {string.format(localization.screenInvalidResolution, limit)}, 1, 0, 0, true, true))
local switch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.screenAutoScale .. ":", MineOSCore.properties.screenAutoScale)).switch
window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0xA5A5A5, {localization.screenScaleInfo}, 1, 0, 0, true, true))
local function updateSwitch()
widthInput.text, heightInput.text = tostring(buffer.getWidth()), tostring(buffer.getHeight())
widthInput.text = tostring(MineOSCore.properties.resolution and MineOSCore.properties.resolution[1] or buffer.getWidth())
heightInput.text = tostring(MineOSCore.properties.resolution and MineOSCore.properties.resolution[2] or buffer.getHeight())
resolutionComboBox.hidden = not switch.state
layout.hidden = switch.state
MineOSInterface.mainContainer:drawOnScreen()
end
local function updateCykaTextBox()
local width, height = tonumber(widthInput.text), tonumber(heightInput.text)
cykaTextBox.hidden = width and height and width * height <= limit
return width, height
end
switch.onStateChanged = function()
updateSwitch()
updateCykaTextBox()
mainContainer:drawOnScreen()
MineOSCore.properties.screenAutoScale = switch.state
MineOSCore.saveProperties()
end
widthInput.onInputFinished = function()
local width, height = tonumber(widthInput.text), tonumber(heightInput.text)
if width and height then
local width, height = updateCykaTextBox()
if cykaTextBox.hidden then
setResolution(width, height)
else
mainContainer:drawOnScreen()
end
end
heightInput.onInputFinished = widthInput.onInputFinished
updateSwitch()
updateCykaTextBox()
end
--------------------------------------------------------------------------------
return module