mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-20 02:59:20 +01:00
Пиздатейшее приложение "Settings" #1
This commit is contained in:
parent
552d25c9ae
commit
b596235729
BIN
Applications/Settings/Icon.pic
Normal file
BIN
Applications/Settings/Icon.pic
Normal file
Binary file not shown.
89
Applications/Settings/Localizations/English.lang
Normal file
89
Applications/Settings/Localizations/English.lang
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
open = "Open",
|
||||
cancel = "Cancel",
|
||||
|
||||
screen = "Screen",
|
||||
screenResolution = "Resolution",
|
||||
screenAutoScale = "Autoscaling",
|
||||
screenWidth = "Width",
|
||||
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",
|
||||
|
||||
wallpaper = "Wallpapers",
|
||||
wallpaperWallpaper = "Wallpaper",
|
||||
wallpaperScreensaver = "Screensaver",
|
||||
wallpaperScreensaverPath = "Screensaver script path",
|
||||
wallpaperScreensaverEnabled = "Wallpaper enabled",
|
||||
wallpaperScreensaverDelay = "Delay",
|
||||
wallpaperPath = "Wallpaper image path",
|
||||
wallpaperEnabled = "Wallpaper enabled",
|
||||
wallpaperBrightness = "Wallpaper brightness",
|
||||
wallpaperStretch = "Stretc",
|
||||
wallpaperCenter = "Center",
|
||||
wallpaperInfo = "Disabling this option will significantly reduce the consumption of RAM and increase performance",
|
||||
|
||||
appearance = "Appearance",
|
||||
appearanceExtensions = "File extensions",
|
||||
appearanceHidden = "Hidden files",
|
||||
appearanceApplications = "Application icons",
|
||||
appearanceHorizontal = "By horizontal",
|
||||
appearanceVertical = "By vertical",
|
||||
appearanceSize = "Icon sizes",
|
||||
appearanceSpace = "Space between icons",
|
||||
appearanceColorScheme = "Color scheme",
|
||||
appearanceFiles = "File properties",
|
||||
appearanceDesktopBackground = "Desktop background",
|
||||
appearanceDock = "Dock color",
|
||||
appearanceMenu = "Menu",
|
||||
appearanceTransparencyEnabled = "Interface transparency",
|
||||
appearanceTransparencyInfo = "Disabling the last two options will significantly reduce the number of direct calls to the CPU / GPU and increase performance",
|
||||
|
||||
users = "Users",
|
||||
|
||||
localizations = "Language",
|
||||
localizationsInfo = "Do you want more language packs? Send pull request to the MineOS repository on GitHub",
|
||||
|
||||
time = "Date and time",
|
||||
timeFormat = "Date format",
|
||||
timeUseRealTimestamp = "Real time",
|
||||
timeInfo = "Disabling this option will allow you to use the game time instead of the real one. It is useful if the host do not allow receiving a timestamp after 1970",
|
||||
timeZone = "Timezone",
|
||||
|
||||
network = "Network",
|
||||
networkName = "Name for other PCs",
|
||||
networkEnabled = "Visibility in the network",
|
||||
networkFileAccess = "Access to files",
|
||||
networkRadius = "Detection radius",
|
||||
networkRemote = "Remote PC settings",
|
||||
networkThis = "This PC settings",
|
||||
networkNoModem = "Attach the modem to use network functions",
|
||||
|
||||
tasks = "Autostart",
|
||||
tasksInfo = "You can add as many scripts as you want to automatically execute them in order at the specified time",
|
||||
tasksBefore = "Run before running the OS",
|
||||
tasksAfter = "Run after starting the OS",
|
||||
tasksPath = "The path to the script",
|
||||
tasksEnabled = "Task enabled",
|
||||
|
||||
disks = "Disks",
|
||||
disksFormat = "Format",
|
||||
disksBootable = "Make bootable",
|
||||
disksRename = "Rename",
|
||||
disksStatistics = "Statistics",
|
||||
disksControl = "Control",
|
||||
disksPermissions = "Access rights",
|
||||
disksReadOnly = "only reading",
|
||||
disksReadAndWrite = "read and write",
|
||||
disksSpaceTotal = "Memory",
|
||||
disksSpaceUsed = "Used",
|
||||
disksSpaceFree = "Free",
|
||||
disksInfo = "Formatting will delete all data from the selected disk without the possibility of recovery, either in the game or on the host",
|
||||
|
||||
system = "System",
|
||||
systemArchitecture = "CPU architecture",
|
||||
systemUnloading = "Automatic unloading",
|
||||
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",
|
||||
}
|
||||
89
Applications/Settings/Localizations/French.lang
Normal file
89
Applications/Settings/Localizations/French.lang
Normal file
@ -0,0 +1,89 @@
|
||||
{
|
||||
open = "Ouvrez le",
|
||||
cancel = "Annuler",
|
||||
|
||||
screen = "Écran",
|
||||
screenResolution = "Résolution",
|
||||
screenAutoScale = "Mise à l'échelle automatique",
|
||||
screenWidth = "Largeur",
|
||||
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\"",
|
||||
|
||||
wallpaper = "Fonds d'écran et économiseur d'écran",
|
||||
wallpaperWallpaper = "Fonds d'écran",
|
||||
wallpaperScreensaver = "Économiseur d'écran",
|
||||
wallpaperScreensaverPath = "Le chemin d'accès au script d'écran de démarrage",
|
||||
wallpaperScreensaverEnabled = "Utiliser économiseur d'écran",
|
||||
wallpaperScreensaverDelay = "Retardé",
|
||||
wallpaperPath = "Chemin vers l'image du papier peint",
|
||||
wallpaperEnabled = "Utiliser le papier peint",
|
||||
wallpaperBrightness = "Luminosité du papier peint",
|
||||
wallpaperStretch = "Étirer",
|
||||
wallpaperCenter = "Centré",
|
||||
wallpaperInfo = "La désactivation de cette option réduira considérablement la consommation de mémoire vive et augmentera les performances",
|
||||
|
||||
appearance = "Apparence",
|
||||
appearanceExtensions = "Extensions de fichiers",
|
||||
appearanceHidden = "Fichiers cachés",
|
||||
appearanceApplications = "Icônes d'application",
|
||||
appearanceHorizontal = "Horizontalement",
|
||||
appearanceVertical = "Vertical",
|
||||
appearanceSize = "Taille de l'icône",
|
||||
appearanceSpace = "Distance entre les icônes",
|
||||
appearanceColorScheme = "Schéma de couleur",
|
||||
appearanceFiles = "Paramètres de fichier",
|
||||
appearanceDesktopBackground = "Fond d'écran",
|
||||
appearanceDock = "Dock de couleur",
|
||||
appearanceMenu = "Couleur du menu",
|
||||
appearanceTransparencyEnabled = "Transparence de l'interface",
|
||||
appearanceTransparencyInfo = "La désactivation des deux dernières options réduira considérablement le nombre d'appels directs au processeur / processeur graphique et augmentera les performances.",
|
||||
|
||||
users = "Liste des membres",
|
||||
|
||||
localizations = "Langue",
|
||||
localizationsInfo = "Voulez-vous plus de packs de langue? Envoyer une requête pull au dépôt MineOS sur GitHub",
|
||||
|
||||
time = "Date et heure",
|
||||
timeFormat = "Format de date",
|
||||
timeUseRealTimestamp = "Temps réel",
|
||||
timeInfo = "La désactivation de cette option vous permettra d'utiliser le temps de jeu au lieu du temps réel. Ceci est utile si les fonctionnalités de l'hôte ne vous permettent pas d'obtenir un horodatage au-delà de 1970",
|
||||
timeZone = "Fuseau horaire",
|
||||
|
||||
network = "Réseau",
|
||||
networkName = "Nom pour les autres",
|
||||
networkEnabled = "Visibilité dans le réseau",
|
||||
networkFileAccess = "Accès aux fichiers",
|
||||
networkRadius = "Rayon de détection",
|
||||
networkRemote = "Paramètres du PC distant",
|
||||
networkThis = "Paramètres de ce PC",
|
||||
networkNoModem = "Connecter le modem pour utiliser les fonctions réseau",
|
||||
|
||||
tasks = "Démarrage automatique",
|
||||
tasksInfo = "Vous pouvez ajouter autant de scripts que vous le souhaitez pour les exécuter automatiquement dans l'ordre spécifié",
|
||||
tasksBefore = "Exécuter avant d'exécuter le système d'exploitation",
|
||||
tasksAfter = "Exécuter après le démarrage du système d'exploitation",
|
||||
tasksPath = "Le chemin du script",
|
||||
tasksEnabled = "L'exécution est activée",
|
||||
|
||||
disks = "Drives",
|
||||
disksFormat = "Format",
|
||||
disksBootable = "Rendre bootable",
|
||||
disksRename = "Renommer",
|
||||
disksStatistics = "Statistiques",
|
||||
disksControl = "Gouvernance",
|
||||
disksPermissions = "Droits d'accès",
|
||||
disksReadOnly = "lecture seule",
|
||||
disksReadAndWrite = "lire et écrire",
|
||||
disksSpaceTotal = "Capacité de mémoire",
|
||||
disksSpaceUsed = "Utilisé",
|
||||
disksSpaceFree = "Librement",
|
||||
disksInfo = "Le formatage supprimera toutes les données du disque sélectionné sans possibilité de récupération, que ce soit dans le jeu ou sur l'hôte",
|
||||
|
||||
system = "Système",
|
||||
systemArchitecture = "Architecture du processeur",
|
||||
systemUnloading = "Déchargement automatique",
|
||||
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",
|
||||
}
|
||||
89
Applications/Settings/Localizations/Russian.lang
Executable file
89
Applications/Settings/Localizations/Russian.lang
Executable file
@ -0,0 +1,89 @@
|
||||
{
|
||||
open = "Открыть",
|
||||
cancel = "Отмена",
|
||||
|
||||
screen = "Экран",
|
||||
screenResolution = "Разрешение",
|
||||
screenAutoScale = "Автомасштабирование",
|
||||
screenWidth = "Ширина",
|
||||
screenHeight = "Высота",
|
||||
screenPreferredMonitor = "Монитор",
|
||||
screenScaleInfo = "Использование этой опции позволит подобрать оптимальное разрешение экрана, чтобы избавиться от эффекта \"черных полос\"",
|
||||
|
||||
wallpaper = "Обои и заставка",
|
||||
wallpaperWallpaper = "Обои",
|
||||
wallpaperScreensaver = "Заставка",
|
||||
wallpaperScreensaverPath = "Путь к скрипту заставки",
|
||||
wallpaperScreensaverEnabled = "Использовать заставку",
|
||||
wallpaperScreensaverDelay = "Задержка",
|
||||
wallpaperPath = "Путь к изображению обоев",
|
||||
wallpaperEnabled = "Использовать обои",
|
||||
wallpaperBrightness = "Яркость обоев",
|
||||
wallpaperStretch = "Растянуть",
|
||||
wallpaperCenter = "По центру",
|
||||
wallpaperInfo = "Отключение этой опции существенно снизит расход оперативной памяти и увеличит производительность",
|
||||
|
||||
appearance = "Внешний вид",
|
||||
appearanceExtensions = "Расширения файлов",
|
||||
appearanceHidden = "Скрытые файлы",
|
||||
appearanceApplications = "Иконки приложений",
|
||||
appearanceHorizontal = "По горизонтали",
|
||||
appearanceVertical = "По вертикали",
|
||||
appearanceSize = "Размер иконок",
|
||||
appearanceSpace = "Расстояние между иконками",
|
||||
appearanceColorScheme = "Цветовая схема",
|
||||
appearanceFiles = "Параметры файлов",
|
||||
appearanceDesktopBackground = "Фон рабочего стола",
|
||||
appearanceDock = "Цвет Dock",
|
||||
appearanceMenu = "Цвет меню",
|
||||
appearanceTransparencyEnabled = "Прозрачность интерфейса",
|
||||
appearanceTransparencyInfo = "Отключение последних двух опций существенно снизит количество прямых обращений к CPU/GPU и увеличит производительность",
|
||||
|
||||
users = "Пользователи",
|
||||
|
||||
localizations = "Язык",
|
||||
localizationsInfo = "Желаете больше языковых пакетов? Отсылайте pull request в репозиторий MineOS на GitHub",
|
||||
|
||||
time = "Дата и время",
|
||||
timeFormat = "Формат даты",
|
||||
timeUseRealTimestamp = "Реальное время",
|
||||
timeInfo = "Отключение этой опции позволит использовать игровое время вместо реального. Это полезно, если особенности хоста не позволяют получить временную метку позднее 1970 года",
|
||||
timeZone = "Часовой пояс",
|
||||
|
||||
network = "Сеть",
|
||||
networkName = "Имя для окружающих",
|
||||
networkEnabled = "Видимость в сети",
|
||||
networkFileAccess = "Доступ к файлам",
|
||||
networkRadius = "Радиус обнаружения",
|
||||
networkRemote = "Параметры удаленных ПК",
|
||||
networkThis = "Параметры данного ПК",
|
||||
networkNoModem = "Подключите модем для использования сетевых функций",
|
||||
|
||||
tasks = "Автозапуск",
|
||||
tasksInfo = "Вы можете добавить сколько угодно скриптов для их автоматического выполнения по порядку в указанный момент времени",
|
||||
tasksBefore = "Выполнить до запуска ОС",
|
||||
tasksAfter = "Выполнить после запуска ОС",
|
||||
tasksPath = "Путь к скрипту",
|
||||
tasksEnabled = "Выполнение включено",
|
||||
|
||||
disks = "Диски",
|
||||
disksFormat = "Форматировать",
|
||||
disksBootable = "Сделать загрузочным",
|
||||
disksRename = "Переименовать",
|
||||
disksStatistics = "Статистика",
|
||||
disksControl = "Управление",
|
||||
disksPermissions = "Права доступа",
|
||||
disksReadOnly = "только чтение",
|
||||
disksReadAndWrite = "чтение и запись",
|
||||
disksSpaceTotal = "Объем памяти",
|
||||
disksSpaceUsed = "Использовано",
|
||||
disksSpaceFree = "Свободно",
|
||||
disksInfo = "Форматирование приведет к удалению всех данных с выбранного диска без возможности восстановления как в игре, так и на хосте",
|
||||
|
||||
system = "Система",
|
||||
systemArchitecture = "Архитектура CPU",
|
||||
systemUnloading = "Автоматическая выгрузка",
|
||||
systemRAM = "Управление памятью",
|
||||
systemUnload = "Выгрузить библиотеку",
|
||||
systemInfo = "Данная опция позволяет экономить память, выгружая неиспользуемые библиотеки методом \"Weak Link\". Отключите ее, если столкнетесь с какими-либо странностями или глюками в поведении сложных взаимозависимых систем",
|
||||
}
|
||||
148
Applications/Settings/Main.lua
Normal file
148
Applications/Settings/Main.lua
Normal file
@ -0,0 +1,148 @@
|
||||
|
||||
local computer = require("computer")
|
||||
local component = require("component")
|
||||
local GUI = require("GUI")
|
||||
local buffer = require("doubleBuffering")
|
||||
local filesystem = require("filesystem")
|
||||
local color = require("color")
|
||||
local image = require("image")
|
||||
local unicode = require("unicode")
|
||||
local MineOSInterface = require("MineOSInterface")
|
||||
local MineOSPaths = require("MineOSPaths")
|
||||
local MineOSCore = require("MineOSCore")
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local modulesPath = MineOSCore.getCurrentScriptDirectory() .. "Modules/"
|
||||
local localization = MineOSCore.getCurrentScriptLocalization()
|
||||
local scrollSpeed = 2
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local mainContainer, window = MineOSInterface.addWindow(GUI.filledWindow(1, 1, 100, 29, 0xF0F0F0))
|
||||
|
||||
local leftPanel = window:addChild(GUI.panel(1, 1, 30, 1, 0xE1E1E1))
|
||||
window.backgroundPanel.localX = leftPanel.width + 1
|
||||
|
||||
window.actionButtons.localY = 2
|
||||
window.actionButtons:moveToFront()
|
||||
|
||||
local modulesLayout = window:addChild(GUI.layout(1, 3, leftPanel.width, 1, 1, 1))
|
||||
modulesLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_TOP)
|
||||
modulesLayout:setSpacing(1, 1, 1)
|
||||
|
||||
window.contentLayout = window:addChild(GUI.layout(window.backgroundPanel.localX, 1, 1, 1, 1, 1))
|
||||
|
||||
|
||||
local function moduleDraw(object)
|
||||
local textColor = object.pressed and 0xE1E1E1 or 0x2D2D2D
|
||||
if object.pressed then
|
||||
buffer.drawRectangle(object.x, object.y, object.width, object.height, 0x336DFF, textColor, " ")
|
||||
buffer.drawText(object.x, object.y - 1, 0x336DFF, string.rep("▄", object.width))
|
||||
buffer.drawText(object.x, object.y + object.height, 0x336DFF, string.rep("▀", object.width))
|
||||
end
|
||||
|
||||
buffer.drawImage(object.x + 2, object.y, object.icon)
|
||||
buffer.drawText(object.x + 12, object.y + 1, textColor, object.module.name)
|
||||
end
|
||||
|
||||
local function runModule(object)
|
||||
window.contentLayout:removeChildren()
|
||||
window.contentLayout:setMargin(1, 1, 0, object.module.margin)
|
||||
|
||||
window.contentLayout.eventHandler = function(mainContainer, _, e1, e2, e3, e4, e5)
|
||||
if e1 == "scroll" then
|
||||
local cell = window.contentLayout.cells[1][1]
|
||||
local to = -math.floor(cell.childrenHeight / 2)
|
||||
|
||||
cell.verticalMargin = cell.verticalMargin + (e5 > 0 and scrollSpeed or -scrollSpeed)
|
||||
if cell.verticalMargin > object.module.margin then
|
||||
cell.verticalMargin = object.module.margin
|
||||
elseif cell.verticalMargin < to then
|
||||
cell.verticalMargin = to
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
object.module.onTouch()
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
local function selectModule(object)
|
||||
local child
|
||||
for i = 1, #modulesLayout.children do
|
||||
child = modulesLayout.children[i]
|
||||
child.pressed = object == child
|
||||
end
|
||||
|
||||
runModule(object)
|
||||
end
|
||||
|
||||
local function moduleEventHandler(mainContainer, object, e1)
|
||||
if e1 == "touch" then
|
||||
selectModule(object)
|
||||
end
|
||||
end
|
||||
|
||||
local modules = {}
|
||||
for file in filesystem.list(modulesPath) do
|
||||
table.insert(modules, file)
|
||||
end
|
||||
table.sort(modules, function(a, b) return a < b end)
|
||||
|
||||
for i = 1, #modules do
|
||||
local result, reason = loadfile(modulesPath .. modules[i] .. "Main.lua")
|
||||
if result then
|
||||
local success, result = pcall(result, mainContainer, window, localization)
|
||||
if success then
|
||||
local object = modulesLayout:addChild(GUI.object(1, 1, modulesLayout.width, 3))
|
||||
|
||||
object.icon = image.load(modulesPath .. modules[i] .. "Icon.pic")
|
||||
object.module = result
|
||||
object.pressed = false
|
||||
object.draw = moduleDraw
|
||||
object.eventHandler = moduleEventHandler
|
||||
else
|
||||
error("Failed to execute module " .. modules[i] .. ": " .. tostring(result))
|
||||
end
|
||||
else
|
||||
error("Failed to load module " .. modules[i] .. ": " .. tostring(reason))
|
||||
end
|
||||
end
|
||||
|
||||
modulesLayout.eventHandler = function(mainContainer, object, e1, e2, e3, e4, e5)
|
||||
if e1 == "scroll" then
|
||||
local cell = modulesLayout.cells[1][1]
|
||||
local to = -(#modulesLayout.children - 1) * 4 + 1
|
||||
|
||||
cell.verticalMargin = cell.verticalMargin + (e5 > 0 and scrollSpeed or -scrollSpeed)
|
||||
if cell.verticalMargin > 1 then
|
||||
cell.verticalMargin = 1
|
||||
elseif cell.verticalMargin < to then
|
||||
cell.verticalMargin = to
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
window.onResize = function(width, height)
|
||||
modulesLayout:setMargin(1, 1, 0, 1)
|
||||
|
||||
window.backgroundPanel.width, window.backgroundPanel.height = width - leftPanel.width, height
|
||||
window.contentLayout.width, window.contentLayout.height = window.backgroundPanel.width, window.backgroundPanel.height
|
||||
leftPanel.height = height
|
||||
modulesLayout.height = height - 2
|
||||
|
||||
for i = 1, #modulesLayout.children do
|
||||
if modulesLayout.children[i].pressed then
|
||||
runModule(modulesLayout.children[i])
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
window:resize(window.width, window.height)
|
||||
selectModule(modulesLayout.children[1])
|
||||
BIN
Applications/Settings/Modules/0_Screen/Icon.pic
Executable file
BIN
Applications/Settings/Modules/0_Screen/Icon.pic
Executable file
Binary file not shown.
96
Applications/Settings/Modules/0_Screen/Main.lua
Normal file
96
Applications/Settings/Modules/0_Screen/Main.lua
Normal file
@ -0,0 +1,96 @@
|
||||
|
||||
local GUI = require("GUI")
|
||||
local component = require("component")
|
||||
local buffer = require("doubleBuffering")
|
||||
local MineOSInterface = require("MineOSInterface")
|
||||
local MineOSPaths = require("MineOSPaths")
|
||||
local MineOSCore = require("MineOSCore")
|
||||
local scale = require("scale")
|
||||
|
||||
local module = {}
|
||||
|
||||
local mainContainer, window, localization = table.unpack({...})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
module.name = localization.screen
|
||||
module.margin = 0
|
||||
module.onTouch = function()
|
||||
-- Screen proxy
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.screenPreferredMonitor))
|
||||
|
||||
local monitorComboBox = window.contentLayout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
for address in component.list("screen") do
|
||||
monitorComboBox:addItem(address).onTouch = function()
|
||||
buffer.clear(0x0)
|
||||
buffer.drawChanges()
|
||||
|
||||
buffer.bindScreen(address, false)
|
||||
MineOSInterface.changeResolution()
|
||||
MineOSInterface.changeWallpaper()
|
||||
MineOSInterface.updateFileListAndDraw()
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
end
|
||||
|
||||
-- Resolution
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.screenResolution))
|
||||
local resolutionComboBox = window.contentLayout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
|
||||
local function setResolution(width, height)
|
||||
MineOSCore.properties.resolution = {width, height}
|
||||
MineOSInterface.changeResolution()
|
||||
MineOSInterface.changeWallpaper()
|
||||
MineOSInterface.updateFileListAndDraw()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
local step = 1 / 6
|
||||
for i = 1, step, -step do
|
||||
local width, height = scale.getResolution(i)
|
||||
resolutionComboBox:addItem(width .. "x" .. height).onTouch = function()
|
||||
setResolution(width, height)
|
||||
end
|
||||
end
|
||||
|
||||
local layout = window.contentLayout:addChild(GUI.layout(1, 1, 36, 3, 1, 1))
|
||||
layout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
|
||||
|
||||
local widthInput = layout:addChild(GUI.input(1, 1, 16, 3, 0xE1E1E1, 0x696969, 0xA5A5A5, 0xE1E1E1, 0x2D2D2D, "", localization.screenWidth))
|
||||
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 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())
|
||||
resolutionComboBox.hidden = not switch.state
|
||||
layout.hidden = switch.state
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
switch.onStateChanged = function()
|
||||
updateSwitch()
|
||||
|
||||
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
|
||||
setResolution(width, height)
|
||||
end
|
||||
end
|
||||
heightInput.onInputFinished = widthInput.onInputFinished
|
||||
|
||||
updateSwitch()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return module
|
||||
|
||||
BIN
Applications/Settings/Modules/1_Wallpaper/Icon.pic
Executable file
BIN
Applications/Settings/Modules/1_Wallpaper/Icon.pic
Executable file
Binary file not shown.
88
Applications/Settings/Modules/1_Wallpaper/Main.lua
Normal file
88
Applications/Settings/Modules/1_Wallpaper/Main.lua
Normal file
@ -0,0 +1,88 @@
|
||||
|
||||
local GUI = require("GUI")
|
||||
local MineOSInterface = require("MineOSInterface")
|
||||
local MineOSPaths = require("MineOSPaths")
|
||||
local MineOSCore = require("MineOSCore")
|
||||
|
||||
local module = {}
|
||||
|
||||
local mainContainer, window, localization = table.unpack({...})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
module.name = localization.wallpaper
|
||||
module.margin = 5
|
||||
module.onTouch = function()
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.wallpaperWallpaper))
|
||||
|
||||
local wallpaperChooser = window.contentLayout:addChild(GUI.filesystemChooser(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5, MineOSCore.properties.wallpaper, localization.open, localization.cancel, localization.wallpaperPath, "/"))
|
||||
wallpaperChooser:setMode(GUI.IO_MODE_OPEN, GUI.IO_MODE_FILE)
|
||||
wallpaperChooser:addExtensionFilter(".pic")
|
||||
wallpaperChooser.onSubmit = function(path)
|
||||
MineOSCore.properties.wallpaper = path
|
||||
MineOSInterface.changeWallpaper()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
local comboBox = window.contentLayout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
comboBox.selectedItem = MineOSCore.properties.wallpaperMode or 1
|
||||
comboBox:addItem(localization.wallpaperStretch)
|
||||
comboBox:addItem(localization.wallpaperCenter)
|
||||
|
||||
local wallpaperSwitch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.wallpaperEnabled .. ":", MineOSCore.properties.wallpaperEnabled)).switch
|
||||
wallpaperSwitch.onStateChanged = function()
|
||||
MineOSCore.properties.wallpaperEnabled = wallpaperSwitch.state
|
||||
MineOSInterface.changeWallpaper()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0xA5A5A5, {localization.wallpaperInfo}, 1, 0, 0, true, true))
|
||||
|
||||
local wallpaperSlider = window.contentLayout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, 0, 100, MineOSCore.properties.wallpaperBrightness * 100, false, localization.wallpaperBrightness .. ": ", "%"))
|
||||
wallpaperSlider.height = 2
|
||||
wallpaperSlider.roundValues = true
|
||||
wallpaperSlider.onValueChanged = function()
|
||||
MineOSCore.properties.wallpaperBrightness = wallpaperSlider.value / 100
|
||||
MineOSInterface.changeWallpaper()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
comboBox.onItemSelected = function()
|
||||
MineOSCore.properties.wallpaperMode = comboBox.selectedItem
|
||||
MineOSInterface.changeWallpaper()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.wallpaperScreensaver))
|
||||
|
||||
local screensaverChooser = window.contentLayout:addChild(GUI.filesystemChooser(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5, MineOSCore.properties.screensaver, localization.open, localization.cancel, localization.wallpaperScreensaverPath, "/"))
|
||||
screensaverChooser:setMode(GUI.IO_MODE_OPEN, GUI.IO_MODE_FILE)
|
||||
screensaverChooser:addExtensionFilter(".lua")
|
||||
|
||||
local screensaverSwitch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.wallpaperScreensaverEnabled .. ":", MineOSCore.properties.screensaverEnabled)).switch
|
||||
|
||||
local screensaverSlider = window.contentLayout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, 1, 100, MineOSCore.properties.screensaverDelay, false, localization.wallpaperScreensaverDelay .. ": ", " s"))
|
||||
|
||||
local function save()
|
||||
MineOSCore.properties.screensaverEnabled = screensaverSwitch.state
|
||||
MineOSCore.properties.screensaver = screensaverChooser.path
|
||||
MineOSCore.properties.screensaverDelay = screensaverSlider.value
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
screensaverChooser.onSubmit, screensaverSwitch.onStateChanged, screensaverSlider.onValueChanged = save, save, save
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return module
|
||||
|
||||
BIN
Applications/Settings/Modules/2_Icons/Icon.pic
Normal file
BIN
Applications/Settings/Modules/2_Icons/Icon.pic
Normal file
Binary file not shown.
91
Applications/Settings/Modules/2_Icons/Main.lua
Normal file
91
Applications/Settings/Modules/2_Icons/Main.lua
Normal file
@ -0,0 +1,91 @@
|
||||
|
||||
local GUI = require("GUI")
|
||||
local computer = require("computer")
|
||||
local MineOSInterface = require("MineOSInterface")
|
||||
local MineOSPaths = require("MineOSPaths")
|
||||
local MineOSCore = require("MineOSCore")
|
||||
|
||||
local module = {}
|
||||
|
||||
local mainContainer, window, localization = table.unpack({...})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
module.name = localization.appearance
|
||||
module.margin = 12
|
||||
module.onTouch = function()
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.appearanceFiles))
|
||||
|
||||
local showExtensionSwitch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.appearanceExtensions .. ":", MineOSCore.properties.showExtension)).switch
|
||||
local showHiddenFilesSwitch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.appearanceHidden .. ":", MineOSCore.properties.showHiddenFiles)).switch
|
||||
local showApplicationIconsSwitch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.appearanceApplications .. ":", MineOSCore.properties.showApplicationIcons)).switch
|
||||
local transparencySwitch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.appearanceTransparencyEnabled .. ":", MineOSCore.properties.transparencyEnabled)).switch
|
||||
|
||||
window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0xA5A5A5, {localization.appearanceTransparencyInfo}, 1, 0, 0, true, true))
|
||||
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.appearanceColorScheme))
|
||||
|
||||
local backgroundColorSelector = window.contentLayout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.backgroundColor, localization.appearanceDesktopBackground))
|
||||
local menuColorSelector = window.contentLayout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.menuColor, localization.appearanceMenu))
|
||||
local dockColorSelector = window.contentLayout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.dockColor, localization.appearanceDock))
|
||||
|
||||
backgroundColorSelector.onColorSelected = function()
|
||||
MineOSCore.properties.backgroundColor = backgroundColorSelector.color
|
||||
MineOSCore.properties.menuColor = menuColorSelector.color
|
||||
MineOSCore.properties.dockColor = dockColorSelector.color
|
||||
MineOSInterface.mainContainer.menu.colors.default.background = MineOSCore.properties.menuColor
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
menuColorSelector.onColorSelected = backgroundColorSelector.onColorSelected
|
||||
dockColorSelector.onColorSelected = backgroundColorSelector.onColorSelected
|
||||
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.appearanceSize))
|
||||
|
||||
local iconWidthSlider = window.contentLayout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, 8, 16, MineOSCore.properties.iconWidth, false, localization.appearanceHorizontal .. ": ", ""))
|
||||
local iconHeightSlider = window.contentLayout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, 6, 16, MineOSCore.properties.iconHeight, false, localization.appearanceVertical .. ": ", ""))
|
||||
iconHeightSlider.height = 2
|
||||
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.appearanceSpace))
|
||||
|
||||
local iconHorizontalSpaceBetweenSlider = window.contentLayout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, 0, 5, MineOSCore.properties.iconHorizontalSpaceBetween, false, localization.appearanceHorizontal .. ": ", ""))
|
||||
local iconVerticalSpaceBetweenSlider = window.contentLayout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, 0, 5, MineOSCore.properties.iconVerticalSpaceBetween, false, localization.appearanceVertical .. ": ", ""))
|
||||
iconVerticalSpaceBetweenSlider.height = 2
|
||||
|
||||
iconHorizontalSpaceBetweenSlider.roundValues, iconVerticalSpaceBetweenSlider.roundValues = true, true
|
||||
iconWidthSlider.roundValues, iconHeightSlider.roundValues = true, true
|
||||
|
||||
iconWidthSlider.onValueChanged = function()
|
||||
MineOSInterface.setIconProperties(math.floor(iconWidthSlider.value), math.floor(iconHeightSlider.value), MineOSCore.properties.iconHorizontalSpaceBetween, MineOSCore.properties.iconVerticalSpaceBetween)
|
||||
end
|
||||
iconHeightSlider.onValueChanged = iconWidthSlider.onValueChanged
|
||||
|
||||
iconHorizontalSpaceBetweenSlider.onValueChanged = function()
|
||||
MineOSInterface.setIconProperties(MineOSCore.properties.iconWidth, MineOSCore.properties.iconHeight, math.floor(iconHorizontalSpaceBetweenSlider.value), math.floor(iconVerticalSpaceBetweenSlider.value))
|
||||
end
|
||||
iconVerticalSpaceBetweenSlider.onValueChanged = iconHorizontalSpaceBetweenSlider.onValueChanged
|
||||
|
||||
showExtensionSwitch.onStateChanged = function()
|
||||
MineOSCore.properties.showExtension = showExtensionSwitch.state
|
||||
MineOSCore.properties.showHiddenFiles = showHiddenFilesSwitch.state
|
||||
MineOSCore.properties.showApplicationIcons = showApplicationIconsSwitch.state
|
||||
MineOSCore.saveProperties()
|
||||
|
||||
computer.pushSignal("MineOSCore", "updateFileList")
|
||||
end
|
||||
showHiddenFilesSwitch.onStateChanged, showApplicationIconsSwitch.onStateChanged = showExtensionSwitch.onStateChanged, showExtensionSwitch.onStateChanged
|
||||
|
||||
transparencySwitch.onStateChanged = function()
|
||||
MineOSCore.properties.transparencyEnabled = transparencySwitch.state
|
||||
|
||||
MineOSInterface.applyTransparency()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return module
|
||||
|
||||
BIN
Applications/Settings/Modules/3_Tasks/Icon.pic
Normal file
BIN
Applications/Settings/Modules/3_Tasks/Icon.pic
Normal file
Binary file not shown.
95
Applications/Settings/Modules/3_Tasks/Main.lua
Normal file
95
Applications/Settings/Modules/3_Tasks/Main.lua
Normal file
@ -0,0 +1,95 @@
|
||||
|
||||
local GUI = require("GUI")
|
||||
local MineOSInterface = require("MineOSInterface")
|
||||
local MineOSPaths = require("MineOSPaths")
|
||||
local MineOSCore = require("MineOSCore")
|
||||
|
||||
local module = {}
|
||||
|
||||
local mainContainer, window, localization = table.unpack({...})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
module.name = localization.tasks
|
||||
module.margin = 0
|
||||
module.onTouch = function()
|
||||
local filesystemChooser = window.contentLayout:addChild(GUI.filesystemChooser(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5, nil, localization.open, localization.cancel, localization.tasksPath, "/"))
|
||||
filesystemChooser:setMode(GUI.IO_MODE_OPEN, GUI.IO_MODE_FILE)
|
||||
|
||||
local container = window.contentLayout:addChild(GUI.container(1, 1, 36, 3))
|
||||
local tasksComboBox = container:addChild(GUI.comboBox(1, 1, 30, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
local removeButton = container:addChild(GUI.button(container.width - 4, 1, 5, 3, 0xE1E1E1, 0x696969, 0x696969, 0xE1E1E1, "-"))
|
||||
|
||||
local modeComboBox = window.contentLayout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
modeComboBox:addItem(localization.tasksAfter)
|
||||
modeComboBox:addItem(localization.tasksBefore)
|
||||
|
||||
local switchAndLabel = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.tasksEnabled .. ":", true))
|
||||
|
||||
local function update()
|
||||
switchAndLabel.hidden = #MineOSCore.properties.tasks == 0
|
||||
modeComboBox.hidden = switchAndLabel.hidden
|
||||
container.hidden = switchAndLabel.hidden
|
||||
|
||||
if not switchAndLabel.hidden then
|
||||
modeComboBox.selectedItem = MineOSCore.properties.tasks[tasksComboBox.selectedItem].mode
|
||||
switchAndLabel.switch:setState(MineOSCore.properties.tasks[tasksComboBox.selectedItem].enabled)
|
||||
end
|
||||
end
|
||||
|
||||
local function fill()
|
||||
tasksComboBox:clear()
|
||||
|
||||
for i = 1, #MineOSCore.properties.tasks do
|
||||
tasksComboBox:addItem(MineOSCore.properties.tasks[i].path)
|
||||
end
|
||||
tasksComboBox.selectedItem = tasksComboBox:count()
|
||||
|
||||
update()
|
||||
end
|
||||
|
||||
tasksComboBox.onItemSelected = update
|
||||
|
||||
filesystemChooser.onSubmit = function(path)
|
||||
table.insert(MineOSCore.properties.tasks, {
|
||||
path = filesystemChooser.path,
|
||||
enabled = switchAndLabel.switch.state,
|
||||
mode = modeComboBox.selectedItem,
|
||||
})
|
||||
|
||||
filesystemChooser.path = nil
|
||||
fill()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
removeButton.onTouch = function()
|
||||
table.remove(MineOSCore.properties.tasks, tasksComboBox.selectedItem)
|
||||
fill()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
modeComboBox.onItemSelected = function()
|
||||
if #MineOSCore.properties.tasks > 0 then
|
||||
MineOSCore.properties.tasks[tasksComboBox.selectedItem].mode = modeComboBox.selectedItem
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
end
|
||||
|
||||
switchAndLabel.switch.onStateChanged = function()
|
||||
if #MineOSCore.properties.tasks > 0 then
|
||||
MineOSCore.properties.tasks[tasksComboBox.selectedItem].enabled = switchAndLabel.switch.state
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
end
|
||||
|
||||
window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0xA5A5A5, {localization.tasksInfo}, 1, 0, 0, true, true))
|
||||
|
||||
fill()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return module
|
||||
|
||||
BIN
Applications/Settings/Modules/4_Disks/Icon.pic
Normal file
BIN
Applications/Settings/Modules/4_Disks/Icon.pic
Normal file
Binary file not shown.
114
Applications/Settings/Modules/4_Disks/Main.lua
Normal file
114
Applications/Settings/Modules/4_Disks/Main.lua
Normal file
@ -0,0 +1,114 @@
|
||||
|
||||
local computer = require("computer")
|
||||
local component = require("component")
|
||||
local GUI = require("GUI")
|
||||
local MineOSInterface = require("MineOSInterface")
|
||||
local MineOSPaths = require("MineOSPaths")
|
||||
local MineOSCore = require("MineOSCore")
|
||||
local filesystem = require("filesystem")
|
||||
|
||||
local module = {}
|
||||
|
||||
local mainContainer, window, localization = table.unpack({...})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
module.name = localization.disks
|
||||
module.margin = 6
|
||||
module.onTouch = function()
|
||||
local currentAddress = computer.getBootAddress()
|
||||
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.disksControl))
|
||||
|
||||
local comboBox = window.contentLayout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
|
||||
local input = window.contentLayout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xA5A5A5, 0xE1E1E1, 0x2D2D2D, "", localization.disksRename))
|
||||
|
||||
local button = window.contentLayout:addChild(GUI.button(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x696969, 0xE1E1E1, localization.disksFormat))
|
||||
|
||||
window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0xA5A5A5, {localization.disksInfo}, 1, 0, 0, true, true))
|
||||
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.disksStatistics))
|
||||
|
||||
local progressBar = window.contentLayout:addChild(GUI.progressBar(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xA5A5A5, 100, true, true, "", "%"))
|
||||
progressBar.height = 2
|
||||
|
||||
local layout = window.contentLayout:addChild(GUI.layout(1, 1, 36, 1, 1, 1))
|
||||
layout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_LEFT, GUI.ALIGNMENT_VERTICAL_TOP)
|
||||
|
||||
local permissionsKV = layout:addChild(GUI.keyAndValue(1, 1, 0x696969, 0xA5A5A5, localization.disksPermissions, ""))
|
||||
local spaceTotalKV = layout:addChild(GUI.keyAndValue(1, 1, 0x696969, 0xA5A5A5, localization.disksSpaceTotal, ""))
|
||||
local spaceUsedKV = layout:addChild(GUI.keyAndValue(1, 1, 0x696969, 0xA5A5A5, localization.disksSpaceUsed, ""))
|
||||
local spaceFreeKV = layout:addChild(GUI.keyAndValue(1, 1, 0x696969, 0xA5A5A5, localization.disksSpaceFree, ""))
|
||||
|
||||
layout.height = (#layout.children * 2) - 1
|
||||
|
||||
local function getProxy()
|
||||
return comboBox:getItem(comboBox.selectedItem).proxy
|
||||
end
|
||||
|
||||
local function update()
|
||||
local proxy = getProxy()
|
||||
local used, total = proxy.spaceUsed(), proxy.spaceTotal()
|
||||
local free = total - used
|
||||
|
||||
progressBar.value = math.ceil(used / total * 100)
|
||||
permissionsKV.value = ": " .. (proxy.isReadOnly() and localization.disksReadOnly or localization.disksReadAndWrite)
|
||||
spaceTotalKV.value = ": " .. string.format("%.2f", total / 1024 / 1024) .. " MB"
|
||||
spaceUsedKV.value = ": " .. string.format("%.2f", used / 1024 / 1024) .. " MB"
|
||||
spaceFreeKV.value = ": " .. string.format("%.2f", free / 1024 / 1024) .. " MB"
|
||||
end
|
||||
|
||||
local function fill()
|
||||
comboBox:clear()
|
||||
|
||||
for address in component.list("filesystem") do
|
||||
local proxy = component.proxy(address)
|
||||
local label = proxy.getLabel()
|
||||
local item = comboBox:addItem(label and label .. " (" .. address .. ")" or address)
|
||||
item.proxy = proxy
|
||||
|
||||
if address == currentAddress then
|
||||
comboBox.selectedItem = comboBox:count()
|
||||
end
|
||||
end
|
||||
|
||||
update()
|
||||
end
|
||||
|
||||
comboBox.onItemSelected = function()
|
||||
currentAddress = getProxy().address
|
||||
update()
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
input.onInputFinished = function()
|
||||
local success, reason = pcall(getProxy().setLabel, input.text)
|
||||
input.text = ""
|
||||
|
||||
if success then
|
||||
fill()
|
||||
else
|
||||
GUI.alert(reason)
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
button.onTouch = function()
|
||||
local list = getProxy().list("/")
|
||||
for i = 1, #list do
|
||||
-- filesystem.remove(list[i])
|
||||
end
|
||||
|
||||
fill()
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
fill()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return module
|
||||
|
||||
BIN
Applications/Settings/Modules/5_Network/Icon.pic
Normal file
BIN
Applications/Settings/Modules/5_Network/Icon.pic
Normal file
Binary file not shown.
110
Applications/Settings/Modules/5_Network/Main.lua
Normal file
110
Applications/Settings/Modules/5_Network/Main.lua
Normal file
@ -0,0 +1,110 @@
|
||||
|
||||
local GUI = require("GUI")
|
||||
local MineOSInterface = require("MineOSInterface")
|
||||
local MineOSPaths = require("MineOSPaths")
|
||||
local MineOSCore = require("MineOSCore")
|
||||
local MineOSNetwork = require("MineOSNetwork")
|
||||
local filesystem = require("filesystem")
|
||||
|
||||
local module = {}
|
||||
|
||||
local mainContainer, window, localization = table.unpack({...})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
module.name = localization.network
|
||||
module.margin = 0
|
||||
module.onTouch = function()
|
||||
local emptyObject = window.contentLayout:addChild(GUI.object(1, 1, 0, 0))
|
||||
local insertModemText = window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.networkNoModem))
|
||||
local ebloText = window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.networkThis))
|
||||
local networkNameInput = window.contentLayout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xA5A5A5, 0xE1E1E1, 0x2D2D2D, MineOSCore.properties.network.name or "", localization.networkName))
|
||||
local stateSwitchAndLabel = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.networkEnabled .. ":", MineOSCore.properties.network.enabled))
|
||||
local remoteComputersText = window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.networkRemote))
|
||||
local remoteComputersComboBox = window.contentLayout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
local allowReadAndWriteSwitchAndLabel = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.networkFileAccess .. ":", false))
|
||||
|
||||
local signalStrengthSlider = window.contentLayout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, 0, 512, MineOSCore.properties.network.signalStrength, false, localization.networkRadius ..": ", ""))
|
||||
signalStrengthSlider.roundValues = true
|
||||
|
||||
local function check()
|
||||
insertModemText.hidden = MineOSNetwork.modemProxy
|
||||
|
||||
for i = 3, #window.contentLayout.children do
|
||||
window.contentLayout.children[i].hidden = not MineOSNetwork.modemProxy
|
||||
end
|
||||
|
||||
if MineOSNetwork.modemProxy then
|
||||
for i = 6, #window.contentLayout.children do
|
||||
window.contentLayout.children[i].hidden = not stateSwitchAndLabel.switch.state
|
||||
end
|
||||
|
||||
if stateSwitchAndLabel.switch.state then
|
||||
signalStrengthSlider.hidden = not MineOSNetwork.modemProxy.isWireless()
|
||||
|
||||
remoteComputersComboBox:clear()
|
||||
for proxy, path in filesystem.mounts() do
|
||||
if proxy.MineOSNetworkModem then
|
||||
local item = remoteComputersComboBox:addItem(MineOSNetwork.getModemProxyName(proxy))
|
||||
item.proxyAddress = proxy.address
|
||||
item.onTouch = function()
|
||||
allowReadAndWriteSwitchAndLabel.switch:setState(MineOSCore.properties.network.users[item.proxyAddress].allowReadAndWrite)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
remoteComputersText.hidden = remoteComputersComboBox:count() < 1
|
||||
remoteComputersComboBox.hidden = remoteComputersText.hidden
|
||||
allowReadAndWriteSwitchAndLabel.hidden = remoteComputersText.hidden
|
||||
|
||||
if not remoteComputersText.hidden then
|
||||
remoteComputersComboBox:getItem(remoteComputersComboBox.selectedItem).onTouch()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
networkNameInput.onInputFinished = function()
|
||||
MineOSCore.properties.network.name = #networkNameInput.text > 0 and networkNameInput.text or nil
|
||||
MineOSCore.saveProperties()
|
||||
MineOSNetwork.broadcastComputerState(MineOSCore.properties.network.enabled)
|
||||
end
|
||||
|
||||
signalStrengthSlider.onValueChanged = function()
|
||||
MineOSCore.properties.network.signalStrength = math.floor(signalStrengthSlider.value)
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
stateSwitchAndLabel.switch.onStateChanged = function()
|
||||
if stateSwitchAndLabel.switch.state then
|
||||
MineOSNetwork.enable()
|
||||
else
|
||||
MineOSNetwork.disable()
|
||||
end
|
||||
|
||||
check()
|
||||
end
|
||||
|
||||
allowReadAndWriteSwitchAndLabel.switch.onStateChanged = function()
|
||||
MineOSCore.properties.network.users[remoteComputersComboBox:getItem(remoteComputersComboBox.selectedItem).proxyAddress].allowReadAndWrite = allowReadAndWriteSwitchAndLabel.switch.state
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
-- Empty object-listener
|
||||
emptyObject.eventHandler = function(mainContainer, object, e1, e2, e3, ...)
|
||||
if (e1 == "component_added" or e1 == "component_removed") and e3 == "modem" then
|
||||
check()
|
||||
elseif e1 == "MineOSNetwork" and e2 == "updateProxyList" then
|
||||
check()
|
||||
end
|
||||
end
|
||||
|
||||
check()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return module
|
||||
|
||||
BIN
Applications/Settings/Modules/6_Localizations/Icon.pic
Normal file
BIN
Applications/Settings/Modules/6_Localizations/Icon.pic
Normal file
Binary file not shown.
44
Applications/Settings/Modules/6_Localizations/Main.lua
Normal file
44
Applications/Settings/Modules/6_Localizations/Main.lua
Normal file
@ -0,0 +1,44 @@
|
||||
|
||||
local GUI = require("GUI")
|
||||
local MineOSInterface = require("MineOSInterface")
|
||||
local MineOSPaths = require("MineOSPaths")
|
||||
local MineOSCore = require("MineOSCore")
|
||||
local filesystem = require("filesystem")
|
||||
|
||||
local module = {}
|
||||
|
||||
local mainContainer, window, localization = table.unpack({...})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
module.name = localization.localizations
|
||||
module.margin = 0
|
||||
module.onTouch = function()
|
||||
local comboBox = window.contentLayout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0xA5A5A5, {localization.localizationsInfo}, 1, 0, 0, true, true))
|
||||
|
||||
for file in filesystem.list(MineOSPaths.localizationFiles) do
|
||||
local name = filesystem.hideExtension(file)
|
||||
comboBox:addItem(name).onTouch = function()
|
||||
MineOSCore.properties.language = name
|
||||
MineOSCore.localization = MineOSCore.getLocalization(MineOSPaths.localizationFiles)
|
||||
|
||||
MineOSInterface.createWidgets()
|
||||
MineOSInterface.changeResolution()
|
||||
MineOSInterface.changeWallpaper()
|
||||
MineOSCore.updateTime()
|
||||
MineOSInterface.updateFileListAndDraw()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
if name == MineOSCore.properties.language then
|
||||
comboBox.selectedItem = comboBox:count()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return module
|
||||
|
||||
BIN
Applications/Settings/Modules/7_Time/Icon.pic
Normal file
BIN
Applications/Settings/Modules/7_Time/Icon.pic
Normal file
Binary file not shown.
52
Applications/Settings/Modules/7_Time/Main.lua
Normal file
52
Applications/Settings/Modules/7_Time/Main.lua
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
local GUI = require("GUI")
|
||||
local MineOSInterface = require("MineOSInterface")
|
||||
local MineOSPaths = require("MineOSPaths")
|
||||
local MineOSCore = require("MineOSCore")
|
||||
|
||||
local module = {}
|
||||
|
||||
local mainContainer, window, localization = table.unpack({...})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
module.name = localization.time
|
||||
module.margin = 0
|
||||
module.onTouch = function()
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.timeZone))
|
||||
|
||||
local comboBox = window.contentLayout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
comboBox.dropDownMenu.itemHeight = 1
|
||||
|
||||
for i = -12, 12 do
|
||||
comboBox:addItem("GMT" .. (i >= 0 and "+" or "") .. i)
|
||||
end
|
||||
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.timeFormat))
|
||||
|
||||
local input = window.contentLayout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xA5A5A5, 0xE1E1E1, 0x2D2D2D, MineOSCore.properties.dateFormat or ""))
|
||||
|
||||
local switch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.timeUseRealTimestamp .. ":", MineOSCore.properties.timeUseRealTimestamp)).switch
|
||||
|
||||
window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0xA5A5A5, {localization.timeInfo}, 1, 0, 0, true, true))
|
||||
|
||||
comboBox.selectedItem = (MineOSCore.properties.timezone or 0) + 13
|
||||
comboBox.onItemSelected = function()
|
||||
MineOSCore.properties.timeUseRealTimestamp = switch.state
|
||||
MineOSCore.properties.timezone = comboBox.selectedItem - 13
|
||||
MineOSCore.properties.dateFormat = input.text
|
||||
|
||||
MineOSCore.updateTimezone()
|
||||
MineOSCore.updateTime()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
input.onInputFinished, switch.onStateChanged = comboBox.onItemSelected, comboBox.onItemSelected
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return module
|
||||
|
||||
BIN
Applications/Settings/Modules/8_System/Icon.pic
Normal file
BIN
Applications/Settings/Modules/8_System/Icon.pic
Normal file
Binary file not shown.
78
Applications/Settings/Modules/8_System/Main.lua
Normal file
78
Applications/Settings/Modules/8_System/Main.lua
Normal file
@ -0,0 +1,78 @@
|
||||
|
||||
local GUI = require("GUI")
|
||||
local MineOSInterface = require("MineOSInterface")
|
||||
local MineOSPaths = require("MineOSPaths")
|
||||
local MineOSCore = require("MineOSCore")
|
||||
local computer = require("computer")
|
||||
local unicode = require("unicode")
|
||||
|
||||
local module = {}
|
||||
|
||||
local mainContainer, window, localization = table.unpack({...})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
module.name = localization.system
|
||||
module.margin = 3
|
||||
module.onTouch = function()
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.systemArchitecture))
|
||||
|
||||
local CPUComboBox = window.contentLayout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
local architectures, architecture = computer.getArchitectures(), computer.getArchitecture()
|
||||
for i = 1, #architectures do
|
||||
CPUComboBox:addItem(architectures[i]).onTouch = function()
|
||||
computer.setArchitecture(architectures[i])
|
||||
computer.shutdown(true)
|
||||
end
|
||||
|
||||
if architecture == architectures[i] then
|
||||
CPUComboBox.selectedItem = i
|
||||
end
|
||||
end
|
||||
|
||||
window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.systemRAM))
|
||||
|
||||
local RAMComboBox = window.contentLayout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0xD2D2D2, 0xA5A5A5))
|
||||
RAMComboBox.dropDownMenu.itemHeight = 1
|
||||
|
||||
local function update()
|
||||
local libraries = {}
|
||||
for key, value in pairs(package.loaded) do
|
||||
if _G[key] ~= value then
|
||||
table.insert(libraries, key)
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(libraries, function(a, b) return unicode.lower(a) < unicode.lower(b) end)
|
||||
|
||||
RAMComboBox:clear()
|
||||
for i = 1, #libraries do
|
||||
RAMComboBox:addItem(libraries[i])
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
window.contentLayout:addChild(GUI.button(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x696969, 0xE1E1E1, localization.systemUnload)).onTouch = function()
|
||||
package.loaded[RAMComboBox:getItem(RAMComboBox.selectedItem).text] = nil
|
||||
update()
|
||||
end
|
||||
|
||||
local switch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.systemUnloading .. ":", MineOSCore.properties.packageUnloading)).switch
|
||||
switch.onStateChanged = function()
|
||||
MineOSCore.properties.packageUnloading = switch.state
|
||||
MineOSCore.setPackageUnloading(MineOSCore.properties.packageUnloading)
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0xA5A5A5, {localization.systemInfo}, 1, 0, 0, true, true))
|
||||
|
||||
update()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
return module
|
||||
|
||||
451
OS.lua
451
OS.lua
@ -215,7 +215,7 @@ end
|
||||
|
||||
---------------------------------------- Основные функции ----------------------------------------
|
||||
|
||||
local function changeWallpaper()
|
||||
function MineOSInterface.changeWallpaper()
|
||||
MineOSInterface.mainContainer.background.wallpaper = nil
|
||||
|
||||
if MineOSCore.properties.wallpaperEnabled and MineOSCore.properties.wallpaper then
|
||||
@ -255,7 +255,7 @@ end
|
||||
|
||||
---------------------------------------- Всякая параша для ОС-контейнера ----------------------------------------
|
||||
|
||||
local function changeResolution()
|
||||
function MineOSInterface.changeResolution()
|
||||
buffer.setResolution(table.unpack(MineOSCore.properties.resolution or {buffer.getGPUProxy().maxResolution()}))
|
||||
|
||||
MineOSInterface.mainContainer.width, MineOSInterface.mainContainer.height = buffer.getResolution()
|
||||
@ -295,7 +295,7 @@ local function getPercentageColor(pecent)
|
||||
end
|
||||
end
|
||||
|
||||
local function applyTransparency()
|
||||
function MineOSInterface.applyTransparency()
|
||||
GUI.dropDownMenu = function(...)
|
||||
local menu = overrideGUIDropDownMenu(...)
|
||||
menu.colors.transparency.background = MineOSCore.properties.transparencyEnabled and GUI.CONTEXT_MENU_BACKGROUND_TRANSPARENCY
|
||||
@ -305,7 +305,7 @@ local function applyTransparency()
|
||||
end
|
||||
end
|
||||
|
||||
local function createOSWidgets()
|
||||
function MineOSInterface.createWidgets()
|
||||
MineOSInterface.mainContainer:removeChildren()
|
||||
MineOSInterface.mainContainer.background = MineOSInterface.mainContainer:addChild(GUI.object(1, 1, 1, 1))
|
||||
MineOSInterface.mainContainer.background.wallpaperPosition = {x = 1, y = 1}
|
||||
@ -604,408 +604,6 @@ local function createOSWidgets()
|
||||
os.exit()
|
||||
end
|
||||
|
||||
local networkItem = MineOSInterface.mainContainer.menu:addItem(MineOSCore.localization.network)
|
||||
networkItem.onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.network)
|
||||
local insertModemTextBox = container.layout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0x5A5A5A, {MineOSCore.localization.networkModemNotAvailable}, 1, 0, 0, true, true))
|
||||
local stateSwitchAndLabel = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.networkState .. ":", MineOSCore.properties.network.enabled))
|
||||
local networkNameInput = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, MineOSCore.properties.network.name or "", MineOSCore.localization.networkName))
|
||||
local remoteComputersLabel = container.layout:addChild(GUI.label(1, 1, container.width, 1, 0xE1E1E1, MineOSCore.localization.networkComputers):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
local remoteComputersComboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
local allowReadAndWriteSwitchAndLabel = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.networkAllowReadAndWrite .. ":", false))
|
||||
|
||||
local signalStrengthSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 0, 512, MineOSCore.properties.network.signalStrength, false, MineOSCore.localization.networkSearchRadius ..": ", ""))
|
||||
signalStrengthSlider.roundValues = true
|
||||
|
||||
local function check()
|
||||
for i = 3, #container.layout.children do
|
||||
container.layout.children[i].hidden = not MineOSNetwork.modemProxy
|
||||
end
|
||||
insertModemTextBox.hidden = MineOSNetwork.modemProxy
|
||||
|
||||
if MineOSNetwork.modemProxy then
|
||||
for i = 4, #container.layout.children do
|
||||
container.layout.children[i].hidden = not stateSwitchAndLabel.switch.state
|
||||
end
|
||||
|
||||
if stateSwitchAndLabel.switch.state then
|
||||
signalStrengthSlider.hidden = not MineOSNetwork.modemProxy.isWireless()
|
||||
|
||||
remoteComputersComboBox:clear()
|
||||
for proxy, path in fs.mounts() do
|
||||
if proxy.MineOSNetworkModem then
|
||||
local item = remoteComputersComboBox:addItem(MineOSNetwork.getModemProxyName(proxy))
|
||||
item.proxyAddress = proxy.address
|
||||
item.onTouch = function()
|
||||
allowReadAndWriteSwitchAndLabel.switch:setState(MineOSCore.properties.network.users[item.proxyAddress].allowReadAndWrite)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
remoteComputersLabel.hidden = remoteComputersComboBox:count() < 1
|
||||
remoteComputersComboBox.hidden = remoteComputersLabel.hidden
|
||||
allowReadAndWriteSwitchAndLabel.hidden = remoteComputersLabel.hidden
|
||||
|
||||
if not remoteComputersLabel.hidden then
|
||||
remoteComputersComboBox:getItem(remoteComputersComboBox.selectedItem).onTouch()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
networkNameInput.onInputFinished = function()
|
||||
MineOSCore.properties.network.name = #networkNameInput.text > 0 and networkNameInput.text or nil
|
||||
MineOSCore.saveProperties()
|
||||
MineOSNetwork.broadcastComputerState(MineOSCore.properties.network.enabled)
|
||||
end
|
||||
|
||||
signalStrengthSlider.onValueChanged = function()
|
||||
MineOSCore.properties.network.signalStrength = math.floor(signalStrengthSlider.value)
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
stateSwitchAndLabel.switch.onStateChanged = function()
|
||||
if stateSwitchAndLabel.switch.state then
|
||||
MineOSNetwork.enable()
|
||||
else
|
||||
MineOSNetwork.disable()
|
||||
end
|
||||
|
||||
check()
|
||||
end
|
||||
|
||||
allowReadAndWriteSwitchAndLabel.switch.onStateChanged = function()
|
||||
MineOSCore.properties.network.users[remoteComputersComboBox:getItem(remoteComputersComboBox.selectedItem).proxyAddress].allowReadAndWrite = allowReadAndWriteSwitchAndLabel.switch.state
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
container.panel.eventHandler = function(mainContainer, object, e1, e2, e3)
|
||||
if e1 == "touch" then
|
||||
container:remove()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
elseif (e1 == "component_added" or e1 == "component_removed") and e3 == "modem" then
|
||||
check()
|
||||
elseif e1 == "MineOSNetwork" and e2 == "updateProxyList" then
|
||||
check()
|
||||
end
|
||||
end
|
||||
|
||||
check()
|
||||
end
|
||||
|
||||
local settingsContextMenu = MineOSInterface.mainContainer.menu:addContextMenu(MineOSCore.localization.settings)
|
||||
if computer.getArchitectures then
|
||||
settingsContextMenu:addItem(MineOSCore.localization.CPUArchitecture).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.CPUArchitecture)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
local architectures, architecture = computer.getArchitectures(), computer.getArchitecture()
|
||||
for i = 1, #architectures do
|
||||
comboBox:addItem(architectures[i]).onTouch = function()
|
||||
computer.setArchitecture(architectures[i])
|
||||
computer.shutdown(true)
|
||||
end
|
||||
|
||||
if architecture == architectures[i] then
|
||||
comboBox.selectedItem = i
|
||||
end
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.RAMControl).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.RAMControl)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
comboBox.dropDownMenu.itemHeight = 1
|
||||
|
||||
local function update()
|
||||
local libraries = {}
|
||||
for key, value in pairs(package.loaded) do
|
||||
if _G[key] ~= value then
|
||||
table.insert(libraries, key)
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(libraries, function(a, b) return unicode.lower(a) < unicode.lower(b) end)
|
||||
|
||||
comboBox:clear()
|
||||
for i = 1, #libraries do
|
||||
comboBox:addItem(libraries[i]).onTouch = function()
|
||||
package.loaded[libraries[i]] = nil
|
||||
update()
|
||||
end
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.packageUnloading .. ":", MineOSCore.properties.packageUnloading)).switch
|
||||
switch.onStateChanged = function()
|
||||
MineOSCore.properties.packageUnloading = switch.state
|
||||
MineOSCore.setPackageUnloading(MineOSCore.properties.packageUnloading)
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
update()
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.screenResolution).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.screenResolution)
|
||||
|
||||
local widthTextBox = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, tostring(MineOSCore.properties.resolution and MineOSCore.properties.resolution[1] or 160), "Width", true))
|
||||
widthTextBox.validator = function(text)
|
||||
local number = tonumber(text)
|
||||
if number then return number >= 1 and number <= 160 end
|
||||
end
|
||||
|
||||
local heightTextBox = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, tostring(MineOSCore.properties.resolution and MineOSCore.properties.resolution[2] or 50), "Height", true))
|
||||
heightTextBox.validator = function(text)
|
||||
local number = tonumber(text)
|
||||
if number then return number >= 1 and number <= 50 end
|
||||
end
|
||||
|
||||
container.panel.eventHandler = function(mainContainer, object, e1)
|
||||
if e1 == "touch" then
|
||||
container:remove()
|
||||
MineOSCore.properties.resolution = {tonumber(widthTextBox.text), tonumber(heightTextBox.text)}
|
||||
MineOSCore.saveProperties()
|
||||
changeResolution()
|
||||
changeWallpaper()
|
||||
MineOSInterface.mainContainer.updateFileListAndDraw()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
settingsContextMenu:addSeparator()
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.systemLanguage).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.systemLanguage)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
for file in fs.list(MineOSPaths.localizationFiles) do
|
||||
local name = fs.hideExtension(file)
|
||||
comboBox:addItem(name).onTouch = function()
|
||||
MineOSCore.properties.language = name
|
||||
MineOSCore.localization = MineOSCore.getLocalization(MineOSPaths.localizationFiles)
|
||||
|
||||
createOSWidgets()
|
||||
changeResolution()
|
||||
changeWallpaper()
|
||||
MineOSCore.updateTime()
|
||||
|
||||
MineOSInterface.mainContainer.updateFileListAndDraw()
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
if name == MineOSCore.properties.language then
|
||||
comboBox.selectedItem = comboBox:count()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.wallpaper).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.wallpaper)
|
||||
|
||||
local filesystemChooser = container.layout:addChild(GUI.filesystemChooser(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696, MineOSCore.properties.wallpaper, MineOSCore.localization.open, MineOSCore.localization.cancel, MineOSCore.localization.wallpaperPath, "/"))
|
||||
filesystemChooser:addExtensionFilter(".pic")
|
||||
filesystemChooser.onSubmit = function(path)
|
||||
MineOSCore.properties.wallpaper = path
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
comboBox.selectedItem = MineOSCore.properties.wallpaperMode or 1
|
||||
comboBox:addItem(MineOSCore.localization.wallpaperModeStretch)
|
||||
comboBox:addItem(MineOSCore.localization.wallpaperModeCenter)
|
||||
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0xE1E1E1, MineOSCore.localization.wallpaperEnabled .. ":", MineOSCore.properties.wallpaperEnabled)).switch
|
||||
switch.onStateChanged = function()
|
||||
MineOSCore.properties.wallpaperEnabled = switch.state
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
container.layout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0x5A5A5A, {MineOSCore.localization.wallpaperSwitchInfo}, 1, 0, 0, true, true))
|
||||
|
||||
local slider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 0, 100, MineOSCore.properties.wallpaperBrightness * 100, false, MineOSCore.localization.wallpaperBrightness .. ": ", "%"))
|
||||
slider.roundValues = true
|
||||
slider.onValueChanged = function()
|
||||
MineOSCore.properties.wallpaperBrightness = slider.value / 100
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
container.layout:addChild(GUI.object(1, 1, 1, 1))
|
||||
|
||||
comboBox.onItemSelected = function()
|
||||
MineOSCore.properties.wallpaperMode = comboBox.selectedItem
|
||||
MineOSCore.saveProperties()
|
||||
changeWallpaper()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.screensaver).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.screensaver)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
local fileList = fs.sortedList(screensaversPath, "name", false)
|
||||
for i = 1, #fileList do
|
||||
comboBox:addItem(fs.hideExtension(fileList[i]))
|
||||
if MineOSCore.properties.screensaver == fileList[i] then
|
||||
comboBox.selectedItem = i
|
||||
end
|
||||
end
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0xE1E1E1, MineOSCore.localization.screensaverEnabled .. ":", MineOSCore.properties.screensaverEnabled)).switch
|
||||
local slider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 1, 80, MineOSCore.properties.screensaverDelay, false, MineOSCore.localization.screensaverDelay .. ": ", ""))
|
||||
|
||||
container.panel.eventHandler = function(mainContainer, object, e1)
|
||||
if e1 == "touch" then
|
||||
container:remove()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
|
||||
MineOSCore.properties.screensaverEnabled = switch.state
|
||||
MineOSCore.properties.screensaver = fileList[comboBox.selectedItem]
|
||||
MineOSCore.properties.screensaverDelay = slider.value
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.colorScheme).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.colorScheme)
|
||||
|
||||
local backgroundColorSelector = container.layout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.backgroundColor, MineOSCore.localization.backgroundColor))
|
||||
local menuColorSelector = container.layout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.menuColor, MineOSCore.localization.menuColor))
|
||||
local dockColorSelector = container.layout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.dockColor, MineOSCore.localization.dockColor))
|
||||
|
||||
local switch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0xE1E1E1, MineOSCore.localization.transparencyEnabled .. ":", MineOSCore.properties.transparencyEnabled)).switch
|
||||
switch.onStateChanged = function()
|
||||
MineOSCore.properties.transparencyEnabled = switch.state
|
||||
|
||||
container.panel.colors.background = switch.state and GUI.BACKGROUND_CONTAINER_PANEL_COLOR or MineOSCore.properties.backgroundColor
|
||||
container.panel.colors.transparency = switch.state and GUI.BACKGROUND_CONTAINER_PANEL_TRANSPARENCY
|
||||
applyTransparency()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
container.layout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0x5A5A5A, {MineOSCore.localization.transparencySwitchInfo}, 1, 0, 0, true, true))
|
||||
|
||||
backgroundColorSelector.onColorSelected = function()
|
||||
MineOSCore.properties.backgroundColor = backgroundColorSelector.color
|
||||
MineOSCore.properties.menuColor = menuColorSelector.color
|
||||
MineOSCore.properties.dockColor = dockColorSelector.color
|
||||
MineOSInterface.mainContainer.menu.colors.default.background = MineOSCore.properties.menuColor
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
menuColorSelector.onColorSelected = backgroundColorSelector.onColorSelected
|
||||
dockColorSelector.onColorSelected = backgroundColorSelector.onColorSelected
|
||||
|
||||
container.panel.eventHandler = function(mainContainer, object, e1)
|
||||
if e1 == "touch" then
|
||||
container:remove()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.iconProperties).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.iconProperties)
|
||||
|
||||
local showExtensionSwitch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.showExtension .. ":", MineOSCore.properties.showExtension)).switch
|
||||
local showHiddenFilesSwitch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.showHiddenFiles .. ":", MineOSCore.properties.showHiddenFiles)).switch
|
||||
local showApplicationIconsSwitch = container.layout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, MineOSCore.localization.showApplicationIcons .. ":", MineOSCore.properties.showApplicationIcons)).switch
|
||||
|
||||
container.layout:addChild(GUI.label(1, 1, container.width, 1, 0xE1E1E1, MineOSCore.localization.sizeOfIcons):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
|
||||
local iconWidthSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 8, 16, MineOSCore.properties.iconWidth, false, MineOSCore.localization.byHorizontal .. ": ", ""))
|
||||
local iconHeightSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 6, 16, MineOSCore.properties.iconHeight, false, MineOSCore.localization.byVertical .. ": ", ""))
|
||||
|
||||
container.layout:addChild(GUI.object(1, 1, 1, 0))
|
||||
container.layout:addChild(GUI.label(1, 1, container.width, 1, 0xE1E1E1, MineOSCore.localization.spaceBetweenIcons):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
|
||||
local iconHorizontalSpaceBetweenSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 0, 5, MineOSCore.properties.iconHorizontalSpaceBetween, false, MineOSCore.localization.byHorizontal .. ": ", ""))
|
||||
local iconVerticalSpaceBetweenSlider = container.layout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0x2D2D2D, 0xE1E1E1, 0x878787, 0, 5, MineOSCore.properties.iconVerticalSpaceBetween, false, MineOSCore.localization.byVertical .. ": ", ""))
|
||||
|
||||
iconHorizontalSpaceBetweenSlider.roundValues, iconVerticalSpaceBetweenSlider.roundValues = true, true
|
||||
iconWidthSlider.roundValues, iconHeightSlider.roundValues = true, true
|
||||
|
||||
iconWidthSlider.onValueChanged = function()
|
||||
MineOSInterface.setIconProperties(math.floor(iconWidthSlider.value), math.floor(iconHeightSlider.value), MineOSCore.properties.iconHorizontalSpaceBetween, MineOSCore.properties.iconVerticalSpaceBetween)
|
||||
end
|
||||
iconHeightSlider.onValueChanged = iconWidthSlider.onValueChanged
|
||||
|
||||
iconHorizontalSpaceBetweenSlider.onValueChanged = function()
|
||||
MineOSInterface.setIconProperties(MineOSCore.properties.iconWidth, MineOSCore.properties.iconHeight, math.floor(iconHorizontalSpaceBetweenSlider.value), math.floor(iconVerticalSpaceBetweenSlider.value))
|
||||
end
|
||||
iconVerticalSpaceBetweenSlider.onValueChanged = iconHorizontalSpaceBetweenSlider.onValueChanged
|
||||
|
||||
showExtensionSwitch.onStateChanged = function()
|
||||
MineOSCore.properties.showExtension = showExtensionSwitch.state
|
||||
MineOSCore.properties.showHiddenFiles = showHiddenFilesSwitch.state
|
||||
MineOSCore.properties.showApplicationIcons = showApplicationIconsSwitch.state
|
||||
MineOSCore.saveProperties()
|
||||
|
||||
computer.pushSignal("MineOSCore", "updateFileList")
|
||||
end
|
||||
showHiddenFilesSwitch.onStateChanged, showApplicationIconsSwitch.onStateChanged = showExtensionSwitch.onStateChanged, showExtensionSwitch.onStateChanged
|
||||
end
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.dateAndTime).onTouch = function()
|
||||
local container = MineOSInterface.addBackgroundContainer(MineOSInterface.mainContainer, MineOSCore.localization.timezone)
|
||||
|
||||
local comboBox = container.layout:addChild(GUI.comboBox(1, 1, 36, 3, 0xE1E1E1, 0x2D2D2D, 0x4B4B4B, 0x969696))
|
||||
comboBox.dropDownMenu.itemHeight = 1
|
||||
|
||||
local label = container.layout:addChild(GUI.label(1, 1, container.width, 1, 0xE1E1E1, MineOSCore.localization.dateFormat):setAlignment(GUI.ALIGNMENT_HORIZONTAL_CENTER, GUI.ALIGNMENT_VERTICAL_TOP))
|
||||
|
||||
local input = container.layout:addChild(GUI.input(1, 1, 36, 3, 0xE1E1E1, 0x696969, 0x878787, 0xE1E1E1, 0x2D2D2D, MineOSCore.properties.dateFormat or ""))
|
||||
input.onInputFinished = function()
|
||||
MineOSCore.properties.dateFormat = input.text
|
||||
MineOSCore.updateTime()
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
for i = -12, 12 do
|
||||
comboBox:addItem("GMT" .. (i >= 0 and "+" or "") .. i).onTouch = function()
|
||||
MineOSCore.properties.timezone = i
|
||||
MineOSCore.updateTimezone(i)
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
|
||||
settingsContextMenu:addSeparator()
|
||||
|
||||
settingsContextMenu:addItem(MineOSCore.localization.setProtectionMethod).onTouch = function()
|
||||
setProtectionMethod()
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer.menuLayout = MineOSInterface.mainContainer:addChild(GUI.layout(1, 1, 1, 1, 1, 1))
|
||||
MineOSInterface.mainContainer.menuLayout:setDirection(1, 1, GUI.DIRECTION_HORIZONTAL)
|
||||
MineOSInterface.mainContainer.menuLayout:setAlignment(1, 1, GUI.ALIGNMENT_HORIZONTAL_RIGHT, GUI.ALIGNMENT_VERTICAL_TOP)
|
||||
@ -1051,7 +649,7 @@ local function createOSWidgets()
|
||||
MineOSCore.updateTime = function()
|
||||
MineOSCore.time = realTimestamp + computer.uptime() - bootUptime + timezoneCorrection
|
||||
|
||||
dateWidgetText = os.date(MineOSCore.properties.dateFormat, MineOSCore.time)
|
||||
dateWidgetText = os.date(MineOSCore.properties.dateFormat, MineOSCore.properties.timeUseRealTimestamp and MineOSCore.time or nil)
|
||||
dateWidget.width = unicode.len(dateWidgetText)
|
||||
|
||||
batteryWidgetPercent = computer.energy() / computer.maxEnergy()
|
||||
@ -1065,12 +663,12 @@ local function createOSWidgets()
|
||||
RAMPercent = (totalMemory - computer.freeMemory()) / totalMemory
|
||||
end
|
||||
|
||||
MineOSCore.updateTimezone = function(timezone)
|
||||
timezoneCorrection = timezone * 3600
|
||||
MineOSCore.updateTimezone = function()
|
||||
timezoneCorrection = MineOSCore.properties.timezone * 3600
|
||||
MineOSCore.updateTime()
|
||||
end
|
||||
|
||||
MineOSInterface.mainContainer.updateFileListAndDraw = function(...)
|
||||
MineOSInterface.updateFileListAndDraw = function(...)
|
||||
MineOSInterface.mainContainer.iconField:updateFileList()
|
||||
MineOSInterface.mainContainer:drawOnScreen(...)
|
||||
end
|
||||
@ -1105,11 +703,11 @@ local function createOSWidgets()
|
||||
lastWindowHandled = false
|
||||
elseif e1 == "MineOSCore" then
|
||||
if e2 == "updateFileList" then
|
||||
MineOSInterface.mainContainer.updateFileListAndDraw()
|
||||
MineOSInterface.updateFileListAndDraw()
|
||||
elseif e2 == "updateFileListAndBufferTrueRedraw" then
|
||||
MineOSInterface.mainContainer.updateFileListAndDraw(true)
|
||||
MineOSInterface.updateFileListAndDraw(true)
|
||||
elseif e2 == "updateWallpaper" then
|
||||
changeWallpaper()
|
||||
MineOSInterface.changeWallpaper()
|
||||
MineOSInterface.mainContainer:drawOnScreen()
|
||||
end
|
||||
elseif e1 == "MineOSNetwork" then
|
||||
@ -1132,8 +730,8 @@ local function createOSWidgets()
|
||||
end
|
||||
|
||||
if dateUptime - screensaverUptime >= MineOSCore.properties.screensaverDelay then
|
||||
if fs.exists(screensaversPath .. MineOSCore.properties.screensaver) then
|
||||
MineOSInterface.safeLaunch(screensaversPath .. MineOSCore.properties.screensaver)
|
||||
if fs.exists(MineOSCore.properties.screensaver) then
|
||||
MineOSInterface.safeLaunch(MineOSCore.properties.screensaver)
|
||||
MineOSInterface.mainContainer:drawOnScreen(true)
|
||||
end
|
||||
|
||||
@ -1156,22 +754,35 @@ end
|
||||
local function createOSWindow()
|
||||
MineOSInterface.mainContainer = GUI.fullScreenContainer()
|
||||
|
||||
createOSWidgets()
|
||||
changeResolution()
|
||||
changeWallpaper()
|
||||
MineOSCore.updateTimezone(MineOSCore.properties.timezone)
|
||||
MineOSInterface.createWidgets()
|
||||
MineOSInterface.changeResolution()
|
||||
MineOSInterface.changeWallpaper()
|
||||
MineOSCore.updateTimezone()
|
||||
end
|
||||
|
||||
local function runTasks(mode)
|
||||
for i = 1, #MineOSCore.properties.tasks do
|
||||
local task = MineOSCore.properties.tasks[i]
|
||||
if task.mode == mode and task.enabled then
|
||||
MineOSInterface.safeLaunch(task.path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---------------------------------------- Сама ОС ----------------------------------------
|
||||
|
||||
MineOSCore.localization = MineOSCore.getLocalization(MineOSPaths.localizationFiles)
|
||||
|
||||
applyTransparency()
|
||||
runTasks(2)
|
||||
|
||||
MineOSInterface.applyTransparency()
|
||||
updateCurrentTimestamp()
|
||||
createOSWindow()
|
||||
login()
|
||||
MineOSNetwork.update()
|
||||
|
||||
runTasks(1)
|
||||
|
||||
while true do
|
||||
local success, path, line, traceback = MineOSCore.call(
|
||||
MineOSInterface.mainContainer.startEventHandling,
|
||||
|
||||
@ -88,6 +88,8 @@ function MineOSCore.loadPropeties()
|
||||
end
|
||||
|
||||
local defaultValues = {
|
||||
tasks = {},
|
||||
timeUseRealTimestamp = true,
|
||||
dateFormat = "%d %b %Y %H:%M:%S",
|
||||
packageUnloading = true,
|
||||
transparencyEnabled = true,
|
||||
|
||||
@ -650,12 +650,12 @@ local exceptionMethods = {
|
||||
end,
|
||||
}
|
||||
|
||||
local function handleRequest(eventData)
|
||||
if MineOSCore.properties.network.users[eventData[3]].allowReadAndWrite then
|
||||
local result = { pcall(exceptionMethods[eventData[8]] or filesystemProxy[eventData[8]], table.unpack(eventData, 9)) }
|
||||
MineOSNetwork.sendMessage(eventData[3], "MineOSNetwork", "response", eventData[8], table.unpack(result, result[1] and 2 or 1))
|
||||
local function handleRequest(e1, e2, e3, e4, e5, e6, e7, e8, ...)
|
||||
if MineOSCore.properties.network.users[e3].allowReadAndWrite then
|
||||
local result = { pcall(exceptionMethods[e8] or filesystemProxy[e8], ...) }
|
||||
MineOSNetwork.sendMessage(e3, "MineOSNetwork", "response", e8, table.unpack(result, result[1] and 2 or 1))
|
||||
else
|
||||
MineOSNetwork.sendMessage(eventData[3], "MineOSNetwork", "accessDenied")
|
||||
MineOSNetwork.sendMessage(e3, "MineOSNetwork", "accessDenied")
|
||||
end
|
||||
end
|
||||
|
||||
@ -668,51 +668,13 @@ function MineOSNetwork.update()
|
||||
MineOSNetwork.setSignalStrength(MineOSCore.properties.network.signalStrength)
|
||||
MineOSNetwork.broadcastComputerState(MineOSCore.properties.network.enabled)
|
||||
|
||||
if MineOSNetwork.eventHandlerID then
|
||||
event.removeHandler(MineOSNetwork.eventHandlerID)
|
||||
end
|
||||
-- if MineOSNetwork.eventHandlerID then
|
||||
-- event.removeHandler(MineOSNetwork.eventHandlerID)
|
||||
-- end
|
||||
|
||||
if MineOSCore.properties.network.enabled then
|
||||
MineOSNetwork.eventHandlerID = event.addHandler(function(...)
|
||||
local eventData = {...}
|
||||
-- if MineOSCore.properties.network.enabled then
|
||||
|
||||
if (eventData[1] == "component_added" or eventData[1] == "component_removed") and (eventData[3] == "modem" or eventData[3] == "internet") then
|
||||
MineOSNetwork.updateComponents()
|
||||
elseif eventData[1] == "modem_message" and MineOSCore.properties.network.enabled and eventData[6] == "MineOSNetwork" then
|
||||
if eventData[7] == "request" then
|
||||
handleRequest(eventData)
|
||||
elseif eventData[7] == "computerAvailable" or eventData[7] == "computerAvailableRedirect" then
|
||||
for proxy in fs.mounts() do
|
||||
if proxy.MineOSNetworkModem and proxy.address == eventData[3] then
|
||||
fs.umount(proxy)
|
||||
end
|
||||
end
|
||||
|
||||
proxy = newModemProxy(eventData[3])
|
||||
proxy.name = eventData[8]
|
||||
fs.mount(proxy, MineOSNetwork.mountPaths.modem .. eventData[3] .. "/")
|
||||
|
||||
if eventData[7] == "computerAvailable" then
|
||||
MineOSNetwork.sendMessage(eventData[3], "MineOSNetwork", "computerAvailableRedirect", MineOSCore.properties.network.name)
|
||||
end
|
||||
|
||||
if not MineOSCore.properties.network.users[eventData[3]] then
|
||||
MineOSCore.properties.network.users[eventData[3]] = {}
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
computer.pushSignal("MineOSNetwork", "updateProxyList")
|
||||
elseif eventData[7] == "computerNotAvailable" then
|
||||
local proxy = MineOSNetwork.getMountedModemProxy(eventData[3])
|
||||
if proxy then
|
||||
fs.umount(proxy)
|
||||
end
|
||||
|
||||
computer.pushSignal("MineOSNetwork", "updateProxyList")
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
-- end
|
||||
end
|
||||
|
||||
function MineOSNetwork.disable()
|
||||
@ -729,16 +691,45 @@ end
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- MineOSNetwork.updateComponents()
|
||||
event.addHandler(function(e1, e2, e3, e4, e5, e6, e7, e8, ...)
|
||||
if (e1 == "component_added" or e1 == "component_removed") and (e3 == "modem" or e3 == "internet") then
|
||||
MineOSNetwork.updateComponents()
|
||||
MineOSNetwork.broadcastComputerState(MineOSCore.properties.network.enabled)
|
||||
elseif MineOSCore.properties.network.enabled and e1 == "modem_message" and e6 == "MineOSNetwork" then
|
||||
if e7 == "request" then
|
||||
handleRequest(e1, e2, e3, e4, e5, e6, e7, e8, ...)
|
||||
elseif e7 == "computerAvailable" or e7 == "computerAvailableRedirect" then
|
||||
for proxy in fs.mounts() do
|
||||
if proxy.MineOSNetworkModem and proxy.address == e3 then
|
||||
fs.umount(proxy)
|
||||
end
|
||||
end
|
||||
|
||||
-- local proxy, reason = MineOSNetwork.FTPProxy("localhost", 8888, "root", "1234")
|
||||
-- print(proxy, reason)
|
||||
proxy = newModemProxy(e3)
|
||||
proxy.name = e8
|
||||
fs.mount(proxy, MineOSNetwork.mountPaths.modem .. e3 .. "/")
|
||||
|
||||
if e7 == "computerAvailable" then
|
||||
MineOSNetwork.sendMessage(e3, "MineOSNetwork", "computerAvailableRedirect", MineOSCore.properties.network.name)
|
||||
end
|
||||
|
||||
if not MineOSCore.properties.network.users[e3] then
|
||||
MineOSCore.properties.network.users[e3] = {}
|
||||
MineOSCore.saveProperties()
|
||||
end
|
||||
|
||||
computer.pushSignal("MineOSNetwork", "updateProxyList")
|
||||
elseif e7 == "computerNotAvailable" then
|
||||
local proxy = MineOSNetwork.getMountedModemProxy(e3)
|
||||
if proxy then
|
||||
fs.umount(proxy)
|
||||
end
|
||||
|
||||
computer.pushSignal("MineOSNetwork", "updateProxyList")
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
return MineOSNetwork
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user