| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/uifactory.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include "uifactory.h"cxx . . $ `<file>/src/core/uifactory.h`/ |
| 5 | |
| 6 | #include "iqmlcomponentfactory.h"cxx . . $ `<file>/src/core/iqmlcomponentfactory.h`/ |
| 7 | #include "isession.h"cxx . . $ `<file>/src/core/isession.h`/ |
| 8 | #include "isysmodel.h"cxx . . $ `<file>/src/core/isysmodel.h`/ |
| 9 | #include "isysmodelui.h"cxx . . $ `<file>/src/core/isysmodelui.h`/ |
| 10 | #include "profilemanagerui.h"cxx . . $ `<file>/src/core/profilemanagerui.h`/ |
| 11 | #include "qmlitem.h"cxx . . $ `<file>/src/core/qmlitem.h`/ |
| 12 | #include "sysmodelqmlitem.h"cxx . . $ `<file>/src/core/sysmodelqmlitem.h`/ |
| 13 | #include "systeminfoui.h"cxx . . $ `<file>/src/core/systeminfoui.h`/ |
| 14 | #include <QObject> |
| 15 | #include <QQmlApplicationEngine> |
| 16 | #include <QQuickItem> |
| 17 | #include <QQuickWindow> |
| 18 | #include <QString> |
| 19 | #include <QUrl> |
| 20 | #include <QtGlobal> |
| 21 | #include <stdexcept> |
| 22 | #include <string> |
| 23 | #include <utility> |
| 24 | |
| 25 | UIFactorycxx . . $ UIFactory#::UIFactorycxx . . $ UIFactory#UIFactory(6f3d50bfccd1323c).( |
| 26 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IQMLComponentFactorycxx . . $ IQMLComponentFactory#> &&qmlComponentfactory) noexcept |
| 27 | : qmlComponentFactory_cxx . . $ UIFactory#qmlComponentFactory_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(qmlComponentfactory)) |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | void UIFactorycxx . . $ UIFactory#::buildcxx . . $ UIFactory#build(a163a717a8fd9951).(QQmlApplicationEnginecxx . . $ QQmlApplicationEngine# &qmlEngine, |
| 32 | ISysModelcxx . . $ ISysModel# const &sysModel, ISessioncxx . . $ ISession# &session) const |
| 33 | { |
| 34 | qmlComponentFactory_cxx . . $ UIFactory#qmlComponentFactory_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).registerQMLTypescxx . . $ IQMLComponentFactory#registerQMLTypes(83f5f38750778ac8).(); |
| 35 | |
| 36 | // Enable native font rendering. |
| 37 | QQuickWindowcxx . . $ QQuickWindow#::setTextRenderTypecxx . . $ QQuickWindow#setTextRenderType(28290e5d061729ad).(QQuickWindowcxx . . $ QQuickWindow#::NativeTextRenderingcxx . . $ QQuickWindow#NativeTextRendering.); |
| 38 | |
| 39 | qmlEngine.loadcxx . . $ QQmlApplicationEngine#load(37355d2f77053a23).(QUrlcxx . . $ QUrl#QUrl(ea1f3831e370f1cb).(QStringLiteralcxx . . $ `<external>/13954984326995544643/qstring.h:1789:9`!("qrc:/qml/main.qml"))); |
| 40 | if (qmlEngine.rootObjectscxx . . $ QQmlApplicationEngine#rootObjects(adb747650fc59aad).().isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) |
| 41 | throw stdcxx . . $ std/::runtime_errorcxx . . $ std/runtime_error#("QML engine failed to load main interface!"); |
| 42 | |
| 43 | auto item = createSysModelQMLItemcxx . . $ UIFactory#createSysModelQMLItem(12da5fd6dc2a015f).(qmlEngine); |
| 44 | if (item != nullptr) { |
| 45 | auto initializer = item->initializercxx . . $ QMLItem#initializer(7a83657deb216afe).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).qmlComponentFactory_cxx . . $ UIFactory#qmlComponentFactory_., qmlEngine); |
| 46 | sysModel.exportWithcxx . . $ Exportable#exportWith(5b5c94ff60635419).(*cxx . . $ std/unique_ptr#`operator*`(2fbe4a4c783c152d).initializer); |
| 47 | |
| 48 | auto profileManagerUI = static_cast<ProfileManagerUIcxx . . $ ProfileManagerUI# *>( |
| 49 | qmlEngine.rootObjectscxx . . $ QQmlApplicationEngine#rootObjects(adb747650fc59aad).().frontcxx . . $ QList#front(19b2b6f17af048b).()->findChildcxx . . $ QObject#findChild(8f4dc8480f36c61a).<QObjectcxx . . $ QObject# *>( |
| 50 | ProfileManagerUIcxx . . $ QAnyStringView#QAnyStringView(80d8335016fb1bdc).::QMLComponentIDcxx . . $ ProfileManagerUI#QMLComponentID..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).())); |
| 51 | profileManagerUI->initcxx . . $ ProfileManagerUI#init(4ab9ddb9f0ca45f2).(&session, dynamic_cast<ISysModelUIcxx . . $ ISysModelUI# *>(item)); |
| 52 | |
| 53 | auto systemInfoUI = static_cast<SystemInfoUIcxx . . $ SystemInfoUI# *>( |
| 54 | qmlEngine.rootObjectscxx . . $ QQmlApplicationEngine#rootObjects(adb747650fc59aad).().frontcxx . . $ QList#front(19b2b6f17af048b).()->findChildcxx . . $ QObject#findChild(8f4dc8480f36c61a).<QObjectcxx . . $ QObject# *>( |
| 55 | SystemInfoUIcxx . . $ QAnyStringView#QAnyStringView(80d8335016fb1bdc).::QMLComponentIDcxx . . $ SystemInfoUI#QMLComponentID..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).())); |
| 56 | systemInfoUI->initcxx . . $ SystemInfoUI#init(5a19f1e4d7dc19f8).(&sysModel); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | QMLItemcxx . . $ QMLItem# *UIFactorycxx . . $ UIFactory#::createSysModelQMLItemcxx . . $ UIFactory#createSysModelQMLItem(12da5fd6dc2a015f).(QQmlApplicationEnginecxx . . $ QQmlApplicationEngine# &qmlEngine) const |
| 61 | { |
| 62 | QStringcxx . . $ QString# parentObjectNamecxx . . $ QString#QString(85c52e162fed56f9).(SysModelQMLItemcxx . . $ SysModelQMLItem#::ParentObjectNamecxx . . $ SysModelQMLItem#ParentObjectName..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).()); |
| 63 | parentObjectName.appendcxx . . $ QString#append(d02845eef0c33901).(QMLItemcxx . . $ QMLItem#::ParentObjectSuffixcxx . . $ QMLItem#ParentObjectSuffix..datacxx . . $ std/basic_string_view#data(8e614c7de0b1573e).()); |
| 64 | |
| 65 | auto itemParent = qmlEngine.rootObjectscxx . . $ QQmlApplicationEngine#rootObjects(adb747650fc59aad).().frontcxx . . $ QList#front(19b2b6f17af048b).()->findChildcxx . . $ QObject#findChild(8f4dc8480f36c61a).<QQuickItemcxx . . $ QQuickItem# *>( |
| 66 | parentObjectNamecxx . . $ QAnyStringView#QAnyStringView(132dd6869045752b).); |
| 67 | |
| 68 | if (itemParent != nullptr) |
| 69 | return qmlComponentFactory_cxx . . $ UIFactory#qmlComponentFactory_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).createQMLItemcxx . . $ IQMLComponentFactory#createQMLItem(308271eb1161825f).(stdcxx . . $ std/::stringcxx . . $ std/string#(ISysModelcxx . . $ ISysModel#::ItemIDcxx . . $ ISysModel#ItemID.), |
| 70 | itemParent, qmlEngine); |
| 71 | |
| 72 | return nullptr; |
| 73 | } |