History

rework ScriptValue to act like a stack variable rather than a pointer

Heather Anderson committed 5 years ago

Commit 85810221 parent f209c51170 files · +2837 −2594Browse files

Showing the changes to interface/src/scripting/AccountServicesScriptingInterface.cpp (1 of 170 files). Show all

Unified · Split

interface/src/scripting/AccountServicesScriptingInterface.cpp+9−9
@@ -123,27 +123,27 @@ DownloadInfoResult::DownloadInfoResult() : · 122 unmodified lines
123123 * @property {number[]} downloading - The download percentage remaining of each asset currently downloading.
124124 * @property {number} pending - The number of assets pending download.
125125 */
126−ScriptValuePointer DownloadInfoResultToScriptValue(ScriptEngine* engine, const DownloadInfoResult& result) {
127− ScriptValuePointer object = engine->newObject();
126+ScriptValue DownloadInfoResultToScriptValue(ScriptEngine* engine, const DownloadInfoResult& result) {
127+ ScriptValue object = engine->newObject();
128128
129− ScriptValuePointer array = engine->newArray(result.downloading.count());
129+ ScriptValue array = engine->newArray(result.downloading.count());
130130 for (int i = 0; i < result.downloading.count(); i += 1) {
131− array->setProperty(i, result.downloading[i]);
131+ array.setProperty(i, result.downloading[i]);
132132 }
133133
134− object->setProperty("downloading", array);
135− object->setProperty("pending", result.pending);
134+ object.setProperty("downloading", array);
135+ object.setProperty("pending", result.pending);
136136 return object;
137137 }
138138
139−void DownloadInfoResultFromScriptValue(const ScriptValuePointer& object, DownloadInfoResult& result) {
140− QList<QVariant> downloading = object->property("downloading")->toVariant().toList();
139+void DownloadInfoResultFromScriptValue(const ScriptValue& object, DownloadInfoResult& result) {
140+ QList<QVariant> downloading = object.property("downloading").toVariant().toList();
141141 result.downloading.clear();
142142 for (int i = 0; i < downloading.count(); i += 1) {
143143 result.downloading.append(downloading[i].toFloat());
144144 }
145145
146− result.pending = object->property("pending")->toVariant().toFloat();
146+ result.pending = object.property("pending").toVariant().toFloat();
147147 }
148148
149149 DownloadInfoResult AccountServicesScriptingInterface::getDownloadInfo() {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t