MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / deactivateLicense

Method deactivateLicense

app/src/Misc/CLI.cpp:760–795  ·  view source on GitHub ↗

* @brief Deactivates the stored license instance on this machine and exits. */

Source from the content-addressed store, hash-verified

758 * @brief Deactivates the stored license instance on this machine and exits.
759 */
760int CLI::deactivateLicense(QApplication& app)
761{
762 auto& ls = Licensing::LemonSqueezy::instance();
763
764 if (!ls.isActivated()) {
765 qInfo() << "License is not active on this machine; nothing to deactivate.";
766 return EXIT_SUCCESS;
767 }
768
769 int result = EXIT_FAILURE;
770
771 QTimer timeout;
772 timeout.setSingleShot(true);
773 timeout.setInterval(30'000);
774
775 QObject::connect(&ls, &Licensing::LemonSqueezy::activatedChanged, &app, [&] {
776 result = !ls.isActivated() ? EXIT_SUCCESS : EXIT_FAILURE;
777 if (!ls.isActivated())
778 qInfo() << "License deactivated successfully.";
779 else
780 qCritical() << "License deactivation failed.";
781
782 app.quit();
783 });
784
785 QObject::connect(&timeout, &QTimer::timeout, &app, [&] {
786 qCritical() << "License deactivation timed out.";
787 app.quit();
788 });
789
790 QTimer::singleShot(0, &ls, &Licensing::LemonSqueezy::deactivate);
791 timeout.start();
792
793 app.exec();
794 return result;
795}
796
797//---------------------------------------------------------------------------------------------------
798// Commercial: Modbus helpers

Callers

nothing calls this directly

Calls 3

execMethod · 0.80
isActivatedMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected