From 69074f32ffa084a5a2923b61e4dcde67d9ec3f6f Mon Sep 17 00:00:00 2001 From: wanghao Date: Fri, 26 Jan 2024 16:12:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[mod]=20=E6=9B=B4=E6=96=B0=E8=A1=A5?= =?UTF-8?q?=E4=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanghao --- patch/v5.12.12/qtbase.patch | 179 +++++++++++++-------------- patch/v5.12.12/qtdeclarative.patch | 4 +- patch/v5.12.12/qtremoteobjects.patch | 61 ++++++++- 3 files changed, 145 insertions(+), 99 deletions(-) diff --git a/patch/v5.12.12/qtbase.patch b/patch/v5.12.12/qtbase.patch index 0746d4c772..bb9f8f1bab 100644 --- a/patch/v5.12.12/qtbase.patch +++ b/patch/v5.12.12/qtbase.patch @@ -870,16 +870,17 @@ index 0000000000..0c0bd12c64 +#endif // QJNIHELPERS_H diff --git a/src/corelib/kernel/qopenharmonyjsenvironment.cpp b/src/corelib/kernel/qopenharmonyjsenvironment.cpp new file mode 100644 -index 0000000000..7ca972cb29 +index 0000000000..0d9c42fc33 --- /dev/null +++ b/src/corelib/kernel/qopenharmonyjsenvironment.cpp -@@ -0,0 +1,395 @@ +@@ -0,0 +1,404 @@ +#include "qopenharmonyjsenvironment.h" +#include "qopenharmonydefines.h" +#include "qopenharmonyhelpers_p.h" +#include "qopenharmonyjsfunction.h" + +static napi_threadsafe_function g_threadsafe_call_js_function = nullptr; ++static napi_threadsafe_function g_threadsafe_remove_object_function = nullptr; +napi_env QOpenHarmonyJsEnvironment::m_env = nullptr; +bool QOpenHarmonyJsEnvironment::m_exit = false; + @@ -990,6 +991,14 @@ index 0000000000..7ca972cb29 + return napi_call_threadsafe_function(g_threadsafe_call_js_function, func, napi_tsfn_blocking) == napi_ok; +} + ++void QOpenHarmonyJsEnvironment::threadSafeRemoveObject(const QString &objectName) ++{ ++ napi_acquire_threadsafe_function(g_threadsafe_remove_object_function); ++ QByteArray dataArray = objectName.toLatin1(); ++ char *_data = dataArray.data(); ++ napi_call_threadsafe_function(g_threadsafe_remove_object_function, (void *)_data, napi_tsfn_blocking); ++} ++ +QString QOpenHarmonyJsEnvironment::getString(napi_value value) +{ + size_t strLen = 0; @@ -1271,10 +1280,10 @@ index 0000000000..7ca972cb29 +} diff --git a/src/corelib/kernel/qopenharmonyjsenvironment.h b/src/corelib/kernel/qopenharmonyjsenvironment.h new file mode 100644 -index 0000000000..98c7f3a7d4 +index 0000000000..0390478e5b --- /dev/null +++ b/src/corelib/kernel/qopenharmonyjsenvironment.h -@@ -0,0 +1,121 @@ +@@ -0,0 +1,122 @@ +#ifndef QOPENHARMONYJSENVIRONMENT_H +#define QOPENHARMONYJSENVIRONMENT_H + @@ -1341,6 +1350,7 @@ index 0000000000..98c7f3a7d4 + static napi_value callFunction(napi_value object, napi_value function, int argc = 0, const napi_value *argv = nullptr); + + static bool callThreadSafeFunction(QOpenHarmonyJsFunction *func); ++ static void threadSafeRemoveObject(const QString &objectName); + + static QString getString(napi_value value); + @@ -2655,10 +2665,10 @@ index 0000000000..6a4626655c +}; diff --git a/src/openharmony/native/QtCore/JsApplication.ts b/src/openharmony/native/QtCore/JsApplication.ts new file mode 100644 -index 0000000000..e5bd848229 +index 0000000000..b27e0379b9 --- /dev/null +++ b/src/openharmony/native/QtCore/JsApplication.ts -@@ -0,0 +1,156 @@ +@@ -0,0 +1,152 @@ +import window from '@ohos.window'; +import display from '@ohos.display'; +import fs from '@ohos.file.fs'; @@ -2687,14 +2697,6 @@ index 0000000000..e5bd848229 + (obj as JsWindowManager).addWindow(name, window); + } + -+ updateQtScreen(size: window.Size): void { -+ let d = display.getDefaultDisplaySync(); -+ let titleHeight: number = JsDataStore.windowTitleHeight(); -+ let borderWidth: number = JsDataStore.windowBorderWidth(); -+ JsDataStore.getQtNativeModule("QPA").setDisplayMetrics(size.width - borderWidth - borderWidth, size.height - titleHeight - borderWidth, d.densityDPI, d.scaledDensity, d.xDPI, d.yDPI, -+ 0, 0, size.width - borderWidth - borderWidth, size.height - titleHeight - borderWidth); -+ } -+ + async run(windowStage: window.WindowStage) { + let qtMajorVersion: number = this.qpa.qtMajorVersion(); + let QtCoreModule: any = null; @@ -2722,11 +2724,15 @@ index 0000000000..e5bd848229 + let localStore = new LocalStorage({"name": this.mainWindowName}); + await windowStage.loadContent('pages/Index', localStore); + this.addWindow(this.mainWindowName, window); ++ let p = this.mainWindow.getWindowProperties(); ++ let d = display.getDefaultDisplaySync(); + if (this.qpa != null) { -+ let p = this.mainWindow.getWindowProperties(); -+ this.updateQtScreen({width: p.windowRect.width, height: p.windowRect.height}); ++ this.qpa.setDisplayMetrics(p.windowRect.width, p.windowRect.height, d.densityDPI, d.scaledDensity, d.xDPI, d.yDPI, ++ 0, 0, p.windowRect.width, p.windowRect.height); ++ this.qpa.setDeviceType(JsDataStore.deviceType()); ++ // this.qpa.setDisplayMetrics(d.width, d.height, d.densityDPI, d.scaledDensity, d.xDPI, d.yDPI, ++ // area.leftRect.left, area.topRect.height, d.width - area.leftRect.width - area.rightRect.width, d.height - area.topRect.height - area.bottomRect.height); + } -+ this.mainWindow.on("windowSizeChange", this.updateQtScreen); + windowStage.on("windowStageEvent", (state)=>{ + if (this.qpa != null) + this.qpa.updateApplicationState(state); @@ -2818,10 +2824,10 @@ index 0000000000..e5bd848229 \ No newline at end of file diff --git a/src/openharmony/native/QtCore/JsDataStore.ts b/src/openharmony/native/QtCore/JsDataStore.ts new file mode 100644 -index 0000000000..a16eee9e0a +index 0000000000..4650216b2e --- /dev/null +++ b/src/openharmony/native/QtCore/JsDataStore.ts -@@ -0,0 +1,136 @@ +@@ -0,0 +1,114 @@ +import common from '@ohos.app.ability.common'; +import window from '@ohos.window'; +import bundleManager from '@ohos.bundle.bundleManager'; @@ -2930,31 +2936,9 @@ index 0000000000..a16eee9e0a + } + + deviceType(): string { -+ // 现目前在pc、pad上模拟成手机端 + return 'default'; + // return deviceInfo.deviceType; + } -+ -+ windowTitleHeight(): number { -+ // Todo read from system -+ return deviceInfo.deviceType == "default" ? 0 : 93; -+ } -+ -+ windowBorderWidth(): number { -+ // Todo read from system -+ return deviceInfo.deviceType == "default" ? 0 : 4; -+ } -+ -+ statusBarHeight(): number { -+ // Todo read from system -+ return deviceInfo.deviceType == "default" ? 0 : 73; -+ } -+ -+ navigationBarHeight(): number { -+ // Todo read from system -+ return deviceInfo.deviceType == "default" ? 0 : 100; -+ } -+ +} + +export default new JsDataStore; @@ -3714,10 +3698,10 @@ index 0000000000..12729a2b3b \ No newline at end of file diff --git a/src/openharmony/native/QtCore/JsWindow.ts b/src/openharmony/native/QtCore/JsWindow.ts new file mode 100644 -index 0000000000..369eb9fbe0 +index 0000000000..76ea421090 --- /dev/null +++ b/src/openharmony/native/QtCore/JsWindow.ts -@@ -0,0 +1,81 @@ +@@ -0,0 +1,85 @@ +import window from '@ohos.window' +import JsLogger from './JsLogger' +import display from '@ohos.display'; @@ -3734,7 +3718,11 @@ index 0000000000..369eb9fbe0 + this.window = window; + this.window?.on("windowSizeChange", (size)=>{ + JsLogger.info("%{public}s window size changed %{public}d %{public}d", name, size.width, size.height); -+ // JsDataStore.getQtNativeModule("QPA").handleGeometryChange(name, 0, 0, size.width, size.height); ++ let d = display.getDefaultDisplaySync(); ++ // JsDataStore.getQtNativeModule("QPA").handleGeometryChange(name, p.windowRect.left, p.windowRect.top, size.width, size.height); ++ JsDataStore.getQtNativeModule("QPA").setDisplayMetrics(size.width, size.height, d.densityDPI, d.scaledDensity, d.xDPI, d.yDPI, ++ 0, 0, size.width, size.height); ++ JsDataStore.getQtNativeModule("QPA").handleGeometryChange(name, 0, 0, size.width, size.height); + }); + } + @@ -4192,10 +4180,10 @@ index 0000000000..f29ee6fccb +#endif // QOPENHARMONYDRAG_H diff --git a/src/plugins/platforms/openharmony/qopenharmonyeglcore.cpp b/src/plugins/platforms/openharmony/qopenharmonyeglcore.cpp new file mode 100644 -index 0000000000..62afca9740 +index 0000000000..aebac49cd9 --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyeglcore.cpp -@@ -0,0 +1,335 @@ +@@ -0,0 +1,337 @@ +#include "qopenharmonyeglcore.h" +#include +#include @@ -4340,13 +4328,12 @@ index 0000000000..62afca9740 + +QImage QOpenHarmonyEGLCore::image() const +{ -+ if (m_image.size() != QSize(m_width, m_height)) -+ m_image = m_image.scaled(m_width, m_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + return m_image; +} + +void QOpenHarmonyEGLCore::initCore() +{ ++ // 1. Create EGLContext from + int attrib3_list[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE @@ -4423,7 +4410,10 @@ index 0000000000..62afca9740 + static GLushort indices[] = { 0, 1, 2, 0, 2, 3 }; + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices); + update(); -+ m_image = image; ++ if (m_image.size() != image.size()) ++ m_image = image.scaled(m_width, m_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ++ else ++ m_image = image; +} + +void QOpenHarmonyEGLCore::update() @@ -4533,7 +4523,7 @@ index 0000000000..62afca9740 +} diff --git a/src/plugins/platforms/openharmony/qopenharmonyeglcore.h b/src/plugins/platforms/openharmony/qopenharmonyeglcore.h new file mode 100644 -index 0000000000..68c17e05e4 +index 0000000000..de764026b3 --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyeglcore.h @@ -0,0 +1,57 @@ @@ -4590,7 +4580,7 @@ index 0000000000..68c17e05e4 + int m_height; + bool m_valid = false; + bool m_inited = false; -+ mutable QImage m_image; ++ QImage m_image; +}; + +#endif // QOPENHARMONYEGLCORE_H @@ -5495,10 +5485,10 @@ index 0000000000..fca5cd99c3 +#endif // QOPENHARMONYJSWINDOW_H diff --git a/src/plugins/platforms/openharmony/qopenharmonyjswindowmanager.cpp b/src/plugins/platforms/openharmony/qopenharmonyjswindowmanager.cpp new file mode 100644 -index 0000000000..bcbb1f55fb +index 0000000000..08618e7bcd --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyjswindowmanager.cpp -@@ -0,0 +1,195 @@ +@@ -0,0 +1,191 @@ +#include "qopenharmonyjswindowmanager.h" +#include "qopenharmonyxcomponent.h" +#include "qopenharmonyjsenvironment.h" @@ -5680,14 +5670,10 @@ index 0000000000..bcbb1f55fb + +void QOpenHarmonyJsWindowManager::handleGeometryChange(const QString &name, const QRect &rect) +{ -+ if (QtOpenHarmony::isPhone()) { -+ QtOpenHarmony::updateDisplayMetrics(rect.width(), rect.height()); -+ } else { -+ QOpenHarmonyJsWindow *w = window(name); -+ if (w == nullptr) -+ return; -+ w->handleGeometryChange(rect); -+ } ++ QOpenHarmonyJsWindow *w = window(name); ++ if (w == nullptr) ++ return; ++ w->handleGeometryChange(rect); +} + +void QOpenHarmonyJsWindowManager::windowCreated() @@ -5867,10 +5853,10 @@ index 0000000000..1a88d88b24 +#endif // QOPENHARMONYDEFINES_H diff --git a/src/plugins/platforms/openharmony/qopenharmonymain.cpp b/src/plugins/platforms/openharmony/qopenharmonymain.cpp new file mode 100644 -index 0000000000..b09de23309 +index 0000000000..20866d1f5c --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonymain.cpp -@@ -0,0 +1,417 @@ +@@ -0,0 +1,430 @@ +#include +#include +#include @@ -5914,8 +5900,6 @@ index 0000000000..b09de23309 +static int m_screenHeightPixels = 0; +static int m_desktopWidthPixels = 0; +static int m_desktopHeightPixels = 0; -+static int m_avoidLeftWidth = 0; -+static int m_avoidTopHeight = 0; +static NativeResourceManager *m_resourceManager = nullptr; +static QOpenHarmonyPlatformIntegration *m_platformIntegration = nullptr; +static QOpenHarmonyFileEngineHandler *m_openHarmonyFileEngineHandler = nullptr; @@ -6083,8 +6067,8 @@ index 0000000000..b09de23309 + double xdpi = value[4]; + double ydpi = value[5]; + -+ m_avoidLeftWidth = static_cast(value[6]); -+ m_avoidTopHeight = static_cast(value[7]); ++ int left = static_cast(value[6]); ++ int top = static_cast(value[7]); + + m_desktopWidthPixels = static_cast(value[8]); + m_desktopHeightPixels = static_cast(value[9]); @@ -6093,7 +6077,7 @@ index 0000000000..b09de23309 + m_screenHeightPixels = qMax(m_screenHeightPixels, m_desktopHeightPixels); + + if (m_platformIntegration == nullptr) { -+ QOpenHarmonyPlatformIntegration::setDefaultDisplayMetrics(m_avoidLeftWidth, m_avoidTopHeight, m_desktopWidthPixels, ++ QOpenHarmonyPlatformIntegration::setDefaultDisplayMetrics(left, top, m_desktopWidthPixels, + m_desktopHeightPixels, + qRound(double(m_screenWidthPixels) / xdpi * 25.4), + qRound(double(m_screenHeightPixels) / ydpi * 25.4), @@ -6103,7 +6087,7 @@ index 0000000000..b09de23309 + m_platformIntegration->setDisplayMetrics(qRound(double(m_screenWidthPixels) / xdpi * 25.4), + qRound(double(m_screenHeightPixels) / ydpi * 25.4)); + m_platformIntegration->setScreenSize(m_screenWidthPixels, m_screenHeightPixels); -+ m_platformIntegration->setDesktopSize(m_avoidLeftWidth, m_avoidTopHeight, m_desktopWidthPixels, m_desktopHeightPixels); ++ m_platformIntegration->setDesktopSize(left, top, m_desktopWidthPixels, m_desktopHeightPixels); + } + return nullptr; +} @@ -6260,10 +6244,25 @@ index 0000000000..b09de23309 + +void QtOpenHarmony::updateDisplayMetrics(int w, int h) +{ -+ m_screenWidthPixels = w; -+ m_screenHeightPixels = h; -+ if (m_platformIntegration != nullptr) -+ m_platformIntegration->setScreenSize(w, h); ++// m_screenWidthPixels = w; ++// m_screenHeightPixels = h; ++ ++//// openharmony xdpi and ydpi is 0 ++// double xdpi = 72; ++// double ydpi = 72; ++// if (m_platformIntegration == nullptr) { ++// QOpenHarmonyPlatformIntegration::setDefaultDisplayMetrics(m_screenWidthPixels, ++// m_screenHeightPixels, ++// qRound(double(m_screenWidthPixels) / xdpi * 25.4), ++// qRound(double(m_screenHeightPixels) / ydpi * 25.4), ++// m_screenWidthPixels, ++// m_screenHeightPixels); ++// } else { ++// m_platformIntegration->setDisplayMetrics(qRound(double(m_desktopWidthPixels) / xdpi * 25.4), ++// qRound(double(m_desktopHeightPixels) / ydpi * 25.4)); ++// m_platformIntegration->setScreenSize(m_screenWidthPixels, m_screenHeightPixels); ++// m_platformIntegration->setDesktopSize(m_screenWidthPixels, m_screenWidthPixels); ++// } +} + +NativeResourceManager *QtOpenHarmony::resourceManager() @@ -6938,10 +6937,10 @@ index 0000000000..39762fdc90 +#endif // QOPENHARMONYPLATFORMDIALOGHELPERS_H diff --git a/src/plugins/platforms/openharmony/qopenharmonyplatformfontdatabase.cpp b/src/plugins/platforms/openharmony/qopenharmonyplatformfontdatabase.cpp new file mode 100644 -index 0000000000..ccad7c3358 +index 0000000000..894071dd1e --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyplatformfontdatabase.cpp -@@ -0,0 +1,36 @@ +@@ -0,0 +1,35 @@ +#include + +#include "qopenharmonyplatformfontdatabase.h" @@ -6961,7 +6960,6 @@ index 0000000000..ccad7c3358 + if (Q_UNLIKELY(!dir.exists())) { + qWarning("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?", + qPrintable(fontpath)); -+ //Todo Qt浣跨敤_stat鍑芥暟鑾峰彇鐘舵佷俊鎭椂杩斿洖-1锛屾潈闄愯鎷掔粷.浣嗘槸浣跨敤entryInfoList鑳藉鍒楀嚭鐩綍涓嬬殑瀛椾綋 + } + + QStringList nameFilters; @@ -8259,10 +8257,10 @@ index 0000000000..c885aa5fec +#endif // QOPENHARMONYPLATFORMOPENGLCONTEXT_H diff --git a/src/plugins/platforms/openharmony/qopenharmonyplatformopenglwindow.cpp b/src/plugins/platforms/openharmony/qopenharmonyplatformopenglwindow.cpp new file mode 100644 -index 0000000000..8e80ab7de7 +index 0000000000..547046ae7a --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyplatformopenglwindow.cpp -@@ -0,0 +1,220 @@ +@@ -0,0 +1,218 @@ +#include "qopenharmonyplatformopenglwindow.h" +#include "qopenharmonyxcomponent.h" +#include "qopenharmonyplatformscreen.h" @@ -8295,8 +8293,6 @@ index 0000000000..8e80ab7de7 + +QOpenHarmonyPlatformOpenGLWindow::~QOpenHarmonyPlatformOpenGLWindow() +{ -+ if (QtOpenHarmony::isPhone()) -+ return; + clearEgl(); + if (m_jsWindow != nullptr) + qJsWindowManager->destoryWindow(m_jsWindow); @@ -8365,12 +8361,12 @@ index 0000000000..8e80ab7de7 + +void QOpenHarmonyPlatformOpenGLWindow::setGeometry(const QRect &rect) +{ ++ if (m_jsWindow == nullptr) ++ createJsWindow(); ++ if (m_jsWindow == nullptr) ++ return; + // 鍦ㄦ墜鏈轰笂锛屾墍鏈夌獥鍙g粯鍒跺湪涓涓猉component, + if (!QtOpenHarmony::isPhone()) { -+ if (m_jsWindow == nullptr) -+ createJsWindow(); -+ if (m_jsWindow == nullptr) -+ return; + // 璁剧疆jswindow鐨勫昂瀵 + m_jsWindow->setGeometry(rect); + } @@ -8475,9 +8471,9 @@ index 0000000000..8e80ab7de7 +void QOpenHarmonyPlatformOpenGLWindow::setVisible(bool visible) +{ + QOpenHarmonyPlatformWindow::setVisible(visible); -+ if (!QtOpenHarmony::isPhone()) { -+ if (m_jsWindow == nullptr) -+ createJsWindow(); ++ if (m_jsWindow == nullptr) ++ createJsWindow(); ++ if (m_jsWindow != nullptr && !QtOpenHarmony::isPhone()) { + m_jsWindow->setVisible(visible); + } +} @@ -8572,10 +8568,10 @@ index 0000000000..c4cb6257c3 + diff --git a/src/plugins/platforms/openharmony/qopenharmonyplatformscreen.cpp b/src/plugins/platforms/openharmony/qopenharmonyplatformscreen.cpp new file mode 100644 -index 0000000000..10a9b29cf2 +index 0000000000..a77bf29b91 --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyplatformscreen.cpp -@@ -0,0 +1,329 @@ +@@ -0,0 +1,328 @@ +#include +#include + @@ -8759,7 +8755,6 @@ index 0000000000..10a9b29cf2 + QRect oldGeometry = m_availableGeometry; + + m_availableGeometry = rect; -+ + QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry(), availableGeometry()); + resizeMaximizedWindows(); + @@ -8816,8 +8811,8 @@ index 0000000000..10a9b29cf2 + return; + } + -+ if (m_window == nullptr || m_windowStack.isEmpty()) { -+ m_window = qJsWindowManager->createWindow(m_windowStack.first()); ++ if (m_window == nullptr) { ++ m_window = qJsWindowManager->createWindow(); + } + if (m_window == nullptr) { + return; diff --git a/patch/v5.12.12/qtdeclarative.patch b/patch/v5.12.12/qtdeclarative.patch index f28255effb..2919763bc8 100644 --- a/patch/v5.12.12/qtdeclarative.patch +++ b/patch/v5.12.12/qtdeclarative.patch @@ -148,7 +148,7 @@ index 9e5bc0b021..e12c80a777 100644 if (isResource) { // qrc resource diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp -index 3c97475e86..307ae5fd5c 100644 +index 3c97475e86..e6041d7aa5 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -45,6 +45,12 @@ @@ -175,7 +175,7 @@ index 3c97475e86..307ae5fd5c 100644 + mask->setZ(std::numeric_limits::max()); + QQuickTextPrivate *maskPrivate = QQuickTextPrivate::get(mask); + maskPrivate->anchors()->setRight(contentItemPrivate->right()); -+ maskPrivate->anchors()->setBottom(contentItemPrivate->bottom()); ++ maskPrivate->anchors()->setBottom(contentItemPrivate->bottom()); +#endif + customRenderMode = qgetenv("QSG_VISUALIZE"); diff --git a/patch/v5.12.12/qtremoteobjects.patch b/patch/v5.12.12/qtremoteobjects.patch index df1f4ef3ef..4fa952c631 100644 --- a/patch/v5.12.12/qtremoteobjects.patch +++ b/patch/v5.12.12/qtremoteobjects.patch @@ -1,11 +1,62 @@ diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro -index 69ca9f1..dec6143 100644 +index 69ca9f1..3fbd89e 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro -@@ -25,3 +25,8 @@ contains(QT_CONFIG, ssl): SUBDIRS += external_IODevice - - qtHaveModule(qml): SUBDIRS += qml - qtConfig(process): SUBDIRS += integration_multiprocess proxy_multiprocess integration_external restart +@@ -1,27 +1,32 @@ +-TEMPLATE = subdirs +- +-sub_localsockettestserver.subdir = localsockettestserver +-sub_localsockettestserver.target = sub-localsockettestserver +- +-sub_integration.subdir = integration +-sub_integration.target = sub-integration +-sub_integration.depends = sub-localsockettestserver +- +-SUBDIRS += \ +- benchmarks \ +- cmake \ +- modelreplica \ +- modelview \ +- pods \ +- proxy \ +- repc \ +- repcodegenerator \ +- repparser \ +- subclassreplica \ +- sub_integration \ +- sub_localsockettestserver +- +-contains(QT_CONFIG, ssl): SUBDIRS += external_IODevice +- +-qtHaveModule(qml): SUBDIRS += qml +-qtConfig(process): SUBDIRS += integration_multiprocess proxy_multiprocess integration_external restart ++TEMPLATE = subdirs ++ ++sub_localsockettestserver.subdir = localsockettestserver ++sub_localsockettestserver.target = sub-localsockettestserver ++ ++sub_integration.subdir = integration ++sub_integration.target = sub-integration ++sub_integration.depends = sub-localsockettestserver ++ ++SUBDIRS += \ ++ benchmarks \ ++ cmake \ ++ modelreplica \ ++ modelview \ ++ pods \ ++ proxy \ ++ repc \ ++ repcodegenerator \ ++ repparser \ ++ subclassreplica \ ++ sub_integration \ ++ sub_localsockettestserver ++ ++contains(QT_CONFIG, ssl): SUBDIRS += external_IODevice ++ ++qtHaveModule(qml): SUBDIRS += qml ++qtConfig(process): SUBDIRS += integration_multiprocess proxy_multiprocess integration_external restart + +!qtHaveModule(gui): SUBDIRS -= modelview + -- Gitee From bcee80e87ae752696808de134cd85cfc83db563f Mon Sep 17 00:00:00 2001 From: wanghao Date: Fri, 26 Jan 2024 16:33:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[fix]=20=E6=9B=B4=E6=96=B0v5.15.11=E8=A1=A5?= =?UTF-8?q?=E4=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanghao --- patch/v5.12.12/qtbase.patch | 1230 ++++++-------------------- patch/v5.12.12/qtconnectivity.patch | 277 ++---- patch/v5.12.12/qtdeclarative.patch | 111 ++- patch/v5.12.12/qtmultimedia.patch | 418 ++------- patch/v5.12.12/qtremoteobjects.patch | 65 -- 5 files changed, 485 insertions(+), 1616 deletions(-) diff --git a/patch/v5.12.12/qtbase.patch b/patch/v5.12.12/qtbase.patch index bb9f8f1bab..60a0900731 100644 --- a/patch/v5.12.12/qtbase.patch +++ b/patch/v5.12.12/qtbase.patch @@ -1,16 +1,17 @@ diff --git a/config.tests/arch/write_info.pri b/config.tests/arch/write_info.pri -index 3b55a63f49..e0518dd242 100644 +index 5b43ce1cd5..e0518dd242 100644 --- a/config.tests/arch/write_info.pri +++ b/config.tests/arch/write_info.pri -@@ -3,7 +3,7 @@ targetinfofile ~= s/pro$/target.txt/ +@@ -3,6 +3,9 @@ targetinfofile ~= s/pro$/target.txt/ win32 { ext = .exe --} else:android { +} else:android|openharmony { - file_prefix = lib - ext = .so ++ file_prefix = lib ++ ext = .so } else:wasm { + ext = .wasm + } diff --git a/mkspecs/common/oh-base-head.conf b/mkspecs/common/oh-base-head.conf new file mode 100644 index 0000000000..d7be212137 @@ -133,45 +134,16 @@ index 0000000000..14524b35ee + !contains(TARGET, ".so"): TARGET = lib$${TARGET}.so + QMAKE_LFLAGS += -Wl,-soname,$$shell_quote($$TARGET) +} -diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf -index 850ee98057..8c92306173 100644 ---- a/mkspecs/features/qt_configure.prf -+++ b/mkspecs/features/qt_configure.prf -@@ -777,6 +777,7 @@ defineTest(qtConfLibrary_inline) { - # this source type cannot fail. - defineTest(qtConfLibrary_makeSpec) { - spec = $$eval($${1}.spec) -+ - isEmpty(spec): \ - error("makeSpec source in library '$$eval($${1}.library)' does not specify 'spec'.") - -@@ -1233,6 +1234,7 @@ defineTest(qtConfPrepareCompileTestSource) { - defineTest(qtConfTest_compile) { - test = $$eval($${1}.test) - host = $$eval($${1}.host) -+ - isEmpty(host): host = false - - test_base_out_dir = $$OUT_PWD/$$basename(QMAKE_CONFIG_TESTS_DIR) -@@ -2135,8 +2137,7 @@ defineTest(qtConfOutput_publicFeature) { - name = "$$eval($${1}.name)" - isEmpty(name): \ - name = $$eval($${1}.feature) -- feature = $$replace(name, [-+.], _) -- -+ feature = $$replace(name, [-+.], _) - $${2} { - qtConfExtendVar("publicPro", "QT.$${currentModule}.enabled_features", $$name) - QT.$${currentModule}.enabled_features += $$name diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf -index 40528a65e2..3e563b8cc0 100644 +index 573d717eea..94b8dd5666 100644 --- a/mkspecs/features/qt_plugin.prf +++ b/mkspecs/features/qt_plugin.prf -@@ -91,7 +91,17 @@ CONFIG(static, static|shared)|prefix_build { +@@ -91,8 +91,19 @@ CONFIG(static, static|shared)|prefix_build { target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE INSTALLS += target --TARGET = $$qt5LibraryTarget($$TARGET) +-qt_libinfix_plugins: TARGET = $$TARGET$$QT_LIBINFIX +-TARGET = $$qt5LibraryTarget($$TARGET, "plugins/$$PLUGIN_TYPE/") +defineReplace(qt5OpenHarmonyPluginTarget) { + LIBRARY_NAME_PREFIX = $$2 + LIBRARY_NAME_PREFIX = $$replace(LIBRARY_NAME_PREFIX, "//", "/") @@ -183,6 +155,8 @@ index 40528a65e2..3e563b8cc0 100644 + + +TARGET = $$qt5OpenHarmonyPluginTarget($$TARGET, "plugins/$$PLUGIN_TYPE/") ++#qt_libinfix_plugins: TARGET = $$TARGET$$QT_LIBINFIX ++#TARGET = $$qt5LibraryTarget($$TARGET, "plugins/$$PLUGIN_TYPE/") CONFIG += create_cmake @@ -415,10 +389,10 @@ index 0000000000..f405c91ecb + +#endif // QPLATFORMDEFS_H diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp -index 3c82097cfe..f85b2baa19 100644 +index 292116cc47..540d6f00a1 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp -@@ -1679,6 +1679,36 @@ static bool android_default_message_handler(QtMsgType type, +@@ -1668,6 +1668,36 @@ static bool android_default_message_handler(QtMsgType type, } #endif //Q_OS_ANDROID @@ -428,8 +402,8 @@ index 3c82097cfe..f85b2baa19 100644 +#define APP_LOG_TAG "QtForOpenHarmony" + +static bool openharmony_default_message_handler(QtMsgType type, -+ const QMessageLogContext &context, -+ const QString &message) ++ const QMessageLogContext &context, ++ const QString &message) +{ + if (shouldLogToStderr()) + return false; // Leave logging up to stderr handler @@ -453,9 +427,9 @@ index 3c82097cfe..f85b2baa19 100644 +#endif + #ifdef Q_OS_WIN - static bool win_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &message) + static void win_outputDebugString_helper(const QString &message) { -@@ -1770,6 +1800,8 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con +@@ -1779,6 +1809,8 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con handledStderr |= AppleUnifiedLogger::messageHandler(type, context, message); # elif defined Q_OS_WASM handledStderr |= wasm_default_message_handler(type, context, message); @@ -465,10 +439,10 @@ index 3c82097cfe..f85b2baa19 100644 #endif diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h -index d87e181e5c..22227d672a 100644 +index ad5d30d544..72a026b182 100644 --- a/src/corelib/global/qsystemdetection.h +++ b/src/corelib/global/qsystemdetection.h -@@ -111,6 +111,9 @@ +@@ -118,6 +118,9 @@ #elif defined(__ANDROID__) || defined(ANDROID) # define Q_OS_ANDROID # define Q_OS_LINUX @@ -479,7 +453,7 @@ index d87e181e5c..22227d672a 100644 # define Q_OS_CYGWIN #elif !defined(SAG_COM) && (!defined(WINAPI_FAMILY) || WINAPI_FAMILY==WINAPI_FAMILY_DESKTOP_APP) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp -index 500b475d1d..8b09cfb04d 100644 +index ee378f6434..1798a905c6 100644 --- a/src/corelib/io/qfileselector.cpp +++ b/src/corelib/io/qfileselector.cpp @@ -199,6 +199,9 @@ static bool isLocalScheme(const QString &file) @@ -504,7 +478,7 @@ index 500b475d1d..8b09cfb04d 100644 QString equivalentPath = scheme + filePath.path(); QString selectedPath = d->select(equivalentPath); diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp -index 6d82981fd6..5896fcbdb5 100644 +index 50512a4a73..3d6226cd2c 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -445,6 +445,11 @@ static inline QString webDavScheme() @@ -519,18 +493,18 @@ index 6d82981fd6..5896fcbdb5 100644 static inline QString webDavSslTag() { return QStringLiteral("@SSL"); -@@ -1021,6 +1026,9 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro +@@ -1018,6 +1023,9 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro if (scheme == fileScheme() #ifdef Q_OS_WIN || scheme == webDavScheme() +#endif +#ifdef Q_OS_OPENHARMONY -+ || scheme == harmonyFileScheme() ++ || scheme == harmonyFileScheme() #endif ) { flags |= IsLocalFile; diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri -index 3f7bf3cd47..f7c6fa9dc8 100644 +index 749672c899..602dce2d9f 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -212,4 +212,24 @@ android:!android-embedded { @@ -559,10 +533,10 @@ index 3f7bf3cd47..f7c6fa9dc8 100644 + !darwin:!unix:!win32: SOURCES += kernel/qelapsedtimer_generic.cpp diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp -index db6546028a..10fba6c9c8 100644 +index d671f70bd3..cebbec8e29 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp -@@ -2337,7 +2337,7 @@ QString QCoreApplication::applicationFilePath() +@@ -2335,7 +2335,7 @@ QString QCoreApplication::applicationFilePath() } #endif #if defined( Q_OS_UNIX ) @@ -870,10 +844,10 @@ index 0000000000..0c0bd12c64 +#endif // QJNIHELPERS_H diff --git a/src/corelib/kernel/qopenharmonyjsenvironment.cpp b/src/corelib/kernel/qopenharmonyjsenvironment.cpp new file mode 100644 -index 0000000000..0d9c42fc33 +index 0000000000..8b8af52eee --- /dev/null +++ b/src/corelib/kernel/qopenharmonyjsenvironment.cpp -@@ -0,0 +1,404 @@ +@@ -0,0 +1,402 @@ +#include "qopenharmonyjsenvironment.h" +#include "qopenharmonydefines.h" +#include "qopenharmonyhelpers_p.h" @@ -959,10 +933,8 @@ index 0000000000..0d9c42fc33 +napi_value QOpenHarmonyJsEnvironment::createObject(const QVariantMap &map) +{ + napi_value result = nullptr; -+ QMapIterator i(map); + NAPI_CALL_BASE(m_env, napi_create_object(m_env, &result), nullptr); -+ while (i.hasNext()) { -+ i.next(); ++ for (auto i = map.cbegin(); i != map.cend(); ++i){ + napi_value name = createString(i.key()); + napi_value v = QtHarmonyPrivate::variant_to_napi_value(i.value()); + napi_set_property(m_env, result, name, v); @@ -1710,7 +1682,7 @@ index 0000000000..4c982d1784 +#endif // QOPENHARMONYJSFUNCTION_H diff --git a/src/corelib/kernel/qopenharmonyjsobject.cpp b/src/corelib/kernel/qopenharmonyjsobject.cpp new file mode 100644 -index 0000000000..f97073cd90 +index 0000000000..9141921922 --- /dev/null +++ b/src/corelib/kernel/qopenharmonyjsobject.cpp @@ -0,0 +1,95 @@ @@ -1745,7 +1717,7 @@ index 0000000000..f97073cd90 + : d_ptr(new QOpenHarmonyJsObjectPrivate(objectType, objectName)) +{ + d_ptr->q_ptr = this; -+ // 蹇呴』浣跨敤ref, 鍚﹀垯浼氬穿婧 ++ // 必须使用ref, 否则会崩溃 + napi_create_reference(qJs::env(), jsObject, 1, &d_ptr->m_jsObject); +} + @@ -2275,64 +2247,70 @@ index 0000000000..e980f4cf8d + napi_module_register(&openharmonyQtCoreModule); +} diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp -index 35c64180d4..396ee5882c 100644 +index 582f48e93e..d9032f61ed 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp -@@ -193,7 +193,11 @@ void QFactoryLoader::update() +@@ -196,10 +196,10 @@ void QFactoryLoader::update() continue; d->loadedPaths << pluginDir; -+#ifdef Q_OS_OPENHARMONY -+ QString path = pluginDir; -+#else - QString path = pluginDir + d->suffix; -+#endif +-#ifdef Q_OS_ANDROID ++#if defined(Q_OS_ANDROID) || defined(Q_OS_OPENHARMONY) + QString path = pluginDir; + #else +- QString path = pluginDir + d->suffix; ++ QString path = pluginDir + d->suffix; + #endif if (qt_debug_component()) - qDebug() << "QFactoryLoader::QFactoryLoader() checking directory path" << path << "..."; -@@ -204,6 +208,8 @@ void QFactoryLoader::update() +@@ -211,10 +211,10 @@ void QFactoryLoader::update() QStringList plugins = QDir(path).entryList( - #ifdef Q_OS_WIN + #if defined(Q_OS_WIN) QStringList(QStringLiteral("*.dll")), -+#elif defined(Q_OS_OPENHARMONY) -+ QStringList(QString("libplugins_%1_*.so").arg(d->suffix)), +-#elif defined(Q_OS_ANDROID) ++#elif defined(Q_OS_ANDROID) || defined(Q_OS_OPENHARMONY) + QStringList(QLatin1String("libplugins_%1_*.so").arg(d->suffix)), #endif - QDir::Files); - QLibraryPrivate *library = 0; -@@ -339,6 +345,10 @@ QFactoryLoader::QFactoryLoader(const char *iid, +- QDir::Files); ++ QDir::Files); + QLibraryPrivate *library = nullptr; + + for (int j = 0; j < plugins.count(); ++j) { +@@ -349,9 +349,9 @@ QFactoryLoader::QFactoryLoader(const char *iid, #if QT_CONFIG(library) d->cs = cs; d->suffix = suffix; -+# ifdef Q_OS_OPENHARMONY -+ if (!d->suffix.isEmpty() && d->suffix.at(0) == QLatin1Char('/')) -+ d->suffix.remove(0, 1); -+# endif +-# ifdef Q_OS_ANDROID ++#if defined(Q_OS_ANDROID) || defined(Q_OS_OPENHARMONY) + if (!d->suffix.isEmpty() && d->suffix.at(0) == QLatin1Char('/')) +- d->suffix.remove(0, 1); ++ d->suffix.remove(0, 1); + # endif QMutexLocker locker(qt_factoryloader_mutex()); - update(); diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp -index 695d45d8e7..b10617fdaa 100644 +index a27782d37c..f900b4eb5c 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp -@@ -312,7 +312,7 @@ static void setCurrentThreadName(const char *name) +@@ -302,7 +302,7 @@ void terminate_on_exception(T &&t) void *QThreadPrivate::start(void *arg) { -#if !defined(Q_OS_ANDROID) +#if !defined(Q_OS_ANDROID) && !defined(Q_OS_OPENHARMONY) - pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, nullptr); #endif pthread_cleanup_push(QThreadPrivate::finish, arg); -@@ -354,7 +354,7 @@ void *QThreadPrivate::start(void *arg) +@@ -343,7 +343,7 @@ void *QThreadPrivate::start(void *arg) #endif emit thr->started(QThread::QPrivateSignal()); -#if !defined(Q_OS_ANDROID) +#if !defined(Q_OS_ANDROID) && !defined(Q_OS_OPENHARMONY) - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, nullptr); pthread_testcancel(); #endif -@@ -751,7 +751,7 @@ void QThread::start(Priority priority) +@@ -721,7 +721,7 @@ void QThread::start(Priority priority) void QThread::terminate() { @@ -2341,7 +2319,7 @@ index 695d45d8e7..b10617fdaa 100644 Q_D(QThread); QMutexLocker locker(&d->mutex); -@@ -793,7 +793,7 @@ void QThread::setTerminationEnabled(bool enabled) +@@ -764,7 +764,7 @@ void QThread::setTerminationEnabled(bool enabled) "Current thread was not started with QThread."); Q_UNUSED(thr) @@ -2349,34 +2327,34 @@ index 695d45d8e7..b10617fdaa 100644 +#if defined(Q_OS_ANDROID) || defined(Q_OS_OPENHARMONY) Q_UNUSED(enabled); #else - pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, NULL); + pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, nullptr); diff --git a/src/gui/configure.json b/src/gui/configure.json -index 6dd6f5b16c..65d59f07be 100644 +index 1f08795c57..a14a499e4a 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json -@@ -1313,7 +1313,7 @@ +@@ -1306,7 +1306,7 @@ "label": "OpenGL ES 2.0", - "enable": "input.opengl == 'es2'", + "enable": "input.opengl == 'es2' || input.angle == 'yes'", "disable": "input.opengl == 'desktop' || input.opengl == 'dynamic' || input.opengl == 'no'", -- "condition": "config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)", -+ "condition": "config.openharmony || config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)", +- "condition": "(config.win32 && !features.opengl-dynamic) || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)", ++ "condition": "config.openharmony || (config.win32 && !features.opengl-dynamic) || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)", "output": [ "publicFeature", "publicQtConfig", -@@ -1323,7 +1323,7 @@ +@@ -1316,7 +1316,7 @@ }, "opengles3": { "label": "OpenGL ES 3.0", -- "condition": "features.opengles2 && !features.angle && tests.opengles3 && !config.wasm", -+ "condition": "features.opengles2 && !features.angle && !config.wasm", +- "condition": "features.opengles2 && !features.angle && tests.opengles3", ++ "condition": "features.opengles2 && !features.angle", "output": [ "publicFeature", { "type": "define", "name": "QT_OPENGL_ES_3" } diff --git a/src/gui/configure.pri b/src/gui/configure.pri -index 1b95449a10..b409140a2d 100644 +index 490ef0df28..537fd3ff69 100644 --- a/src/gui/configure.pri +++ b/src/gui/configure.pri -@@ -66,6 +66,7 @@ defineTest(qtConfTest_qpaDefaultPlatform) { +@@ -70,6 +70,7 @@ defineTest(qtConfTest_qpaDefaultPlatform) { else: integrity: name = integrityfb else: haiku: name = haiku else: wasm: name = wasm @@ -2384,37 +2362,37 @@ index 1b95449a10..b409140a2d 100644 else: name = xcb $${1}.value = $$name -diff --git a/src/gui/gui.pro b/src/gui/gui.pro -index 06c9cd3939..d45b4d8b8c 100644 ---- a/src/gui/gui.pro -+++ b/src/gui/gui.pro -@@ -70,7 +70,12 @@ qtConfig(angle) { - CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2 - } else { - qtConfig(egl) { -- CMAKE_EGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_EGL) -+ #FIXME wanghao changed QMAKE_LIBS_EGL is absolute path -+ openharmony { -+ CMAKE_EGL_LIBS = EGL -+ } else { -+ CMAKE_EGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_EGL) -+ } - !isEmpty(QMAKE_LIBDIR_EGL): CMAKE_EGL_LIBDIR += $$cmakeTargetPath($$QMAKE_LIBDIR_EGL) +diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp +index c7ff2a6dac..bccadc3084 100644 +--- a/src/gui/kernel/qguiapplication.cpp ++++ b/src/gui/kernel/qguiapplication.cpp +@@ -1220,7 +1220,7 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString + arguments.append(QLibraryInfo::platformPluginArguments(argumentsKey)); + + // Create the platform integration. +- QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, arguments, argc, argv, platformPluginPath); ++ QGuiApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name, arguments, argc, argv, platformPluginPath); + if (Q_UNLIKELY(!QGuiApplicationPrivate::platform_integration)) { + if (availablePlugins.contains(name)) { + qCInfo(lcQpaPluginLoading).nospace().noquote() +diff --git a/src/gui/kernel/qplatformintegrationfactory.cpp b/src/gui/kernel/qplatformintegrationfactory.cpp +index 3fcf9014a7..f478f0178c 100644 +--- a/src/gui/kernel/qplatformintegrationfactory.cpp ++++ b/src/gui/kernel/qplatformintegrationfactory.cpp +@@ -67,7 +67,7 @@ QPlatformIntegration *QPlatformIntegrationFactory::create(const QString &platfor } + #else + Q_UNUSED(platformPluginPath); +-#endif ++#endif + return qLoadPlugin(loader(), platform, paramList, argc, argv); + } -@@ -78,6 +83,7 @@ qtConfig(angle) { - !isEmpty(QMAKE_INCDIR_OPENGL_ES2): CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES2) - CMAKE_OPENGL_INCDIRS = $$cmakePortablePaths($$QMAKE_INCDIR_OPENGL_ES2) - CMAKE_OPENGL_LIBS = $$cmakeProcessLibs($$QMAKE_LIBS_OPENGL_ES2) -+ openharmony:CMAKE_OPENGL_LIBS=GLESv3 #FIXME wanghao changed CMAKE_OPENGL_LIBS is absolute path - !isEmpty(QMAKE_LIBDIR_OPENGL_ES2): CMAKE_OPENGL_LIBDIR = $$cmakePortablePaths($$QMAKE_LIBDIR_OPENGL_ES2) - CMAKE_GL_HEADER_NAME = GLES2/gl2.h - CMAKE_QT_OPENGL_IMPLEMENTATION = GLESv2 diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp -index f208eb02be..9033d0730c 100644 +index 990272b0c2..b1b539bfb3 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp -@@ -392,7 +392,11 @@ QRect QScreen::geometry() const +@@ -427,7 +427,11 @@ QRect QScreen::geometry() const QRect QScreen::availableGeometry() const { Q_D(const QScreen); @@ -2426,21 +2404,8 @@ index f208eb02be..9033d0730c 100644 } /*! -diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp -index bd409c124f..29bb587b12 100644 ---- a/src/gui/kernel/qsimpledrag.cpp -+++ b/src/gui/kernel/qsimpledrag.cpp -@@ -248,7 +248,7 @@ void QBasicDrag::recreateShapedPixmapWindow(QScreen *screen, const QPoint &pos) - - m_drag_icon_window->setUseCompositing(m_useCompositing); - m_drag_icon_window->setPixmap(m_drag->pixmap()); -- m_drag_icon_window->setHotspot(m_drag->hotSpot()); -+ m_drag_icon_window->setHotspot(m_drag->hotSpot()); - m_drag_icon_window->updateGeometry(pos); - m_drag_icon_window->setVisible(true); - } diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp -index 60353cb03e..b8b7290cbf 100644 +index 507417f86c..a29678555e 100644 --- a/src/network/access/qnetworkaccessfilebackend.cpp +++ b/src/network/access/qnetworkaccessfilebackend.cpp @@ -57,6 +57,9 @@ QStringList QNetworkAccessFileBackendFactory::supportedSchemes() const @@ -2476,10 +2441,10 @@ index 60353cb03e..b8b7290cbf 100644 fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); } diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp -index 31b1dbf2a5..c42d41d696 100644 +index a10fe9e3fe..7c363279a2 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp -@@ -1378,6 +1378,9 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera +@@ -1419,6 +1419,9 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera if (isLocalFile #ifdef Q_OS_ANDROID || scheme == QLatin1String("assets") @@ -2490,129 +2455,21 @@ index 31b1dbf2a5..c42d41d696 100644 || scheme == QLatin1String("qrc")) { return new QNetworkReplyFileImpl(this, req, op); diff --git a/src/network/access/qnetworkreplyfileimpl.cpp b/src/network/access/qnetworkreplyfileimpl.cpp -index ef319ebf0d..7f531f5b47 100644 +index 6e69b4c4d3..ff8ff19361 100644 --- a/src/network/access/qnetworkreplyfileimpl.cpp +++ b/src/network/access/qnetworkreplyfileimpl.cpp -@@ -109,6 +109,11 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QNetworkAccessManager *manager, con +@@ -110,6 +110,11 @@ QNetworkReplyFileImpl::QNetworkReplyFileImpl(QNetworkAccessManager *manager, con if (scheme == QLatin1String("assets")) fileName = QLatin1String("assets:") + url.path(); else +#endif +#if defined(Q_OS_OPENHARMONY) -+ if (scheme == QLatin1String("rawfile")) -+ fileName = QLatin1String("rawfile:") + url.path(); -+ else ++ if (scheme == QLatin1String("rawfile")) ++ fileName = QLatin1String("rawfile:") + url.path(); ++ else #endif fileName = url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery); } -diff --git a/src/network/socket/qabstractsocketengine.cpp b/src/network/socket/qabstractsocketengine.cpp -index 3fffff6d5a..f461b555dc 100644 ---- a/src/network/socket/qabstractsocketengine.cpp -+++ b/src/network/socket/qabstractsocketengine.cpp -@@ -117,8 +117,7 @@ QAbstractSocketEngine *QAbstractSocketEngine::createSocketEngine(QAbstractSocket - // only NoProxy can have reached here - if (proxy.type() != QNetworkProxy::NoProxy) - return 0; --#endif -- -+#endif - return new QNativeSocketEngine(parent); - } - -diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp -index 8947a7ee8a..11ad26f306 100644 ---- a/src/network/socket/qnativesocketengine.cpp -+++ b/src/network/socket/qnativesocketengine.cpp -@@ -440,7 +440,7 @@ QNativeSocketEngine::~QNativeSocketEngine() - broadcast enabled. - */ - bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType socketType, QAbstractSocket::NetworkLayerProtocol protocol) --{ -+{ - Q_D(QNativeSocketEngine); - if (isValid()) - close(); -@@ -691,15 +691,20 @@ bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port) - */ - bool QNativeSocketEngine::listen() - { -+ qWarning() << "<-----------QNativeSocketEngine::listen()---000"; - Q_D(QNativeSocketEngine); -+ qWarning() << "<-----------QNativeSocketEngine::listen()---111"; - Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::listen(), false); -+ qWarning() << "<-----------QNativeSocketEngine::listen()---222"; - Q_CHECK_STATE(QNativeSocketEngine::listen(), QAbstractSocket::BoundState, false); - #ifndef QT_NO_SCTP - Q_CHECK_TYPES(QNativeSocketEngine::listen(), QAbstractSocket::TcpSocket, - QAbstractSocket::SctpSocket, false); - #else -+ qWarning() << "<-----------QNativeSocketEngine::listen()---333"; - Q_CHECK_TYPE(QNativeSocketEngine::listen(), QAbstractSocket::TcpSocket, false); - #endif -+ qWarning() << "<-----------QNativeSocketEngine::listen()---444"; - - // We're using a backlog of 50. Most modern kernels support TCP - // syncookies by default, and if they do, the backlog is ignored. -diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp -index e7e4d64c32..7a6dfe44bc 100644 ---- a/src/network/socket/qsocks5socketengine.cpp -+++ b/src/network/socket/qsocks5socketengine.cpp -@@ -1906,13 +1906,13 @@ QAbstractSocketEngine * - QSocks5SocketEngineHandler::createSocketEngine(QAbstractSocket::SocketType socketType, - const QNetworkProxy &proxy, QObject *parent) - { -- Q_UNUSED(socketType); -- -+ Q_UNUSED(socketType); - // proxy type must have been resolved by now - if (proxy.type() != QNetworkProxy::Socks5Proxy) { - QSOCKS5_DEBUG << "not proxying"; - return 0; - } -+ - QScopedPointer engine(new QSocks5SocketEngine(parent)); - engine->setProxy(proxy); - return engine.take(); -diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp -index eddf789921..f0f3a62935 100644 ---- a/src/network/socket/qtcpserver.cpp -+++ b/src/network/socket/qtcpserver.cpp -@@ -305,11 +305,10 @@ bool QTcpServer::listen(const QHostAddress &address, quint16 port) - static const QNetworkProxy &proxy = *(QNetworkProxy *)0; - #else - QNetworkProxy proxy = d->resolveProxy(addr, port); --#endif -- -+#endif - delete d->socketEngine; - d->socketEngine = QAbstractSocketEngine::createSocketEngine(d->socketType, proxy, this); -- if (!d->socketEngine) { -+ if (!d->socketEngine) { - d->serverSocketError = QAbstractSocket::UnsupportedSocketOperationError; - d->serverSocketErrorString = tr("Operation on socket is not supported"); - return false; -@@ -318,18 +317,18 @@ bool QTcpServer::listen(const QHostAddress &address, quint16 port) - //copy network session down to the socket engine (if it has been set) - d->socketEngine->setProperty("_q_networksession", property("_q_networksession")); - #endif -- if (!d->socketEngine->initialize(d->socketType, proto)) { -+ if (!d->socketEngine->initialize(d->socketType, proto)) { - d->serverSocketError = d->socketEngine->error(); - d->serverSocketErrorString = d->socketEngine->errorString(); - return false; - } -+ - proto = d->socketEngine->protocol(); - if (addr.protocol() == QAbstractSocket::AnyIPProtocol && proto == QAbstractSocket::IPv4Protocol) - addr = QHostAddress::AnyIPv4; - - d->configureCreatedSocket(); -- -- if (!d->socketEngine->bind(addr, port)) { -+ if (!d->socketEngine->bind(addr, port)) { - d->serverSocketError = d->socketEngine->error(); - d->serverSocketErrorString = d->socketEngine->errorString(); - return false; diff --git a/src/openharmony/entryability/EntryAbility.ts b/src/openharmony/entryability/EntryAbility.ts new file mode 100644 index 0000000000..6a4626655c @@ -2665,10 +2522,10 @@ index 0000000000..6a4626655c +}; diff --git a/src/openharmony/native/QtCore/JsApplication.ts b/src/openharmony/native/QtCore/JsApplication.ts new file mode 100644 -index 0000000000..b27e0379b9 +index 0000000000..e5bd848229 --- /dev/null +++ b/src/openharmony/native/QtCore/JsApplication.ts -@@ -0,0 +1,152 @@ +@@ -0,0 +1,156 @@ +import window from '@ohos.window'; +import display from '@ohos.display'; +import fs from '@ohos.file.fs'; @@ -2697,6 +2554,14 @@ index 0000000000..b27e0379b9 + (obj as JsWindowManager).addWindow(name, window); + } + ++ updateQtScreen(size: window.Size): void { ++ let d = display.getDefaultDisplaySync(); ++ let titleHeight: number = JsDataStore.windowTitleHeight(); ++ let borderWidth: number = JsDataStore.windowBorderWidth(); ++ JsDataStore.getQtNativeModule("QPA").setDisplayMetrics(size.width - borderWidth - borderWidth, size.height - titleHeight - borderWidth, d.densityDPI, d.scaledDensity, d.xDPI, d.yDPI, ++ 0, 0, size.width - borderWidth - borderWidth, size.height - titleHeight - borderWidth); ++ } ++ + async run(windowStage: window.WindowStage) { + let qtMajorVersion: number = this.qpa.qtMajorVersion(); + let QtCoreModule: any = null; @@ -2724,15 +2589,11 @@ index 0000000000..b27e0379b9 + let localStore = new LocalStorage({"name": this.mainWindowName}); + await windowStage.loadContent('pages/Index', localStore); + this.addWindow(this.mainWindowName, window); -+ let p = this.mainWindow.getWindowProperties(); -+ let d = display.getDefaultDisplaySync(); + if (this.qpa != null) { -+ this.qpa.setDisplayMetrics(p.windowRect.width, p.windowRect.height, d.densityDPI, d.scaledDensity, d.xDPI, d.yDPI, -+ 0, 0, p.windowRect.width, p.windowRect.height); -+ this.qpa.setDeviceType(JsDataStore.deviceType()); -+ // this.qpa.setDisplayMetrics(d.width, d.height, d.densityDPI, d.scaledDensity, d.xDPI, d.yDPI, -+ // area.leftRect.left, area.topRect.height, d.width - area.leftRect.width - area.rightRect.width, d.height - area.topRect.height - area.bottomRect.height); ++ let p = this.mainWindow.getWindowProperties(); ++ this.updateQtScreen({width: p.windowRect.width, height: p.windowRect.height}); + } ++ this.mainWindow.on("windowSizeChange", this.updateQtScreen); + windowStage.on("windowStageEvent", (state)=>{ + if (this.qpa != null) + this.qpa.updateApplicationState(state); @@ -2824,10 +2685,10 @@ index 0000000000..b27e0379b9 \ No newline at end of file diff --git a/src/openharmony/native/QtCore/JsDataStore.ts b/src/openharmony/native/QtCore/JsDataStore.ts new file mode 100644 -index 0000000000..4650216b2e +index 0000000000..a16eee9e0a --- /dev/null +++ b/src/openharmony/native/QtCore/JsDataStore.ts -@@ -0,0 +1,114 @@ +@@ -0,0 +1,136 @@ +import common from '@ohos.app.ability.common'; +import window from '@ohos.window'; +import bundleManager from '@ohos.bundle.bundleManager'; @@ -2936,9 +2797,31 @@ index 0000000000..4650216b2e + } + + deviceType(): string { ++ // 现目前在pc、pad上模拟成手机端 + return 'default'; + // return deviceInfo.deviceType; + } ++ ++ windowTitleHeight(): number { ++ // Todo read from system ++ return deviceInfo.deviceType == "default" ? 0 : 93; ++ } ++ ++ windowBorderWidth(): number { ++ // Todo read from system ++ return deviceInfo.deviceType == "default" ? 0 : 4; ++ } ++ ++ statusBarHeight(): number { ++ // Todo read from system ++ return deviceInfo.deviceType == "default" ? 0 : 73; ++ } ++ ++ navigationBarHeight(): number { ++ // Todo read from system ++ return deviceInfo.deviceType == "default" ? 0 : 100; ++ } ++ +} + +export default new JsDataStore; @@ -3698,10 +3581,10 @@ index 0000000000..12729a2b3b \ No newline at end of file diff --git a/src/openharmony/native/QtCore/JsWindow.ts b/src/openharmony/native/QtCore/JsWindow.ts new file mode 100644 -index 0000000000..76ea421090 +index 0000000000..369eb9fbe0 --- /dev/null +++ b/src/openharmony/native/QtCore/JsWindow.ts -@@ -0,0 +1,85 @@ +@@ -0,0 +1,81 @@ +import window from '@ohos.window' +import JsLogger from './JsLogger' +import display from '@ohos.display'; @@ -3718,11 +3601,7 @@ index 0000000000..76ea421090 + this.window = window; + this.window?.on("windowSizeChange", (size)=>{ + JsLogger.info("%{public}s window size changed %{public}d %{public}d", name, size.width, size.height); -+ let d = display.getDefaultDisplaySync(); -+ // JsDataStore.getQtNativeModule("QPA").handleGeometryChange(name, p.windowRect.left, p.windowRect.top, size.width, size.height); -+ JsDataStore.getQtNativeModule("QPA").setDisplayMetrics(size.width, size.height, d.densityDPI, d.scaledDensity, d.xDPI, d.yDPI, -+ 0, 0, size.width, size.height); -+ JsDataStore.getQtNativeModule("QPA").handleGeometryChange(name, 0, 0, size.width, size.height); ++ // JsDataStore.getQtNativeModule("QPA").handleGeometryChange(name, 0, 0, size.width, size.height); + }); + } + @@ -3880,21 +3759,28 @@ index 0000000000..8e956b4724 + } +} diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp -index ad134a825f..dcbefde499 100644 +index 24b2821fbb..e13a08cf45 100644 --- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp +++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp -@@ -149,10 +149,14 @@ void QEvdevKeyboardHandler::switchLed(int led, bool state) - qCDebug(qLcEvdevKey) << "switchLed" << led << state; +@@ -159,16 +159,17 @@ std::unique_ptr QEvdevKeyboardHandler::create(const QStri + + void QEvdevKeyboardHandler::switchLed(int led, bool state) + { +- qCDebug(qLcEvdevKey, "switchLed %d %d", led, int(state)); ++ qCDebug(qLcEvdevKey) << "switchLed" << led << state; - struct ::input_event led_ie; ++ struct ::input_event led_ie; +#if __BITS_PER_LONG != 32 || !defined(__USE_TIME_BITS64) - ::gettimeofday(&led_ie.time, 0); ++ ::gettimeofday(&led_ie.time, 0); ++#else + struct timeval tv; + ::gettimeofday(&tv, 0); +- struct ::input_event led_ie; +- led_ie.input_event_sec = tv.tv_sec; +- led_ie.input_event_usec = tv.tv_usec; - led_ie.type = EV_LED; - led_ie.code = led; - led_ie.value = state; -+#else -+ struct timeval tv; -+ ::gettimeofday(&tv, 0); + led_ie.__sec = tv.tv_sec; + led_ie.__usec = tv.tv_usec; +#endif @@ -3902,21 +3788,23 @@ index ad134a825f..dcbefde499 100644 qt_safe_write(m_fd.get(), &led_ie, sizeof(led_ie)); } diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp -index 70271c7fd6..1634094364 100644 +index 7f1f0ebdae..e48e79e1b1 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp -@@ -568,7 +568,11 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) +@@ -582,8 +582,11 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) // update timestamps m_lastTimeStamp = m_timeStamp; +- m_timeStamp = data->input_event_sec + data->input_event_usec / 1000000.0; +- +#if __BITS_PER_LONG != 32 || !defined(__USE_TIME_BITS64) - m_timeStamp = data->time.tv_sec + data->time.tv_usec / 1000000.0; ++ m_timeStamp = data->time.tv_sec + data->time.tv_usec / 1000000.0; +#else + m_timeStamp = data->__sec + data->__usec / 1000000.0 ; +#endif - m_lastTouchPoints = m_touchPoints; m_touchPoints.clear(); + Qt::TouchPointStates combinedStates; diff --git a/src/plugins/platforms/openharmony/openharmony.json b/src/plugins/platforms/openharmony/openharmony.json new file mode 100644 index 0000000000..886625295c @@ -4180,10 +4068,10 @@ index 0000000000..f29ee6fccb +#endif // QOPENHARMONYDRAG_H diff --git a/src/plugins/platforms/openharmony/qopenharmonyeglcore.cpp b/src/plugins/platforms/openharmony/qopenharmonyeglcore.cpp new file mode 100644 -index 0000000000..aebac49cd9 +index 0000000000..62afca9740 --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyeglcore.cpp -@@ -0,0 +1,337 @@ +@@ -0,0 +1,335 @@ +#include "qopenharmonyeglcore.h" +#include +#include @@ -4328,12 +4216,13 @@ index 0000000000..aebac49cd9 + +QImage QOpenHarmonyEGLCore::image() const +{ ++ if (m_image.size() != QSize(m_width, m_height)) ++ m_image = m_image.scaled(m_width, m_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + return m_image; +} + +void QOpenHarmonyEGLCore::initCore() +{ -+ // 1. Create EGLContext from + int attrib3_list[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE @@ -4410,10 +4299,7 @@ index 0000000000..aebac49cd9 + static GLushort indices[] = { 0, 1, 2, 0, 2, 3 }; + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices); + update(); -+ if (m_image.size() != image.size()) -+ m_image = image.scaled(m_width, m_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); -+ else -+ m_image = image; ++ m_image = image; +} + +void QOpenHarmonyEGLCore::update() @@ -4523,7 +4409,7 @@ index 0000000000..aebac49cd9 +} diff --git a/src/plugins/platforms/openharmony/qopenharmonyeglcore.h b/src/plugins/platforms/openharmony/qopenharmonyeglcore.h new file mode 100644 -index 0000000000..de764026b3 +index 0000000000..68c17e05e4 --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyeglcore.h @@ -0,0 +1,57 @@ @@ -4580,7 +4466,7 @@ index 0000000000..de764026b3 + int m_height; + bool m_valid = false; + bool m_inited = false; -+ QImage m_image; ++ mutable QImage m_image; +}; + +#endif // QOPENHARMONYEGLCORE_H @@ -5485,10 +5371,10 @@ index 0000000000..fca5cd99c3 +#endif // QOPENHARMONYJSWINDOW_H diff --git a/src/plugins/platforms/openharmony/qopenharmonyjswindowmanager.cpp b/src/plugins/platforms/openharmony/qopenharmonyjswindowmanager.cpp new file mode 100644 -index 0000000000..08618e7bcd +index 0000000000..bcbb1f55fb --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyjswindowmanager.cpp -@@ -0,0 +1,191 @@ +@@ -0,0 +1,195 @@ +#include "qopenharmonyjswindowmanager.h" +#include "qopenharmonyxcomponent.h" +#include "qopenharmonyjsenvironment.h" @@ -5670,10 +5556,14 @@ index 0000000000..08618e7bcd + +void QOpenHarmonyJsWindowManager::handleGeometryChange(const QString &name, const QRect &rect) +{ -+ QOpenHarmonyJsWindow *w = window(name); -+ if (w == nullptr) -+ return; -+ w->handleGeometryChange(rect); ++ if (QtOpenHarmony::isPhone()) { ++ QtOpenHarmony::updateDisplayMetrics(rect.width(), rect.height()); ++ } else { ++ QOpenHarmonyJsWindow *w = window(name); ++ if (w == nullptr) ++ return; ++ w->handleGeometryChange(rect); ++ } +} + +void QOpenHarmonyJsWindowManager::windowCreated() @@ -5853,10 +5743,10 @@ index 0000000000..1a88d88b24 +#endif // QOPENHARMONYDEFINES_H diff --git a/src/plugins/platforms/openharmony/qopenharmonymain.cpp b/src/plugins/platforms/openharmony/qopenharmonymain.cpp new file mode 100644 -index 0000000000..20866d1f5c +index 0000000000..b09de23309 --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonymain.cpp -@@ -0,0 +1,430 @@ +@@ -0,0 +1,417 @@ +#include +#include +#include @@ -5900,6 +5790,8 @@ index 0000000000..20866d1f5c +static int m_screenHeightPixels = 0; +static int m_desktopWidthPixels = 0; +static int m_desktopHeightPixels = 0; ++static int m_avoidLeftWidth = 0; ++static int m_avoidTopHeight = 0; +static NativeResourceManager *m_resourceManager = nullptr; +static QOpenHarmonyPlatformIntegration *m_platformIntegration = nullptr; +static QOpenHarmonyFileEngineHandler *m_openHarmonyFileEngineHandler = nullptr; @@ -6067,8 +5959,8 @@ index 0000000000..20866d1f5c + double xdpi = value[4]; + double ydpi = value[5]; + -+ int left = static_cast(value[6]); -+ int top = static_cast(value[7]); ++ m_avoidLeftWidth = static_cast(value[6]); ++ m_avoidTopHeight = static_cast(value[7]); + + m_desktopWidthPixels = static_cast(value[8]); + m_desktopHeightPixels = static_cast(value[9]); @@ -6077,7 +5969,7 @@ index 0000000000..20866d1f5c + m_screenHeightPixels = qMax(m_screenHeightPixels, m_desktopHeightPixels); + + if (m_platformIntegration == nullptr) { -+ QOpenHarmonyPlatformIntegration::setDefaultDisplayMetrics(left, top, m_desktopWidthPixels, ++ QOpenHarmonyPlatformIntegration::setDefaultDisplayMetrics(m_avoidLeftWidth, m_avoidTopHeight, m_desktopWidthPixels, + m_desktopHeightPixels, + qRound(double(m_screenWidthPixels) / xdpi * 25.4), + qRound(double(m_screenHeightPixels) / ydpi * 25.4), @@ -6087,7 +5979,7 @@ index 0000000000..20866d1f5c + m_platformIntegration->setDisplayMetrics(qRound(double(m_screenWidthPixels) / xdpi * 25.4), + qRound(double(m_screenHeightPixels) / ydpi * 25.4)); + m_platformIntegration->setScreenSize(m_screenWidthPixels, m_screenHeightPixels); -+ m_platformIntegration->setDesktopSize(left, top, m_desktopWidthPixels, m_desktopHeightPixels); ++ m_platformIntegration->setDesktopSize(m_avoidLeftWidth, m_avoidTopHeight, m_desktopWidthPixels, m_desktopHeightPixels); + } + return nullptr; +} @@ -6244,25 +6136,10 @@ index 0000000000..20866d1f5c + +void QtOpenHarmony::updateDisplayMetrics(int w, int h) +{ -+// m_screenWidthPixels = w; -+// m_screenHeightPixels = h; -+ -+//// openharmony xdpi and ydpi is 0 -+// double xdpi = 72; -+// double ydpi = 72; -+// if (m_platformIntegration == nullptr) { -+// QOpenHarmonyPlatformIntegration::setDefaultDisplayMetrics(m_screenWidthPixels, -+// m_screenHeightPixels, -+// qRound(double(m_screenWidthPixels) / xdpi * 25.4), -+// qRound(double(m_screenHeightPixels) / ydpi * 25.4), -+// m_screenWidthPixels, -+// m_screenHeightPixels); -+// } else { -+// m_platformIntegration->setDisplayMetrics(qRound(double(m_desktopWidthPixels) / xdpi * 25.4), -+// qRound(double(m_desktopHeightPixels) / ydpi * 25.4)); -+// m_platformIntegration->setScreenSize(m_screenWidthPixels, m_screenHeightPixels); -+// m_platformIntegration->setDesktopSize(m_screenWidthPixels, m_screenWidthPixels); -+// } ++ m_screenWidthPixels = w; ++ m_screenHeightPixels = h; ++ if (m_platformIntegration != nullptr) ++ m_platformIntegration->setScreenSize(w, h); +} + +NativeResourceManager *QtOpenHarmony::resourceManager() @@ -6937,10 +6814,10 @@ index 0000000000..39762fdc90 +#endif // QOPENHARMONYPLATFORMDIALOGHELPERS_H diff --git a/src/plugins/platforms/openharmony/qopenharmonyplatformfontdatabase.cpp b/src/plugins/platforms/openharmony/qopenharmonyplatformfontdatabase.cpp new file mode 100644 -index 0000000000..894071dd1e +index 0000000000..82131d485a --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyplatformfontdatabase.cpp -@@ -0,0 +1,35 @@ +@@ -0,0 +1,36 @@ +#include + +#include "qopenharmonyplatformfontdatabase.h" @@ -6960,6 +6837,7 @@ index 0000000000..894071dd1e + if (Q_UNLIKELY(!dir.exists())) { + qWarning("QFontDatabase: Cannot find font directory %s - is Qt installed correctly?", + qPrintable(fontpath)); ++ //Todo Qt使用_stat函数获取状态信息时返回-1,权限被拒绝.但是使用entryInfoList能够列出目录下的字体 + } + + QStringList nameFilters; @@ -8257,10 +8135,10 @@ index 0000000000..c885aa5fec +#endif // QOPENHARMONYPLATFORMOPENGLCONTEXT_H diff --git a/src/plugins/platforms/openharmony/qopenharmonyplatformopenglwindow.cpp b/src/plugins/platforms/openharmony/qopenharmonyplatformopenglwindow.cpp new file mode 100644 -index 0000000000..547046ae7a +index 0000000000..8e80ab7de7 --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyplatformopenglwindow.cpp -@@ -0,0 +1,218 @@ +@@ -0,0 +1,220 @@ +#include "qopenharmonyplatformopenglwindow.h" +#include "qopenharmonyxcomponent.h" +#include "qopenharmonyplatformscreen.h" @@ -8293,6 +8171,8 @@ index 0000000000..547046ae7a + +QOpenHarmonyPlatformOpenGLWindow::~QOpenHarmonyPlatformOpenGLWindow() +{ ++ if (QtOpenHarmony::isPhone()) ++ return; + clearEgl(); + if (m_jsWindow != nullptr) + qJsWindowManager->destoryWindow(m_jsWindow); @@ -8361,12 +8241,12 @@ index 0000000000..547046ae7a + +void QOpenHarmonyPlatformOpenGLWindow::setGeometry(const QRect &rect) +{ -+ if (m_jsWindow == nullptr) -+ createJsWindow(); -+ if (m_jsWindow == nullptr) -+ return; + // 鍦ㄦ墜鏈轰笂锛屾墍鏈夌獥鍙g粯鍒跺湪涓涓猉component, + if (!QtOpenHarmony::isPhone()) { ++ if (m_jsWindow == nullptr) ++ createJsWindow(); ++ if (m_jsWindow == nullptr) ++ return; + // 璁剧疆jswindow鐨勫昂瀵 + m_jsWindow->setGeometry(rect); + } @@ -8471,9 +8351,9 @@ index 0000000000..547046ae7a +void QOpenHarmonyPlatformOpenGLWindow::setVisible(bool visible) +{ + QOpenHarmonyPlatformWindow::setVisible(visible); -+ if (m_jsWindow == nullptr) -+ createJsWindow(); -+ if (m_jsWindow != nullptr && !QtOpenHarmony::isPhone()) { ++ if (!QtOpenHarmony::isPhone()) { ++ if (m_jsWindow == nullptr) ++ createJsWindow(); + m_jsWindow->setVisible(visible); + } +} @@ -8568,10 +8448,10 @@ index 0000000000..c4cb6257c3 + diff --git a/src/plugins/platforms/openharmony/qopenharmonyplatformscreen.cpp b/src/plugins/platforms/openharmony/qopenharmonyplatformscreen.cpp new file mode 100644 -index 0000000000..a77bf29b91 +index 0000000000..10a9b29cf2 --- /dev/null +++ b/src/plugins/platforms/openharmony/qopenharmonyplatformscreen.cpp -@@ -0,0 +1,328 @@ +@@ -0,0 +1,329 @@ +#include +#include + @@ -8755,6 +8635,7 @@ index 0000000000..a77bf29b91 + QRect oldGeometry = m_availableGeometry; + + m_availableGeometry = rect; ++ + QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), geometry(), availableGeometry()); + resizeMaximizedWindows(); + @@ -8811,8 +8692,8 @@ index 0000000000..a77bf29b91 + return; + } + -+ if (m_window == nullptr) { -+ m_window = qJsWindowManager->createWindow(); ++ if (m_window == nullptr || m_windowStack.isEmpty()) { ++ m_window = qJsWindowManager->createWindow(m_windowStack.first()); + } + if (m_window == nullptr) { + return; @@ -10054,28 +9935,27 @@ index 0000000000..f7edc8475e +}; +#endif // QOPENHARMONYXCOMPONENT_H diff --git a/src/plugins/platforms/platforms.pro b/src/plugins/platforms/platforms.pro -index acc55adf6f..288df4ce01 100644 +index 23f838a7fe..f13ef8b9cd 100644 --- a/src/plugins/platforms/platforms.pro +++ b/src/plugins/platforms/platforms.pro -@@ -3,9 +3,11 @@ QT_FOR_CONFIG += gui-private +@@ -7,6 +7,12 @@ android:!android-embedded: SUBDIRS += android - android:!android-embedded: SUBDIRS += android + !wasm:!android:qtConfig(freetype): SUBDIRS += offscreen --!android: SUBDIRS += minimal +openharmony: SUBDIRS += openharmony - --!android:qtConfig(freetype): SUBDIRS += offscreen ++ +!android:!openharmony: SUBDIRS += minimal + +!android:!openharmony:qtConfig(freetype): SUBDIRS += offscreen - ++ qtConfig(xcb) { SUBDIRS += xcb + } diff --git a/src/src.pro b/src/src.pro -index 1c76a2e46f..18d8903d9b 100644 +index 8990109743..ffa3ca0dcc 100644 --- a/src/src.pro +++ b/src/src.pro -@@ -147,6 +147,8 @@ src_plugins.target = sub-plugins +@@ -152,6 +152,8 @@ src_plugins.target = sub-plugins src_android.subdir = $$PWD/android @@ -10084,17 +9964,17 @@ index 1c76a2e46f..18d8903d9b 100644 # this order is important !qtConfig(system-zlib)|cross_compile { SUBDIRS += src_qtzlib -@@ -238,6 +240,8 @@ nacl: SUBDIRS -= src_network src_testlib +@@ -250,6 +252,8 @@ nacl: SUBDIRS -= src_network src_testlib android:!android-embedded: SUBDIRS += src_android src_3rdparty_gradle +openharmony: SUBDIRS += src_openharmony + - TR_EXCLUDE = \ - src_tools_bootstrap src_tools_moc src_tools_rcc src_tools_uic src_tools_qlalr \ - src_tools_bootstrap_dbus src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml \ + qtConfig(private_tests) { + qtConfig(network):qtConfig(gui) { + src_network_doc_snippets.subdir = network/doc/snippets diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp -index ed53dcdde8..35097057e7 100644 +index 851a284678..2154f97ba7 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -66,6 +66,10 @@ @@ -10119,13 +9999,15 @@ index ed53dcdde8..35097057e7 100644 outputString(str); } diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp -index ff5dbaa44a..2401af425e 100644 +index 8917f0dc0e..7042f00f2d 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp -@@ -417,7 +417,9 @@ void QTestLog::startLogging() +@@ -420,8 +420,10 @@ void QTestLog::startLogging() + elapsedTotalTime.start(); elapsedFunctionTime.start(); FOREACH_TEST_LOGGER - logger->startLogging(); +- logger->startLogging(); ++ logger->startLogging(); +#ifndef Q_OS_OPENHARMONY QTest::oldMessageHandler = qInstallMessageHandler(QTest::messageHandler); +#endif @@ -10133,13 +10015,13 @@ index ff5dbaa44a..2401af425e 100644 void QTestLog::stopLogging() diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp -index eb3479b3e0..39cd4c95c8 100644 +index 711effefe2..03ced89c4c 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp -@@ -2169,7 +2169,15 @@ QString QFileDialog::getOpenFileName(QWidget *parent, - { +@@ -2218,10 +2218,18 @@ QString QFileDialog::getOpenFileName(QWidget *parent, const QStringList schemes = QStringList(QStringLiteral("file")); - const QUrl selectedUrl = getOpenFileUrl(parent, caption, QUrl::fromLocalFile(dir), filter, selectedFilter, options, schemes); + const QUrl selectedUrl = getOpenFileUrl(parent, caption, QUrl::fromLocalFile(dir), filter, + selectedFilter, options, schemes); +#ifdef Q_OS_OPENHARMONY + QString fileName = selectedUrl.toLocalFile(); + if (!fileName.isEmpty()) { @@ -10147,15 +10029,18 @@ index eb3479b3e0..39cd4c95c8 100644 + } + return fileName; +#else - return selectedUrl.toLocalFile(); + if (selectedUrl.isLocalFile() || selectedUrl.isEmpty()) + return selectedUrl.toLocalFile(); + else + return selectedUrl.toString(); +#endif } /*! -@@ -2400,7 +2408,15 @@ QString QFileDialog::getSaveFileName(QWidget *parent, - { +@@ -2581,10 +2589,18 @@ QString QFileDialog::getSaveFileName(QWidget *parent, const QStringList schemes = QStringList(QStringLiteral("file")); - const QUrl selectedUrl = getSaveFileUrl(parent, caption, QUrl::fromLocalFile(dir), filter, selectedFilter, options, schemes); + const QUrl selectedUrl = getSaveFileUrl(parent, caption, QUrl::fromLocalFile(dir), filter, + selectedFilter, options, schemes); +#ifdef Q_OS_OPENHARMONY + QString fileName = selectedUrl.toLocalFile(); + if (!fileName.isEmpty()) { @@ -10163,28 +10048,31 @@ index eb3479b3e0..39cd4c95c8 100644 + } + return fileName; +#else - return selectedUrl.toLocalFile(); + if (selectedUrl.isLocalFile() || selectedUrl.isEmpty()) + return selectedUrl.toLocalFile(); + else + return selectedUrl.toString(); +#endif } /*! diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp -index 09541bb53b..a8dda888a4 100644 +index 122a8529e8..138a6a5b4e 100644 --- a/src/widgets/widgets/qtextbrowser.cpp +++ b/src/widgets/widgets/qtextbrowser.cpp -@@ -161,6 +161,11 @@ QString QTextBrowserPrivate::findFile(const QUrl &name) const +@@ -177,6 +177,11 @@ QString QTextBrowserPrivate::findFile(const QUrl &name) const if (name.scheme() == QLatin1String("assets")) fileName = QLatin1String("assets:") + name.path(); else +#endif +#if defined(Q_OS_OPENHARMONY) -+ if (name.scheme() == QLatin1String("rawfile")) -+ fileName = QLatin1String("rawfile:") + name.path(); -+ else ++ if (name.scheme() == QLatin1String("rawfile")) ++ fileName = QLatin1String("rawfile:") + name.path(); ++ else #endif fileName = name.toLocalFile(); } -@@ -231,6 +236,9 @@ void QTextBrowserPrivate::_q_activateAnchor(const QString &href) +@@ -247,6 +252,9 @@ void QTextBrowserPrivate::_q_activateAnchor(const QString &href) url.scheme() == QLatin1String("file") #if defined(Q_OS_ANDROID) || url.scheme() == QLatin1String("assets") @@ -10195,260 +10083,22 @@ index 09541bb53b..a8dda888a4 100644 || url.scheme() == QLatin1String("qrc"); if ((openExternalLinks && !isFileScheme && !url.isRelative()) diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp -index e6fac74ccc..ca6e8f3c45 100644 +index 2e2209ac5d..b6b872fc24 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp -@@ -365,7 +365,7 @@ protected: +@@ -368,7 +368,7 @@ protected: const QByteArray name = "Bar" + QByteArray::number(i) + postFix; const char *nm = name.constData(); int tp = qRegisterMetaType(nm); -#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) +#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_OPENHARMONY) - pthread_yield(); + sched_yield(); #endif QMetaType info(tp); -diff --git a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp -index 75806dd285..b4904109ec 100644 ---- a/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp -+++ b/tests/auto/corelib/plugin/qpluginloader/almostplugin/almostplugin.cpp -@@ -1,36 +1,41 @@ --/**************************************************************************** --** --** Copyright (C) 2016 The Qt Company Ltd. --** Contact: https://www.qt.io/licensing/ --** --** This file is part of the test suite of the Qt Toolkit. --** --** $QT_BEGIN_LICENSE:GPL-EXCEPT$ --** Commercial License Usage --** Licensees holding valid commercial Qt licenses may use this file in --** accordance with the commercial license agreement provided with the --** Software or, alternatively, in accordance with the terms contained in --** a written agreement between you and The Qt Company. For licensing terms --** and conditions see https://www.qt.io/terms-conditions. For further --** information use the contact form at https://www.qt.io/contact-us. --** --** GNU General Public License Usage --** Alternatively, this file may be used under the terms of the GNU --** General Public License version 3 as published by the Free Software --** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT --** included in the packaging of this file. Please review the following --** information to ensure the GNU General Public License requirements will --** be met: https://www.gnu.org/licenses/gpl-3.0.html. --** --** $QT_END_LICENSE$ --** --****************************************************************************/ --#include --#include "almostplugin.h" --#include -- --QString AlmostPlugin::pluginName() const --{ -- unresolvedSymbol(); -- return QLatin1String("Plugin ok"); --} -+/**************************************************************************** -+** -+** Copyright (C) 2016 The Qt Company Ltd. -+** Contact: https://www.qt.io/licensing/ -+** -+** This file is part of the test suite of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -+** Commercial License Usage -+** Licensees holding valid commercial Qt licenses may use this file in -+** accordance with the commercial license agreement provided with the -+** Software or, alternatively, in accordance with the terms contained in -+** a written agreement between you and The Qt Company. For licensing terms -+** and conditions see https://www.qt.io/terms-conditions. For further -+** information use the contact form at https://www.qt.io/contact-us. -+** -+** GNU General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU -+** General Public License version 3 as published by the Free Software -+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -+** included in the packaging of this file. Please review the following -+** information to ensure the GNU General Public License requirements will -+** be met: https://www.gnu.org/licenses/gpl-3.0.html. -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+#include -+#include "almostplugin.h" -+#include -+ -+QString AlmostPlugin::pluginName() const -+{ -+ unresolvedSymbol(); -+ return QLatin1String("Plugin ok"); -+} -+ -+void AlmostPlugin::unresolvedSymbol() const -+{ -+ -+} -\ No newline at end of file -diff --git a/tests/auto/corelib/serialization/serialization.pro b/tests/auto/corelib/serialization/serialization.pro -index 9638178cdc..f4a5a3c5b1 100644 ---- a/tests/auto/corelib/serialization/serialization.pro -+++ b/tests/auto/corelib/serialization/serialization.pro -@@ -11,7 +11,8 @@ SUBDIRS = \ - qxmlstream - - !qtHaveModule(gui): SUBDIRS -= \ -- qdatastream -+ qdatastream \ -+ qdatastream_core_pixmap - - !qtHaveModule(network): SUBDIRS -= \ - qtextstream -diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp -index 42347d6788..36a4c29d0a 100644 ---- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp -+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp -@@ -656,6 +656,7 @@ void tst_QDateTime::setMSecsSinceEpoch_data() - - void tst_QDateTime::setMSecsSinceEpoch() - { -+#if QT_CONFIG(timezone) - QFETCH(qint64, msecs); - QFETCH(QDateTime, utc); - QFETCH(QDateTime, cet); -@@ -729,6 +730,7 @@ void tst_QDateTime::setMSecsSinceEpoch() - - QDateTime reference(QDate(1970, 1, 1), QTime(), Qt::UTC); - QCOMPARE(dt, reference.addMSecs(msecs)); -+#endif //timezone - } - - void tst_QDateTime::fromMSecsSinceEpoch_data() -@@ -914,6 +916,7 @@ void tst_QDateTime::toString_textDate() - - void tst_QDateTime::toString_textDate_extra() - { -+#if QT_CONFIG(timezone) - QLatin1String GMT("GMT"); - QDateTime dt = QDateTime::fromMSecsSinceEpoch(0, Qt::LocalTime); - QVERIFY(!dt.toString().endsWith(GMT)); -@@ -923,7 +926,6 @@ void tst_QDateTime::toString_textDate_extra() - QVERIFY(dt.toString() != QLatin1String("Thu Jan 1 00:00:00 1970")); - else - QCOMPARE(dt.toString(), QLatin1String("Thu Jan 1 00:00:00 1970")); --#if QT_CONFIG(timezone) - # if defined Q_OS_UNIX && !defined Q_OS_DARWIN && !defined Q_OS_ANDROID - # define CORRECT_ZONE_ABBREV - # endif // QTBUG-57320, QTBUG-57298, QTBUG-68833 -@@ -954,9 +956,9 @@ void tst_QDateTime::toString_textDate_extra() - } else { - qDebug("Missed zone test: no Europe/Berlin zone available"); - } --#endif // timezone - dt = QDateTime::fromMSecsSinceEpoch(0, Qt::UTC); - QVERIFY(dt.toString().endsWith(GMT)); -+#endif // timezone - } - - void tst_QDateTime::toString_rfcDate_data() -@@ -2519,6 +2521,7 @@ void tst_QDateTime::fromStringToStringLocale() - - void tst_QDateTime::offsetFromUtc() - { -+#if QT_CONFIG(timezone) - /* Check default value. */ - QCOMPARE(QDateTime().offsetFromUtc(), 0); - -@@ -2550,6 +2553,7 @@ void tst_QDateTime::offsetFromUtc() - - QDateTime dt6(QDate(2013, 6, 1), QTime(0, 0, 0), QTimeZone("Pacific/Auckland")); - QCOMPARE(dt6.offsetFromUtc(), 43200); -+#endif //timezone - } - - void tst_QDateTime::setOffsetFromUtc() -@@ -2705,6 +2709,7 @@ void tst_QDateTime::zoneAtTime_data() - - void tst_QDateTime::zoneAtTime() - { -+#if QT_CONFIG(timezone) - QFETCH(QByteArray, ianaID); - QFETCH(QDate, date); - QFETCH(int, offset); -@@ -2717,6 +2722,7 @@ void tst_QDateTime::zoneAtTime() - QCOMPARE(zone.standardTimeOffset(QDateTime(date, noon, zone)), offset); - else // zone.offsetFromUtc *does* include DST, even before epoch - QCOMPARE(zone.offsetFromUtc(QDateTime(date, noon, zone)), offset); -+#endif //timezone - } - - void tst_QDateTime::timeZoneAbbreviation() -@@ -2758,6 +2764,7 @@ void tst_QDateTime::timeZoneAbbreviation() - const QString cest(QStringLiteral("CEST")); - #endif - -+#if QT_CONFIG(timezone) - QDateTime dt5(QDate(2013, 1, 1), QTime(0, 0, 0), QTimeZone("Europe/Berlin")); - #ifdef Q_OS_WIN - QEXPECT_FAIL("", "Windows only reports long names (QTBUG-32759)", Continue); -@@ -2768,6 +2775,7 @@ void tst_QDateTime::timeZoneAbbreviation() - QEXPECT_FAIL("", "Windows only reports long names (QTBUG-32759)", Continue); - #endif - QCOMPARE(dt6.timeZoneAbbreviation(), cest); -+#endif /timezone - } - - void tst_QDateTime::getDate() -@@ -3239,6 +3247,7 @@ void tst_QDateTime::daylightTransitions() const - - void tst_QDateTime::timeZones() const - { -+#if QT_CONFIG(timezone) - QTimeZone invalidTz = QTimeZone("Vulcan/ShiKahr"); - QCOMPARE(invalidTz.isValid(), false); - QDateTime invalidDateTime = QDateTime(QDate(2000, 1, 1), QTime(0, 0, 0), invalidTz); -@@ -3431,6 +3440,7 @@ void tst_QDateTime::timeZones() const - QDateTime future(QDate(2015, 1, 1), QTime(0, 0, 0), sgt); - QVERIFY(future.isValid()); - QCOMPARE(future.offsetFromUtc(), 28800); -+#endif //timezone - } - - #if defined(Q_OS_UNIX) -@@ -3452,6 +3462,7 @@ static void setTimeZone(const QByteArray &tz) - - void tst_QDateTime::systemTimeZoneChange() const - { -+#if QT_CONFIG(timezone) - struct ResetTZ { - QByteArray original; - ResetTZ() : original(qgetenv("TZ")) {} -@@ -3480,11 +3491,13 @@ void tst_QDateTime::systemTimeZoneChange() const - QCOMPARE(utcDate.toMSecsSinceEpoch(), utcMsecs); - QCOMPARE(tzDate, QDateTime(QDate(2012, 6, 1), QTime(2, 15, 30), QTimeZone("Australia/Brisbane"))); - QCOMPARE(tzDate.toMSecsSinceEpoch(), tzMsecs); -+#endif //timezone - } - #endif - - void tst_QDateTime::invalid() const - { -+#if QT_CONFIG(timezone) - QDateTime invalidDate = QDateTime(QDate(0, 0, 0), QTime(-1, -1, -1)); - QCOMPARE(invalidDate.isValid(), false); - QCOMPARE(invalidDate.timeSpec(), Qt::LocalTime); -@@ -3500,6 +3513,7 @@ void tst_QDateTime::invalid() const - QDateTime tzDate = invalidDate.toTimeZone(QTimeZone("Europe/Oslo")); - QCOMPARE(tzDate.isValid(), false); - QCOMPARE(tzDate.timeSpec(), Qt::TimeZone); -+#endif //timezone - } - - void tst_QDateTime::macTypes() -diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp -index 230ae4d8aa..33ebc80f00 100644 ---- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp -+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +index 84901f8f75..282150e327 100644 +--- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp ++++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -46,7 +46,7 @@ #include #include @@ -10458,353 +10108,3 @@ index 230ae4d8aa..33ebc80f00 100644 # define QT_USE_FENV #endif -@@ -1726,6 +1726,7 @@ void tst_QLocale::formatDateTime() - - void tst_QLocale::formatTimeZone() - { -+#if QT_CONFIG(timezone) - QLocale enUS("en_US"); - - QDateTime dt1(QDate(2013, 1, 1), QTime(1, 0, 0), Qt::OffsetFromUTC, 60 * 60); -@@ -1786,6 +1787,7 @@ void tst_QLocale::formatTimeZone() - // Time on its own will always be current local time zone - QCOMPARE(enUS.toString(QTime(1, 2, 3), "t"), - QDateTime::currentDateTime().timeZoneAbbreviation()); -+#endif //timezone - } - - void tst_QLocale::toDateTime_data() -diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro -index f28cf21b8b..1c12619544 100644 ---- a/tests/auto/corelib/tools/tools.pro -+++ b/tests/auto/corelib/tools/tools.pro -@@ -1,71 +1,71 @@ --TEMPLATE=subdirs --SUBDIRS=\ -- collections \ -- containerapisymmetry \ -- qalgorithms \ -- qarraydata \ -- qarraydata_strictiterators \ -- qbitarray \ -- qbytearray \ -- qbytearraylist \ -- qbytearraymatcher \ -- qbytedatabuffer \ -- qcache \ -- qchar \ -- qcollator \ -- qcommandlineparser \ -- qcontiguouscache \ -- qcryptographichash \ -- qdate \ -- qdatetime \ -- qeasingcurve \ -- qexplicitlyshareddatapointer \ -- qfreelist \ -- qhash \ -- qhash_strictiterators \ -- qhashfunctions \ -- qlatin1string \ -- qline \ -- qlinkedlist \ -- qlist \ -- qlist_strictiterators \ -- qlocale \ -- qmakearray \ -- qmap \ -- qmap_strictiterators \ -- qmargins \ -- qmessageauthenticationcode \ -- qpair \ -- qpoint \ -- qpointf \ -- qqueue \ -- qrect \ -- qregexp \ -- qregularexpression \ -- qringbuffer \ -- qscopedpointer \ -- qscopedvaluerollback \ -- qset \ -- qsharedpointer \ -- qsize \ -- qsizef \ -- qstl \ -- qstring \ -- qstring_no_cast_from_bytearray \ -- qstringapisymmetry \ -- qstringbuilder \ -- qstringiterator \ -- qstringlist \ -- qstringmatcher \ -- qstringref \ -- qstringview \ -- qtextboundaryfinder \ -- qtime \ -- qtimezone \ -- qtimeline \ -- qvarlengtharray \ -- qvector \ -- qvector_strictiterators \ -- qversionnumber -- --darwin: SUBDIRS += qmacautoreleasepool -+TEMPLATE=subdirs -+SUBDIRS=\ -+ collections \ -+ containerapisymmetry \ -+ qalgorithms \ -+ qarraydata \ -+ qarraydata_strictiterators \ -+ qbitarray \ -+ qbytearray \ -+ qbytearraylist \ -+ qbytearraymatcher \ -+ qbytedatabuffer \ -+ qcache \ -+ qchar \ -+ qcollator \ -+ qcommandlineparser \ -+ qcontiguouscache \ -+ qcryptographichash \ -+ qdate \ -+ qdatetime \ -+ qeasingcurve \ -+ qexplicitlyshareddatapointer \ -+ qfreelist \ -+ qhash \ -+ qhash_strictiterators \ -+ qhashfunctions \ -+ qlatin1string \ -+ qline \ -+ qlinkedlist \ -+ qlist \ -+ qlist_strictiterators \ -+ qlocale \ -+ qmakearray \ -+ qmap \ -+ qmap_strictiterators \ -+ qmargins \ -+ qmessageauthenticationcode \ -+ qpair \ -+ qpoint \ -+ qpointf \ -+ qqueue \ -+ qrect \ -+ qregexp \ -+ qregularexpression \ -+ qringbuffer \ -+ qscopedpointer \ -+ qscopedvaluerollback \ -+ qset \ -+ qsharedpointer \ -+ qsize \ -+ qsizef \ -+ qstl \ -+ qstring \ -+ qstring_no_cast_from_bytearray \ -+ qstringapisymmetry \ -+ qstringbuilder \ -+ qstringiterator \ -+ qstringlist \ -+ qstringmatcher \ -+ qstringref \ -+ qstringview \ -+ qtextboundaryfinder \ -+ qtime \ -+ qtimezone \ -+ qtimeline \ -+ qvarlengtharray \ -+ qvector \ -+ qvector_strictiterators \ -+ qversionnumber -+ -+darwin: SUBDIRS += qmacautoreleasepool -\ No newline at end of file -diff --git a/tests/auto/network/access/access.pro b/tests/auto/network/access/access.pro -index b140b5e9f2..a0abd994b0 100644 ---- a/tests/auto/network/access/access.pro -+++ b/tests/auto/network/access/access.pro -@@ -1,25 +1,29 @@ --TEMPLATE=subdirs --SUBDIRS=\ -- qnetworkdiskcache \ -- qnetworkcookiejar \ -- qnetworkaccessmanager \ -- qnetworkcookie \ -- qnetworkrequest \ -- qhttpnetworkconnection \ -- qnetworkreply \ -- spdy \ -- qnetworkcachemetadata \ -- qftp \ -- qhttpnetworkreply \ -- qabstractnetworkcache \ -- hpack \ -- http2 \ -- hsts -- --!qtConfig(private_tests): SUBDIRS -= \ -- qhttpnetworkconnection \ -- qhttpnetworkreply \ -- qftp \ -- hpack \ -- http2 \ -- hsts -+TEMPLATE=subdirs -+SUBDIRS=\ -+ qnetworkdiskcache \ -+ qnetworkcookiejar \ -+ qnetworkaccessmanager \ -+ qnetworkcookie \ -+ qnetworkrequest \ -+ qhttpnetworkconnection \ -+ qnetworkreply \ -+ spdy \ -+ qnetworkcachemetadata \ -+ qftp \ -+ qhttpnetworkreply \ -+ qabstractnetworkcache \ -+ hpack \ -+ http2 \ -+ hsts -+ -+!qtConfig(private_tests): SUBDIRS -= \ -+ qhttpnetworkconnection \ -+ qhttpnetworkreply \ -+ qftp \ -+ hpack \ -+ http2 \ -+ hsts -+ -+#TODO support http -+SUBDIRS -= qnetworkreply \ -+ spdy -\ No newline at end of file -diff --git a/tests/auto/network/kernel/kernel.pro b/tests/auto/network/kernel/kernel.pro -index 42df80dfa1..c3ef0fa6c7 100644 ---- a/tests/auto/network/kernel/kernel.pro -+++ b/tests/auto/network/kernel/kernel.pro -@@ -1,24 +1,23 @@ --TEMPLATE=subdirs --SUBDIRS=\ -- qdnslookup \ -- qdnslookup_appless \ -- qhostinfo \ -- qnetworkproxyfactory \ -- qauthenticator \ -- qnetworkproxy \ -- qnetworkinterface \ -- qnetworkdatagram \ -- qnetworkaddressentry \ -- qhostaddress \ -- --winrt: SUBDIRS -= \ -- qnetworkproxy \ -- qnetworkproxyfactory \ -- --osx: SUBDIRS -= \ # QTBUG-41847 -- qhostinfo \ -- --!qtConfig(private_tests): SUBDIRS -= \ -- qauthenticator \ -- qhostinfo \ -- -+TEMPLATE=subdirs -+SUBDIRS=\ -+ qdnslookup \ -+ qdnslookup_appless \ -+ qhostinfo \ -+ qnetworkproxyfactory \ -+ qauthenticator \ -+ qnetworkproxy \ -+ qnetworkinterface \ -+ qnetworkdatagram \ -+ qnetworkaddressentry \ -+ qhostaddress \ -+ -+winrt: SUBDIRS -= \ -+ qnetworkproxy \ -+ qnetworkproxyfactory \ -+ -+osx: SUBDIRS -= \ # QTBUG-41847 -+ qhostinfo \ -+ -+!qtConfig(private_tests): SUBDIRS -= \ -+ qauthenticator \ -+ qhostinfo \ -\ No newline at end of file -diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp -index 224e4d61a9..12b0fa4f4c 100644 ---- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp -+++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp -@@ -43,7 +43,7 @@ - # endif - #endif - --#ifdef Q_OS_ANDROID -+#if defined(Q_OS_ANDROID) || defined(Q_OS_OPENHARMONY) - # include - #endif - -@@ -382,7 +382,7 @@ void tst_QHostAddress::assignment() - QCOMPARE(address, QHostAddress("::1")); - - // WinRT does not support sockaddr_in --#ifndef Q_OS_WINRT -+#if !defined(Q_OS_WINRT) - QHostAddress addr("4.2.2.1"); - sockaddr_in sockAddr; - sockAddr.sin_family = AF_INET; -diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp -index f31a755f9e..1cb8f94e55 100644 ---- a/tests/auto/other/toolsupport/tst_toolsupport.cpp -+++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp -@@ -140,8 +140,10 @@ void tst_toolsupport::offsets_data() - << pmm_to_offsetof(&QDateTimePrivate::m_status) << 8 << 8; - QTest::newRow("QDateTimePrivate::m_offsetFromUtc") - << pmm_to_offsetof(&QDateTimePrivate::m_offsetFromUtc) << 12 << 12; -+#if QT_CONFIG(timezone) - QTest::newRow("QDateTimePrivate::m_timeZone") - << pmm_to_offsetof(&QDateTimePrivate::m_timeZone) << 20 << 24; -+#endif //timezone - } - #endif // RUN_MEMBER_OFFSET_TEST - } -diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp -index 710f26b72d..d77e95db9e 100644 ---- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp -+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp -@@ -4124,6 +4124,7 @@ void tst_QSqlQuery::QTBUG_2192() - - void tst_QSqlQuery::QTBUG_36211() - { -+#if QT_CONFIG(timezone) - QFETCH( QString, dbName ); - QSqlDatabase db = QSqlDatabase::database( dbName ); - CHECK_DATABASE( db ); -@@ -4159,6 +4160,7 @@ void tst_QSqlQuery::QTBUG_36211() - } - } - } -+#endif //timezone - } - - void tst_QSqlQuery::QTBUG_53969() -@@ -4632,6 +4634,7 @@ void tst_QSqlQuery::QTBUG_57138() - - void tst_QSqlQuery::dateTime_data() - { -+#if QT_CONFIG(timezone) - QTest::addColumn("dbName"); - QTest::addColumn("tableName"); - QTest::addColumn("createTableString"); -@@ -4680,6 +4683,7 @@ void tst_QSqlQuery::dateTime_data() - << dbName << tableNameDate << QStringLiteral(" (dt DATE)") - << dateTimes << expectedDateTimes; - } -+#endif //timezone - } - - void tst_QSqlQuery::dateTime() diff --git a/patch/v5.12.12/qtconnectivity.patch b/patch/v5.12.12/qtconnectivity.patch index 4c82763ff5..f575e74b1f 100644 --- a/patch/v5.12.12/qtconnectivity.patch +++ b/patch/v5.12.12/qtconnectivity.patch @@ -1,10 +1,10 @@ diff --git a/src/bluetooth/bluetooth.pro b/src/bluetooth/bluetooth.pro -index 0b253942..7525f76b 100644 +index b7f9a198..f1dd6777 100644 --- a/src/bluetooth/bluetooth.pro +++ b/src/bluetooth/bluetooth.pro -@@ -155,6 +155,21 @@ qtConfig(bluez) { +@@ -157,6 +157,21 @@ qtConfig(bluez) { - PRIVATE_HEADERS += qlowenergycontroller_android_p.h \ + HEADERS += qlowenergycontroller_android_p.h \ qbluetoothsocket_android_p.h +} else:openharmony { + include(openharmony/openharmony.pri) @@ -19,7 +19,7 @@ index 0b253942..7525f76b 100644 + qbluetoothdevicediscoveryagent_ohos.cpp \ + qbluetoothservicediscoveryagent_ohos.cpp + -+ PRIVATE_HEADERS += qbluetoothsocket_ohos_p.h \ ++ HEADERS += qbluetoothsocket_ohos_p.h \ + qlowenergycontroller_ohos_p.h } else:osx { QT_PRIVATE = concurrent @@ -604,11 +604,11 @@ index 00000000..ad2f5db1 + diff --git a/src/bluetooth/openharmony/openharmony.pri b/src/bluetooth/openharmony/openharmony.pri new file mode 100644 -index 00000000..fbc1329e +index 00000000..df993a7e --- /dev/null +++ b/src/bluetooth/openharmony/openharmony.pri @@ -0,0 +1,20 @@ -+PRIVATE_HEADERS += \ ++HEADERS += \ + $$PWD/openharmonyload_p.h \ + $$PWD/bluetoothdatareceiver_p.h \ + $$PWD/serveracceptancethread_p.h \ @@ -1339,14 +1339,15 @@ index 00000000..ae54df82 +}; +#endif // SERVERACCEPTANCETHREAD_P_H diff --git a/src/bluetooth/qbluetooth.cpp b/src/bluetooth/qbluetooth.cpp -index 6eab11fb..49d27923 100644 +index 1e8ce0b8..5e9cf19b 100644 --- a/src/bluetooth/qbluetooth.cpp +++ b/src/bluetooth/qbluetooth.cpp -@@ -102,5 +102,6 @@ Q_LOGGING_CATEGORY(QT_BT, "qt.bluetooth") - Q_LOGGING_CATEGORY(QT_BT_ANDROID, "qt.bluetooth.android") +@@ -104,6 +104,7 @@ Q_LOGGING_CATEGORY(QT_BT_ANDROID, "qt.bluetooth.android") Q_LOGGING_CATEGORY(QT_BT_BLUEZ, "qt.bluetooth.bluez") + Q_LOGGING_CATEGORY(QT_BT_WINDOWS, "qt.bluetooth.windows") Q_LOGGING_CATEGORY(QT_BT_WINRT, "qt.bluetooth.winrt") +Q_LOGGING_CATEGORY(QT_BT_OPENHARMONY, "qt.bluetooth.openharmony") + Q_LOGGING_CATEGORY(QT_BT_WINRT_SERVICE_THREAD, "qt.bluetooth.winrt.service.thread") QT_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_ohos.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_ohos.cpp @@ -1632,10 +1633,10 @@ index 00000000..060c8aef +} +QT_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h -index ce31392f..4a5d2ff3 100644 +index ca93d839..15dce11b 100644 --- a/src/bluetooth/qbluetoothdevicediscoveryagent_p.h +++ b/src/bluetooth/qbluetoothdevicediscoveryagent_p.h -@@ -83,6 +83,13 @@ QT_END_NAMESPACE +@@ -59,6 +59,13 @@ #include #endif @@ -1646,20 +1647,20 @@ index ce31392f..4a5d2ff3 100644 +class OpenHarmonyBluetoothDiscoveryReceiver; +#endif + - QT_BEGIN_NAMESPACE - - #ifdef QT_WINRT_BLUETOOTH -@@ -90,7 +97,7 @@ class QWinRTBluetoothDeviceDiscoveryWorker; - #endif + #ifdef Q_OS_DARWIN + #include "osx/btdelegates_p.h" + #include "osx/btraii_p.h" +@@ -113,7 +120,7 @@ class QWinRTBluetoothDeviceDiscoveryWorker; class QBluetoothDeviceDiscoveryAgentPrivate --#if defined(QT_ANDROID_BLUETOOTH) || defined(QT_WINRT_BLUETOOTH) -+#if defined(QT_ANDROID_BLUETOOTH) || defined(QT_WINRT_BLUETOOTH) || defined(QT_OPENHARMONY_BLUETOOTH) + #if defined(QT_ANDROID_BLUETOOTH) || defined(QT_WINRT_BLUETOOTH) || defined(QT_WIN_BLUETOOTH) \ +- || defined(Q_OS_DARWIN) ++ || defined(Q_OS_DARWIN) || defined(QT_OPENHARMONY_BLUETOOTH) : public QObject - { - Q_OBJECT -@@ -164,6 +171,24 @@ private: - QTimer extendedDiscoveryTimer; + #if defined(Q_OS_MACOS) + , public DarwinBluetooth::DeviceInquiryDelegate +@@ -196,6 +203,24 @@ private: + QMap devicesProperties; #endif +#ifdef QT_OPENHARMONY_BLUETOOTH @@ -1680,9 +1681,9 @@ index ce31392f..4a5d2ff3 100644 + QSharedPointer m_jsBluetoothManager; +#endif + - #ifdef QT_WINRT_BLUETOOTH - private slots: - void registerDevice(const QBluetoothDeviceInfo &info); + #ifdef QT_WIN_BLUETOOTH + public: + static QString discoveredLeDeviceSystemPath(const QBluetoothAddress &deviceAddress); diff --git a/src/bluetooth/qbluetoothlocaldevice.h b/src/bluetooth/qbluetoothlocaldevice.h index 9f6d1e1b..59bdd36b 100644 --- a/src/bluetooth/qbluetoothlocaldevice.h @@ -2038,10 +2039,10 @@ index 00000000..dfe5f7b2 + +QT_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothlocaldevice_p.h b/src/bluetooth/qbluetoothlocaldevice_p.h -index 1f99f27e..b30c6004 100644 +index 6bb74737..3b5a27b8 100644 --- a/src/bluetooth/qbluetoothlocaldevice_p.h +++ b/src/bluetooth/qbluetoothlocaldevice_p.h -@@ -84,6 +84,10 @@ QT_END_NAMESPACE +@@ -85,6 +85,10 @@ QT_END_NAMESPACE #include #endif @@ -2049,21 +2050,12 @@ index 1f99f27e..b30c6004 100644 +#include "QtCore/qopenharmonyjsobject.h" +#endif + - QT_BEGIN_NAMESPACE - - extern void registerQBluetoothLocalDeviceMetaType(); -@@ -97,7 +101,7 @@ class QBluetoothLocalDevicePrivate : public QObject - Q_OBJECT - public: - QBluetoothLocalDevicePrivate( -- QBluetoothLocalDevice *q, const QBluetoothAddress &address = QBluetoothAddress()); -+ QBluetoothLocalDevice *q, const QBluetoothAddress &address = QBluetoothAddress()); - ~QBluetoothLocalDevicePrivate(); + #ifdef QT_WINRT_BLUETOOTH + #include - QAndroidJniObject *adapter(); -@@ -207,6 +211,43 @@ private: - void initializeAdapter(); - void initializeAdapterBluez5(); +@@ -263,6 +267,43 @@ private: + Microsoft::WRL::ComPtr mStatics; + Microsoft::WRL::ComPtr mLEStatics; }; +#elif QT_OPENHARMONY_BLUETOOTH +class QOpenHarmonyJsObject; @@ -2102,12 +2094,12 @@ index 1f99f27e..b30c6004 100644 + QBluetoothLocalDevice *q_ptr; + QSharedPointer m_jsBluetoothManager; +}; - #elif !defined(QT_OSX_BLUETOOTH) // winrt and dummy backend + #elif !defined(QT_OSX_BLUETOOTH) // dummy backend class QBluetoothLocalDevicePrivate : public QObject { diff --git a/src/bluetooth/qbluetoothserver_ohos.cpp b/src/bluetooth/qbluetoothserver_ohos.cpp new file mode 100644 -index 00000000..90b98398 +index 00000000..b8a32c3e --- /dev/null +++ b/src/bluetooth/qbluetoothserver_ohos.cpp @@ -0,0 +1,237 @@ @@ -2128,9 +2120,9 @@ index 00000000..90b98398 +Q_DECLARE_LOGGING_CATEGORY(QT_BT_OPENHARMONY) + +QHash __fakeServerPorts; -+QBluetoothServerPrivate::QBluetoothServerPrivate(QBluetoothServiceInfo::Protocol sType) ++QBluetoothServerPrivate::QBluetoothServerPrivate(QBluetoothServiceInfo::Protocol sType, QBluetoothServer *parent) + : socket(0),maxPendingConnections(1), securityFlags(QBluetooth::NoSecurity), serverType(sType), -+ m_lastError(QBluetoothServer::NoError) ++ m_lastError(QBluetoothServer::NoError), q_ptr(parent) +{ + thread = new ServerAcceptanceThread(); + thread->setMaxPendingConnections(maxPendingConnections); @@ -2349,7 +2341,7 @@ index 00000000..90b98398 +QT_END_NAMESPACE + diff --git a/src/bluetooth/qbluetoothserver_p.h b/src/bluetooth/qbluetoothserver_p.h -index d78eee5f..f8d67cb5 100644 +index d14dc7b4..3d6c0704 100644 --- a/src/bluetooth/qbluetoothserver_p.h +++ b/src/bluetooth/qbluetoothserver_p.h @@ -69,6 +69,10 @@ QT_FORWARD_DECLARE_CLASS(QSocketNotifier) @@ -2363,7 +2355,7 @@ index d78eee5f..f8d67cb5 100644 #ifdef QT_WINRT_BLUETOOTH #include -@@ -124,6 +128,14 @@ public: +@@ -136,6 +140,14 @@ public: bool isListening() const; bool initiateActiveListening(const QBluetoothUuid& uuid, const QString &serviceName); bool deactivateActiveListening(); @@ -2379,39 +2371,10 @@ index d78eee5f..f8d67cb5 100644 EventRegistrationToken connectionToken {-1}; diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.cpp b/src/bluetooth/qbluetoothservicediscoveryagent.cpp -index 53ce98e5..a6dfd9b0 100644 +index e76c2311..19d1a4f9 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent.cpp -@@ -317,8 +317,7 @@ QBluetoothAddress QBluetoothServiceDiscoveryAgent::remoteAddress() const - */ - void QBluetoothServiceDiscoveryAgent::start(DiscoveryMode mode) - { -- Q_D(QBluetoothServiceDiscoveryAgent); -- -+ Q_D(QBluetoothServiceDiscoveryAgent); - if (d->discoveryState() == QBluetoothServiceDiscoveryAgentPrivate::Inactive - && d->error != InvalidBluetoothAdapterError) { - #if QT_CONFIG(bluez) -@@ -326,14 +325,14 @@ void QBluetoothServiceDiscoveryAgent::start(DiscoveryMode mode) - // on Bluez5 - d->foundHostAdapterPath.clear(); - #endif -- d->setDiscoveryMode(mode); -- if (d->deviceAddress.isNull()) { -+ d->setDiscoveryMode(mode); -+ if (d->deviceAddress.isNull()) { - d->startDeviceDiscovery(); - } else { - d->discoveredDevices << QBluetoothDeviceInfo(d->deviceAddress, QString(), 0); -- d->startServiceDiscovery(); -+ d->startServiceDiscovery(); - } -- } -+ } - } - - /*! -@@ -425,7 +424,7 @@ QString QBluetoothServiceDiscoveryAgent::errorString() const +@@ -436,7 +436,7 @@ QString QBluetoothServiceDiscoveryAgent::errorString() const This signal is triggered when the service discovery was canceled via a call to \l stop(). */ @@ -2420,7 +2383,7 @@ index 53ce98e5..a6dfd9b0 100644 /*! Starts device discovery. */ -@@ -443,6 +442,15 @@ void QBluetoothServiceDiscoveryAgentPrivate::startDeviceDiscovery() +@@ -454,6 +454,14 @@ void QBluetoothServiceDiscoveryAgentPrivate::startDeviceDiscovery() q, [this](){ this->_q_deviceDiscoveryFinished(); }); @@ -2432,11 +2395,10 @@ index 53ce98e5..a6dfd9b0 100644 + this->_q_deviceDiscovered(info); + this->_q_deviceDiscoveryFinished(); + }); -+ QObject::connect(deviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, q, [this](const QBluetoothDeviceInfo &info){ this->_q_deviceDiscovered(info); -@@ -456,7 +464,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::startDeviceDiscovery() +@@ -467,7 +475,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::startDeviceDiscovery() setDiscoveryState(DeviceDiscovery); @@ -2445,32 +2407,6 @@ index 53ce98e5..a6dfd9b0 100644 } /*! -@@ -495,8 +503,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_deviceDiscoveryFinished() - } - - delete deviceDiscoveryAgent; -- deviceDiscoveryAgent = nullptr; -- -+ deviceDiscoveryAgent = nullptr; - startServiceDiscovery(); - } - -@@ -534,14 +541,12 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_deviceDiscoveryError(QBluetoothD - */ - void QBluetoothServiceDiscoveryAgentPrivate::startServiceDiscovery() - { -- Q_Q(QBluetoothServiceDiscoveryAgent); -- -+ Q_Q(QBluetoothServiceDiscoveryAgent); - if (discoveredDevices.isEmpty()) { - setDiscoveryState(Inactive); - emit q->finished(); - return; - } -- - setDiscoveryState(ServiceDiscovery); - start(discoveredDevices.at(0).address()); - } diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_ohos.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_ohos.cpp new file mode 100644 index 00000000..ffc400d6 @@ -2923,10 +2859,10 @@ index 00000000..ffc400d6 + +QT_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_p.h b/src/bluetooth/qbluetoothservicediscoveryagent_p.h -index dbf8b1d4..c7dfacde 100644 +index 40321c55..325ca41f 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_p.h +++ b/src/bluetooth/qbluetoothservicediscoveryagent_p.h -@@ -86,6 +86,12 @@ class LocalDeviceBroadcastReceiver; +@@ -105,6 +105,12 @@ class LocalDeviceBroadcastReceiver; #include #endif @@ -2939,10 +2875,10 @@ index dbf8b1d4..c7dfacde 100644 #ifdef QT_WINRT_BLUETOOTH class QWinRTBluetoothServiceDiscoveryWorker; #endif -@@ -150,6 +156,15 @@ public: +@@ -171,6 +177,14 @@ public: + void _q_fetchUuidsTimeout(); void _q_hostModeStateChanged(QBluetoothLocalDevice::HostMode state); #endif - +#ifdef QT_OPENHARMONY_BLUETOOTH + void _q_processFetchedUuids(const QBluetoothAddress &address, const QList &uuids); + @@ -2951,26 +2887,24 @@ index dbf8b1d4..c7dfacde 100644 + void _q_fetchUuidsTimeout(); + void _q_hostModeStateChanged(QBluetoothLocalDevice::HostMode state); +#endif -+ - private: - void start(const QBluetoothAddress &address); - void stop(); -@@ -200,6 +215,15 @@ private: + #ifdef QT_WIN_BLUETOOTH + void _q_nextSdpScan(const QVariant &input); + bool serviceMatches(const QBluetoothServiceInfo &info); +@@ -231,7 +245,14 @@ private: + // scan result is received. QMap > > sdpCache; #endif - +#ifdef QT_OPENHARMONY_BLUETOOTH + OPenHarmonyServiceDiscoveryReceiver *receiver = nullptr; + OPenHarmonyLocalDeviceBroadcastReceiver *localDeviceReceiver = nullptr; -+ + + QSharedPointer m_jsBtMgr; + QSharedPointer m_jsAdapter; + QMap > > sdpCache; +#endif -+ - #ifdef QT_WINRT_BLUETOOTH - private slots: - void processFoundService(quint64 deviceAddress, const QBluetoothServiceInfo &info); + #ifdef QT_WIN_BLUETOOTH + private: + bool pendingStop; diff --git a/src/bluetooth/qbluetoothserviceinfo_ohos.cpp b/src/bluetooth/qbluetoothserviceinfo_ohos.cpp new file mode 100644 index 00000000..1c59c713 @@ -3078,7 +3012,7 @@ index 00000000..1c59c713 + +QT_END_NAMESPACE diff --git a/src/bluetooth/qbluetoothsocket.cpp b/src/bluetooth/qbluetoothsocket.cpp -index daa589bb..2abd1067 100644 +index 9da67272..0ee28dbe 100644 --- a/src/bluetooth/qbluetoothsocket.cpp +++ b/src/bluetooth/qbluetoothsocket.cpp @@ -45,6 +45,8 @@ @@ -3089,38 +3023,25 @@ index daa589bb..2abd1067 100644 +#include "qbluetoothsocket_ohos_p.h" #elif defined(QT_WINRT_BLUETOOTH) #include "qbluetoothsocket_winrt_p.h" - #else -@@ -52,7 +54,6 @@ - #endif - - #include "qbluetoothservicediscoveryagent.h" -- - #include - #include - -@@ -267,6 +268,8 @@ static QBluetoothSocketBasePrivate *createSocketPrivate() + #elif defined(QT_WIN_BLUETOOTH) +@@ -274,6 +276,8 @@ static QBluetoothSocketBasePrivate *createSocketPrivate() + } + #elif defined(QT_ANDROID_BLUETOOTH) return new QBluetoothSocketPrivateAndroid(); - #elif defined(QT_WINRT_BLUETOOTH) - return new QBluetoothSocketPrivateWinRT(); +#elif defined(QT_OPENHARMONY_BLUETOOTH) + return new QBluetoothSocketPrivateOpenHarmony(); - #else - return new QBluetoothSocketPrivateDummy(); - #endif + #elif defined(QT_WINRT_BLUETOOTH) + return new QBluetoothSocketPrivateWinRT(); + #elif defined(QT_WIN_BLUETOOTH) diff --git a/src/bluetooth/qbluetoothsocket.h b/src/bluetooth/qbluetoothsocket.h -index d2535544..e4ca30e4 100644 +index 8d35f77e..731987d7 100644 --- a/src/bluetooth/qbluetoothsocket.h +++ b/src/bluetooth/qbluetoothsocket.h -@@ -72,10 +72,12 @@ class Q_BLUETOOTH_EXPORT QBluetoothSocket : public QIODevice - friend class QBluetoothServerPrivate; - friend class QBluetoothSocketPrivate; - friend class QBluetoothSocketPrivateAndroid; -+ friend class QBluetoothSocketPrivateOpenHarmony; - friend class QBluetoothSocketPrivateBluez; - friend class QBluetoothSocketPrivateBluezDBus; +@@ -70,6 +70,7 @@ class Q_BLUETOOTH_EXPORT QBluetoothSocket : public QIODevice friend class QBluetoothSocketPrivateDummy; + friend class QBluetoothSocketPrivateWin; friend class QBluetoothSocketPrivateWinRT; -+ friend class QBluetoothSocketPrivateOPenharmony; ++ friend class QBluetoothSocketPrivateOpenHarmony; public: @@ -3716,10 +3637,10 @@ index 00000000..e29cd19f + +#endif // QBLUETOOTHSOCKET_ANDROID_P_H diff --git a/src/bluetooth/qbluetoothsocketbase_p.h b/src/bluetooth/qbluetoothsocketbase_p.h -index 410dcbbd..6c96d474 100644 +index d1894e96..15267b68 100644 --- a/src/bluetooth/qbluetoothsocketbase_p.h +++ b/src/bluetooth/qbluetoothsocketbase_p.h -@@ -123,7 +123,7 @@ public: +@@ -122,7 +122,7 @@ public: QBluetoothSocket::OpenMode openMode = QBluetoothSocket::ReadWrite) = 0; @@ -3729,20 +3650,20 @@ index 410dcbbd..6c96d474 100644 QIODevice::OpenMode openMode) = 0; #else diff --git a/src/bluetooth/qbluetoothtransfermanager.cpp b/src/bluetooth/qbluetoothtransfermanager.cpp -index 165faceb..f00ac1c7 100644 +index d84f726c..45005eef 100644 --- a/src/bluetooth/qbluetoothtransfermanager.cpp +++ b/src/bluetooth/qbluetoothtransfermanager.cpp @@ -122,7 +122,7 @@ QBluetoothTransferReply *QBluetoothTransferManager::put(const QBluetoothTransfer return reply; #else - // Android, iOS, and WinRT have no implementation --#if !defined(QT_ANDROID_BLUETOOTH) && !defined(QT_IOS_BLUETOOTH) && !defined(QT_WINRT_BLUETOOTH) -+#if !defined(QT_ANDROID_BLUETOOTH) && !defined(QT_IOS_BLUETOOTH) && !defined(QT_WINRT_BLUETOOTH) && !defined(QT_OPENHARMONY_BLUETOOTH) + // Android, iOS, and Win/WinRT have no implementation +-#if !defined(QT_ANDROID_BLUETOOTH) && !defined(QT_IOS_BLUETOOTH) && !defined(QT_WINRT_BLUETOOTH) && !defined(QT_WIN_BLUETOOTH) ++#if !defined(QT_ANDROID_BLUETOOTH) && !defined(QT_IOS_BLUETOOTH) && !defined(QT_WINRT_BLUETOOTH) && !defined(QT_WIN_BLUETOOTH) && !defined(QT_OPENHARMONY_BLUETOOTH) printDummyWarning(); #endif Q_UNUSED(request); diff --git a/src/bluetooth/qlowenergycharacteristic.h b/src/bluetooth/qlowenergycharacteristic.h -index cb747e32..a43ef1df 100644 +index fe9b73fa..a0861ffc 100644 --- a/src/bluetooth/qlowenergycharacteristic.h +++ b/src/bluetooth/qlowenergycharacteristic.h @@ -98,6 +98,7 @@ protected: @@ -3754,19 +3675,19 @@ index cb747e32..a43ef1df 100644 friend class QLowEnergyControllerPrivateBluezDBus; friend class QLowEnergyControllerPrivateCommon; diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp -index 6b4c17d6..0115700f 100644 +index b065555c..df1f09e3 100644 --- a/src/bluetooth/qlowenergycontroller.cpp +++ b/src/bluetooth/qlowenergycontroller.cpp -@@ -54,6 +54,8 @@ - #include "qlowenergycontroller_bluez_p.h" +@@ -55,6 +55,8 @@ #elif defined(QT_ANDROID_BLUETOOTH) #include "qlowenergycontroller_android_p.h" + #include "android/androidutils_p.h" +#elif defined(QT_OPENHARMONY_BLUETOOTH) +#include "qlowenergycontroller_ohos_p.h" #elif defined(QT_WINRT_BLUETOOTH) + #include "qtbluetoothglobal_p.h" #include "qlowenergycontroller_winrt_p.h" - #else -@@ -308,6 +310,8 @@ static QLowEnergyControllerPrivate *privateController(QLowEnergyController::Role +@@ -324,6 +326,8 @@ static QLowEnergyControllerPrivate *privateController(QLowEnergyController::Role #elif defined(QT_ANDROID_BLUETOOTH) Q_UNUSED(role); return new QLowEnergyControllerPrivateAndroid(); @@ -3774,15 +3695,7 @@ index 6b4c17d6..0115700f 100644 + return new QLowEnergyControllerPrivateOpenHarmony(); #elif defined(QT_WINRT_BLUETOOTH) Q_UNUSED(role); - return new QLowEnergyControllerPrivateWinRT(); -@@ -733,6 +737,7 @@ void QLowEnergyController::startAdvertising(const QLowEnergyAdvertisingParameter - qCWarning(QT_BT) << "Cannot start advertising in central role" << state(); - return; - } -+ qDebug() << "ooooooooooooooooooooooooo" << state(); - if (state() != UnconnectedState) { - qCWarning(QT_BT) << "Cannot start advertising in state" << state(); - return; + #if QT_CONFIG(winrt_btle_no_pairing) diff --git a/src/bluetooth/qlowenergycontroller_ohos.cpp b/src/bluetooth/qlowenergycontroller_ohos.cpp new file mode 100644 index 00000000..73fb98eb @@ -4770,7 +4683,7 @@ index 00000000..0f18ecd1 + +#endif // QLOWENERGYCONTROLLERPRIVATEOHOS_P_H diff --git a/src/bluetooth/qlowenergydescriptor.h b/src/bluetooth/qlowenergydescriptor.h -index 9dd0cc20..6a78e500 100644 +index 18bb53c0..e6c6a7ff 100644 --- a/src/bluetooth/qlowenergydescriptor.h +++ b/src/bluetooth/qlowenergydescriptor.h @@ -81,6 +81,7 @@ protected: @@ -4780,26 +4693,26 @@ index 9dd0cc20..6a78e500 100644 + friend class QLowEnergyControllerPrivateOpenHarmony; friend class QLowEnergyControllerPrivateBluezDBus; friend class QLowEnergyControllerPrivateCommon; - friend class QLowEnergyControllerPrivateOSX; + friend class QLowEnergyControllerPrivateWin32; diff --git a/src/bluetooth/qlowenergyservice.h b/src/bluetooth/qlowenergyservice.h -index 9de65a84..811db534 100644 +index a2715471..fb9597f7 100644 --- a/src/bluetooth/qlowenergyservice.h +++ b/src/bluetooth/qlowenergyservice.h -@@ -136,6 +136,7 @@ private: - friend class QLowEnergyControllerPrivate; +@@ -137,6 +137,7 @@ private: friend class QLowEnergyControllerPrivateBluez; friend class QLowEnergyControllerPrivateAndroid; + friend class QLowEnergyControllerPrivateDarwin; + friend class QLowEnergyControllerPrivateOpenHarmony; QLowEnergyService(QSharedPointer p, QObject *parent = nullptr); }; diff --git a/src/bluetooth/qlowenergyserviceprivate_p.h b/src/bluetooth/qlowenergyserviceprivate_p.h -index fb4163a0..41456e79 100644 +index 1816a23f..167ca7e2 100644 --- a/src/bluetooth/qlowenergyserviceprivate_p.h +++ b/src/bluetooth/qlowenergyserviceprivate_p.h -@@ -128,7 +128,9 @@ public: - // reference to the BluetoothGattService object - QAndroidJniObject androidService; +@@ -137,7 +137,9 @@ public: + #if defined(QT_WIN_BLUETOOTH) + Qt::HANDLE hService = nullptr; #endif - +#if defined (QT_OPENHARMONY_BLUETOOTH) @@ -4809,10 +4722,10 @@ index fb4163a0..41456e79 100644 typedef QHash CharacteristicDataMap; diff --git a/src/nfc/nfc.pro b/src/nfc/nfc.pro -index ed88b79a..c10a7900 100644 +index c6ae147d..4a84cda1 100644 --- a/src/nfc/nfc.pro +++ b/src/nfc/nfc.pro -@@ -56,7 +56,7 @@ SOURCES += \ +@@ -54,7 +54,7 @@ SOURCES += \ qnearfieldsharetarget.cpp \ qnfc.cpp @@ -4821,7 +4734,7 @@ index ed88b79a..c10a7900 100644 NFC_BACKEND_AVAILABLE = yes QT_PRIVATE += dbus -@@ -112,6 +112,33 @@ linux:!android:qtHaveModule(dbus) { +@@ -110,6 +110,33 @@ linux:!android:qtHaveModule(dbus) { qnearfieldsharemanagerimpl_p.cpp \ qnearfieldsharetargetimpl_p.cpp \ android/androidmainnewintentlistener.cpp @@ -4831,7 +4744,7 @@ index ed88b79a..c10a7900 100644 + DEFINES += OPENHARMONY_NFC + QT_PRIVATE += core-private gui + -+ PRIVATE_HEADERS += \ ++ HEADERS += \ + qllcpserver_openharmony_p.h \ + qllcpsocket_openharmony_p.h \ + qnearfieldmanager_openharmony_p.h \ @@ -5729,7 +5642,7 @@ index 00000000..0be026c0 + +#endif // QLLCPSOCKET_OPENHARMONY_P_H diff --git a/src/nfc/qnearfieldmanager.cpp b/src/nfc/qnearfieldmanager.cpp -index 02e4d918..2da5f74a 100644 +index 757c8c99..8dfffd47 100644 --- a/src/nfc/qnearfieldmanager.cpp +++ b/src/nfc/qnearfieldmanager.cpp @@ -46,6 +46,8 @@ diff --git a/patch/v5.12.12/qtdeclarative.patch b/patch/v5.12.12/qtdeclarative.patch index 2919763bc8..d7fe9df119 100644 --- a/patch/v5.12.12/qtdeclarative.patch +++ b/patch/v5.12.12/qtdeclarative.patch @@ -1,73 +1,77 @@ diff --git a/src/qml/qml/qqmlfile.cpp b/src/qml/qml/qqmlfile.cpp -index 99031e1e74..dcfc473da2 100644 +index 465a342129..982e9e93fd 100644 --- a/src/qml/qml/qqmlfile.cpp +++ b/src/qml/qml/qqmlfile.cpp -@@ -65,6 +65,9 @@ static char file_string[] = "file"; - #if defined(Q_OS_ANDROID) +@@ -66,7 +66,9 @@ static char file_string[] = "file"; static char assets_string[] = "assets"; + static char content_string[] = "content"; #endif +- +#if defined(Q_OS_OPENHARMONY) +static char rawfile_string[] = "rawfile"; +#endif - class QQmlFilePrivate; -@@ -453,6 +456,10 @@ bool QQmlFile::isSynchronous(const QUrl &url) - } else if (scheme.length() == 6 && 0 == scheme.compare(QLatin1String(assets_string), Qt::CaseInsensitive)) { + #if QT_CONFIG(qml_network) +@@ -456,7 +458,10 @@ bool QQmlFile::isSynchronous(const QUrl &url) + } else if (scheme.length() == 7 && 0 == scheme.compare(QLatin1String(content_string), Qt::CaseInsensitive)) { return true; #endif +- +#if defined(Q_OS_OPENHARMONY) + } else if (scheme.length() == 7 && 0 == scheme.compare(QLatin1String(rawfile_string), Qt::CaseInsensitive)) { + return true; +#endif - } else { return false; -@@ -495,6 +502,14 @@ bool QQmlFile::isSynchronous(const QString &url) - + } +@@ -501,7 +506,14 @@ bool QQmlFile::isSynchronous(const QString &url) + url[7] == QLatin1Char(':') && url[8] == QLatin1Char('/'); } #endif +#if defined(Q_OS_OPENHARMONY) + else if (f == QLatin1Char('r') || f == QLatin1Char('R')) { + return url.length() >= 9 /* rawfile:/ */ && -+ url.startsWith(QLatin1String(rawfile_string), Qt::CaseInsensitive) && -+ url[7] == QLatin1Char(':') && url[8] == QLatin1Char('/'); -+ ++ url.startsWith(QLatin1String(rawfile_string), Qt::CaseInsensitive) && ++ url[7] == QLatin1Char(':') && url[8] == QLatin1Char('/'); + + } +#endif - return false; } -@@ -518,6 +533,10 @@ bool QQmlFile::isLocalFile(const QUrl &url) + +@@ -524,7 +536,10 @@ bool QQmlFile::isLocalFile(const QUrl &url) } else if (scheme.length() == 6 && 0 == scheme.compare(QLatin1String(assets_string), Qt::CaseInsensitive)) { return true; #endif +- +#if defined(Q_OS_OPENHARMONY) + } else if (scheme.length() == 7 && 0 == scheme.compare(QLatin1String(rawfile_string), Qt::CaseInsensitive)) { + return true; +#endif - } else { return false; -@@ -559,6 +578,14 @@ bool QQmlFile::isLocalFile(const QString &url) - + } +@@ -568,7 +583,14 @@ bool QQmlFile::isLocalFile(const QString &url) + url[7] == QLatin1Char(':') && url[8] == QLatin1Char('/'); } #endif +#if defined(Q_OS_OPENHARMONY) + else if (f == QLatin1Char('r') || f == QLatin1Char('R')) { + return url.length() >= 9 /* assets:/ */ && -+ url.startsWith(QLatin1String(rawfile_string), Qt::CaseInsensitive) && -+ url[7] == QLatin1Char(':') && url[8] == QLatin1Char('/'); -+ ++ url.startsWith(QLatin1String(rawfile_string), Qt::CaseInsensitive) && ++ url[7] == QLatin1Char(':') && url[8] == QLatin1Char('/'); + + } +#endif - return false; } -@@ -582,6 +609,13 @@ QString QQmlFile::urlToLocalFileOrQrc(const QUrl& url) - return QString(); + +@@ -593,7 +615,13 @@ QString QQmlFile::urlToLocalFileOrQrc(const QUrl& url) + return url.toString(); } #endif +- +#if defined(Q_OS_OPENHARMONY) + else if (url.scheme().compare(QLatin1String("rawfile"), Qt::CaseInsensitive) == 0) { + if (url.authority().isEmpty()) @@ -75,23 +79,24 @@ index 99031e1e74..dcfc473da2 100644 + return QString(); + } +#endif - return url.toLocalFile(); } -@@ -620,6 +654,11 @@ QString QQmlFile::urlToLocalFileOrQrc(const QString& url) + +@@ -633,7 +661,11 @@ QString QQmlFile::urlToLocalFileOrQrc(const QString& url) return url; } #endif +- +#if defined(Q_OS_OPENHARMONY) + else if (url.startsWith(QLatin1String("rawfile:"), Qt::CaseInsensitive)) { + return url; + } +#endif - return toLocalFile(url); } + diff --git a/src/qml/qml/qqmlplatform.cpp b/src/qml/qml/qqmlplatform.cpp -index 0acf20bbb4..27f22c19a3 100644 +index dcd7ca2d46..a03b569641 100644 --- a/src/qml/qml/qqmlplatform.cpp +++ b/src/qml/qml/qqmlplatform.cpp @@ -60,6 +60,8 @@ QString QQmlPlatform::os() @@ -104,67 +109,75 @@ index 0acf20bbb4..27f22c19a3 100644 return QStringLiteral("ios"); #elif defined(Q_OS_TVOS) diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp -index 9e5bc0b021..e12c80a777 100644 +index 01aba47a9a..c415d69f78 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp -@@ -1827,6 +1827,14 @@ QString QQmlTypeLoader::absoluteFilePath(const QString &path) +@@ -945,7 +945,14 @@ QString QQmlTypeLoader::absoluteFilePath(const QString &path) return fileInfo.isFile() ? fileInfo.absoluteFilePath() : QString(); } #endif +- +#if defined(Q_OS_OPENHARMONY) + else if (path.count() > 8 && path.at(7) == QLatin1Char(':') && path.at(8) == QLatin1Char('/') && -+ path.startsWith(QLatin1String("rawfile"), Qt::CaseInsensitive)) { ++ path.startsWith(QLatin1String("rawfile"), Qt::CaseInsensitive)) { + // assets resource url + QFileInfo fileInfo(QQmlFile::urlToLocalFileOrQrc(path)); + return fileInfo.isFile() ? fileInfo.absoluteFilePath() : QString(); + } +#endif - int lastSlash = path.lastIndexOf(QLatin1Char('/')); QString dirPath(path.left(lastSlash)); -@@ -1884,6 +1892,14 @@ bool QQmlTypeLoader::fileExists(const QString &path, const QString &file) - return fileInfo.isFile(); + +@@ -1034,7 +1041,13 @@ bool QQmlTypeLoader::fileExists(const QString &path, const QString &file) + return addToCache(QFileInfo(QQmlFile::urlToLocalFileOrQrc(path + file))); } #endif +- +#if defined(Q_OS_OPENHARMONY) + else if (path.count() > 8 && path.at(7) == QLatin1Char(':') && path.at(8) == QLatin1Char('/') && -+ path.startsWith(QLatin1String("rawfile"), Qt::CaseInsensitive)) { -+ // assets resource url -+ QFileInfo fileInfo(QQmlFile::urlToLocalFileOrQrc(path + file)); -+ return fileInfo.isFile(); ++ path.startsWith(QLatin1String("rawfile"), Qt::CaseInsensitive)) { ++ // content url ++ return addToCache(QFileInfo(QQmlFile::urlToLocalFileOrQrc(path + file))); + } +#endif + return addToCache(QFileInfo(path + file)); + } - LockHolder holder(this); - if (!m_importDirCache.contains(path)) { -@@ -1921,6 +1937,9 @@ bool QQmlTypeLoader::directoryExists(const QString &path) - #if defined(Q_OS_ANDROID) - isResource = isResource || path.startsWith(QLatin1String("assets:/")); +@@ -1053,6 +1066,9 @@ bool QQmlTypeLoader::directoryExists(const QString &path) + isResource = isResource || path.startsWith(QLatin1String("assets:/")) || path.startsWith(QLatin1String("content:/")); #endif + +#if defined(Q_OS_OPENHARMONY) + isResource = isResource || path.startsWith(QLatin1String("rawfile:/")); +#endif - if (isResource) { // qrc resource + QFileInfo fileInfo(path); diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp -index 3c97475e86..e6041d7aa5 100644 +index 50b7a333c7..90a2c7094a 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp -@@ -45,6 +45,12 @@ +@@ -44,6 +44,11 @@ #include "qquickitem_p.h" #include "qquickevents_p_p.h" +#ifdef USE_MASK -+#include +#include "qquicktext_p.h" +#include +#endif + + #if QT_CONFIG(quick_draganddrop) #include - #include - #include -@@ -627,6 +633,16 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control) + #endif +@@ -686,7 +691,6 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control) + { + q_ptr = c; + +- + Q_Q(QQuickWindow); + + contentItem = new QQuickRootItem; +@@ -698,6 +702,16 @@ void QQuickWindowPrivate::init(QQuickWindow *c, QQuickRenderControl *control) contentItemPrivate->flags |= QQuickItem::ItemIsFocusScope; contentItem->setSize(q->size()); diff --git a/patch/v5.12.12/qtmultimedia.patch b/patch/v5.12.12/qtmultimedia.patch index 843e74970c..e18d10094b 100644 --- a/patch/v5.12.12/qtmultimedia.patch +++ b/patch/v5.12.12/qtmultimedia.patch @@ -1,35 +1,3 @@ -diff --git a/src/multimedia/audio/qsoundeffect_qaudio_p.cpp b/src/multimedia/audio/qsoundeffect_qaudio_p.cpp -index 13df416f3..f247bc79a 100644 ---- a/src/multimedia/audio/qsoundeffect_qaudio_p.cpp -+++ b/src/multimedia/audio/qsoundeffect_qaudio_p.cpp -@@ -333,13 +333,14 @@ void PrivateSoundSource::sampleReady() - if (!m_muted) - m_audioOutput->setVolume(m_volume); - else -- m_audioOutput->setVolume(0); -+ m_audioOutput->setVolume(0); - } - m_sampleReady = true; - soundeffect->setStatus(QSoundEffect::Ready); - -- if (m_playing && m_audioOutput->state() == QAudio::StoppedState) -+ if (m_playing && m_audioOutput->state() == QAudio::StoppedState) { - m_audioOutput->start(this); -+ } - } - - void PrivateSoundSource::decoderError() -@@ -362,9 +363,8 @@ void PrivateSoundSource::stateChanged(QAudio::State state) - } - - qint64 PrivateSoundSource::readData(char *data, qint64 len) --{ -+{ - if ((m_runningCount > 0 || m_runningCount == QSoundEffect::Infinite) && m_playing) { -- - if (m_sample->state() != QSample::Ready) - return 0; - diff --git a/src/openharmony/native/QtMultiMedia/JsAudioManager.ts b/src/openharmony/native/QtMultiMedia/JsAudioManager.ts new file mode 100644 index 000000000..d484e3a7c @@ -371,18 +339,6 @@ index 000000000..966d9dcf0 +templates.base = $$PWD + +INSTALLS += templates -diff --git a/src/plugins/android/src/mediaplayer/qandroidmediaservice.cpp b/src/plugins/android/src/mediaplayer/qandroidmediaservice.cpp -index 2688f3550..f74f6a1d4 100644 ---- a/src/plugins/android/src/mediaplayer/qandroidmediaservice.cpp -+++ b/src/plugins/android/src/mediaplayer/qandroidmediaservice.cpp -@@ -38,7 +38,6 @@ - ****************************************************************************/ - - #include "qandroidmediaservice.h" -- - #include "qandroidmediaplayercontrol.h" - #include "qandroidmetadatareadercontrol.h" - #include "qandroidmediaplayervideorenderercontrol.h" diff --git a/src/plugins/openharmony/openharmony.pro b/src/plugins/openharmony/openharmony.pro new file mode 100644 index 000000000..a3841d703 @@ -2344,7 +2300,7 @@ index 000000000..e4aa287f2 +PLUGIN_CLASS_NAME = QOPenharmonySGVideoNodeFactoryPlugin +load(qt_plugin) diff --git a/src/plugins/opensles/qopenslesaudioinput.cpp b/src/plugins/opensles/qopenslesaudioinput.cpp -index ad87cb057..79bcb04e7 100644 +index 54ed18ac1..3ad19b694 100644 --- a/src/plugins/opensles/qopenslesaudioinput.cpp +++ b/src/plugins/opensles/qopenslesaudioinput.cpp @@ -52,7 +52,11 @@ @@ -2383,30 +2339,18 @@ index ad87cb057..79bcb04e7 100644 QOpenSLESAudioInput::QOpenSLESAudioInput(const QByteArray &device) : m_device(device) -@@ -207,9 +220,11 @@ QIODevice *QOpenSLESAudioInput::start() +@@ -209,8 +222,10 @@ QIODevice *QOpenSLESAudioInput::start() bool QOpenSLESAudioInput::startRecording() { -+ qWarning() << "Audio Input Test startRecording<----------000"; +#ifdef ANDROID if (!hasRecordingPermission()) return false; -- +#endif + m_processedBytes = 0; m_clockStamp.restart(); - m_lastNotifyTime = 0; -@@ -229,27 +244,40 @@ bool QOpenSLESAudioInput::startRecording() - SLDataLocator_BufferQueue loc_bq = { SL_DATALOCATOR_BUFFERQUEUE, NUM_BUFFERS }; - #endif - -+ qWarning() << "Audio Input Test startRecording<----------1111" << m_format; - SLDataFormat_PCM format_pcm = QOpenSLESEngine::audioFormatToSLFormatPCM(m_format); - SLDataSink audioSnk = { &loc_bq, &format_pcm }; -+ qWarning() << "Audio Input Test startRecording<----------1111------->"; - - // create audio recorder - // (requires the RECORD_AUDIO permission) +@@ -239,14 +254,24 @@ bool QOpenSLESAudioInput::startRecording() #ifdef ANDROID const SLInterfaceID id[2] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_ANDROIDCONFIGURATION }; const SLboolean req[2] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE }; @@ -2419,7 +2363,6 @@ index ad87cb057..79bcb04e7 100644 #endif +#if defined(Q_OS_OPENHARMONY) -+ qWarning() << "Audio Input Test startRecording<----------1111------->openharmony"; + result = (*m_engine->slEngine())->CreateAudioRecorder(m_engine->slEngine(), &m_recorderObject, + &audioSrc, &audioSnk, + 0, nullptr, nullptr); @@ -2429,16 +2372,10 @@ index ad87cb057..79bcb04e7 100644 &audioSrc, &audioSnk, sizeof(req) / sizeof(SLboolean), id, req); +#endif -+ qWarning() << "Audio Input Test startRecording<----------1111------->111"; if (result != SL_RESULT_SUCCESS) { m_errorState = QAudio::OpenError; return false; - } -- - #ifdef ANDROID - // configure recorder source - SLAndroidConfigurationItf configItf; -@@ -291,6 +319,8 @@ bool QOpenSLESAudioInput::startRecording() +@@ -293,6 +318,8 @@ bool QOpenSLESAudioInput::startRecording() // get the buffer queue interface #ifdef ANDROID SLInterfaceID bufferqueueItfID = SL_IID_ANDROIDSIMPLEBUFFERQUEUE; @@ -2447,25 +2384,7 @@ index ad87cb057..79bcb04e7 100644 #else SLInterfaceID bufferqueueItfID = SL_IID_BUFFERQUEUE; #endif -@@ -306,7 +336,7 @@ bool QOpenSLESAudioInput::startRecording() - m_errorState = QAudio::FatalError; - return false; - } -- -+ qWarning() << "Audio Input Test startRecording<----------2222"; - if (m_bufferSize <= 0) { - m_bufferSize = m_format.bytesForDuration(DEFAULT_PERIOD_TIME_MS * 1000); - } else { -@@ -336,7 +366,7 @@ bool QOpenSLESAudioInput::startRecording() - } - - m_errorState = QAudio::NoError; -- -+ qWarning() << "Audio Input Test startRecording<----------3333"; - return true; - } - -@@ -419,6 +449,8 @@ void QOpenSLESAudioInput::processBuffer() +@@ -421,6 +448,8 @@ void QOpenSLESAudioInput::processBuffer() // If the buffer queue is empty (shouldn't happen), stop recording. #ifdef ANDROID SLAndroidSimpleBufferQueueState state; @@ -2475,7 +2394,7 @@ index ad87cb057..79bcb04e7 100644 SLBufferQueueState state; #endif diff --git a/src/plugins/opensles/qopenslesaudioinput.h b/src/plugins/opensles/qopenslesaudioinput.h -index ad84db0cd..e722d7957 100644 +index 35cc37959..3ecb62a28 100644 --- a/src/plugins/opensles/qopenslesaudioinput.h +++ b/src/plugins/opensles/qopenslesaudioinput.h @@ -44,6 +44,11 @@ @@ -2490,92 +2409,24 @@ index ad84db0cd..e722d7957 100644 #ifdef ANDROID #include -@@ -53,6 +58,8 @@ - - #endif - -+ -+ - QT_BEGIN_NAMESPACE - - class QOpenSLESEngine; -@@ -105,6 +112,9 @@ private: +@@ -106,6 +111,8 @@ private: #ifdef ANDROID SLuint32 m_recorderPreset; SLAndroidSimpleBufferQueueItf m_bufferQueue; -+ +#elif defined(Q_OS_OPENHARMONY) + SLOHBufferQueueItf m_bufferQueue; #else SLBufferQueueItf m_bufferQueue; #endif diff --git a/src/plugins/opensles/qopenslesaudiooutput.cpp b/src/plugins/opensles/qopenslesaudiooutput.cpp -index 381ce0ec2..a916b455a 100644 +index 381ce0ec2..93716e1c9 100644 --- a/src/plugins/opensles/qopenslesaudiooutput.cpp +++ b/src/plugins/opensles/qopenslesaudiooutput.cpp -@@ -89,10 +89,10 @@ QOpenSLESAudioOutput::QOpenSLESAudioOutput(const QByteArray &device) - m_startRequiresInit(true) +@@ -360,8 +360,11 @@ void QOpenSLESAudioOutput::onEOSEvent() { - #ifndef ANDROID -- m_streamType = -1; -+ m_streamType = -1; - #else -- m_streamType = SL_ANDROID_STREAM_MEDIA; -- m_category = QLatin1String("media"); -+ m_streamType = SL_ANDROID_STREAM_MEDIA; -+ m_category = QLatin1String("media"); - #endif // ANDROID - } - -@@ -114,22 +114,20 @@ QAudio::State QOpenSLESAudioOutput::state() const - void QOpenSLESAudioOutput::start(QIODevice *device) - { - Q_ASSERT(device); -- - if (m_state != QAudio::StoppedState) - stop(); -- - if (!preparePlayer()) - return; - - m_pullMode = true; -- m_audioSource = device; -+ m_audioSource = device; - m_nextBuffer = 0; - m_processedBytes = 0; - m_availableBuffers = BUFFER_COUNT; - setState(QAudio::ActiveState); - setError(QAudio::NoError); - -- // Attempt to fill buffers first. -+ // Attempt to fill buffers first. - for (int i = 0; i != BUFFER_COUNT; ++i) { - const int index = i * m_bufferSize; - const qint64 readSize = m_audioSource->read(m_buffers + index, m_bufferSize); -@@ -146,8 +144,8 @@ void QOpenSLESAudioOutput::start(QIODevice *device) - if (m_processedBytes < 1) - onEOSEvent(); - -- // Change the state to playing. -- // We need to do this after filling the buffers or processedBytes might get corrupted. -+ // Change the state to playing. -+ // We need to do this after filling the buffers or processedBytes might get corrupted. - startPlayer(); - } - -@@ -165,7 +163,7 @@ QIODevice *QOpenSLESAudioOutput::start() - m_audioSource = new SLIODevicePrivate(this); - m_audioSource->open(QIODevice::WriteOnly | QIODevice::Unbuffered); - -- // Change the state to playing -+ // Change the state to playing - startPlayer(); - - setState(QAudio::IdleState); -@@ -361,10 +359,13 @@ void QOpenSLESAudioOutput::onEOSEvent() if (m_state != QAudio::ActiveState) return; - +- +#if defined(Q_OS_OPENHARMONY) + SLOHBufferQueueState state; +#else @@ -2583,31 +2434,12 @@ index 381ce0ec2..a916b455a 100644 +#endif if (SL_RESULT_SUCCESS != (*m_bufferQueueItf)->GetState(m_bufferQueueItf, &state)) return; -- - if (state.count > 0) - return; - -@@ -381,7 +382,6 @@ void QOpenSLESAudioOutput::bufferAvailable(quint32 count, quint32 playIndex) - { - Q_UNUSED(count); - Q_UNUSED(playIndex); -- - if (m_state == QAudio::StoppedState) - return; - -@@ -394,7 +394,7 @@ void QOpenSLESAudioOutput::bufferAvailable(quint32 count, quint32 playIndex) - return; - } - -- // We're in pull mode. -+ // We're in pull mode. - const int index = m_nextBuffer * m_bufferSize; - const qint64 readSize = m_audioSource->read(m_buffers + index, m_bufferSize); -@@ -427,6 +427,15 @@ void QOpenSLESAudioOutput::playCallback(SLPlayItf player, void *ctx, SLuint32 ev +@@ -426,7 +429,15 @@ void QOpenSLESAudioOutput::playCallback(SLPlayItf player, void *ctx, SLuint32 ev + Q_EMIT audioOutput->notify(); } - +- +#if defined(Q_OS_OPENHARMONY) +void QOpenSLESAudioOutput::bufferQueueCallback (SLOHBufferQueueItf bufferQueue, void *ctx, SLuint32 size) +{ @@ -2620,7 +2452,7 @@ index 381ce0ec2..a916b455a 100644 void QOpenSLESAudioOutput::bufferQueueCallback(SLBufferQueueItf bufferQueue, void *ctx) { SLBufferQueueState state; -@@ -434,7 +443,7 @@ void QOpenSLESAudioOutput::bufferQueueCallback(SLBufferQueueItf bufferQueue, voi +@@ -434,7 +445,7 @@ void QOpenSLESAudioOutput::bufferQueueCallback(SLBufferQueueItf bufferQueue, voi QOpenSLESAudioOutput *audioOutput = reinterpret_cast(ctx); audioOutput->bufferAvailable(state.count, state.playIndex); } @@ -2629,16 +2461,7 @@ index 381ce0ec2..a916b455a 100644 bool QOpenSLESAudioOutput::preparePlayer() { if (m_startRequiresInit) -@@ -454,7 +463,7 @@ bool QOpenSLESAudioOutput::preparePlayer() - - SLDataSource audioSrc = { &bufferQueueLocator, &pcmFormat }; - -- // OutputMix -+ // OutputMix - if (SL_RESULT_SUCCESS != (*engine)->CreateOutputMix(engine, - &m_outputMixObject, - 0, -@@ -476,7 +485,11 @@ bool QOpenSLESAudioOutput::preparePlayer() +@@ -476,7 +487,11 @@ bool QOpenSLESAudioOutput::preparePlayer() #ifndef ANDROID const int iids = 2; @@ -2650,12 +2473,7 @@ index 381ce0ec2..a916b455a 100644 const SLboolean req[iids] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE }; #else const int iids = 3; -@@ -486,14 +499,22 @@ bool QOpenSLESAudioOutput::preparePlayer() - const SLboolean req[iids] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE }; - #endif // ANDROID - -- // AudioPlayer -+ // AudioPlayer +@@ -490,10 +505,18 @@ bool QOpenSLESAudioOutput::preparePlayer() if (SL_RESULT_SUCCESS != (*engine)->CreateAudioPlayer(engine, &m_playerObject, &audioSrc, @@ -2675,7 +2493,7 @@ index 381ce0ec2..a916b455a 100644 qWarning() << "Unable to create AudioPlayer"; setError(QAudio::OpenError); return false; -@@ -520,8 +541,13 @@ bool QOpenSLESAudioOutput::preparePlayer() +@@ -520,7 +543,11 @@ bool QOpenSLESAudioOutput::preparePlayer() // Buffer interface if (SL_RESULT_SUCCESS != (*m_playerObject)->GetInterface(m_playerObject, @@ -2685,107 +2503,52 @@ index 381ce0ec2..a916b455a 100644 SL_IID_BUFFERQUEUE, +#endif &m_bufferQueueItf)) { -+ setError(QAudio::FatalError); return false; - } -@@ -531,16 +557,16 @@ bool QOpenSLESAudioOutput::preparePlayer() - this)) { - setError(QAudio::FatalError); - return false; -- } -- -- // Play interface -+ } -+ // Play interface - if (SL_RESULT_SUCCESS != (*m_playerObject)->GetInterface(m_playerObject, - SL_IID_PLAY, - &m_playItf)) { +@@ -540,7 +567,8 @@ bool QOpenSLESAudioOutput::preparePlayer() setError(QAudio::FatalError); return false; } - +#ifndef Q_OS_OPENHARMONY -+ /* TODO for openharmony*/ ++ /* TODO for openharmony*/ if (SL_RESULT_SUCCESS != (*m_playItf)->RegisterCallback(m_playItf, playCallback, this)) { setError(QAudio::FatalError); return false; -@@ -555,8 +581,8 @@ bool QOpenSLESAudioOutput::preparePlayer() +@@ -555,7 +583,7 @@ bool QOpenSLESAudioOutput::preparePlayer() setError(QAudio::FatalError); return false; } - -- // Volume interface +#endif -+ // Volume interface + // Volume interface if (SL_RESULT_SUCCESS != (*m_playerObject)->GetInterface(m_playerObject, SL_IID_VOLUME, - &m_volumeItf)) { -@@ -575,7 +601,7 @@ bool QOpenSLESAudioOutput::preparePlayer() - return false; - } - -- // Buffer size -+ // Buffer size - if (m_bufferSize <= 0) { - m_bufferSize = defaultBufferSize; - } else if (QOpenSLESEngine::supportsLowLatency()) { -@@ -639,7 +665,7 @@ void QOpenSLESAudioOutput::stopPlayer() - m_audioSource = nullptr; - } - -- // We need to change the state manually... -+ // We need to change the state manually... - if (m_playItf) - (*m_playItf)->SetPlayState(m_playItf, SL_PLAYSTATE_STOPPED); - -@@ -666,10 +692,10 @@ qint64 QOpenSLESAudioOutput::writeData(const char *data, qint64 len) - if (len > m_bufferSize) - len = m_bufferSize; - -- // Acquire one slot in the buffer -+ // Acquire one slot in the buffer - const int before = m_availableBuffers.fetchAndAddAcquire(-1); - -- // If there where no vacant slots, then we just overdrew the buffer account... -+ // If there where no vacant slots, then we just overdrew the buffer account... - if (before < 1) { - m_availableBuffers.fetchAndAddRelease(1); - return 0; -@@ -681,7 +707,7 @@ qint64 QOpenSLESAudioOutput::writeData(const char *data, qint64 len) - m_buffers + index, - len); - -- // If we where unable to enqueue a new buffer, give back the acquired slot. -+ // If we where unable to enqueue a new buffer, give back the acquired slot. - if (res == SL_RESULT_BUFFER_INSUFFICIENT) { - m_availableBuffers.fetchAndAddRelease(1); - return 0; diff --git a/src/plugins/opensles/qopenslesaudiooutput.h b/src/plugins/opensles/qopenslesaudiooutput.h -index b480f00e6..b8c561aa0 100644 +index b480f00e6..342423d40 100644 --- a/src/plugins/opensles/qopenslesaudiooutput.h +++ b/src/plugins/opensles/qopenslesaudiooutput.h -@@ -42,6 +42,10 @@ +@@ -47,6 +47,11 @@ + #include + #include - #include - #include +#if defined(Q_OS_OPENHARMONY) +#include +#include +#endif - #include - #include - #include -@@ -90,8 +94,12 @@ private: ++ + QT_BEGIN_NAMESPACE + + class QOpenSLESAudioOutput : public QAbstractAudioOutput +@@ -90,8 +95,11 @@ private: void bufferAvailable(quint32 count, quint32 playIndex); static void playCallback(SLPlayItf playItf, void *ctx, SLuint32 event); -- static void bufferQueueCallback(SLBufferQueueItf bufferQueue, void *ctx); - +#if defined(Q_OS_OPENHARMONY) + static void bufferQueueCallback(SLOHBufferQueueItf bufferQueue, void *ctx, SLuint32 size); +#else -+ static void bufferQueueCallback(SLBufferQueueItf bufferQueue, void *ctx); + static void bufferQueueCallback(SLBufferQueueItf bufferQueue, void *ctx); +- +#endif bool preparePlayer(); void destroyPlayer(); @@ -2803,7 +2566,7 @@ index b480f00e6..b8c561aa0 100644 char *m_buffers; qreal m_volume; diff --git a/src/plugins/opensles/qopenslesdeviceinfo.cpp b/src/plugins/opensles/qopenslesdeviceinfo.cpp -index 8aaf67c76..d9700e572 100644 +index 8aaf67c76..d3af9ea13 100644 --- a/src/plugins/opensles/qopenslesdeviceinfo.cpp +++ b/src/plugins/opensles/qopenslesdeviceinfo.cpp @@ -41,13 +41,26 @@ @@ -2821,25 +2584,22 @@ index 8aaf67c76..d9700e572 100644 QOpenSLESDeviceInfo::QOpenSLESDeviceInfo(const QByteArray &device, QAudio::Mode mode) : m_engine(QOpenSLESEngine::instance()) -- , m_device(device) -- , m_mode(mode) -+ , m_device(device) -+ , m_mode(mode) + , m_device(device) + , m_mode(mode) +#if defined(Q_OS_OPENHARMONY) -+ , m_jsAudioMgr(Q_NULLPTR) ++ , m_jsAudioMgr(Q_NULLPTR) +#endif { +#if defined(Q_OS_OPENHARMONY) -+ m_jsAudioMgr = qJsObjectLoader->create("JsAudioManager"); ++ m_jsAudioMgr = qJsObjectLoader->create("qtaudiomanager"); +#endif } bool QOpenSLESDeviceInfo::isFormatSupported(const QAudioFormat &format) const -@@ -67,8 +80,14 @@ QAudioFormat QOpenSLESDeviceInfo::preferredFormat() const +@@ -67,8 +80,13 @@ QAudioFormat QOpenSLESDeviceInfo::preferredFormat() const format.setCodec(QStringLiteral("audio/pcm")); format.setSampleSize(16); format.setSampleType(QAudioFormat::SignedInt); -+ +#if defined(Q_OS_OPENHARMONY) + format.setSampleRate(QOpenSLESEngine::getOutputValue(QOpenSLESEngine::SampleRate, 44100)); + format.setChannelCount(2); @@ -2850,7 +2610,7 @@ index 8aaf67c76..d9700e572 100644 return format; } -@@ -84,20 +103,39 @@ QStringList QOpenSLESDeviceInfo::supportedCodecs() +@@ -84,20 +102,39 @@ QStringList QOpenSLESDeviceInfo::supportedCodecs() QList QOpenSLESDeviceInfo::supportedSampleRates() { @@ -2890,7 +2650,7 @@ index 8aaf67c76..d9700e572 100644 } QList QOpenSLESDeviceInfo::supportedByteOrders() -@@ -107,7 +145,13 @@ QList QOpenSLESDeviceInfo::supportedByteOrders() +@@ -107,7 +144,13 @@ QList QOpenSLESDeviceInfo::supportedByteOrders() QList QOpenSLESDeviceInfo::supportedSampleTypes() { @@ -2938,7 +2698,7 @@ index ebeb6b4b2..f7ee584ec 100644 QT_END_NAMESPACE diff --git a/src/plugins/opensles/qopenslesengine.cpp b/src/plugins/opensles/qopenslesengine.cpp -index 43cdcb276..0386fa7b0 100644 +index 36025dcfd..a5674292b 100644 --- a/src/plugins/opensles/qopenslesengine.cpp +++ b/src/plugins/opensles/qopenslesengine.cpp @@ -38,7 +38,11 @@ @@ -2954,17 +2714,18 @@ index 43cdcb276..0386fa7b0 100644 #include "qopenslesaudioinput.h" #include -@@ -48,6 +52,9 @@ +@@ -48,6 +52,10 @@ #include #endif +#if defined(Q_OS_OPENHARMONY) +#define OHOS_OPENSLES_BUFFER 16384 +#endif ++ #define MINIMUM_PERIOD_TIME_MS 5 #define DEFAULT_PERIOD_TIME_MS 50 -@@ -59,6 +66,9 @@ QOpenSLESEngine::QOpenSLESEngine() +@@ -59,6 +67,9 @@ QOpenSLESEngine::QOpenSLESEngine() : m_engineObject(0) , m_engine(0) , m_checkedInputFormats(false) @@ -2974,45 +2735,20 @@ index 43cdcb276..0386fa7b0 100644 { SLresult result; -@@ -70,6 +80,10 @@ QOpenSLESEngine::QOpenSLESEngine() +@@ -70,6 +81,9 @@ QOpenSLESEngine::QOpenSLESEngine() result = (*m_engineObject)->GetInterface(m_engineObject, SL_IID_ENGINE, &m_engine); CheckError("Failed to get engine interface"); -+ -+#if defined(Q_OS_OPENHARMONY) -+ m_jsAudioMgr = qJsObjectLoader->create("JsAudioManager"); -+#endif ++#if defined(Q_OS_OPENHARMONY) ++ m_jsAudioMgr = qJsObjectLoader->create("qtaudiomanager"); ++#endif } QOpenSLESEngine::~QOpenSLESEngine() -@@ -92,11 +106,11 @@ SLDataFormat_PCM QOpenSLESEngine::audioFormatToSLFormatPCM(const QAudioFormat &f - format_pcm.bitsPerSample = format.sampleSize(); - format_pcm.containerSize = format.sampleSize(); - format_pcm.channelMask = (format.channelCount() == 1 ? -- SL_SPEAKER_FRONT_CENTER : -- SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT); -+ SL_SPEAKER_FRONT_CENTER : -+ SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT); - format_pcm.endianness = (format.byteOrder() == QAudioFormat::LittleEndian ? -- SL_BYTEORDER_LITTLEENDIAN : -- SL_BYTEORDER_BIGENDIAN); -+ SL_BYTEORDER_LITTLEENDIAN : -+ SL_BYTEORDER_BIGENDIAN); - return format_pcm; - - } -@@ -108,18 +122,24 @@ QByteArray QOpenSLESEngine::defaultDevice(QAudio::Mode mode) const - } - - QList QOpenSLESEngine::availableDevices(QAudio::Mode mode) const --{ -+{ - QList devices; - if (mode == QAudio::AudioInput) { - #ifdef ANDROID - devices << QT_ANDROID_PRESET_MIC +@@ -116,11 +130,17 @@ QList QOpenSLESEngine::availableDevices(QAudio::Mode mode) const << QT_ANDROID_PRESET_CAMCORDER - << QT_ANDROID_PRESET_VOICE_RECOGNITION; + << QT_ANDROID_PRESET_VOICE_RECOGNITION + << QT_ANDROID_PRESET_VOICE_COMMUNICATION; +#elif defined(Q_OS_OPENHARMONY) + devices << m_jsAudioMgr->call("availableInputDevices"); #else @@ -3027,15 +2763,7 @@ index 43cdcb276..0386fa7b0 100644 } return devices; } -@@ -204,7 +224,6 @@ int QOpenSLESEngine::getOutputValue(QOpenSLESEngine::OutputValue type, int defau - return sampleRate; - - #endif // Q_OS_ANDROID -- - return defaultValue; - } - -@@ -246,6 +265,8 @@ int QOpenSLESEngine::getDefaultBufferSize(const QAudioFormat &format) +@@ -247,6 +267,8 @@ int QOpenSLESEngine::getDefaultBufferSize(const QAudioFormat &format) channelConfig, audioFormat); return minBufferSize > 0 ? minBufferSize : format.bytesForDuration(DEFAULT_PERIOD_TIME_MS); @@ -3044,7 +2772,7 @@ index 43cdcb276..0386fa7b0 100644 #else return format.bytesForDuration(DEFAULT_PERIOD_TIME_MS); #endif // Q_OS_ANDROID -@@ -253,8 +274,12 @@ int QOpenSLESEngine::getDefaultBufferSize(const QAudioFormat &format) +@@ -254,8 +276,12 @@ int QOpenSLESEngine::getDefaultBufferSize(const QAudioFormat &format) int QOpenSLESEngine::getLowLatencyBufferSize(const QAudioFormat &format) { @@ -3057,25 +2785,7 @@ index 43cdcb276..0386fa7b0 100644 } bool QOpenSLESEngine::supportsLowLatency() -@@ -318,7 +343,7 @@ void QOpenSLESEngine::checkSupportedInputFormats() - SL_SAMPLINGRATE_48 }; - - -- // Test sampling rates -+ // Test sampling rates - for (int i = 0 ; i < 9; ++i) { - SLDataFormat_PCM format = defaultFormat; - format.samplesPerSec = rates[i]; -@@ -328,7 +353,7 @@ void QOpenSLESEngine::checkSupportedInputFormats() - - } - -- // Test if stereo is supported -+ // Test if stereo is supported - { - SLDataFormat_PCM format = defaultFormat; - format.numChannels = 2; -@@ -350,8 +375,12 @@ bool QOpenSLESEngine::inputFormatIsSupported(SLDataFormat_PCM format) +@@ -351,8 +377,12 @@ bool QOpenSLESEngine::inputFormatIsSupported(SLDataFormat_PCM format) #ifdef ANDROID SLDataLocator_AndroidSimpleBufferQueue loc_bq = { SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 1 }; @@ -3089,17 +2799,16 @@ index 43cdcb276..0386fa7b0 100644 SLDataSink audioSnk = { &loc_bq, &format }; diff --git a/src/plugins/opensles/qopenslesengine.h b/src/plugins/opensles/qopenslesengine.h -index c36b21488..e45d0524a 100644 +index c36b21488..22e3a8172 100644 --- a/src/plugins/opensles/qopenslesengine.h +++ b/src/plugins/opensles/qopenslesengine.h -@@ -44,10 +44,17 @@ - #include +@@ -45,9 +45,16 @@ #include #include + #include +#if defined(Q_OS_OPENHARMONY) +#include +#endif - #include QT_BEGIN_NAMESPACE @@ -3121,7 +2830,7 @@ index c36b21488..e45d0524a 100644 QT_END_NAMESPACE diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro -index 71b9ec6e1..c7cfe9970 100644 +index 95c004125..e877f959d 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -17,6 +17,10 @@ android { @@ -3136,14 +2845,13 @@ index 71b9ec6e1..c7cfe9970 100644 qtConfig(mmrenderer): SUBDIRS += qnx SUBDIRS += audiocapture diff --git a/src/plugins/videonode/egl/qsgvideonode_egl.cpp b/src/plugins/videonode/egl/qsgvideonode_egl.cpp -index c3694f533..fbb6dc609 100644 +index c3694f533..d87cbe837 100644 --- a/src/plugins/videonode/egl/qsgvideonode_egl.cpp +++ b/src/plugins/videonode/egl/qsgvideonode_egl.cpp -@@ -40,8 +40,11 @@ - #include "qsgvideonode_egl.h" +@@ -41,7 +41,11 @@ #include -- + +#ifdef Q_OS_OPENHARMONY +#include +#else @@ -3153,7 +2861,7 @@ index c3694f533..fbb6dc609 100644 QT_BEGIN_NAMESPACE diff --git a/src/src.pro b/src/src.pro -index 97a053379..501514fa0 100644 +index 1dc1015c6..0520764c5 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,6 +1,7 @@ diff --git a/patch/v5.12.12/qtremoteobjects.patch b/patch/v5.12.12/qtremoteobjects.patch index 4fa952c631..e69de29bb2 100644 --- a/patch/v5.12.12/qtremoteobjects.patch +++ b/patch/v5.12.12/qtremoteobjects.patch @@ -1,65 +0,0 @@ -diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro -index 69ca9f1..3fbd89e 100644 ---- a/tests/auto/auto.pro -+++ b/tests/auto/auto.pro -@@ -1,27 +1,32 @@ --TEMPLATE = subdirs -- --sub_localsockettestserver.subdir = localsockettestserver --sub_localsockettestserver.target = sub-localsockettestserver -- --sub_integration.subdir = integration --sub_integration.target = sub-integration --sub_integration.depends = sub-localsockettestserver -- --SUBDIRS += \ -- benchmarks \ -- cmake \ -- modelreplica \ -- modelview \ -- pods \ -- proxy \ -- repc \ -- repcodegenerator \ -- repparser \ -- subclassreplica \ -- sub_integration \ -- sub_localsockettestserver -- --contains(QT_CONFIG, ssl): SUBDIRS += external_IODevice -- --qtHaveModule(qml): SUBDIRS += qml --qtConfig(process): SUBDIRS += integration_multiprocess proxy_multiprocess integration_external restart -+TEMPLATE = subdirs -+ -+sub_localsockettestserver.subdir = localsockettestserver -+sub_localsockettestserver.target = sub-localsockettestserver -+ -+sub_integration.subdir = integration -+sub_integration.target = sub-integration -+sub_integration.depends = sub-localsockettestserver -+ -+SUBDIRS += \ -+ benchmarks \ -+ cmake \ -+ modelreplica \ -+ modelview \ -+ pods \ -+ proxy \ -+ repc \ -+ repcodegenerator \ -+ repparser \ -+ subclassreplica \ -+ sub_integration \ -+ sub_localsockettestserver -+ -+contains(QT_CONFIG, ssl): SUBDIRS += external_IODevice -+ -+qtHaveModule(qml): SUBDIRS += qml -+qtConfig(process): SUBDIRS += integration_multiprocess proxy_multiprocess integration_external restart -+ -+!qtHaveModule(gui): SUBDIRS -= modelview -+ -+#TODO add remove -+SUBDIRS -= integration_external -\ No newline at end of file -- Gitee