diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp index 2a676e667..a89082cb2 100644 --- a/companion/src/apppreferencesdialog.cpp +++ b/companion/src/apppreferencesdialog.cpp @@ -460,6 +460,12 @@ void AppPreferencesDialog::on_clearImageButton_clicked() void AppPreferencesDialog::onBaseFirmwareChanged() { populateFirmwareOptions(getBaseFirmware()); + + Firmware *newfw = getFirmwareVariant(); + Profile & profile = g.currentProfile(); + profile.defaultInternalModule(Boards::getDefaultInternalModules(newfw->getBoard())); + ui->defaultInternalModuleCB->setModel(ModuleData::internalModuleItemModel(newfw->getBoard())); + ui->defaultInternalModuleCB->setCurrentIndex(ui->defaultInternalModuleCB->findData(profile.defaultInternalModule())); } Firmware *AppPreferencesDialog::getBaseFirmware() const diff --git a/companion/src/firmwares/moduledata.cpp b/companion/src/firmwares/moduledata.cpp index 167fc83e1..25bb5aec9 100644 --- a/companion/src/firmwares/moduledata.cpp +++ b/companion/src/firmwares/moduledata.cpp @@ -25,7 +25,6 @@ #include "radiodataconversionstate.h" #include "compounditemmodels.h" #include "generalsettings.h" -#include "datahelpers.h" #include #include @@ -359,12 +358,12 @@ QString ModuleData::typeToString(int type) return CHECK_IN_ARRAY(strings, type); } -AbstractStaticItemModel * ModuleData::internalModuleItemModel() +AbstractStaticItemModel * ModuleData::internalModuleItemModel(int board) { AbstractStaticItemModel * mdl = new AbstractStaticItemModel(); mdl->setName("moduledata.internalmodule"); - auto modules = Boards::getSupportedInternalModules(getCurrentBoard()); + auto modules = Boards::getSupportedInternalModules(board == Board::BOARD_UNKNOWN ? getCurrentBoard() : (Board::Type)board); for(auto mod : modules) { mdl->appendToItemList(typeToString(mod), mod); } diff --git a/companion/src/firmwares/moduledata.h b/companion/src/firmwares/moduledata.h index af0ff5a70..b1606f0d5 100644 --- a/companion/src/firmwares/moduledata.h +++ b/companion/src/firmwares/moduledata.h @@ -249,7 +249,7 @@ class ModuleData { static int getTypeFromProtocol(unsigned int protocol); static int getSubTypeFromProtocol(unsigned int protocol); static QString typeToString(int type); - static AbstractStaticItemModel * internalModuleItemModel(); + static AbstractStaticItemModel * internalModuleItemModel(int board = -1); static bool isProtocolAvailable(int moduleidx, unsigned int protocol, GeneralSettings & settings); static AbstractStaticItemModel * protocolItemModel(GeneralSettings & settings); }; diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index 085b1b3fe..dab9309e1 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -1626,9 +1626,11 @@ int MainWindow::newProfile(bool loadProfile) if (i == MAX_PROFILES) //Failed to find free slot return -1; + Firmware *newfw = Firmware::getDefaultVariant(); g.profile[i].init(); - g.profile[i].name(tr("New Radio")); - g.profile[i].fwType(Firmware::getDefaultVariant()->getId()); + g.profile[i].name("New Radio"); + g.profile[i].fwType(newfw->getId()); + g.profile[i].defaultInternalModule(Boards::getDefaultInternalModules(newfw->getBoard())); if (loadProfile) { if (loadProfileId(i))