void WaveformWidgetFactory::addTimerListener(QWidget* pWidget) { // Do not hold the pointer to of timer listeners since they may be deleted. // We don't activate update() or repaint() directly so listener widgets // can decide whether to paint or not. connect(this, SIGNAL(waveformUpdateTick()), pWidget, SLOT(maybeUpdate()), Qt::DirectConnection); }
void QQuickTrivialWindowManager::show(QQuickWindow *window) { WindowData data; data.updatePending = false; data.grabOnly = false; m_windows[window] = data; maybeUpdate(window); }
void QSGSoftwareRenderLoop::show(QQuickWindow *window) { WindowData data; data.updatePending = false; data.grabOnly = false; m_windows[window] = data; if (m_backingStores[window] == nullptr) { m_backingStores[window] = new QBackingStore(window); } maybeUpdate(window); }
/*! * \returns the tracker-id of the sound file when it is available. */ QString AlertTone::trackerId() { maybeUpdate(); return m_trackerId; }
/*! * \returns The human readable name of the sound file. * * For the sound files under the /home directory this method will return the * sound file title provided by the tracker subsystem by reading the sound file * itself. For files under a different diretory the method will create the nice * name from the filename, because tracker will not provide file information for * these files. In this case the nice name is created from the basename of the * file by removing the file extension and changing underscore ('-') characters * to spaces (' '). */ QString AlertTone::niceName() { maybeUpdate(); return m_niceName; }
void vgRemoveSubmission(char *database, char *submissionSetId) /* vgRemoveSubmission - Remove submissionSet and associated images.. */ { struct sqlConnection *conn = sqlConnect(database); int submitId = atoi(submissionSetId); char *submitName; struct dyString *query = dyStringNew(0); struct slInt *imageList = NULL, *imageProbeList = NULL; int imageFileCount, contributorCount; /* As a sanity check get the name of submission set and print it */ sqlDyStringPrintf(query, "select name from submissionSet where id=%d", submitId); submitName = sqlQuickString(conn, query->string); if (submitName == NULL) errAbort("No submissionSetId %s in %s", submissionSetId, database); verbose(1, "Removing submissionSet named %s\n", submitName); /* Figure out how many submissionContributors we'll delete. */ dyStringClear(query); sqlDyStringPrintf(query, "select count(*) from submissionContributor where submissionSet=%d", submitId); contributorCount = sqlQuickNum(conn, query->string); /* Actually delete submissionContributors. */ dyStringClear(query); sqlDyStringPrintf(query, "delete from submissionContributor where submissionSet=%d", submitId); maybeUpdate(conn, query->string); verbose(1, "Deleted %d submissionContributors\n", contributorCount); /* Get list of images we'll delete. */ dyStringClear(query); sqlDyStringPrintf(query, "select id from image where submissionSet=%d", submitId); imageList = sqlQuickNumList(conn, query->string); /* Get list of imageProbes. */ if (imageList != NULL) { dyStringClear(query); sqlDyStringPrintf(query, "select id from imageProbe where image "); intInClause(query, imageList); imageProbeList = sqlQuickNumList(conn, query->string); } /* Delete expressionLevel's tied to imageProbes. */ if (imageProbeList != NULL) { int oldExpLevel = sqlQuickNum(conn, NOSQLINJ "select count(*) from expressionLevel"); int newExpLevel; dyStringClear(query); sqlDyStringPrintf(query, "delete from expressionLevel where imageProbe "); intInClause(query, imageProbeList); maybeUpdate(conn, query->string); newExpLevel = sqlQuickNum(conn, NOSQLINJ "select count(*) from expressionLevel"); verbose(1, "Deleted %d expressionLevels\n", oldExpLevel - newExpLevel); } /* Delete image probes. */ if (imageProbeList != NULL) { dyStringClear(query); sqlDyStringPrintf(query, "delete from imageProbe where image "); intInClause(query, imageList); maybeUpdate(conn, query->string); } verbose(1, "Deleted %d image probes.\n", slCount(imageProbeList)); /* Delete images. */ dyStringClear(query); sqlDyStringPrintf(query, "delete from image where submissionSet=%d", submitId); maybeUpdate(conn, query->string); verbose(1, "Deleted %d images.\n", slCount(imageList)); /* Delete imageFiles. */ dyStringClear(query); sqlDyStringPrintf(query, "select count(*) from imageFile where submissionSet=%d", submitId); imageFileCount = sqlQuickNum(conn, query->string); dyStringClear(query); sqlDyStringPrintf(query, "delete from imageFile where submissionSet=%d", submitId); maybeUpdate(conn, query->string); verbose(1, "Deleted %d imageFile records.\n", imageFileCount); /* Delete submissionSet record. */ dyStringClear(query); sqlDyStringPrintf(query, "delete from submissionSet where id=%d", submitId); maybeUpdate(conn, query->string); dyStringFree(&query); slFreeList(&imageList); sqlDisconnect(&conn); }
void QSGWindowsRenderLoop::update(QQuickWindow *window) { RLDEBUG("update"); maybeUpdate(window); }
void QQuickTrivialWindowManager::exposureChanged(QQuickWindow *window) { if (window->isExposed()) maybeUpdate(window); }
void QQuickTrivialWindowManager::renderWindow(QQuickWindow *window) { bool renderWithoutShowing = QQuickWindowPrivate::get(window)->renderWithoutShowing; if ((!window->isExposed() && !renderWithoutShowing) || !m_windows.contains(window)) return; WindowData &data = const_cast<WindowData &>(m_windows[window]); QQuickWindow *masterWindow = 0; if (!window->isVisible() && !renderWithoutShowing) { // Find a "proper surface" to bind... for (QHash<QQuickWindow *, WindowData>::const_iterator it = m_windows.constBegin(); it != m_windows.constEnd() && !masterWindow; ++it) { if (it.key()->isVisible()) masterWindow = it.key(); } } else { masterWindow = window; } if (!masterWindow) return; if (!QQuickWindowPrivate::get(masterWindow)->isRenderable()) { qWarning().nospace() << "Unable to find a renderable master window " << masterWindow << "when trying to render" << window << " (" << window->geometry() << ")."; return; } if (!gl) { gl = new QOpenGLContext(); gl->setFormat(masterWindow->requestedFormat()); gl->create(); if (!gl->makeCurrent(masterWindow)) qWarning("QQuickWindow: makeCurrent() failed..."); sg->initialize(gl); } else { gl->makeCurrent(masterWindow); } bool alsoSwap = data.updatePending; data.updatePending = false; QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window); cd->polishItems(); int renderTime = 0, syncTime = 0; QTime renderTimer; if (qquick_render_timing()) renderTimer.start(); cd->syncSceneGraph(); if (qquick_render_timing()) syncTime = renderTimer.elapsed(); cd->renderSceneGraph(window->size()); if (qquick_render_timing()) renderTime = renderTimer.elapsed() - syncTime; if (data.grabOnly) { grabContent = qt_gl_read_framebuffer(window->size(), false, false); data.grabOnly = false; } if (alsoSwap && window->isVisible()) { gl->swapBuffers(window); cd->fireFrameSwapped(); } if (qquick_render_timing()) { static QTime lastFrameTime = QTime::currentTime(); const int swapTime = renderTimer.elapsed() - renderTime - syncTime; qDebug() << "- Breakdown of frame time; sync:" << syncTime << "ms render:" << renderTime << "ms swap:" << swapTime << "ms total:" << swapTime + renderTime + syncTime << "ms time since last frame:" << (lastFrameTime.msecsTo(QTime::currentTime())) << "ms"; lastFrameTime = QTime::currentTime(); } // Might have been set during syncSceneGraph() if (data.updatePending) maybeUpdate(window); }
void getCachedHeapSize(HeapInfo& info) { maybeUpdate(); info = m_info; }
void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose) { QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window); if (!m_windows.contains(window)) return; WindowData &data = const_cast<WindowData &>(m_windows[window]); //If were not in grabOnly mode, dont render a non-renderable window if (!data.grabOnly && !cd->isRenderable()) return; //Resize the backing store if necessary if (m_backingStores[window]->size() != window->size()) { m_backingStores[window]->resize(window->size()); } // ### create QPainter and set up pointer to current window/painter QSGSoftwareRenderContext *ctx = static_cast<QSGSoftwareRenderContext*>(cd->context); ctx->initializeIfNeeded(); bool alsoSwap = data.updatePending; data.updatePending = false; if (!data.grabOnly) { cd->flushFrameSynchronousEvents(); // Event delivery/processing triggered the window to be deleted or stop rendering. if (!m_windows.contains(window)) return; } QElapsedTimer renderTimer; qint64 renderTime = 0, syncTime = 0, polishTime = 0; bool profileFrames = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled(); if (profileFrames) renderTimer.start(); Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame); cd->polishItems(); if (profileFrames) polishTime = renderTimer.nsecsElapsed(); Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame, QQuickProfiler::SceneGraphRenderLoopFrame, QQuickProfiler::SceneGraphPolishPolish); emit window->afterAnimating(); cd->syncSceneGraph(); rc->endSync(); if (profileFrames) syncTime = renderTimer.nsecsElapsed(); Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame, QQuickProfiler::SceneGraphRenderLoopSync); //Tell the renderer about the windows backing store auto softwareRenderer = static_cast<QSGSoftwareRenderer*>(cd->renderer); if (softwareRenderer) softwareRenderer->setBackingStore(m_backingStores[window]); cd->renderSceneGraph(window->size()); if (profileFrames) renderTime = renderTimer.nsecsElapsed(); Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame, QQuickProfiler::SceneGraphRenderLoopRender); if (data.grabOnly) { grabContent = m_backingStores[window]->handle()->toImage(); data.grabOnly = false; } if (alsoSwap && window->isVisible()) { //Flush backingstore to window if (!isNewExpose) m_backingStores[window]->flush(softwareRenderer->flushRegion()); else m_backingStores[window]->flush(QRegion(QRect(QPoint(0,0), window->size()))); cd->fireFrameSwapped(); } qint64 swapTime = 0; if (profileFrames) swapTime = renderTimer.nsecsElapsed(); Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame, QQuickProfiler::SceneGraphRenderLoopSwap); if (QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled()) { static QTime lastFrameTime = QTime::currentTime(); qCDebug(QSG_RASTER_LOG_TIME_RENDERLOOP, "Frame rendered with 'software' renderloop in %dms, polish=%d, sync=%d, render=%d, swap=%d, frameDelta=%d", int(swapTime / 1000000), int(polishTime / 1000000), int((syncTime - polishTime) / 1000000), int((renderTime - syncTime) / 1000000), int((swapTime - renderTime) / 10000000), int(lastFrameTime.msecsTo(QTime::currentTime()))); lastFrameTime = QTime::currentTime(); } // Might have been set during syncSceneGraph() if (data.updatePending) maybeUpdate(window); }