mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 05:52:38 +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}")
|
||||
|
||||
setup_hifi_library(Gui Widgets AndroidExtras)
|
||||
|
||||
add_definitions(-DANDROID)
|
||||
else ()
|
||||
setup_hifi_project(Gui Widgets)
|
||||
endif ()
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
|
||||
#include <jni.h>
|
||||
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#include <QtAndroidExtras/QAndroidJniEnvironment>
|
||||
#include <QtAndroidExtras/QAndroidJniObject>
|
||||
|
||||
#endif
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#include <QtWidgets/QMenuBar>
|
||||
|
||||
#ifdef HAVE_LIBOVR
|
||||
|
@ -53,13 +53,12 @@ GVRInterface::GVRInterface(int argc, char* argv[]) :
|
|||
|
||||
connect(this, &QGuiApplication::applicationStateChanged, this, &GVRInterface::handleApplicationStateChange);
|
||||
|
||||
#if defined(Q_WS_ANDROID) && defined(HAVE_LIBOVR)
|
||||
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||
QAndroidJniEnvironment jniEnv;
|
||||
|
||||
QPlatformNativeInterface* interface = QApplication::platformNativeInterface();
|
||||
jobject activity = (jobject) interface->nativeResourceForIntegration("QtActivity");
|
||||
|
||||
|
||||
ovr_RegisterHmtReceivers(&*jniEnv, activity);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class GVRInterface : public QApplication {
|
|||
Q_OBJECT
|
||||
public:
|
||||
GVRInterface(int argc, char* argv[]);
|
||||
|
||||
|
||||
RenderingClient* getClient() { return _client; }
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <QtWidgets/QInputDialog>
|
||||
#include <QtWidgets/QMenuBar>
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
#ifndef ANDROID
|
||||
#include <QtWidgets/QDesktopWidget>
|
||||
#endif
|
||||
|
||||
|
@ -42,13 +42,18 @@ GVRMainWindow::GVRMainWindow(QWidget* parent) :
|
|||
menuBar()->addMenu(helpMenu);
|
||||
|
||||
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);
|
||||
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);
|
||||
helpMenu->addAction(aboutQt);
|
||||
|
||||
QWidget* baseWidget = new QWidget(this);
|
||||
|
||||
|
@ -65,6 +70,14 @@ GVRMainWindow::GVRMainWindow(QWidget* parent) :
|
|||
new InterfaceView(baseWidget);
|
||||
}
|
||||
|
||||
void GVRMainWindow::goFullScreen() {
|
||||
#ifdef ANDROID
|
||||
menuBar()->hide();
|
||||
#else
|
||||
showFullScreen();
|
||||
#endif
|
||||
}
|
||||
|
||||
void GVRMainWindow::showAddressBar() {
|
||||
// setup the address QInputDialog
|
||||
QInputDialog* addressDialog = new QInputDialog(this);
|
||||
|
|
|
@ -22,6 +22,7 @@ public:
|
|||
GVRMainWindow(QWidget* parent = 0);
|
||||
public slots:
|
||||
void showAddressBar();
|
||||
void goFullScreen();
|
||||
private:
|
||||
QVBoxLayout* _mainLayout;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue