mirror of
https://github.com/celesrenata/end-4-flakes.git
synced 2026-06-06 02:39:27 -05:00
50 lines
1.3 KiB
QML
50 lines
1.3 KiB
QML
pragma Singleton
|
|
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
|
|
Singleton {
|
|
id: root
|
|
property alias states: persistentStatesJsonAdapter
|
|
property string fileDir: Directories.state
|
|
property string fileName: "states.json"
|
|
property string filePath: `${root.fileDir}/${root.fileName}`
|
|
|
|
FileView {
|
|
path: root.filePath
|
|
|
|
watchChanges: true
|
|
onFileChanged: reload()
|
|
onAdapterUpdated: {
|
|
writeAdapter()
|
|
}
|
|
onLoadFailed: error => {
|
|
console.log("Failed to load persistent states file:", error);
|
|
if (error == FileViewError.FileNotFound) {
|
|
writeAdapter();
|
|
}
|
|
}
|
|
|
|
adapter: JsonAdapter {
|
|
id: persistentStatesJsonAdapter
|
|
property JsonObject ai: JsonObject {
|
|
property string model
|
|
property real temperature: 0.5
|
|
}
|
|
|
|
property JsonObject sidebar: JsonObject {
|
|
property JsonObject bottomGroup: JsonObject {
|
|
property bool collapsed: false
|
|
property int tab: 0
|
|
}
|
|
}
|
|
|
|
property JsonObject booru: JsonObject {
|
|
property bool allowNsfw: false
|
|
property string provider: "yandere"
|
|
}
|
|
}
|
|
}
|
|
}
|