Timeline.h 3.79 KB
Newer Older
Ludovic Fauvet's avatar
Ludovic Fauvet committed
1 2 3
/*****************************************************************************
 * Timeline.h: Widget that handle the tracks
 *****************************************************************************
Ludovic Fauvet's avatar
Ludovic Fauvet committed
4
 * Copyright (C) 2008-2010 VideoLAN
Ludovic Fauvet's avatar
Ludovic Fauvet committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 * Authors: Ludovic Fauvet <etix@l0cal.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

23 24 25
#ifndef TIMELINE_H
#define TIMELINE_H

26
#include "vlmc.h"
27
#include "ui_Timeline.h"
28
#include "Workflow/MainWorkflow.h"
29

Ludovic Fauvet's avatar
Ludovic Fauvet committed
30 31
class TracksScene;
class TracksView;
Ludovic Fauvet's avatar
Ludovic Fauvet committed
32 33 34
class TracksControls;
class TracksRuler;
class WorkflowRenderer;
Ludovic Fauvet's avatar
Ludovic Fauvet committed
35

36 37 38
/**
 * \brief Entry point of the timeline widget.
 */
39 40
class Timeline : public QWidget
{
41
    Q_OBJECT
42
    Q_DISABLE_COPY( Timeline )
43
public:
44
    explicit Timeline( WorkflowRenderer* renderer, QWidget *parent = 0 );
45
    virtual ~Timeline();
Ludovic Fauvet's avatar
Ludovic Fauvet committed
46
    /// Return a pointer to the TracksView instance.
47
    TracksView*         tracksView() { return m_tracksView; }
Ludovic Fauvet's avatar
Ludovic Fauvet committed
48
    /// Return a pointer to the TracksScene instance.
49
    TracksScene*        tracksScene() { return m_tracksScene; }
Ludovic Fauvet's avatar
Ludovic Fauvet committed
50
    /// Return a pointer to the TracksRuler instance.
51
    TracksRuler*        tracksRuler() { return m_tracksRuler; }
Ludovic Fauvet's avatar
Ludovic Fauvet committed
52
    /// Return a pointer to the Timeline instance (singleton).
53
    static Timeline*    getInstance() { return m_instance; }
54

55
public slots:
Ludovic Fauvet's avatar
Ludovic Fauvet committed
56 57 58
    /**
     * \brief Asks the workflow to clear itself.
     */
59
    void clear();
Ludovic Fauvet's avatar
Ludovic Fauvet committed
60 61 62 63
    /**
     * \brief Change the zoom level for all widgets of the timeline.
     * \param factor The zoom factor.
     */
64
    void changeZoom( int factor );
Ludovic Fauvet's avatar
Ludovic Fauvet committed
65 66 67 68
    /**
     * \brief Change the duration of the project.
     * \param duration Duration in frames.
     */
69
    void setDuration( int duration );
Ludovic Fauvet's avatar
Ludovic Fauvet committed
70 71 72
    /**
     * \brief Change the currently selected tool.
     */
73
    void setTool( ToolButtons button );
Ludovic Fauvet's avatar
Ludovic Fauvet committed
74 75 76 77 78 79 80
    /**
     * \brief Insert an item into the timeline.
     * \param clip Clip to insert.
     * \param track The track's number.
     * \param start The position in frames.
     * \param
     */
81
    void actionAddClip( Clip* clip, unsigned int track, qint64 start, MainWorkflow::TrackType trackType );
Ludovic Fauvet's avatar
Ludovic Fauvet committed
82 83 84 85 86 87
    /**
     * \brief Move an item in the timeline.
     * \param uuid The Universally Unique Identifier of the item.
     * \param track The new track of the item.
     * \param time The new position (in frames) of the item.
     */
88
    void actionMoveClip( const QUuid& uuid, unsigned int track, qint64 time, MainWorkflow::TrackType );
Ludovic Fauvet's avatar
Ludovic Fauvet committed
89 90 91 92 93
    /**
     * \brief Remove an item from the timeline.
     * \param uuid The Universally Unique Identifier of the item.
     * \param track The current track of the item.
     */
94
    void actionRemoveClip( const QUuid& uuid, unsigned int track, MainWorkflow::TrackType trackType );
95

96
protected:
97
    virtual void changeEvent( QEvent *e );
98 99

private:
100 101 102 103
    Ui::Timeline        m_ui;
    TracksView*         m_tracksView;
    TracksScene*        m_tracksScene;
    TracksRuler*        m_tracksRuler;
104
    TracksControls*     m_tracksControls;
105 106
    double              m_scale;
    MainWorkflow*       m_mainWorkflow;
107
    WorkflowRenderer*   m_renderer;
108
    static Timeline*    m_instance;
109 110 111
};

#endif // TIMELINE_H