const int ClipTypeRole = NameRole + 3;
ProjectItem::ProjectItem(QTreeWidget * parent, const QStringList & strings, QDomElement xml, int clipId)
- : QTreeWidgetItem(parent, strings, QTreeWidgetItem::UserType), m_clipType(DocClipBase::NONE), m_clipId(clipId), m_isGroup(false)
+ : QTreeWidgetItem(parent, strings, QTreeWidgetItem::UserType), m_clipType(DocClipBase::NONE), m_clipId(clipId), m_isGroup(false), m_groupName(QString::null)
{
m_element = xml.cloneNode().toElement();
setSizeHint(0, QSize(65, 45));
}
ProjectItem::ProjectItem(QTreeWidgetItem * parent, const QStringList & strings, QDomElement xml, int clipId)
- : QTreeWidgetItem(parent, strings, QTreeWidgetItem::UserType), m_clipType(DocClipBase::NONE), m_clipId(clipId), m_isGroup(false)
+ : QTreeWidgetItem(parent, strings, QTreeWidgetItem::UserType), m_clipType(DocClipBase::NONE), m_clipId(clipId), m_isGroup(false), m_groupName(QString::null)
{
m_element = xml.cloneNode().toElement();
setSizeHint(0, QSize(65, 45));
}
ProjectItem::ProjectItem(QTreeWidget * parent, const QStringList & strings, int clipId)
- : QTreeWidgetItem(parent, strings, QTreeWidgetItem::UserType), m_element(QDomElement()), m_clipType(DocClipBase::NONE), m_clipId(clipId), m_isGroup(true)
+ : QTreeWidgetItem(parent, strings, QTreeWidgetItem::UserType), m_element(QDomElement()), m_clipType(DocClipBase::NONE), m_clipId(clipId), m_isGroup(true), m_groupName(strings.at(1))
{
setSizeHint(0, QSize(65, 45));
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
{
}
-ProjectItem *ProjectItem::clone() const
-{
- ProjectItem *item = (ProjectItem *) this->QTreeWidgetItem::clone();
- /*if (isGroup())
- {
- item = new ProjectItem(new QTreeWidget(), names(), clipId());
- }
- else {
- if (parent())
- item = new ProjectItem(new QTreeWidgetItem(), names(), toXml().cloneNode().toElement(), clipId());
- else
- item = new ProjectItem(new QTreeWidget(), names(), toXml().cloneNode().toElement(), clipId());
- }*/
- return item;
-}
-
int ProjectItem::clipId() const
{
return m_clipId;
return m_isGroup;
}
-const QString &ProjectItem::groupName() const
+const QString ProjectItem::groupName() const
{
- if (isGroup()) return text(1);
- else return QString::null;
+ return m_groupName;
}
QStringList ProjectItem::names() const
return m_element;
}
+const KUrl ProjectItem::clipUrl() const
+{
+ if (m_clipType != DocClipBase::COLOR && m_clipType != DocClipBase::VIRTUAL && m_clipType != DocClipBase::NONE)
+ return KUrl(m_element.attribute("resouce"));
+ else return KUrl();
+}
+
+
void ProjectItem::slotSetToolTip()
{
QString tip = "<qt><b>";
#include <KInputDialog>
#include <nepomuk/resourcemanager.h>
#include <kio/netaccess.h>
+#include <KMessageBox>
#include "projectlist.h"
#include "projectitem.h"
if (!m_commandStack) kDebug()<<"!!!!!!!!!!!!!!!! NO CMD STK";
if (!listView->currentItem()) return;
ProjectItem *item = ((ProjectItem *)listView->currentItem());
- AddClipCommand *command = new AddClipCommand(this, item->names(), item->toXml(), item->clipId(), KUrl(item->data(1, FullPathRole).toString()), item->groupName(), false);
+ if (!item) kDebug()<<"/////////////// ERROR NOT FOUND";
+ if (KMessageBox::questionYesNo(this, i18n("Delete clip <b>%1</b> ?").arg(item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes) return;
+ AddClipCommand *command = new AddClipCommand(this, item->names(), item->toXml(), item->clipId(), item->clipUrl(), item->groupName(), false);
m_commandStack->push(command);
-
}
void ProjectList::selectItemById(const int clipId)
if (id >= m_clipIdCounter) m_clipIdCounter = id + 1;
else if (id == 0) id = m_clipIdCounter++;
+ if (parentId != -1) {
+ // item is a westley playlist, adjust subproducers ids
+ id = (parentId + 1) * 10000 + id;
+ }
if (type == DocClipBase::AUDIO || type == DocClipBase::VIDEO || type == DocClipBase::AV || type == DocClipBase::IMAGE || type == DocClipBase::PLAYLIST)
{
KUrl resource = KUrl(producer.attribute("resource"));
if (item->parent()) item = item->parent();
if (((ProjectItem *) item)->isGroup()) {
//emit addClip(event->mimeData->text());
- kDebug()<<"//////////////// DROPPED RIGHT 1";
+ kDebug()<<"//////////////// DROPPED RIGHT 1 ";
QList <QTreeWidgetItem *> list;
list = selectedItems ();
ProjectItem *clone;
foreach (QTreeWidgetItem *it, list) {
- // TODO allow dragging of folders
- if (!((ProjectItem *) it)->isGroup()) {
+ // TODO allow dragging of folders ?
+ if (!((ProjectItem *) it)->isGroup() && ((ProjectItem *) it)->clipId() < 10000) {
if (it->parent()) clone = (ProjectItem* ) it->parent()->takeChild(it->parent()->indexOfChild(it));
else clone = (ProjectItem* ) takeTopLevelItem(indexOfTopLevelItem(it));
if (clone) item->addChild(clone);
ProjectItem *clone;
foreach (QTreeWidgetItem *it, list) {
QTreeWidgetItem *parent = it->parent();
- if (parent) {
+ if (parent && ((ProjectItem *) it)->clipId() < 10000) {
kDebug()<<"++ item parent: "<<parent->text(1);
clone = (ProjectItem* ) parent->takeChild(parent->indexOfChild(it));
if (clone) addTopLevelItem(clone);