From 43fb59d56a1f67ff81df0a1fe6c4e0eb25fcf036 Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Thu, 31 Jan 2019 16:16:26 +0300 Subject: [PATCH] Added localization dependency type when creating/updating AppMarket publication --- .../App Market.app/Localizations/English.lang | 1 + .../App Market.app/Localizations/French.lang | 1 + .../App Market.app/Localizations/German.lang | 1 + .../App Market.app/Localizations/Italian.lang | 1 + .../App Market.app/Localizations/Russian.lang | 1 + .../Localizations/Ukrainian.lang | 1 + Applications/App Market.app/Main.lua | 55 ++++++++++++------- Applications/VK.app/Main.lua | 2 + 8 files changed, 43 insertions(+), 20 deletions(-) diff --git a/Applications/App Market.app/Localizations/English.lang b/Applications/App Market.app/Localizations/English.lang index e6ed16f5..14392ce4 100644 --- a/Applications/App Market.app/Localizations/English.lang +++ b/Applications/App Market.app/Localizations/English.lang @@ -50,6 +50,7 @@ fileByURL = "File via URL", add = "Add", relativePath = "Relative path", + localizationDependency = "Localization file", login = "Log in", profile = "Profile", diff --git a/Applications/App Market.app/Localizations/French.lang b/Applications/App Market.app/Localizations/French.lang index 1cf1bcab..e31d5abb 100644 --- a/Applications/App Market.app/Localizations/French.lang +++ b/Applications/App Market.app/Localizations/French.lang @@ -50,6 +50,7 @@ fileByURL = "Fichier par URL", add = "Ajouter", relativePath = "Chemin relatif", + localizationDependency = "Fichier de localisation", login = "S'identifier", profile = "Profil", diff --git a/Applications/App Market.app/Localizations/German.lang b/Applications/App Market.app/Localizations/German.lang index 3eaf907d..c9771b95 100644 --- a/Applications/App Market.app/Localizations/German.lang +++ b/Applications/App Market.app/Localizations/German.lang @@ -50,6 +50,7 @@ fileByURL = "Datei über URL", add = "Hinzufügen", relativePath = "Relativer Pfad", + localizationDependency = "Lokalisierungsdatei", login = "Anmelden", profile = "Profil", diff --git a/Applications/App Market.app/Localizations/Italian.lang b/Applications/App Market.app/Localizations/Italian.lang index d2b99ac5..c4d92e6f 100644 --- a/Applications/App Market.app/Localizations/Italian.lang +++ b/Applications/App Market.app/Localizations/Italian.lang @@ -50,6 +50,7 @@ fileByURL = "File tramite URL", add = "Aggiungere", relativePath = "Percorso relativo", + localizationDependency = "File di localizzazione", login = "Login", profile = "Profilo", diff --git a/Applications/App Market.app/Localizations/Russian.lang b/Applications/App Market.app/Localizations/Russian.lang index 89da935f..0e875ca4 100644 --- a/Applications/App Market.app/Localizations/Russian.lang +++ b/Applications/App Market.app/Localizations/Russian.lang @@ -50,6 +50,7 @@ fileByURL = "Файл по URL", add = "Добавить", relativePath = "Относительный путь", + localizationDependency = "Файл локализации", login = "Авторизация", profile = "Профиль", diff --git a/Applications/App Market.app/Localizations/Ukrainian.lang b/Applications/App Market.app/Localizations/Ukrainian.lang index 072d5c78..8531d078 100644 --- a/Applications/App Market.app/Localizations/Ukrainian.lang +++ b/Applications/App Market.app/Localizations/Ukrainian.lang @@ -50,6 +50,7 @@ fileByURL = "Файл по URL", add = "Додати", relativePath = "Відносний шлях", + localizationDependency = "Файл локалізації", login = "Авторизація", profile = "Профіль", diff --git a/Applications/App Market.app/Main.lua b/Applications/App Market.app/Main.lua index d00bc649..5259c055 100644 --- a/Applications/App Market.app/Main.lua +++ b/Applications/App Market.app/Main.lua @@ -1,6 +1,4 @@ -local args = {...} - local internet = require("Internet") local GUI = require("GUI") local screen = require("Screen") @@ -398,7 +396,7 @@ local function getDependencyPath(mainFilePath, dependency) end end - return path:gsub("/+", "/") + return filesystem.removeSlashes(path) end local function download(publication) @@ -484,7 +482,7 @@ local function download(publication) pizda(dependencyTree, 1, "") end - local shortcutSwitchAndLabel = container.layout:addChild(GUI.switchAndLabel(1, 1, 44, 8, 0x66DB80, 0x0, 0xE1E1E1, 0x878787, localization.createShortcut .. ":", true)) + local shortcutSwitchAndLabel = container.layout:addChild(GUI.switchAndLabel(1, 1, 44, 6, 0x66DB80, 0x0, 0xE1E1E1, 0x878787, localization.createShortcut .. ":", true)) shortcutSwitchAndLabel.hidden = publication.category_id == 2 container.layout:addChild(GUI.button(1, 1, 44, 3, 0x696969, 0xFFFFFF, 0x0, 0xFFFFFF, localization.download)).onTouch = function() @@ -835,7 +833,7 @@ local function settings() local currentPasswordInput = layout:addChild(GUI.input(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0xB4B4B4, 0xFFFFFF, 0x2D2D2D, "", localization.currentPassword, false, "*")) local passwordInput = layout:addChild(GUI.input(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0xB4B4B4, 0xFFFFFF, 0x2D2D2D, "", recover and localization.newPassword or localization.password, false, "*")) - local singleSessionSwitchAndLabel = layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xC3C3C3, 0xFFFFFF, 0xA5A5A5, localization.singleSession .. ":", config.singleSession)) + local singleSessionSwitchAndLabel = layout:addChild(GUI.switchAndLabel(1, 1, 36, 6, 0x66DB80, 0xC3C3C3, 0xFFFFFF, 0xA5A5A5, localization.singleSession .. ":", config.singleSession)) layout:addChild(GUI.button(1, 1, 36, 3, 0xA5A5A5, 0xFFFFFF, 0x696969, 0xFFFFFF, "OK")).onTouch = function() if login then @@ -1569,20 +1567,30 @@ editPublication = function(initialPublication, initialCategoryID) local dependencyTypeComboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xFFFFFF, 0x4B4B4B, 0x969696, 0xE1E1E1)) dependencyTypeComboBox:addItem(localization.fileByURL) + dependencyTypeComboBox:addItem(localization.localizationDependency) dependencyTypeComboBox:addItem(localization.existingPublication) dependencyTypeComboBox.selectedItem = lastDependencyType - local publicationNameInput = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0xB4B4B4, 0xFFFFFF, 0x2D2D2D, "", "Double Buffering")) - local urlInput = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0xB4B4B4, 0xFFFFFF, 0x2D2D2D, "", "http://example.com/English.lang")) + local publicationNameInput = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0xB4B4B4, 0xFFFFFF, 0x2D2D2D, "", "MineOS")) + local urlInput = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0xB4B4B4, 0xFFFFFF, 0x2D2D2D, "", "")) local pathInput = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xFFFFFF, 0x696969, 0xB4B4B4, 0xFFFFFF, 0x2D2D2D, "", "")) - local pathType = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x0, 0xE1E1E1, 0x878787, localization.relativePath .. ":", true)) + local pathType = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 6, 0x66DB80, 0x0, 0xE1E1E1, 0x878787, localization.relativePath .. ":", true)) local button = container.layout:addChild(GUI.button(1, 1, 36, 3, 0x696969, 0xFFFFFF, 0x0, 0xFFFFFF, localization.add)) button.onTouch = function() addDependency({ - publication_name = lastDependencyType > 1 and publicationNameInput.text or nil, - path = lastDependencyType == 1 and (not pathType.hidden and pathType.switch.state and pathInput.text:gsub("^/+", "") or "/" .. pathInput.text:gsub("/+", "/")) or nil, - source_url = lastDependencyType == 1 and urlInput.text or nil, + publication_name = lastDependencyType == 3 and publicationNameInput.text or nil, + path = + lastDependencyType == 1 and + ( + not pathType.hidden and pathType.switch.state and pathInput.text:gsub("^/+", "") or filesystem.removeSlashes("/" .. pathInput.text) + ) or + lastDependencyType == 2 and + ( + "Localizations/" .. filesystem.name(urlInput.text) + ) or + nil, + source_url = lastDependencyType ~= 3 and urlInput.text or nil, }) container:remove() @@ -1592,18 +1600,27 @@ editPublication = function(initialPublication, initialCategoryID) publicationNameInput.onInputFinished = function() if lastDependencyType == 1 then button.disabled = #pathInput.text == 0 or #urlInput.text == 0 + elseif lastDependencyType == 2 then + button.disabled = #urlInput.text == 0 or filesystem.extension(urlInput.text) ~= ".lang" else button.disabled = #publicationNameInput.text == 0 end end pathInput.onInputFinished, urlInput.onInputFinished = publicationNameInput.onInputFinished, publicationNameInput.onInputFinished + local function updatePlaceholder() + urlInput.placeholderText = lastDependencyType == 1 and "http://example.com/Main.lua" or "http://example.com/English.lang" + pathInput.placeholderText = pathType.switch.state and "Resources/Main.lua" or "Users/Scripts/Main.lua" + end + local function onDependencyTypeComboBoxItemSelected() lastDependencyType = dependencyTypeComboBox.selectedItem - publicationNameInput.hidden = lastDependencyType == 1 - pathInput.hidden = not publicationNameInput.hidden - urlInput.hidden = pathInput.hidden - pathType.hidden = categoryComboBox.selectedItem > 1 or pathInput.hidden + publicationNameInput.hidden = lastDependencyType ~= 3 + pathInput.hidden = lastDependencyType ~= 1 + urlInput.hidden = lastDependencyType == 3 + pathType.hidden = categoryComboBox.selectedItem == 3 or pathInput.hidden + + updatePlaceholder() end dependencyTypeComboBox.onItemSelected = function() @@ -1611,9 +1628,7 @@ editPublication = function(initialPublication, initialCategoryID) workspace:draw() end - pathType.switch.onStateChanged = function() - pathInput.placeholderText = pathType.switch.state and "Localizations/English.lang" or "/MineOS/Localizations/English.lang" - end + pathType.switch.onStateChanged = updatePlaceholder publicationNameInput.onInputFinished() onDependencyTypeComboBoxItemSelected() @@ -1931,7 +1946,7 @@ loadConfig() lastMethod = loadCategory -if args[1] == "updates" then +if select(1, ...) == "updates" then lastArguments = {nil, true} leftList.selectedItem = #categories + 2 else @@ -1939,4 +1954,4 @@ else leftList.selectedItem = 2 end -window:resize(window.width, window.height) \ No newline at end of file +window:resize(window.width, window.height) diff --git a/Applications/VK.app/Main.lua b/Applications/VK.app/Main.lua index b6a2b1ee..2324235f 100644 --- a/Applications/VK.app/Main.lua +++ b/Applications/VK.app/Main.lua @@ -1710,7 +1710,9 @@ window.onResize = function(width, height) window.backgroundPanel.localX, window.backgroundPanel.width, window.backgroundPanel.height = leftPanel.width + 1, width - leftPanel.width, height contentContainer.localX, contentContainer.width, contentContainer.height = window.backgroundPanel.localX, window.backgroundPanel.width, window.backgroundPanel.height +end +window.onResizeFinished = function() if lastPizda then lastPizda() end