From 2d45b94a49aef6222b56105dcce035f3b88cf30f Mon Sep 17 00:00:00 2001 From: Naomi Kirby Date: Tue, 30 Jan 2024 08:09:10 -0800 Subject: [PATCH] VPN-5472: Merge Mozilla.Shared.qmlcomponents into Mozilla.VPN module (#8843) * QML: Merge Mozilla.Share.qmlcomponents into Mozilla.VPN modules * Move MZFilterProxyModel into nebula * Create Mozilla.VPN.ui qml module and move composer classes into it * Merge Mozilla.VPN and Mozilla.VPN.ui and use QML_FOREIGN for singletons * Register MZAddonMessage type through UI module * Add VPNAndroidUtils singleton too * Move MZComposerView back into nebula * Make VPNProducts a singleton too --- nebula/ui/components/CMakeLists.txt | 5 +- nebula/ui/components/MZComposerView.qml | 2 +- nebula/ui/components/MZGuideList.qml | 2 +- .../ui/components}/filterproxymodel.cpp | 37 ++++------- .../ui/components}/filterproxymodel.h | 0 nebula/ui/components/forms/MZSearchBar.qml | 2 +- src/CMakeLists.txt | 6 +- src/addons/addon.h | 3 +- src/addons/addonguide.h | 2 +- src/addons/addonmessage.h | 6 +- src/cmake/sentry.cmake | 2 + src/cmake/shared-sources.cmake | 16 ----- src/commands/commandui.cpp | 55 ---------------- src/connectionhealth.cpp | 13 ++++ src/connectionhealth.h | 12 +--- src/mozillavpn.cpp | 4 +- src/productshandler.cpp | 5 ++ src/ui/CMakeLists.txt | 65 +++++++++++++++++++ src/{ => ui}/composer/composer.cpp | 0 src/{ => ui}/composer/composer.h | 0 src/{ => ui}/composer/composerblock.cpp | 0 src/{ => ui}/composer/composerblock.h | 0 src/{ => ui}/composer/composerblockbutton.cpp | 0 src/{ => ui}/composer/composerblockbutton.h | 0 .../composer/composerblockorderedlist.cpp | 0 .../composer/composerblockorderedlist.h | 0 src/{ => ui}/composer/composerblocktext.cpp | 0 src/{ => ui}/composer/composerblocktext.h | 0 src/{ => ui}/composer/composerblocktitle.cpp | 0 src/{ => ui}/composer/composerblocktitle.h | 0 .../composer/composerblockunorderedlist.cpp | 0 .../composer/composerblockunorderedlist.h | 0 .../home/servers/RecentConnections.qml | 1 - src/ui/screens/messaging/ViewMessage.qml | 2 +- .../screens/messaging/ViewMessagesInbox.qml | 2 +- src/ui/screens/settings/ViewGuide.qml | 1 - .../appPermissions/AppPermissionsList.qml | 1 - src/ui/singletons/VPN.h | 24 +++++++ src/ui/singletons/VPNAndroidUtils.h | 24 +++++++ src/ui/singletons/VPNAppPermissions.h | 24 +++++++ src/ui/singletons/VPNCaptivePortal.h | 26 ++++++++ src/ui/singletons/VPNConnectionBenchmark.h | 26 ++++++++ src/ui/singletons/VPNConnectionHealth.h | 25 +++++++ src/ui/singletons/VPNController.h | 27 ++++++++ src/ui/singletons/VPNCurrentServer.h | 25 +++++++ src/ui/singletons/VPNDeviceModel.h | 25 +++++++ src/ui/singletons/VPNIPAddressLookup.h | 25 +++++++ src/ui/singletons/VPNProducts.h | 24 +++++++ src/ui/singletons/VPNProfileFlow.h | 25 +++++++ src/ui/singletons/VPNPurchase.h | 25 +++++++ src/ui/singletons/VPNRecentConnectionsModel.h | 24 +++++++ .../singletons/VPNRecommendedLocationModel.h | 25 +++++++ src/ui/singletons/VPNReleaseMonitor.h | 25 +++++++ src/ui/singletons/VPNServerCountryModel.h | 26 ++++++++ src/ui/singletons/VPNServerLatency.h | 25 +++++++ src/ui/singletons/VPNSubscriptionData.h | 25 +++++++ src/ui/singletons/VPNSupportCategoryModel.h | 26 ++++++++ src/ui/singletons/VPNUser.h | 25 +++++++ src/ui/types/MZAddonMessage.h | 21 ++++++ tests/auth_tests/CMakeLists.txt | 15 +++++ tests/dummyvpn/CMakeLists.txt | 7 +- tests/qml/CMakeLists.txt | 37 +++++------ tests/qml/tst_VPNCheckBoxRow.qml | 1 - tests/qml/tst_VPNRadioDelegate.qml | 1 - tests/qml/tst_filterableModel.qml | 4 +- tests/unit/CMakeLists.txt | 30 ++++----- tests/unit_tests/CMakeLists.txt | 15 +++++ tests/unit_tests/testcomposer.cpp | 12 ++-- 68 files changed, 731 insertions(+), 182 deletions(-) rename {src => nebula/ui/components}/filterproxymodel.cpp (82%) rename {src => nebula/ui/components}/filterproxymodel.h (100%) create mode 100644 src/ui/CMakeLists.txt rename src/{ => ui}/composer/composer.cpp (100%) rename src/{ => ui}/composer/composer.h (100%) rename src/{ => ui}/composer/composerblock.cpp (100%) rename src/{ => ui}/composer/composerblock.h (100%) rename src/{ => ui}/composer/composerblockbutton.cpp (100%) rename src/{ => ui}/composer/composerblockbutton.h (100%) rename src/{ => ui}/composer/composerblockorderedlist.cpp (100%) rename src/{ => ui}/composer/composerblockorderedlist.h (100%) rename src/{ => ui}/composer/composerblocktext.cpp (100%) rename src/{ => ui}/composer/composerblocktext.h (100%) rename src/{ => ui}/composer/composerblocktitle.cpp (100%) rename src/{ => ui}/composer/composerblocktitle.h (100%) rename src/{ => ui}/composer/composerblockunorderedlist.cpp (100%) rename src/{ => ui}/composer/composerblockunorderedlist.h (100%) create mode 100644 src/ui/singletons/VPN.h create mode 100644 src/ui/singletons/VPNAndroidUtils.h create mode 100644 src/ui/singletons/VPNAppPermissions.h create mode 100644 src/ui/singletons/VPNCaptivePortal.h create mode 100644 src/ui/singletons/VPNConnectionBenchmark.h create mode 100644 src/ui/singletons/VPNConnectionHealth.h create mode 100644 src/ui/singletons/VPNController.h create mode 100644 src/ui/singletons/VPNCurrentServer.h create mode 100644 src/ui/singletons/VPNDeviceModel.h create mode 100644 src/ui/singletons/VPNIPAddressLookup.h create mode 100644 src/ui/singletons/VPNProducts.h create mode 100644 src/ui/singletons/VPNProfileFlow.h create mode 100644 src/ui/singletons/VPNPurchase.h create mode 100644 src/ui/singletons/VPNRecentConnectionsModel.h create mode 100644 src/ui/singletons/VPNRecommendedLocationModel.h create mode 100644 src/ui/singletons/VPNReleaseMonitor.h create mode 100644 src/ui/singletons/VPNServerCountryModel.h create mode 100644 src/ui/singletons/VPNServerLatency.h create mode 100644 src/ui/singletons/VPNSubscriptionData.h create mode 100644 src/ui/singletons/VPNSupportCategoryModel.h create mode 100644 src/ui/singletons/VPNUser.h create mode 100644 src/ui/types/MZAddonMessage.h diff --git a/nebula/ui/components/CMakeLists.txt b/nebula/ui/components/CMakeLists.txt index ab5ce2282c..95f10dc8e9 100644 --- a/nebula/ui/components/CMakeLists.txt +++ b/nebula/ui/components/CMakeLists.txt @@ -25,6 +25,7 @@ qt_add_qml_module(components MZChevron.qml MZClickableRow.qml MZCollapsibleCard.qml + MZComposerView.qml MZDropShadowWithStates.qml MZExternalLinkListItem.qml MZFlickable.qml @@ -82,7 +83,6 @@ qt_add_qml_module(components MZSwipeDelegate.qml MZSwipeAction.qml MZBadge.qml - MZComposerView.qml MZPasteButton.qml MZInformationCard.qml MZStepProgressBar.qml @@ -92,6 +92,9 @@ qt_add_qml_module(components navigationBar/MZBottomNavigationBarButton.qml navigator/MZNavigatorLoader.qml navigator/navigatorLoaderInternal.qml + SOURCES + filterproxymodel.cpp + filterproxymodel.h ) add_subdirectory(forms) diff --git a/nebula/ui/components/MZComposerView.qml b/nebula/ui/components/MZComposerView.qml index 5548ad32ad..a64cfb3598 100644 --- a/nebula/ui/components/MZComposerView.qml +++ b/nebula/ui/components/MZComposerView.qml @@ -6,7 +6,7 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 import Mozilla.Shared 1.0 -import Mozilla.Shared.qmlcomponents 1.0 +import Mozilla.VPN 1.0 import components 0.1 ColumnLayout { diff --git a/nebula/ui/components/MZGuideList.qml b/nebula/ui/components/MZGuideList.qml index e3b36b5281..df702c5737 100644 --- a/nebula/ui/components/MZGuideList.qml +++ b/nebula/ui/components/MZGuideList.qml @@ -6,7 +6,7 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 import Mozilla.Shared 1.0 -import Mozilla.Shared.qmlcomponents 1.0 +import Mozilla.VPN 1.0 import components 0.1 GridLayout { diff --git a/src/filterproxymodel.cpp b/nebula/ui/components/filterproxymodel.cpp similarity index 82% rename from src/filterproxymodel.cpp rename to nebula/ui/components/filterproxymodel.cpp index 85dcb73ce2..b22cca972a 100644 --- a/src/filterproxymodel.cpp +++ b/nebula/ui/components/filterproxymodel.cpp @@ -4,12 +4,9 @@ #include "filterproxymodel.h" -#include "logger.h" -#include "qmlengineholder.h" - -namespace { -Logger logger("FilterProxyModel"); -} +#include +#include +#include FilterProxyModel::FilterProxyModel(QObject* parent) : QSortFilterProxyModel(parent) {} @@ -18,8 +15,7 @@ QJSValue FilterProxyModel::filterCallback() const { return m_filterCallback; } void FilterProxyModel::setFilterCallback(QJSValue filterCallback) { if (!filterCallback.isCallable()) { - logger.error() - << "FilterProxyModel.filterCallback must be a JS callable value"; + qWarning() << "FilterProxyModel.filterCallback must be a JS callable value"; return; } @@ -33,8 +29,7 @@ QJSValue FilterProxyModel::sortCallback() const { return m_sortCallback; } void FilterProxyModel::setSortCallback(QJSValue sortCallback) { if (!sortCallback.isCallable()) { - logger.error() - << "FilterProxyModel.sortCallback must be a JS callable value"; + qWarning() << "FilterProxyModel.sortCallback must be a JS callable value"; return; } @@ -81,7 +76,7 @@ bool FilterProxyModel::filterAcceptsRow( } if (m_filterCallback.isNull() || m_filterCallback.isUndefined()) { - logger.debug() << "No filter callback set!"; + qDebug() << "No filter callback set!"; return true; } @@ -92,11 +87,6 @@ bool FilterProxyModel::filterAcceptsRow( return false; } - if (!QmlEngineHolder::exists()) { - logger.error() << "Something bad is happening. Are we shutting down?"; - return false; - } - QJSValue value = dataToJSValue(sourceModel(), index); QJSValueList arguments; @@ -104,7 +94,7 @@ bool FilterProxyModel::filterAcceptsRow( QJSValue retValue = m_filterCallback.call(arguments); if (retValue.isError()) { - logger.debug() << "Execution throws an error:" << retValue.toString(); + qDebug() << "Execution throws an error:" << retValue.toString(); return false; } @@ -123,11 +113,6 @@ bool FilterProxyModel::lessThan(const QModelIndex& left, Q_ASSERT(m_sortCallback.isCallable()); - if (!QmlEngineHolder::exists()) { - logger.error() << "Something bad is happening. Are we shutting down?"; - return false; - } - QJSValue valueA = dataToJSValue(sourceModel(), left); QJSValue valueB = dataToJSValue(sourceModel(), right); @@ -137,7 +122,7 @@ bool FilterProxyModel::lessThan(const QModelIndex& left, QJSValue retValue = m_sortCallback.call(arguments); if (retValue.isError()) { - logger.debug() << "Execution throws an error:" << retValue.toString(); + qDebug() << "Execution throws an error:" << retValue.toString(); return false; } @@ -157,8 +142,10 @@ void FilterProxyModel::componentComplete() { QJSValue FilterProxyModel::dataToJSValue(const QAbstractItemModel* model, const QModelIndex& index) const { - QJSEngine* engine = QmlEngineHolder::instance()->engine(); - Q_ASSERT(engine); + QQmlEngine* engine = qmlEngine(this); + if (engine == nullptr) { + return QJSValue(QJSValue::UndefinedValue); + } QJSValue value = engine->newObject(); Q_ASSERT(value.isObject()); diff --git a/src/filterproxymodel.h b/nebula/ui/components/filterproxymodel.h similarity index 100% rename from src/filterproxymodel.h rename to nebula/ui/components/filterproxymodel.h diff --git a/nebula/ui/components/forms/MZSearchBar.qml b/nebula/ui/components/forms/MZSearchBar.qml index 8d86884c25..70f3c08705 100644 --- a/nebula/ui/components/forms/MZSearchBar.qml +++ b/nebula/ui/components/forms/MZSearchBar.qml @@ -6,7 +6,7 @@ import QtQuick 2.0 import QtQuick.Layouts 1.14 import Mozilla.Shared 1.0 -import Mozilla.Shared.qmlcomponents 1.0 +import Mozilla.VPN 1.0 import components 0.1 import components.forms 0.1 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 40e5414270..bd858bad49 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -61,9 +61,7 @@ if(NOT CMAKE_CROSSCOMPILING) target_compile_definitions(mozillavpn PUBLIC MVPN_WEBEXTENSION) endif() -qt6_add_qml_module(mozillavpn - URI Mozilla.Shared.qmlcomponents - VERSION 1.0 -) +add_subdirectory(ui) +target_link_libraries(mozillavpn PRIVATE mozillavpn-ui mozillavpn-uiplugin) qt_finalize_target(mozillavpn) diff --git a/src/addons/addon.h b/src/addons/addon.h index 482e0fd567..8eadddf786 100644 --- a/src/addons/addon.h +++ b/src/addons/addon.h @@ -9,14 +9,13 @@ #include #include -#include "settings/settinggroup.h" -#include "settingsholder.h" #include "state/addonstate.h" class AddonConditionWatcher; class QJsonObject; class AddonApi; +class SettingGroup; // A settings group that will contain all settings related to individual addons. constexpr const char* ADDON_SETTINGS_GROUP = "addon"; diff --git a/src/addons/addonguide.h b/src/addons/addonguide.h index eb7c9661f0..20f9abcbd9 100644 --- a/src/addons/addonguide.h +++ b/src/addons/addonguide.h @@ -5,9 +5,9 @@ #ifndef ADDONGUIDE_H #define ADDONGUIDE_H -#include "../composer/composer.h" #include "addon.h" #include "addonproperty.h" +#include "composer.h" class QJsonObject; diff --git a/src/addons/addonmessage.h b/src/addons/addonmessage.h index 06065784a2..8a726a30f6 100644 --- a/src/addons/addonmessage.h +++ b/src/addons/addonmessage.h @@ -5,12 +5,12 @@ #ifndef ADDONMESSAGE_H #define ADDONMESSAGE_H -#include "../composer/composer.h" #include "addon.h" #include "addonproperty.h" -#include "settingsholder.h" +#include "composer.h" class QJsonObject; +class SettingGroup; #ifdef UNIT_TEST class TestAddon; @@ -22,8 +22,6 @@ constexpr const char* ADDON_MESSAGE_SETTINGS_STATUS_KEY = "state"; class AddonMessage final : public Addon { Q_OBJECT Q_DISABLE_COPY_MOVE(AddonMessage) - QML_NAMED_ELEMENT(MZAddonMessage) - QML_UNCREATABLE("") public: ADDON_PROPERTY(title, m_title, getTitle, setTitle, retranslationCompleted) diff --git a/src/cmake/sentry.cmake b/src/cmake/sentry.cmake index 81490a9a6a..997184cf85 100644 --- a/src/cmake/sentry.cmake +++ b/src/cmake/sentry.cmake @@ -26,6 +26,8 @@ if( ${_SUPPORTED} GREATER -1 ) target_compile_definitions(shared-sources INTERFACE SENTRY_ENABLED) # Let's the app know we need to provide the upload client target_compile_definitions(shared-sources INTERFACE SENTRY_NONE_TRANSPORT) + # We need QML private headers for QML backtracing. + target_link_libraries(shared-sources INTERFACE Qt6::QmlPrivate) # Sentry support is given target_sources(shared-sources INTERFACE diff --git a/src/cmake/shared-sources.cmake b/src/cmake/shared-sources.cmake index 875b2efbfb..bdd05e8ac6 100644 --- a/src/cmake/shared-sources.cmake +++ b/src/cmake/shared-sources.cmake @@ -83,20 +83,6 @@ target_sources(shared-sources INTERFACE ${CMAKE_SOURCE_DIR}/src/authenticationlistener.h ${CMAKE_SOURCE_DIR}/src/collator.cpp ${CMAKE_SOURCE_DIR}/src/collator.h - ${CMAKE_SOURCE_DIR}/src/composer/composer.cpp - ${CMAKE_SOURCE_DIR}/src/composer/composer.h - ${CMAKE_SOURCE_DIR}/src/composer/composerblock.cpp - ${CMAKE_SOURCE_DIR}/src/composer/composerblock.h - ${CMAKE_SOURCE_DIR}/src/composer/composerblockbutton.cpp - ${CMAKE_SOURCE_DIR}/src/composer/composerblockbutton.h - ${CMAKE_SOURCE_DIR}/src/composer/composerblockorderedlist.cpp - ${CMAKE_SOURCE_DIR}/src/composer/composerblockorderedlist.h - ${CMAKE_SOURCE_DIR}/src/composer/composerblocktext.cpp - ${CMAKE_SOURCE_DIR}/src/composer/composerblocktext.h - ${CMAKE_SOURCE_DIR}/src/composer/composerblocktitle.cpp - ${CMAKE_SOURCE_DIR}/src/composer/composerblocktitle.h - ${CMAKE_SOURCE_DIR}/src/composer/composerblockunorderedlist.cpp - ${CMAKE_SOURCE_DIR}/src/composer/composerblockunorderedlist.h ${CMAKE_SOURCE_DIR}/src/cryptosettings.cpp ${CMAKE_SOURCE_DIR}/src/cryptosettings.h ${CMAKE_SOURCE_DIR}/src/curve25519.cpp @@ -107,8 +93,6 @@ target_sources(shared-sources INTERFACE ${CMAKE_SOURCE_DIR}/src/errorhandler.h ${CMAKE_SOURCE_DIR}/src/feature/feature.cpp ${CMAKE_SOURCE_DIR}/src/feature/feature.h - ${CMAKE_SOURCE_DIR}/src/filterproxymodel.cpp - ${CMAKE_SOURCE_DIR}/src/filterproxymodel.h ${CMAKE_SOURCE_DIR}/src/fontloader.cpp ${CMAKE_SOURCE_DIR}/src/fontloader.h ${CMAKE_SOURCE_DIR}/src/frontend/navigator.cpp diff --git a/src/commands/commandui.cpp b/src/commands/commandui.cpp index af08c1350b..903f694c94 100644 --- a/src/commands/commandui.cpp +++ b/src/commands/commandui.cpp @@ -309,61 +309,6 @@ int CommandUI::run(QStringList& tokens) { engine->addImageProvider(QString("app"), provider); } - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPN", - MozillaVPN::instance()); - qmlRegisterSingletonInstance( - "Mozilla.VPN", 1, 0, "VPNCaptivePortal", - MozillaVPN::instance()->captivePortalDetection()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNController", - MozillaVPN::instance()->controller()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNUser", - MozillaVPN::instance()->user()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNDeviceModel", - MozillaVPN::instance()->deviceModel()); - - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, - "VPNRecentConnectionsModel", - RecentConnections::instance()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, - "VPNRecommendedLocationModel", - RecommendedLocationModel::instance()); - qmlRegisterSingletonInstance( - "Mozilla.VPN", 1, 0, "VPNSupportCategoryModel", - MozillaVPN::instance()->supportCategoryModel()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNServerCountryModel", - MozillaVPN::instance()->serverCountryModel()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNSubscriptionData", - MozillaVPN::instance()->subscriptionData()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNProfileFlow", - MozillaVPN::instance()->profileFlow()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNCurrentServer", - MozillaVPN::instance()->serverData()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNServerLatency", - MozillaVPN::instance()->serverLatency()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNConnectionHealth", - MozillaVPN::instance()->connectionHealth()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNReleaseMonitor", - MozillaVPN::instance()->releaseMonitor()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNAppPermissions", - AppPermission::instance()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNConnectionBenchmark", - MozillaVPN::instance()->connectionBenchmark()); - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNIPAddressLookup", - MozillaVPN::instance()->ipAddressLookup()); - -#ifdef MZ_ANDROID - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNAndroidUtils", - AndroidUtils::instance()); -#endif - - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNPurchase", - PurchaseHandler::instance()); - - if (!Feature::get(Feature::Feature_webPurchase)->isSupported()) { - qmlRegisterSingletonInstance("Mozilla.VPN", 1, 0, "VPNProducts", - ProductsHandler::instance()); - } - qmlRegisterSingletonInstance("Mozilla.Shared", 1, 0, "MZAccessibleNotification", AccessibleNotification::instance()); diff --git a/src/connectionhealth.cpp b/src/connectionhealth.cpp index c241712088..5c4ac868a6 100644 --- a/src/connectionhealth.cpp +++ b/src/connectionhealth.cpp @@ -8,6 +8,7 @@ #include #include +#include "constants.h" #include "controller.h" #include "glean/generated/metrics.h" #include "leakdetector.h" @@ -262,3 +263,15 @@ void ConnectionHealth::applicationStateChanged(Qt::ApplicationState state) { } #endif } + +void ConnectionHealth::overwriteStabilityForInspector( + ConnectionStability stability) { + if (Constants::inProduction()) { + qFatal( + "Connection health stability mode can only be overwritten in Dev " + "mode!"); + } + m_stabilityOverwritten = true; + m_stability = stability; + emit stabilityChanged(); +} diff --git a/src/connectionhealth.h b/src/connectionhealth.h index 9b2c0257ef..fc41f4d344 100644 --- a/src/connectionhealth.h +++ b/src/connectionhealth.h @@ -5,7 +5,6 @@ #ifndef CONNECTIONHEALTH_H #define CONNECTIONHEALTH_H -#include "constants.h" #include "dnspingsender.h" #include "pinghelper.h" @@ -58,16 +57,7 @@ class ConnectionHealth final : public QObject { ConnectionStability stability() const { return m_stability; } - void overwriteStabilityForInspector(ConnectionStability stability) { - if (Constants::inProduction()) { - qFatal( - "Connection health stability mode can only be overwritten in Dev " - "mode!"); - } - m_stabilityOverwritten = true; - m_stability = stability; - emit stabilityChanged(); - } + void overwriteStabilityForInspector(ConnectionStability stability); uint latency() const { return m_pingHelper.latency(); } double loss() const { return m_pingHelper.loss(); } diff --git a/src/mozillavpn.cpp b/src/mozillavpn.cpp index a1b00df25f..f1ea79d27e 100644 --- a/src/mozillavpn.cpp +++ b/src/mozillavpn.cpp @@ -191,9 +191,7 @@ MozillaVPN::MozillaVPN() : App(nullptr), m_private(new MozillaVPNPrivate()) { &m_private->m_connectionHealth, &ConnectionHealth::connectionStateChanged); - if (!Feature::get(Feature::Feature_webPurchase)->isSupported()) { - ProductsHandler::createInstance(); - } + ProductsHandler::createInstance(); PurchaseHandler* purchaseHandler = PurchaseHandler::createInstance(); connect(purchaseHandler, &PurchaseHandler::subscriptionStarted, this, &MozillaVPN::subscriptionStarted); diff --git a/src/productshandler.cpp b/src/productshandler.cpp index 58eb8b2162..f205f37385 100644 --- a/src/productshandler.cpp +++ b/src/productshandler.cpp @@ -44,6 +44,11 @@ ProductsHandler::ProductsHandler(QObject* parent) : QAbstractListModel(parent) { Q_ASSERT(!s_instance); s_instance = this; + // If web purchases are supported, then we don't need to do anything. + if (Feature::get(Feature::Feature_webPurchase)->isSupported()) { + return; + } + // On iAP make sure the Products are loaded in time. // If we Move into any State adjecent to iAP - load the // products if we don't have that already. diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt new file mode 100644 index 0000000000..ce0a691564 --- /dev/null +++ b/src/ui/CMakeLists.txt @@ -0,0 +1,65 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +qt_add_qml_module(mozillavpn-ui + VERSION 1.0 + URI Mozilla.VPN + STATIC + OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Mozilla/VPN + SOURCES + composer/composer.cpp + composer/composer.h + composer/composerblock.cpp + composer/composerblock.h + composer/composerblockbutton.cpp + composer/composerblockbutton.h + composer/composerblockorderedlist.cpp + composer/composerblockorderedlist.h + composer/composerblocktext.cpp + composer/composerblocktext.h + composer/composerblocktitle.cpp + composer/composerblocktitle.h + composer/composerblockunorderedlist.cpp + composer/composerblockunorderedlist.h + singletons/VPN.h + singletons/VPNAppPermissions.h + singletons/VPNCaptivePortal.h + singletons/VPNConnectionBenchmark.h + singletons/VPNConnectionHealth.h + singletons/VPNController.h + singletons/VPNCurrentServer.h + singletons/VPNDeviceModel.h + singletons/VPNIPAddressLookup.h + singletons/VPNProducts.h + singletons/VPNProfileFlow.h + singletons/VPNPurchase.h + singletons/VPNRecentConnectionsModel.h + singletons/VPNRecommendedLocationModel.h + singletons/VPNReleaseMonitor.h + singletons/VPNServerCountryModel.h + singletons/VPNServerLatency.h + singletons/VPNSubscriptionData.h + singletons/VPNSupportCategoryModel.h + singletons/VPNUser.h + types/MZAddonMessage.h +) + +target_link_libraries(mozillavpn-ui PRIVATE + Qt6::Quick + Qt6::Widgets +) + +target_include_directories(mozillavpn-ui PRIVATE + ${CMAKE_SOURCE_DIR}/src +) + +target_include_directories(mozillavpn-ui PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/composer + ${CMAKE_CURRENT_SOURCE_DIR}/singletons + ${CMAKE_CURRENT_SOURCE_DIR}/types +) + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Android") + target_sources(mozillavpn-ui PRIVATE singletons/VPNAndroidUtils.h) +endif() diff --git a/src/composer/composer.cpp b/src/ui/composer/composer.cpp similarity index 100% rename from src/composer/composer.cpp rename to src/ui/composer/composer.cpp diff --git a/src/composer/composer.h b/src/ui/composer/composer.h similarity index 100% rename from src/composer/composer.h rename to src/ui/composer/composer.h diff --git a/src/composer/composerblock.cpp b/src/ui/composer/composerblock.cpp similarity index 100% rename from src/composer/composerblock.cpp rename to src/ui/composer/composerblock.cpp diff --git a/src/composer/composerblock.h b/src/ui/composer/composerblock.h similarity index 100% rename from src/composer/composerblock.h rename to src/ui/composer/composerblock.h diff --git a/src/composer/composerblockbutton.cpp b/src/ui/composer/composerblockbutton.cpp similarity index 100% rename from src/composer/composerblockbutton.cpp rename to src/ui/composer/composerblockbutton.cpp diff --git a/src/composer/composerblockbutton.h b/src/ui/composer/composerblockbutton.h similarity index 100% rename from src/composer/composerblockbutton.h rename to src/ui/composer/composerblockbutton.h diff --git a/src/composer/composerblockorderedlist.cpp b/src/ui/composer/composerblockorderedlist.cpp similarity index 100% rename from src/composer/composerblockorderedlist.cpp rename to src/ui/composer/composerblockorderedlist.cpp diff --git a/src/composer/composerblockorderedlist.h b/src/ui/composer/composerblockorderedlist.h similarity index 100% rename from src/composer/composerblockorderedlist.h rename to src/ui/composer/composerblockorderedlist.h diff --git a/src/composer/composerblocktext.cpp b/src/ui/composer/composerblocktext.cpp similarity index 100% rename from src/composer/composerblocktext.cpp rename to src/ui/composer/composerblocktext.cpp diff --git a/src/composer/composerblocktext.h b/src/ui/composer/composerblocktext.h similarity index 100% rename from src/composer/composerblocktext.h rename to src/ui/composer/composerblocktext.h diff --git a/src/composer/composerblocktitle.cpp b/src/ui/composer/composerblocktitle.cpp similarity index 100% rename from src/composer/composerblocktitle.cpp rename to src/ui/composer/composerblocktitle.cpp diff --git a/src/composer/composerblocktitle.h b/src/ui/composer/composerblocktitle.h similarity index 100% rename from src/composer/composerblocktitle.h rename to src/ui/composer/composerblocktitle.h diff --git a/src/composer/composerblockunorderedlist.cpp b/src/ui/composer/composerblockunorderedlist.cpp similarity index 100% rename from src/composer/composerblockunorderedlist.cpp rename to src/ui/composer/composerblockunorderedlist.cpp diff --git a/src/composer/composerblockunorderedlist.h b/src/ui/composer/composerblockunorderedlist.h similarity index 100% rename from src/composer/composerblockunorderedlist.h rename to src/ui/composer/composerblockunorderedlist.h diff --git a/src/ui/screens/home/servers/RecentConnections.qml b/src/ui/screens/home/servers/RecentConnections.qml index 6c6ae58cc6..c98e47098e 100644 --- a/src/ui/screens/home/servers/RecentConnections.qml +++ b/src/ui/screens/home/servers/RecentConnections.qml @@ -6,7 +6,6 @@ import QtQuick 2.5 import QtQuick.Layouts 1.14 import Mozilla.Shared 1.0 -import Mozilla.Shared.qmlcomponents 1.0 import Mozilla.VPN 1.0 import compat 0.1 import components 0.1 diff --git a/src/ui/screens/messaging/ViewMessage.qml b/src/ui/screens/messaging/ViewMessage.qml index 0bb70d6b7f..3043089c6a 100644 --- a/src/ui/screens/messaging/ViewMessage.qml +++ b/src/ui/screens/messaging/ViewMessage.qml @@ -7,7 +7,7 @@ import QtQuick.Controls 2.14 import QtQuick.Layouts 1.14 import Mozilla.Shared 1.0 -import Mozilla.Shared.qmlcomponents 1.0 +import Mozilla.VPN 1.0 import components 0.1 MZViewBase { diff --git a/src/ui/screens/messaging/ViewMessagesInbox.qml b/src/ui/screens/messaging/ViewMessagesInbox.qml index bfc9f00b63..c004b54b8e 100644 --- a/src/ui/screens/messaging/ViewMessagesInbox.qml +++ b/src/ui/screens/messaging/ViewMessagesInbox.qml @@ -7,7 +7,7 @@ import QtQuick.Controls 2.14 import QtQuick.Layouts 1.14 import Mozilla.Shared 1.0 -import Mozilla.Shared.qmlcomponents 1.0 +import Mozilla.VPN 1.0 import components 0.1 import components.forms 0.1 diff --git a/src/ui/screens/settings/ViewGuide.qml b/src/ui/screens/settings/ViewGuide.qml index b4658cf0bc..2c218f0433 100644 --- a/src/ui/screens/settings/ViewGuide.qml +++ b/src/ui/screens/settings/ViewGuide.qml @@ -6,7 +6,6 @@ import QtQuick 2.15 import QtQuick.Layouts 1.15 import Mozilla.Shared 1.0 -import Mozilla.Shared.qmlcomponents 1.0 import Mozilla.VPN 1.0 import components 0.1 diff --git a/src/ui/screens/settings/appPermissions/AppPermissionsList.qml b/src/ui/screens/settings/appPermissions/AppPermissionsList.qml index af3eb4c941..8782ddde90 100644 --- a/src/ui/screens/settings/appPermissions/AppPermissionsList.qml +++ b/src/ui/screens/settings/appPermissions/AppPermissionsList.qml @@ -8,7 +8,6 @@ import QtQuick.Controls import QtQuick.Layouts 1.14 import Mozilla.Shared 1.0 -import Mozilla.Shared.qmlcomponents 1.0 import Mozilla.VPN 1.0 import components.forms 0.1 import components 0.1 diff --git a/src/ui/singletons/VPN.h b/src/ui/singletons/VPN.h new file mode 100644 index 0000000000..bfffdf3e62 --- /dev/null +++ b/src/ui/singletons/VPN.h @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPN_H +#define VPN_H + +#include + +#include "mozillavpn.h" + +struct VPN { + Q_GADGET + QML_FOREIGN(MozillaVPN) + QML_ELEMENT + QML_SINGLETON + + public: + static MozillaVPN* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return MozillaVPN::instance(); + } +}; + +#endif // VPN_H diff --git a/src/ui/singletons/VPNAndroidUtils.h b/src/ui/singletons/VPNAndroidUtils.h new file mode 100644 index 0000000000..0d829b4cae --- /dev/null +++ b/src/ui/singletons/VPNAndroidUtils.h @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNANDROIDUTILS_H +#define VPNANDROIDUTILS_H + +#include + +#include "platforms/android/androidutils.h" + +struct VPNAndroidUtils { + Q_GADGET + QML_FOREIGN(AndroidUtils) + QML_ELEMENT + QML_SINGLETON + + public: + static AndroidUtils* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return AndroidUtils::instance(); + } +}; + +#endif // VPNANDROIDUTILS_H diff --git a/src/ui/singletons/VPNAppPermissions.h b/src/ui/singletons/VPNAppPermissions.h new file mode 100644 index 0000000000..b47c0d35c4 --- /dev/null +++ b/src/ui/singletons/VPNAppPermissions.h @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNAPPPERMISSIONS_H +#define VPNAPPPERMISSIONS_H + +#include + +#include "apppermission.h" + +struct VPNAppPermissions { + Q_GADGET + QML_FOREIGN(AppPermission) + QML_ELEMENT + QML_SINGLETON + + public: + static AppPermission* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return AppPermission::instance(); + } +}; + +#endif // VPNAPPPERMISSIONS_H diff --git a/src/ui/singletons/VPNCaptivePortal.h b/src/ui/singletons/VPNCaptivePortal.h new file mode 100644 index 0000000000..439c52c30d --- /dev/null +++ b/src/ui/singletons/VPNCaptivePortal.h @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNCAPTIVEPORTAL_H +#define VPNCAPTIVEPORTAL_H + +#include + +#include "captiveportal/captiveportaldetection.h" +#include "mozillavpn.h" + +struct VPNCaptivePortal { + Q_GADGET + QML_FOREIGN(CaptivePortalDetection) + QML_ELEMENT + QML_SINGLETON + + public: + static CaptivePortalDetection* create(QQmlEngine* qmlEngine, + QJSEngine* jsEngine) { + return MozillaVPN::instance()->captivePortalDetection(); + } +}; + +#endif // VPNCAPTIVEPORTAL_H diff --git a/src/ui/singletons/VPNConnectionBenchmark.h b/src/ui/singletons/VPNConnectionBenchmark.h new file mode 100644 index 0000000000..756178fba7 --- /dev/null +++ b/src/ui/singletons/VPNConnectionBenchmark.h @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNCONNECTIONBENCHMARK_H +#define VPNCONNECTIONBENCHMARK_H + +#include + +#include "connectionbenchmark/connectionbenchmark.h" +#include "mozillavpn.h" + +struct VPNConnectionBenchmark { + Q_GADGET + QML_FOREIGN(ConnectionBenchmark) + QML_ELEMENT + QML_SINGLETON + + public: + static ConnectionBenchmark* create(QQmlEngine* qmlEngine, + QJSEngine* jsEngine) { + return MozillaVPN::instance()->connectionBenchmark(); + } +}; + +#endif // VPNCONNECTIONBENCHMARK_H diff --git a/src/ui/singletons/VPNConnectionHealth.h b/src/ui/singletons/VPNConnectionHealth.h new file mode 100644 index 0000000000..0a34e4663e --- /dev/null +++ b/src/ui/singletons/VPNConnectionHealth.h @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNCONNECTIONHEALTH_H +#define VPNCONNECTIONHEALTH_H + +#include + +#include "connectionhealth.h" +#include "mozillavpn.h" + +struct VPNConnectionHealth { + Q_GADGET + QML_FOREIGN(ConnectionHealth) + QML_ELEMENT + QML_SINGLETON + + public: + static ConnectionHealth* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return MozillaVPN::instance()->connectionHealth(); + } +}; + +#endif // VPNCONNECTIONHEALTH_H diff --git a/src/ui/singletons/VPNController.h b/src/ui/singletons/VPNController.h new file mode 100644 index 0000000000..b4985f03bf --- /dev/null +++ b/src/ui/singletons/VPNController.h @@ -0,0 +1,27 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNCONTROLLER_H +#define VPNCONTROLLER_H + +#include + +#include "controller.h" +#include "mozillavpn.h" + +class Controller; + +struct VPNController { + Q_GADGET + QML_FOREIGN(Controller) + QML_ELEMENT + QML_SINGLETON + + public: + static Controller* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return MozillaVPN::instance()->controller(); + } +}; + +#endif // VPNCONTROLLER_H diff --git a/src/ui/singletons/VPNCurrentServer.h b/src/ui/singletons/VPNCurrentServer.h new file mode 100644 index 0000000000..448e70baf3 --- /dev/null +++ b/src/ui/singletons/VPNCurrentServer.h @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNCURRENTSERVER_H +#define VPNCURRENTSERVER_H + +#include + +#include "models/serverdata.h" +#include "mozillavpn.h" + +struct VPNCurrentServer { + Q_GADGET + QML_FOREIGN(ServerData) + QML_ELEMENT + QML_SINGLETON + + public: + static ServerData* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return MozillaVPN::instance()->serverData(); + } +}; + +#endif // VPNCURRENTSERVER_H diff --git a/src/ui/singletons/VPNDeviceModel.h b/src/ui/singletons/VPNDeviceModel.h new file mode 100644 index 0000000000..d436530d8d --- /dev/null +++ b/src/ui/singletons/VPNDeviceModel.h @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNDEVICEMODEL_H +#define VPNDEVICEMODEL_H + +#include + +#include "models/devicemodel.h" +#include "mozillavpn.h" + +struct VPNDeviceModel { + Q_GADGET + QML_FOREIGN(DeviceModel) + QML_ELEMENT + QML_SINGLETON + + public: + static DeviceModel* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return MozillaVPN::instance()->deviceModel(); + } +}; + +#endif // VPNDEVICEMODEL_H diff --git a/src/ui/singletons/VPNIPAddressLookup.h b/src/ui/singletons/VPNIPAddressLookup.h new file mode 100644 index 0000000000..34f187e5fd --- /dev/null +++ b/src/ui/singletons/VPNIPAddressLookup.h @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNIPADDRESSLOOKUP_H +#define VPNIPADDRESSLOOKUP_H + +#include + +#include "ipaddresslookup.h" +#include "mozillavpn.h" + +struct VPNIPAddressLookup { + Q_GADGET + QML_FOREIGN(IpAddressLookup) + QML_ELEMENT + QML_SINGLETON + + public: + static IpAddressLookup* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return MozillaVPN::instance()->ipAddressLookup(); + } +}; + +#endif // VPNIPADDRESSLOOKUP_H diff --git a/src/ui/singletons/VPNProducts.h b/src/ui/singletons/VPNProducts.h new file mode 100644 index 0000000000..5a2cb627cc --- /dev/null +++ b/src/ui/singletons/VPNProducts.h @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNPRODUCTS_H +#define VPNPRODUCTS_H + +#include + +#include "productshandler.h" + +struct VPNProducts { + Q_GADGET + QML_FOREIGN(ProductsHandler) + QML_ELEMENT + QML_SINGLETON + + public: + static ProductsHandler* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return ProductsHandler::instance(); + } +}; + +#endif // VPNPRODUCTS_H diff --git a/src/ui/singletons/VPNProfileFlow.h b/src/ui/singletons/VPNProfileFlow.h new file mode 100644 index 0000000000..26306622fa --- /dev/null +++ b/src/ui/singletons/VPNProfileFlow.h @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNPROFILEFLOW_H +#define VPNPROFILEFLOW_H + +#include + +#include "mozillavpn.h" +#include "profileflow.h" + +struct VPNProfileFlow { + Q_GADGET + QML_FOREIGN(ProfileFlow) + QML_ELEMENT + QML_SINGLETON + + public: + static ProfileFlow* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return MozillaVPN::instance()->profileFlow(); + } +}; + +#endif // VPNPROFILEFLOW_H diff --git a/src/ui/singletons/VPNPurchase.h b/src/ui/singletons/VPNPurchase.h new file mode 100644 index 0000000000..aa76a80fc6 --- /dev/null +++ b/src/ui/singletons/VPNPurchase.h @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNPURCHASE_H +#define VPNPURCHASE_H + +#include + +#include "mozillavpn.h" +#include "purchasehandler.h" + +struct VPNPurchase { + Q_GADGET + QML_FOREIGN(PurchaseHandler) + QML_ELEMENT + QML_SINGLETON + + public: + static PurchaseHandler* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return PurchaseHandler::instance(); + } +}; + +#endif // VPNPURCHASE_H diff --git a/src/ui/singletons/VPNRecentConnectionsModel.h b/src/ui/singletons/VPNRecentConnectionsModel.h new file mode 100644 index 0000000000..088966eeea --- /dev/null +++ b/src/ui/singletons/VPNRecentConnectionsModel.h @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNRECENTCONNECTIONSMODEL_H +#define VPNRECENTCONNECTIONSMODEL_H + +#include + +#include "models/recentconnections.h" + +struct VPNRecentConnectionsModel { + Q_GADGET + QML_FOREIGN(RecentConnections) + QML_ELEMENT + QML_SINGLETON + + public: + static RecentConnections* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return RecentConnections::instance(); + } +}; + +#endif // VPNRECENTCONNECTIONSMODEL_H diff --git a/src/ui/singletons/VPNRecommendedLocationModel.h b/src/ui/singletons/VPNRecommendedLocationModel.h new file mode 100644 index 0000000000..4d96d0e42d --- /dev/null +++ b/src/ui/singletons/VPNRecommendedLocationModel.h @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNRECOMMENDEDLOCATIONMODEL_H +#define VPNRECOMMENDEDLOCATIONMODEL_H + +#include + +#include "models/recommendedlocationmodel.h" + +struct VPNRecommendedLocationModel { + Q_GADGET + QML_FOREIGN(RecommendedLocationModel) + QML_ELEMENT + QML_SINGLETON + + public: + static RecommendedLocationModel* create(QQmlEngine* qmlEngine, + QJSEngine* jsEngine) { + return RecommendedLocationModel::instance(); + } +}; + +#endif // VPNRECOMMENDEDLOCATIONMODEL_H diff --git a/src/ui/singletons/VPNReleaseMonitor.h b/src/ui/singletons/VPNReleaseMonitor.h new file mode 100644 index 0000000000..f5cc70b3e7 --- /dev/null +++ b/src/ui/singletons/VPNReleaseMonitor.h @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNRELEASEMONITOR_H +#define VPNRELEASEMONITOR_H + +#include + +#include "mozillavpn.h" +#include "releasemonitor.h" + +struct VPNReleaseMonitor { + Q_GADGET + QML_FOREIGN(ReleaseMonitor) + QML_ELEMENT + QML_SINGLETON + + public: + static ReleaseMonitor* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return MozillaVPN::instance()->releaseMonitor(); + } +}; + +#endif // VPNRELEASEMONITOR_H diff --git a/src/ui/singletons/VPNServerCountryModel.h b/src/ui/singletons/VPNServerCountryModel.h new file mode 100644 index 0000000000..c19b1b2ded --- /dev/null +++ b/src/ui/singletons/VPNServerCountryModel.h @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNSERVERCOUNTRYMODEL_H +#define VPNSERVERCOUNTRYMODEL_H + +#include + +#include "models/servercountrymodel.h" +#include "mozillavpn.h" + +struct VPNServerCountryModel { + Q_GADGET + QML_FOREIGN(ServerCountryModel) + QML_ELEMENT + QML_SINGLETON + + public: + static ServerCountryModel* create(QQmlEngine* qmlEngine, + QJSEngine* jsEngine) { + return MozillaVPN::instance()->serverCountryModel(); + } +}; + +#endif // VPNSERVERCOUNTRYMODEL_H diff --git a/src/ui/singletons/VPNServerLatency.h b/src/ui/singletons/VPNServerLatency.h new file mode 100644 index 0000000000..3ef5b3204f --- /dev/null +++ b/src/ui/singletons/VPNServerLatency.h @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNSERVERLATENCY_H +#define VPNSERVERLATENCY_H + +#include + +#include "mozillavpn.h" +#include "serverlatency.h" + +struct VPNServerLatency { + Q_GADGET + QML_FOREIGN(ServerLatency) + QML_ELEMENT + QML_SINGLETON + + public: + static ServerLatency* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return MozillaVPN::instance()->serverLatency(); + } +}; + +#endif // VPNSERVERLATENCY_H diff --git a/src/ui/singletons/VPNSubscriptionData.h b/src/ui/singletons/VPNSubscriptionData.h new file mode 100644 index 0000000000..8674455349 --- /dev/null +++ b/src/ui/singletons/VPNSubscriptionData.h @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNSUBSCRIPTIONDATA_H +#define VPNSUBSCRIPTIONDATA_H + +#include + +#include "models/subscriptiondata.h" +#include "mozillavpn.h" + +struct VPNSubscriptionData { + Q_GADGET + QML_FOREIGN(SubscriptionData) + QML_ELEMENT + QML_SINGLETON + + public: + static SubscriptionData* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return MozillaVPN::instance()->subscriptionData(); + } +}; + +#endif // VPNSUBSCRIPTIONDATA_H diff --git a/src/ui/singletons/VPNSupportCategoryModel.h b/src/ui/singletons/VPNSupportCategoryModel.h new file mode 100644 index 0000000000..d3658a1cab --- /dev/null +++ b/src/ui/singletons/VPNSupportCategoryModel.h @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNSUPPORTCATEGORYMODEL_H +#define VPNSUPPORTCATEGORYMODEL_H + +#include + +#include "models/supportcategorymodel.h" +#include "mozillavpn.h" + +struct VPNSupportCategoryModel { + Q_GADGET + QML_FOREIGN(SupportCategoryModel) + QML_ELEMENT + QML_SINGLETON + + public: + static SupportCategoryModel* create(QQmlEngine* qmlEngine, + QJSEngine* jsEngine) { + return MozillaVPN::instance()->supportCategoryModel(); + } +}; + +#endif // VPNSUPPORTCATEGORYMODEL_H diff --git a/src/ui/singletons/VPNUser.h b/src/ui/singletons/VPNUser.h new file mode 100644 index 0000000000..37965fdccd --- /dev/null +++ b/src/ui/singletons/VPNUser.h @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef VPNUSER_H +#define VPNUSER_H + +#include + +#include "models/user.h" +#include "mozillavpn.h" + +struct VPNUser { + Q_GADGET + QML_FOREIGN(User) + QML_ELEMENT + QML_SINGLETON + + public: + static User* create(QQmlEngine* qmlEngine, QJSEngine* jsEngine) { + return MozillaVPN::instance()->user(); + } +}; + +#endif // VPNUSER_H diff --git a/src/ui/types/MZAddonMessage.h b/src/ui/types/MZAddonMessage.h new file mode 100644 index 0000000000..8115b84e46 --- /dev/null +++ b/src/ui/types/MZAddonMessage.h @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef MZADDONMESSAGE_H +#define MZADDONMESSAGE_H + +#include + +#include "addons/addonmessage.h" + +class AddonMessage; + +struct MZAddonMessage { + Q_GADGET + QML_FOREIGN(AddonMessage) + QML_ELEMENT + QML_UNCREATABLE("") +}; + +#endif // MZADDONMESSAGE_H diff --git a/tests/auth_tests/CMakeLists.txt b/tests/auth_tests/CMakeLists.txt index d04ddcd1b3..b644364245 100644 --- a/tests/auth_tests/CMakeLists.txt +++ b/tests/auth_tests/CMakeLists.txt @@ -25,6 +25,7 @@ include_directories(${MZ_SOURCE_DIR}/glean) include_directories(${MZ_SOURCE_DIR}/hacl-star) include_directories(${MZ_SOURCE_DIR}/hacl-star/kremlin) include_directories(${MZ_SOURCE_DIR}/hacl-star/kremlin/minimal) +include_directories(${MZ_SOURCE_DIR}/ui/composer) include_directories(${CMAKE_SOURCE_DIR}/tests/auth_tests) qt_add_executable(app_auth_tests EXCLUDE_FROM_ALL MANUAL_FINALIZATION) @@ -75,6 +76,20 @@ target_sources(app_auth_tests PRIVATE testpasswordvalidation.h testsignupandin.cpp testsignupandin.h + ${MZ_SOURCE_DIR}/ui/composer/composer.cpp + ${MZ_SOURCE_DIR}/ui/composer/composer.h + ${MZ_SOURCE_DIR}/ui/composer/composerblock.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblock.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockbutton.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockbutton.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockorderedlist.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockorderedlist.h + ${MZ_SOURCE_DIR}/ui/composer/composerblocktext.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblocktext.h + ${MZ_SOURCE_DIR}/ui/composer/composerblocktitle.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblocktitle.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockunorderedlist.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockunorderedlist.h ) ## Add the tests to be run, one for each test class. diff --git a/tests/dummyvpn/CMakeLists.txt b/tests/dummyvpn/CMakeLists.txt index 741a43f199..d349defd59 100644 --- a/tests/dummyvpn/CMakeLists.txt +++ b/tests/dummyvpn/CMakeLists.txt @@ -24,6 +24,8 @@ endif() target_link_libraries(dummyvpn PRIVATE shared-sources mozillavpn-sources + mozillavpn-ui + mozillavpn-uiplugin lottie nebula translations @@ -69,9 +71,4 @@ ExternalProject_Add(functional_test_addons ) add_dependencies(dummyvpn functional_test_addons) -qt6_add_qml_module(dummyvpn - URI Mozilla.Shared.qmlcomponents - VERSION 1.0 -) - qt_finalize_target(dummyvpn) diff --git a/tests/qml/CMakeLists.txt b/tests/qml/CMakeLists.txt index 4629f921df..f3d2c03a02 100644 --- a/tests/qml/CMakeLists.txt +++ b/tests/qml/CMakeLists.txt @@ -7,11 +7,11 @@ get_filename_component(MZ_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src ABSOLUTE) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${MZ_SOURCE_DIR}) include_directories(${MZ_SOURCE_DIR}/addons) -include_directories(${MZ_SOURCE_DIR}/composer) include_directories(${MZ_SOURCE_DIR}/glean) include_directories(${MZ_SOURCE_DIR}/hacl-star) include_directories(${MZ_SOURCE_DIR}/hacl-star/kremlin) include_directories(${MZ_SOURCE_DIR}/hacl-star/kremlin/minimal) +include_directories(${MZ_SOURCE_DIR}/ui/composer) include_directories(${CMAKE_SOURCE_DIR}/glean) qt_add_executable(qml_tests EXCLUDE_FROM_ALL) @@ -137,20 +137,6 @@ target_sources(qml_tests PRIVATE ${MZ_SOURCE_DIR}/authenticationlistener.h ${MZ_SOURCE_DIR}/collator.cpp ${MZ_SOURCE_DIR}/collator.h - ${MZ_SOURCE_DIR}/composer/composer.cpp - ${MZ_SOURCE_DIR}/composer/composer.h - ${MZ_SOURCE_DIR}/composer/composerblock.cpp - ${MZ_SOURCE_DIR}/composer/composerblock.h - ${MZ_SOURCE_DIR}/composer/composerblockbutton.cpp - ${MZ_SOURCE_DIR}/composer/composerblockbutton.h - ${MZ_SOURCE_DIR}/composer/composerblockorderedlist.cpp - ${MZ_SOURCE_DIR}/composer/composerblockorderedlist.h - ${MZ_SOURCE_DIR}/composer/composerblocktext.cpp - ${MZ_SOURCE_DIR}/composer/composerblocktext.h - ${MZ_SOURCE_DIR}/composer/composerblocktitle.cpp - ${MZ_SOURCE_DIR}/composer/composerblocktitle.h - ${MZ_SOURCE_DIR}/composer/composerblockunorderedlist.cpp - ${MZ_SOURCE_DIR}/composer/composerblockunorderedlist.h ${MZ_SOURCE_DIR}/cryptosettings.cpp ${MZ_SOURCE_DIR}/cryptosettings.h ${MZ_SOURCE_DIR}/curve25519.cpp @@ -161,8 +147,6 @@ target_sources(qml_tests PRIVATE ${MZ_SOURCE_DIR}/errorhandler.h ${MZ_SOURCE_DIR}/feature/feature.cpp ${MZ_SOURCE_DIR}/feature/feature.h - ${MZ_SOURCE_DIR}/filterproxymodel.cpp - ${MZ_SOURCE_DIR}/filterproxymodel.h ${MZ_SOURCE_DIR}/frontend/navigator.cpp ${MZ_SOURCE_DIR}/frontend/navigator.h ${MZ_SOURCE_DIR}/frontend/navigationbarbutton.cpp @@ -261,6 +245,20 @@ target_sources(qml_tests PRIVATE ${MZ_SOURCE_DIR}/temporarydir.h ${MZ_SOURCE_DIR}/theme.cpp ${MZ_SOURCE_DIR}/theme.h + ${MZ_SOURCE_DIR}/ui/composer/composer.cpp + ${MZ_SOURCE_DIR}/ui/composer/composer.h + ${MZ_SOURCE_DIR}/ui/composer/composerblock.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblock.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockbutton.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockbutton.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockorderedlist.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockorderedlist.h + ${MZ_SOURCE_DIR}/ui/composer/composerblocktext.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblocktext.h + ${MZ_SOURCE_DIR}/ui/composer/composerblocktitle.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblocktitle.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockunorderedlist.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockunorderedlist.h ${MZ_SOURCE_DIR}/urlopener.cpp ${MZ_SOURCE_DIR}/urlopener.h ${MZ_SOURCE_DIR}/utils.cpp @@ -301,11 +299,6 @@ foreach(QML_SOURCE ${QML_TEST_SOURCES}) add_test(NAME ${QML_SOURCE} COMMAND qml_tests ${QML_TEST_ARGS} -input ${CMAKE_CURRENT_SOURCE_DIR}/${QML_SOURCE}) endforeach() -qt6_add_qml_module(qml_tests - URI Mozilla.Shared.qmlcomponents - VERSION 1.0 -) - if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") find_package(Qt6 REQUIRED COMPONENTS DBus) target_link_libraries(qml_tests PRIVATE Qt6::DBus) diff --git a/tests/qml/tst_VPNCheckBoxRow.qml b/tests/qml/tst_VPNCheckBoxRow.qml index 94f6f63d0b..835a7662fa 100644 --- a/tests/qml/tst_VPNCheckBoxRow.qml +++ b/tests/qml/tst_VPNCheckBoxRow.qml @@ -6,7 +6,6 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtTest 1.0 -import Mozilla.VPN 1.0 import components 0.1 Item { diff --git a/tests/qml/tst_VPNRadioDelegate.qml b/tests/qml/tst_VPNRadioDelegate.qml index ce5d13fb68..16e3de2b77 100644 --- a/tests/qml/tst_VPNRadioDelegate.qml +++ b/tests/qml/tst_VPNRadioDelegate.qml @@ -6,7 +6,6 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtTest 1.0 -import Mozilla.VPN 1.0 import components 0.1 Item { diff --git a/tests/qml/tst_filterableModel.qml b/tests/qml/tst_filterableModel.qml index 8226c3a585..b9051f7a67 100644 --- a/tests/qml/tst_filterableModel.qml +++ b/tests/qml/tst_filterableModel.qml @@ -5,7 +5,7 @@ import QtQuick 2.3 import QtTest 1.0 -import Mozilla.Shared.qmlcomponents 1.0 +import components 0.1 Item { width: 600 @@ -48,7 +48,7 @@ Item { } TestCase { - name: "MZFilterPRoxyModel" + name: "MZFilterProxyModel" when: windowShown function test_source() { diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index c245208271..d80106cbe3 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -8,11 +8,11 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_BINARY_DIR}/qtglean) include_directories(${MZ_SOURCE_DIR}) include_directories(${MZ_SOURCE_DIR}/addons) -include_directories(${MZ_SOURCE_DIR}/composer) include_directories(${MZ_SOURCE_DIR}/glean) include_directories(${MZ_SOURCE_DIR}/hacl-star) include_directories(${MZ_SOURCE_DIR}/hacl-star/kremlin) include_directories(${MZ_SOURCE_DIR}/hacl-star/kremlin/minimal) +include_directories(${MZ_SOURCE_DIR}/ui/composer) include_directories(${CMAKE_SOURCE_DIR}/tests/unit) qt_add_executable(unit_tests EXCLUDE_FROM_ALL) @@ -184,20 +184,6 @@ target_sources(unit_tests PRIVATE ${MZ_SOURCE_DIR}/authenticationlistener.h ${MZ_SOURCE_DIR}/collator.cpp ${MZ_SOURCE_DIR}/collator.h - ${MZ_SOURCE_DIR}/composer/composer.cpp - ${MZ_SOURCE_DIR}/composer/composer.h - ${MZ_SOURCE_DIR}/composer/composerblock.cpp - ${MZ_SOURCE_DIR}/composer/composerblock.h - ${MZ_SOURCE_DIR}/composer/composerblockbutton.cpp - ${MZ_SOURCE_DIR}/composer/composerblockbutton.h - ${MZ_SOURCE_DIR}/composer/composerblockorderedlist.cpp - ${MZ_SOURCE_DIR}/composer/composerblockorderedlist.h - ${MZ_SOURCE_DIR}/composer/composerblocktext.cpp - ${MZ_SOURCE_DIR}/composer/composerblocktext.h - ${MZ_SOURCE_DIR}/composer/composerblocktitle.cpp - ${MZ_SOURCE_DIR}/composer/composerblocktitle.h - ${MZ_SOURCE_DIR}/composer/composerblockunorderedlist.cpp - ${MZ_SOURCE_DIR}/composer/composerblockunorderedlist.h ${MZ_SOURCE_DIR}/cryptosettings.cpp ${MZ_SOURCE_DIR}/cryptosettings.h ${MZ_SOURCE_DIR}/curve25519.cpp @@ -306,6 +292,20 @@ target_sources(unit_tests PRIVATE ${MZ_SOURCE_DIR}/temporarydir.h ${MZ_SOURCE_DIR}/theme.cpp ${MZ_SOURCE_DIR}/theme.h + ${MZ_SOURCE_DIR}/ui/composer/composer.cpp + ${MZ_SOURCE_DIR}/ui/composer/composer.h + ${MZ_SOURCE_DIR}/ui/composer/composerblock.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblock.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockbutton.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockbutton.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockorderedlist.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockorderedlist.h + ${MZ_SOURCE_DIR}/ui/composer/composerblocktext.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblocktext.h + ${MZ_SOURCE_DIR}/ui/composer/composerblocktitle.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblocktitle.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockunorderedlist.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockunorderedlist.h ${MZ_SOURCE_DIR}/urlopener.cpp ${MZ_SOURCE_DIR}/urlopener.h ${MZ_SOURCE_DIR}/utils.cpp diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt index ed500d44a8..5894101f60 100644 --- a/tests/unit_tests/CMakeLists.txt +++ b/tests/unit_tests/CMakeLists.txt @@ -25,6 +25,7 @@ include_directories(${MZ_SOURCE_DIR}/glean) include_directories(${MZ_SOURCE_DIR}/hacl-star) include_directories(${MZ_SOURCE_DIR}/hacl-star/kremlin) include_directories(${MZ_SOURCE_DIR}/hacl-star/kremlin/minimal) +include_directories(${MZ_SOURCE_DIR}/ui/composer) include_directories(${CMAKE_SOURCE_DIR}/tests/unit_tests) qt_add_executable(app_unit_tests EXCLUDE_FROM_ALL MANUAL_FINALIZATION) @@ -139,6 +140,20 @@ target_sources(app_unit_tests PRIVATE ${MZ_SOURCE_DIR}/tasks/sentry/tasksentry.h ${MZ_SOURCE_DIR}/daemon/daemonaccesscontrol.cpp ${MZ_SOURCE_DIR}/daemon/daemonaccesscontrol.h + ${MZ_SOURCE_DIR}/ui/composer/composer.cpp + ${MZ_SOURCE_DIR}/ui/composer/composer.h + ${MZ_SOURCE_DIR}/ui/composer/composerblock.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblock.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockbutton.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockbutton.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockorderedlist.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockorderedlist.h + ${MZ_SOURCE_DIR}/ui/composer/composerblocktext.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblocktext.h + ${MZ_SOURCE_DIR}/ui/composer/composerblocktitle.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblocktitle.h + ${MZ_SOURCE_DIR}/ui/composer/composerblockunorderedlist.cpp + ${MZ_SOURCE_DIR}/ui/composer/composerblockunorderedlist.h ) if(NOT BUILD_ADJUST_SDK_TOKEN) diff --git a/tests/unit_tests/testcomposer.cpp b/tests/unit_tests/testcomposer.cpp index a242dd1180..4697dcbb9e 100644 --- a/tests/unit_tests/testcomposer.cpp +++ b/tests/unit_tests/testcomposer.cpp @@ -8,12 +8,12 @@ #include "addons/addon.h" #include "addons/addonmessage.h" -#include "composer/composer.h" -#include "composer/composerblockbutton.h" -#include "composer/composerblockorderedlist.h" -#include "composer/composerblocktext.h" -#include "composer/composerblocktitle.h" -#include "composer/composerblockunorderedlist.h" +#include "composer.h" +#include "composerblockbutton.h" +#include "composerblockorderedlist.h" +#include "composerblocktext.h" +#include "composerblocktitle.h" +#include "composerblockunorderedlist.h" #include "helper.h" #include "localizer.h" #include "qmlengineholder.h"