C
Localization: Localize Safety-Critical Content
// Copyright (C) 2022 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial // This file is part of the Qt Safe Renderer module #include <QtSafeRenderer/qsafelayout.h> #include <QtSafeRenderer/qsafelayoutresourcereader.h> #include <QtSafeRenderer/statemanager.h> #include <QtSafeRenderer/qsafechecksum.h> #include <QtSafePlatformAdaptation/safewindow.h> #include <QtSafePlatformAdaptation/eventhandler.h> using namespace SafeRenderer; int main(int argc, char **argv) { (void)argc; (void)argv; // Load all the variants. static QSafeLayoutResourceReader en("/layoutData/SafeUI/en/SafeUI_en.srl"); static QSafeLayoutResourceReader fi("/layoutData/SafeUI/fi/SafeUI_fi.srl"); static QSafeLayoutResourceReader de("/layoutData/SafeUI/de/SafeUI_de.srl"); static QSafeLayoutResourceReader uk("/layoutData/SafeUI/uk/SafeUI_uk.srl"); static QSafeLayoutResourceReader el("/layoutData/SafeUI/el/SafeUI_el.srl"); static QSafeLayoutResourceReader ar("/layoutData/SafeUI/ar/SafeUI_ar.srl"); static QSafeLayoutResourceReader da("/layoutData/SafeUI/da/SafeUI_da.srl"); static QSafeLayoutResourceReader et("/layoutData/SafeUI/et/SafeUI_et.srl"); static QSafeLayoutResourceReader no("/layoutData/SafeUI/no/SafeUI_no.srl"); static QSafeLayoutResourceReader sv("/layoutData/SafeUI/sv/SafeUI_sv.srl"); en.setLayoutId(qsafe_hash_string("en")); fi.setLayoutId(qsafe_hash_string("fi")); de.setLayoutId(qsafe_hash_string("de")); uk.setLayoutId(qsafe_hash_string("uk")); el.setLayoutId(qsafe_hash_string("el")); ar.setLayoutId(qsafe_hash_string("ar")); da.setLayoutId(qsafe_hash_string("da")); et.setLayoutId(qsafe_hash_string("et")); no.setLayoutId(qsafe_hash_string("no")); sv.setLayoutId(qsafe_hash_string("sv")); SafeWindow telltaleWindow(en.size(), QSafePoint(0U, 0U)); static SafeRenderer::StateManager stateManager(telltaleWindow, en); stateManager.addLayout(&fi); stateManager.addLayout(&de); stateManager.addLayout(&uk); stateManager.addLayout(&el); stateManager.addLayout(&ar); stateManager.addLayout(&da); stateManager.addLayout(&et); stateManager.addLayout(&no); stateManager.addLayout(&sv); telltaleWindow.requestUpdate(); //Request is required because eventHandler is not running yet. EventHandler msgHandler(stateManager, telltaleWindow); //Switch to finnish layout stateManager.setLayout(&fi); msgHandler.handleEvents(); return 0; }