MainWindow.h 3.4 KB

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