widgets/templateclip_ui.ui
widgets/keyframeeditor_ui.ui
widgets/timecodedisplay_ui.ui
+ widgets/tracksconfigdialog_ui.ui
)
set(kdenlive_SRCS
kis_cubic_curve.cpp
kis_curve_widget.cpp
timecodedisplay.cpp
+ tracksconfigdialog.cpp
+ configtrackscommand.cpp
)
add_definitions( ${KDE4_DEFINITIONS} )
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.de) *
+ * *
+ * 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 "configtrackscommand.h"
+#include "customtrackview.h"
+
+#include <KLocale>
+
+ConfigTracksCommand::ConfigTracksCommand(CustomTrackView* view, QList< TrackInfo > oldInfos, QList< TrackInfo > newInfos, QUndoCommand* parent) :
+ QUndoCommand(parent),
+ m_view(view),
+ m_oldInfos(oldInfos),
+ m_newInfos(newInfos)
+{
+ setText(i18n("Configure Tracks"));
+}
+
+// virtual
+void ConfigTracksCommand::undo()
+{
+ m_view->configTracks(m_oldInfos);
+}
+
+// virtual
+void ConfigTracksCommand::redo()
+{
+ m_view->configTracks(m_newInfos);
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.de) *
+ * *
+ * 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 CONFIGTRACKSCOMMAND_H
+#define CONFIGTRACKSCOMMAND_H
+
+#include <QUndoCommand>
+#include <QGraphicsView>
+#include <QPointF>
+
+#include <KDebug>
+#include "definitions.h"
+
+class CustomTrackView;
+
+class ConfigTracksCommand : public QUndoCommand
+{
+public:
+ ConfigTracksCommand(CustomTrackView *view, QList <TrackInfo> oldInfos, QList <TrackInfo> newInfos, QUndoCommand * parent = 0);
+ virtual void undo();
+ virtual void redo();
+
+private:
+ CustomTrackView *m_view;
+ QList <TrackInfo> m_oldInfos;
+ QList <TrackInfo> m_newInfos;
+};
+
+#endif
#include "splitaudiocommand.h"
#include "changecliptypecommand.h"
#include "trackdialog.h"
+#include "tracksconfigdialog.h"
+#include "configtrackscommand.h"
#include <KDebug>
#include <KLocale>
viewport()->update();
}
+void CustomTrackView::configTracks(QList < TrackInfo > trackInfos)
+{
+ for (int i = 0; i < trackInfos.count(); ++i) {
+ m_document->setTrackType(i, trackInfos.at(i));
+ m_document->renderer()->mltChangeTrackState(i + 1, m_document->trackInfoAt(i).isMute, m_document->trackInfoAt(i).isBlind);
+ }
+
+ QTimer::singleShot(300, this, SIGNAL(trackHeightChanged()));
+ viewport()->update();
+}
void CustomTrackView::slotSwitchTrackAudio(int ix)
{
GenTime spaceDuration = d.selectedDuration();
track = d.selectedTrack();
+ // TODO: Make "All Tracks" work
+ if (track == -1)
+ return;
+
if (m_document->isTrackLocked(m_document->tracksCount() - track - 1)) {
emit displayMessage(i18n("Cannot insert space in a locked track"), ErrorMessage);
return;
}
}
+void CustomTrackView::slotConfigTracks(int ix)
+{
+ TracksConfigDialog d(m_document, ix, parentWidget());
+ if (d.exec() == QDialog::Accepted) {
+ ConfigTracksCommand *configTracks = new ConfigTracksCommand(this, m_document->tracksList(), d.tracksList());
+ m_commandStack->push(configTracks);
+ setDocumentModified();
+ }
+}
void CustomTrackView::deleteTimelineTrack(int ix, TrackInfo trackinfo)
{
void addTrack(TrackInfo type, int ix = -1);
void removeTrack(int ix);
void changeTrack(int ix, TrackInfo type);
+ /** @brief Makes the document use new track infos (name, type, ...). */
+ void configTracks(QList <TrackInfo> trackInfos);
int cursorPos();
void checkAutoScroll();
void moveClip(const ItemInfo start, const ItemInfo end, bool refresh);
void clipEnd();
void changeClipSpeed();
void doChangeClipSpeed(ItemInfo info, ItemInfo speedIndependantInfo, const double speed, const double oldspeed, int strobe, const QString &id);
+ /** @brief Sets the document as modified. */
void setDocumentModified();
void setInPoint();
void setOutPoint();
void slotInsertTrack(int ix);
void slotDeleteTrack(int ix);
void slotChangeTrack(int ix);
+ /** @brief Shows the configure tracks dialog. */
+ void slotConfigTracks(int ix);
void clipNameChanged(const QString id, const QString name);
void slotTrackUp();
void slotTrackDown();
}
}
- if (missingClips.isEmpty() && missingLumas.isEmpty()) {
+ if (missingClips.isEmpty() && missingLumas.isEmpty())
return false;
- }
+
m_dialog = new QDialog();
m_dialog->setFont(KGlobalSettings::toolBarFont());
m_ui.setupUi(m_dialog);
QWidget::mousePressEvent(event);
}
+void HeaderTrack::mouseDoubleClickEvent(QMouseEvent* event)
+{
+ emit configTrack(m_index);
+ QWidget::mouseDoubleClickEvent(event);
+}
+
void HeaderTrack::setSelectedIndex(int ix)
{
if (m_index == ix) {
protected:
virtual void mousePressEvent(QMouseEvent * event);
+ virtual void mouseDoubleClickEvent(QMouseEvent * event);
private:
int m_index;
void changeTrack(int);
void renameTrack(int);
void selectTrack(int);
+ void configTrack(int);
};
#endif
disconnect(m_activeTimeline, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
disconnect(m_activeTimeline, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
disconnect(m_activeTimeline, SIGNAL(changeTrack(int)), this, SLOT(slotChangeTrack(int)));
+ disconnect(m_activeTimeline, SIGNAL(configTrack(int)), this, SLOT(slotConfigTrack(int)));
disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
disconnect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
disconnect(m_effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
connect(trackView, SIGNAL(insertTrack(int)), this, SLOT(slotInsertTrack(int)));
connect(trackView, SIGNAL(deleteTrack(int)), this, SLOT(slotDeleteTrack(int)));
connect(trackView, SIGNAL(changeTrack(int)), this, SLOT(slotChangeTrack(int)));
+ connect(trackView, SIGNAL(configTrack(int)), this, SLOT(slotConfigTrack(int)));
connect(trackView, SIGNAL(updateTracksInfo()), this, SLOT(slotUpdateTrackInfo()));
connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
m_activeTimeline->projectView()->slotChangeTrack(ix);
}
+void MainWindow::slotConfigTrack(int ix)
+{
+ m_projectMonitor->activateMonitor();
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->slotConfigTracks(ix);
+ if (m_activeDocument)
+ m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
+}
+
void MainWindow::slotEditGuide()
{
if (m_activeTimeline)
QString getMimeType();
public slots:
+ /** @brief Prepares opening @param url.
+ *
+ * Checks if already open and whether backup exists */
void openFile(const KUrl &url);
void slotGotProgressInfo(const QString &message, int progress);
Q_SCRIPTABLE void setRenderingProgress(const QString &url, int progress);
void queryQuit();
void activateDocument();
void connectDocument(TrackView*, KdenliveDoc*);
+ /** @brief Shows file open dialog. */
void openFile();
void openLastFile();
/** @brief Checks whether a URL is available to save to.
void slotInsertTrack(int ix = 0);
void slotDeleteTrack(int ix = 0);
void slotChangeTrack(int ix = 0);
+ /** @brief Shows the configure tracks dialog and updates transitions afterwards. */
+ void slotConfigTrack(int ix = -1);
void slotGetNewLumaStuff();
void slotGetNewTitleStuff();
void slotGetNewRenderStuff();
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.de) *
+ * *
+ * 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 "tracksconfigdialog.h"
+#include "kdenlivedoc.h"
+
+#include <QTableWidget>
+#include <QComboBox>
+#include <KDebug>
+
+TracksDelegate::TracksDelegate(QObject *parent) :
+ QItemDelegate(parent)
+{
+}
+
+QWidget *TracksDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & /* option */, const QModelIndex & /*index*/) const
+{
+ QComboBox *comboBox = new QComboBox(parent);
+ comboBox->addItem(i18n("Video"));
+ comboBox->addItem(i18n("Audio"));
+ connect(comboBox, SIGNAL(activated(int)), this, SLOT(emitCommitData()));
+ return comboBox;
+}
+
+void TracksDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
+{
+ QComboBox *comboBox = qobject_cast<QComboBox *>(editor);
+ if (!comboBox)
+ return;
+ int pos = comboBox->findText(index.model()->data(index).toString(), Qt::MatchExactly);
+ comboBox->setCurrentIndex(pos);
+}
+
+void TracksDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
+{
+ QComboBox *comboBox = qobject_cast<QComboBox *>(editor);
+ if (!comboBox)
+ return;
+ model->setData(index, comboBox->currentText());
+}
+
+void TracksDelegate::emitCommitData()
+{
+ emit commitData(qobject_cast<QWidget *>(sender()));
+}
+
+
+TracksConfigDialog::TracksConfigDialog(KdenliveDoc * doc, int selected, QWidget* parent) :
+ QDialog(parent),
+ m_doc(doc)
+{
+ setupUi(this);
+
+ table->setColumnCount(5);
+ table->setHorizontalHeaderLabels(QStringList() << i18n("Name") << i18n("Type") << i18n("Hidden") << i18n("Muted") << i18n("Locked"));
+ table->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
+ table->horizontalHeader()->setResizeMode(1, QHeaderView::Fixed);
+ table->horizontalHeader()->setResizeMode(2, QHeaderView::Fixed);
+ table->horizontalHeader()->setResizeMode(3, QHeaderView::Fixed);
+ table->horizontalHeader()->setResizeMode(4, QHeaderView::Fixed);
+
+ table->setItemDelegateForColumn(1, new TracksDelegate(this));
+
+ setupOriginal(selected);
+ connect(table, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(slotUpdateRow(QTableWidgetItem *)));
+}
+
+const QList <TrackInfo> TracksConfigDialog::tracksList()
+{
+ QList <TrackInfo> tracks;
+ TrackInfo info;
+ for (int i = table->rowCount() - 1; i >= 0; i--) {
+ info.trackName = table->item(i, 0)->text();
+ QTableWidgetItem *item = table->item(i, 1);
+ if (item->text() == i18n("Audio")) {
+ info.type = AUDIOTRACK;
+ info.isBlind = true;
+ } else {
+ info.type = VIDEOTRACK;
+ info.isBlind = (table->item(i, 2)->checkState() == Qt::Checked);
+ }
+ info.isMute = (table->item(i, 3)->checkState() == Qt::Checked);
+ info.isLocked = (table->item(i, 4)->checkState() == Qt::Checked);
+ tracks << info;
+ }
+ return tracks;
+}
+
+void TracksConfigDialog::setupOriginal(int selected)
+{
+ table->setRowCount(m_doc->tracksCount());
+
+ QStringList numbers;
+ TrackInfo info;
+ for (int i = m_doc->tracksCount() - 1; i >= 0; i--) {
+ numbers << QString::number(i);
+ info = m_doc->trackInfoAt(m_doc->tracksCount() - i - 1);
+ table->setItem(i, 0, new QTableWidgetItem(info.trackName));
+
+ QTableWidgetItem *item1 = new QTableWidgetItem(i18n("Video"));
+ if (info.type == AUDIOTRACK)
+ item1->setText(i18n("Audio"));
+ table->setItem(i, 1, item1);
+ table->openPersistentEditor(item1);
+
+ QTableWidgetItem *item2 = new QTableWidgetItem("");
+ item2->setFlags(item2->flags() & ~Qt::ItemIsEditable);
+ item2->setCheckState(info.isBlind ? Qt::Checked : Qt::Unchecked);
+ if (info.type == AUDIOTRACK)
+ item2->setFlags(item2->flags() & ~Qt::ItemIsEnabled);
+ table->setItem(i, 2, item2);
+
+ QTableWidgetItem *item3 = new QTableWidgetItem("");
+ item3->setFlags(item3->flags() & ~Qt::ItemIsEditable);
+ item3->setCheckState(info.isMute ? Qt::Checked : Qt::Unchecked);
+ table->setItem(i, 3, item3);
+
+ QTableWidgetItem *item4 = new QTableWidgetItem("");
+ item4->setFlags(item4->flags() & ~Qt::ItemIsEditable);
+ item4->setCheckState(info.isLocked ? Qt::Checked : Qt::Unchecked);
+ table->setItem(i, 4, item4);
+ }
+ table->setVerticalHeaderLabels(numbers);
+
+ table->resizeColumnsToContents();
+ if (selected != -1)
+ table->selectRow(selected);
+}
+
+void TracksConfigDialog::slotUpdateRow(QTableWidgetItem* item)
+{
+ if (table->column(item) == 1) {
+ QTableWidgetItem *item2 = table->item(table->row(item), 2);
+ if (item->text() == i18n("Audio")) {
+ item2->setFlags(item2->flags() & ~Qt::ItemIsEnabled);
+ item2->setCheckState(Qt::Checked);
+ } else {
+ item2->setFlags(item2->flags() | Qt::ItemIsEnabled);
+ item2->setCheckState(Qt::Unchecked);
+ }
+ }
+}
+
+#include "tracksconfigdialog.moc"
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.de) *
+ * *
+ * 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 TRACKSCONFIGDIALOG_H
+#define TRACKSCONFIGDIALOG_H
+
+#include "ui_tracksconfigdialog_ui.h"
+
+#include <QItemDelegate>
+
+class TracksDelegate : public QItemDelegate
+{
+ Q_OBJECT
+public:
+ TracksDelegate(QObject *parent = 0);
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const;
+ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
+private slots:
+ void emitCommitData();
+};
+
+
+struct TrackInfo;
+class KdenliveDoc;
+class QTableWidgetItem;
+
+/**
+ * @class TracksConfigDialog
+ * @brief A dialog to change the name, type, ... of tracks.
+ * @author Till Theato
+ */
+
+class TracksConfigDialog : public QDialog, public Ui::TracksConfigDialog_UI
+{
+ Q_OBJECT
+public:
+ /** @brief Sets up the table.
+ * @param doc the kdenlive document whose tracks to use
+ * @param selected the track which should be selected by default
+ * @param parent the parent widget */
+ TracksConfigDialog(KdenliveDoc * doc, int selected = -1, QWidget * parent = 0);
+
+ /** @brief Returns the new list of tracks created from the table. */
+ const QList <TrackInfo> tracksList();
+
+private slots:
+ /** @brief Updates the "hidden" checkbox if type was changed. */
+ void slotUpdateRow(QTableWidgetItem *item);
+
+private:
+ /** @brief Recreates the table from the list of tracks in m_doc. */
+ void setupOriginal(int selected = -1);
+ KdenliveDoc *m_doc;
+};
+
+#endif
connect(header, SIGNAL(insertTrack(int)), this, SIGNAL(insertTrack(int)));
connect(header, SIGNAL(changeTrack(int)), this, SIGNAL(changeTrack(int)));
connect(header, SIGNAL(renameTrack(int)), this, SLOT(slotRenameTrack(int)));
+ connect(header, SIGNAL(configTrack(int)), this, SIGNAL(configTrack(int)));
headers_container->layout()->addWidget(header);
}
frame = new QFrame(this);
private slots:
void setCursorPos(int pos);
void moveCursorPos(int pos);
- /** @brief Rebuild the track headers */
+ /** @brief Rebuilds the track headers */
void slotRebuildTrackHeaders();
/** @brief The tracks count or a track name changed, rebuild and notify */
void slotReloadTracks();
void insertTrack(int);
void deleteTrack(int);
void changeTrack(int);
+ void configTrack(int);
void updateTracksInfo();
void setZoom(int);
};
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>TracksConfigDialog_UI</class>
+ <widget class="QDialog" name="TracksConfigDialog_UI">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>508</width>
+ <height>305</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Configure Tracks</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <property name="modal">
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="1" column="0">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QTableWidget" name="table">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>TracksConfigDialog_UI</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>TracksConfigDialog_UI</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>