MainWindow.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. // MainWindow.h
  2. #ifndef __MAINWINDOW_H__
  3. #define __MAINWINDOW_H__
  4. #include "VideoWidget.h"
  5. #include "ArffWidgetCoord.h"
  6. #include "ArffWidgetSpeed.h"
  7. #include "PaintGaze.h"
  8. #include "../arffHelper/Arff.h"
  9. #include <QMainWindow>
  10. #include <memory>
  11. enum class GazeType
  12. {
  13. EYE_PLUS_HEAD,
  14. FOV,
  15. HEAD
  16. };
  17. struct SetupValues
  18. {
  19. QString arffFile;
  20. QString saveFile;
  21. QString videoFile;
  22. QString primaryLabel;
  23. QString primaryLabelValues;
  24. QString secondaryLabel;
  25. QString secondaryLabelValues;
  26. GazeType gazeType;
  27. };
  28. class MainWindow : public QMainWindow
  29. {
  30. Q_OBJECT
  31. public:
  32. MainWindow();
  33. MainWindow(SetupValues setup);
  34. // Constructor for command line use
  35. ~MainWindow();
  36. protected:
  37. void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
  38. private slots:
  39. void SaveArff();
  40. ///< Saves Arff to m_saveFilename. Gets value if it is empty.
  41. void SaveAsArff();
  42. ///< proimpts user to provide a name
  43. void OpenFiles();
  44. ///< opens video and arff file
  45. void Undo();
  46. ///< undoes last change
  47. void Redo();
  48. ///< redoes change
  49. void HandleTime(int curTime_us);
  50. void HandleWindowDur(int dur_us);
  51. void HandleUpdate();
  52. signals:
  53. void SendTime(int curTime_us, QObject *pSender);
  54. void SendWindowDur(int dur_us, QObject *pSender);
  55. void SendUpdate();
  56. void SendSelectedEyeMovement(int eyeMovement);
  57. void SendToggleView();
  58. private:
  59. void InitializeMainWidget();
  60. ///< initializes object and connects signals
  61. void InitializeVariables();
  62. ///< initializes all needed variables
  63. void InitializeMenu();
  64. ///< initializes the menu and te actions
  65. int InitializeAtt(QString name, QString values);
  66. void ConnectTimeSignals(const QObject *pObject);
  67. void ConnectWinDurSignals(const QObject *pObject);
  68. void ConnectUpdateSignals(const QObject *pObject);
  69. void ConnectEyeMovementSignals(const QObject *pObject);
  70. void ConnectToggleViewSignals(const QObject *pObject);
  71. void SetData(int attIndex);
  72. void keyPressEvent(QKeyEvent *event);
  73. ///< overwrites key press events when it has focus
  74. bool eventFilter(QObject *watched, QEvent *event);
  75. ///< overwrites the event filter in order to provide keyboard short cuts
  76. bool ProcessKeyPress(QKeyEvent *event);
  77. ///< processes key events. Returns true if the event was handled. False otherwise
  78. bool UseAttributeDialog(QString attName);
  79. ///< shows a dialog if attribute already exists and returns true if the user selected
  80. ///< to change the existing one or the attribute wans't present
  81. SetupValues m_setup;
  82. QWidget *m_pMainWidget;
  83. QDir path; // path to last used directory
  84. VideoWidget *m_pVideoWidget;
  85. ArffWidgetCoordX *m_pArffWidgetCoordX;
  86. ArffWidgetCoordY *m_pArffWidgetCoordY;
  87. ArffWidgetSpeed *m_pArffWidgetSpeed;
  88. ArffWidgetBase *m_pArffSecondWidgetSpeed;
  89. ArffWidgetBase *m_pArffSecondWidgetY;
  90. PaintGaze *m_pPaintGaze;
  91. shared_ptr<Arff> m_pArff;
  92. shared_ptr<Arff> m_pFovArff; // arff for FOV conversion from equirectangular
  93. // menu windows and actions
  94. QMenu *m_fileMenu;
  95. QMenu *m_editMenu;
  96. QAction *m_openAction;
  97. QAction *m_saveAction;
  98. QAction *m_saveAsAction;
  99. QAction *m_undoAction;
  100. QAction *m_redoAction;
  101. };
  102. #endif /*__MAINWINDOW_H__*/