Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cpn): Radio Type sorted alphabetically #4273

Merged
merged 3 commits into from
Nov 10, 2023
Merged

Conversation

pfeerick
Copy link
Member

@pfeerick pfeerick commented Nov 2, 2023

Summary of changes:

Firmware is currently added in non-alphabetically order, and thus the Radio Type list in Companion settings is in a seemingly random wacky order... (i.e. the order stuff was added over time). I've manually gone through and changed the order firmware is registered, which puts them in a more rational order...

Before:
image

After:
image

@pfeerick pfeerick added companion Related to the companion software don't merge labels Nov 2, 2023
@elecpower
Copy link
Collaborator

Probably should have the drop down list sorted too so the add sequence doesn't matter. Would you like a commit? Shouldn't take too much effort (famous last words).

@pfeerick
Copy link
Member Author

pfeerick commented Nov 2, 2023

I initially tried that ... something like

boardCB->model()->sort(0, Qt::AscendingOrder);

at around

which works... except it is case sensitive, so stuck iFlight Commando8 at the bottom of the list 🤪 . I opted for avoidance of the problem and to wait for you to wave a finger and say "that's not how you do it" 🤣 As I didn't want to have to start figuring out QStringList::sort() and a temporary list, etc.

And yes, you're always welcome to make corrections / improvements if you so wish ;)

@philmoz
Copy link
Collaborator

philmoz commented Nov 2, 2023

Add to eeprominterface.h, Firmware class:

    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; });
    }

Add to opentxinterface.app, registerOpenTxFirmwares, at the end of the function:

  Firmware::sortRegisteredFirmwares();

@pfeerick pfeerick force-pushed the cpn-sort-radio-type branch from e24e5b9 to f859eb0 Compare November 2, 2023 09:18
@pfeerick pfeerick added this to the 2.10 milestone Nov 2, 2023
@pfeerick pfeerick added the enhancement ✨ New feature or request label Nov 2, 2023
@pfeerick pfeerick changed the title cpn: Radio Type sorted alphabetically feat(cpn): Radio Type sorted alphabetically Nov 2, 2023
@pfeerick pfeerick merged commit 6a4a101 into main Nov 10, 2023
3 checks passed
@pfeerick pfeerick deleted the cpn-sort-radio-type branch November 10, 2023 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
companion Related to the companion software enhancement ✨ New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants