#define ID_TIMELINE_POS 6
#define ID_TIMELINE_FORMAT 7
+EffectsList MainWindow::videoEffects;
+EffectsList MainWindow::audioEffects;
+EffectsList MainWindow::customEffects;
+EffectsList MainWindow::transitions;
+
MainWindow::MainWindow(QWidget *parent)
: KXmlGuiWindow(parent),
m_activeDocument(NULL), m_activeTimeline(NULL), m_renderWidget(NULL), m_jogProcess(NULL) {
m_timelineArea->setCornerWidget(closeTabButton);
connect(m_timelineArea, SIGNAL(currentChanged(int)), this, SLOT(activateDocument()));
- initEffects::parseEffectFiles(&m_audioEffects, &m_videoEffects, &m_transitions);
+ initEffects::parseEffectFiles();
m_monitorManager = new MonitorManager();
projectListDock = new QDockWidget(i18n("Project Tree"), this);
effectListDock = new QDockWidget(i18n("Effect List"), this);
effectListDock->setObjectName("effect_list");
- m_effectList = new EffectsListView(&m_audioEffects, &m_videoEffects, &m_customEffects);
+ m_effectList = new EffectsListView();
//m_effectList = new KListWidget(this);
effectListDock->setWidget(m_effectList);
effectStackDock = new QDockWidget(i18n("Effect Stack"), this);
effectStackDock->setObjectName("effect_stack");
- effectStack = new EffectStackView(&m_audioEffects, &m_videoEffects, &m_customEffects, this);
+ effectStack = new EffectStackView(this);
effectStackDock->setWidget(effectStack);
addDockWidget(Qt::TopDockWidgetArea, effectStackDock);
transitionConfigDock = new QDockWidget(i18n("Transition"), this);
transitionConfigDock->setObjectName("transition");
- transitionConfig = new TransitionSettings(&m_transitions, this);
+ transitionConfig = new TransitionSettings(this);
transitionConfigDock->setWidget(transitionConfig);
addDockWidget(Qt::TopDockWidgetArea, transitionConfigDock);
tabifyDockWidget(clipMonitorDock, projectMonitorDock);
setCentralWidget(m_timelineArea);
- m_timecodeFormat = new KComboBox(this);
- m_timecodeFormat->addItem(i18n("hh:mm:ss::ff"));
- m_timecodeFormat->addItem(i18n("Frames"));
-
- statusProgressBar = new QProgressBar(this);
- statusProgressBar->setMinimum(0);
- statusProgressBar->setMaximum(100);
- statusProgressBar->setMaximumWidth(150);
- statusProgressBar->setVisible(false);
- statusLabel = new QLabel(this);
-
- QWidget *w = new QWidget;
- timeline_buttons_ui.setupUi(w);
- timeline_buttons_ui.buttonVideo->setDown(KdenliveSettings::videothumbnails());
- timeline_buttons_ui.buttonAudio->setDown(KdenliveSettings::audiothumbnails());
- connect(timeline_buttons_ui.buttonVideo, SIGNAL(clicked()), this, SLOT(slotSwitchVideoThumbs()));
- connect(timeline_buttons_ui.buttonAudio, SIGNAL(clicked()), this, SLOT(slotSwitchAudioThumbs()));
- connect(timeline_buttons_ui.buttonFitZoom, SIGNAL(clicked()), this, SLOT(slotFitZoom()));
-
- statusBar()->insertPermanentWidget(0, statusProgressBar, 1);
- statusBar()->insertPermanentWidget(1, statusLabel, 1);
- statusBar()->insertPermanentWidget(ID_TIMELINE_BUTTONS, w);
- statusBar()->insertPermanentFixedItem("00:00:00:00", ID_TIMELINE_POS);
- statusBar()->insertPermanentWidget(ID_TIMELINE_FORMAT, m_timecodeFormat);
- statusBar()->setMaximumHeight(statusBar()->font().pointSize() * 4);
-
- timeline_buttons_ui.buttonVideo->setIcon(KIcon("video-mpeg"));
- timeline_buttons_ui.buttonVideo->setToolTip(i18n("Show video thumbnails"));
- timeline_buttons_ui.buttonAudio->setIcon(KIcon("audio-mpeg"));
- timeline_buttons_ui.buttonAudio->setToolTip(i18n("Show audio thumbnails"));
- timeline_buttons_ui.buttonFitZoom->setIcon(KIcon("zoom-fit-best"));
- timeline_buttons_ui.buttonFitZoom->setToolTip(i18n("Fit zoom to project"));
-
setupGUI(Default, NULL /*"kdenliveui.rc"*/);
kDebug() << factory() << " " << factory()->container("video_effects_menu", this);
// build effects menus
QAction *action;
QMenu *videoEffectsMenu = (QMenu*)(factory()->container("video_effects_menu", this));
- QStringList effects = m_videoEffects.effectNames();
+ QStringList effects = videoEffects.effectNames();
foreach(QString name, effects) {
action = new QAction(name, this);
action->setData(name);
videoEffectsMenu->addAction(action);
}
QMenu *audioEffectsMenu = (QMenu*)(factory()->container("audio_effects_menu", this));
- effects = m_audioEffects.effectNames();
+ effects = audioEffects.effectNames();
foreach(QString name, effects) {
action = new QAction(name, this);
action->setData(name);
audioEffectsMenu->addAction(action);
}
QMenu *customEffectsMenu = (QMenu*)(factory()->container("custom_effects_menu", this));
- effects = m_customEffects.effectNames();
+ effects = customEffects.effectNames();
foreach(QString name, effects) {
action = new QAction(name, this);
action->setData(name);
}
void MainWindow::setupActions() {
+
+ m_timecodeFormat = new KComboBox(this);
+ m_timecodeFormat->addItem(i18n("hh:mm:ss::ff"));
+ m_timecodeFormat->addItem(i18n("Frames"));
+
+ statusProgressBar = new QProgressBar(this);
+ statusProgressBar->setMinimum(0);
+ statusProgressBar->setMaximum(100);
+ statusProgressBar->setMaximumWidth(150);
+ statusProgressBar->setVisible(false);
+ statusLabel = new QLabel(this);
+
+ QWidget *w = new QWidget;
+
+ QHBoxLayout *layout = new QHBoxLayout;
+ w->setLayout(layout);
+ layout->setContentsMargins(5, 0, 5, 0);
+ QToolBar *toolbar = new QToolBar("statusToolBar", this);
+ w->setMinimumHeight(34);
+
+ m_toolGroup = new QActionGroup(this);
+
+ m_buttonSelectTool = toolbar->addAction(KIcon("kdenlive-select-tool"), i18n("Selection tool"));
+ m_buttonSelectTool->setCheckable(true);
+ m_buttonSelectTool->setChecked(true);
+
+ m_buttonRazorTool = toolbar->addAction(KIcon("edit-cut"), i18n("Razor tool"));
+ m_buttonRazorTool->setCheckable(true);
+ m_buttonRazorTool->setChecked(false);
+
+ m_toolGroup->addAction(m_buttonSelectTool);
+ m_toolGroup->addAction(m_buttonRazorTool);
+ m_toolGroup->setExclusive(true);
+ connect(m_toolGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeTool(QAction *)));
+
+ toolbar->addSeparator();
+ m_buttonFitZoom = toolbar->addAction(KIcon("zoom-fit-best"), i18n("Fit zoom to project"));
+ m_buttonFitZoom->setCheckable(false);
+ connect(m_buttonFitZoom, SIGNAL(triggered()), this, SLOT(slotFitZoom()));
+
+ m_zoomSlider = new QSlider(Qt::Horizontal, this);
+ m_zoomSlider->setMaximum(13);
+ m_zoomSlider->setMaximumHeight(34);
+ m_zoomSlider->setMaximumWidth(150);
+ m_zoomSlider->setMinimumWidth(100);
+ toolbar->addWidget(m_zoomSlider);
+
+ m_buttonVideoThumbs = toolbar->addAction(KIcon("video-mpeg"), i18n("Show videoo thumbnails"));
+ m_buttonVideoThumbs->setCheckable(true);
+ m_buttonVideoThumbs->setChecked(KdenliveSettings::audiothumbnails());
+ connect(m_buttonVideoThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchVideoThumbs()));
+
+ m_buttonAudioThumbs = toolbar->addAction(KIcon("audio-mpeg"), i18n("Show audio thumbnails"));
+ m_buttonAudioThumbs->setCheckable(true);
+ m_buttonAudioThumbs->setChecked(KdenliveSettings::videothumbnails());
+ connect(m_buttonAudioThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchAudioThumbs()));
+ layout->addWidget(toolbar);
+
+ statusBar()->insertPermanentWidget(0, statusProgressBar, 1);
+ statusBar()->insertPermanentWidget(1, statusLabel, 1);
+ statusBar()->insertPermanentWidget(ID_TIMELINE_BUTTONS, w);
+ statusBar()->insertPermanentFixedItem("00:00:00:00", ID_TIMELINE_POS);
+ statusBar()->insertPermanentWidget(ID_TIMELINE_FORMAT, m_timecodeFormat);
+ statusBar()->setMaximumHeight(statusBar()->font().pointSize() * 4);
+
+ actionCollection()->addAction("select_tool", m_buttonSelectTool);
+ actionCollection()->addAction("razor_tool", m_buttonRazorTool);
+
KAction* clearAction = new KAction(this);
clearAction->setText(i18n("Clear"));
clearAction->setIcon(KIcon("document-new"));
actionCollection()->addAction("monitor_seek_forward-one-frame", monitorSeekForwardOneFrame);
connect(monitorSeekForwardOneFrame, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotForwardOneFrame()));
- KAction* deleteTimelineClip = new KAction(this);
- deleteTimelineClip->setText(i18n("Delete Clip"));
+ KAction* deleteTimelineClip = new KAction(KIcon("edit-delete"), i18n("Delete Clip"), this);
deleteTimelineClip->setShortcut(Qt::Key_Delete);
- deleteTimelineClip->setIcon(KIcon("edit-delete"));
actionCollection()->addAction("delete_timeline_clip", deleteTimelineClip);
connect(deleteTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotDeleteTimelineClip()));
+ KAction* cutTimelineClip = new KAction(KIcon("edit-cut"), i18n("Cut Clip"), this);
+ cutTimelineClip->setShortcut(Qt::SHIFT + Qt::Key_R);
+ actionCollection()->addAction("cut_timeline_clip", cutTimelineClip);
+ connect(cutTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotCutTimelineClip()));
+
KStandardAction::quit(this, SLOT(queryQuit()),
actionCollection());
void MainWindow::newFile() {
QString profileName;
+ KUrl projectFolder;
if (m_timelineArea->count() == 0) profileName = KdenliveSettings::default_profile();
else {
ProjectSettings *w = new ProjectSettings;
- w->exec();
+ if (w->exec() != QDialog::Accepted) return;
profileName = w->selectedProfile();
+ projectFolder = w->selectedFolder();
delete w;
}
MltVideoProfile prof = ProfilesDialog::getVideoProfile(profileName);
if (prof.width == 0) prof = ProfilesDialog::getVideoProfile("dv_pal");
- KdenliveDoc *doc = new KdenliveDoc(KUrl(), prof, m_commandStack);
+ KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, prof, m_commandStack);
TrackView *trackView = new TrackView(doc, this);
m_timelineArea->addTab(trackView, KIcon("kdenlive"), i18n("Untitled") + " / " + prof.description);
if (m_timelineArea->count() == 1)
//TODO: get video profile from url before opening it
MltVideoProfile prof = ProfilesDialog::getVideoProfile(KdenliveSettings::default_profile());
if (prof.width == 0) prof = ProfilesDialog::getVideoProfile("dv_pal");
- KdenliveDoc *doc = new KdenliveDoc(url, prof, m_commandStack);
+ KdenliveDoc *doc = new KdenliveDoc(url, KUrl(), prof, m_commandStack);
TrackView *trackView = new TrackView(doc, this);
m_timelineArea->setCurrentIndex(m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description()));
m_timelineArea->setTabToolTip(m_timelineArea->currentIndex(), doc->url().path());
void MainWindow::parseProfiles() {
//kdDebug()<<" + + YOUR MLT INSTALL WAS FOUND IN: "<< MLT_PREFIX <<endl;
+
+ //KdenliveSettings::setDefaulttmpfolder();
if (KdenliveSettings::mltpath().isEmpty()) {
KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
}
disconnect(m_activeDocument, SIGNAL(addProjectFolder(const QString, int, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, int, bool, bool)));
disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(int)), m_projectList, SLOT(slotDeleteClip(int)));
disconnect(m_activeDocument, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int)));
+ disconnect(m_activeDocument, SIGNAL(refreshClipThumbnail(int)), m_projectList, SLOT(slotRefreshClipThumbnail(int)));
disconnect(m_activeDocument, SIGNAL(deletTimelineClip(int)), m_activeTimeline, SLOT(slotDeleteClip(int)));
disconnect(m_activeDocument, SIGNAL(thumbsProgress(KUrl, int)), this, SLOT(slotGotProgressInfo(KUrl, int)));
disconnect(m_activeTimeline, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
+ disconnect(trackView, SIGNAL(clipItemSelected(ClipItem*)), this, SLOT(slotActivateEffectStackView()));
disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*)));
- disconnect(timeline_buttons_ui.zoom_slider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
+ disconnect(trackView, SIGNAL(transitionItemSelected(Transition*)), this, SLOT(slotActivateTransitionView()));
+ disconnect(m_zoomSlider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
disconnect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
disconnect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
disconnect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
disconnect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
- disconnect(transitionConfig, SIGNAL(transitionUpdated(QDomElement, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(QDomElement, QDomElement)));
+ disconnect(transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
}
m_activeDocument->setRenderer(NULL);
connect(doc, SIGNAL(addProjectFolder(const QString, int, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, int, bool, bool)));
connect(doc, SIGNAL(signalDeleteProjectClip(int)), m_projectList, SLOT(slotDeleteClip(int)));
connect(doc, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int)));
+ connect(doc, SIGNAL(refreshClipThumbnail(int)), m_projectList, SLOT(slotRefreshClipThumbnail(int)));
+
connect(doc, SIGNAL(deletTimelineClip(int)), trackView, SLOT(slotDeleteClip(int)));
connect(doc, SIGNAL(thumbsProgress(KUrl, int)), this, SLOT(slotGotProgressInfo(KUrl, int)));
connect(doc, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
+
+
connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
+ connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), this, SLOT(slotActivateEffectStackView()));
connect(trackView, SIGNAL(transitionItemSelected(Transition*)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*)));
- timeline_buttons_ui.zoom_slider->setValue(trackView->currentZoom());
- connect(timeline_buttons_ui.zoom_slider, SIGNAL(valueChanged(int)), trackView, SLOT(slotChangeZoom(int)));
+ connect(trackView, SIGNAL(transitionItemSelected(Transition*)), this, SLOT(slotActivateTransitionView()));
+ m_zoomSlider->setValue(trackView->currentZoom());
+ connect(m_zoomSlider, SIGNAL(valueChanged(int)), trackView, SLOT(slotChangeZoom(int)));
connect(trackView->projectView(), SIGNAL(zoomIn()), this, SLOT(slotZoomIn()));
connect(trackView->projectView(), SIGNAL(zoomOut()), this, SLOT(slotZoomOut()));
connect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
connect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
connect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
connect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
- connect(transitionConfig, SIGNAL(transitionUpdated(QDomElement, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(QDomElement, QDomElement)));
+ connect(transitionConfig, SIGNAL(transitionUpdated(Transition *, QDomElement)), trackView->projectView() , SLOT(slotTransitionUpdated(Transition *, QDomElement)));
connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu);
m_activeTimeline = trackView;
currentTab->projectView()->checkTrackHeight();
if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
}
- timeline_buttons_ui.buttonAudio->setDown(KdenliveSettings::audiothumbnails());
- timeline_buttons_ui.buttonVideo->setDown(KdenliveSettings::videothumbnails());
+ m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
+ m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
activateShuttleDevice();
}
if (currentTab) {
currentTab->refresh();
}
- timeline_buttons_ui.buttonVideo->setDown(KdenliveSettings::videothumbnails());
+ m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
}
void MainWindow::slotSwitchAudioThumbs() {
currentTab->projectView()->checkAutoScroll();
if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
}
- timeline_buttons_ui.buttonAudio->setDown(KdenliveSettings::audiothumbnails());
+ m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
}
void MainWindow::slotDeleteTimelineClip() {
}
}
+void MainWindow::slotCutTimelineClip() {
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab) {
+ currentTab->projectView()->cutSelectedClips();
+ }
+}
+
void MainWindow::slotAddProjectClip(KUrl url) {
if (m_activeDocument)
m_activeDocument->slotAddClipFile(url, QString());
void MainWindow::slotAddVideoEffect(QAction *result) {
if (!result) return;
- QDomElement effect = m_videoEffects.getEffectByName(result->data().toString());
+ QDomElement effect = videoEffects.getEffectByName(result->data().toString());
slotAddEffect(effect);
}
void MainWindow::slotAddAudioEffect(QAction *result) {
if (!result) return;
- QDomElement effect = m_audioEffects.getEffectByName(result->data().toString());
+ QDomElement effect = audioEffects.getEffectByName(result->data().toString());
slotAddEffect(effect);
}
void MainWindow::slotAddCustomEffect(QAction *result) {
if (!result) return;
- QDomElement effect = m_customEffects.getEffectByName(result->data().toString());
+ QDomElement effect = customEffects.getEffectByName(result->data().toString());
slotAddEffect(effect);
}
void MainWindow::slotZoomIn() {
- timeline_buttons_ui.zoom_slider->setValue(timeline_buttons_ui.zoom_slider->value() - 1);
+ m_zoomSlider->setValue(m_zoomSlider->value() - 1);
}
void MainWindow::slotZoomOut() {
- timeline_buttons_ui.zoom_slider->setValue(timeline_buttons_ui.zoom_slider->value() + 1);
+ m_zoomSlider->setValue(m_zoomSlider->value() + 1);
}
void MainWindow::slotFitZoom() {
TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
if (currentTab) {
- timeline_buttons_ui.zoom_slider->setValue(currentTab->fitZoom());
+ m_zoomSlider->setValue(currentTab->fitZoom());
}
}
}
void MainWindow::slotShowClipProperties(DocClipBase *clip) {
+ if (clip->clipType() == TEXT) {
+ m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
+ return;
+ }
ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
if (dia.exec() == QDialog::Accepted) {
m_projectList->slotUpdateClipProperties(dia.clipId(), dia.properties());
kDebug() << "RECIEVED JOG EVEMNT!!!";
}
}
+void MainWindow::slotActivateEffectStackView() {
+ effectStack->raiseWindow(effectStackDock);
+}
+
+void MainWindow::slotActivateTransitionView() {
+ transitionConfig->raiseWindow(transitionConfigDock);
+}
+
+void MainWindow::slotChangeTool(QAction * action) {
+ if (action == m_buttonSelectTool) slotSetTool(SELECTTOOL);
+ else if (action == m_buttonRazorTool) slotSetTool(RAZORTOOL);
+}
+void MainWindow::slotSetTool(PROJECTTOOL tool) {
+ if (m_activeDocument) {
+ //m_activeDocument->setTool(tool);
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ currentTab->projectView()->setTool(tool);
+ }
+}
#include "mainwindow.moc"