feat(cpn): reorganise and refactor Edit Settings (Profile/Application/Simulator/Update) dialog (#7623)
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
|
||||
//! CPN_SETTINGS_REVISION is used to track settings changes independently of EdgeTX version. It should be reset to zero whenever settings are migrated to new COMPANY or PRODUCT.
|
||||
//! \note !! Increment this value if properties are removed or refactored. It will trigger a conversion/cleanup of any stored settings. \sa AppData::convertSettings()
|
||||
#define CPN_SETTINGS_REVISION 3 // Note: bumped for changes during 3.0 dev
|
||||
#define CPN_SETTINGS_REVISION 4 // Note: bumped for multiple changes during 3.0 dev
|
||||
|
||||
//! CPN_SETTINGS_VERSION is used for settings data version tracking.
|
||||
#define CPN_SETTINGS_VERSION ((VERSION_NUMBER << 8) | CPN_SETTINGS_REVISION)
|
||||
@@ -310,23 +310,6 @@ class CompStoreObj: public QObject
|
||||
class AppData;
|
||||
|
||||
|
||||
//! \brief FwRevision class stores data about downloaded firmware binaries. It uses dynamic key names and does not have any properties.
|
||||
class FwRevision: public CompStoreObj
|
||||
{
|
||||
Q_OBJECT
|
||||
public slots:
|
||||
inline int get(const QString & fwType) const { return m_settings.value(settingsPath() % fwType, 0).toInt(); }
|
||||
inline void set(const QString & fwType, const int fwRevision) const { store(QString("%1").arg(fwRevision), fwType); }
|
||||
inline void remove(const QString & tag) const { clear(tag); }
|
||||
inline void resetAll() override { clear(propertyGroup(), ""); }
|
||||
|
||||
protected:
|
||||
explicit FwRevision() : CompStoreObj() { CompStoreObj::addDynamicPropertyGroup(propertyGroup()); }
|
||||
QString propertyGroup() const override { return QStringLiteral("FwRevisions"); }
|
||||
friend class AppData;
|
||||
};
|
||||
|
||||
|
||||
//! \brief JStickData class stores properties related to each joystick axis (calibration/assignment/direction).
|
||||
class JStickData: public CompStoreObj
|
||||
{
|
||||
@@ -519,28 +502,31 @@ class Profile: public CompStoreObj
|
||||
PROPERTYSTR2(name, "Name")
|
||||
PROPERTYSTR2(splashFile, "SplashFileName")
|
||||
PROPERTYSTR(fwName)
|
||||
PROPERTYSTR(fwType)
|
||||
PROPERTYSTR(fwType) // converted 3.0 split out options and language to own fields
|
||||
PROPERTYSTR(fwOptions) // added 3.0
|
||||
PROPERTYSTR(fwLanguage) // added 3.0
|
||||
PROPERTYSTR(sdPath)
|
||||
PROPERTYSTR(pBackupDir)
|
||||
PROPERTYSTR(modelsDir) // added 3.0
|
||||
|
||||
PROPERTY (int, defaultInternalModule, 0)
|
||||
PROPERTY (int, externalModuleSize, 1) // added 2.9 - Board::EXTMODSIZE_STD used for existing profiles
|
||||
PROPERTY4(int, channelOrder, "default_channel_order", 0)
|
||||
PROPERTY4(int, defaultMode, "default_mode", 1)
|
||||
PROPERTY (int, volumeGain, 10)
|
||||
PROPERTY (int, externalModuleSize, 1) // added 2.9 - Board::EXTMODSIZE_STD used for existing profiles
|
||||
PROPERTY4(int, channelOrder, "default_channel_order", 0)
|
||||
PROPERTY4(int, defaultMode, "default_mode", 1)
|
||||
PROPERTY (int, volumeGain, 10) // divided by 10
|
||||
|
||||
PROPERTY (bool, burnFirmware, false)
|
||||
PROPERTY (bool, penableBackup, false)
|
||||
PROPERTY (bool, runSDSync, false)
|
||||
|
||||
// Simulator variables
|
||||
PROPERTY(SimulatorOptions, simulatorOptions, SimulatorOptions())
|
||||
PROPERTY(bool, telemSimEnabled, false)
|
||||
PROPERTY(bool, telemSimPauseOnHide, true)
|
||||
PROPERTY(bool, telemSimResetRssiOnStop, false)
|
||||
PROPERTY(QColor, radioSimCaseColor, QColor(Qt::black))
|
||||
PROPERTY(bool, simBtnClickedUseOSTheme, true)
|
||||
PROPERTY(QColor, simBtnClickedColor, QColor(Qt::red))
|
||||
PROPERTY(SimulatorOptions, simulatorOptions, SimulatorOptions())
|
||||
PROPERTY(bool, telemSimEnabled, false)
|
||||
PROPERTY(bool, telemSimPauseOnHide, true)
|
||||
PROPERTY(bool, telemSimResetRssiOnStop, false)
|
||||
PROPERTY(QColor, radioSimCaseColor, QColor(Qt::black))
|
||||
PROPERTY(bool, simBtnClickedUseOSTheme, true)
|
||||
PROPERTY(QColor, simBtnClickedColor, QColor(Qt::red))
|
||||
|
||||
// General settings
|
||||
PROPERTYQBA(generalSettings)
|
||||
@@ -672,6 +658,8 @@ class AppData: public CompStoreObj
|
||||
// refer enum QtMsgType
|
||||
static QStringList updateLogLevelsList() { return { tr("Debug"), tr("Warning"), tr("Critical"), tr("Fatal"), tr("Information") } ; }
|
||||
static QStringList simuGenericKeysPosList() { return { tr("Default"), tr("Left"), tr("Right") } ; }
|
||||
static QStringList simuBackLightColorList() { return { tr("Blue"), tr("Green"), tr("Red"), tr("Orange"), tr("Yellow") } ; }
|
||||
static QStringList splashLibsList() { return { tr("Only show user splash images"), tr("Show user and companion splash images") } ; }
|
||||
|
||||
explicit AppData();
|
||||
void init() override;
|
||||
@@ -728,7 +716,6 @@ class AppData: public CompStoreObj
|
||||
JStickData joystick[MAX_JS_AXES];
|
||||
JButtonData jsButton[MAX_JS_BUTTONS];
|
||||
NamedJSData namedJS[MAX_NAMED_JOYSTICKS];
|
||||
FwRevision fwRev;
|
||||
ComponentData component[MAX_COMPONENTS];
|
||||
|
||||
void clearJSData() {
|
||||
@@ -760,6 +747,7 @@ class AppData: public CompStoreObj
|
||||
PROPERTYQBA2(mainWinGeo, "mainWindowGeometry")
|
||||
PROPERTYQBA2(mainWinState, "mainWindowState")
|
||||
PROPERTYQBA2(modelEditGeo, "modelEditGeometry")
|
||||
PROPERTYQBA2(prefsEditGeo, "prefsEditGeometry") // added 3.0
|
||||
PROPERTYQBA (mdiWinGeo)
|
||||
PROPERTYQBA (mdiWinState)
|
||||
PROPERTYQBA (compareWinGeo)
|
||||
@@ -775,6 +763,7 @@ class AppData: public CompStoreObj
|
||||
PROPERTYSTRD(downloadDir, CPN_DOCUMENTS_LOCATION % "/downloads")
|
||||
PROPERTYSTRD(decompressDir, CPN_DOCUMENTS_LOCATION % "/decompress")
|
||||
PROPERTYSTRD(updateDir, CPN_DOCUMENTS_LOCATION % "/updates")
|
||||
PROPERTYSTRD(modelsDir, CPN_DOCUMENTS_LOCATION % "/models") // added 3.0
|
||||
PROPERTY (bool, decompressDirUseDwnld, true)
|
||||
PROPERTY (bool, updateDirUseSD, true)
|
||||
PROPERTY (bool, runAppInstaller, false)
|
||||
@@ -782,6 +771,7 @@ class AppData: public CompStoreObj
|
||||
PROPERTY (bool, updDelDownloads, false)
|
||||
PROPERTY (bool, updDelDecompress, false)
|
||||
PROPERTYSTR (lastUpdateDir)
|
||||
PROPERTY (bool, logVerbose, false)
|
||||
|
||||
PROPERTYSTR (locale)
|
||||
PROPERTYSTR (gePath)
|
||||
|
||||
Reference in New Issue
Block a user