Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85367057
D321.1783135758.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
D321.1783135758.diff
View Options
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,10 @@
include(ECMQtDeclareLoggingCategory)
include(ECMDeprecationSettings)
include(ECMQmlModule)
+if(ANDROID)
+ find_package(Perl 5.12 REQUIRED)
+ include(ECMAddAndroidApk)
+endif()
ecm_set_disabled_deprecation_versions(
QT 5.15.14
@@ -80,6 +84,9 @@
pkg_search_module(cmark libcmark IMPORTED_TARGET GLOBAL)
set(CMARK_TARGET_NAME cmark)
endif()
+if(ANDROID)
+ find_package(OpenSSL REQUIRED)
+endif()
if(${kazv_ENABLE_APPIUM_TESTS} STREQUAL "")
find_package(SeleniumWebDriverATSPI)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -124,6 +124,12 @@
QCoro::Core
${CMARK_TARGET_NAME}
)
+if(ANDROID)
+ target_link_libraries(kazvqmlmodule PUBLIC
+ KF${KF_MAJOR_VERSION}::Kirigami
+ OpenSSL::SSL
+ )
+endif()
target_include_directories(kazvqmlmodule PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(kazvqmlmodule PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/device-mgmt)
@@ -306,8 +312,16 @@
kazvqmlqmlmoduleplugin
kazvprivlib
)
-if(kazv_LINK_BREEZE_ICONS)
- target_link_libraries(kazv PRIVATE KF${KF_MAJOR_VERSION}::BreezeIcons)
+if(ANDROID)
+ message(STATUS "Collecting icons for apk deployment")
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/scan-icons
+ RESULT_VARIABLE KAZV_SCAN_ICONS_RESULT
+ OUTPUT_VARIABLE KAZV_FOUND_ICONS
+ COMMAND_ERROR_IS_FATAL ANY
+ )
+ kirigami_package_breeze_icons(ICONS ${KAZV_FOUND_ICONS})
endif()
set(kazv_INSTALL_ARGS ${KF_INSTALL_TARGETS_DEFAULT_ARGS})
@@ -316,4 +330,8 @@
endif()
install(TARGETS kazv ${kazv_INSTALL_ARGS})
+if(ANDROID)
+ ecm_add_android_apk(kazv ANDROID_DIR ${CMAKE_CURRENT_SOURCE_DIR}/android)
+endif()
+
add_subdirectory(tests)
diff --git a/src/android/AndroidManifest.xml b/src/android/AndroidManifest.xml
new file mode 100644
--- /dev/null
+++ b/src/android/AndroidManifest.xml
@@ -0,0 +1,68 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--
+ Taken from
+ https://develop.kde.org/docs/packaging/android/porting_applications/basic/
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="moe.kazv.mxc.kazv"
+ android:versionName="0.6.0"
+ android:versionCode="6000"
+ android:installLocation="auto">
+
+ <supports-screens
+ android:largeScreens="true"
+ android:normalScreens="true"
+ android:anyDensity="true"
+ android:smallScreens="true" />
+
+ <uses-permission android:name="android.permission.ACCESS_LOCAL_NETWORK" />
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+
+ <!-- %%INSERT_PERMISSIONS -->
+ <!-- %%INSERT_FEATURES -->
+
+ <application
+ android:name="org.qtproject.qt.android.bindings.QtApplication"
+ android:label="kazv"
+ android:icon="@drawable/kazv"
+ android:appCategory="social">
+ <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation"
+ android:name="org.qtproject.qt.android.bindings.QtActivity"
+ android:label="kazv"
+ android:windowSoftInputMode="adjustResize"
+ android:launchMode="singleTop"
+ android:exported="true">
+
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+
+ <meta-data android:name="android.app.lib_name" android:value="kazv" />
+ <meta-data android:name="android.app.repository" android:value="default" />
+ <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs" />
+ <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs" />
+ <meta-data android:name="android.app.extract_android_style" android:value="minimal" />
+
+ <!-- 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.load_local_libs_resource_id" android:resource="@array/load_local_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" 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%% --"/>
+ <!-- Messages maps -->
+ <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
+
+ <!-- Background running -->
+ <meta-data android:name="android.app.background_running" android:value="false"/>
+
+ <!-- auto screen scale factor -->
+ <meta-data android:name="android.app.auto_screen_scale_factor" android:value="true"/>
+ </activity>
+ </application>
+</manifest>
diff --git a/src/android/res/drawable/kazv.png b/src/android/res/drawable/kazv.png
new file mode 120000
--- /dev/null
+++ b/src/android/res/drawable/kazv.png
@@ -0,0 +1 @@
+../../../../icons/kazvlogo-256.png
\ No newline at end of file
diff --git a/src/contents/ui/Bubble.qml b/src/contents/ui/Bubble.qml
--- a/src/contents/ui/Bubble.qml
+++ b/src/contents/ui/Bubble.qml
@@ -198,7 +198,7 @@
RowLayout {
Layout.alignment: Qt.AlignBottom
Kirigami.Icon {
- source: 'emblem-encrypted-locked'
+ source: /* iconName: */ 'emblem-encrypted-locked'
visible: !compactMode && event && event.encrypted
Layout.preferredHeight: inlineBadgeSize
Layout.preferredWidth: inlineBadgeSize
diff --git a/src/contents/ui/device-mgmt/Device.qml b/src/contents/ui/device-mgmt/Device.qml
--- a/src/contents/ui/device-mgmt/Device.qml
+++ b/src/contents/ui/device-mgmt/Device.qml
@@ -169,15 +169,15 @@
{
switch (level) {
case 'blocked':
- return 'emblem-error';
+ return /* iconName: */ 'emblem-error';
case 'unseen':
- return 'emblem-warning';
+ return /* iconName: */ 'emblem-warning';
case 'seen':
- return 'emblem-added';
+ return /* iconName: */ 'emblem-added';
case 'verified':
- return 'emblem-checked';
+ return /* iconName: */ 'emblem-checked';
default:
- return 'emblem-question';
+ return /* iconName: */ 'emblem-question';
}
}
}
diff --git a/src/contents/ui/event-types/Emote.qml b/src/contents/ui/event-types/Emote.qml
--- a/src/contents/ui/event-types/Emote.qml
+++ b/src/contents/ui/event-types/Emote.qml
@@ -18,7 +18,7 @@
textFormat: isHtmlFormatted ? TextEdit.RichText : TextEdit.PlainText
Kirigami.Icon {
- source: 'package-new'
+ source: /* iconName: */ 'package-new'
Layout.preferredHeight: inlineBadgeSize
Layout.preferredWidth: inlineBadgeSize
}
diff --git a/src/contents/ui/event-types/Fallback.qml b/src/contents/ui/event-types/Fallback.qml
--- a/src/contents/ui/event-types/Fallback.qml
+++ b/src/contents/ui/event-types/Fallback.qml
@@ -18,7 +18,7 @@
Kirigami.Icon {
objectName: 'fallbackIcon'
- source: 'emblem-question'
+ source: /* iconName: */ 'emblem-question'
Layout.preferredHeight: inlineBadgeSize
Layout.preferredWidth: inlineBadgeSize
}
diff --git a/src/contents/ui/event-types/Redacted.qml b/src/contents/ui/event-types/Redacted.qml
--- a/src/contents/ui/event-types/Redacted.qml
+++ b/src/contents/ui/event-types/Redacted.qml
@@ -19,7 +19,7 @@
text: l10n.get('event-deleted')
Kirigami.Icon {
- source: 'edit-delete-symbolic'
+ source: /* iconName: */ 'edit-delete-symbolic'
Layout.preferredHeight: inlineBadgeSize
Layout.preferredWidth: inlineBadgeSize
}
diff --git a/src/contents/ui/event-types/State.qml b/src/contents/ui/event-types/State.qml
--- a/src/contents/ui/event-types/State.qml
+++ b/src/contents/ui/event-types/State.qml
@@ -38,15 +38,19 @@
const isSelfSent = event.stateKey === event.sender;
if (newState === 'join' && oldState !== 'join') {
- return 'list-add-user';
+ return /* iconName: */ 'list-add-user';
} else if (newState === 'leave' || newState === 'ban') {
- return isSelfSent ? 'list-remove-user' : 'im-kick-user';
+ return (
+ isSelfSent
+ ? /* iconName: */ 'list-remove-user'
+ : /* iconName: */ 'im-kick-user'
+ );
} else {
- return 'im-user';
+ return /* iconName: */ 'im-user';
}
default:
- return 'emblem-information';
+ return /* iconName: */ 'emblem-information';
}
}
diff --git a/src/contents/ui/event-types/Video.qml b/src/contents/ui/event-types/Video.qml
--- a/src/contents/ui/event-types/Video.qml
+++ b/src/contents/ui/event-types/Video.qml
@@ -118,7 +118,7 @@
}
contentItem: Kirigami.Icon {
- source: 'media-playback-start'
+ source: /* iconName: */ 'media-playback-start'
}
}
diff --git a/src/contents/ui/room-settings/RoomSettingsPage.qml b/src/contents/ui/room-settings/RoomSettingsPage.qml
--- a/src/contents/ui/room-settings/RoomSettingsPage.qml
+++ b/src/contents/ui/room-settings/RoomSettingsPage.qml
@@ -142,7 +142,7 @@
objectName: 'roomMembersAvatarsMore'
Layout.preferredHeight: Kirigami.Units.iconSizes.huge
Layout.preferredWidth: Kirigami.Units.iconSizes.huge
- source: 'go-next-skip'
+ source: /* iconName: */ 'go-next-skip'
visible: members.count > roomSettingsPage.avatarCount
}
}
diff --git a/src/main.cpp b/src/main.cpp
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,10 +5,14 @@
*/
#include <kazv-defs.hpp>
-
+#include <kazv-platform.hpp>
#include <immer/config.hpp> // https://github.com/arximboldi/immer/issues/168
+#if KAZV_IS_ANDROID
+#include <QGuiApplication>
+#else
#include <QApplication>
+#endif
#include <QByteArray>
#include <QQmlApplicationEngine>
#include <QtQml>
@@ -27,11 +31,16 @@
#include "kazv-log.hpp"
using namespace Qt::Literals::StringLiterals;
+#if KAZV_IS_ANDROID
+using AppClass = QGuiApplication;
+#else
+using AppClass = QApplication;
+#endif
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QApplication app(argc, argv);
+ AppClass app(argc, argv);
QCoreApplication::setOrganizationName(u"project-kazv"_s);
QCoreApplication::setOrganizationDomain(u"mxc.kazv.moe"_s);
QCoreApplication::setApplicationName(u"kazv"_s);
@@ -52,6 +61,9 @@
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
}
#endif
+#if KAZV_IS_ANDROID
+ QQuickStyle::setStyle(QStringLiteral("org.kde.breeze"));
+#endif
QQmlApplicationEngine engine;
diff --git a/tools/scan-icons b/tools/scan-icons
new file mode 100755
--- /dev/null
+++ b/tools/scan-icons
@@ -0,0 +1,32 @@
+#!/usr/bin/env perl
+
+use File::Find;
+use File::Basename qw/dirname/;
+use 5.012;
+
+my %all;
+my $sourceDir = dirname(dirname($0)) . '/src/contents/ui';
+
+sub processFile
+{
+ if (!/(\.qml|\.js)$/) {
+ return;
+ }
+ open my $fh, '<', $_ or die "Cannot open $_: $!\n";
+ while (<$fh>) {
+ if (!/(icon\.name|iconName):/) {
+ next;
+ }
+ chomp;
+ s/.+?://;
+ while (my $i = /("[^"]+"|'[^']+')/g) {
+ my $name = substr $1, 1, -1;
+ $all{$name} = 1;
+ }
+ }
+ close $fh;
+}
+
+find(\&processFile, $sourceDir);
+
+say for sort keys %all;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jul 3, 8:29 PM (22 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1655310
Default Alt Text
D321.1783135758.diff (12 KB)
Attached To
Mode
D321: Create android apk
Attached
Detach File
Event Timeline
Log In to Comment