add_subdirectory( widgets )
+find_package(Nepomuk REQUIRED)
include_directories(
${CMAKE_SOURCE_DIR}/src/widgets
${LIBMLT_INCLUDE_DIR}
${LIBMLTPLUS_INCLUDE_DIR}
${LIBFFMPEG_INCLUDE_DIR}
+ ${NEPOMUK_INCLUDES}
)
LINK_DIRECTORIES(
${LIBMLT_LIBRARY}
${LIBMLTPLUS_LIBRARY}
${LIBFFMPEG_LIBRARY}
+${NEPOMUK_LIBRARIES}
)
)
set(kdenlive_SRCS
+ addclipcommand.cpp
main.cpp
mainwindow.cpp
customruler.cpp
documentvideotrack.cpp
documentaudiotrack.cpp
headertrack.cpp
+ trackpanelfunctionfactory.cpp
+ trackpanelfunction.cpp
+ trackpanelclipmovefunction.cpp
)
kde4_add_kcfg_files(kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc )
${KDE4_KIO_LIBS}
${LIBMLTPLUS_LIBRARY}
${LIBMLT_LIBRARY}
+ ${NEPOMUK_LIBRARIES}
)
install(TARGETS kdenlive DESTINATION ${BIN_INSTALL_DIR})
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+#include "addclipcommand.h"
+
+AddClipCommand::AddClipCommand(ProjectList *list, const QStringList &names, const QDomElement &xml, const int id, const KUrl &url, bool doIt)
+ : m_list(list), m_names(names), m_xml(xml), m_id(id), m_url(url), m_doIt(doIt) {
+ if (doIt) setText(i18n("Add clip"));
+ else setText(i18n("Delete clip"));
+ }
+
+
+// virtual
+void AddClipCommand::undo()
+{
+ if (!m_list) kDebug()<<"---- ERROR, NO LIST FOR undoing action";
+kDebug()<<"---- undoing action";
+ if (m_doIt) m_list->deleteClip(m_id);
+ else m_list->addClip(m_names, m_xml, m_id, m_url);
+}
+// virtual
+void AddClipCommand::redo()
+{
+ if (!m_list) kDebug()<<"---- ERROR, NO LIST FOR redoing action";
+kDebug()<<"---- redoing action";
+ if (m_doIt) m_list->addClip(m_names, m_xml, m_id, m_url);
+ else m_list->deleteClip(m_id);
+}
+
+#include "addclipcommand.moc"
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+
#ifndef ADDCLIPCOMMAND_H
#define ADDCLIPCOMMAND_H
class AddClipCommand : public QUndoCommand
{
public:
- AddClipCommand(ProjectList *list, const QStringList &names, const QDomElement &xml, const int id, const KUrl &url, bool doIt)
- : m_list(list), m_names(names), m_xml(xml), m_id(id), m_url(url), m_doIt(doIt) {
- if (doIt) setText(i18n("Add clip"));
- else setText(i18n("Delete clip"));
- }
- virtual void undo()
- {
- kDebug()<<"---- undoing action";
- if (m_doIt) m_list->deleteClip(m_id);
- else m_list->addClip(m_names, m_xml, m_id, m_url);
- }
- virtual void redo()
- {
- kDebug()<<"---- redoing action";
- if (m_doIt) m_list->addClip(m_names, m_xml, m_id, m_url);
- else m_list->deleteClip(m_id);
- }
+ AddClipCommand(ProjectList *list, const QStringList &names, const QDomElement &xml, const int id, const KUrl &url, bool doIt);
+
+ virtual void undo();
+ virtual void redo();
+
private:
ProjectList *m_list;
QStringList m_names;
int value = this->value(),
minval = minimum(),
maxval;
- maxval = maximum()
- + offset() - endOffset();
+ maxval = maximum() + offset() - endOffset();
//ioffsetval = value-offset;
// pixelpm = (int)ppm;
offsetmin=(double)(minval-offset()),
offsetmax=(double)(maxval-offset()),
fontOffset = (((double)minval)>offsetmin)?(double)minval:offsetmin;
-
+ QRect bg = QRect(offsetmin, 0, offsetmax, height());
+
+ QPalette palette;
+ //p.fillRect(bg, palette.light());
// draw labels
QFont font = p.font();
font.setPointSize(LABEL_SIZE);
p.setFont( font );
+ p.setPen(palette.dark().color());
// draw littlemarklabel
// draw mediummarklabel
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+
#ifndef DEFINITIONS_H
#define DEFINITIONS_H
#define FRAME_SIZE 90
+struct TrackViewClip {
+ int startTime;
+ int duration;
+ int cropTime;
+ QString producer;
+};
+
#endif
: QWidget(parent), m_xml(xml), m_trackDuration(0)
{
setFixedHeight(50);
+ addFunctionDecorator("move", "move");
parseXml();
}
+int DocumentTrack::documentTrackIndex()
+{
+ return 0;
+}
+
+TrackViewClip *DocumentTrack::getClipAt(GenTime pos)
+{
+ return 0;
+}
+
+void DocumentTrack::addFunctionDecorator(const QString & mode, const QString & function)
+{
+ m_trackPanelFunctions[mode].append(function);
+}
+
+QStringList DocumentTrack::applicableFunctions(const QString & mode)
+{
+ return m_trackPanelFunctions[mode];
+}
void DocumentTrack::parseXml()
{
#include <QDomElement>
#include <QList>
+#include <QWidget>
+#include <QMap>
+#include <QStringList>
+#include "definitions.h"
+#include "gentime.h"
+
+
+class TrackPanelFunction;
class TrackView;
-struct TrackViewClip {
- int startTime;
- int duration;
- int cropTime;
- QString producer;
-};
class DocumentTrack : public QWidget
{
QList <TrackViewClip> clipList();
int duration();
+ int documentTrackIndex();
+ TrackViewClip *getClipAt(GenTime pos);
+ void addFunctionDecorator(const QString & mode, const QString & function);
+ QStringList applicableFunctions(const QString & mode);
protected:
virtual void paintEvent(QPaintEvent * /*e*/);
QList <TrackViewClip> m_clipList;
void parseXml();
int m_trackDuration;
+ /** A map of lists of track panel functions. */
+ QMap < QString, QStringList > m_trackPanelFunctions;
+
public slots:
/***************************************************************************
- kdenlivedoc.cpp - description
- -------------------
- begin : Fri Nov 22 2002
- copyright : (C) 2002 by Jason Wood
- email : jasonwood@blueyonder.co.uk
- copyright : (C) 2005 Lucio Flavio Correa
- email : lucio.correa@gmail.com
- copyright : (C) Marco Gittler
- email : g.marco@freenet.de
- copyright : (C) 2006 Jean-Baptiste Mardelle
- email : jb@ader.ch
-
-***************************************************************************/
-
-/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* 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 *
***************************************************************************/
-
#include <KDebug>
#include <KStandardDirs>
#include <KMessageBox>
KdenliveDoc::KdenliveDoc(KUrl url, double fps, int width, int height, QWidget *parent):QObject(parent), m_render(NULL), m_url(url), m_fps(fps), m_width(width), m_height(height), m_projectName(NULL)
{
- m_commandStack = new KUndoStack(this);
+ m_commandStack = new KUndoStack();
if (!url.isEmpty()) {
QString tmpFile;
if(KIO::NetAccess::download(url.path(), tmpFile, parent))
KdenliveDoc::~KdenliveDoc()
{
+ delete m_commandStack;
}
KUndoStack *KdenliveDoc::commandStack()
/***************************************************************************
- krender.h - description
- -------------------
- begin : Fri Nov 22 2002
- copyright : (C) 2002 by Jason Wood
- email : jasonwood@blueyonder.co.uk
-***************************************************************************/
-
-/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* 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 *
***************************************************************************/
+
#ifndef KDENLIVEDOC_H
#define KDENLIVEDOC_H
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
#include <QTextStream>
MainWindow::MainWindow(QWidget *parent)
: KXmlGuiWindow(parent),
- fileName(QString()), m_activeDocument(NULL)
+ fileName(QString()), m_activeDocument(NULL), m_commandStack(NULL)
{
m_timelineArea = new KTabWidget(this);
m_timelineArea->setHoverCloseButton(true);
setCentralWidget(m_timelineArea);
m_monitorManager = new MonitorManager();
- m_commandStack = new KUndoStack(this);
projectListDock = new QDockWidget(i18n("Project Tree"), this);
projectListDock->setObjectName("project_tree");
undoViewDock->setObjectName("undo_history");
m_undoView = new QUndoView(this);
undoViewDock->setWidget(m_undoView);
+ m_undoView->setStack(m_commandStack);
addDockWidget(Qt::TopDockWidgetArea, undoViewDock);
setupActions();
void MainWindow::openFile() //changed
{
- openFile(KFileDialog::getOpenFileName(KUrl(), "application/vnd.kde.kdenlive"));
+ openFile(KFileDialog::getOpenFileName(KUrl(), "application/vnd.kde.kdenlive,*.kdenlive"));
}
void MainWindow::openFile(const QString &inputFileName) //new
TrackView *trackView = new TrackView(doc);
m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, QIcon(), doc->documentName()));
m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
- connectDocument(trackView, doc);
+ //connectDocument(trackView, doc);
}
void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //changed
m_projectList->setDocument(doc);
m_monitorManager->setTimecode(doc->timecode());
doc->setRenderer(m_projectMonitor->render);
+ //m_undoView->setStack(0);
m_commandStack = doc->commandStack();
QAction *redo = m_commandStack->createRedoAction(actionCollection());
w->addAction(undo);
w->addAction(redo);
}
- m_undoView->setStack(m_commandStack);
-
+ m_undoView->setStack(doc->commandStack());
m_activeDocument = doc;
}
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
#include <QMouseEvent>
#include <QStylePainter>
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+
#ifndef MONITOR_H
#define MONITOR_H
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+
#include <QObject>
#include <QTimer>
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+
#ifndef MONITORMANAGER_H
#define MONITORMANAGER_H
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
#include <QMouseEvent>
#include <QStylePainter>
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+
#ifndef PROJECTITEM_H
#define PROJECTITEM_H
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);
- ~ProjectItem();
+ virtual ~ProjectItem();
QDomElement toXml();
void setProperties(const QMap < QString, QString > &attributes, const QMap < QString, QString > &metadata);
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
#include <QMouseEvent>
#include <QStylePainter>
#include <KAction>
#include <KLocale>
#include <KFileDialog>
+#include <nepomuk/resourcemanager.h>
+#include <kio/netaccess.h>
#include "projectlist.h"
#include "projectitem.h"
void ProjectList::slotRemoveClip()
{
+ 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()), false);
if (item) listView->setCurrentItem(item);
}
-void ProjectList::addClip(const QStringList &name, const QDomElement &elem, const int clipId, const KUrl &url)
+void ProjectList::addClip(const QStringList &name, const QDomElement &elem, const int clipId, const KUrl &url, int parentId)
{
kDebug()<<"///////// ADDING VCLIP=: "<<name;
ProjectItem *item;
+ ProjectItem *groupItem = NULL;
QString group = elem.attribute("group", QString::null);
- if (!group.isEmpty()) {
+ if (parentId != -1) {
+ groupItem = getItemById(parentId);
+ }
+ else if (!group.isEmpty()) {
// Clip is in a group
QList<QTreeWidgetItem *> groupList = listView->findItems(group, Qt::MatchExactly, 1);
- ProjectItem *groupItem;
+
if (groupList.isEmpty()) {
QStringList groupName;
groupName<<QString::null<<group;
groupItem = new ProjectItem(listView, groupName);
}
else groupItem = (ProjectItem *) groupList.first();
- item = new ProjectItem(groupItem, name, elem, clipId);
}
+ if (groupItem) item = new ProjectItem(groupItem, name, elem, clipId);
else item = new ProjectItem(listView, name, elem, clipId);
if (!url.isEmpty()) {
item->setData(1, FullPathRole, url.path());
+/* Nepomuk::File f( url.path() );
+ QString annotation = f.getAnnotation();
+ if (!annotation.isEmpty()) item->setText(2, annotation);*/
+ QString resource = url.path();
+ if (resource.endsWith("westley") || resource.endsWith("kdenlive")) {
+ QString tmpfile;
+ QDomDocument doc;
+ if (KIO::NetAccess::download(url, tmpfile, 0)) {
+ QFile file(tmpfile);
+ if (file.open(QIODevice::ReadOnly)) {
+ doc.setContent(&file, false);
+ file.close();
+ }
+ KIO::NetAccess::removeTempFile(tmpfile);
+
+ QDomNodeList subProds = doc.elementsByTagName("producer");
+ int ct = subProds.count();
+ for (int i = 0; i < ct ; i++)
+ {
+ QDomElement e = subProds.item(i).toElement();
+ if (!e.isNull()) {
+ addProducer(e, clipId);
+ }
+ }
+ }
+ }
+
}
+
if (elem.isNull() ) {
QDomDocument doc;
QDomElement element = doc.createElement("producer");
void ProjectList::slotAddClip()
{
-
+ if (!m_commandStack) kDebug()<<"!!!!!!!!!!!!!!!! NO CMD STK";
KUrl::List list = KFileDialog::getOpenUrls( KUrl(), "application/vnd.kde.kdenlive application/vnd.westley.scenelist application/flv application/vnd.rn-realmedia video/x-dv video/x-msvideo video/mpeg video/x-ms-wmv audio/x-mp3 audio/x-wav application/ogg *.m2t *.dv video/mp4 video/quicktime image/gif image/jpeg image/png image/x-bmp image/svg+xml image/tiff image/x-xcf-gimp image/x-vnd.adobe.photoshop image/x-pcx image/x-exr");
if (list.isEmpty()) return;
KUrl::List::Iterator it;
void ProjectList::slotAddColorClip()
{
+ if (!m_commandStack) kDebug()<<"!!!!!!!!!!!!!!!! NO CMD STK";
QDialog *dia = new QDialog;
Ui::ColorClip_UI *dia_ui = new Ui::ColorClip_UI();
dia_ui->setupUi(dia);
itemEntry.append(dia_ui->clip_name->text());
AddClipCommand *command = new AddClipCommand(this, itemEntry, element, m_clipIdCounter++, KUrl(), true);
m_commandStack->push(command);
- //ProjectItem *item = new ProjectItem(listView, itemEntry, element);
+ // ProjectItem *item = new ProjectItem(listView, itemEntry, element, m_clipIdCounter++);
/*QPixmap pix(60, 40);
pix.fill(dia_ui->clip_color->color());
item->setIcon(0, QIcon(pix));*/
QDomDocument doc;
QDomElement prods = doc.createElement("producerlist");
doc.appendChild(prods);
-
+ kDebug()<<"//////////// PRO LIST BUILD PRDSLIST ";
QTreeWidgetItemIterator it(listView);
while (*it) {
if (!((ProjectItem *)(*it))->isGroup())
}
-void ProjectList::addProducer(QDomElement producer)
+void ProjectList::addProducer(QDomElement producer, int parentId)
{
+ if (!m_commandStack) kDebug()<<"!!!!!!!!!!!!!!!! NO CMD STK";
DocClipBase::CLIPTYPE type = (DocClipBase::CLIPTYPE) producer.attribute("type").toInt();
/*QDomDocument doc;
//kDebug()<<"////// ADDING PRODUCER:\n "<<doc.toString()<<"\n+++++++++++++++++";
int id = producer.attribute("id").toInt();
if (id >= m_clipIdCounter) m_clipIdCounter = id + 1;
+ else if (id == 0) id = m_clipIdCounter++;
- if (type == DocClipBase::AUDIO || type == DocClipBase::VIDEO || type == DocClipBase::AV)
+ if (type == DocClipBase::AUDIO || type == DocClipBase::VIDEO || type == DocClipBase::AV || type == DocClipBase::IMAGE || type == DocClipBase::PLAYLIST)
{
KUrl resource = KUrl(producer.attribute("resource"));
if (!resource.isEmpty()) {
QStringList itemEntry;
itemEntry.append(QString::null);
itemEntry.append(resource.fileName());
- addClip(itemEntry, producer, id, resource);
+ addClip(itemEntry, producer, id, resource, parentId);
/*AddClipCommand *command = new AddClipCommand(this, itemEntry, producer, id, resource, true);
m_commandStack->push(command);*/
pix.fill(QColor(colour.left(7)));
QStringList itemEntry;
itemEntry.append(QString::null);
- itemEntry.append(producer.attribute("name"));
- addClip(itemEntry, producer, id, KUrl());
+ itemEntry.append(producer.attribute("name", i18n("Color clip")));
+ addClip(itemEntry, producer, id, KUrl(), parentId);
/*AddClipCommand *command = new AddClipCommand(this, itemEntry, producer, id, KUrl(), true);
m_commandStack->push(command);*/
//ProjectItem *item = new ProjectItem(listView, itemEntry, producer);
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+
#ifndef PRJECTLIST_H
#define PRJECTLIST_H
QDomElement producersList();
void setRenderer(Render *projectRender);
- void addClip(const QStringList &name, const QDomElement &elem, const int clipId, const KUrl &url = KUrl());
+ void addClip(const QStringList &name, const QDomElement &elem, const int clipId, const KUrl &url = KUrl(), int parentId = -1);
void deleteClip(const int clipId);
public slots:
void setDocument(KdenliveDoc *doc);
- void addProducer(QDomElement producer);
+ void addProducer(QDomElement producer, int parentId = -1);
void slotReplyGetImage(int clipId, int pos, const QPixmap &pix, int w, int h);
void slotReplyGetFileProperties(int clipId, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata);
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
#include <QMouseEvent>
#include <QStylePainter>
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * 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 *
+ ***************************************************************************/
+
+
#ifndef SMALLRULER_H
#define SMALLRULER_H
#include "documentaudiotrack.h"
#include "headertrack.h"
#include "trackview.h"
+#include "trackpanelclipmovefunction.h"
TrackView::TrackView(KdenliveDoc *doc, QWidget *parent)
- : QWidget(parent), m_doc(doc), m_scale(1.0)
+ : QWidget(parent), m_doc(doc), m_scale(1.0), m_panelUnderMouse(NULL), m_function(NULL)
{
+ setMouseTracking(true);
view = new Ui::TimeLine_UI();
view->setupUi(this);
m_ruler = new CustomRuler(doc->timecode());
parseDocument(doc->toXml());
+ TrackPanelClipMoveFunction *m_moveFunction = new TrackPanelClipMoveFunction(this);
+ registerFunction("move", m_moveFunction);
+ setEditMode("move");
+
connect(view->horizontalSlider, SIGNAL(valueChanged ( int )), this, SLOT(slotChangeZoom( int )));
}
+void TrackView::registerFunction(const QString & name, TrackPanelFunction * function)
+{
+ m_factory.registerFunction(name, function);
+}
+
void TrackView::parseDocument(QDomDocument doc)
{
QDomNodeList tracks = doc.elementsByTagName("playlist");
return m_scale * FRAME_SIZE;
}
+const int TrackView::mapLocalToValue(int x) const
+{
+ return (int) x * zoomFactor();
+}
+
KdenliveDoc *TrackView::document()
{
return m_doc;
//track->show();
}
+DocumentTrack *TrackView::panelAt(int y)
+{
+ return NULL;
+}
+
+void TrackView::setEditMode(const QString & editMode)
+{
+ m_editMode = editMode;
+}
+
+const QString & TrackView::editMode() const
+{
+ return m_editMode;
+}
+
+/** This event occurs when the mouse has been moved. */
+ void TrackView::mouseMoveEvent(QMouseEvent * event) {
+ kDebug()<<"-------- TRACKVIEW MOUSE MOVE EVENT -----";
+ if (m_panelUnderMouse) {
+ if (event->buttons() & Qt::LeftButton) {
+ bool result = false;
+ if (m_function)
+ result =
+ m_function->mouseMoved(m_panelUnderMouse, event);
+ if (!result) {
+ m_panelUnderMouse = 0;
+ m_function = 0;
+ }
+ } else {
+ if (m_function) {
+ m_function->mouseReleased(m_panelUnderMouse, event);
+ m_function = 0;
+ }
+ m_panelUnderMouse = 0;
+ }
+ } else {
+ DocumentTrack *panel = panelAt(event->y());
+ if (panel) {
+ QCursor result(Qt::ArrowCursor);
+
+ TrackPanelFunction *function =
+ getApplicableFunction(panel, editMode(),
+ event);
+ if (function)
+ result = function->getMouseCursor(panel, event);
+
+ setCursor(result);
+ } else {
+ setCursor(QCursor(Qt::ArrowCursor));
+ }
+ }
+ }
+
+ TrackPanelFunction *TrackView::getApplicableFunction(DocumentTrack *
+ panel, const QString & editMode, QMouseEvent * event) {
+ TrackPanelFunction *function = 0;
+
+ QStringList list = panel->applicableFunctions(editMode);
+ QStringList::iterator itt = list.begin();
+
+ while (itt != list.end()) {
+ TrackPanelFunction *testFunction = m_factory.function(*itt);
+ if (testFunction) {
+ if (testFunction->mouseApplies(panel, event)) {
+ function = testFunction;
+ break;
+ }
+ }
+
+ ++itt;
+ }
+
+ return function;
+ }
+
+
#include "trackview.moc"
#include "customruler.h"
#include "kdenlivedoc.h"
#include "documenttrack.h"
+#include "trackpanelfunctionfactory.h"
+#include "trackpanelfunction.h"
class TrackView : public QWidget
{
public:
TrackView(KdenliveDoc *doc, QWidget *parent=0);
+ /** This event occurs when the mouse has been moved. */
+ void mouseMoveEvent(QMouseEvent * event);
+
const double zoomFactor() const;
+ DocumentTrack *panelAt(int y);
+ const int mapLocalToValue(int x) const;
+ void setEditMode(const QString & editMode);
+ const QString & editMode() const;
public slots:
KdenliveDoc *document();
double m_scale;
QList <DocumentTrack*> documentTracks;
int m_projectDuration;
+ TrackPanelFunctionFactory m_factory;
+ DocumentTrack *m_panelUnderMouse;
+ /** The currently applied function. This lasts from mousePressed until mouseRelease. */
+ TrackPanelFunction *m_function;
+ QString m_editMode;
KdenliveDoc *m_doc;
QVBoxLayout *m_tracksLayout;
void parseDocument(QDomDocument doc);
int slotAddAudioTrack(int ix, QDomElement xml);
int slotAddVideoTrack(int ix, QDomElement xml);
-
+ void registerFunction(const QString & name, TrackPanelFunction * function);
+ TrackPanelFunction *getApplicableFunction(DocumentTrack * panel, const QString & editMode, QMouseEvent * event);
private slots:
void slotChangeZoom(int factor);