void Geolocation::cancelAllRequests() { auto copy = copyToVector(m_oneShots); cancelRequests(copy); m_watchers.getNotifiersVector(copy); cancelRequests(copy); }
void Geolocation::cancelAllRequests() { GeoNotifierVector copy; copyToVector(m_oneShots, copy); cancelRequests(copy); m_watchers.getNotifiersVector(copy); cancelRequests(copy); }
void MapViewer::initialize() { if (!m_renderer && !m_fetcher) { // Here the TileRenderer is constructed first to target the MapViewer Qwindow // surface, and the TileFetcher is construted to share the same GL context // See the GLWorker constructors for details m_renderer = new TileRenderer(m_config, this); m_fetcher = new TileFetcher(m_config, *m_renderer); // connect the renderer tile request signal to the fetcher tile request slot connect(m_renderer, SIGNAL(requestTile(const TileIndex&)), m_fetcher, SLOT(tileRequest(const TileIndex&))); // connect the tile fetcher response signal to the tile renderer reposnse slot connect(m_fetcher, SIGNAL(responseTile(TileImage*)), m_renderer, SLOT(tileResponse(TileImage*))); // connect the signal to cancel outstanding tile requests to the fetcher slot connect(this, SIGNAL(cancelRequests()), m_fetcher, SIGNAL(cancelRequests())); // connect the renderer delete tile signal to the tile fetcher slot connect(m_renderer, SIGNAL(deleteTile(TileImage*)), m_fetcher, SLOT(deleteTile(TileImage*))); // start the worker threads for these objects m_renderer->start(); m_fetcher->start(); } }
void MapViewer::mouseDoubleClickEvent(QMouseEvent * event) { const QSize& size = m_render_state.mapSize(); m_map_center += (event->pos() - QPoint(size.width() / 2, size.height() / 2)); // Here a left button double click zoom in, a right button zooms out if (event->buttons() & Qt::LeftButton) { // Zoom in m_render_state.setZoom(std::min(m_render_state.zoom() + 1, m_config.max_zoom)); if (m_render_state.zoomedIn()) { // only scale the map center coordinate if we zoomed in m_map_center = QPoint(m_map_center.x() * 2, m_map_center.y() * 2); } } else if (event->buttons() & Qt::RightButton) { // Zoom out m_render_state.setZoom(std::max(m_render_state.zoom() - 1, m_config.min_zoom)); if (m_render_state.zoomedOut()) { // only scale the map center coordinate if we zoomed out m_map_center = QPoint(m_map_center.x() / 2, m_map_center.y() / 2); } } // emit a signal to cancel outstanding tile requests since we are moving to a new // zoom level in the map. This allows the network layer to immediately start // downloading map tiles for the current level. emit cancelRequests(); // A zoom operation changes the map center in pixel coordinates because the // center is defined within the pixel spae of a specific zoom level QRect bounds(m_map_center.x() - size.width() / 2, m_map_center.y() - size.height() / 2, size.width(), size.height()); m_render_state.setBounds(bounds); m_renderer->setState(m_render_state); }
mtpFileLoader::~mtpFileLoader() { if (_localTaskId) { Local::cancelTask(_localTaskId); } removeFromQueue(); cancelRequests(); }
CachedResourceLoader::~CachedResourceLoader() { m_document = 0; cancelRequests(); clearPreloads(); DocumentResourceMap::iterator end = m_documentResources.end(); for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != end; ++it) it->second->setOwningCachedResourceLoader(0); // Make sure no requests still point to this CachedResourceLoader ASSERT(m_requestCount == 0); }
void mtpFileLoader::cancel() { cancelRequests(); type = mtpc_storage_fileUnknown; complete = true; if (fileIsOpen) { file.close(); fileIsOpen = false; file.remove(); } data = QByteArray(); file.setFileName(QString()); emit progress(this); loadNext(); }
void mtpFileLoader::finishFail() { bool started = currentOffset(true) > 0; cancelRequests(); type = mtpc_storage_fileUnknown; complete = true; if (fileIsOpen) { file.close(); fileIsOpen = false; file.remove(); } data = QByteArray(); emit failed(this, started); file.setFileName(fname = QString()); loadNext(); }
void FileLoader::cancel(bool fail) { bool started = currentOffset(true) > 0; cancelRequests(); _type = mtpc_storage_fileUnknown; _complete = true; if (_fileIsOpen) { _file.close(); _fileIsOpen = false; _file.remove(); } _data = QByteArray(); if (fail) { emit failed(this, started); } else { emit progress(this); } _fname = QString(); _file.setFileName(_fname); loadNext(); }
mtpFileLoader::~mtpFileLoader() { cancelRequests(); }