VideoViewAdapter::VideoViewAdapter()
: d(new VideoViewAdapterPrivate)
{
    d->q = this;
    d->mMediaObject = new Phonon::MediaObject(this);
    d->mMediaObject->setTickInterval(350);
    connect(d->mMediaObject, SIGNAL(finished()), SIGNAL(videoFinished()));

    d->mVideoWidget = new Phonon::VideoWidget;
    d->mVideoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    d->mVideoWidget->setAttribute(Qt::WA_Hover);
    d->mVideoWidget->installEventFilter(this);

    Phonon::createPath(d->mMediaObject, d->mVideoWidget);

    d->mAudioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this);
    Phonon::createPath(d->mMediaObject, d->mAudioOutput);

    QGraphicsProxyWidget* proxy = new DoubleClickableProxyWidget;
    proxy->setFlag(QGraphicsItem::ItemIsSelectable); // Needed for doubleclick to work
    proxy->setWidget(d->mVideoWidget);
    setWidget(proxy);

    d->setupActions();
    d->setupHud(proxy);

    updatePlayUi();
    updateMuteAction();
}
示例#2
0
void BuzzerLive::videoStatusChanged(QMediaPlayer::MediaStatus status) {
    switch (status) {
    case QMediaPlayer::EndOfMedia:
        emit videoFinished();
        layout->setCurrentWidget(dTeamName);
        break;
    default:
        break;
    }
}
ThreadToProcessImages::ThreadToProcessImages(QObject *parent) : QThread(parent)
{
    abortAcquisition = false;
    mCameraManager = new SonyCamManager(this,2);
    connect(mCameraManager, SIGNAL( processedImageReady(QPixmap,int) ),this, SLOT( processedImageIsReady(QPixmap,int) ) );
    connect(mCameraManager, SIGNAL(cvHistIsReady(QVector<double>&,int)),this,SLOT(histWasRecieved(QVector<double>&,int)));
    connect(mCameraManager, SIGNAL(newPearsonCoeficientIsReady(double,int)), this,SLOT(newCoefPearsonCoeficcientWasRecieved(double,int)));
    connect(mCameraManager,SIGNAL( videoAcquiringFinished() ),this, SLOT( videoFinished() ) );
    connect(mCameraManager,SIGNAL( cameraStateChange(int) ),this, SLOT( processCameraStateChanges(int) ) );

}
示例#4
0
BuzzerModule::BuzzerModule() {
    setTitle("Buzzer");
    setControlWidget(new BuzzerControl);
    setLiveWidget(new BuzzerLive);
    BaseControl *control = getControlWidget();
    BaseLive *live = getLiveWidget();

    serial = new QSerialPort();
    teamLocked = false;

    connect(control, SIGNAL(sendTeamWin(QString)), live, SLOT(teamWin(QString)));
    connect(control, SIGNAL(openSerialPort(QString&)), this, SLOT(openSerialPort(QString&)));
    connect(control, SIGNAL(closeSerialPort()), this, SLOT(closeSerialPort()));
    connect(this, SIGNAL(teamWin(int)), control, SLOT(teamWin(int)));
    connect(serial, SIGNAL(readyRead()), this, SLOT(readSerialPort()));
    connect(live, SIGNAL(unlockTeam()), this, SLOT(unlockTeam()));
    connect(control, SIGNAL(setVideo(QString)), live, SLOT(setVideo(QString)));
    connect(control, SIGNAL(setVideoPlaying(bool)), live, SLOT(setVideoPlaying(bool)));
    connect(control, SIGNAL(toggleVideoPlaying()), live, SLOT(toggleVideoPlaying()));
    connect(live, SIGNAL(videoPlaying(bool)), control, SLOT(videoPlaying(bool)));
    connect(live, SIGNAL(videoFinished()), control, SLOT(videoFinished()));
}
示例#5
0
void MainWindow::connectSignals()
{
    connect(controller->captureThread, SIGNAL(videoFinished()), this, SLOT(on_playButton_clicked()));
    connect(ui->videoLabel, SIGNAL(roiSelected(QRect, QPoint)), controller->processingThread, SLOT(setTarget(QRect, QPoint)));
}
示例#6
0
void CaptureThread::run()
{
    while(1)
    {
        // Check if it is paused
        pauseMutex.lock();
        if (paused)
        {
            pauseMutex.unlock();
            sleep(3); // to avoid consuming CPU
            continue;
        }
        pauseMutex.unlock();

        /////////////////////////////////
        // Stop thread if stopped=TRUE //
        /////////////////////////////////
        stoppedMutex.lock();
        if (stopped)
        {
            stopped = false;
            stoppedMutex.unlock();
            break;
        }
        stoppedMutex.unlock();


        // Capture a frame
        capMutex.lock();
            cap >> grabbedFrame;
        capMutex.unlock();
        // resize the frame to fit in the UI frames
        cv::resize(grabbedFrame, grabbedFrame, cv::Size(toResize.width(), toResize.height()));
        // flip the image
        cv::flip(grabbedFrame, grabbedFrame, 1);

        // Create the CImage object
        currentImage = CImage(grabbedFrame.clone());

        // add the frame to the buffer
        inputBuffer->addFrame(currentImage);

        // if the video reached the end just repeat it
        inputMutex.lock();
        if (inputMode == INPUT_VIDEO)
        {
            inputMutex.unlock();
            capMutex.lock();
            if (cap.get(CV_CAP_PROP_FRAME_COUNT)-1 == cap.get(CV_CAP_PROP_POS_FRAMES))
            {
                cap.set(CV_CAP_PROP_POS_FRAMES, 0);
                emit videoFinished();
            }
            capMutex.unlock();
            msleep(1000/cap.get(CV_CAP_PROP_FPS));
        }
        else if (inputMode == INPUT_CAMERA)
        {
            inputMutex.unlock();
            msleep(35);
        }
        inputMutex.unlock();
    }
}
示例#7
0
BuzzerControl::BuzzerControl() {
    QHBoxLayout *layout = new QHBoxLayout();
    QVBoxLayout *settingsLayout = new QVBoxLayout();
    QHBoxLayout *confLayout = new QHBoxLayout();
    QGridLayout *teamLayout = new QGridLayout();

    serialPortList = new QComboBox();
    start = new QPushButton("Connect");
    start->setCheckable(true);
    refresh = new QPushButton("Refresh");
    QPushButton *reset = new QPushButton("Reset");

    connect(refresh, SIGNAL(clicked()), this, SLOT(updateSerialPortList()));
    connect(start, SIGNAL(clicked(bool)), this, SLOT(serialGo(bool)));

    updateSerialPortList();

    confLayout->addWidget(serialPortList);
    confLayout->addWidget(start);
    confLayout->addWidget(refresh);
    confLayout->addWidget(reset);

    QSignalMapper *signalMapper = new QSignalMapper();

    teamLayout->addWidget(new QLabel("Teams:"), 0, 1);
    for (int i = 0; i < MAX_TEAMS; i++) {
        teamName[i] = new QLineEdit();
        QPushButton *triggerButton = new QPushButton("Trigger");

        teamLayout->addWidget(new QLabel(QString::number(i+1)), i+1, 0);
        teamLayout->addWidget(teamName[i], i+1, 1);
        teamLayout->addWidget(triggerButton, i+1, 2);
        connect(triggerButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
        signalMapper->setMapping(triggerButton, i);
    }

    connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(teamWin(int)));

    QWidget *confWidget = new QWidget();
    confWidget->setLayout(confLayout);
    QWidget *teamWidget = new QWidget();
    teamWidget->setLayout(teamLayout);

    settingsLayout->addWidget(confWidget);
    settingsLayout->addWidget(teamWidget);

    QWidget *settingsWidget = new QWidget();
    settingsWidget->setLayout(settingsLayout);

    QDir *videosDir = new QDir("media/buzzer/videos/");
    videosDir->setFilter(QDir::Files);
    videoFiles = videosDir->entryInfoList();

    videoPlaylist = new QListWidget();
    for (int i = 0; i < videoFiles.size(); i++)
        new QListWidgetItem(videoFiles[i].fileName(), videoPlaylist);
    videoPlaylist->setCurrentRow(0);

    QPushButton *startBtn = new QPushButton("Start");
    connect(videoPlaylist, SIGNAL(itemDoubleClicked(QListWidgetItem *)), startBtn, SLOT(animateClick()));
    connect(startBtn, SIGNAL(clicked()), this, SLOT(startNewVideo()));
    pauseBtn = new QPushButton("Pause");
    connect(pauseBtn, SIGNAL(clicked()), this, SIGNAL(toggleVideoPlaying()));
    QPushButton *nextBtn = new QPushButton("Next");
    connect(nextBtn, SIGNAL(clicked()), this, SLOT(videoFinished()));

    QHBoxLayout *controlsLayout = new QHBoxLayout();
    controlsLayout->addWidget(startBtn);
    controlsLayout->addWidget(pauseBtn);
    controlsLayout->addWidget(nextBtn);

    QWidget *controlsWidget = new QWidget();
    controlsWidget->setLayout(controlsLayout);

    QVBoxLayout *playlistLayout = new QVBoxLayout();
    playlistLayout->addWidget(new QLabel("Videos:"));
    playlistLayout->addWidget(videoPlaylist);
    playlistLayout->addWidget(controlsWidget);

    QWidget *playlistWidget = new QWidget();
    playlistWidget->setLayout(playlistLayout);

    layout->addWidget(settingsWidget);
    layout->addWidget(playlistWidget);
    setLayout(layout);
}