quickshell-web/modules/Quickshell.Io/FileView.json

111 lines
6.5 KiB
JSON
Raw Normal View History

2024-09-27 23:35:19 +00:00
{
"name": "FileView",
"module": "Quickshell.Io",
"type": "class",
"super": {
"type": "qt",
"module": "qml.QtQml",
"name": "QtObject"
},
"description": "Simplified reader for small files.",
"details": "A reader for small to medium files that don't need seeking/cursor access,\nsuitable for most text files.\n\n#### Example: Reading a JSON\n```qml\nFileView {\n id: jsonFile\n path: Qt.resolvedUrl(\"./your.json\")\n // Forces the file to be loaded by the time we call JSON.parse().\n // see blockLoading's property documentation for details.\n blockLoading: true\n}\n\nreadonly property var jsonData: JSON.parse(jsonFile.text())\n```\n",
"properties": {
"blockAllReads": {
"type": {
"type": "qt",
"module": "qml",
"name": "bool"
},
"details": "If TYPE99Vtext99Tfunc99TYPE and TYPE99Vdata99Tfunc99TYPE should block all operations while a file loads. Defaults to false.\n\nThis is nearly identical to TYPE99VblockLoading99Tprop99TYPE, but will additionally block when\na file is loaded and TYPE99Vpath99Tprop99TYPE changes.\n\n> [!WARNING] We cannot think of a valid use case for this.\n> You almost definitely want TYPE99VblockLoading99Tprop99TYPE.\n"
},
"blockLoading": {
"type": {
"type": "qt",
"module": "qml",
"name": "bool"
},
"details": "If TYPE99Vtext99Tfunc99TYPE and TYPE99Vdata99Tfunc99TYPE should block all operations until the file is loaded. Defaults to false.\n\nIf the file is already loaded, no blocking will occur.\nIf a file was loaded, and TYPE99Vpath99Tprop99TYPE was changed to a new file, no blocking will occur.\n\n> [!WARNING] Blocking operations should be used carefully to avoid stutters and other performance\n> degradations. Blocking means that your interface **WILL NOT FUNCTION** during the call.\n>\n> **We recommend you use a blocking load ONLY for files loaded before the windows of your shell\n> are loaded, which happens after `Component.onCompleted` runs for the root component of your shell.**\n>\n> The most reasonable use case would be to load things like configuration files that the program\n> must have available.\n"
},
"preload": {
"type": {
"type": "qt",
"module": "qml",
"name": "bool"
},
"details": "If the file should be loaded in the background immediately when set. Defaults to true.\n\nThis may either increase or decrease the amount of time it takes to load the file\ndepending on how large the file is, how fast its storage is, and how you access its data.\n"
},
"loaded": {
"type": {
"type": "qt",
"module": "qml",
"name": "bool"
},
"details": "If a file is currently loaded, which may or may not be the one currently specified by TYPE99Vpath99Tprop99TYPE.\n\n> [!NOTE] If a file is loaded, TYPE99Vpath99Tprop99TYPE is changed, and a new file is loaded,\n> this property will stay true the whole time.\n> If TYPE99Vpath99Tprop99TYPE is set to an empty string to unload the file it will become false.\n",
"flags": [
"readonly"
]
},
"path": {
"type": {
"type": "qt",
"module": "qml",
"name": "string"
},
"details": "The path to the file that should be read, or an empty string to unload the file.\n"
}
},
"functions": [
{
"ret": {
"type": "qt",
"module": "qml",
"name": "bool"
},
"name": "blockUntilLoaded",
"id": "blockUntilLoaded",
"details": "Block all operations until the currently running load completes.\n\n> [!WARNING] See TYPE99VblockLoading99Tprop99TYPE for an explanation and warning about blocking.\n",
"params": []
},
{
"ret": {
"type": "unknown",
"module": "",
"name": ""
},
"name": "data",
"id": "data",
"details": "Returns the data of the file specified by TYPE99Vpath99Tprop99TYPE as an [ArrayBuffer].\n\nIf TYPE99VblockAllReads99Tprop99TYPE is true, all changes to TYPE99Vpath99Tprop99TYPE will cause the program to block\nwhen this function is called.\n\nIf TYPE99VblockLoading99Tprop99TYPE is true, reading this property before the file has been loaded\nwill block, but changing TYPE99Vpath99Tprop99TYPE or calling TYPE99Vreload99Tfunc99TYPE will return the old data\nuntil the load completes.\n\nIf neither is true, an empty buffer will be returned if no file is loaded,\notherwise it will behave as in the case above.\n\n> [!NOTE] Due to technical limitations, TYPE99Vdata99Tfunc99TYPE could not be a property,\n> however you can treat it like a property, it will trigger property updates\n> as a property would, and the signal `dataChanged()` is present.\n\n[ArrayBuffer]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer\n",
"params": []
},
{
"ret": {
"type": "qt",
"module": "qml",
"name": "void"
},
"name": "reload",
"id": "reload",
"details": "Unload the loaded file and reload it, usually in response to changes.\n\nThis will not block if TYPE99VblockLoading99Tprop99TYPE is set, only if TYPE99VblockAllReads99Tprop99TYPE is true.\nIt acts the same as changing TYPE99Vpath99Tprop99TYPE to a new file, except loading the same file.\n",
"params": []
},
{
"ret": {
"type": "qt",
"module": "qml",
"name": "string"
},
"name": "text",
"id": "text",
"details": "Returns the data of the file specified by TYPE99Vpath99Tprop99TYPE as text.\n\nIf TYPE99VblockAllReads99Tprop99TYPE is true, all changes to TYPE99Vpath99Tprop99TYPE will cause the program to block\nwhen this function is called.\n\nIf TYPE99VblockLoading99Tprop99TYPE is true, reading this property before the file has been loaded\nwill block, but changing TYPE99Vpath99Tprop99TYPE or calling TYPE99Vreload99Tfunc99TYPE will return the old data\nuntil the load completes.\n\nIf neither is true, an empty string will be returned if no file is loaded,\notherwise it will behave as in the case above.\n\n> [!NOTE] Due to technical limitations, TYPE99Vtext99Tfunc99TYPE could not be a property,\n> however you can treat it like a property, it will trigger property updates\n> as a property would, and the signal `textChanged()` is present.\n",
"params": []
}
],
"signals": {
"loadFailed": {
"name": "loadFailed",
"details": "! Fires if the file failed to load. A warning will be printed in the log.\n",
"params": []
}
},
"variants": {}
}