mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 21:43:03 +02:00
make sure ANDROID is defined for Android build
This commit is contained in:
parent
3af97b7f8d
commit
05c4c32e30
5 changed files with 25 additions and 10 deletions
|
@ -17,6 +17,8 @@ if (ANDROID)
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ANDROID_APK_OUTPUT_DIR}/libs/${ANDROID_ABI}")
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ANDROID_APK_OUTPUT_DIR}/libs/${ANDROID_ABI}")
|
||||||
|
|
||||||
setup_hifi_library(Gui Widgets AndroidExtras)
|
setup_hifi_library(Gui Widgets AndroidExtras)
|
||||||
|
|
||||||
|
add_definitions(-DANDROID)
|
||||||
else ()
|
else ()
|
||||||
setup_hifi_project(Gui Widgets)
|
setup_hifi_project(Gui Widgets)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -13,13 +13,13 @@
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
#include <QtAndroidExtras/QAndroidJniEnvironment>
|
#include <QtAndroidExtras/QAndroidJniEnvironment>
|
||||||
#include <QtAndroidExtras/QAndroidJniObject>
|
#include <QtAndroidExtras/QAndroidJniObject>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <qpa/qplatformnativeinterface.h>
|
|
||||||
#include <QtWidgets/QMenuBar>
|
#include <QtWidgets/QMenuBar>
|
||||||
|
|
||||||
#ifdef HAVE_LIBOVR
|
#ifdef HAVE_LIBOVR
|
||||||
|
@ -53,13 +53,12 @@ GVRInterface::GVRInterface(int argc, char* argv[]) :
|
||||||
|
|
||||||
connect(this, &QGuiApplication::applicationStateChanged, this, &GVRInterface::handleApplicationStateChange);
|
connect(this, &QGuiApplication::applicationStateChanged, this, &GVRInterface::handleApplicationStateChange);
|
||||||
|
|
||||||
#if defined(Q_WS_ANDROID) && defined(HAVE_LIBOVR)
|
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||||
QAndroidJniEnvironment jniEnv;
|
QAndroidJniEnvironment jniEnv;
|
||||||
|
|
||||||
QPlatformNativeInterface* interface = QApplication::platformNativeInterface();
|
QPlatformNativeInterface* interface = QApplication::platformNativeInterface();
|
||||||
jobject activity = (jobject) interface->nativeResourceForIntegration("QtActivity");
|
jobject activity = (jobject) interface->nativeResourceForIntegration("QtActivity");
|
||||||
|
|
||||||
|
|
||||||
ovr_RegisterHmtReceivers(&*jniEnv, activity);
|
ovr_RegisterHmtReceivers(&*jniEnv, activity);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class GVRInterface : public QApplication {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GVRInterface(int argc, char* argv[]);
|
GVRInterface(int argc, char* argv[]);
|
||||||
|
|
||||||
RenderingClient* getClient() { return _client; }
|
RenderingClient* getClient() { return _client; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <QtWidgets/QInputDialog>
|
#include <QtWidgets/QInputDialog>
|
||||||
#include <QtWidgets/QMenuBar>
|
#include <QtWidgets/QMenuBar>
|
||||||
|
|
||||||
#ifndef Q_OS_ANDROID
|
#ifndef ANDROID
|
||||||
#include <QtWidgets/QDesktopWidget>
|
#include <QtWidgets/QDesktopWidget>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -42,13 +42,18 @@ GVRMainWindow::GVRMainWindow(QWidget* parent) :
|
||||||
menuBar()->addMenu(helpMenu);
|
menuBar()->addMenu(helpMenu);
|
||||||
|
|
||||||
QAction* goToAddress = new QAction("Go to Address", fileMenu);
|
QAction* goToAddress = new QAction("Go to Address", fileMenu);
|
||||||
QAction* aboutQt = new QAction("About Qt", helpMenu);
|
|
||||||
|
|
||||||
fileMenu->addAction(goToAddress);
|
|
||||||
helpMenu->addAction(aboutQt);
|
|
||||||
|
|
||||||
connect(goToAddress, &QAction::triggered, this, &GVRMainWindow::showAddressBar);
|
connect(goToAddress, &QAction::triggered, this, &GVRMainWindow::showAddressBar);
|
||||||
|
fileMenu->addAction(goToAddress);
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
QAction* goFullScreen = new QAction("Enter Full Screen", fileMenu);
|
||||||
|
connect(goFullScreen, &QAction::triggered, this, &GVRMainWindow::goFullScreen);
|
||||||
|
fileMenu->addAction(goFullScreen);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QAction* aboutQt = new QAction("About Qt", helpMenu);
|
||||||
connect(aboutQt, &QAction::triggered, qApp, &QApplication::aboutQt);
|
connect(aboutQt, &QAction::triggered, qApp, &QApplication::aboutQt);
|
||||||
|
helpMenu->addAction(aboutQt);
|
||||||
|
|
||||||
QWidget* baseWidget = new QWidget(this);
|
QWidget* baseWidget = new QWidget(this);
|
||||||
|
|
||||||
|
@ -65,6 +70,14 @@ GVRMainWindow::GVRMainWindow(QWidget* parent) :
|
||||||
new InterfaceView(baseWidget);
|
new InterfaceView(baseWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GVRMainWindow::goFullScreen() {
|
||||||
|
#ifdef ANDROID
|
||||||
|
menuBar()->hide();
|
||||||
|
#else
|
||||||
|
showFullScreen();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void GVRMainWindow::showAddressBar() {
|
void GVRMainWindow::showAddressBar() {
|
||||||
// setup the address QInputDialog
|
// setup the address QInputDialog
|
||||||
QInputDialog* addressDialog = new QInputDialog(this);
|
QInputDialog* addressDialog = new QInputDialog(this);
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
GVRMainWindow(QWidget* parent = 0);
|
GVRMainWindow(QWidget* parent = 0);
|
||||||
public slots:
|
public slots:
|
||||||
void showAddressBar();
|
void showAddressBar();
|
||||||
|
void goFullScreen();
|
||||||
private:
|
private:
|
||||||
QVBoxLayout* _mainLayout;
|
QVBoxLayout* _mainLayout;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue