kwave  18.07.70
SelectTimeWidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  SelectTimeWidget.h - widget for selecting a time or range
3  -------------------
4  begin : Thu Jan 16 2003
5  copyright : (C) 2002 by Thomas Eschenbacher
6  email : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef SELECT_TIME_WIDGET_H
19 #define SELECT_TIME_WIDGET_H
20 
21 #include "config.h"
22 
23 #include <QtGlobal>
24 #include <QGroupBox>
25 #include <QObject>
26 #include <QTimer>
27 
28 #include "libgui/ui_SelectTimeWidgetBase.h"
29 #include "libkwave/Sample.h"
30 
31 namespace Kwave
32 {
33 
37  class Q_DECL_EXPORT SelectTimeWidget
38  :public QGroupBox, public Ui::SelectTimeWidgetBase
39  {
40  Q_OBJECT
41  public:
42 
44  typedef enum {
45  byTime = 0,
47  byPercents
48  } Mode;
49 
54  explicit SelectTimeWidget(QWidget *widget);
55 
66  virtual void init(Mode mode, quint64 range, double sample_rate,
67  sample_index_t offset, sample_index_t signal_length);
68 
70  virtual ~SelectTimeWidget();
71 
73  void setMode(Mode new_mode);
74 
76  Mode mode() const { return m_mode; }
77 
79  quint64 time() const { return m_range; }
80 
82  sample_index_t samples() const;
83 
85  virtual void setTitle(const QString title);
86 
95  static sample_index_t timeToSamples(Mode mode, quint64 time,
96  double rate, sample_index_t length);
97 
106  static quint64 samplesToTime(Mode mode, sample_index_t time,
107  double rate, sample_index_t length);
108 
109  signals:
110 
112  void valueChanged(sample_index_t samples);
113 
114  public slots:
115 
122  void setOffset(sample_index_t offset);
123 
124  private slots:
125 
127  void modeChanged(bool checked);
128 
130  void timeChanged(int);
131 
133  void checkNewSampleEdit();
134 
136  void samplesChanged(int);
137 
139  void percentsChanged(int p);
140 
141  private:
142 
144  void connect();
145 
147  void disconnect();
148 
149  private:
150 
152  Mode m_mode;
153 
155  quint64 m_range;
156 
158  double m_rate;
159 
162 
165 
167  QTimer m_timer;
168 
169  };
170 }
171 
172 #endif /* SELECT_TIME_WIDGET_H */
173 
174 //***************************************************************************
175 //***************************************************************************
Definition: App.h:33
quint64 sample_index_t
Definition: Sample.h:28
bool connect(Kwave::StreamObject &source, const char *output, Kwave::StreamObject &sink, const char *input)
Definition: Connect.cpp:48