From 7a633ee8c8923a05d3beb44439f5e19b76446521 Mon Sep 17 00:00:00 2001 From: Xavier Michelon Date: Tue, 5 Jul 2022 15:43:25 +0200 Subject: [PATCH] GODT-1669: QML files are now bundled in a Qt resource file. [skip-ci] --- internal/frontend/qt6/CMakeLists.txt | 1 + internal/frontend/qt6/Resources.qrc | 117 +++++++++++++++++++++++++++ internal/frontend/qt6/main.cpp | 11 ++- 3 files changed, 123 insertions(+), 6 deletions(-) create mode 100644 internal/frontend/qt6/Resources.qrc diff --git a/internal/frontend/qt6/CMakeLists.txt b/internal/frontend/qt6/CMakeLists.txt index 286664ef..f6a1b42c 100644 --- a/internal/frontend/qt6/CMakeLists.txt +++ b/internal/frontend/qt6/CMakeLists.txt @@ -103,6 +103,7 @@ add_custom_command( ) add_executable(bridge_qt6 + Resources.qrc ${PROTO_CPP_FILE} ${PROTO_H_FILE} ${GRPC_CPP_FILE} ${GRPC_H_FILE} AppController.cpp AppController.h EventStreamWorker.cpp EventStreamWorker.h diff --git a/internal/frontend/qt6/Resources.qrc b/internal/frontend/qt6/Resources.qrc new file mode 100644 index 00000000..796995cb --- /dev/null +++ b/internal/frontend/qt6/Resources.qrc @@ -0,0 +1,117 @@ + + + + qml/AccountDelegate.qml + qml/AccountView.qml + qml/Banner.qml + qml/Bridge.qml + qml/Bridge_test.qml + qml/bridgeqml.qmlproject + qml/BridgeTest/UserControl.qml + qml/BridgeTest/UserList.qml + qml/BridgeTest/UserModel.qml + qml/BugReportView.qml + qml/Configuration.qml + qml/ConfigurationItem.qml + qml/ContentWrapper.qml + qml/DebugWrapper.qml + qml/GeneralSettings.qml + qml/HelpView.qml + qml/icons/ic-alert.svg + qml/icons/ic-apple-mail.svg + qml/icons/ic-arrow-left.svg + qml/icons/ic-card-identity.svg + qml/icons/ic-check.svg + qml/icons/ic-chevron-down.svg + qml/icons/ic-chevron-up.svg + qml/icons/ic-cog-wheel.svg + qml/icons/ic-connected.svg + qml/icons/ic-copy.svg + qml/icons/ic-cross-close.svg + qml/icons/ic-drive.svg + qml/icons/ic-exclamation-circle-filled.svg + qml/icons/ic-external-link.svg + qml/icons/ic-eye-slash.svg + qml/icons/ic-eye.svg + qml/icons/ic-illustrative-view-html-code.svg + qml/icons/ic-info-circle-filled.svg + qml/icons/ic-info.svg + qml/icons/ic-microsoft-outlook.svg + qml/icons/ic-mozilla-thunderbird.svg + qml/icons/ic-no-connection.svg + qml/icons/ic-other-mail-clients.svg + qml/icons/ic-plus.svg + qml/icons/ic-question-circle.svg + qml/icons/ic-success.svg + qml/icons/ic-three-dots-vertical.svg + qml/icons/ic-trash.svg + qml/icons/img-proton-logos.png + qml/icons/img-proton-logos.svg + qml/icons/img-splash.png + qml/icons/img-splash.svg + qml/icons/img-welcome-dark.png + qml/icons/img-welcome-dark.svg + qml/icons/img-welcome.png + qml/icons/img-welcome.svg + qml/icons/Loader_16.svg + qml/icons/Loader_48.svg + qml/icons/product_logos.svg + qml/icons/product_logos_dark.svg + qml/icons/systray-color-error.png + qml/icons/systray-color-norm.png + qml/icons/systray-color-update.png + qml/icons/systray-color-warn.png + qml/icons/systray-mono-error.png + qml/icons/systray-mono-norm.png + qml/icons/systray-mono-update.png + qml/icons/systray-mono-warn.png + qml/icons/systray.svg + qml/KeychainSettings.qml + qml/LocalCacheSettings.qml + qml/MainWindow.qml + qml/NotificationDialog.qml + qml/NotificationPopups.qml + qml/Notifications/Notification.qml + qml/Notifications/NotificationFilter.qml + qml/Notifications/Notifications.qml + qml/Notifications/qmldir + qml/PortSettings.qml + qml/Proton/Action.qml + qml/Proton/ApplicationWindow.qml + qml/Proton/Button.qml + qml/Proton/CheckBox.qml + qml/Proton/ColorScheme.qml + qml/Proton/ComboBox.qml + qml/Proton/Dialog.qml + qml/Proton/Label.qml + qml/Proton/Menu.qml + qml/Proton/MenuItem.qml + qml/Proton/Popup.qml + qml/Proton/qmldir + qml/Proton/RadioButton.qml + qml/Proton/Style.qml + qml/Proton/Switch.qml + qml/Proton/TextArea.qml + qml/Proton/TextField.qml + qml/Proton/Toggle.qml + qml/SettingsItem.qml + qml/SettingsView.qml + qml/SetupGuide.qml + qml/SignIn.qml + qml/SMTPSettings.qml + qml/SplashScreen.qml + qml/Status.qml + qml/StatusWindow.qml + qml/tests/Buttons.qml + qml/tests/ButtonsColumn.qml + qml/tests/CheckBoxes.qml + qml/tests/ComboBoxes.qml + qml/tests/RadioButtons.qml + qml/tests/Switches.qml + qml/tests/Test.qml + qml/tests/TestComponents.qml + qml/tests/TextAreas.qml + qml/tests/TextFields.qml + qml/WelcomeGuide.qml + + diff --git a/internal/frontend/qt6/main.cpp b/internal/frontend/qt6/main.cpp index 3e464ccd..41882c41 100644 --- a/internal/frontend/qt6/main.cpp +++ b/internal/frontend/qt6/main.cpp @@ -66,8 +66,7 @@ void initLog() //**************************************************************************************************************************************************** QQmlComponent *createRootQmlComponent(QQmlApplicationEngine &engine) { - /// \todo GODT-1669 pack QML and resources in QRC resource file. - QDir qmlDir("qml"); + QString const qrcQmlDir = "qrc:/qml"; qmlRegisterType("CppBackend", 1, 0, "QMLBackend"); qmlRegisterType("CppBackend", 1, 0, "UserList"); @@ -75,13 +74,13 @@ QQmlComponent *createRootQmlComponent(QQmlApplicationEngine &engine) auto rootComponent = new QQmlComponent(&engine, &engine); - engine.addImportPath(qmlDir.absolutePath()); - engine.addPluginPath(qmlDir.absolutePath()); + engine.addImportPath(qrcQmlDir); + engine.addPluginPath(qrcQmlDir); - QQuickStyle::addStylePath(qmlDir.absolutePath()); + QQuickStyle::addStylePath(qrcQmlDir); QQuickStyle::setStyle("Proton"); - rootComponent->loadUrl(qmlDir.absoluteFilePath("Bridge.qml")); + rootComponent->loadUrl(QUrl(qrcQmlDir + "/Bridge.qml")); if (rootComponent->status() != QQmlComponent::Status::Ready) throw Exception("Could not load QML component");