Set default internal module in profile
This commit is contained in:
committed by
Raphael Coeffic
parent
417c7f1247
commit
2a13dba411
@@ -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
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "radiodataconversionstate.h"
|
||||
#include "compounditemmodels.h"
|
||||
#include "generalsettings.h"
|
||||
#include "datahelpers.h"
|
||||
|
||||
#include <QPair>
|
||||
#include <QVector>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user