| 1 | // This file is part of the PACPUS framework distributed under the | 
|---|
| 2 | // CECILL-C License, Version 1.0. | 
|---|
| 3 | // | 
|---|
| 4 | /// @author  Elie Al Alam <firstname.surname@utc.fr> | 
|---|
| 5 | /// @author  Gerald Dherbomez <firstname.surname@utc.fr> | 
|---|
| 6 | /// @date    April, 2007 | 
|---|
| 7 | /// @version $Id$ | 
|---|
| 8 | /// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved. | 
|---|
| 9 | /// @brief DbitePlayer graphical user interface. | 
|---|
| 10 | /// | 
|---|
| 11 | /// Detailed description. | 
|---|
| 12 |  | 
|---|
| 13 | #ifndef DEF_PACPUS_DBTPLYUSERINTERFACE_H | 
|---|
| 14 | #define DEF_PACPUS_DBTPLYUSERINTERFACE_H | 
|---|
| 15 |  | 
|---|
| 16 | #include <QWidget> | 
|---|
| 17 |  | 
|---|
| 18 | #include <Pacpus/kernel/ComponentBase.h> | 
|---|
| 19 | #include <Pacpus/kernel/ComponentFactory.h> | 
|---|
| 20 | #include <Pacpus/DbitePlayer/DbitePlayerConfig.h> | 
|---|
| 21 | #include <Pacpus/DbitePlayer/DbtPlyFileManager.h> | 
|---|
| 22 | #include <Pacpus/DbitePlayer/DbtPlyEngine.h> | 
|---|
| 23 |  | 
|---|
| 24 | class QButtonGroup; | 
|---|
| 25 | class QCheckBox; | 
|---|
| 26 | class QCloseEvent; | 
|---|
| 27 | class QGroupBox; | 
|---|
| 28 | class QLabel; | 
|---|
| 29 | class QLayout; | 
|---|
| 30 | class QPushButton; | 
|---|
| 31 | class QSlider; | 
|---|
| 32 | class QTableWidget; | 
|---|
| 33 |  | 
|---|
| 34 | namespace pacpus { | 
|---|
| 35 |  | 
|---|
| 36 | class DbtPlyEngine; | 
|---|
| 37 | class DbtPlyEngineState; | 
|---|
| 38 |  | 
|---|
| 39 | class DBITE_PLAYER_API DbtPlyUserInterface | 
|---|
| 40 | : public QWidget | 
|---|
| 41 | , public ComponentBase | 
|---|
| 42 | { | 
|---|
| 43 | Q_OBJECT | 
|---|
| 44 |  | 
|---|
| 45 | public: | 
|---|
| 46 | /// Constructor. | 
|---|
| 47 | /// | 
|---|
| 48 | /// @param name component name | 
|---|
| 49 | /// @see ComponentBase::ComponentBase(QString) | 
|---|
| 50 | DbtPlyUserInterface(QString name); | 
|---|
| 51 |  | 
|---|
| 52 | /// Destructor. | 
|---|
| 53 | ~DbtPlyUserInterface(); | 
|---|
| 54 |  | 
|---|
| 55 | /// @returns time slider value | 
|---|
| 56 | int getTime(); | 
|---|
| 57 |  | 
|---|
| 58 | /// sets time slider value to 0 | 
|---|
| 59 | void resetTime(); | 
|---|
| 60 |  | 
|---|
| 61 | public Q_SLOTS: | 
|---|
| 62 | /// Slot. | 
|---|
| 63 | /// Refreshes the state of the player. | 
|---|
| 64 | void displayStateSlot(DbtPlyEngineState * state, float speed); | 
|---|
| 65 |  | 
|---|
| 66 | /// Slot. | 
|---|
| 67 | /// Displays the max and min times. | 
|---|
| 68 | void displayMinMaxTime(road_time_t min, road_time_t max); | 
|---|
| 69 |  | 
|---|
| 70 | /// Slot. | 
|---|
| 71 | /// Displays the current time of the player. | 
|---|
| 72 | void displayTime(road_time_t time); | 
|---|
| 73 |  | 
|---|
| 74 | private: | 
|---|
| 75 | /// Configures the component. | 
|---|
| 76 | virtual COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config); | 
|---|
| 77 |  | 
|---|
| 78 | /// Starts component activity. | 
|---|
| 79 | virtual void startActivity(); | 
|---|
| 80 |  | 
|---|
| 81 | /// Stops component activity. | 
|---|
| 82 | virtual void stopActivity(); | 
|---|
| 83 |  | 
|---|
| 84 | void closeEvent(QCloseEvent * e); | 
|---|
| 85 |  | 
|---|
| 86 | void connectButtons(); | 
|---|
| 87 | void connectDisplay(); | 
|---|
| 88 | void connectSlider(); | 
|---|
| 89 | QLayout * createMainLayout(); | 
|---|
| 90 | QGroupBox * createControlGroupBox(); | 
|---|
| 91 | QGroupBox * createComponentListGroupBox(); | 
|---|
| 92 | void updateComponentList(); | 
|---|
| 93 |  | 
|---|
| 94 | private: | 
|---|
| 95 | DbtPlyEngine * mEngine; | 
|---|
| 96 |  | 
|---|
| 97 | QWidget * wTel_ ; | 
|---|
| 98 | QButtonGroup * butGroup; | 
|---|
| 99 | QPushButton * playBut ; | 
|---|
| 100 | QPushButton * pauseBut ; | 
|---|
| 101 | QPushButton * stopBut ; | 
|---|
| 102 | QPushButton * speedUpBut ; | 
|---|
| 103 | QPushButton * speedDownBut ; | 
|---|
| 104 | QLabel * lab; | 
|---|
| 105 | QCheckBox * rev; | 
|---|
| 106 | QSlider * timeSlider; | 
|---|
| 107 | QLabel * timeMinTitle; | 
|---|
| 108 | QLabel * timeMinValue; | 
|---|
| 109 | QLabel * timeMaxTitle; | 
|---|
| 110 | QLabel * timeMaxValue; | 
|---|
| 111 | QLabel * timeCurTitle; | 
|---|
| 112 | QLabel * timeCurValue; | 
|---|
| 113 |  | 
|---|
| 114 | QTableWidget * componentTableWidget; | 
|---|
| 115 |  | 
|---|
| 116 | // current max time | 
|---|
| 117 | road_time_t tMax_; | 
|---|
| 118 | // current min time | 
|---|
| 119 | road_time_t tMin_; | 
|---|
| 120 | // current absolute time | 
|---|
| 121 | road_time_t absTime_; | 
|---|
| 122 | // current relative time | 
|---|
| 123 | int relTime_; | 
|---|
| 124 | }; | 
|---|
| 125 |  | 
|---|
| 126 | } // namespace pacpus | 
|---|
| 127 |  | 
|---|
| 128 | #endif // DEF_PACPUS_DBTPLYUSERINTERFACE_H | 
|---|