feat(cpn): Allow opening of individual model yml files (#1959)
- parse the yaml file and if successful open as a new document in a Models and Settings window - warn the user that no radio conversion has been possible as source radio flavour unknown - populate radio settings with default values based on current radio profile
This commit is contained in:
@@ -1340,6 +1340,11 @@ void MdiChild::newFile(bool createDefaults)
|
||||
|
||||
bool MdiChild::loadFile(const QString & filename, bool resetCurrentFile)
|
||||
{
|
||||
if (getStorageType(filename) == STORAGE_TYPE_YML) {
|
||||
newFile(false);
|
||||
resetCurrentFile = false;
|
||||
}
|
||||
|
||||
Storage storage(filename);
|
||||
if (!storage.load(radioData)) {
|
||||
QMessageBox::critical(this, CPN_STR_TTL_ERROR, storage.error());
|
||||
@@ -1355,6 +1360,10 @@ bool MdiChild::loadFile(const QString & filename, bool resetCurrentFile)
|
||||
setCurrentFile(filename);
|
||||
}
|
||||
|
||||
// set after successful import
|
||||
if (getStorageType(filename) == STORAGE_TYPE_YML)
|
||||
setModified();
|
||||
|
||||
// For etx files this will never be true as any conversion occurs when parsing file
|
||||
if (!Boards::isBoardCompatible(storage.getBoard(), getCurrentBoard())) {
|
||||
if (!convertStorage(storage.getBoard(), getCurrentBoard(), true))
|
||||
|
||||
Reference in New Issue
Block a user