bool OsmAnd::MapStyle::areDependenciesResolved() const { if(isStandalone()) return true; return _d->_parent && _d->_parent->areDependenciesResolved(); }
std::shared_ptr<const OsmAnd::ResolvedMapStyle> OsmAnd::MapStylesCollection_P::getResolvedStyleByName(const QString& name) const { QMutexLocker scopedLocker(&_resolvedStylesLock); const auto styleName = getFullyQualifiedStyleName(name); // Check if such style was already resolved auto& resolvedStyle = _resolvedStyles[styleName]; if (resolvedStyle) return resolvedStyle; // Get style inheritance chain QList< std::shared_ptr<UnresolvedMapStyle> > stylesChain; { QReadLocker scopedLocker(&_stylesLock); auto style = getEditableStyleByName_noSync(name); while (style) { stylesChain.push_back(style); // In case this is root-style, do nothing if (style->isStandalone()) break; // Otherwise, obtain next parent const auto parentStyle = getEditableStyleByName_noSync(style->parentName); if (!parentStyle) { LogPrintf(LogSeverityLevel::Error, "Failed to resolve style '%s': parent-in-chain '%s' was not found", qPrintable(name), qPrintable(style->parentName)); return nullptr; } style = parentStyle; } } // From top-most parent to style, load it auto itStyle = iteratorOf(stylesChain); itStyle.toBack(); while (itStyle.hasPrevious()) { const auto& style = itStyle.previous(); if (!style->load()) { LogPrintf(LogSeverityLevel::Error, "Failed to resolve style '%s': parent-in-chain '%s' failed to load", qPrintable(name), qPrintable(style->name)); return nullptr; } } return ResolvedMapStyle::resolveMapStylesChain(copyAs< QList< std::shared_ptr<const UnresolvedMapStyle> > >(stylesChain));; }
void Editor::initGui( void* systemWindow ) { CRect rc = childFrame_->getViewSize(); CCoord middle = rc.width() - 276; CCoord bottom = rc.height() - 55; CRect rcTabView( rc.left+8, rc.top+8, rc.right-8, rc.bottom-8 ); CRect rcTabButtons( -3, 0, 100, 64 ); // size of a TabButton (double height) CRect rcDisplay( 0, 0, rc.right-16, bottom ); // area without tab bar CRect rcProgramView( 0, 0, middle, bottom ); CRect rcCtrlView( middle, 0, rc.right-8, bottom ); CRect rcBankView( 0, 0, rc.right-8, bottom ); CRect rcSystemView( 0, 0, rc.right-16, bottom ); tabView_ = new TabView( rcTabView, rcTabButtons, this ); ctrlView_ = new CtrlView( rcCtrlView, this ); programView_ = new ProgramView( rcProgramView, this, ctrlView_ ); bankView_ = new BankView( rcBankView, this ); CViewContainer* programTab = new CViewContainer( rcDisplay, childFrame_ ); programTab->setAutosizeFlags( kAutosizeAll ); programTab->setTransparency( true ); programTab->addView( programView_->getScrollView() ); programTab->addView( ctrlView_ ); tabView_->addTab( programTab, new TabButton( "Program" )); tabView_->addTab( bankView_, new TabButton( "Bank" ) ); if( isStandalone() ) { systemView_ = new SystemView( rcSystemView, this ); tabView_->addTab( systemView_, new TabButton( "System" ) ); } tabView_->init(); childFrame_->addView( tabView_ ); checkAppState(); setColorScheme(); }