void QDeclarativeGeoMap::setPlugin(QDeclarativeGeoServiceProvider *plugin) { if (m_plugin) { qmlInfo(this) << QStringLiteral("Plugin is a write-once property, and cannot be set again."); return; } m_plugin = plugin; emit pluginChanged(m_plugin); if (m_plugin->isAttached()) { pluginReady(); } else { connect(m_plugin, SIGNAL(attached()), this, SLOT(pluginReady())); } }
/*! \qmlproperty Plugin Place::plugin This property holds the \l Plugin that provided this place which can be used to retrieve more information about the service. */ void QDeclarativePlace::setPlugin(QDeclarativeGeoServiceProvider *plugin) { if (m_plugin == plugin) return; m_plugin = plugin; if (m_complete) emit pluginChanged(); if (m_plugin->isAttached()) { pluginReady(); } else { connect(m_plugin, SIGNAL(attached()), this, SLOT(pluginReady())); } }
/*! \qmlproperty Plugin Category::plugin This property holds the location based service to which the category belongs. */ void QDeclarativeCategory::setPlugin(QDeclarativeGeoServiceProvider *plugin) { if (m_plugin == plugin) return; m_plugin = plugin; if (m_complete) emit pluginChanged(); if (m_icon && m_icon->parent() == this && !m_icon->plugin()) m_icon->setPlugin(m_plugin); if (!m_plugin) return; if (m_plugin->isAttached()) { pluginReady(); } else { connect(m_plugin, SIGNAL(attached()), this, SLOT(pluginReady())); } }
/*! \internal */ void QDeclarativeGeoMap::pluginReady() { serviceProvider_ = plugin_->sharedGeoServiceProvider(); mappingManager_ = serviceProvider_->mappingManager(); if (!mappingManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) { qmlInfo(this) << QStringLiteral("Error: Plugin does not support mapping.\nError message:") << serviceProvider_->errorString(); return; } if (!mappingManager_->isInitialized()) connect(mappingManager_, SIGNAL(initialized()), this, SLOT(mappingManagerInitialized())); else mappingManagerInitialized(); // make sure this is only called once disconnect(this, SLOT(pluginReady())); }
/*! \internal */ void QDeclarativeGeoMap::pluginReady() { serviceProvider_ = plugin_->sharedGeoServiceProvider(); mappingManager_ = serviceProvider_->mappingManager(); if (!mappingManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) { QString msg = QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_MAPPING).arg(serviceProvider_->errorString()); qmlInfo(this) << msg; return; } if (!mappingManager_->isInitialized()) connect(mappingManager_, SIGNAL(initialized()), this, SLOT(mappingManagerInitialized())); else mappingManagerInitialized(); // make sure this is only called once disconnect(this, SLOT(pluginReady())); }
/*! \internal */ void QDeclarativeGeoMap::pluginReady() { m_serviceProvider = m_plugin->sharedGeoServiceProvider(); m_mappingManager = m_serviceProvider->mappingManager(); if (m_serviceProvider->error() != QGeoServiceProvider::NoError) { setError(m_serviceProvider->error(), m_serviceProvider->errorString()); return; } if (!m_mappingManager) { //TODO Should really be EngineNotSetError (see QML GeoCodeModel) setError(QGeoServiceProvider::NotSupportedError, tr("Plugin does not support mapping.")); return; } if (!m_mappingManager->isInitialized()) connect(m_mappingManager, SIGNAL(initialized()), this, SLOT(mappingManagerInitialized())); else mappingManagerInitialized(); // make sure this is only called once disconnect(this, SLOT(pluginReady())); }