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.

158 lines
4.9 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. }
  12. MainWindow::~MainWindow(){
  13. delete ui;
  14. }
  15. void MainWindow::callbackSettings(void){
  16. //if (m_pDeviceSettings == NULL){
  17. // m_pDeviceSettings = new DialogSettingsLGS(this);
  18. // m_pDeviceSettings->attachMasterDevice( m_pMasterDevice );
  19. // m_pDeviceSettings->attachSlaveDevice( m_pSlaveDevice );
  20. //};
  21. //m_pDeviceSettings->updateValues();
  22. //m_pDeviceSettings->show();
  23. }
  24. //void MainWindow::handleScreenShotPress(){
  25. //QString fileName;
  26. //fileName = QFileDialog::getOpenFileName(this, "Open Data", "data/", "Data Files (*.raw *.jpg *.bmp)");
  27. //char fName[MAX_PATH];
  28. //sprintf(fName, "%s", fileName.toStdString().c_str() );
  29. //m_pRangeMap->loadFromFile(fName);
  30. //m_pGLRadar->loadFromFile(fName);
  31. //}
  32. void MainWindow::handleSave3DPicture( void ){
  33. QString fileName;
  34. fileName = QFileDialog::getSaveFileName(this, "Save 3D Picture As", "data/", "Picture Files (*.png)");
  35. QPixmap image = QPixmap::grabWidget(m_pGLRadar);
  36. if(!image.save(fileName, "PNG")){
  37. QMessageBox::warning(this, "Save Image", "Error saving image.");
  38. };
  39. }
  40. void MainWindow::handleAddMask(){
  41. if( m_pRangeMap!= NULL ){
  42. m_pRangeMap->setAddMaskMode();
  43. };
  44. }
  45. void MainWindow::handleDeleteMask(){
  46. if (m_pRangeMap != NULL){
  47. m_pRangeMap->setDeleteMaskMode();
  48. };
  49. }
  50. void MainWindow::handleSilencePress(){
  51. basicEvent *pEvt;
  52. basicCameraCommand *tData;
  53. absCameraMoveParam *tParam;
  54. tData = (basicCameraCommand*) malloc(sizeof(basicCameraCommand));
  55. if (tData != NULL) {
  56. tParam = (absCameraMoveParam*)malloc(sizeof(absCameraMoveParam));
  57. if (tParam != NULL) {
  58. tData->m_cCode = CMD_CAMERA_SET_PTZ;
  59. tData->m_pParam = tParam;
  60. tParam->m_fPan = 180.f;
  61. tParam->m_fTilt = 0.f;
  62. tParam->m_fRange = 1.f;
  63. pEvt = createBasicEvent(0, EVT_CLASS_IMAGE, EVT_COMMAND, "Test Event", tData);
  64. basicEventHeap::getInstance()->broadcast(pEvt);
  65. };
  66. };
  67. }
  68. void MainWindow::handleVideoRecorder(){
  69. basicEvent *pEvt;
  70. basicCameraCommand *tData;
  71. tData = (basicCameraCommand*) malloc(sizeof(basicCameraCommand));
  72. tData->m_pParam = NULL;
  73. if(!m_bUserRecordsVideo){
  74. // Generate Video Event -> Starts Record
  75. tData->m_cCode = CMD_CAMERA_START_RECORD;
  76. pEvt = createBasicEvent( 0, EVT_CLASS_IMAGE, EVT_COMMAND, "User Starts Record Video", tData );
  77. basicEventHeap::getInstance()->broadcast(pEvt);
  78. m_bUserRecordsVideo = true;
  79. m_pButtonCmdVideoRecord->setIcon(QIcon(":pictures/appbar.control.stop.png"));
  80. m_pButtonCmdVideoRecord->setText(QStringLiteral("Stop Record"));
  81. } else {
  82. tData->m_cCode = CMD_CAMERA_STOP_RECORD;
  83. pEvt = createBasicEvent( 0, EVT_CLASS_IMAGE, EVT_COMMAND, "User Stops Record Video", tData );
  84. basicEventHeap::getInstance()->broadcast(pEvt);
  85. m_bUserRecordsVideo = false;
  86. m_pButtonCmdVideoRecord->setIcon(QIcon(":pictures/appbar.cabinet.in.png"));
  87. m_pButtonCmdVideoRecord->setText(QStringLiteral("Start Record"));
  88. };
  89. }
  90. void MainWindow::handleReports(){
  91. //if (m_pReportManager == NULL ){
  92. // m_pReportManager = new guiReportsManagerWindow((QDialog *)this);
  93. //};
  94. //m_pReportManager->showMaximized();
  95. }
  96. void MainWindow::on_m_pButtonCmdClear_clicked()
  97. {
  98. m_pEventsList->clear();
  99. m_pGLRadar->clearTargets();
  100. m_pRangeRadar->clearTargets();
  101. m_pRangeMap->clearTargets();
  102. m_pTitleWidget->setStatus( TSW_ARMING );
  103. }
  104. void MainWindow::on_m_pButton5_clicked(bool checked)
  105. {
  106. if(!checked){
  107. m_pButton5->setChecked(true);
  108. m_pButton6->setChecked(false);
  109. m_pRangeMap->setMinimums();
  110. m_pRangeRadar->setMinimums();
  111. }
  112. }
  113. void MainWindow::on_m_pButton6_clicked(bool checked)
  114. {
  115. if(!checked){
  116. m_pButton5->setChecked(false);
  117. m_pButton6->setChecked(true);
  118. m_pRangeMap->setMaximums();
  119. m_pRangeRadar->setMaximums();
  120. }
  121. }
  122. void MainWindow::on_pushButton_3_clicked()
  123. {
  124. m_pRangeMap->startGenerateWS();
  125. }
  126. void MainWindow::on_pushButton_4_clicked()
  127. {
  128. QString fileName;
  129. //fileName = QFileDialog::getSaveFileName(this, tr("Save 2D Map As"), "/", tr("Picture Files (*.png *.jpg *.bmp)"));
  130. //if( !fileName.isEmpty() ){
  131. // m_pRangeMap->savePicture(fileName);
  132. //} else {
  133. //}
  134. QFileDialog dialog(this);
  135. dialog.setFileMode(QFileDialog::AnyFile);
  136. dialog.setViewMode(QFileDialog::Detail);
  137. QStringList fileNames;
  138. if (dialog.exec())
  139. fileNames = dialog.selectedFiles();
  140. }