AbstractClipItem::AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps) :
QObject(),
QGraphicsRectItem(rect),
- m_info(info),
+ m_info(info),
m_editedKeyframe(-1),
m_selectedKeyframe(0),
m_keyframeFactor(1),
}
//kDebug()<<"// DURATION DIFF: "<<durationDiff.frames(25)<<", POS: "<<pos().x();
m_info.startPos += durationDiff;
- GenTime originalDiff = GenTime((int) (durationDiff.frames(m_fps) * speed + 0.5), m_fps);
-
+ GenTime originalDiff = GenTime((int)(durationDiff.frames(m_fps) * speed + 0.5), m_fps);
+
if (type() == AVWIDGET) {
- m_info.cropStart += durationDiff;
- m_info.originalcropStart += originalDiff;
+ m_info.cropStart += durationDiff;
+ m_info.originalcropStart += originalDiff;
}
m_info.cropDuration = m_info.cropDuration - originalDiff;
if ((int) scenePos().x() != posx) {
//kDebug()<<"////// WARNING, DIFF IN XPOS: "<<pos().x()<<" == "<<m_startPos.frames(m_fps);
GenTime diff = GenTime((int) pos().x() - posx, m_fps);
- GenTime originalDiff = GenTime((int) (diff.frames(m_fps) * speed + 0.5), m_fps);
+ GenTime originalDiff = GenTime((int)(diff.frames(m_fps) * speed + 0.5), m_fps);
if (type() == AVWIDGET) {
- m_info.cropStart += diff;
- m_info.originalcropStart += originalDiff;
- }
+ m_info.cropStart += diff;
+ m_info.originalcropStart += originalDiff;
+ }
m_info.cropDuration = m_info.cropDuration - originalDiff;
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
//kDebug()<<"// NEW START: "<<m_startPos.frames(25)<<", NW DUR: "<<m_cropDuration.frames(25);
durationDiff = GenTime() - (cropDuration() - GenTime(3, m_fps));
}
//kDebug() << "// DUR DIFF2:" << durationDiff.frames(25) << ", ADJUSTED: " << durationDiff.frames(25) * speed << ", SPED:" << speed;
- m_info.cropDuration += GenTime((int) (durationDiff.frames(m_fps) * speed + 0.5), m_fps);
+ m_info.cropDuration += GenTime((int)(durationDiff.frames(m_fps) * speed + 0.5), m_fps);
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
if (durationDiff > GenTime()) {
QList <QGraphicsItem *> collisionList = collidingItems(Qt::IntersectsItemBoundingRect);
kDebug() << "///////// CURRENT: " << startPos().frames(25) << "x" << endPos().frames(25) << ", RECT: " << rect() << "-" << pos();
kDebug() << "///////// COLLISION: " << ((AbstractClipItem *)item)->startPos().frames(25) << "x" << ((AbstractClipItem *)item)->endPos().frames(25) << ", RECT: " << ((AbstractClipItem *)item)->rect() << "-" << item->pos();*/
GenTime diff = ((AbstractClipItem *)item)->startPos() - GenTime(1, m_fps) - startPos();
- m_info.cropDuration = GenTime((int) (diff.frames(m_fps) * speed + 0.5), m_fps);
+ m_info.cropDuration = GenTime((int)(diff.frames(m_fps) * speed + 0.5), m_fps);
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
break;
}
virtual GenTime maxDuration() const;
virtual void setCropStart(GenTime pos);
-protected:
+protected:
ItemInfo m_info;
// int m_track;
int m_editedKeyframe;
int m_selectedKeyframe;
-/* GenTime m_cropStart;
- GenTime m_cropDuration;
- GenTime m_startPos;*/
+ /* GenTime m_cropStart;
+ GenTime m_cropDuration;
+ GenTime m_startPos;*/
GenTime m_maxDuration;
QMap <int, int> m_keyframes;
double m_keyframeFactor;
pen.setStyle(Qt::DotLine);
painter->setPen(pen);
for (; it != markers.end(); ++it) {
- pos = GenTime((int) ((*it).time().frames(m_fps) / m_speed + 0.5), m_fps) - cropStart();
+ pos = GenTime((int)((*it).time().frames(m_fps) / m_speed + 0.5), m_fps) - cropStart();
if (pos > GenTime()) {
if (pos > cropDuration()) break;
QLineF l(rect().x() + pos.frames(m_fps), rect().y(), rect().x() + pos.frames(m_fps), rect().bottom());
GenTime pos;
for (int i = 0; i < markers.size(); i++) {
-
- pos = GenTime((int) (markers.at(i).frames(m_fps) / m_speed + 0.5), m_fps) - cropStart();
+
+ pos = GenTime((int)(markers.at(i).frames(m_fps) / m_speed + 0.5), m_fps) - cropStart();
if (pos > GenTime()) {
if (pos > cropDuration()) break;
else snaps.append(pos + startPos());
GenTime pos;
for (int i = 0; i < markers.size(); i++) {
- pos = GenTime((int) (markers.at(i).time().frames(m_fps) / m_speed + 0.5), m_fps) - cropStart();
+ pos = GenTime((int)(markers.at(i).time().frames(m_fps) / m_speed + 0.5), m_fps) - cropStart();
if (pos > GenTime()) {
if (pos > cropDuration()) break;
else snaps.append(CommentedTime(pos + startPos(), markers.at(i).comment()));
GenTime ClipItem::maxDuration() const
{
- return GenTime((int) (m_maxDuration.frames(m_fps) / m_speed + 0.5), m_fps);
+ return GenTime((int)(m_maxDuration.frames(m_fps) / m_speed + 0.5), m_fps);
}
GenTime ClipItem::cropStart() const
{
- return GenTime((int) (m_info.originalcropStart.frames(m_fps) / m_speed + 0.5), m_fps);
+ return GenTime((int)(m_info.originalcropStart.frames(m_fps) / m_speed + 0.5), m_fps);
}
GenTime ClipItem::cropDuration() const
{
- return GenTime((int) (m_info.cropDuration.frames(m_fps) / m_speed + 0.5), m_fps);
+ return GenTime((int)(m_info.cropDuration.frames(m_fps) / m_speed + 0.5), m_fps);
}
GenTime ClipItem::endPos() const
{
QUndoCommand *delClips = new QUndoCommand();
delClips->setText(i18np("Delete clip", "Delete clips", ids.size()));
-
+
for (int i = 0; i < ids.size(); i++) {
DocClipBase *clip = getClipById(ids.at(i));
if (clip) {
m_clickPoint = QPoint((int)(mapToScene(event->pos()).x() - m_dragItem->startPos().frames(m_document->fps())), (int)(event->pos().y() - m_dragItem->pos().y()));
m_operationMode = m_dragItem->operationMode(mapToScene(event->pos()));
-
+
// Update snap points
if (m_selectionGroup == NULL) {
- if (m_operationMode == RESIZEEND || m_operationMode == RESIZESTART) updateSnapPoints(NULL);
- else updateSnapPoints(m_dragItem);
- }
- else {
+ if (m_operationMode == RESIZEEND || m_operationMode == RESIZESTART) updateSnapPoints(NULL);
+ else updateSnapPoints(m_dragItem);
+ } else {
QList <GenTime> offsetList;
QList<QGraphicsItem *> children = m_selectionGroup->childItems();
for (int i = 0; i < children.count(); i++) {
info.startPos = GenTime();
info.cropStart = GenTime(list.at(1).toInt(), m_document->fps());
info.endPos = GenTime(list.at(2).toInt() - list.at(1).toInt(), m_document->fps());
- info.cropDuration = info.endPos - info.startPos;
- info.originalcropStart = info.cropStart;
+ info.cropDuration = info.endPos - info.startPos;
+ info.originalcropStart = info.cropStart;
info.track = 0;
// Check if clip can be inserted at that position
ItemInfo pasteInfo = info;
pasteInfo.startPos = GenTime((int)(framePos.x() + 0.5), m_document->fps());
- pasteInfo.endPos = pasteInfo.startPos + info.endPos;
+ pasteInfo.endPos = pasteInfo.startPos + info.endPos;
pasteInfo.track = (int)(framePos.y() / m_tracksHeight);
if (!canBePastedTo(pasteInfo, AVWIDGET)) {
return true;
}
ItemInfo info;
info.startPos = start;
- info.cropDuration = clip->duration();
+ info.cropDuration = clip->duration();
info.endPos = info.startPos + info.cropDuration;
info.track = track;
infoList.append(info);
DocClipBase *clip = m_document->getBaseClip(ids.at(i));
ItemInfo info;
info.startPos = start;
- info.cropDuration = clip->duration();
+ info.cropDuration = clip->duration();
info.endPos = info.startPos + info.cropDuration;
info.track = 0;
start += info.cropDuration;
if (it == 0) return GenTime();
else if (it == m_snapMarkers.count() - 1 && m_snapMarkers.at(it).time() < currTime)
return m_snapMarkers.at(it).time();
- else return m_snapMarkers.at(it-1).time();
+ else return m_snapMarkers.at(it -1).time();
}
GenTime DocClipBase::findNextSnapMarker(const GenTime & currTime)
KAction* projectClean = new KAction(KIcon("edit-clear"), i18n("Clean Project"), this);
collection->addAction("project_clean", projectClean);
connect(projectClean, SIGNAL(triggered(bool)), this, SLOT(slotCleanProject()));
-
+
KAction* monitorPlay = new KAction(KIcon("media-playback-start"), i18n("Play"), this);
KShortcut playShortcut;
playShortcut.setPrimary(Qt::Key_Space);
connect(m_projectList, SIGNAL(loadingIsOver()), trackView->projectView(), SLOT(slotUpdateAllThumbs()));
connect(m_projectList, SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
-
+
trackView->projectView()->setContextMenu(m_timelineContextMenu, m_timelineContextClipMenu, m_timelineContextTransitionMenu, m_clipTypeGroup);
m_activeTimeline = trackView;
if (m_renderWidget) {
if (m_activeTimeline) {
ClipItem *item = m_activeTimeline->projectView()->getActiveClipUnderCursor();
if (item) {
- pos = GenTime((int) ((m_projectMonitor->position() - item->startPos() + item->cropStart()).frames(m_activeDocument->fps()) * item->speed() + 0.5), m_activeDocument->fps());
+ pos = GenTime((int)((m_projectMonitor->position() - item->startPos() + item->cropStart()).frames(m_activeDocument->fps()) * item->speed() + 0.5), m_activeDocument->fps());
clip = item->baseClip();
}
}
//TODO: add save zone to timeline monitor when fixed
if (m_name == "clip") {
- m_contextMenu->addMenu(m_markerMenu);
- m_contextMenu->addAction(KIcon("document-save"), i18n("Save zone"), this, SLOT(slotSaveZone()));
+ m_contextMenu->addMenu(m_markerMenu);
+ m_contextMenu->addAction(KIcon("document-save"), i18n("Save zone"), this, SLOT(slotSaveZone()));
}
QAction *extractFrame = m_configMenu->addAction(KIcon("document-new"), i18n("Extract frame"), this, SLOT(slotExtractCurrentFrame()));
m_contextMenu->addAction(extractFrame);
void Monitor::slotExtractCurrentFrame()
{
QImage frame = render->extractFrame(render->seekFramePosition());
- KFileDialog *fs = new KFileDialog(KUrl(), "image/png",this);
+ KFileDialog *fs = new KFileDialog(KUrl(), "image/png", this);
fs->setOperationMode(KFileDialog::Saving);
fs->setMode(KFile::File);
#if KDE_IS_VERSION(4,2,0)
}
if (clip != m_currentClip) {
m_currentClip = clip;
- updateMarkers(clip);
+ updateMarkers(clip);
if (render->setProducer(clip->producer(), position) == -1) {
// MLT CONSUMER is broken
emit blockMonitors();
extendItem(w,
}
*/
- void drawFocus ( QPainter *, const QStyleOptionViewItem &, const QRect & ) const {
+ void drawFocus(QPainter *, const QStyleOptionViewItem &, const QRect &) const {
}
-
+
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
if (index.column() == 1) {
QRect r1 = option.rect;
slotUpdateFiles();
connect(clear_cache, SIGNAL(clicked()), this, SLOT(slotClearCache()));
connect(delete_unused, SIGNAL(clicked()), this, SLOT(slotDeleteUnused()));
- }
- else tabWidget->widget(1)->setEnabled(false);
+ } else tabWidget->widget(1)->setEnabled(false);
connect(profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
connect(project_folder, SIGNAL(textChanged(const QString &)), this, SLOT(slotUpdateButton(const QString &)));
}
}
void ProjectSettings::slotUpdateFiles(bool cacheOnly)
-{
- KIO::DirectorySizeJob * job = KIO::directorySize( project_folder->url().path(KUrl::AddTrailingSlash) + "thumbs/" );
+{
+ KIO::DirectorySizeJob * job = KIO::directorySize(project_folder->url().path(KUrl::AddTrailingSlash) + "thumbs/");
job->exec();
thumbs_count->setText(QString::number(job->totalFiles()));
thumbs_size->setText(KIO::convertSize(job->totalSize()));
if (clip->numReferences() == 0) {
unused++;
unUsedSize += clip->fileSize();
- }
- else {
+ } else {
used++;
usedSize += clip->fileSize();
}
{
if (m_captureProcess) m_captureProcess->setWorkingDirectory(KdenliveSettings::capturefolder());
slotVideoDeviceChanged(m_ui.device_selector->currentIndex());
- kDebug()<<"// UPDATE CAPT FOLD: "<<KdenliveSettings::capturefolder();
-
+ kDebug() << "// UPDATE CAPT FOLD: " << KdenliveSettings::capturefolder();
+
#if KDE_IS_VERSION(4,2,0)
// update free space info
updatedFreeSpace();
else m_ui.video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture\nFiles will be saved in:\n%1", KdenliveSettings::capturefolder())));
}
m_isCapturing = false;
-
+
#if KDE_IS_VERSION(4,2,0)
// update free space info
KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(KdenliveSettings::capturefolder());
- if( info.isValid() ) {
+ if (info.isValid()) {
m_freeSpace->setValue(100 * info.used() / info.size());
m_freeSpace->setText(i18n("Free space: %1", KIO::convertSize(info.available())));
}
// virtual
void RecMonitor::mousePressEvent(QMouseEvent * /*event*/)
-{
+{
#if KDE_IS_VERSION(4,2,0)
if (m_freeSpace->underMouse()) updatedFreeSpace();
#endif
void RecMonitor::updatedFreeSpace()
{
KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(KdenliveSettings::capturefolder());
- if( info.isValid() ) {
+ if (info.isValid()) {
m_freeSpace->setValue(100 * info.used() / info.size());
m_freeSpace->setText(i18n("Free space: %1", KIO::convertSize(info.available())));
m_freeSpace->update();
QString m_name;
bool m_isActive;
KDateTime m_captureTime;
-
+
#if KDE_IS_VERSION(4,2,0)
KCapacityBar *m_freeSpace;
#endif
void checkDeviceAvailability();
QPixmap mergeSideBySide(const QPixmap& pix, const QString txt);
void manageCapturedFiles();
-
+
#if KDE_IS_VERSION(4,2,0)
void updatedFreeSpace();
#endif
if (trackPlaylist.type() == playlist_type) trackPlaylist.clear();
trackNb--;
}
- delete field;
+ delete field;
}
mlt_service_unlock(service.get_service());
}
ct++;
filter = sourceService.filter(ct);
- }
+ }
mltRemoveClip(info.track, info.startPos);
mltInsertClip(info, element, prod);
if (!filtersList.isEmpty()) {
Mlt::Producer *cut;
GenTime duration = info.cropDuration;
- int originalStart = (int)(info.originalcropStart.frames(m_fps));
+ int originalStart = (int)(info.originalcropStart.frames(m_fps));
if (clipIndex + 1 < trackPlaylist.count() && (info.startPos + info.cropDuration).frames(m_fps) > blankEnd) {
GenTime maxLength = GenTime(blankEnd, m_fps) - info.startPos;
cut = prod->cut(originalStart, (int)(originalStart + maxLength.frames(m_fps) - 1));
}
Mlt::Producer *clip = trackPlaylist.replace_with_blank(clipIndex);
trackPlaylist.consolidate_blanks(0);
-
- GenTime duration = info.cropDuration / speed;
- int originalStart = (int)(info.originalcropStart.frames(m_fps) / speed);
+
+ GenTime duration = info.cropDuration / speed;
+ int originalStart = (int)(info.originalcropStart.frames(m_fps) / speed);
// Check that the blank space is long enough for our new duration
clipIndex = trackPlaylist.get_clip_index_at(startPos);
// move all effects to the correct producer
mltPasteEffects(clipProducer, clip);
-
+
int newIndex = destTrackPlaylist.insert_at(moveEnd, clip, 1);
-
+
if (clip == clipProducer) {
delete clip;
clip = NULL;
const QStringList acodecsList = KdenliveSettings::audiocodecs();
bool replaceVorbisCodec = false;
if (!acodecsList.contains("vorbis") && acodecsList.contains("libvorbis")) replaceVorbisCodec = true;
- bool replaceLibfaacCodec = false;
- if (!acodecsList.contains("libfaac") && acodecsList.contains("aac")) replaceLibfaacCodec = true;
+ bool replaceLibfaacCodec = false;
+ if (!acodecsList.contains("libfaac") && acodecsList.contains("aac")) replaceLibfaacCodec = true;
if (editable || groups.count() == 0) {
// replace vorbis with libvorbis
params = params.replace("vorbis", "libvorbis");
}
- if (replaceLibfaacCodec && params.contains("acodec=libfaac")) {
- // replace libfaac with aac
- params = params.replace("libfaac", "aac");
- }
+ if (replaceLibfaacCodec && params.contains("acodec=libfaac")) {
+ // replace libfaac with aac
+ params = params.replace("libfaac", "aac");
+ }
QString category = profile.attribute("category", i18n("Custom"));
QString dest = profile.attribute("destinationid");
// replace vorbis with libvorbis
params = params.replace("vorbis", "libvorbis");
}
- if (replaceLibfaacCodec && params.contains("acodec=libfaac")) {
- // replace libfaac with aac
- params = params.replace("libfaac", "aac");
- }
+ if (replaceLibfaacCodec && params.contains("acodec=libfaac")) {
+ // replace libfaac with aac
+ params = params.replace("libfaac", "aac");
+ }
- prof_extension = profileElement.attribute("extension");
+ prof_extension = profileElement.attribute("extension");
if (!prof_extension.isEmpty()) extension = prof_extension;
item = new QListWidgetItem(profileName, m_view.size_list);
item->setData(GroupRole, groupName);
const int zoneStart = (int)(m_zoneStart * m_scale);
const int zoneEnd = (int)(m_zoneEnd * m_scale);
p.fillRect(zoneStart, height() / 2 - 1, zoneEnd - zoneStart, height() / 2, m_zoneColor);
-
+
// draw markers
if (!m_markers.isEmpty()) {
p.setPen(Qt::red);
// draw the little marks
fend = m_scale * m_small;
if (fend > 2) for (f = 0; f < width(); f += fend) {
- p.drawLine((int)f, 0, (int)f, 3);
- }
+ p.drawLine((int)f, 0, (int)f, 3);
+ }
// draw medium marks
fend = m_scale * m_medium;
if (fend > 2) for (f = 0; f < width(); f += fend) {
- p.drawLine((int)f, 0, (int)f, 6);
- }
+ p.drawLine((int)f, 0, (int)f, 6);
+ }
p.end();
update();
}
if (anim_start->isChecked()) slotAnimStart(false);
if (anim_end->isChecked()) slotAnimEnd(false);
if (url.isEmpty()) {
- KFileDialog *fs = new KFileDialog(KUrl(m_projectTitlePath), "application/x-kdenlivetitle",this);
+ KFileDialog *fs = new KFileDialog(KUrl(m_projectTitlePath), "application/x-kdenlivetitle", this);
fs->setOperationMode(KFileDialog::Saving);
fs->setMode(KFile::File);
#if KDE_IS_VERSION(4,2,0)
clipinfo.startPos = GenTime(position, m_doc->fps());
clipinfo.endPos = clipinfo.startPos + GenTime(out - in + 1, m_doc->fps());
clipinfo.cropStart = GenTime(in, m_doc->fps());
- clipinfo.cropDuration = GenTime((int) ((clipinfo.endPos - clipinfo.startPos).frames(m_doc->fps()) * speed + 0.5), m_doc->fps());
- clipinfo.originalcropStart = GenTime((int) ((clipinfo.cropStart).frames(m_doc->fps()) * speed + 0.5), m_doc->fps());
-
+ clipinfo.cropDuration = GenTime((int)((clipinfo.endPos - clipinfo.startPos).frames(m_doc->fps()) * speed + 0.5), m_doc->fps());
+ clipinfo.originalcropStart = GenTime((int)((clipinfo.cropStart).frames(m_doc->fps()) * speed + 0.5), m_doc->fps());
+
clipinfo.track = ix;
//kDebug() << "// INSERTING CLIP: " << in << "x" << out << ", track: " << ix << ", ID: " << id << ", SCALE: " << m_scale << ", FPS: " << m_doc->fps();
ClipItem *item = new ClipItem(clip, clipinfo, m_doc->fps(), speed, strobe, false);