This commit is contained in:
Zira project 2020-09-19 21:49:44 +05:00
commit 2adff3ecf3
40 changed files with 1908 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
DevPack.pro.user

69
DevPack.pro Normal file
View File

@ -0,0 +1,69 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
equals(QT_MAJOR_VERSION, 5): lessThan(QT_MINOR_VERSION, 13) {
DISTFILES += \
android/Qt5_12/AndroidManifest.xml \
android/Qt5_12/build.gradle \
android/Qt5_12/gradle/wrapper/gradle-wrapper.jar \
android/Qt5_12/gradle/wrapper/gradle-wrapper.properties \
android/Qt5_12/gradlew \
android/Qt5_12/gradlew.bat \
android/Qt5_12/res/values/libs.xml
contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
ANDROID_PACKAGE_SOURCE_DIR = \
$$PWD/android/Qt5_12
}
contains(ANDROID_TARGET_ARCH,arm64-v8a) {
ANDROID_PACKAGE_SOURCE_DIR = \
$$PWD/android/Qt5_12
}
}
equals(QT_MAJOR_VERSION, 5): greaterThan(QT_MINOR_VERSION, 12) {
DISTFILES += \
android/Qt5_14/AndroidManifest.xml \
android/Qt5_14/build.gradle \
android/Qt5_14/gradle/wrapper/gradle-wrapper.jar \
android/Qt5_14/gradle/wrapper/gradle-wrapper.properties \
android/Qt5_14/gradlew \
android/Qt5_14/gradlew.bat \
android/Qt5_14/res/values/libs.xml
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android/Qt5_14
}
RESOURCES += \
qrc/images.qrc \
qrc/styles.qrc

View File

@ -0,0 +1,89 @@
<?xml version="1.0"?>
<manifest package="com.github.ziracms.devpack" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.0.2-android16-armv8a" android:versionCode="8" android:installLocation="auto">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<!-- %%INSERT_PERMISSIONS -->
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
Remove the comment if you do not require these default features. -->
<!-- %%INSERT_FEATURES -->
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Zira DevPack" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="Zira DevPack" android:screenOrientation="unspecified" android:launchMode="singleTop" android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Application arguments -->
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
<!-- Application arguments -->
<meta-data android:name="android.app.lib_name" android:value="DevPack"/>
<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"/>
<!-- 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.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.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%% --"/>
<!-- Used to specify custom system library path to run with local system libs -->
<!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
<!-- Messages maps -->
<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"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
<!-- Messages maps -->
<!-- Splash screen -->
<!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation,
then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and
use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you
are done populating your window with content. -->
<!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / -->
<!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / -->
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash_center"/>
<!-- Splash screen -->
<!-- Background running -->
<!-- Warning: changing this value to true may cause unexpected crashes if the
application still try to draw after
"applicationStateChanged(Qt::ApplicationSuspended)"
signal is sent! -->
<meta-data android:name="android.app.background_running" android:value="false"/>
<!-- Background running -->
<!-- auto screen scale factor -->
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
<!-- auto screen scale factor -->
<!-- extract android style -->
<!-- available android:values :
* default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons
* full - useful QWidget & Quick Controls 1 apps
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
* none - useful for apps that don't use any of the above Qt modules
-->
<meta-data android:name="android.app.extract_android_style" android:value="default"/>
<!-- extract android style -->
</activity>
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
</application>
</manifest>

View File

@ -0,0 +1,57 @@
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
repositories {
google()
jcenter()
}
apply plugin: 'com.android.application'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
}
android {
/*******************************************************
* The following variables:
* - androidBuildToolsVersion,
* - androidCompileSdkVersion
* - qt5AndroidDir - holds the path to qt android files
* needed to build any Qt application
* on Android.
*
* are defined in gradle.properties file. This file is
* updated by QtCreator and androiddeployqt tools.
* Changing them manually might break the compilation!
*******************************************************/
compileSdkVersion androidCompileSdkVersion.toInteger()
buildToolsVersion '28.0.3'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
res.srcDirs = [qt5AndroidDir + '/res', 'res']
resources.srcDirs = ['src']
renderscript.srcDirs = ['src']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
lintOptions {
abortOnError false
}
}

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

172
android/Qt5_12/gradlew vendored Executable file
View File

@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
android/Qt5_12/gradlew.bat vendored Normal file
View File

@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/background" >
<shape android:shape="rectangle">
<solid android:color="@color/bg_color"/>
</shape>
</item>
<item android:id="@+id/item_img">
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splash"
android:gravity="center"/>
</item>
</layer-list>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bg_color">#40a675</color>
<style name="AppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="android:windowBackground">@color/bg_color</item>
</style>
</resources>

View File

@ -0,0 +1,25 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<array name="qt_sources">
<item>https://download.qt.io/ministro/android/qt5/qt-5.9</item>
</array>
<!-- The following is handled automatically by the deployment tool. It should
not be edited manually. -->
<array name="bundled_libs">
<!-- %%INSERT_EXTRA_LIBS%% -->
</array>
<array name="qt_libs">
<!-- %%INSERT_QT_LIBS%% -->
</array>
<array name="bundled_in_lib">
<!-- %%INSERT_BUNDLED_IN_LIB%% -->
</array>
<array name="bundled_in_assets">
<!-- %%INSERT_BUNDLED_IN_ASSETS%% -->
</array>
</resources>

View File

@ -0,0 +1,88 @@
<?xml version="1.0"?>
<manifest package="com.github.ziracms.devpack" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.0.2-android21-x86-64" android:versionCode="12" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<!-- %%INSERT_PERMISSIONS -->
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
Remove the comment if you do not require these default features. -->
<!-- %%INSERT_FEATURES -->
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Zira DevPack" android:extractNativeLibs="true" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="Zira DevPack" android:screenOrientation="unspecified" android:launchMode="singleTop" android:theme="@style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Application arguments -->
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
<!-- Application arguments -->
<meta-data android:name="android.app.lib_name" android:value="DevPack"/>
<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"/>
<!-- Deploy Qt libs as part of package -->
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
<!-- 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.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_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%% --"/>
<!-- Used to specify custom system library path to run with local system libs -->
<!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
<!-- Messages maps -->
<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"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
<!-- Messages maps -->
<!-- Splash screen -->
<!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation,
then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and
use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you
are done populating your window with content. -->
<!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / -->
<!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / -->
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash_center"/>
<!-- Splash screen -->
<!-- Background running -->
<!-- Warning: changing this value to true may cause unexpected crashes if the
application still try to draw after
"applicationStateChanged(Qt::ApplicationSuspended)"
signal is sent! -->
<meta-data android:name="android.app.background_running" android:value="false"/>
<!-- Background running -->
<!-- auto screen scale factor -->
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
<!-- auto screen scale factor -->
<!-- extract android style -->
<!-- available android:values :
* default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons
* full - useful QWidget & Quick Controls 1 apps
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
* none - useful for apps that don't use any of the above Qt modules
-->
<meta-data android:name="android.app.extract_android_style" android:value="default"/>
<!-- extract android style -->
</activity>
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
</application>
</manifest>

View File

@ -0,0 +1,66 @@
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
repositories {
google()
jcenter()
}
apply plugin: 'com.android.application'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
}
android {
/*******************************************************
* The following variables:
* - androidBuildToolsVersion,
* - androidCompileSdkVersion
* - qt5AndroidDir - holds the path to qt android files
* needed to build any Qt application
* on Android.
*
* are defined in gradle.properties file. This file is
* updated by QtCreator and androiddeployqt tools.
* Changing them manually might break the compilation!
*******************************************************/
compileSdkVersion androidCompileSdkVersion.toInteger()
buildToolsVersion '28.0.3'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
res.srcDirs = [qt5AndroidDir + '/res', 'res']
resources.srcDirs = ['resources']
renderscript.srcDirs = ['src']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
lintOptions {
abortOnError false
}
// Do not compress Qt binary resources file
aaptOptions {
noCompress 'rcc'
}
defaultConfig {
resConfigs "en"
}
}

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

172
android/Qt5_14/gradlew vendored Executable file
View File

@ -0,0 +1,172 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
android/Qt5_14/gradlew.bat vendored Normal file
View File

@ -0,0 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/background" >
<shape android:shape="rectangle">
<solid android:color="@color/bg_color"/>
</shape>
</item>
<item android:id="@+id/item_img">
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splash"
android:gravity="center"/>
</item>
</layer-list>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="bg_color">#40a675</color>
<style name="AppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="android:windowBackground">@color/bg_color</item>
</style>
</resources>

View File

@ -0,0 +1,22 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<array name="qt_sources">
<item>https://download.qt.io/ministro/android/qt5/qt-5.14</item>
</array>
<!-- The following is handled automatically by the deployment tool. It should
not be edited manually. -->
<array name="bundled_libs">
<!-- %%INSERT_EXTRA_LIBS%% -->
</array>
<array name="qt_libs">
<!-- %%INSERT_QT_LIBS%% -->
</array>
<array name="load_local_libs">
<!-- %%INSERT_LOCAL_LIBS%% -->
</array>
</resources>

14
main.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}

497
mainwindow.cpp Normal file
View File

@ -0,0 +1,497 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QStandardPaths>
#include <QFile>
#include <QDir>
#include <QProcess>
#include <QMessageBox>
#include <QClipboard>
#include <QTextStream>
const QString PHP_TMP_DIR = "tmp";
const QString BIN_DIR = "bin";
const QString GIT_CORE_DIR = "git-core";
const QString GIT_TEMPLATES_DIR = "templates";
const QString TERMINFO_DIR = "terminfo";
const QString MC_DIR = "mc";
const QString MC_THEMES_SUBDIR = "skins";
const QString MC_SYNTAX_SUBDIR = "syntax";
const QString APP_DATA_HOME = "/data/data/com.github.ziracms.devpack/files";
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
QStringList stddirs = QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
if (stddirs.size()>0) dataDir = stddirs.at(0);
else dataDir = "";
binFiles << "php" << "sqlite3" << "git" << "git-receive-pack" << "git-upload-archive" << "git-upload-pack" << "sassc" << "nano" << "mc" << "vim" << "termux-elf-cleaner";
gitFiles << "git" << "git-remote" << "git-remote-http" << "git-remote-https" << "git-receive-pack" << "git-upload-archive" << "git-upload-pack";
termFiles << "linux" << "screen" << "screen-256color" << "vt100" << "xterm" << "cygwin";
mcFiles << "filehighlight.ini" << "mc.charsets";
mcThemeFiles << "default.ini" << "standard.ini";
mcSyntaxFiles << "Syntax" << "unknown.syntax";
otherFiles << "php.ini" << "gitconfig" << "cacert.pem" << "nanorc";
if (!isPackInstalled()) {
ui->checkButton->hide();
ui->uninstallButton->hide();
ui->infoButton->hide();
ui->envLabel->hide();
ui->envTextEdit->hide();
ui->copyButton->hide();
} else {
ui->installButton->hide();
}
ui->versionsLabel->hide();
ui->envTextEdit->setText(
"export ZIRA_HOME=\""+APP_DATA_HOME+"\"\n" +
"export PATH=\"$ZIRA_HOME/"+BIN_DIR+":$PATH\"\n" +
"export TERMINFO=\"$ZIRA_HOME/"+TERMINFO_DIR+"\"\n" +
"export TERM=\"linux\"\n" +
"export LC_CTYPE=\"en_US.UTF-8\"\n" +
"cd ~"
);
connect(ui->installButton, SIGNAL(clicked(bool)), this, SLOT(installButtonClicked(bool)));
connect(ui->uninstallButton, SIGNAL(clicked(bool)), this, SLOT(uninstallButtonClicked(bool)));
connect(ui->checkButton, SIGNAL(clicked(bool)), this, SLOT(checkButtonClicked(bool)));
connect(ui->infoButton, SIGNAL(clicked(bool)), this, SLOT(infoButtonClicked(bool)));
connect(ui->copyButton, SIGNAL(clicked(bool)), this, SLOT(copyPathClicked(bool)));
applyStyle();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::installButtonClicked(bool)
{
QString installButtonText = ui->installButton->text();
ui->installButton->setText(tr("Please wait")+"...");
ui->installButton->repaint();
QApplication::processEvents();
if (!installPack(true)) {
QMessageBox msgBox(this);
msgBox.setWindowTitle(QObject::tr("Error"));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText("Installation failed :(");
msgBox.exec();
} else {
QSize size = geometry().size();
ui->installButton->hide();
ui->checkButton->show();
ui->infoButton->show();
ui->uninstallButton->show();
ui->envLabel->show();
ui->envTextEdit->show();
ui->copyButton->show();
setFixedSize(size);
/*
QMessageBox msgBox(this);
msgBox.setWindowTitle(QObject::tr("Success"));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText("Installation completed :)");
msgBox.exec();
*/
}
ui->installButton->setText(installButtonText);
}
void MainWindow::uninstallButtonClicked(bool)
{
if (QMessageBox::question(this, tr("Confirmation"), tr("Uninstall pack ?"), QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok) return;
QString uninstallButtonText = ui->uninstallButton->text();
ui->uninstallButton->setText(tr("Please wait")+"...");
ui->uninstallButton->repaint();
QApplication::processEvents();
if (!uninstallPack()) {
QMessageBox msgBox(this);
msgBox.setWindowTitle(QObject::tr("Error"));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText("An error occurred :(");
msgBox.exec();
} else {
QSize size = geometry().size();
ui->checkButton->hide();
ui->infoButton->hide();
ui->uninstallButton->hide();
ui->envLabel->hide();
ui->envTextEdit->hide();
ui->copyButton->hide();
ui->installButton->show();
if (ui->versionsLabel->isVisible()) {
ui->versionsLabel->hide();
}
if (!ui->ziraLabel->isVisible()){
ui->ziraLabel->show();
}
setFixedSize(size);
/*
QMessageBox msgBox(this);
msgBox.setWindowTitle(QObject::tr("Success"));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText("Uninstalled successfully :)");
msgBox.exec();
*/
}
ui->uninstallButton->setText(uninstallButtonText);
}
void MainWindow::showVersionsLabel()
{
if (ui->versionsLabel->isVisible()) return;
ui->versionsLabel->show();
ui->ziraLabel->hide();
}
void MainWindow::checkButtonClicked(bool)
{
QSize size = geometry().size();
showVersionsLabel();
ui->envLabel->show();
ui->envTextEdit->show();
ui->copyButton->show();
showVersions();
setFixedSize(size);
}
void MainWindow::infoButtonClicked(bool)
{
QSize size = geometry().size();
showVersionsLabel();
ui->envLabel->hide();
ui->envTextEdit->hide();
ui->copyButton->hide();
showPHPInfo();
setFixedSize(size);
}
bool MainWindow::installPack(bool cleanELF)
{
if (dataDir.size() == 0) return false;
QFile f(dataDir);
setPermissions(f);
QFileInfo di(dataDir);
if (!di.isWritable() || !di.isExecutable()) return false;
QDir d(dataDir);
if (!createDirectory(d, dataDir+"/"+BIN_DIR)) return false;
if (!createDirectory(d, dataDir+"/"+BIN_DIR+"/"+GIT_CORE_DIR)) return false;
if (!createDirectory(d, dataDir+"/"+GIT_TEMPLATES_DIR)) return false;
if (!createDirectory(d, dataDir+"/"+PHP_TMP_DIR)) return false;
if (!createDirectory(d, dataDir+"/"+TERMINFO_DIR)) return false;
if (!createDirectory(d, dataDir+"/"+MC_DIR)) return false;
if (!createDirectory(d, dataDir+"/"+MC_DIR+"/"+MC_THEMES_SUBDIR)) return false;
if (!createDirectory(d, dataDir+"/"+MC_DIR+"/"+MC_SYNTAX_SUBDIR)) return false;
for (QString fileName : binFiles) {
if (!installBinaryFile(fileName, dataDir+"/"+BIN_DIR)) return false;
}
for (QString fileName : gitFiles) {
if (!installBinaryFile(fileName, dataDir+"/"+BIN_DIR+"/"+GIT_CORE_DIR)) return false;
}
for (QString fileName : termFiles) {
if (fileName.size() == 0) continue;
QChar c = fileName.at(0);
if (!createDirectory(d, dataDir+"/"+TERMINFO_DIR+"/"+c)) return false;
if (!installBinaryFile(fileName, dataDir+"/"+TERMINFO_DIR+"/"+c)) return false;
}
for (QString fileName : mcFiles) {
if (!installBinaryFile(fileName, dataDir+"/"+MC_DIR)) return false;
}
for (QString fileName : mcThemeFiles) {
if (!installBinaryFile(fileName, dataDir+"/"+MC_DIR+"/"+MC_THEMES_SUBDIR)) return false;
}
for (QString fileName : mcSyntaxFiles) {
if (!installBinaryFile(fileName, dataDir+"/"+MC_DIR+"/"+MC_SYNTAX_SUBDIR)) return false;
}
for (QString fileName : otherFiles) {
if (!installBinaryFile(fileName, dataDir)) return false;
}
QFile gitConfigHidden(dataDir+"/.gitconfig");
if (gitConfigHidden.exists()) gitConfigHidden.remove();
QFile gitConfig(dataDir+"/gitconfig");
if (gitConfig.exists()) gitConfig.rename(".gitconfig");
if (cleanELF) {
QStringList cleanFiles;
for (QString fileName : binFiles) {
if (fileName == "termux-elf-cleaner") continue;
cleanFiles << dataDir+"/"+BIN_DIR+"/"+fileName;
}
for (QString fileName : gitFiles) {
cleanFiles << dataDir+"/"+BIN_DIR+"/"+GIT_CORE_DIR+"/"+fileName;
}
QProcess cleanProcess(this);
cleanProcess.start(dataDir+"/"+BIN_DIR+"/termux-elf-cleaner", cleanFiles);
if (!cleanProcess.waitForFinished()) return false;
}
return true;
}
bool MainWindow::uninstallPack()
{
if (dataDir.size() == 0) return false;
for (QString fileName : binFiles) {
if (!removeFile(dataDir+"/"+BIN_DIR+"/"+fileName)) return false;
}
for (QString fileName : gitFiles) {
if (!removeFile(dataDir+"/"+BIN_DIR+"/"+GIT_CORE_DIR+"/"+fileName)) return false;
}
for (QString fileName : termFiles) {
if (fileName.size() == 0) continue;
QChar c = fileName.at(0);
if (!removeFile(dataDir+"/"+TERMINFO_DIR+"/"+c+"/"+fileName)) return false;
}
for (QString fileName : mcFiles) {
if (!removeFile(dataDir+"/"+MC_DIR+"/"+fileName)) return false;
}
for (QString fileName : mcThemeFiles) {
if (!removeFile(dataDir+"/"+MC_DIR+"/"+MC_THEMES_SUBDIR+"/"+fileName)) return false;
}
for (QString fileName : mcSyntaxFiles) {
if (!removeFile(dataDir+"/"+MC_DIR+"/"+MC_SYNTAX_SUBDIR+"/"+fileName)) return false;
}
for (QString fileName : otherFiles) {
if (fileName == "gitconfig") fileName = "."+fileName;
if (!removeFile(dataDir+"/"+fileName)) return false;
}
if (!removeDirectory(dataDir+"/"+BIN_DIR+"/"+GIT_CORE_DIR)) return false;
if (!removeDirectory(dataDir+"/"+BIN_DIR)) return false;
if (!removeDirectory(dataDir+"/"+GIT_TEMPLATES_DIR)) return false;
if (!removeDirectory(dataDir+"/"+PHP_TMP_DIR)) return false;
if (!removeDirectory(dataDir+"/"+TERMINFO_DIR)) return false;
if (!removeDirectory(dataDir+"/"+MC_DIR+"/"+MC_THEMES_SUBDIR)) return false;
if (!removeDirectory(dataDir+"/"+MC_DIR+"/"+MC_SYNTAX_SUBDIR)) return false;
if (!removeDirectory(dataDir+"/"+MC_DIR)) return false;
return true;
}
bool MainWindow::createDirectory(QDir rootDir, QString path)
{
if (!rootDir.mkpath(path)) return false;
if (!setPermissions(path)) return false;
return true;
}
bool MainWindow::removeDirectory(QString path)
{
QDir dir(path);
if (!dir.exists()) return true;
if (!dir.removeRecursively()) return false;
return true;
}
bool MainWindow::installBinaryFile(QString fileName, QString installDir)
{
QFile f("assets:/"+fileName);
if (!f.exists()) return false;
QFile fi(installDir+"/"+fileName);
if (fi.exists()) fi.remove();
if (!f.copy(installDir+"/"+fileName)) return false;
QFile pf(installDir+"/"+fileName);
if (!setPermissions(pf)) return false;
return true;
}
bool MainWindow::removeFile(QString fileName)
{
QFile f(fileName);
if (!f.exists()) return true;
if (!f.remove()) return false;
return true;
}
bool MainWindow::setPermissions(QFile &f)
{
return f.setPermissions(
QFileDevice::ReadOwner |
QFileDevice::ReadGroup |
QFileDevice::ReadOther |
QFileDevice::WriteOwner |
QFileDevice::WriteGroup |
QFileDevice::WriteOther |
QFileDevice::ExeOwner |
QFileDevice::ExeGroup |
QFileDevice::ExeOther
);
}
bool MainWindow::setPermissions(QString path)
{
QFile f(path);
return setPermissions(f);
}
bool MainWindow::isPackInstalled()
{
for (QString fileName : binFiles) {
QFileInfo fileInfo(dataDir+"/"+BIN_DIR+"/"+fileName);
if (!fileInfo.exists() || !fileInfo.isExecutable()) return false;
}
for (QString fileName : gitFiles) {
QFileInfo fileInfo(dataDir+"/"+BIN_DIR+"/"+GIT_CORE_DIR+"/"+fileName);
if (!fileInfo.exists() || !fileInfo.isExecutable()) return false;
}
return true;
}
void MainWindow::copyPathClicked(bool)
{
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(ui->envTextEdit->toPlainText());
QMessageBox msgBox(this);
msgBox.setWindowTitle(QObject::tr("Message"));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText("Copied to clipboard");
msgBox.exec();
}
void MainWindow::showVersions()
{
QString versions = "<div>";
QProcess phpProcess(this);
phpProcess.start(dataDir+"/"+BIN_DIR+"/php", QStringList() << "-v");
if (!phpProcess.waitForFinished()) return;
QByteArray phpResult = phpProcess.readAllStandardError();
phpResult += phpProcess.readAllStandardOutput();
versions += "<p>"+QString(phpResult).trimmed().split("\n").at(0) + "</p>";
QProcess gitProcess(this);
gitProcess.start(dataDir+"/"+BIN_DIR+"/git", QStringList() << "--version");
if (!gitProcess.waitForFinished()) return;
QByteArray gitResult = gitProcess.readAllStandardError();
gitResult += gitProcess.readAllStandardOutput();
versions += "<p>"+QString(gitResult).trimmed().split("\n").at(0) + "</p>";
QProcess sasscProcess(this);
sasscProcess.start(dataDir+"/"+BIN_DIR+"/sassc", QStringList() << "--version");
if (!sasscProcess.waitForFinished()) return;
QByteArray sasscResult = sasscProcess.readAllStandardError();
sasscResult += sasscProcess.readAllStandardOutput();
versions += "<p>"+QString(sasscResult).trimmed().split("\n").at(0) + "</p>";
QProcess sqlite3Process(this);
sqlite3Process.start(dataDir+"/"+BIN_DIR+"/sqlite3", QStringList() << "--version");
if (!sqlite3Process.waitForFinished()) return;
QByteArray sqlite3Result = sqlite3Process.readAllStandardError();
sqlite3Result += sqlite3Process.readAllStandardOutput();
versions += "<p>SQLite " + QString(sqlite3Result).trimmed().split("\n").at(0) + "</p>";
QProcess nanoProcess(this);
nanoProcess.start(dataDir+"/"+BIN_DIR+"/nano", QStringList() << "--version");
if (!nanoProcess.waitForFinished()) return;
QByteArray nanoResult = nanoProcess.readAllStandardError();
nanoResult += nanoProcess.readAllStandardOutput();
versions += "<p>"+QString(nanoResult).trimmed().split("\n").at(0) + "</p>";
QProcess vimProcess(this);
vimProcess.start(dataDir+"/"+BIN_DIR+"/vim", QStringList() << "--version");
if (!vimProcess.waitForFinished()) return;
QByteArray vimResult = vimProcess.readAllStandardError();
vimResult += vimProcess.readAllStandardOutput();
versions += "<p>"+QString(vimResult).trimmed().split("\n").at(0) + "</p>";
QProcess mcProcess(this);
mcProcess.start(dataDir+"/"+BIN_DIR+"/mc", QStringList() << "--version");
if (!mcProcess.waitForFinished()) return;
QByteArray mcResult = mcProcess.readAllStandardError();
mcResult += mcProcess.readAllStandardOutput();
versions += "<p>"+QString(mcResult).trimmed().split("\n").at(0) + "</p>";
versions += "</div>";
ui->versionsLabel->setText(versions);
}
void MainWindow::showPHPInfo()
{
QProcess phpProcess(this);
phpProcess.start(dataDir+"/"+BIN_DIR+"/php", QStringList() << "-r" << "phpinfo();");
if (!phpProcess.waitForFinished()) return;
QByteArray phpResult = phpProcess.readAllStandardOutput();
QStringList phpResultList = QString(phpResult).trimmed().split("\n");
QString phpResultStr = "<div>";
for (QString phpResultListItem : phpResultList) {
QStringList phpResultListItemParts = phpResultListItem.split("=>");
if (phpResultListItemParts.size() == 1) {
phpResultStr += "<h2>" + phpResultListItemParts.at(0) + "</h2>";
} else if (phpResultListItemParts.size() > 1) {
phpResultStr += "<p><b>" + phpResultListItemParts.at(0) + ":</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + "<span>" + phpResultListItemParts.at(1) + "</span></p>";
}
}
phpResultStr += "</div>";
ui->versionsLabel->setText(phpResultStr);
}
void MainWindow::applyStyle()
{
QFile f(":/styles/dark");
if (!f.exists()) return;
QString style = "";
f.open(QIODevice::ReadOnly);
QTextStream in(&f);
style += in.readAll() + "\n";
f.close();
setStyleSheet(style);
}

50
mainwindow.h Normal file
View File

@ -0,0 +1,50 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QFile>
#include <QDir>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
protected:
bool installPack(bool cleanELF = true);
bool uninstallPack();
bool createDirectory(QDir rootDir, QString path);
bool removeDirectory(QString path);
bool installBinaryFile(QString fileName, QString installDir);
bool removeFile(QString fileName);
bool setPermissions(QFile &f);
bool setPermissions(QString path);
bool isPackInstalled();
void showVersionsLabel();
void showVersions();
void showPHPInfo();
void applyStyle();
private:
Ui::MainWindow *ui;
QString dataDir;
QStringList binFiles;
QStringList gitFiles;
QStringList termFiles;
QStringList mcFiles;
QStringList mcThemeFiles;
QStringList mcSyntaxFiles;
QStringList otherFiles;
private slots:
void installButtonClicked(bool);
void uninstallButtonClicked(bool);
void checkButtonClicked(bool);
void infoButtonClicked(bool);
void copyPathClicked(bool);
};
#endif // MAINWINDOW_H

210
mainwindow.ui Normal file
View File

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="installLayout">
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<widget class="QPushButton" name="checkButton">
<property name="text">
<string>Check</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="infoButton">
<property name="text">
<string>phpinfo()</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="uninstallButton">
<property name="text">
<string>Uninstall</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="envLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>778</width>
<height>244</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="ziraLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>154</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="qrc/images.qrc">:/images/zira.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="versionsLabel">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QLabel" name="envLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Initialization for Android Terminal Emulator:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="envTextEdit">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="copyButton">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="installButton">
<property name="text">
<string>Install</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources>
<include location="qrc/images.qrc"/>
</resources>
<connections/>
</ui>

5
qrc/images.qrc Normal file
View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/images">
<file alias="zira.png">images/zira.png</file>
</qresource>
</RCC>

BIN
qrc/images/zira.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

5
qrc/styles.qrc Normal file
View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/styles">
<file alias="dark">styles/dark.css</file>
</qresource>
</RCC>

148
qrc/styles/dark.css Normal file
View File

@ -0,0 +1,148 @@
/** Zira DevPack Dark theme **/
QWidget
{
color: #c4c8cc;
background-color: #232627;
}
QTextEdit,
QPlainTextEdit
{
color: #a5a9ad;
background: #0f0f10;
selection-color: #ffffff;
selection-background-color: #008dc1;
}
QLineEdit
{
background-color: #3d4d53;
border-style: solid;
border: 1px solid #1e1e1e;
border-radius: 3;
padding: 5px;
selection-color: #ffffff;
selection-background-color: #008dc1;
}
QPushButton
{
color: #e5e8ea;
background-color: #3d4d53;
border: 1px solid #1e1e1e;
border-radius: 3;
padding: 15px 20px;
outline: none;
}
QPushButton:hover
{
border: 1px solid #008dc1;
background: #186e8e;
}
QPushButton:focus
{
background-color: #186e8e;
}
QPushButton:pressed
{
background-color: #008dc1;
}
QScrollArea
{
border: none;
}
QScrollBar:horizontal {
border: none;
background: #232627;
height: 20px;
margin: 0px 1px;
padding: 2px 0px;
}
QScrollBar::handle:horizontal
{
background-color: #3d4d53;
min-width: 38px;
border-radius: 0px;
}
QScrollBar::handle:horizontal:hover
{
background: #006a7b;
}
QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal
{
border: none;
border-radius: 0px;
background: none;
width: 1px;
subcontrol-position: right;
subcontrol-origin: margin;
}
QScrollBar::right-arrow:horizontal, QScrollBar::left-arrow:horizontal
{
border: none;
width: 1px;
height: 1px;
background: none;
border-radius: 0px;
}
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal
{
background: none;
}
QScrollBar:vertical
{
background: #232627;
width: 20px;
margin: 1px 0px;
border: none;
padding: 0px 2px;
}
QScrollBar::handle:vertical
{
background: #3d4d53;
min-height: 38px;
border-radius: 0px;
}
QScrollBar::handle:vertical:hover
{
background: #006a7b;
}
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical
{
border: none;
border-radius: 0px;
background: none;
height: 1px;
subcontrol-position: bottom;
subcontrol-origin: margin;
}
QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical
{
border: none;
width: 1px;
height: 1px;
background: none;
}
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical
{
background: none;
}