mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-16 22:26:16 +02:00
cleanup to snapshot class to reduce passing of variables
This commit is contained in:
parent
e5a54116dc
commit
eb0f7da517
5 changed files with 17 additions and 14 deletions
|
@ -4158,7 +4158,7 @@ void Application::takeSnapshot() {
|
||||||
player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
|
||||||
player->play();
|
player->play();
|
||||||
|
|
||||||
QString fileName = Snapshot::saveSnapshot(_glWidget, _myAvatar);
|
QString fileName = Snapshot::saveSnapshot();
|
||||||
|
|
||||||
AccountManager& accountManager = AccountManager::getInstance();
|
AccountManager& accountManager = AccountManager::getInstance();
|
||||||
if (!accountManager.isLoggedIn()) {
|
if (!accountManager.isLoggedIn()) {
|
||||||
|
|
|
@ -101,10 +101,8 @@ void LocationManager::locationImageUpdateSuccess(const QJsonObject& rootObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationManager::updateSnapshotForExistingLocation(const QString& locationID) {
|
void LocationManager::updateSnapshotForExistingLocation(const QString& locationID) {
|
||||||
// first create a snapshot and save it
|
// first create a snapshot and save it
|
||||||
Application* application = Application::getInstance();
|
QTemporaryFile* tempImageFile = Snapshot::saveTempSnapshot();
|
||||||
|
|
||||||
QTemporaryFile* tempImageFile = Snapshot::saveTempSnapshot(application->getGLWidget(), application->getAvatar());
|
|
||||||
|
|
||||||
if (tempImageFile && tempImageFile->open()) {
|
if (tempImageFile && tempImageFile->open()) {
|
||||||
AccountManager& accountManager = AccountManager::getInstance();
|
AccountManager& accountManager = AccountManager::getInstance();
|
||||||
|
|
|
@ -64,8 +64,8 @@ SnapshotMetaData* Snapshot::parseSnapshotData(QString snapshotPath) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Snapshot::saveSnapshot(QGLWidget* widget, Avatar* avatar) {
|
QString Snapshot::saveSnapshot() {
|
||||||
QFile* snapshotFile = savedFileForSnapshot(widget, avatar, false);
|
QFile* snapshotFile = savedFileForSnapshot(false);
|
||||||
|
|
||||||
// we don't need the snapshot file, so close it, grab its filename and delete it
|
// we don't need the snapshot file, so close it, grab its filename and delete it
|
||||||
snapshotFile->close();
|
snapshotFile->close();
|
||||||
|
@ -77,14 +77,18 @@ QString Snapshot::saveSnapshot(QGLWidget* widget, Avatar* avatar) {
|
||||||
return snapshotPath;
|
return snapshotPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTemporaryFile* Snapshot::saveTempSnapshot(QGLWidget* widget, Avatar* avatar) {
|
QTemporaryFile* Snapshot::saveTempSnapshot() {
|
||||||
// return whatever we get back from saved file for snapshot
|
// return whatever we get back from saved file for snapshot
|
||||||
return static_cast<QTemporaryFile*>(savedFileForSnapshot(widget, avatar, true));;
|
return static_cast<QTemporaryFile*>(savedFileForSnapshot(true));;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile* Snapshot::savedFileForSnapshot(QGLWidget* widget, Avatar* avatar, bool isTemporary) {
|
QFile* Snapshot::savedFileForSnapshot(bool isTemporary) {
|
||||||
|
|
||||||
|
QGLWidget* widget = Application::getInstance()->getGLWidget();
|
||||||
QImage shot = widget->grabFrameBuffer();
|
QImage shot = widget->grabFrameBuffer();
|
||||||
|
|
||||||
|
Avatar* avatar = Application::getInstance()->getAvatar();
|
||||||
|
|
||||||
glm::vec3 location = avatar->getPosition();
|
glm::vec3 location = avatar->getPosition();
|
||||||
glm::quat orientation = avatar->getHead()->getOrientation();
|
glm::quat orientation = avatar->getHead()->getOrientation();
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
#include <QFile>
|
||||||
#include <QGLWidget>
|
#include <QGLWidget>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
@ -41,12 +42,12 @@ private:
|
||||||
class Snapshot {
|
class Snapshot {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static QString saveSnapshot(QGLWidget* widget, Avatar* avatar);
|
static QString saveSnapshot();
|
||||||
static QTemporaryFile* saveTempSnapshot(QGLWidget* widget, Avatar* avatar);
|
static QTemporaryFile* saveTempSnapshot();
|
||||||
static SnapshotMetaData* parseSnapshotData(QString snapshotPath);
|
static SnapshotMetaData* parseSnapshotData(QString snapshotPath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QFile* savedFileForSnapshot(QGLWidget* widget, Avatar* avatar, bool isTemporary);
|
static QFile* savedFileForSnapshot(bool isTemporary);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_Snapshot_h
|
#endif // hifi_Snapshot_h
|
||||||
|
|
|
@ -33,7 +33,7 @@ const char SOLO_NODE_TYPES[2] = {
|
||||||
NodeType::AudioMixer
|
NodeType::AudioMixer
|
||||||
};
|
};
|
||||||
|
|
||||||
const QUrl DEFAULT_NODE_AUTH_URL = QUrl("https://data.highfidelity.io");
|
const QUrl DEFAULT_NODE_AUTH_URL = QUrl("http://localhost:3000");
|
||||||
|
|
||||||
LimitedNodeList* LimitedNodeList::_sharedInstance = NULL;
|
LimitedNodeList* LimitedNodeList::_sharedInstance = NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue