/** * Retrace one call. * * Take snapshots before/after retracing (as appropriate) and dispatch it to * the respective handler. */ static void retraceCall(trace::Call *call) { bool swapRenderTarget = call->flags & trace::CALL_FLAG_SWAP_RENDERTARGET; bool doSnapshot = snapshotFrequency.contains(*call); // For calls which cause rendertargets to be swaped, we take the // snapshot _before_ swapping the rendertargets. if (doSnapshot && swapRenderTarget) { if (call->flags & trace::CALL_FLAG_END_FRAME) { // For swapbuffers/presents we still use this // call number, spite not have been executed yet. takeSnapshot(call->no); } else { // Whereas for ordinate fbo/rendertarget changes we // use the previous call's number. takeSnapshot(call->no - 1); } } callNo = call->no; calcStatistics(*call); retracer.retrace(*call); if (doSnapshot && !swapRenderTarget) takeSnapshot(call->no); if (call->no >= dumpStateCallNo && dumper->dumpState(std::cout)) { exit(0); } }
result_t profiler_base::diff(v8::Local<v8::Function> test, v8::Local<v8::Object>& retVal) { obj_ptr<HeapSnapshot_base> s1, s2; takeSnapshot(s1); test->Call(v8::Undefined(Isolate::now()->m_isolate), 0, NULL); takeSnapshot(s2); s2->diff(s1, retVal); deleteAllHeapSnapshots(); return 0; }
void MFileDataStore::fileChanged(const QString &fileName) { Q_D(MFileDataStore); // sync the settings and add the path, for observing // the file even if it was deleted d->settings.sync(); addPathsToWatcher(d->settings.fileName(), d->watcher); if (d->settings.fileName() == fileName && isWritable()) { // Check whether the values for existing keys have changed or // if keys have been deleted foreach(const QString & key, d->settingsSnapshot.keys()) { if ((d->settings.contains(key) && d->settings.value(key) != d->settingsSnapshot.value(key)) || (!d->settings.contains(key))) { emit valueChanged(key, d->settings.value(key)); } } // Check whether new keys have been added foreach(const QString & key, d->settings.allKeys()) { if (!d->settingsSnapshot.contains(key)) { emit valueChanged(key, d->settings.value(key)); } } takeSnapshot(); }
void chip8emu::Chip8Emu::handleEvents() { if(mKeyboard->isKeyDown(SDL_SCANCODE_ESCAPE)) { mRunning = false; } if(mKeyboard->isKeyDown(SDL_SCANCODE_F10)) { if(mFullscreen) { SDL_SetWindowFullscreen(mWindow.get(), 0); } else { SDL_SetWindowFullscreen(mWindow.get(), SDL_WINDOW_FULLSCREEN); } mFullscreen = !mFullscreen; } if(mKeyboard->isKeyPressed(SDLK_F8)) { saveState(); } if(mKeyboard->isKeyPressed(SDLK_F9)) { takeSnapshot(); } mSpeedTrottled = !mKeyboard->isKeyDown(SDL_SCANCODE_SPACE); mKeyboard->update(); }
void MainThread::work() { setMaxHeartbeatInterval( 5.0 ); while ( !isStopping() ) { try { bool dummy; const int TIMEOUT_MS = 1000; int ret = requestStore_.getNext( dummy, TIMEOUT_MS ); if ( ret == 0 ) { takeSnapshot(); // Clear any requests that might have arrived while we were taking the snapshot if ( !requestStore_.isEmpty() ) requestStore_.get( dummy ); } health().ok(); } catch ( ... ) { orcaice::catchMainLoopExceptions( health() ); } } }
static bool takeSnapshots(TextIndicatorData& data, Frame& frame, IntRect snapshotRect) { SnapshotOptions snapshotOptions = snapshotOptionsForTextIndicatorOptions(data.options); data.contentImage = takeSnapshot(frame, snapshotRect, snapshotOptions, data.contentImageScaleFactor); if (!data.contentImage) return false; if (data.options & TextIndicatorOptionIncludeSnapshotWithSelectionHighlight) { float snapshotScaleFactor; data.contentImageWithHighlight = takeSnapshot(frame, snapshotRect, SnapshotOptionsNone, snapshotScaleFactor); ASSERT(!data.contentImageWithHighlight || data.contentImageScaleFactor == snapshotScaleFactor); } return true; }
MFileDataStore::MFileDataStore(const QString &filePath) : d_ptr(new MFileDataStorePrivate(filePath)) { Q_D(MFileDataStore); takeSnapshot(); addPathsToWatcher(filePath, d->watcher); connect(d->watcher.data(), SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString))); connect(d->watcher.data(), SIGNAL(directoryChanged(QString)), this, SLOT(directoryChanged(QString))); }
void MFileDataStore::clear() { Q_D(MFileDataStore); // QSettings has some kind of a cache so we'll prevent any temporary writes // by checking if the data can be actually stored before doing anything if (isWritable()) { d->settings.clear(); d->settings.sync(); takeSnapshot(); } }
void vtkTimerCallbackSnapshot::process(vtkRenderWindowInteractor * iren, vtkActor * actor, vtkRenderer * renderer, int ino) { vtkRenderWindow *win = iren->GetRenderWindow(); //snap std::string snapname = takeSnapshot(win, ino); //save process_image(snapname, renderer, actor, ino); }
void frameComplete(trace::Call &call) { ++frameNo; if (!(call.flags & trace::CALL_FLAG_END_FRAME) && snapshotFrequency.contains(call)) { // This call doesn't have the end of frame flag, so take any snapshot // now. takeSnapshot(call.no); } }
void VBoxSnapshotsWgt::sltRestoreSnapshot(bool fSuppressNonCriticalWarnings /* = false*/) { /* Get currently chosen item: */ SnapshotWgtItem *pItem = mTreeWidget->currentItem() ? static_cast<SnapshotWgtItem*>(mTreeWidget->currentItem()) : 0; AssertReturn(pItem, (void)0); /* Detemine snapshot id: */ QString strSnapshotId = pItem->snapshotId(); AssertReturn(!strSnapshotId.isNull(), (void)0); /* Get currently desired snapshot: */ CSnapshot snapshot = mMachine.FindSnapshot(strSnapshotId); /* Ask the user if he really wants to restore the snapshot: */ int iResultCode = AlertButton_Ok; if (!fSuppressNonCriticalWarnings || mMachine.GetCurrentStateModified()) { iResultCode = msgCenter().confirmSnapshotRestoring(snapshot.GetName(), mMachine.GetCurrentStateModified()); if (iResultCode & AlertButton_Cancel) return; } /* If user also confirmed new snapshot creation: */ if (iResultCode & AlertOption_CheckBox) { /* Take snapshot of changed current state: */ mTreeWidget->setCurrentItem(curStateItem()); if (!takeSnapshot()) return; } /* Open a direct session (this call will handle all errors): */ CSession session = vboxGlobal().openSession(mMachineId); if (session.isNull()) return; /* Restore chosen snapshot: */ CConsole console = session.GetConsole(); CProgress progress = console.RestoreSnapshot(snapshot); if (console.isOk()) { msgCenter().showModalProgressDialog(progress, mMachine.GetName(), ":/progress_snapshot_restore_90px.png"); if (progress.GetResultCode() != 0) msgCenter().cannotRestoreSnapshot(progress, snapshot.GetName(), mMachine.GetName()); } else msgCenter().cannotRestoreSnapshot(console, snapshot.GetName(), mMachine.GetName()); /* Unlock machine finally: */ session.UnlockMachine(); }
PngItem::PngItem(QDeclarativeItem *parent) : QDeclarativeItem(parent) { image = new QImage(width(), height(), QImage::Format_RGB32); image->fill(Qt::green); setFlag(QGraphicsItem::ItemHasNoContents, false); recordTimer.setInterval(1000/30); connect(&recordTimer,SIGNAL(timeout()),this,SLOT(takeSnapshot())); connect(this,SIGNAL(widthChanged()),this,SLOT(widthChangedSlot())); connect(this,SIGNAL(heightChanged()),this,SLOT(heightChangedSlot())); }
void C64::endOfRasterline() { vic->endRasterline(); rasterlineCycle = 1; rasterline++; if (rasterline >= vic->getRasterlinesPerFrame()) { // Last rasterline of frame rasterline = 0; vic->endFrame(); frame++; // Increment time of day clocks every tenth of a second if (frame % (vic->getFramesPerSecond() / 10) == 0) { cia1->incrementTOD(); cia2->incrementTOD(); } // Take a snapshot once in a while if (frame % (vic->getFramesPerSecond() * 4) == 0) { takeSnapshot(); } // Execute remaining SID cycles sid->executeUntil(cycles); /* int diff = sid->resid->writePtr - sid->resid->readPtr; debug(2,"SID readCnt: %8d writeCnt: %8d readPtr: %8d writePtr: %8d diff: %8d volume:%d target:%d\n", sid->resid->readDataCnt, sid->resid->writeDataCnt, sid->resid->readPtr, sid->resid->writePtr, (diff > 0) ? diff : 44100 + diff,sid->resid->volume,sid->resid->targetVolume); sid->resid->readDataCnt = sid->resid->writeDataCnt = 0; */ // Execute the IEC bus iec->execute(); // Count some sheep (zzzzzz) ... if (!getWarp()) synchronizeTiming(); } }
void C64::endOfRasterline() { vic->endRasterline(); rasterlineCycle = 1; rasterline++; if (rasterline >= vic->getRasterlinesPerFrame()) { // Last rasterline of frame rasterline = 0; vic->endFrame(); frame++; // Increment time of day clocks every tenth of a second if (frame % (vic->getFramesPerSecond() / 10) == 0) { cia1->incrementTOD(); cia2->incrementTOD(); } // Take a snapshot once in a while if (frame % (vic->getFramesPerSecond() * 4) == 0) { takeSnapshot(); } // Execute remaining SID cycles // sid->execute(vic->getCyclesPerFrame()); sid->executeUntil(cycles); // Execute the IEC bus iec->execute(); // Count some sheep (zzzzzz) ... if (!getWarp()) synchronizeTiming(); } }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: update(); break; case 1: updateRobotLabel(); break; case 2: showHideConfig((*reinterpret_cast< bool(*)>(_a[1]))); break; case 3: showHideSimulator((*reinterpret_cast< bool(*)>(_a[1]))); break; case 4: changeCurrentRobot(); break; case 5: changeCurrentTeam(); break; case 6: changeBallMass(); break; case 7: changeBallGroundSurface(); break; case 8: changeBallDamping(); break; case 9: changeGravity(); break; case 10: changeTimer(); break; case 11: restartSimulator(); break; case 12: ballMenuTriggered((*reinterpret_cast< QAction*(*)>(_a[1]))); break; case 13: toggleFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break; case 14: setCurrentRobotPosition(); break; case 15: takeSnapshot(); break; case 16: takeSnapshotToClipboard(); break; case 17: customFPS((*reinterpret_cast< int(*)>(_a[1]))); break; case 18: showAbout(); break; case 19: reconnectCommandSocket(); break; case 20: reconnectYellowStatusSocket(); break; case 21: reconnectBlueStatusSocket(); break; case 22: reconnectVisionSocket(); break; case 23: recvActions(); break; default: ; } _id -= 24; } return _id; }
CamView::CamView(QWidget* parent) : QMainWindow(parent) { setupUi(this); readDevices(); QSettings settings; QString dname = settings.value("device", devices.front().shortName).toString(); for (auto& i : devices) { if (i.shortName == dname) { setting.device = &i; break; } } setting.size = settings.value("size", devices.front().formats.front().size).toSize(); setting.fps = settings.value("fps", 30).toInt(); for (auto& i : devices) { devs->addItem(i.name, QVariant::fromValue<CamDevice*>(&i)); if (i.shortName == dname) devs->setCurrentIndex(devs->count()-1); } connect(devs, SIGNAL(activated(int)), SLOT(changeDevice(int))); connect(sizes, SIGNAL(activated(int)), SLOT(changeSize(int))); connect(fps, SIGNAL(activated(int)), SLOT(changeFps(int))); connect(cam, SIGNAL(click(const QString&, int)), statusBar(), SLOT(showMessage(const QString&,int))); connect(picturePath, SIGNAL(textEdited(const QString&)), cam, SLOT(setPicturePath(const QString&))); connect(picturePrefix, SIGNAL(textEdited(const QString&)), cam, SLOT(setPicturePrefix(const QString&))); connect(click, SIGNAL(clicked()), cam, SLOT(takeSnapshot())); setCam(setting); picturePath->setText(cam->picturePath()); picturePrefix->setText(cam->picturePrefix()); cam->start(); }
result_t profiler_base::saveSnapshot(const char* fname) { obj_ptr<HeapSnapshot_base> snapshot; takeSnapshot(snapshot); return snapshot->save(fname, NULL); }
void VBoxSnapshotsWgt::sltTakeSnapshot() { takeSnapshot(); }
void MainWindow::createConnections() { connect(&m_toolBar, SIGNAL(newMolecule()), &m_viewerModel, SLOT(newMoleculeMenu())); connect(&m_toolBar, SIGNAL(open()), this, SLOT(openFile())); connect(&m_toolBar, SIGNAL(save()), &m_viewerModel, SLOT(saveAll())); connect(&m_toolBar, SIGNAL(addHydrogens()), &m_viewerModel, SLOT(addHydrogens())); connect(&m_toolBar, SIGNAL(minimizeEnergy()), &m_viewerModel, SLOT(minimizeEnergy())); connect(&m_toolBar, SIGNAL(deleteSelection()), &m_viewerModel, SLOT(deleteSelection())); connect(&m_toolBar, SIGNAL(takeSnapshot()), &m_viewer, SLOT(saveSnapshot())); connect(&m_toolBar, SIGNAL(record(bool)), this, SLOT(setRecordingActive(bool))); connect(this, SIGNAL(recordingActive(bool)), &m_toolBar, SLOT(setRecordAnimationButtonChecked(bool))); connect(this, SIGNAL(recordingActive(bool)), &m_viewer, SLOT(setRecordingActive(bool))); connect(&m_viewer, SIGNAL(recordingCancelled()), this, SLOT(recordingCancelled())); connect(&m_toolBar, SIGNAL(fullScreen()), this, SLOT(fullScreen())); connect(&m_toolBar, SIGNAL(showHelp()), this, SLOT(showHelp())); connect(&m_toolBar, SIGNAL(viewerModeChanged(Viewer::Mode const)), &m_viewer, SLOT(setActiveViewerMode(Viewer::Mode const))); connect(&m_toolBar, SIGNAL(buildElementSelected(unsigned int)), &m_viewer, SLOT(setDefaultBuildElement(unsigned int))); connect(&m_toolBar, SIGNAL(buildFragmentSelected(QString const&, Viewer::Mode const)), &m_viewer, SLOT(setDefaultBuildFragment(QString const&, Viewer::Mode const))); // ViewerModel connect(&m_viewerModel, SIGNAL(updated()), &m_viewer, SLOT(updateGL())); connect(&m_viewerView, SIGNAL(doubleClicked(QModelIndex const&)), &m_viewerModel, SLOT(itemDoubleClicked(QModelIndex const&))); connect(&m_viewerView, SIGNAL(expanded(QModelIndex const&)), &m_viewerModel, SLOT(itemExpanded(QModelIndex const&))); connect(&m_viewerModel, SIGNAL(sceneRadiusChanged(double const)), &m_viewer, SLOT(setSceneRadius(double const))); connect(&m_viewerModel, SIGNAL(changeActiveViewerMode(Viewer::Mode const)), &m_viewer, SLOT(setActiveViewerMode(Viewer::Mode const))); connect(&m_viewerModel, SIGNAL(displayMessage(QString const&)), &m_viewer, SLOT(displayMessage(QString const&))); connect(&m_viewerModel, SIGNAL(postCommand(QUndoCommand*)), this, SLOT(addCommand(QUndoCommand*))); connect(&m_viewerModel, SIGNAL(foregroundColorChanged(QColor const&)), &m_viewer, SLOT(setForegroundColor(QColor const&))); connect(&(ProcessMonitor::instance()), SIGNAL(resultsAvailable(JobInfo*)), &m_viewerModel, SLOT(openCalculationResults(JobInfo*))); // Viewer connect(&m_viewer, SIGNAL(enableUpdate(bool const)), &m_viewerModel, SLOT(enableUpdate(bool const))); connect(&m_viewerModel, SIGNAL(pushAnimators(AnimatorList const&)), &m_viewer, SLOT(pushAnimators(AnimatorList const&))); connect(&m_viewerModel, SIGNAL(popAnimators(AnimatorList const&)), &m_viewer, SLOT(popAnimators(AnimatorList const&))); connect(&m_viewer, SIGNAL(postCommand(QUndoCommand*)), this, SLOT(addCommand(QUndoCommand*))); connect(&m_viewer, SIGNAL(openFileFromDrop(QString const&)), this, SLOT(openFile(QString const&))); connect(&m_viewer, SIGNAL(activeViewerModeChanged(Viewer::Mode const)), &m_toolBar, SLOT(setToolBarMode(Viewer::Mode const))); connect(&m_viewer, SIGNAL(escapeFullScreen()), this, SLOT(fullScreen())); connect(&m_viewer, SIGNAL(animationStep()), &m_viewerModel, SLOT(reperceiveBondsForAnimation())); // Selection connect(&m_viewerSelectionModel, SIGNAL(selectionChanged(QItemSelection const&, QItemSelection const&)), &m_viewerModel, SLOT(selectionChanged(QItemSelection const&, QItemSelection const&)) ); connect(&m_viewerModel, SIGNAL(selectionChanged(QItemSelection const&, QItemSelectionModel::SelectionFlags)), &m_viewerSelectionModel, SLOT(select(QItemSelection const&, QItemSelectionModel::SelectionFlags)) ); connect(&m_viewerModel, SIGNAL(clearSelection()), &m_viewerSelectionModel, SLOT(clearSelection())); connect(&m_viewer, SIGNAL(clearSelection()), &m_viewerSelectionModel, SLOT(clearSelection())); connect(&m_viewer, SIGNAL(select(QModelIndex const&, QItemSelectionModel::SelectionFlags)), &m_viewerSelectionModel, SLOT(select(QModelIndex const&, QItemSelectionModel::SelectionFlags))); connect(&m_viewerModel, SIGNAL(select(QModelIndex const&, QItemSelectionModel::SelectionFlags)), &m_viewerSelectionModel, SLOT(select(QModelIndex const&, QItemSelectionModel::SelectionFlags))); }
BrushSnapshot::BrushSnapshot(Brush* brush) : m_brush(brush) { takeSnapshot(brush); }
void snap( sf::Font& font ) { sf::RenderWindow window( sf::VideoMode( getScreenSize().x, getScreenSize().y ), "QuickSnap - Snap", sf::Style::None ); window.setFramerateLimit( 30 ); setTransparent( window, 128 ); moveToPos( window, getScreenPos() ); sf::CircleShape circ; circ.setRadius( 4 ); circ.setFillColor( sf::Color::Black ); circ.setOrigin( 4, 4 ); sf::RectangleShape rect; rect.setOutlineColor( sf::Color::Black ); rect.setOutlineThickness( 3 ); rect.setFillColor( sf::Color( 255, 255, 255, 64 ) ); bool didFirstClick = false; bool didFirstRelease = false; bool isRunning = true; while ( isRunning ) { moveToTop( window ); focus( window ); sf::Event event; while ( window.pollEvent( event ) ) { if ( event.type == sf::Event::KeyPressed ) { if ( event.key.code == sf::Keyboard::Return ) { window.close(); takeSnapshot( rect ); isRunning = false; } else if ( event.key.code == sf::Keyboard::Escape ) { isRunning = false; } } else if ( event.type == sf::Event::MouseButtonPressed ) { if ( event.mouseButton.button == sf::Mouse::Left ) { didFirstClick = true; didFirstRelease = false; rect.setPosition( event.mouseButton.x, event.mouseButton.y ); } } else if ( event.type == sf::Event::MouseButtonReleased ) { if ( event.mouseButton.button == sf::Mouse::Left ) { didFirstRelease = true; fixRect( window, rect ); } } } fixCircle( window, circ ); if ( !didFirstRelease ) { fixRect( window, rect ); } window.clear( sf::Color( 255, 255, 255, 64 ) ); if ( didFirstClick ) { window.draw( rect ); } window.draw( circ ); window.display(); } }
connect(_xmltv, SIGNAL(schedule(QString, XmltvProgrammeModel *)), _scheduleTab, SLOT(setEpg(QString, XmltvProgrammeModel *))); connect(_scheduleTab, SIGNAL(requestEpg(QString)), _xmltv, SLOT(request(QString))); connect(_scheduleTab, SIGNAL(itemSelected(QString)), _xmltv, SLOT(requestProgramme(QString))); connect(_xmltv, SIGNAL(programme(XmltvProgramme *)), _showInfoTab, SLOT(display(XmltvProgramme *))); connect(_mediaPlayer->osd(), SIGNAL(openLink(QString)), _xmltv, SLOT(requestProgramme(QString))); connect(_showInfoTab, SIGNAL(requestNext(QString, QString)), _xmltv, SLOT(requestProgrammeNext(QString, QString))); connect(_showInfoTab, SIGNAL(requestPrevious(QString, QString)), _xmltv, SLOT(requestProgrammePrevious(QString, QString))); connect(_playlistTab->playlist(), SIGNAL(scheduleRequested(Channel *)), _scheduleTab, SLOT(channel(Channel *))); connect(_mediaPlayer, SIGNAL(stateChanged(Vlc::State)), this, SLOT(setState(Vlc::State))); connect(_mediaPlayer, SIGNAL(vout(int)), this, SLOT(showVideo(int))); connect(_mediaPlayer, SIGNAL(sessionChannel(int)), _playlistTab->playlist(), SLOT(channelSelected(int))); connect(ui->actionRecorder, SIGNAL(triggered(bool)), this, SLOT(showRecorder())); connect(ui->actionRecordNow, SIGNAL(toggled(bool)), this, SLOT(recordNow(bool))); connect(ui->actionSnapshot, SIGNAL(triggered()), _mediaPlayer, SLOT(takeSnapshot())); connect(_showInfoTab, SIGNAL(requestRecord(QString)), _xmltv, SLOT(requestProgrammeRecord(QString))); connect(_scheduleTab, SIGNAL(requestRecord(QString)), _xmltv, SLOT(requestProgrammeRecord(QString))); connect(_xmltv, SIGNAL(programmeRecord(XmltvProgramme *)), this, SLOT(recordProgramme(XmltvProgramme *))); connect(ui->actionRecordQuick, SIGNAL(triggered()), _recorder, SLOT(quickRecord())); connect(ui->actionRecordTimer, SIGNAL(triggered()), _recorder, SLOT(newTimer())); connect(_recorder, SIGNAL(play(Timer *)), this, SLOT(playRecording(Timer *))); connect(_mouseTimer, SIGNAL(timeout()), this, SLOT(toggleMouse())); qDebug() << "Initialised: Event connections"; } void MainWindow::createMenus()