[Companion] Radio profile/current firmware handling: (#4737)
* Fix possible confusion/data corruption when deleting radio profile (closes #4734, ref: #4686); * Add Delete Profile action to Radio Profiles menu (closes #4736) (but remove from from app prefs. panel); * Add confirmation prompt before deleting profile; * Open profile settings dialog when creating/copying a profile (closes #4735); * Make sure current (global) firmware flavor is properly updated when changing fw type/options in profile; * Append "-Copy" to name of copied profile; * Factor out Firmware global vars/functions in favor of static members.
This commit is contained in:
committed by
Bertrand Songis
parent
8d0db05e78
commit
36bb951314
@@ -239,7 +239,7 @@ RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSetting
|
||||
{
|
||||
RawSourceRange result;
|
||||
|
||||
Firmware * firmware = getCurrentFirmware();
|
||||
Firmware * firmware = Firmware::getCurrentVariant();
|
||||
int board = firmware->getBoard();
|
||||
bool singleprec = (flags & RANGE_SINGLE_PRECISION);
|
||||
|
||||
@@ -912,7 +912,7 @@ QString CustomFunctionData::funcToString() const
|
||||
void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox * b, unsigned int value = 0)
|
||||
{
|
||||
int val = 0;
|
||||
Firmware * firmware = getCurrentFirmware();
|
||||
Firmware * firmware = Firmware::getCurrentVariant();
|
||||
Board::Type board = firmware->getBoard();
|
||||
|
||||
b->addItem(QObject::tr("Timer1"), val++);
|
||||
@@ -1138,7 +1138,7 @@ GeneralSettings::GeneralSettings()
|
||||
calibSpanPos[i] = 0x180;
|
||||
}
|
||||
|
||||
Firmware * firmware = getCurrentFirmware();
|
||||
Firmware * firmware = Firmware::getCurrentVariant();
|
||||
Board::Type board = firmware->getBoard();
|
||||
|
||||
for (int i=0; i<getBoardCapability(board, Board::FactoryInstalledSwitches); i++) {
|
||||
@@ -1735,10 +1735,6 @@ void unregisterEEpromInterfaces()
|
||||
OpenTxEepromCleanup();
|
||||
}
|
||||
|
||||
QList<Firmware *> firmwares;
|
||||
Firmware * default_firmware_variant;
|
||||
Firmware * current_firmware_variant;
|
||||
|
||||
void ShowEepromErrors(QWidget *parent, const QString &title, const QString &mainMessage, unsigned long errorsFound)
|
||||
{
|
||||
std::bitset<NUM_ERRORS> errors((unsigned long long)errorsFound);
|
||||
@@ -1790,16 +1786,22 @@ void ShowEepromWarnings(QWidget *parent, const QString &title, unsigned long err
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
Firmware * getFirmware(const QString & id)
|
||||
// static
|
||||
QVector<Firmware *> Firmware::registeredFirmwares;
|
||||
Firmware * Firmware::defaultVariant = NULL;
|
||||
Firmware * Firmware::currentVariant = NULL;
|
||||
|
||||
// static
|
||||
Firmware * Firmware::getFirmwareForId(const QString & id)
|
||||
{
|
||||
foreach(Firmware * firmware, firmwares) {
|
||||
foreach(Firmware * firmware, registeredFirmwares) {
|
||||
Firmware * result = firmware->getFirmwareVariant(id);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return default_firmware_variant;
|
||||
return defaultVariant;
|
||||
}
|
||||
|
||||
void Firmware::addOption(const char *option, QString tooltip, uint32_t variant)
|
||||
|
||||
Reference in New Issue
Block a user