Commit 0dd519e804b52ec43175f73f297c5f7239dfe323
0 parents
starting
Showing
28 changed files
with
719 additions
and
0 deletions
.gitignore
0 → 100644
android/AndroidManifest.xml
0 → 100644
1 | +++ a/android/AndroidManifest.xml | ||
1 | +<?xml version="1.0"?> | ||
2 | +<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.1" android:versionCode="1" android:installLocation="auto"> | ||
3 | + <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:icon="@drawable/icon"> | ||
4 | + <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop"> | ||
5 | + <intent-filter> | ||
6 | + <action android:name="android.intent.action.MAIN"/> | ||
7 | + <category android:name="android.intent.category.LAUNCHER"/> | ||
8 | + </intent-filter> | ||
9 | + <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> | ||
10 | + <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> | ||
11 | + <meta-data android:name="android.app.repository" android:value="default"/> | ||
12 | + <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> | ||
13 | + <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> | ||
14 | + <!-- Deploy Qt libs as part of package --> | ||
15 | + <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> | ||
16 | + <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/> | ||
17 | + <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/> | ||
18 | + <!-- Run with local libs --> | ||
19 | + <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> | ||
20 | + <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> | ||
21 | + <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/> | ||
22 | + <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> | ||
23 | + <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> | ||
24 | + <!-- Messages maps --> | ||
25 | + <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> | ||
26 | + <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> | ||
27 | + <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> | ||
28 | + <!-- Messages maps --> | ||
29 | + | ||
30 | + <!-- Splash screen --> | ||
31 | + <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash"/> | ||
32 | + <!-- Splash screen --> | ||
33 | + | ||
34 | + <!-- Background running --> | ||
35 | + <!-- Warning: changing this value to true may cause unexpected crashes if the | ||
36 | + application still try to draw after | ||
37 | + "applicationStateChanged(Qt::ApplicationSuspended)" | ||
38 | + signal is sent! --> | ||
39 | + <meta-data android:name="android.app.background_running" android:value="false"/> | ||
40 | + <!-- Background running --> | ||
41 | + </activity> | ||
42 | + </application> | ||
43 | + <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/> | ||
44 | + <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> | ||
45 | + | ||
46 | + <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. | ||
47 | + Remove the comment if you do not require these default permissions. --> | ||
48 | + <!-- %%INSERT_PERMISSIONS --> | ||
49 | + | ||
50 | + <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. | ||
51 | + Remove the comment if you do not require these default features. --> | ||
52 | + <!-- %%INSERT_FEATURES --> | ||
53 | + | ||
54 | +</manifest> |
android/build.gradle
0 → 100644
1 | +++ a/android/build.gradle | ||
1 | +buildscript { | ||
2 | + repositories { | ||
3 | + jcenter() | ||
4 | + } | ||
5 | + | ||
6 | + dependencies { | ||
7 | + classpath 'com.android.tools.build:gradle:1.0.0' | ||
8 | + } | ||
9 | +} | ||
10 | + | ||
11 | +allprojects { | ||
12 | + repositories { | ||
13 | + jcenter() | ||
14 | + } | ||
15 | +} | ||
16 | + | ||
17 | +apply plugin: 'com.android.application' | ||
18 | + | ||
19 | +dependencies { | ||
20 | + compile fileTree(dir: 'libs', include: ['*.jar']) | ||
21 | +} | ||
22 | + | ||
23 | +android { | ||
24 | + /******************************************************* | ||
25 | + * The following variables: | ||
26 | + * - androidBuildToolsVersion, | ||
27 | + * - androidCompileSdkVersion | ||
28 | + * - qt5AndroidDir - holds the path to qt android files | ||
29 | + * needed to build any Qt application | ||
30 | + * on Android. | ||
31 | + * | ||
32 | + * are defined in gradle.properties file. This file is | ||
33 | + * updated by QtCreator and androiddeployqt tools. | ||
34 | + * Changing them manually might break the compilation! | ||
35 | + *******************************************************/ | ||
36 | + | ||
37 | + compileSdkVersion androidCompileSdkVersion.toInteger() | ||
38 | + | ||
39 | + buildToolsVersion androidBuildToolsVersion | ||
40 | + | ||
41 | + sourceSets { | ||
42 | + main { | ||
43 | + manifest.srcFile 'AndroidManifest.xml' | ||
44 | + java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] | ||
45 | + aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] | ||
46 | + res.srcDirs = [qt5AndroidDir + '/res', 'res'] | ||
47 | + resources.srcDirs = ['src'] | ||
48 | + renderscript.srcDirs = ['src'] | ||
49 | + assets.srcDirs = ['assets'] | ||
50 | + jniLibs.srcDirs = ['libs'] | ||
51 | + } | ||
52 | + } | ||
53 | + | ||
54 | + lintOptions { | ||
55 | + abortOnError false | ||
56 | + } | ||
57 | +} |
android/gradle/wrapper/gradle-wrapper.jar
0 → 100644
No preview for this file type
android/gradle/wrapper/gradle-wrapper.properties
0 → 100644
1 | +++ a/android/gradle/wrapper/gradle-wrapper.properties | ||
1 | +#Wed Apr 10 15:27:10 PDT 2013 | ||
2 | +distributionBase=GRADLE_USER_HOME | ||
3 | +distributionPath=wrapper/dists | ||
4 | +zipStoreBase=GRADLE_USER_HOME | ||
5 | +zipStorePath=wrapper/dists | ||
6 | +distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip |
android/gradlew
0 → 100755
1 | +++ a/android/gradlew | ||
1 | +#!/usr/bin/env bash | ||
2 | + | ||
3 | +############################################################################## | ||
4 | +## | ||
5 | +## Gradle start up script for UN*X | ||
6 | +## | ||
7 | +############################################################################## | ||
8 | + | ||
9 | +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
10 | +DEFAULT_JVM_OPTS="" | ||
11 | + | ||
12 | +APP_NAME="Gradle" | ||
13 | +APP_BASE_NAME=`basename "$0"` | ||
14 | + | ||
15 | +# Use the maximum available, or set MAX_FD != -1 to use that value. | ||
16 | +MAX_FD="maximum" | ||
17 | + | ||
18 | +warn ( ) { | ||
19 | + echo "$*" | ||
20 | +} | ||
21 | + | ||
22 | +die ( ) { | ||
23 | + echo | ||
24 | + echo "$*" | ||
25 | + echo | ||
26 | + exit 1 | ||
27 | +} | ||
28 | + | ||
29 | +# OS specific support (must be 'true' or 'false'). | ||
30 | +cygwin=false | ||
31 | +msys=false | ||
32 | +darwin=false | ||
33 | +case "`uname`" in | ||
34 | + CYGWIN* ) | ||
35 | + cygwin=true | ||
36 | + ;; | ||
37 | + Darwin* ) | ||
38 | + darwin=true | ||
39 | + ;; | ||
40 | + MINGW* ) | ||
41 | + msys=true | ||
42 | + ;; | ||
43 | +esac | ||
44 | + | ||
45 | +# For Cygwin, ensure paths are in UNIX format before anything is touched. | ||
46 | +if $cygwin ; then | ||
47 | + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` | ||
48 | +fi | ||
49 | + | ||
50 | +# Attempt to set APP_HOME | ||
51 | +# Resolve links: $0 may be a link | ||
52 | +PRG="$0" | ||
53 | +# Need this for relative symlinks. | ||
54 | +while [ -h "$PRG" ] ; do | ||
55 | + ls=`ls -ld "$PRG"` | ||
56 | + link=`expr "$ls" : '.*-> \(.*\)$'` | ||
57 | + if expr "$link" : '/.*' > /dev/null; then | ||
58 | + PRG="$link" | ||
59 | + else | ||
60 | + PRG=`dirname "$PRG"`"/$link" | ||
61 | + fi | ||
62 | +done | ||
63 | +SAVED="`pwd`" | ||
64 | +cd "`dirname \"$PRG\"`/" >&- | ||
65 | +APP_HOME="`pwd -P`" | ||
66 | +cd "$SAVED" >&- | ||
67 | + | ||
68 | +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | ||
69 | + | ||
70 | +# Determine the Java command to use to start the JVM. | ||
71 | +if [ -n "$JAVA_HOME" ] ; then | ||
72 | + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | ||
73 | + # IBM's JDK on AIX uses strange locations for the executables | ||
74 | + JAVACMD="$JAVA_HOME/jre/sh/java" | ||
75 | + else | ||
76 | + JAVACMD="$JAVA_HOME/bin/java" | ||
77 | + fi | ||
78 | + if [ ! -x "$JAVACMD" ] ; then | ||
79 | + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | ||
80 | + | ||
81 | +Please set the JAVA_HOME variable in your environment to match the | ||
82 | +location of your Java installation." | ||
83 | + fi | ||
84 | +else | ||
85 | + JAVACMD="java" | ||
86 | + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||
87 | + | ||
88 | +Please set the JAVA_HOME variable in your environment to match the | ||
89 | +location of your Java installation." | ||
90 | +fi | ||
91 | + | ||
92 | +# Increase the maximum file descriptors if we can. | ||
93 | +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then | ||
94 | + MAX_FD_LIMIT=`ulimit -H -n` | ||
95 | + if [ $? -eq 0 ] ; then | ||
96 | + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then | ||
97 | + MAX_FD="$MAX_FD_LIMIT" | ||
98 | + fi | ||
99 | + ulimit -n $MAX_FD | ||
100 | + if [ $? -ne 0 ] ; then | ||
101 | + warn "Could not set maximum file descriptor limit: $MAX_FD" | ||
102 | + fi | ||
103 | + else | ||
104 | + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" | ||
105 | + fi | ||
106 | +fi | ||
107 | + | ||
108 | +# For Darwin, add options to specify how the application appears in the dock | ||
109 | +if $darwin; then | ||
110 | + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" | ||
111 | +fi | ||
112 | + | ||
113 | +# For Cygwin, switch paths to Windows format before running java | ||
114 | +if $cygwin ; then | ||
115 | + APP_HOME=`cygpath --path --mixed "$APP_HOME"` | ||
116 | + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` | ||
117 | + | ||
118 | + # We build the pattern for arguments to be converted via cygpath | ||
119 | + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` | ||
120 | + SEP="" | ||
121 | + for dir in $ROOTDIRSRAW ; do | ||
122 | + ROOTDIRS="$ROOTDIRS$SEP$dir" | ||
123 | + SEP="|" | ||
124 | + done | ||
125 | + OURCYGPATTERN="(^($ROOTDIRS))" | ||
126 | + # Add a user-defined pattern to the cygpath arguments | ||
127 | + if [ "$GRADLE_CYGPATTERN" != "" ] ; then | ||
128 | + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" | ||
129 | + fi | ||
130 | + # Now convert the arguments - kludge to limit ourselves to /bin/sh | ||
131 | + i=0 | ||
132 | + for arg in "$@" ; do | ||
133 | + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` | ||
134 | + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option | ||
135 | + | ||
136 | + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition | ||
137 | + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` | ||
138 | + else | ||
139 | + eval `echo args$i`="\"$arg\"" | ||
140 | + fi | ||
141 | + i=$((i+1)) | ||
142 | + done | ||
143 | + case $i in | ||
144 | + (0) set -- ;; | ||
145 | + (1) set -- "$args0" ;; | ||
146 | + (2) set -- "$args0" "$args1" ;; | ||
147 | + (3) set -- "$args0" "$args1" "$args2" ;; | ||
148 | + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; | ||
149 | + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; | ||
150 | + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; | ||
151 | + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; | ||
152 | + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; | ||
153 | + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; | ||
154 | + esac | ||
155 | +fi | ||
156 | + | ||
157 | +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules | ||
158 | +function splitJvmOpts() { | ||
159 | + JVM_OPTS=("$@") | ||
160 | +} | ||
161 | +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS | ||
162 | +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" | ||
163 | + | ||
164 | +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" |
android/gradlew.bat
0 → 100644
1 | +++ a/android/gradlew.bat | ||
1 | +@if "%DEBUG%" == "" @echo off | ||
2 | +@rem ########################################################################## | ||
3 | +@rem | ||
4 | +@rem Gradle startup script for Windows | ||
5 | +@rem | ||
6 | +@rem ########################################################################## | ||
7 | + | ||
8 | +@rem Set local scope for the variables with windows NT shell | ||
9 | +if "%OS%"=="Windows_NT" setlocal | ||
10 | + | ||
11 | +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
12 | +set DEFAULT_JVM_OPTS= | ||
13 | + | ||
14 | +set DIRNAME=%~dp0 | ||
15 | +if "%DIRNAME%" == "" set DIRNAME=. | ||
16 | +set APP_BASE_NAME=%~n0 | ||
17 | +set APP_HOME=%DIRNAME% | ||
18 | + | ||
19 | +@rem Find java.exe | ||
20 | +if defined JAVA_HOME goto findJavaFromJavaHome | ||
21 | + | ||
22 | +set JAVA_EXE=java.exe | ||
23 | +%JAVA_EXE% -version >NUL 2>&1 | ||
24 | +if "%ERRORLEVEL%" == "0" goto init | ||
25 | + | ||
26 | +echo. | ||
27 | +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||
28 | +echo. | ||
29 | +echo Please set the JAVA_HOME variable in your environment to match the | ||
30 | +echo location of your Java installation. | ||
31 | + | ||
32 | +goto fail | ||
33 | + | ||
34 | +:findJavaFromJavaHome | ||
35 | +set JAVA_HOME=%JAVA_HOME:"=% | ||
36 | +set JAVA_EXE=%JAVA_HOME%/bin/java.exe | ||
37 | + | ||
38 | +if exist "%JAVA_EXE%" goto init | ||
39 | + | ||
40 | +echo. | ||
41 | +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | ||
42 | +echo. | ||
43 | +echo Please set the JAVA_HOME variable in your environment to match the | ||
44 | +echo location of your Java installation. | ||
45 | + | ||
46 | +goto fail | ||
47 | + | ||
48 | +:init | ||
49 | +@rem Get command-line arguments, handling Windowz variants | ||
50 | + | ||
51 | +if not "%OS%" == "Windows_NT" goto win9xME_args | ||
52 | +if "%@eval[2+2]" == "4" goto 4NT_args | ||
53 | + | ||
54 | +:win9xME_args | ||
55 | +@rem Slurp the command line arguments. | ||
56 | +set CMD_LINE_ARGS= | ||
57 | +set _SKIP=2 | ||
58 | + | ||
59 | +:win9xME_args_slurp | ||
60 | +if "x%~1" == "x" goto execute | ||
61 | + | ||
62 | +set CMD_LINE_ARGS=%* | ||
63 | +goto execute | ||
64 | + | ||
65 | +:4NT_args | ||
66 | +@rem Get arguments from the 4NT Shell from JP Software | ||
67 | +set CMD_LINE_ARGS=%$ | ||
68 | + | ||
69 | +:execute | ||
70 | +@rem Setup the command line | ||
71 | + | ||
72 | +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | ||
73 | + | ||
74 | +@rem Execute Gradle | ||
75 | +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% | ||
76 | + | ||
77 | +:end | ||
78 | +@rem End local scope for the variables with windows NT shell | ||
79 | +if "%ERRORLEVEL%"=="0" goto mainEnd | ||
80 | + | ||
81 | +:fail | ||
82 | +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | ||
83 | +rem the _cmd.exe /c_ return code! | ||
84 | +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 | ||
85 | +exit /b 1 | ||
86 | + | ||
87 | +:mainEnd | ||
88 | +if "%OS%"=="Windows_NT" endlocal | ||
89 | + | ||
90 | +:omega |
android/res/drawable-hdpi/icon.png
0 → 100644
16.8 KB
android/res/drawable-hdpi/splash.png
0 → 100644
16.8 KB
android/res/drawable-ldpi/icon.png
0 → 100644
16.8 KB
android/res/drawable-ldpi/splash.png
0 → 100644
16.8 KB
android/res/drawable-mdpi/icon.png
0 → 100644
16.8 KB
android/res/drawable-mdpi/splash.png
0 → 100644
16.8 KB
android/res/values/libs.xml
0 → 100644
1 | +++ a/android/res/values/libs.xml | ||
1 | +<?xml version='1.0' encoding='utf-8'?> | ||
2 | +<resources> | ||
3 | + <array name="qt_sources"> | ||
4 | + <item>https://download.qt-project.org/ministro/android/qt5/qt-5.4</item> | ||
5 | + </array> | ||
6 | + | ||
7 | + <!-- The following is handled automatically by the deployment tool. It should | ||
8 | + not be edited manually. --> | ||
9 | + | ||
10 | + <array name="bundled_libs"> | ||
11 | + <!-- %%INSERT_EXTRA_LIBS%% --> | ||
12 | + </array> | ||
13 | + | ||
14 | + <array name="qt_libs"> | ||
15 | + <!-- %%INSERT_QT_LIBS%% --> | ||
16 | + </array> | ||
17 | + | ||
18 | + <array name="bundled_in_lib"> | ||
19 | + <!-- %%INSERT_BUNDLED_IN_LIB%% --> | ||
20 | + </array> | ||
21 | + <array name="bundled_in_assets"> | ||
22 | + <!-- %%INSERT_BUNDLED_IN_ASSETS%% --> | ||
23 | + </array> | ||
24 | + | ||
25 | +</resources> |
camerasurface.cpp
0 → 100644
1 | +++ a/camerasurface.cpp | ||
1 | +#include "camerasurface.h" | ||
2 | + | ||
3 | +QList<QVideoFrame::PixelFormat> CameraSurface::supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const | ||
4 | +{ | ||
5 | + return QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_RGB32; | ||
6 | +} | ||
7 | + | ||
8 | +bool CameraSurface::present(const QVideoFrame &frame) | ||
9 | +{ | ||
10 | + if (frame.isValid()) { | ||
11 | + QVideoFrame cloneFrame(frame); | ||
12 | + cloneFrame.map(QAbstractVideoBuffer::ReadOnly); | ||
13 | + | ||
14 | + QByteArray ba; | ||
15 | + ba.append( (char*)cloneFrame.bits(), cloneFrame.bytesPerLine() * cloneFrame.height() ); | ||
16 | + | ||
17 | + emit novoFrame( ba, cloneFrame.width(), cloneFrame.height() ); | ||
18 | + | ||
19 | + cloneFrame.unmap(); | ||
20 | + return true; | ||
21 | + } | ||
22 | + return false; | ||
23 | +} |
camerasurface.h
0 → 100644
1 | +++ a/camerasurface.h | ||
1 | +#ifndef CAMERASURFACE_H | ||
2 | +#define CAMERASURFACE_H | ||
3 | + | ||
4 | +#include <QAbstractVideoSurface> | ||
5 | + | ||
6 | +class CameraSurface : public QAbstractVideoSurface | ||
7 | +{ | ||
8 | + Q_OBJECT | ||
9 | + public: | ||
10 | + explicit CameraSurface(QObject *parent = 0) : QAbstractVideoSurface(parent){} | ||
11 | + //~CameraSurface(); | ||
12 | + QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const; | ||
13 | + bool present(const QVideoFrame &frame); | ||
14 | + | ||
15 | + signals: | ||
16 | + void novoFrame(QByteArray &buf, int w, int h); | ||
17 | +}; | ||
18 | + | ||
19 | +#endif // CAMERASURFACE_H |
camerawindow.cpp
0 → 100644
1 | +++ a/camerawindow.cpp | ||
1 | +#include "camerawindow.h" | ||
2 | +#include "ui_camerawindow.h" | ||
3 | + | ||
4 | +CameraWindow::CameraWindow(QWidget *parent) : | ||
5 | + QMainWindow(parent), | ||
6 | + ui(new Ui::CameraWindow), | ||
7 | + hasResolution(false) | ||
8 | +{ | ||
9 | + ui->setupUi(this); | ||
10 | + | ||
11 | + cameraSurface = new CameraSurface(); | ||
12 | + camera = new QCamera(); | ||
13 | + capture = new QCameraImageCapture( camera ); | ||
14 | + camera->setViewfinder(cameraSurface); | ||
15 | + camera->setCaptureMode(QCamera::CaptureStillImage); | ||
16 | + camera->start(); | ||
17 | + | ||
18 | + zxing = new QZXing( QZXing::DecoderFormat_QR_CODE, this ); | ||
19 | + //connect(zxing, SIGNAL(tagFound(QString)), this, SLOT(show_result(QString))); | ||
20 | + | ||
21 | + connect(cameraSurface, SIGNAL(novoFrame(QByteArray&,int,int)), this, SLOT(frameHandler(QByteArray&,int,int))); | ||
22 | +} | ||
23 | + | ||
24 | +CameraWindow::~CameraWindow() | ||
25 | +{ | ||
26 | + delete ui; | ||
27 | + delete cameraSurface; | ||
28 | + delete camera; | ||
29 | + delete capture; | ||
30 | + delete viewfinder; | ||
31 | + delete zxing; | ||
32 | + delete img; | ||
33 | + delete buffer; | ||
34 | +} | ||
35 | + | ||
36 | +void CameraWindow::frameHandler(QByteArray &buff, int w, int h) | ||
37 | +{ | ||
38 | + if (!hasResolution) { | ||
39 | + img = new QImage( w, h, QImage::Format_RGB32 ); | ||
40 | + hasResolution = true; | ||
41 | + } | ||
42 | + | ||
43 | + u_int32_t* data = (u_int32_t*)buff.data(); | ||
44 | + for(int y = 0; y < h; ++y) { | ||
45 | + QRgb* scan = (QRgb*)img->scanLine(y); | ||
46 | + | ||
47 | + for(int x = 0; x < w; ++x) { | ||
48 | + scan[x] = data[y * w + x]; | ||
49 | + } | ||
50 | + } | ||
51 | + | ||
52 | + zxing->decodeImage( *img, w, h, true ); | ||
53 | + | ||
54 | + QImage imgTmp = img->scaled(w*.30, h*.30); | ||
55 | + //ui->label->setPixmap(QPixmap::fromImage(imgTmp)); | ||
56 | + buff.clear(); | ||
57 | +} |
camerawindow.h
0 → 100644
1 | +++ a/camerawindow.h | ||
1 | +#ifndef CAMERAWINDOW_H | ||
2 | +#define CAMERAWINDOW_H | ||
3 | + | ||
4 | +#include <QMainWindow> | ||
5 | +#include <QCamera> | ||
6 | +#include <QCameraImageCapture> | ||
7 | +#include <QCameraViewfinder> | ||
8 | +#include <QZXing.h> | ||
9 | +#include "camerasurface.h" | ||
10 | + | ||
11 | +namespace Ui { | ||
12 | +class CameraWindow; | ||
13 | +} | ||
14 | + | ||
15 | +class CameraWindow : public QMainWindow | ||
16 | +{ | ||
17 | + Q_OBJECT | ||
18 | + private: | ||
19 | + Ui::CameraWindow *ui; | ||
20 | + QCamera * camera; | ||
21 | + QCameraImageCapture * capture; | ||
22 | + QCameraViewfinder *viewfinder; | ||
23 | + CameraSurface *cameraSurface; | ||
24 | + QZXing *zxing; | ||
25 | + QImage *img; | ||
26 | + u_int8_t * buffer; | ||
27 | + bool hasResolution; | ||
28 | + | ||
29 | + public: | ||
30 | + explicit CameraWindow(QWidget *parent = 0); | ||
31 | + ~CameraWindow(); | ||
32 | + | ||
33 | + public slots: | ||
34 | + void frameHandler(QByteArray&,int,int); | ||
35 | +}; | ||
36 | + | ||
37 | +#endif // CAMERAWINDOW_H |
camerawindow.ui
0 → 100644
1 | +++ a/camerawindow.ui | ||
1 | +<ui version="4.0"> | ||
2 | + <author/> | ||
3 | + <comment/> | ||
4 | + <exportmacro/> | ||
5 | + <class>CameraWindow</class> | ||
6 | + <widget class="QMainWindow" name="CameraWindow"> | ||
7 | + <property name="geometry"> | ||
8 | + <rect> | ||
9 | + <x>0</x> | ||
10 | + <y>0</y> | ||
11 | + <width>800</width> | ||
12 | + <height>600</height> | ||
13 | + </rect> | ||
14 | + </property> | ||
15 | + <property name="windowTitle"> | ||
16 | + <string>MainWindow</string> | ||
17 | + </property> | ||
18 | + <widget class="QMenuBar" name="menubar"/> | ||
19 | + <widget class="QWidget" name="centralwidget"/> | ||
20 | + <widget class="QStatusBar" name="statusbar"/> | ||
21 | + </widget> | ||
22 | + <pixmapfunction/> | ||
23 | + <connections/> | ||
24 | +</ui> |
funifier.pro
0 → 100644
1 | +++ a/funifier.pro | ||
1 | +#------------------------------------------------- | ||
2 | +# | ||
3 | +# Project created by QtCreator 2015-06-23T12:39:33 | ||
4 | +# | ||
5 | +#------------------------------------------------- | ||
6 | + | ||
7 | +QT += core gui multimedia multimediawidgets | ||
8 | + | ||
9 | +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
10 | + | ||
11 | +TARGET = funifier | ||
12 | +TEMPLATE = app | ||
13 | + | ||
14 | +include(../QZXing/QZXing.pri) | ||
15 | + | ||
16 | +SOURCES += main.cpp\ | ||
17 | + mainwindow.cpp \ | ||
18 | + camerasurface.cpp \ | ||
19 | + camerawindow.cpp | ||
20 | + | ||
21 | +HEADERS += mainwindow.h \ | ||
22 | + camerasurface.h \ | ||
23 | + camerawindow.h | ||
24 | + | ||
25 | +FORMS += mainwindow.ui \ | ||
26 | + camerawindow.ui | ||
27 | + | ||
28 | +CONFIG += mobility | ||
29 | +MOBILITY = | ||
30 | + | ||
31 | +DISTFILES += \ | ||
32 | + android/AndroidManifest.xml \ | ||
33 | + android/gradle/wrapper/gradle-wrapper.jar \ | ||
34 | + android/gradlew \ | ||
35 | + android/res/values/libs.xml \ | ||
36 | + android/build.gradle \ | ||
37 | + android/gradle/wrapper/gradle-wrapper.properties \ | ||
38 | + android/gradlew.bat | ||
39 | + | ||
40 | +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android | ||
41 | + |
images/funifier-logo.png
0 → 100644
16.8 KB
images/theme/develop/pencil.png
0 → 100644
8.68 KB
images/theme/develop/plus.png
0 → 100644
54.7 KB
images/Índice.jpeg
0 → 100644
5.64 KB
main.cpp
0 → 100644
mainwindow.cpp
0 → 100644
1 | +++ a/mainwindow.cpp | ||
1 | +#include "mainwindow.h" | ||
2 | +#include "ui_mainwindow.h" | ||
3 | + | ||
4 | +MainWindow::MainWindow(QWidget *parent) : | ||
5 | + QMainWindow(parent), | ||
6 | + ui(new Ui::MainWindow) | ||
7 | +{ | ||
8 | + ui->setupUi(this); | ||
9 | + | ||
10 | + connect(ui->pushButton, SIGNAL(clicked(bool)), this, SLOT(addGame())); | ||
11 | +} | ||
12 | + | ||
13 | +MainWindow::~MainWindow() | ||
14 | +{ | ||
15 | + delete ui; | ||
16 | + delete cameraWindow; | ||
17 | +} | ||
18 | + | ||
19 | +void MainWindow::addGame() | ||
20 | +{ | ||
21 | + CameraWindow * cameraWindow = new CameraWindow(); | ||
22 | + cameraWindow->show(); | ||
23 | + //hide(); | ||
24 | +} |
mainwindow.h
0 → 100644
1 | +++ a/mainwindow.h | ||
1 | +#ifndef MAINWINDOW_H | ||
2 | +#define MAINWINDOW_H | ||
3 | + | ||
4 | +#include <QMainWindow> | ||
5 | +#include "camerawindow.h" | ||
6 | + | ||
7 | +namespace Ui { | ||
8 | + class MainWindow; | ||
9 | +} | ||
10 | + | ||
11 | +class MainWindow : public QMainWindow | ||
12 | +{ | ||
13 | + Q_OBJECT | ||
14 | + private: | ||
15 | + Ui::MainWindow *ui; | ||
16 | + CameraWindow *cameraWindow; | ||
17 | + public: | ||
18 | + explicit MainWindow(QWidget *parent = 0); | ||
19 | + ~MainWindow(); | ||
20 | + public slots: | ||
21 | + void addGame(); | ||
22 | +}; | ||
23 | + | ||
24 | +#endif // MAINWINDOW_H |
mainwindow.ui
0 → 100644
1 | +++ a/mainwindow.ui | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<ui version="4.0"> | ||
3 | + <class>MainWindow</class> | ||
4 | + <widget class="QMainWindow" name="MainWindow"> | ||
5 | + <property name="geometry"> | ||
6 | + <rect> | ||
7 | + <x>0</x> | ||
8 | + <y>0</y> | ||
9 | + <width>313</width> | ||
10 | + <height>365</height> | ||
11 | + </rect> | ||
12 | + </property> | ||
13 | + <property name="windowTitle"> | ||
14 | + <string>Funifier</string> | ||
15 | + </property> | ||
16 | + <widget class="QWidget" name="centralWidget"> | ||
17 | + <layout class="QGridLayout" name="gridLayout_2"> | ||
18 | + <item row="0" column="0"> | ||
19 | + <layout class="QGridLayout" name="gridLayout"> | ||
20 | + <item row="0" column="1"> | ||
21 | + <spacer name="verticalSpacer"> | ||
22 | + <property name="orientation"> | ||
23 | + <enum>Qt::Vertical</enum> | ||
24 | + </property> | ||
25 | + <property name="sizeHint" stdset="0"> | ||
26 | + <size> | ||
27 | + <width>20</width> | ||
28 | + <height>40</height> | ||
29 | + </size> | ||
30 | + </property> | ||
31 | + </spacer> | ||
32 | + </item> | ||
33 | + <item row="2" column="2"> | ||
34 | + <widget class="QPushButton" name="pushButton"> | ||
35 | + <property name="text"> | ||
36 | + <string>Add</string> | ||
37 | + </property> | ||
38 | + </widget> | ||
39 | + </item> | ||
40 | + <item row="2" column="1"> | ||
41 | + <spacer name="horizontalSpacer"> | ||
42 | + <property name="orientation"> | ||
43 | + <enum>Qt::Horizontal</enum> | ||
44 | + </property> | ||
45 | + <property name="sizeHint" stdset="0"> | ||
46 | + <size> | ||
47 | + <width>40</width> | ||
48 | + <height>20</height> | ||
49 | + </size> | ||
50 | + </property> | ||
51 | + </spacer> | ||
52 | + </item> | ||
53 | + </layout> | ||
54 | + </item> | ||
55 | + </layout> | ||
56 | + </widget> | ||
57 | + </widget> | ||
58 | + <layoutdefault spacing="6" margin="11"/> | ||
59 | + <resources/> | ||
60 | + <connections/> | ||
61 | +</ui> |