Showing the changes to interface/src/scripting/AccountServicesScriptingInterface.cpp (1 of 170 files). Show all
Unified · Split
| @@ -123,27 +123,27 @@ DownloadInfoResult::DownloadInfoResult() : · 122 unmodified lines | |||
| 123 | * @property {number[]} downloading - The download percentage remaining of each asset currently downloading. | 123 | * @property {number[]} downloading - The download percentage remaining of each asset currently downloading. |
| 124 | * @property {number} pending - The number of assets pending download. | 124 | * @property {number} pending - The number of assets pending download. |
| 125 | */ | 125 | */ |
| 126 | ScriptValuePointer DownloadInfoResultToScriptValue(ScriptEngine* engine, const DownloadInfoResult& result) { | 126 | ScriptValue DownloadInfoResultToScriptValue(ScriptEngine* engine, const DownloadInfoResult& result) { |
| 127 | ScriptValuePointer object = engine->newObject(); | 127 | ScriptValue object = engine->newObject(); |
| 128 | 128 | ||
| 129 | ScriptValuePointer array = engine->newArray(result.downloading.count()); | 129 | ScriptValue array = engine->newArray(result.downloading.count()); |
| 130 | for (int i = 0; i < result.downloading.count(); i += 1) { | 130 | for (int i = 0; i < result.downloading.count(); i += 1) { |
| 131 | array->setProperty(i, result.downloading[i]); | 131 | array.setProperty(i, result.downloading[i]); |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | object->setProperty("downloading", array); | 134 | object.setProperty("downloading", array); |
| 135 | object->setProperty("pending", result.pending); | 135 | object.setProperty("pending", result.pending); |
| 136 | return object; | 136 | return object; |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | void DownloadInfoResultFromScriptValue(const ScriptValuePointer& object, DownloadInfoResult& result) { | 139 | void DownloadInfoResultFromScriptValue(const ScriptValue& object, DownloadInfoResult& result) { |
| 140 | QList<QVariant> downloading = object->property("downloading")->toVariant().toList(); | 140 | QList<QVariant> downloading = object.property("downloading").toVariant().toList(); |
| 141 | result.downloading.clear(); | 141 | result.downloading.clear(); |
| 142 | for (int i = 0; i < downloading.count(); i += 1) { | 142 | for (int i = 0; i < downloading.count(); i += 1) { |
| 143 | result.downloading.append(downloading[i].toFloat()); | 143 | result.downloading.append(downloading[i].toFloat()); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | result.pending = object->property("pending")->toVariant().toFloat(); | 146 | result.pending = object.property("pending").toVariant().toFloat(); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | DownloadInfoResult AccountServicesScriptingInterface::getDownloadInfo() { | 149 | DownloadInfoResult AccountServicesScriptingInterface::getDownloadInfo() { |