MIRA
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
TapePlayerWidget.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
47 #ifndef _MIRA_TAPEPLAYERWIDGET_H_
48 #define _MIRA_TAPEPLAYERWIDGET_H_
49 
50 #include <QTimer>
51 #include <QCheckBox>
52 #include <QPushButton>
53 #include <QToolButton>
54 #include <QLabel>
55 #include <QSlider>
56 #include <QWidget>
57 
58 #include <fw/Framework.h>
59 #include <fw/TapeVisitor.h>
60 
61 namespace mira {
62 
64 
65 class TapePlayer;
66 
67 class TapePlayerWidget : public QWidget
68 {
69  Q_OBJECT
70 public:
71 
72  TapePlayerWidget(QWidget* parent);
73  void setupUi();
74 
75  void openTapes(const QStringList& tapeFiles, boost::optional<std::vector<std::string>> channelsToPlay = boost::optional<std::vector<std::string>>());
76  void closeTapes();
77 
78 public slots:
79 
80  void open();
81  void stop();
82  void play();
83  void step();
84  void check();
85  void startJump();
86  void autoStep();
87  void pause(bool pause);
88  void moveJump(int time);
89  void jump();
90  void jumpToTime(Duration time);
91  void setSpeed(int speed);
92  void stepToChanged(bool state);
93  void autoStepToChanged(bool state);
94  void loopChanged(bool state);
95  void pauseControlChanged(bool state);
96  void selectChannels();
97 
98 signals:
99 
100  void onOpen(const QStringList& files, bool useOriginalTimestamp, const QString& namespacePrefix);
101  void onStop();
102  void onAutoStep();
103  void onPauseControl(bool pause);
104 
105 protected:
106 
107  int32 getLoopCount() const;
108  void onAutoStep(ChannelRead<void> data);
110 
111 public:
112 
113  boost::shared_ptr<TapePlayer> player;
115  std::map<QString, Tape*> tapes;
116  QSlider* slider;
117  QLabel* info;
118  QToolButton* btOpen;
119  QToolButton* btStop;
120  QToolButton* btPlay;
121  QToolButton* btStep;
122  QToolButton* cbLoop;
123  QToolButton* btChannels;
124  QAction* actStep;
125  QAction* actAutoStep;
126  QAction* actPauseControl;
127  QMenu* loopMenu;
128  std::vector<QAction*> actLoopCount;
130  QLabel* lblSpeed;
131  QSlider* speed;
132  QTimer checkTimer;
133 
134  QStringList lastTapes;
135  boost::optional<std::vector<std::string>> lastChannelsToPlay;
136 
137  std::string mStepToChannel;
138  std::string mAutoStepChannel;
139  std::string mPauseControlChannel;
141  std::string namespacePrefix;
143 };
144 
146 
147 }
148 
149 #endif
void onPauseControl(bool pause)
QToolButton * btStep
Definition: TapePlayerWidget.h:121
void pause(bool pause)
std::string mAutoStepChannel
Definition: TapePlayerWidget.h:138
int32 loopCount
Definition: TapePlayerWidget.h:129
void autoStepToChanged(bool state)
void stepToChanged(bool state)
TapePlayerWidget(QWidget *parent)
std::string mStepToChannel
Definition: TapePlayerWidget.h:137
std::map< QString, Tape * > tapes
Definition: TapePlayerWidget.h:115
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
void pauseControlChanged(bool state)
void jumpToTime(Duration time)
int32 getLoopCount() const
An object that allows read access to data of a channel.
Definition: ChannelReadWrite.h:494
QAction * actStep
Definition: TapePlayerWidget.h:124
Wrapper class for boost::posix_time::ptime for adding more functionality to it.
Definition: Time.h:418
TapeVisitor visitor
Definition: TapePlayerWidget.h:114
void moveJump(int time)
void openTapes(const QStringList &tapeFiles, boost::optional< std::vector< std::string >> channelsToPlay=boost::optional< std::vector< std::string >>())
QLabel * info
Definition: TapePlayerWidget.h:117
QLabel * lblSpeed
Definition: TapePlayerWidget.h:130
boost::shared_ptr< TapePlayer > player
Definition: TapePlayerWidget.h:113
Use this class to represent time durations.
Definition: Time.h:106
std::string namespacePrefix
Definition: TapePlayerWidget.h:141
Time lastTime
Definition: TapePlayerWidget.h:142
QMenu * loopMenu
Definition: TapePlayerWidget.h:127
QAction * actAutoStep
Definition: TapePlayerWidget.h:125
Definition: TapePlayerWidget.h:67
QTimer checkTimer
Definition: TapePlayerWidget.h:132
QToolButton * btOpen
Definition: TapePlayerWidget.h:118
std::string mPauseControlChannel
Definition: TapePlayerWidget.h:139
std::vector< QAction * > actLoopCount
Definition: TapePlayerWidget.h:128
QToolButton * cbLoop
Definition: TapePlayerWidget.h:122
QSlider * speed
Definition: TapePlayerWidget.h:131
Visitor class to inspect tapes by channels and/or time interval.
Definition: TapeVisitor.h:66
void setSpeed(int speed)
int32_t int32
Definition: Types.h:60
QToolButton * btChannels
Definition: TapePlayerWidget.h:123
QSlider * slider
Definition: TapePlayerWidget.h:116
boost::optional< std::vector< std::string > > lastChannelsToPlay
Definition: TapePlayerWidget.h:135
QToolButton * btPlay
Definition: TapePlayerWidget.h:120
QStringList lastTapes
Definition: TapePlayerWidget.h:134
QToolButton * btStop
Definition: TapePlayerWidget.h:119
void loopChanged(bool state)
Class implementing a visitor concept for tapes.
void onOpen(const QStringList &files, bool useOriginalTimestamp, const QString &namespacePrefix)
The framework that holds all manager classes and provides startup and shutdown of all framework relat...
QAction * actPauseControl
Definition: TapePlayerWidget.h:126
bool useOriginalTimestamp
Definition: TapePlayerWidget.h:140