History

Don't use blocking connections on the main thread

Brad Davis committed 9 years ago

Commit b52dd7b1 parent b22daa945 files · +377 −178Browse files

Showing the changes to libraries/script-engine/src/RecordingScriptingInterface.cpp (1 of 45 files). Show all

Unified · Split

libraries/script-engine/src/RecordingScriptingInterface.cpp+9−8
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <QtScript/QScriptValue>
1515 #include <QtWidgets/QFileDialog>
1616
17+#include <shared/QtHelpers.h>
1718 #include <AssetClient.h>
1819 #include <AssetUpload.h>
1920 #include <BuildInfo.h>
@@ -98,7 +99,7 @@ void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue · 78 unmodified lines
9899
99100 void RecordingScriptingInterface::startPlaying() {
100101 if (QThread::currentThread() != thread()) {
101− QMetaObject::invokeMethod(this, "startPlaying", Qt::BlockingQueuedConnection);
102+ hifi::qt::blockingInvokeMethod(this, "startPlaying");
102103 return;
103104 }
104105
@@ -115,7 +116,7 @@ void RecordingScriptingInterface::setPlayerAudioOffset(float audioOffset) { · 10 unmodified lines
115116
116117 void RecordingScriptingInterface::setPlayerTime(float time) {
117118 if (QThread::currentThread() != thread()) {
118− QMetaObject::invokeMethod(this, "setPlayerTime", Qt::BlockingQueuedConnection, Q_ARG(float, time));
119+ hifi::qt::blockingInvokeMethod(this, "setPlayerTime", Q_ARG(float, time));
119120 return;
120121 }
121122 _player->seek(time);
@@ -147,7 +148,7 @@ void RecordingScriptingInterface::setPlayerUseSkeletonModel(bool useSkeletonMode · 25 unmodified lines
147148
148149 void RecordingScriptingInterface::pausePlayer() {
149150 if (QThread::currentThread() != thread()) {
150− QMetaObject::invokeMethod(this, "pausePlayer", Qt::BlockingQueuedConnection);
151+ hifi::qt::blockingInvokeMethod(this, "pausePlayer");
151152 return;
152153 }
153154 _player->pause();
@@ -155,7 +156,7 @@ void RecordingScriptingInterface::pausePlayer() { · 1 unmodified line
155156
156157 void RecordingScriptingInterface::stopPlaying() {
157158 if (QThread::currentThread() != thread()) {
158− QMetaObject::invokeMethod(this, "stopPlaying", Qt::BlockingQueuedConnection);
159+ hifi::qt::blockingInvokeMethod(this, "stopPlaying");
159160 return;
160161 }
161162 _player->stop();
@@ -176,7 +177,7 @@ void RecordingScriptingInterface::startRecording() { · 14 unmodified lines
176177 }
177178
178179 if (QThread::currentThread() != thread()) {
179− QMetaObject::invokeMethod(this, "startRecording", Qt::BlockingQueuedConnection);
180+ hifi::qt::blockingInvokeMethod(this, "startRecording");
180181 return;
181182 }
182183
@@ -199,7 +200,7 @@ QString RecordingScriptingInterface::getDefaultRecordingSaveDirectory() { · 16 unmodified lines
199200
200201 void RecordingScriptingInterface::saveRecording(const QString& filename) {
201202 if (QThread::currentThread() != thread()) {
202− QMetaObject::invokeMethod(this, "saveRecording", Qt::BlockingQueuedConnection,
203+ hifi::qt::blockingInvokeMethod(this, "saveRecording",
203204 Q_ARG(QString, filename));
204205 return;
205206 }
@@ -220,7 +221,7 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr · 14 unmodified lines
220221
221222 if (QThread::currentThread() != thread()) {
222223 bool result;
223− QMetaObject::invokeMethod(this, "saveRecordingToAsset", Qt::BlockingQueuedConnection,
224+ hifi::qt::blockingInvokeMethod(this, "saveRecordingToAsset",
224225 Q_RETURN_ARG(bool, result),
225226 Q_ARG(QScriptValue, getClipAtpUrl));
226227 return result;
@@ -257,7 +258,7 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr · 30 unmodified lines
257258
258259 void RecordingScriptingInterface::loadLastRecording() {
259260 if (QThread::currentThread() != thread()) {
260− QMetaObject::invokeMethod(this, "loadLastRecording", Qt::BlockingQueuedConnection);
261+ hifi::qt::blockingInvokeMethod(this, "loadLastRecording");
261262 return;
262263 }
263264