Remove the HA Dashboard tab and the Qt WebEngine dependency (D40)
DSH-1 ended with a negative result: the Frame's system WebEngine can't be loaded, and bundling our own failed (no sandbox, ICU resources, Vulkan abort, empty page). Reverts the tab (60deb43), the container packages (0676998) and the bundler's WebEngine support (b823ff3,e2cfa8e), and updates the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+2
-8
@@ -58,20 +58,14 @@ target_link_libraries(frameassistant_lib PUBLIC Qt6::Core)
|
||||
target_compile_options(frameassistant_lib PRIVATE -Wall -Wextra)
|
||||
|
||||
# The app: its UI is the QML module "FrameAssistant" (src/qml/).
|
||||
# Qt WebEngine shows HA's web UI (DSH-1); on the Frame it comes with the system Qt.
|
||||
find_package(Qt6 REQUIRED COMPONENTS WebEngineQuick)
|
||||
vrdash_add_dashboard(frameassistant
|
||||
OUTPUT_NAME ${VRDASH_EXECUTABLE_NAME}
|
||||
QML_URI FrameAssistant
|
||||
SOURCES main.cpp Dashboard.h Dashboard.cpp
|
||||
QML_SOURCES ha/HaWebUi.h ha/HaWebUi.cpp
|
||||
QML_FILES
|
||||
qml/Main.qml
|
||||
qml/Card.qml
|
||||
qml/HaDashboard.qml)
|
||||
target_link_libraries(frameassistant PRIVATE frameassistant_lib Qt6::WebEngineQuick)
|
||||
# The generated QML type registration includes QML_SOURCES headers by file name.
|
||||
target_include_directories(frameassistant PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ha)
|
||||
qml/Card.qml)
|
||||
target_link_libraries(frameassistant PRIVATE frameassistant_lib)
|
||||
|
||||
install(FILES ${OPENVR_LIBRARY} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
|
||||
@@ -17,9 +17,6 @@ Dashboard::Dashboard(int& argc, char** argv)
|
||||
.arg(Config::defaultPath()),
|
||||
QStringLiteral("path"))}) {
|
||||
addSurface({.qmlRootType = QStringLiteral("Main")});
|
||||
addSurface({.id = QStringLiteral("dashboard"),
|
||||
.qmlRootType = QStringLiteral("HaDashboard"),
|
||||
.displayName = QStringLiteral("HA Dashboard")});
|
||||
}
|
||||
|
||||
bool Dashboard::prepare(QString* error) {
|
||||
@@ -37,5 +34,3 @@ bool Dashboard::prepare(QString* error) {
|
||||
<< m_config.deviceName << "(" + m_config.deviceId + ")";
|
||||
return true;
|
||||
}
|
||||
|
||||
void Dashboard::loading() { m_haWebUi.setUrl(m_config.haUrl); }
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "app/DashboardApplication.h"
|
||||
#include "config/Config.h"
|
||||
#include "ha/HaWebUi.h"
|
||||
|
||||
// The dashboard app. Its UI is the QML module set up in src/CMakeLists.txt
|
||||
// (QML_URI FrameAssistant, files in src/qml/).
|
||||
@@ -17,10 +16,7 @@ class Dashboard : public DashboardApplication {
|
||||
protected:
|
||||
// Loads the settings (overlay and desktop mode; docs/DESIGN.md, D22).
|
||||
bool prepare(QString* error) override;
|
||||
void loading() override;
|
||||
|
||||
private:
|
||||
Config m_config;
|
||||
// QML singleton (HaWebUi); a member, so it outlives all QML.
|
||||
HaWebUi m_haWebUi{nullptr};
|
||||
};
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
#include "ha/HaWebUi.h"
|
||||
|
||||
#include <QQmlEngine>
|
||||
#include <QQuickWebEngineProfile>
|
||||
#include <QStandardPaths>
|
||||
|
||||
namespace {
|
||||
|
||||
HaWebUi* g_instance = nullptr;
|
||||
|
||||
} // namespace
|
||||
|
||||
HaWebUi::HaWebUi(QObject* parent) : QObject(parent) {
|
||||
Q_ASSERT(!g_instance);
|
||||
g_instance = this;
|
||||
}
|
||||
|
||||
HaWebUi::~HaWebUi() { g_instance = nullptr; }
|
||||
|
||||
QQuickWebEngineProfile* HaWebUi::profile() {
|
||||
if (!m_profile) {
|
||||
m_profile = new QQuickWebEngineProfile(this);
|
||||
m_profile->setStorageName(QStringLiteral("frameassistant"));
|
||||
m_profile->setOffTheRecord(false);
|
||||
m_profile->setPersistentStoragePath(storagePath());
|
||||
m_profile->setCachePath(cachePath());
|
||||
m_profile->setPersistentCookiesPolicy(
|
||||
QQuickWebEngineProfile::AllowPersistentCookies);
|
||||
}
|
||||
return m_profile;
|
||||
}
|
||||
|
||||
QString HaWebUi::storagePath() {
|
||||
return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QStringLiteral("/frameassistant/webengine");
|
||||
}
|
||||
|
||||
QString HaWebUi::cachePath() {
|
||||
return QStandardPaths::writableLocation(
|
||||
QStandardPaths::GenericCacheLocation) +
|
||||
QStringLiteral("/frameassistant/webengine");
|
||||
}
|
||||
|
||||
HaWebUi* HaWebUi::create(QQmlEngine*, QJSEngine*) {
|
||||
Q_ASSERT(g_instance);
|
||||
// Owned by the app, not by the QML engine.
|
||||
QJSEngine::setObjectOwnership(g_instance, QJSEngine::CppOwnership);
|
||||
return g_instance;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtQml/qqmlregistration.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QQuickWebEngineProfile>
|
||||
#include <QUrl>
|
||||
|
||||
class QJSEngine;
|
||||
class QQmlEngine;
|
||||
|
||||
// HA's web UI in the "HA Dashboard" tab (DSH-1): the URL from the settings
|
||||
// and a persistent WebEngine profile, so the HA login survives restarts
|
||||
// (docs/DESIGN.md, D39). A QML singleton owned by the app (Dashboard).
|
||||
class HaWebUi : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_SINGLETON
|
||||
// Empty: no URL configured (the tab shows a hint).
|
||||
Q_PROPERTY(QUrl url READ url CONSTANT)
|
||||
Q_PROPERTY(QQuickWebEngineProfile* profile READ profile CONSTANT)
|
||||
|
||||
public:
|
||||
// Not default-constructible, so QML uses create() instead of making its
|
||||
// own instance.
|
||||
explicit HaWebUi(QObject* parent);
|
||||
~HaWebUi() override;
|
||||
|
||||
// Call before the QML is loaded.
|
||||
void setUrl(const QUrl& url) { m_url = url; }
|
||||
|
||||
QUrl url() const { return m_url; }
|
||||
// Created on first use: only a tab that shows the web UI needs it.
|
||||
QQuickWebEngineProfile* profile();
|
||||
|
||||
// Where the profile keeps its data (cookies, local storage) and cache.
|
||||
static QString storagePath();
|
||||
static QString cachePath();
|
||||
|
||||
// QML singleton factory: the instance the app created.
|
||||
static HaWebUi* create(QQmlEngine*, QJSEngine*);
|
||||
|
||||
private:
|
||||
QUrl m_url;
|
||||
QQuickWebEngineProfile* m_profile = nullptr;
|
||||
};
|
||||
@@ -1,11 +1,6 @@
|
||||
#include <QtWebEngineQuick/qtwebenginequickglobal.h>
|
||||
|
||||
#include "Dashboard.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
// Must run before the Qt application object exists (the Dashboard
|
||||
// constructor creates it).
|
||||
QtWebEngineQuick::initialize();
|
||||
Dashboard app(argc, argv);
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
import QtWebEngine
|
||||
|
||||
// "HA Dashboard" tab (DSH-1): HA's own web UI at the URL from the settings.
|
||||
// Without a URL it shows a hint instead.
|
||||
Pane {
|
||||
id: root
|
||||
|
||||
Material.theme: Material.Dark
|
||||
padding: 0
|
||||
font.pixelSize: 24
|
||||
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
sourceComponent: HaWebUi.url.toString() !== "" ? webUi : hint
|
||||
}
|
||||
|
||||
Component {
|
||||
id: webUi
|
||||
|
||||
WebEngineView {
|
||||
profile: HaWebUi.profile
|
||||
url: HaWebUi.url
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: hint
|
||||
|
||||
Label {
|
||||
padding: 48
|
||||
wrapMode: Text.WordWrap
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: qsTr("No Home Assistant URL configured.\n\nSet \"homeassistant.url\" in the settings file and restart.")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user