Пример #1
0
void MoviePlayer::play() {
	if (_vm->getBitFlag(40)) {
		_vm->setBitFlag(42, false);
		startSound();
		return;
	}

	_leftButtonDown = false;
	_rightButtonDown = false;
	_skipMovie = false;

	_vm->_mixer->stopAll();

	_ticks = _vm->_system->getMillis();

	startSound();

	playVideo();
	stopVideo();

	_vm->o_killAnimate();

	if (_vm->getBitFlag(41)) {
		_vm->fillBackFromFront();
	} else {
		uint8 palette[768];
		memset(palette, 0, sizeof(palette));
		_vm->clearSurfaces();
		_vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
	}

	_vm->fillBackGroundFromBack();
	_vm->_fastFadeOutFlag = true;
}
Пример #2
0
QDroneDesktop::QDroneDesktop() {
  setupUi(this);
  
  _dctrl = new DeviceController();

  _pDashboard = new QDroneDashboard(_dctrl, this->wCtrlContainer);
  _pDriveCtrl = new QDriveControl(_dctrl, this->wCtrlContainer);
  _pAnimCtrl = new QAnimationControl(_dctrl, this->wCtrlContainer);

  this->wCtrlContainer->layout()->addWidget(_pDashboard);
  this->wCtrlContainer->layout()->addWidget(_pDriveCtrl);
  this->wCtrlContainer->layout()->addWidget(_pAnimCtrl);
  
  QGridLayout* videoLayout = new QGridLayout();
  videoLayout->setContentsMargins(0, 0, 0, 0);
  videoLayout->setObjectName(QString::fromUtf8("videoLayout"));
  wVideoContainer->setLayout(videoLayout);

  connect(actionConnect, SIGNAL(triggered()), this, SLOT(connectDrone()));
  connect(actionDisonnect, SIGNAL(triggered()), this, SLOT(disconnectDrone()));
  connect(actionStart_Video, SIGNAL(triggered()), this, SLOT(startVideo()));
  connect(actionStop_Video, SIGNAL(triggered()), this, SLOT(stopVideo()));
  connect(actionStart_Updating, SIGNAL(triggered()), _pDashboard, SLOT(startUpdating()));
  connect(actionStop_Updating, SIGNAL(triggered()), _pDashboard, SLOT(stopUpdating()));
}
Пример #3
0
void QDroneDesktop::disconnectDrone() {
  if (_pVideo) {
    stopVideo();
  }
  _dctrl->exitControlLoop();
  _dctrl->disconnect();
}
Пример #4
0
void DataController::startVideoStreaming(bool writeToDisk)
{
    stopVideo();

    if (writeToDisk) {
        QMetaObject::invokeMethod(videoWriter, "beginWriting", Qt::BlockingQueuedConnection);
    }
    if ((cameraController != NULL) && (triggerType == EXTERNAL_CAMERA_TRIGGER)) {
        QMetaObject::invokeMethod(cameraController, "startTriggerSync", Qt::BlockingQueuedConnection);
        for (int i = 0; i < numCameras; i++) {
            QMetaObject::invokeMethod(cameraList.at(i), "StartCameraCaptureSync", Qt::BlockingQueuedConnection);
        }
    }
    else if ((triggerType == NO_CAMERA_TRIGGER) || (cameraController == NULL)) {
        for (int i = 0; i < numCameras; i++) {
            QMetaObject::invokeMethod(cameraList.at(i), "StartCameraCaptureAsync", Qt::BlockingQueuedConnection);
        }
    }

    if (writeToDisk) {
        emit updateSavingMenus(CURRENTLY_WRITING);
    }

    videoIsStreaming = true;

}
Пример #5
0
void DataController::stopVideoWriting()
{
    stopVideo();
    QMetaObject::invokeMethod(videoWriter, "endWriting", Qt::BlockingQueuedConnection);
    startVideoStreaming(false);
    emit updateSavingMenus(NOT_SAVING);

}
Пример #6
0
void 
Video::cleanupOnExit()
{
	if(!stopVideo()) { 
		if(debug) printf("Video::cleanupOnExit() : Failed stopping video properly\n");
	}
	cleanupInterfaces();
}
//----------------------------------------------------------------------------------------------------------------------
void KinectInterface::toggleVideoState(bool _mode)
{
    if(_mode ==true)
    {
        startVideo();
    }
    else
    {
        stopVideo();
    }
}
Пример #8
0
void CameraMainWindow::toggleVideo()
{
    if ( recording )
        stopVideo();
    else
        startVideo();
    recording = !recording;
    camera->video->setText(recording ? tr("Stop") : tr("Video"));
    camera->photo->setEnabled(!recording);
    for (int i=0; i<nthumb; i++)
        thumb[i]->setEnabled(!recording && !thumb[i]->icon().isNull());
}
Пример #9
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->vid = new Video();
    this->vid->init();
    this->img = new ImageFactory(this);
    QObject::connect(ui->buttonStart, SIGNAL(clicked()), this, SLOT(startVideo()));
    QObject::connect(ui->buttonStop, SIGNAL(clicked()), this, SLOT(stopVideo()));    
    QObject::connect(ui->buttonExport, SIGNAL(clicked()), this, SLOT(exportImg()));
    QObject::connect(ui->listImg, SIGNAL(currentTextChanged(QString)), this, SLOT(setFileSelected(QString)));
    QObject::connect(ui->buttonSave, SIGNAL(clicked()), this, SLOT(saveImg()));
}
Пример #10
0
bool QtCamera::createCamera()
{
	if (m_captureThread && m_captureThread->isRunning()) {
		stopVideo();
	}

	if (m_camera) {
		delete m_camera;
		m_camera = NULL;
	}

	m_camera = new WebCam();

	return (m_camera != NULL);
}
Пример #11
0
QtCamera::~QtCamera()
{
	if (m_captureThread) {
		stopVideo();
		delete m_captureThread;
		m_captureThread = NULL;
	}

	if (m_camera) {
		delete m_camera;
		m_camera = NULL;
	}

	clearQueue();
}
Пример #12
0
void SyntroLCamConsole::run()
{
#ifndef WIN32
	if (m_daemonMode)
		runDaemon();
	else
#endif
		runConsole();

    stopVideo();
    stopAudio();

    m_client->exitThread();
    SyntroUtils::syntroAppExit();
	QCoreApplication::exit();
}
Пример #13
0
QtCamera::QtCamera(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);

	m_frameCount = 0;
	m_captureThread = NULL;
	m_frameRateTimer = 0;
	m_frameRefreshTimer = 0;
	m_camera = NULL;

	QWidget *centralWidget = new QWidget(this);
	QVBoxLayout *verticalLayout = new QVBoxLayout(centralWidget);
	verticalLayout->setSpacing(6);
	verticalLayout->setContentsMargins(0, 0, 0, 0);
	m_cameraView = new QLabel(centralWidget);
	
	QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	sizePolicy.setHorizontalStretch(0);
	sizePolicy.setVerticalStretch(0);
	sizePolicy.setHeightForWidth(m_cameraView->sizePolicy().hasHeightForWidth());
	m_cameraView->setSizePolicy(sizePolicy);
	m_cameraView->setMinimumSize(QSize(320, 240));
	m_cameraView->setAlignment(Qt::AlignCenter);

	verticalLayout->addWidget(m_cameraView);

	setCentralWidget(centralWidget);


	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionStart, SIGNAL(triggered()), this, SLOT(startVideo()));
	connect(ui.actionStop, SIGNAL(triggered()), this, SLOT(stopVideo()));
	connect(ui.actionScale, SIGNAL(triggered()), this, SLOT(toggleScaling()));

	m_pStatus = new QLabel(this);
	m_pStatus->setAlignment(Qt::AlignCenter | Qt::AlignLeft);
	m_pStatus->setText("0.0 fps  ");
	ui.statusBar->addPermanentWidget(m_pStatus);

	ui.actionStop->setEnabled(false);
	ui.actionStart->setEnabled(true);
	m_scaling = ui.actionScale->isChecked();
}
Пример #14
0
VideoEditor::VideoEditor(NotesModule::Video* vid ,QWidget *parent) :QWidget(parent), ui(new Ui::VideoEditor), video(vid)
{
    ui->setupUi(this);
    ui->videoPlayer->setMinimumHeight(170);
    ui->volumeSlider->setAudioOutput(ui->videoPlayer->audioOutput());
    ui->volumeSlider->setEnabled(false);
    ui->pushButtonDelete->setEnabled(false);
    if (video){
        ui->lineEditTitle->setText(dynamic_cast<NotesModule::Note*>(video)->getTitle());
        ui->textEditDescription->setText(dynamic_cast<NotesModule::Multimedia*>(video)->getDescription());

    }

    QObject::connect(ui->pushButtonSave,SIGNAL(clicked()),this,SLOT(saveVideo()));
    QObject::connect(ui->lineEditTitle,SIGNAL(textEdited(QString)),this,SLOT(activateSave(QString)));
    QObject::connect(ui->textEditDescription,SIGNAL(textChanged()),this,SLOT(activateSave()));
    QObject::connect(ui->pushButtonBrowse,SIGNAL(clicked()),this,SLOT(getVideoPath()));
    QObject::connect(ui->pushButtonPlay,SIGNAL(clicked()),this,SLOT(playVideo()));
    QObject::connect(ui->pushButtonStop,SIGNAL(clicked()),this,SLOT(stopVideo()));
    QObject::connect(ui->pushButtonPause,SIGNAL(clicked()),this,SLOT(pauseVideo()));
    QObject::connect(ui->pushButtonDelete,SIGNAL(clicked()),this,SLOT(delete_note()));
}
Пример #15
0
TakePicView::TakePicView(int calibType, int numPictures, QWidget *parent) : QDialog(parent)
{

    if (calibType == Enums::controllerEnum::INTRINSIC)
    {
        // create intrinsic calib stuff
        videoLabel = new QLabel(this);
        videoLabel->setMinimumWidth(640);
        videoLabel->setMinimumHeight(480);
        titleLabel = new QLabel("Intrinsic Calibration");
        picProgressLabel = new QLabel("");
        this->incrementSuccesses(1, numPictures);
        messageLabel = new QLabel("Messages: ");
        messages = new QLabel("");
        messages->setStyleSheet("color: red; font-weight: bold;");
        takePicButton = new QPushButton("Take Picture");
        takePicButton->setEnabled(false);
        setButtonStyle(takePicButton, false);
        cancelButton = new QPushButton("Cancel");
        setButtonStyle(cancelButton, true);

        connect(takePicButton, SIGNAL(clicked()), this, SLOT(takePicture()));
        connect(cancelButton, SIGNAL(clicked()), this, SLOT(stopVideo()));
        connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));

        // layout code
        mainLayout = new QBoxLayout(QBoxLayout::TopToBottom);
        mainLayout->addWidget(titleLabel);
        mainLayout->addWidget(videoLabel);
        mainLayout->addWidget(picProgressLabel);
        mainLayout->addWidget(messageLabel);
        mainLayout->addWidget(messages);
        buttonLayout = new QGridLayout();
        buttonLayout->addWidget(takePicButton, 0, 0);
        buttonLayout->addWidget(cancelButton, 1, 0);
        mainLayout->addLayout(buttonLayout);
        setLayout(mainLayout);
    }
    else if (calibType == Enums::controllerEnum::EXTRINSIC)
    {
        // create extrin calib stuff
        videoLabel = new QLabel(this);
        videoLabel->setMinimumWidth(640);
        videoLabel->setMinimumHeight(480);
        titleLabel = new QLabel("Extrinsic Calibration");
        picProgressLabel = new QLabel("");
        this->incrementSuccesses(1, numPictures);
        messageLabel = new QLabel("Messages: ");
        messages = new QLabel("<b>Messages Go Here</b>");
        messages->setStyleSheet("color: red; font-weight: bold;");
        takePicButton = new QPushButton("Take Picture");
        takePicButton->setEnabled(false);
        setButtonStyle(takePicButton, false);
        cancelButton = new QPushButton("Cancel");
        setButtonStyle(cancelButton, true);

        connect(takePicButton, SIGNAL(clicked()), this, SLOT(takePicture()));
        connect(cancelButton, SIGNAL(clicked()), this, SLOT(stopVideo()));
        connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));

        // layout code
        mainLayout = new QBoxLayout(QBoxLayout::TopToBottom);
        mainLayout->addWidget(titleLabel);
        mainLayout->addWidget(videoLabel);
        mainLayout->addWidget(picProgressLabel);
        mainLayout->addWidget(messageLabel);
        mainLayout->addWidget(messages);
        buttonLayout = new QGridLayout();
        buttonLayout->addWidget(takePicButton, 0, 0);
        buttonLayout->addWidget(cancelButton, 1, 0);
        mainLayout->addLayout(buttonLayout);
        setLayout(mainLayout);
    }
    capture.open(0);
    if (capture.isOpened())
    {
        //Disable autofocus by setting focus to current focus only
        //capture.set(CV_CAP_PROP_FOCUS, capture.get(CV_CAP_PROP_FOCUS));
        // if the Video Capture Stream is open, set button and create timer
        takePicButton->setEnabled(true);
        setButtonStyle(takePicButton, true);
        timer = new QTimer(this);
        // slot for displaying video every 20ms
        connect(timer, SIGNAL(timeout()), this, SLOT(displayVideoFrame()));
        timer->start(20);
    }
    else
    {
        videoLabel->setPixmap(QPixmap("noCamera.png"));
        takePicButton->setEnabled(false);
        setButtonStyle(takePicButton, false);
        messages->setStyleSheet("color: red; font-weight: bold;");
        messages->setText("No camera is detected! Please check your connection!");
    }
}
Пример #16
0
int main()
{
    // Objects
    CameraInput *camera = new CameraInput();
    Control *controller = new Control();
    Process *processer = new Process();
    Tracking *tracker = new Tracking();
    Serial_Communication *serial = new Serial_Communication("/dev/ttyUSB0", "/dev/ttyUSB1");
//    Serial_Communication *serial = new Serial_Communication("/dev/ttyUSB0");// #### For testing with only one arduino
    File_Handler *file_Handler = new File_Handler();
    Window_Handler *window_Handler = new Window_Handler();
    Menu *menu = new Menu();


    // Threads
    QThread *t1 = new QThread;
    QThread *t2 = new QThread;
    QThread *t3 = new QThread;
    QThread *t4 = new QThread;
    QThread *t5 = new QThread;

    camera->moveToThread(t1);
    processer->moveToThread(t2);
    tracker->moveToThread(t3);
    serial->moveToThread(t3);
    controller->moveToThread(t4);
    file_Handler->moveToThread(t5);

    // Connect signals to slots. Whenever a signal is emitted in a function, its corresponding (connected) function will run.
    qRegisterMetaType<cv::Mat>("cv::Mat");

    //Signals calling from:
    //Main thread
    QObject::connect(menu, SIGNAL(startRecording(bool)), controller, SLOT(startRecording(bool)));
    QObject::connect(menu, SIGNAL(stopRecording()), controller, SLOT(stopRecording()));
    QObject::connect(menu, SIGNAL(displayMenu(cv::Mat)), window_Handler, SLOT(drawImage(cv::Mat)));
    QObject::connect(menu, SIGNAL(requestDataFromFootController()), serial, SLOT(receiveDataFromFootControllerLoop()));
    QObject::connect(menu, SIGNAL(startHighRep()), controller, SLOT(startDelayMode()));
    QObject::connect(menu, SIGNAL(decreaseDelay()), controller, SLOT(decreaseDelay()));
    QObject::connect(menu, SIGNAL(increaseDelay()), controller, SLOT(increaseDelay()));
    QObject::connect(menu, SIGNAL(modeSwitch()), controller, SLOT(endMode()));
    QObject::connect(menu, SIGNAL(startPlayback()), file_Handler, SLOT(readFromFile()));
    QObject::connect(menu, SIGNAL(stopPlayback()), file_Handler, SLOT(stopVideo()));
    QObject::connect(menu, SIGNAL(toggleSlowMotion()), file_Handler, SLOT(toggleSlowMotion()));
    QObject::connect(menu, SIGNAL(toggleTracking()), controller, SLOT(toggleTracking()));

    //Thread 1
    QObject::connect(t1, SIGNAL(started()), camera, SLOT(captureImage()));
    QObject::connect(camera, SIGNAL(capturedImage(cv::Mat)), controller, SLOT(inputImage(cv::Mat)));

    //Thread 2
    QObject::connect(t2, SIGNAL(started()), controller, SLOT(processerReady()));
    QObject::connect(processer, SIGNAL(posXposY(int,int)), tracker, SLOT(position(int,int)));
    QObject::connect(processer, SIGNAL(readyForWork()), controller, SLOT(processerReady()));

    //Thread 3
    QObject::connect(tracker, SIGNAL(directionAndSpeed(int,int)), serial, SLOT(sendDataToControlUnit(int,int)));
    QObject::connect(serial, SIGNAL(fromFootController(char)), menu, SLOT(giveInput(char)));

    //Thread 4
    QObject::connect(t4, SIGNAL(started()), controller, SLOT(fileHandlerReadyToWrite()));
    QObject::connect(controller, SIGNAL(imageToProcess(cv::Mat)), processer, SLOT(processImage(cv::Mat)));
    QObject::connect(controller, SIGNAL(requestImage()), camera, SLOT(captureImage()));
    QObject::connect(controller, SIGNAL(imageToRecord(cv::Mat)), file_Handler, SLOT(writeImage(cv::Mat)));
//    QObject::connect(controller, SIGNAL(imageToShow(cv::Mat)), window_Handler, SLOT(drawImage(cv::Mat)));
    QObject::connect(processer, SIGNAL(processedImage(cv::Mat)), window_Handler, SLOT(drawImage(cv::Mat)));
    QObject::connect(controller, SIGNAL(stopMotor()), serial, SLOT(stopMotor()));

    //Thread 5
    QObject::connect(file_Handler, SIGNAL(showFrame(cv::Mat)), window_Handler, SLOT(drawImage(cv::Mat)));
    QObject::connect(file_Handler, SIGNAL(readyToWrite()), controller, SLOT(fileHandlerReadyToWrite()));
    QObject::connect(file_Handler, SIGNAL(timeout()), file_Handler, SLOT(playVideo()));
    QObject::connect(file_Handler, SIGNAL(playbackEnded()), menu, SLOT(returnToLowRep()));

    // Starting Threads
    t1->start();
    t2->start();
    t3->start();
    t4->start();
    t5->start();

//    menu->menu();
    menu->inputHandler();
    return 0;
}