Added pause/setCurrentTime/setCurrentFrame JShooks

This commit is contained in:
Atlante45 2014-09-23 14:19:16 -07:00
parent 95c00b1d4e
commit 3b33db9a6b
2 changed files with 22 additions and 29 deletions

View file

@ -587,18 +587,13 @@ bool AvatarData::hasReferential() {
} }
bool AvatarData::isPlaying() { bool AvatarData::isPlaying() {
if (!_player) {
return false;
}
if (QThread::currentThread() != thread()) {
bool result;
QMetaObject::invokeMethod(this, "isPlaying", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(bool, result));
return result;
}
return _player && _player->isPlaying(); return _player && _player->isPlaying();
} }
bool AvatarData::isPaused() {
return _player && _player->isPaused();
}
qint64 AvatarData::playerElapsed() { qint64 AvatarData::playerElapsed() {
if (!_player) { if (!_player) {
return 0; return 0;
@ -626,29 +621,11 @@ qint64 AvatarData::playerLength() {
} }
int AvatarData::playerCurrentFrame() { int AvatarData::playerCurrentFrame() {
if (!_player) { return (_player) ? _player->getCurrentFrame() : 0;
return 0;
}
if (QThread::currentThread() != thread()) {
int result;
QMetaObject::invokeMethod(this, "playerCurrentFrame", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(int, result));
return result;
}
return _player->getCurrentFrame();
} }
int AvatarData::playerFrameNumber() { int AvatarData::playerFrameNumber() {
if (!_player) { return (_player) ? _player->getRecording()->getFrameNumber() : 0;
return 0;
}
if (QThread::currentThread() != thread()) {
int result;
QMetaObject::invokeMethod(this, "playerFrameNumber", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(int, result));
return result;
}
return _player->getRecording()->getFrameNumber();
} }
void AvatarData::loadRecording(QString filename) { void AvatarData::loadRecording(QString filename) {
@ -734,6 +711,20 @@ void AvatarData::play() {
} }
} }
void AvatarData::pausePlayer() {
if (!_player) {
return;
}
if (QThread::currentThread() != thread()) {
QMetaObject::invokeMethod(this, "pausePlayer", Qt::BlockingQueuedConnection);
return;
}
if (_player) {
_player->pausePlayer();
}
}
void AvatarData::stopPlaying() { void AvatarData::stopPlaying() {
if (!_player) { if (!_player) {
return; return;

View file

@ -296,6 +296,7 @@ public slots:
bool hasReferential(); bool hasReferential();
bool isPlaying(); bool isPlaying();
bool isPaused();
qint64 playerElapsed(); qint64 playerElapsed();
qint64 playerLength(); qint64 playerLength();
int playerCurrentFrame(); int playerCurrentFrame();
@ -312,6 +313,7 @@ public slots:
void setPlayerUseHeadModel(bool useHeadModel); void setPlayerUseHeadModel(bool useHeadModel);
void setPlayerUseSkeletonModel(bool useSkeletonModel); void setPlayerUseSkeletonModel(bool useSkeletonModel);
void play(); void play();
void pausePlayer();
void stopPlaying(); void stopPlaying();
protected: protected: