void tst_QQuickAccessible::cleanup() { const EventList list = QTestAccessibility::events(); if (!list.isEmpty()) { qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(), QString(QTest::currentTestFunction()).toLatin1().constData()); for (int i = 0; i < list.count(); ++i) qWarning(" %d: Object: %p Event: '%s' Child: %d", i + 1, list.at(i)->object(), qAccessibleEventString(list.at(i)->type()), list.at(i)->child()); } QTestAccessibility::clearEvents(); }
void EventsWindow::eventContextMenu(const QPoint &pos) { EventsView *view = qobject_cast<EventsView*>(sender()); if (!view) return; EventList selectedEvents = view->selectedEvents(); EventList selectedMediaEvents = selectedEvents.filter(MediaEventFilter()); EventList selectedCameraEvents = selectedEvents.filter(CameraEventFilter()); QMenu menu(view); QAction *aPlay = menu.addAction(tr("Play video")); aPlay->setEnabled(selectedMediaEvents.size() == 1); menu.setDefaultAction(aPlay); QAction *aPlayWindow = menu.addAction(tr("Play in a new window")); aPlayWindow->setEnabled(selectedMediaEvents.size() == 1); menu.addSeparator(); QAction *aSave = menu.addAction(tr("Save video")); aSave->setEnabled(!selectedMediaEvents.isEmpty()); menu.addSeparator(); QAction *aSelectOnly = menu.addAction(tr("Show only this camera")); aSelectOnly->setEnabled(!selectedCameraEvents.isEmpty()); QAction *aSelectElse = menu.addAction(tr("Exclude this camera")); aSelectElse->setEnabled(!selectedCameraEvents.isEmpty()); QAction *act = menu.exec(view->mapToGlobal(pos)); if (!act) return; else if (act == aPlay) showEvent(view->currentIndex()); else if (act == aPlayWindow) { ModelEventsCursor *modelEventsCursor = new ModelEventsCursor(); modelEventsCursor->setModel(view->model()); modelEventsCursor->setCameraFilter(selectedMediaEvents.at(0).locationCamera()); modelEventsCursor->setIndex(view->currentIndex().row()); EventViewWindow::open(selectedMediaEvents.at(0), modelEventsCursor); } else if (act == aSave) { if (selectedMediaEvents.size() == 1) bcApp->eventDownloadManager()->startEventDownload(selectedMediaEvents.at(0)); else bcApp->eventDownloadManager()->startMultipleEventDownloads(selectedMediaEvents); } else if (act == aSelectOnly || act == aSelectElse) { EventSourcesModel *sModel = qobject_cast<EventSourcesModel*>(m_sourcesView->model()); Q_ASSERT(sModel); if (!sModel) return; QSet<DVRCamera *> cameras = selectedCameraEvents.cameras(); QModelIndex sIdx = sModel->indexOfCamera(*cameras.begin()); if (act == aSelectOnly) { m_sourcesView->checkOnlyIndex(sIdx); // uncheck all, some kind of temporary hack foreach (DVRCamera *camera, cameras) sModel->setData(sModel->indexOfCamera(camera), Qt::Checked, Qt::CheckStateRole); } else { foreach (DVRCamera *camera, cameras) sModel->setData(sModel->indexOfCamera(camera), Qt::Unchecked, Qt::CheckStateRole); } } }