install(TARGETS kdenlive DESTINATION ${BIN_INSTALL_DIR})
install( FILES kdenliveui.rc DESTINATION ${DATA_INSTALL_DIR}/kdenlive )
-install (FILES kdenlive.kcfg DESTINATION share/config.kcfg)
\ No newline at end of file
+install (FILES kdenlivesettings.kcfg DESTINATION share/config.kcfg)
\ No newline at end of file
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);
if (!url.isEmpty()) {
QString tmpFile;
if(KIO::NetAccess::download(url.path(), tmpFile, parent))
{
}
+KUndoStack *KdenliveDoc::commandStack()
+{
+ return m_commandStack;
+}
+
void KdenliveDoc::setRenderer(Render *render)
{
m_render = render;
#include <QList>
#include <QObject>
+#include <KUndoStack>
#include <kurl.h>
#include "gentime.h"
Timecode timecode();
QDomDocument toXml();
void setRenderer(Render *render);
+ KUndoStack *commandStack();
private:
KUrl m_url;
int m_height;
Timecode m_timecode;
Render *m_render;
+ KUndoStack *m_commandStack;
QDomDocument generateSceneList();
public slots:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<gui name="kdenlive" version="3">
+<gui name="kdenlive" version="4">
<ToolBar name="mainToolBar" >
<text>Main Toolbar</text>
<Action name="clear" />
#include <QTextStream>
#include <QTimer>
+#include <QAction>
#include <KApplication>
#include <KAction>
#include <KSaveFile>
#include <KRuler>
#include <KConfigDialog>
-
+#include <KXMLGUIFactory>
#include <mlt++/Mlt.h>
setCentralWidget(m_timelineArea);
m_monitorManager = new MonitorManager();
-
m_commandStack = new KUndoStack(this);
projectListDock = new QDockWidget(i18n("Project Tree"), this);
projectListDock->setObjectName("project_tree");
- m_projectList = new ProjectList(m_commandStack, this);
+ m_projectList = new ProjectList(this);
projectListDock->setWidget(m_projectList);
addDockWidget(Qt::TopDockWidgetArea, projectListDock);
connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, int)), m_clipMonitor->render, SLOT(getFileProperties(const QDomElement &, int)));
- //connect(m_projectList, SIGNAL(getFileProperties(const KUrl &, uint)), m_clipMonitor->render, SLOT(getFileProperties(const KUrl &, uint)));
-
connect(m_clipMonitor->render, SIGNAL(replyGetImage(int, int, const QPixmap &, int, int)), m_projectList, SLOT(slotReplyGetImage(int, int, const QPixmap &, int, int)));
connect(m_clipMonitor->render, SIGNAL(replyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &)), m_projectList, SLOT(slotReplyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &)));
KStandardAction::preferences(this, SLOT(slotPreferences()),
actionCollection());
- QAction * redo = m_commandStack->createRedoAction(actionCollection());
- QAction * undo = m_commandStack->createUndoAction(actionCollection());
+ /*m_redo = m_commandStack->createRedoAction(actionCollection());
+ m_undo = m_commandStack->createUndoAction(actionCollection());*/
setupGUI();
+
+
}
void MainWindow::newFile()
m_projectList->setDocument(doc);
m_monitorManager->setTimecode(doc->timecode());
doc->setRenderer(m_projectMonitor->render);
+ m_commandStack = doc->commandStack();
+
+ QAction *redo = m_commandStack->createRedoAction(actionCollection());
+ QAction *undo = m_commandStack->createUndoAction(actionCollection());
+
+ QWidget* w = factory()->container("mainToolBar", this);
+ if(w) {
+ if (actionCollection()->action("undo"))
+ delete actionCollection()->action("undo");
+ if(actionCollection()->action("redo"))
+ delete actionCollection()->action("redo");
+
+ actionCollection()->addAction("undo", undo);
+ actionCollection()->addAction("redo", redo);
+ w->addAction(undo);
+ w->addAction(redo);
+ }
+
m_activeDocument = doc;
}
Monitor *m_projectMonitor;
KUndoStack *m_commandStack;
+ QAction *m_undo;
+ QAction *m_redo;
private slots:
void newFile();
{
setSizeHint(0, QSize(65, 45));
setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
+ if (m_element.isNull()) m_element.setAttribute("id", clipId);
QString cType = m_element.attribute("type", 0);
if (!cType.isEmpty()) {
m_clipType = (DocClipBase::CLIPTYPE) cType.toInt();
};
-ProjectList::ProjectList(KUndoStack *commandStack, QWidget *parent)
- : QWidget(parent), m_render(NULL), m_fps(-1), m_commandStack(commandStack)
+ProjectList::ProjectList(QWidget *parent)
+ : QWidget(parent), m_render(NULL), m_fps(-1), m_commandStack(NULL)
{
QWidget *vbox = new QWidget;
}
+void ProjectList::selectItemById(const int clipId)
+{
+ QTreeWidgetItem *parent = 0;
+ int count =
+ parent ? parent->childCount() : listView->topLevelItemCount();
+
+ for (int i = 0; i < count; i++)
+ {
+ QTreeWidgetItem *item =
+ parent ? parent->child(i) : listView->topLevelItem(i);
+ if (((ProjectItem *)item)->clipId() == clipId) {
+ listView->setCurrentItem(item);
+ break;
+ }
+ }
+}
+
void ProjectList::addClip(const QStringList &name, const QDomElement &elem, const int clipId, const KUrl &url)
{
ProjectItem *item = new ProjectItem(listView, name, elem, clipId);
emit getFileProperties(element, clipId);
}
else emit getFileProperties(elem, clipId);
+ selectItemById(clipId);
}
void ProjectList::deleteClip(const int clipId)
{
m_fps = doc->fps();
m_timecode = doc->timecode();
-
+ m_commandStack = doc->commandStack();
QDomNodeList prods = doc->producersList();
listView->clear();
for (int i = 0; i < prods.count () ; i++)
parent ? parent->child(i) : listView->topLevelItem(i);
prods.appendChild(doc.importNode(((ProjectItem *)item)->toXml(), true));
}
- //kDebug()<<"PRODUCERS: \n"<<doc.toString();
+
return prods;
}
void ProjectList::addProducer(QDomElement producer)
{
DocClipBase::CLIPTYPE type = (DocClipBase::CLIPTYPE) producer.attribute("type").toInt();
-
+
+ QDomDocument doc;
+ QDomElement prods = doc.createElement("list");
+ prods.appendChild(doc.importNode(producer, true));
+
+
+ kDebug()<<"////// ADDING PRODUCER:\n "<<doc.toString()<<"\n+++++++++++++++++";
+ int id = producer.attribute("id").toInt();
+ if (id >= m_clipIdCounter) m_clipIdCounter = id + 1;
+
if (type == DocClipBase::AUDIO || type == DocClipBase::VIDEO || type == DocClipBase::AV)
{
KUrl resource = KUrl(producer.attribute("resource"));
QStringList itemEntry;
itemEntry.append(QString::null);
itemEntry.append(resource.fileName());
+ addClip(itemEntry, producer, id, resource);
+ /*AddClipCommand *command = new AddClipCommand(this, itemEntry, producer, id, resource, true);
+ m_commandStack->push(command);*/
- AddClipCommand *command = new AddClipCommand(this, itemEntry, producer, producer.attribute("id").toInt(), resource, true);
- m_commandStack->push(command);
/*ProjectItem *item = new ProjectItem(listView, itemEntry, producer);
item->setData(1, FullPathRole, resource.path());
QStringList itemEntry;
itemEntry.append(QString::null);
itemEntry.append(producer.attribute("name"));
-
- AddClipCommand *command = new AddClipCommand(this, itemEntry, producer, producer.attribute("id").toInt(), KUrl(), true);
- m_commandStack->push(command);
+ addClip(itemEntry, producer, id, KUrl());
+ /*AddClipCommand *command = new AddClipCommand(this, itemEntry, producer, id, KUrl(), true);
+ m_commandStack->push(command);*/
//ProjectItem *item = new ProjectItem(listView, itemEntry, producer);
/*item->setIcon(0, QIcon(pix));
item->setData(1, ClipTypeRole, (int) type);*/
Q_OBJECT
public:
- ProjectList(KUndoStack *commandStack, QWidget *parent=0);
+ ProjectList(QWidget *parent=0);
QDomElement producersList();
void setRenderer(Render *projectRender);
QToolBar *m_toolbar;
KUndoStack *m_commandStack;
int m_clipIdCounter;
+ void selectItemById(const int clipId);
private slots:
void slotAddClip();