Ejemplo n.º 1
0
void EventsModel::setFilterSource(DVRServer *server)
{
    if (!server)
        return;

    QMap<DVRServer*,QList<int> > sources;
    sources.insert(server, QList<int>());
    setFilterSources(sources);
}
Ejemplo n.º 2
0
void EventsModel::setFilterSource(DVRCamera *camera)
{
    if (!camera)
        return;

    QMap<DVRServer*,QList<int> > sources;
    sources.insert(camera->data().server(), QList<int>() << camera->data().id());
    setFilterSources(sources);
}
Ejemplo n.º 3
0
EventsWindow::EventsWindow(QWidget *parent)
    : QWidget(parent, Qt::Window)
{
    setWindowTitle(tr("Bluecherry - Event Browser"));
    resize(QSize(900, 600));

    QBoxLayout *layout = new QHBoxLayout(this);
    QBoxLayout *filtersLayout = new QVBoxLayout;
    layout->addLayout(filtersLayout);

    createResultsView();

    /* Filters */
    m_sourcesView = new DVRServersView;
    EventSourcesModel *sourcesModel = new EventSourcesModel(bcApp->serverRepository(), m_sourcesView);

    DVRServersProxyModel *proxyModel = new DVRServersProxyModel(sourcesModel);
    proxyModel->setDynamicSortFilter(true);
    proxyModel->setSourceModel(sourcesModel);
    proxyModel->sort(0);

    m_sourcesView->setModel(proxyModel);
    m_sourcesView->setMaximumWidth(180);
    //m_sourcesView->setMaximumHeight(150);
    filtersLayout->addWidget(m_sourcesView);

    connect(sourcesModel, SIGNAL(checkedSourcesChanged(QMap<DVRServer*,QList<int>>)),
            m_resultsView->eventsModel(), SLOT(setFilterSources(QMap<DVRServer*,QList<int>>)));

    createDateFilter(filtersLayout);

#if 0 /* This is not useful currently. */
    QLabel *label = new QLabel(tr("Minimum Level"));
    label->setStyleSheet(QLatin1String("font-weight:bold;"));
    filtersLayout->addWidget(label);
    filtersLayout->addWidget(createLevelFilter());
#endif

    QLabel *label = new QLabel(tr("Type"));
    label->setStyleSheet(QLatin1String("font-weight:bold;"));
    filtersLayout->addWidget(label);
    filtersLayout->addWidget(createTypeFilter());

#if 0 /* Tags are not fully implemented yet */
    label = new QLabel(tr("Tags"));
    label->setStyleSheet(QLatin1String("font-weight:bold;"));
    filtersLayout->addWidget(label);
    filtersLayout->addWidget(createTags());
    filtersLayout->addWidget(createTagsInput());
#endif

    /* Splitter between results and playback */
    m_videoSplitter = new QSplitter(Qt::Vertical);
    layout->addWidget(m_videoSplitter, 1);

    /* Results */
    m_resultTabs = new QTabWidget;
    m_videoSplitter->addWidget(m_resultTabs);
    m_videoSplitter->setCollapsible(0, false);

    m_resultTabs->addTab(m_resultsView, tr("List"));
    m_resultTabs->addTab(createTimeline(), tr("Timeline"));

    /* Playback */
    m_eventViewer = new EventViewWindow;
    m_eventViewer->layout()->setMargin(0);
    m_eventViewer->hide();
    m_videoSplitter->addWidget(m_eventViewer);

    m_modelEventsCursor = new ModelEventsCursor();
    m_modelEventsCursor->setModel(m_resultsView->model());
    m_eventViewer->setEventsCursor(m_modelEventsCursor);
    connect(m_modelEventsCursor, SIGNAL(indexUpdated()), this, SLOT(cursorIndexUpdated()));

    /* Settings */
    QSettings settings;
    restoreGeometry(settings.value(QLatin1String("ui/events/geometry")).toByteArray());
    m_videoSplitter->restoreState(settings.value(QLatin1String("ui/events/videoSplitter")).toByteArray());
}