void Content::dispose() { if (_disposed) return; Ref<Content> safe = this; _disposed = true; try { unload(); } catch (Exception& ex) { LOG(0, "*** '%s': disposed but unload failed: %s", getSourceUrl().c_str(), ex.getFullDescription().c_str()); } ContentManager* manager = getManager(); if (manager) manager->onDispose(this); onDispose(); _source = NULL; _proxy = NULL; _linked = false; _loading = false; _loaded = false; if (hasCacheEntry()) getCacheEntry()->discard(); }
void Transfer::showTransCompleteBalloon() { // Show a balloon :P if (KFTPCore::Config::showBalloons() && !KFTPQueue::Manager::self()->isProcessing()) { if (!KFTPCore::Config::showBalloonWhenQueueEmpty() || (KFTPQueue::Manager::self()->topLevelObject()->getChildrenList().count() == 1 && !hasParentTransfer())) { QString transCompleteStr = i18n("Transfer of the following files is complete:"); transCompleteStr += "<br><i>"; transCompleteStr += getSourceUrl().fileName(); transCompleteStr += "</i>"; KFTPWidgets::SystemTray::self()->showMessage(i18n("Information"), transCompleteStr); } } }
void TestWindow::buildSurface(QmlInfo& qmlInfo, bool video) { ++_surfaceCount; auto lifetimeSecs = (uint32_t)(5.0f + (randFloat() * 10.0f)); auto lifetimeUsecs = (USECS_PER_SECOND * lifetimeSecs); qmlInfo.lifetime = lifetimeUsecs + usecTimestampNow(); qmlInfo.texture = 0; qmlInfo.surface.reset(new hifi::qml::OffscreenSurface()); qmlInfo.surface->load(getTestResource(CONTROL_URL), [video](QQmlContext* context, QQuickItem* item) { item->setProperty(URL_PROPERTY, getSourceUrl(video)); }); qmlInfo.surface->setMaxFps(DEFAULT_MAX_FPS); qmlInfo.surface->resize(_qmlSize); qmlInfo.surface->resume(); }
void Content::unload() { if (!_loaded) return; if (_loading) { NIT_THROW_FMT(EX_INVALID_STATE, "'%s': can't unload while loading", getSourceUrl().c_str()); // It would be headache when async process try to dispose.. // TODO: just cancel it or resource manager should treat them by a list } onUnload(); _loaded = false; }
void WebEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params, EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData, EntityPropertyFlags& requestedProperties, EntityPropertyFlags& propertyFlags, EntityPropertyFlags& propertiesDidntFit, int& propertyCount, OctreeElement::AppendState& appendState) const { bool successPropertyFits = true; APPEND_ENTITY_PROPERTY(PROP_COLOR, getColor()); APPEND_ENTITY_PROPERTY(PROP_ALPHA, getAlpha()); withReadLock([&] { _pulseProperties.appendSubclassData(packetData, params, entityTreeElementExtraEncodeData, requestedProperties, propertyFlags, propertiesDidntFit, propertyCount, appendState); }); APPEND_ENTITY_PROPERTY(PROP_BILLBOARD_MODE, (uint32_t)getBillboardMode()); APPEND_ENTITY_PROPERTY(PROP_SOURCE_URL, getSourceUrl()); APPEND_ENTITY_PROPERTY(PROP_DPI, getDPI()); APPEND_ENTITY_PROPERTY(PROP_SCRIPT_URL, getScriptURL()); APPEND_ENTITY_PROPERTY(PROP_MAX_FPS, getMaxFPS()); APPEND_ENTITY_PROPERTY(PROP_INPUT_MODE, (uint32_t)getInputMode()); APPEND_ENTITY_PROPERTY(PROP_SHOW_KEYBOARD_FOCUS_HIGHLIGHT, getShowKeyboardFocusHighlight()); }