MCPcopy Create free account
hub / github.com/KikoPlayProject/KikoPlay / ~ScriptBase

Method ~ScriptBase

Extension/Script/scriptbase.cpp:44–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44ScriptBase::~ScriptBase()
45{
46 if(L)
47 {
48 QMutexLocker locker(&scriptLock);
49 lua_close(L);
50 L = nullptr;
51 }
52 if(settingsUpdated)
53 {
54 const QString scriptPath(scriptMeta["path"]);
55 QFile settingSaved(getSettingFile(scriptPath, false));
56 if(settingSaved.open(QFile::WriteOnly))
57 {
58 QMap<QString, QVariant> settingMap, searchSettingMap;
59 for(const auto &item : scriptSettings)
60 settingMap[item.key] = item.value;
61 for(const auto &item : searchSettingItems)
62 {
63 if(item.save) searchSettingMap[item.key] = item.value;
64 }
65 QJsonObject settingObj
66 {
67 {"scriptSettings", QJsonObject::fromVariantMap(settingMap)},
68 {"searchSettings", QJsonObject::fromVariantMap(searchSettingMap)}
69 };
70 QJsonDocument doc(settingObj);
71 settingSaved.write(doc.toJson(QJsonDocument::Indented));
72 }
73 settingsUpdated = false;
74 }
75}
76
77ScriptState ScriptBase::setOption(int index, const QString &value, bool callLua)
78{

Callers

nothing calls this directly

Calls 4

lua_closeFunction · 0.85
openMethod · 0.80
toJsonMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected