static const char version[] = VERSION;
-static const int ID_TIMELINE_POS = 0;
namespace Mlt
{
class Producer;
viewMenu->addAction(guiActions->addAction(viewActions.at(i).first, viewActions.at(i).second));
// Populate encoding profiles
- KConfig conf("encodingprofiles.rc", KConfig::FullConfig, "appdata");
+ KConfig conf("encodingprofiles.rc", KConfig::CascadeConfig, "appdata");
if (KdenliveSettings::proxyparams().isEmpty() || KdenliveSettings::proxyextension().isEmpty()) {
KConfigGroup group(&conf, "proxy");
QMap< QString, QString > values = group.entryMap();
KdenliveSettings::setV4l_extension(data.section(';', 1, 1));
}
}
+ if (KdenliveSettings::grab_parameters().isEmpty() || KdenliveSettings::grab_extension().isEmpty()) {
+ KConfigGroup group(&conf, "screengrab");
+ QMap< QString, QString > values = group.entryMap();
+ QMapIterator<QString, QString> i(values);
+ if (i.hasNext()) {
+ i.next();
+ QString data = i.value();
+ KdenliveSettings::setGrab_parameters(data.section(';', 0, 0));
+ KdenliveSettings::setGrab_extension(data.section(';', 1, 1));
+ }
+ }
if (KdenliveSettings::decklink_parameters().isEmpty() || KdenliveSettings::decklink_extension().isEmpty()) {
KConfigGroup group(&conf, "decklink");
QMap< QString, QString > values = group.entryMap();
void MainWindow::setupActions()
{
-
NameGrabbingKActionCollection collection(actionCollection(), m_action_names);
- m_timecodeFormat = new KComboBox(this);
- m_timecodeFormat->addItem(i18n("hh:mm:ss:ff"));
- m_timecodeFormat->addItem(i18n("Frames"));
- if (KdenliveSettings::frametimecode()) m_timecodeFormat->setCurrentIndex(1);
- connect(m_timecodeFormat, SIGNAL(activated(int)), this, SLOT(slotUpdateTimecodeFormat(int)));
-
m_statusProgressBar = new QProgressBar(this);
m_statusProgressBar->setMinimum(0);
m_statusProgressBar->setMaximum(100);
setStatusBarStyleSheet(palette());
QString styleBorderless = "QToolButton { border-width: 0px;margin: 1px 3px 0px;padding: 0px;}";
-
+
//create edit mode buttons
m_normalEditTool = new KAction(KIcon("kdenlive-normal-edit"), i18n("Normal mode"), this);
m_normalEditTool->setShortcut(i18nc("Normal editing", "n"));
statusBar()->addWidget(m_messageLabel, 10);
statusBar()->addWidget(m_statusProgressBar, 0);
statusBar()->addPermanentWidget(toolbar);
- statusBar()->insertPermanentFixedItem("00:00:00:00", ID_TIMELINE_POS);
- statusBar()->addPermanentWidget(m_timecodeFormat);
- //statusBar()->setMaximumHeight(statusBar()->font().pointSize() * 3);
+
+ m_timeFormatButton = new KSelectAction("00:00:00:00 / 00:00:00:00", this);
+ m_timeFormatButton->addAction(i18n("hh:mm:ss:ff"));
+ m_timeFormatButton->addAction(i18n("Frames"));
+ if (KdenliveSettings::frametimecode()) m_timeFormatButton->setCurrentItem(1);
+ else m_timeFormatButton->setCurrentItem(0);
+ connect(m_timeFormatButton, SIGNAL(triggered(int)), this, SLOT(slotUpdateTimecodeFormat(int)));
+ m_timeFormatButton->setToolBarMode(KSelectAction::MenuMode);
+ toolbar->addAction(m_timeFormatButton);
+ actionWidget = toolbar->widgetForAction(m_timeFormatButton);
+ const QFontMetrics metric = toolbar->fontMetrics();
+ actionWidget->setFixedWidth(metric.width("000:00:00:00 / 00:00:00:000") + 10);
+ actionWidget->setObjectName("timecode");
+
collection.addAction("normal_mode", m_normalEditTool);
collection.addAction("overwrite_mode", m_overwriteEditTool);
fullMon->setText(i18n("Switch monitor fullscreen"));
fullMon->setIcon(KIcon("view-fullscreen"));
connect(fullMon, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotSwitchFullscreen()));
+
+ KSelectAction *interlace = new KSelectAction(i18n("Deinterlacer"), this);
+ interlace->addAction(i18n("One Field (fast)"));
+ interlace->addAction(i18n("Linear Blend (fast)"));
+ interlace->addAction(i18n("YADIF - temporal only (good)"));
+ interlace->addAction(i18n("YADIF - temporal + spacial (best)"));
+ if (KdenliveSettings::mltdeinterlacer() == "linearblend") interlace->setCurrentItem(1);
+ else if (KdenliveSettings::mltdeinterlacer() == "yadif-temporal") interlace->setCurrentItem(2);
+ else if (KdenliveSettings::mltdeinterlacer() == "yadif") interlace->setCurrentItem(3);
+ else interlace->setCurrentItem(0);
+ collection.addAction("mlt_interlace", interlace);
+ connect(interlace, SIGNAL(triggered(int)), this, SLOT(slotSetDeinterlacer(int)));
+
+ KSelectAction *interpol = new KSelectAction(i18n("Interpolation"), this);
+ interpol->addAction(i18n("Nearest Neighbor (fast)"));
+ interpol->addAction(i18n("Bilinear (good)"));
+ interpol->addAction(i18n("Bicubic (better)"));
+ interpol->addAction(i18n("Hyper/Lanczos (best)"));
+ if (KdenliveSettings::mltinterpolation() == "bilinear") interpol->setCurrentItem(1);
+ else if (KdenliveSettings::mltinterpolation() == "bicubic") interpol->setCurrentItem(2);
+ else if (KdenliveSettings::mltinterpolation() == "hyper") interpol->setCurrentItem(3);
+ else interpol->setCurrentItem(0);
+ collection.addAction("mlt_interpolation", interpol);
+ connect(interpol, SIGNAL(triggered(int)), this, SLOT(slotSetInterpolation(int)));
KAction *insertTree = collection.addAction("insert_project_tree");
insertTree->setText(i18n("Insert zone in project tree"));
QColor buttonBord = scheme.foreground(KColorScheme::LinkText).color();
QColor buttonBord2 = scheme.shade(KColorScheme::LightShade);
statusBar()->setStyleSheet(QString("QStatusBar QLabel {font-size:%1pt;} QStatusBar::item { border: 0px; font-size:%1pt;padding:0px; }").arg(statusBar()->font().pointSize()));
- QString style1 = QString("QToolBar { border: 0px } QToolButton { border-style: inset; border:1px solid transparent;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton:hover { background: %3;border-style: inset; border:1px solid %3;border-radius: 3px;} QToolButton:checked { background-color: %1; border-style: inset; border:1px solid %2;border-radius: 3px;}").arg(buttonBg.name()).arg(buttonBord.name()).arg(buttonBord2.name());
+ QString style1 = QString("QToolBar { border: 0px } QToolButton { border-style: inset; border:1px solid transparent;border-radius: 3px;margin: 0px 3px;padding: 0px;} QToolButton#timecode {padding-right:8px} QToolButton:hover { background: %3;border-style: inset; border:1px solid %3;border-radius: 3px;} QToolButton:checked { background-color: %1; border-style: inset; border:1px solid %2;border-radius: 3px;}").arg(buttonBg.name()).arg(buttonBord.name()).arg(buttonBord2.name());
statusBar()->setStyleSheet(style1);
}
if (docToClose == m_activeDocument) {
delete m_activeDocument;
m_activeDocument = NULL;
+ m_monitorManager->setDocument(m_activeDocument);
m_effectStack->clear();
m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
} else {
// Opening a compressed project file, we need to process it
kDebug()<<"Opening archive, processing";
QPointer<ArchiveWidget> ar = new ArchiveWidget(url);
- if (ar->exec() == QDialog::Accepted) openFile(KUrl(ar->extractedProjectFile()));
+ if (ar->exec() == QDialog::Accepted) {
+ openFile(KUrl(ar->extractedProjectFile()));
+ }
+ else if (!m_startUrl.isEmpty()) {
+ // we tried to open an invalid file from command line, init new project
+ newFile(false);
+ }
delete ar;
return;
}
if (!url.fileName().endsWith(".kdenlive")) {
// This is not a Kdenlive project file, abort loading
KMessageBox::sorry(this, i18n("File %1 is not a Kdenlive project file", url.path()));
+ if (!m_startUrl.isEmpty()) {
+ // we tried to open an invalid file from command line, init new project
+ newFile(false);
+ }
return;
}
m_activeDocument->setModified();
slotUpdateProxySettings();
}
- m_activeDocument->setMetadata(w->metadata());
+ if (w->metadata() != m_activeDocument->metadata()) m_activeDocument->setMetadata(w->metadata());
}
delete w;
}
KdenliveSettings::setCurrent_profile(profile);
KdenliveSettings::setProject_fps(m_activeDocument->fps());
setCaption(m_activeDocument->description(), m_activeDocument->isModified());
-
m_activeDocument->clipManager()->clearUnusedProducers();
m_monitorManager->resetProfiles(m_activeDocument->timecode());
m_transitionConfig->updateProjectFormat(m_activeDocument->mltProfile(), m_activeDocument->timecode(), m_activeDocument->tracksList());
m_commandStack->activeStack()->clear();
//Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
slotUpdateMousePosition(0);
+ m_projectList->slotReloadClip();
// We need to desactivate & reactivate monitors to get a refresh
//m_monitorManager->switchMonitors();
}
void MainWindow::slotUpdateMousePosition(int pos)
{
if (m_activeDocument)
- switch (m_timecodeFormat->currentIndex()) {
+ switch (m_timeFormatButton->currentItem()) {
case 0:
- statusBar()->changeItem(m_activeDocument->timecode().getTimecodeFromFrames(pos), ID_TIMELINE_POS);
+ m_timeFormatButton->setText(m_activeDocument->timecode().getTimecodeFromFrames(pos) + " / " + m_activeDocument->timecode().getTimecodeFromFrames(m_activeTimeline->duration()));
break;
default:
- statusBar()->changeItem(QString::number(pos), ID_TIMELINE_POS);
+ m_timeFormatButton->setText(QString::number(pos) + " / " + QString::number(m_activeTimeline->duration()));
}
}
+void MainWindow::slotUpdateProjectDuration(int pos)
+{
+ if (m_activeDocument) {
+ m_activeTimeline->setDuration(pos);
+ slotUpdateMousePosition(m_activeTimeline->projectView()->getMousePos());
+ }
+}
+
void MainWindow::slotUpdateDocumentState(bool modified)
{
if (!m_activeDocument) return;
connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), doc, SLOT(setModified()));
connect(m_clipMonitor, SIGNAL(zoneUpdated(QPoint)), doc, SLOT(setModified()));
- connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
connect(m_projectMonitor->render, SIGNAL(refreshDocumentProducers(bool, bool)), doc, SLOT(checkProjectClips(bool, bool)));
connect(doc, SIGNAL(addProjectClip(DocClipBase *, bool)), m_projectList, SLOT(slotAddClip(DocClipBase *, bool)));
m_saveAction->setEnabled(doc->isModified());
m_normalEditTool->setChecked(true);
m_activeDocument = doc;
+ connect(m_projectMonitor, SIGNAL(durationChanged(int)), this, SLOT(slotUpdateProjectDuration(int)));
+ m_monitorManager->setDocument(m_activeDocument);
m_activeTimeline->updateProjectFps();
m_activeDocument->checkProjectClips();
#ifndef Q_WS_MAC
#endif
//Update the mouse position display so it will display in DF/NDF format by default based on the project setting.
slotUpdateMousePosition(0);
- m_monitorManager->activateMonitor(Kdenlive::clipMonitor);
+
+ // Make sure monitor is visible so that it is painted black on startup
+ show();
+ m_monitorManager->activateMonitor(Kdenlive::clipMonitor, true);
// set tool to select tool
m_buttonSelectTool->setChecked(true);
}
CommentedTime marker(pos, i18n("Marker"), KdenliveSettings::default_marker_type());
QPointer<MarkerDialog> d = new MarkerDialog(clip, marker,
m_activeDocument->timecode(), i18n("Add Marker"), this);
- if (d->exec() == QDialog::Accepted)
+ if (d->exec() == QDialog::Accepted) {
m_activeTimeline->projectView()->slotAddClipMarker(id, QList <CommentedTime>() << d->newMarker());
+ QString hash = clip->getClipHash();
+ if (!hash.isEmpty()) m_activeDocument->cacheImage(hash + '#' + QString::number(d->newMarker().time().frames(m_activeDocument->fps())), d->markerImage());
+ }
delete d;
}
m_activeDocument->timecode(), i18n("Edit Marker"), this);
if (d->exec() == QDialog::Accepted) {
m_activeTimeline->projectView()->slotAddClipMarker(id, QList <CommentedTime>() <<d->newMarker());
+ QString hash = clip->getClipHash();
+ if (!hash.isEmpty()) m_activeDocument->cacheImage(hash + '#' + QString::number(d->newMarker().time().frames(m_activeDocument->fps())), d->markerImage());
if (d->newMarker().time() != pos) {
// remove old marker
oldMarker.setMarkerType(-1);
//m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
return;
}
+
+ // Check if we already have a properties dialog opened for that clip
+ QList <ClipProperties *> list = findChildren<ClipProperties *>();
+ for (int i = 0; i < list.size(); ++i) {
+ if (list.at(i)->clipId() == clip->getId()) {
+ // We have one dialog, show it
+ list.at(i)->raise();
+ return;
+ }
+ }
// any type of clip but a title
ClipProperties *dia = new ClipProperties(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
if (clip->clipType() == AV || clip->clipType() == VIDEO || clip->clipType() == PLAYLIST || clip->clipType() == SLIDESHOW) {
// request clip thumbnails
- m_activeDocument->clipManager()->requestThumbs(QString('?' + clip->getId()), QList<int>() << clip->getClipThumbFrame());
connect(m_activeDocument->clipManager(), SIGNAL(gotClipPropertyThumbnail(const QString&,QImage)), dia, SLOT(slotGotThumbnail(const QString&,QImage)));
+ connect(dia, SIGNAL(requestThumb(const QString, QList <int>)), m_activeDocument->clipManager(), SLOT(slotRequestThumbs(QString,QList<int>)));
+ m_activeDocument->clipManager()->slotRequestThumbs(QString('?' + clip->getId()), QList<int>() << clip->getClipThumbFrame());
}
connect(dia, SIGNAL(addMarkers(const QString &, QList <CommentedTime>)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, QList <CommentedTime>)));
void MainWindow::slotClipInProjectTree()
{
if (m_activeTimeline) {
- const QStringList &clipIds = m_activeTimeline->projectView()->selectedClips();
+ QStringList clipIds;
+ if (m_mainClip) clipIds << m_mainClip->clipProducer();
+ else clipIds = m_activeTimeline->projectView()->selectedClips();
if (clipIds.isEmpty())
return;
m_projectListDock->raise();
- for (int i = 0; i < clipIds.count(); i++)
- m_projectList->selectItemById(clipIds.at(i));
+ m_projectList->selectItemById(clipIds.at(0));
if (m_projectMonitor->isActive())
slotSwitchMonitors();
}
QPointer<DvdWizard> w = new DvdWizard(m_monitorManager, url, this);
w->exec();
delete w;
+ m_monitorManager->activateMonitor(Kdenlive::clipMonitor);
}
void MainWindow::slotShowTimeline(bool show)
filtername=action->data().toString();
}
m_projectList->startClipFilterJob(filtername, condition);
- /*
- if (ids.isEmpty()) {
- m_messageLabel->setMessage(i18n("No clip to transcode"), ErrorMessage);
- return;
- }
- QString destination;
- ProjectItem *item = m_projectList->getClipById(ids.at(0));
- if (ids.count() == 1) {
-
- }
- ClipStabilize *d = new ClipStabilize(destination, ids.count(), filtername);
- //connect(d, SIGNAL(addClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
- if (d->exec() == QDialog::Accepted) {
- m_projectList->slotStabilizeClipJob(ids, d->autoAddClip(), d->params(), d->desc());
- }
- delete d;*/
}
void MainWindow::slotTranscode(KUrl::List urls)
// Always insert a guide in pos 0
QDomElement chapter = doc.createElement("chapter");
chapters.insertBefore(chapter, QDomNode());
- chapter.setAttribute("title", i18n("Start"));
+ chapter.setAttribute("title", i18nc("the first in a list of chapters", "Start"));
chapter.setAttribute("time", "0");
}
// save chapters file
m_effectStack->updateTimecodeFormat();
//m_activeTimeline->projectView()->clearSelection();
m_activeTimeline->updateRuler();
+ slotUpdateMousePosition(m_activeTimeline->projectView()->getMousePos());
}
void MainWindow::slotRemoveFocus()
m_activeTimeline->projectView()->slotAlignPlayheadToMousePos();
}
+void MainWindow::slotSetDeinterlacer(int ix)
+{
+ QString value;
+ switch (ix) {
+
+ case 1:
+ value = "linearblend";
+ break;
+ case 2:
+ value = "yadif-nospatial";
+ break;
+ case 3:
+ value = "yadif";
+ break;
+ default:
+ value = "onefield";
+ }
+ KdenliveSettings::setMltdeinterlacer(value);
+ m_monitorManager->setConsumerProperty("deinterlace_method", value);
+}
+
+void MainWindow::slotSetInterpolation(int ix)
+{
+ QString value;
+ switch (ix) {
+ case 1:
+ value = "bilinear";
+ break;
+ case 2:
+ value = "bicubic";
+ break;
+ case 3:
+ value = "hyper";
+ break;
+ default:
+ value = "nearest";
+ }
+ KdenliveSettings::setMltinterpolation(value);
+ m_monitorManager->setConsumerProperty("rescale", value);
+}
+
#include "mainwindow.moc"
#ifdef DEBUG_MAINW