diff --git a/.gitignore b/.gitignore
index fab7372..d0b2fe7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,6 +37,7 @@ Thumbs.db
# qtcreator generated files
*.pro.user*
+CMakeLists.txt.user*
# xemacs temporary files
*.flc
@@ -71,3 +72,4 @@ Thumbs.db
*.dll
*.exe
+build/
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..d10ddd9
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,48 @@
+cmake_minimum_required(VERSION 3.16)
+
+project(nooLight VERSION 1.0 LANGUAGES CXX)
+
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+set(CMAKE_AUTORCC ON)
+
+find_package(Qt6 6.5 REQUIRED COMPONENTS Quick)
+
+qt_standard_project_setup(REQUIRES 6.5)
+
+qt_add_executable(appnooLight
+ main.cpp
+ qml.qrc
+)
+
+if (ANDROID)
+ set_property(TARGET appnooLight APPEND PROPERTY QT_ANDROID_EXTRA_LIBS
+ ${QT_ANDROID_SSL_DIR}/no-asm/ssl_3/${ANDROID_ABI}/libcrypto_3.so
+ ${QT_ANDROID_SSL_DIR}/no-asm/ssl_3/${ANDROID_ABI}/libssl_3.so)
+
+ set_property(TARGET appnooLight APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
+ ${CMAKE_CURRENT_SOURCE_DIR}/android)
+endif()
+
+
+# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
+# If you are developing for iOS or macOS you should consider setting an
+# explicit, fixed bundle identifier manually though.
+set_target_properties(appnooLight PROPERTIES
+# MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appnooLight
+ MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
+ MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
+ MACOSX_BUNDLE TRUE
+ WIN32_EXECUTABLE TRUE
+)
+
+target_link_libraries(appnooLight
+ PRIVATE Qt6::Quick
+)
+
+include(GNUInstallDirs)
+install(TARGETS appnooLight
+ BUNDLE DESTINATION .
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
diff --git a/LightsModel.qml b/LightsModel.qml
index 0d6719b..65fd55c 100644
--- a/LightsModel.qml
+++ b/LightsModel.qml
@@ -6,12 +6,12 @@ ListModel {
readonly property var client: NooLiteClient {
id: nooLiteClient
- onError: {
+ onError: (text) => {
root.error(text)
root.isLoading = false
}
- onModelLoad: {
+ onModelLoad: (data) => {
root.populateModel(data)
root.isLoading = false
}
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index 52f9ca7..22843d0 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -1,77 +1,16 @@
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
diff --git a/android/build.gradle b/android/build.gradle
index 3a3e0cd..f6c2f3d 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,23 +1,23 @@
buildscript {
repositories {
- jcenter()
+ google()
+ mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.3'
+ classpath 'com.android.tools.build:gradle:7.4.1'
}
}
-allprojects {
- repositories {
- jcenter()
- }
+repositories {
+ google()
+ mavenCentral()
}
apply plugin: 'com.android.application'
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
+ implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
}
android {
@@ -25,7 +25,7 @@ android {
* The following variables:
* - androidBuildToolsVersion,
* - androidCompileSdkVersion
- * - qt5AndroidDir - holds the path to qt android files
+ * - qtAndroidDir - holds the path to qt android files
* needed to build any Qt application
* on Android.
*
@@ -35,23 +35,47 @@ android {
*******************************************************/
compileSdkVersion androidCompileSdkVersion.toInteger()
-
buildToolsVersion androidBuildToolsVersion
+ ndkVersion androidNdkVersion
+
+ // Extract native libraries from the APK
+ packagingOptions.jniLibs.useLegacyPackaging true
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']
+ java.srcDirs = [qtAndroidDir + '/src', 'src', 'java']
+ aidl.srcDirs = [qtAndroidDir + '/src', 'src', 'aidl']
+ res.srcDirs = [qtAndroidDir + '/res', 'res']
+ resources.srcDirs = ['resources']
renderscript.srcDirs = ['src']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
+ tasks.withType(JavaCompile) {
+ options.incremental = true
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
lintOptions {
abortOnError false
}
+
+ // Do not compress Qt binary resources file
+ aaptOptions {
+ noCompress 'rcc'
+ }
+
+ defaultConfig {
+ resConfig "en"
+ minSdkVersion qtMinSdkVersion
+ targetSdkVersion qtTargetSdkVersion
+ ndk.abiFilters = qtTargetAbiList.split(",")
+ }
}
diff --git a/android/gradle.properties b/android/gradle.properties
index 9a136c6..03e1d6d 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -3,7 +3,3 @@
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
-androidBuildToolsVersion=27.0.2
-androidCompileSdkVersion=27
-buildDir=.build
-qt5AndroidDir=/home/denis/Qt.5.9/5.9.3/android_armv7/src/android/java
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 4244097..ff60cd6 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
diff --git a/android/res/values/libs.xml b/android/res/values/libs.xml
deleted file mode 100644
index 4009a77..0000000
--- a/android/res/values/libs.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
- - https://download.qt.io/ministro/android/qt5/qt-5.9
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/main.cpp b/main.cpp
index 6333b85..eeefb81 100644
--- a/main.cpp
+++ b/main.cpp
@@ -3,14 +3,16 @@
int main(int argc, char *argv[])
{
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
-
QGuiApplication app(argc, argv);
+ app.setOrganizationName("ded");
+ app.setOrganizationDomain("inc");
+
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
- if (engine.rootObjects().isEmpty())
+ if (engine.rootObjects().isEmpty()) {
return -1;
+ }
return app.exec();
}
diff --git a/main.qml b/main.qml
index 84ef5fa..d35e07e 100644
--- a/main.qml
+++ b/main.qml
@@ -21,7 +21,7 @@ ApplicationWindow {
serviceUrl: settings.serviceUrl
- onError: stackView.showError(text)
+ onError: (text) => stackView.showError(text)
}
header: ToolBar {
@@ -95,6 +95,14 @@ ApplicationWindow {
stackView.openPage("SettingsForm.qml")
}
}
+
+ ItemDelegate {
+ text: qsTr("Quit")
+ width: parent.width
+ onClicked: {
+ Qt.quit()
+ }
+ }
}
}
diff --git a/nooLight.pro b/nooLight.pro
index 9976046..97ec091 100644
--- a/nooLight.pro
+++ b/nooLight.pro
@@ -37,3 +37,8 @@ DISTFILES += \
android/gradlew.bat
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
+
+ANDROID_EXTRA_LIBS += $$ANDROID_SDK_ROOT/android_openssl/latest/arm/libssl_1_1.so \
+ $$ANDROID_SDK_ROOT/android_openssl/latest/arm/libcrypto_1_1.so
+
+ANDROID_ABIS = armeabi-v7a