overte-HifiExperiments/libraries/animation/src/AnimNodeLoader.h
2016-04-12 13:51:11 -07:00

53 lines
1.1 KiB
C++

//
// AnimNodeLoader.h
//
// Created by Anthony J. Thibault on 9/2/15.
// Copyright (c) 2015 High Fidelity, Inc. All rights reserved.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_AnimNodeLoader_h
#define hifi_AnimNodeLoader_h
#include <memory>
#include <QNetworkReply>
#include <QString>
#include <QUrl>
#include "AnimNode.h"
class Resource;
class AnimNodeLoader : public QObject {
Q_OBJECT
public:
explicit AnimNodeLoader(const QUrl& url);
signals:
void success(AnimNode::Pointer node);
void error(int error, QString str);
protected:
// synchronous
static AnimNode::Pointer load(const QByteArray& contents, const QUrl& jsonUrl);
protected slots:
void onRequestDone(const QByteArray data);
void onRequestError(QNetworkReply::NetworkError error);
protected:
QUrl _url;
QSharedPointer<Resource> _resource;
private:
// no copies
AnimNodeLoader(const AnimNodeLoader&) = delete;
AnimNodeLoader& operator=(const AnimNodeLoader&) = delete;
};
#endif // hifi_AnimNodeLoader