Skip to content

Commit

Permalink
chore: Automatically sort registered firmware
Browse files Browse the repository at this point in the history
Thanks @philmoz
  • Loading branch information
pfeerick committed Nov 2, 2023
1 parent a47d454 commit f859eb0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions companion/src/firmwares/eeprominterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,15 @@ class Firmware
currentVariant = value;
}

static void sortRegisteredFirmwares()
{
std::sort(registeredFirmwares.begin(), registeredFirmwares.end(),
[](const Firmware *a, const Firmware *b) {
return QString::compare(a->getName(), b->getName(),
Qt::CaseInsensitive) < 0;
});
}

QString getFlavour();

static Firmware * getFirmwareForFlavour(const QString & flavour)
Expand Down
1 change: 1 addition & 0 deletions companion/src/firmwares/opentx/opentxinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,7 @@ void registerOpenTxFirmwares()
addOpenTxArm9xOptions(firmware);
registerOpenTxFirmware(firmware, true);

Firmware::sortRegisteredFirmwares();
Firmware::setDefaultVariant(Firmware::getFirmwareForFlavour("tx16s"));
Firmware::setCurrentVariant(Firmware::getDefaultVariant());
}
Expand Down

0 comments on commit f859eb0

Please sign in to comment.