From cbb57fe714b633cd5b91850eae9cfd326dee2eeb Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Wed, 29 Dec 2021 00:26:47 +0000 Subject: rbutil: allow checking bootloader installer capabilities Instead of checking for certain hardcoded strings, fetch the actual capability bitmask by instantiating an installer and querying it. Change-Id: I7883d9c1e90da37ee7c0189732ac626685adbfa1 --- utils/rbutilqt/base/bootloaderinstallhelper.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'utils/rbutilqt/base/bootloaderinstallhelper.cpp') diff --git a/utils/rbutilqt/base/bootloaderinstallhelper.cpp b/utils/rbutilqt/base/bootloaderinstallhelper.cpp index c94ed29140..4a1b24883b 100644 --- a/utils/rbutilqt/base/bootloaderinstallhelper.cpp +++ b/utils/rbutilqt/base/bootloaderinstallhelper.cpp @@ -77,6 +77,26 @@ BootloaderInstallBase* BootloaderInstallHelper::createBootloaderInstaller(QObjec } } +BootloaderInstallBase::Capabilities + BootloaderInstallHelper::bootloaderInstallerCapabilities(QObject *parent, QString type) +{ + /* Note - this is a terrible pattern in general, but in this case + * it is a much simpler option to just allocate a class instance. + * This operation is rarely used, anyway. */ + + BootloaderInstallBase* bootloaderInstaller = + createBootloaderInstaller(parent, type); + + BootloaderInstallBase::Capabilities caps = BootloaderInstallBase::Capabilities(); + + if(bootloaderInstaller) { + caps = bootloaderInstaller->capabilities(); + delete bootloaderInstaller; + } + + return caps; +} + //! @brief Return post install hints string. //! @param model model string -- cgit v1.2.3