mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-20 02:59:20 +01:00
User add feature for Settings app
This commit is contained in:
parent
dadbd40a83
commit
1b51cd8286
@ -87,4 +87,10 @@
|
||||
systemRAM = "Memory management",
|
||||
systemUnload = "Upload library",
|
||||
systemInfo = "This option saves memory by unloading unused libraries using the \"Weak Link\" method. Disable it if you encounter any rancors or glitches in the behavior of complex interdependent systems",
|
||||
|
||||
users = "Users",
|
||||
usersAdd = "Add user",
|
||||
usersList = "List of users",
|
||||
usersTypeNameHere = "Type nickname here",
|
||||
usersInfo = "You can create private access to your computer. To register, the specified user must be online",
|
||||
}
|
||||
@ -87,4 +87,10 @@
|
||||
systemRAM = "Gestion de la mémoire",
|
||||
systemUnload = "Télécharger la bibliothèque",
|
||||
systemInfo = "Cette option économise de la mémoire en déchargeant les bibliothèques inutilisées en utilisant la méthode \"Weak Link\". Désactivez-le si vous rencontrez des bizarreries ou des problèmes dans le comportement de systèmes interdépendants complexes",
|
||||
|
||||
users = "Utilisateurs",
|
||||
usersAdd = "Ajouter un utilisateur",
|
||||
usersList = "La liste des utilisateurs",
|
||||
usersTypeNameHere = "Entrez un surnom",
|
||||
usersInfo = "Vous pouvez créer un accès privé à votre ordinateur. Pour l'enregistrement, l'utilisateur spécifié doit être en ligne",
|
||||
}
|
||||
@ -87,4 +87,10 @@
|
||||
systemRAM = "Управление памятью",
|
||||
systemUnload = "Выгрузить библиотеку",
|
||||
systemInfo = "Данная опция позволяет экономить память, выгружая неиспользуемые библиотеки методом \"Weak Link\". Отключите ее, если столкнетесь с какими-либо странностями или глюками в поведении сложных взаимозависимых систем",
|
||||
|
||||
users = "Пользователи",
|
||||
usersAdd = "Добавить пользователя",
|
||||
usersList = "Список пользователей",
|
||||
usersTypeNameHere = "Введите никнейм",
|
||||
usersInfo = "Вы можете создать приватный доступ к компьютеру. Для регистрации указанный пользователь должен быть онлайн",
|
||||
}
|
||||
@ -87,4 +87,10 @@
|
||||
systemRAM = "Управління пам'яттю",
|
||||
systemUnload = "Вивантажити бібліотеку",
|
||||
systemInfo = "Дана опція дозволяє економити пам'ять, вивантажуючи невикористовувані бібліотеки методом \"Weak Link \". Вимкніть її, якщо зіткнетеся з якими-небудь дивацтвами або глюками в поведінці складних взаємозалежних систем",
|
||||
|
||||
users = "Користувач",
|
||||
usersAdd = "Додати користувача",
|
||||
usersList = "Список користувачів",
|
||||
usersTypeNameHere = "Введіть нікнейм",
|
||||
usersInfo = "Ви можете створити приватний доступ до комп'ютера. Для реєстрації вказаний користувач повинен бути онлайн",
|
||||
}
|
||||
BIN
Applications/Settings/Modules/00_Users/Icon.pic
Executable file
BIN
Applications/Settings/Modules/00_Users/Icon.pic
Executable file
Binary file not shown.
67
Applications/Settings/Modules/00_Users/Main.lua
Normal file
67
Applications/Settings/Modules/00_Users/Main.lua
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
local GUI = require("GUI")
|
||||
local computer = require("computer")
|
||||
|
||||
local module = {}
|
||||
|
||||
local mainContainer, window, localization = table.unpack({...})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
module.name = localization.users
|
||||
module.margin = 0
|
||||
module.onTouch = function()
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.usersAdd))
|
||||
|
||||
local input = window.contentLayout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xA5A5A5, 0xE1E1E1, 0x2D2D2D, "", localization.usersTypeNameHere))
|
||||
|
||||
window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0xA5A5A5, {localization.usersInfo}, 1, 0, 0, true, true))
|
||||
|
||||
local usersListText = window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.usersList))
|
||||
|
||||
local usersLayout = window.contentLayout:addChild(GUI.layout(1, 1, 36, 1, 1, 1))
|
||||
usersLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_TOP)
|
||||
usersLayout:setSpacing(1, 1, 0)
|
||||
|
||||
local function update()
|
||||
local users = {computer.users()}
|
||||
|
||||
usersLayout:removeChildren()
|
||||
usersLayout.height = 0
|
||||
|
||||
usersListText.hidden = #users == 0
|
||||
usersLayout.hidden = usersListText.hidden
|
||||
|
||||
if #users > 0 then
|
||||
for i = 1, #users do
|
||||
local userContainer = usersLayout:addChild(GUI.container(1, 1, usersLayout.width, 3))
|
||||
userContainer:addChild(GUI.panel(1, 1, userContainer.width - 5, userContainer.height, 0xE1E1E1))
|
||||
userContainer:addChild(GUI.text(2, 2, 0x696969, string.limit(users[i], userContainer.width - 5, "right")))
|
||||
userContainer:addChild(GUI.button(userContainer.width - 4, 1, 5, 3, 0xD2D2D2, 0x0, 0x969696, 0xE1E1E1, "x")).onTouch = function()
|
||||
computer.removeUser(users[i])
|
||||
|
||||
update()
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
usersLayout.height = usersLayout.height + userContainer.height
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
input.onInputFinished = function()
|
||||
if #input.text > 0 then
|
||||
computer.addUser(input.text)
|
||||
input.text = ""
|
||||
|
||||
update()
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
update()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return module
|
||||
Loading…
x
Reference in New Issue
Block a user