]> git.sesse.net Git - kdenlive/blob - src/subprojectitem.cpp
Cleanup drawing of project tree
[kdenlive] / src / subprojectitem.cpp
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20
21 #include "subprojectitem.h"
22 #include "timecode.h"
23 #include "definitions.h"
24 #include "kdenlivesettings.h"
25 #include "docclipbase.h"
26
27 #include <KDebug>
28 #include <KLocale>
29 #include <KIcon>
30
31 const int DurationRole = Qt::UserRole + 1;
32
33 SubProjectItem::SubProjectItem(QTreeWidgetItem * parent, int in, int out) :
34         QTreeWidgetItem(parent, PROJECTSUBCLIPTYPE), m_in(in), m_out(out)
35 {
36     setSizeHint(0, QSize(65, 30));
37     setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
38     QString name = Timecode::getStringTimecode(in, KdenliveSettings::project_fps());
39     setText(0, name);
40     GenTime duration = GenTime(out - in, KdenliveSettings::project_fps());
41     if (duration != GenTime()) setData(0, DurationRole, Timecode::getEasyTimecode(duration, KdenliveSettings::project_fps()));
42     //setFlags(Qt::NoItemFlags);
43     //kDebug() << "Constructed with clipId: " << m_clipId;
44 }
45
46
47 SubProjectItem::~SubProjectItem()
48 {
49 }
50
51 int SubProjectItem::numReferences() const
52 {
53     return 0;
54 }
55
56 QDomElement SubProjectItem::toXml() const
57 {
58     //return m_clip->toXML();
59     return QDomElement();
60 }
61
62 QPoint SubProjectItem::zone() const
63 {
64     QPoint z(m_in, m_out);
65     return z;
66 }
67
68 DocClipBase *SubProjectItem::referencedClip()
69 {
70     return NULL; //m_clip;
71 }
72
73