mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +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->play();
|
||||
|
||||
QString fileName = Snapshot::saveSnapshot(_glWidget, _myAvatar);
|
||||
QString fileName = Snapshot::saveSnapshot();
|
||||
|
||||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
if (!accountManager.isLoggedIn()) {
|
||||
|
|
|
@ -101,10 +101,8 @@ void LocationManager::locationImageUpdateSuccess(const QJsonObject& rootObject)
|
|||
}
|
||||
|
||||
void LocationManager::updateSnapshotForExistingLocation(const QString& locationID) {
|
||||
// first create a snapshot and save it
|
||||
Application* application = Application::getInstance();
|
||||
|
||||
QTemporaryFile* tempImageFile = Snapshot::saveTempSnapshot(application->getGLWidget(), application->getAvatar());
|
||||
// first create a snapshot and save it
|
||||
QTemporaryFile* tempImageFile = Snapshot::saveTempSnapshot();
|
||||
|
||||
if (tempImageFile && tempImageFile->open()) {
|
||||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
|
|
|
@ -64,8 +64,8 @@ SnapshotMetaData* Snapshot::parseSnapshotData(QString snapshotPath) {
|
|||
return data;
|
||||
}
|
||||
|
||||
QString Snapshot::saveSnapshot(QGLWidget* widget, Avatar* avatar) {
|
||||
QFile* snapshotFile = savedFileForSnapshot(widget, avatar, false);
|
||||
QString Snapshot::saveSnapshot() {
|
||||
QFile* snapshotFile = savedFileForSnapshot(false);
|
||||
|
||||
// we don't need the snapshot file, so close it, grab its filename and delete it
|
||||
snapshotFile->close();
|
||||
|
@ -77,14 +77,18 @@ QString Snapshot::saveSnapshot(QGLWidget* widget, Avatar* avatar) {
|
|||
return snapshotPath;
|
||||
}
|
||||
|
||||
QTemporaryFile* Snapshot::saveTempSnapshot(QGLWidget* widget, Avatar* avatar) {
|
||||
QTemporaryFile* Snapshot::saveTempSnapshot() {
|
||||
// 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();
|
||||
|
||||
Avatar* avatar = Application::getInstance()->getAvatar();
|
||||
|
||||
glm::vec3 location = avatar->getPosition();
|
||||
glm::quat orientation = avatar->getHead()->getOrientation();
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <QImage>
|
||||
#include <QFile>
|
||||
#include <QGLWidget>
|
||||
#include <QString>
|
||||
|
||||
|
@ -41,12 +42,12 @@ private:
|
|||
class Snapshot {
|
||||
|
||||
public:
|
||||
static QString saveSnapshot(QGLWidget* widget, Avatar* avatar);
|
||||
static QTemporaryFile* saveTempSnapshot(QGLWidget* widget, Avatar* avatar);
|
||||
static QString saveSnapshot();
|
||||
static QTemporaryFile* saveTempSnapshot();
|
||||
static SnapshotMetaData* parseSnapshotData(QString snapshotPath);
|
||||
|
||||
private:
|
||||
static QFile* savedFileForSnapshot(QGLWidget* widget, Avatar* avatar, bool isTemporary);
|
||||
static QFile* savedFileForSnapshot(bool isTemporary);
|
||||
};
|
||||
|
||||
#endif // hifi_Snapshot_h
|
||||
|
|
|
@ -33,7 +33,7 @@ const char SOLO_NODE_TYPES[2] = {
|
|||
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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue