#include <QTreeWidget>
#include <QDomElement>
+#include <KUrl>
+
#include "gentime.h"
-#include "docclipbase.h"
+#include "definitions.h"
+class DocClipBase;
+/** \brief Represents a clip or a folder in the projecttree
+ *
+ * This class represents a clip or folder in the projecttree and in the document(?) */
class ProjectItem : public QTreeWidgetItem
{
- public:
- ProjectItem(QTreeWidget * parent, const QStringList & strings, QDomElement xml, int clipId);
- ProjectItem(QTreeWidgetItem * parent, const QStringList & strings, QDomElement xml, int clipId);
- ProjectItem(QTreeWidget * parent, const QStringList & strings);
+public:
+ ProjectItem(QTreeWidget * parent, DocClipBase *clip);
+ ProjectItem(QTreeWidgetItem * parent, DocClipBase *clip);
virtual ~ProjectItem();
- QDomElement toXml();
+ QDomElement toXml() const;
+ int numReferences() const;
void setProperties(const QMap < QString, QString > &attributes, const QMap < QString, QString > &metadata);
- int clipId();
- QStringList names();
- bool isGroup();
-
- private:
- QDomElement m_element;
- GenTime m_duration;
- bool m_durationKnown;
- DocClipBase::CLIPTYPE m_clipType;
- int m_clipId;
+
+ /** \brief The id of the clip or folder.
+ *
+ * The clipId is used both to identify clips and folders (groups) */
+ const QString &clipId() const;
+ QStringList names() const;
+ const KUrl clipUrl() const;
+ int clipMaxDuration() const;
+ CLIPTYPE clipType() const;
+ void changeDuration(int frames);
+ DocClipBase *referencedClip();
+ void setProperties(QMap <QString, QString> props);
+ void setProperty(const QString &key, const QString &value);
+ void clearProperty(const QString &key);
+ QString getClipHash() const;
+ static int itemDefaultHeight();
void slotSetToolTip();
- bool m_isGroup;
+
+ virtual bool operator<(const QTreeWidgetItem &other)const {
+ int column = treeWidget()->sortColumn();
+ if (other.type() != PROJECTFOLDERTYPE)
+ return text(column).toLower() < other.text(column).toLower();
+ else return false;
+ }
+
+private:
+ CLIPTYPE m_clipType;
+ QString m_clipId;
+ DocClipBase *m_clip;
};
#endif