Merge branch 'android' of git://github.com/birarda/hifi into android

This commit is contained in:
Atlante45 2015-01-29 15:22:01 -08:00
commit cb8e4f33bc
6 changed files with 45 additions and 12 deletions

View file

@ -182,9 +182,15 @@ _Note that the INSTALL target should handle the copying of files into an install
Download the zip from the [soxr sourceforge page](http://sourceforge.net/projects/soxr/). Download the zip from the [soxr sourceforge page](http://sourceforge.net/projects/soxr/).
We recommend you extract it to %HIFI_LIB_DIR%\soxr. This will help our FindSoxr cmake module find what it needs. You can place it wherever you like on your machine if you specify SOXR_ROOT_DIR as an environment variable or a variable passed when cmake is run. We recommend you install it to %HIFI_LIB_DIR%\soxr. This will help our FindSoxr cmake module find what it needs. You can place it wherever you like on your machine if you specify SOXR_ROOT_DIR as an environment variable or a variable passed when cmake is run.
You will need to use cmake to build and install Soxr. If you'd like to keep everything containted in the Soxr folder, pass `-DCMAKE_INSTALL_PREFIX=.` when you run Cmake so that it will be installed to the same directory. Extract the soxr archive wherever you like. Then, inside the extracted folder, create a directory called `build`. From that build directory, the following commands will build and then install soxr to `%HIFI_LIB_DIR%`.
```
cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%HIFI_LIB_DIR%/soxr
nmake
nmake install
```
###Build High Fidelity using Visual Studio ###Build High Fidelity using Visual Studio
Follow the same build steps from the CMake section of [BUILD.md](BUILD.md), but pass a different generator to CMake. Follow the same build steps from the CMake section of [BUILD.md](BUILD.md), but pass a different generator to CMake.

View file

@ -9,7 +9,9 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
#ifdef Q_WS_ANDROID #ifdef ANDROID
#include <jni.h>
#include <QtAndroidExtras/QAndroidJniEnvironment> #include <QtAndroidExtras/QAndroidJniEnvironment>
#include <QtAndroidExtras/QAndroidJniObject> #include <QtAndroidExtras/QAndroidJniObject>
@ -34,11 +36,20 @@
#include "GVRInterface.h" #include "GVRInterface.h"
static QString launchURLString = QString();
GVRInterface::GVRInterface(int argc, char* argv[]) : GVRInterface::GVRInterface(int argc, char* argv[]) :
QApplication(argc, argv), QApplication(argc, argv),
_inVRMode(false) _inVRMode(false)
{ {
_client = new RenderingClient(this); if (!launchURLString.isEmpty()) {
// did we get launched with a lookup URL? If so it is time to give that to the AddressManager
qDebug() << "We were opened via a hifi URL -" << launchURLString;
}
_client = new RenderingClient(this, launchURLString);
launchURLString = QString();
connect(this, &QGuiApplication::applicationStateChanged, this, &GVRInterface::handleApplicationStateChange); connect(this, &QGuiApplication::applicationStateChanged, this, &GVRInterface::handleApplicationStateChange);
@ -58,8 +69,20 @@ GVRInterface::GVRInterface(int argc, char* argv[]) :
idleTimer->start(0); idleTimer->start(0);
} }
#ifdef ANDROID
extern "C" {
JNIEXPORT void Java_io_highfidelity_gvrinterface_InterfaceActivity_handleHifiURL(JNIEnv *jni, jclass clazz, jstring hifiURLString) {
launchURLString = QAndroidJniObject(hifiURLString).toString();
}
}
#endif
void GVRInterface::idle() { void GVRInterface::idle() {
#if defined(Q_WS_ANDROID) && defined(HAVE_LIBOVR) #if defined(ANDROID) && defined(HAVE_LIBOVR)
if (!_inVRMode && ovr_IsHeadsetDocked()) { if (!_inVRMode && ovr_IsHeadsetDocked()) {
qDebug() << "The headset just got docked - assume we are in VR mode."; qDebug() << "The headset just got docked - assume we are in VR mode.";
_inVRMode = true; _inVRMode = true;

View file

@ -29,7 +29,7 @@ GVRMainWindow::GVRMainWindow(QWidget* parent) :
QMainWindow(parent) QMainWindow(parent)
{ {
#ifndef Q_OS_ANDROID #ifndef ANDROID
const int NOTE_4_WIDTH = 2560; const int NOTE_4_WIDTH = 2560;
const int NOTE_4_HEIGHT = 1440; const int NOTE_4_HEIGHT = 1440;
setFixedSize(NOTE_4_WIDTH / 2, NOTE_4_HEIGHT / 2); setFixedSize(NOTE_4_WIDTH / 2, NOTE_4_HEIGHT / 2);

View file

@ -21,11 +21,16 @@
RenderingClient* RenderingClient::_instance = NULL; RenderingClient* RenderingClient::_instance = NULL;
RenderingClient::RenderingClient(QObject *parent) : RenderingClient::RenderingClient(QObject *parent, const QString& launchURLString) :
Client(parent) Client(parent)
{ {
_instance = this; _instance = this;
// connect to AddressManager and pass it the launch URL, if we have one
auto addressManager = DependencyManager::get<AddressManager>();
connect(addressManager.data(), &AddressManager::locationChangeRequired, this, &RenderingClient::goToLocation);
addressManager->loadSettings(launchURLString);
// tell the NodeList which node types all rendering clients will want to know about // tell the NodeList which node types all rendering clients will want to know about
DependencyManager::get<NodeList>()->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer); DependencyManager::get<NodeList>()->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer);
@ -42,9 +47,6 @@ RenderingClient::RenderingClient(QObject *parent) :
connect(audioThread, &QThread::started, audioClient.data(), &AudioClient::start); connect(audioThread, &QThread::started, audioClient.data(), &AudioClient::start);
audioThread->start(); audioThread->start();
connect(DependencyManager::get<AddressManager>().data(), &AddressManager::locationChangeRequired,
this, &RenderingClient::goToLocation);
} }
RenderingClient::~RenderingClient() { RenderingClient::~RenderingClient() {

View file

@ -21,7 +21,7 @@
class RenderingClient : public Client { class RenderingClient : public Client {
Q_OBJECT Q_OBJECT
public: public:
RenderingClient(QObject* parent = 0); RenderingClient(QObject* parent = 0, const QString& launchURLString = QString());
~RenderingClient(); ~RenderingClient();
const glm::vec3& getPosition() const { return _position; } const glm::vec3& getPosition() const { return _position; }

View file

@ -20,6 +20,8 @@ import org.qtproject.qt5.android.bindings.QtActivity;
public class InterfaceActivity extends QtActivity { public class InterfaceActivity extends QtActivity {
public static native void handleHifiURL(String hifiURLString);
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -31,7 +33,7 @@ public class InterfaceActivity extends QtActivity {
Uri data = intent.getData(); Uri data = intent.getData();
if (data.getScheme().equals("hifi")) { if (data.getScheme().equals("hifi")) {
handleHifiURL(data.toString());
} }
} }