Commit 6af9a170 authored by dogmaphobic's avatar dogmaphobic

More Android work...

parent db135056
......@@ -60,6 +60,7 @@ public class UsbDeviceJNI extends QtActivity
// USED TO DETECT WHEN A DEVICE HAS BEEN UNPLUGGED
private BroadcastReceiver m_UsbReceiver = null;
private final static ExecutorService m_Executor = Executors.newSingleThreadExecutor();
private static final String TAG = "QGC_UsbDeviceJNI";
private final static UsbIoManager.Listener m_Listener =
new UsbIoManager.Listener()
......@@ -67,6 +68,7 @@ public class UsbDeviceJNI extends QtActivity
@Override
public void onRunError(Exception eA, int userDataA)
{
Log.e(TAG, "onRunError Exception");
nativeDeviceException(userDataA, eA.getMessage());
}
......@@ -77,7 +79,6 @@ public class UsbDeviceJNI extends QtActivity
}
};
private static final String TAG = "QGC_UsbDeviceJNI";
// NATIVE C++ FUNCTION THAT WILL BE CALLED IF THE DEVICE IS UNPLUGGED
private static native void nativeDeviceHasDisconnected(int userDataA);
......@@ -120,7 +121,6 @@ public class UsbDeviceJNI extends QtActivity
return true;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// List all available devices that are not already open. It returns the serial port info
......
......@@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE
static const char V_jniClassName[] {"org/qgroundcontrol/qgchelper/UsbDeviceJNI"};
static const char V_TAG[] {"QGC_QSerialPortInfo"};
extern void cleanJavaException();
QList<QSerialPortInfo> availablePortsByFiltersOfDevices(bool &ok)
{
QList<QSerialPortInfo> serialPortInfoList;
......@@ -117,22 +119,26 @@ QList<qint32> QSerialPortInfo::standardBaudRates()
bool QSerialPortInfo::isBusy() const
{
QAndroidJniObject jstrL = QAndroidJniObject::fromString(d_ptr->portName);
cleanJavaException();
jboolean resultL = QAndroidJniObject::callStaticMethod<jboolean>(
V_jniClassName,
"isDeviceNameOpen",
"(Ljava/lang/String;)Z",
jstrL.object<jstring>());
cleanJavaException();
return resultL;
}
bool QSerialPortInfo::isValid() const
{
QAndroidJniObject jstrL = QAndroidJniObject::fromString(d_ptr->portName);
cleanJavaException();
jboolean resultL = QAndroidJniObject::callStaticMethod<jboolean>(
V_jniClassName,
"isDeviceNameValid",
"(Ljava/lang/String;)Z",
jstrL.object<jstring>());
cleanJavaException();
return resultL;
}
......
......@@ -104,7 +104,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) :
_app = this;
// This prevents usage of QQuickWidget to fail since it doesn't support native widget siblings
#ifndef __android__
setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
#endif
#ifdef QT_DEBUG
// First thing we want to do is set up the qtlogging.ini file. If it doesn't already exist we copy
......
......@@ -217,10 +217,10 @@ void QGCFileDialog::_validate(Options& options)
Q_ASSERT(qgcApp());
Q_ASSERT_X(QThread::currentThread() == qgcApp()->thread(), "Threading issue", "QGCFileDialog can only be called from main thread");
#ifndef __android__
// On OSX native dialog can hang so we always use Qt dialogs
options |= DontUseNativeDialog;
#endif
if (MainWindow::instance()) {
MainWindow::instance()->hideSplashScreen();
}
......
......@@ -183,8 +183,10 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
// Qt 4 on Ubuntu does place the native menubar correctly so on Linux we revert back to in-window menu bar.
// TODO: Check that this is still necessary on Qt5 on Ubuntu
#ifdef Q_OS_LINUX
#ifndef __android__
menuBar()->setNativeMenuBar(false);
#endif
#endif
#ifdef UNITTEST_BUILD
QAction* qmlTestAction = new QAction("Test QML palette and controls", NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment