Showing the changes to interface/src/scripting/LocationScriptingInterface.h (1 of 4 files). Show all
Unified · Split
| @@ -0,0 +1,50 @@ | ||
| 1 | +// | |
| 2 | +// LocationScriptingInterface.h | |
| 3 | +// interface/src/scripting | |
| 4 | +// | |
| 5 | +// Created by Ryan Huffman on 4/29/14. | |
| 6 | +// Copyright 2014 High Fidelity, Inc. | |
| 7 | +// | |
| 8 | +// Distributed under the Apache License, Version 2.0. | |
| 9 | +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | |
| 10 | +// | |
| 11 | + | |
| 12 | +#ifndef hifi_LocationScriptingInterface_h | |
| 13 | +#define hifi_LocationScriptingInterface_h | |
| 14 | + | |
| 15 | +#include <QObject> | |
| 16 | +#include <QScriptContext> | |
| 17 | +#include <QScriptEngine> | |
| 18 | +#include <QScriptValue> | |
| 19 | +#include <QString> | |
| 20 | + | |
| 21 | +#include <AddressManager.h> | |
| 22 | + | |
| 23 | +#include "Application.h" | |
| 24 | + | |
| 25 | +class LocationScriptingInterface : public QObject { | |
| 26 | + Q_OBJECT | |
| 27 | + Q_PROPERTY(bool isConnected READ isConnected) | |
| 28 | + Q_PROPERTY(QString href READ getHref) | |
| 29 | + Q_PROPERTY(QString protocol READ getProtocol) | |
| 30 | + Q_PROPERTY(QString hostname READ getHostname) | |
| 31 | + Q_PROPERTY(QString pathname READ getPathname) | |
| 32 | + LocationScriptingInterface() { }; | |
| 33 | +public: | |
| 34 | + static LocationScriptingInterface* getInstance(); | |
| 35 | + | |
| 36 | + bool isConnected(); | |
| 37 | + QString getHref(); | |
| 38 | + QString getProtocol() { return HIFI_URL_SCHEME; }; | |
| 39 | + QString getPathname(); | |
| 40 | + QString getHostname(); | |
| 41 | + | |
| 42 | + static QScriptValue locationGetter(QScriptContext* context, QScriptEngine* engine); | |
| 43 | + static QScriptValue locationSetter(QScriptContext* context, QScriptEngine* engine); | |
| 44 | + | |
| 45 | +public slots: | |
| 46 | + void assign(const QString& url); | |
| 47 | + | |
| 48 | +}; | |
| 49 | + | |
| 50 | +#endif // hifi_LocationScriptingInterface_h | |