00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef AUDIO_CLIP_VIEW_H
00023 #define AUDIO_CLIP_VIEW_H
00024
00025 #include "ViewItem.h"
00026 #include <defines.h>
00027 #include <QList>
00028 #include <QTimer>
00029 #include <QPolygonF>
00030 #include <QPixmap>
00031
00032 class AudioClip;
00033 class Sheet;
00034 class FadeCurve;
00035 class CurveView;
00036 class SheetView;
00037 class TrackView;
00038 class FadeView;
00039 class Peak;
00040
00041
00042 class AudioClipView : public ViewItem
00043 {
00044 Q_OBJECT
00045 Q_CLASSINFO("fade_range", tr("Closest: Adjust Length"))
00046 Q_CLASSINFO("clip_fade_in", tr("In: Adjust Length"))
00047 Q_CLASSINFO("clip_fade_out", tr("Out: Adjust Length"))
00048 Q_CLASSINFO("select_fade_in_shape", tr("In: Select Preset"));
00049 Q_CLASSINFO("select_fade_out_shape", tr("Out: Select Preset"));
00050 Q_CLASSINFO("reset_fade", tr("Closest: Delete"));
00051 Q_CLASSINFO("set_audio_file", tr("Reset Audio File"));
00052 Q_CLASSINFO("edit_properties", tr("Edit Properties"));
00053
00054 public:
00055 AudioClipView(SheetView* view, TrackView* parent, AudioClip* clip);
00056 ~AudioClipView();
00057
00058 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
00059
00060 void set_height(int height);
00061
00062 AudioClip* get_clip() const {return m_clip;}
00063 int get_height() const;
00064 int get_childview_y_offset() const;
00065
00066 void calculate_bounding_rect();
00067 void load_theme_data();
00068
00069 protected:
00070 void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
00071
00072 private:
00073 TrackView* m_tv;
00074 QList<FadeView*> m_fadeViews;
00075 AudioClip* m_clip;
00076 Sheet* m_sheet;
00077 CurveView* curveView;
00078 QPolygonF m_polygon;
00079 QPixmap m_clipInfo;
00080 QTimer m_recordingTimer;
00081
00082 float m_progress;
00083 int m_peakloadingcount;
00084
00085 bool m_waitingForPeaks;
00086 bool m_mergedView;
00087 bool m_classicView;
00088 bool m_paintWithOutline;
00089 bool m_drawDbGrid;
00090 int m_height;
00091 int m_infoAreaHeight;
00092 int m_mimimumheightforinfoarea;
00093 int m_lineOffset;
00094 int m_lineVOffset;
00095 TimeRef m_oldRecordingPos;
00096
00097
00098 int m_drawbackground;
00099 int m_fillwave;
00100 QColor m_backgroundColorTop;
00101 QColor m_backgroundColorBottom;
00102 QColor m_backgroundColorMouseHoverTop;
00103 QColor m_backgroundColorMouseHoverBottom;
00104 QColor minINFLineColor;
00105 QBrush m_waveBrush;
00106 QBrush m_brushBgRecording;
00107 QBrush m_brushBgMuted;
00108 QBrush m_brushBgMutedHover;
00109 QBrush m_brushBgSelected;
00110 QBrush m_brushBgSelectedHover;
00111 QBrush m_brushBg;
00112 QBrush m_brushBgHover;
00113 QBrush m_brushFg;
00114 QBrush m_brushFgHover;
00115 QBrush m_brushFgMuted;
00116 QBrush m_brushFgEdit;
00117 QBrush m_brushFgEditHover;
00118
00119 void create_clipinfo_string();
00120
00121 void draw_clipinfo_area(QPainter* painter, int xstart, int pixelcount);
00122 void draw_db_lines(QPainter* painter, qreal xstart, int pixelcount);
00123 void draw_peaks(QPainter* painter, qreal xstart, int pixelcount);
00124 void create_brushes();
00125
00126 friend class FadeView;
00127
00128 public slots:
00129 void add_new_fadeview(FadeCurve* fade);
00130 void remove_fadeview(FadeCurve* fade);
00131 void repaint();
00132 void update_start_pos();
00133 void position_changed();
00134
00135 Command* fade_range();
00136 Command* clip_fade_in();
00137 Command* clip_fade_out();
00138 Command* select_fade_in_shape();
00139 Command* select_fade_out_shape();
00140 Command* reset_fade();
00141 Command* set_audio_file();
00142 Command* edit_properties();
00143
00144 private slots:
00145 void update_progress_info(int progress);
00146 void peak_creation_finished();
00147 void start_recording();
00148 void finish_recording();
00149 void update_recording();
00150 void clip_state_changed();
00151 };
00152
00153
00154 inline int AudioClipView::get_height() const {
00155 int height;
00156 (m_height > m_mimimumheightforinfoarea) ? height = m_height - m_infoAreaHeight : height = m_height;
00157 return height;
00158 }
00159
00160 #endif
00161
00162