|
|
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ m_bUserRecordsVideo = false; ui->setupUi(this); ui->m_pMainVideoWidget->init(); ui->m_pMainVideoWidget->setError( true, "No Source Choisen" ); ui->m_pScrollAreaWidgetContents->setMainMediaViewer( ui->m_pMainVideoWidget ); m_pReportManager = NULL; //ui->m_pDevScrollAreaWidgetContents->setSelectedDevice(0);
}
MainWindow::~MainWindow(){ delete ui;}
RangeMapWidget *MainWindow::getRangeMap( void ){ return ui->m_pRangeMap;}
RadarMapWidget *MainWindow::getRadarMap( void ){ return ui->m_pRangeRadar;}
GLRadar *MainWindow::getGLRadar( void ){ return ui->m_pGLRadar;}
void MainWindow::callbackSettings(void){ //if (m_pDeviceSettings == NULL){
// m_pDeviceSettings = new DialogSettingsLGS(this);
// m_pDeviceSettings->attachMasterDevice( m_pMasterDevice );
// m_pDeviceSettings->attachSlaveDevice( m_pSlaveDevice );
//};
//m_pDeviceSettings->updateValues();
//m_pDeviceSettings->show();
}
//void MainWindow::handleScreenShotPress(){
//QString fileName;
//fileName = QFileDialog::getOpenFileName(this, "Open Data", "data/", "Data Files (*.raw *.jpg *.bmp)");
//char fName[MAX_PATH];
//sprintf(fName, "%s", fileName.toStdString().c_str() );
//m_pRangeMap->loadFromFile(fName);
//m_pGLRadar->loadFromFile(fName);
//}
void MainWindow::handleSave3DPicture( void ){ QString fileName; fileName = QFileDialog::getSaveFileName(this, "Save 3D Picture As", "data/", "Picture Files (*.png)"); QPixmap image = QPixmap::grabWidget(m_pGLRadar); if(!image.save(fileName, "PNG")){ QMessageBox::warning(this, "Save Image", "Error saving image."); };}
void MainWindow::handleAddMask(){ if( m_pRangeMap!= NULL ){ m_pRangeMap->setAddMaskMode(); };}
void MainWindow::handleDeleteMask(){ if (m_pRangeMap != NULL){ m_pRangeMap->setDeleteMaskMode(); };}
void MainWindow::handleSilencePress(){ basicEvent *pEvt; basicCameraCommand *tData; absCameraMoveParam *tParam; tData = (basicCameraCommand*) malloc(sizeof(basicCameraCommand)); if (tData != NULL) { tParam = (absCameraMoveParam*)malloc(sizeof(absCameraMoveParam)); if (tParam != NULL) { tData->m_cCode = CMD_CAMERA_SET_PTZ; tData->m_pParam = tParam; tParam->m_fPan = 180.f; tParam->m_fTilt = 0.f; tParam->m_fRange = 1.f; pEvt = createBasicEvent(0, EVT_CLASS_IMAGE, EVT_COMMAND, "Test Event", tData); basicEventHeap::getInstance()->broadcast(pEvt); }; };}
void MainWindow::handleVideoRecorder(){ basicEvent *pEvt; basicCameraCommand *tData; tData = (basicCameraCommand*) malloc(sizeof(basicCameraCommand)); tData->m_pParam = NULL; if(!m_bUserRecordsVideo){ // Generate Video Event -> Starts Record
tData->m_cCode = CMD_CAMERA_START_RECORD; pEvt = createBasicEvent( 0, EVT_CLASS_IMAGE, EVT_COMMAND, "User Starts Record Video", tData ); basicEventHeap::getInstance()->broadcast(pEvt); m_bUserRecordsVideo = true; m_pButtonCmdVideoRecord->setIcon(QIcon(":pictures/appbar.control.stop.png")); m_pButtonCmdVideoRecord->setText(QStringLiteral("Stop Record")); } else { tData->m_cCode = CMD_CAMERA_STOP_RECORD; pEvt = createBasicEvent( 0, EVT_CLASS_IMAGE, EVT_COMMAND, "User Stops Record Video", tData ); basicEventHeap::getInstance()->broadcast(pEvt); m_bUserRecordsVideo = false; m_pButtonCmdVideoRecord->setIcon(QIcon(":pictures/appbar.cabinet.in.png")); m_pButtonCmdVideoRecord->setText(QStringLiteral("Start Record")); };}
void MainWindow::handleReports(){ //if (m_pReportManager == NULL ){
// m_pReportManager = new guiReportsManagerWindow((QDialog *)this);
//};
//m_pReportManager->showMaximized();
}
void MainWindow::on_m_pButtonCmdClear_clicked(){ m_pEventsList->clear(); m_pGLRadar->clearTargets(); m_pRangeRadar->clearTargets(); m_pRangeMap->clearTargets(); m_pTitleWidget->setStatus( TSW_ARMING );}
void MainWindow::on_m_pButton5_clicked(bool checked){ if(!checked){ m_pButton5->setChecked(true); m_pButton6->setChecked(false); m_pRangeMap->setMinimums(); m_pRangeRadar->setMinimums(); }}
void MainWindow::on_m_pButton6_clicked(bool checked){ if(!checked){ m_pButton5->setChecked(false); m_pButton6->setChecked(true); m_pRangeMap->setMaximums(); m_pRangeRadar->setMaximums(); }}
void MainWindow::on_pushButton_3_clicked(){ m_pRangeMap->startGenerateWS();}
void MainWindow::on_pushButton_4_clicked(){ QString fileName; fileName = QFileDialog::getSaveFileName(this, tr("Save 2D Map As"), "/", tr("Picture Files (*.png *.jpg *.bmp)")); if( !fileName.isEmpty() ){ m_pRangeMap->savePicture(fileName); } else {
};}
void MainWindow::on_m_pButtonCmdVideoRecord_clicked(){ basicEvent *pEvt; basicCameraCommand *tData; tData = (basicCameraCommand*) malloc(sizeof(basicCameraCommand)); tData->m_pParam = NULL; if(!m_bUserRecordsVideo){ // Generate Video Event -> Starts Record
tData->m_cCode = CMD_CAMERA_START_RECORD; pEvt = createBasicEvent( 0, EVT_CLASS_VIDEO, EVT_COMMAND, "User Starts Record Video", tData ); basicEventHeap::getInstance()->broadcast(pEvt); m_bUserRecordsVideo = true; ui->m_pButtonCmdVideoRecord->setIcon(QIcon(":pictures/appbar.control.stop.png")); ui->m_pButtonCmdVideoRecord->setText(QStringLiteral("Stop Record")); } else { tData->m_cCode = CMD_CAMERA_STOP_RECORD; pEvt = createBasicEvent( 0, EVT_CLASS_VIDEO, EVT_COMMAND, "User Stops Record Video", tData ); basicEventHeap::getInstance()->broadcast(pEvt); m_bUserRecordsVideo = false; ui->m_pButtonCmdVideoRecord->setIcon(QIcon(":pictures/appbar.cabinet.in.png")); ui->m_pButtonCmdVideoRecord->setText(QStringLiteral("Start Record")); };}
void MainWindow::on_m_pButtonCmdReport_clicked(){ if(m_pReportManager==NULL){ m_pReportManager = new guiReportsManagerDialog(this); }; m_pReportManager->show();}
|