NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mainwindow.h
1 // Trajectory editor main window
2 // Authors: Max Schwarz <max.schwarz@uni-bonn.de>, Dmytro Pavlichenko <dm.mark999@gmail.com>
3 
4 #ifndef MAINWINDOW_H
5 #define MAINWINDOW_H
6 
7 #include <QMainWindow>
8 #include <QItemSelection>
9 #include <QProgressBar>
10 #include <QScrollArea>
11 #include <QString>
12 
13 #include <motion_player/MotionPlayerState.h>
14 
15 #include <trajectory_editor/keyframemodel.h>
16 #include <trajectory_editor/motionplayerclient.h>
17 #include <trajectory_editor/savecontroller.h>
18 #include <trajectory_editor/recentfiles.h>
19 
20 #include <trajectory_editor/headerview.h>
21 #include <trajectory_editor/frameview.h>
22 #include <trajectory_editor/ruleview.h>
23 
24 #include <trajectory_editor/spaces/jointdisplay.h>
25 #include <trajectory_editor/spaces/abstractspace.h>
26 #include <trajectory_editor/spaces/inversespace.h>
27 #include <trajectory_editor/spaces/pidspace.h>
28 
29 namespace Ui { class MainWindow; }
30 
31 class MainWindow : public QMainWindow
32 {
33 Q_OBJECT
34 public:
35  MainWindow();
36  virtual ~MainWindow();
37 
38 private Q_SLOTS:
39  void playFrameClicked();
40  void playFrameSlowClicked();
41 
42  void playMotionClicked();
43  void playSlowMotionClicked();
44 
45  void playSequenceClicked();
46  void updateMotionClicked();
47 
48  void handleNewMotion();
49 
50  void handleLoad();
51  void handleLoad(QString path);
52  void handleSave();
53  void handleSaveAs();
54  void handleSaveMirroredAs();
55 
56  void handleAddFrameButton();
57  void handleRemoveButton();
58  void handleSelectionChanged(QItemSelection);
59  void handleDisableSelected();
60  void setViewSelection(int row);
61  void setViewSelection(QItemSelection selection);
62 
63  void handleMoveUp();
64  void handleMoveDown();
65 
66  void showAbout();
67  void showControls();
68 
69  void ctrlC();
70  void ctrlV();
71 
72  void updateCurrentFileLabel(QString newTitle);
73 
74  void setPlayButtonsEnabled(bool flag);
75  void setControlButtonsEnabled(bool flag);
76 
77 private:
78  void motionPlayerStateReceived(const motion_player::MotionPlayerState& stateMsg);
79  std::vector<int> getSelectedIndices(bool sort);
80 
81  void proposeSave(); // Proposes to save the motion. If user clicks yes - saves it
82  void initSpaces();
83  void initHeaderWidgets();
84  void onQuit();
85 
86  QScrollArea* createAreaWithWidget(QWidget *widget);
87 
88 private:
89  Ui::MainWindow* m_ui;
90  KeyframeModel* m_kModel;
91  MotionPlayerClient *m_motion_player_client;
92  SaveController *m_save_controller;
93  RecentFiles *m_recent_files;
94 
95  HeaderView *m_header_view;
96  FrameView *m_frame_view;
97  RuleView *m_rule_view;
98 
99  std::vector<BasicSpace*> m_spaces;
100  JointManager *m_joint_space;
101  AbstractSpace *m_abstract_space;
102  InverseSpace *m_inverse_space;
103  PIDSpace *m_pid_space;
104 
105  QWidget *m_controls_view;
106  QWidget *m_about_view;
107 
108  QProgressBar *m_progress_bar;
109  ros::Subscriber m_state_subscriber;
110 };
111 
112 #endif