Index: sources/gui/GuiView.cpp =================================================================== diff -u -r8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec -r5687815256ae070a9a207107088e3f72dd464da0 --- sources/gui/GuiView.cpp (.../GuiView.cpp) (revision 8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec) +++ sources/gui/GuiView.cpp (.../GuiView.cpp) (revision 5687815256ae070a9a207107088e3f72dd464da0) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file GuiView.cpp * \author (last) Behrouz NematiPour - * \date (last) 18-Jul-2023 + * \date (last) 10-Jul-2024 * \author (original) Behrouz NematiPour * \date (original) 26-Aug-2020 * @@ -19,6 +19,8 @@ #include "DeviceController.h" #include "FileHandler.h" +#include "qrcodegen.h" + // namespace using namespace Gui; @@ -395,6 +397,9 @@ void GuiView::onPOSTPass(bool vPassed) { +#if BUILD_FOR_DESKTOP // ignore the POST fails on Desktop/VM builds for testing. + vPassed = true; +#endif manufactMode( gEnableManufacturing && vPassed ); updateMode ( gEnableUpdating && vPassed ); postPass(vPassed); @@ -407,3 +412,17 @@ void GuiView::doQuitApplication() { emit didQuitApplication(); } + +/*! + * \brief doGenerateQRImage + * \details should be called with the given vText to update the qrImageSource property for an image source. + * \param vText - the given text for the QR Code + */ +void GuiView::doGenerateQRImage(const QString &vText) +{ + const uint border = 1; + qrcodegen::QrCode qr = qrcodegen::QrCode::encodeText(vText.toLatin1().constData(), qrcodegen::QrCode::Ecc::MEDIUM); + std::string svg = qrcodegen::QrCode::toSvgString(qr, border); + QString svgSource = QString("").fromStdString(svg); + qrImageSource(svgSource); +}