| 114 | #define TRYSILENT(x) \ |
| 115 | try { x; } catch (Suscan::Exception const &) {} |
| 116 | void |
| 117 | AppConfig::deserialize(Suscan::Object const &conf) |
| 118 | { |
| 119 | this->loadDefaults(); |
| 120 | if (!conf.isHollow()) { |
| 121 | TRYSILENT(this->profile = Suscan::Source::Config(conf.getField("source"))); |
| 122 | TRYSILENT(this->analyzerParams.deserialize(conf.getField("analyzerParams"))); |
| 123 | TRYSILENT(this->colors.deserialize(conf.getField("colors"))); |
| 124 | TRYSILENT(this->guiConfig.deserialize(conf.getField("guiConfig"))); |
| 125 | TRYSILENT(this->tleSourceConfig.deserialize(conf.getField("tleSourceConfig"))); |
| 126 | TRYSILENT(this->panSpectrumConfig->deserialize(conf.getField("panoramicSpectrum"))); |
| 127 | |
| 128 | TRYSILENT(this->version = conf.get("version", SIGDIGGER_UICONFIG_DEFAULT_VERSION)); |
| 129 | TRYSILENT(this->width = conf.get("width", this->width)); |
| 130 | TRYSILENT(this->height = conf.get("height", this->height)); |
| 131 | TRYSILENT(this->x = conf.get("x", this->x)); |
| 132 | TRYSILENT(this->y = conf.get("y", this->y)); |
| 133 | TRYSILENT(this->fullScreen = conf.get("fullScreen", this->fullScreen)); |
| 134 | TRYSILENT(this->sidePanelRatio = conf.get("sidePanelRatio", this->sidePanelRatio)); |
| 135 | TRYSILENT(this->disableHighRateWarning = conf.get("disableHighRateWarning", this->disableHighRateWarning)); |
| 136 | TRYSILENT(this->loFreq = conf.get("loFreq", this->loFreq)); |
| 137 | TRYSILENT(this->bandwidth = conf.get("bandwidth", this->bandwidth)); |
| 138 | |
| 139 | try { |
| 140 | Suscan::Object set = conf.getField("bandPlans"); |
| 141 | for (unsigned int i = 0; i < set.length(); ++i) |
| 142 | this->enabledBandPlans.push_back(set[i].value()); |
| 143 | } catch (Suscan::Exception &) { |
| 144 | |
| 145 | } |
| 146 | |
| 147 | try { |
| 148 | this->cachedComponentConfig.copyFrom(conf.getField("Components")); |
| 149 | if (this->cachedComponentConfig.getType() != SUSCAN_OBJECT_TYPE_OBJECT) |
| 150 | this->cachedComponentConfig = Suscan::Object(SUSCAN_OBJECT_TYPE_OBJECT); |
| 151 | } catch (Suscan::Exception const &) { |
| 152 | this->cachedComponentConfig = Suscan::Object(SUSCAN_OBJECT_TYPE_OBJECT); |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | // OH MY GOD HOLY CHRIST |
| 158 | [[ noreturn ]] |