sigrok-cross-android: Adapt PulseView for Qt5
authorMarcus Comstedt <marcus@mc.pp.se>
Sat, 17 May 2014 10:56:29 +0000 (12:56 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Mon, 25 Aug 2014 20:38:43 +0000 (22:38 +0200)
cross-compile/android/pulseview-cpp.patch
cross-compile/android/pulseview-java.patch
cross-compile/android/sigrok-cross-android

index 14057048f9db9d3aceb37dc7b7ebf7f4c662fe0f..5acdf36c5d1672d0fe01f09e7345780681d4a8f0 100644 (file)
@@ -24,19 +24,6 @@ index 11767a6..b8eed96 100644
  
  target_link_libraries(${PROJECT_NAME} ${PULSEVIEW_LINK_LIBS})
  
-diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp
-index e4f0276..861d25b 100644
---- a/pv/view/decodetrace.cpp
-+++ b/pv/view/decodetrace.cpp
-@@ -373,7 +373,7 @@ void DecodeTrace::draw_instant(const pv::data::decode::Annotation &a, QPainter &
- {
-       const QString text = a.annotations().empty() ?
-               QString() : a.annotations().back();
--      const double w = min(p.boundingRect(QRectF(), 0, text).width(),
-+      const double w = min((double)p.boundingRect(QRectF(), 0, text).width(),
-               0.0) + h;
-       const QRectF rect(x - w / 2, y - h / 2, w, h);
 diff --git a/main.cpp b/main.cpp
 index 2c6a59e..79627db 100644
 --- a/main.cpp 2014-04-26 23:40:24.253187700 +0200
index 56956141f32cdfc3085e00cfd6300df067e7f336..1495985075e4ab37e50af8c97029b6386f025036 100644 (file)
@@ -4,20 +4,39 @@ index 0564a8d..0356f33 100644
 +++ b/java/AndroidManifest.xml
 @@ -1,5 +1,5 @@
  <?xml version='1.0' encoding='utf-8'?>
--<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="org.kde.necessitas.example">
-+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="org.sigrok.pulseview">
-     <application android:name="org.kde.necessitas.origo.QtApplication" android:icon="@drawable/icon" android:label="@string/app_name">
-         <activity android:name="org.kde.necessitas.origo.QtActivity" android:label="@string/app_name" android:configChanges="orientation|locale|fontScale|keyboard|keyboardHidden" >
-             <intent-filter>
-@@ -8,7 +8,7 @@
+-<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
++<manifest package="org.sigrok.pulseview" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
+     <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name">
+         <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
+                   android:name="org.qtproject.qt5.android.bindings.QtActivity"
+@@ -9,21 +9,21 @@
+                 <action android:name="android.intent.action.MAIN"/>
+                 <category android:name="android.intent.category.LAUNCHER"/>
              </intent-filter>
+-            <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
++            <meta-data android:name="android.app.lib_name" android:value="pulseview"/>
+             <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
+             <meta-data android:name="android.app.repository" android:value="default"/>
              <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
              <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
--            <meta-data android:name="android.app.lib_name" android:value=""/>
-+            <meta-data android:name="android.app.lib_name" android:value="pulseview"/>
+             <!-- Deploy Qt libs as part of package -->
+-            <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
++            <meta-data android:name="android.app.bundle_local_qt_libs" android:value="0"/>
+             <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
+             <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
+             <!-- Run with local libs -->
+-            <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
++            <meta-data android:name="android.app.use_local_qt_libs" android:value="0"/>
+             <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
+-            <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
+-            <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
+-            <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
++            <meta-data android:name="android.app.load_local_libs" android:value="libs/libgnustl_shared.so"/>
++            <meta-data android:name="android.app.load_local_jars" android:value=":"/>
++            <meta-data android:name="android.app.static_init_classes" android:value=":"/>
              <!--  Messages maps -->
-             <meta-data android:name="android.app.ministro_not_found_msg" android:value="@string/ministro_not_found_msg"/>
-             <meta-data android:name="android.app.ministro_needed_msg" android:value="@string/ministro_needed_msg"/>
+             <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
+             <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
 diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
 index bd6928f..68f017e 100644
 --- a/java/res/values/strings.xml
@@ -25,19 +44,32 @@ index bd6928f..68f017e 100644
 @@ -1,6 +1,6 @@
  <?xml version='1.0' encoding='utf-8'?>
  <resources>
--    <string name="app_name"></string>
+-    <string name="app_name"><!-- %%INSERT_APP_NAME%% --></string>
 +    <string name="app_name">PulseView</string>
      <string name="ministro_not_found_msg">Can\'t find Ministro service.\nThe application can\'t start.</string>
      <string name="ministro_needed_msg">This application requires Ministro service. Would you like to install it?</string>
-     <string name="fatal_error_msg">Your application encountered a fatal error and cannot continue.</string>
-diff --git a/java/src/org/kde/necessitas/origo/QtActivity.java b/java/src/org/kde/necessitas/origo/QtActivity.java
+diff --git a/java/res/values/libs.xml b/java/res/values/libs.xml
+--- a/java/res/values/libs.xml 2014-05-17 11:09:29.855631921 +0200
++++ b/java/res/values/libs.xml 2014-05-17 11:13:04.380841784 +0200
+@@ -13,6 +13,9 @@
+      <array name="qt_libs">
+          <!-- %%INSERT_QT_LIBS%% -->
++         <item>Qt5Core</item>
++         <item>Qt5Gui</item>
++         <item>Qt5Widgets</item>
+      </array>
+     <array name="bundled_in_lib">
+diff --git a/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
 index 4ebf1f6..f4e3598 100644
---- a/java/src/org/kde/necessitas/origo/QtActivity.java
-+++ b/java/src/org/kde/necessitas/origo/QtActivity.java
-@@ -108,6 +108,14 @@ public class QtActivity extends Activity
+--- a/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
++++ b/java/src/org/qtproject/qt5/android/bindings/QtActivity.java
+@@ -187,6 +187,14 @@
+     private void loadApplication(Bundle loaderParams)
      {
-         try
-         {
+         try {
 +          org.sigrok.androidutils.Environment.initEnvironment(
 +               getApplicationInfo().sourceDir);
 +          System.loadLibrary("gnustl_shared");
@@ -46,9 +78,9 @@ index 4ebf1f6..f4e3598 100644
 +                new File(getApplicationInfo().nativeLibraryDir),
 +                new File(getFilesDir(), "lib"));
 +
-             if (loaderParams.getInt(ERROR_CODE_KEY) != 0)
-             { // fatal error, show the error and quit
-                 AlertDialog errorDialog = new AlertDialog.Builder(QtActivity.this).create();
+             final int errorCode = loaderParams.getInt(ERROR_CODE_KEY);
+             if (errorCode != 0) {
+                 if (errorCode == INCOMPATIBLE_MINISTRO_VERSION) {
 diff --git a/java/src/org/sigrok/androidutils/LibWrangler.java b/java/src/org/sigrok/androidutils/LibWrangler.java
 new file mode 100644
 index 0000000..0c9effe
index 5e08bda3fc69fd593ddc9147ad3e2bc506e69504..76e149b64388a1872f4d43752627af66f3b61ab2 100755 (executable)
@@ -316,12 +316,14 @@ cd ..
 $GIT_CLONE git://sigrok.org/pulseview
 cd pulseview
 patch -p1 < ../../pulseview-cpp.patch
-cmake $CM -DQT_QMAKE_EXECUTABLE=${PREFIX}/bin/qmake -DANDROID_STL_PATH=${ANDROID_NDK}/sources/cxx-stl .
+cmake $CM -DANDROID_STL_PATH=${ANDROID_NDK}/sources/cxx-stl .
 make $PARALLEL
 cp -r "$PREFIX"/src/android/java .
 cp -r libs java/
 cd java
 patch -p2 < ../../../pulseview-java.patch
+cp "$PREFIX"/jar/QtAndroid-bundled.jar libs/
+cp "$PREFIX"/jar/QtAndroidAccessibility-bundled.jar libs/
 mkdir -p assets
 READELF=$TOOLCHAIN_TRIPLET-readelf ../../../fix-libraries.sh "$PREFIX/lib" libs/"$TARGET_ARCH" libpulseview.so > assets/liblist.txt
 cp -r "$PREFIX"/lib/python3.3 assets/