cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsOpenALPlayQtComponent.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Marcin Balicki
7  Created on: 2011-02-10
8 
9  (C) Copyright 2011 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 */
20 
21 #ifndef _mtsOpenALPlayQtComponent_h
22 #define _mtsOpenALPlayQtComponent_h
23 
24 #include <QObject>
25 #include <QDockWidget>
26 #include <QTimerEvent>
27 #include <QErrorMessage>
28 #include <QSlider>
29 
33 
34 #include "ui_mtsOpenALPlayQtWidget.h"
35 
36 // Always include last!
38 
41 
44 
45 class CISST_EXPORT mtsOpenALPlayQtComponent: public QObject, public mtsComponent
46 {
47  Q_OBJECT;
49 
50  public:
51 
52  QDockWidget * GetWidget(void) {
53  return &Widget;
54  }
55 
56  //
57  mtsOpenALPlayQtComponent(const std::string & name, double updatePeriod);
59  void Configure(const std::string & filename = "");
60  //States of operation
61  enum {STOP, PLAY, SEEK};
62 
63  private:
64  //The instance of the widget representing this behavior.
65  QDockWidget Widget;
66  QSlider *SeekSlider;
67 
68 
69  Ui::mtsOpenALPlayQtWidget PlayWidget;
70  void MakeQTConnections(void);
71 
72  mtsInt State;
73 
74  //Current time (aka position) in the data playback process
75  mtsDouble Time;
76 
77  //the start and end timestamps of the data in our system. min/max.
78  mtsDouble DataStartTime;
79  mtsDouble DataEndTime;
80  //the time when current play was started, timestamp is the cpu clock,
81  //the .Data is the corresponding time in the Data stream
82  mtsDouble PlayStartTime;
83  //the Data stream time when the stream playback should stop
84  mtsDouble PlayUntilTime;
85 
87  vctPlot2DBase::Signal * DataTrace;
88 
89  osaTimeServer TimeServer;
90  QErrorMessage * ErrorMessageDialog;
91  void ErrorMessage(const std::string & message);
92 
93  void timerEvent(QTimerEvent *);
94 
95  struct {
107  } Player;
108 
109  void RangeChangedEvent(void) {
110  emit QSignalUpdateRange();
111  }
112 
113  public slots:
114 
115  void QSlotPlayClicked();
116  void QSlotPauseClicked();
117  void QSlotFileDialogClicked();
118  void QSlotOpenFileClicked();
119  void QSlotVolumeSliderMoved(int v);
120  void QSlotSeekSliderMoved(int v);
121  void QSlotUpdateRange(void);
122 
123  signals:
124  void QSignalUpdateRange(void);
125 
126 };
127 
129 
130 #endif //_mtsOpenALPlayQtComponent_h
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
mtsFunctionWrite Seek
Definition: mtsOpenALPlayQtComponent.h:99
~mtsOpenALPlayQtComponent()
Definition: mtsOpenALPlayQtComponent.h:58
QDockWidget * GetWidget(void)
Definition: mtsOpenALPlayQtComponent.h:52
mtsComponentState State
Definition: mtsComponent.h:163
Definition: mtsFunctionRead.h:37
mtsFunctionRead GetLengthInSec
Definition: mtsOpenALPlayQtComponent.h:105
mtsFunctionRead GetTime
Definition: mtsOpenALPlayQtComponent.h:104
Declaration of osaTimeServer class.
Definition: mtsFunctionVoid.h:36
mtsFunctionWrite SetVolume
Definition: mtsOpenALPlayQtComponent.h:103
Definition: mtsOpenALPlayQtComponent.h:45
Declaration of mtsComponent.
mtsFunctionRead GetVolume
Definition: mtsOpenALPlayQtComponent.h:102
Definition: mtsComponent.h:150
mtsFunctionVoid Pause
Definition: mtsOpenALPlayQtComponent.h:98
#define CMN_DECLARE_SERVICES(hasDynamicCreation, lod)
Definition: cmnClassRegisterMacros.h:116
mtsFunctionVoid Play
Definition: mtsOpenALPlayQtComponent.h:97
Definition: vctPlot2DOpenGLQtWidget.h:29
Class for relative time.
Definition: osaTimeServer.h:73
mtsFunctionWrite OpenFile
Definition: mtsOpenALPlayQtComponent.h:101
Definition: mtsFunctionWrite.h:37
mtsFunctionRead GetIsPlaying
Definition: mtsOpenALPlayQtComponent.h:96
Definition: mtsGenericObjectProxy.h:45
const int CMN_NO_DYNAMIC_CREATION
Definition: cmnClassRegisterMacros.h:328
virtual void Configure(const std::string &filename="")
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition: cmnClassRegisterMacros.h:202
Definition: vctPlot2DBase.h:55
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76
Definition: mtsOpenALPlayQtComponent.h:61
mtsFunctionRead GetStartTime
Definition: mtsOpenALPlayQtComponent.h:100
mtsFunctionRead GetStreamVolume
Definition: mtsOpenALPlayQtComponent.h:106