Overte C++ Documentation
AnimNodeLoader.h
1 //
2 // AnimNodeLoader.h
3 //
4 // Created by Anthony J. Thibault on 9/2/15.
5 // Copyright (c) 2015 High Fidelity, Inc. All rights reserved.
6 //
7 // Distributed under the Apache License, Version 2.0.
8 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
9 //
10 
11 #ifndef hifi_AnimNodeLoader_h
12 #define hifi_AnimNodeLoader_h
13 
14 #include <memory>
15 
16 #include <QNetworkReply>
17 #include <QtCore/QSharedPointer>
18 #include <QString>
19 #include <QUrl>
20 
21 #include "AnimNode.h"
22 
23 class Resource;
24 
25 class AnimNodeLoader : public QObject {
26  Q_OBJECT
27 
28 public:
29  explicit AnimNodeLoader(const QUrl& url);
30 
31 signals:
32  void success(AnimNode::Pointer node);
33  void error(int error, QString str);
34 
35 protected:
36  // synchronous
37  static AnimNode::Pointer load(const QByteArray& contents, const QUrl& jsonUrl);
38 
39 protected slots:
40  void onRequestDone(const QByteArray data);
41  void onRequestError(QNetworkReply::NetworkError error);
42 
43 protected:
44  QUrl _url;
45  QSharedPointer<Resource> _resource;
46 
47 private:
48  Q_DISABLE_COPY(AnimNodeLoader)
49 };
50 
51 #endif // hifi_AnimNodeLoader
Base class for resources.
Definition: ResourceCache.h:409