Qt: bring over the WebView build's home screen
The WebView build saved its home in its page's localStorage, which stays in the app's data now that the Qt build is dev.ultra.launcher. On first start HomeActivity reads the ultra.home.* keys through a throwaway WebView on the same origin and hands them to QML: apps by component, widgets with their px heights turned into rows, pins kept when the Qt home is still empty. The widget host id goes back to the WebView build's, so its widgets stay bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hiQsCq11CwCPnKPp9D
This commit is contained in:
8 files changed
+130
-2
No files matched your search
@@ -55,6 +55,13 @@ void jWidgetDrag(JNIEnv *, jclass, jint x, jint y) {
|
||||
}
|
||||
void jWidgetDrop(JNIEnv *, jclass, jboolean moved) { post([=] { emit g_backend->widgetDrop(moved); }); }
|
||||
|
||||
void jLegacyHome(JNIEnv *env, jclass, jstring json) {
|
||||
const char *c = env->GetStringUTFChars(json, nullptr);
|
||||
const QString s = QString::fromUtf8(c);
|
||||
env->ReleaseStringUTFChars(json, c);
|
||||
post([=] { emit g_backend->legacyHome(s); });
|
||||
}
|
||||
|
||||
void registerNatives() {
|
||||
static bool done = false;
|
||||
if (done) return;
|
||||
@@ -69,6 +76,7 @@ void registerNatives() {
|
||||
{"widgetGrab", "(I)V", reinterpret_cast<void *>(jWidgetGrab)},
|
||||
{"widgetDrag", "(II)V", reinterpret_cast<void *>(jWidgetDrag)},
|
||||
{"widgetDrop", "(Z)V", reinterpret_cast<void *>(jWidgetDrop)},
|
||||
{"legacyHome", "(Ljava/lang/String;)V", reinterpret_cast<void *>(jLegacyHome)},
|
||||
};
|
||||
QJniEnvironment env;
|
||||
env.registerNativeMethods("dev/ultra/launcher/Native", methods, int(std::size(methods)));
|
||||
|
||||
@@ -73,6 +73,7 @@ signals:
|
||||
void widgetGrab(int id);
|
||||
void widgetDrag(qreal x, qreal y); // global logical px
|
||||
void widgetDrop(bool moved);
|
||||
void legacyHome(const QString &json); // the WebView build's saved home, read once
|
||||
void toast(const QString &text); // desktop stand-in for an action
|
||||
|
||||
private:
|
||||
|
||||
Reference in new issue
Block a user