You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

198 lines
6.3 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3. MainWindow::MainWindow(QWidget *parent) :
  4. QMainWindow(parent),
  5. ui(new Ui::MainWindow){
  6. m_bUserRecordsVideo = false;
  7. ui->setupUi(this);
  8. ui->m_pMainVideoWidget->init();
  9. ui->m_pMainVideoWidget->setError( true, "No Source Choisen" );
  10. ui->m_pScrollAreaWidgetContents->setMainMediaViewer( ui->m_pMainVideoWidget );
  11. m_pReportManager = NULL;
  12. //ui->m_pDevScrollAreaWidgetContents->setSelectedDevice(0);
  13. }
  14. MainWindow::~MainWindow(){
  15. delete ui;
  16. }
  17. RangeMapWidget *MainWindow::getRangeMap( void ){
  18. return ui->m_pRangeMap;
  19. }
  20. RadarMapWidget *MainWindow::getRadarMap( void ){
  21. return ui->m_pRangeRadar;
  22. }
  23. GLRadar *MainWindow::getGLRadar( void ){
  24. return ui->m_pGLRadar;
  25. }
  26. void MainWindow::callbackSettings(void){
  27. //if (m_pDeviceSettings == NULL){
  28. // m_pDeviceSettings = new DialogSettingsLGS(this);
  29. // m_pDeviceSettings->attachMasterDevice( m_pMasterDevice );
  30. // m_pDeviceSettings->attachSlaveDevice( m_pSlaveDevice );
  31. //};
  32. //m_pDeviceSettings->updateValues();
  33. //m_pDeviceSettings->show();
  34. }
  35. //void MainWindow::handleScreenShotPress(){
  36. //QString fileName;
  37. //fileName = QFileDialog::getOpenFileName(this, "Open Data", "data/", "Data Files (*.raw *.jpg *.bmp)");
  38. //char fName[MAX_PATH];
  39. //sprintf(fName, "%s", fileName.toStdString().c_str() );
  40. //m_pRangeMap->loadFromFile(fName);
  41. //m_pGLRadar->loadFromFile(fName);
  42. //}
  43. void MainWindow::handleSave3DPicture( void ){
  44. QString fileName;
  45. fileName = QFileDialog::getSaveFileName(this, "Save 3D Picture As", "data/", "Picture Files (*.png)");
  46. QPixmap image = QPixmap::grabWidget(m_pGLRadar);
  47. if(!image.save(fileName, "PNG")){
  48. QMessageBox::warning(this, "Save Image", "Error saving image.");
  49. };
  50. }
  51. void MainWindow::handleAddMask(){
  52. if( m_pRangeMap!= NULL ){
  53. m_pRangeMap->setAddMaskMode();
  54. };
  55. }
  56. void MainWindow::handleDeleteMask(){
  57. if (m_pRangeMap != NULL){
  58. m_pRangeMap->setDeleteMaskMode();
  59. };
  60. }
  61. void MainWindow::handleSilencePress(){
  62. basicEvent *pEvt;
  63. basicCameraCommand *tData;
  64. absCameraMoveParam *tParam;
  65. tData = (basicCameraCommand*) malloc(sizeof(basicCameraCommand));
  66. if (tData != NULL) {
  67. tParam = (absCameraMoveParam*)malloc(sizeof(absCameraMoveParam));
  68. if (tParam != NULL) {
  69. tData->m_cCode = CMD_CAMERA_SET_PTZ;
  70. tData->m_pParam = tParam;
  71. tParam->m_fPan = 180.f;
  72. tParam->m_fTilt = 0.f;
  73. tParam->m_fRange = 1.f;
  74. pEvt = createBasicEvent(0, EVT_CLASS_IMAGE, EVT_COMMAND, "Test Event", tData);
  75. basicEventHeap::getInstance()->broadcast(pEvt);
  76. };
  77. };
  78. }
  79. void MainWindow::handleVideoRecorder(){
  80. basicEvent *pEvt;
  81. basicCameraCommand *tData;
  82. tData = (basicCameraCommand*) malloc(sizeof(basicCameraCommand));
  83. tData->m_pParam = NULL;
  84. if(!m_bUserRecordsVideo){
  85. // Generate Video Event -> Starts Record
  86. tData->m_cCode = CMD_CAMERA_START_RECORD;
  87. pEvt = createBasicEvent( 0, EVT_CLASS_IMAGE, EVT_COMMAND, "User Starts Record Video", tData );
  88. basicEventHeap::getInstance()->broadcast(pEvt);
  89. m_bUserRecordsVideo = true;
  90. m_pButtonCmdVideoRecord->setIcon(QIcon(":pictures/appbar.control.stop.png"));
  91. m_pButtonCmdVideoRecord->setText(QStringLiteral("Stop Record"));
  92. } else {
  93. tData->m_cCode = CMD_CAMERA_STOP_RECORD;
  94. pEvt = createBasicEvent( 0, EVT_CLASS_IMAGE, EVT_COMMAND, "User Stops Record Video", tData );
  95. basicEventHeap::getInstance()->broadcast(pEvt);
  96. m_bUserRecordsVideo = false;
  97. m_pButtonCmdVideoRecord->setIcon(QIcon(":pictures/appbar.cabinet.in.png"));
  98. m_pButtonCmdVideoRecord->setText(QStringLiteral("Start Record"));
  99. };
  100. }
  101. void MainWindow::handleReports(){
  102. //if (m_pReportManager == NULL ){
  103. // m_pReportManager = new guiReportsManagerWindow((QDialog *)this);
  104. //};
  105. //m_pReportManager->showMaximized();
  106. }
  107. void MainWindow::on_m_pButtonCmdClear_clicked()
  108. {
  109. m_pEventsList->clear();
  110. m_pGLRadar->clearTargets();
  111. m_pRangeRadar->clearTargets();
  112. m_pRangeMap->clearTargets();
  113. m_pTitleWidget->setStatus( TSW_ARMING );
  114. }
  115. void MainWindow::on_m_pButton5_clicked(bool checked)
  116. {
  117. if(!checked){
  118. m_pButton5->setChecked(true);
  119. m_pButton6->setChecked(false);
  120. m_pRangeMap->setMinimums();
  121. m_pRangeRadar->setMinimums();
  122. }
  123. }
  124. void MainWindow::on_m_pButton6_clicked(bool checked)
  125. {
  126. if(!checked){
  127. m_pButton5->setChecked(false);
  128. m_pButton6->setChecked(true);
  129. m_pRangeMap->setMaximums();
  130. m_pRangeRadar->setMaximums();
  131. }
  132. }
  133. void MainWindow::on_pushButton_3_clicked()
  134. {
  135. m_pRangeMap->startGenerateWS();
  136. }
  137. void MainWindow::on_pushButton_4_clicked()
  138. {
  139. QString fileName;
  140. fileName = QFileDialog::getSaveFileName(this, tr("Save 2D Map As"), "/", tr("Picture Files (*.png *.jpg *.bmp)"));
  141. if( !fileName.isEmpty() ){
  142. m_pRangeMap->savePicture(fileName);
  143. } else {
  144. };
  145. }
  146. void MainWindow::on_m_pButtonCmdVideoRecord_clicked()
  147. {
  148. basicEvent *pEvt;
  149. basicCameraCommand *tData;
  150. tData = (basicCameraCommand*) malloc(sizeof(basicCameraCommand));
  151. tData->m_pParam = NULL;
  152. if(!m_bUserRecordsVideo){
  153. // Generate Video Event -> Starts Record
  154. tData->m_cCode = CMD_CAMERA_START_RECORD;
  155. pEvt = createBasicEvent( 0, EVT_CLASS_VIDEO, EVT_COMMAND, "User Starts Record Video", tData );
  156. basicEventHeap::getInstance()->broadcast(pEvt);
  157. m_bUserRecordsVideo = true;
  158. ui->m_pButtonCmdVideoRecord->setIcon(QIcon(":pictures/appbar.control.stop.png"));
  159. ui->m_pButtonCmdVideoRecord->setText(QStringLiteral("Stop Record"));
  160. } else {
  161. tData->m_cCode = CMD_CAMERA_STOP_RECORD;
  162. pEvt = createBasicEvent( 0, EVT_CLASS_VIDEO, EVT_COMMAND, "User Stops Record Video", tData );
  163. basicEventHeap::getInstance()->broadcast(pEvt);
  164. m_bUserRecordsVideo = false;
  165. ui->m_pButtonCmdVideoRecord->setIcon(QIcon(":pictures/appbar.cabinet.in.png"));
  166. ui->m_pButtonCmdVideoRecord->setText(QStringLiteral("Start Record"));
  167. };
  168. }
  169. void MainWindow::on_m_pButtonCmdReport_clicked()
  170. {
  171. if(m_pReportManager==NULL){
  172. m_pReportManager = new guiReportsManagerDialog(this);
  173. };
  174. m_pReportManager->show();
  175. }