Added extension for picture as string (.rpic)

This commit is contained in:
Bs0Dd 2021-07-16 16:10:41 +06:00
parent e4ad6ad6f9
commit a439f28f3b
3 changed files with 23 additions and 2 deletions

View File

@ -0,0 +1,21 @@
local filesystem = require("Filesystem")
local GUI = require("GUI")
local paths = require("Paths")
local system = require("System")
local workspace, icon, menu = select(1, ...), select(2, ...), select(3, ...)
local localization = system.getSystemLocalization()
menu:addItem(localization.setAsWallpaper).onTouch = function()
local userSettings = system.getUserSettings()
userSettings.interfaceWallpaperPath = icon.path
userSettings.interfaceWallpaperEnabled = true
system.updateWallpaper()
workspace:draw()
system.saveUserSettings()
end
system.addUploadToPastebinMenuItem(menu, icon.path)

View File

@ -298,7 +298,7 @@ end
local function loadImage(path)
local result, reason
if filesystem.extension(path) == ".rawpic" then
if filesystem.extension(path) == ".rpic" then
result = image.fromString(filesystem.read(path))
else
result, reason = image.load(path)
@ -335,7 +335,7 @@ local function saveAs()
local filesystemDialog = GUI.addFilesystemDialog(workspace, true, 50, math.floor(window.height * 0.8), locale.save, locale.cancel, locale.fileName, "/")
filesystemDialog:setMode(GUI.IO_MODE_SAVE, GUI.IO_MODE_FILE)
filesystemDialog:addExtensionFilter(".pic")
filesystemDialog:addExtensionFilter(".rawpic")
filesystemDialog:addExtensionFilter(".rpic")
filesystemDialog:expandPath(paths.user.desktop)
filesystemDialog.filesystemTree.selectedItem = paths.user.desktop
filesystemDialog:show()