| 1 |
/* |
| 2 |
* Audacity: A Digital Audio Editor |
| 3 |
*/ |
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <QString> |
| 7 |
|
| 8 |
#include "modularity/ioc.h" |
| 9 |
#include "context/iglobalcontext.h" |
| 10 |
#include "actions/iactionsdispatcher.h" |
| 11 |
#include "playback/iplayback.h" |
| 12 |
|
| 13 |
#include "uicomponents/view/toolbaritem.h" |
| 14 |
|
| 15 |
namespace au::playback { |
| 16 |
class PlaybackToolBarTimeItem : public muse::uicomponents::ToolBarItem |
| 17 |
{ |
| 18 |
Q_OBJECT |
| 19 |
|
| 20 |
Q_PROPERTY(int currentFormat READ currentFormat WRITE setCurrentFormat NOTIFY currentFormatChanged FINAL) |
| 21 |
|
| 22 |
Q_PROPERTY(double currentValue READ currentValue WRITE setCurrentValue NOTIFY currentValueChanged FINAL) |
| 23 |
|
| 24 |
Q_PROPERTY(double sampleRate READ sampleRate NOTIFY sampleRateChanged FINAL) |
| 25 |
Q_PROPERTY(double tempo READ tempo NOTIFY timeSignatureChanged FINAL) |
| 26 |
Q_PROPERTY(int upperTimeSignature READ upperTimeSignature NOTIFY timeSignatureChanged FINAL) |
| 27 |
Q_PROPERTY(int lowerTimeSignature READ lowerTimeSignature NOTIFY timeSignatureChanged FINAL) |
| 28 |
|
| 29 |
muse::Inject<context::IGlobalContext> globalContext; |
| 30 |
muse::Inject<muse::actions::IActionsDispatcher> dispatcher; |
| 31 |
muse::Inject<playback::IPlayback> playback; |
| 32 |
|
| 33 |
public: |
| 34 |
explicit PlaybackToolBarTimeItem(const muse::ui::UiAction& action, muse::uicomponents::ToolBarItemType::Type type, |
| 35 |
QObject* parent = nullptr); |
| 36 |
|
| 37 |
int currentFormat() const; |
| 38 |
void setCurrentFormat(int format); |
| 39 |
|
| 40 |
double currentValue() const; |
| 41 |
void setCurrentValue(double value); |
| 42 |
|
| 43 |
double sampleRate() const; |
| 44 |
double tempo() const; |
| 45 |
int upperTimeSignature() const; |
| 46 |
int lowerTimeSignature() const; |
| 47 |
|
| 48 |
signals: |
| 49 |
void currentFormatChanged(); |
| 50 |
void currentValueChanged(); |
| 51 |
|
| 52 |
void sampleRateChanged(); |
| 53 |
void timeSignatureChanged(); |
| 54 |
|
| 55 |
private: |
| 56 |
context::IPlaybackStatePtr playbackState() const; |
| 57 |
|
| 58 |
int m_currentFormat = 0; |
| 59 |
}; |
| 60 |
} |